@agentchatme/openclaw 0.10.0 → 0.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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { L as Logger, M as MetricsRecorder } from './setup-entry-C9aFZx3n.cjs';
2
- export { A as AgentchatChannelConfig, a as AgentchatResolvedAccount, C as CreateMetricsOptions, I as IntegrationSocket, b as IntegrationSocketOptions, c as MetricsSnapshot, P as PromFactory, d as PromRegistryLike, S as SocketBlocked, e as SocketDisconnect, f as SocketHandlers, g as SocketHealth, h as SocketState, i as agentchatChannelEntry, j as agentchatPlugin, k as agentchatSetupEntry, j as agentchatSetupPlugin, l as createInMemoryMetrics, m as createMetrics, n as createNoopMetrics, i as default, p as parseChannelConfig, r as realtimeOptionsFor } from './setup-entry-C9aFZx3n.cjs';
1
+ import { L as Logger, M as MetricsRecorder } from './setup-entry-DFY6cAa6.cjs';
2
+ export { A as AgentchatChannelConfig, a as AgentchatResolvedAccount, C as CreateMetricsOptions, I as IntegrationSocket, b as IntegrationSocketOptions, c as MetricsSnapshot, P as PromFactory, d as PromRegistryLike, S as SocketBlocked, e as SocketDisconnect, f as SocketHandlers, g as SocketHealth, h as SocketState, i as agentchatChannelEntry, j as agentchatPlugin, k as agentchatSetupEntry, j as agentchatSetupPlugin, l as createInMemoryMetrics, m as createMetrics, n as createNoopMetrics, i as default, p as parseChannelConfig, r as realtimeOptionsFor } from './setup-entry-DFY6cAa6.cjs';
3
3
  export { hasAgentChatConfiguredState } from './configured-state.cjs';
4
4
  import { integration, InboxCard, TrayInvite, RealtimeClient, GateModelCall, Texts, AgentChatClient, ToolNamer } from 'agentchatme';
5
5
  import 'openclaw/plugin-sdk/channel-core';
