@privateclaw/privateclaw 0.1.28 → 0.1.31
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/README.md +6 -6
- package/dist/cli.js +17 -5
- package/dist/cli.js.map +1 -1
- package/dist/openclaw-plugin.js +25 -12
- package/dist/openclaw-plugin.js.map +1 -1
- package/dist/pair-session.d.ts +1 -0
- package/dist/pair-session.js +10 -2
- package/dist/pair-session.js.map +1 -1
- package/dist/session-control.js +5 -5
- package/dist/session-control.js.map +1 -1
- package/dist/setup.js +5 -2
- package/dist/setup.js.map +1 -1
- package/dist/text.d.ts +7 -0
- package/dist/text.js +25 -1
- package/dist/text.js.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +6 -2
- package/src/cli.ts +21 -4
- package/src/openclaw-plugin.test.ts +6 -0
- package/src/openclaw-plugin.ts +29 -11
- package/src/pair-session.ts +11 -1
- package/src/session-control.test.ts +40 -0
- package/src/session-control.ts +9 -6
- package/src/setup.test.ts +34 -0
- package/src/setup.ts +6 -2
- package/src/text.test.ts +26 -0
- package/src/text.ts +50 -3
package/src/openclaw-plugin.ts
CHANGED
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
type PrivateClawControlHostKind,
|
|
51
51
|
} from "./session-control.js";
|
|
52
52
|
import {
|
|
53
|
+
appendPrivateClawAppInstallFooter,
|
|
53
54
|
buildPrivateClawBackgroundDaemonReminder,
|
|
54
55
|
buildPrivateClawCommandErrorMessage,
|
|
55
56
|
formatBilingualInline,
|
|
@@ -73,6 +74,7 @@ import {
|
|
|
73
74
|
PRIVATECLAW_COMMAND_DESCRIPTION,
|
|
74
75
|
PRIVATECLAW_INVITE_URI_LABEL,
|
|
75
76
|
PRIVATECLAW_PLUGIN_DESCRIPTION,
|
|
77
|
+
writePrivateClawAppInstallFooter,
|
|
76
78
|
} from "./text.js";
|
|
77
79
|
import type {
|
|
78
80
|
PrivateClawAgentBridge,
|
|
@@ -180,12 +182,12 @@ function buildCommandReplyText(params: {
|
|
|
180
182
|
}): string {
|
|
181
183
|
const baseText =
|
|
182
184
|
`${params.announcementText}\n\n${PRIVATECLAW_INVITE_URI_LABEL}:\n${params.inviteUri}`;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
185
|
+
const text = !channelRequiresInlineImageReply(params.channel)
|
|
186
|
+
? baseText
|
|
187
|
+
: `${baseText}\n\n<qqimg>${params.qrImagePath}</qqimg>`;
|
|
186
188
|
|
|
187
189
|
// QQ command replies expand images from inline <qqimg> tags instead of mediaUrl payloads.
|
|
188
|
-
return
|
|
190
|
+
return appendPrivateClawAppInstallFooter(text);
|
|
189
191
|
}
|
|
190
192
|
|
|
191
193
|
function readNumber(value: unknown): number | undefined {
|
|
@@ -932,6 +934,9 @@ class PrivateClawPluginRuntime {
|
|
|
932
934
|
bundle.invite.sessionId,
|
|
933
935
|
),
|
|
934
936
|
);
|
|
937
|
+
writePrivateClawAppInstallFooter(
|
|
938
|
+
params?.writeLine ?? ((line: string) => console.log(line)),
|
|
939
|
+
);
|
|
935
940
|
return bundle;
|
|
936
941
|
}
|
|
937
942
|
|
|
@@ -1072,6 +1077,7 @@ class PrivateClawPluginRuntime {
|
|
|
1072
1077
|
const bundle = await renderInviteBundleOutput(result.bundle, {
|
|
1073
1078
|
qrMediaDir: this.getMediaDir(),
|
|
1074
1079
|
...(params?.openInBrowser ? { openInBrowser: true } : {}),
|
|
1080
|
+
includeFooter: false,
|
|
1075
1081
|
...(params?.writeLine ? { writeLine: params.writeLine } : {}),
|
|
1076
1082
|
});
|
|
1077
1083
|
return {
|
|
@@ -1099,6 +1105,10 @@ function formatCommandError(error: unknown): string {
|
|
|
1099
1105
|
return error instanceof Error ? error.message : String(error);
|
|
1100
1106
|
}
|
|
1101
1107
|
|
|
1108
|
+
function formatCommandErrorWithFooter(error: unknown): string {
|
|
1109
|
+
return appendPrivateClawAppInstallFooter(formatCommandError(error));
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1102
1112
|
function createPluginDefinition(
|
|
1103
1113
|
runtimeFactory: (api: OpenClawPluginApiCompat) => PrivateClawPluginRuntime,
|
|
1104
1114
|
): OpenClawExtensionPluginCompat {
|
|
@@ -1237,7 +1247,7 @@ function createPluginDefinition(
|
|
|
1237
1247
|
},
|
|
1238
1248
|
});
|
|
1239
1249
|
} catch (error) {
|
|
1240
|
-
console.error(
|
|
1250
|
+
console.error(formatCommandErrorWithFooter(error));
|
|
1241
1251
|
process.exitCode = 1;
|
|
1242
1252
|
}
|
|
1243
1253
|
});
|
|
@@ -1250,6 +1260,9 @@ function createPluginDefinition(
|
|
|
1250
1260
|
.option("--notify", PRIVATECLAW_CLI_NOTIFY_OPTION_DESCRIPTION)
|
|
1251
1261
|
.action(async (sessionIdRaw: unknown, rawOptions: unknown) => {
|
|
1252
1262
|
try {
|
|
1263
|
+
const writeLine = (line: string) => {
|
|
1264
|
+
console.log(line);
|
|
1265
|
+
};
|
|
1253
1266
|
const sessionId = readString(sessionIdRaw);
|
|
1254
1267
|
if (!sessionId) {
|
|
1255
1268
|
throw new Error(
|
|
@@ -1263,9 +1276,7 @@ function createPluginDefinition(
|
|
|
1263
1276
|
const result = await runtime.printManagedSessionQr(sessionId, {
|
|
1264
1277
|
...(options.notify ? { notifyParticipants: true } : {}),
|
|
1265
1278
|
...(options.open ? { openInBrowser: true } : {}),
|
|
1266
|
-
writeLine
|
|
1267
|
-
console.log(line);
|
|
1268
|
-
},
|
|
1279
|
+
writeLine,
|
|
1269
1280
|
});
|
|
1270
1281
|
if (options.notify && !isManagedSessionQrLegacyResult(result)) {
|
|
1271
1282
|
console.log(
|
|
@@ -1277,8 +1288,11 @@ function createPluginDefinition(
|
|
|
1277
1288
|
} else if (options.notify && isManagedSessionQrLegacyResult(result)) {
|
|
1278
1289
|
process.exitCode = 1;
|
|
1279
1290
|
}
|
|
1291
|
+
if (!isManagedSessionQrLegacyResult(result)) {
|
|
1292
|
+
writePrivateClawAppInstallFooter(writeLine);
|
|
1293
|
+
}
|
|
1280
1294
|
} catch (error) {
|
|
1281
|
-
console.error(
|
|
1295
|
+
console.error(formatCommandErrorWithFooter(error));
|
|
1282
1296
|
process.exitCode = 1;
|
|
1283
1297
|
}
|
|
1284
1298
|
});
|
|
@@ -1310,8 +1324,9 @@ function createPluginDefinition(
|
|
|
1310
1324
|
`Session ${result.session.sessionId} has been terminated.`,
|
|
1311
1325
|
),
|
|
1312
1326
|
);
|
|
1327
|
+
writePrivateClawAppInstallFooter((line) => console.log(line));
|
|
1313
1328
|
} catch (error) {
|
|
1314
|
-
console.error(
|
|
1329
|
+
console.error(formatCommandErrorWithFooter(error));
|
|
1315
1330
|
process.exitCode = 1;
|
|
1316
1331
|
}
|
|
1317
1332
|
});
|
|
@@ -1329,6 +1344,7 @@ function createPluginDefinition(
|
|
|
1329
1344
|
"There are no background daemon sessions to terminate.",
|
|
1330
1345
|
),
|
|
1331
1346
|
);
|
|
1347
|
+
writePrivateClawAppInstallFooter((line) => console.log(line));
|
|
1332
1348
|
return;
|
|
1333
1349
|
}
|
|
1334
1350
|
if (result.closed.length > 0) {
|
|
@@ -1369,8 +1385,9 @@ function createPluginDefinition(
|
|
|
1369
1385
|
}
|
|
1370
1386
|
process.exitCode = 1;
|
|
1371
1387
|
}
|
|
1388
|
+
writePrivateClawAppInstallFooter((line) => console.log(line));
|
|
1372
1389
|
} catch (error) {
|
|
1373
|
-
console.error(
|
|
1390
|
+
console.error(formatCommandErrorWithFooter(error));
|
|
1374
1391
|
process.exitCode = 1;
|
|
1375
1392
|
}
|
|
1376
1393
|
});
|
|
@@ -1398,6 +1415,7 @@ function createPluginDefinition(
|
|
|
1398
1415
|
`Removed ${result.participant.displayName} (${result.participant.appId}) from session ${result.session.sessionId}.`,
|
|
1399
1416
|
),
|
|
1400
1417
|
);
|
|
1418
|
+
writePrivateClawAppInstallFooter((line) => console.log(line));
|
|
1401
1419
|
});
|
|
1402
1420
|
},
|
|
1403
1421
|
{ commands: ["privateclaw"] },
|
package/src/pair-session.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
PRIVATECLAW_SESSION_ENDED_MESSAGE,
|
|
15
15
|
PRIVATECLAW_WAITING_FOR_APP_MESSAGE,
|
|
16
16
|
PRIVATECLAW_WAITING_FOR_APP_WITH_BACKGROUND_MESSAGE,
|
|
17
|
+
writePrivateClawAppInstallFooter,
|
|
17
18
|
} from "./text.js";
|
|
18
19
|
import type { PrivateClawInviteBundle } from "./types.js";
|
|
19
20
|
|
|
@@ -129,8 +130,10 @@ export async function renderInviteBundleOutput(
|
|
|
129
130
|
qrMediaDir?: string;
|
|
130
131
|
openInBrowser?: boolean;
|
|
131
132
|
writeLine?: (line: string) => void;
|
|
133
|
+
includeFooter?: boolean;
|
|
132
134
|
},
|
|
133
135
|
): Promise<PrivateClawInviteBundle> {
|
|
136
|
+
const writeLine = params?.writeLine ?? ((line) => console.log(line));
|
|
134
137
|
const mediaDir = params?.qrMediaDir ?? resolvePrivateClawMediaDir();
|
|
135
138
|
const qrPng = await writeInviteQrPng(bundle, mediaDir);
|
|
136
139
|
const renderedBundle: PrivateClawInviteBundle = {
|
|
@@ -138,7 +141,7 @@ export async function renderInviteBundleOutput(
|
|
|
138
141
|
qrPngPath: qrPng.pngPath,
|
|
139
142
|
};
|
|
140
143
|
|
|
141
|
-
printPairInviteBundle(renderedBundle,
|
|
144
|
+
printPairInviteBundle(renderedBundle, writeLine);
|
|
142
145
|
|
|
143
146
|
if (params?.openInBrowser) {
|
|
144
147
|
const preview = await writeInviteQrPreviewHtml(
|
|
@@ -148,6 +151,9 @@ export async function renderInviteBundleOutput(
|
|
|
148
151
|
);
|
|
149
152
|
await openInBrowserPreview(preview.previewFileUrl);
|
|
150
153
|
}
|
|
154
|
+
if (params?.includeFooter !== false) {
|
|
155
|
+
writePrivateClawAppInstallFooter(writeLine);
|
|
156
|
+
}
|
|
151
157
|
|
|
152
158
|
return renderedBundle;
|
|
153
159
|
}
|
|
@@ -175,15 +181,18 @@ export async function runPairSession({
|
|
|
175
181
|
const bundle = await renderInviteBundleOutput(inviteBundle, {
|
|
176
182
|
...(qrMediaDir ? { qrMediaDir } : {}),
|
|
177
183
|
...(openInBrowser ? { openInBrowser: true } : {}),
|
|
184
|
+
includeFooter: false,
|
|
178
185
|
writeLine,
|
|
179
186
|
});
|
|
180
187
|
|
|
181
188
|
if (printOnly) {
|
|
189
|
+
writePrivateClawAppInstallFooter(writeLine);
|
|
182
190
|
await provider.dispose();
|
|
183
191
|
return bundle;
|
|
184
192
|
}
|
|
185
193
|
|
|
186
194
|
if (!foreground) {
|
|
195
|
+
writePrivateClawAppInstallFooter(writeLine);
|
|
187
196
|
return bundle;
|
|
188
197
|
}
|
|
189
198
|
|
|
@@ -192,6 +201,7 @@ export async function runPairSession({
|
|
|
192
201
|
? PRIVATECLAW_WAITING_FOR_APP_WITH_BACKGROUND_MESSAGE
|
|
193
202
|
: PRIVATECLAW_WAITING_FOR_APP_MESSAGE,
|
|
194
203
|
);
|
|
204
|
+
writePrivateClawAppInstallFooter(writeLine);
|
|
195
205
|
for (;;) {
|
|
196
206
|
const outcome = await Promise.race<
|
|
197
207
|
| { kind: "signal"; signal: NodeJS.Signals }
|
|
@@ -19,6 +19,7 @@ import { resolvePrivateClawMediaDir } from "./invite-qr-files.js";
|
|
|
19
19
|
import { DEFAULT_SESSION_TTL_MS, PrivateClawProvider } from "./provider.js";
|
|
20
20
|
import {
|
|
21
21
|
buildManagedSessionQrLegacyLines,
|
|
22
|
+
buildManagedSessionsReportLines,
|
|
22
23
|
closeManagedSessionsFromStateDir,
|
|
23
24
|
closeManagedSessionFromStateDir,
|
|
24
25
|
followManagedSessionLogFromStateDir,
|
|
@@ -408,6 +409,38 @@ test("session control can follow a managed OpenClaw session log", async (t) => {
|
|
|
408
409
|
assert.ok(printed.includes(secondLine));
|
|
409
410
|
});
|
|
410
411
|
|
|
412
|
+
test("session control reports append app install footer", () => {
|
|
413
|
+
const lines = buildManagedSessionsReportLines([
|
|
414
|
+
{
|
|
415
|
+
host: {
|
|
416
|
+
controlId: "control-1",
|
|
417
|
+
kind: "pair-daemon",
|
|
418
|
+
pid: 12345,
|
|
419
|
+
startedAt: "2026-03-22T08:00:00.000Z",
|
|
420
|
+
},
|
|
421
|
+
sessions: [
|
|
422
|
+
{
|
|
423
|
+
sessionId: "session-1",
|
|
424
|
+
expiresAt: "2026-03-23T08:00:00.000Z",
|
|
425
|
+
groupMode: false,
|
|
426
|
+
participantCount: 1,
|
|
427
|
+
participants: [
|
|
428
|
+
{
|
|
429
|
+
appId: "app-1",
|
|
430
|
+
displayName: "RiverCat",
|
|
431
|
+
},
|
|
432
|
+
],
|
|
433
|
+
state: "awaiting_hello",
|
|
434
|
+
},
|
|
435
|
+
],
|
|
436
|
+
},
|
|
437
|
+
]);
|
|
438
|
+
const report = lines.join("\n");
|
|
439
|
+
assert.match(report, /TestFlight/i);
|
|
440
|
+
assert.match(report, /Google Play/i);
|
|
441
|
+
assert.match(report, /Google Group/i);
|
|
442
|
+
});
|
|
443
|
+
|
|
411
444
|
test("session control can terminate a managed session", async (t) => {
|
|
412
445
|
const relay = createRelayServer({
|
|
413
446
|
host: "127.0.0.1",
|
|
@@ -688,4 +721,11 @@ test("session control falls back to the saved QR PNG when an older host lacks th
|
|
|
688
721
|
}).join("\n"),
|
|
689
722
|
/notified|推送/u,
|
|
690
723
|
);
|
|
724
|
+
assert.match(
|
|
725
|
+
buildManagedSessionQrLegacyLines({
|
|
726
|
+
result,
|
|
727
|
+
notifyParticipants: true,
|
|
728
|
+
}).join("\n"),
|
|
729
|
+
/TestFlight|Google Play|Google Group/u,
|
|
730
|
+
);
|
|
691
731
|
});
|
package/src/session-control.ts
CHANGED
|
@@ -5,7 +5,10 @@ import { type AddressInfo } from "node:net";
|
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { resolvePrivateClawMediaDir } from "./invite-qr-files.js";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
appendPrivateClawAppInstallFooterLines,
|
|
10
|
+
formatBilingualInline,
|
|
11
|
+
} from "./text.js";
|
|
9
12
|
import type {
|
|
10
13
|
PrivateClawInviteBundle,
|
|
11
14
|
PrivateClawManagedSession,
|
|
@@ -318,12 +321,12 @@ export function buildManagedSessionsReportLines(
|
|
|
318
321
|
})),
|
|
319
322
|
);
|
|
320
323
|
if (sessions.length === 0) {
|
|
321
|
-
return [
|
|
324
|
+
return appendPrivateClawAppInstallFooterLines([
|
|
322
325
|
formatBilingualInline(
|
|
323
326
|
"当前没有活动中的 PrivateClaw 会话。",
|
|
324
327
|
"No active PrivateClaw sessions.",
|
|
325
328
|
),
|
|
326
|
-
];
|
|
329
|
+
]);
|
|
327
330
|
}
|
|
328
331
|
|
|
329
332
|
const lines = [
|
|
@@ -346,7 +349,7 @@ export function buildManagedSessionsReportLines(
|
|
|
346
349
|
}
|
|
347
350
|
}
|
|
348
351
|
|
|
349
|
-
return lines;
|
|
352
|
+
return appendPrivateClawAppInstallFooterLines(lines);
|
|
350
353
|
}
|
|
351
354
|
|
|
352
355
|
export class PrivateClawSessionControlServer {
|
|
@@ -649,9 +652,9 @@ export function buildManagedSessionQrLegacyLines(params: {
|
|
|
649
652
|
"如需直接打开这张已保存的二维码图片,可重试并追加 --open。",
|
|
650
653
|
"Re-run with --open to open the saved QR image directly.",
|
|
651
654
|
),
|
|
652
|
-
|
|
655
|
+
);
|
|
653
656
|
}
|
|
654
|
-
return lines;
|
|
657
|
+
return appendPrivateClawAppInstallFooterLines(lines);
|
|
655
658
|
}
|
|
656
659
|
|
|
657
660
|
async function waitForPidExit(params: {
|
package/src/setup.test.ts
CHANGED
|
@@ -74,6 +74,40 @@ test("detectLocalOpenClawStatus does not trust commands-list mentions when the p
|
|
|
74
74
|
});
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
+
test("detectLocalOpenClawStatus does not trust generic root help output for unknown commands", async () => {
|
|
78
|
+
const status = await detectLocalOpenClawStatus(async (_command, args) => {
|
|
79
|
+
if (args.length === 1 && args[0] === "--version") {
|
|
80
|
+
return {
|
|
81
|
+
stdout: "OpenClaw 2026.3.22\n",
|
|
82
|
+
stderr: "",
|
|
83
|
+
combined: "OpenClaw 2026.3.22\n",
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (
|
|
87
|
+
args[0] === "privateclaw" &&
|
|
88
|
+
args[1] === "pair" &&
|
|
89
|
+
args[2] === "--help"
|
|
90
|
+
) {
|
|
91
|
+
return {
|
|
92
|
+
stdout: "Usage: openclaw [options] [command]\nCommands:\n help Display help for command\n",
|
|
93
|
+
stderr: "",
|
|
94
|
+
combined:
|
|
95
|
+
"Usage: openclaw [options] [command]\nCommands:\n help Display help for command\n",
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
if (args[0] === "plugins" && args[1] === "info" && args[2] === "privateclaw") {
|
|
99
|
+
throw new Error("Plugin not found");
|
|
100
|
+
}
|
|
101
|
+
throw new Error(`Unexpected command args: ${args.join(" ")}`);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
assert.deepEqual(status, {
|
|
105
|
+
openClawAvailable: true,
|
|
106
|
+
privateClawCommandAvailable: false,
|
|
107
|
+
privateClawPluginPresent: false,
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
77
111
|
test("parsePrivateClawSessionDurationPreset supports the permanent preset", () => {
|
|
78
112
|
const preset = parsePrivateClawSessionDurationPreset("permanent");
|
|
79
113
|
assert.equal(preset.ttlMs, EFFECTIVELY_PERMANENT_SESSION_TTL_MS);
|
package/src/setup.ts
CHANGED
|
@@ -308,12 +308,16 @@ async function commandExists(
|
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
+
function isPrivateClawPairHelpOutput(output: string): boolean {
|
|
312
|
+
return /Usage:\s*openclaw privateclaw pair\b/iu.test(output);
|
|
313
|
+
}
|
|
314
|
+
|
|
311
315
|
async function detectPrivateClawCommandAvailability(
|
|
312
316
|
runCommand: OneShotCommandRunner,
|
|
313
317
|
): Promise<boolean> {
|
|
314
318
|
try {
|
|
315
|
-
await runCommand("openclaw", ["privateclaw", "pair", "--help"]);
|
|
316
|
-
return
|
|
319
|
+
const result = await runCommand("openclaw", ["privateclaw", "pair", "--help"]);
|
|
320
|
+
return isPrivateClawPairHelpOutput(result.combined);
|
|
317
321
|
} catch {
|
|
318
322
|
return false;
|
|
319
323
|
}
|
package/src/text.test.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import {
|
|
4
|
+
appendPrivateClawAppInstallFooter,
|
|
5
|
+
buildPrivateClawCommandErrorMessage,
|
|
6
|
+
PRIVATECLAW_APP_INSTALL_FOOTER_LINES,
|
|
7
|
+
} from "./text.js";
|
|
8
|
+
|
|
9
|
+
test("appendPrivateClawAppInstallFooter appends concise store links", () => {
|
|
10
|
+
const text = appendPrivateClawAppInstallFooter("PrivateClaw session ready.");
|
|
11
|
+
assert.match(text, /TestFlight/i);
|
|
12
|
+
assert.match(text, /Google Play/i);
|
|
13
|
+
assert.match(text, /Google Group/i);
|
|
14
|
+
assert.ok(
|
|
15
|
+
text.endsWith(PRIVATECLAW_APP_INSTALL_FOOTER_LINES.at(-1) ?? ""),
|
|
16
|
+
"footer should end with the Google Group note",
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test("buildPrivateClawCommandErrorMessage also appends store links", () => {
|
|
21
|
+
const text = buildPrivateClawCommandErrorMessage("boom");
|
|
22
|
+
assert.match(text, /Failed to create a PrivateClaw session: boom/);
|
|
23
|
+
assert.match(text, /TestFlight/i);
|
|
24
|
+
assert.match(text, /Google Play/i);
|
|
25
|
+
assert.match(text, /Google Group/i);
|
|
26
|
+
});
|
package/src/text.ts
CHANGED
|
@@ -9,6 +9,51 @@ export function formatBilingualInline(
|
|
|
9
9
|
return `${chinese} / ${english}`;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
export const PRIVATECLAW_IOS_PUBLIC_BETA_URL =
|
|
13
|
+
"https://testflight.apple.com/join/XvgJ9c33";
|
|
14
|
+
export const PRIVATECLAW_ANDROID_CLOSED_TESTING_PLAY_URL =
|
|
15
|
+
"https://play.google.com/store/apps/details?id=gg.ai.privateclaw";
|
|
16
|
+
export const PRIVATECLAW_ANDROID_CLOSED_TESTING_GROUP_URL =
|
|
17
|
+
"https://groups.google.com/g/gg-studio-ai-products";
|
|
18
|
+
|
|
19
|
+
export const PRIVATECLAW_APP_INSTALL_FOOTER_LINES = [
|
|
20
|
+
formatBilingualInline(
|
|
21
|
+
`iOS 公开测试(TestFlight):${PRIVATECLAW_IOS_PUBLIC_BETA_URL}`,
|
|
22
|
+
`iOS public beta (TestFlight): ${PRIVATECLAW_IOS_PUBLIC_BETA_URL}`,
|
|
23
|
+
),
|
|
24
|
+
formatBilingualInline(
|
|
25
|
+
`Android 封闭测试(Google Play):${PRIVATECLAW_ANDROID_CLOSED_TESTING_PLAY_URL}`,
|
|
26
|
+
`Android closed testing (Google Play): ${PRIVATECLAW_ANDROID_CLOSED_TESTING_PLAY_URL}`,
|
|
27
|
+
),
|
|
28
|
+
formatBilingualInline(
|
|
29
|
+
`Android 需先加入 Google Group:${PRIVATECLAW_ANDROID_CLOSED_TESTING_GROUP_URL}`,
|
|
30
|
+
`Join the Google Group first for Android closed testing: ${PRIVATECLAW_ANDROID_CLOSED_TESTING_GROUP_URL}`,
|
|
31
|
+
),
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
export function appendPrivateClawAppInstallFooter(text: string): string {
|
|
35
|
+
const trimmed = text.trimEnd();
|
|
36
|
+
if (trimmed === "") {
|
|
37
|
+
return PRIVATECLAW_APP_INSTALL_FOOTER_LINES.join("\n");
|
|
38
|
+
}
|
|
39
|
+
return `${trimmed}\n\n${PRIVATECLAW_APP_INSTALL_FOOTER_LINES.join("\n")}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function appendPrivateClawAppInstallFooterLines(
|
|
43
|
+
lines: ReadonlyArray<string>,
|
|
44
|
+
): string[] {
|
|
45
|
+
return [...lines, "", ...PRIVATECLAW_APP_INSTALL_FOOTER_LINES];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function writePrivateClawAppInstallFooter(
|
|
49
|
+
writeLine: (line: string) => void,
|
|
50
|
+
): void {
|
|
51
|
+
writeLine("");
|
|
52
|
+
for (const line of PRIVATECLAW_APP_INSTALL_FOOTER_LINES) {
|
|
53
|
+
writeLine(line);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
12
57
|
export function buildInviteAnnouncementText(params: {
|
|
13
58
|
sessionId: string;
|
|
14
59
|
expiresAt: string;
|
|
@@ -191,9 +236,11 @@ export function buildPrivateClawBackgroundHandoffFailureMessage(
|
|
|
191
236
|
}
|
|
192
237
|
|
|
193
238
|
export function buildPrivateClawCommandErrorMessage(details: string): string {
|
|
194
|
-
return
|
|
195
|
-
|
|
196
|
-
|
|
239
|
+
return appendPrivateClawAppInstallFooter(
|
|
240
|
+
formatBilingualInline(
|
|
241
|
+
`创建 PrivateClaw 会话失败:${details}`,
|
|
242
|
+
`Failed to create a PrivateClaw session: ${details}`,
|
|
243
|
+
),
|
|
197
244
|
);
|
|
198
245
|
}
|
|
199
246
|
|