@jini-ai/http-kit 0.6.15 → 0.6.16

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @jini-ai/http-kit
2
2
 
3
+ ## 0.6.16
4
+
5
+ ### Patch Changes
6
+
7
+ - Remove the GitHub Copilot CLI agent: its def, `createCopilotStreamHandler`/`CopilotStreamEvent`,
8
+ account model discovery and the `@github/copilot-sdk` optional peer, the MCP installer's `copilot`
9
+ slug, and its icon. A saved `copilot` agent id no longer resolves (`getAgentDef` returns `null`).
10
+ CopilotKit/AG-UI is unrelated and unchanged.
11
+
12
+ Drop peers no runtime entry loads: `express` from core and http-kit (type-only imports; type
13
+ consumers keep `@types/express`), `vue` from ui-kit, `react-dom` from vibecoding.
14
+
3
15
  ## 0.6.13
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -12,8 +12,9 @@ lives in `@jini-ai/daemon/read-only-tools`. CMS settings live in `@jini-ai/cms/h
12
12
  npm install @jini-ai/http-kit express
13
13
  ```
14
14
 
15
- Regular dependencies are core, platform, protocol and Express. There is no daemon,
16
- agent-runtime or CMS dependency.
15
+ Regular dependencies are core, platform and protocol. Express is supplied by the host and
16
+ referenced only through erased types, so this package declares no Express runtime peer.
17
+ There is no daemon, agent-runtime or CMS dependency.
17
18
 
18
19
  ## Surface
19
20
 
@@ -1,21 +1,7 @@
1
1
  import { trimCharsEnd } from '@jini-ai/core/primitives';
2
2
  import { hasForbiddenRawUrlCharacter } from "./origin.js";
3
3
  import { createVerifiedOrigin } from "./types.js";
4
- /**
5
- * Loopback (including *.localhost and 127.0.0.0/8) cannot represent a public deployment. Rejecting
6
- * it also prevents a shared public-URL setting from overriding development TLS-derived schemes
7
- * with a workspace-setting HTTPS origin on a server that only answers HTTP.
8
- * Private network ranges remain valid: intranet deployments can legitimately use private hosts.
9
- */
10
- const LOOPBACK_HOSTS = new Set(["localhost", "0.0.0.0", "::1", "[::1]", "::", "[::]"]);
11
- const LOOPBACK_IPV4 = /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
12
- function isLoopbackHost(host) {
13
- if (LOOPBACK_HOSTS.has(host))
14
- return true;
15
- if (host.endsWith(".localhost"))
16
- return true;
17
- return LOOPBACK_IPV4.test(host);
18
- }
4
+ import { isLoopbackHost } from "./loopback-host.js";
19
5
  // Match candidate-origin normalization so a trailing DNS dot has one meaning across decisions.
20
6
  function normalizeHost(hostname) {
21
7
  const lowered = hostname.toLowerCase();
@@ -45,7 +31,7 @@ function refusalReason(url) {
45
31
  const host = normalizeHost(url.hostname);
46
32
  if (host === "")
47
33
  return "its host is empty";
48
- if (isLoopbackHost(host))
34
+ if (isLoopbackHost({ host }))
49
35
  return `'${host}' is a loopback host, not a public origin`;
50
36
  return null;
51
37
  }
@@ -0,0 +1,9 @@
1
+ /** Public identity must not name a development listener. Normalize URL spellings first so
2
+ * shortened IPv4 and IPv4-mapped IPv6 cannot bypass the same rule used for localhost.
3
+ * Private intranet hosts remain valid. Invalid hosts are left to the caller's URL validation.
4
+ * @complexity O(host bytes), pure; parse failures return false.
5
+ */
6
+ export declare function isLoopbackHost({ host }: {
7
+ host: string;
8
+ }, _options?: {}): boolean;
9
+ //# sourceMappingURL=loopback-host.d.ts.map
@@ -0,0 +1,17 @@
1
+ /** Public identity must not name a development listener. Normalize URL spellings first so
2
+ * shortened IPv4 and IPv4-mapped IPv6 cannot bypass the same rule used for localhost.
3
+ * Private intranet hosts remain valid. Invalid hosts are left to the caller's URL validation.
4
+ * @complexity O(host bytes), pure; parse failures return false.
5
+ */
6
+ export function isLoopbackHost({ host }, _options = {}) {
7
+ let hostname;
8
+ const authority = host.includes(":") && !host.startsWith("[") ? `[${host}]` : host;
9
+ try {
10
+ hostname = new URL(`http://${authority}`).hostname.toLowerCase().replace(/\.$/, "");
11
+ }
12
+ catch {
13
+ return false;
14
+ }
15
+ return /^(?:localhost|.*\.localhost|127\.\d+\.\d+\.\d+|0\.0\.0\.0|\[(?:::1|::|::ffff:7f[\da-f]{2}:[\da-f]+)\])$/.test(hostname);
16
+ }
17
+ //# sourceMappingURL=loopback-host.js.map
@@ -23,9 +23,11 @@ export declare class OriginNotVerifiedError extends Error {
23
23
  message: string;
24
24
  });
