@gamaze/hicortex 0.23.2 → 0.24.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.
- package/README.md +3 -1
- package/assets/dashboard.html +181 -44
- package/dist/calibration.d.ts +31 -0
- package/dist/calibration.js +38 -1
- package/dist/capture.d.ts +7 -0
- package/dist/capture.js +10 -1
- package/dist/dashboard.d.ts +14 -0
- package/dist/dashboard.js +8 -0
- package/dist/db.js +45 -0
- package/dist/distill-queue.d.ts +203 -0
- package/dist/distill-queue.js +440 -0
- package/dist/health.d.ts +13 -1
- package/dist/health.js +6 -1
- package/dist/hosted-boot.d.ts +1 -1
- package/dist/llm.d.ts +4 -0
- package/dist/llm.js +23 -4
- package/dist/localhost-bypass.js +1 -1
- package/dist/mcp-server.js +87 -5
- package/dist/nightly.js +87 -0
- package/dist/nofit.d.ts +1 -1
- package/dist/nofit.js +1 -1
- package/dist/schema-prototypes.d.ts +1 -1
- package/dist/schema-prototypes.js +1 -1
- package/dist/status.d.ts +11 -0
- package/dist/status.js +25 -0
- package/dist/types.d.ts +28 -0
- package/hermes-plugin/hicortex/README.md +13 -6
- package/hermes-plugin/hicortex/__init__.py +7 -0
- package/hermes-plugin/hicortex/client.py +64 -2
- package/hermes-plugin/hicortex/plugin.yaml +1 -1
- package/hermes-plugin/hicortex/provider.py +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -6,10 +6,55 @@ Stdlib-only (no pip dependencies) so the plugin installs with zero friction.
|
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
|
|
8
8
|
import json
|
|
9
|
+
import logging
|
|
9
10
|
import urllib.error
|
|
10
11
|
import urllib.parse
|
|
11
12
|
import urllib.request
|
|
12
|
-
from typing import Any, Optional
|
|
13
|
+
from typing import Any, Optional, Tuple
|
|
14
|
+
|
|
15
|
+
logger = logging.getLogger(__name__)
|
|
16
|
+
|
|
17
|
+
# One-shot-per-process guard for the cleartext-transport warning. Clients are
|
|
18
|
+
# rebuilt per provider/config read; warning per construction would spam the
|
|
19
|
+
# gateway log on every rebuild.
|
|
20
|
+
_cleartext_warned = False
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _origin(url: str) -> Tuple[Optional[str], Optional[int]]:
|
|
24
|
+
"""(host, port) origin of a URL, default-port-normalized (http→80,
|
|
25
|
+
https→443) and lower-cased — the identity a redirect must preserve for the
|
|
26
|
+
Authorization header to be safe to keep. Unparseable URLs never compare
|
|
27
|
+
equal, so they fail CLOSED (token stripped)."""
|
|
28
|
+
try:
|
|
29
|
+
parsed = urllib.parse.urlparse(url)
|
|
30
|
+
port = parsed.port or (443 if parsed.scheme == "https" else 80)
|
|
31
|
+
return (parsed.hostname or "").lower(), port
|
|
32
|
+
except ValueError:
|
|
33
|
+
return (url, None)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class _AuthStrippingRedirectHandler(urllib.request.HTTPRedirectHandler):
|
|
37
|
+
"""Strip ``Authorization`` on any redirect that leaves the original origin.
|
|
38
|
+
|
|
39
|
+
urllib's default redirect handler forwards the request's headers to the
|
|
40
|
+
redirect target (only content headers — length/type/encoding — are
|
|
41
|
+
dropped), so a cross-host 302 hands the bearer token to whoever answers
|
|
42
|
+
the redirect. Same-origin redirects (path changes, trailing-slash fixes)
|
|
43
|
+
keep authenticating as before."""
|
|
44
|
+
|
|
45
|
+
def redirect_request(self, req, fp, code, msg, headers, newurl):
|
|
46
|
+
new_req = super().redirect_request(req, fp, code, msg, headers, newurl)
|
|
47
|
+
if new_req is not None and _origin(req.full_url) != _origin(newurl):
|
|
48
|
+
# Request headers are Capitalized by add_header ("Authorization").
|
|
49
|
+
new_req.headers.pop("Authorization", None)
|
|
50
|
+
new_req.unredirected_hdrs.pop("Authorization", None)
|
|
51
|
+
return new_req
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# Shared opener: urllib's defaults plus the auth-stripping redirect handler.
|
|
55
|
+
# `urlopen` cannot be used for this — it goes through the process-global
|
|
56
|
+
# default opener, which we must not reconfigure from inside a plugin.
|
|
57
|
+
_OPENER = urllib.request.build_opener(_AuthStrippingRedirectHandler)
|
|
13
58
|
|
|
14
59
|
|
|
15
60
|
class HicortexClient:
|
|
@@ -31,6 +76,23 @@ class HicortexClient:
|
|
|
31
76
|
if host in ("127.0.0.1", "localhost", "::1", "::ffff:127.0.0.1")
|
|
32
77
|
else auth_token
|
|
33
78
|
)
|
|
79
|
+
# Cleartext transport warning (catalog review 130093): a plain http://
|
|
80
|
+
# URL to a non-loopback host while a token is set means the token AND
|
|
81
|
+
# every prompt sent for recall cross the network unencrypted. WARN,
|
|
82
|
+
# never reject — plain http on a trusted private network (overlay
|
|
83
|
+
# networks, private overlay meshes) is a legitimate setup.
|
|
84
|
+
if self.auth_token and urllib.parse.urlparse(self.base_url).scheme != "https":
|
|
85
|
+
global _cleartext_warned
|
|
86
|
+
if not _cleartext_warned:
|
|
87
|
+
_cleartext_warned = True
|
|
88
|
+
logger.warning(
|
|
89
|
+
"hicortex: %s uses plain http:// on a non-loopback host "
|
|
90
|
+
"while an auth token is set — the token and every prompt "
|
|
91
|
+
"sent for recall cross the network in cleartext. Use "
|
|
92
|
+
"https://, or keep the server on a trusted private "
|
|
93
|
+
"network. (This warning fires once per process.)",
|
|
94
|
+
self.base_url,
|
|
95
|
+
)
|
|
34
96
|
self.timeout = timeout
|
|
35
97
|
|
|
36
98
|
def _headers(self) -> dict[str, str]:
|
|
@@ -69,7 +131,7 @@ class HicortexClient:
|
|
|
69
131
|
errors converted to statuses (never raised)."""
|
|
70
132
|
req = urllib.request.Request(url, data=data, headers=self._headers(), method=method)
|
|
71
133
|
try:
|
|
72
|
-
with
|
|
134
|
+
with _OPENER.open(req, timeout=timeout or self.timeout) as resp:
|
|
73
135
|
return resp.status, json.loads(resp.read().decode("utf-8"))
|
|
74
136
|
except urllib.error.HTTPError as e:
|
|
75
137
|
return e.code, self._parse_http_error(e)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
name: hicortex
|
|
2
|
-
version: 0.7.
|
|
2
|
+
version: 0.7.10
|
|
3
3
|
description: "Self-learning memory for Hermes agents — every session is distilled into lessons overnight, and your agent wakes up wiser. Pushes a compact per-turn recall index (lazy-loaded with hicortex_get), injects fresh lessons plus a per-agent standing context block, and exposes the full 9-tool memory surface (search, get, recent, ingest, lessons, index, graph, update, delete) via a shared Hicortex server. Stdlib-only. AFTER INSTALL: run `hermes memory setup`, select hicortex, enter the server URL + token (see the token env var description for where to find it)."
|
|
4
4
|
pip_dependencies: []
|
|
5
5
|
hooks: []
|
|
@@ -26,7 +26,7 @@ Recall: prefetch() -> POST /recall-index (pushed recall index, 0.14
|
|
|
26
26
|
|
|
27
27
|
Capture is NOT the plugin's job. A nightly reader on the Hicortex server
|
|
28
28
|
distills each agent's own session store (Hermes: ~/.hermes/profiles/<agent>/
|
|
29
|
-
state.db) centrally
|
|
29
|
+
state.db) centrally. This
|
|
30
30
|
plugin has no local LLM, no spool, no timer, and no capture path.
|
|
31
31
|
"""
|
|
32
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamaze/hicortex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.1",
|
|
4
4
|
"description": "Persistent agent identity for AI agents \u2014 a hand-edited identity layer, nightly-distilled experience, and lessons injected every session, shared across your whole fleet. Works with Hermes, OpenClaw, Claude Code, Pi, and opencode.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
package/server.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"name": "io.github.gamaze-labs/hicortex",
|
|
4
4
|
"title": "Hicortex \u2014 AI Fleet Memory",
|
|
5
5
|
"description": "Shared fleet memory for AI agents: nightly self-correction, recall every prompt (supported agents).",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.24.1",
|
|
7
7
|
"packages": [
|
|
8
8
|
{
|
|
9
9
|
"registryType": "npm",
|
|
10
10
|
"identifier": "@gamaze/hicortex",
|
|
11
|
-
"version": "0.
|
|
11
|
+
"version": "0.24.1",
|
|
12
12
|
"transport": {
|
|
13
13
|
"type": "stdio",
|
|
14
14
|
"command": "npx",
|