@totalreclaw/totalreclaw 3.3.12-rc.2 → 3.3.12-rc.21
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 +26 -0
- package/SKILL.md +34 -249
- package/api-client.ts +17 -9
- package/batch-gate.ts +42 -0
- package/billing-cache.ts +25 -20
- package/claims-helper.ts +7 -1
- package/config.ts +54 -12
- package/consolidation.ts +6 -13
- package/contradiction-sync.ts +19 -14
- package/credential-provider.ts +184 -0
- package/crypto.ts +27 -160
- package/dist/api-client.js +17 -9
- package/dist/batch-gate.js +40 -0
- package/dist/billing-cache.js +19 -21
- package/dist/claims-helper.js +7 -1
- package/dist/config.js +54 -12
- package/dist/consolidation.js +6 -15
- package/dist/contradiction-sync.js +15 -15
- package/dist/credential-provider.js +145 -0
- package/dist/crypto.js +17 -137
- package/dist/download-ux.js +11 -7
- package/dist/embedder-loader.js +266 -0
- package/dist/embedding.js +36 -3
- package/dist/entry.js +123 -0
- package/dist/extractor.js +134 -0
- package/dist/fs-helpers.js +116 -241
- package/dist/import-adapters/chatgpt-adapter.js +14 -0
- package/dist/import-adapters/claude-adapter.js +14 -0
- package/dist/import-adapters/gemini-adapter.js +43 -159
- package/dist/import-adapters/mcp-memory-adapter.js +14 -0
- package/dist/import-state-manager.js +100 -0
- package/dist/index.js +1130 -2520
- package/dist/llm-client.js +69 -1
- package/dist/memory-runtime.js +459 -0
- package/dist/native-memory.js +123 -0
- package/dist/onboarding-cli.js +3 -2
- package/dist/pair-cli.js +1 -1
- package/dist/pair-crypto.js +16 -358
- package/dist/pair-http.js +147 -4
- package/dist/relay.js +140 -0
- package/dist/reranker.js +13 -8
- package/dist/semantic-dedup.js +5 -7
- package/dist/skill-register.js +97 -0
- package/dist/subgraph-search.js +3 -1
- package/dist/subgraph-store.js +315 -282
- package/dist/tool-gating.js +39 -26
- package/dist/tools.js +367 -0
- package/dist/tr-cli-export-helper.js +103 -0
- package/dist/tr-cli.js +220 -127
- package/dist/trajectory-poller.js +155 -9
- package/dist/vault-crypto.js +551 -0
- package/download-ux.ts +12 -6
- package/embedder-loader.ts +293 -1
- package/embedding.ts +43 -3
- package/entry.ts +132 -0
- package/extractor.ts +167 -0
- package/fs-helpers.ts +166 -292
- package/import-adapters/chatgpt-adapter.ts +18 -0
- package/import-adapters/claude-adapter.ts +18 -0
- package/import-adapters/gemini-adapter.ts +56 -183
- package/import-adapters/mcp-memory-adapter.ts +18 -0
- package/import-adapters/types.ts +1 -1
- package/import-state-manager.ts +139 -0
- package/index.ts +1432 -3002
- package/llm-client.ts +74 -1
- package/memory-runtime.ts +723 -0
- package/native-memory.ts +196 -0
- package/onboarding-cli.ts +3 -2
- package/openclaw.plugin.json +5 -17
- package/package.json +7 -4
- package/pair-cli.ts +1 -1
- package/pair-crypto.ts +41 -483
- package/pair-http.ts +194 -5
- package/postinstall.mjs +138 -0
- package/relay.ts +172 -0
- package/reranker.ts +13 -8
- package/semantic-dedup.ts +5 -6
- package/skill-register.ts +146 -0
- package/skill.json +1 -1
- package/subgraph-search.ts +3 -1
- package/subgraph-store.ts +334 -299
- package/tool-gating.ts +39 -26
- package/tools.ts +499 -0
- package/tr-cli-export-helper.ts +138 -0
- package/tr-cli.ts +263 -133
- package/trajectory-poller.ts +162 -10
- package/vault-crypto.ts +705 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* skill-register — mirror the bundled SKILL.md + skill.json into the
|
|
3
|
+
* OpenClaw workspace skills directory on plugin load so the skill is
|
|
4
|
+
* auto-discovered without a separate `openclaw skills install` step.
|
|
5
|
+
*
|
|
6
|
+
* Why this file exists
|
|
7
|
+
* --------------------
|
|
8
|
+
* Historically `openclaw plugins install @totalreclaw/totalreclaw`
|
|
9
|
+
* installed only the plugin code; the SKILL.md instructions had to be
|
|
10
|
+
* installed via a second `openclaw skills install totalreclaw` command
|
|
11
|
+
* that agents frequently skipped — leaving the agent without the
|
|
12
|
+
* pairing / recall playbook. With the skill files copied into
|
|
13
|
+
* `~/.openclaw/workspace/skills/totalreclaw/` at register() time, the
|
|
14
|
+
* workspace skill scanner picks them up on the next gateway load, so a
|
|
15
|
+
* single `openclaw plugins install` is enough for both plugin + skill.
|
|
16
|
+
*
|
|
17
|
+
* Scanner note (MANDATORY — do not regress)
|
|
18
|
+
* -----------------------------------------
|
|
19
|
+
* This file is held scanner-clean by construction:
|
|
20
|
+
* - NO `process.env` reads. The home / workspace path arrives as a
|
|
21
|
+
* parameter from the caller, so the env-harvesting rule (env + net
|
|
22
|
+
* in the same file) can never fire here.
|
|
23
|
+
* - NO outbound-network primitives or trigger words. Disk-only. The
|
|
24
|
+
* potential-exfiltration rule (disk read + net in the same file)
|
|
25
|
+
* therefore cannot fire either.
|
|
26
|
+
* Do NOT add network-capable imports or trigger-word comments to this
|
|
27
|
+
* file — see `../scripts/check-scanner.mjs` for the exact rule set.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import fs from 'node:fs';
|
|
31
|
+
import path from 'node:path';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Minimal logger surface matching the slice of the host plugin logger
|
|
35
|
+
* this helper uses. Declared locally so the module has no heavy type
|
|
36
|
+
* dependency on the plugin API shape.
|
|
37
|
+
*/
|
|
38
|
+
export interface SkillRegisterLogger {
|
|
39
|
+
info(...args: unknown[]): void;
|
|
40
|
+
warn(...args: unknown[]): void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface EnsureSkillRegisteredOptions {
|
|
44
|
+
/**
|
|
45
|
+
* The running plugin directory — i.e. the compiled `dist/` dir where
|
|
46
|
+
* the plugin executes. SKILL.md and skill.json are resolved ONE level
|
|
47
|
+
* up from this (the package root), matching the shipped tarball layout
|
|
48
|
+
* (`dist/index.js` + `SKILL.md` + `skill.json` at the package root).
|
|
49
|
+
*/
|
|
50
|
+
pluginDir: string;
|
|
51
|
+
/**
|
|
52
|
+
* The workspace `skills/` parent directory (typically
|
|
53
|
+
* `~/.openclaw/workspace/skills`). A `totalreclaw/` subdirectory is
|
|
54
|
+
* created / updated inside it. Passed in by the caller (resolved from
|
|
55
|
+
* `CONFIG.openclawWorkspace`) so this file never reads the env.
|
|
56
|
+
*/
|
|
57
|
+
skillsDir: string;
|
|
58
|
+
/** Best-effort logger. Never throws. */
|
|
59
|
+
logger: SkillRegisterLogger;
|
|
60
|
+
/**
|
|
61
|
+
* Override list of filenames to mirror. Defaults to SKILL.md +
|
|
62
|
+
* skill.json. Exposed for tests; production callers omit it.
|
|
63
|
+
*/
|
|
64
|
+
files?: readonly string[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const DEFAULT_FILES: readonly string[] = ['SKILL.md', 'skill.json'];
|
|
68
|
+
const SKILL_SUBDIR = 'totalreclaw';
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Copy the bundled skill files (SKILL.md + skill.json) from the plugin
|
|
72
|
+
* package root into `<skillsDir>/totalreclaw/` so the workspace skill
|
|
73
|
+
* scanner discovers them on the next gateway load.
|
|
74
|
+
*
|
|
75
|
+
* Contract:
|
|
76
|
+
* - Creates `<skillsDir>/totalreclaw/` if missing (recursive).
|
|
77
|
+
* - Idempotent: a destination file whose bytes already match the
|
|
78
|
+
* source is left untouched (no rewrite, no mtime bump) so a healthy
|
|
79
|
+
* reload is a no-op.
|
|
80
|
+
* - A destination file whose content differs is overwritten with the
|
|
81
|
+
* bundled source — keeps the skill in sync with the installed
|
|
82
|
+
* plugin version across upgrades.
|
|
83
|
+
* - Missing source files are skipped (logged at warn) — a stripped or
|
|
84
|
+
* minimal install must not fail plugin load.
|
|
85
|
+
* - NEVER throws. All filesystem errors are swallowed and logged;
|
|
86
|
+
* this helper runs inside register() and a failure here must not
|
|
87
|
+
* block plugin activation.
|
|
88
|
+
*/
|
|
89
|
+
export function ensureSkillRegistered(opts: EnsureSkillRegisteredOptions): void {
|
|
90
|
+
const { pluginDir, skillsDir, logger } = opts;
|
|
91
|
+
const files = opts.files ?? DEFAULT_FILES;
|
|
92
|
+
|
|
93
|
+
// Package root is one level up from the compiled `dist/` dir. This
|
|
94
|
+
// mirrors the readPluginVersion() resolution in fs-helpers.ts.
|
|
95
|
+
const packageRoot = path.dirname(pluginDir);
|
|
96
|
+
const destDir = path.join(skillsDir, SKILL_SUBDIR);
|
|
97
|
+
|
|
98
|
+
try {
|
|
99
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
100
|
+
} catch (err) {
|
|
101
|
+
logger.warn(
|
|
102
|
+
`TotalReclaw: skill auto-register skipped — could not create ${destDir}: ${
|
|
103
|
+
err instanceof Error ? err.message : String(err)
|
|
104
|
+
}`,
|
|
105
|
+
);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
for (const file of files) {
|
|
110
|
+
const src = path.join(packageRoot, file);
|
|
111
|
+
const dest = path.join(destDir, file);
|
|
112
|
+
try {
|
|
113
|
+
if (!fs.existsSync(src)) {
|
|
114
|
+
// Bundled file absent (trimmed tarball / dev source tree). Skip
|
|
115
|
+
// rather than failing register().
|
|
116
|
+
logger.warn(
|
|
117
|
+
`TotalReclaw: skill auto-register — bundled source not found, skipping: ${file}`,
|
|
118
|
+
);
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Idempotent fast path: identical bytes already on disk — leave
|
|
123
|
+
// the destination untouched so a healthy reload is a no-op.
|
|
124
|
+
if (fs.existsSync(dest)) {
|
|
125
|
+
try {
|
|
126
|
+
const srcBuf = fs.readFileSync(src);
|
|
127
|
+
const destBuf = fs.readFileSync(dest);
|
|
128
|
+
if (srcBuf.equals(destBuf)) {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
} catch {
|
|
132
|
+
// Compare failed — fall through to the overwrite below.
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
fs.copyFileSync(src, dest);
|
|
137
|
+
logger.info(`TotalReclaw: skill auto-register — installed ${file} -> ${destDir}`);
|
|
138
|
+
} catch (err) {
|
|
139
|
+
logger.warn(
|
|
140
|
+
`TotalReclaw: skill auto-register failed for ${file}: ${
|
|
141
|
+
err instanceof Error ? err.message : String(err)
|
|
142
|
+
}`,
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
package/skill.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "totalreclaw",
|
|
3
|
-
"version": "3.3.12-rc.
|
|
3
|
+
"version": "3.3.12-rc.21",
|
|
4
4
|
"description": "End-to-end encrypted memory for AI agents — portable, yours forever. XChaCha20-Poly1305 E2EE: server never sees plaintext.",
|
|
5
5
|
"author": "TotalReclaw Team",
|
|
6
6
|
"license": "MIT",
|
package/subgraph-search.ts
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
import { getSubgraphConfig } from './subgraph-store.js';
|
|
24
24
|
import { CONFIG } from './config.js';
|
|
25
25
|
import { buildRelayHeaders } from './relay-headers.js';
|
|
26
|
+
import { relayFetch } from './relay.js';
|
|
26
27
|
|
|
27
28
|
export interface SubgraphSearchFact {
|
|
28
29
|
id: string;
|
|
@@ -56,7 +57,8 @@ async function gqlQuery<T>(
|
|
|
56
57
|
overrides['Authorization'] = `Bearer ${authKeyHex}`;
|
|
57
58
|
}
|
|
58
59
|
const headers = buildRelayHeaders(overrides);
|
|
59
|
-
const response = await
|
|
60
|
+
const response = await relayFetch({
|
|
61
|
+
url: endpoint,
|
|
60
62
|
method: 'POST',
|
|
61
63
|
headers,
|
|
62
64
|
body: JSON.stringify({ query, variables }),
|