pubblue 0.6.4 → 0.6.8
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/dist/chunk-AZQD654L.js +1489 -0
- package/dist/index.js +105 -147
- package/dist/live-daemon-entry.js +757 -6
- package/package.json +2 -2
- package/dist/chunk-JXEXE632.js +0 -608
- package/dist/chunk-QFJDLFK5.js +0 -1366
- package/dist/live-daemon-EEIBVVBU.js +0 -7
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
toCliFailure,
|
|
28
28
|
waitForDaemonReady,
|
|
29
29
|
writeLatestCliVersion
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-AZQD654L.js";
|
|
31
31
|
|
|
32
32
|
// src/program.ts
|
|
33
33
|
import { Command } from "commander";
|
|
@@ -189,103 +189,78 @@ function parsePositiveInteger(raw, key) {
|
|
|
189
189
|
}
|
|
190
190
|
return parsed;
|
|
191
191
|
}
|
|
192
|
-
var
|
|
193
|
-
"openclaw.path",
|
|
194
|
-
"openclaw.
|
|
195
|
-
"openclaw.
|
|
196
|
-
"openclaw.
|
|
197
|
-
"openclaw.
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
"openclaw.
|
|
203
|
-
"
|
|
204
|
-
|
|
192
|
+
var CONFIG_KEY_REGISTRY = {
|
|
193
|
+
"openclaw.path": { target: "bridge", field: "openclawPath", type: "string" },
|
|
194
|
+
"openclaw.stateDir": { target: "bridge", field: "openclawStateDir", type: "string" },
|
|
195
|
+
"openclaw.sessionId": { target: "bridge", field: "sessionId", type: "string" },
|
|
196
|
+
"openclaw.threadId": { target: "bridge", field: "threadId", type: "string" },
|
|
197
|
+
"openclaw.canvasReminderEvery": {
|
|
198
|
+
target: "bridge",
|
|
199
|
+
field: "canvasReminderEvery",
|
|
200
|
+
type: "integer"
|
|
201
|
+
},
|
|
202
|
+
"openclaw.deliver": { target: "bridge", field: "deliver", type: "boolean" },
|
|
203
|
+
"openclaw.deliverChannel": { target: "bridge", field: "deliverChannel", type: "string" },
|
|
204
|
+
"openclaw.replyTo": { target: "bridge", field: "replyTo", type: "string" },
|
|
205
|
+
"openclaw.deliverTimeoutMs": { target: "bridge", field: "deliverTimeoutMs", type: "integer" },
|
|
206
|
+
"openclaw.attachmentDir": { target: "bridge", field: "attachmentDir", type: "string" },
|
|
207
|
+
"openclaw.attachmentMaxBytes": { target: "bridge", field: "attachmentMaxBytes", type: "integer" },
|
|
208
|
+
"claude-code.path": { target: "bridge", field: "claudeCodePath", type: "string" },
|
|
209
|
+
"claude-code.model": { target: "bridge", field: "claudeCodeModel", type: "string" },
|
|
210
|
+
"claude-code.allowedTools": { target: "bridge", field: "claudeCodeAllowedTools", type: "string" },
|
|
211
|
+
"claude-code.appendSystemPrompt": {
|
|
212
|
+
target: "bridge",
|
|
213
|
+
field: "claudeCodeAppendSystemPrompt",
|
|
214
|
+
type: "string",
|
|
215
|
+
displayAs: "set-only"
|
|
216
|
+
},
|
|
217
|
+
"claude-code.maxTurns": { target: "bridge", field: "claudeCodeMaxTurns", type: "integer" },
|
|
218
|
+
"claude-code.cwd": { target: "bridge", field: "claudeCodeCwd", type: "string" },
|
|
219
|
+
"telegram.botToken": {
|
|
220
|
+
target: "telegram",
|
|
221
|
+
field: "botToken",
|
|
222
|
+
type: "string",
|
|
223
|
+
cascadeUnset: ["botUsername", "hasMainWebApp"]
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
var SUPPORTED_KEYS = Object.keys(CONFIG_KEY_REGISTRY);
|
|
227
|
+
function coerceValue(raw, type, key) {
|
|
228
|
+
if (type === "integer") return parsePositiveInteger(raw, key);
|
|
229
|
+
if (type === "boolean") return parseBooleanValue(raw, key);
|
|
230
|
+
return raw;
|
|
231
|
+
}
|
|
205
232
|
function applyConfigSet(bridge, telegram, key, value) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
return;
|
|
222
|
-
case "openclaw.deliverChannel":
|
|
223
|
-
bridge.deliverChannel = value;
|
|
224
|
-
return;
|
|
225
|
-
case "openclaw.replyTo":
|
|
226
|
-
bridge.replyTo = value;
|
|
227
|
-
return;
|
|
228
|
-
case "openclaw.deliverTimeoutMs":
|
|
229
|
-
bridge.deliverTimeoutMs = parsePositiveInteger(value, key);
|
|
230
|
-
return;
|
|
231
|
-
case "openclaw.attachmentDir":
|
|
232
|
-
bridge.attachmentDir = value;
|
|
233
|
-
return;
|
|
234
|
-
case "openclaw.attachmentMaxBytes":
|
|
235
|
-
bridge.attachmentMaxBytes = parsePositiveInteger(value, key);
|
|
236
|
-
return;
|
|
237
|
-
case "telegram.botToken":
|
|
238
|
-
telegram.botToken = value;
|
|
239
|
-
return;
|
|
240
|
-
default:
|
|
241
|
-
throw new Error(
|
|
242
|
-
[
|
|
243
|
-
`Unknown config key: ${key}`,
|
|
244
|
-
"Supported keys:",
|
|
245
|
-
...SUPPORTED_KEYS.map((k) => ` ${k}`)
|
|
246
|
-
].join("\n")
|
|
247
|
-
);
|
|
233
|
+
const def = CONFIG_KEY_REGISTRY[key];
|
|
234
|
+
if (!def) {
|
|
235
|
+
throw new Error(
|
|
236
|
+
[
|
|
237
|
+
`Unknown config key: ${key}`,
|
|
238
|
+
"Supported keys:",
|
|
239
|
+
...SUPPORTED_KEYS.map((k) => ` ${k}`)
|
|
240
|
+
].join("\n")
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
const coerced = coerceValue(value, def.type, key);
|
|
244
|
+
if (def.target === "bridge") {
|
|
245
|
+
Object.assign(bridge, { [def.field]: coerced });
|
|
246
|
+
} else {
|
|
247
|
+
Object.assign(telegram, { [def.field]: coerced });
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
function applyConfigUnset(bridge, telegram, key) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
case "openclaw.deliver":
|
|
265
|
-
delete bridge.deliver;
|
|
266
|
-
return;
|
|
267
|
-
case "openclaw.deliverChannel":
|
|
268
|
-
delete bridge.deliverChannel;
|
|
269
|
-
return;
|
|
270
|
-
case "openclaw.replyTo":
|
|
271
|
-
delete bridge.replyTo;
|
|
272
|
-
return;
|
|
273
|
-
case "openclaw.deliverTimeoutMs":
|
|
274
|
-
delete bridge.deliverTimeoutMs;
|
|
275
|
-
return;
|
|
276
|
-
case "openclaw.attachmentDir":
|
|
277
|
-
delete bridge.attachmentDir;
|
|
278
|
-
return;
|
|
279
|
-
case "openclaw.attachmentMaxBytes":
|
|
280
|
-
delete bridge.attachmentMaxBytes;
|
|
281
|
-
return;
|
|
282
|
-
case "telegram.botToken":
|
|
283
|
-
delete telegram.botToken;
|
|
284
|
-
delete telegram.botUsername;
|
|
285
|
-
delete telegram.hasMainWebApp;
|
|
286
|
-
return;
|
|
287
|
-
default:
|
|
288
|
-
throw new Error(`Unknown config key for --unset: ${key}`);
|
|
251
|
+
const def = CONFIG_KEY_REGISTRY[key];
|
|
252
|
+
if (!def) {
|
|
253
|
+
throw new Error(`Unknown config key for --unset: ${key}`);
|
|
254
|
+
}
|
|
255
|
+
if (def.target === "bridge") {
|
|
256
|
+
delete bridge[def.field];
|
|
257
|
+
} else {
|
|
258
|
+
delete telegram[def.field];
|
|
259
|
+
if (def.cascadeUnset) {
|
|
260
|
+
for (const cascadeField of def.cascadeUnset) {
|
|
261
|
+
delete telegram[cascadeField];
|
|
262
|
+
}
|
|
263
|
+
}
|
|
289
264
|
}
|
|
290
265
|
}
|
|
291
266
|
function hasValues(obj) {
|
|
@@ -317,41 +292,32 @@ async function telegramSetMenuButton(token, button) {
|
|
|
317
292
|
throw new Error(data.description ?? "setChatMenuButton failed");
|
|
318
293
|
}
|
|
319
294
|
}
|
|
320
|
-
function
|
|
321
|
-
if (
|
|
322
|
-
|
|
295
|
+
function formatFieldValue(value, def) {
|
|
296
|
+
if (def.displayAs === "set-only") return "(set)";
|
|
297
|
+
if (def.type === "boolean") return value ? "true" : "false";
|
|
298
|
+
return String(value);
|
|
299
|
+
}
|
|
300
|
+
function printBridgeConfig(bridge) {
|
|
301
|
+
if (!hasValues(bridge)) {
|
|
302
|
+
console.log(" bridge: none");
|
|
323
303
|
return;
|
|
324
304
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
if (
|
|
329
|
-
|
|
330
|
-
if (saved.bridge.threadId) console.log(` openclaw.threadId: ${saved.bridge.threadId}`);
|
|
331
|
-
if (saved.bridge.canvasReminderEvery !== void 0)
|
|
332
|
-
console.log(` openclaw.canvasReminderEvery: ${saved.bridge.canvasReminderEvery}`);
|
|
333
|
-
if (saved.bridge.deliver !== void 0)
|
|
334
|
-
console.log(` openclaw.deliver: ${saved.bridge.deliver ? "true" : "false"}`);
|
|
335
|
-
if (saved.bridge.deliverChannel)
|
|
336
|
-
console.log(` openclaw.deliverChannel: ${saved.bridge.deliverChannel}`);
|
|
337
|
-
if (saved.bridge.replyTo) console.log(` openclaw.replyTo: ${saved.bridge.replyTo}`);
|
|
338
|
-
if (saved.bridge.deliverTimeoutMs !== void 0)
|
|
339
|
-
console.log(` openclaw.deliverTimeoutMs: ${saved.bridge.deliverTimeoutMs}`);
|
|
340
|
-
if (saved.bridge.attachmentDir)
|
|
341
|
-
console.log(` openclaw.attachmentDir: ${saved.bridge.attachmentDir}`);
|
|
342
|
-
if (saved.bridge.attachmentMaxBytes !== void 0)
|
|
343
|
-
console.log(` openclaw.attachmentMaxBytes: ${saved.bridge.attachmentMaxBytes}`);
|
|
344
|
-
} else {
|
|
345
|
-
console.log(" bridge: none");
|
|
305
|
+
for (const [key, def] of Object.entries(CONFIG_KEY_REGISTRY)) {
|
|
306
|
+
if (def.target !== "bridge") continue;
|
|
307
|
+
const value = bridge[def.field];
|
|
308
|
+
if (value === void 0) continue;
|
|
309
|
+
console.log(` ${key}: ${formatFieldValue(value, def)}`);
|
|
346
310
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
311
|
+
}
|
|
312
|
+
function printTelegramConfig(telegram) {
|
|
313
|
+
if (telegram?.botToken && telegram.botUsername) {
|
|
314
|
+
console.log(` telegram.botToken: ${maskSecret(telegram.botToken)}`);
|
|
315
|
+
console.log(` telegram.botUsername: @${telegram.botUsername}`);
|
|
316
|
+
if (!telegram.hasMainWebApp) {
|
|
351
317
|
console.log(" INFO: Register Mini App in @BotFather for deep links to open in Telegram");
|
|
352
318
|
}
|
|
353
|
-
} else if (
|
|
354
|
-
console.log(` telegram.botToken: ${maskSecret(
|
|
319
|
+
} else if (telegram?.botToken) {
|
|
320
|
+
console.log(` telegram.botToken: ${maskSecret(telegram.botToken)}`);
|
|
355
321
|
console.log(" telegram.botUsername: (not resolved)");
|
|
356
322
|
} else {
|
|
357
323
|
console.log(" telegram: not configured");
|
|
@@ -359,6 +325,16 @@ function printConfigSummary(saved) {
|
|
|
359
325
|
console.log(" Example: pubblue configure --set telegram.botToken=<BOT_TOKEN>");
|
|
360
326
|
}
|
|
361
327
|
}
|
|
328
|
+
function printConfigSummary(saved) {
|
|
329
|
+
if (!saved) {
|
|
330
|
+
console.log("Saved config: none");
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
console.log("Saved config:");
|
|
334
|
+
console.log(` apiKey: ${maskSecret(saved.apiKey)}`);
|
|
335
|
+
printBridgeConfig(saved.bridge ?? {});
|
|
336
|
+
printTelegramConfig(saved.telegram);
|
|
337
|
+
}
|
|
362
338
|
function registerConfigureCommand(program2) {
|
|
363
339
|
program2.command("configure").description("Configure the CLI with your API key").option("--api-key <key>", "Your API key (less secure: appears in shell history)").option("--api-key-stdin", "Read API key from stdin").option(
|
|
364
340
|
"--set <key=value>",
|
|
@@ -451,8 +427,8 @@ import * as path3 from "path";
|
|
|
451
427
|
// package.json
|
|
452
428
|
var package_default = {
|
|
453
429
|
name: "pubblue",
|
|
454
|
-
version: "0.6.
|
|
455
|
-
description: "CLI tool for publishing content and running
|
|
430
|
+
version: "0.6.8",
|
|
431
|
+
description: "CLI tool for publishing content and running live sessions via pub.blue",
|
|
456
432
|
type: "module",
|
|
457
433
|
bin: {
|
|
458
434
|
pubblue: "./dist/index.js"
|
|
@@ -511,35 +487,16 @@ function registerLiveCommands(program2) {
|
|
|
511
487
|
registerDoctorCommand(program2);
|
|
512
488
|
}
|
|
513
489
|
function registerStartCommand(program2) {
|
|
514
|
-
program2.command("start").description("Start the agent daemon (registers presence, awaits live requests)").requiredOption("--agent-name <name>", "Agent display name shown to the browser user").option("--bridge <mode>", "Bridge mode: openclaw|
|
|
490
|
+
program2.command("start").description("Start the agent daemon (registers presence, awaits live requests)").requiredOption("--agent-name <name>", "Agent display name shown to the browser user").option("--bridge <mode>", "Bridge mode: openclaw|claude-code").action(async (opts) => {
|
|
515
491
|
await ensureNodeDatachannelAvailable();
|
|
516
492
|
writeLatestCliVersion(CLI_VERSION);
|
|
517
493
|
const runtimeConfig = getConfig();
|
|
518
|
-
const apiClient = createClient(runtimeConfig);
|
|
519
494
|
const bridgeMode = resolveBridgeMode(opts);
|
|
520
495
|
const bridgeProcessEnv = buildBridgeProcessEnv(runtimeConfig.bridge);
|
|
521
496
|
const socketPath = getAgentSocketPath();
|
|
522
497
|
const infoPath = liveInfoPath("agent");
|
|
523
498
|
const logPath = liveLogPath("agent");
|
|
524
499
|
await stopOtherDaemons();
|
|
525
|
-
if (opts.foreground) {
|
|
526
|
-
const { startDaemon } = await import("./live-daemon-EEIBVVBU.js");
|
|
527
|
-
console.log("Agent daemon starting in foreground...");
|
|
528
|
-
console.log("Press Ctrl+C to stop.");
|
|
529
|
-
try {
|
|
530
|
-
await startDaemon({
|
|
531
|
-
cliVersion: CLI_VERSION,
|
|
532
|
-
apiClient,
|
|
533
|
-
socketPath,
|
|
534
|
-
infoPath,
|
|
535
|
-
bridgeMode,
|
|
536
|
-
agentName: opts.agentName
|
|
537
|
-
});
|
|
538
|
-
} catch (error) {
|
|
539
|
-
failCli(`Daemon failed: ${errorMessage(error)}`);
|
|
540
|
-
}
|
|
541
|
-
return;
|
|
542
|
-
}
|
|
543
500
|
const { fork } = await import("child_process");
|
|
544
501
|
const daemonScript = path3.join(import.meta.dirname, "live-daemon-entry.js");
|
|
545
502
|
const daemonLogFd = fs3.openSync(logPath, "a");
|
|
@@ -624,7 +581,8 @@ function registerStatusCommand(program2) {
|
|
|
624
581
|
}
|
|
625
582
|
const bridge = response.bridge;
|
|
626
583
|
if (bridge) {
|
|
627
|
-
|
|
584
|
+
const bridgeLabel = response.bridgeMode ?? "unknown";
|
|
585
|
+
console.log(` Bridge: ${bridgeLabel} (${bridge.running ? "running" : "stopped"})`);
|
|
628
586
|
if (bridge.sessionId) {
|
|
629
587
|
console.log(` Bridge session: ${bridge.sessionId}`);
|
|
630
588
|
}
|