@openagents-org/agent-launcher 0.2.228 → 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/base.js +9 -1
- package/src/adapters/codearts.js +1 -0
- package/src/adapters/codex.js +142 -17
- package/src/adapters/cursor.js +1 -1
- package/src/adapters/mimo-code.js +1 -0
- package/src/adapters/opencode-server.js +254 -0
- package/src/adapters/opencode.js +349 -36
- package/src/adapters/workspace-prompt.js +65 -18
- package/src/cli-models.js +37 -1
- package/src/cli.js +1 -1
- package/src/installer.js +26 -2
- package/src/mcp-server.js +53 -3
- package/src/probe.js +199 -16
- package/src/workspace-client.js +21 -0
package/src/probe.js
CHANGED
|
@@ -27,7 +27,9 @@
|
|
|
27
27
|
* of anything key-shaped before it leaves this module.
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
+
const fs = require('fs');
|
|
30
31
|
const os = require('os');
|
|
32
|
+
const path = require('path');
|
|
31
33
|
// spawn() here is the WSL bridge from ./wsl: same signature as
|
|
32
34
|
// child_process.spawn, and a straight pass-through unless the resolved CLI
|
|
33
35
|
// lives on the other side of the Windows/WSL boundary.
|
|
@@ -38,6 +40,7 @@ const { decodeConsoleOutput, BENIGN_CLI_OUTPUT, stripCliNoise, redactSecrets } =
|
|
|
38
40
|
const { formatAuthGuidance } = require('./auth-guidance');
|
|
39
41
|
const { isCliLogin, stripForCliLogin, typeEnvFor } = require('./env');
|
|
40
42
|
const { configuredModel } = require('./agent-model');
|
|
43
|
+
const { codexPlanRefusedModel, codexAccountModels, codexPlanFallback } = require('./cli-models');
|
|
41
44
|
|
|
42
45
|
const PROBE_PROMPT = 'hi';
|
|
43
46
|
const DEFAULT_TIMEOUT_MS = 90_000;
|
|
@@ -66,6 +69,7 @@ const CODE = {
|
|
|
66
69
|
CLI_ERROR: 'cli_error',
|
|
67
70
|
INSTALL_INCOMPLETE: 'install_incomplete',
|
|
68
71
|
ENDPOINT_INCOMPATIBLE: 'endpoint_incompatible',
|
|
72
|
+
CLIENT_ONLY: 'client_only',
|
|
69
73
|
};
|
|
70
74
|
|
|
71
75
|
const BENIGN_OUTPUT = BENIGN_CLI_OUTPUT;
|
|
@@ -153,9 +157,14 @@ function classifyOutputText(text) {
|
|
|
153
157
|
// completion" or, refreshing its model list, "failed to refresh available
|
|
154
158
|
// models: request timed out" — on a device that cannot reach chatgpt.com
|
|
155
159
|
// that was all the probe saw before its clock ran out, and it was reported
|
|
156
|
-
// as a CLI waiting for a login prompt.
|
|
157
|
-
|
|
160
|
+
// as a CLI waiting for a login prompt. With no route at all it prints
|
|
161
|
+
// "Reconnecting... waiting for network" until the clock runs out.
|
|
162
|
+
if (/enotfound|econnrefused|econnreset|etimedout|eai_again|fetch failed|socket hang up|network error|error sending request|request to \S+ timed out|self[- ]signed certificate|unable to get local issuer|connection failed|stream disconnected before completion|failed to lookup address|dns error|tls handshake|failed to refresh available models: request timed out|reconnecting\.{3} waiting for network/.test(text)) return CODE.NETWORK;
|
|
158
163
|
if (/api key.{0,24}(not set|not found|missing)|no api key|missing api key|environment variable.{0,40}(is )?(not set|required)/.test(text)) return CODE.MISSING_API_KEY;
|
|
164
|
+
// Codex with no sign-in at all sends no credential: "401 Unauthorized:
|
|
165
|
+
// Missing bearer … authentication", or for a ChatGPT workspace "workspace
|
|
166
|
+
// routing discovery unauthorized (401)". Nothing to re-enter, a sign-in.
|
|
167
|
+
if (/missing bearer|workspace routing discovery unauthorized/.test(text)) return CODE.NOT_LOGGED_IN;
|
|
159
168
|
if (/invalid.{0,12}(api.?key|x-api-key|token)|incorrect api key|authentication[_ ]?error|invalid credentials|\b401\b|unauthorized|forbidden|\b403\b/.test(text)) return CODE.INVALID_API_KEY;
|
|
160
169
|
// A sign-in that exists but has run out — Claude Code: "Failed to
|
|
161
170
|
// authenticate: OAuth session expired and could not be refreshed".
|
|
@@ -164,14 +173,17 @@ function classifyOutputText(text) {
|
|
|
164
173
|
// "Model 'x' is not available. This gateway only allows: …" is how the
|
|
165
174
|
// OpenAgents gateway refuses a model; read as a CLI error it sent people to
|
|
166
175
|
// a terminal to debug a model name.
|
|
167
|
-
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;
|
|
168
177
|
if (/\b50[234]\b|service (is )?(temporarily )?unavailable|temporarily unavailable|bad gateway|gateway time-?out/.test(text)) return CODE.SERVICE_UNAVAILABLE;
|
|
169
178
|
return null;
|
|
170
179
|
}
|
|
171
180
|
|
|
172
181
|
function classifyFailure(output, { timedOut = false, spawnError = null } = {}) {
|
|
173
182
|
if (spawnError && /ENOENT/.test(String(spawnError))) return CODE.NOT_INSTALLED;
|
|
174
|
-
|
|
183
|
+
// Notices (see PROBE_NOISE) never decide the verdict: Claude Code's "this
|
|
184
|
+
// sign-in ends between …, run claude auth login before then" read as
|
|
185
|
+
// "not logged in" on a sign-in that still worked.
|
|
186
|
+
const text = withoutProbeNotices(output).toLowerCase();
|
|
175
187
|
if (timedOut) {
|
|
176
188
|
// A CLI that retries a hard API error (bad key, unknown model, quota)
|
|
177
189
|
// until the probe clock runs out is NOT "waiting for interactive input" —
|
|
@@ -283,6 +295,9 @@ function buildGuidance(code, entry, agentEnv, extra = {}) {
|
|
|
283
295
|
async function directApiVerdict(agentEnv, entry, model, baseUrl, protocol) {
|
|
284
296
|
const res = await callLLM(agentEnv, model, baseUrl, protocol);
|
|
285
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;
|
|
286
301
|
const code = directFailureCode(res.error, protocol);
|
|
287
302
|
if (code === CODE.CLI_ERROR) return null;
|
|
288
303
|
return {
|
|
@@ -375,6 +390,28 @@ function directFailureCode(error, protocol) {
|
|
|
375
390
|
return classifyFailure(error, {});
|
|
376
391
|
}
|
|
377
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
|
+
|
|
378
415
|
/** The field a refusing endpoint named (`"param":"client_metadata"`), or ''. */
|
|
379
416
|
function refusedParam(error) {
|
|
380
417
|
const m = /"param"\s*:\s*"([^"]{1,64})"/.exec(String(error || ''));
|
|
@@ -439,6 +476,64 @@ function mostlyEncoded(line) {
|
|
|
439
476
|
return encoded * 2 >= body.length;
|
|
440
477
|
}
|
|
441
478
|
|
|
479
|
+
/**
|
|
480
|
+
* Lines a CLI prints on a run that say nothing about why it failed, so a
|
|
481
|
+
* failed test never quotes them as the reason, and the classifier never reads
|
|
482
|
+
* them. Each was quoted as the reason on the daily errors dashboard:
|
|
483
|
+
* - the `codex exec` banner (version, workdir, model, sandbox, session id)
|
|
484
|
+
* and its echo of the prompt;
|
|
485
|
+
* - Codex's notices about the user's own config.toml (settings it ignores,
|
|
486
|
+
* under-development features, a skill file it could not load);
|
|
487
|
+
* - Gemini's "Ripgrep is not available" and duplicate-skill notices;
|
|
488
|
+
* - Claude Code's untrusted-folder permissions notice, and its "this sign-in
|
|
489
|
+
* ends between …" reminder, which read as "not logged in" though the
|
|
490
|
+
* sign-in still worked.
|
|
491
|
+
*/
|
|
492
|
+
const PROBE_NOISE = new RegExp([
|
|
493
|
+
/^OpenAI Codex v\d/,
|
|
494
|
+
/^-{4,}$/,
|
|
495
|
+
/^(workdir|model|provider|approval|sandbox|reasoning effort|reasoning summaries|session id): \S+$/,
|
|
496
|
+
/^(user|hi)$/,
|
|
497
|
+
/^hook: /,
|
|
498
|
+
/^mcp startup:/,
|
|
499
|
+
/^warning: Codex is ignoring \d+ unrecognized configuration setting/i,
|
|
500
|
+
/^(user|project|session-flags)\b.*: `[^`]+` is ignored\.?$/,
|
|
501
|
+
/Under-development features (enabled|are incomplete)/,
|
|
502
|
+
/\bfailed to load skill\b/,
|
|
503
|
+
/^warning: Codex could not find bubblewrap/i,
|
|
504
|
+
/^WARNING: proceeding, even though we could not create PATH aliases/,
|
|
505
|
+
/^Ripgrep is not available/,
|
|
506
|
+
/is overriding the same skill from/,
|
|
507
|
+
/^Ignoring \d+ permissions\.\w+ entries/,
|
|
508
|
+
/^Warning: this sign-in ends between/,
|
|
509
|
+
].map((r) => r.source).join('|'), 'i');
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Codex prefixes a failed WebSocket attempt's reason with this notice ("…
|
|
513
|
+
* transport. unexpected status 401 Unauthorized: Missing bearer …"); the
|
|
514
|
+
* reason after it is what matters.
|
|
515
|
+
*/
|
|
516
|
+
const CODEX_WS_FALLBACK = /^\s*warning: Falling back from WebSockets to HTTPS transport\.\s*/i;
|
|
517
|
+
|
|
518
|
+
/** One line of CLI output with the notices above taken off; '' when it was only notice. */
|
|
519
|
+
function probeLine(line) {
|
|
520
|
+
const l = String(line).replace(CODEX_WS_FALLBACK, '').trim();
|
|
521
|
+
return l && !PROBE_NOISE.test(l) ? l : '';
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/** CLI output without the notices above. */
|
|
525
|
+
function withoutProbeNotices(text) {
|
|
526
|
+
return String(text || '').split(/\r?\n/).map(probeLine).filter(Boolean).join('\n');
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/** CLI output without the known-harmless lines (shared and probe-only). */
|
|
530
|
+
function withoutProbeNoise(text) {
|
|
531
|
+
return withoutProbeNotices(withoutNoise(text));
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/** A line that reads as the error itself, when the classifier knows none. */
|
|
535
|
+
const ERRORISH = /\b(error|fatal|failed|failure|denied|refused|unauthorized|forbidden|not supported|no longer supported|invalid|exception)\b/i;
|
|
536
|
+
|
|
442
537
|
/**
|
|
443
538
|
* The one line worth reporting from a failed run.
|
|
444
539
|
*
|
|
@@ -464,23 +559,75 @@ function failureMessage(res, code, timeoutMs) {
|
|
|
464
559
|
// nothing else was said do they stand, rather than no reason at all.
|
|
465
560
|
const LOG_RECORD = /^\d{4}-\d{2}-\d{2}T[\d:.]+Z?\s+(?=(TRACE|DEBUG|INFO|WARN|ERROR)\s)/;
|
|
466
561
|
const SIDE_SERVICE = /\brmcp::|\bcodex_mcp::/;
|
|
467
|
-
|
|
468
|
-
|
|
562
|
+
// `codex exec` opens with a banner (version, workdir, model, sandbox,
|
|
563
|
+
// session id) and echoes the prompt. On a probe that timed out with nothing
|
|
564
|
+
// else said, that banner was quoted as the reason — "Timed out after 120s:
|
|
565
|
+
// OpenAI Codex v0.165.0 -------- workdir: …" — which explains nothing.
|
|
566
|
+
// Noise lines (see PROBE_NOISE) are dropped as well.
|
|
567
|
+
const grouped = (s) => {
|
|
568
|
+
const said = String(s || '').split(/\r?\n/).map((l) => scrub(probeLine(l)))
|
|
469
569
|
.filter((l) => l && !BENIGN_OUTPUT.test(l) && !mostlyEncoded(l) && !/^at\s+\S/.test(l));
|
|
470
570
|
const own = said.filter((l) => !SIDE_SERVICE.test(l));
|
|
471
571
|
const kept = own.length ? own : said;
|
|
472
572
|
const plain = kept.filter((l) => !LOG_RECORD.test(l));
|
|
473
573
|
const logged = kept.filter((l) => LOG_RECORD.test(l)).map((l) => l.replace(LOG_RECORD, ''));
|
|
474
|
-
return
|
|
574
|
+
return { plain, logged };
|
|
475
575
|
};
|
|
576
|
+
const lines = (s) => { const g = grouped(s); return [...g.plain, ...g.logged]; };
|
|
476
577
|
const all = [...lines(res.stderr), ...lines(res.stdout)];
|
|
477
578
|
const telling = all.find((l) => classifyOutputText(l.toLowerCase()) === code);
|
|
478
|
-
|
|
579
|
+
// Nothing the classifier knows: the last line that reads as an error, not
|
|
580
|
+
// the tail of everything. Gemini dumps its account record before
|
|
581
|
+
// "IneligibleTierError: This client is no longer supported…", and the tail
|
|
582
|
+
// began mid-dump.
|
|
583
|
+
// Plain words rank ahead of log records here too.
|
|
584
|
+
const lastErrorish = (ls) => [...ls].reverse().find((l) => ERRORISH.test(l));
|
|
585
|
+
const errorish = (s) => { const g = grouped(s); return lastErrorish(g.plain) || lastErrorish(g.logged); };
|
|
586
|
+
const fallback = errorish(res.stderr) || errorish(res.stdout)
|
|
587
|
+
|| lines(res.stderr).join('\n') || lines(res.stdout).join('\n');
|
|
588
|
+
const detail = tail(telling || fallback, OUTPUT_CAP);
|
|
479
589
|
if (res.timedOut) {
|
|
480
590
|
const prefix = `Timed out after ${Math.round(timeoutMs / 1000)}s`;
|
|
481
591
|
return detail ? `${prefix}: ${detail}` : prefix;
|
|
482
592
|
}
|
|
483
|
-
|
|
593
|
+
if (detail) return detail;
|
|
594
|
+
// "Exited with code 0" said only that the CLI finished.
|
|
595
|
+
return res.code === 0 ? 'The CLI finished without replying' : `Exited with code ${res.code}`;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/** A model id safe to pass on a command line, through a Windows shell too. */
|
|
599
|
+
const CODEX_MODEL_ARG = /^[\w.:@/-]{1,128}$/;
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Codex's probe run, cut down to the one question it asks.
|
|
603
|
+
*
|
|
604
|
+
* `codex exec hi` starts everything the user's ~/.codex/config.toml sets up
|
|
605
|
+
* before it sends "hi": every MCP server (a Figma connector whose host does
|
|
606
|
+
* not answer), every hook, and the built-in ChatGPT apps connector. On a slow
|
|
607
|
+
* or blocked network those alone ran the 120s probe clock out, and the test
|
|
608
|
+
* reported Codex broken when sign-in and model were fine. The real chat run
|
|
609
|
+
* still loads all of it; only the probe leaves it out.
|
|
610
|
+
*
|
|
611
|
+
* Only `-c` overrides, never newer flags: an older Codex rejects a flag it
|
|
612
|
+
* does not know, but ignores (with a warning) a feature it does not know.
|
|
613
|
+
* Server names are taken from the `[mcp_servers.<name>]` tables and only
|
|
614
|
+
* bare names are used, so nothing needs quoting through a Windows shell.
|
|
615
|
+
*/
|
|
616
|
+
function codexProbeArgs(args, env = {}, model = null) {
|
|
617
|
+
if (!Array.isArray(args) || args[0] !== 'exec') return args;
|
|
618
|
+
const home = env.CODEX_HOME || path.join(os.homedir(), '.codex');
|
|
619
|
+
let text = '';
|
|
620
|
+
try { text = fs.readFileSync(path.join(home, 'config.toml'), 'utf8'); } catch {}
|
|
621
|
+
const names = new Set();
|
|
622
|
+
for (const m of text.matchAll(/^[ \t]*\[[ \t]*mcp_servers\.([A-Za-z0-9_-]+)[ \t]*[.\]]/gm)) names.add(m[1]);
|
|
623
|
+
const extra = ['-c', 'features.hooks=false', '-c', 'features.apps=false'];
|
|
624
|
+
for (const name of names) extra.push('-c', `mcp_servers.${name}.enabled=false`);
|
|
625
|
+
// The model the agent's chat runs on (the adapter passes `-m`). Without it
|
|
626
|
+
// the test ran Codex's own default: an agent set to gpt-5.6-luna failed
|
|
627
|
+
// its test on gpt-6.1-sol, which its ChatGPT plan does not include.
|
|
628
|
+
if (model && CODEX_MODEL_ARG.test(model)) extra.push('-m', model);
|
|
629
|
+
// After the subcommand: `codex exec -c … hi`.
|
|
630
|
+
return [args[0], ...extra, ...args.slice(1)];
|
|
484
631
|
}
|
|
485
632
|
|
|
486
633
|
/** Run a CLI to completion with a hard timeout. Never rejects. */
|
|
@@ -646,18 +793,44 @@ async function probeAgentType(connector, type, opts = {}) {
|
|
|
646
793
|
// ── Live tier 1: the agent's own CLI, when the registry declares how ──
|
|
647
794
|
if (hasLiveCli) {
|
|
648
795
|
const shell = probeArgs && health.binary ? shouldUseShellForBinary(health.binary) : true;
|
|
649
|
-
const
|
|
796
|
+
const runProbeCli = (m) => runCommand(shellQuoted(health.binary, shell),
|
|
797
|
+
type === 'codex' ? codexProbeArgs(probeArgs, env, m) : probeArgs, { env, timeoutMs, shell });
|
|
798
|
+
let res = probeArgs && health.binary
|
|
650
799
|
// Node refuses to spawn .cmd/.bat without a shell (EINVAL since the
|
|
651
800
|
// CVE-2024-27980 hardening), which made every Windows CLI probe of an
|
|
652
801
|
// npm-shim binary fail as "Exited with code 1" with no output.
|
|
653
|
-
? await
|
|
802
|
+
? await runProbeCli(model)
|
|
654
803
|
: await runCommand(altCheck, [], { env, timeoutMs, shell: true });
|
|
655
|
-
|
|
656
|
-
|
|
804
|
+
// A ChatGPT sign-in refusing the model Codex ran on. With no model
|
|
805
|
+
// chosen that is Codex's default, and the chat adapter then runs the
|
|
806
|
+
// first model the account lists (adapters/codex.js); test that one. With
|
|
807
|
+
// a model chosen, say which models the account does list.
|
|
808
|
+
let planNote = '';
|
|
809
|
+
const refused = type === 'codex' && probeArgs && health.binary
|
|
810
|
+
? codexPlanRefusedModel(`${res.stdout}\n${res.stderr}`) : null;
|
|
811
|
+
if (refused && !model) {
|
|
812
|
+
let fallback = null;
|
|
813
|
+
try { fallback = await codexPlanFallback(health.binary, env, refused); } catch {}
|
|
814
|
+
if (fallback && CODEX_MODEL_ARG.test(fallback)) {
|
|
815
|
+
res = await runProbeCli(fallback);
|
|
816
|
+
planNote = ` on ${fallback}: Codex's default model (${refused}) isn't included in this ChatGPT plan, so chats use ${fallback}`;
|
|
817
|
+
}
|
|
818
|
+
} else if (refused) {
|
|
819
|
+
let listed = [];
|
|
820
|
+
try { listed = (await codexAccountModels(health.binary, env)).map((m) => m.id); } catch {}
|
|
821
|
+
return done({
|
|
822
|
+
ok: false, method: 'cli', code: CODE.BAD_MODEL,
|
|
823
|
+
message: `${refused} isn't included in this ChatGPT plan.`
|
|
824
|
+
+ (listed.length ? ` Models this account lists: ${listed.slice(0, 8).join(', ')}.` : ''),
|
|
825
|
+
guidance: buildGuidance(CODE.BAD_MODEL, entry, agentEnv),
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
const output = withoutProbeNoise(`${res.stdout}\n${res.stderr}`);
|
|
829
|
+
const reply = withoutProbeNoise(res.stdout).trim();
|
|
657
830
|
if (!res.timedOut && !res.spawnError && res.code === 0 && reply) {
|
|
658
831
|
return done({
|
|
659
832
|
ok: true, method: 'cli', code: CODE.OK,
|
|
660
|
-
message:
|
|
833
|
+
message: `Responded${planNote}`,
|
|
661
834
|
reply: tail(reply, REPLY_CAP),
|
|
662
835
|
});
|
|
663
836
|
}
|
|
@@ -671,7 +844,7 @@ async function probeAgentType(connector, type, opts = {}) {
|
|
|
671
844
|
if (res.timedOut && !res.spawnError && looksLikeAnswer) {
|
|
672
845
|
return done({
|
|
673
846
|
ok: true, method: 'cli', code: CODE.OK,
|
|
674
|
-
message: `Responded (the CLI did not exit within ${Math.round(timeoutMs / 1000)}s)`,
|
|
847
|
+
message: `Responded${planNote} (the CLI did not exit within ${Math.round(timeoutMs / 1000)}s)`,
|
|
675
848
|
reply: tail(reply, REPLY_CAP),
|
|
676
849
|
});
|
|
677
850
|
}
|
|
@@ -765,6 +938,16 @@ async function probeAgentType(connector, type, opts = {}) {
|
|
|
765
938
|
reply: tail(res.response || '', REPLY_CAP),
|
|
766
939
|
});
|
|
767
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
|
+
}
|
|
768
951
|
const code = directFailureCode(res && res.error, protocol);
|
|
769
952
|
return done({
|
|
770
953
|
ok: false, method: 'llm_api', code,
|
|
@@ -787,4 +970,4 @@ async function probeAgentType(connector, type, opts = {}) {
|
|
|
787
970
|
});
|
|
788
971
|
}
|
|
789
972
|
|
|
790
|
-
module.exports = { probeAgentType, classifyFailure, buildGuidance, authFlavor, installCommandFor, scrub, failureMessage, CODE, DEFAULT_TIMEOUT_MS };
|
|
973
|
+
module.exports = { probeAgentType, codexProbeArgs, classifyFailure, buildGuidance, authFlavor, installCommandFor, scrub, failureMessage, CODE, DEFAULT_TIMEOUT_MS };
|
package/src/workspace-client.js
CHANGED
|
@@ -1199,6 +1199,27 @@ class WorkspaceClient {
|
|
|
1199
1199
|
return data.data || data;
|
|
1200
1200
|
}
|
|
1201
1201
|
|
|
1202
|
+
/** Ask for a public "anyone with the link" link to an artifact (POST
|
|
1203
|
+
* /v1/public-shares/requests). Nothing is published: the workspace files
|
|
1204
|
+
* an approval in the thread, and a person who can manage the artifact
|
|
1205
|
+
* decides. Returns the approval record (status "pending"). */
|
|
1206
|
+
async requestPublicShare(workspaceId, token, {
|
|
1207
|
+
channel, kind, id, expires_at, reason, source, requester_email,
|
|
1208
|
+
} = {}) {
|
|
1209
|
+
const body = {
|
|
1210
|
+
network: workspaceId,
|
|
1211
|
+
channel,
|
|
1212
|
+
kind: kind || 'file',
|
|
1213
|
+
id,
|
|
1214
|
+
source: source || 'openagents:unknown',
|
|
1215
|
+
};
|
|
1216
|
+
if (expires_at) body.expires_at = expires_at;
|
|
1217
|
+
if (reason) body.reason = String(reason).slice(0, 500);
|
|
1218
|
+
if (requester_email) body.requester_email = requester_email;
|
|
1219
|
+
const data = await this._post('/v1/public-shares/requests', body, this._wsHeaders(token));
|
|
1220
|
+
return data.data || data;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1202
1223
|
async getApproval(workspaceId, token, approvalId) {
|
|
1203
1224
|
const params = new URLSearchParams({ network: workspaceId });
|
|
1204
1225
|
const data = await this._get(`/v1/approvals/${encodeURIComponent(approvalId)}?${params}`, this._wsHeaders(token));
|