@zuplo/cli 7.14.6 → 7.15.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.
Files changed (85) hide show
  1. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/general/decrypt.js +3 -2
  2. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
  3. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/general/verify.js +2 -8
  4. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +11 -8
  5. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key_management.js +0 -1
  6. package/node_modules/@modelcontextprotocol/client/node_modules/jose/package.json +1 -1
  7. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/decrypt.js +3 -2
  8. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
  9. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/general/verify.js +2 -8
  10. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +11 -8
  11. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_management.js +0 -1
  12. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/package.json +1 -1
  13. package/node_modules/@zuplo/core/customer.cli.minified.js +95 -95
  14. package/node_modules/@zuplo/core/index.minified.js +100 -100
  15. package/node_modules/@zuplo/core/package.json +1 -1
  16. package/node_modules/@zuplo/core/zeno.js +1 -1
  17. package/node_modules/@zuplo/graphql/package.json +1 -1
  18. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  19. package/node_modules/@zuplo/otel/package.json +1 -1
  20. package/node_modules/@zuplo/runtime/out/esm/{chunk-JORDKCQ5.js → chunk-F4G3YEN2.js} +97 -97
  21. package/node_modules/@zuplo/runtime/out/esm/chunk-F4G3YEN2.js.map +1 -0
  22. package/node_modules/@zuplo/runtime/out/esm/{chunk-AEVCZW3D.js → chunk-GWGCD6Z7.js} +2 -2
  23. package/node_modules/@zuplo/runtime/out/esm/{chunk-LDA754KZ.js → chunk-HTXNM72E.js} +2 -2
  24. package/node_modules/@zuplo/runtime/out/esm/chunk-M4IZPJP6.js +37 -0
  25. package/node_modules/@zuplo/runtime/out/esm/{chunk-VIH2ISEH.js.map → chunk-M4IZPJP6.js.map} +1 -1
  26. package/node_modules/@zuplo/runtime/out/esm/{chunk-G2O2ZIL3.js → chunk-SX6JF7A6.js} +2 -2
  27. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  28. package/node_modules/@zuplo/runtime/out/esm/mcp/messages/index.js +1 -1
  29. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +8 -8
  30. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
  31. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  32. package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js +1 -1
  33. package/node_modules/@zuplo/runtime/out/types/index.d.ts +14 -5
  34. package/node_modules/@zuplo/runtime/out/types/internal/index.d.ts +14 -5
  35. package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +40 -0
  36. package/node_modules/@zuplo/runtime/package.json +1 -1
  37. package/node_modules/ansi-regex/index.js +22 -17
  38. package/node_modules/ansi-regex/package.json +1 -1
  39. package/node_modules/ansi-regex/readme.md +8 -0
  40. package/node_modules/hono/dist/adapter/aws-lambda/handler.js +1 -1
  41. package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +1 -1
  42. package/node_modules/hono/dist/cjs/adapter/bun/serve-static.js +1 -1
  43. package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +1 -1
  44. package/node_modules/hono/dist/cjs/client/fetch-result-please.js +1 -1
  45. package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +2 -1
  46. package/node_modules/hono/dist/cjs/helper/ssg/ssg.js +5 -3
  47. package/node_modules/hono/dist/cjs/jsx/base.js +49 -30
  48. package/node_modules/hono/dist/cjs/jsx/components.js +2 -2
  49. package/node_modules/hono/dist/cjs/jsx/constants.js +2 -0
  50. package/node_modules/hono/dist/cjs/jsx/jsx-runtime.js +13 -17
  51. package/node_modules/hono/dist/cjs/middleware/etag/index.js +3 -1
  52. package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +1 -0
  53. package/node_modules/hono/dist/cjs/middleware/timing/timing.js +4 -3
  54. package/node_modules/hono/dist/cjs/utils/cookie.js +2 -2
  55. package/node_modules/hono/dist/cjs/utils/mime.js +1 -1
  56. package/node_modules/hono/dist/cjs/utils/url.js +1 -1
  57. package/node_modules/hono/dist/client/fetch-result-please.js +1 -1
  58. package/node_modules/hono/dist/helper/accepts/accepts.js +2 -1
  59. package/node_modules/hono/dist/helper/ssg/ssg.js +5 -3
  60. package/node_modules/hono/dist/jsx/base.js +49 -32
  61. package/node_modules/hono/dist/jsx/components.js +2 -2
  62. package/node_modules/hono/dist/jsx/constants.js +2 -1
  63. package/node_modules/hono/dist/jsx/jsx-runtime.js +15 -19
  64. package/node_modules/hono/dist/middleware/etag/index.js +3 -1
  65. package/node_modules/hono/dist/middleware/language/language.js +1 -1
  66. package/node_modules/hono/dist/middleware/pretty-json/index.js +1 -0
  67. package/node_modules/hono/dist/middleware/timing/timing.js +4 -3
  68. package/node_modules/hono/dist/types/helper/factory/index.d.ts +1 -1
  69. package/node_modules/hono/dist/types/helper/ssg/ssg.d.ts +6 -1
  70. package/node_modules/hono/dist/types/jsx/base.d.ts +4 -2
  71. package/node_modules/hono/dist/types/jsx/constants.d.ts +1 -0
  72. package/node_modules/hono/dist/types/jsx/jsx-runtime.d.ts +2 -1
  73. package/node_modules/hono/dist/types/utils/cookie.d.ts +1 -1
  74. package/node_modules/hono/dist/utils/cookie.js +2 -2
  75. package/node_modules/hono/dist/utils/mime.js +1 -1
  76. package/node_modules/hono/dist/utils/url.js +1 -1
  77. package/node_modules/hono/package.json +1 -1
  78. package/package.json +11 -11
  79. package/node_modules/@zuplo/runtime/out/esm/chunk-JORDKCQ5.js.map +0 -1
  80. package/node_modules/@zuplo/runtime/out/esm/chunk-VIH2ISEH.js +0 -37
  81. /package/node_modules/@zuplo/runtime/out/esm/{chunk-JORDKCQ5.js.LEGAL.txt → chunk-F4G3YEN2.js.LEGAL.txt} +0 -0
  82. /package/node_modules/@zuplo/runtime/out/esm/{chunk-AEVCZW3D.js.map → chunk-GWGCD6Z7.js.map} +0 -0
  83. /package/node_modules/@zuplo/runtime/out/esm/{chunk-LDA754KZ.js.map → chunk-HTXNM72E.js.map} +0 -0
  84. /package/node_modules/@zuplo/runtime/out/esm/{chunk-VIH2ISEH.js.LEGAL.txt → chunk-M4IZPJP6.js.LEGAL.txt} +0 -0
  85. /package/node_modules/@zuplo/runtime/out/esm/{chunk-G2O2ZIL3.js.map → chunk-SX6JF7A6.js.map} +0 -0
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{G as p,M as c,Q as u}from"../chunk-JORDKCQ5.js";import"../chunk-VP5Q3DEN.js";import{a as d}from"../chunk-AEVCZW3D.js";import"../chunk-A3QGJZO7.js";import"../chunk-G2O2ZIL3.js";import"../chunk-UKQQD2JN.js";import{aa as i}from"../chunk-VIH2ISEH.js";import{a as o}from"../chunk-TYV53J3B.js";function w(l={request:new Request("https://api.example.com")}){let e=[];function t(s){e.push(Promise.resolve(s))}return o(t,"waitUntil"),{context:new a({event:{waitUntil:t},route:l.route,originalRequest:l.request}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(w,"createMockContext");var g={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},a=class extends EventTarget{static{o(this,"MockZuploContext")}#e;#t;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=g,parentContext:n,originalRequest:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:i.console.info,log:i.console.log,debug:i.console.debug,warn:i.console.warn,error:i.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=n,this.#e=e,this.#t=r,this.analyticsContext=new c(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,n){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")}addPreRequestHandler(e,t){let n;try{n=u.getContextExtensions(this)}catch{n=u.initialize(this,new d(this.#t??new Request("https://api.example.com")))}n.preRequestPhase??="active",p(this,n,e,t)}get preRequestHandlers(){let e;try{e=u.getContextExtensions(this)}catch{return[]}return(e.preRequestState?.entries??[]).map(t=>({policyName:t.policyName,name:t.name}))}addEventListener(e,t,n){let r=o(s=>{try{typeof t=="function"?t(s):t.handleEvent(s)}catch(m){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),m}},"wrapped");super.addEventListener(e,r,n)}};export{a as MockZuploContext,w as createMockContext};
25
+ import{G as p,M as c,Q as u}from"../chunk-F4G3YEN2.js";import"../chunk-VP5Q3DEN.js";import{a as d}from"../chunk-GWGCD6Z7.js";import"../chunk-A3QGJZO7.js";import"../chunk-SX6JF7A6.js";import"../chunk-UKQQD2JN.js";import{aa as i}from"../chunk-M4IZPJP6.js";import{a as o}from"../chunk-TYV53J3B.js";function w(l={request:new Request("https://api.example.com")}){let e=[];function t(s){e.push(Promise.resolve(s))}return o(t,"waitUntil"),{context:new a({event:{waitUntil:t},route:l.route,originalRequest:l.request}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(w,"createMockContext");var g={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},a=class extends EventTarget{static{o(this,"MockZuploContext")}#e;#t;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=g,parentContext:n,originalRequest:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:i.console.info,log:i.console.log,debug:i.console.debug,warn:i.console.warn,error:i.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=n,this.#e=e,this.#t=r,this.analyticsContext=new c(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,n){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")}addPreRequestHandler(e,t){let n;try{n=u.getContextExtensions(this)}catch{n=u.initialize(this,new d(this.#t??new Request("https://api.example.com")))}n.preRequestPhase??="active",p(this,n,e,t)}get preRequestHandlers(){let e;try{e=u.getContextExtensions(this)}catch{return[]}return(e.preRequestState?.entries??[]).map(t=>({policyName:t.policyName,name:t.name}))}addEventListener(e,t,n){let r=o(s=>{try{typeof t=="function"?t(s):t.handleEvent(s)}catch(m){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),m}},"wrapped");super.addEventListener(e,r,n)}};export{a as MockZuploContext,w as createMockContext};
26
26
  //# sourceMappingURL=index.js.map
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{H as a,I as l,J as c,K as o,N as p,O as y,P as m}from"../../chunk-G2O2ZIL3.js";import"../../chunk-UKQQD2JN.js";import"../../chunk-VIH2ISEH.js";import{a as i}from"../../chunk-TYV53J3B.js";async function g(r,e){let t=typeof e.credentials=="function"?await e.credentials():e.credentials,n=r.method,d=n!=="GET"&&n!=="HEAD"&&r.body!=null?await r.arrayBuffer():null,s=await new o({method:n,url:r.url,headers:r.headers,body:d,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,sessionToken:t.sessionToken,service:e.service,region:e.region,signQuery:e.signQuery}).sign();return new Request(s.url.toString(),{method:s.method,headers:s.headers,body:s.body})}i(g,"signRequest");export{c as AwsClient,o as AwsV4Signer,p as fromTemporaryCredentials,y as fromWebToken,m as fromZuploIdentity,l as getAwsCredentialProvider,a as setAwsCredentialProvider,g as signRequest};
25
+ import{H as a,I as l,J as c,K as o,N as p,O as y,P as m}from"../../chunk-SX6JF7A6.js";import"../../chunk-UKQQD2JN.js";import"../../chunk-M4IZPJP6.js";import{a as i}from"../../chunk-TYV53J3B.js";async function g(r,e){let t=typeof e.credentials=="function"?await e.credentials():e.credentials,n=r.method,d=n!=="GET"&&n!=="HEAD"&&r.body!=null?await r.arrayBuffer():null,s=await new o({method:n,url:r.url,headers:r.headers,body:d,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,sessionToken:t.sessionToken,service:e.service,region:e.region,signQuery:e.signQuery}).sign();return new Request(s.url.toString(),{method:s.method,headers:s.headers,body:s.body})}i(g,"signRequest");export{c as AwsClient,o as AwsV4Signer,p as fromTemporaryCredentials,y as fromWebToken,m as fromZuploIdentity,l as getAwsCredentialProvider,a as setAwsCredentialProvider,g as signRequest};
26
26
  //# sourceMappingURL=index.js.map
@@ -4352,9 +4352,11 @@ declare interface CompatibilityFlags {
4352
4352
  * precompiled Ajv validators from the OpenAPI document, validated per the
4353
4353
  * dialect and OpenAPI version they declare (specs/mcp-tool-schemas.md), and
4354
4354
  * `prompts/list` also lists the arguments behind a prompt schema's `$ref`
4355
- * and `allOf`. `request-validation-inbound` validates with the same dialect,
4356
- * `format` and pattern rules, and keeps its parameter type coercion
4357
- * (specs/compat-improved-schema-validation.md).
4355
+ * and `allOf`. A tool set to `toolInputStyle: "flat"` whose input can't be
4356
+ * fully flattened fails the build instead of staying nested
4357
+ * (specs/mcp-flat-input.md FLAT-18). `request-validation-inbound` validates
4358
+ * with the same dialect, `format` and pattern rules, and keeps its parameter
4359
+ * type coercion (specs/compat-improved-schema-validation.md).
4358
4360
  *
4359
4361
  * @compatibilityDate 2026-11-06
4360
4362
  */
@@ -4433,10 +4435,11 @@ declare interface CompatibilityFlags {
4433
4435
  omitMcpFieldsNewerThanNegotiatedVersion: boolean;
4434
4436
  /**
4435
4437
  * Whether built-in policies treat an empty or whitespace-only value for an
4436
- * optional string option as if the option were left out.
4438
+ * optional string option as if the option were left out, and reject one for
4439
+ * a required string option.
4437
4440
  *
4438
4441
  * `$env(VAR)` with `VAR` defined but empty reaches a policy as `""`, so this
4439
- * decides what an empty environment variable does to an optional option.
4442
+ * decides what an empty environment variable does to a policy option.
4440
4443
  *
4441
4444
  * Before this flag: Many policies reject `""`. Some fail every request with
4442
4445
  * a `ConfigurationError` (for example `http-deprecation-outbound` `link`,
@@ -4451,6 +4454,12 @@ declare interface CompatibilityFlags {
4451
4454
  * current behavior. `BLANK_IS_NOT_UNSET` in
4452
4455
  * `policies/optional-string-options.spec.ts` lists them with the reason.
4453
4456
  *
4457
+ * A required string option that is empty or whitespace-only fails with a
4458
+ * `ConfigurationError` naming the option when the policy is created, instead
4459
+ * of being sent as a blank credential, host or header. Required options
4460
+ * where an empty value means something (`replace-string-outbound`
4461
+ * `replaceWith`, `set-body-inbound` `body`) are used as given.
4462
+ *
4454
4463
  * @compatibilityDate 2026-11-06
4455
4464
  */
4456
4465
  treatBlankOptionalStringOptionsAsUnset: boolean;
@@ -223,9 +223,11 @@ declare interface CompatibilityFlags {
223
223
  * precompiled Ajv validators from the OpenAPI document, validated per the
224
224
  * dialect and OpenAPI version they declare (specs/mcp-tool-schemas.md), and
225
225
  * `prompts/list` also lists the arguments behind a prompt schema's `$ref`
226
- * and `allOf`. `request-validation-inbound` validates with the same dialect,
227
- * `format` and pattern rules, and keeps its parameter type coercion
228
- * (specs/compat-improved-schema-validation.md).
226
+ * and `allOf`. A tool set to `toolInputStyle: "flat"` whose input can't be
227
+ * fully flattened fails the build instead of staying nested
228
+ * (specs/mcp-flat-input.md FLAT-18). `request-validation-inbound` validates
229
+ * with the same dialect, `format` and pattern rules, and keeps its parameter
230
+ * type coercion (specs/compat-improved-schema-validation.md).
229
231
  *
230
232
  * @compatibilityDate 2026-11-06
231
233
  */
@@ -304,10 +306,11 @@ declare interface CompatibilityFlags {
304
306
  omitMcpFieldsNewerThanNegotiatedVersion: boolean;
305
307
  /**
306
308
  * Whether built-in policies treat an empty or whitespace-only value for an
307
- * optional string option as if the option were left out.
309
+ * optional string option as if the option were left out, and reject one for
310
+ * a required string option.
308
311
  *
309
312
  * `$env(VAR)` with `VAR` defined but empty reaches a policy as `""`, so this
310
- * decides what an empty environment variable does to an optional option.
313
+ * decides what an empty environment variable does to a policy option.
311
314
  *
312
315
  * Before this flag: Many policies reject `""`. Some fail every request with
313
316
  * a `ConfigurationError` (for example `http-deprecation-outbound` `link`,
@@ -322,6 +325,12 @@ declare interface CompatibilityFlags {
322
325
  * current behavior. `BLANK_IS_NOT_UNSET` in
323
326
  * `policies/optional-string-options.spec.ts` lists them with the reason.
324
327
  *
328
+ * A required string option that is empty or whitespace-only fails with a
329
+ * `ConfigurationError` naming the option when the policy is created, instead
330
+ * of being sent as a blank credential, host or header. Required options
331
+ * where an empty value means something (`replace-string-outbound`
332
+ * `replaceWith`, `set-body-inbound` `body`) are used as given.
333
+ *
325
334
  * @compatibilityDate 2026-11-06
326
335
  */
327
336
  treatBlankOptionalStringOptionsAsUnset: boolean;
@@ -2925,6 +2925,46 @@ export declare function McpProxyHandler(
2925
2925
  context: ZuploContext
2926
2926
  ): Promise<Response>;
2927
2927
 
2928
+ /**
2929
+ * OpenTelemetry options for the MCP Gateway's `McpProxyHandler`, set under
2930
+ * `telemetry` in the route's handler options. The same options as the MCP
2931
+ * Server handler's `telemetry`.
2932
+ */
2933
+ export declare interface McpProxyHandlerTelemetryOptions {
2934
+ /**
2935
+ * Record tool call content on the MCP SERVER and CLIENT spans of a
2936
+ * forwarded `tools/call`: the arguments the client sent as
2937
+ * `gen_ai.tool.call.arguments` and, when the upstream returns a result
2938
+ * without `isError: true`, that result as `gen_ai.tool.call.result`. Both
2939
+ * are JSON strings capped at 8192 UTF-16 code units.
2940
+ *
2941
+ * Off by default. Tool arguments and results often contain personal or
2942
+ * otherwise sensitive data, and enabling this sends them to your telemetry
2943
+ * backend.
2944
+ *
2945
+ * The gateway records content only for a `tools/call` it forwards upstream.
2946
+ * A call a gateway policy answers itself (for example, by asking the client
2947
+ * to connect the upstream) records neither attribute. A result is recorded
2948
+ * when the JSON response, or the SSE event that carries it, is 1 MiB or
2949
+ * less; a larger result is forwarded to the client but not recorded.
2950
+ *
2951
+ * @example
2952
+ * ```json
2953
+ * {
2954
+ * "handler": {
2955
+ * "export": "McpProxyHandler",
2956
+ * "module": "$import(@zuplo/runtime/mcp-gateway)",
2957
+ * "options": {
2958
+ * "rewritePattern": "https://mcp.example.com/mcp",
2959
+ * "telemetry": { "captureToolCallContent": true }
2960
+ * }
2961
+ * }
2962
+ * }
2963
+ * ```
2964
+ */
2965
+ captureToolCallContent?: boolean;
2966
+ }
2967
+
2928
2968
  /**
2929
2969
  * Resolve a gateway-managed upstream MCP credential and apply it to the
2930
2970
  * request before the normal Zuplo route handler forwards the request.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "7.14.6",
4
+ "version": "7.15.0",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {
@@ -1,24 +1,29 @@
1
- export default function ansiRegex({onlyFirst = false} = {}) {
2
- // Valid string terminator sequences are BEL, ESC\, and 0x9c
3
- const ST = String.raw`(?:\u0007|\u001B\u005C|\u009C)`;
1
+ // Valid string terminator sequences are ESC\ and 0x9c; OSC also accepts BEL.
2
+ const ST = String.raw`(?:\u001B\u005C|\u009C)`;
3
+
4
+ // OSC sequences only: ESC ] ... BEL/ST (or the C1 introducer 0x9d ... BEL/ST).
5
+ // Payloads stop at terminators, cancellations, and C1 controls. An unterminated string cannot swallow the next sequence or repeatedly scan its payload from later introducers. Terminals likewise abort a control string on an unexpected ESC.
6
+ const stringControls = String.raw`\u0018\u001A\u001B\u0080-\u009F`;
7
+ const osc = String.raw`(?:\u001B\]|\u009D)[^\u0007${stringControls}]*(?:\u0007|${ST})`;
4
8
 
5
- // OSC sequences only: ESC ] ... ST (or the C1 introducer 0x9d ... ST)
6
- // The payload stops at the first terminator character rather than scanning ahead for one, so an unterminated `ESC ]` cannot rescan the rest of the input. Terminals likewise abort a control string on an unexpected ESC. The payload also stops at 0x9d so an unterminated C1 OSC cannot swallow the next one.
7
- const osc = String.raw`(?:(?:\u001B\]|\u009D)[^\u0007\u001B\u009C\u009D]*${ST})`;
9
+ // DCS, SOS, PM, APC, and screen window titles have opaque payloads terminated by ST. Nested ESC payloads, such as tmux passthrough, require a parser.
10
+ const controlString = String.raw`(?:\u001B[PX^_k]|[\u0090\u0098\u009E\u009F])[^${stringControls}]*${ST}`;
8
11
 
9
- // CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte
10
- // The final byte class is deliberately narrow, so that ESC followed by an arbitrary character is not read as a sequence. It must
11
- // not include the parameter digits though: when the real final byte is outside the class the engine backtracks and takes the last
12
- // parameter digit as the final byte instead, leaving the real one behind as visible text. `ESC [ 5 d` stripped to a bare `d`.
13
- const csi = String.raw`[\u001B\u009B][[\]()#;?]*(?:\d{1,4}(?:[;:]\d{0,4})*)?[A-PR-TZcf-nq-uy=><~]`;
12
+ // Linux console palette controls have fixed lengths and no string terminator; iTerm2 terminates its palette assignments. Consume an immediately adjacent OSC terminator, but match these controls before OSC so a later BEL cannot consume visible text.
13
+ const linuxPalette = String.raw`\u001B\](?:P[\dA-Fa-f]{7}|R)(?:\u0007|${ST})?`;
14
14
 
15
- // `= < >` are final bytes in the two byte VT52 escapes (`ESC >`) but parameter bytes in a CSI
16
- // (`ESC [ > 0 ; 276 ; 0 c`, the device attributes reply). Matching them as a final byte always
17
- // wins and leaves the rest of the reply behind as visible text, so the private parameter form is
18
- // matched first, where the `[` makes the two unambiguous.
19
- const csiPrivate = String.raw`(?:\u001B\[|\u009B)[<=>][0-9;:]*[A-PR-TZcf-nq-uy~]`;
15
+ // CSI: ESC [ or C1 CSI, parameter bytes (0x30–0x3f), intermediate bytes (0x20–0x2f), then a final byte (0x40–0x7e).
16
+ // `= < >` are final bytes in two-byte VT52 escapes (`ESC >`) but parameter bytes in a CSI (`ESC [ > 0 ; 276 ; 0 c`, the device attributes reply). Match CSI first to consume the whole sequence, where its introducer makes the two unambiguous.
17
+ const csi = String.raw`(?:\u001B\[|\u009B)[\u0030-\u003F]*[\u0020-\u002F]*[\u0040-\u007E]`;
20
18
 
21
- const pattern = `${osc}|${csiPrivate}|${csi}`;
19
+ // Related escapes: ESC, intermediate bytes (0x20–0x2f), then a final byte (0x30–0x7e), or a supported two-byte escape.
20
+ // The two-byte final class stays narrow so that ESC followed by an arbitrary character is not read as a sequence. CSI parameters belong only to the CSI form, preventing partial matches and avoiding a second scan with nested repetition.
21
+ // Escapes whose final byte is a digit include `ESC 7` and `ESC 8` (save and restore cursor), `ESC ( 0` (line drawing character set), and `ESC # 8` (screen alignment).
22
+ // A digit is never a CSI final byte. These escapes end immediately at their final byte, so `ESC 7 l` is read as the escape followed by text rather than a sequence with parameter 7 and final byte `l`.
23
+ const escape = String.raw`\u001B(?:[\u0020-\u002F]+[\u0030-\u007E]|[\dA-PR-TZcf-oq-uy=><~|}])`;
22
24
 
25
+ const pattern = `${linuxPalette}|${osc}|${controlString}|${csi}|${escape}`;
26
+
27
+ export default function ansiRegex({onlyFirst = false} = {}) {
23
28
  return new RegExp(pattern, onlyFirst ? undefined : 'g');
24
29
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ansi-regex",
3
- "version": "6.5.0",
3
+ "version": "6.6.0",
4
4
  "description": "Regular expression for matching ANSI escape codes",
5
5
  "license": "MIT",
6
6
  "repository": "chalk/ansi-regex",
@@ -54,6 +54,14 @@ If you run the regex against untrusted user input in a server context, you shoul
54
54
 
55
55
  ## FAQ
56
56
 
57
+ ### Which sequences are supported?
58
+
59
+ The regex matches complete CSI sequences, OSC strings, ST-terminated DCS/SOS/PM/APC strings, screen window-title strings, character-set and encoding selections, and common two-byte ESC controls. Both seven-bit escape sequences and their C1 equivalents are supported where applicable. Linux console palette controls are also supported.
60
+
61
+ Control-string payloads are opaque, so this includes terminal hyperlinks, shell integration, clipboard commands, editor queries, sixel images, and Kitty graphics without needing a list of individual commands. ESC, CAN, SUB, and C1 control characters delimit or interrupt a control string.
62
+
63
+ This is a matcher for contiguous terminal output sequences, not a terminal emulator. It does not reconstruct screen contents, decode terminal keyboard/mouse input, or handle nested escape payloads such as tmux passthrough. Incomplete or cancelled sequences are handled on a best-effort basis. Standalone control characters, including tabs, newlines, and BEL, are preserved.
64
+
57
65
  ### Why do you test for codes not in the ECMA 48 standard?
58
66
 
59
67
  Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
@@ -199,7 +199,7 @@ var EventV2Processor = class extends EventProcessor {
199
199
  const headers = new Headers();
200
200
  this.getCookies(event, headers);
201
201
  if (event.headers) {
202
- for (const [k, v] of Object.entries(event.headers)) if (v) headers.set(k, v);
202
+ for (const [k, v] of Object.entries(event.headers)) if (v) headers.set(k, sanitizeHeaderValue(v));
203
203
  }
204
204
  return headers;
205
205
  }
@@ -200,7 +200,7 @@ var EventV2Processor = class extends EventProcessor {
200
200
  const headers = new Headers();
201
201
  this.getCookies(event, headers);
202
202
  if (event.headers) {
203
- for (const [k, v] of Object.entries(event.headers)) if (v) headers.set(k, v);
203
+ for (const [k, v] of Object.entries(event.headers)) if (v) headers.set(k, sanitizeHeaderValue(v));
204
204
  }
205
205
  return headers;
206
206
  }
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_middleware_serve_static_index = require("../../middleware/serve-static/index.js");
3
- let node_path = require("node:path");
4
3
  let node_fs_promises = require("node:fs/promises");
4
+ let node_path = require("node:path");
5
5
  //#region src/adapter/bun/serve-static.ts
6
6
  /**
7
7
  * @deprecated `hono/bun` will be removed in v5. Install `@hono/bun` and import from there instead.
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_helper_websocket_index = require("../../helper/websocket/index.js");
3
2
  const require_adapter_bun_server = require("./server.js");
3
+ const require_helper_websocket_index = require("../../helper/websocket/index.js");
4
4
  //#region src/adapter/bun/websocket.ts
5
5
  /**
6
6
  * @internal
@@ -58,7 +58,7 @@ const jsonRegex = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(?:;.+)?$/i;
58
58
  function detectResponseType(response) {
59
59
  const _contentType = response.headers.get("content-type");
60
60
  if (!_contentType) return "text";
61
- const contentType = _contentType.split(";").shift();
61
+ const contentType = _contentType.split(";").shift().trim();
62
62
  if (jsonRegex.test(contentType)) return "json";
63
63
  return "text";
64
64
  }
@@ -20,12 +20,13 @@ const getSpecificity = (type) => {
20
20
  };
21
21
  const defaultMatch = (accepts, config) => {
22
22
  const { supports, default: defaultSupport } = config;
23
+ const exactTypes = new Set(accepts.filter((accept) => getSpecificity(accept.type) === 3).map((accept) => accept.type.toLowerCase()));
23
24
  const sortedAccepts = accepts.filter((accept) => accept.q > 0).sort((a, b) => {
24
25
  if (b.q !== a.q) return b.q - a.q;
25
26
  return getSpecificity(b.type) - getSpecificity(a.type);
26
27
  });
27
28
  for (const accept of sortedAccepts) {
28
- const matched = supports.find((supported) => matchType(accept.type, supported));
29
+ const matched = supports.find((supported) => matchType(accept.type, supported) && (getSpecificity(accept.type) !== 2 || !exactTypes.has(supported.toLowerCase())));
29
30
  if (matched) return matched;
30
31
  }
31
32
  return defaultSupport;
@@ -39,6 +39,8 @@ const defaultExtensionMap = {
39
39
  const determineExtension = (mimeType, userExtensionMap) => {
40
40
  const extensionMap = userExtensionMap || defaultExtensionMap;
41
41
  if (mimeType in extensionMap) return extensionMap[mimeType];
42
+ const lowerCasedMimeType = mimeType.toLowerCase();
43
+ if (lowerCasedMimeType in extensionMap) return extensionMap[lowerCasedMimeType];
42
44
  return require_utils_mime.getExtension(mimeType) || "html";
43
45
  };
44
46
  const combineBeforeRequestHooks = (hooks) => {
@@ -142,8 +144,7 @@ const fetchRoutesContent = function* (app, beforeRequestHook, afterResponseHook,
142
144
  * `saveContentToFile` is an experimental feature.
143
145
  * The API might be changed.
144
146
  */
145
- const createdDirs = /* @__PURE__ */ new Set();
146
- const saveContentToFile = async (data, fsModule, outDir, extensionMap) => {
147
+ const saveContentToFile = async (data, fsModule, outDir, extensionMap, createdDirs = /* @__PURE__ */ new Set()) => {
147
148
  const awaitedData = await data;
148
149
  if (!awaitedData) return;
149
150
  const { routePath, content, mimeType } = awaitedData;
@@ -183,10 +184,11 @@ const toSSG = async (app, fs, options) => {
183
184
  const concurrency = options?.concurrency ?? DEFAULT_CONCURRENCY;
184
185
  const combinedBeforeRequestHook = combineBeforeRequestHooks(beforeRequestHooks.length > 0 ? beforeRequestHooks : [(req) => req]);
185
186
  const combinedAfterResponseHook = combineAfterResponseHooks(afterResponseHooks.length > 0 ? afterResponseHooks : [(req) => req]);
187
+ const createdDirs = /* @__PURE__ */ new Set();
186
188
  const getInfoGen = fetchRoutesContent(app, combinedBeforeRequestHook, combinedAfterResponseHook, concurrency);
187
189
  for (const getInfo of getInfoGen) getInfoPromises.push(getInfo.then((getContentGen) => {
188
190
  if (!getContentGen) return;
189
- for (const content of getContentGen) savePromises.push(saveContentToFile(content, fs, outputDir, options?.extensionMap).catch((e) => e));
191
+ for (const content of getContentGen) savePromises.push(saveContentToFile(content, fs, outputDir, options?.extensionMap, createdDirs).catch((e) => e));
190
192
  }));
191
193
  await Promise.all(getInfoPromises);
192
194
  const files = [];
@@ -26,7 +26,7 @@ const emptyTags = [
26
26
  "track",
27
27
  "wbr"
28
28
  ];
29
- const booleanAttributes = [
29
+ const booleanAttributes = /* @__PURE__ */ new Set([
30
30
  "allowfullscreen",
31
31
  "async",
32
32
  "autofocus",
@@ -52,8 +52,11 @@ const booleanAttributes = [
52
52
  "readonly",
53
53
  "required",
54
54
  "reversed",
55
- "selected"
56
- ];
55
+ "selected",
56
+ "shadowrootclonable",
57
+ "shadowrootdelegatesfocus",
58
+ "shadowrootserializable"
59
+ ]);
57
60
  const resolveFunctionComponentResult = (result, suspendedContext) => result.then((resolved) => {
58
61
  if (typeof resolved !== "string" && !Array.isArray(resolved) && !(resolved instanceof JSXNode)) return resolved;
59
62
  const children = Array.isArray(resolved) ? resolved : [resolved];
@@ -64,6 +67,44 @@ const resolveFunctionComponentResult = (result, suspendedContext) => result.then
64
67
  };
65
68
  return suspendedContext ? suspendedContext(render) : require_jsx_context.runWithRenderContext(render);
66
69
  });
70
+ const markRenderedJSX = (value) => {
71
+ value[require_jsx_constants.RENDERED_JSX] = true;
72
+ return value;
73
+ };
74
+ const isEscapedAttribute = (value) => value instanceof String && value.isEscaped && !(require_jsx_constants.RENDERED_JSX in value);
75
+ const objectToAttributeString = (v) => {
76
+ const s = v.toString();
77
+ return s instanceof Promise ? s.then(String) : String(s);
78
+ };
79
+ const attributeToBuffer = (buffer, prefix, key, v, tag) => {
80
+ if (key === "ref" || v === null || v === void 0) return;
81
+ if (typeof v === "boolean" && booleanAttributes.has(key)) {
82
+ if (v) buffer[0] += `${prefix}${key}=""`;
83
+ return;
84
+ }
85
+ if (typeof v === "function") {
86
+ if (!key.startsWith("on")) throw new Error(`Invalid prop '${key}' of type 'function' supplied to ${tag ? `'${tag}'` : "a JSX element"}.`);
87
+ return;
88
+ }
89
+ buffer[0] += `${prefix}${key}="`;
90
+ if (key === "style" && typeof v === "object") {
91
+ let styleStr = "";
92
+ require_jsx_utils.styleObjectForEach(v, (property, value) => {
93
+ if (value != null) styleStr += `${styleStr ? ";" : ""}${property}:${value}`;
94
+ });
95
+ require_utils_html.escapeToBuffer(styleStr, buffer);
96
+ } else if (typeof v === "string") require_utils_html.escapeToBuffer(v, buffer);
97
+ else if (typeof v === "number" || isEscapedAttribute(v)) buffer[0] += `${v}`;
98
+ else {
99
+ const s = v instanceof Promise ? v.then((r) => typeof r === "object" && r !== null && !isEscapedAttribute(r) ? objectToAttributeString(r) : r) : objectToAttributeString(v);
100
+ if (s instanceof Promise) {
101
+ buffer.unshift("\"", s);
102
+ return;
103
+ }
104
+ require_utils_html.escapeToBuffer(s, buffer);
105
+ }
106
+ buffer[0] += "\"";
107
+ };
67
108
  const childrenToStringToBuffer = (children, buffer) => {
68
109
  for (let i = 0, len = children.length; i < len; i++) {
69
110
  const child = children[i];
@@ -115,7 +156,7 @@ var JSXNode = class {
115
156
  const render = () => {
116
157
  const buffer = [""];
117
158
  this.toStringToBuffer(buffer);
118
- return buffer.length === 1 ? "callbacks" in buffer ? require_utils_html.resolveCallbackSync(require_utils_html.raw(buffer[0], buffer.callbacks)).toString() : buffer[0] : require_utils_html.stringBufferToString(buffer, buffer.callbacks);
159
+ return buffer.length === 1 ? "callbacks" in buffer ? require_utils_html.resolveCallbackSync(require_utils_html.raw(buffer[0], buffer.callbacks)).toString() : buffer[0] : require_utils_html.stringBufferToString(buffer, buffer.callbacks).then(markRenderedJSX);
119
160
  };
120
161
  return require_jsx_context.runWithRenderContext(render);
121
162
  }
@@ -128,34 +169,10 @@ var JSXNode = class {
128
169
  for (let [key, v] of Object.entries(props)) {
129
170
  key = normalizeKey(key);
130
171
  if (!require_jsx_utils.isValidAttributeName(key)) continue;
131
- if (key === "children") {} else if (key === "style" && typeof v === "object") {
132
- let styleStr = "";
133
- require_jsx_utils.styleObjectForEach(v, (property, value) => {
134
- if (value != null) styleStr += `${styleStr ? ";" : ""}${property}:${value}`;
135
- });
136
- buffer[0] += " style=\"";
137
- require_utils_html.escapeToBuffer(styleStr, buffer);
138
- buffer[0] += "\"";
139
- } else if (typeof v === "string") {
140
- buffer[0] += ` ${key}="`;
141
- require_utils_html.escapeToBuffer(v, buffer);
142
- buffer[0] += "\"";
143
- } else if (v === null || v === void 0) {} else if (typeof v === "number" || v.isEscaped) buffer[0] += ` ${key}="${v}"`;
144
- else if (typeof v === "boolean" && booleanAttributes.includes(key)) {
145
- if (v) buffer[0] += ` ${key}=""`;
146
- } else if (key === "dangerouslySetInnerHTML") {
172
+ if (key === "children") {} else if (key === "dangerouslySetInnerHTML" && typeof v === "object" && v !== null && "__html" in v) {
147
173
  if (children.length > 0) throw new Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`.");
148
174
  children = [require_utils_html.raw(v.__html)];
149
- } else if (v instanceof Promise) {
150
- buffer[0] += ` ${key}="`;
151
- buffer.unshift("\"", v);
152
- } else if (typeof v === "function") {
153
- if (!key.startsWith("on") && key !== "ref") throw new Error(`Invalid prop '${key}' of type 'function' supplied to '${tag}'.`);
154
- } else {
155
- buffer[0] += ` ${key}="`;
156
- require_utils_html.escapeToBuffer(v.toString(), buffer);
157
- buffer[0] += "\"";
158
- }
175
+ } else attributeToBuffer(buffer, " ", key, v, tag);
159
176
  }
160
177
  if (emptyTags.includes(tag) && children.length === 0) {
161
178
  buffer[0] += "/>";
@@ -252,6 +269,7 @@ const reactAPICompatVersion = "19.0.0-hono-jsx";
252
269
  exports.Fragment = Fragment;
253
270
  exports.JSXFragmentNode = JSXFragmentNode;
254
271
  exports.JSXNode = JSXNode;
272
+ exports.attributeToBuffer = attributeToBuffer;
255
273
  exports.booleanAttributes = booleanAttributes;
256
274
  exports.cloneElement = cloneElement;
257
275
  exports.getNameSpaceContext = getNameSpaceContext;
@@ -259,6 +277,7 @@ exports.isUntrustedObject = isUntrustedObject;
259
277
  exports.isValidElement = isValidElement;
260
278
  exports.jsx = jsx;
261
279
  exports.jsxFn = jsxFn;
280
+ exports.markRenderedJSX = markRenderedJSX;
262
281
  exports.memo = memo;
263
282
  exports.reactAPICompatVersion = reactAPICompatVersion;
264
283
  exports.renderChildren = renderChildren;
@@ -78,7 +78,7 @@ const ErrorBoundary = async ({ children, fallback, fallbackRender, onError }) =>
78
78
  buffer[0] = buffer[0].replace(replaceRe, () => fallbackResString);
79
79
  return fallbackCallbacks?.length ? require_utils_html.raw("", fallbackCallbacks) : "";
80
80
  }
81
- return require_utils_html.raw(`<template data-hono-target="E:${index}">${fallbackResString}</template><script>
81
+ return require_utils_html.raw(`<template data-hono-target="E:${index}">${fallbackResString}</template><script${nonce ? ` nonce="${nonce}"` : ""}>
82
82
  ((d,c,n) => {
83
83
  c=d.currentScript.previousSibling
84
84
  d=d.getElementById('E:${index}')
@@ -119,7 +119,7 @@ d.parentElement.insertBefore(c.content,d.nextSibling)
119
119
  buffer[0] += content;
120
120
  return require_utils_html.raw("", content.callbacks);
121
121
  }
122
- return require_utils_html.raw(content + (resolvedCount !== callbacks.length ? "" : `<script>
122
+ return require_utils_html.raw(content + (resolvedCount !== callbacks.length ? "" : `<script${nonce ? ` nonce="${nonce}"` : ""}>
123
123
  ((d,c,n) => {
124
124
  d=d.getElementById('E:${index}')
125
125
  if(!d)return
@@ -6,6 +6,7 @@ const DOM_STASH = Symbol("STASH");
6
6
  const DOM_INTERNAL_TAG = Symbol("INTERNAL");
7
7
  const DOM_MEMO = Symbol("MEMO");
8
8
  const PERMALINK = Symbol("PERMALINK");
9
+ const RENDERED_JSX = Symbol("RENDERED_JSX");
9
10
  //#endregion
10
11
  exports.DOM_ERROR_HANDLER = DOM_ERROR_HANDLER;
11
12
  exports.DOM_INTERNAL_TAG = DOM_INTERNAL_TAG;
@@ -13,3 +14,4 @@ exports.DOM_MEMO = DOM_MEMO;
13
14
  exports.DOM_RENDERER = DOM_RENDERER;
14
15
  exports.DOM_STASH = DOM_STASH;
15
16
  exports.PERMALINK = PERMALINK;
17
+ exports.RENDERED_JSX = RENDERED_JSX;
@@ -1,30 +1,26 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_utils_html = require("../utils/html.js");
3
3
  const require_helper_html_index = require("../helper/html/index.js");
4
+ const require_jsx_constants = require("./constants.js");
4
5
  const require_jsx_utils = require("./utils.js");
5
6
  const require_jsx_base = require("./base.js");
6
7
  const require_jsx_jsx_dev_runtime = require("./jsx-dev-runtime.js");
7
8
  //#region src/jsx/jsx-runtime.ts
9
+ const jsxTemplate = (strings, ...values) => {
10
+ const result = require_helper_html_index.html(strings, ...values);
11
+ return result instanceof Promise ? result.then(require_jsx_base.markRenderedJSX) : require_jsx_base.markRenderedJSX(result);
12
+ };
8
13
  const jsxAttr = (key, v) => {
9
14
  if (!require_jsx_utils.isValidAttributeName(key)) return require_utils_html.raw("");
10
- const buffer = [`${key}="`];
11
- if (key === "style" && typeof v === "object") {
12
- let styleStr = "";
13
- require_jsx_utils.styleObjectForEach(v, (property, value) => {
14
- if (value != null) styleStr += `${styleStr ? ";" : ""}${property}:${value}`;
15
- });
16
- require_utils_html.escapeToBuffer(styleStr, buffer);
17
- buffer[0] += "\"";
18
- } else if (typeof v === "string") {
15
+ if (typeof v === "string") {
16
+ const buffer = [`${key}="`];
19
17
  require_utils_html.escapeToBuffer(v, buffer);
20
- buffer[0] += "\"";
21
- } else if (v === null || v === void 0) return require_utils_html.raw("");
22
- else if (typeof v === "number" || v.isEscaped) buffer[0] += `${v}"`;
23
- else if (v instanceof Promise) buffer.unshift("\"", v);
24
- else {
25
- require_utils_html.escapeToBuffer(v.toString(), buffer);
26
- buffer[0] += "\"";
18
+ return require_utils_html.raw(buffer[0] + "\"");
27
19
  }
20
+ let value = v;
21
+ if (typeof value === "function" && (key === "action" || key === "formaction")) value = require_jsx_constants.PERMALINK in value ? value[require_jsx_constants.PERMALINK] : void 0;
22
+ const buffer = [""];
23
+ require_jsx_base.attributeToBuffer(buffer, "", key, value);
28
24
  return buffer.length === 1 ? require_utils_html.raw(buffer[0]) : require_utils_html.stringBufferToString(buffer, void 0);
29
25
  };
30
26
  const jsxEscape = (value) => value;
@@ -33,5 +29,5 @@ exports.Fragment = require_jsx_base.Fragment;
33
29
  exports.jsx = require_jsx_jsx_dev_runtime.jsxDEV;
34
30
  exports.jsxAttr = jsxAttr;
35
31
  exports.jsxEscape = jsxEscape;
36
- exports.jsxTemplate = require_helper_html_index.html;
32
+ exports.jsxTemplate = jsxTemplate;
37
33
  exports.jsxs = require_jsx_jsx_dev_runtime.jsxDEV;
@@ -17,7 +17,8 @@ const RETAINED_304_HEADERS = [
17
17
  ];
18
18
  const stripWeak = (tag) => tag.replace(/^W\//, "");
19
19
  function etagMatches(etag, ifNoneMatch) {
20
- return ifNoneMatch != null && ifNoneMatch.split(",").some((t) => stripWeak(t.trim()) === stripWeak(etag));
20
+ const expected = stripWeak(etag);
21
+ return ifNoneMatch?.match(/"[^"]*"/g)?.some((tag) => tag === expected) ?? false;
21
22
  }
22
23
  function initializeGenerator(generator) {
23
24
  if (!generator) {
@@ -65,6 +66,7 @@ const etag = (options) => {
65
66
  etag = weak ? `W/"${hash}"` : `"${hash}"`;
66
67
  }
67
68
  if (ifNoneMatch === "*" || etagMatches(etag, ifNoneMatch)) {
69
+ await res.body?.cancel();
68
70
  c.res = new Response(null, {
69
71
  status: 304,
70
72
  statusText: "Not Modified",
@@ -32,6 +32,7 @@ const prettyJSON = (options) => {
32
32
  } catch {
33
33
  return;
34
34
  }
35
+ await c.res.body?.cancel();
35
36
  c.res = new Response(JSON.stringify(obj, null, options?.space ?? 2), c.res);
36
37
  c.res.headers.delete("Content-Length");
37
38
  }
@@ -75,6 +75,7 @@ const timing = (config) => {
75
75
  }
76
76
  };
77
77
  };
78
+ const quote = (s) => `"${s.replace(/[\\"]/g, "\\$&")}"`;
78
79
  /**
79
80
  * Set a metric for the timing middleware.
80
81
  *
@@ -97,11 +98,11 @@ const setMetric = (c, name, valueDescription, description, precision) => {
97
98
  return;
98
99
  }
99
100
  if (typeof valueDescription === "number") {
100
- const dur = valueDescription.toFixed(precision || 1);
101
- const metric = description ? `${name};dur=${dur};desc="${description}"` : `${name};dur=${dur}`;
101
+ const dur = valueDescription.toFixed(precision ?? 1);
102
+ const metric = description ? `${name};dur=${dur};desc=${quote(description)}` : `${name};dur=${dur}`;
102
103
  metrics.headers.push(metric);
103
104
  } else {
104
- const metric = valueDescription ? `${name};desc="${valueDescription}"` : `${name}`;
105
+ const metric = valueDescription ? `${name};desc=${quote(valueDescription)}` : `${name}`;
105
106
  metrics.headers.push(metric);
106
107
  }
107
108
  };
@@ -80,8 +80,8 @@ const parseSigned = async (cookie, secret, name) => {
80
80
  const _serialize = (name, value, opt = {}) => {
81
81
  if (!validCookieNameRegEx.test(name)) throw new Error("Invalid cookie name");
82
82
  let cookie = `${name}=${value}`;
83
- if (name.startsWith("__Secure-") && !opt.secure) throw new Error("__Secure- Cookie must have Secure attributes");
84
- if (name.startsWith("__Host-")) {
83
+ if (/^__secure-/i.test(name) && !opt.secure) throw new Error("__Secure- Cookie must have Secure attributes");
84
+ if (/^__host-/i.test(name)) {
85
85
  if (!opt.secure) throw new Error("__Host- Cookie must have Secure attributes");
86
86
  if (opt.path !== "/") throw new Error("__Host- Cookie must have Path attributes with \"/\"");
87
87
  if (opt.domain) throw new Error("__Host- Cookie must not have Domain attributes");