@openagents-org/agent-launcher 0.2.213 → 0.2.214
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/package.json +1 -1
- package/registry.json +3 -6
- package/src/adapters/codex.js +12 -6
- package/src/adapters/openclaw.js +23 -4
- package/src/cli.js +5 -0
- package/src/config.js +24 -1
- package/src/probe.js +11 -4
package/package.json
CHANGED
package/registry.json
CHANGED
|
@@ -616,8 +616,7 @@
|
|
|
616
616
|
{
|
|
617
617
|
"name": "LLM_BASE_URL",
|
|
618
618
|
"description": "Custom OpenAI-compatible base URL (leave empty to use Hermes's own provider login)",
|
|
619
|
-
"required": false
|
|
620
|
-
"placeholder": "https://api.openai.com/v1"
|
|
619
|
+
"required": false
|
|
621
620
|
},
|
|
622
621
|
{
|
|
623
622
|
"name": "LLM_MODEL",
|
|
@@ -1844,8 +1843,7 @@
|
|
|
1844
1843
|
{
|
|
1845
1844
|
"name": "DEEPSEEK_BASE_URL",
|
|
1846
1845
|
"description": "Optional gateway/proxy base URL. Leave blank for the public DeepSeek API. A URL ending in a version segment (e.g. https://relay.example.com/v1, or OpenAgents credits) is used as an OpenAI-compatible chat-completions endpoint; any other URL must speak the Anthropic Messages API (e.g. https://api.deepseek.com/anthropic).",
|
|
1847
|
-
"required": false
|
|
1848
|
-
"placeholder": "https://api.deepseek.com/anthropic"
|
|
1846
|
+
"required": false
|
|
1849
1847
|
},
|
|
1850
1848
|
{
|
|
1851
1849
|
"name": "DEEPSEEK_MODEL",
|
|
@@ -2254,8 +2252,7 @@
|
|
|
2254
2252
|
{
|
|
2255
2253
|
"name": "CODEBUDDY_BASE_URL",
|
|
2256
2254
|
"description": "Advanced. Endpoint override, for an enterprise or self-hosted deployment. Blank means the endpoint the region above selects.",
|
|
2257
|
-
"required": false
|
|
2258
|
-
"placeholder": "https://www.codebuddy.cn"
|
|
2255
|
+
"required": false
|
|
2259
2256
|
}
|
|
2260
2257
|
],
|
|
2261
2258
|
"check_ready": {
|
package/src/adapters/codex.js
CHANGED
|
@@ -604,7 +604,7 @@ class CodexAdapter extends BaseAdapter {
|
|
|
604
604
|
}
|
|
605
605
|
});
|
|
606
606
|
|
|
607
|
-
proc.on('exit', async (code) => {
|
|
607
|
+
proc.on('exit', async (code, signal) => {
|
|
608
608
|
// Wait for all in-flight processLine calls
|
|
609
609
|
try { await _pendingLines; } catch {}
|
|
610
610
|
|
|
@@ -617,7 +617,7 @@ class CodexAdapter extends BaseAdapter {
|
|
|
617
617
|
|
|
618
618
|
const stderrBuf = CodexAdapter._decodeOutput(Buffer.concat(stderrChunks));
|
|
619
619
|
if (code !== 0) {
|
|
620
|
-
this._log(`Codex CLI exited with code ${code}`);
|
|
620
|
+
this._log(`Codex CLI exited with code ${code}${signal ? ` (${signal})` : ''}`);
|
|
621
621
|
if (stderrBuf.trim()) {
|
|
622
622
|
this._log(`stderr: ${stderrBuf.trim().slice(0, 500)}`);
|
|
623
623
|
}
|
|
@@ -626,6 +626,7 @@ class CodexAdapter extends BaseAdapter {
|
|
|
626
626
|
resolve({
|
|
627
627
|
responseText: responseTexts.join('\n').trim(),
|
|
628
628
|
exitCode: code,
|
|
629
|
+
signal,
|
|
629
630
|
stderr: stderrBuf,
|
|
630
631
|
errorMessage: lastErrorMessage,
|
|
631
632
|
turnFailed,
|
|
@@ -744,11 +745,13 @@ class CodexAdapter extends BaseAdapter {
|
|
|
744
745
|
|
|
745
746
|
/**
|
|
746
747
|
* Pick the most informative failure detail from a run result:
|
|
747
|
-
* turn.failed / error event message → stderr tail → exit code.
|
|
748
|
+
* turn.failed / error event message → stderr tail → signal → exit code.
|
|
749
|
+
* Redacted.
|
|
748
750
|
*/
|
|
749
|
-
static _failureDetail({ errorMessage, stderr, exitCode } = {}) {
|
|
751
|
+
static _failureDetail({ errorMessage, stderr, exitCode, signal } = {}) {
|
|
750
752
|
const raw = String(errorMessage || '').trim()
|
|
751
753
|
|| CodexAdapter._stderrReason(stderr)
|
|
754
|
+
|| (signal ? `codex was terminated by ${signal}` : '')
|
|
752
755
|
|| (exitCode ? `codex exited with code ${exitCode}` : '');
|
|
753
756
|
const detail = CodexAdapter._explain(CodexAdapter._unwrap(raw));
|
|
754
757
|
return CodexAdapter._redact(detail).slice(0, 500).trim();
|
|
@@ -767,7 +770,10 @@ class CodexAdapter extends BaseAdapter {
|
|
|
767
770
|
* when neither exists does the raw tail stand.
|
|
768
771
|
*/
|
|
769
772
|
static _stderrReason(stderr) {
|
|
770
|
-
|
|
773
|
+
// The stdin banner is never a reason: a run whose stderr holds nothing
|
|
774
|
+
// else falls through to the exit code instead of quoting the banner.
|
|
775
|
+
const lines = String(stderr || '').split(/\r?\n/).map((l) => l.trim())
|
|
776
|
+
.filter((l) => l && !/^Reading (prompt|additional input) from stdin/i.test(l));
|
|
771
777
|
if (!lines.length) return '';
|
|
772
778
|
const TRACE = /^\d{4}-\d{2}-\d{2}T[\d:.]+Z?\s+(TRACE|DEBUG|INFO|WARN|ERROR)\s+(?:[\w:]+:\s+)?(.*)$/;
|
|
773
779
|
const plain = [];
|
|
@@ -775,7 +781,7 @@ class CodexAdapter extends BaseAdapter {
|
|
|
775
781
|
for (const line of lines) {
|
|
776
782
|
const m = line.match(TRACE);
|
|
777
783
|
if (!m) {
|
|
778
|
-
|
|
784
|
+
plain.push(line);
|
|
779
785
|
} else if (m[1] === 'ERROR' && m[2] && !errors.includes(m[2])) {
|
|
780
786
|
errors.push(m[2]);
|
|
781
787
|
}
|
package/src/adapters/openclaw.js
CHANGED
|
@@ -100,6 +100,9 @@ function needsDoctorMigration(message) {
|
|
|
100
100
|
return /requires[^\n]*\bmigration\b/i.test(text) && /openclaw doctor --fix/i.test(text);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
/** OpenClaw's refusal to run embedded while a Gateway owns the state. */
|
|
104
|
+
const GATEWAY_RUNNING = /A Gateway is running for this state directory/i;
|
|
105
|
+
|
|
103
106
|
/** Budget for one `openclaw doctor --fix` run. */
|
|
104
107
|
const DOCTOR_REPAIR_TIMEOUT_MS = 120000;
|
|
105
108
|
|
|
@@ -383,7 +386,7 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
383
386
|
*/
|
|
384
387
|
async _runCliAgentWithMigration(userMessage, channel) {
|
|
385
388
|
try {
|
|
386
|
-
return await this.
|
|
389
|
+
return await this._runCliTurn(userMessage, channel);
|
|
387
390
|
} catch (e) {
|
|
388
391
|
// At most one repair per turn; a repair that failed is not retried on
|
|
389
392
|
// every later message.
|
|
@@ -396,7 +399,23 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
396
399
|
this._doctorRepairFailed = true;
|
|
397
400
|
throw e;
|
|
398
401
|
}
|
|
399
|
-
return this.
|
|
402
|
+
return this._runCliTurn(userMessage, channel);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* One turn, embedded (`--local`) by default. OpenClaw refuses an embedded
|
|
408
|
+
* run while the user's own Gateway serves the same state directory — "A
|
|
409
|
+
* Gateway is running for this state directory … Run without --local to use
|
|
410
|
+
* it" — and every message failed that way. Hand the turn to that Gateway.
|
|
411
|
+
*/
|
|
412
|
+
async _runCliTurn(userMessage, channel) {
|
|
413
|
+
try {
|
|
414
|
+
return await this._runCliAgent(userMessage, channel);
|
|
415
|
+
} catch (e) {
|
|
416
|
+
if (!GATEWAY_RUNNING.test((e && e.message) || '')) throw e;
|
|
417
|
+
this._log('A Gateway is running for this OpenClaw state — retrying the turn through it');
|
|
418
|
+
return this._runCliAgent(userMessage, channel, { local: false });
|
|
400
419
|
}
|
|
401
420
|
}
|
|
402
421
|
|
|
@@ -471,7 +490,7 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
471
490
|
return { spawnBin: binary, spawnArgs: args };
|
|
472
491
|
}
|
|
473
492
|
|
|
474
|
-
_runCliAgent(userMessage, channel) {
|
|
493
|
+
_runCliAgent(userMessage, channel, { local = true } = {}) {
|
|
475
494
|
return new Promise((resolve, reject) => {
|
|
476
495
|
// Stopped while this turn was being prepared: start nothing (no tokens).
|
|
477
496
|
if (this._stoppedBeforeStart(channel)) {
|
|
@@ -496,7 +515,7 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
496
515
|
|
|
497
516
|
const args = [
|
|
498
517
|
'--log-level', 'trace',
|
|
499
|
-
'agent', '--local',
|
|
518
|
+
'agent', ...(local ? ['--local'] : []),
|
|
500
519
|
'--agent', this.openclawAgentId,
|
|
501
520
|
'--session-id', sessionKey,
|
|
502
521
|
'--message', userMessage,
|
package/src/cli.js
CHANGED
|
@@ -1059,6 +1059,11 @@ async function cmdProbe(connector, flags, positional) {
|
|
|
1059
1059
|
} catch {}
|
|
1060
1060
|
|
|
1061
1061
|
const result = await connector.probeAgentType(type, { agentEnv });
|
|
1062
|
+
// The daemon probes by agent name: a name that is neither an agent here nor
|
|
1063
|
+
// a type is an agent that is gone, not a type the catalog lacks.
|
|
1064
|
+
if (!agentEnv && result.code === 'unknown_type') {
|
|
1065
|
+
result.message = `No agent named '${target}' on this device`;
|
|
1066
|
+
}
|
|
1062
1067
|
|
|
1063
1068
|
if (flags && flags.json) {
|
|
1064
1069
|
// Machine consumers (the daemon's probe_agent node command) read ONLY
|
package/src/config.js
CHANGED
|
@@ -45,9 +45,32 @@ class Config {
|
|
|
45
45
|
|
|
46
46
|
// -- Write --
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Replace the file in one step. A plain writeFileSync truncates first, and
|
|
50
|
+
* the daemon and its `agn` children read this file all the time: a probe
|
|
51
|
+
* started right after a create read it empty and reported the new agent as
|
|
52
|
+
* "Unknown agent type '<name>'", and a read-modify-write in that window
|
|
53
|
+
* saves the empty list back. Windows can refuse the rename while a reader
|
|
54
|
+
* holds the file open, so that case retries and then writes in place.
|
|
55
|
+
*/
|
|
48
56
|
save(config) {
|
|
49
57
|
fs.mkdirSync(this.configDir, { recursive: true });
|
|
50
|
-
|
|
58
|
+
const text = serializeYaml(config);
|
|
59
|
+
const tmp = `${this.configFile}.${process.pid}.tmp`;
|
|
60
|
+
fs.writeFileSync(tmp, text, 'utf-8');
|
|
61
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
62
|
+
try {
|
|
63
|
+
fs.renameSync(tmp, this.configFile);
|
|
64
|
+
return;
|
|
65
|
+
} catch (err) {
|
|
66
|
+
if (!['EPERM', 'EACCES', 'EBUSY'].includes(err.code)) {
|
|
67
|
+
try { fs.unlinkSync(tmp); } catch {}
|
|
68
|
+
throw err;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
try { fs.unlinkSync(tmp); } catch {}
|
|
73
|
+
fs.writeFileSync(this.configFile, text, 'utf-8');
|
|
51
74
|
}
|
|
52
75
|
|
|
53
76
|
addAgent({ name, type, role, path: agentPath, env }) {
|
package/src/probe.js
CHANGED
|
@@ -34,7 +34,7 @@ const os = require('os');
|
|
|
34
34
|
const { spawn } = require('./wsl');
|
|
35
35
|
const { getEnhancedEnv } = require('./paths');
|
|
36
36
|
const { shouldUseShellForBinary, REASON } = require('./adapters/health-status');
|
|
37
|
-
const { decodeConsoleOutput, BENIGN_CLI_OUTPUT, stripCliNoise } = require('./adapters/utils');
|
|
37
|
+
const { decodeConsoleOutput, BENIGN_CLI_OUTPUT, stripCliNoise, redactSecrets } = require('./adapters/utils');
|
|
38
38
|
const { formatAuthGuidance } = require('./auth-guidance');
|
|
39
39
|
const { isCliLogin, stripForCliLogin, typeEnvFor } = require('./env');
|
|
40
40
|
const { configuredModel } = require('./agent-model');
|
|
@@ -90,10 +90,14 @@ function installCommandFor(entry) {
|
|
|
90
90
|
/** Redact anything that looks like a secret before output leaves the device. */
|
|
91
91
|
function scrub(text) {
|
|
92
92
|
if (!text) return '';
|
|
93
|
-
|
|
93
|
+
const masked = String(text)
|
|
94
94
|
.replace(/sk-[A-Za-z0-9_-]{8,}/g, 'sk-****')
|
|
95
95
|
.replace(/(api[-_ ]?key["':\s=]+)[A-Za-z0-9_-]{8,}/gi, '$1****')
|
|
96
96
|
.replace(/Bearer\s+[A-Za-z0-9._-]{8,}/gi, 'Bearer ****');
|
|
97
|
+
// Then everything the adapters strip from quoted CLI text: a Codex probe
|
|
98
|
+
// that failed after printing a token-shaped blob showed that blob as its
|
|
99
|
+
// reason, on the device card in the workspace.
|
|
100
|
+
return redactSecrets(masked);
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
function tail(text, cap) {
|
|
@@ -355,8 +359,11 @@ function shellQuoted(binary, shell) {
|
|
|
355
359
|
* with the timeout named first.
|
|
356
360
|
*/
|
|
357
361
|
function failureMessage(res, code, timeoutMs) {
|
|
362
|
+
// A line that is one long run of base64/base64url characters is an encoded
|
|
363
|
+
// blob (a token, encrypted reasoning), never a sentence that says why the
|
|
364
|
+
// CLI failed. JSON and URLs have characters outside that set and stay.
|
|
358
365
|
const lines = (s) => String(s || '').split(/\r?\n/).map((l) => l.trim())
|
|
359
|
-
.filter((l) => l && !BENIGN_OUTPUT.test(l));
|
|
366
|
+
.filter((l) => l && !BENIGN_OUTPUT.test(l) && !/^[A-Za-z0-9+/=._-]{24,}$/.test(l));
|
|
360
367
|
const all = [...lines(res.stderr), ...lines(res.stdout)];
|
|
361
368
|
const telling = all.find((l) => classifyOutputText(l.toLowerCase()) === code);
|
|
362
369
|
const detail = tail(telling || lines(res.stderr).join('\n') || lines(res.stdout).join('\n'), OUTPUT_CAP);
|
|
@@ -660,4 +667,4 @@ async function probeAgentType(connector, type, opts = {}) {
|
|
|
660
667
|
});
|
|
661
668
|
}
|
|
662
669
|
|
|
663
|
-
module.exports = { probeAgentType, classifyFailure, buildGuidance, authFlavor, installCommandFor, scrub, CODE, DEFAULT_TIMEOUT_MS };
|
|
670
|
+
module.exports = { probeAgentType, classifyFailure, buildGuidance, authFlavor, installCommandFor, scrub, failureMessage, CODE, DEFAULT_TIMEOUT_MS };
|