@agentchatme/openclaw 0.6.11 → 0.6.13

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.
@@ -0,0 +1,104 @@
1
+ import * as openclaw_plugin_sdk_channel_core from 'openclaw/plugin-sdk/channel-core';
2
+ import { defineChannelPluginEntry, ChannelPlugin } from 'openclaw/plugin-sdk/channel-core';
3
+ import { z } from 'zod';
4
+
5
+ /**
6
+ * Zod schema for AgentChat channel config.
7
+ *
8
+ * Source of truth: this file. The JSON Schema inlined in `openclaw.plugin.json`
9
+ * MUST stay in sync (P1 adds a build step that emits it via zod-to-json-schema).
10
+ *
11
+ * `.strict()` rejects unknown keys — a common source of "the config silently
12
+ * ignored my setting" bugs.
13
+ */
14
+
15
+ declare const agentchatChannelConfigSchema: z.ZodObject<{
16
+ apiBase: z.ZodDefault<z.ZodString>;
17
+ apiKey: z.ZodString;
18
+ agentHandle: z.ZodOptional<z.ZodString>;
19
+ reconnect: z.ZodPrefault<z.ZodObject<{
20
+ initialBackoffMs: z.ZodDefault<z.ZodNumber>;
21
+ maxBackoffMs: z.ZodDefault<z.ZodNumber>;
22
+ jitterRatio: z.ZodDefault<z.ZodNumber>;
23
+ }, z.core.$strict>>;
24
+ ping: z.ZodPrefault<z.ZodObject<{
25
+ intervalMs: z.ZodDefault<z.ZodNumber>;
26
+ timeoutMs: z.ZodDefault<z.ZodNumber>;
27
+ }, z.core.$strict>>;
28
+ outbound: z.ZodPrefault<z.ZodObject<{
29
+ maxInFlight: z.ZodDefault<z.ZodNumber>;
30
+ sendTimeoutMs: z.ZodDefault<z.ZodNumber>;
31
+ }, z.core.$strict>>;
32
+ observability: z.ZodPrefault<z.ZodObject<{
33
+ logLevel: z.ZodDefault<z.ZodEnum<{
34
+ warn: "warn";
35
+ error: "error";
36
+ trace: "trace";
37
+ debug: "debug";
38
+ info: "info";
39
+ }>>;
40
+ redactKeys: z.ZodDefault<z.ZodArray<z.ZodString>>;
41
+ }, z.core.$strict>>;
42
+ }, z.core.$strict>;
43
+ type AgentchatChannelConfig = z.infer<typeof agentchatChannelConfigSchema>;
44
+ /**
45
+ * Parse + validate config at plugin startup.
46
+ *
47
+ * Strict on `apiKey` and the four nested groups — `parseChannelConfig` is
48
+ * called only AFTER `resolveAgentchatAccount` has confirmed that the
49
+ * persisted config block is non-empty (see `channel.ts`), so an empty
50
+ * install-time config never reaches Zod. The runtime-time strictness here
51
+ * surfaces typos and out-of-range values fast. The OpenClaw install-time
52
+ * JSON Schema (emitted by `scripts/emit-manifest-schema.mjs`) is more
53
+ * permissive — see that script's post-process step for the rationale —
54
+ * so a freshly-installed plugin can pass install validation against an
55
+ * empty config block before the setup wizard fills in credentials.
56
+ *
57
+ * `AgentChatChannelError` wraps validation failures so the gateway can
58
+ * classify them (`terminal-user` — operator fix required).
59
+ */
60
+ declare function parseChannelConfig(input: unknown): AgentchatChannelConfig;
61
+
62
+ /**
63
+ * ChannelStatusAdapter — account health + configured-state probe.
64
+ *
65
+ * `probeAccount` hits `/v1/agents/me` with a short timeout and reports
66
+ * whether the configured key still authenticates and whether the account
67
+ * is active / restricted / suspended. The gateway uses this to surface a
68
+ * red/yellow/green status in `openclaw channels status` and to decide when
69
+ * to page an operator for stuck accounts.
70
+ */
71
+
72
+ type AgentchatProbeResult = {
73
+ readonly ok: boolean;
74
+ readonly handle?: string;
75
+ readonly status?: 'active' | 'restricted' | 'suspended' | 'deleted';
76
+ readonly pausedByOwner?: 'none' | 'send' | 'full';
77
+ readonly error?: string;
78
+ };
79
+
80
+ interface AgentchatResolvedAccount {
81
+ accountId: string;
82
+ enabled: boolean;
83
+ configured: boolean;
84
+ config: AgentchatChannelConfig | null;
85
+ parseError: string | null;
86
+ }
87
+ declare const agentchatPlugin: ChannelPlugin<AgentchatResolvedAccount, AgentchatProbeResult>;
88
+ /**
89
+ * Canonical channel-entry descriptor consumed by OpenClaw's extension loader.
90
+ * Exported as `default` because `openclaw.extensions` in package.json points to
91
+ * this module and the loader reads the default export.
92
+ *
93
+ * The explicit `ReturnType<...>` annotation pins the emitted `.d.ts` to the
94
+ * function signature instead of the structural shape — otherwise the inferred
95
+ * type references `ChannelConfigSchema` through a non-exported path and TS
96
+ * fails with TS2742 ("cannot be named without a reference to ...").
97
+ */
98
+ declare const agentchatChannelEntry: ReturnType<typeof defineChannelPluginEntry<typeof agentchatPlugin>>;
99
+
100
+ declare const agentchatSetupEntry: {
101
+ plugin: openclaw_plugin_sdk_channel_core.ChannelPlugin<AgentchatResolvedAccount, AgentchatProbeResult>;
102
+ };
103
+
104
+ export { type AgentchatChannelConfig as A, type AgentchatResolvedAccount as a, agentchatChannelEntry as b, agentchatPlugin as c, agentchatSetupEntry as d, parseChannelConfig as p };
@@ -0,0 +1,104 @@
1
+ import * as openclaw_plugin_sdk_channel_core from 'openclaw/plugin-sdk/channel-core';
2
+ import { defineChannelPluginEntry, ChannelPlugin } from 'openclaw/plugin-sdk/channel-core';
3
+ import { z } from 'zod';
4
+
5
+ /**
6
+ * Zod schema for AgentChat channel config.
7
+ *
8
+ * Source of truth: this file. The JSON Schema inlined in `openclaw.plugin.json`
9
+ * MUST stay in sync (P1 adds a build step that emits it via zod-to-json-schema).
10
+ *
11
+ * `.strict()` rejects unknown keys — a common source of "the config silently
12
+ * ignored my setting" bugs.
13
+ */
14
+
15
+ declare const agentchatChannelConfigSchema: z.ZodObject<{
16
+ apiBase: z.ZodDefault<z.ZodString>;
17
+ apiKey: z.ZodString;
18
+ agentHandle: z.ZodOptional<z.ZodString>;
19
+ reconnect: z.ZodPrefault<z.ZodObject<{
20
+ initialBackoffMs: z.ZodDefault<z.ZodNumber>;
21
+ maxBackoffMs: z.ZodDefault<z.ZodNumber>;
22
+ jitterRatio: z.ZodDefault<z.ZodNumber>;
23
+ }, z.core.$strict>>;
24
+ ping: z.ZodPrefault<z.ZodObject<{
25
+ intervalMs: z.ZodDefault<z.ZodNumber>;
26
+ timeoutMs: z.ZodDefault<z.ZodNumber>;
27
+ }, z.core.$strict>>;
28
+ outbound: z.ZodPrefault<z.ZodObject<{
29
+ maxInFlight: z.ZodDefault<z.ZodNumber>;
30
+ sendTimeoutMs: z.ZodDefault<z.ZodNumber>;
31
+ }, z.core.$strict>>;
32
+ observability: z.ZodPrefault<z.ZodObject<{
33
+ logLevel: z.ZodDefault<z.ZodEnum<{
34
+ warn: "warn";
35
+ error: "error";
36
+ trace: "trace";
37
+ debug: "debug";
38
+ info: "info";
39
+ }>>;
40
+ redactKeys: z.ZodDefault<z.ZodArray<z.ZodString>>;
41
+ }, z.core.$strict>>;
42
+ }, z.core.$strict>;
43
+ type AgentchatChannelConfig = z.infer<typeof agentchatChannelConfigSchema>;
44
+ /**
45
+ * Parse + validate config at plugin startup.
46
+ *
47
+ * Strict on `apiKey` and the four nested groups — `parseChannelConfig` is
48
+ * called only AFTER `resolveAgentchatAccount` has confirmed that the
49
+ * persisted config block is non-empty (see `channel.ts`), so an empty
50
+ * install-time config never reaches Zod. The runtime-time strictness here
51
+ * surfaces typos and out-of-range values fast. The OpenClaw install-time
52
+ * JSON Schema (emitted by `scripts/emit-manifest-schema.mjs`) is more
53
+ * permissive — see that script's post-process step for the rationale —
54
+ * so a freshly-installed plugin can pass install validation against an
55
+ * empty config block before the setup wizard fills in credentials.
56
+ *
57
+ * `AgentChatChannelError` wraps validation failures so the gateway can
58
+ * classify them (`terminal-user` — operator fix required).
59
+ */
60
+ declare function parseChannelConfig(input: unknown): AgentchatChannelConfig;
61
+
62
+ /**
63
+ * ChannelStatusAdapter — account health + configured-state probe.
64
+ *
65
+ * `probeAccount` hits `/v1/agents/me` with a short timeout and reports
66
+ * whether the configured key still authenticates and whether the account
67
+ * is active / restricted / suspended. The gateway uses this to surface a
68
+ * red/yellow/green status in `openclaw channels status` and to decide when
69
+ * to page an operator for stuck accounts.
70
+ */
71
+
72
+ type AgentchatProbeResult = {
73
+ readonly ok: boolean;
74
+ readonly handle?: string;
75
+ readonly status?: 'active' | 'restricted' | 'suspended' | 'deleted';
76
+ readonly pausedByOwner?: 'none' | 'send' | 'full';
77
+ readonly error?: string;
78
+ };
79
+
80
+ interface AgentchatResolvedAccount {
81
+ accountId: string;
82
+ enabled: boolean;
83
+ configured: boolean;
84
+ config: AgentchatChannelConfig | null;
85
+ parseError: string | null;
86
+ }
87
+ declare const agentchatPlugin: ChannelPlugin<AgentchatResolvedAccount, AgentchatProbeResult>;
88
+ /**
89
+ * Canonical channel-entry descriptor consumed by OpenClaw's extension loader.
90
+ * Exported as `default` because `openclaw.extensions` in package.json points to
91
+ * this module and the loader reads the default export.
92
+ *
93
+ * The explicit `ReturnType<...>` annotation pins the emitted `.d.ts` to the
94
+ * function signature instead of the structural shape — otherwise the inferred
95
+ * type references `ChannelConfigSchema` through a non-exported path and TS
96
+ * fails with TS2742 ("cannot be named without a reference to ...").
97
+ */
98
+ declare const agentchatChannelEntry: ReturnType<typeof defineChannelPluginEntry<typeof agentchatPlugin>>;
99
+
100
+ declare const agentchatSetupEntry: {
101
+ plugin: openclaw_plugin_sdk_channel_core.ChannelPlugin<AgentchatResolvedAccount, AgentchatProbeResult>;
102
+ };
103
+
104
+ export { type AgentchatChannelConfig as A, type AgentchatResolvedAccount as a, agentchatChannelEntry as b, agentchatPlugin as c, agentchatSetupEntry as d, parseChannelConfig as p };
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var channelCore = require('openclaw/plugin-sdk/channel-core');
6
6
  var setup = require('openclaw/plugin-sdk/setup');
