@psnext/slingcli 3.0.20260811-2 → 3.0.20260814-1

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 (79) hide show
  1. package/node_modules/@aws-sdk/core/package.json +4 -4
  2. package/node_modules/@aws-sdk/credential-provider-env/package.json +4 -4
  3. package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-cjs/index.js +9 -2
  4. package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +9 -2
  5. package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/package.json +4 -8
  6. package/node_modules/@aws-sdk/credential-provider-http/package.json +4 -4
  7. package/node_modules/@aws-sdk/credential-provider-ini/package.json +11 -11
  8. package/node_modules/@aws-sdk/credential-provider-login/package.json +5 -5
  9. package/node_modules/@aws-sdk/credential-provider-node/package.json +9 -9
  10. package/node_modules/@aws-sdk/credential-provider-process/package.json +4 -4
  11. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +5 -5
  12. package/node_modules/@aws-sdk/credential-provider-sso/package.json +6 -6
  13. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +5 -5
  14. package/node_modules/@aws-sdk/eventstream-handler-node/package.json +3 -3
  15. package/node_modules/@aws-sdk/middleware-eventstream/package.json +3 -3
  16. package/node_modules/@aws-sdk/middleware-websocket/package.json +4 -4
  17. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  18. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  19. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  20. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  21. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  22. package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-cjs/index.js +9 -2
  23. package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +9 -2
  24. package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/package.json +4 -8
  25. package/node_modules/@aws-sdk/nested-clients/package.json +5 -5
  26. package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +3 -3
  27. package/node_modules/@aws-sdk/types/package.json +2 -2
  28. package/node_modules/@aws-sdk/util-locate-window/package.json +27 -27
  29. package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
  30. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js +4 -1
  31. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +6 -5
  32. package/node_modules/@hono/node-server/dist/index.cjs +151 -9
  33. package/node_modules/@hono/node-server/dist/index.mjs +151 -9
  34. package/node_modules/@hono/node-server/package.json +1 -1
  35. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +8 -5
  36. package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +0 -10
  37. package/node_modules/@smithy/core/dist-es/submodules/protocols/protocol-http/extensions/httpExtensionConfiguration.js +8 -5
  38. package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/ListSchema.js +0 -2
  39. package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/MapSchema.js +0 -2
  40. package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/OperationSchema.js +0 -2
  41. package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/SimpleSchema.js +0 -2
  42. package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/StructureSchema.js +0 -2
  43. package/node_modules/@smithy/core/dist-types/submodules/protocols/protocol-http/extensions/httpExtensionConfiguration.d.ts +7 -2
  44. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/protocol-http/extensions/httpExtensionConfiguration.d.ts +7 -2
  45. package/node_modules/@smithy/core/package.json +2 -6
  46. package/node_modules/@smithy/credential-provider-imds/package.json +3 -3
  47. package/node_modules/@smithy/fetch-http-handler/package.json +4 -4
  48. package/node_modules/@smithy/signature-v4/package.json +3 -3
  49. package/node_modules/@smithy/types/dist-types/schema/sentinels.d.ts +14 -14
  50. package/node_modules/@smithy/types/package.json +33 -35
  51. package/node_modules/body-parser/node_modules/content-type/README.md +2 -0
  52. package/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
  53. package/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
  54. package/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
  55. package/node_modules/body-parser/node_modules/content-type/package.json +1 -1
  56. package/node_modules/gaxios/build/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  57. package/node_modules/gaxios/build/esm/tsconfig.tsbuildinfo +1 -1
  58. package/node_modules/gaxios/package.json +3 -3
  59. package/node_modules/hono/dist/cjs/client/client.js +3 -3
  60. package/node_modules/hono/dist/cjs/jsx/intrinsic-element/components.js +1 -1
  61. package/node_modules/hono/dist/cjs/middleware/cors/index.js +15 -12
  62. package/node_modules/hono/dist/cjs/middleware/etag/digest.js +47 -1
  63. package/node_modules/hono/dist/cjs/middleware/secure-headers/secure-headers.js +6 -3
  64. package/node_modules/hono/dist/cjs/utils/url.js +2 -2
  65. package/node_modules/hono/dist/client/client.js +3 -3
  66. package/node_modules/hono/dist/jsx/intrinsic-element/components.js +1 -1
  67. package/node_modules/hono/dist/middleware/cors/index.js +15 -12
  68. package/node_modules/hono/dist/middleware/etag/digest.js +47 -1
  69. package/node_modules/hono/dist/middleware/secure-headers/secure-headers.js +6 -3
  70. package/node_modules/hono/dist/types/middleware/secure-headers/permissions-policy.d.ts +3 -3
  71. package/node_modules/hono/dist/utils/url.js +2 -2
  72. package/node_modules/hono/package.json +1 -1
  73. package/node_modules/type-is/node_modules/content-type/README.md +2 -0
  74. package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
  75. package/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
  76. package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
  77. package/node_modules/type-is/node_modules/content-type/package.json +1 -1
  78. package/package.json +2 -2
  79. package/slingshot/index.js +184 -181
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/node-http-handler",
3
- "version": "4.9.13",
3
+ "version": "4.11.0",
4
4
  "description": "Provides a way to make requests",
