@jini-ai/platform 0.5.6 → 0.5.7

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,9 @@
1
1
  # @jini-ai/platform
2
2
 
3
+ ## 0.5.7 — 2026-10-14
4
+
5
+ - The asset cache's optional `undici` load moves behind `asset-cache.adapter.ts` (64eafe35); injected dispatchers, DNS validation and the MODULE_NOT_FOUND message are unchanged. No API change.
6
+
3
7
  ## 0.5.6 — 2026-10-13
4
8
 
5
9
  - `undici` and `hast-util-from-parse5`, `hast-util-to-mdast`, `mdast-util-to-markdown`, `mdast-util-gfm-table` (with `parse5`) are now optional peers instead of dependencies. Only `./web` needs the HTML/Markdown set; only the default `createAssetCacheDispatcher` needs undici, loaded lazily (a missing peer throws `AssetCacheError` 500; a host-supplied dispatcher needs none). Hosts using those must list the packages themselves.
@@ -0,0 +1,9 @@
1
+ import type { LookupFunction } from 'node:net';
2
+ import type { Agent } from 'undici';
3
+ /** Load the optional vendor only for a default dispatcher; the cache owns lookup validation.
4
+ * @throws When the optional peer cannot be loaded or its Agent cannot be constructed.
5
+ */
6
+ export declare function createUndiciAssetCacheDispatcher({ lookup }: {
7
+ lookup: LookupFunction;
8
+ }, _options?: Record<string, never>): Agent;
9
+ //# sourceMappingURL=asset-cache.adapter.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { createRequire } from 'node:module';
2
+ const require = createRequire(import.meta.url);
3
+ /** Load the optional vendor only for a default dispatcher; the cache owns lookup validation.
4
+ * @throws When the optional peer cannot be loaded or its Agent cannot be constructed.
5
+ */
6
+ export function createUndiciAssetCacheDispatcher({ lookup }, _options = {}) {
7
+ const { Agent } = require('undici');
8
+ return new Agent({ connect: { lookup } });
9
+ }
10
+ //# sourceMappingURL=asset-cache.adapter.js.map
@@ -23,10 +23,9 @@ import { createHash } from 'node:crypto';
23
23
  import { lookup as dnsLookupCb } from 'node:dns';
24
24
  import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
25
25
  import { isIP } from 'node:net';
26
- import { createRequire } from 'node:module';
27
26
  import path from 'node:path';
27
+ import { createUndiciAssetCacheDispatcher } from './asset-cache.adapter.js';
28
28
  import { isPrivateAddress } from './net/address.js';
29
- const require = createRequire(import.meta.url);
30
29
  /** Media extensions we are willing to cache + proxy. Anything else (HTML,
31
30
  * CSS, JS, fonts) is intentionally left alone so this surface never becomes a
32
31
  * general-purpose open proxy. */
@@ -133,9 +132,8 @@ export function createValidatingLookup(lookupImpl = dnsLookupCb) {
133
132
  */
134
133
  export function createAssetCacheDispatcher(_required, { lookupImpl } = {}) {
135
134
  // Keep the factory synchronous while root imports and host-supplied dispatchers need no undici.
136
- let undici;
137
135
  try {
138
- undici = require('undici');
136
+ return createUndiciAssetCacheDispatcher({ lookup: createValidatingLookup(lookupImpl) });
139
137
  }
140
138
  catch (error) {
141
139
  if (error instanceof Error && error.code === 'MODULE_NOT_FOUND'
@@ -144,7 +142,6 @@ export function createAssetCacheDispatcher(_required, { lookupImpl } = {}) {
144
142
  }
145
143
  throw error;
146
144
  }
147
- return new undici.Agent({ connect: { lookup: createValidatingLookup(lookupImpl) } });
148
145
  }
149
146
  /** Build a disk-backed cache for external sandboxed-content media. Concurrent
150
147
  * requests for the same URL share one in-flight fetch; completed fetches
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jini-ai/platform",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "Generic OS/platform primitives: process exec and lifecycle, filesystem containment, HTTP readiness polling, toolchain discovery, blob storage, AWS signing, and an SSRF-safe asset cache.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {