@agentchatme/openclaw 0.8.0 → 0.9.0

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +32 -1
  2. package/README.md +72 -70
  3. package/RUNBOOK.md +54 -41
  4. package/SECURITY.md +8 -5
  5. package/dist/binding/agents-anchor.cjs +24 -20
  6. package/dist/binding/agents-anchor.cjs.map +1 -1
  7. package/dist/binding/agents-anchor.d.cts +38 -31
  8. package/dist/binding/agents-anchor.d.ts +38 -31
  9. package/dist/binding/agents-anchor.js +24 -18
  10. package/dist/binding/agents-anchor.js.map +1 -1
  11. package/dist/credentials/read-env.cjs +16 -7
  12. package/dist/credentials/read-env.cjs.map +1 -1
  13. package/dist/credentials/read-env.d.cts +26 -10
  14. package/dist/credentials/read-env.d.ts +26 -10
  15. package/dist/credentials/read-env.js +12 -6
  16. package/dist/credentials/read-env.js.map +1 -1
  17. package/dist/index.cjs +978 -1421
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +155 -721
  20. package/dist/index.d.ts +155 -721
  21. package/dist/index.js +969 -1415
  22. package/dist/index.js.map +1 -1
  23. package/dist/openclaw-layout.cjs.map +1 -1
  24. package/dist/openclaw-layout.d.cts +1 -1
  25. package/dist/openclaw-layout.d.ts +1 -1
  26. package/dist/openclaw-layout.js.map +1 -1
  27. package/dist/setup-entry-Dq5Dwg8O.d.cts +655 -0
  28. package/dist/setup-entry-Dq5Dwg8O.d.ts +655 -0
  29. package/dist/setup-entry.cjs +967 -1427
  30. package/dist/setup-entry.cjs.map +1 -1
  31. package/dist/setup-entry.d.cts +2 -1
  32. package/dist/setup-entry.d.ts +2 -1
  33. package/dist/setup-entry.js +968 -1428
  34. package/dist/setup-entry.js.map +1 -1
  35. package/openclaw.plugin.json +6 -12
  36. package/package.json +6 -6
  37. package/skills/agentchat/SKILL.md +132 -78
  38. package/dist/setup-entry-DU51IFUF.d.cts +0 -154
  39. package/dist/setup-entry-DU51IFUF.d.ts +0 -154
package/dist/index.d.cts CHANGED
@@ -1,700 +1,107 @@
1
- import { A as AgentchatChannelConfig } from './setup-entry-DU51IFUF.cjs';
2
- export { a as AgentchatResolvedAccount, b as agentchatChannelEntry, c as agentchatPlugin, d as agentchatSetupEntry, c as agentchatSetupPlugin, b as default, p as parseChannelConfig } from './setup-entry-DU51IFUF.cjs';
1
+ import { L as Logger } from './setup-entry-Dq5Dwg8O.cjs';
2
+ export { A as AgentInvoker, a as AgentInvokerOptions, b as AgentchatChannelConfig, c as AgentchatResolvedAccount, C as CycleOutcome, d as CycleResult, G as GroupInvite, I as IntegrationSocket, e as IntegrationSocketOptions, f as InviteLedger, S as SocketBlocked, g as SocketDisconnect, h as SocketHandlers, i as SocketHealth, j as SocketState, W as WakeSource, k as agentchatChannelEntry, l as agentchatPlugin, m as agentchatSetupEntry, l as agentchatSetupPlugin, k as default, n as groupInviteFromRecord, p as parseChannelConfig, r as realtimeOptionsFor } from './setup-entry-Dq5Dwg8O.cjs';
3
3
  export { hasAgentChatConfiguredState } from './configured-state.cjs';
4
- import { WebSocket } from 'ws';
4
+ import { AgentChatClient, Texts, ToolNamer } from 'agentchatme';
5
5
  import 'openclaw/plugin-sdk/channel-core';
6
6
  import 'zod';
7
7
 
8
- interface Logger {
9
- trace(obj: object, msg?: string): void;
10
- debug(obj: object, msg?: string): void;
11
- info(obj: object, msg?: string): void;
12
- warn(obj: object, msg?: string): void;
13
- error(obj: object, msg?: string): void;
14
- child(bindings: Record<string, unknown>): Logger;
15
- }
16
-
17
8
  /**
18
- * Optional Prometheus metrics for the channel plugin.
19
- *
20
- * Design: the gateway owns the `/metrics` endpoint. Plugins do not expose
21
- * their own port. If the user passes a `prom-client` Registry, we register
22
- * our counters/gauges into it. Otherwise, we return a no-op recorder — zero
23
- * overhead, zero config.
24
- *
25
- * Names are prefixed with `agentchat_channel_` for easy scraping. The
26
- * doorbell sends nothing, so there are no outbound metrics: what it reports
27
- * is the socket's state and its knocks.
9
+ * The served texts: fetched from AgentChat, never bundled.
10
+ *
11
+ * Every text an agent sees is written once, in AgentChat's experience layer,
12
+ * and served as data (`GET /v1/texts?runtime=openclaw`): the wake
13
+ * instruction a turn starts with, the invite prompt, the identity line that
14
+ * goes into the workspace `AGENTS.md`, and where the manual is. This module
15
+ * fetches them at channel start and every 24 hours, keeps the last copy in
16
+ * the plugin's state dir, and hands them out spelled for OpenClaw (the hosted
17
+ * tools as `agentchat__<tool>`, see `./turn.ts`).
18
+ *
19
+ * When the server is unreachable at start the last cached copy is used; with
20
+ * nothing cached the channel still starts (the socket connects, the gate can
21
+ * run) and logs once — turns wait for the first successful fetch, which is
22
+ * retried every few minutes until it lands.
28
23
  */
29
- interface MetricsRecorder {
30
- /** Incremented on every reconnect attempt. */
31
- incReconnect(labels: {
32
- reason: string;
33
- }): void;
34
- /** Incremented on every transport/channel error, labeled by error class. */
35
- incError(labels: {
36
- errorClass: string;
37
- }): void;
38
- /** Set the current connection state (cardinality bounded by state kinds). */
39
- setConnectionState(kind: string): void;
40
- /** Incremented on every knock handed to the invoker. */
41
- incKnock(labels: {
42
- source: string;
43
- }): void;
44
- }
45
24
 
46
- /**
47
- * Error taxonomy for the AgentChat channel plugin.
48
- *
49
- * Every error that crosses a pipeline boundary (inbound receive, outbound
50
- * send, config validation, transport) must be classifiable as one of:
51
- *
52
- * terminal-auth — 401/403. API key invalid or revoked. Do not retry.
53
- * Move state machine to AUTH_FAIL.
54
- * terminal-user — 400/422 (client-side validation). Bug in this plugin
55
- * or malformed outbound. Log at error level, drop,
56
- * do not retry.
57
- * retry-rate — 429. Retry after `retryAfterMs` (or jittered
58
- * exponential backoff if header absent).
59
- * retry-transient — 5xx, ECONNRESET, ETIMEDOUT, network flap.
60
- * Exponential backoff + jitter. Open circuit after N.
61
- * idempotent-replay — 409 on POST /v1/messages with duplicate
62
- * client_msg_id. Treat as success, log at info.
63
- * validation — Zod schema failed on inbound payload. Likely a
64
- * server change. Log at error, drop, alert.
65
- */
66
- type ErrorClass = 'terminal-auth' | 'terminal-user' | 'retry-rate' | 'retry-transient' | 'idempotent-replay' | 'validation';
67
- declare class AgentChatChannelError extends Error {
68
- readonly class_: ErrorClass;
69
- readonly retryAfterMs: number | undefined;
70
- readonly statusCode: number | undefined;
71
- constructor(class_: ErrorClass, message: string, options?: {
72
- cause?: unknown;
73
- retryAfterMs?: number;
74
- statusCode?: number;
75
- });
76
- }
77
-
78
- /**
79
- * Internal shared types for @agentchatme/openclaw.
80
- *
81
- * Kept intentionally small. Anything externally visible is exported from
82
- * `./index.ts` or `./setup-entry.ts`. Types with a public SDK shape (channel
83
- * plugin, setup plugin) live next to their respective entry files.
84
- */
85
- type UnixMillis = number;
86
-
87
- /**
88
- * Connection state machine for the AgentChat WebSocket.
89
- *
90
- * Pure functions only — no I/O, no timers. The runtime (P2) owns the socket
91
- * and drives transitions by emitting events.
92
- *
93
- * States:
94
- * DISCONNECTED — initial, and after a clean close
95
- * CONNECTING — TCP/TLS handshake + WS upgrade in flight
96
- * AUTHENTICATING — socket open, waiting for `hello.ok` from server
97
- * READY — authenticated, receiving + sending normally
98
- * DEGRADED — heartbeat missed or send buffer full; still connected but impaired
99
- * DRAINING — SIGTERM received; flush in-flight sends, then close
100
- * CLOSED — terminal after clean shutdown
101
- * AUTH_FAIL — terminal after 401/403; operator action required (rotate key)
102
- *
103
- * Invariants:
104
- * - From AUTH_FAIL, no event can move us back to CONNECTING without
105
- * an explicit RECONFIGURED event (operator rotated key).
106
- * - From CLOSED, only SHUTDOWN is a no-op; anything else is a bug.
107
- * - DRAINING has a deadline (ms timestamp) after which we force-close.
108
- */
109
-
110
- type ConnectionState = {
111
- readonly kind: 'DISCONNECTED';
112
- } | {
113
- readonly kind: 'CONNECTING';
114
- readonly attempt: number;
115
- readonly startedAt: UnixMillis;
116
- } | {
117
- readonly kind: 'AUTHENTICATING';
118
- readonly startedAt: UnixMillis;
119
- } | {
120
- readonly kind: 'READY';
121
- readonly connectedAt: UnixMillis;
122
- } | {
123
- readonly kind: 'DEGRADED';
124
- readonly since: UnixMillis;
125
- readonly reason: string;
126
- } | {
127
- readonly kind: 'DRAINING';
128
- readonly since: UnixMillis;
129
- readonly deadline: UnixMillis;
130
- } | {
131
- readonly kind: 'CLOSED';
132
- } | {
133
- readonly kind: 'AUTH_FAIL';
134
- readonly reason: string;
135
- };
136
-
137
- /**
138
- * AgentChat WebSocket client — state-machine-driven, production-grade.
139
- *
140
- * Responsibilities:
141
- * - Own the WS transport and HELLO handshake lifecycle.
142
- * - Drive the connection state machine (`./state-machine.ts`) by emitting
143
- * events in response to socket/auth/heartbeat transitions.
144
- * - Maintain native WS PING/PONG heartbeat at `ping.intervalMs`; declare
145
- * DEGRADED on `ping.timeoutMs` miss, then force-reconnect.
146
- * - Schedule reconnect with exponential backoff + ±`jitterRatio` jitter
147
- * per `reconnect.*` config. Thundering-herd-safe across a fleet.
148
- * - Emit typed events upwards (`inboundFrame`, `stateChanged`, `error`,
149
- * `authenticated`) so the runtime can turn frames into knocks.
150
- *
151
- * Intentional design choices:
152
- * - Uses the `ws` package directly (not `globalThis.WebSocket`) because
153
- * OpenClaw runs on Node — `ws` exposes `.ping()` / `.pong()` / event
154
- * hooks that native WebSocket omits. Every major agent-hosting target
155
- * (Fly, Render, Vercel functions, Lambda) is Node.
156
- * - Authenticates via HELLO frame (`{type: "hello", api_key}`), never via
157
- * URL query string. Keeps the key out of access logs and Referers.
158
- * - Advertises the `ack` capability in HELLO and NEVER acknowledges. With
159
- * the capability negotiated the server keeps every envelope `stored`
160
- * until an ack arrives (WS Delivery-Ack Protocol v1); none ever does
161
- * from here — a verdict recorded by the gate, or a send by the agent,
162
- * is what settles delivery. There is no code path in this module that
163
- * can emit a frame other than HELLO: delivery is judged, never
164
- * confirmed by the transport.
165
- * - `RECONNECT_HARD_CAP_ATTEMPTS` guards against runaway reconnect loops
166
- * after catastrophic network events; crosses into `AUTH_FAIL` so the
167
- * operator sees a clear signal instead of silent retry forever.
168
- * - Frame parsing is defensive: malformed JSON, unknown `type`, missing
169
- * payload — all classified as `validation` errors (non-terminal for
170
- * the connection, but dropped with a metric + log).
171
- * - No message-layer ordering here. Per-conversation seq ordering + gap
172
- * recovery belong to the SDK's `RealtimeClient` and the drain layer
173
- * (P3 consumers). This module is strictly the transport.
174
- */
175
-
176
- /** One parsed inbound server frame. */
177
- interface InboundFrame {
178
- readonly type: string;
179
- readonly payload: Record<string, unknown>;
180
- readonly receivedAt: UnixMillis;
181
- readonly raw: unknown;
182
- }
183
- interface WsClientEvents {
184
- stateChanged: (next: ConnectionState, prev: ConnectionState) => void;
185
- inboundFrame: (frame: InboundFrame) => void;
186
- error: (error: AgentChatChannelError) => void;
187
- /** Fired once per `hello.ok` — the runtime turns it into the connect knock. */
188
- authenticated: (at: UnixMillis) => void;
189
- /** Fired after a clean close + CLOSED state (after stop() or terminal auth failure). */
190
- closed: () => void;
191
- }
192
- interface WsClientOptions {
193
- readonly config: AgentchatChannelConfig;
194
- readonly logger: Logger;
195
- readonly metrics: MetricsRecorder;
196
- /** Clock source — override in tests. Default: `Date.now`. */
197
- readonly now?: () => UnixMillis;
198
- /** WebSocket constructor override — tests pass a mock. Default: `ws`. */
199
- readonly webSocketCtor?: typeof WebSocket;
200
- /** Random source for jitter — override in tests. Default: `Math.random`. */
201
- readonly random?: () => number;
202
- /** timer.setTimeout override for tests. */
203
- readonly setTimeout?: (fn: () => void, ms: number) => NodeJS.Timeout;
204
- readonly clearTimeout?: (h: NodeJS.Timeout) => void;
205
- readonly setInterval?: (fn: () => void, ms: number) => NodeJS.Timeout;
206
- readonly clearInterval?: (h: NodeJS.Timeout) => void;
207
- }
208
- type Listener<E extends keyof WsClientEvents> = WsClientEvents[E];
209
- /**
210
- * AgentChat channel WebSocket client.
211
- *
212
- * Lifecycle:
213
- * 1. `start()` — DISCONNECTED → CONNECTING. Transport opens, HELLO is sent.
214
- * 2. `hello.ok` → READY. Heartbeat timer starts. Upstream consumers begin.
215
- * 3. On socket drop → DISCONNECTED → CONNECTING (with backoff).
216
- * 4. `stop(deadlineMs)` → DRAINING. Wait for in-flight drains, then CLOSED.
217
- *
218
- * Thread-safety: this class is single-threaded. All callbacks fire on the
219
- * Node event loop; callers should never invoke public methods from timer
220
- * callbacks without being aware of reentrancy (e.g., a `stateChanged`
221
- * listener that calls `send()` is fine, but `start()` inside `closed()`
222
- * will re-enter the lifecycle — usually a bug).
223
- */
224
- declare class AgentchatWsClient {
225
- private readonly config;
226
- private readonly logger;
227
- private readonly metrics;
228
- private readonly now;
229
- private readonly WebSocketCtor;
230
- private readonly random;
231
- private readonly _setTimeout;
232
- private readonly _clearTimeout;
233
- private readonly _setInterval;
234
- private readonly _clearInterval;
235
- private state;
236
- private ws;
237
- private attempt;
238
- private _ackNegotiated;
239
- private helloAckTimer;
240
- private pingTimer;
241
- private pongTimer;
242
- private reconnectTimer;
243
- private drainTimer;
244
- private readonly listeners;
245
- constructor(options: WsClientOptions);
246
- /** Current connection state. Read-only from the caller's perspective. */
247
- getState(): ConnectionState;
248
- /**
249
- * True when the last `hello.ok` echoed the `ack` capability: the server
250
- * keeps envelopes `stored` until acknowledged — and this client never
251
- * acknowledges. False against a legacy server (envelopes marked on push).
252
- */
253
- get ackNegotiated(): boolean;
254
- /**
255
- * Kick off connection. No-op if already connecting, authenticating, or
256
- * ready. Throws on `AUTH_FAIL` — the caller must call `reconfigured()`
257
- * after rotating the API key before retrying.
258
- */
259
- start(): void;
260
- /**
261
- * Request a graceful drain. The caller-supplied deadline is a Unix-ms
262
- * timestamp; after it passes, the socket is force-closed regardless of
263
- * remaining in-flight work. Safe to call from any state.
264
- */
265
- stop(deadline?: UnixMillis): void;
266
- /**
267
- * Signal that operator has rotated the API key. Transitions from
268
- * AUTH_FAIL back to DISCONNECTED; the next `start()` call will attempt
269
- * a fresh HELLO with the current config.
270
- */
271
- reconfigured(): void;
272
- on<E extends keyof WsClientEvents>(event: E, handler: Listener<E>): () => void;
273
- private openSocket;
274
- private bindSocket;
275
- private handleOpen;
276
- private handleMessage;
277
- private extractReason;
278
- private extractPayload;
279
- private handleHelloOk;
280
- private handleAuthRejected;
281
- private handleClose;
282
- private closeSocket;
283
- private startHeartbeat;
284
- private stopHeartbeat;
285
- private sendPing;
286
- private handlePong;
287
- private scheduleReconnect;
288
- private computeReconnectDelay;
289
- private scheduleDrainDeadline;
290
- /**
291
- * Called by upper layers when their pending work has fully drained, to
292
- * let the WS client transition CLOSED earlier than the deadline.
293
- */
294
- drainCompleted(): void;
295
- private applyEvent;
296
- private emit;
297
- private emitError;
298
- }
299
-
300
- /**
301
- * What the doorbell reads from a server frame — and what it does not.
302
- *
303
- * A `message.new` frame means *the tray changed*. The doorbell reads only
304
- * the sender (to skip the echo of its own sends) and the ids (for the log
305
- * line). The body is never looked at: the agent reads it through the hosted
306
- * tools inside its turn. There is no schema for message content here
307
- * because nothing here consumes it.
308
- *
309
- * A `group.invite.received` frame is the second knock kind. Invites are not
310
- * on the tray and are not gated; the doorbell reads the ids and names it
311
- * logs and hands the invite to the invoker, which starts one turn with a
312
- * fixed prompt.
313
- */
314
-
315
- interface MessageKnock {
316
- readonly kind: 'message';
317
- /** Bare, lowercase sender handle (`@` stripped); `''` when the frame carried none. */
318
- readonly sender: string;
319
- readonly messageId: string;
320
- readonly conversationId: string;
321
- }
322
- interface GroupInviteKnock {
323
- readonly kind: 'group-invite';
324
- readonly inviteId: string;
325
- readonly groupId: string;
326
- readonly groupName: string;
327
- readonly inviterHandle: string;
328
- }
329
- type Knock = MessageKnock | GroupInviteKnock;
330
-
331
- /**
332
- * AgentChat channel runtime — the socket as a knock.
333
- *
334
- * One instance per (channelId, accountId). It owns the WebSocket transport
335
- * (`AgentchatWsClient`: HELLO, state machine, heartbeat, reconnect) and turns
336
- * what arrives on it into knocks for the doorbell's invoker:
337
- *
338
- * - `message.new` → `onKnock('message')` — after reading only
339
- * the sender (to skip our own echo) and the
340
- * ids for the log line. The body is never
341
- * looked at; the agent reads it through the
342
- * hosted tools inside its turn.
343
- * - every successful HELLO → `onKnock('connect')` — whatever landed
344
- * while the socket was down is on the tray.
345
- * - `group.invite.received` → `onGroupInvite(invite)` — the second knock
346
- * kind; not on the tray, not gated.
347
- *
348
- * Nothing is parsed into message shapes, nothing is acknowledged, nothing is
349
- * sent: the socket advertises the `ack` capability so the server keeps every
350
- * envelope `stored` until a verdict or a send settles it, and this runtime
351
- * has no code path that could emit an ack frame (`ws-client.ts`). Delivery
352
- * is judged by the agent, never by the transport.
353
- */
354
-
355
- type KnockSource = 'message' | 'connect';
356
- interface ChannelRuntimeHandlers {
357
- /** A knock: the tray may have changed. `source` is for the log line only. */
358
- onKnock?: (source: KnockSource) => void;
359
- /** The second knock kind. */
360
- onGroupInvite?: (invite: GroupInviteKnock) => void;
361
- /** Called on state transitions — surface to the gateway for health/UI. */
362
- onStateChanged?: (next: ConnectionState, prev: ConnectionState) => void;
363
- /** Called once per successful HELLO (initial + every reconnect), before the connect knock. */
364
- onAuthenticated?: (at: UnixMillis) => void;
365
- /** Called on every closed/unreachable situation worth observing. */
366
- onError?: (error: AgentChatChannelError) => void;
367
- }
368
- interface ChannelRuntimeOptions {
369
- readonly config: AgentchatChannelConfig;
370
- readonly handlers?: ChannelRuntimeHandlers;
371
- /** Pre-built logger — if absent, we construct one from `config.observability`. */
372
- readonly logger?: Logger;
373
- /** Pre-built metrics recorder — if absent, uses no-op. */
374
- readonly metrics?: MetricsRecorder;
375
- /** Provided by tests. */
376
- readonly webSocketCtor?: ConstructorParameters<typeof AgentchatWsClient>[0]['webSocketCtor'];
377
- readonly now?: () => UnixMillis;
378
- readonly random?: () => number;
379
- }
380
- interface HealthSnapshot {
381
- readonly state: ConnectionState;
382
- readonly authenticated: boolean;
383
- /** Whether the server echoed the `ack` capability on the last HELLO (envelopes stay `stored` until judged). */
384
- readonly ackNegotiated: boolean;
385
- readonly counters: {
386
- readonly frames: number;
387
- readonly selfFiltered: number;
388
- readonly knocks: number;
389
- readonly invites: number;
390
- };
391
- }
392
- declare class AgentchatChannelRuntime {
393
- private readonly config;
394
- private readonly handlers;
395
- private readonly logger;
396
- private readonly ws;
397
- private readonly selfHandle;
398
- private readonly now;
399
- private started;
400
- private authenticated;
401
- private stopPromise;
402
- private frames;
403
- private selfFiltered;
404
- private knocks;
405
- private invites;
406
- private authenticatedAt;
407
- constructor(opts: ChannelRuntimeOptions);
408
- /** Open the transport. Idempotent — subsequent calls are no-ops. */
409
- start(): void;
410
- /** Graceful shutdown: close the socket (nothing is in flight — the runtime sends nothing). */
411
- stop(deadlineMs?: UnixMillis): Promise<void>;
412
- /** Operator rotated the API key — leave AUTH_FAIL so the next `start()` can retry. */
413
- reconfigured(): void;
414
- getHealth(): HealthSnapshot;
415
- private bindWsEvents;
416
- private dispatchFrame;
417
- private knock;
418
- /** A failing handler never takes the socket down; the next frame knocks again and the tray keeps the cards. */
419
- private guard;
420
- }
421
-
422
- /** The tray, as the server sends it. Only the fields the doorbell reads are typed; the rest passes through. */
423
- interface Tray {
424
- readonly you?: unknown;
425
- readonly question?: unknown;
426
- readonly categories?: unknown;
427
- readonly conversations?: unknown;
428
- readonly deferred?: unknown;
429
- readonly truncated?: unknown;
430
- readonly [key: string]: unknown;
431
- }
432
- type Decision = 'reply' | 'dismiss' | 'defer';
433
- interface RecordDecisionInput {
434
- readonly decision: Decision;
435
- readonly category?: string | undefined;
436
- readonly throughMessageId?: string | undefined;
437
- readonly deferSeconds?: number | undefined;
438
- }
439
- /**
440
- * A main-line call failed: transport error or a non-2xx answer.
441
- * `status` is the HTTP status (`undefined` for transport failures); `code`
442
- * is the server's error code when the body carried one.
443
- */
444
- declare class MainLineError extends Error {
445
- readonly status: number | undefined;
446
- readonly code: string | undefined;
447
- constructor(message: string, options?: {
448
- status?: number;
449
- code?: string;
450
- cause?: unknown;
451
- });
452
- }
453
- interface MainLineClientOptions {
454
- readonly apiKey: string;
455
- readonly apiBase: string;
25
+ type TextsClient = Pick<AgentChatClient, 'texts'>;
26
+ type TextsSourceKind = 'server' | 'cache';
27
+ interface LoadedTexts {
28
+ /** Spelled for OpenClaw. */
29
+ readonly texts: Texts;
30
+ readonly source: TextsSourceKind;
31
+ readonly fetchedAt: string;
32
+ }
33
+ interface LoadTextsParams {
34
+ readonly client: TextsClient;
35
+ readonly accountId: string;
36
+ readonly stateDir?: string | undefined;
37
+ readonly now?: () => number;
38
+ readonly log?: Logger | undefined;
456
39
  readonly timeoutMs?: number;
457
- /** Test seam. Production uses the global `fetch`. */
458
- readonly fetch?: typeof fetch;
459
40
  }
460
- declare class MainLineClient {
461
- private readonly apiKey;
462
- private readonly apiBase;
463
- private readonly timeoutMs;
464
- private readonly fetchImpl;
465
- constructor(options: MainLineClientOptions);
466
- /**
467
- * `GET /v1/inbox` — the briefing cards plus the gate question, returned as
468
- * the server sent them (`you`, `question`, `categories`, `conversations`,
469
- * `deferred`, `truncated`, and any field a newer server adds). Marks
470
- * nothing delivered.
471
- */
472
- inbox(params?: {
473
- waitMs?: number;
474
- limit?: number;
475
- }): Promise<Tray>;
476
- /**
477
- * `POST /v1/conversations/{id}/decisions` — record one verdict. The server
478
- * validates `decision`, `category` and `defer_seconds` against its own
479
- * taxonomy; this client passes them through and raises `MainLineError`
480
- * (`status` 400) when the server rejects a value, so the caller can retry
481
- * with less.
482
- */
483
- recordDecision(conversationId: string, input: RecordDecisionInput): Promise<Record<string, unknown>>;
484
- private request;
485
- }
486
-
487
- /**
488
- * The gate step: the agent's own model answers the server's question about the server's cards.
489
- *
490
- * Code we keep, brain we don't
491
- * ────────────────────────────
492
- * Every word the model reads here comes from the main line: the gate question
493
- * (`tray.question`) and the briefing cards (`tray.conversations`) are passed
494
- * through exactly as `GET /v1/inbox` returned them. This module adds a
495
- * two-line wrapper asking for strict JSON, parses the answer, and records the
496
- * verdicts with `POST /v1/conversations/{id}/decisions`. No wording of its
497
- * own, no category list of its own (categories are offered only when the
498
- * tray carries them), no pace or relationship arithmetic — the server
499
- * computes, the agent's model judges, the doorbell carries.
500
- *
501
- * What gets recorded
502
- * ──────────────────
503
- * `dismiss` and `defer` are posted; a recorded verdict settles delivery for
504
- * what it covers, so the sender's tick is honest and the conversation leaves
505
- * the tray. `reply` is deliberately *not* posted: the send is the reply
506
- * verdict, and posting it would settle the envelopes and take the card off
507
- * the tray before the agent's turn has read it. Cards decided `reply` stay
508
- * on the tray; the turn that follows reads exactly those with the hosted
509
- * `agentchat_inbox` tool. A model that still answers the legacy spelling
510
- * `no_reply` is understood and posted as `dismiss`.
511
- *
512
- * Failure policy
513
- * ──────────────
514
- * Fail closed by default: when the model cannot be reached or answers nothing
515
- * usable, nothing is posted and no turn starts. The envelopes stay `stored`,
516
- * the tray keeps the cards, and the invoker re-knocks on its own ladder. With
517
- * `AGENTCHAT_REPLY_GATE_FAIL_OPEN=1` a failed gate starts the turn anyway and
518
- * the agent judges from the tray inside the turn.
519
- */
520
-
521
- interface Verdict {
522
- readonly conversationId: string;
523
- readonly decision: Decision;
524
- readonly category?: string | undefined;
525
- readonly deferSeconds?: number | undefined;
526
- }
527
- /** Returns the model's raw text. Injectable so tests never reach a provider. */
528
- type GateCaller = (params: {
529
- readonly systemPrompt: string;
530
- readonly userContent: string;
531
- readonly maxTokens: number;
532
- readonly timeoutMs: number;
533
- }) => Promise<string>;
534
- type GateSource = 'llm' | 'empty' | 'fail_closed' | 'fail_open' | 'disabled';
535
- interface GateResult {
536
- /** How the cycle ended; see the module header. */
537
- readonly source: GateSource;
538
- readonly cards: number;
539
- readonly verdicts: readonly Verdict[];
540
- readonly undecided: readonly string[];
541
- readonly replyConversations: readonly string[];
542
- readonly posted: number;
543
- readonly postFailures: number;
544
- readonly truncated: boolean;
545
- readonly latencyMs: number;
546
- readonly failure: string | null;
547
- }
548
-
549
41
  /**
550
- * Where the doorbell meets OpenClaw's agent runtime.
551
- *
552
- * Two things only, both on the `PluginRuntime` OpenClaw hands a channel entry
553
- * through `defineChannelPluginEntry({ setRuntime })`:
554
- *
555
- * 1. **The gate call** — `runtime.llm.complete({ systemPrompt, messages,
556
- * maxTokens, temperature, purpose })` runs one tool-free completion on the
557
- * agent's own configured model and credentials (`LlmCompleteParams`,
558
- * `plugin-sdk/types`; docs.openclaw.ai/plugins/sdk-runtime/models). Without
559
- * an `agentId` OpenClaw uses the ambient default agent; passing one is an
560
- * OVERRIDE that OpenClaw 2026.10.9 rejects with
561
- * `LLM_COMPLETION_NOT_AUTHORIZED` unless the operator set
562
- * `plugins.entries.agentchat.llm.allowAgentIdOverride: true`. The doorbell
563
- * therefore passes `agentId` only when the account is genuinely routed to
564
- * a non-default agent (`agentIdOverride`), and the wizard / doctor write
565
- * the opt-in in that case. The judgement is the agent's; the platform
566
- * computes, it never judges.
567
- *
568
- * 2. **The turn** — `runtime.subagent.run({ sessionKey, message, lane,
569
- * deliver: false })` admits one agent run with the fixed prompt as its
570
- * message and no delivery of its final text (`SubagentRunParams`;
571
- * docs.openclaw.ai/plugins/sdk-runtime/background-work — the same shape
572
- * OpenClaw's own background features use with `deliver: false`). The
573
- * turn's output is never routed anywhere: the agent's only way to say
574
- * something on AgentChat is the hosted `agentchat__agentchat_send_message`
575
- * tool during the turn. `runtime.subagent.waitForRun` bounds how long the
576
- * invoker waits before it may start the next cycle; it never cancels the
577
- * run.
578
- *
579
- * The agent id is resolved the way OpenClaw routes inbound for this channel
580
- * (`channelRuntime.routing.resolveAgentRoute`), so the doorbell wakes the
581
- * agent the operator bound to the account; `main` when nothing is bound.
42
+ * Server first; the cache when the server cannot be reached. A server
43
+ * success refreshes the cache (a cache write failure is logged, never
44
+ * fatal). `null` when neither is available. Never throws.
582
45
  */
583
-
584
- interface TurnRequest {
585
- readonly sessionKey: string;
586
- readonly prompt: string;
587
- readonly lane: string;
588
- }
589
- interface TurnOutcome {
590
- readonly ran: boolean;
591
- readonly runId?: string;
592
- readonly status?: string;
593
- readonly error?: string;
594
- }
595
- /** Starts one agent turn and waits for it (bounded). Injectable so the invoker is testable without OpenClaw. */
596
- type TurnRunner = (request: TurnRequest) => Promise<TurnOutcome>;
597
-
46
+ declare function loadTexts(params: LoadTextsParams): Promise<LoadedTexts | null>;
598
47
  /**
599
- * Knock → gate → turn. The only path from the socket to the agent.
600
- *
601
- * What happens on a knock
602
- * ───────────────────────
603
- * 1. **Coalesce.** Frames inside a short window become one knock
604
- * (`KnockCoalescer`). A group waking up is one cycle, not twenty.
605
- * 2. **Read the tray.** `GET /v1/inbox?wait_ms=0&limit=50` — the server's
606
- * briefing cards and its gate question, as it built them.
607
- * 3. **Gate.** The agent's own model answers the question per card
608
- * (`./gate.ts`); `dismiss` / `defer` verdicts are recorded on the server,
609
- * which settles those conversations. `reply` cards stay on the tray.
610
- * 4. **Turn.** If anything was decided `reply`, start ONE OpenClaw agent turn
611
- * with the fixed prompt (`./turn.ts`). The agent reads and answers through
612
- * the hosted MCP tools; the send is its verdict. The turn's final text is
613
- * discarded — nothing is auto-routed anywhere.
614
- *
615
- * One cycle at a time per account: a knock that lands while a cycle runs is
616
- * remembered and runs once the cycle ends (the tray is re-read, so whatever
617
- * the earlier knock announced is covered). A cycle that could not complete —
618
- * model unreachable, server error, verdicts rejected — re-knocks itself on a
619
- * local ladder (1 m, 5 m, 30 m) because a connected socket gets no re-ring
620
- * from the server; the cards wait on the tray meanwhile. One outage climbs
621
- * the ladder one rung: a retry already on its way is never replaced by a
622
- * later one.
623
- *
624
- * Group invites are a second knock kind: not on the tray, not gated, one turn
625
- * each with the fixed invite prompt, serialized on the same worker.
48
+ * The identity line for the key's own agent, spelled for OpenClaw — for the
49
+ * placement paths that run outside the gateway (wizard, `channels add`,
50
+ * `doctor --fix`, re-enable). Server, then cache; `null` when neither.
626
51
  */
627
-
628
- interface AgentInvokerOptions {
52
+ declare function loadIdentityLine(params: LoadTextsParams): Promise<string | null>;
53
+ interface TextsStoreOptions {
54
+ readonly client: TextsClient;
629
55
  readonly accountId: string;
630
- readonly agentId: string;
631
- readonly mainLine: MainLineClient;
632
- readonly gateCaller: GateCaller;
633
- readonly turnRunner: TurnRunner;
634
56
  readonly logger: Logger;
635
- readonly gateEnabled?: boolean;
636
- readonly gateFailOpen?: boolean;
637
- readonly gateTimeoutMs?: number;
638
- readonly debounceMs?: number;
639
- readonly retryLadderMs?: readonly number[];
57
+ readonly stateDir?: string | undefined;
58
+ readonly refreshMs?: number;
59
+ readonly retryMs?: number;
60
+ readonly fetchTimeoutMs?: number;
640
61
  readonly now?: () => number;
641
62
  readonly setTimeout?: (fn: () => void, ms: number) => NodeJS.Timeout;
642
63
  readonly clearTimeout?: (handle: NodeJS.Timeout) => void;
643
64
  }
644
- interface InvokerCounters {
645
- readonly cycles: number;
646
- readonly turns: number;
647
- readonly inviteTurns: number;
648
- readonly knocks: number;
649
- readonly absorbed: number;
650
- readonly retryRung: number;
651
- }
652
- declare class AgentInvoker {
65
+ /**
66
+ * The texts for one running account: loaded at start, refreshed on a timer,
67
+ * available synchronously to the invoker. `ensure()` is what a cycle calls
68
+ * when it needs them: the current copy, or one load attempt right now.
69
+ */
70
+ declare class TextsStore {
71
+ private readonly client;
653
72
  private readonly accountId;
654
- private readonly agentId;
655
- private readonly mainLine;
656
- private readonly gateCaller;
657
- private readonly turnRunner;
658
73
  private readonly logger;
659
- private readonly gateEnabled;
660
- private readonly gateFailOpen;
661
- private readonly gateTimeoutMs;
662
- private readonly ladder;
74
+ private readonly stateDir;
75
+ private readonly refreshMs;
76
+ private readonly retryMs;
77
+ private readonly fetchTimeoutMs;
663
78
  private readonly now;
664
- private readonly coalescer;
665
- private cycleDue;
666
- private running;
79
+ private readonly _setTimeout;
80
+ private readonly _clearTimeout;
81
+ private loaded;
82
+ private timer;
83
+ private inFlight;
667
84
  private stopped;
668
- private readonly invites;
669
- private readonly seenInvites;
670
- private retryRung;
671
- cycles: number;
672
- turns: number;
673
- inviteTurns: number;
674
- constructor(options: AgentInvokerOptions);
675
- /** A knock from the socket (a frame, a connect) or any other source. Coalesced, then cycled. */
676
- knock(source: string): void;
677
- /**
678
- * The second knock kind. Deduplicated by invite id for the life of the
679
- * process so an invite seen live and again on a connect-time catch-up is
680
- * decided once. Returns true when newly queued.
681
- */
682
- groupInvite(invite: GroupInviteKnock, source: string): boolean;
683
- /** Cancel timers; a cycle in flight finishes on its own. */
85
+ private missingAnnounced;
86
+ private readonly listeners;
87
+ loads: number;
88
+ serverLoads: number;
89
+ constructor(options: TextsStoreOptions);
90
+ /** The texts spelled for OpenClaw, or null until the first copy exists. */
91
+ get current(): Texts | null;
92
+ get source(): TextsSourceKind | null;
93
+ get fetchedAt(): string | null;
94
+ /** Called with every copy that arrives from the server (not with a cached one). */
95
+ onServerCopy(listener: (texts: Texts, source: TextsSourceKind) => void): () => void;
96
+ /** First load (server, then cache), then the timer. Resolves after the first attempt; never throws. */
97
+ start(): Promise<Texts | null>;
98
+ /** The current copy, or one load attempt now (coalesced with any in flight). */
99
+ ensure(): Promise<Texts | null>;
100
+ /** Force a refresh (tests, operators). Coalesced. */
101
+ refresh(): Promise<Texts | null>;
684
102
  stop(): void;
685
- /** The promise of the cycle currently running, for tests and for graceful stops. */
686
- settled(): Promise<void>;
687
- counters(): InvokerCounters;
688
- private onKnockFired;
689
- /** Run the worker if idle. One cycle at a time; work that lands mid-cycle runs afterwards. */
690
- private schedule;
691
- private drain;
692
- /** Read the tray, gate it, start a turn when warranted. Public so tests can drive one cycle. */
693
- runCycle(): Promise<GateResult | null>;
694
- private scheduleRetry;
695
- /** Start the knock turn. Returns whether OpenClaw admitted the run. */
696
- private runKnockTurn;
697
- private runInviteTurn;
103
+ private load;
104
+ private arm;
698
105
  }
699
106
 
700
107
  declare function hostedMcpUrl(apiBase?: string): string;
@@ -756,16 +163,19 @@ declare function probeHostedMcp(params: {
756
163
  declare const AGENTCHAT_CHANNEL_ID: "agentchat";
757
164
  declare const AGENTCHAT_DEFAULT_ACCOUNT_ID = "default";
758
165
 
759
- interface KnockCoalescerOptions {
166
+ interface WakeCoalescerOptions {
760
167
  readonly onFire: () => void;
168
+ /** Called when a delayed (retry-ladder) wake fires, before it is counted like any other wake. */
169
+ readonly onDelayedWake?: () => void;
761
170
  readonly debounceMs?: number;
762
171
  readonly maxWindowMs?: number;
763
172
  readonly now?: () => number;
764
173
  readonly setTimeout?: (fn: () => void, ms: number) => NodeJS.Timeout;
765
174
  readonly clearTimeout?: (handle: NodeJS.Timeout) => void;
766
175
  }
767
- declare class KnockCoalescer {
176
+ declare class WakeCoalescer {
768
177
  private readonly onFire;
178
+ private readonly onDelayedWake;
769
179
  private readonly debounceMs;
770
180
  private readonly maxWindowMs;
771
181
  private readonly now;
@@ -776,76 +186,100 @@ declare class KnockCoalescer {
776
186
  private delayed;
777
187
  private delayedDeadline;
778
188
  private stopped;
779
- knocks: number;
189
+ wakes: number;
780
190
  absorbed: number;
781
191
  fires: number;
782
- constructor(options: KnockCoalescerOptions);
192
+ constructor(options: WakeCoalescerOptions);
783
193
  /** True while a debounce timer is armed. */
784
194
  get armed(): boolean;
785
- /** True while a retry knock is scheduled and has not fired. */
195
+ /** True while a retry wake is scheduled and has not fired. */
786
196
  get delayedPending(): boolean;
787
197
  /**
788
- * A knock. The first one of a burst arms the window; every later one is
198
+ * A wake. The first one of a burst arms the window; every later one is
789
199
  * absorbed and restarts it (trailing edge), never past the burst's cap.
790
200
  */
791
- knock(): void;
792
- /** A delayed knock (retry ladder). The sooner pending deadline is kept. */
793
- knockAfter(delayMs: number): void;
794
- /** Cancel everything; later knocks are ignored. */
201
+ wake(): void;
202
+ /** A delayed wake (retry ladder). The sooner pending deadline is kept. */
203
+ wakeAfter(delayMs: number): void;
204
+ /** Cancel everything; later wakes are ignored. */
795
205
  stop(): void;
796
206
  private fire;
797
207
  }
798
208
 
799
209
  /**
800
- * The turn prompts and the names OpenClaw gives the hosted tools.
210
+ * Turns: the names OpenClaw gives the hosted tools, the prompts a turn starts
211
+ * with, and the session keys and lane the turns run on.
801
212
  *
802
- * The doorbell starts an agent turn with the main line's own wake
803
- * instruction — the same three sentences the server sends every webhook
804
- * doorbell — followed by the conversation ids the gate step decided to
805
- * answer. What the agent then reads, decides and sends goes through the
806
- * hosted MCP tools (`https://api.agentchat.me/mcp`), registered as the MCP
807
- * server `agentchat` (see `./mcp.ts`).
213
+ * No product text lives here. The wake instruction and the invite prompt are
214
+ * served by AgentChat (`GET /v1/texts`, fetched by `./texts.ts`) and placed
215
+ * by this module; the one line of our own states a fact (which conversation
216
+ * the gate decided to answer), never judgement.
808
217
  *
809
- * OpenClaw exposes an MCP server's tools to the model as
810
- * `<server>__<tool>`: the tool-policy pipeline builds the namespace prefix
811
- * as `normalizeToolName(sanitizeServerName(serverName) + "__")`
218
+ * OpenClaw exposes an MCP server's tools to the model as `<server>__<tool>`:
219
+ * the tool-policy pipeline builds the namespace prefix as
220
+ * `normalizeToolName(sanitizeServerName(serverName) + "__")`
812
221
  * (`openclaw/dist/tool-policy-*.js`, 2026.6.10) and the docs describe the
813
- * same `<server>__<tool>` shape (docs.openclaw.ai/tools/mcp). Our server
814
- * name is already provider-safe (`[a-z]`), so the hosted `agentchat_inbox`
815
- * is `agentchat__agentchat_inbox` inside an OpenClaw turn.
816
- *
817
- * Nothing in this module is product text of its own: the wake instruction,
818
- * the manual, the identity line, the briefing card and the gate question are
819
- * all written in the main line and only placed by this plugin. The one
820
- * sentence that is ours states facts (which ids the gate chose), not
821
- * judgement.
222
+ * same shape (docs.openclaw.ai/tools/mcp). The server spells the hosted
223
+ * tools by their bare names (`agentchat_inbox`); `spellToolsForOpenClaw`
224
+ * re-spells exactly those tokens so the agent is told the names it can call.
822
225
  */
226
+
823
227
  /** Name of the MCP server entry this plugin places. Changing it changes every tool name the model sees — keep in lockstep with `./mcp.ts`. */
824
228
  declare const MCP_SERVER_NAME = "agentchat";
825
229
  /** `agentchat_inbox` → `agentchat__agentchat_inbox`. */
826
230
  declare function mcpToolName(tool: string): string;
827
231
  /**
828
- * The main line's wake instruction — the AgentChat platform's default wake
829
- * instruction, the text every webhook doorbell receives — with the names
830
- * OpenClaw gives the hosted tools. The server sends these three sentences to every webhook
831
- * doorbell; a socket doorbell carries the same text so the agent is
832
- * addressed the same way whichever doorbell rang. Update together with the
833
- * server.
232
+ * How OpenClaw spells a hosted tool. Idempotent: a name that already carries
233
+ * the server prefix is returned as is, so a server that one day serves the
234
+ * OpenClaw spelling itself is not prefixed twice.
235
+ */
236
+ declare const OPENCLAW_TOOL_NAMER: ToolNamer;
237
+ /** Re-spell every bare hosted tool name in a served text the way OpenClaw exposes it. Pure, idempotent. */
238
+ declare function spellToolsForOpenClaw(text: string): string;
239
+ /**
240
+ * The prompt a wake turn starts with: the served wake instruction and, when
241
+ * the gate decided a specific conversation, one factual line naming it. The
242
+ * `reply` verdict is recorded as the turn is admitted, which marks the
243
+ * conversation read and takes it off the tray — so the turn is told which
244
+ * conversation to open, and that the verdict is already taken care of.
245
+ * Whether the tray still shows the card when the turn looks depends on the
246
+ * race between the record and the turn's first call, so the line says so.
834
247
  */
835
- declare const WAKE_INSTRUCTION: string;
836
- declare const KNOCK_TURN_PROMPT: string;
837
- declare const INVITE_TURN_PROMPT: string;
248
+ declare function wakeTurnPrompt(texts: Pick<Texts, 'wake_instruction'>, conversationId?: string): string;
249
+ /** The prompt a group-invite turn starts with: the served invite prompt. */
250
+ declare function inviteTurnPrompt(texts: Pick<Texts, 'invite_prompt'>): string;
251
+
838
252
  /**
839
- * The prompt a knock turn starts with. `replyConversations` are the
840
- * conversation ids the gate step decided `reply` just before this turn. The
841
- * turn is a fresh session with no memory of that call, so the ids are
842
- * stated; every other card on the tray was left undecided and the turn
843
- * judges it with the tray's own question. Ids are metadata — a webhook wake
844
- * carries the same — never content.
253
+ * Error taxonomy for the AgentChat channel plugin.
254
+ *
255
+ * Every error that crosses a pipeline boundary (inbound receive, outbound
256
+ * send, config validation, transport) must be classifiable as one of:
257
+ *
258
+ * terminal-auth — 401/403. API key invalid or revoked. Do not retry.
259
+ * Move state machine to AUTH_FAIL.
260
+ * terminal-user — 400/422 (client-side validation). Bug in this plugin
261
+ * or malformed outbound. Log at error level, drop,
262
+ * do not retry.
263
+ * retry-rate — 429. Retry after `retryAfterMs` (or jittered
264
+ * exponential backoff if header absent).
265
+ * retry-transient — 5xx, ECONNRESET, ETIMEDOUT, network flap.
266
+ * Exponential backoff + jitter. Open circuit after N.
267
+ * idempotent-replay — 409 on POST /v1/messages with duplicate
268
+ * client_msg_id. Treat as success, log at info.
269
+ * validation — Zod schema failed on inbound payload. Likely a
270
+ * server change. Log at error, drop, alert.
845
271
  */
846
- declare function knockTurnPrompt(replyConversations?: readonly string[]): string;
847
- /** The one prompt a group-invite turn starts with. */
848
- declare function inviteTurnPrompt(): string;
272
+ type ErrorClass = 'terminal-auth' | 'terminal-user' | 'retry-rate' | 'retry-transient' | 'idempotent-replay' | 'validation';
273
+ declare class AgentChatChannelError extends Error {
274
+ readonly class_: ErrorClass;
275
+ readonly retryAfterMs: number | undefined;
276
+ readonly statusCode: number | undefined;
277
+ constructor(class_: ErrorClass, message: string, options?: {
278
+ cause?: unknown;
279
+ retryAfterMs?: number;
280
+ statusCode?: number;
281
+ });
282
+ }
849
283
 
850
284
  /**
851
285
  * Minimal HTTP client used by the setup plugin (P7) to:
@@ -1051,4 +485,4 @@ declare function recoverAgentVerify(input: RecoverAgentVerifyInput, opts?: Regis
1051
485
  */
1052
486
  declare function assertApiKeyValid(apiKey: string, opts?: ValidateApiKeyOptions): Promise<AgentchatAgentIdentity>;
1053
487
 
1054
- export { AGENTCHAT_CHANNEL_ID, AGENTCHAT_DEFAULT_ACCOUNT_ID, AgentChatChannelError, AgentInvoker, type AgentchatAgentIdentity, AgentchatChannelConfig, AgentchatChannelRuntime, type ChannelRuntimeHandlers, type ChannelRuntimeOptions, type ConnectionState, type Decision, type EmailPolicyReason, type ErrorClass, type GroupInviteKnock, type HealthSnapshot, INVITE_TURN_PROMPT, KNOCK_TURN_PROMPT, type Knock, KnockCoalescer, type KnockSource, MCP_SERVER_NAME, MainLineClient, MainLineError, type MessageKnock, type RecoverAgentStartInput, type RecoverAgentVerifyInput, type RecoverStartResult, type RecoverVerifyResult, type RegisterAgentStartInput, type RegisterAgentVerifyInput, type RegisterOptions, type RegisterStartResult, type RegisterVerifyResult, type Tray, type ValidateApiKeyOptions, type ValidateApiKeyResult, WAKE_INSTRUCTION, assertApiKeyValid, hostedMcpServerEntry, hostedMcpSnippet, hostedMcpUrl, inviteTurnPrompt, knockTurnPrompt, mcpToolName, probeHostedMcp, recoverAgentStart, recoverAgentVerify, registerAgentStart, registerAgentVerify, validateApiKey };
488
+ export { AGENTCHAT_CHANNEL_ID, AGENTCHAT_DEFAULT_ACCOUNT_ID, AgentChatChannelError, type AgentchatAgentIdentity, type EmailPolicyReason, type ErrorClass, MCP_SERVER_NAME, OPENCLAW_TOOL_NAMER, type RecoverAgentStartInput, type RecoverAgentVerifyInput, type RecoverStartResult, type RecoverVerifyResult, type RegisterAgentStartInput, type RegisterAgentVerifyInput, type RegisterOptions, type RegisterStartResult, type RegisterVerifyResult, TextsStore, type ValidateApiKeyOptions, type ValidateApiKeyResult, WakeCoalescer, assertApiKeyValid, hostedMcpServerEntry, hostedMcpSnippet, hostedMcpUrl, inviteTurnPrompt, loadIdentityLine, loadTexts, mcpToolName, probeHostedMcp, recoverAgentStart, recoverAgentVerify, registerAgentStart, registerAgentVerify, spellToolsForOpenClaw, validateApiKey, wakeTurnPrompt };