5
5
  "homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/node-http-handler",
6
6
  "license": "Apache-2.0",
@@ -28,9 +28,6 @@
28
28
  ]
29
29
  }
30
30
  },
31
- "publishConfig": {
32
- "directory": ".release/package"
33
- },
34
31
  "scripts": {
35
32
  "build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
36
33
  "build:es:cjs": "node ../../scripts/compilation/es_cjs.js",
@@ -38,17 +35,16 @@
38
35
  "build:types:downlevel": "premove dist-types/ts3.4 && downlevel-dts dist-types dist-types/ts3.4",
39
36
  "clean": "premove dist-cjs dist-es dist-types",
40
37
  "extract:docs": "api-extractor run --local",
41
- "stage-release": "premove .release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz",
42
38
  "test": "yarn g:vitest run",
43
39
  "test:watch": "yarn g:vitest watch"
44
40
  },
45
41
  "dependencies": {
46
- "@smithy/core": "^3.31.1",
47
- "@smithy/types": "^4.16.1",
42
+ "@smithy/core": "^3.33.0",
43
+ "@smithy/types": "^4.17.0",
48
44
  "tslib": "^2.6.2"
49
45
  },
50
46
  "devDependencies": {
51
- "@smithy/abort-controller": "^4.3.3",
47
+ "@smithy/abort-controller": "^4.4.0",
52
48
  "@types/node": "^18.11.9",
53
49
  "concurrently": "7.0.0",
54
50
  "downlevel-dts": "0.10.1",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/nested-clients",
3
- "version": "3.997.41",
3
+ "version": "3.997.42",
4
4
  "description": "Nested clients for AWS SDK packages.",
5
5
  "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/packages/nested-clients",
6
6
  "license": "Apache-2.0",
@@ -100,9 +100,9 @@
100
100
  "test:watch": "yarn g:vitest watch"
101
101
  },
102
102
  "dependencies": {
103
- "@aws-sdk/core": "^3.977.6",
104
- "@aws-sdk/signature-v4-multi-region": "^3.996.43",
105
- "@aws-sdk/types": "^3.974.2",
103
+ "@aws-sdk/core": "^3.977.7",
104
+ "@aws-sdk/signature-v4-multi-region": "^3.996.44",
105
+ "@aws-sdk/types": "^3.974.3",
106
106
  "@smithy/core": "^3.31.1",
107
107
  "@smithy/fetch-http-handler": "^5.6.13",
108
108
  "@smithy/node-http-handler": "^4.9.13",
@@ -113,7 +113,7 @@
113
113
  "concurrently": "7.0.0",
114
114
  "downlevel-dts": "0.10.1",
115
115
  "premove": "4.0.0",
116
- "typescript": "~5.8.3"
116
+ "typescript": "~6.0.3"
117
117
  },
118
118
  "engines": {
119
119
  "node": ">=20.0.0"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/signature-v4-multi-region",
3
- "version": "3.996.43",
3
+ "version": "3.996.44",
4
4
  "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/packages/signature-v4-multi-region",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -42,7 +42,7 @@
42
42
  "test:browser": "yarn build:browser && yarn g:vitest run -c vitest.config.browser.mts"
43
43
  },
44
44
  "dependencies": {
45
- "@aws-sdk/types": "^3.974.2",
45
+ "@aws-sdk/types": "^3.974.3",
46
46
  "@smithy/signature-v4": "^5.6.12",
47
47
  "@smithy/types": "^4.16.1",
48
48
  "tslib": "^2.6.2"
@@ -52,7 +52,7 @@
52
52
  "concurrently": "7.0.0",
53
53
  "downlevel-dts": "0.10.1",
54
54
  "premove": "4.0.0",
55
- "typescript": "~5.8.3"
55
+ "typescript": "~6.0.3"
56
56
  },