7
- var readEnv_js = require('./credentials/read-env.js');
8
- var agentsAnchor_js = require('./binding/agents-anchor.js');
7
+ var readEnv_js = require('./credentials/read-env.cjs');
8
+ var agentsAnchor_js = require('./binding/agents-anchor.cjs');
9
9
  var zod = require('zod');
10
10
  var pino = require('pino');
11
11
  var ws = require('ws');
@@ -324,8 +324,8 @@ async function promptEmail(prompter) {
324
324
  }
325
325
  async function promptHandle(prompter) {
326
326
  return (await prompter.text({
327
- message: "3\u201330 chars, lowercase a-z, 0-9, hyphens, starts with a letter, e.g. anton-claw01",
328
- placeholder: "anton-claw01",
327
+ message: "Choose a handle (your @name on AgentChat)",
328
+ placeholder: "3\u201330 chars, lowercase a-z, 0-9, hyphens, starts with a letter",
329
329
  validate: (value) => {
330
330
  const trimmed = value.trim();
331
331
  if (!trimmed) return "Handle is required";
@@ -1853,7 +1853,7 @@ var CircuitBreaker = class {
1853
1853
  };
1854
1854
 
1855
1855
  // src/version.ts
1856
- var PACKAGE_VERSION = "0.6.11";
1856
+ var PACKAGE_VERSION = "0.6.13";
1857
1857
 
1858
1858
  // src/outbound.ts
1859
1859
  var DEFAULT_RETRY_POLICY = {
@@ -2437,21 +2437,28 @@ async function handleMessage(deps, event) {
2437
2437
  const recipientHandle = selfHandle ?? "me";
2438
2438
  const conversationLabel = event.conversationKind === "group" ? `group ${event.conversationId}` : `dm with @${senderHandle}`;
2439
2439
  try {
2440
+ const sessionKey = event.conversationKind === "group" ? `agentchat:${deps.accountId}:group:${event.conversationId}` : `agentchat:${deps.accountId}:dm:${senderHandle}`;
2440
2441
  await dispatcher({
2441
2442
  cfg: deps.gatewayCfg,
2442
2443
  ctx: {
2443
- channel: "agentchat",
2444
- channelLabel: "AgentChat",
2445
- accountId: deps.accountId,
2446
- conversationId: event.conversationId,
2447
- conversationLabel,
2448
- senderId: senderHandle,
2449
- senderAddress: `@${senderHandle}`,
2450
- recipientAddress: `@${recipientHandle}`,
2451
- messageId: event.messageId,
2452
- rawBody: body,
2453
- timestamp: event.createdAt,
2454
- chatType: event.conversationKind === "group" ? "group" : "direct"
2444
+ Body: body,
2445
+ BodyForAgent: body,
2446
+ RawBody: body,
2447
+ CommandBody: body,
2448
+ From: `@${senderHandle}`,
2449
+ To: `@${recipientHandle}`,
2450
+ SessionKey: sessionKey,
2451
+ AccountId: deps.accountId,
2452
+ ChatType: event.conversationKind === "group" ? "group" : "direct",
2453
+ ConversationLabel: conversationLabel,
2454
+ SenderId: senderHandle,
2455
+ Provider: "agentchat",
2456
+ Surface: "agentchat",
2457
+ MessageSid: event.messageId,
2458
+ MessageSidFull: event.messageId,
2459
+ Timestamp: event.createdAt,
2460
+ OriginatingChannel: "agentchat",
2461
+ OriginatingTo: `@${recipientHandle}`
2455
2462
  },
2456
2463
  dispatcherOptions: {
2457
2464
  deliver: async (payload) => {