@yeego/yeego-openclaw 1.3.0 → 1.3.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 +2 -1
- package/src/tools/pocketbase.ts +31 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yeego/yeego-openclaw",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Yeego plugin for OpenClaw - Connect your AI personas to Yeego messaging platform",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"QUICKSTART.md"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
+
"@sinclair/typebox": "^0.32.0",
|
|
30
31
|
"pocketbase": "^0.26.8"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
package/src/tools/pocketbase.ts
CHANGED
|
@@ -3,10 +3,33 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import PocketBase from "pocketbase";
|
|
6
|
+
import { existsSync, readFileSync } from "fs";
|
|
7
|
+
import { join } from "path";
|
|
8
|
+
import { homedir } from "os";
|
|
6
9
|
|
|
7
10
|
// PocketBase admin singleton
|
|
8
11
|
let pbAdminInstance: PocketBase | null = null;
|
|
9
12
|
|
|
13
|
+
interface YeegoInternalConfig {
|
|
14
|
+
token: string;
|
|
15
|
+
profile_id: string;
|
|
16
|
+
base_url: string;
|
|
17
|
+
sidecar_url?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Load Yeego config from ~/.yeego/config.json
|
|
22
|
+
*/
|
|
23
|
+
function loadYeegoConfig(): YeegoInternalConfig {
|
|
24
|
+
const configPath = join(homedir(), '.yeego', 'config.json');
|
|
25
|
+
|
|
26
|
+
if (!existsSync(configPath)) {
|
|
27
|
+
throw new Error(`Yeego config not found at ${configPath}. Please ensure the Yeego channel is properly configured and started.`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
31
|
+
}
|
|
32
|
+
|
|
10
33
|
/**
|
|
11
34
|
* Get authenticated PocketBase admin client
|
|
12
35
|
*/
|
|
@@ -15,13 +38,17 @@ export async function getPbAdmin(): Promise<PocketBase> {
|
|
|
15
38
|
return pbAdminInstance;
|
|
16
39
|
}
|
|
17
40
|
|
|
18
|
-
//
|
|
19
|
-
const
|
|
20
|
-
|
|
41
|
+
// Load config from ~/.yeego/config.json
|
|
42
|
+
const config = loadYeegoConfig();
|
|
43
|
+
|
|
44
|
+
// Use base_url (not sidecar_url) for PocketBase API access
|
|
45
|
+
const dbUrl = config.base_url;
|
|
46
|
+
|
|
47
|
+
console.error(`[OpenClaw Tools] Initializing PocketBase client with URL: ${dbUrl}`);
|
|
21
48
|
|
|
22
49
|
const pb = new PocketBase(dbUrl);
|
|
23
50
|
pb.autoCancellation(false);
|
|
24
|
-
pb.authStore.save(token, null);
|
|
51
|
+
pb.authStore.save(config.token, null);
|
|
25
52
|
|
|
26
53
|
pbAdminInstance = pb;
|
|
27
54
|
return pb;
|