25
25
  }
26
- /** Copy stored evidence, rejecting an HTTP public origin with InsecureOriginSourceError.
27
- * @complexity O(1) time and space; pure, with no ownership or reachability probe.
26
+ /** Copy evidence, refusing HTTP public origins and treating public loopback origins as unset.
27
+ * Both writers and registry reads use this boundary, including reads of legacy persisted rows.
28
+ * @throws InsecureOriginSourceError for HTTP public evidence; OriginNotVerifiedError for loopback public evidence.
29
+ * @complexity O(host bytes) time and space; pure, with no ownership or reachability probe.
28
30
  * @example createVerifiedOrigin({ scheme: "https", host: "example.com", verifiedAt, source: "workspace-setting" });
29
31
  */
30
- export declare function createVerifiedOrigin(input: VerifiedOrigin): VerifiedOrigin;
32
+ export declare function createVerifiedOrigin(input: VerifiedOrigin, _options?: Record<string, never>): VerifiedOrigin;
31
33
  //# sourceMappingURL=types.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { isLoopbackHost } from "./loopback-host.js";
1
2
  export class InsecureOriginSourceError extends Error {
2
3
  constructor({ message }) { super(message); }
3
4
  }
@@ -6,11 +7,13 @@ export class InsecureOriginSourceError extends Error {
6
7
  export class OriginNotVerifiedError extends Error {
7
8
  constructor({ message }) { super(message); }
8
9
  }
9
- /** Copy stored evidence, rejecting an HTTP public origin with InsecureOriginSourceError.
10
- * @complexity O(1) time and space; pure, with no ownership or reachability probe.
10
+ /** Copy evidence, refusing HTTP public origins and treating public loopback origins as unset.
11
+ * Both writers and registry reads use this boundary, including reads of legacy persisted rows.
12
+ * @throws InsecureOriginSourceError for HTTP public evidence; OriginNotVerifiedError for loopback public evidence.
13
+ * @complexity O(host bytes) time and space; pure, with no ownership or reachability probe.
11
14
  * @example createVerifiedOrigin({ scheme: "https", host: "example.com", verifiedAt, source: "workspace-setting" });
12
15
  */
13
- export function createVerifiedOrigin(input) {
16
+ export function createVerifiedOrigin(input, _options = {}) {
14
17
  // Repositories and other adapters must construct evidence through this function; an object
15
18
  // literal can bypass the scheme/source invariant even though it satisfies the structural type.
16
19
  if (input.scheme === "http" && input.source !== "dev-capability") {
@@ -18,6 +21,10 @@ export function createVerifiedOrigin(input) {
18
21
  message: `origin scheme 'http' is only legal for source 'dev-capability' (got source '${input.source}')`
19
22
  });
20
23
  }
24
+ // Explicit dev capabilities may address a listener; a public site URL never may.
25
+ if (input.source === "workspace-setting" && isLoopbackHost({ host: input.host })) {
26
+ throw new OriginNotVerifiedError({ message: "a loopback host is not a verified public origin" });
27
+ }
21
28
  return { ...input };
22
29
  }
23
30
  //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jini-ai/http-kit",
3
- "version": "0.6.15",
3
+ "version": "0.6.16",
4
4
  "description": "Generic Express transport primitives, request parsing, response serialization, origin guards and route-pack mounting.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -71,25 +71,14 @@
71
71
  "@types/express": "^4.17.21",
72
72
  "@vitest/coverage-v8": "^2.1.9",
73
73
  "express": "^4.21.0",
74
- "@jini-ai/core": "0.6.15",
75
- "@jini-ai/protocol": "0.6.15",
76
- "@jini-ai/platform": "0.6.15"
74
+ "@jini-ai/core": "0.6.16",
75
+ "@jini-ai/platform": "0.6.16",
76
+ "@jini-ai/protocol": "0.6.16"
77
77
  },
78
78
  "dependencies": {
79
- "@jini-ai/protocol": "^0.6.15",
80
- "@jini-ai/core": "^0.6.15"
81
- },
82
- "peerDependencies": {
83
- "@jini-ai/platform": "^0.6.10",
84
- "express": "^4.21.0 || ^5.0.0"
85
- },
86
- "peerDependenciesMeta": {
87
- "@jini-ai/platform": {
88
- "optional": true
89
- },
90
- "express": {
91
- "optional": true
92
- }
79
+ "@jini-ai/platform": "^0.6.16",
80
+ "@jini-ai/core": "^0.6.16",
81
+ "@jini-ai/protocol": "^0.6.16"
93
82
  },
94
83
  "scripts": {
95
84
  "build": "tsc -p tsconfig.json",