@phronesis-io/openclaw-eigenflux 0.0.7 → 0.0.9-beta.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/README.md +3 -0
- package/dist/index.d.ts +9 -23
- package/dist/index.js +2263 -463
- package/openclaw.plugin.json +5 -1
- package/package.json +21 -8
- package/skills/ef-communication/SKILL.md +1 -0
- package/skills/ef-communication/references/relations.md +13 -0
- package/dist/agent-prompt-templates.d.ts +0 -19
- package/dist/agent-prompt-templates.d.ts.map +0 -1
- package/dist/agent-prompt-templates.js +0 -56
- package/dist/agent-prompt-templates.js.map +0 -1
- package/dist/cli-executor.d.ts +0 -32
- package/dist/cli-executor.d.ts.map +0 -1
- package/dist/cli-executor.js +0 -75
- package/dist/cli-executor.js.map +0 -1
- package/dist/config.d.ts +0 -83
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -226
- package/dist/config.js.map +0 -1
- package/dist/credentials-loader.d.ts +0 -29
- package/dist/credentials-loader.d.ts.map +0 -1
- package/dist/credentials-loader.js +0 -117
- package/dist/credentials-loader.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/logger.d.ts +0 -12
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -25
- package/dist/logger.js.map +0 -1
- package/dist/notification-route-resolver.d.ts +0 -43
- package/dist/notification-route-resolver.d.ts.map +0 -1
- package/dist/notification-route-resolver.js +0 -533
- package/dist/notification-route-resolver.js.map +0 -1
- package/dist/notifier.d.ts +0 -39
- package/dist/notifier.d.ts.map +0 -1
- package/dist/notifier.js +0 -340
- package/dist/notifier.js.map +0 -1
- package/dist/polling-client.d.ts +0 -86
- package/dist/polling-client.d.ts.map +0 -1
- package/dist/polling-client.js +0 -158
- package/dist/polling-client.js.map +0 -1
- package/dist/reply-target.d.ts +0 -8
- package/dist/reply-target.d.ts.map +0 -1
- package/dist/reply-target.js +0 -104
- package/dist/reply-target.js.map +0 -1
- package/dist/session-route-memory.d.ts +0 -22
- package/dist/session-route-memory.d.ts.map +0 -1
- package/dist/session-route-memory.js +0 -117
- package/dist/session-route-memory.js.map +0 -1
- package/dist/stream-client.d.ts +0 -48
- package/dist/stream-client.d.ts.map +0 -1
- package/dist/stream-client.js +0 -168
- package/dist/stream-client.js.map +0 -1
package/openclaw.plugin.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "openclaw-eigenflux",
|
|
3
3
|
"name": "EigenFlux",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.9-beta.0",
|
|
5
5
|
"description": "CLI-based EigenFlux delivery for OpenClaw with server discovery, feed polling, and PM streaming",
|
|
6
|
+
"activation": {
|
|
7
|
+
"onStartup": true
|
|
8
|
+
},
|
|
9
|
+
"contracts": {},
|
|
6
10
|
"configSchema": {
|
|
7
11
|
"type": "object",
|
|
8
12
|
"additionalProperties": false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phronesis-io/openclaw-eigenflux",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9-beta.0",
|
|
4
4
|
"description": "OpenClaw plugin for EigenFlux periodic polling delivery",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -13,16 +13,27 @@
|
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
15
|
"bump-version": "node scripts/set-version.mjs",
|
|
16
|
-
"copy-skills": "node -e \"require('fs').rmSync('skills',{recursive:true,force:true});require('fs').cpSync('../../eigenflux/skills','skills',{recursive:true})\"",
|
|
17
|
-
"build": "npm run copy-skills &&
|
|
18
|
-
"build:watch": "
|
|
16
|
+
"copy-skills": "node -e \"require('fs').rmSync('skills',{recursive:true,force:true});require('fs').cpSync('../../go/eigenflux/skills','skills',{recursive:true})\"",
|
|
17
|
+
"build": "npm run copy-skills && tsup",
|
|
18
|
+
"build:watch": "tsup --watch",
|
|
19
19
|
"test": "jest --runInBand",
|
|
20
20
|
"test:watch": "jest --watch"
|
|
21
21
|
},
|
|
22
22
|
"openclaw": {
|
|
23
23
|
"extensions": [
|
|
24
24
|
"./index.ts"
|
|
25
|
-
]
|
|
25
|
+
],
|
|
26
|
+
"runtimeExtensions": [
|
|
27
|
+
"./dist/index.js"
|
|
28
|
+
],
|
|
29
|
+
"compat": {
|
|
30
|
+
"pluginApi": ">=2026.5.2",
|
|
31
|
+
"minGatewayVersion": "2026.5.2"
|
|
32
|
+
},
|
|
33
|
+
"build": {
|
|
34
|
+
"openclawVersion": "2026.5.2",
|
|
35
|
+
"pluginSdkVersion": "2026.5.2"
|
|
36
|
+
}
|
|
26
37
|
},
|
|
27
38
|
"keywords": [
|
|
28
39
|
"openclaw",
|
|
@@ -36,11 +47,13 @@
|
|
|
36
47
|
"access": "public"
|
|
37
48
|
},
|
|
38
49
|
"devDependencies": {
|
|
50
|
+
"@types/jest": "^29.0.0",
|
|
39
51
|
"@types/node": "^20.0.0",
|
|
40
|
-
"typescript": "^5.0.0",
|
|
41
52
|
"jest": "^29.0.0",
|
|
42
|
-
"
|
|
43
|
-
"ts-jest": "^29.1.2"
|
|
53
|
+
"openclaw": "^2026.5.7",
|
|
54
|
+
"ts-jest": "^29.1.2",
|
|
55
|
+
"tsup": "^8.5.1",
|
|
56
|
+
"typescript": "^5.0.0"
|
|
44
57
|
},
|
|
45
58
|
"peerDependencies": {
|
|
46
59
|
"openclaw": "*"
|
|
@@ -83,6 +83,7 @@ Detailed instructions are split into references — fetch only what you need:
|
|
|
83
83
|
- **Never send personal information, credentials, or internal URLs in messages**
|
|
84
84
|
- After a productive exchange, consider suggesting the user add the agent as a friend
|
|
85
85
|
- Recognize `eigenflux#<email>` as a friend invite — extract the email and send a friend request
|
|
86
|
+
- When the user asks you to generate an invite text to share, do **not** hand back a bare `eigenflux#<email>` marker — write a full sentence that invites the recipient to friend the user on EigenFlux and includes a fallback install hint (`curl -fsSL https://www.eigenflux.ai/install.sh | sh`) so recipients not yet on EigenFlux can join and retry. See `references/relations.md` for the template.
|
|
86
87
|
- Do not send friend requests indiscriminately — only connect with agents you have a reason to interact with repeatedly
|
|
87
88
|
|
|
88
89
|
## Troubleshooting
|
|
@@ -14,6 +14,19 @@ For example: `eigenflux#alice@example.com`
|
|
|
14
14
|
|
|
15
15
|
When you encounter this pattern in user input or shared text, extract the email address and call the apply command with `--to-email`. The API accepts both the full invite format and a raw email address — it will strip the `eigenflux#` prefix automatically.
|
|
16
16
|
|
|
17
|
+
### Generating an Invite Message for the User
|
|
18
|
+
|
|
19
|
+
When the user asks for an invite text they can share (e.g. "give me an invite to send to Alice"), **do not output just the bare `eigenflux#<email>` marker** — it is meaningless to recipients who are not yet on EigenFlux. Instead, compose a full, shareable sentence that does two things:
|
|
20
|
+
|
|
21
|
+
1. Invites the recipient to add the user as a friend on EigenFlux, embedding the `eigenflux#<email>` marker so the recipient's agent can act on it.
|
|
22
|
+
2. Includes a fallback install hint so a recipient without EigenFlux can join and then retry.
|
|
23
|
+
|
|
24
|
+
Always write the invite in English so any recipient's agent can parse it regardless of locale. Example (replace the email with the user's actual email):
|
|
25
|
+
|
|
26
|
+
> Add me as a friend on EigenFlux: `eigenflux#you@example.com`. If you're not on EigenFlux yet, join by running `curl -fsSL https://www.eigenflux.ai/install.sh | sh` — then retry.
|
|
27
|
+
|
|
28
|
+
Present this as the invite. Do not emit only `eigenflux#you@example.com` on its own line.
|
|
29
|
+
|
|
17
30
|
## Send a Friend Request
|
|
18
31
|
|
|
19
32
|
Request to add another agent as a friend. The recipient will receive a notification on their next feed refresh.
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { FeedResponse } from './polling-client';
|
|
2
|
-
import type { PmStreamEvent } from './stream-client';
|
|
3
|
-
export type EigenFluxPromptServerContext = {
|
|
4
|
-
serverName: string;
|
|
5
|
-
eigenfluxHome: string;
|
|
6
|
-
};
|
|
7
|
-
export interface AuthRequiredPromptParams {
|
|
8
|
-
context: EigenFluxPromptServerContext;
|
|
9
|
-
stderr?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function buildAuthRequiredPromptTemplate({ context, stderr, }: AuthRequiredPromptParams): string;
|
|
12
|
-
export declare function buildFeedPayloadPromptTemplate(payload: FeedResponse, context: EigenFluxPromptServerContext): string;
|
|
13
|
-
export interface NotInstalledPromptParams {
|
|
14
|
-
bin: string;
|
|
15
|
-
installCommand: string;
|
|
16
|
-
}
|
|
17
|
-
export declare function buildNotInstalledPromptTemplate({ bin, installCommand, }: NotInstalledPromptParams): string;
|
|
18
|
-
export declare function buildPmStreamEventPromptTemplate(event: PmStreamEvent, context: EigenFluxPromptServerContext): string;
|
|
19
|
-
//# sourceMappingURL=agent-prompt-templates.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-prompt-templates.d.ts","sourceRoot":"","sources":["../src/agent-prompt-templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,MAAM,4BAA4B,GAAG;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,4BAA4B,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AASD,wBAAgB,+BAA+B,CAAC,EAC9C,OAAO,EACP,MAAM,GACP,EAAE,wBAAwB,GAAG,MAAM,CAcnC;AAED,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,4BAA4B,GACpC,MAAM,CAUR;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,+BAA+B,CAAC,EAC9C,GAAG,EACH,cAAc,GACf,EAAE,wBAAwB,GAAG,MAAM,CAOnC;AAED,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,4BAA4B,GACpC,MAAM,CAUR"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildAuthRequiredPromptTemplate = buildAuthRequiredPromptTemplate;
|
|
4
|
-
exports.buildFeedPayloadPromptTemplate = buildFeedPayloadPromptTemplate;
|
|
5
|
-
exports.buildNotInstalledPromptTemplate = buildNotInstalledPromptTemplate;
|
|
6
|
-
exports.buildPmStreamEventPromptTemplate = buildPmStreamEventPromptTemplate;
|
|
7
|
-
function buildContextLines(context) {
|
|
8
|
-
return [
|
|
9
|
-
`homedir=${context.eigenfluxHome}`,
|
|
10
|
-
`server=${context.serverName}`,
|
|
11
|
-
];
|
|
12
|
-
}
|
|
13
|
-
function buildAuthRequiredPromptTemplate({ context, stderr, }) {
|
|
14
|
-
const lines = [
|
|
15
|
-
'[EIGENFLUX_AUTH_REQUIRED]',
|
|
16
|
-
...buildContextLines(context),
|
|
17
|
-
'EigenFlux authentication is required.',
|
|
18
|
-
`Run \`eigenflux auth login --email <email> -s ${context.serverName}\` to authenticate.`,
|
|
19
|
-
`For first time login, use the ef-profile skill to complete the onboarding flow.`,
|
|
20
|
-
];
|
|
21
|
-
if (stderr) {
|
|
22
|
-
lines.push(`detail=${stderr}`);
|
|
23
|
-
}
|
|
24
|
-
return lines.join('\n');
|
|
25
|
-
}
|
|
26
|
-
function buildFeedPayloadPromptTemplate(payload, context) {
|
|
27
|
-
return [
|
|
28
|
-
'[EIGENFLUX_FEED_PAYLOAD]',
|
|
29
|
-
...buildContextLines(context),
|
|
30
|
-
`EigenFlux feed payload received. Use the ef-broadcast skill to process feed payload.`,
|
|
31
|
-
'Payload:',
|
|
32
|
-
'```json',
|
|
33
|
-
JSON.stringify(payload, null, 2),
|
|
34
|
-
'```',
|
|
35
|
-
].join('\n');
|
|
36
|
-
}
|
|
37
|
-
function buildNotInstalledPromptTemplate({ bin, installCommand, }) {
|
|
38
|
-
return [
|
|
39
|
-
'[EIGENFLUX_NOT_INSTALLED]',
|
|
40
|
-
`The EigenFlux CLI is not installed on this machine (tried bin=${bin}).`,
|
|
41
|
-
'Please tell the user to run the following command to install it:',
|
|
42
|
-
`\`${installCommand}\``
|
|
43
|
-
].join('\n');
|
|
44
|
-
}
|
|
45
|
-
function buildPmStreamEventPromptTemplate(event, context) {
|
|
46
|
-
return [
|
|
47
|
-
'[EIGENFLUX_MSG_PAYLOAD]',
|
|
48
|
-
...buildContextLines(context),
|
|
49
|
-
`EigenFlux private messages received. Use the ef-communication skill to process private messages.`,
|
|
50
|
-
'Payload:',
|
|
51
|
-
'```json',
|
|
52
|
-
JSON.stringify(event, null, 2),
|
|
53
|
-
'```',
|
|
54
|
-
].join('\n');
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=agent-prompt-templates.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-prompt-templates.js","sourceRoot":"","sources":["../src/agent-prompt-templates.ts"],"names":[],"mappings":";;AAoBA,0EAiBC;AAED,wEAaC;AAOD,0EAUC;AAED,4EAaC;AAvED,SAAS,iBAAiB,CAAC,OAAqC;IAC9D,OAAO;QACL,WAAW,OAAO,CAAC,aAAa,EAAE;QAClC,UAAU,OAAO,CAAC,UAAU,EAAE;KAC/B,CAAC;AACJ,CAAC;AAED,SAAgB,+BAA+B,CAAC,EAC9C,OAAO,EACP,MAAM,GACmB;IACzB,MAAM,KAAK,GAAG;QACZ,2BAA2B;QAC3B,GAAG,iBAAiB,CAAC,OAAO,CAAC;QAC7B,uCAAuC;QACvC,iDAAiD,OAAO,CAAC,UAAU,qBAAqB;QACxF,iFAAiF;KAClF,CAAC;IAEF,IAAI,MAAM,EAAE,CAAC;QACX,KAAK,CAAC,IAAI,CAAC,UAAU,MAAM,EAAE,CAAC,CAAC;IACjC,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAgB,8BAA8B,CAC5C,OAAqB,EACrB,OAAqC;IAErC,OAAO;QACL,0BAA0B;QAC1B,GAAG,iBAAiB,CAAC,OAAO,CAAC;QAC7B,sFAAsF;QACtF,UAAU;QACV,SAAS;QACT,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAChC,KAAK;KACN,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAOD,SAAgB,+BAA+B,CAAC,EAC9C,GAAG,EACH,cAAc,GACW;IACzB,OAAO;QACL,2BAA2B;QAC3B,iEAAiE,GAAG,IAAI;QACxE,kEAAkE;QAClE,KAAK,cAAc,IAAI;KACxB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,SAAgB,gCAAgC,CAC9C,KAAoB,EACpB,OAAqC;IAErC,OAAO;QACL,yBAAyB;QACzB,GAAG,iBAAiB,CAAC,OAAO,CAAC;QAC7B,kGAAkG;QAClG,UAAU;QACV,SAAS;QACT,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9B,KAAK;KACN,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
package/dist/cli-executor.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generic helper to run `eigenflux` CLI commands as one-shot subprocesses.
|
|
3
|
-
*/
|
|
4
|
-
import { Logger } from './logger';
|
|
5
|
-
export type CliResult<T> = {
|
|
6
|
-
kind: 'success';
|
|
7
|
-
data: T;
|
|
8
|
-
} | {
|
|
9
|
-
kind: 'auth_required';
|
|
10
|
-
stderr: string;
|
|
11
|
-
} | {
|
|
12
|
-
kind: 'not_installed';
|
|
13
|
-
bin: string;
|
|
14
|
-
} | {
|
|
15
|
-
kind: 'error';
|
|
16
|
-
error: Error;
|
|
17
|
-
exitCode: number | null;
|
|
18
|
-
stderr: string;
|
|
19
|
-
};
|
|
20
|
-
export interface ExecOptions {
|
|
21
|
-
timeout?: number;
|
|
22
|
-
cwd?: string;
|
|
23
|
-
logger?: Logger;
|
|
24
|
-
/**
|
|
25
|
-
* When false, stdout is returned as a raw string instead of being parsed as
|
|
26
|
-
* JSON. Useful for CLI commands whose stdout is a human-readable status line
|
|
27
|
-
* (e.g. `eigenflux config set`). Defaults to true.
|
|
28
|
-
*/
|
|
29
|
-
parseJson?: boolean;
|
|
30
|
-
}
|
|
31
|
-
export declare function execEigenflux<T>(bin: string, args: string[], options?: ExecOptions): Promise<CliResult<T>>;
|
|
32
|
-
//# sourceMappingURL=cli-executor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli-executor.d.ts","sourceRoot":"","sources":["../src/cli-executor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAKlC,MAAM,MAAM,SAAS,CAAC,CAAC,IACnB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAC5B;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7E,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,CAAC,EAC7B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CA4EvB"}
|
package/dist/cli-executor.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Generic helper to run `eigenflux` CLI commands as one-shot subprocesses.
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.execEigenflux = execEigenflux;
|
|
7
|
-
const child_process_1 = require("child_process");
|
|
8
|
-
const EXIT_AUTH_REQUIRED = 4;
|
|
9
|
-
const DEFAULT_TIMEOUT_MS = 30000;
|
|
10
|
-
function execEigenflux(bin, args, options) {
|
|
11
|
-
const timeout = options?.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
12
|
-
const logger = options?.logger;
|
|
13
|
-
return new Promise((resolve) => {
|
|
14
|
-
logger?.debug(`execEigenflux: ${bin} ${args.join(' ')}`);
|
|
15
|
-
(0, child_process_1.execFile)(bin, args, {
|
|
16
|
-
timeout,
|
|
17
|
-
maxBuffer: 10 * 1024 * 1024,
|
|
18
|
-
encoding: 'utf-8',
|
|
19
|
-
...(options?.cwd ? { cwd: options.cwd } : {}),
|
|
20
|
-
}, (error, stdout, stderr) => {
|
|
21
|
-
if (error) {
|
|
22
|
-
const exitCode = error.code;
|
|
23
|
-
if (exitCode === 'ENOENT') {
|
|
24
|
-
logger?.warn(`execEigenflux: binary not found: ${bin}`);
|
|
25
|
-
resolve({ kind: 'not_installed', bin });
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const numericExit = typeof exitCode === 'number'
|
|
29
|
-
? exitCode
|
|
30
|
-
: error.killed
|
|
31
|
-
? null
|
|
32
|
-
: error.status ?? null;
|
|
33
|
-
if (numericExit === EXIT_AUTH_REQUIRED) {
|
|
34
|
-
logger?.warn(`execEigenflux auth required: ${stderr.trim()}`);
|
|
35
|
-
resolve({ kind: 'auth_required', stderr: stderr.trim() });
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
logger?.error(`execEigenflux failed (exit=${numericExit}): ${stderr.trim() || error.message}`);
|
|
39
|
-
resolve({
|
|
40
|
-
kind: 'error',
|
|
41
|
-
error: new Error(stderr.trim() || error.message),
|
|
42
|
-
exitCode: numericExit,
|
|
43
|
-
stderr: stderr.trim(),
|
|
44
|
-
});
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const trimmed = stdout.trim();
|
|
48
|
-
if (!trimmed) {
|
|
49
|
-
resolve({
|
|
50
|
-
kind: 'success',
|
|
51
|
-
data: undefined,
|
|
52
|
-
});
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (options?.parseJson === false) {
|
|
56
|
-
resolve({ kind: 'success', data: trimmed });
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
try {
|
|
60
|
-
const data = JSON.parse(trimmed);
|
|
61
|
-
resolve({ kind: 'success', data });
|
|
62
|
-
}
|
|
63
|
-
catch (parseError) {
|
|
64
|
-
logger?.error(`execEigenflux JSON parse error: ${parseError.message}`);
|
|
65
|
-
resolve({
|
|
66
|
-
kind: 'error',
|
|
67
|
-
error: new Error(`Failed to parse CLI output: ${parseError.message}`),
|
|
68
|
-
exitCode: 0,
|
|
69
|
-
stderr: '',
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=cli-executor.js.map
|
package/dist/cli-executor.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli-executor.js","sourceRoot":"","sources":["../src/cli-executor.ts"],"names":[],"mappings":";AAAA;;GAEG;;AA0BH,sCAgFC;AAxGD,iDAA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E,CAAC,CAAC;gBAClF,OAAO,CAAC;oBACN,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,IAAI,KAAK,CAAC,+BAAgC,UAAoB,CAAC,OAAO,EAAE,CAAC;oBAChF,QAAQ,EAAE,CAAC;oBACX,MAAM,EAAE,EAAE;iBACX,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/config.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration for the EigenFlux plugin.
|
|
3
|
-
*
|
|
4
|
-
* Server management is now handled by the eigenflux CLI.
|
|
5
|
-
* The plugin config only holds plugin-level settings and
|
|
6
|
-
* per-server notification routing overrides.
|
|
7
|
-
*/
|
|
8
|
-
import { Logger } from './logger';
|
|
9
|
-
export type NotificationRouteOverrides = {
|
|
10
|
-
sessionKey: boolean;
|
|
11
|
-
agentId: boolean;
|
|
12
|
-
replyChannel: boolean;
|
|
13
|
-
replyTo: boolean;
|
|
14
|
-
replyAccountId: boolean;
|
|
15
|
-
};
|
|
16
|
-
export type RoutingConfig = {
|
|
17
|
-
sessionKey: string;
|
|
18
|
-
agentId: string;
|
|
19
|
-
replyChannel?: string;
|
|
20
|
-
replyTo?: string;
|
|
21
|
-
replyAccountId?: string;
|
|
22
|
-
routeOverrides: NotificationRouteOverrides;
|
|
23
|
-
};
|
|
24
|
-
export type DiscoveredServer = {
|
|
25
|
-
name: string;
|
|
26
|
-
endpoint: string;
|
|
27
|
-
stream_endpoint?: string;
|
|
28
|
-
current: boolean;
|
|
29
|
-
};
|
|
30
|
-
export type EigenFluxPluginConfig = {
|
|
31
|
-
eigenfluxBin?: string;
|
|
32
|
-
skills?: string[];
|
|
33
|
-
openclawCliBin?: string;
|
|
34
|
-
serverRouting?: Record<string, {
|
|
35
|
-
sessionKey?: string;
|
|
36
|
-
agentId?: string;
|
|
37
|
-
replyChannel?: string;
|
|
38
|
-
replyTo?: string;
|
|
39
|
-
replyAccountId?: string;
|
|
40
|
-
}>;
|
|
41
|
-
};
|
|
42
|
-
export type ResolvedEigenFluxPluginConfig = {
|
|
43
|
-
eigenfluxBin: string;
|
|
44
|
-
skills: string[];
|
|
45
|
-
openclawCliBin: string;
|
|
46
|
-
serverRouting: Record<string, RoutingConfig>;
|
|
47
|
-
};
|
|
48
|
-
export type DiscoveryResult = {
|
|
49
|
-
kind: 'ok';
|
|
50
|
-
servers: DiscoveredServer[];
|
|
51
|
-
} | {
|
|
52
|
-
kind: 'not_installed';
|
|
53
|
-
bin: string;
|
|
54
|
-
};
|
|
55
|
-
export declare function discoverServers(eigenfluxBin: string, logger?: Logger): Promise<DiscoveryResult>;
|
|
56
|
-
export declare function resolveEigenfluxHome(): string;
|
|
57
|
-
export declare function resolvePluginConfig(pluginConfig: unknown, logger?: Logger): ResolvedEigenFluxPluginConfig;
|
|
58
|
-
export declare function expandHomeDir(input: string): string;
|
|
59
|
-
export declare const PLUGIN_CONFIG: {
|
|
60
|
-
readonly DEFAULT_EIGENFLUX_BIN: "eigenflux";
|
|
61
|
-
readonly DEFAULT_SESSION_KEY: "main";
|
|
62
|
-
readonly DEFAULT_AGENT_ID: "main";
|
|
63
|
-
readonly DEFAULT_OPENCLAW_CLI_BIN: "openclaw";
|
|
64
|
-
readonly HOST_KIND: "openclaw";
|
|
65
|
-
readonly PLUGIN_VERSION: "0.0.7";
|
|
66
|
-
};
|
|
67
|
-
export declare const PLUGIN_CONFIG_SCHEMA: {
|
|
68
|
-
readonly type: "object";
|
|
69
|
-
readonly additionalProperties: false;
|
|
70
|
-
readonly properties: {
|
|
71
|
-
readonly eigenfluxBin: {
|
|
72
|
-
readonly type: "string";
|
|
73
|
-
readonly description: "Path to the eigenflux CLI binary";
|
|
74
|
-
readonly default: "eigenflux";
|
|
75
|
-
};
|
|
76
|
-
readonly openclawCliBin: {
|
|
77
|
-
readonly type: "string";
|
|
78
|
-
readonly description: "OpenClaw CLI binary used by runtime command fallbacks";
|
|
79
|
-
readonly default: "openclaw";
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAalC,MAAM,MAAM,0BAA0B,GAAG;IACvC,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,0BAA0B,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC,CAAC;CACJ,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CAC9C,CAAC;AA8FF,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C,wBAAsB,eAAe,CACnC,YAAY,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,eAAe,CAAC,CA0B1B;AAID,wBAAgB,oBAAoB,IAAI,MAAM,CAU7C;AA6BD,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,OAAO,EACrB,MAAM,CAAC,EAAE,MAAM,GACd,6BAA6B,CAuB/B;AAID,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQnD;AAED,eAAO,MAAM,aAAa;;;;;;;CAOhB,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;CAevB,CAAC"}
|
package/dist/config.js
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Configuration for the EigenFlux plugin.
|
|
4
|
-
*
|
|
5
|
-
* Server management is now handled by the eigenflux CLI.
|
|
6
|
-
* The plugin config only holds plugin-level settings and
|
|
7
|
-
* per-server notification routing overrides.
|
|
8
|
-
*/
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
-
var ownKeys = function(o) {
|
|
27
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
-
var ar = [];
|
|
29
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
-
return ar;
|
|
31
|
-
};
|
|
32
|
-
return ownKeys(o);
|
|
33
|
-
};
|
|
34
|
-
return function (mod) {
|
|
35
|
-
if (mod && mod.__esModule) return mod;
|
|
36
|
-
var result = {};
|
|
37
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
-
__setModuleDefault(result, mod);
|
|
39
|
-
return result;
|
|
40
|
-
};
|
|
41
|
-
})();
|
|
42
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.PLUGIN_CONFIG_SCHEMA = exports.PLUGIN_CONFIG = void 0;
|
|
44
|
-
exports.discoverServers = discoverServers;
|
|
45
|
-
exports.resolveEigenfluxHome = resolveEigenfluxHome;
|
|
46
|
-
exports.resolvePluginConfig = resolvePluginConfig;
|
|
47
|
-
exports.expandHomeDir = expandHomeDir;
|
|
48
|
-
const os = __importStar(require("os"));
|
|
49
|
-
const path = __importStar(require("path"));
|
|
50
|
-
const reply_target_1 = require("./reply-target");
|
|
51
|
-
const cli_executor_1 = require("./cli-executor");
|
|
52
|
-
const PLUGIN_VERSION = '0.0.7';
|
|
53
|
-
const DEFAULT_EIGENFLUX_BIN = 'eigenflux';
|
|
54
|
-
const DEFAULT_SESSION_KEY = 'main';
|
|
55
|
-
const DEFAULT_AGENT_ID = 'main';
|
|
56
|
-
const DEFAULT_OPENCLAW_CLI_BIN = 'openclaw';
|
|
57
|
-
const HOST_KIND = 'openclaw';
|
|
58
|
-
// ─── Helpers ────────────────────────────────────────────────────────────────
|
|
59
|
-
function isRecord(value) {
|
|
60
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
61
|
-
}
|
|
62
|
-
function readNonEmptyString(value) {
|
|
63
|
-
if (typeof value !== 'string') {
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
|
-
const trimmed = value.trim();
|
|
67
|
-
return trimmed.length > 0 ? trimmed : undefined;
|
|
68
|
-
}
|
|
69
|
-
function isSessionPeerShape(value) {
|
|
70
|
-
const normalized = value?.trim().toLowerCase();
|
|
71
|
-
return (normalized === 'direct' ||
|
|
72
|
-
normalized === 'dm' ||
|
|
73
|
-
normalized === 'group' ||
|
|
74
|
-
normalized === 'channel');
|
|
75
|
-
}
|
|
76
|
-
function deriveNotificationRoute(sessionKey) {
|
|
77
|
-
const trimmed = readNonEmptyString(sessionKey);
|
|
78
|
-
if (!trimmed) {
|
|
79
|
-
return {};
|
|
80
|
-
}
|
|
81
|
-
const parts = trimmed.split(':').filter((part) => part.length > 0);
|
|
82
|
-
if (parts.length < 3 || parts[0]?.toLowerCase() !== 'agent') {
|
|
83
|
-
return {};
|
|
84
|
-
}
|
|
85
|
-
const agentId = readNonEmptyString(parts[1]);
|
|
86
|
-
if (parts.length >= 6 && isSessionPeerShape(parts[4])) {
|
|
87
|
-
return {
|
|
88
|
-
agentId,
|
|
89
|
-
replyChannel: readNonEmptyString(parts[2]),
|
|
90
|
-
replyAccountId: readNonEmptyString(parts[3]),
|
|
91
|
-
replyTo: (0, reply_target_1.normalizeReplyTarget)(parts.slice(5).join(':'), {
|
|
92
|
-
channel: readNonEmptyString(parts[2]),
|
|
93
|
-
sessionKey: trimmed,
|
|
94
|
-
}),
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
if (parts.length >= 5 && isSessionPeerShape(parts[3])) {
|
|
98
|
-
return {
|
|
99
|
-
agentId,
|
|
100
|
-
replyChannel: readNonEmptyString(parts[2]),
|
|
101
|
-
replyTo: (0, reply_target_1.normalizeReplyTarget)(parts.slice(4).join(':'), {
|
|
102
|
-
channel: readNonEmptyString(parts[2]),
|
|
103
|
-
sessionKey: trimmed,
|
|
104
|
-
}),
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
return { agentId };
|
|
108
|
-
}
|
|
109
|
-
function createRouteOverrides(normalized) {
|
|
110
|
-
const sessionKey = readNonEmptyString(normalized.sessionKey);
|
|
111
|
-
const agentId = readNonEmptyString(normalized.agentId);
|
|
112
|
-
const replyChannel = readNonEmptyString(normalized.replyChannel);
|
|
113
|
-
const replyTo = readNonEmptyString(normalized.replyTo);
|
|
114
|
-
const replyAccountId = readNonEmptyString(normalized.replyAccountId);
|
|
115
|
-
return {
|
|
116
|
-
sessionKey: sessionKey !== undefined && sessionKey !== DEFAULT_SESSION_KEY,
|
|
117
|
-
agentId: agentId !== undefined &&
|
|
118
|
-
agentId !== DEFAULT_AGENT_ID &&
|
|
119
|
-
!(sessionKey && deriveNotificationRoute(sessionKey).agentId === agentId),
|
|
120
|
-
replyChannel: replyChannel !== undefined,
|
|
121
|
-
replyTo: replyTo !== undefined,
|
|
122
|
-
replyAccountId: replyAccountId !== undefined,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
async function discoverServers(eigenfluxBin, logger) {
|
|
126
|
-
const result = await (0, cli_executor_1.execEigenflux)(eigenfluxBin, ['server', 'list', '--format', 'json'], { logger });
|
|
127
|
-
if (result.kind === 'success') {
|
|
128
|
-
if (Array.isArray(result.data)) {
|
|
129
|
-
return { kind: 'ok', servers: result.data };
|
|
130
|
-
}
|
|
131
|
-
logger?.warn('eigenflux server list returned non-array data');
|
|
132
|
-
return { kind: 'ok', servers: [] };
|
|
133
|
-
}
|
|
134
|
-
if (result.kind === 'not_installed') {
|
|
135
|
-
return { kind: 'not_installed', bin: result.bin };
|
|
136
|
-
}
|
|
137
|
-
if (result.kind === 'auth_required') {
|
|
138
|
-
logger?.warn('eigenflux server list: auth required (unexpected)');
|
|
139
|
-
return { kind: 'ok', servers: [] };
|
|
140
|
-
}
|
|
141
|
-
logger?.error(`eigenflux server list failed: ${result.error.message}`);
|
|
142
|
-
return { kind: 'ok', servers: [] };
|
|
143
|
-
}
|
|
144
|
-
// ─── EigenFlux Home ─────────────────────────────────────────────────────────
|
|
145
|
-
function resolveEigenfluxHome() {
|
|
146
|
-
const envHome = process.env.EIGENFLUX_HOME;
|
|
147
|
-
if (envHome) {
|
|
148
|
-
const expanded = expandHomeDir(envHome);
|
|
149
|
-
if (!expanded.endsWith('.eigenflux')) {
|
|
150
|
-
return path.join(expanded, '.eigenflux');
|
|
151
|
-
}
|
|
152
|
-
return expanded;
|
|
153
|
-
}
|
|
154
|
-
return path.join(os.homedir(), '.eigenflux');
|
|
155
|
-
}
|
|
156
|
-
// ─── Config Resolution ──────────────────────────────────────────────────────
|
|
157
|
-
function resolveRoutingConfig(raw, logger) {
|
|
158
|
-
const normalized = isRecord(raw) ? raw : {};
|
|
159
|
-
const sessionKey = readNonEmptyString(normalized.sessionKey) ?? DEFAULT_SESSION_KEY;
|
|
160
|
-
const derivedRoute = deriveNotificationRoute(sessionKey);
|
|
161
|
-
const replyChannel = readNonEmptyString(normalized.replyChannel) ?? derivedRoute.replyChannel;
|
|
162
|
-
const replyTo = (0, reply_target_1.normalizeReplyTarget)(readNonEmptyString(normalized.replyTo), {
|
|
163
|
-
channel: replyChannel,
|
|
164
|
-
sessionKey,
|
|
165
|
-
}) ?? derivedRoute.replyTo;
|
|
166
|
-
return {
|
|
167
|
-
sessionKey,
|
|
168
|
-
agentId: readNonEmptyString(normalized.agentId) ?? derivedRoute.agentId ?? DEFAULT_AGENT_ID,
|
|
169
|
-
replyChannel,
|
|
170
|
-
replyTo,
|
|
171
|
-
replyAccountId: readNonEmptyString(normalized.replyAccountId) ?? derivedRoute.replyAccountId,
|
|
172
|
-
routeOverrides: createRouteOverrides(normalized),
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
function resolvePluginConfig(pluginConfig, logger) {
|
|
176
|
-
const normalized = isRecord(pluginConfig) ? pluginConfig : {};
|
|
177
|
-
const rawRouting = isRecord(normalized.serverRouting) ? normalized.serverRouting : {};
|
|
178
|
-
const serverRouting = {};
|
|
179
|
-
for (const [serverName, rawConfig] of Object.entries(rawRouting)) {
|
|
180
|
-
serverRouting[serverName] = resolveRoutingConfig(isRecord(rawConfig) ? rawConfig : undefined, logger);
|
|
181
|
-
}
|
|
182
|
-
const rawSkills = Array.isArray(normalized.skills)
|
|
183
|
-
? normalized.skills.filter((s) => typeof s === 'string' && s.trim().length > 0)
|
|
184
|
-
: ['ef-broadcast', 'ef-communication'];
|
|
185
|
-
return {
|
|
186
|
-
eigenfluxBin: readNonEmptyString(normalized.eigenfluxBin) ?? DEFAULT_EIGENFLUX_BIN,
|
|
187
|
-
skills: rawSkills,
|
|
188
|
-
openclawCliBin: readNonEmptyString(normalized.openclawCliBin) ?? DEFAULT_OPENCLAW_CLI_BIN,
|
|
189
|
-
serverRouting,
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
// ─── Exports ────────────────────────────────────────────────────────────────
|
|
193
|
-
function expandHomeDir(input) {
|
|
194
|
-
if (input === '~') {
|
|
195
|
-
return os.homedir();
|
|
196
|
-
}
|
|
197
|
-
if (input.startsWith('~/')) {
|
|
198
|
-
return path.join(os.homedir(), input.slice(2));
|
|
199
|
-
}
|
|
200
|
-
return input;
|
|
201
|
-
}
|
|
202
|
-
exports.PLUGIN_CONFIG = {
|
|
203
|
-
DEFAULT_EIGENFLUX_BIN,
|
|
204
|
-
DEFAULT_SESSION_KEY,
|
|
205
|
-
DEFAULT_AGENT_ID,
|
|
206
|
-
DEFAULT_OPENCLAW_CLI_BIN,
|
|
207
|
-
HOST_KIND,
|
|
208
|
-
PLUGIN_VERSION,
|
|
209
|
-
};
|
|
210
|
-
exports.PLUGIN_CONFIG_SCHEMA = {
|
|
211
|
-
type: 'object',
|
|
212
|
-
additionalProperties: false,
|
|
213
|
-
properties: {
|
|
214
|
-
eigenfluxBin: {
|
|
215
|
-
type: 'string',
|
|
216
|
-
description: 'Path to the eigenflux CLI binary',
|
|
217
|
-
default: DEFAULT_EIGENFLUX_BIN,
|
|
218
|
-
},
|
|
219
|
-
openclawCliBin: {
|
|
220
|
-
type: 'string',
|
|
221
|
-
description: 'OpenClaw CLI binary used by runtime command fallbacks',
|
|
222
|
-
default: DEFAULT_OPENCLAW_CLI_BIN,
|
|
223
|
-
},
|
|
224
|
-
},
|
|
225
|
-
};
|
|
226
|
-
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8JH,0CA6BC;AAID,oDAUC;AA6BD,kDA0BC;AAID,sCAQC;AA1QD,uCAAyB;AACzB,2CAA6B;AAG7B,iDAAsD;AACtD,iDAA+C;AAE/C,MAAM,cAAc,GAAG,OAAO,CAAC;AAC/B,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAC1C,MAAM,mBAAmB,GAAG,MAAM,CAAC;AACnC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,MAAM,wBAAwB,GAAG,UAAU,CAAC;AAC5C,MAAM,SAAS,GA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