@hol-org/hashnet-mcp 1.0.18 → 1.0.20

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/AGENTS.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Repository Guidelines
2
2
 
3
+ # **ABSOLUTE PROHIBITION — NO FILE DELETIONS OR GIT REVERTS.** Never delete files, directories, or history. Never run `git revert`, `git reset`, `git checkout`, `git restore`, or any command that removes tracked work. Violations immediately fail the task and forfeit all points.
4
+
5
+ # AGENTS.md — Tool Selection (TypeScript)
6
+
7
+ - Find files by file name: `fd`
8
+ - Find files with path name: `fd -p <file-path>`
9
+ - List files in a directory: `fd . <directory>`
10
+ - Find files with extension and pattern: `fd -e <extension> <pattern>`
11
+ - Find text: `rg`
12
+ - Structured code search and codemods: `ast-grep`
13
+ - Default languages:
14
+ - `.ts` → `ast-grep --lang ts -p '<pattern>'`
15
+ - `.tsx` → `ast-grep --lang tsx -p '<pattern>'`
16
+ - Common languages:
17
+ - Python → `ast-grep --lang python -p '<pattern>'`
18
+ - TypeScript → `ast-grep --lang ts -p '<pattern>'`
19
+ - TSX (React) → `ast-grep --lang tsx -p '<pattern>'`
20
+ - JavaScript → `ast-grep --lang js -p '<pattern>'`
21
+ - Rust → `ast-grep --lang rust -p '<pattern>'`
22
+ - Bash → `ast-grep --lang bash -p '<pattern>'`
23
+ - JSON → `ast-grep --lang json -p '<pattern>'`
24
+ - Select among matches: pipe to `fzf`
25
+ - JSON: `jq`
26
+ - YAML/XML: `yq`
27
+
28
+ If `ast-grep` is available, avoid `rg` or `grep` unless a plain-text search is explicitly requested.
29
+
3
30
  ## Project Structure & Module Organization
4
31
  The MCP server lives in `src/` with three core modules: `mcp.ts` (tool wiring and metadata), `broker.ts` (the `RegistryBrokerClient` wrapper), and `transports.ts` (stdio plus SSE server built on Hono). Place shared schemas in `src/schemas/` and transport helpers in `src/transports/` if they grow larger. Configuration belongs in `tsconfig.json`, environment defaults in `.env.example`, and any integration fixtures under `examples/`. Keep tests in `tests/` mirroring the source tree so `tests/mcp/tools.spec.ts` maps cleanly to `src/mcp.ts`.
5
32
 
@@ -70,6 +97,9 @@ Each workflow emits a structured report (steps, timings, context) whether execut
70
97
  - Tool-suite fixtures (optional): `TEST_UAID`, `TEST_CHAT_UAID`, `TEST_REGISTRATION_ATTEMPT_ID`, and `BROKER_PROTOCOL_TOOLS`. Populate them (see `.env.example`) so `pnpm test:tools` can exercise UAID/chat flows locally or skip protocol checks when the broker doesn’t expose those endpoints; leave blank to rely on auto-discovered UAIDs/attempt IDs from the preceding scenarios.
71
98
  Workflow pipelines declare their required env vars and will fail fast with a descriptive error if anything is missing; payload-specific secrets (OpenRouter tokens, Agentverse headers, bearer tokens) should be supplied via `.env` or injected by your CLI before invoking the workflow.
72
99
 
100
+ ### Memory (optional)
101
+ - Set `MEMORY_ENABLED=1` to enable local memory capture (SQLite by default; see `.env.example` for limits and store selection). When enabled, workflows like `workflow.chatSmoke`, `workflow.openrouterChat`, `workflow.historyTopUp`, `workflow.registryBrokerShowcase`, and `workflow.fullRegistration` will load scoped context (uaid/session/namespace) and append discovery/chat traces. Pass `disableMemory: true` in workflow inputs to opt out even when memory is enabled.
102
+
73
103
  ### Running `pnpm workflow:register`
74
104
  1. The CLI prompts for display name, alias, description, MCP URL, chat message, and report path (defaults provided).
75
105
  2. Runs the registration → chat → ops pipelines and prints progress to the console.
package/README.md CHANGED
@@ -93,7 +93,7 @@ Use `"type": "sse"` if your build expects it.
93
93
  Categories are exposed as MCP tools (`hol.*`) plus workflows (`workflow.*`):
94
94
  - **Discovery**: `hol.search`, `hol.vectorSearch`, `hol.registrySearchByNamespace`, `hol.resolveUaid`
95
95
  - **Registration**: `hol.getRegistrationQuote`, `hol.registerAgent`, `hol.waitForRegistrationCompletion`, `hol.updateAgent`
96
- - **Chat**: `hol.chat.createSession` (uaid preferred), `hol.chat.sendMessage` (sessionId or uaid; auto-creates session), `hol.chat.history`, `hol.chat.compact`, `hol.chat.end`, `hol.closeUaidConnection`
96
+ - **Chat**: `hol.chat.createSession` (uaid or agentUrl), `hol.chat.sendMessage` (sessionId or uaid/agentUrl; auto-creates session), `hol.chat.history`, `hol.chat.compact`, `hol.chat.end`, `hol.closeUaidConnection`
97
97
  - **Protocols/Ops**: `hol.listProtocols`, `hol.detectProtocol`, `hol.stats`, `hol.metricsSummary`, `hol.dashboardStats`, `hol.websocketStats`
98
98
  - **Credits**: `hol.credits.balance`, `hol.purchaseCredits.hbar`, `hol.x402.minimums`, `hol.x402.buyCredits`
99
99
  - **Ledger**: `hol.ledger.challenge`, `hol.ledger.authenticate`
@@ -105,6 +105,14 @@ Categories are exposed as MCP tools (`hol.*`) plus workflows (`workflow.*`):
105
105
  - **Chat**: Start with `hol.chat.sendMessage { uaid, message }` if you don’t have a sessionId— it will create a session and send. Otherwise use `hol.chat.createSession` then `hol.chat.sendMessage { sessionId, message }`. Manage with `hol.chat.history/compact/end`.
106
106
  - **Ops/Health**: `workflow.opsCheck` or the `hol.stats`/`hol.metricsSummary`/`hol.dashboardStats` trio.
107
107
  - **Credits**: Always check `hol.credits.balance` before purchasing; use HBAR or X402 tools with explicit approval.
108
+ - **Memory**: When `MEMORY_ENABLED=1`, workflows (chatSmoke, openrouterChat, historyTopUp, registryBrokerShowcase, fullRegistration) will load scoped context and append chat/discovery traces; pass `disableMemory: true` to skip.
109
+
110
+ ## Memory (how it works)
111
+ - Enable with `MEMORY_ENABLED=1` (defaults to a file-backed store at `MEMORY_STORAGE_PATH`; use `MEMORY_STORE=memory` for in-memory only, or `MEMORY_STORE=sqlite` if you want SQLite and have native build tools installed). Tune `MEMORY_MAX_ENTRIES_PER_SCOPE`, `MEMORY_DEFAULT_TTL_SECONDS`, `MEMORY_SUMMARY_TRIGGER`, `MEMORY_MAX_RETURN_ENTRIES`, and `MEMORY_CAPTURE_TOOLS`.
112
+ - MCP tools: `hol.memory.context`, `hol.memory.note`, `hol.memory.search`, `hol.memory.clear` (see `help://hol/memory`). Scopes use `uaid`, `sessionId`, `namespace`, or `userId`.
113
+ - Automatic capture: `hol.chat.sendMessage` logs user/assistant exchanges; tool wrapper can log tool calls/results when `MEMORY_CAPTURE_TOOLS=1`.
114
+ - Workflows: `chatSmoke`, `openrouterChat`, `historyTopUp`, `registryBrokerShowcase`, and `fullRegistration` load prior context and append transcripts/results when memory is enabled. Add `disableMemory: true` in workflow inputs to opt out.
115
+ - Guardrails: entries are truncated to stay within size budgets, secrets are redacted, TTL + max-entries bounds keep storage from growing unbounded. Summaries are generated heuristically once thresholds are exceeded.
108
116
 
109
117
  ## Tool catalog (what each does)
110
118
  **Discovery**
@@ -122,12 +130,11 @@ Categories are exposed as MCP tools (`hol.*`) plus workflows (`workflow.*`):
122
130
  - `hol.additionalRegistries` — catalog of additional registries/networks.
123
131
 
124
132
  **Chat**
125
- - `hol.chat.createSession` — open a session by `uaid` (preferred).
126
- - `hol.chat.sendMessage` — send to an existing sessionId or auto-create via `uaid`.
133
+ - `hol.chat.createSession` — open a session by `uaid` or `agentUrl`.
134
+ - `hol.chat.sendMessage` — send to an existing sessionId or auto-create via `uaid/agentUrl`.
127
135
  - `hol.chat.history` / `hol.chat.compact` / `hol.chat.end` — manage chat lifecycle.
128
136
 
129
137
  **Protocols / Ops**
130
- - `hol.listProtocols`, `hol.detectProtocol` — inspect/route inbound payloads.
131
138
  - `hol.stats`, `hol.metricsSummary`, `hol.dashboardStats`, `hol.websocketStats` — broker health/metrics.
132
139
 
133
140
  **Credits**
@@ -150,6 +157,7 @@ Set in `.env` or your process:
150
157
  - `REGISTRY_BROKER_API_URL` (default `https://registry.hashgraphonline.com/api/v1`)
151
158
  - `REGISTRY_BROKER_API_KEY` (required for live broker)
152
159
  - Optional: `HEDERA_ACCOUNT_ID`, `HEDERA_PRIVATE_KEY` (auto top-up), `LOG_LEVEL`, `PORT`, `HTTP_STREAM_PORT`, `BROKER_*` rate limit vars, `WORKFLOW_DRY_RUN`, `BROKER_AUTO_TOP_UP`.
160
+ - Memory (optional): set `MEMORY_ENABLED=1` to enable local storage (defaults to file-backed JSON at `MEMORY_STORAGE_PATH`; use `MEMORY_STORE=memory` for in-memory only, or `MEMORY_STORE=sqlite` if you want SQLite with native deps). Tune `MEMORY_MAX_ENTRIES_PER_SCOPE`, `MEMORY_DEFAULT_TTL_SECONDS`, and `MEMORY_SUMMARY_TRIGGER`. See `help://hol/memory` for the `hol.memory.*` tools.
153
161
 
154
162
  ## Testing & quality
155
163
  - Run once with coverage: `pnpm test --run --coverage`