@agentbean/daemon 0.1.17 → 0.1.19

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.
@@ -1,13 +1,23 @@
1
1
  import { spawn } from 'node:child_process';
2
+ function runtimeArgs(args = []) {
3
+ if (args[0] === 'gateway' && args[1] === 'run') {
4
+ return args.slice(2);
5
+ }
6
+ return args;
7
+ }
8
+ function hasMessageFlag(args) {
9
+ return args.includes('--message') || args.includes('-m');
10
+ }
2
11
  function buildArgs(baseArgs, prompt) {
3
- // If user already configured args with chat send --message, just append the prompt
4
- // Otherwise default to: openclaw chat send --message "<prompt>"
5
- const hasSend = baseArgs.includes('send');
6
- const hasMessage = baseArgs.includes('--message');
7
- if (hasSend && hasMessage) {
12
+ // Current OpenClaw one-shot agent turns use: openclaw agent --message "<prompt>".
13
+ // Preserve explicit custom args when the message flag is already configured.
14
+ if (hasMessageFlag(baseArgs)) {
8
15
  return [...baseArgs, prompt];
9
16
  }
10
- return [...baseArgs, 'chat', 'send', '--message', prompt];
17
+ if (baseArgs.includes('agent')) {
18
+ return [...baseArgs, '--message', prompt];
19
+ }
20
+ return [...baseArgs, 'agent', '--message', prompt];
11
21
  }
12
22
  function buildPrompt(input, systemPrompt) {
13
23
  const parts = [];
@@ -29,7 +39,7 @@ export class OpenClawAdapter {
29
39
  return new Promise((resolve, reject) => {
30
40
  const prompt = buildPrompt(input, this.opts.systemPrompt ?? input.systemPrompt);
31
41
  const cwd = input.workspace ?? this.opts.cwd ?? process.cwd();
32
- const child = spawn(this.opts.command, buildArgs(this.opts.args ?? [], prompt), {
42
+ const child = spawn(this.opts.command, buildArgs(runtimeArgs(this.opts.args), prompt), {
33
43
  cwd,
34
44
  stdio: ['ignore', 'pipe', 'pipe'],
35
45
  env: { ...process.env, ...(input.env ?? {}) },
package/dist/scanner.js CHANGED
@@ -262,7 +262,7 @@ async function checkOpenClawGateway() {
262
262
  name: "OpenClaw-Agent",
263
263
  adapterKind: "openclaw",
264
264
  command: path,
265
- args: ["gateway", "run"],
265
+ args: [],
266
266
  source: "gateway",
267
267
  };
268
268
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agentbean/daemon",
3
3
  "private": false,
4
- "version": "0.1.17",
4
+ "version": "0.1.19",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "bin": {