@zuplo/runtime 7.1.9 → 7.1.10

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.
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{b as l}from"../chunk-RAZK5G27.js";import{_ as n}from"../chunk-4POCC75H.js";import{a as o}from"../chunk-TYV53J3B.js";function g(u={request:new Request("https://api.example.com")}){let e=[];function t(r){e.push(Promise.resolve(r))}return o(t,"waitUntil"),{context:new s({event:{waitUntil:t},route:u.route}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(g,"createMockContext");var a={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},s=class extends EventTarget{static{o(this,"MockZuploContext")}#e;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=a,parentContext:i}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:n.console.info,log:n.console.log,debug:n.console.debug,warn:n.console.warn,error:n.console.error,setLogProperties:o(()=>{},"setLogProperties")},this.custom={},this.route=t,this.incomingRequestProperties={ip:"203.0.113.7",asn:1234,asOrganization:"ORGANIZATION",city:"Seattle",region:"Washington",regionCode:"WA",colo:"SEA",continent:"NA",country:"US",postalCode:"98004",metroCode:"SEA",latitude:void 0,longitude:void 0,timezone:void 0,httpProtocol:void 0,clientCert:void 0,clientMtlsVerificationStatus:void 0,clientMtlsVerificationReason:void 0,clientCertFingerprintSha256:void 0,clientCertNotBefore:void 0,clientCertNotAfter:void 0,clientCertIssuerDn:void 0,clientCertSubjectDn:void 0},this.parentContext=i,this.#e=e,this.analyticsContext=new l(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,i){throw new Error("Not implemented")}invokeRoute(e,t){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addEventListener(e,t,i){let d=o(r=>{try{typeof t=="function"?t(r):t.handleEvent(r)}catch(p){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),p}},"wrapped");super.addEventListener(e,d,i)}};export{s as MockZuploContext,g as createMockContext};
25
+ import{b as l}from"../chunk-4VE55TG3.js";import{_ as n}from"../chunk-4POCC75H.js";import{a as o}from"../chunk-TYV53J3B.js";function g(u={request:new Request("https://api.example.com")}){let e=[];function t(r){e.push(Promise.resolve(r))}return o(t,"waitUntil"),{context:new s({event:{waitUntil:t},route:u.route}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(g,"createMockContext");var a={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},s=class extends EventTarget{static{o(this,"MockZuploContext")}#e;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=a,parentContext:i}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:n.console.info,log:n.console.log,debug:n.console.debug,warn:n.console.warn,error:n.console.error,setLogProperties:o(()=>{},"setLogProperties")},this.custom={},this.route=t,this.incomingRequestProperties={ip:"203.0.113.7",asn:1234,asOrganization:"ORGANIZATION",city:"Seattle",region:"Washington",regionCode:"WA",colo:"SEA",continent:"NA",country:"US",postalCode:"98004",metroCode:"SEA",latitude:void 0,longitude:void 0,timezone:void 0,httpProtocol:void 0,clientCert:void 0,clientMtlsVerificationStatus:void 0,clientMtlsVerificationReason:void 0,clientCertFingerprintSha256:void 0,clientCertNotBefore:void 0,clientCertNotAfter:void 0,clientCertIssuerDn:void 0,clientCertSubjectDn:void 0},this.parentContext=i,this.#e=e,this.analyticsContext=new l(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,i){throw new Error("Not implemented")}invokeRoute(e,t){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addEventListener(e,t,i){let d=o(r=>{try{typeof t=="function"?t(r):t.handleEvent(r)}catch(p){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),p}},"wrapped");super.addEventListener(e,d,i)}};export{s as MockZuploContext,g as createMockContext};
26
26
  //# sourceMappingURL=index.js.map
@@ -960,10 +960,14 @@ export declare interface AIGatewaySemanticCacheOutboundPolicyOptions {}
960
960
  * response-sending hook to write the upstream response back into the cache —
961
961
  * matching the firewall's single-policy shape (no separate outbound policy).
962
962
  *
963
- * Caching parameters (semanticTolerance, expirationSecondsTtl, namespace) come
964
- * from the policy options, and presence in the route's chain is what enables
965
- * it. An id from the authenticated app configuration always provides the cache
966
- * namespace so application-supplied options cannot cross tenant partitions.
963
+ * Caching parameters (semanticTolerance, expirationSecondsTtl, namespace,
964
+ * recentMessageCount) come from the policy options, and presence in the
965
+ * route's chain is what enables it. An id from the authenticated app
966
+ * configuration always provides the cache namespace so application-supplied
967
+ * options cannot cross tenant partitions. The cache key covers the system
968
+ * prompt plus the last `recentMessageCount` messages (default 1) — applied
969
+ * when storing and when matching — so multi-turn conversations can hit
970
+ * entries cached from earlier, shorter ones.
967
971
  *
968
972
  * Cache outcomes are reported on the response via the RFC 9211 `Cache-Status`
969
973
  * header under the cache name `zp-aigw-sem-cache` (hit:
@@ -997,6 +1001,7 @@ export declare interface AIGatewaySemanticCacheV2InboundPolicyOptions {
997
1001
  semanticTolerance?: SemanticTolerance;
998
1002
  expirationSecondsTtl?: CacheTTLSeconds;
999
1003
  namespace?: CacheNamespace;
1004
+ recentMessageCount?: RecentMessageCount;
1000
1005
  maxConversationLength?: MaxConversationLength;
1001
1006
  endpoints?: ApplicableEndpoints;
1002
1007
  onUnknownShape?: OnUnknownShape;
@@ -1837,7 +1842,7 @@ declare interface APITokenCredentialConfig {
1837
1842
  }
1838
1843
 
1839
1844
  /**
1840
- * The endpoint shapes to cache. Defaults to ['openai-chat', 'anthropic-messages']; OpenAI Responses remains unsupported.
1845
+ * The endpoint shapes to cache. Defaults to all shapes: ['openai-chat', 'anthropic-messages', 'openai-responses'].
1841
1846
  * @public
1842
1847
  */
1843
1848
  declare type ApplicableEndpoints = (
@@ -4917,6 +4922,7 @@ declare const EventType: {
4917
4922
  readonly MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_auth_upstream_reconsent_required";
4918
4923
  readonly GRAPHQL_OPERATION: "graphql_operation";
4919
4924
  readonly CACHE_OPERATION: "cache_operation";
4925
+ readonly HANDLER_EXECUTION: "handler_execution";
4920
4926
  };
4921
4927
 
4922
4928
  declare type EventType = (typeof EventType)[keyof typeof EventType];
@@ -8046,7 +8052,7 @@ declare type LokiTransportVersion = 1 | 2;
8046
8052
  /* Excluded from this release type: LookupResult */
8047
8053
 
8048
8054
  /**
8049
- * Skip caching requests whose message count exceeds this value. Longer conversations rarely repeat and dilute cache quality. Defaults to 3.
8055
+ * Skip caching entirely when the conversation has more than this many messages. Unset by default (no limit). Set a bound to guard against topic drift: the cache key covers only the last recentMessageCount messages, so the deeper a conversation goes, the more likely a match on recent messages alone ignores earlier context that should change the answer.
8050
8056
  * @public
8051
8057
  */
8052
8058
  declare type MaxConversationLength = number;
@@ -12339,6 +12345,12 @@ export declare function ReadmeMetricsInboundPolicy(
12339
12345
  policyName: string
12340
12346
  ): Promise<ZuploRequest<RequestGeneric>>;
12341
12347
 
12348
+ /**
12349
+ * How many of the conversation's most recent messages (input items on the Responses endpoint) form the cache key, both when storing a response and when matching later requests. Earlier messages are ignored, so a multi-turn conversation can hit an entry cached from a shorter one; system messages are always included. Requests whose keyed window contains no user message (for example a conversation ending in an assistant prefill) are not cached. Defaults to 1 (match on the newest message only).
12350
+ * @public
12351
+ */
12352
+ declare type RecentMessageCount = number;
12353
+
12342
12354
  /**
12343
12355
  * Record the GraphQL response-cache outcome for the in-flight operation so
12344
12356
  * the analytics middleware can emit it as the `cacheState` dimension on the
@@ -208,6 +208,7 @@ declare const EventType: {
208
208
  readonly MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_auth_upstream_reconsent_required";
209
209
  readonly GRAPHQL_OPERATION: "graphql_operation";
210
210
  readonly CACHE_OPERATION: "cache_operation";
211
+ readonly HANDLER_EXECUTION: "handler_execution";
211
212
  };
212
213
 
213
214
  declare type EventType = (typeof EventType)[keyof typeof EventType];
@@ -138,6 +138,7 @@ declare const EventType: {
138
138
  readonly MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_auth_upstream_reconsent_required";
139
139
  readonly GRAPHQL_OPERATION: "graphql_operation";
140
140
  readonly CACHE_OPERATION: "cache_operation";
141
+ readonly HANDLER_EXECUTION: "handler_execution";
141
142
  };
142
143
 
143
144
  declare type EventType = (typeof EventType)[keyof typeof EventType];
@@ -198,6 +198,7 @@ declare const EventType: {
198
198
  readonly MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_auth_upstream_reconsent_required";
199
199
  readonly GRAPHQL_OPERATION: "graphql_operation";
200
200
  readonly CACHE_OPERATION: "cache_operation";
201
+ readonly HANDLER_EXECUTION: "handler_execution";
201
202
  };
202
203
 
203
204
  declare type EventType = (typeof EventType)[keyof typeof EventType];
@@ -113,6 +113,7 @@ declare const EventType: {
113
113
  readonly MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_auth_upstream_reconsent_required";
114
114
  readonly GRAPHQL_OPERATION: "graphql_operation";
115
115
  readonly CACHE_OPERATION: "cache_operation";
116
+ readonly HANDLER_EXECUTION: "handler_execution";
116
117
  };
117
118
 
118
119
  declare type EventType = (typeof EventType)[keyof typeof EventType];
@@ -357,6 +357,7 @@ declare const EventType: {
357
357
  readonly MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_auth_upstream_reconsent_required";
358
358
  readonly GRAPHQL_OPERATION: "graphql_operation";
359
359
  readonly CACHE_OPERATION: "cache_operation";
360
+ readonly HANDLER_EXECUTION: "handler_execution";
360
361
  };
361
362
 
362
363
  declare type EventType = (typeof EventType)[keyof typeof EventType];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "7.1.9",
4
+ "version": "7.1.10",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {