@totalreclaw/mcp-server 3.3.0-rc.1 → 3.3.0-rc.3
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/SKILL.md +203 -0
- package/dist/extraction/config.d.ts +35 -0
- package/dist/extraction/config.d.ts.map +1 -0
- package/dist/extraction/config.js +60 -0
- package/dist/extraction/config.js.map +1 -0
- package/dist/extraction/extractor.d.ts +305 -0
- package/dist/extraction/extractor.d.ts.map +1 -0
- package/dist/extraction/extractor.js +1257 -0
- package/dist/extraction/extractor.js.map +1 -0
- package/dist/extraction/llm-client.d.ts +236 -0
- package/dist/extraction/llm-client.d.ts.map +1 -0
- package/dist/extraction/llm-client.js +704 -0
- package/dist/extraction/llm-client.js.map +1 -0
- package/dist/extraction/llm-profile-reader.d.ts +145 -0
- package/dist/extraction/llm-profile-reader.d.ts.map +1 -0
- package/dist/extraction/llm-profile-reader.js +362 -0
- package/dist/extraction/llm-profile-reader.js.map +1 -0
- package/dist/index.js +162 -0
- package/dist/index.js.map +1 -1
- package/dist/trajectory-poller.d.ts +148 -0
- package/dist/trajectory-poller.d.ts.map +1 -0
- package/dist/trajectory-poller.js +304 -0
- package/dist/trajectory-poller.js.map +1 -0
- package/package.json +3 -2
package/SKILL.md
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: totalreclaw
|
|
3
|
+
description: "End-to-end encrypted, decentralized memory for OpenClaw via the totalreclaw MCP server. Set up an account once, then call totalreclaw__totalreclaw_remember and totalreclaw__totalreclaw_recall instead of writing to MEMORY.md / USER.md / local files. Trigger on 'install TotalReclaw', 'set up TotalReclaw', 'restore my recovery phrase', or any user statement that contains a preference / fact / decision / commitment about themselves."
|
|
4
|
+
version: 3.3.0-rc.3
|
|
5
|
+
author: TotalReclaw Team
|
|
6
|
+
license: MIT
|
|
7
|
+
homepage: https://totalreclaw.xyz
|
|
8
|
+
metadata:
|
|
9
|
+
openclaw:
|
|
10
|
+
requires:
|
|
11
|
+
env: []
|
|
12
|
+
bins: []
|
|
13
|
+
emoji: "🧠"
|
|
14
|
+
os: ["macos", "linux", "windows"]
|
|
15
|
+
keywords:
|
|
16
|
+
- memory
|
|
17
|
+
- e2ee
|
|
18
|
+
- e2e-encryption
|
|
19
|
+
- encryption
|
|
20
|
+
- privacy
|
|
21
|
+
- agent-memory
|
|
22
|
+
- persistent-context
|
|
23
|
+
- mcp
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
# TotalReclaw — MCP-only memory for OpenClaw agents
|
|
27
|
+
|
|
28
|
+
> **MCP-first install path.** This skill ships with `@totalreclaw/mcp-server` and gives the agent a full memory toolset over MCP. There is no `tr` CLI, no plugin install, no shell-side glue. All memory ops happen via the `totalreclaw__totalreclaw_*` tools the MCP server exposes.
|
|
29
|
+
|
|
30
|
+
## CRITICAL: How TotalReclaw stores memories (read first)
|
|
31
|
+
|
|
32
|
+
**TotalReclaw is end-to-end encrypted memory stored across a DECENTRALIZED NETWORK — not on a single company server.** Memories are encrypted with keys derived from the user's 12-word recovery phrase, submitted as Account Abstraction UserOps, and persisted on a public blockchain (Base Sepolia for free tier, Gnosis mainnet for paid). The Graph subgraph indexes them. The TotalReclaw relay only forwards encrypted bundles to the bundler and proxies subgraph reads — it never sees plaintext, can't read memories, and could be replaced by any compatible relay without losing data. No single company controls or can read user memories.
|
|
33
|
+
|
|
34
|
+
Forbidden vocabulary — these claims are WRONG:
|
|
35
|
+
- "local", "local-only", "stored locally", "on disk", "local memory", "local storage" — wrong direction (implies local-only).
|
|
36
|
+
- "stored on a relay server", "stored on TotalReclaw's server", "single server owned by", "TotalReclaw stores your", "company server" — wrong direction (implies centralized custody).
|
|
37
|
+
- "without an account" — wrong (an account is required to derive the encryption key).
|
|
38
|
+
|
|
39
|
+
Canonical line: **"Memories are encrypted with a key derived from your recovery phrase, submitted on-chain via Account Abstraction, and stored across a decentralized network. The relay only forwards encrypted bundles — it never sees plaintext. Only you can decrypt them, and only with your recovery phrase."**
|
|
40
|
+
|
|
41
|
+
## User-facing vocabulary
|
|
42
|
+
|
|
43
|
+
Internal terms the user does NOT know — translate when you must speak:
|
|
44
|
+
|
|
45
|
+
| Internal term | Say to the user |
|
|
46
|
+
|---|---|
|
|
47
|
+
| pair / pairing / paired account | "set up an account" / "your TotalReclaw account" |
|
|
48
|
+
| relay / relay server | (don't mention; if forced, say "the encrypted-bundle forwarder") |
|
|
49
|
+
| WS / WebSocket / handshake | (don't mention) |
|
|
50
|
+
| trapdoor / blind index / dedup-key | (don't mention) |
|
|
51
|
+
| subgraph / bundler / UserOp / Account Abstraction | (don't mention; if forced, "submitted on-chain to a decentralized network") |
|
|
52
|
+
| credentials.json / mnemonic file | "your recovery phrase" |
|
|
53
|
+
| MCP tool / MCP server | "your memory" / (don't mention) |
|
|
54
|
+
|
|
55
|
+
The word "pair" is internal jargon — never use it in user-visible prose. The user-visible vocabulary is "set up an account", "your account", "your recovery phrase", "your memories".
|
|
56
|
+
|
|
57
|
+
## Install (one-time)
|
|
58
|
+
|
|
59
|
+
The user runs ONE shell command in their terminal — you do not run this:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
openclaw mcp set totalreclaw '{"command":"npx","args":["-y","@totalreclaw/mcp-server"]}'
|
|
63
|
+
openclaw skills install totalreclaw
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
After the user installs, restart any agent session so the new MCP server is loaded. Tools appear under the `totalreclaw__` namespace prefix (the MCP host adds the prefix).
|
|
67
|
+
|
|
68
|
+
**Do NOT direct the user to the legacy OpenClaw plugin install path. The MCP-only path is the canonical install for 3.3.0+.**
|
|
69
|
+
|
|
70
|
+
## Setup (account creation)
|
|
71
|
+
|
|
72
|
+
When the user asks to "set up TotalReclaw" or wants to remember something but has no credentials yet:
|
|
73
|
+
|
|
74
|
+
1. Call the `totalreclaw__totalreclaw_pair` tool with `{"mode": "generate"}` (or `{"mode": "import"}` if the user has an existing recovery phrase to restore).
|
|
75
|
+
2. The tool returns `{"url": "...", "pin": "...", "expires_at_ms": ...}`.
|
|
76
|
+
3. Emit one user-facing line: "Open <url> in your browser. Enter PIN <pin>. Generate or paste a 12-word recovery phrase. Reply `done` once it's sealed."
|
|
77
|
+
4. Wait for the user to say `done`. The browser handles phrase generation/import; the MCP server writes credentials silently.
|
|
78
|
+
5. Confirm: "✓ You're set up on the TotalReclaw free tier — 500 memories/month, unlimited reads. https://totalreclaw.xyz/pricing. Ask me to remember anything."
|
|
79
|
+
|
|
80
|
+
If the user already has credentials, `totalreclaw__totalreclaw_status` returns `{"onboarded": true}` and you can skip setup.
|
|
81
|
+
|
|
82
|
+
## When to call totalreclaw_remember (MANDATORY — read this carefully)
|
|
83
|
+
|
|
84
|
+
**ALWAYS call `totalreclaw__totalreclaw_remember` when the user mentions any of the following.** Do not wait for an explicit "remember this" — these are first-class triggers:
|
|
85
|
+
|
|
86
|
+
### Trigger phrases (call remember on detection)
|
|
87
|
+
|
|
88
|
+
- **Preferences**: "I prefer X", "I like X", "I love X", "I hate X", "my favorite X is Y", "I'd rather X", "X over Y"
|
|
89
|
+
- **Identity**: "I'm a X", "I work at X", "I work on X", "I live in X", "I'm based in X", "I have X"
|
|
90
|
+
- **Tools / setup**: "I use X", "I'm running X", "my X is Y", "I've configured X to Y"
|
|
91
|
+
- **Decisions / plans**: "I decided to X", "I'm going to X", "I'm planning X", "we agreed X", "we settled on X"
|
|
92
|
+
- **Commitments**: "I'll X by Y", "remind me to X", "I need to X by Y"
|
|
93
|
+
- **Explicit asks**: "remember that X", "save X", "note that X", "store X"
|
|
94
|
+
- **Facts about themselves or their work**: "X is true about me", "I have N years of Y", "I built X", "I own X"
|
|
95
|
+
|
|
96
|
+
### NEVER store user statements in local files
|
|
97
|
+
|
|
98
|
+
**The MCP-first architecture is canonical.** When the user states a preference or fact:
|
|
99
|
+
|
|
100
|
+
- ✅ DO call `totalreclaw__totalreclaw_remember` with the fact text and an importance score (1–10).
|
|
101
|
+
- ❌ DO NOT write the fact to `MEMORY.md`.
|
|
102
|
+
- ❌ DO NOT write the fact to `USER.md`.
|
|
103
|
+
- ❌ DO NOT write the fact to `~/.claude/memory/*.md` or any other local file.
|
|
104
|
+
- ❌ DO NOT use `Write`, `Edit`, or `Append` on a memory file.
|
|
105
|
+
|
|
106
|
+
`MEMORY.md` and `USER.md` are for AGENT PERSONA and CODEBASE INSTRUCTIONS — they are read-only operational config the agent loads at startup. They are NOT for user-supplied memories. User memories live encrypted on-chain via TotalReclaw.
|
|
107
|
+
|
|
108
|
+
## When to call totalreclaw_recall
|
|
109
|
+
|
|
110
|
+
**ALWAYS call `totalreclaw__totalreclaw_recall` when the user asks about themselves, their preferences, or anything from past conversations.**
|
|
111
|
+
|
|
112
|
+
### Trigger phrases (call recall on detection)
|
|
113
|
+
|
|
114
|
+
- "what's my X?", "do I X?", "where do I X?", "when did I X?", "have I told you X?"
|
|
115
|
+
- "what do you remember about me?", "what do you know about my X?"
|
|
116
|
+
- "remind me about X", "what did we decide about X?"
|
|
117
|
+
- "do you remember when X?"
|
|
118
|
+
|
|
119
|
+
Always **recall first**, then answer from the returned facts. If 0 results come back, say so plainly — do not guess from session history.
|
|
120
|
+
|
|
121
|
+
## Tool reference
|
|
122
|
+
|
|
123
|
+
The MCP server exposes these tools (the MCP host prefixes them with `totalreclaw__`):
|
|
124
|
+
|
|
125
|
+
| Tool | Purpose |
|
|
126
|
+
|---|---|
|
|
127
|
+
| `totalreclaw_pair` | Set up account (generate or import recovery phrase, browser-side) |
|
|
128
|
+
| `totalreclaw_remember` | Store a fact / preference / decision (encrypted, on-chain) |
|
|
129
|
+
| `totalreclaw_recall` | Semantic search across the user's memories |
|
|
130
|
+
| `totalreclaw_forget` | Delete a memory by id (tombstone on-chain) |
|
|
131
|
+
| `totalreclaw_pin` | Mark a memory as never-supersedable |
|
|
132
|
+
| `totalreclaw_unpin` | Remove pin status |
|
|
133
|
+
| `totalreclaw_retype` | Change a memory's type (claim/preference/directive/etc.) |
|
|
134
|
+
| `totalreclaw_set_scope` | Change a memory's scope (global / per-agent / per-session) |
|
|
135
|
+
| `totalreclaw_export` | Export all memories (json / markdown) |
|
|
136
|
+
| `totalreclaw_import` | Import memories from a structured payload |
|
|
137
|
+
| `totalreclaw_import_from` | Import from a file path |
|
|
138
|
+
| `totalreclaw_import_batch` | Bulk import with chunking + extraction |
|
|
139
|
+
| `totalreclaw_consolidate` | Merge near-duplicates after a fresh import |
|
|
140
|
+
| `totalreclaw_debrief` | Summarize a conversation into stored facts |
|
|
141
|
+
| `totalreclaw_status` | Check onboarding state, version, billing tier |
|
|
142
|
+
| `totalreclaw_account` | Show smart-account address + chain |
|
|
143
|
+
| `totalreclaw_upgrade` | Open the Stripe upgrade flow (free → paid tier) |
|
|
144
|
+
| `totalreclaw_migrate` | Move testnet memories to mainnet (Pro tier) |
|
|
145
|
+
| `totalreclaw_support` | File a support ticket with diagnostic context |
|
|
146
|
+
|
|
147
|
+
**Total: 18 tools.** All tools accept JSON input and return structured JSON in their response payload.
|
|
148
|
+
|
|
149
|
+
## Auto-extraction (background, no agent action required)
|
|
150
|
+
|
|
151
|
+
The MCP server runs a background trajectory poller every 60 seconds. It scans `~/.openclaw/agents/<agent>/sessions/*.trajectory.jsonl` for new conversation turns and, when enough turns accumulate (default: every 3 turns), runs LLM-driven extraction to surface preferences / facts / commitments the agent didn't explicitly call `totalreclaw_remember` on. Extracted facts go through importance filtering and dedup before landing on-chain.
|
|
152
|
+
|
|
153
|
+
**Important:** auto-extraction is a SAFETY NET, not a substitute for explicit `totalreclaw__totalreclaw_remember` calls. Explicit calls are higher-fidelity (the agent decides the importance, type, and scope) and are the canonical path. Auto-extraction catches things the agent missed.
|
|
154
|
+
|
|
155
|
+
The poller honors:
|
|
156
|
+
- **Pairing gate**: skips extraction until the user has set up an account.
|
|
157
|
+
- **Stale-file skip**: trajectory files older than 7 days are skipped (one-time offset snapshot, never re-scanned).
|
|
158
|
+
- **Cap = 1 per poll**: to avoid LLM rate-limit cascades, only one extraction runs per 60s tick. Other files defer to the next poll.
|
|
159
|
+
|
|
160
|
+
## Phrase safety (HARD — never break)
|
|
161
|
+
|
|
162
|
+
The 12-word recovery phrase is the master key — losing it means losing all memories. Hard rules:
|
|
163
|
+
|
|
164
|
+
- **NEVER echo, generate, or ask the user to paste a recovery phrase in chat.** The browser at the pair URL handles phrase generation and import; the phrase never enters the agent's LLM context.
|
|
165
|
+
- **NEVER call `totalreclaw__totalreclaw_pair` with a phrase as input.** The tool's only inputs are `mode` (generate / import) and optional config — never the phrase itself.
|
|
166
|
+
- **NEVER invoke any phrase-touching CLI via your shell tool.** The `npx @totalreclaw/mcp-server` binary is for the MCP host only; do not shell out to it for phrase ops.
|
|
167
|
+
- **If the user pastes a phrase anyway**: tell them the phrase is now compromised, re-run `totalreclaw_pair` with `{"mode": "generate"}` to mint a fresh wallet.
|
|
168
|
+
|
|
169
|
+
The trajectory poller passes ONLY chat-message text (user/assistant content) to the extraction LLM. The recovery phrase is read from `~/.totalreclaw/credentials.json` by the MCP server process and used solely for crypto operations — it never crosses the LLM call surface.
|
|
170
|
+
|
|
171
|
+
## Forbidden actions
|
|
172
|
+
|
|
173
|
+
These will break the install or compromise security:
|
|
174
|
+
|
|
175
|
+
1. **Do NOT use `--allow-dangerous` on any MCP-related command.** The MCP server is sandboxed by design.
|
|
176
|
+
2. **Do NOT manually edit `~/.totalreclaw/credentials.json`.** Round-trip via `totalreclaw_pair` (re-generate) instead.
|
|
177
|
+
3. **Do NOT install the legacy plugin path (the `@totalreclaw/totalreclaw` OpenClaw plugin) alongside the MCP server.** The two paths overlap and will double-write facts. Pick one — this skill assumes the MCP-only path.
|
|
178
|
+
4. **Do NOT save QR PNGs from the pair flow.** The browser at the pair URL renders QR if the user wants to scan-to-confirm; the agent does not need to render anything.
|
|
179
|
+
5. **Do NOT write to `MEMORY.md` or `USER.md` for user-supplied facts.** See the "NEVER store user statements in local files" rule above.
|
|
180
|
+
|
|
181
|
+
## How does TotalReclaw work? (canonical answer for user questions)
|
|
182
|
+
|
|
183
|
+
When the user asks "how does this work?" / "where are my memories stored?" / "is this safe?" — answer with this content. Do NOT say "stored on a relay server" or any phrasing that implies single-company custody.
|
|
184
|
+
|
|
185
|
+
> **End-to-end encrypted, decentralized memory.** When you tell me to remember something, I encrypt it locally with a key derived from your 12-word recovery phrase, then submit it on-chain via Account Abstraction (a UserOperation). It lives on a public blockchain (Base Sepolia for free tier, Gnosis mainnet for paid). The Graph subgraph indexes it for fast retrieval. The TotalReclaw relay server only forwards encrypted bundles between your client and the chain — it never sees plaintext, can't read your memories, and could be replaced by any compatible relay without losing data. Your recovery phrase is the only thing that can decrypt the memories. Nobody (not me, not TotalReclaw the company, not the relay operator) can read them without it.
|
|
186
|
+
|
|
187
|
+
Shorter slices:
|
|
188
|
+
- **"Where are memories stored?"** → "Encrypted, on-chain (Base or Gnosis depending on your tier), indexed by The Graph. Not on any single company's server."
|
|
189
|
+
- **"Is the relay reading my data?"** → "No. The relay only forwards encrypted bundles. Plaintext never leaves your device. Only your recovery phrase can decrypt them."
|
|
190
|
+
- **"What if TotalReclaw shuts down?"** → "Your memories survive. They're on a public blockchain. Any compatible relay (or self-hosted relay) can read them with your recovery phrase."
|
|
191
|
+
|
|
192
|
+
## Diagnostics
|
|
193
|
+
|
|
194
|
+
- `totalreclaw_*` tools missing from toolset → the MCP server isn't registered or didn't start. Confirm the install command ran and that the agent session was restarted after install.
|
|
195
|
+
- `totalreclaw_status` returns `onboarded: false` → no credentials yet; run setup (call `totalreclaw_pair`).
|
|
196
|
+
- User says "I told you X but you don't remember" → call `totalreclaw_recall` with a query covering X. If 0 results, the prior session didn't store it (auto-extraction may have missed it; the agent should call `totalreclaw_remember` proactively going forward).
|
|
197
|
+
- `quota exceeded` → call `totalreclaw_status` to see current tier; offer `totalreclaw_upgrade`.
|
|
198
|
+
|
|
199
|
+
## Tool surface summary
|
|
200
|
+
|
|
201
|
+
`totalreclaw__totalreclaw_pair` · `_remember` · `_recall` · `_forget` · `_pin` · `_unpin` · `_retype` · `_set_scope` · `_export` · `_import` · `_import_from` · `_import_batch` · `_consolidate` · `_debrief` · `_status` · `_account` · `_upgrade` · `_migrate` · `_support` (19 tools — one of these is RC-only).
|
|
202
|
+
|
|
203
|
+
**Default behavior summary**: the agent's job is to call `totalreclaw_remember` aggressively on user statements that match the trigger-phrase list, and `totalreclaw_recall` when the user asks about themselves. Local files (`MEMORY.md`, `USER.md`, etc.) are NOT for user memory — they are agent-persona configuration only.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* extraction/config.ts — env-var reads for the extraction LLM client.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the relevant subset of `skill/plugin/config.ts` (the plugin's
|
|
5
|
+
* CONFIG object) so the ported `llm-client.ts` doesn't need to be edited
|
|
6
|
+
* substantively. Scoped to ONLY the env reads the extraction pipeline
|
|
7
|
+
* actually needs: provider API keys, zai base URL, retry budget.
|
|
8
|
+
*
|
|
9
|
+
* This file is a centralized env-read surface so future contributors can
|
|
10
|
+
* find every TOTALRECLAW_/PROVIDER_API_KEY env touchpoint in one place
|
|
11
|
+
* (matches the rationale of the plugin's config.ts).
|
|
12
|
+
*
|
|
13
|
+
* MCP-server-specific note: the plugin's config.ts has a scanner-isolation
|
|
14
|
+
* rule that forbids mixing process.env reads with outbound-network triggers
|
|
15
|
+
* in the same file. The MCP server is NOT scanner-gated (it's a regular
|
|
16
|
+
* npm package run by node, not an OpenClaw plugin), so the rule doesn't
|
|
17
|
+
* apply — but we keep the same structural separation anyway because it
|
|
18
|
+
* makes the env surface auditable.
|
|
19
|
+
*/
|
|
20
|
+
export declare const EXTRACTION_CONFIG: {
|
|
21
|
+
llmApiKeys: Record<string, string>;
|
|
22
|
+
/**
|
|
23
|
+
* zai base-URL override. Read via a getter so tests can mutate the env
|
|
24
|
+
* between calls. Default is the coding endpoint (GLM Coding Plan); the
|
|
25
|
+
* `chatCompletion` auto-fallback flips to the standard PAYG endpoint on
|
|
26
|
+
* an "Insufficient balance" 429.
|
|
27
|
+
*/
|
|
28
|
+
readonly zaiBaseUrl: string;
|
|
29
|
+
/**
|
|
30
|
+
* Retry budget for chatCompletion. Default 60s covers multi-minute
|
|
31
|
+
* upstream outages. Read once at module load.
|
|
32
|
+
*/
|
|
33
|
+
llmRetryBudgetMs: number;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/extraction/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,eAAO,MAAM,iBAAiB;gBAcvB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAE3B;;;;;OAKG;yBACe,MAAM;IAMxB;;;OAGG;;CAMJ,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* extraction/config.ts — env-var reads for the extraction LLM client.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the relevant subset of `skill/plugin/config.ts` (the plugin's
|
|
6
|
+
* CONFIG object) so the ported `llm-client.ts` doesn't need to be edited
|
|
7
|
+
* substantively. Scoped to ONLY the env reads the extraction pipeline
|
|
8
|
+
* actually needs: provider API keys, zai base URL, retry budget.
|
|
9
|
+
*
|
|
10
|
+
* This file is a centralized env-read surface so future contributors can
|
|
11
|
+
* find every TOTALRECLAW_/PROVIDER_API_KEY env touchpoint in one place
|
|
12
|
+
* (matches the rationale of the plugin's config.ts).
|
|
13
|
+
*
|
|
14
|
+
* MCP-server-specific note: the plugin's config.ts has a scanner-isolation
|
|
15
|
+
* rule that forbids mixing process.env reads with outbound-network triggers
|
|
16
|
+
* in the same file. The MCP server is NOT scanner-gated (it's a regular
|
|
17
|
+
* npm package run by node, not an OpenClaw plugin), so the rule doesn't
|
|
18
|
+
* apply — but we keep the same structural separation anyway because it
|
|
19
|
+
* makes the env surface auditable.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.EXTRACTION_CONFIG = void 0;
|
|
23
|
+
exports.EXTRACTION_CONFIG = {
|
|
24
|
+
llmApiKeys: {
|
|
25
|
+
zai: process.env.ZAI_API_KEY || '',
|
|
26
|
+
anthropic: process.env.ANTHROPIC_API_KEY || '',
|
|
27
|
+
openai: process.env.OPENAI_API_KEY || '',
|
|
28
|
+
gemini: process.env.GEMINI_API_KEY || '',
|
|
29
|
+
google: process.env.GOOGLE_API_KEY || '',
|
|
30
|
+
mistral: process.env.MISTRAL_API_KEY || '',
|
|
31
|
+
groq: process.env.GROQ_API_KEY || '',
|
|
32
|
+
deepseek: process.env.DEEPSEEK_API_KEY || '',
|
|
33
|
+
openrouter: process.env.OPENROUTER_API_KEY || '',
|
|
34
|
+
xai: process.env.XAI_API_KEY || '',
|
|
35
|
+
together: process.env.TOGETHER_API_KEY || '',
|
|
36
|
+
cerebras: process.env.CEREBRAS_API_KEY || '',
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* zai base-URL override. Read via a getter so tests can mutate the env
|
|
40
|
+
* between calls. Default is the coding endpoint (GLM Coding Plan); the
|
|
41
|
+
* `chatCompletion` auto-fallback flips to the standard PAYG endpoint on
|
|
42
|
+
* an "Insufficient balance" 429.
|
|
43
|
+
*/
|
|
44
|
+
get zaiBaseUrl() {
|
|
45
|
+
const override = process.env.ZAI_BASE_URL;
|
|
46
|
+
if (override && override.trim())
|
|
47
|
+
return override.trim().replace(/\/+$/, '');
|
|
48
|
+
return 'https://api.z.ai/api/coding/paas/v4';
|
|
49
|
+
},
|
|
50
|
+
/**
|
|
51
|
+
* Retry budget for chatCompletion. Default 60s covers multi-minute
|
|
52
|
+
* upstream outages. Read once at module load.
|
|
53
|
+
*/
|
|
54
|
+
llmRetryBudgetMs: (() => {
|
|
55
|
+
const raw = process.env.TOTALRECLAW_LLM_RETRY_BUDGET_MS;
|
|
56
|
+
const parsed = raw ? parseInt(raw, 10) : NaN;
|
|
57
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : 60_000;
|
|
58
|
+
})(),
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/extraction/config.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAEU,QAAA,iBAAiB,GAAG;IAC/B,UAAU,EAAE;QACV,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE;QAClC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE;QAC9C,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE;QACxC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE;QACxC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE;QACxC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE;QAC1C,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE;QACpC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,EAAE;QAC5C,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,EAAE;QAChD,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE;QAClC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,EAAE;QAC5C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,EAAE;KACnB;IAE3B;;;;;OAKG;IACH,IAAI,UAAU;QACZ,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;QAC1C,IAAI,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE;YAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC5E,OAAO,qCAAqC,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACH,gBAAgB,EAAE,CAAC,GAAG,EAAE;QACtB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC;QACxD,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QAC7C,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IACjE,CAAC,CAAC,EAAE;CACL,CAAC"}
|