@cfio/cohort-sync 0.1.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.
- package/dist/index.js +12455 -0
- package/dist/openclaw.plugin.json +48 -0
- package/dist/package.json +12 -0
- package/package.json +36 -0
- package/scripts/postinstall.mjs +48 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "cohort-sync",
|
|
3
|
+
"uiHints": {
|
|
4
|
+
"apiUrl": {
|
|
5
|
+
"label": "Cohort API URL",
|
|
6
|
+
"placeholder": "https://fortunate-chipmunk-286.convex.site",
|
|
7
|
+
"help": "Base URL for the Cohort telemetry API"
|
|
8
|
+
},
|
|
9
|
+
"apiKey": {
|
|
10
|
+
"label": "API Key",
|
|
11
|
+
"sensitive": true,
|
|
12
|
+
"placeholder": "cohort_...",
|
|
13
|
+
"help": "Cohort API key for telemetry writes"
|
|
14
|
+
},
|
|
15
|
+
"syncIntervalMs": {
|
|
16
|
+
"label": "Sync Interval (ms)",
|
|
17
|
+
"placeholder": "300000",
|
|
18
|
+
"advanced": true,
|
|
19
|
+
"help": "Fallback full sync interval in milliseconds (default: 5 min)"
|
|
20
|
+
},
|
|
21
|
+
"agentNameMap": {
|
|
22
|
+
"label": "Agent Name Map",
|
|
23
|
+
"advanced": true,
|
|
24
|
+
"help": "Map OpenClaw agent IDs to Cohort display names (e.g. {\"main\": \"yuki\"})"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"configSchema": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"additionalProperties": false,
|
|
30
|
+
"properties": {
|
|
31
|
+
"apiUrl": {
|
|
32
|
+
"type": "string"
|
|
33
|
+
},
|
|
34
|
+
"apiKey": {
|
|
35
|
+
"type": "string"
|
|
36
|
+
},
|
|
37
|
+
"syncIntervalMs": {
|
|
38
|
+
"type": "number"
|
|
39
|
+
},
|
|
40
|
+
"agentNameMap": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"additionalProperties": {
|
|
43
|
+
"type": "string"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cfio/cohort-sync",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Syncs agent status and skills to Cohort dashboard",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "index.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "node scripts/build.mjs",
|
|
10
|
+
"postinstall": "node scripts/postinstall.mjs",
|
|
11
|
+
"prepublishOnly": "node scripts/build.mjs",
|
|
12
|
+
"typecheck": "tsc --noEmit",
|
|
13
|
+
"test": "vitest run"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"scripts/postinstall.mjs"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"esbuild": "^0.25.0",
|
|
24
|
+
"vitest": "^2.1.8"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"openclaw": ">=0.1.0"
|
|
28
|
+
},
|
|
29
|
+
"openclaw": {
|
|
30
|
+
"extensions": ["./dist/index.js"]
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@sinclair/typebox": "^0.34.0",
|
|
34
|
+
"convex": "^1.32.0"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* postinstall: copies dist files to ~/.openclaw/extensions/cohort-sync/
|
|
5
|
+
* Runs after `npm install -g @cfio/cohort-sync`.
|
|
6
|
+
* Exits 0 even on failure — a broken postinstall should not fail the npm install.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { cpSync, mkdirSync, existsSync } from "node:fs";
|
|
10
|
+
import { join, dirname } from "node:path";
|
|
11
|
+
import { homedir } from "node:os";
|
|
12
|
+
import { fileURLToPath } from "node:url";
|
|
13
|
+
|
|
14
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
|
|
16
|
+
// When installed globally, the layout is:
|
|
17
|
+
// <global-prefix>/lib/node_modules/@cfio/cohort-sync/
|
|
18
|
+
// dist/index.js
|
|
19
|
+
// dist/package.json
|
|
20
|
+
// dist/openclaw.plugin.json
|
|
21
|
+
// scripts/postinstall.mjs ← we are here
|
|
22
|
+
const distDir = join(__dirname, "..", "dist");
|
|
23
|
+
const targetDir = join(homedir(), ".openclaw", "extensions", "cohort-sync");
|
|
24
|
+
|
|
25
|
+
const FILES = ["index.js", "package.json", "openclaw.plugin.json"];
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
// Verify dist files exist (they should — prepublishOnly builds them)
|
|
29
|
+
for (const file of FILES) {
|
|
30
|
+
if (!existsSync(join(distDir, file))) {
|
|
31
|
+
process.exit(0);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
mkdirSync(targetDir, { recursive: true });
|
|
36
|
+
|
|
37
|
+
for (const file of FILES) {
|
|
38
|
+
cpSync(join(distDir, file), join(targetDir, file));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
console.log(`✓ cohort-sync installed to ${targetDir}`);
|
|
42
|
+
console.log(` Run 'openclaw cohort auth' to connect.`);
|
|
43
|
+
} catch (err) {
|
|
44
|
+
// Never fail the npm install — print a warning and exit 0
|
|
45
|
+
console.warn(`⚠ Could not copy cohort-sync to ${targetDir}`);
|
|
46
|
+
console.warn(` Error: ${err.message}`);
|
|
47
|
+
console.warn(` You can manually copy the files from: ${distDir}`);
|
|
48
|
+
}
|