@totalreclaw/totalreclaw 3.3.1-rc.16 → 3.3.1-rc.18

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 CHANGED
@@ -66,7 +66,7 @@ The QR encodes ONLY the pair URL. The 6-digit PIN is a separate out-of-band conf
66
66
 
67
67
  ## Phrase safety (HARD — never break)
68
68
 
69
- NEVER echo / generate / ask the user to paste a recovery phrase in chat. NEVER invoke `openclaw totalreclaw onboard`, `totalreclaw setup`, or any phrase-touching CLI via your shell tool (stdout enters LLM context). The ONLY agent-facilitated setup path is `totalreclaw_pair`. If the user pastes a phrase anyway: tell them it is compromised, call `totalreclaw_pair` with `mode=generate` for a fresh wallet.
69
+ NEVER echo / generate / ask the user to paste a recovery phrase in chat. NEVER invoke `openclaw totalreclaw onboard`, `totalreclaw setup`, or any phrase-touching CLI via your shell tool (stdout enters LLM context). The ONLY agent-facilitated setup paths are (in order of preference): (1) `totalreclaw_pair` tool; (2) if the tool is missing from your tool list — a known gap for some container-based agents, issue #87 — shell out to `openclaw totalreclaw pair generate --url-pin-only`, which emits a single-line JSON `{v,url,pin,expires_at_ms}` with zero phrase material on stdout (pair-crypto is x25519-only, not BIP-39). If the user pastes a phrase anyway: tell them it is compromised, call `totalreclaw_pair` with `mode=generate` for a fresh wallet.
70
70
 
71
71
  ## Usage (post-setup)
72
72
 
@@ -78,7 +78,7 @@ NEVER echo / generate / ask the user to paste a recovery phrase in chat. NEVER i
78
78
 
79
79
  ## Diagnostics
80
80
 
81
- - `totalreclaw_*` tools not visible → plugin not installed or gateway not restarted. Verify via `openclaw plugins list | grep totalreclaw`. If listed, ask the user to restart the gateway.
81
+ - `totalreclaw_*` tools not visible → plugin not installed or gateway not restarted. Verify via `openclaw plugins list | grep totalreclaw`. If listed but tools still absent (container-agent gap, issue #87), shell out to `openclaw totalreclaw pair generate --url-pin-only` on the gateway host and hand the user the `url` + `pin` from the JSON payload — do NOT suggest `openclaw totalreclaw onboard` (leaks phrase on stdout).
82
82
  - User says done but `credentials.json` missing → PIN expired or entered wrong phrase; call `totalreclaw_pair` again.
83
83
  - `onboarding required` → credentials missing; redo from the pair step.
84
84
  - `quota exceeded` → `totalreclaw_status`, then offer `totalreclaw_upgrade`.
package/index.ts CHANGED
@@ -5412,11 +5412,18 @@ const plugin = {
5412
5412
  '## TotalReclaw setup pending\n\n' +
5413
5413
  'TotalReclaw encrypted memory is installed but not yet set up on this machine. ' +
5414
5414
  'If the user asks about memory features or wants to configure TotalReclaw, ' +
5415
- 'call the `totalreclaw_onboarding_start` tool for instructions.\n\n' +
5415
+ 'call the `totalreclaw_pair` tool it returns a pairing URL + 6-digit PIN ' +
5416
+ 'the user opens in a browser (phrase is generated and encrypted in-browser, ' +
5417
+ 'never leaves their device in plaintext). If `totalreclaw_pair` is not in ' +
5418
+ 'your tool list (container-based agents sometimes miss it), shell out to ' +
5419
+ '`openclaw totalreclaw pair generate --url-pin-only` on the gateway host — ' +
5420
+ 'it emits a single JSON line `{v,url,pin,expires_at_ms}` with no phrase ' +
5421
+ 'material; hand the user the `url` and `pin`.\n\n' +
5416
5422
  '**Do NOT** attempt to generate, display, or relay a recovery phrase in chat. ' +
5417
- 'All phrase handling happens on the user\'s local terminal via ' +
5418
- '`openclaw totalreclaw onboard` this keeps the phrase out of the LLM ' +
5419
- 'provider\'s logs.',
5423
+ '**Do NOT** run `openclaw totalreclaw onboard` that CLI emits the recovery ' +
5424
+ 'phrase on stdout and would leak it into the LLM transcript. Use `pair` ' +
5425
+ '(tool or `--url-pin-only` CLI) instead; `onboard` is reserved for users ' +
5426
+ 'running it directly in their own local terminal.',
5420
5427
  };
5421
5428
  }
5422
5429
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@totalreclaw/totalreclaw",
3
- "version": "3.3.1-rc.16",
3
+ "version": "3.3.1-rc.18",
4
4
  "description": "End-to-end encrypted, agent-portable memory for OpenClaw and any LLM-agent runtime. XChaCha20-Poly1305 with protobuf v4 + on-chain Memory Taxonomy v1 (claim / preference / directive / commitment / episode / summary).",
5
5
  "type": "module",
