@clawling/clawchat-plugin-openclaw 2026.7.9-4 → 2026.7.10-1

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.
@@ -144,7 +144,10 @@ function waitForOutput(child, match, timeoutMs, label) {
144
144
  }
145
145
  export async function startSampleServer(opts) {
146
146
  const spawnFn = opts.spawnFn ?? nodeSpawn;
147
- const child = spawnFn(process.execPath, [path.join(opts.appDir, "server.mjs"), "--dir", opts.appDir, "--port", String(opts.port)], { stdio: ["ignore", "pipe", "pipe"] });
147
+ const args = [path.join(opts.appDir, "server.mjs"), "--dir", opts.appDir, "--port", String(opts.port)];
148
+ if (opts.agentUserId)
149
+ args.push("--agent-id", opts.agentUserId);
150
+ const child = spawnFn(process.execPath, args, { stdio: ["ignore", "pipe", "pipe"] });
148
151
  const line = await waitForOutput(child, (acc) => acc.split("\n").find((l) => l.trim().startsWith('{"port"')) ?? null, opts.timeoutMs ?? SERVER_START_TIMEOUT_MS, "liveware-sample server start");
149
152
  return { child, port: JSON.parse(line).port };
150
153
  }
@@ -291,8 +294,9 @@ export async function livewareAppCreate(opts) {
291
294
  throw new Error(`liveware app create: cannot parse app id from output: ${stdout.slice(0, 500)}`);
292
295
  return appId;
293
296
  }
294
- export const LIVEWARE_SAMPLE_INTRO_TEXT = "我给你安装了一个 liveware 演示应用「Liveware Sample」,它已经出现在我们的聊天里。" +
295
- "点开它看看,然后试试对我说:把标题改成 Hello Liveware。" +
297
+ export const LIVEWARE_SAMPLE_INTRO_TEXT = "我给你安装了一个 liveware 演示应用「Liveware Sample」。" +
298
+ "入口:在我们的对话页面,点右上角的「应用」按钮(✦),在打开的面板里选名为「Liveware Sample」的应用。" +
299
+ "页面上有完整的使用引导,试试对我说:把标题改成 Hello Liveware。" +
296
300
  "你在页面上点的按钮、提交的留言我也能看到,随时问我。";
297
301
  const DEFAULT_SAMPLE_PORT = 43110;
298
302
  const RESTART_WINDOW_MS = 30 * 60 * 1000;