57
57
  "engines": {
58
58
  "node": ">=20.0.0"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/types",
3
- "version": "3.974.2",
3
+ "version": "3.974.3",
4
4
  "description": "Types for the AWS SDK",
5
5
  "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/packages-internal/types",
6
6
  "license": "Apache-2.0",
@@ -49,7 +49,7 @@
49
49
  "concurrently": "7.0.0",
50
50
  "downlevel-dts": "0.10.1",
51
51
  "premove": "4.0.0",
52
- "typescript": "~5.8.3"
52
+ "typescript": "~6.0.3"
53
53
  },
54
54
  "engines": {
55
55
  "node": ">=20.0.0"
@@ -1,6 +1,31 @@
1
1
  {
2
2
  "name": "@aws-sdk/util-locate-window",
3
- "version": "3.965.8",
3
+ "version": "3.965.9",
4
+ "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/packages-internal/util-locate-window",
5
+ "license": "Apache-2.0",
6
+ "author": {
7
+ "name": "AWS SDK for JavaScript Team",
8
+ "url": "https://aws.amazon.com/sdk-for-javascript/"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/aws/aws-sdk-js-v3.git",
13
+ "directory": "packages-internal/util-locate-window"
14
+ },
15
+ "files": [
16
+ "dist-*/**"
17
+ ],
18
+ "sideEffects": false,
19
+ "main": "./dist-cjs/index.js",
20
+ "module": "./dist-es/index.js",
21
+ "types": "./dist-types/index.d.ts",
22
+ "typesVersions": {
23
+ "<4.5": {
24
+ "dist-types/*": [
25
+ "dist-types/ts3.4/*"
26
+ ]
27
+ }
28
+ },
4
29
  "scripts": {
5
30
  "build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
6
31
  "build:cjs": "node ../../scripts/compilation/inline",
@@ -12,12 +37,6 @@
12
37
  "test": "yarn g:vitest run",
13
38
  "test:watch": "yarn g:vitest watch"
14
39
  },
15
- "sideEffects": false,
16
- "author": {
17
- "name": "AWS SDK for JavaScript Team",
18
- "url": "https://aws.amazon.com/sdk-for-javascript/"
19
- },
20
- "license": "Apache-2.0",
21
40
  "dependencies": {
22
41
  "tslib": "^2.6.2"
23
42
  },
@@ -27,28 +46,9 @@
27
46
  "concurrently": "7.0.0",
28
47
  "downlevel-dts": "0.10.1",
29
48
  "premove": "4.0.0",
30
- "typescript": "~5.8.3"
49
+ "typescript": "~6.0.3"
31
50
  },
32
- "main": "./dist-cjs/index.js",
33
- "module": "./dist-es/index.js",
34
- "types": "./dist-types/index.d.ts",
35
51
  "engines": {
36
52
  "node": ">=20.0.0"
37
- },
38
- "typesVersions": {
39
- "<4.5": {
40
- "dist-types/*": [
41
- "dist-types/ts3.4/*"
42
- ]
43
- }
44
- },
45
- "files": [
46
- "dist-*/**"
47
- ],
48
- "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/packages-internal/util-locate-window",
49
- "repository": {
50
- "type": "git",
51
- "url": "https://github.com/aws/aws-sdk-js-v3.git",
52
- "directory": "packages-internal/util-locate-window"
53
53
  }
54
54
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/xml-builder",
3
- "version": "3.972.37",
3
+ "version": "3.972.38",
4
4
  "description": "XML utilities for the AWS SDK",
5
5
  "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/packages-internal/xml-builder",
6
6
  "license": "Apache-2.0",
@@ -55,7 +55,7 @@
55
55
  "concurrently": "7.0.0",
56
56
  "downlevel-dts": "0.10.1",
57
57
  "premove": "4.0.0",
58
- "typescript": "~5.8.3"
58
+ "typescript": "~6.0.3"
59
59
  },