@@ -297,9 +297,11 @@ declare class TurnStore {
297
297
  * when it ends it gets the after-turn rule. A stored turn first started more
298
298
  * than `STORED_TURN_MAX_AGE_MS` ago is dropped, so a restart storm cannot
299
299
  * re-adopt it forever. Not covered (accepted): a continuation that starts
300
- * after the hold, when the conversation may have been gated again; the wake
301
- * text AgentChat serves for OpenClaw is to tell the agent not to resume an
302
- * AgentChat turn after a restart (a server change). A plugin reload waits for the runs (OpenClaw drains a plugin's
300
+ * after the hold, when the conversation may have been gated again. The wake
301
+ * instruction and invite prompt AgentChat serves for OpenClaw end with a
302
+ * restart note telling the agent not to continue an interrupted turn after a
303
+ * restart (it promises no wake); that lowers the odds, it is no guarantee.
304
+ * A plugin reload waits for the runs (OpenClaw drains a plugin's
303
305
  * admitted work first, and every turn holds it until it ends).
304
306
  */
305
307
 
@@ -540,11 +542,14 @@ interface IntegrationLoop {
540
542
  declare function createIntegrationLoop(options: IntegrationLoopOptions): IntegrationLoop;
541
543
 
542
544
  declare function hostedMcpUrl(apiBase?: string): string;
545
+ /** The header that names the calling client to AgentChat (the server reads it case-insensitively). */
546
+ declare const CLIENT_HEADER = "X-AgentChat-Client";
543
547
  interface McpServerEntry {
544
548
  readonly url: string;
545
549
  readonly transport: 'streamable-http';
546
550
  readonly headers: {
547
551
  readonly Authorization: string;
552
+ readonly [CLIENT_HEADER]: string;
548
553
  };
549
554
  }
550
555
  /** The `mcp.servers.agentchat` value this plugin places. */
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { L as Logger, M as MetricsRecorder } from './setup-entry-C9aFZx3n.js';
2
- export { A as AgentchatChannelConfig, a as AgentchatResolvedAccount, C as CreateMetricsOptions, I as IntegrationSocket, b as IntegrationSocketOptions, c as MetricsSnapshot, P as PromFactory, d as PromRegistryLike, S as SocketBlocked, e as SocketDisconnect, f as SocketHandlers, g as SocketHealth, h as SocketState, i as agentchatChannelEntry, j as agentchatPlugin, k as agentchatSetupEntry, j as agentchatSetupPlugin, l as createInMemoryMetrics, m as createMetrics, n as createNoopMetrics, i as default, p as parseChannelConfig, r as realtimeOptionsFor } from './setup-entry-C9aFZx3n.js';
1
+ import { L as Logger, M as MetricsRecorder } from './setup-entry-DFY6cAa6.js';
2
+ export { A as AgentchatChannelConfig, a as AgentchatResolvedAccount, C as CreateMetricsOptions, I as IntegrationSocket, b as IntegrationSocketOptions, c as MetricsSnapshot, P as PromFactory, d as PromRegistryLike, S as SocketBlocked, e as SocketDisconnect, f as SocketHandlers, g as SocketHealth, h as SocketState, i as agentchatChannelEntry, j as agentchatPlugin, k as agentchatSetupEntry, j as agentchatSetupPlugin, l as createInMemoryMetrics, m as createMetrics, n as createNoopMetrics, i as default, p as parseChannelConfig, r as realtimeOptionsFor } from './setup-entry-DFY6cAa6.js';
3
3
  export { hasAgentChatConfiguredState } from './configured-state.js';
4
4
  import { integration, InboxCard, TrayInvite, RealtimeClient, GateModelCall, Texts, AgentChatClient, ToolNamer } from 'agentchatme';
5
5
  import 'openclaw/plugin-sdk/channel-core';
@@ -297,9 +297,11 @@ declare class TurnStore {
297
297
  * when it ends it gets the after-turn rule. A stored turn first started more
298
298
  * than `STORED_TURN_MAX_AGE_MS` ago is dropped, so a restart storm cannot
299
299
  * re-adopt it forever. Not covered (accepted): a continuation that starts
300
- * after the hold, when the conversation may have been gated again; the wake
301
- * text AgentChat serves for OpenClaw is to tell the agent not to resume an
302
- * AgentChat turn after a restart (a server change). A plugin reload waits for the runs (OpenClaw drains a plugin's
300
+ * after the hold, when the conversation may have been gated again. The wake
301
+ * instruction and invite prompt AgentChat serves for OpenClaw end with a
302
+ * restart note telling the agent not to continue an interrupted turn after a
303
+ * restart (it promises no wake); that lowers the odds, it is no guarantee.
304
+ * A plugin reload waits for the runs (OpenClaw drains a plugin's
303
305
  * admitted work first, and every turn holds it until it ends).
304
306
  */
305
307
 
@@ -540,11 +542,14 @@ interface IntegrationLoop {
540
542
  declare function createIntegrationLoop(options: IntegrationLoopOptions): IntegrationLoop;
541
543
 
542
544
  declare function hostedMcpUrl(apiBase?: string): string;
545
+ /** The header that names the calling client to AgentChat (the server reads it case-insensitively). */
546
+ declare const CLIENT_HEADER = "X-AgentChat-Client";
543
547
  interface McpServerEntry {
544
548
  readonly url: string;
545
549
  readonly transport: 'streamable-http';
546
550
  readonly headers: {
547
551
  readonly Authorization: string;
552
+ readonly [CLIENT_HEADER]: string;
548
553
  };
549
554
  }
550
555
  /** The `mcp.servers.agentchat` value this plugin places. */
package/dist/index.js CHANGED
@@ -120,7 +120,7 @@ var AgentChatChannelError = class extends Error {
120
120
  };
121
121
 
122
122
  // src/version.ts
123
- var PACKAGE_VERSION = "0.10.0";
123
+ var PACKAGE_VERSION = "0.10.1";
124
124
 
125
125
  // src/client-identity.ts
126
126
  var AGENTCHAT_CLIENT_NAME = "openclaw";
@@ -390,14 +390,22 @@ var DEFAULT_API_BASE2 = "https://api.agentchat.me";
390
390
  function hostedMcpUrl(apiBase = DEFAULT_API_BASE2) {
391
391
  return `${apiBase.replace(/\/+$/, "")}${MCP_PATH}`;
392
392
  }
393
+ var CLIENT_HEADER = "X-AgentChat-Client";
394
+ function clientIdentityHeaders() {
395
+ return { [CLIENT_HEADER]: AGENTCHAT_CLIENT_NAME };
396
+ }
397
+ function clientIdentityText() {
398
+ return `${CLIENT_HEADER}: ${AGENTCHAT_CLIENT_NAME}`;
399
+ }
393
400
  function hostedMcpServerEntry(apiBase = DEFAULT_API_BASE2) {
394
401
  return {
395
402
  url: hostedMcpUrl(apiBase),
396
403
  transport: "streamable-http",
397
- headers: { Authorization: AUTH_HEADER_TEMPLATE }
404
+ headers: { Authorization: AUTH_HEADER_TEMPLATE, ...clientIdentityHeaders() }
398
405
  };
399
406
  }
400
407
  function hostedMcpSnippet(apiBase = DEFAULT_API_BASE2) {
408
+ const identity = clientIdentityHeaders();
401
409
  return [
402
410
  "{",
403
411
  " mcp: {",
@@ -405,7 +413,10 @@ function hostedMcpSnippet(apiBase = DEFAULT_API_BASE2) {
405
413
  ` ${MCP_SERVER_NAME}: {`,
406
414
  ` url: "${hostedMcpUrl(apiBase)}",`,
407
415
  ' transport: "streamable-http",',
408
- ` headers: { Authorization: "${AUTH_HEADER_TEMPLATE}" },`,
416
+ " headers: {",
417
+ ` Authorization: "${AUTH_HEADER_TEMPLATE}",`,
418
+ ` "${CLIENT_HEADER}": "${identity[CLIENT_HEADER]}",`,
419
+ " },",
409
420
  " },",
410
421
  " },",
411
422
  " },",
@@ -428,23 +439,99 @@ function pointsAtUs(entry, apiBase, apiKey) {
428
439
  const headers = entry.headers;
429
440
  if (headers === void 0) return true;
430
441
  if (!headers || typeof headers !== "object" || Array.isArray(headers)) return false;
431
- const auth = headers.Authorization ?? headers.authorization;
442
+ const auths = headerValues(headers, "Authorization");
443
+ if (auths.length > 1) return false;
444
+ const auth = auths[0];
432
445
  if (auth === void 0) return true;
433
446
  if (typeof auth !== "string") return false;
434
447
  if (auth === AUTH_HEADER_TEMPLATE || auth.includes(`\${${API_KEY_ENV}}`)) return true;
435
448
  return apiKey !== void 0 && apiKey.length > 0 && auth.trim() === `Bearer ${apiKey}`;
436
449
  }
450
+ function describeMcpIdentity(cfg) {
451
+ const entry = agentchatEntry(cfg);
452
+ const headers = entry && isRecord(entry.headers) ? entry.headers : void 0;
453
+ if (!headers) return "missing";
454
+ const want = clientIdentityHeaders();
455
+ const clients = headerValues(headers, CLIENT_HEADER);
456
+ const client = clients[0];
457
+ return clients.length === 1 && typeof client === "string" && client.trim().toLowerCase() === want[CLIENT_HEADER] ? "current" : "missing";
458
+ }
437
459
  function withHostedMcpEntry(cfg, apiBase = DEFAULT_API_BASE2, apiKey) {
438
460
  const state = describeMcpEntry(cfg, apiBase, apiKey);
439
461
  const base = cfg ?? {};
440
- if (state === "ours") return { cfg: base, outcome: "present" };
441
462
  if (state === "user_managed") return { cfg: base, outcome: "user_managed" };
442
463
  if (state === "disabled") return { cfg: base, outcome: "disabled" };
464
+ if (state === "ours" && describeMcpIdentity(base) === "current") return { cfg: base, outcome: "present" };
443
465
  const mcp = { ...base.mcp ?? {} };
444
466
  const servers = { ...mcp.servers ?? {} };
445
- servers[MCP_SERVER_NAME] = hostedMcpServerEntry(apiBase);
467
+ const existing = servers[MCP_SERVER_NAME];
468
+ servers[MCP_SERVER_NAME] = state === "ours" && isRecord(existing) ? upgradedHostedMcpEntry(existing, apiBase) : hostedMcpServerEntry(apiBase);
446
469
  mcp.servers = servers;
447
- return { cfg: { ...base, mcp }, outcome: "added" };
470
+ return { cfg: { ...base, mcp }, outcome: state === "ours" ? "updated" : "added" };
471
+ }
472
+ function upgradedHostedMcpEntry(entry, apiBase = DEFAULT_API_BASE2) {
473
+ const headers = isRecord(entry.headers) ? entry.headers : {};
474
+ const kept = Object.fromEntries(Object.entries(headers).filter(([name]) => name.toLowerCase() !== CLIENT_HEADER.toLowerCase()));
475
+ return {
476
+ ...entry,
477
+ url: hostedMcpUrl(apiBase),
478
+ transport: "streamable-http",
479
+ headers: { ...kept, ...clientIdentityHeaders() }
480
+ };
481
+ }
482
+ function upgradeHostedMcpEntryInPlace(draft, apiBase = DEFAULT_API_BASE2, apiKey) {
483
+ if (describeMcpEntry(draft, apiBase, apiKey) !== "ours" || describeMcpIdentity(draft) === "current") return false;
484
+ const servers = draft.mcp.servers;
485
+ const existing = servers[MCP_SERVER_NAME];
486
+ if (!isRecord(existing)) return false;
487
+ servers[MCP_SERVER_NAME] = upgradedHostedMcpEntry(existing, apiBase);
488
+ return true;
489
+ }
490
+ var NoChange = class extends Error {
491
+ constructor(outcome) {
492
+ super(`no change (${outcome})`);
493
+ this.outcome = outcome;
494
+ }
495
+ outcome;
496
+ };
497
+ var NIX_MODE_ERROR_CODE = "OPENCLAW_NIX_MODE_CONFIG_IMMUTABLE";
498
+ async function refreshHostedMcpEntry(params) {
499
+ const apiBase = params.apiBase ?? DEFAULT_API_BASE2;
500
+ if (describeMcpEntry(params.liveCfg, apiBase, params.apiKey) !== "ours") return { outcome: "not_ours" };
501
+ if (describeMcpIdentity(params.liveCfg) === "current") return { outcome: "current" };
502
+ const mutate = params.config?.mutateConfigFile;
503
+ if (typeof mutate !== "function") return { outcome: "unsupported" };
504
+ try {
505
+ await mutate.call(params.config, {
506
+ afterWrite: { mode: "auto" },
507
+ mutate: ((draft) => {
508
+ if (describeMcpEntry(draft, apiBase, params.apiKey) !== "ours") throw new NoChange("not_ours");
509
+ if (!upgradeHostedMcpEntryInPlace(draft, apiBase, params.apiKey)) throw new NoChange("current");
510
+ })
511
+ });
512
+ return { outcome: "updated" };
513
+ } catch (err) {
514
+ if (err instanceof NoChange) return { outcome: err.outcome };
515
+ const code = err?.code;
516
+ return {
517
+ outcome: "failed",
518
+ error: err instanceof Error ? err.message : String(err),
519
+ ...typeof code === "string" ? { code } : {}
520
+ };
521
+ }
522
+ }
523
+ function isRecord(value) {
524
+ return value !== null && typeof value === "object" && !Array.isArray(value);
525
+ }
526
+ function agentchatEntry(cfg) {
527
+ const servers = cfg?.mcp?.servers;
528
+ if (!isRecord(servers)) return void 0;
529
+ const entry = servers[MCP_SERVER_NAME];
530
+ return isRecord(entry) ? entry : void 0;
531
+ }
532
+ function headerValues(headers, name) {
533
+ const wanted = name.toLowerCase();
534
+ return Object.entries(headers).filter(([key]) => key.toLowerCase() === wanted).map(([, value]) => value);
448
535
  }
449
536
  function withoutHostedMcpEntry(cfg, apiBase = DEFAULT_API_BASE2, apiKey) {
450
537
  if (describeMcpEntry(cfg, apiBase, apiKey) !== "ours") return { cfg, removed: false };
@@ -867,6 +954,7 @@ function applyIntegrationConfig(cfg, params) {
867
954
  const mcp = withHostedMcpEntry(next, params.apiBase, params.apiKey);
868
955
  next = mcp.cfg;
869
956
  if (mcp.outcome === "added") changes.push(`mcp.servers.agentchat \u2192 ${hostedMcpUrl(params.apiBase)} (bearer template on ${API_KEY_ENV})`);
957
+ if (mcp.outcome === "updated") changes.push(`mcp.servers.agentchat names this client (${clientIdentityText()})`);
870
958
  const bound = resolveBoundAgentId(next, AGENTCHAT_CHANNEL_ID, params.accountId);
871
959
  const ambient = resolveOpenClawDefaultAgentId(next);
872
960
  if (bound && bound !== (ambient ?? bound)) {
@@ -971,6 +1059,8 @@ function describeMcpOutcome(outcome, apiBase) {
971
1059
  switch (outcome) {
972
1060
  case "added":
973
1061
  return { name: "mcp", status: "changed", detail: `hosted tools registered as mcp.servers.agentchat \u2192 ${hostedMcpUrl(apiBase)} (bearer template on ${API_KEY_ENV})` };
1062
+ case "updated":
1063
+ return { name: "mcp", status: "changed", detail: `mcp.servers.agentchat now names this client to the hosted tools (${clientIdentityText()})` };
974
1064
  case "present":
975
1065
  return { name: "mcp", status: "ok", detail: "hosted tools already registered as mcp.servers.agentchat" };
976
1066
  case "disabled":
@@ -1012,14 +1102,39 @@ function checkPlacement(params) {
1012
1102
  checks.push({ name: "anchor", ok: false, detail: `agentHandle not in config \u2014 the identity line cannot be checked; ${remedy("run openclaw doctor --fix (it learns the handle from the key)")}` });
1013
1103
  }
1014
1104
  checks.push({ name: "manual", ok: true, detail: "manual bundled as the agentchat skill" });
1015
- const mcpState = describeMcpEntry(params.cfg, params.apiBase, params.apiKey);
1016
- checks.push({
1017
- name: "mcp",
1018
- ok: mcpState === "ours" || mcpState === "user_managed",
1019
- detail: mcpState === "ours" ? "hosted tools registered as mcp.servers.agentchat" : mcpState === "user_managed" ? "mcp.servers.agentchat is managed by hand" : mcpState === "disabled" ? "mcp.servers.agentchat is disabled \u2014 the agent has no AgentChat tools" : `mcp.servers.agentchat missing \u2014 ${remedy("run openclaw doctor --fix (or openclaw channels add agentchat)")}`
1020
- });
1105
+ checks.push(checkMcpEntry(params.cfg, params.apiBase, params.apiKey, remedy));
1021
1106
  return checks;
1022
1107
  }
1108
+ function checkMcpEntry(cfg, apiBase, apiKey, remedy) {
1109
+ const unknownClient = "AgentChat treats the agent as an unknown client and lists the webhook-setup tools it does not need";
1110
+ switch (describeMcpEntry(cfg, apiBase, apiKey)) {
1111
+ case "ours": {
1112
+ const identity = describeMcpIdentity(cfg);
1113
+ if (identity === "current") return { name: "mcp", ok: true, detail: "hosted tools registered as mcp.servers.agentchat" };
1114
+ return {
1115
+ name: "mcp",
1116
+ ok: true,
1117
+ notice: true,
1118
+ repair: true,
1119
+ detail: `hosted tools registered as mcp.servers.agentchat, without ${CLIENT_HEADER} \u2014 ${unknownClient}; the gateway adds ${clientIdentityText()} to the entry when it starts (its log says if it could not), and openclaw doctor --fix does now`
1120
+ };
1121
+ }
1122
+ case "user_managed": {
1123
+ if (describeMcpIdentity(cfg) === "current") return { name: "mcp", ok: true, detail: "mcp.servers.agentchat is managed by hand" };
1124
+ const identity = clientIdentityHeaders();
1125
+ return {
1126
+ name: "mcp",
1127
+ ok: true,
1128
+ notice: true,
1129
+ detail: `mcp.servers.agentchat is managed by hand and does not name this client, so ${unknownClient} \u2014 add "${CLIENT_HEADER}": "${identity[CLIENT_HEADER]}" to its headers`
1130
+ };
1131
+ }
1132
+ case "disabled":
1133
+ return { name: "mcp", ok: false, detail: "mcp.servers.agentchat is disabled \u2014 the agent has no AgentChat tools" };
1134
+ case "missing":
1135
+ return { name: "mcp", ok: false, repair: true, detail: `mcp.servers.agentchat missing \u2014 ${remedy("run openclaw doctor --fix (or openclaw channels add agentchat)")}` };
1136
+ }
1137
+ }
1023
1138
  function describe2(err) {
1024
1139
  return err instanceof Error ? err.message : String(err);
1025
1140
  }
@@ -1723,7 +1838,7 @@ var agentchatSetupWizard = {
1723
1838
  {
1724
1839
  value: "paste",
1725
1840
  label: "I already have an API key",
1726
- hint: "paste ac_live_\u2026 on the next prompt"
1841
+ hint: "paste ac_\u2026 on the next prompt"
1727
1842
  },
1728
1843
  {
1729
1844
  value: "recover",
@@ -1794,10 +1909,10 @@ var agentchatSetupWizard = {
1794
1909
  preferredEnvVar: "AGENTCHAT_API_KEY",
1795
1910
  envPrompt: "AGENTCHAT_API_KEY detected in env. Use it?",
1796
1911
  keepPrompt: "AgentChat API key already configured. Keep it?",
1797
- inputPrompt: "Paste your AgentChat API key (ac_live_\u2026)",
1912
+ inputPrompt: "Paste your AgentChat API key (ac_\u2026)",
1798
1913
  helpTitle: "AgentChat API key",
1799
1914
  helpLines: [
1800
- "Format: ac_live_<base64>, \u226520 chars. Validated against",
1915
+ "Format: ac_ followed by 43 base64url characters. Validated against",
1801
1916
  "GET /v1/agents/me during this wizard \u2014 bad keys fail fast instead",
1802
1917
  "of flapping reconnects at runtime."
1803
1918
  ],
@@ -3194,6 +3309,32 @@ async function waitUntilAbort(signal, onAbort) {
3194
3309
  }
3195
3310
  await onAbort();
3196
3311
  }
3312
+ var mcpUpdateWarned = /* @__PURE__ */ new Set();
3313
+ async function updateHostedMcpEntry(ctx, apiBase, apiKey, runtime = getPluginRuntime) {
3314
+ const prefix = `[agentchat:${ctx.accountId}]`;
3315
+ const warnOnce = (line) => {
3316
+ if (mcpUpdateWarned.has(ctx.accountId)) return;
3317
+ mcpUpdateWarned.add(ctx.accountId);
3318
+ ctx.log?.warn?.(`${prefix} ${line}`);
3319
+ };
3320
+ try {
3321
+ const { cfg: liveCfg } = readLiveConfig(ctx.cfg, runtime);
3322
+ const config = runtime()?.config;
3323
+ const result = await refreshHostedMcpEntry({ liveCfg, config, apiBase, apiKey });
3324
+ if (result.outcome === "updated") {
3325
+ mcpUpdateWarned.delete(ctx.accountId);
3326
+ ctx.log?.info?.(`${prefix} mcp.servers.agentchat now names this client to the hosted tools (${clientIdentityText()}); under the default reload mode OpenClaw applies it without a restart`);
3327
+ } else if (result.outcome === "unsupported") {
3328
+ warnOnce(`mcp.servers.agentchat does not name this client (${clientIdentityText()}) and this OpenClaw cannot update its config from a plugin \u2014 run \`openclaw doctor --fix\``);
3329
+ } else if (result.outcome === "failed") {
3330
+ warnOnce(
3331
+ result.code === NIX_MODE_ERROR_CODE ? `mcp.servers.agentchat does not name this client and OpenClaw's config is read-only here (Nix mode) \u2014 add ${clientIdentityText()} to its headers in the Nix-managed config` : `mcp.servers.agentchat could not be updated to name this client (${result.error ?? "unknown error"}) \u2014 run \`openclaw doctor --fix\``
3332
+ );
3333
+ }
3334
+ } catch (err) {
3335
+ warnOnce(`mcp.servers.agentchat check failed: ${err instanceof Error ? err.message : String(err)}`);
3336
+ }
3337
+ }
3197
3338
  var agentchatGatewayAdapter = {
3198
3339
  async startAccount(ctx) {
3199
3340
  const account = ctx.account;
@@ -3208,6 +3349,7 @@ var agentchatGatewayAdapter = {
3208
3349
  const config = account.config;
3209
3350
  const logger = adaptLog(ctx.log) ?? createLogger({ level: config.observability.logLevel, redactKeys: config.observability.redactKeys });
3210
3351
  ctx.setStatus(withLifecycle({ ...ctx.getStatus(), running: true, connected: false }, "starting"));
3352
+ void updateHostedMcpEntry(ctx, config.apiBase, config.apiKey);
3211
3353
  const wakeMode = readWakeModeFromEnv();
3212
3354
  if (wakeMode.mode === "off") {
3213
3355
  ctx.log?.info?.(
@@ -3491,7 +3633,7 @@ var agentchatStatusAdapter = {
3491
3633
  }
3492
3634
  if (probe.mcp) lines.push({ text: probe.mcp.detail, tone: probe.mcp.ok ? "success" : "error" });
3493
3635
  for (const check of probe.placement ?? []) {
3494
- lines.push({ text: `${check.name}: ${check.detail}`, tone: check.ok ? "muted" : "warn" });
3636
+ lines.push({ text: `${check.name}: ${check.detail}`, tone: check.ok && !check.notice ? "muted" : "warn" });
3495
3637
  }
3496
3638
  if (probe.refusal) lines.push({ text: `integration not started \u2014 ${probe.refusal}`, tone: "error" });
3497
3639
  if (probe.integration) {
@@ -3541,8 +3683,8 @@ var agentchatDoctorAdapter = {
3541
3683
  const handle = readAgentchatConfigField(cfg, accountId, "agentHandle");
3542
3684
  const agentId = resolvePlacementAgentId(cfg, accountId);
3543
3685
  for (const check of checkPlacement({ cfg, handle, apiKey, apiBase, identityLine: cachedIdentityLine(accountId), agentId, accountId, env })) {
3544
- if (check.ok) continue;
3545
- const fix = check.name === "mcp" ? ` (${doctorFixCommand} adds it)` : "";
3686
+ if (check.ok && !check.notice) continue;
3687
+ const fix = check.name === "mcp" && check.repair && !check.ok ? ` (${doctorFixCommand} adds it)` : "";
3546
3688
  warnings.push(`[${AGENTCHAT_CHANNEL_ID}:${accountId}] ${check.name}: ${check.detail}${fix}`);
3547
3689
  }
3548
3690
  const bound = resolveBoundAgentId(cfg, AGENTCHAT_CHANNEL_ID, accountId);
@@ -3611,6 +3753,7 @@ var agentchatDoctorAdapter = {
3611
3753
  const result = withHostedMcpEntry(next, apiBase, apiKey);
3612
3754
  next = result.cfg;
3613
3755
  if (result.outcome === "added") changes.push(`added mcp.servers.agentchat \u2192 ${apiBase}/mcp (bearer template on AGENTCHAT_API_KEY)`);
3756
+ if (result.outcome === "updated") changes.push(`updated mcp.servers.agentchat to name this client (${clientIdentityText()})`);
3614
3757
  }
3615
3758
  return { config: next, changes, ...warnings.length > 0 ? { warnings } : {} };
3616
3759
  }
@@ -3637,9 +3780,9 @@ function resolveAgentchatAccount(cfg, accountId) {
3637
3780
  var uiHints = {
3638
3781
  apiKey: {
3639
3782
  label: "AgentChat API key",
3640
- placeholder: "ac_live_...",
3783
+ placeholder: "ac_\u2026",
3641
3784
  sensitive: true,
3642
- help: "The setup wizard registers you via email OTP and mints a key, recovers a lost key (handle + email OTP), or accepts an existing ac_live_\u2026 key."
3785
+ help: "The setup wizard registers you via email OTP and mints a key, recovers a lost key (handle + email OTP), or accepts an existing ac_\u2026 key."
3643
3786
  },
3644
3787
  apiBase: {
3645
3788
  label: "API base URL",
@@ -3850,8 +3993,14 @@ var agentchatPlugin = {
3850
3993
  threads: false,
3851
3994
  nativeCommands: false
3852
3995
  },
3996
+ // OpenClaw matches a reload prefix as `path === prefix` or `path` starting
3997
+ // with `prefix.` (src/gateway/config-reload-plan.ts), so the prefix carries
3998
+ // no trailing dot: `channels.agentchat.` matched nothing, and every
3999
+ // channels.agentchat change restarted the gateway (2026.6.x–2026.8.x) or
4000
+ // reloaded the plugin (2026.11.x). With this one OpenClaw restarts just the
4001
+ // channel, after a running turn has ended.
3853
4002
  reload: {
3854
- configPrefixes: [`channels.${AGENTCHAT_CHANNEL_ID}.`]
4003
+ configPrefixes: [`channels.${AGENTCHAT_CHANNEL_ID}`]
3855
4004
  },
3856
4005
  configSchema: buildChannelConfigSchema(agentchatChannelConfigSchema, { uiHints }),
3857
4006
  setupWizard: agentchatSetupWizard,