@openagents-org/agent-launcher 0.2.229 → 0.2.230
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/src/adapters/codearts.js +1 -0
- package/src/adapters/codex.js +67 -13
- package/src/adapters/mimo-code.js +1 -0
- package/src/adapters/opencode.js +49 -1
- package/src/probe.js +37 -1
package/package.json
CHANGED
package/src/adapters/codearts.js
CHANGED
|
@@ -82,6 +82,7 @@ const FAILURE_MESSAGES = {
|
|
|
82
82
|
process_crashed: 'CodeArts Agent exited unexpectedly. Open diagnostics or retry.',
|
|
83
83
|
cwd_unavailable: "CodeArts Agent's working directory is not accessible. Check the agent's configured path (or agent home) permissions.",
|
|
84
84
|
config_invalid: 'CodeArts Agent would not start because one of its config files is invalid — the file and what is wrong with it are below. Correct or remove that entry, then retry.',
|
|
85
|
+
malformed_tool_call: "The model sent back a tool call CodeArts Agent could not read (it named no tool), so the run stopped. This comes from the model or the endpoint serving it, not from this agent's settings: retry, and if it keeps happening, switch this agent to another model or provider.",
|
|
85
86
|
unknown_error: 'CodeArts Agent failed for an undetermined reason. Open diagnostics or retry.',
|
|
86
87
|
};
|
|
87
88
|
|
package/src/adapters/codex.js
CHANGED
|
@@ -522,6 +522,11 @@ class CodexAdapter extends BaseAdapter {
|
|
|
522
522
|
// error left in daemon.log. Say it stopped, and why.
|
|
523
523
|
if (CodexAdapter._endedEarly(result)) {
|
|
524
524
|
await this._sendRunFailure(msgChannel, result, { partial: true });
|
|
525
|
+
// Failed after some text (an auto-compaction refused mid-turn):
|
|
526
|
+
// the reply is posted, so no rerun, but the next message must not
|
|
527
|
+
// resume the same thread and fail again.
|
|
528
|
+
const unusable = threadId ? CodexAdapter._unusableThread(result) : null;
|
|
529
|
+
if (unusable) await this._dropThread(msgChannel, unusable);
|
|
525
530
|
}
|
|
526
531
|
return;
|
|
527
532
|
} else if (!planRetried && !this._effectiveModel() && !this._customProvider
|
|
@@ -549,17 +554,13 @@ class CodexAdapter extends BaseAdapter {
|
|
|
549
554
|
} catch {}
|
|
550
555
|
attempt--;
|
|
551
556
|
continue;
|
|
552
|
-
} else if (threadId && attempt === 0 && CodexAdapter.
|
|
553
|
-
// The thread holds
|
|
554
|
-
//
|
|
555
|
-
//
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
this.
|
|
559
|
-
try {
|
|
560
|
-
await this.sendStatus(msgChannel, 'This Codex conversation grew past what the model API accepts, '
|
|
561
|
-
+ 'so it continues in a new one. Earlier context in this thread is not carried over.');
|
|
562
|
-
} catch {}
|
|
557
|
+
} else if (threadId && attempt === 0 && CodexAdapter._unusableThread(result)) {
|
|
558
|
+
// The thread holds something the service will no longer take (an
|
|
559
|
+
// item over an API limit, or reasoning sealed for another account),
|
|
560
|
+
// and codex resends the whole thread with every turn, so every later
|
|
561
|
+
// message in this channel failed the same way. Only a new thread
|
|
562
|
+
// runs again.
|
|
563
|
+
await this._dropThread(msgChannel, CodexAdapter._unusableThread(result));
|
|
563
564
|
continue;
|
|
564
565
|
} else if (result.exitCode !== 0 && threadId && attempt === 0 && !result.turnStarted && !CodexAdapter._serviceRefused(result)) {
|
|
565
566
|
// Stale thread — clear and retry fresh. Only when the turn never
|
|
@@ -572,13 +573,16 @@ class CodexAdapter extends BaseAdapter {
|
|
|
572
573
|
delete this._channelThreads[msgChannel];
|
|
573
574
|
this._saveSessions();
|
|
574
575
|
continue;
|
|
575
|
-
} else if (fromAgent && CodexAdapter._finishedQuietly(result)) {
|
|
576
|
+
} else if (fromAgent && !result.ranTools && CodexAdapter._finishedQuietly(result)) {
|
|
576
577
|
// Another agent wrote ("received", "noted") and codex ended its
|
|
577
578
|
// turn with nothing to add, as the prompt tells it to. Posting
|
|
578
579
|
// "Codex couldn't run" for that read as a failure: the daily errors
|
|
579
580
|
// dashboard of 2026-11-17 had one agent post it 14 times in two
|
|
580
581
|
// minutes while two agents acknowledged each other. A status says
|
|
581
|
-
// so and wakes nobody. A person's message still gets the error
|
|
582
|
+
// so and wakes nobody. A person's message still gets the error, and
|
|
583
|
+
// so does a turn that ran commands or edited files and then said
|
|
584
|
+
// nothing: that was a task, and whoever asked for it has to hear
|
|
585
|
+
// that no answer came.
|
|
582
586
|
this._log(`Turn from another agent in ${msgChannel} ended with no reply; not posting one`);
|
|
583
587
|
try { await this.sendStatus(msgChannel, 'Nothing to add, so no reply was posted.'); } catch {}
|
|
584
588
|
return;
|
|
@@ -637,6 +641,7 @@ class CodexAdapter extends BaseAdapter {
|
|
|
637
641
|
let lastErrorMessage = '';
|
|
638
642
|
let turnFailed = false;
|
|
639
643
|
let turnStarted = false;
|
|
644
|
+
let ranTools = false;
|
|
640
645
|
let reconnectNoted = false;
|
|
641
646
|
let _pendingLines = Promise.resolve();
|
|
642
647
|
|
|
@@ -678,6 +683,7 @@ class CodexAdapter extends BaseAdapter {
|
|
|
678
683
|
try { await this.sendThinking(msgChannel, item.text); } catch {}
|
|
679
684
|
} else if (item.type === 'command_execution') {
|
|
680
685
|
hasToolUseSinceLastText = true;
|
|
686
|
+
ranTools = true;
|
|
681
687
|
const cmdText = (item.command || '').slice(0, 200);
|
|
682
688
|
const exitCode = item.exit_code;
|
|
683
689
|
const output = (item.output || '').slice(0, 500);
|
|
@@ -689,6 +695,7 @@ class CodexAdapter extends BaseAdapter {
|
|
|
689
695
|
this._log(`Command: ${cmdText} → exit ${exitCode}`);
|
|
690
696
|
} else if (item.type === 'file_change') {
|
|
691
697
|
hasToolUseSinceLastText = true;
|
|
698
|
+
ranTools = true;
|
|
692
699
|
// codex reports the edited files in `changes`; `filename` is the
|
|
693
700
|
// legacy shape and was always empty on current CLIs.
|
|
694
701
|
const filename = Array.isArray(item.changes) && item.changes.length
|
|
@@ -754,6 +761,7 @@ class CodexAdapter extends BaseAdapter {
|
|
|
754
761
|
errorMessage: lastErrorMessage,
|
|
755
762
|
turnFailed,
|
|
756
763
|
turnStarted,
|
|
764
|
+
ranTools,
|
|
757
765
|
});
|
|
758
766
|
});
|
|
759
767
|
|
|
@@ -894,6 +902,52 @@ class CodexAdapter extends BaseAdapter {
|
|
|
894
902
|
return /array_above_max_length|context_length_exceeded/i.test(reason);
|
|
895
903
|
}
|
|
896
904
|
|
|
905
|
+
/**
|
|
906
|
+
* Why the channel's thread can no longer be resumed, as `{ log, status }`
|
|
907
|
+
* (what the daemon log and the channel are told), or null when it can.
|
|
908
|
+
*/
|
|
909
|
+
static _unusableThread(result) {
|
|
910
|
+
if (CodexAdapter._threadTooLarge(result)) {
|
|
911
|
+
return {
|
|
912
|
+
log: 'exceeds an API limit',
|
|
913
|
+
status: 'This Codex conversation grew past what the model API accepts, so it continues in a new one. '
|
|
914
|
+
+ 'Earlier context in this thread is not carried over.',
|
|
915
|
+
};
|
|
916
|
+
}
|
|
917
|
+
if (CodexAdapter._threadUnverifiable(result)) {
|
|
918
|
+
return {
|
|
919
|
+
log: 'holds content this account cannot verify',
|
|
920
|
+
status: 'Codex could no longer read back this conversation\'s earlier turns (this happens after Codex is '
|
|
921
|
+
+ 'signed in to a different account), so it continues in a new one. Earlier context in this thread is not '
|
|
922
|
+
+ 'carried over.',
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
return null;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
/** Forget the channel's thread, and say why in the log and the channel. */
|
|
929
|
+
async _dropThread(msgChannel, { log, status }) {
|
|
930
|
+
this._log(`Thread ${this._channelThreads[msgChannel]} for ${msgChannel} ${log}; starting a new one`);
|
|
931
|
+
delete this._channelThreads[msgChannel];
|
|
932
|
+
this._saveSessions();
|
|
933
|
+
try { await this.sendStatus(msgChannel, status); } catch {}
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* True when the service could not verify the thread's encrypted reasoning.
|
|
938
|
+
* Seen as `Error running remote compact task: {"error":{"message":"The
|
|
939
|
+
* encrypted content for item rs_… could not be verified. Reason: Encrypted
|
|
940
|
+
* content item_id did not match the target item id.", "code":
|
|
941
|
+
* "invalid_encrypted_content"}}` on every message of two agents, after their
|
|
942
|
+
* user signed Codex in to another ChatGPT account: the items were sealed for
|
|
943
|
+
* the old one, and codex resends them each turn. The run's error, else what
|
|
944
|
+
* its stderr gives as the reason (_stderrReason), as for _threadTooLarge.
|
|
945
|
+
*/
|
|
946
|
+
static _threadUnverifiable({ errorMessage, stderr } = {}) {
|
|
947
|
+
const reason = String(errorMessage || '').trim() || CodexAdapter._stderrReason(stderr);
|
|
948
|
+
return /invalid_encrypted_content|encrypted content\b.{0,120}\bcould not be (?:verified|decrypted)/i.test(reason);
|
|
949
|
+
}
|
|
950
|
+
|
|
897
951
|
/**
|
|
898
952
|
* True when the model service turned the run away (rate limit, quota,
|
|
899
953
|
* credentials, network) — nothing to do with the thread being resumed. Such
|
|
@@ -95,6 +95,7 @@ const FAILURE_MESSAGES = {
|
|
|
95
95
|
cwd_unavailable: "MiMo Code's working directory is not accessible. Check the agent's configured path (or agent home) permissions.",
|
|
96
96
|
session_missing: 'MiMo Code no longer has this conversation\'s session. Send the message again to start a new one.',
|
|
97
97
|
config_invalid: 'MiMo Code would not start because one of its config files is invalid — the file and what is wrong with it are below. Correct or remove that entry, then retry.',
|
|
98
|
+
malformed_tool_call: "The model sent back a tool call MiMo Code could not read (it named no tool), so the run stopped. This comes from the model or the endpoint serving it, not from this agent's settings: retry, and if it keeps happening, switch this agent to another model or provider.",
|
|
98
99
|
unknown_error: 'MiMo Code failed for an undetermined reason. Open diagnostics or retry.',
|
|
99
100
|
};
|
|
100
101
|
|
package/src/adapters/opencode.js
CHANGED
|
@@ -132,6 +132,7 @@ const FAILURE_MESSAGES = {
|
|
|
132
132
|
process_crashed: 'OpenCode exited unexpectedly. Open diagnostics or retry.',
|
|
133
133
|
cwd_unavailable: "OpenCode's working directory is not accessible. Check the agent's configured path (or agent home) permissions.",
|
|
134
134
|
shared_db_migrated: "OpenCode could not open its session database: a newer OpenCode (2.x, or the OpenCode desktop app) on this device has converted it to a format the OpenCode CLI that OpenAgents runs cannot read, and running it on a database of its own did not help either. Reinstall OpenCode from the launcher, or set OPENCODE_DB in this agent's configuration to the full path of a new file, then retry.",
|
|
135
|
+
malformed_tool_call: "The model sent back a tool call OpenCode could not read (it named no tool), so the run stopped. This comes from the model or the endpoint serving it, not from this agent's settings: retry, and if it keeps happening, switch this agent to another model or provider.",
|
|
135
136
|
config_invalid: 'OpenCode would not start because one of its config files is invalid — the file and what is wrong with it are below. OpenCode reads it on every run, so every message fails until it is fixed: correct or remove that entry, then retry.',
|
|
136
137
|
unknown_error: 'OpenCode failed for an undetermined reason. Open diagnostics or retry.',
|
|
137
138
|
};
|
|
@@ -301,7 +302,8 @@ class OpenCodeAdapter extends BaseAdapter {
|
|
|
301
302
|
* their rules alone.
|
|
302
303
|
*/
|
|
303
304
|
static _userRulesExternalDirs(env, runCwd) {
|
|
304
|
-
const mentions = (text) => /external_directory
|
|
305
|
+
const mentions = (text) => /external_directory/.test(String(text || ''))
|
|
306
|
+
|| OpenCodeAdapter._setsEveryPermission(String(text || ''));
|
|
305
307
|
if (mentions(env.OPENCODE_CONFIG_CONTENT)) return true;
|
|
306
308
|
const home = env.HOME || env.USERPROFILE || os.homedir();
|
|
307
309
|
const globalDir = path.join(env.XDG_CONFIG_HOME || path.join(home, '.config'), 'opencode');
|
|
@@ -319,6 +321,38 @@ class OpenCodeAdapter extends BaseAdapter {
|
|
|
319
321
|
});
|
|
320
322
|
}
|
|
321
323
|
|
|
324
|
+
/**
|
|
325
|
+
* Whether a config's text sets every permission at once: `"permission":
|
|
326
|
+
* "deny"`, or a `"*"` key anywhere in the permission object — not only as
|
|
327
|
+
* its first key: `{"bash": {"git *": "allow"}, "*": "deny"}` was read as
|
|
328
|
+
* no rule, and the external_directory allow then went over a lockdown.
|
|
329
|
+
* Only the object's own keys count, not a `"*"` inside a nested rule.
|
|
330
|
+
*/
|
|
331
|
+
static _setsEveryPermission(text) {
|
|
332
|
+
const re = /"permission"\s*:\s*/g;
|
|
333
|
+
for (let m = re.exec(text); m; m = re.exec(text)) {
|
|
334
|
+
let i = m.index + m[0].length;
|
|
335
|
+
if (text[i] === '"') return true;
|
|
336
|
+
if (text[i] !== '{') continue;
|
|
337
|
+
let depth = 0;
|
|
338
|
+
let inString = false;
|
|
339
|
+
for (let start = i; i < text.length; i++) {
|
|
340
|
+
const c = text[i];
|
|
341
|
+
if (inString) {
|
|
342
|
+
if (c === '\\') i++;
|
|
343
|
+
else if (c === '"') {
|
|
344
|
+
inString = false;
|
|
345
|
+
// A key of the permission object itself.
|
|
346
|
+
if (depth === 1 && text.slice(start, i + 1) === '"*"' && /^\s*:/.test(text.slice(i + 1))) return true;
|
|
347
|
+
}
|
|
348
|
+
} else if (c === '"') { inString = true; start = i; }
|
|
349
|
+
else if (c === '{') depth++;
|
|
350
|
+
else if (c === '}' && --depth === 0) break;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
|
|
322
356
|
_spawnEnv(channel, { contextFile = null } = {}) {
|
|
323
357
|
const env = { ...(this.agentEnv || process.env) };
|
|
324
358
|
if (!env.OPENCODE_DB && fs.existsSync(ownDbPath())) env.OPENCODE_DB = ownDbPath();
|
|
@@ -1324,6 +1358,12 @@ class OpenCodeAdapter extends BaseAdapter {
|
|
|
1324
1358
|
else if (roles[part.messageID] === 'assistant') emit(part);
|
|
1325
1359
|
} else if (ev.type === 'message.part.delta' && props.sessionID === sid) {
|
|
1326
1360
|
watchdog.touch();
|
|
1361
|
+
} else if ((ev.type === 'message.part.updated' && props.part && children.has(props.part.sessionID))
|
|
1362
|
+
|| (ev.type === 'message.part.delta' && children.has(props.sessionID))) {
|
|
1363
|
+
// A subagent at work is the turn at work: its parts are not this
|
|
1364
|
+
// channel's reply, but a long task run in a child session left the
|
|
1365
|
+
// turn's own session quiet until the watchdog stopped it.
|
|
1366
|
+
watchdog.touch();
|
|
1327
1367
|
}
|
|
1328
1368
|
});
|
|
1329
1369
|
const stopping = () => this._stoppingChannels.has(msgChannel);
|
|
@@ -1817,6 +1857,14 @@ class OpenCodeAdapter extends BaseAdapter {
|
|
|
1817
1857
|
category = 'network_error';
|
|
1818
1858
|
} else if (has(/\b5\d\d\b|server error|internal server|bad gateway|service unavailable|gateway timeout|server is busy|system is busy|系统繁忙|服务繁忙|đang bận/)) {
|
|
1819
1859
|
category = 'provider_server_error';
|
|
1860
|
+
} else if (has(/expected '?function\.name'? to be a string/)) {
|
|
1861
|
+
// The provider streamed a tool call with no tool name, and the AI SDK
|
|
1862
|
+
// under OpenCode refused it: "Expected 'function.name' to be a string."
|
|
1863
|
+
// Six times in a row from one user's agents on GLM / DeepSeek models
|
|
1864
|
+
// (daily errors dashboard, 2026-11-18), each read as "OpenCode failed
|
|
1865
|
+
// for an undetermined reason". After the provider categories: a key,
|
|
1866
|
+
// credit or network failure in the same output is the cause to report.
|
|
1867
|
+
category = 'malformed_tool_call';
|
|
1820
1868
|
} else if (has(/timeout|timed out/)) {
|
|
1821
1869
|
category = 'timeout';
|
|
1822
1870
|
} else if (err) {
|
package/src/probe.js
CHANGED
|
@@ -69,6 +69,7 @@ const CODE = {
|
|
|
69
69
|
CLI_ERROR: 'cli_error',
|
|
70
70
|
INSTALL_INCOMPLETE: 'install_incomplete',
|
|
71
71
|
ENDPOINT_INCOMPATIBLE: 'endpoint_incompatible',
|
|
72
|
+
CLIENT_ONLY: 'client_only',
|
|
72
73
|
};
|
|
73
74
|
|
|
74
75
|
const BENIGN_OUTPUT = BENIGN_CLI_OUTPUT;
|
|
@@ -172,7 +173,7 @@ function classifyOutputText(text) {
|
|
|
172
173
|
// "Model 'x' is not available. This gateway only allows: …" is how the
|
|
173
174
|
// OpenAgents gateway refuses a model; read as a CLI error it sent people to
|
|
174
175
|
// a terminal to debug a model name.
|
|
175
|
-
if (/unrecognized_model|model_not_found|invalid model|no such model|issue with the selected model|unknown model|model.{0,40}(does not exist|not found|not exist|is not supported|is not available)/.test(text)) return CODE.BAD_MODEL;
|
|
176
|
+
if (/unrecognized_model|model_not_found|invalid model|no such model|model must be a (?:valid )?model id|issue with the selected model|unknown model|model.{0,40}(does not exist|not found|not exist|is not supported|is not available)/.test(text)) return CODE.BAD_MODEL;
|
|
176
177
|
if (/\b50[234]\b|service (is )?(temporarily )?unavailable|temporarily unavailable|bad gateway|gateway time-?out/.test(text)) return CODE.SERVICE_UNAVAILABLE;
|
|
177
178
|
return null;
|
|
178
179
|
}
|
|
@@ -294,6 +295,9 @@ function buildGuidance(code, entry, agentEnv, extra = {}) {
|
|
|
294
295
|
async function directApiVerdict(agentEnv, entry, model, baseUrl, protocol) {
|
|
295
296
|
const res = await callLLM(agentEnv, model, baseUrl, protocol);
|
|
296
297
|
if (!res || res.success) return null;
|
|
298
|
+
// The endpoint turned the test away for not being the agent's CLI; that
|
|
299
|
+
// says nothing about the CLI's own run.
|
|
300
|
+
if (clientOnlyRefusal(res.error)) return null;
|
|
297
301
|
const code = directFailureCode(res.error, protocol);
|
|
298
302
|
if (code === CODE.CLI_ERROR) return null;
|
|
299
303
|
return {
|
|
@@ -386,6 +390,28 @@ function directFailureCode(error, protocol) {
|
|
|
386
390
|
return classifyFailure(error, {});
|
|
387
391
|
}
|
|
388
392
|
|
|
393
|
+
/**
|
|
394
|
+
* A relay that serves only the coding CLIs it recognises, and refused the
|
|
395
|
+
* direct test for not being one: `HTTP 403: {"error":{"code":
|
|
396
|
+
* "client_not_allowed","message":"本站仅支持编程客户端使用:Codex、Claude Code、
|
|
397
|
+
* OpenCode、…"}}`. Read as any 403, it came back "invalid API key" — eight
|
|
398
|
+
* times in a minute for one OpenCode agent on the daily errors dashboard of
|
|
399
|
+
* 2026-11-18 — for a key the CLI itself may well be let through with. Only
|
|
400
|
+
* these words: an English "only allows authorized clients" is as likely a
|
|
401
|
+
* key refused for real.
|
|
402
|
+
*/
|
|
403
|
+
const CLIENT_ONLY_REFUSAL = /client_not_allowed|仅支持[^。.\n]{0,24}客户端/i;
|
|
404
|
+
|
|
405
|
+
/** The start of a refusal, where its code and reason are, scrubbed and capped. */
|
|
406
|
+
function head(text, cap) {
|
|
407
|
+
const s = scrub(String(text || '').trim());
|
|
408
|
+
return s.length > cap ? `${s.slice(0, cap)}…` : s;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
function clientOnlyRefusal(error) {
|
|
412
|
+
return CLIENT_ONLY_REFUSAL.test(String(error || ''));
|
|
413
|
+
}
|
|
414
|
+
|
|
389
415
|
/** The field a refusing endpoint named (`"param":"client_metadata"`), or ''. */
|
|
390
416
|
function refusedParam(error) {
|
|
391
417
|
const m = /"param"\s*:\s*"([^"]{1,64})"/.exec(String(error || ''));
|
|
@@ -912,6 +938,16 @@ async function probeAgentType(connector, type, opts = {}) {
|
|
|
912
938
|
reply: tail(res.response || '', REPLY_CAP),
|
|
913
939
|
});
|
|
914
940
|
}
|
|
941
|
+
// Could not be checked, not failed: the endpoint only answers the coding
|
|
942
|
+
// CLIs it recognises, and this test is not one of them.
|
|
943
|
+
if (res && clientOnlyRefusal(res.error)) {
|
|
944
|
+
return done({
|
|
945
|
+
ok: null, method: 'llm_api', code: CODE.CLIENT_ONLY,
|
|
946
|
+
message: 'This endpoint only takes requests from the coding tools it recognises, and it turned away the '
|
|
947
|
+
+ `connection test, which calls it directly (${head(res.error, 240)}). The key and model could not be `
|
|
948
|
+
+ 'checked ahead of time; send the agent a message, and a normal reply confirms it works.',
|
|
949
|
+
});
|
|
950
|
+
}
|
|
915
951
|
const code = directFailureCode(res && res.error, protocol);
|
|
916
952
|
return done({
|
|
917
953
|
ok: false, method: 'llm_api', code,
|