@xmoxmo/bncr 0.2.0 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmoxmo/bncr",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -26,13 +26,46 @@ const requiredFiles = [
26
26
  'src/messaging/outbound/actions.ts',
27
27
  ];
28
28
 
29
+ const readPackageVersion = () => {
30
+ const pkgPath = path.join(root, 'package.json');
31
+ const raw = fs.readFileSync(pkgPath, 'utf8');
32
+ const pkg = JSON.parse(raw);
33
+ return typeof pkg?.version === 'string' ? pkg.version.trim() : '';
34
+ };
35
+
36
+ const validateVersionPolicy = (version) => {
37
+ const match = version.match(/^(\d+)\.(\d+)\.(\d+)$/);
38
+ if (!match) {
39
+ return {
40
+ ok: false,
41
+ reason: 'version must be strict semver x.y.z',
42
+ version,
43
+ };
44
+ }
45
+
46
+ const patch = Number.parseInt(match[3], 10);
47
+ if (patch > 9) {
48
+ return {
49
+ ok: false,
50
+ reason: 'patch version must stay within 0-9; bump minor instead',
51
+ version,
52
+ };
53
+ }
54
+
55
+ return { ok: true, version };
56
+ };
57
+
29
58
  const missing = requiredFiles.filter((rel) => !fs.existsSync(path.join(root, rel)));
59
+ const version = readPackageVersion();
60
+ const versionPolicy = validateVersionPolicy(version);
30
61
  const result = {
31
- ok: missing.length === 0,
62
+ ok: missing.length === 0 && versionPolicy.ok,
32
63
  checkedRoot: root,
33
64
  requiredCount: requiredFiles.length,
34
65
  missing,
66
+ version,
67
+ versionPolicy,
35
68
  };
36
69
 
37
70
  console.log(JSON.stringify(result, null, 2));
38
- if (missing.length > 0) process.exit(1);
71
+ if (missing.length > 0 || !versionPolicy.ok) process.exit(1);
package/src/channel.ts CHANGED
@@ -9,13 +9,12 @@ import type {
9
9
  } from 'openclaw/plugin-sdk/core';
10
10
  import {
11
11
  applyAccountNameToChannelSection,
12
+ jsonResult,
12
13
  setAccountEnabledInConfigSection,
13
14
  } from 'openclaw/plugin-sdk/core';
14
15
  import { readJsonFileWithFallback, writeJsonFileAtomically } from 'openclaw/plugin-sdk/json-store';
15
- import type { ChannelMessageActionAdapter, ChatType } from 'openclaw/plugin-sdk/mattermost';
16
16
  import { readStringParam } from 'openclaw/plugin-sdk/param-readers';
17
17
  import { createDefaultChannelRuntimeState } from 'openclaw/plugin-sdk/status-helpers';
18
- import { jsonResult } from 'openclaw/plugin-sdk/telegram-core';
19
18
  import { extractToolSend } from 'openclaw/plugin-sdk/tool-send';
20
19
  import {
21
20
  BNCR_DEFAULT_ACCOUNT_ID,
@@ -127,6 +126,20 @@ type FileRecvTransferState = {
127
126
  error?: string;
128
127
  };
129
128
 
129
+ type ChatType = 'direct' | 'group' | (string & {});
130
+
131
+ type ChannelMessageActionAdapter = {
132
+ describeMessageTool: (ctx: { cfg: any }) => { actions: string[]; capabilities: unknown[] } | null;
133
+ supportsAction: (ctx: { action: string }) => boolean;
134
+ extractToolSend: (ctx: { args: unknown }) => unknown;
135
+ handleAction: (ctx: {
136
+ action: string;
137
+ params: unknown;
138
+ accountId: string;
139
+ mediaLocalRoots?: string[];
140
+ }) => Promise<unknown>;
141
+ };
142
+
130
143
  type PersistedState = {
131
144
  outbox: OutboxEntry[];
132
145
  deadLetter: OutboxEntry[];