@privateclaw/privateclaw 0.1.10 → 0.1.12

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/src/cli.ts CHANGED
@@ -1,13 +1,40 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { parseArgs } from "node:util";
4
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
5
+ import path from "node:path";
3
6
  import { EchoBridge } from "./bridges/echo-bridge.js";
4
7
  import { OpenClawAgentBridge } from "./bridges/openclaw-agent-bridge.js";
5
8
  import { OpenAICompatibleBridge } from "./bridges/openai-compatible-bridge.js";
6
9
  import { WebhookBridge } from "./bridges/webhook-bridge.js";
7
- import { runPairSession } from "./pair-session.js";
10
+ import { loadAvailableOpenClawCommands } from "./openclaw-command-discovery.js";
11
+ import {
12
+ parsePositiveIntegerFlag,
13
+ printPairInviteBundle,
14
+ runPairSession,
15
+ } from "./pair-session.js";
16
+ import {
17
+ handoffForegroundPairToBackground,
18
+ spawnBackgroundPairDaemon,
19
+ } from "./pair-daemon.js";
8
20
  import { DEFAULT_SESSION_TTL_MS, PrivateClawProvider } from "./provider.js";
9
21
  import { DEFAULT_RELAY_BASE_URL } from "./relay-defaults.js";
10
22
  import { resolveRelayEndpoints } from "./relay-endpoints.js";
23
+ import {
24
+ buildManagedSessionsReportLines,
25
+ kickManagedParticipantFromStateDir,
26
+ listManagedSessionsFromStateDir,
27
+ PrivateClawSessionControlServer,
28
+ resolvePrivateClawStateDir,
29
+ } from "./session-control.js";
30
+ import { formatBilingualInline } from "./text.js";
31
+ import type { PrivateClawProviderHandoffState } from "./types.js";
32
+
33
+ type BridgeMode =
34
+ | "echo"
35
+ | "webhook"
36
+ | "openclaw-agent"
37
+ | "openai-compatible";
11
38
 