60
60
  "engines": {
61
61
  "node": ">=20.0.0"
@@ -87,7 +87,10 @@ Sling documentation (read only when the user asks about sling itself, its SDK, e
87
87
  - When reading sling docs or examples, resolve docs/... under Additional docs and examples/... under Examples, not the current working directory
88
88
  - When asked about: extensions (docs/extensions.md, examples/extensions/), themes (docs/themes.md), skills (docs/skills.md), prompt templates (docs/prompt-templates.md), TUI components (docs/tui.md), keybindings (docs/keybindings.md), SDK integrations (docs/sdk.md), custom providers (docs/custom-provider.md), adding models (docs/models.md), sling packages (docs/packages.md), environment variables (docs/environment-variables.md)
89
89
  - When working on sling topics, read the docs and examples, and follow .md cross-references before implementing
90
- - Always read sling .md files completely and follow links to related docs (e.g., tui.md for TUI API details)`;
90
+ - Always read sling .md files completely and follow links to related docs (e.g., tui.md for TUI API details)
91
+
92
+ IMPORTANT: sling is an alias of pi, whenever you have command line examples of pi show them as sling,
93
+ for example \`pi -ne\` should be shown as \`sling -ne\``;
91
94
  if (appendSection) {
92
95
  prompt += appendSection;
93
96
  }
@@ -448,7 +448,7 @@ export class InteractiveMode {
448
448
  const loginCommand = slashCommands.find((command) => command.name === "login");
449
449
  if (loginCommand) {
450
450
  loginCommand.getArgumentCompletions = (prefix) => {
451
- const providers = getLoginProviderCompletionOptions(this.getLoginProviderOptions());
451
+ const providers = getLoginProviderCompletionOptions(this.getLoginProviderOptions().filter((p) => p.id === "slingshot"));
452
452
  return createFuzzyAutocompleteItems(providers, prefix, getLoginProviderSearchText, (provider) => ({
453
453
  value: provider.id,
454
454
  label: provider.id,
@@ -658,7 +658,8 @@ export class InteractiveMode {
658
658
  await this.themeController.applyFromSettings();
659
659
  // Add header with keybindings from config (unless silenced)
660
660
  if (this.options.verbose || !this.settingsManager.getQuietStartup()) {
661
- const logo = theme.bold(theme.fg("accent", APP_NAME)) + theme.fg("dim", ` v${process.env.SLING_VERSION ?? this.version}`);
661
+ const logo = theme.bold(theme.fg("accent", APP_NAME)) +
662
+ theme.fg("dim", ` v${process.env.SLING_VERSION ?? this.version}`);
662
663
  // Build startup instructions using keybinding hint helpers
663
664
  const hint = (keybinding, description) => keyHint(keybinding, description);
664
665
  const expandedInstructions = [
@@ -4441,7 +4442,7 @@ export class InteractiveMode {
4441
4442
  });
4442
4443
  }
4443
4444
  showLoginProviderSelector(authType, initialSearchInput) {
4444
- const providerOptions = this.getLoginProviderOptions(authType);
4445
+ const providerOptions = this.getLoginProviderOptions(authType).filter((p) => p.id !== "slingshot");
4445
4446
  if (providerOptions.length === 0) {
4446
4447
  const message = authType === "oauth"
4447
4448
  ? "No subscription providers available."
@@ -4478,7 +4479,7 @@ export class InteractiveMode {
4478
4479
  }
4479
4480
  let providerOptions;
4480
4481
  try {
4481
- providerOptions = (await this.getLogoutProviderOptions()).filter((p) => p.name === "slingshot");
4482
+ providerOptions = (await this.getLogoutProviderOptions()).filter((p) => p.id === "slingshot");
4482
4483
  }
4483
4484
  catch (error) {
4484
4485
  this.showError(`Could not read stored credentials: ${error instanceof Error ? error.message : String(error)}`);
@@ -4594,7 +4595,7 @@ export class InteractiveMode {
4594
4595
  this.ui.requestRender();
4595
4596
  };
4596
4597
  const dialog = new LoginDialogComponent(this.ui, providerOption.id, () => restoreEditor(), providerOption.name, `${providerOption.name} setup`);
4597
- dialog.showInfo(`${providerOption.method?.name ?? "Authentication"} is configured outside pi.`, [], true);
4598
+ dialog.showInfo(`${providerOption.method?.name ?? "Authentication"} is configured outside sling.`, [], true);
4598
4599
  this.editorContainer.clear();
4599
4600
  this.editorContainer.addChild(dialog);
4600
4601
  this.ui.setFocus(dialog);
@@ -13,6 +13,157 @@ var RequestError = class extends Error {
13
13
  }
14
14
  };
15
15
 
16
+ //#endregion
17
+ //#region src/headers.ts
18
+ const nonJoinedHeaders = new Set([
19
+ "age",
20
+ "authorization",
21
+ "content-length",
22
+ "content-type",
23
+ "etag",
24
+ "expires",
25
+ "from",
26
+ "host",
27
+ "if-modified-since",
28
+ "if-unmodified-since",
29
+ "last-modified",
30
+ "location",
31
+ "max-forwards",
32
+ "proxy-authorization",
33
+ "referer",
34
+ "retry-after",
35
+ "server",
36
+ "user-agent"
37
+ ]);
38
+ const validHeaderName = /^[!#$%&'*+\-.^_`|~\dA-Za-z]+$/;
39
+ const isHttpWhitespace = (code) => code === 9 || code === 10 || code === 13 || code === 32;
40
+ const normalizeHeaderValue = (value) => {
41
+ if (!isHttpWhitespace(value.charCodeAt(0)) && !isHttpWhitespace(value.charCodeAt(value.length - 1))) return value;
42
+ let start = 0;
43
+ let end = value.length;
44
+ while (start < end && isHttpWhitespace(value.charCodeAt(start))) start++;
45
+ while (end > start && isHttpWhitespace(value.charCodeAt(end - 1))) end--;
46
+ return value.slice(start, end);
47
+ };
48
+ const forbiddenHeaderValue = /[\0\r\n]/;
49
+ const GlobalHeaders = globalThis.Headers;
50
+ const materializeHeaders = (rawHeaders, HeadersCtor = GlobalHeaders) => {
51
+ const headers = new HeadersCtor();
52
+ for (let i = 0; i < rawHeaders.length; i += 2) {
53
+ const name = rawHeaders[i];
54
+ if (!name.startsWith(":")) headers.append(name, rawHeaders[i + 1]);
55
+ }
56
+ return headers;
57
+ };
58
+ var RequestHeaders = class {
59
+ #incoming;
60
+ #rawHeaders;
61
+ #headers;
62
+ #invalidValue;
63
+ constructor(incoming) {
64
+ this.#incoming = incoming;
65
+ if (incoming instanceof node_http2.Http2ServerRequest) this.#rawHeaders = incoming.rawHeaders.slice();
66
+ }
67
+ get #lazyRawHeaders() {
68
+ return this.#rawHeaders ??= this.#incoming.rawHeaders.slice();
69
+ }
70
+ get #native() {
71
+ if (!this.#headers) {
72
+ this.#headers = materializeHeaders(this.#lazyRawHeaders);
73
+ this.#rawHeaders = void 0;
74
+ }
75
+ return this.#headers;
76
+ }
77
+ #normalizedName(name) {
78
+ if (typeof name !== "string") return;
79
+ if (!validHeaderName.test(name)) throw new TypeError(`Invalid header name: ${name}`);
80
+ return name.toLowerCase();
81
+ }
82
+ #lookupHttp1(lowerName) {
83
+ const headers = this.#incoming instanceof node_http2.Http2ServerRequest ? void 0 : this.#incoming.headers;
84
+ if (!headers || nonJoinedHeaders.has(lowerName) || lowerName === "set-cookie" || lowerName === "__proto__") return;
85
+ if (!Object.hasOwn(headers, lowerName)) return null;
86
+ const rawValue = headers[lowerName];
87
+ if (typeof rawValue === "string") {
88
+ const value = normalizeHeaderValue(rawValue);
89
+ return forbiddenHeaderValue.test(value) ? void 0 : value;
90
+ }
91
+ }
92
+ #lookup(rawHeaders, lowerName) {
93
+ const separator = lowerName === "cookie" ? "; " : ", ";
94
+ let value = null;
95
+ for (let i = 0; i < rawHeaders.length; i += 2) {
96
+ const rawName = rawHeaders[i];
97
+ if (rawName.length === lowerName.length && rawName.toLowerCase() === lowerName) {
98
+ const rawValue = normalizeHeaderValue(rawHeaders[i + 1]);
99
+ if (forbiddenHeaderValue.test(rawValue)) {
100
+ this.#invalidValue = true;
101
+ return;
102
+ }
103
+ value = value === null ? rawValue : value + separator + rawValue;
104
+ }
105
+ }
106
+ return value;
107
+ }
108
+ append(name, value) {
109
+ this.#native.append(name, value);
110
+ }
111
+ delete(name) {
112
+ this.#native.delete(name);
113
+ }
114
+ get(name) {
115
+ const lowerName = this.#normalizedName(name);
116
+ if (lowerName && !this.#headers && !this.#invalidValue) {
117
+ const http1Value = this.#lookupHttp1(lowerName);
118
+ if (http1Value !== void 0) return http1Value;
119
+ const value = this.#lookup(this.#lazyRawHeaders, lowerName);
120
+ if (value !== void 0) return value;
121
+ }
122
+ return this.#native.get(name);
123
+ }
124
+ has(name) {
125
+ const lowerName = this.#normalizedName(name);
126
+ if (lowerName && !this.#headers && !this.#invalidValue) {
127
+ const http1Value = this.#lookupHttp1(lowerName);
128
+ if (http1Value !== void 0) return http1Value !== null;
129
+ const value = this.#lookup(this.#lazyRawHeaders, lowerName);
130
+ if (value !== void 0) return value !== null;
131
+ }
132
+ return this.#native.has(name);
133
+ }
134
+ set(name, value) {
135
+ this.#native.set(name, value);
136
+ }
137
+ getSetCookie() {
138
+ return this.#native.getSetCookie();
139
+ }
140
+ keys() {
141
+ return this.#native.keys();
142
+ }
143
+ values() {
144
+ return this.#native.values();
145
+ }
146
+ entries() {
147
+ return this.#native.entries();
148
+ }
149
+ forEach(callback, thisArg) {
150
+ this.#native.forEach((value, key) => {
151
+ callback.call(thisArg, value, key, this);
152
+ });
153
+ }
154
+ [Symbol.iterator]() {
155
+ return this.entries();
156
+ }
157
+ };
158
+ Object.defineProperty(RequestHeaders.prototype, Symbol.for("nodejs.util.inspect.custom"), { value: function(depth, options, inspectFn) {
159
+ return `Headers (lightweight) ${inspectFn(Object.fromEntries(this), {
160
+ ...options,
161
+ depth: depth == null ? null : depth - 1
162
+ })}`;
163
+ } });
164
+ Object.setPrototypeOf(RequestHeaders.prototype, GlobalHeaders.prototype);
165
+ const newHeadersFromIncoming = (incoming) => globalThis.Headers === GlobalHeaders ? new RequestHeaders(incoming) : materializeHeaders(incoming.rawHeaders, globalThis.Headers);
166
+
16
167
  //#endregion
17
168
  //#region src/url.ts
18
169
  const reValidRequestUrl = /^\/[!#$&-;=?-\[\]_a-z~]*$/;
@@ -50,15 +201,6 @@ var Request$1 = class extends GlobalRequest {
50
201
  super(input, options);
51
202
  }
52
203
  };
53
- const newHeadersFromIncoming = (incoming) => {
54
- const headerRecord = [];
55
- const rawHeaders = incoming.rawHeaders;
56
- for (let i = 0, len = rawHeaders.length; i < len; i += 2) {
57
- const key = rawHeaders[i];
58
- if (key.charCodeAt(0) !== 58) headerRecord.push([key, rawHeaders[i + 1]]);
59
- }
60
- return new Headers(headerRecord);
61
- };
62
204
  const wrapBodyStream = Symbol("wrapBodyStream");
63
205
  const byteExactEncodings = new Set([
64
206
  "latin1",
@@ -12,6 +12,157 @@ var RequestError = class extends Error {
12
12
  }
13
13
  };
14
14
 
15
+ //#endregion
16
+ //#region src/headers.ts
17
+ const nonJoinedHeaders = new Set([
18
+ "age",
19
+ "authorization",
20
+ "content-length",
21
+ "content-type",
22
+ "etag",
23
+ "expires",
24
+ "from",
25
+ "host",
26
+ "if-modified-since",
27
+ "if-unmodified-since",
28
+ "last-modified",
29
+ "location",
30
+ "max-forwards",
31
+ "proxy-authorization",
32
+ "referer",
33
+ "retry-after",
34
+ "server",
35
+ "user-agent"
36
+ ]);
37
+ const validHeaderName = /^[!#$%&'*+\-.^_`|~\dA-Za-z]+$/;
38
+ const isHttpWhitespace = (code) => code === 9 || code === 10 || code === 13 || code === 32;
39
+ const normalizeHeaderValue = (value) => {
40
+ if (!isHttpWhitespace(value.charCodeAt(0)) && !isHttpWhitespace(value.charCodeAt(value.length - 1))) return value;
41
+ let start = 0;
42
+ let end = value.length;
43
+ while (start < end && isHttpWhitespace(value.charCodeAt(start))) start++;
44
+ while (end > start && isHttpWhitespace(value.charCodeAt(end - 1))) end--;
45
+ return value.slice(start, end);
46
+ };
47
+ const forbiddenHeaderValue = /[\0\r\n]/;
48
+ const GlobalHeaders = globalThis.Headers;
49
+ const materializeHeaders = (rawHeaders, HeadersCtor = GlobalHeaders) => {
50
+ const headers = new HeadersCtor();
51
+ for (let i = 0; i < rawHeaders.length; i += 2) {
52
+ const name = rawHeaders[i];
53
+ if (!name.startsWith(":")) headers.append(name, rawHeaders[i + 1]);
54
+ }
55
+ return headers;
56
+ };
57
+ var RequestHeaders = class {
58
+ #incoming;
59
+ #rawHeaders;
60
+ #headers;
61
+ #invalidValue;
62
+ constructor(incoming) {
63
+ this.#incoming = incoming;
64
+ if (incoming instanceof Http2ServerRequest) this.#rawHeaders = incoming.rawHeaders.slice();
65
+ }
66
+ get #lazyRawHeaders() {
67
+ return this.#rawHeaders ??= this.#incoming.rawHeaders.slice();
68
+ }
69
+ get #native() {
70
+ if (!this.#headers) {
71
+ this.#headers = materializeHeaders(this.#lazyRawHeaders);
72
+ this.#rawHeaders = void 0;
73
+ }
74
+ return this.#headers;
75
+ }
76
+ #normalizedName(name) {
77
+ if (typeof name !== "string") return;
78
+ if (!validHeaderName.test(name)) throw new TypeError(`Invalid header name: ${name}`);
79
+ return name.toLowerCase();
80
+ }
81
+ #lookupHttp1(lowerName) {
82
+ const headers = this.#incoming instanceof Http2ServerRequest ? void 0 : this.#incoming.headers;
83
+ if (!headers || nonJoinedHeaders.has(lowerName) || lowerName === "set-cookie" || lowerName === "__proto__") return;
84
+ if (!Object.hasOwn(headers, lowerName)) return null;
85
+ const rawValue = headers[lowerName];
86
+ if (typeof rawValue === "string") {
87
+ const value = normalizeHeaderValue(rawValue);
88
+ return forbiddenHeaderValue.test(value) ? void 0 : value;
89
+ }
90
+ }
91
+ #lookup(rawHeaders, lowerName) {
92
+ const separator = lowerName === "cookie" ? "; " : ", ";
93
+ let value = null;
94
+ for (let i = 0; i < rawHeaders.length; i += 2) {
95
+ const rawName = rawHeaders[i];
96
+ if (rawName.length === lowerName.length && rawName.toLowerCase() === lowerName) {
97
+ const rawValue = normalizeHeaderValue(rawHeaders[i + 1]);
98
+ if (forbiddenHeaderValue.test(rawValue)) {
99
+ this.#invalidValue = true;
100
+ return;
101
+ }
102
+ value = value === null ? rawValue : value + separator + rawValue;
103
+ }
104
+ }
105
+ return value;
106
+ }
107
+ append(name, value) {
108
+ this.#native.append(name, value);
109
+ }
110
+ delete(name) {
111
+ this.#native.delete(name);
112
+ }
113
+ get(name) {
114
+ const lowerName = this.#normalizedName(name);
115
+ if (lowerName && !this.#headers && !this.#invalidValue) {
116
+ const http1Value = this.#lookupHttp1(lowerName);
117
+ if (http1Value !== void 0) return http1Value;
118
+ const value = this.#lookup(this.#lazyRawHeaders, lowerName);
119
+ if (value !== void 0) return value;
120
+ }
121
+ return this.#native.get(name);
122
+ }
123
+ has(name) {
124
+ const lowerName = this.#normalizedName(name);
125
+ if (lowerName && !this.#headers && !this.#invalidValue) {
126
+ const http1Value = this.#lookupHttp1(lowerName);
127
+ if (http1Value !== void 0) return http1Value !== null;
128
+ const value = this.#lookup(this.#lazyRawHeaders, lowerName);
129
+ if (value !== void 0) return value !== null;
130
+ }
131
+ return this.#native.has(name);
132
+ }
133
+ set(name, value) {
134
+ this.#native.set(name, value);
135
+ }
136
+ getSetCookie() {
137
+ return this.#native.getSetCookie();
138
+ }
139
+ keys() {
140
+ return this.#native.keys();
141
+ }
142
+ values() {
143
+ return this.#native.values();
144
+ }
145
+ entries() {
146
+ return this.#native.entries();
147
+ }
148
+ forEach(callback, thisArg) {
149
+ this.#native.forEach((value, key) => {
150
+ callback.call(thisArg, value, key, this);
151
+ });
152
+ }
153
+ [Symbol.iterator]() {
154
+ return this.entries();
155
+ }
156
+ };
157
+ Object.defineProperty(RequestHeaders.prototype, Symbol.for("nodejs.util.inspect.custom"), { value: function(depth, options, inspectFn) {
158
+ return `Headers (lightweight) ${inspectFn(Object.fromEntries(this), {
159
+ ...options,
160
+ depth: depth == null ? null : depth - 1
161
+ })}`;
162
+ } });
163
+ Object.setPrototypeOf(RequestHeaders.prototype, GlobalHeaders.prototype);
164
+ const newHeadersFromIncoming = (incoming) => globalThis.Headers === GlobalHeaders ? new RequestHeaders(incoming) : materializeHeaders(incoming.rawHeaders, globalThis.Headers);
165
+
15
166
  //#endregion
