@discovery-tree/runner 0.1.23 → 0.1.24
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/README.md +10 -0
- package/dist/cli.js +128 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -271,6 +271,12 @@ Codex's own sandbox is what keeps a run in its worktree:
|
|
|
271
271
|
Interrupting a Codex turn stops its process (and what it started); the next message resumes the
|
|
272
272
|
conversation. Planning requests are still answered by Claude Code.
|
|
273
273
|
|
|
274
|
+
Which model a Codex run uses is chosen in Discovery Tree's model picker. The runner lists the
|
|
275
|
+
models your Codex offers (`codex debug models`) with each heartbeat, so the picker shows them
|
|
276
|
+
under "Codex (your computer)"; `dt-runner doctor` prints the same list. A Codex too old to list
|
|
277
|
+
models still runs on its own default. The models appear within a few minutes of starting the
|
|
278
|
+
runner (its agent probe is cached for five minutes).
|
|
279
|
+
|
|
274
280
|
## Running Cursor
|
|
275
281
|
|
|
276
282
|
The runner can also run a session with the [Cursor Agent CLI](https://cursor.com/cli) signed in
|
|
@@ -330,6 +336,10 @@ sandbox.
|
|
|
330
336
|
Interrupting a Cursor turn stops its process (and what it started); the next message resumes the
|
|
331
337
|
chat. Planning requests are still answered by Claude Code.
|
|
332
338
|
|
|
339
|
+
The Cursor models come from `cursor-agent --list-models`,
|
|
340
|
+
reported the same way and shown under "Cursor (your computer)" in the picker; `dt-runner doctor`
|
|
341
|
+
prints them too. Without a list, Cursor runs the model its CLI is set to.
|
|
342
|
+
|
|
333
343
|
## Planning on your own Claude Code
|
|
334
344
|
|
|
335
345
|
Turn on **Plan on my own Claude Code** under Account settings → Local runners, and your
|
package/dist/cli.js
CHANGED
|
@@ -22,6 +22,7 @@ var WORKSPACE_KEY_PROVIDER_TYPES = [
|
|
|
22
22
|
var AI_CATEGORY_MODEL_MAX_LENGTH = 200;
|
|
23
23
|
|
|
24
24
|
// ../contracts/src/agent-work.ts
|
|
25
|
+
var OWN_CLAUDE_PROVIDER = "own_claude";
|
|
25
26
|
var AGENT_WORK_IDLE_AFTER_MS = 24 * 60 * 60 * 1e3;
|
|
26
27
|
|
|
27
28
|
// ../contracts/src/default-task-model.ts
|
|
@@ -89,6 +90,15 @@ var AGENT_RUN_MAX_WALL_MS = 6 * 60 * 60 * 1e3;
|
|
|
89
90
|
var AGENT_RUN_ABANDONED_GRACE_MS = 30 * 60 * 1e3;
|
|
90
91
|
var AGENT_RUN_AUTO_RECOVER_MAX_MS = 5 * 6e4;
|
|
91
92
|
|
|
93
|
+
// ../contracts/src/active-run-summary.ts
|
|
94
|
+
var ACTIVE_RUN_AGENT_SHORT = {
|
|
95
|
+
[OWN_CLAUDE_PROVIDER]: "Claude",
|
|
96
|
+
local_claude_code: "Claude",
|
|
97
|
+
local_codex: "Codex",
|
|
98
|
+
local_cursor: "Cursor",
|
|
99
|
+
cursor_cloud: "Cursor"
|
|
100
|
+
};
|
|
101
|
+
|
|
92
102
|
// ../contracts/src/discovered-work.ts
|
|
93
103
|
var MAX_DISCOVERED_TASKS_PER_TURN = 5;
|
|
94
104
|
var EXAMPLE_TITLE = "Return 404 instead of 500 when an invoice id is unknown";
|
|
@@ -679,7 +689,7 @@ function toolGrantRepositoryKey(url) {
|
|
|
679
689
|
var RUN_STUCK_TOOL_CALL_AFTER_MS = 15 * 6e4;
|
|
680
690
|
|
|
681
691
|
// src/version.ts
|
|
682
|
-
var RUNNER_VERSION = true ? "0.1.
|
|
692
|
+
var RUNNER_VERSION = true ? "0.1.24" : "0.0.0-dev";
|
|
683
693
|
var RUNNER_PLATFORM = `${process.platform}-${process.arch}`;
|
|
684
694
|
|
|
685
695
|
// src/api.ts
|
|
@@ -3240,6 +3250,56 @@ function startupHint(stderr) {
|
|
|
3240
3250
|
return "";
|
|
3241
3251
|
}
|
|
3242
3252
|
|
|
3253
|
+
// src/drivers/model-list.ts
|
|
3254
|
+
var MAX_LISTED_MODELS = 200;
|
|
3255
|
+
var MODEL_ID = /^[A-Za-z0-9][\w.:@/-]{0,199}$/;
|
|
3256
|
+
var ANSI = /\u001b\[[0-9;?]*[ -/]*[@-~]/g;
|
|
3257
|
+
function tidy(ids) {
|
|
3258
|
+
const out = [];
|
|
3259
|
+
for (const raw of ids) {
|
|
3260
|
+
const id = raw.trim();
|
|
3261
|
+
if (MODEL_ID.test(id) && !out.includes(id)) out.push(id);
|
|
3262
|
+
if (out.length >= MAX_LISTED_MODELS) break;
|
|
3263
|
+
}
|
|
3264
|
+
return out.length ? out : void 0;
|
|
3265
|
+
}
|
|
3266
|
+
function parseCodexModels(stdout) {
|
|
3267
|
+
const text = stdout.trim();
|
|
3268
|
+
if (!text) return void 0;
|
|
3269
|
+
let parsed;
|
|
3270
|
+
try {
|
|
3271
|
+
parsed = JSON.parse(text);
|
|
3272
|
+
} catch {
|
|
3273
|
+
return void 0;
|
|
3274
|
+
}
|
|
3275
|
+
const list = Array.isArray(parsed) ? parsed : parsed && typeof parsed === "object" ? parsed.models : void 0;
|
|
3276
|
+
if (!Array.isArray(list)) return void 0;
|
|
3277
|
+
const ids = [];
|
|
3278
|
+
for (const item of list) {
|
|
3279
|
+
if (typeof item === "string") {
|
|
3280
|
+
ids.push(item);
|
|
3281
|
+
} else if (item && typeof item === "object") {
|
|
3282
|
+
const m = item;
|
|
3283
|
+
if (typeof m.visibility === "string" && m.visibility !== "list") continue;
|
|
3284
|
+
const id = [m.slug, m.id, m.model, m.name].find((v) => typeof v === "string");
|
|
3285
|
+
if (typeof id === "string") ids.push(id);
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3288
|
+
return tidy(ids);
|
|
3289
|
+
}
|
|
3290
|
+
function parseCursorModels(stdout) {
|
|
3291
|
+
const ids = [];
|
|
3292
|
+
for (const raw of stdout.replace(ANSI, "").split(/\r?\n/)) {
|
|
3293
|
+
const line = raw.replace(/^[\s*•✓-]+(?=[A-Za-z0-9])/, "").trim();
|
|
3294
|
+
if (!line) continue;
|
|
3295
|
+
const m = /^(\S+)(?:\s+-\s+.*)?$/.exec(line);
|
|
3296
|
+
if (m && !m[1].endsWith(":") && (line !== m[1] || /[-.\d]/.test(m[1]) || m[1] === "auto")) {
|
|
3297
|
+
ids.push(m[1]);
|
|
3298
|
+
}
|
|
3299
|
+
}
|
|
3300
|
+
return tidy(ids);
|
|
3301
|
+
}
|
|
3302
|
+
|
|
3243
3303
|
// src/drivers/codex/codex.ts
|
|
3244
3304
|
var CODEX_NPM_SCRIPT = ["node_modules", "@openai", "codex", "bin", "codex.js"];
|
|
3245
3305
|
async function findCodex(env = process.env) {
|
|
@@ -3261,6 +3321,14 @@ async function codexVersion(bin, env = process.env) {
|
|
|
3261
3321
|
return null;
|
|
3262
3322
|
}
|
|
3263
3323
|
}
|
|
3324
|
+
async function codexModels(bin, env = process.env) {
|
|
3325
|
+
try {
|
|
3326
|
+
const res = await runCodex(bin, ["debug", "models"], 2e4, env);
|
|
3327
|
+
return res.code === 0 ? parseCodexModels(res.stdout) : void 0;
|
|
3328
|
+
} catch {
|
|
3329
|
+
return void 0;
|
|
3330
|
+
}
|
|
3331
|
+
}
|
|
3264
3332
|
async function codexAuthStatus(bin, env = process.env) {
|
|
3265
3333
|
try {
|
|
3266
3334
|
const res = await runCodex(bin, ["login", "status"], 2e4, env);
|
|
@@ -3287,7 +3355,7 @@ function codexKeyVariable(env = process.env) {
|
|
|
3287
3355
|
if (env.OPENAI_API_KEY) return "OPENAI_API_KEY";
|
|
3288
3356
|
return null;
|
|
3289
3357
|
}
|
|
3290
|
-
async function probeCodex(env = process.env) {
|
|
3358
|
+
async function probeCodex(env = process.env, opts = {}) {
|
|
3291
3359
|
const bin = await findCodex(env);
|
|
3292
3360
|
if (!bin) {
|
|
3293
3361
|
return {
|
|
@@ -3312,7 +3380,13 @@ async function probeCodex(env = process.env) {
|
|
|
3312
3380
|
codexProblem: "Codex is not signed in. Run `codex login` on this computer."
|
|
3313
3381
|
};
|
|
3314
3382
|
}
|
|
3315
|
-
|
|
3383
|
+
const models = auth.loggedIn === true && opts.models !== false ? await codexModels(bin, env) : void 0;
|
|
3384
|
+
return {
|
|
3385
|
+
codexVersion: version,
|
|
3386
|
+
codexReady: auth.loggedIn,
|
|
3387
|
+
codexProblem: null,
|
|
3388
|
+
...models ? { codexModels: models } : {}
|
|
3389
|
+
};
|
|
3316
3390
|
}
|
|
3317
3391
|
var SIGN_IN_FAILURE2 = /not logged in|please (run|use) `?codex login|401 unauthorized|status 401|invalid[_ ]api[_ ]key|incorrect api key|refresh token|token (has )?expired|token_expired|could not be refreshed/i;
|
|
3318
3392
|
function looksLikeCodexSignInFailure(text) {
|
|
@@ -3541,10 +3615,10 @@ var codexDriver = {
|
|
|
3541
3615
|
resolveBinary: (env) => findCodex(env),
|
|
3542
3616
|
notInstalledMessage: () => "Codex is not installed on the runner\u2019s computer (no `codex` on PATH). Install it with `npm i -g @openai/codex` and run `codex login`.",
|
|
3543
3617
|
readFeatures: async () => ({}),
|
|
3544
|
-
probe: async (env) => ({
|
|
3618
|
+
probe: async (env, opts) => ({
|
|
3545
3619
|
claudeVersion: null,
|
|
3546
3620
|
claudeReady: null,
|
|
3547
|
-
...await probeCodex(env),
|
|
3621
|
+
...await probeCodex(env, opts),
|
|
3548
3622
|
runsCodex: true
|
|
3549
3623
|
}),
|
|
3550
3624
|
doctor: doctor2,
|
|
@@ -3624,6 +3698,14 @@ async function doctor2(env = process.env) {
|
|
|
3624
3698
|
detail: "could not tell (`codex login status` failed)"
|
|
3625
3699
|
}
|
|
3626
3700
|
);
|
|
3701
|
+
if (auth.loggedIn === true) {
|
|
3702
|
+
const models = await codexModels(bin, env);
|
|
3703
|
+
checks.push({
|
|
3704
|
+
name: "Codex models",
|
|
3705
|
+
level: models ? "ok" : "warn",
|
|
3706
|
+
detail: models ? `${models.length} available: ${models.slice(0, 6).join(", ")}${models.length > 6 ? ", \u2026" : ""}` : "could not list them (`codex debug models`): runs can only use Codex\u2019s own default model"
|
|
3707
|
+
});
|
|
3708
|
+
}
|
|
3627
3709
|
const key = codexKeyVariable(env);
|
|
3628
3710
|
if (key) {
|
|
3629
3711
|
checks.push({
|
|
@@ -3654,6 +3736,14 @@ async function cursorVersion(bin, env = process.env) {
|
|
|
3654
3736
|
return null;
|
|
3655
3737
|
}
|
|
3656
3738
|
}
|
|
3739
|
+
async function cursorModels(bin, env = process.env) {
|
|
3740
|
+
try {
|
|
3741
|
+
const res = await runCursor(bin, ["--list-models"], 2e4, env);
|
|
3742
|
+
return res.code === 0 ? parseCursorModels(res.stdout) : void 0;
|
|
3743
|
+
} catch {
|
|
3744
|
+
return void 0;
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3657
3747
|
async function cursorAuthStatus(bin, env = process.env) {
|
|
3658
3748
|
try {
|
|
3659
3749
|
const res = await runCursor(bin, ["status"], 2e4, env);
|
|
@@ -3678,7 +3768,7 @@ function cursorSignInFix(env = process.env) {
|
|
|
3678
3768
|
}
|
|
3679
3769
|
return "On the runner\u2019s computer, run `cursor-agent login` and sign in, and check that `cursor-agent status` says you are logged in.";
|
|
3680
3770
|
}
|
|
3681
|
-
async function probeCursor(env = process.env) {
|
|
3771
|
+
async function probeCursor(env = process.env, opts = {}) {
|
|
3682
3772
|
const bin = await findCursor(env);
|
|
3683
3773
|
if (!bin) {
|
|
3684
3774
|
return {
|
|
@@ -3703,7 +3793,13 @@ async function probeCursor(env = process.env) {
|
|
|
3703
3793
|
cursorProblem: "The Cursor Agent CLI is not signed in. Run `cursor-agent login` on this computer."
|
|
3704
3794
|
};
|
|
3705
3795
|
}
|
|
3706
|
-
|
|
3796
|
+
const models = opts.models === false ? void 0 : await cursorModels(bin, env);
|
|
3797
|
+
return {
|
|
3798
|
+
cursorVersion: version,
|
|
3799
|
+
cursorReady: auth.loggedIn,
|
|
3800
|
+
cursorProblem: null,
|
|
3801
|
+
...models ? { cursorModels: models } : {}
|
|
3802
|
+
};
|
|
3707
3803
|
}
|
|
3708
3804
|
var SIGN_IN_FAILURE3 = /authentication required|not (logged|signed) in|please run `?(cursor-)?agent login|invalid api key|401 unauthorized|status 401|unauthenticated|session (has )?expired/i;
|
|
3709
3805
|
function looksLikeCursorSignInFailure(text) {
|
|
@@ -4102,10 +4198,10 @@ var cursorDriver = {
|
|
|
4102
4198
|
resolveBinary: (env) => findCursor(env),
|
|
4103
4199
|
notInstalledMessage: () => "The Cursor Agent CLI is not installed on the runner\u2019s computer (no `cursor-agent` on PATH). Install it from https://cursor.com/cli and run `cursor-agent login`.",
|
|
4104
4200
|
readFeatures: async () => ({}),
|
|
4105
|
-
probe: async (env) => ({
|
|
4201
|
+
probe: async (env, opts) => ({
|
|
4106
4202
|
claudeVersion: null,
|
|
4107
4203
|
claudeReady: null,
|
|
4108
|
-
...await probeCursor(env),
|
|
4204
|
+
...await probeCursor(env, opts),
|
|
4109
4205
|
runsCursor: true
|
|
4110
4206
|
}),
|
|
4111
4207
|
doctor: doctor3,
|
|
@@ -4190,6 +4286,14 @@ async function doctor3(env = process.env) {
|
|
|
4190
4286
|
detail: "could not tell (`cursor-agent status` said nothing the runner reads)"
|
|
4191
4287
|
}
|
|
4192
4288
|
);
|
|
4289
|
+
if (auth.loggedIn !== false) {
|
|
4290
|
+
const models = await cursorModels(bin, env);
|
|
4291
|
+
checks.push({
|
|
4292
|
+
name: "Cursor models",
|
|
4293
|
+
level: models ? "ok" : "warn",
|
|
4294
|
+
detail: models ? `${models.length} available: ${models.slice(0, 6).join(", ")}${models.length > 6 ? ", \u2026" : ""}` : "could not list them (`cursor-agent --list-models`): runs can only use the model the CLI is set to"
|
|
4295
|
+
});
|
|
4296
|
+
}
|
|
4193
4297
|
if (cursorKeyVariable(env)) {
|
|
4194
4298
|
checks.push({
|
|
4195
4299
|
name: "CURSOR_API_KEY",
|
|
@@ -10056,8 +10160,14 @@ var RunnerDaemon = class {
|
|
|
10056
10160
|
async agentProblem(driver) {
|
|
10057
10161
|
const agent = this.optional.find((a) => a.driver.kind === driver.kind);
|
|
10058
10162
|
if (!agent) return null;
|
|
10059
|
-
const fresh = readAgentFields(await agent.driver.probe(), agent);
|
|
10060
|
-
if (this.agentInfo)
|
|
10163
|
+
const fresh = readAgentFields(await agent.driver.probe(void 0, { models: false }), agent);
|
|
10164
|
+
if (this.agentInfo) {
|
|
10165
|
+
const kept = readAgentFields(this.agentInfo.info, agent).models;
|
|
10166
|
+
this.agentInfo.info = withAgentFields(this.agentInfo.info, agent, {
|
|
10167
|
+
...fresh,
|
|
10168
|
+
models: fresh.models ?? kept
|
|
10169
|
+
});
|
|
10170
|
+
}
|
|
10061
10171
|
if (fresh.ready === true) this.signInFailed.delete(agent.driver.kind);
|
|
10062
10172
|
if (fresh.ready !== false) return null;
|
|
10063
10173
|
return fresh.problem || `${agent.driver.displayName} is not ready. ${agent.driver.signInFix()}`;
|
|
@@ -10409,6 +10519,7 @@ var OPTIONAL_AGENTS = [
|
|
|
10409
10519
|
version: "codexVersion",
|
|
10410
10520
|
ready: "codexReady",
|
|
10411
10521
|
problem: "codexProblem",
|
|
10522
|
+
models: "codexModels",
|
|
10412
10523
|
runs: "runsCodex"
|
|
10413
10524
|
},
|
|
10414
10525
|
{
|
|
@@ -10416,6 +10527,7 @@ var OPTIONAL_AGENTS = [
|
|
|
10416
10527
|
version: "cursorVersion",
|
|
10417
10528
|
ready: "cursorReady",
|
|
10418
10529
|
problem: "cursorProblem",
|
|
10530
|
+
models: "cursorModels",
|
|
10419
10531
|
runs: "runsCursor"
|
|
10420
10532
|
}
|
|
10421
10533
|
];
|
|
@@ -10423,7 +10535,8 @@ function readAgentFields(info, agent) {
|
|
|
10423
10535
|
return {
|
|
10424
10536
|
version: info[agent.version] ?? null,
|
|
10425
10537
|
ready: info[agent.ready] ?? null,
|
|
10426
|
-
problem: info[agent.problem] ?? null
|
|
10538
|
+
problem: info[agent.problem] ?? null,
|
|
10539
|
+
models: info[agent.models]
|
|
10427
10540
|
};
|
|
10428
10541
|
}
|
|
10429
10542
|
function withAgentFields(info, agent, fields) {
|
|
@@ -10431,7 +10544,9 @@ function withAgentFields(info, agent, fields) {
|
|
|
10431
10544
|
...info,
|
|
10432
10545
|
[agent.version]: fields.version,
|
|
10433
10546
|
[agent.ready]: fields.ready,
|
|
10434
|
-
[agent.problem]: fields.problem
|
|
10547
|
+
[agent.problem]: fields.problem,
|
|
10548
|
+
// A fresh probe that listed none clears what an earlier one listed.
|
|
10549
|
+
[agent.models]: fields.models
|
|
10435
10550
|
};
|
|
10436
10551
|
}
|
|
10437
10552
|
|
package/package.json
CHANGED