12
39
  function parsePositiveInteger(value: string | undefined, fallback: number): number {
13
40
  if (!value || value.trim() === "") {
@@ -34,79 +61,422 @@ function resolveChatCompletionsUrl(baseUrl: string): string {
34
61
  return url.toString();
35
62
  }
36
63
 
37
- const relayBaseUrl = process.env.PRIVATECLAW_RELAY_BASE_URL?.trim() || DEFAULT_RELAY_BASE_URL;
38
- const { providerWsUrl, appWsUrl } = resolveRelayEndpoints(relayBaseUrl);
39
- const webhookUrl = process.env.PRIVATECLAW_WEBHOOK_URL?.trim();
40
- const webhookToken = process.env.PRIVATECLAW_WEBHOOK_TOKEN?.trim();
41
- const gatewayBaseUrl = process.env.PRIVATECLAW_GATEWAY_BASE_URL?.trim();
42
- const gatewayChatCompletionsUrl = process.env.PRIVATECLAW_GATEWAY_CHAT_COMPLETIONS_URL?.trim();
43
- const gatewayModel = process.env.PRIVATECLAW_GATEWAY_MODEL?.trim() || "openclaw";
44
- const gatewayApiKey = process.env.PRIVATECLAW_GATEWAY_API_KEY?.trim();
45
- const gatewaySystemPrompt = process.env.PRIVATECLAW_GATEWAY_SYSTEM_PROMPT?.trim();
46
- const openClawAgentBridge = parseBooleanFlag(process.env.PRIVATECLAW_OPENCLAW_AGENT_BRIDGE);
47
- const openClawAgentExecutable = process.env.PRIVATECLAW_OPENCLAW_AGENT_BIN?.trim();
48
- const openClawAgentId = process.env.PRIVATECLAW_OPENCLAW_AGENT_ID?.trim();
49
- const openClawAgentChannel = process.env.PRIVATECLAW_OPENCLAW_AGENT_CHANNEL?.trim();
50
- const openClawAgentThinking = process.env.PRIVATECLAW_OPENCLAW_AGENT_THINKING?.trim() as
51
- | "off"
52
- | "minimal"
53
- | "low"
54
- | "medium"
55
- | "high"
56
- | undefined;
57
- const openClawAgentLocal = parseBooleanFlag(process.env.PRIVATECLAW_OPENCLAW_AGENT_LOCAL);
58
- const openClawAgentTimeoutSeconds = process.env.PRIVATECLAW_OPENCLAW_AGENT_TIMEOUT_SECONDS
59
- ? parsePositiveInteger(process.env.PRIVATECLAW_OPENCLAW_AGENT_TIMEOUT_SECONDS, 600)
60
- : undefined;
61
- const ttlMs = parsePositiveInteger(
62
- process.env.PRIVATECLAW_SESSION_TTL_MS,
63
- DEFAULT_SESSION_TTL_MS,
64
- );
65
- const openQr = parseBooleanFlag(process.env.PRIVATECLAW_OPEN_QR);
66
- const providerLabel = process.env.PRIVATECLAW_PROVIDER_LABEL?.trim() || "PrivateClaw";
67
- const welcomeMessage = process.env.PRIVATECLAW_WELCOME_MESSAGE?.trim();
68
-
69
- const bridge =
70
- openClawAgentBridge
71
- ? new OpenClawAgentBridge({
72
- ...(openClawAgentExecutable ? { executable: openClawAgentExecutable } : {}),
73
- ...(openClawAgentId ? { agentId: openClawAgentId } : {}),
74
- ...(openClawAgentChannel ? { channel: openClawAgentChannel } : {}),
75
- ...(openClawAgentThinking ? { thinking: openClawAgentThinking } : {}),
76
- ...(openClawAgentTimeoutSeconds ? { timeoutSeconds: openClawAgentTimeoutSeconds } : {}),
77
- ...(openClawAgentLocal ? { local: true } : {}),
64
+ function detectBridgeMode(): BridgeMode {
65
+ const explicit = process.env.PRIVATECLAW_BRIDGE_MODE?.trim().toLowerCase();
66
+ if (
67
+ explicit === "echo" ||
68
+ explicit === "webhook" ||
69
+ explicit === "openclaw-agent" ||
70
+ explicit === "openai-compatible"
71
+ ) {
72
+ return explicit;
73
+ }
74
+
75
+ const hasOpenClawAgentConfig =
76
+ parseBooleanFlag(process.env.PRIVATECLAW_OPENCLAW_AGENT_BRIDGE) ||
77
+ Boolean(process.env.PRIVATECLAW_OPENCLAW_AGENT_BIN?.trim()) ||
78
+ Boolean(process.env.PRIVATECLAW_OPENCLAW_AGENT_ID?.trim()) ||
79
+ Boolean(process.env.PRIVATECLAW_OPENCLAW_AGENT_CHANNEL?.trim());
80
+ if (hasOpenClawAgentConfig) {
81
+ return "openclaw-agent";
82
+ }
83
+ if (
84
+ process.env.PRIVATECLAW_GATEWAY_CHAT_COMPLETIONS_URL?.trim() ||
85
+ process.env.PRIVATECLAW_GATEWAY_BASE_URL?.trim()
86
+ ) {
87
+ return "openai-compatible";
88
+ }
89
+ if (process.env.PRIVATECLAW_WEBHOOK_URL?.trim()) {
90
+ return "webhook";
91
+ }
92
+ return "echo";
93
+ }
94
+
95
+ function createProvider(params?: {
96
+ providerId?: string;
97
+ }): {
98
+ provider: PrivateClawProvider;
99
+ stateDir: string;
100
+ } {
101
+ const providerWsUrl = process.env.PRIVATECLAW_PROVIDER_WS_URL?.trim();
102
+ const appWsUrl = process.env.PRIVATECLAW_APP_WS_URL?.trim();
103
+ const relayBaseUrl =
104
+ process.env.PRIVATECLAW_RELAY_BASE_URL?.trim() || DEFAULT_RELAY_BASE_URL;
105
+ const relayEndpoints =
106
+ providerWsUrl && appWsUrl
107
+ ? { providerWsUrl, appWsUrl }
108
+ : resolveRelayEndpoints(relayBaseUrl);
109
+ const bridgeMode = detectBridgeMode();
110
+
111
+ const webhookUrl = process.env.PRIVATECLAW_WEBHOOK_URL?.trim();
112
+ const webhookToken = process.env.PRIVATECLAW_WEBHOOK_TOKEN?.trim();
113
+ const gatewayBaseUrl = process.env.PRIVATECLAW_GATEWAY_BASE_URL?.trim();
114
+ const gatewayChatCompletionsUrl =
115
+ process.env.PRIVATECLAW_GATEWAY_CHAT_COMPLETIONS_URL?.trim();
116
+ const gatewayModel =
117
+ process.env.PRIVATECLAW_GATEWAY_MODEL?.trim() || "openclaw";
118
+ const gatewayApiKey = process.env.PRIVATECLAW_GATEWAY_API_KEY?.trim();
119
+ const gatewaySystemPrompt =
120
+ process.env.PRIVATECLAW_GATEWAY_SYSTEM_PROMPT?.trim();
121
+ const openClawAgentExecutable =
122
+ process.env.PRIVATECLAW_OPENCLAW_AGENT_BIN?.trim();
123
+ const openClawAgentId = process.env.PRIVATECLAW_OPENCLAW_AGENT_ID?.trim();
124
+ const openClawAgentChannel =
125
+ process.env.PRIVATECLAW_OPENCLAW_AGENT_CHANNEL?.trim();
126
+ const openClawAgentThinking = process.env.PRIVATECLAW_OPENCLAW_AGENT_THINKING
127
+ ?.trim() as
128
+ | "off"
129
+ | "minimal"
130
+ | "low"
131
+ | "medium"
132
+ | "high"
133
+ | undefined;
134
+ const openClawAgentLocal = parseBooleanFlag(
135
+ process.env.PRIVATECLAW_OPENCLAW_AGENT_LOCAL,
136
+ );
137
+ const openClawAgentTimeoutSeconds =
138
+ process.env.PRIVATECLAW_OPENCLAW_AGENT_TIMEOUT_SECONDS
139
+ ? parsePositiveInteger(
140
+ process.env.PRIVATECLAW_OPENCLAW_AGENT_TIMEOUT_SECONDS,
141
+ 600,
142
+ )
143
+ : undefined;
144
+
145
+ const bridge =
146
+ bridgeMode === "openclaw-agent"
147
+ ? new OpenClawAgentBridge({
148
+ ...(openClawAgentExecutable
149
+ ? { executable: openClawAgentExecutable }
150
+ : {}),
151
+ ...(openClawAgentId ? { agentId: openClawAgentId } : {}),
152
+ ...(openClawAgentChannel ? { channel: openClawAgentChannel } : {}),
153
+ ...(openClawAgentThinking ? { thinking: openClawAgentThinking } : {}),
154
+ ...(openClawAgentTimeoutSeconds
155
+ ? { timeoutSeconds: openClawAgentTimeoutSeconds }
156
+ : {}),
157
+ ...(openClawAgentLocal ? { local: true } : {}),
158
+ onLog: (message) => {
159
+ console.log(`[privateclaw-provider] ${message}`);
160
+ },
161
+ })
162
+ : bridgeMode === "openai-compatible"
163
+ ? new OpenAICompatibleBridge({
164
+ endpoint:
165
+ gatewayChatCompletionsUrl ||
166
+ resolveChatCompletionsUrl(gatewayBaseUrl!),
167
+ model: gatewayModel,
168
+ ...(gatewayApiKey ? { apiKey: gatewayApiKey } : {}),
169
+ ...(gatewaySystemPrompt
170
+ ? { systemPrompt: gatewaySystemPrompt }
171
+ : {}),
172
+ })
173
+ : bridgeMode === "webhook"
174
+ ? new WebhookBridge({
175
+ endpoint: webhookUrl!,
176
+ ...(webhookToken ? { token: webhookToken } : {}),
177
+ })
178
+ : new EchoBridge(
179
+ process.env.PRIVATECLAW_ECHO_PREFIX?.trim() || "PrivateClaw demo",
180
+ );
181
+
182
+ const ttlMs = parsePositiveInteger(
183
+ process.env.PRIVATECLAW_SESSION_TTL_MS,
184
+ DEFAULT_SESSION_TTL_MS,
185
+ );
186
+ const providerLabel =
187
+ process.env.PRIVATECLAW_PROVIDER_LABEL?.trim() || "PrivateClaw";
188
+ const welcomeMessage = process.env.PRIVATECLAW_WELCOME_MESSAGE?.trim();
189
+
190
+ return {
191
+ provider: new PrivateClawProvider({
192
+ providerWsUrl: relayEndpoints.providerWsUrl,
193
+ appWsUrl: relayEndpoints.appWsUrl,
194
+ bridge,
195
+ ...(params?.providerId ? { providerId: params.providerId } : {}),
196
+ defaultTtlMs: ttlMs,
197
+ providerLabel,
198
+ commandsProvider: async () => {
199
+ try {
200
+ return await loadAvailableOpenClawCommands();
201
+ } catch {
202
+ return [];
203
+ }
204
+ },
205
+ ...(welcomeMessage ? { welcomeMessage } : {}),
206
+ onLog: (message) => {
207
+ console.log(`[privateclaw-provider] ${message}`);
208
+ },
209
+ }),
210
+ stateDir: resolvePrivateClawStateDir(),
211
+ };
212
+ }
213
+
214
+ async function waitForSessionsToDrain(
215
+ provider: PrivateClawProvider,
216
+ ): Promise<void> {
217
+ while (provider.listActiveSessions().length > 0) {
218
+ await new Promise((resolve) => setTimeout(resolve, 250));
219
+ }
220
+ }
221
+
222
+ async function writeDaemonResult(
223
+ resultFile: string,
224
+ payload: unknown,
225
+ ): Promise<void> {
226
+ await mkdir(path.dirname(resultFile), { recursive: true });
227
+ await writeFile(resultFile, JSON.stringify(payload), "utf8");
228
+ }
229
+
230
+ async function readHandoffState(
231
+ snapshotFile: string,
232
+ ): Promise<PrivateClawProviderHandoffState> {
233
+ return JSON.parse(await readFile(snapshotFile, "utf8")) as PrivateClawProviderHandoffState;
234
+ }
235
+
236
+ function printHelp(): void {
237
+ console.log(`privateclaw-provider <pair|sessions|kick>
238
+
239
+ pair [--ttl-ms <ms>] [--label <label>] [--group] [--print-only] [--open] [--foreground]
240
+ sessions
241
+ kick <sessionId> <appId>`);
242
+ }
243
+
244
+ async function runPairCommand(args: string[]): Promise<void> {
245
+ const parsed = parseArgs({
246
+ args,
247
+ allowPositionals: true,
248
+ options: {
249
+ "ttl-ms": { type: "string" },
250
+ label: { type: "string" },
251
+ group: { type: "boolean", default: false },
252
+ "print-only": { type: "boolean", default: false },
253
+ open: { type: "boolean", default: parseBooleanFlag(process.env.PRIVATECLAW_OPEN_QR) },
254
+ foreground: { type: "boolean", default: false },
255
+ "daemon-child": { type: "boolean", default: false },
256
+ "result-file": { type: "string" },
257
+ "resume-snapshot-file": { type: "string" },
258
+ help: { type: "boolean", short: "h" },
259
+ },
260
+ });
261
+
262
+ if (parsed.values.help) {
263
+ printHelp();
264
+ return;
265
+ }
266
+
267
+ const ttlMs = parsePositiveIntegerFlag(parsed.values["ttl-ms"], "--ttl-ms");
268
+ const label = parsed.values.label?.trim();
269
+ const groupMode = parsed.values.group === true;
270
+ const printOnly = parsed.values["print-only"] === true;
271
+ const openInBrowser = parsed.values.open === true;
272
+ const foreground = parsed.values.foreground === true;
273
+ const daemonChild = parsed.values["daemon-child"] === true;
274
+ const resultFile = parsed.values["result-file"];
275
+ const resumeSnapshotFile = parsed.values["resume-snapshot-file"];
276
+
277
+ if (daemonChild) {
278
+ if (!resultFile) {
279
+ throw new Error("--daemon-child requires --result-file.");
280
+ }
281
+ let provider: PrivateClawProvider | undefined;
282
+ let controlServer: PrivateClawSessionControlServer | undefined;
283
+ try {
284
+ const handoffState = resumeSnapshotFile
285
+ ? await readHandoffState(resumeSnapshotFile)
286
+ : undefined;
287
+ const resolved = createProvider(
288
+ handoffState ? { providerId: handoffState.providerId } : undefined,
289
+ );
290
+ provider = resolved.provider;
291
+ if (handoffState) {
292
+ provider.importHandoffState(handoffState);
293
+ await provider.connect();
294
+ }
295
+ controlServer = new PrivateClawSessionControlServer({
296
+ provider,
297
+ stateDir: resolved.stateDir,
298
+ kind: "pair-daemon",
78
299
  onLog: (message) => {
79
300
  console.log(`[privateclaw-provider] ${message}`);
80
301
  },
81
- })
82
- : gatewayChatCompletionsUrl || gatewayBaseUrl
83
- ? new OpenAICompatibleBridge({
84
- endpoint: gatewayChatCompletionsUrl || resolveChatCompletionsUrl(gatewayBaseUrl!),
85
- model: gatewayModel,
86
- ...(gatewayApiKey ? { apiKey: gatewayApiKey } : {}),
87
- ...(gatewaySystemPrompt ? { systemPrompt: gatewaySystemPrompt } : {}),
88
- })
89
- : webhookUrl
90
- ? new WebhookBridge({ endpoint: webhookUrl, ...(webhookToken ? { token: webhookToken } : {}) })
91
- : new EchoBridge(process.env.PRIVATECLAW_ECHO_PREFIX?.trim() || "PrivateClaw demo");
92
-
93
- const provider = new PrivateClawProvider({
94
- providerWsUrl,
95
- appWsUrl,
96
- bridge,
97
- defaultTtlMs: ttlMs,
98
- providerLabel,
99
- ...(welcomeMessage ? { welcomeMessage } : {}),
100
- onLog: (message) => {
101
- console.log(`[privateclaw-provider] ${message}`);
102
- },
103
- });
104
-
105
- await runPairSession({
106
- provider,
107
- ttlMs,
108
- ...(openQr ? { openInBrowser: true } : {}),
109
- writeLine: (line) => {
302
+ });
303
+ await controlServer.start();
304
+ if (handoffState) {
305
+ await writeDaemonResult(resultFile, {
306
+ ok: true,
307
+ resumedSessionCount: handoffState.sessions.length,
308
+ });
309
+ } else {
310
+ const bundle = await runPairSession({
311
+ provider,
312
+ ...(typeof ttlMs === "number" ? { ttlMs } : {}),
313
+ ...(label ? { label } : {}),
314
+ ...(groupMode ? { groupMode: true } : {}),
315
+ ...(openInBrowser ? { openInBrowser: true } : {}),
316
+ foreground: false,
317
+ writeLine: () => undefined,
318
+ });
319
+ await writeDaemonResult(resultFile, { ok: true, bundle });
320
+ }
321
+ await waitForSessionsToDrain(provider);
322
+ } catch (error) {
323
+ await writeDaemonResult(resultFile, {
324
+ ok: false,
325
+ error: error instanceof Error ? error.message : String(error),
326
+ });
327
+ throw error;
328
+ } finally {
329
+ await controlServer?.stop();
330
+ await provider?.dispose();
331
+ }
332
+ return;
333
+ }
334
+
335
+ if (printOnly || foreground) {
336
+ const { provider, stateDir } = createProvider();
337
+ const controlServer =
338
+ printOnly
339
+ ? undefined
340
+ : new PrivateClawSessionControlServer({
341
+ provider,
342
+ stateDir,
343
+ kind: "pair-foreground",
344
+ onLog: (message) => {
345
+ console.log(`[privateclaw-provider] ${message}`);
346
+ },
347
+ });
348
+ try {
349
+ await controlServer?.start();
350
+ await runPairSession({
351
+ provider,
352
+ ...(typeof ttlMs === "number" ? { ttlMs } : {}),
353
+ ...(label ? { label } : {}),
354
+ ...(groupMode ? { groupMode: true } : {}),
355
+ ...(printOnly ? { printOnly: true } : {}),
356
+ ...(openInBrowser ? { openInBrowser: true } : {}),
357
+ foreground: true,
358
+ ...(printOnly
359
+ ? {}
360
+ : {
361
+ handoffToBackground: async () => {
362
+ provider.suppressReconnectsForHandoff();
363
+ try {
364
+ await handoffForegroundPairToBackground({
365
+ cliModuleUrl: import.meta.url,
366
+ stateDir,
367
+ env: process.env,
368
+ handoffState: provider.exportHandoffState(),
369
+ });
370
+ return formatBilingualInline(
371
+ "当前 PrivateClaw 会话已转入后台。可使用 `privateclaw-provider sessions` 查看。",
372
+ "The current PrivateClaw session is now running in the background. Use `privateclaw-provider sessions` to inspect it.",
373
+ );
374
+ } catch (error) {
375
+ provider.resumeReconnectsAfterHandoffFailure();
376
+ throw error;
377
+ }
378
+ },
379
+ }),
380
+ });
381
+ } finally {
382
+ await controlServer?.stop();
383
+ }
384
+ return;
385
+ }
386
+
387
+ const bundle = await spawnBackgroundPairDaemon({
388
+ cliModuleUrl: import.meta.url,
389
+ stateDir: resolvePrivateClawStateDir(),
390
+ env: process.env,
391
+ ...(typeof ttlMs === "number" ? { ttlMs } : {}),
392
+ ...(label ? { label } : {}),
393
+ ...(groupMode ? { groupMode: true } : {}),
394
+ ...(openInBrowser ? { openInBrowser: true } : {}),
395
+ });
396
+ printPairInviteBundle(bundle, (line) => {
397
+ console.log(line);
398
+ });
399
+ }
400
+
401
+ async function runSessionsCommand(args: string[]): Promise<void> {
402
+ const parsed = parseArgs({
403
+ args,
404
+ allowPositionals: true,
405
+ options: {
406
+ help: { type: "boolean", short: "h" },
407
+ },
408
+ });
409
+ if (parsed.values.help) {
410
+ printHelp();
411
+ return;
412
+ }
413
+
414
+ const listings = await listManagedSessionsFromStateDir(resolvePrivateClawStateDir());
415
+ for (const line of buildManagedSessionsReportLines(listings)) {
110
416
  console.log(line);
111
- },
112
- });
417
+ }
418
+ }
419
+
420
+ async function runKickCommand(args: string[]): Promise<void> {
421
+ const parsed = parseArgs({
422
+ args,
423
+ allowPositionals: true,
424
+ options: {
425
+ help: { type: "boolean", short: "h" },
426
+ },
427
+ });
428
+ if (parsed.values.help) {
429
+ printHelp();
430
+ return;
431
+ }
432
+ if (parsed.positionals.length < 2) {
433
+ throw new Error(
434
+ formatBilingualInline(
435
+ "kick 需要提供 sessionId 和 appId。",
436
+ "kick requires both a sessionId and appId.",
437
+ ),
438
+ );
439
+ }
440
+
441
+ const [sessionIdRaw, appIdRaw] = parsed.positionals;
442
+ if (!sessionIdRaw || !appIdRaw) {
443
+ throw new Error(
444
+ formatBilingualInline(
445
+ "kick 需要提供 sessionId 和 appId。",
446
+ "kick requires both a sessionId and appId.",
447
+ ),
448
+ );
449
+ }
450
+ const sessionId = sessionIdRaw;
451
+ const appId = appIdRaw;
452
+ const result = await kickManagedParticipantFromStateDir({
453
+ stateDir: resolvePrivateClawStateDir(),
454
+ sessionId,
455
+ appId,
456
+ reason: "participant_removed",
457
+ });
458
+ console.log(
459
+ formatBilingualInline(
460
+ `已从会话 ${result.session.sessionId} 中移除 ${result.participant.displayName} (${result.participant.appId})。`,
461
+ `Removed ${result.participant.displayName} (${result.participant.appId}) from session ${result.session.sessionId}.`,
462
+ ),
463
+ );
464
+ }
465
+
466
+ const argv = process.argv.slice(2);
467
+ const [command, ...rest] =
468
+ argv.length === 0 || argv[0]!.startsWith("-")
469
+ ? ["pair", ...argv]
470
+ : argv;
471
+
472
+ if (command === "pair") {
473
+ await runPairCommand(rest);
474
+ } else if (command === "sessions") {
475
+ await runSessionsCommand(rest);
476
+ } else if (command === "kick") {
477
+ await runKickCommand(rest);
478
+ } else if (command === "help" || command === "--help" || command === "-h") {
479
+ printHelp();
480
+ } else {
481
+ throw new Error(`Unsupported privateclaw-provider command: ${command}`);
482
+ }
@@ -127,6 +127,7 @@ export interface OpenClawPluginServiceCompat {
127
127
  export interface OpenClawCliCommandCompat {
128
128
  command(name: string): OpenClawCliCommandCompat;
129
129
  description(text: string): OpenClawCliCommandCompat;
130
+ argument(spec: string): OpenClawCliCommandCompat;
130
131
  option(
131
132
  flags: string,
132
133
  description?: string,