16
167
  //#region src/url.ts
17
168
  const reValidRequestUrl = /^\/[!#$&-;=?-\[\]_a-z~]*$/;
@@ -49,15 +200,6 @@ var Request$1 = class extends GlobalRequest {
49
200
  super(input, options);
50
201
  }
51
202
  };
52
- const newHeadersFromIncoming = (incoming) => {
53
- const headerRecord = [];
54
- const rawHeaders = incoming.rawHeaders;
55
- for (let i = 0, len = rawHeaders.length; i < len; i += 2) {
56
- const key = rawHeaders[i];
57
- if (key.charCodeAt(0) !== 58) headerRecord.push([key, rawHeaders[i + 1]]);
58
- }
59
- return new Headers(headerRecord);
60
- };
61
203
  const wrapBodyStream = Symbol("wrapBodyStream");
62
204
  const byteExactEncodings = new Set([
63
205
  "latin1",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hono/node-server",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Node.js Adapter for Hono",
5
5
  "main": "dist/index.mjs",
6
6
  "type": "module",
@@ -928,24 +928,27 @@ class Fields {
928
928
  }
929
929
 
930
930
  const getHttpHandlerExtensionConfiguration = (runtimeConfig) => {
931
+ if (runtimeConfig.logger && runtimeConfig.logger.constructor?.name !== "NoOpLogger") {
932
+ runtimeConfig.requestHandler?.updateHttpClientConfig?.(Symbol.for("logger"), runtimeConfig.logger);
933
+ }
931
934
  return {
932
935
  setHttpHandler(handler) {
933
- runtimeConfig.httpHandler = handler;
936
+ runtimeConfig.requestHandler = handler;
934
937
  },
935
938
  httpHandler() {
936
- return runtimeConfig.httpHandler;
939
+ return runtimeConfig.requestHandler;
937
940
  },
938
941
  updateHttpClientConfig(key, value) {
939
- runtimeConfig.httpHandler?.updateHttpClientConfig(key, value);
942
+ runtimeConfig.requestHandler?.updateHttpClientConfig(key, value);
940
943
  },
941
944
  httpHandlerConfigs() {
942
- return runtimeConfig.httpHandler.httpHandlerConfigs();
945
+ return runtimeConfig.requestHandler.httpHandlerConfigs();
943
946
  },
944
947
  };
945
948
  };
946
949
  const resolveHttpHandlerRuntimeConfig = (httpHandlerExtensionConfiguration) => {
947
950
  return {
948
- httpHandler: httpHandlerExtensionConfiguration.httpHandler(),
951
+ requestHandler: httpHandlerExtensionConfiguration.httpHandler(),
949
952
  };
950
953
  };
951
954