@amaranthic/hernex 0.3.0 → 0.4.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.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,49 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ---
8
8
 
9
+ ## [0.4.0] - 2026-11-12
10
+
11
+ ### Summary
12
+
13
+ Version `0.4.0` introduces the built-in `WebFetchTool` (`webFetch`), expanding Hernex's default tool registry to 8 core tools. Features include comprehensive Server-Side Request Forgery (SSRF) defense via `ipaddr.js`, automated HTML-to-Markdown conversion using `turndown`, cross-host redirect safety halts, a 15-minute in-memory response cache, and model-driven focused extraction with exponential backoff retries.
14
+
15
+ ---
16
+
17
+ ### New Features
18
+
19
+ - **Built-in `WebFetchTool` (`webFetch`)**:
20
+ - Registered as the 8th default tool in `ToolRegistry` alongside file and shell tools.
21
+ - Automatically fetches HTTP and HTTPS web resources and converts HTML directly into clean Markdown using `TurndownService`.
22
+ - Formats `application/json` responses into syntax-highlighted code blocks and handles plain text.
23
+
24
+ - **SSRF Defense Architecture (`ssrfGuard`)**:
25
+ - Validates all destination addresses using `ipaddr.js`.
26
+ - Rejects private IPv4 networks (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`), loopback (`127.0.0.0/8`), link-local / IMDS (`169.254.0.0/16`), carrier-grade NAT (`100.64.0.0/10`), unspecified (`0.0.0.0/8`), multicast, and reserved ranges.
27
+ - Rejects IPv6 loopback (`::1`), link-local (`fe80::/10`), unique local (`fc00::/7`), and IPv4-mapped IPv6 variants (`::ffff:x.x.x.x`).
28
+ - Blocks local host suffixes (`.local`, `.internal`, `.localhost`, `.lan`), single-label internal hosts, cloud metadata endpoints (`metadata.google.internal`, `instance-data`), and embedded basic auth credentials.
29
+
30
+ - **Cross-Host Redirect Safety**:
31
+ - Follows permitted same-host and `www.` redirects up to 5 hops.
32
+ - Halts cross-host redirects and returns a notice with the target location, preserving agent control and security oversight over unexpected domain jumps.
33
+
34
+ - **In-Memory Response Caching**:
35
+ - Implements a 15-minute response cache (`cacheTtlMs: 900,000`).
36
+ - Subsequent requests targeting identical URLs within TTL return cached Markdown (`cached: true`) with zero network latency.
37
+
38
+ - **Model-Driven Targeted Extraction**:
39
+ - Supports optional `prompt` parameter on `webFetch`.
40
+ - If omitted: returns clean page Markdown directly (zero extra token overhead).
41
+ - If provided: runs single-turn extraction via Hernex's `generateText` runtime using the turn's active model and credentials, with up to 5 retry attempts and exponential backoff on transient errors.
42
+
43
+ ---
44
+
45
+ ### Bug Fixes & Resilience Hardening
46
+
47
+ - **Storage Stale-Lock Recovery Test**:
48
+ - Corrected hardcoded PID `1234` in `tests/storage.test.ts` to use `process.pid`, ensuring the process liveness probe accurately tests timeout behavior against an active lock holder.
49
+
50
+ ---
51
+
9
52
  ## [0.3.0] - 2026-11-12
10
53
 
11
54
  ### Summary
package/README.md CHANGED
@@ -58,7 +58,7 @@ for await (const event of engine.runTurn("Check working directory status")) {
58
58
  - [Agent Engine & Turn Lifecycle](docs/agent.md)
59
59
  - [Outward Streaming Events](docs/events.md)
60
60
  - [Inward Interception Hooks](docs/hooks.md)
61
- - [Tool Registry & Process Tools](docs/tools.md)
61
+ - [Tool Registry & Built-In Tools](docs/tools.md)
62
62
 
63
63
  ---
64
64
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaranthic/hernex",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Unified AI agent runtime, microkernel engine, and tool harnesses built on Vercel AI SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -57,11 +57,14 @@
57
57
  "@ai-sdk/togetherai": "3.0.76",
58
58
  "@ai-sdk/xai": "5.0.27",
59
59
  "ai": "7.0.148",
60
+ "ipaddr.js": "2.5.0",
61
+ "turndown": "7.2.5",
60
62
  "zod": "4.6.7"
61
63
  },
62
64
  "devDependencies": {
63
65
  "@types/bun": "^1.4.3",
64
66
  "@types/node": "26.6.5",
67
+ "@types/turndown": "5.0.6",
65
68
  "typescript": "7.0.2"
66
69
  }
67
70
  }