nervepay 1.4.0 → 1.4.1

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.
@@ -176,6 +176,38 @@ async function updateOpenClawConfig(agentDid, privateKey, apiUrl) {
176
176
  } catch { return false; }
177
177
  }
178
178
 
179
+ /**
180
+ * Enable /v1/chat/completions on the OpenClaw gateway.
181
+ *
182
+ * Sets gateway.http.endpoints.chatCompletions.enabled = true in openclaw.json.
183
+ * This allows NervePay Mission Control to chat directly without spawning sub-agents.
184
+ *
185
+ * Returns true if config was updated, false otherwise.
186
+ * The gateway must be restarted for the change to take effect.
187
+ */
188
+ async function enableChatCompletions() {
189
+ const configPath = findOpenClawConfigPath();
190
+ if (!configPath) return false;
191
+ try {
192
+ const config = JSON.parse(await readFile(configPath, 'utf-8'));
193
+
194
+ // Check if already enabled
195
+ if (config.gateway?.http?.endpoints?.chatCompletions?.enabled === true) {
196
+ return 'already_enabled';
197
+ }
198
+
199
+ // Deep-merge the setting
200
+ if (!config.gateway) config.gateway = {};
201
+ if (!config.gateway.http) config.gateway.http = {};
202
+ if (!config.gateway.http.endpoints) config.gateway.http.endpoints = {};
203
+ if (!config.gateway.http.endpoints.chatCompletions) config.gateway.http.endpoints.chatCompletions = {};
204
+ config.gateway.http.endpoints.chatCompletions.enabled = true;
205
+
206
+ await writeFile(configPath, JSON.stringify(config, null, 2));
207
+ return true;
208
+ } catch { return false; }
209
+ }
210
+
179
211
  // ---------------------------------------------------------------------------
180
212
  // CLI program
181
213
  // ---------------------------------------------------------------------------
@@ -356,6 +388,13 @@ program
356
388
  log(dim('Approve in Mission Control > Task Board > Incoming'));
357
389
  }
358
390
 
391
+ // Enable /v1/chat/completions for direct chat (no sub-agent spawning)
392
+ const chatResult = await enableChatCompletions();
393
+ if (chatResult === true) {
394
+ logOk('Enabled chat completions endpoint');
395
+ log(dim(' Restart gateway for this to take effect:'), info('openclaw gateway restart'));
396
+ }
397
+
359
398
  divider();
360
399
  logOk(bold('Setup complete'));
361
400
  console.log();
@@ -584,6 +623,17 @@ async function deviceNodePairing(options) {
584
623
  field(' Gateway ID', apiResult.gateway_id);
585
624
  field(' Device ID', deviceId.slice(0, 16) + '...');
586
625
  field(' Agent DID', agentDid);
626
+ console.log();
627
+
628
+ // Enable /v1/chat/completions for direct chat (no sub-agent spawning)
629
+ const chatResult = await enableChatCompletions();
630
+ if (chatResult === true) {
631
+ logOk('Enabled chat completions endpoint');
632
+ log(dim(' Restart gateway for this to take effect:'), info('openclaw gateway restart'));
633
+ } else if (chatResult === 'already_enabled') {
634
+ logOk('Chat completions endpoint already enabled');
635
+ }
636
+
587
637
  console.log();
588
638
  log(dim('View in dashboard:'), info('Mission Control > Task Board'));
589
639
  console.log();
@@ -704,6 +754,17 @@ async function legacyCodePairing(options) {
704
754
  logOk(bold('Gateway paired'));
705
755
  field(' Gateway ID', result.gateway_id || 'created');
706
756
  field(' Agent DID', agentDid);
757
+ console.log();
758
+
759
+ // Enable /v1/chat/completions for direct chat (no sub-agent spawning)
760
+ const chatResult = await enableChatCompletions();
761
+ if (chatResult === true) {
762
+ logOk('Enabled chat completions endpoint');
763
+ log(dim(' Restart gateway for this to take effect:'), info('openclaw gateway restart'));
764
+ } else if (chatResult === 'already_enabled') {
765
+ logOk('Chat completions endpoint already enabled');
766
+ }
767
+
707
768
  console.log();
708
769
  log(dim('View in dashboard:'), info('Mission Control > Task Board'));
709
770
  console.log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nervepay",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "NervePay plugin for OpenClaw - Self-sovereign identity, vault, and orchestration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",