@badgerclaw/connect 1.4.0 → 1.4.2
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 +3 -3
- package/scripts/postinstall.cjs +47 -0
- package/src/channel.ts +1 -1
- package/scripts/postinstall.js +0 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@badgerclaw/connect",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "BadgerClaw channel plugin for OpenClaw",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
-
"postinstall": "node scripts/postinstall.
|
|
35
|
+
"postinstall": "node scripts/postinstall.cjs"
|
|
36
36
|
}
|
|
37
|
-
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
// Find openclaw package.json via common global install paths
|
|
6
|
+
const CANDIDATES = [
|
|
7
|
+
'/opt/homebrew/lib/node_modules/openclaw/package.json',
|
|
8
|
+
'/usr/local/lib/node_modules/openclaw/package.json',
|
|
9
|
+
path.join(process.env.HOME || '', '.npm-global/lib/node_modules/openclaw/package.json'),
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
const MISSING_EXPORTS = {
|
|
13
|
+
'./plugin-sdk/compat': {
|
|
14
|
+
types: './dist/plugin-sdk/compat.d.ts',
|
|
15
|
+
default: './dist/plugin-sdk/compat.js',
|
|
16
|
+
},
|
|
17
|
+
'./plugin-sdk/extension-shared': {
|
|
18
|
+
types: './dist/plugin-sdk/extension-shared.d.ts',
|
|
19
|
+
default: './dist/plugin-sdk/extension-shared.js',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const pkgPath = CANDIDATES.find(p => fs.existsSync(p));
|
|
24
|
+
if (!pkgPath) {
|
|
25
|
+
console.log('[badgerclaw] postinstall: openclaw not found, skipping exports patch');
|
|
26
|
+
process.exit(0);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
31
|
+
if (!pkg.exports) pkg.exports = {};
|
|
32
|
+
let patched = false;
|
|
33
|
+
for (const [key, entry] of Object.entries(MISSING_EXPORTS)) {
|
|
34
|
+
if (!pkg.exports[key]) {
|
|
35
|
+
pkg.exports[key] = entry;
|
|
36
|
+
console.log(`[badgerclaw] patched openclaw exports map: added ${key}`);
|
|
37
|
+
patched = true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (patched) {
|
|
41
|
+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|
|
42
|
+
} else {
|
|
43
|
+
console.log('[badgerclaw] openclaw exports map already up to date');
|
|
44
|
+
}
|
|
45
|
+
} catch (e) {
|
|
46
|
+
console.log('[badgerclaw] postinstall warning:', e.message);
|
|
47
|
+
}
|
package/src/channel.ts
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
PAIRING_APPROVED_MESSAGE,
|
|
16
16
|
type ChannelPlugin,
|
|
17
17
|
} from "openclaw/plugin-sdk/matrix";
|
|
18
|
-
import { buildTrafficStatusSummary } from "
|
|
18
|
+
import { buildTrafficStatusSummary } from "openclaw/plugin-sdk/extension-shared";
|
|
19
19
|
import { matrixMessageActions } from "./actions.js";
|
|
20
20
|
import { MatrixConfigSchema } from "./config-schema.js";
|
|
21
21
|
import { listMatrixDirectoryGroupsLive, listMatrixDirectoryPeersLive } from "./directory-live.js";
|
package/scripts/postinstall.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* postinstall.js — patches openclaw package.json exports map to expose
|
|
4
|
-
* plugin-sdk/compat subpath, which was removed in openclaw >=2026.3.24.
|
|
5
|
-
* This runs automatically after `npm install` in the plugin directory.
|
|
6
|
-
*/
|
|
7
|
-
const fs = require('fs');
|
|
8
|
-
const path = require('path');
|
|
9
|
-
|
|
10
|
-
const OPENCLAW_PKG = path.join(
|
|
11
|
-
path.dirname(require.resolve('openclaw/package.json')),
|
|
12
|
-
'package.json'
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
const COMPAT_EXPORT = './plugin-sdk/compat';
|
|
16
|
-
const COMPAT_ENTRY = {
|
|
17
|
-
types: './dist/plugin-sdk/compat.d.ts',
|
|
18
|
-
default: './dist/plugin-sdk/compat.js',
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
const pkg = JSON.parse(fs.readFileSync(OPENCLAW_PKG, 'utf-8'));
|
|
23
|
-
if (!pkg.exports) pkg.exports = {};
|
|
24
|
-
if (!pkg.exports[COMPAT_EXPORT]) {
|
|
25
|
-
pkg.exports[COMPAT_EXPORT] = COMPAT_ENTRY;
|
|
26
|
-
fs.writeFileSync(OPENCLAW_PKG, JSON.stringify(pkg, null, 2));
|
|
27
|
-
console.log('[badgerclaw] patched openclaw exports map: added plugin-sdk/compat');
|
|
28
|
-
} else {
|
|
29
|
-
console.log('[badgerclaw] openclaw exports map already has plugin-sdk/compat');
|
|
30
|
-
}
|
|
31
|
-
} catch (e) {
|
|
32
|
-
// Non-fatal — openclaw may not be installed yet
|
|
33
|
-
console.log('[badgerclaw] postinstall: could not patch openclaw exports map:', e.message);
|
|
34
|
-
}
|