@spark-strategic/helix-core 0.1.1 → 0.1.3

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 CHANGED
@@ -1,75 +1,26 @@
1
1
  # @spark-strategic/helix-core
2
2
 
3
- The local companion you run to connect a **personal agent** to Helix — and the
4
- home for future local Helix tooling (e.g. an MCP server). Thin by design: it owns
5
- a WebSocket to `agents-api` and the chat-turn protocol, and delegates the actual
6
- answering to a pluggable **adapter**.
3
+ Connect a personal agent to [Helix](https://helix.spark-strategic.ai).
7
4
 
8
- > This package is intended to be installed from public npm and run wherever your
9
- > agent lives. It never needs to run inside the Helix cloud.
5
+ Create a personal agent in Helix, then run the command shown on its page:
10
6
 
11
- ## Quick start
12
-
13
- ```bash
14
- npm i -g @spark-strategic/helix-core
15
-
16
- export HELIX_CONNECTOR_SLUG=my-agent # PersonalAgent.slug
17
- export HELIX_CONNECTOR_KEY=… # connector shared secret
18
- helix-core connect
19
7
  ```
20
-
21
- Config resolves from (low → high precedence): built-in defaults, a `connector`
22
- block in `~/.helix/config.json`, environment variables, then CLI flags.
23
-
24
- | Setting | Env | Flag |
25
- |---|---|---|
26
- | agents-api base URL | `HELIX_AGENTS_API_URL` | `--url` |
27
- | PersonalAgent slug | `HELIX_CONNECTOR_SLUG` | `--slug` |
28
- | Connector key | `HELIX_CONNECTOR_KEY` | `--key` |
29
-
30
- ## Bring your own agent
31
-
32
- The built-in `echo` adapter just streams your message back. To connect a real
33
- agent, embed the library and pass your own `AgentAdapter`:
34
-
35
- ```ts
36
- import { Connector, resolveConfig, packageInfo, type AgentAdapter } from '@spark-strategic/helix-core';
37
-
38
- const myAdapter: AgentAdapter = {
39
- name: 'my-agent',
40
- version: '1.0.0',
41
- async runTurn(ctx, emit) {
42
- emit.status('thinking');
43
- for await (const chunk of myModel(ctx.message, { signal: ctx.signal })) {
44
- emit.delta(chunk);
45
- }
46
- return { costUsd: 0 }; // optional attribution for the Helix ledger
47
- },
48
- };
49
-
50
- new Connector({ config: resolveConfig(), adapter: myAdapter, client: packageInfo() }).start();
8
+ npm i -g @spark-strategic/helix-core
9
+ helix-core init openclaw --token <personal agent token>
51
10
  ```
52
11
 
53
- - Resolve `runTurn` = the turn succeeded (a `chat_done` is emitted for you).
54
- - Throw = it failed (a `chat_error` is emitted with the message).
55
- - Honor `ctx.signal` — it aborts when the user hits stop or the socket drops.
56
-
57
- ## Compatibility
58
-
59
- The client and the Helix server version independently, so the wire protocol is
60
- deliberately conservative:
12
+ That's the whole setup. `init` enrolls the agent from your token, prepares the
13
+ local OpenClaw gateway, and stays connected so the agent is live in Helix. Nothing
14
+ else to configure.
61
15
 
62
- - **`PROTOCOL_VERSION`** is bumped only on a *breaking* wire change. Additive
63
- features are announced via `capabilities` on the connect handshake instead —
64
- so an old connector and a new server (or vice-versa) still interoperate.
65
- - **Unknown inbound frames are ignored**, never fatal. Helix can add new frames
66
- without breaking older connectors.
67
- - On connect the client sends a `connector_hello` with its package version, which
68
- Helix records so it can nudge you when a newer release is available. You are
69
- never *forced* to update unless a minimum version is enforced server-side.
16
+ ## Notes
70
17
 
71
- ## Extending
18
+ - Your **personal agent token** comes from the agent's page in Helix — copy the
19
+ command straight from there.
20
+ - Re-running `init` is safe.
21
+ - The agent stays online while the command runs. To run it under a process
22
+ manager instead, add `--no-connect` and start it separately with
23
+ `helix-core connect --adapter openclaw`.
24
+ - `helix-core help` lists every option.
72
25
 
73
- Additional package tools are added as **new CLI subcommands** (beside `connect`),
74
- not by overloading the adapter interface. The adapter is only the personal-agent
75
- chat seam.
26
+ MIT © Spark Strategic
package/dist/cli.js CHANGED
@@ -11,6 +11,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
11
11
  const config_1 = require("./config");
12
12
  const connector_1 = require("./connector");
13
13
  const adapter_1 = require("./adapter");
14
+ const openclaw_adapter_1 = require("./openclaw-adapter");
15
+ const init_1 = require("./init");
14
16
  const version_1 = require("./version");
15
17
  /** Minimal flag parser: `--key value`, `--key=value`, and boolean `--flag`. */
16
18
  function parseArgs(argv) {
@@ -18,6 +20,11 @@ function parseArgs(argv) {
18
20
  const flags = {};
19
21
  for (let i = 0; i < rest.length; i += 1) {
20
22
  const arg = rest[i];
23
+ // Single-dash boolean short flags (e.g. `-y`).
24
+ if (/^-[a-zA-Z]$/.test(arg)) {
25
+ flags[arg.slice(1)] = true;
26
+ continue;
27
+ }
21
28
  if (!arg.startsWith('--'))
22
29
  continue;
23
30
  const body = arg.slice(2);
@@ -45,20 +52,27 @@ function overridesFromFlags(flags) {
45
52
  o.key = flags.key;
46
53
  return o;
47
54
  }
48
- /** Resolve the adapter named by `--adapter`. Only the reference echo adapter ships
49
- * in-box; real adapters are expected to embed the library, not go through the CLI.
50
- * Kept as a lookup so additional built-ins can be registered later. */
51
- function selectAdapter(name) {
55
+ /** Resolve the adapter named by `--adapter`. The `echo` reference and the
56
+ * `openclaw` gateway bridge ship in-box; other custom agents are expected to
57
+ * embed the library and pass their own AgentAdapter rather than go through the
58
+ * CLI. Kept as a lookup so additional built-ins can be registered later. */
59
+ function selectAdapter(name, flags) {
52
60
  switch ((name ?? 'echo').toLowerCase()) {
53
61
  case 'echo':
54
62
  return new adapter_1.EchoAdapter();
63
+ case 'openclaw':
64
+ return new openclaw_adapter_1.OpenClawAdapter({
65
+ baseUrl: typeof flags['openclaw-url'] === 'string' ? flags['openclaw-url'] : undefined,
66
+ token: typeof flags['openclaw-token'] === 'string' ? flags['openclaw-token'] : undefined,
67
+ agentId: typeof flags['openclaw-agent'] === 'string' ? flags['openclaw-agent'] : undefined,
68
+ });
55
69
  default:
56
- throw new Error(`Unknown adapter "${name}". Built-in: echo. For a custom agent, embed the library and pass your own AgentAdapter.`);
70
+ throw new Error(`Unknown adapter "${name}". Built-in: echo, openclaw. For a custom agent, embed the library and pass your own AgentAdapter.`);
57
71
  }
58
72
  }
59
73
  function runConnect(flags) {
60
74
  const config = (0, config_1.resolveConfig)(overridesFromFlags(flags));
61
- const adapter = selectAdapter(typeof flags.adapter === 'string' ? flags.adapter : undefined);
75
+ const adapter = selectAdapter(typeof flags.adapter === 'string' ? flags.adapter : undefined, flags);
62
76
  const client = (0, version_1.packageInfo)();
63
77
  const connector = new connector_1.Connector({ config, adapter, client });
64
78
  connector.start();
@@ -70,21 +84,23 @@ function runConnect(flags) {
70
84
  process.on('SIGINT', () => shutdown('SIGINT'));
71
85
  process.on('SIGTERM', () => shutdown('SIGTERM'));
72
86
  }
73
- const HELP = `helix-core — connect a personal agent (and future tools) to Helix
87
+ const HELP = `helix-core — connect a personal agent to Helix
88
+
89
+ Setup (one command, from your agent's page in Helix):
90
+ helix-core init openclaw --token <personal agent token>
74
91
 
75
- Usage:
76
- helix-core connect [options] Attach as a PersonalAgent and service chat turns
77
- helix-core version Print package + protocol version
78
- helix-core help Show this help
92
+ That enrolls the agent, prepares the local OpenClaw gateway, and stays connected.
79
93
 
80
- Options (connect):
81
- --url <url> agents-api base URL (default: https://agents-api.spark-strategic.ai)
82
- --slug <slug> PersonalAgent slug to attach as
83
- --key <key> Connector shared secret
84
- --adapter <name> Built-in adapter to run (default: echo)
94
+ Other commands:
95
+ helix-core version Print package + protocol version
96
+ helix-core help Show this help
85
97
 
86
- Config also resolves from ~/.helix/config.json (a "connector" block) and env:
87
- HELIX_AGENTS_API_URL, HELIX_CONNECTOR_SLUG, HELIX_CONNECTOR_KEY
98
+ Options (init openclaw):
99
+ --token <token> Personal agent token from Helix (required for first setup)
100
+ --yes, -y Skip the pre-restart confirmation prompt
101
+ --no-restart Configure only; don't restart the gateway
102
+ --no-connect Configure only; don't stay attached after setup
103
+ --agent <id> OpenClaw agent id to route turns to (default: main)
88
104
  `;
89
105
  function main() {
90
106
  const { command, flags } = parseArgs(process.argv.slice(2));
@@ -107,6 +123,27 @@ function main() {
107
123
  process.exit(1);
108
124
  }
109
125
  break;
126
+ case 'init': {
127
+ // `init <target>` — target is the first positional after the command.
128
+ const target = process.argv.slice(3).find((a) => !a.startsWith('-'));
129
+ if (target !== 'openclaw') {
130
+ console.error(`[helix-core] unknown init target "${target ?? ''}" — supported: openclaw\n`);
131
+ console.log(HELP);
132
+ process.exit(1);
133
+ }
134
+ (0, init_1.runInitOpenClaw)({
135
+ token: typeof flags.token === 'string' ? flags.token : undefined,
136
+ yes: flags.yes === true || flags.y === true,
137
+ noRestart: flags['no-restart'] === true,
138
+ noConnect: flags['no-connect'] === true,
139
+ agent: typeof flags.agent === 'string' ? flags.agent : undefined,
140
+ url: typeof flags.url === 'string' ? flags.url : undefined,
141
+ }).catch((err) => {
142
+ console.error(`[helix-core] ${err instanceof Error ? err.message : String(err)}`);
143
+ process.exit(1);
144
+ });
145
+ break;
146
+ }
110
147
  default:
111
148
  console.error(`[helix-core] unknown command "${command}"\n`);
112
149
  console.log(HELP);
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AACA;;;;;;GAMG;;AAEH,qCAA+D;AAC/D,2CAAwC;AACxC,uCAA2D;AAC3D,uCAA0D;AAO1D,+EAA+E;AAC/E,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,CAAC,OAAO,GAAG,SAAS,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAC5C,MAAM,KAAK,GAAqC,EAAE,CAAC;IACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,SAAS;QACpC,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC1B,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,EAAE,IAAI,CAAC,EAAE,CA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AC,KAAK,CAAC,CAAC,CAAC,SAAS;gBAChE,GAAG,EAAE,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS;aAC3D,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACf,OAAO,CAAC,KAAK,CAAC,gBAAgB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAClF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;YACH,MAAM;QACR,CAAC;QACD;YACE,OAAO,CAAC,KAAK,CAAC,iCAAiC,OAAO,KAAK,CAAC,CAAC;YAC7D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
package/dist/config.d.ts CHANGED
@@ -14,6 +14,11 @@ export interface ConnectorConfig {
14
14
  /** Shared secret presented on the socket. Matches PersonalAgent.connectorKey. */
15
15
  key: string;
16
16
  }
17
+ export declare const DEFAULT_AGENTS_API_URL = "https://agents-api.spark-strategic.ai";
18
+ /** Resolve the agents-api base URL from (low → high): default, ~/.helix
19
+ * config, env, explicit override. Used by enrollment before a full connector
20
+ * config exists (there's no slug/key yet at that point). */
21
+ export declare function resolveAgentsApiUrl(override?: string): string;
17
22
  export type ConfigOverrides = Partial<ConnectorConfig>;
18
23
  /**
19
24
  * Resolve the effective connector config. Throws a clear error if a required
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,YAAY,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,GAAG,EAAE,MAAM,CAAC;CACb;AAID,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAkBvD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,SAAS,GAAE,eAAoB,GAAG,eAAe,CAiC9E;AAED,8DAA8D;AAC9D,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAG9D"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,YAAY,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,sBAAsB,0CAA0C,CAAC;AAE9E;;6DAE6D;AAC7D,wBAAgB,mBAAmB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAY7D;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAkBvD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,SAAS,GAAE,eAAoB,GAAG,eAAe,CAiC9E;AAED,8DAA8D;AAC9D,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAG9D"}
package/dist/config.js CHANGED
@@ -41,12 +41,28 @@ var __importStar = (this && this.__importStar) || (function () {
41
41
  };
42
42
  })();
43
43
  Object.defineProperty(exports, "__esModule", { value: true });
44
+ exports.DEFAULT_AGENTS_API_URL = void 0;
45
+ exports.resolveAgentsApiUrl = resolveAgentsApiUrl;
44
46
  exports.resolveConfig = resolveConfig;
45
47
  exports.connectorWsUrl = connectorWsUrl;
46
48
  const fs = __importStar(require("fs"));
47
49
  const os = __importStar(require("os"));
48
50
  const path = __importStar(require("path"));
49
- const DEFAULT_AGENTS_API_URL = 'https://agents-api.spark-strategic.ai';
51
+ exports.DEFAULT_AGENTS_API_URL = 'https://agents-api.spark-strategic.ai';
52
+ /** Resolve the agents-api base URL from (low → high): default, ~/.helix
53
+ * config, env, explicit override. Used by enrollment before a full connector
54
+ * config exists (there's no slug/key yet at that point). */
55
+ function resolveAgentsApiUrl(override) {
56
+ const file = readConfigFile();
57
+ const fileConnector = (file.connector && typeof file.connector === 'object'
58
+ ? file.connector
59
+ : {});
60
+ return (str(override) ??
61
+ str(process.env.HELIX_AGENTS_API_URL) ??
62
+ str(fileConnector.agentsApiUrl) ??
63
+ str(file.agentsApiUrl) ??
64
+ exports.DEFAULT_AGENTS_API_URL);
65
+ }
50
66
  function readConfigFile() {
51
67
  const configPath = path.join(os.homedir(), '.helix', 'config.json');
52
68
  if (!fs.existsSync(configPath))
@@ -78,7 +94,7 @@ function resolveConfig(overrides = {}) {
78
94
  str(process.env.HELIX_AGENTS_API_URL) ??
79
95
  str(fileConnector.agentsApiUrl) ??
80
96
  str(file.agentsApiUrl) ??
81
- DEFAULT_AGENTS_API_URL;
97
+ exports.DEFAULT_AGENTS_API_URL;
82
98
  const slug = overrides.slug ??
83
99
  str(process.env.HELIX_CONNECTOR_SLUG) ??
84
100
  str(fileConnector.slug);
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCH,sCAiCC;AAGD,wCAGC;AA5ED,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAW7B,MAAM,sBAAsB,GAAG,uCAAuC,CAAC;AAIvE,SAAS,cAAc;IACrB,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;IACpE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU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CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC5E,OAAO,GAAG,IAAI,iBAAiB,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,kBAAkB,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;AACzG,CAAC"}
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  */
8
8
  export * from './protocol';
9
9
  export * from './adapter';
10
+ export * from './openclaw-adapter';
10
11
  export * from './config';
11
12
  export * from './connector';
12
13
  export { packageInfo, PROTOCOL_VERSION } from './version';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.PROTOCOL_VERSION = exports.packageInfo = void 0;
25
25
  __exportStar(require("./protocol"), exports);
26
26
  __exportStar(require("./adapter"), exports);
27
+ __exportStar(require("./openclaw-adapter"), exports);
27
28
  __exportStar(require("./config"), exports);
28
29
  __exportStar(require("./connector"), exports);
29
30
  var version_1 = require("./version");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;AAEH,6CAA2B;AAC3B,4CAA0B;AAC1B,2CAAyB;AACzB,8CAA4B;AAC5B,qCAA0D;AAAjD,sGAAA,WAAW,OAAA;AAAE,2GAAA,gBAAgB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;AAEH,6CAA2B;AAC3B,4CAA0B;AAC1B,qDAAmC;AACnC,2CAAyB;AACzB,8CAA4B;AAC5B,qCAA0D;AAAjD,sGAAA,WAAW,OAAA;AAAE,2GAAA,gBAAgB,OAAA"}
package/dist/init.d.ts ADDED
@@ -0,0 +1,46 @@
1
+ /**
2
+ * `helix-core init openclaw` — one-shot setup that makes a local OpenClaw
3
+ * gateway reachable by the OpenClaw adapter.
4
+ *
5
+ * The adapter (openclaw-adapter.ts) talks to the gateway's OpenAI-compatible
6
+ * `/v1/chat/completions` endpoint, which ships **disabled by default**. Rather
7
+ * than making the operator hand-edit config and remember to restart, this
8
+ * command:
9
+ *
10
+ * 1. seeds the `openclaw` block in ~/.helix/config.json (gateway url + token +
11
+ * agent id) so `helix-core connect --adapter openclaw` needs no flags,
12
+ * 2. flips `gateway.http.endpoints.chatCompletions.enabled = true` — but
13
+ * PROMPTS first, because OpenClaw watches its config file and this write
14
+ * auto-restarts the gateway (kind:"restart", default reload mode "hybrid"),
15
+ * briefly taking it offline. The prompt therefore gates the WRITE, not a
16
+ * later restart; on "hot"/"off" reload modes we restart explicitly instead.
17
+ *
18
+ * On enabling the flag we PREFER the first-class `openclaw config set`, but fall
19
+ * back to a direct JSON merge of the OpenClaw config file when the CLI rejects it
20
+ * (older CLIs whose schema predates the endpoint, or whose `config` subcommand
21
+ * resolves a different store than the file). Reads always come from the file,
22
+ * because `openclaw config get` proved unreliable across versions.
23
+ *
24
+ * Idempotent: re-running is safe (already-enabled is detected and reported).
25
+ */
26
+ export interface InitFlags {
27
+ /** Personal agent token from the Helix UI — the one credential the operator
28
+ * supplies. Enrolled to discover the agent slug; no slug/URL needed. */
29
+ token?: string;
30
+ /** Skip the pre-restart confirmation prompt (non-interactive installs). */
31
+ yes?: boolean;
32
+ /** Configure only; do not restart the gateway. */
33
+ noRestart?: boolean;
34
+ /** Configure only; don't stay attached after setup. */
35
+ noConnect?: boolean;
36
+ /** OpenClaw agent id turns should route to (default: main). */
37
+ agent?: string;
38
+ /** Advanced: override the agents-api base URL (defaults to the Helix cloud). */
39
+ url?: string;
40
+ }
41
+ /** Locate OpenClaw's config file. Mirrors OpenClaw's own resolution order:
42
+ * OPENCLAW_CONFIG (explicit file) → OPENCLAW_HOME/openclaw.json → ~/.openclaw/openclaw.json. */
43
+ export declare function openclawConfigPath(): string;
44
+ /** `helix-core init openclaw` handler. */
45
+ export declare function runInitOpenClaw(flags: InitFlags): Promise<void>;
46
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAgBH,MAAM,WAAW,SAAS;IACxB;6EACyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,kDAAkD;IAClD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uDAAuD;IACvD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AA4DD;iGACiG;AACjG,wBAAgB,kBAAkB,IAAI,MAAM,CAM3C;AAsFD,0CAA0C;AAC1C,wBAAsB,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CA0HrE"}
package/dist/init.js ADDED
@@ -0,0 +1,338 @@
1
+ "use strict";
2
+ /**
3
+ * `helix-core init openclaw` — one-shot setup that makes a local OpenClaw
4
+ * gateway reachable by the OpenClaw adapter.
5
+ *
6
+ * The adapter (openclaw-adapter.ts) talks to the gateway's OpenAI-compatible
7
+ * `/v1/chat/completions` endpoint, which ships **disabled by default**. Rather
8
+ * than making the operator hand-edit config and remember to restart, this
9
+ * command:
10
+ *
11
+ * 1. seeds the `openclaw` block in ~/.helix/config.json (gateway url + token +
12
+ * agent id) so `helix-core connect --adapter openclaw` needs no flags,
13
+ * 2. flips `gateway.http.endpoints.chatCompletions.enabled = true` — but
14
+ * PROMPTS first, because OpenClaw watches its config file and this write
15
+ * auto-restarts the gateway (kind:"restart", default reload mode "hybrid"),
16
+ * briefly taking it offline. The prompt therefore gates the WRITE, not a
17
+ * later restart; on "hot"/"off" reload modes we restart explicitly instead.
18
+ *
19
+ * On enabling the flag we PREFER the first-class `openclaw config set`, but fall
20
+ * back to a direct JSON merge of the OpenClaw config file when the CLI rejects it
21
+ * (older CLIs whose schema predates the endpoint, or whose `config` subcommand
22
+ * resolves a different store than the file). Reads always come from the file,
23
+ * because `openclaw config get` proved unreliable across versions.
24
+ *
25
+ * Idempotent: re-running is safe (already-enabled is detected and reported).
26
+ */
27
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ var desc = Object.getOwnPropertyDescriptor(m, k);
30
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
31
+ desc = { enumerable: true, get: function() { return m[k]; } };
32
+ }
33
+ Object.defineProperty(o, k2, desc);
34
+ }) : (function(o, m, k, k2) {
35
+ if (k2 === undefined) k2 = k;
36
+ o[k2] = m[k];
37
+ }));
38
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
39
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
40
+ }) : function(o, v) {
41
+ o["default"] = v;
42
+ });
43
+ var __importStar = (this && this.__importStar) || (function () {
44
+ var ownKeys = function(o) {
45
+ ownKeys = Object.getOwnPropertyNames || function (o) {
46
+ var ar = [];
47
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
48
+ return ar;
49
+ };
50
+ return ownKeys(o);
51
+ };
52
+ return function (mod) {
53
+ if (mod && mod.__esModule) return mod;
54
+ var result = {};
55
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
56
+ __setModuleDefault(result, mod);
57
+ return result;
58
+ };
59
+ })();
60
+ Object.defineProperty(exports, "__esModule", { value: true });
61
+ exports.openclawConfigPath = openclawConfigPath;
62
+ exports.runInitOpenClaw = runInitOpenClaw;
63
+ const child_process_1 = require("child_process");
64
+ const fs = __importStar(require("fs"));
65
+ const os = __importStar(require("os"));
66
+ const path = __importStar(require("path"));
67
+ const readline = __importStar(require("readline"));
68
+ const config_1 = require("./config");
69
+ const connector_1 = require("./connector");
70
+ const openclaw_adapter_1 = require("./openclaw-adapter");
71
+ const version_1 = require("./version");
72
+ const ENDPOINT_PATH = 'gateway.http.endpoints.chatCompletions.enabled';
73
+ const DEFAULT_AGENT_ID = 'main';
74
+ const DEFAULT_PORT = 18789;
75
+ /** Exchange a personal agent token for its routable slug via the agents-api
76
+ * enrollment endpoint. The token is the only identity the operator has; this is
77
+ * how the connector discovers everything else. Throws a clear error on a bad
78
+ * token or an unreachable API. */
79
+ async function enrollConnector(token, agentsApiUrl) {
80
+ const base = agentsApiUrl.replace(/\/+$/, '');
81
+ let res;
82
+ try {
83
+ res = await fetch(`${base}/api/connector/enroll`, {
84
+ method: 'POST',
85
+ headers: { 'content-type': 'application/json' },
86
+ body: JSON.stringify({ token }),
87
+ });
88
+ }
89
+ catch (err) {
90
+ throw new Error(`could not reach Helix at ${base} to enroll (${err instanceof Error ? err.message : String(err)}). Check your connection and try again.`);
91
+ }
92
+ if (res.status === 401) {
93
+ throw new Error('that personal agent token was not recognized. Copy the exact command from the Helix agent page and try again.');
94
+ }
95
+ if (!res.ok) {
96
+ let detail = '';
97
+ try {
98
+ detail = (await res.json()).message ?? '';
99
+ }
100
+ catch { /* ignore */ }
101
+ throw new Error(`enrollment failed (${res.status})${detail ? `: ${detail}` : ''}.`);
102
+ }
103
+ const body = (await res.json());
104
+ if (!body.slug)
105
+ throw new Error('enrollment succeeded but returned no agent slug — please report this.');
106
+ return { slug: body.slug, name: body.name ?? body.slug };
107
+ }
108
+ /** Merge the resolved connector identity (slug + key + api url) into the
109
+ * `connector` block of ~/.helix/config.json so `connect` needs no flags/env. */
110
+ function seedHelixConnectorBlock(block) {
111
+ const configPath = path.join(os.homedir(), '.helix', 'config.json');
112
+ const existing = readJsonFile(configPath, true);
113
+ const prev = (existing.connector && typeof existing.connector === 'object'
114
+ ? existing.connector
115
+ : {});
116
+ existing.connector = { ...prev, ...block };
117
+ fs.mkdirSync(path.dirname(configPath), { recursive: true });
118
+ fs.writeFileSync(configPath, `${JSON.stringify(existing, null, 2)}\n`, 'utf-8');
119
+ return configPath;
120
+ }
121
+ /** Run an `openclaw` subcommand and capture output. Uses `shell:true` with a
122
+ * single trusted command string (all callers pass fixed constants — no user
123
+ * input) so Windows resolves `openclaw.cmd` without the args-splitting
124
+ * deprecation. Returns ok:false (never throws) if the CLI is missing/fails. */
125
+ function openclaw(args) {
126
+ const res = (0, child_process_1.spawnSync)(`openclaw ${args}`, { encoding: 'utf-8', shell: true });
127
+ if (res.error)
128
+ return { ok: false, stdout: '', stderr: String(res.error.message ?? res.error) };
129
+ return { ok: res.status === 0, stdout: (res.stdout ?? '').trim(), stderr: (res.stderr ?? '').trim() };
130
+ }
131
+ /** Locate OpenClaw's config file. Mirrors OpenClaw's own resolution order:
132
+ * OPENCLAW_CONFIG (explicit file) → OPENCLAW_HOME/openclaw.json → ~/.openclaw/openclaw.json. */
133
+ function openclawConfigPath() {
134
+ const explicit = process.env.OPENCLAW_CONFIG?.trim();
135
+ if (explicit)
136
+ return explicit;
137
+ const home = process.env.OPENCLAW_HOME?.trim();
138
+ if (home)
139
+ return path.join(home, 'openclaw.json');
140
+ return path.join(os.homedir(), '.openclaw', 'openclaw.json');
141
+ }
142
+ /** Read + parse a JSON config file. Strips a leading UTF-8 BOM (OpenClaw writes
143
+ * one on Windows and `JSON.parse` rejects it). `strict` throws on a present but
144
+ * unparseable file so write paths never clobber real config; non-strict returns
145
+ * {} (used for best-effort reads). Missing file → {} in both modes. */
146
+ function readJsonFile(file, strict = false) {
147
+ if (!fs.existsSync(file))
148
+ return {};
149
+ let raw = fs.readFileSync(file, 'utf-8');
150
+ if (raw.charCodeAt(0) === 0xFEFF)
151
+ raw = raw.slice(1); // strip UTF-8 BOM (OpenClaw writes one on Windows)
152
+ try {
153
+ const parsed = JSON.parse(raw);
154
+ return parsed && typeof parsed === 'object' ? parsed : {};
155
+ }
156
+ catch (err) {
157
+ if (strict) {
158
+ throw new Error(`refusing to edit ${file} — it exists but isn't valid JSON (${err instanceof Error ? err.message : String(err)}). Fix it and re-run.`);
159
+ }
160
+ return {};
161
+ }
162
+ }
163
+ /** Read a nested value by dot-path from an already-parsed object. */
164
+ function getPath(obj, dotPath) {
165
+ let cur = obj;
166
+ for (const key of dotPath.split('.')) {
167
+ if (!cur || typeof cur !== 'object')
168
+ return undefined;
169
+ cur = cur[key];
170
+ }
171
+ return cur;
172
+ }
173
+ /** Deep-set a nested value by dot-path, creating intermediate objects. */
174
+ function setPath(obj, dotPath, value) {
175
+ const keys = dotPath.split('.');
176
+ let cur = obj;
177
+ for (let i = 0; i < keys.length - 1; i += 1) {
178
+ const k = keys[i];
179
+ if (!cur[k] || typeof cur[k] !== 'object')
180
+ cur[k] = {};
181
+ cur = cur[k];
182
+ }
183
+ cur[keys[keys.length - 1]] = value;
184
+ }
185
+ /** Ask a yes/no question on the TTY. Resolves true only on an explicit yes.
186
+ * No TTY (piped/CI) → false; callers should pass --yes in that case. */
187
+ function confirm(question) {
188
+ if (!process.stdin.isTTY)
189
+ return Promise.resolve(false);
190
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
191
+ return new Promise((resolve) => {
192
+ rl.question(`${question} [y/N] `, (answer) => {
193
+ rl.close();
194
+ resolve(/^y(es)?$/i.test(answer.trim()));
195
+ });
196
+ });
197
+ }
198
+ /** Merge a partial `openclaw` block into ~/.helix/config.json, preserving the
199
+ * rest of the file (the SAME file helix-os / the connector read). */
200
+ function seedHelixOpenClawBlock(block) {
201
+ const configPath = path.join(os.homedir(), '.helix', 'config.json');
202
+ const existing = readJsonFile(configPath, true);
203
+ const prev = (existing.openclaw && typeof existing.openclaw === 'object'
204
+ ? existing.openclaw
205
+ : {});
206
+ existing.openclaw = { ...prev, ...block };
207
+ fs.mkdirSync(path.dirname(configPath), { recursive: true });
208
+ fs.writeFileSync(configPath, `${JSON.stringify(existing, null, 2)}\n`, 'utf-8');
209
+ return configPath;
210
+ }
211
+ /** Enable the endpoint. Prefer the first-class `openclaw config set`, but the
212
+ * ONLY source of truth is the config file the gateway actually reads — some
213
+ * CLI builds report success without persisting there. So we always re-read the
214
+ * file to verify, and fall back to a direct JSON merge if it didn't land.
215
+ * Returns how it was ultimately applied so the caller can report honestly. */
216
+ function enableEndpoint(cfgPath) {
217
+ openclaw(`config set ${ENDPOINT_PATH} true --strict-json`); // best effort
218
+ if (getPath(readJsonFile(cfgPath), ENDPOINT_PATH) === true)
219
+ return 'cli';
220
+ const cfg = readJsonFile(cfgPath, true);
221
+ setPath(cfg, ENDPOINT_PATH, true);
222
+ fs.mkdirSync(path.dirname(cfgPath), { recursive: true });
223
+ fs.writeFileSync(cfgPath, `${JSON.stringify(cfg, null, 2)}\n`, 'utf-8');
224
+ return 'file';
225
+ }
226
+ /** `helix-core init openclaw` handler. */
227
+ async function runInitOpenClaw(flags) {
228
+ const log = (m) => console.log(`[helix-core] ${m}`);
229
+ // 0a. Enroll the personal agent token, if given. This is the primary path: one
230
+ // token in, everything (slug + saved connector identity) out. The plaintext
231
+ // token doubles as the socket key, so it's stored alongside the slug.
232
+ if (flags.token) {
233
+ const agentsApiUrl = (0, config_1.resolveAgentsApiUrl)(flags.url);
234
+ log('enrolling personal agent…');
235
+ const agent = await enrollConnector(flags.token, agentsApiUrl);
236
+ seedHelixConnectorBlock({ slug: agent.slug, key: flags.token, agentsApiUrl });
237
+ log(`enrolled as "${agent.name}" (${agent.slug}).`);
238
+ }
239
+ // 0b. Confirm the OpenClaw CLI is present (we need it to restart the gateway).
240
+ if (!openclaw('--version').ok) {
241
+ throw new Error('openclaw CLI not found on PATH — install/enable OpenClaw first, then re-run `helix-core init openclaw`.');
242
+ }
243
+ const cfgPath = openclawConfigPath();
244
+ const cfg = readJsonFile(cfgPath);
245
+ log(`using OpenClaw config: ${cfgPath}`);
246
+ // 1. Seed ~/.helix/config.json `openclaw` block so `connect` needs no flags.
247
+ // This is non-disruptive (a different file the gateway doesn't watch), so we
248
+ // do all the harmless prep BEFORE the one action that bounces the gateway.
249
+ const portRaw = getPath(cfg, 'gateway.port');
250
+ const port = typeof portRaw === 'number' ? portRaw : DEFAULT_PORT;
251
+ const authMode = getPath(cfg, 'gateway.auth.mode');
252
+ const tokenRaw = getPath(cfg, 'gateway.auth.token');
253
+ const token = authMode === 'token' && typeof tokenRaw === 'string' ? tokenRaw : undefined;
254
+ const agentId = flags.agent?.trim() || DEFAULT_AGENT_ID;
255
+ const block = { url: `http://127.0.0.1:${port}`, agentId };
256
+ if (token)
257
+ block.token = token;
258
+ const written = seedHelixOpenClawBlock(block);
259
+ log(`seeded openclaw block in ${written} (url + agentId${token ? ' + token' : ''}).`);
260
+ if (authMode === 'token' && !token) {
261
+ log('note: gateway auth is "token" but no token was found — set OPENCLAW_GATEWAY_TOKEN or gateway.auth.token before connecting.');
262
+ }
263
+ // 2. Enable the OpenAI-compatible endpoint — the ONLY disruptive step.
264
+ //
265
+ // OpenClaw watches its own config file and auto-restarts the gateway on any
266
+ // `gateway.*` change (reload rule kind:"restart", default mode "hybrid").
267
+ // So the WRITE below is what takes the gateway briefly offline — not a
268
+ // separate restart afterwards. An earlier version prompted AFTER the write
269
+ // and then issued its own `gateway restart`, which meant the operator's
270
+ // gateway had already bounced before they saw the warning (and bounced a
271
+ // second time). The confirmation must gate the write itself.
272
+ if (getPath(cfg, ENDPOINT_PATH) === true) {
273
+ log(`${ENDPOINT_PATH} already enabled — nothing to change, no restart.`);
274
+ }
275
+ else if (flags.noRestart) {
276
+ log(`${ENDPOINT_PATH} is disabled; enabling it edits the gateway config and restarts the gateway — skipped because --no-restart.`);
277
+ log(`Enable it when ready with: openclaw config set ${ENDPOINT_PATH} true`);
278
+ }
279
+ else {
280
+ const proceed = flags.yes ||
281
+ (await confirm('Enabling the OpenClaw chat endpoint edits your gateway config, which briefly restarts the gateway (offline for a moment). Continue?'));
282
+ if (!proceed) {
283
+ log('left the chat endpoint disabled and your gateway untouched. Re-run when ready.');
284
+ return;
285
+ }
286
+ // Whether the config write auto-restarts depends on the reload mode: "hybrid"
287
+ // (default) and "restart" bounce the gateway for us; "hot" and "off" won't
288
+ // apply a gateway change, so we restart explicitly to make the endpoint live.
289
+ const reloadMode = getPath(cfg, 'gateway.reload.mode');
290
+ const autoRestarts = reloadMode === undefined || reloadMode === 'hybrid' || reloadMode === 'restart';
291
+ const how = enableEndpoint(cfgPath);
292
+ log(`enabled ${ENDPOINT_PATH} (${how === 'cli' ? 'via openclaw config' : 'via direct config edit'}).`);
293
+ if (autoRestarts) {
294
+ log('gateway is restarting to apply (OpenClaw auto-restarts on a config change).');
295
+ }
296
+ else {
297
+ log(`restarting gateway to apply (reload mode "${String(reloadMode)}" won't auto-apply a gateway change)…`);
298
+ const restart = openclaw('gateway restart');
299
+ if (!restart.ok) {
300
+ throw new Error(`gateway restart failed: ${restart.stderr || restart.stdout || 'unknown error'} — run \`openclaw gateway restart\` manually.`);
301
+ }
302
+ log('gateway restarted.');
303
+ }
304
+ }
305
+ // 4. Attach and stay connected. This makes `init` the ONLY command an operator
306
+ // runs — setup and going-live in one shot. Opt out with --no-connect (e.g.
307
+ // to run the connector under a process manager separately).
308
+ if (flags.noConnect) {
309
+ log('setup complete. Start the agent later with: helix-core connect --adapter openclaw');
310
+ return;
311
+ }
312
+ let config;
313
+ try {
314
+ config = (0, config_1.resolveConfig)();
315
+ }
316
+ catch (err) {
317
+ // No connector identity on this box (init ran without --token and none was
318
+ // pre-configured). Setup is still done; just can't auto-connect.
319
+ log(`setup complete. ${err instanceof Error ? err.message : String(err)}`);
320
+ log('re-run with your personal agent token to go live: helix-core init openclaw --token <token>');
321
+ return;
322
+ }
323
+ log('setup complete — bringing the agent online…');
324
+ const connector = new connector_1.Connector({
325
+ config,
326
+ adapter: new openclaw_adapter_1.OpenClawAdapter({ agentId: flags.agent }),
327
+ client: (0, version_1.packageInfo)(),
328
+ });
329
+ connector.start();
330
+ const shutdown = (signal) => {
331
+ console.log(`\n[helix-core] ${signal} — shutting down`);
332
+ connector.stop();
333
+ process.exit(0);
334
+ };
335
+ process.on('SIGINT', () => shutdown('SIGINT'));
336
+ process.on('SIGTERM', () => shutdown('SIGTERM'));
337
+ }
338
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FH,gDAMC;AAuFD,0CA0HC;AAjTD,iDAA0C;AAC1C,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,mDAAqC;AACrC,qCAA8D;AAC9D,2CAAwC;AACxC,yDAAqD;AACrD,uCAAwC;AAExC,MAAM,aAAa,GAAG,gDAAgD,CAAC;AACvE,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,MAAM,YAAY,GAAG,KAAK,CAAC;AAuB3B;;;mCAGmC;AACnC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AG,IAAI,qBAAS,CAAC;QAC9B,MAAM;QACN,OAAO,EAAE,IAAI,kCAAe,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;QACtD,MAAM,EAAE,IAAA,qBAAW,GAAE;KACtB,CAAC,CAAC;IACH,SAAS,CAAC,KAAK,EAAE,CAAC;IAElB,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAQ,EAAE;QACxC,OAAO,CAAC,GAAG,CAAC,kBAAkB,MAAM,kBAAkB,CAAC,CAAC;QACxD,SAAS,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC;IACF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;AACnD,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * OpenClaw adapter — bridges a Helix chat turn to a locally-running OpenClaw
3
+ * gateway. This is the piece that makes an OpenClaw instance a Helix
4
+ * PersonalAgent: the connector owns the socket, this owns "how a turn is
5
+ * answered" by forwarding it to the gateway's OpenAI-compatible endpoint and
6
+ * streaming the reply back.
7
+ *
8
+ * There is NO proxy and nothing gets configured on OpenClaw's side beyond
9
+ * enabling the endpoint — the connector is the client. Flow:
10
+ *
11
+ * Helix chat → agents-api → /ws/connector/:slug → Connector
12
+ * → OpenClawAdapter.runTurn() → POST gateway /v1/chat/completions (SSE)
13
+ *
14
+ * Requires the gateway's OpenAI-compatible endpoint to be enabled (off by
15
+ * default): `gateway.http.endpoints.chatCompletions.enabled = true`.
16
+ */
17
+ import type { AgentAdapter, TurnContext, TurnEmitter, TurnResult } from './adapter';
18
+ export interface OpenClawAdapterOptions {
19
+ /** Gateway base URL (http/https). Default http://127.0.0.1:18789. */
20
+ baseUrl?: string;
21
+ /** Bearer token for the gateway (gateway.auth.token / OPENCLAW_GATEWAY_TOKEN).
22
+ * Optional — omitted if the gateway runs with auth disabled. */
23
+ token?: string;
24
+ /** OpenClaw agent id to route turns to (encoded as model `openclaw:<id>`). */
25
+ agentId?: string;
26
+ }
27
+ /**
28
+ * Resolve OpenClaw connection settings. Precedence (low → high):
29
+ * built-in defaults < ~/.helix/config.json (`openclaw` block) < env < opts
30
+ *
31
+ * Env: OPENCLAW_GATEWAY_URL, OPENCLAW_GATEWAY_TOKEN, OPENCLAW_AGENT_ID.
32
+ */
33
+ export declare function resolveOpenClawOptions(opts?: OpenClawAdapterOptions): Required<Pick<OpenClawAdapterOptions, 'baseUrl' | 'agentId'>> & {
34
+ token?: string;
35
+ };
36
+ /**
37
+ * Streams turns from Helix to an OpenClaw gateway's OpenAI-compatible
38
+ * `/v1/chat/completions` endpoint (same run path as `openclaw agent`).
39
+ */
40
+ export declare class OpenClawAdapter implements AgentAdapter {
41
+ readonly name = "openclaw";
42
+ readonly version = "0.1.0";
43
+ readonly capabilities: string[];
44
+ private readonly baseUrl;
45
+ private readonly token?;
46
+ private readonly agentId;
47
+ constructor(options?: OpenClawAdapterOptions);
48
+ runTurn(ctx: TurnContext, emit: TurnEmitter): Promise<TurnResult>;
49
+ }
50
+ //# sourceMappingURL=openclaw-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openclaw-adapter.d.ts","sourceRoot":"","sources":["../src/openclaw-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAMpF,MAAM,WAAW,sBAAsB;IACrC,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;qEACiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,GAAE,sBAA2B,GAAG,QAAQ,CAAC,IAAI,CAAC,sBAAsB,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAwB5J;AAcD;;;GAGG;AACH,qBAAa,eAAgB,YAAW,YAAY;IAClD,QAAQ,CAAC,IAAI,cAAc;IAC3B,QAAQ,CAAC,OAAO,WAAmB;IACnC,QAAQ,CAAC,YAAY,WAAgB;IAErC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,GAAE,sBAA2B;IAO1C,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;CAqFxE"}
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+ /**
3
+ * OpenClaw adapter — bridges a Helix chat turn to a locally-running OpenClaw
4
+ * gateway. This is the piece that makes an OpenClaw instance a Helix
5
+ * PersonalAgent: the connector owns the socket, this owns "how a turn is
6
+ * answered" by forwarding it to the gateway's OpenAI-compatible endpoint and
7
+ * streaming the reply back.
8
+ *
9
+ * There is NO proxy and nothing gets configured on OpenClaw's side beyond
10
+ * enabling the endpoint — the connector is the client. Flow:
11
+ *
12
+ * Helix chat → agents-api → /ws/connector/:slug → Connector
13
+ * → OpenClawAdapter.runTurn() → POST gateway /v1/chat/completions (SSE)
14
+ *
15
+ * Requires the gateway's OpenAI-compatible endpoint to be enabled (off by
16
+ * default): `gateway.http.endpoints.chatCompletions.enabled = true`.
17
+ */
18
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
+ }
24
+ Object.defineProperty(o, k2, desc);
25
+ }) : (function(o, m, k, k2) {
26
+ if (k2 === undefined) k2 = k;
27
+ o[k2] = m[k];
28
+ }));
29
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
30
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
31
+ }) : function(o, v) {
32
+ o["default"] = v;
33
+ });
34
+ var __importStar = (this && this.__importStar) || (function () {
35
+ var ownKeys = function(o) {
36
+ ownKeys = Object.getOwnPropertyNames || function (o) {
37
+ var ar = [];
38
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
39
+ return ar;
40
+ };
41
+ return ownKeys(o);
42
+ };
43
+ return function (mod) {
44
+ if (mod && mod.__esModule) return mod;
45
+ var result = {};
46
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
47
+ __setModuleDefault(result, mod);
48
+ return result;
49
+ };
50
+ })();
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.OpenClawAdapter = void 0;
53
+ exports.resolveOpenClawOptions = resolveOpenClawOptions;
54
+ const fs = __importStar(require("fs"));
55
+ const os = __importStar(require("os"));
56
+ const path = __importStar(require("path"));
57
+ const ADAPTER_VERSION = '0.1.0';
58
+ const DEFAULT_GATEWAY_URL = 'http://127.0.0.1:18789';
59
+ const DEFAULT_AGENT_ID = 'main';
60
+ /**
61
+ * Resolve OpenClaw connection settings. Precedence (low → high):
62
+ * built-in defaults < ~/.helix/config.json (`openclaw` block) < env < opts
63
+ *
64
+ * Env: OPENCLAW_GATEWAY_URL, OPENCLAW_GATEWAY_TOKEN, OPENCLAW_AGENT_ID.
65
+ */
66
+ function resolveOpenClawOptions(opts = {}) {
67
+ const file = readOpenClawConfigBlock();
68
+ const str = (v) => typeof v === 'string' && v.trim() ? v.trim() : undefined;
69
+ const baseUrl = opts.baseUrl ??
70
+ str(process.env.OPENCLAW_GATEWAY_URL) ??
71
+ str(file.baseUrl) ??
72
+ str(file.url) ??
73
+ DEFAULT_GATEWAY_URL;
74
+ const token = opts.token ??
75
+ str(process.env.OPENCLAW_GATEWAY_TOKEN) ??
76
+ str(file.token);
77
+ const agentId = opts.agentId ??
78
+ str(process.env.OPENCLAW_AGENT_ID) ??
79
+ str(file.agentId) ??
80
+ DEFAULT_AGENT_ID;
81
+ return { baseUrl: baseUrl.replace(/\/+$/, ''), token, agentId };
82
+ }
83
+ function readOpenClawConfigBlock() {
84
+ const configPath = path.join(os.homedir(), '.helix', 'config.json');
85
+ if (!fs.existsSync(configPath))
86
+ return {};
87
+ try {
88
+ const parsed = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
89
+ const block = parsed && typeof parsed === 'object' ? parsed.openclaw : undefined;
90
+ return block && typeof block === 'object' ? block : {};
91
+ }
92
+ catch {
93
+ return {};
94
+ }
95
+ }
96
+ /**
97
+ * Streams turns from Helix to an OpenClaw gateway's OpenAI-compatible
98
+ * `/v1/chat/completions` endpoint (same run path as `openclaw agent`).
99
+ */
100
+ class OpenClawAdapter {
101
+ name = 'openclaw';
102
+ version = ADAPTER_VERSION;
103
+ capabilities = ['openclaw'];
104
+ baseUrl;
105
+ token;
106
+ agentId;
107
+ constructor(options = {}) {
108
+ const resolved = resolveOpenClawOptions(options);
109
+ this.baseUrl = resolved.baseUrl;
110
+ this.token = resolved.token;
111
+ this.agentId = resolved.agentId;
112
+ }
113
+ async runTurn(ctx, emit) {
114
+ const started = Date.now();
115
+ const url = `${this.baseUrl}/v1/chat/completions`;
116
+ emit.status('thinking');
117
+ const headers = { 'Content-Type': 'application/json' };
118
+ if (this.token)
119
+ headers.Authorization = `Bearer ${this.token}`;
120
+ const body = JSON.stringify({
121
+ model: `openclaw:${this.agentId}`,
122
+ stream: true,
123
+ // Deriving a stable session key from `user` lets a multi-turn Helix chat
124
+ // reuse one OpenClaw agent session (see gateway "Session behavior").
125
+ user: ctx.sessionId,
126
+ messages: [{ role: 'user', content: ctx.message }],
127
+ });
128
+ let res;
129
+ try {
130
+ res = await fetch(url, { method: 'POST', headers, body, signal: ctx.signal });
131
+ }
132
+ catch (err) {
133
+ if (ctx.signal.aborted)
134
+ throw new Error('aborted');
135
+ throw new Error(`OpenClaw gateway unreachable at ${this.baseUrl} — is \`openclaw gateway\` running? (${err instanceof Error ? err.message : String(err)})`);
136
+ }
137
+ if (!res.ok) {
138
+ const detail = (await res.text().catch(() => '')).slice(0, 500);
139
+ if (res.status === 404) {
140
+ throw new Error(`OpenClaw gateway returned 404 for ${url} — enable the OpenAI endpoint: gateway.http.endpoints.chatCompletions.enabled = true`);
141
+ }
142
+ if (res.status === 401 || res.status === 403) {
143
+ throw new Error(`OpenClaw gateway rejected auth (${res.status}) — check the gateway token. ${detail}`);
144
+ }
145
+ throw new Error(`OpenClaw gateway error ${res.status}: ${detail || res.statusText}`);
146
+ }
147
+ if (!res.body)
148
+ throw new Error('OpenClaw gateway returned no response body');
149
+ let model;
150
+ let usage;
151
+ let sawContent = false;
152
+ const decoder = new TextDecoder();
153
+ let buffer = '';
154
+ // SSE: events separated by a blank line; each carries `data: <json>` lines,
155
+ // terminated by `data: [DONE]`. We tolerate multi-line data and CRLF.
156
+ for await (const chunk of res.body) {
157
+ if (ctx.signal.aborted)
158
+ throw new Error('aborted');
159
+ buffer += decoder.decode(chunk, { stream: true });
160
+ let sep;
161
+ while ((sep = indexOfEvent(buffer)) !== -1) {
162
+ const rawEvent = buffer.slice(0, sep);
163
+ buffer = buffer.slice(sep).replace(/^(\r?\n){1,2}/, '');
164
+ const dataStr = extractData(rawEvent);
165
+ if (dataStr === null)
166
+ continue;
167
+ if (dataStr === '[DONE]') {
168
+ buffer = '';
169
+ break;
170
+ }
171
+ let json;
172
+ try {
173
+ json = JSON.parse(dataStr);
174
+ }
175
+ catch {
176
+ continue;
177
+ }
178
+ if (typeof json?.model === 'string')
179
+ model = json.model;
180
+ if (json?.usage)
181
+ usage = json.usage;
182
+ const delta = json?.choices?.[0]?.delta?.content;
183
+ if (typeof delta === 'string' && delta.length) {
184
+ sawContent = true;
185
+ emit.delta(delta);
186
+ }
187
+ }
188
+ }
189
+ if (!sawContent)
190
+ emit.status('done');
191
+ return {
192
+ model,
193
+ usage,
194
+ costUsd: null, // gateway runs don't report cost through this endpoint
195
+ durationMs: Date.now() - started,
196
+ };
197
+ }
198
+ }
199
+ exports.OpenClawAdapter = OpenClawAdapter;
200
+ /** Index just past the end of the first complete SSE event (its blank-line
201
+ * delimiter), or -1 if no complete event is buffered yet. */
202
+ function indexOfEvent(buf) {
203
+ const nn = buf.indexOf('\n\n');
204
+ const rn = buf.indexOf('\r\n\r\n');
205
+ if (nn === -1)
206
+ return rn === -1 ? -1 : rn + 4;
207
+ if (rn === -1)
208
+ return nn + 2;
209
+ return Math.min(nn + 2, rn + 4);
210
+ }
211
+ /** Concatenate the `data:` lines of one SSE event, or null if it has none. */
212
+ function extractData(event) {
213
+ const parts = [];
214
+ for (const line of event.split(/\r?\n/)) {
215
+ if (line.startsWith('data:'))
216
+ parts.push(line.slice(5).replace(/^ /, ''));
217
+ }
218
+ return parts.length ? parts.join('\n') : null;
219
+ }
220
+ //# sourceMappingURL=openclaw-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openclaw-adapter.js","sourceRoot":"","sources":["../src/openclaw-adapter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BH,wDAwBC;AAjDD,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAG7B,MAAM,eAAe,GAAG,OAAO,CAAC;AAChC,MAAM,mBAAmB,GAAG,wBAAwB,CAAC;AACrD,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAYhC;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,O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I,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC;AAClC,CAAC;AAED,8EAA8E;AAC9E,SAAS,WAAW,CAAC,KAAa;IAChC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAChD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spark-strategic/helix-core",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Helix Core — the minimal local runtime you run to connect a personal agent to Helix. Other tools (MCP, etc.) ship as their own packages that Core runs.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",