@@ -425,6 +429,7 @@ export class LivewareSampleSupervisor {
425
429
  return;
426
430
  const server = await startSampleServer({
427
431
  appDir, port: DEFAULT_SAMPLE_PORT, spawnFn: deps.spawnFn,
432
+ agentUserId: deps.resolveAgentUserId?.() ?? null,
428
433
  });
429
434
  this.serverChild = server.child;
430
435
  if (this.bailIfStopped())
@@ -496,6 +501,7 @@ export class LivewareSampleSupervisor {
496
501
  return;
497
502
  const server = await startSampleServer({
498
503
  appDir, port: row.port || DEFAULT_SAMPLE_PORT, spawnFn: deps.spawnFn,
504
+ agentUserId: deps.resolveAgentUserId?.() ?? null,
499
505
  });
500
506
  this.serverChild = server.child;
501
507
  if (this.bailIfStopped())
@@ -801,6 +801,7 @@ export async function startOpenclawClawlingGateway(params) {
801
801
  store: store,
802
802
  sampleRoot: path.join(stateDirForSample ?? "", "clawchat", "liveware-sample"),
803
803
  resolveToken: () => account.token ?? "",
804
+ resolveAgentUserId: () => account.userId ?? null,
804
805
  resolveLivewarePath: () => resolveLivewarePath(stateDirForSample),
805
806
  cliReady: livewareCliReady,
806
807
  listApps: async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawling/clawchat-plugin-openclaw",
3
- "version": "2026.7.9-4",
3
+ "version": "2026.7.10-1",
4
4
  "description": "OpenClaw ClawChat channel plugin",
5
5
  "license": "MIT",
6
6
  "author": "CLAWLING PTE. LTD.",
@@ -183,15 +183,14 @@ function waitForOutput(
183
183
  export async function startSampleServer(opts: {
184
184
  appDir: string;
185
185
  port: number;
186
+ agentUserId?: string | null;
186
187
  spawnFn?: SpawnLike;
187
188
  timeoutMs?: number;
188
189
  }): Promise<{ child: ChildProcess; port: number }> {
189
190
  const spawnFn = opts.spawnFn ?? nodeSpawn;
190
- const child = spawnFn(
191
- process.execPath,
192
- [path.join(opts.appDir, "server.mjs"), "--dir", opts.appDir, "--port", String(opts.port)],
193
- { stdio: ["ignore", "pipe", "pipe"] },
194
- );
191
+ const args = [path.join(opts.appDir, "server.mjs"), "--dir", opts.appDir, "--port", String(opts.port)];
192
+ if (opts.agentUserId) args.push("--agent-id", opts.agentUserId);
193
+ const child = spawnFn(process.execPath, args, { stdio: ["ignore", "pipe", "pipe"] });
195
194
  const line = await waitForOutput(
196
195
  child,
197
196
  (acc) => acc.split("\n").find((l) => l.trim().startsWith('{"port"')) ?? null,
@@ -396,6 +395,10 @@ export type LivewareSampleSupervisorDeps = {
396
395
  sampleRoot: string;
397
396
  resolveToken: () => string;
398
397
  resolveLivewarePath: () => string | null;
398
+ /** The agent's own ClawChat user id (`usr_…`) — minted into the sample
399
+ * page's back-to-chat deep link. Read at spawn time; null/absent → the
400
+ * page renders its text fallback instead of the link. */
401
+ resolveAgentUserId?: () => string | null;
399
402
  /** Settles when the liveware CLI self-download has finished (either way).
400
403
  * start() awaits it before the CLI gate so a first boot doesn't lose the
401
404
  * race against ensureLivewareCli and silently skip forever. */
@@ -412,8 +415,9 @@ export type LivewareSampleSupervisorDeps = {
412
415
  };
413
416
 
414
417
  export const LIVEWARE_SAMPLE_INTRO_TEXT =
415
- "我给你安装了一个 liveware 演示应用「Liveware Sample」,它已经出现在我们的聊天里。" +
416
- "点开它看看,然后试试对我说:把标题改成 Hello Liveware。" +
418
+ "我给你安装了一个 liveware 演示应用「Liveware Sample」。" +
419
+ "入口:在我们的对话页面,点右上角的「应用」按钮(✦),在打开的面板里选名为「Liveware Sample」的应用。" +
420
+ "页面上有完整的使用引导,试试对我说:把标题改成 Hello Liveware。" +
417
421
  "你在页面上点的按钮、提交的留言我也能看到,随时问我。";
418
422
 
419
423
  const DEFAULT_SAMPLE_PORT = 43110;
@@ -539,6 +543,7 @@ export class LivewareSampleSupervisor {
539
543
  if (this.bailIfStopped()) return;
540
544
  const server = await startSampleServer({
541
545
  appDir, port: DEFAULT_SAMPLE_PORT, spawnFn: deps.spawnFn,
546
+ agentUserId: deps.resolveAgentUserId?.() ?? null,
542
547
  });
543
548
  this.serverChild = server.child;
544
549
  if (this.bailIfStopped()) return;
@@ -600,6 +605,7 @@ export class LivewareSampleSupervisor {
600
605
  if (this.bailIfStopped()) return;
601
606
  const server = await startSampleServer({
602
607
  appDir, port: row.port || DEFAULT_SAMPLE_PORT, spawnFn: deps.spawnFn,
608
+ agentUserId: deps.resolveAgentUserId?.() ?? null,
603
609
  });
604
610
  this.serverChild = server.child;
605
611
  if (this.bailIfStopped()) return;
package/src/runtime.ts CHANGED
@@ -1119,6 +1119,7 @@ export async function startOpenclawClawlingGateway(params: StartGatewayParams):
1119
1119
  store: store as unknown as LivewareSampleStoreLike,
1120
1120
  sampleRoot: path.join(stateDirForSample ?? "", "clawchat", "liveware-sample"),
1121
1121
  resolveToken: () => account.token ?? "",
1122
+ resolveAgentUserId: () => account.userId ?? null,
1122
1123
  resolveLivewarePath: () => resolveLivewarePath(stateDirForSample),
1123
1124
  cliReady: livewareCliReady,
1124
1125
  listApps: async () => {