6
6
  "keywords": [
package/pair-cli.ts CHANGED
@@ -85,8 +85,15 @@ export interface PairCliOutcome {
85
85
  * as the session reaches a terminal state — same status-code
86
86
  * semantics as 'human' (0 on completed, 1 on expired/rejected/error,
87
87
  * 130 on canceled).
88
+ * - 'url-pin': (3.3.1-rc.15, issue #87) headless container-agent fallback.
89
+ * Emits ONLY `{ v, url, pin, expires_at_ms }` — no QR ASCII, no SID,
90
+ * no mode echo. Use when a container-based agent cannot see the
91
+ * `totalreclaw_pair` tool (OpenClaw gateway-to-container tool-injection
92
+ * gap) and must shell out to the CLI. Guarantees zero phrase material
93
+ * on stdout by construction — pair-crypto is x25519-only and the slim
94
+ * payload carries nothing BIP-39-adjacent.
88
95
  */
89
- export type PairCliOutputMode = 'human' | 'json';
96
+ export type PairCliOutputMode = 'human' | 'json' | 'url-pin';
90
97
 
91
98
  /**
92
99
  * JSON payload emitted by runPairCli when outputMode === 'json'. Printed
@@ -103,6 +110,17 @@ export interface PairCliJsonPayload {
103
110
  qr_ascii: string;
104
111
  }
105
112
 
113
+ /**
114
+ * Slim payload for outputMode === 'url-pin'. Intentionally a subset of
115
+ * `PairCliJsonPayload` with no QR ASCII, SID, or mode echo. Issue #87.
116
+ */
117
+ export interface PairCliUrlPinPayload {
118
+ v: 1;
119
+ url: string;
120
+ pin: string;
121
+ expires_at_ms: number;
122
+ }
123
+
106
124
  // ---------------------------------------------------------------------------
107
125
  // Default stdout IO
108
126
  // ---------------------------------------------------------------------------
@@ -213,9 +231,11 @@ export async function runPairCli(
213
231
  return { status: 'error', error: msg };
214
232
  }
215
233
 
216
- // 2. Render the QR promise-based so both human + json modes share it.
234
+ // 2. Build the URL unconditionally, but only render the QR for modes
235
+ // that actually emit it. url-pin mode skips the renderer entirely —
236
+ // no CPU cost, no qrcode-terminal import, no ASCII on stdout.
217
237
  const url = deps.renderPairingUrl(session);
218
- const qrAscii = await new Promise<string>((resolve) => {
238
+ const qrAscii = outputMode === 'url-pin' ? '' : await new Promise<string>((resolve) => {
219
239
  // Guard against QR renderers that never fire their callback (shouldn't
220
240
  // happen with qrcode-terminal, but defensive): a 10-second timeout
221
241
  // returns an empty string so we never hang the pairing flow.
@@ -241,8 +261,16 @@ export async function runPairCli(
241
261
  }
242
262
  });
243
263
 
244
- // 3. Emit the visible surface (JSON first — single line — or human copy).
245
- if (outputMode === 'json') {
264
+ // 3. Emit the visible surface (JSON/url-pin first — single line — or human copy).
265
+ if (outputMode === 'url-pin') {
266
+ const payload: PairCliUrlPinPayload = {
267
+ v: 1,
268
+ url,
269
+ pin: session.secondaryCode,
270
+ expires_at_ms: session.expiresAtMs,
271
+ };
272
+ stdout.write(JSON.stringify(payload) + '\n');
273
+ } else if (outputMode === 'json') {
246
274
  const payload: PairCliJsonPayload = {
247
275
  v: 1,
248
276
  sid: session.sid,
@@ -276,7 +304,9 @@ export async function runPairCli(
276
304
  canceled = true;
277
305
  });
278
306
 
279
- // 5. Poll
307
+ // 5. Poll — status transitions only surface in human mode; json/url-pin
308
+ // modes stay silent after the single payload line so agents parsing
309
+ // stdout get one JSON line and an exit code, nothing else.
280
310
  const emitStatus = (text: string): void => {
281
311
  if (outputMode === 'human') stdout.write(text);
282
312
  };
@@ -399,14 +429,19 @@ export function registerPairCli(
399
429
  'Pair a remote browser device to this gateway (mode = generate | import; default generate)',
400
430
  )
401
431
  .option('--json', 'Emit a single JSON payload (url/pin/sid/qr_ascii) instead of the human-readable banner. Enables agent-driven pairing.')
432
+ .option('--url-pin-only', 'Emit ONLY {v,url,pin,expires_at_ms} — no QR ASCII, no SID, no mode echo. Headless fallback for container-based agents where the totalreclaw_pair tool is not injected (issue #87). Zero phrase exposure on stdout.')
402
433
  .option('--timeout <sec>', 'Session TTL in seconds (default: 900 = 15 min, matches pair-session-store default)')
403
434
  .action(async (...args: unknown[]) => {
404
435
  // commander passes: [modeArg, options, cmd]
405
436
  const modeRaw = typeof args[0] === 'string' ? args[0] : undefined;
406
- const opts = (args[1] ?? {}) as { json?: boolean; timeout?: string | number };
437
+ const opts = (args[1] ?? {}) as { json?: boolean; urlPinOnly?: boolean; timeout?: string | number };
407
438
  const mode: PairCliMode =
408
439
  modeRaw === 'import' || modeRaw === 'imp' ? 'import' : 'generate';
409
- const outputMode: PairCliOutputMode = opts.json ? 'json' : 'human';
440
+ // --url-pin-only wins over --json when both are passed, since it is
441
+ // strictly the tighter surface (no QR, no SID). The flag is a subset.
442
+ const outputMode: PairCliOutputMode = opts.urlPinOnly
443
+ ? 'url-pin'
444
+ : opts.json ? 'json' : 'human';
410
445
  let ttlSeconds: number | undefined;
411
446
  if (typeof opts.timeout === 'number' && Number.isFinite(opts.timeout)) {
412
447
  ttlSeconds = opts.timeout;