toolroll 0.9.115 → 0.9.117
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/CHANGELOG.md +55 -0
- package/README.md +43 -26
- package/dist/acp-agents.js +14 -1
- package/dist/acp-client.js +19 -1
- package/dist/agent-change-check.js +60 -0
- package/dist/agent-change-schema.js +19 -0
- package/dist/agent-detect.js +11 -1
- package/dist/agent-fence.js +39 -10
- package/dist/agent-network-request.js +108 -0
- package/dist/agent-requests.js +105 -0
- package/dist/approval-summary.js +3 -3
- package/dist/backup.js +17 -1
- package/dist/batch-checks.js +81 -18
- package/dist/browser/terminal.js +41 -41
- package/dist/browser/workspace.css +2 -2
- package/dist/browser/workspace.js +36 -36
- package/dist/builder.js +3 -1
- package/dist/candidate-materialize.js +119 -0
- package/dist/central-enrollment-contract.js +156 -0
- package/dist/central-recovery-stage.js +329 -0
- package/dist/chat-actions.js +101 -2
- package/dist/chat-channel.js +40 -0
- package/dist/check-only-standing.js +13 -0
- package/dist/check-only.js +25 -13
- package/dist/check-recovery-hold.js +199 -0
- package/dist/check-recovery-index-schema.js +3 -0
- package/dist/check-screenshots.js +83 -0
- package/dist/cli.js +125 -6
- package/dist/codex-limits.js +4 -0
- package/dist/connect-cli.js +257 -11
- package/dist/contracts/chat-actions.js +4 -0
- package/dist/contracts/console-api.js +15 -4
- package/dist/contracts/engine-api.js +344 -2
- package/dist/contracts/lead-tools.js +56 -2
- package/dist/contracts/provider.js +1 -1
- package/dist/contracts/route.js +1 -1
- package/dist/contracts/terminal-connection.js +50 -0
- package/dist/converse.js +80 -4
- package/dist/device-pair.js +280 -0
- package/dist/direct-chat-artifacts.js +347 -0
- package/dist/direct-chat-catalog.js +311 -0
- package/dist/direct-chat-fence.js +96 -0
- package/dist/direct-chat-git.js +343 -0
- package/dist/direct-chat-laptop.js +19 -0
- package/dist/direct-chat-schema.js +181 -0
- package/dist/direct-chat-ship.js +861 -0
- package/dist/direct-chat-workspace.js +389 -0
- package/dist/direct-chat.js +2107 -0
- package/dist/doctor.js +1 -1
- package/dist/easy-start.js +18 -0
- package/dist/egress.js +25 -4
- package/dist/engine-chat.js +454 -0
- package/dist/engine-reads.js +141 -13
- package/dist/exec.js +4 -3
- package/dist/flexible-agents.js +8 -16
- package/dist/flexible-authority-end.js +2 -0
- package/dist/flexible-interactive-schema.js +133 -0
- package/dist/flexible-interactive.js +94 -0
- package/dist/flexible-session.js +117 -49
- package/dist/flexible-ship.js +87 -7
- package/dist/flexible-sign-in.js +10 -0
- package/dist/flexible-start.js +21 -3
- package/dist/flexible-thread.js +2 -3
- package/dist/flexible-turns.js +26 -5
- package/dist/flexible.js +13 -0
- package/dist/flow-triggers.js +13 -4
- package/dist/flows-ui.js +54 -20
- package/dist/handoff-cli.js +630 -0
- package/dist/invoke.js +55 -13
- package/dist/lead-contract.js +5 -4
- package/dist/lead-doors.js +80 -1
- package/dist/lead-progress.js +9 -0
- package/dist/lead-tools.js +682 -10
- package/dist/lead.js +37 -9
- package/dist/live-bus.js +11 -0
- package/dist/live-terminal.js +132 -12
- package/dist/local-handoff.js +363 -0
- package/dist/local-owner-acts.js +264 -2
- package/dist/local-owner.js +16 -1
- package/dist/multiplayer-handoff.js +528 -0
- package/dist/multiplayer-presence.js +471 -0
- package/dist/names.js +17 -4
- package/dist/needs-you.js +10 -0
- package/dist/operate.js +280 -19
- package/dist/policy.js +2 -2
- package/dist/project-delete-ui.js +18 -11
- package/dist/project-delete.js +65 -4
- package/dist/project-tools.js +1 -1
- package/dist/prompt.js +1 -1
- package/dist/provider-connection.js +2 -0
- package/dist/provider-home.js +251 -8
- package/dist/provider.js +3 -2
- package/dist/publish.js +119 -64
- package/dist/pull-request-flow.js +35 -14
- package/dist/read-executor-worker.js +1 -1
- package/dist/read-executor.js +95 -1
- package/dist/restore-retirement.js +152 -0
- package/dist/result-follow-ups.js +116 -37
- package/dist/route-change.js +44 -4
- package/dist/scope.js +62 -5
- package/dist/serve.js +49 -5
- package/dist/server/chat.js +94 -13
- package/dist/server/console.css +9 -9
- package/dist/server/direct-chat.js +583 -0
- package/dist/server/engine-api.js +219 -21
- package/dist/server/flows.js +47 -13
- package/dist/server/found-repos.js +25 -0
- package/dist/server/guards.js +20 -6
- package/dist/server/live.js +81 -23
- package/dist/server/pages.js +67 -13
- package/dist/server/people-tokens.js +47 -6
- package/dist/server/remote.js +29 -0
- package/dist/server/render-results.js +6 -2
- package/dist/server/render-settings.js +4 -2
- package/dist/server/render-tasks.js +18 -17
- package/dist/server/route-table.js +69 -2
- package/dist/server/settings.js +22 -7
- package/dist/server/task-views.js +15 -3
- package/dist/server/tasks.js +39 -2
- package/dist/server/terminals.js +185 -11
- package/dist/settings-proofs.js +1 -1
- package/dist/spend-report.js +2 -2
- package/dist/spend.js +3 -3
- package/dist/store.js +600 -59
- package/dist/subagent-admin.js +23 -10
- package/dist/subagent-backup-schema.js +36 -0
- package/dist/subagent-backup.js +92 -0
- package/dist/subagent-week.js +2 -2
- package/dist/subagent-work.js +70 -47
- package/dist/subagents-ui.js +6 -2
- package/dist/subagents.js +5 -2
- package/dist/subscription-chat.js +36 -5
- package/dist/subscription-usage.js +233 -0
- package/dist/task-live.js +2 -1
- package/dist/teardown-git.js +34 -4
- package/dist/terminal-connection.js +159 -0
- package/dist/terminal-safety.js +114 -0
- package/dist/tui/darwin-arm64/toolroll-tui +0 -0
- package/dist/tui/darwin-x64/toolroll-tui +0 -0
- package/dist/tui/linux-arm64/toolroll-tui +0 -0
- package/dist/tui/linux-x64/toolroll-tui +0 -0
- package/dist/tui-contract.js +1 -1
- package/dist/tui-launch.js +32 -1
- package/dist/workspace-identity-schema.js +21 -0
- package/package.json +4 -2
package/dist/cli.js
CHANGED
|
@@ -16,7 +16,7 @@ import { isBareInvocation, runQuickStart } from "./quick-start.js";
|
|
|
16
16
|
import { easyStartApplies, easyStartArgs } from "./easy-start-args.js";
|
|
17
17
|
import { underAgent } from "./prompt.js";
|
|
18
18
|
import { COMMAND_GUIDE, SURFACE_NOTES, SURFACE_SCHEMA_VERSION } from "./surface.js";
|
|
19
|
-
import { hasCentralProfile, maybeRunConnectCommand } from "./connect-cli.js";
|
|
19
|
+
import { centralProfile, hasCentralProfile, maybeRunConnectCommand, probeTerminalConnection, saveCentralBinding } from "./connect-cli.js";
|
|
20
20
|
import { removedCommand, removedMessage } from "./deprecations.js";
|
|
21
21
|
import { maybeRunRemoteCommand } from "./remote-exec.js";
|
|
22
22
|
import { discover, inspectAll } from "./discover.js";
|
|
@@ -162,7 +162,7 @@ export const OPERATE_COMMANDS = new Set([
|
|
|
162
162
|
"reconcile",
|
|
163
163
|
"run",
|
|
164
164
|
"flows",
|
|
165
|
-
"config", "chat", "proposals", "mode", "chat-approval", "people", "tokens", "keys", "agents",
|
|
165
|
+
"config", "chat", "proposals", "request", "mode", "chat-approval", "people", "tokens", "keys", "agents",
|
|
166
166
|
"setup",
|
|
167
167
|
"verify",
|
|
168
168
|
"intake",
|
|
@@ -304,6 +304,15 @@ async function dispatch(argv, write, mainOptions) {
|
|
|
304
304
|
const connected = await maybeRunConnectCommand(argv, write, mainOptions.connect);
|
|
305
305
|
if (connected !== null)
|
|
306
306
|
return connected;
|
|
307
|
+
if (argv[0] === "handoff") {
|
|
308
|
+
const { maybeRunHandoffCommand } = await import("./handoff-cli.js");
|
|
309
|
+
const handoffCode = await maybeRunHandoffCommand(argv, write, connectOptions ?? {});
|
|
310
|
+
if (handoffCode !== null)
|
|
311
|
+
return handoffCode;
|
|
312
|
+
}
|
|
313
|
+
if (argv[0] === "--remote") {
|
|
314
|
+
return runRemoteTuiCommand(argv.slice(1), write, connectOptions ?? {});
|
|
315
|
+
}
|
|
307
316
|
if ((argv[0] === "chat" || argv[0] === "brief") && argv.includes("--local"))
|
|
308
317
|
argv = argv.filter(arg => arg !== "--local");
|
|
309
318
|
const [first, ...rest] = argv;
|
|
@@ -339,7 +348,8 @@ async function dispatch(argv, write, mainOptions) {
|
|
|
339
348
|
if (first !== undefined && OPERATE_COMMANDS.has(first)) {
|
|
340
349
|
return runOperate(first, rest, write, mainOptions.operate ?? {});
|
|
341
350
|
}
|
|
342
|
-
|
|
351
|
+
const startArgs = easyStartArgs(argv);
|
|
352
|
+
if (startArgs !== null) {
|
|
343
353
|
const terminal = mainOptions.easyStart?.terminal ?? (process.stdin.isTTY === true && process.stdout.isTTY === true);
|
|
344
354
|
const agent = terminal && (mainOptions.easyStart?.underAgent ?? underAgent(process.env));
|
|
345
355
|
if (easyStartApplies(argv, { stdin: terminal, stdout: terminal, agent })) {
|
|
@@ -349,10 +359,16 @@ async function dispatch(argv, write, mainOptions) {
|
|
|
349
359
|
databaseFile, write, build: (await import("./monitoring.js")).packageVersion(),
|
|
350
360
|
...(mainOptions.operate === undefined ? {} : { operate: mainOptions.operate }),
|
|
351
361
|
admit: repo => runReposCommand(["add", repo], write, mainOptions.onboard),
|
|
352
|
-
...(
|
|
353
|
-
...(
|
|
362
|
+
...(startArgs.screenReader === true ? { screenReader: true } : {}),
|
|
363
|
+
...(startArgs.tuiBinary === undefined ? {} : { tuiBinary: startArgs.tuiBinary }),
|
|
354
364
|
});
|
|
355
|
-
return easy.runEasyStart("start",
|
|
365
|
+
return easy.runEasyStart("start", startArgs, { ...seams, ...mainOptions.easyStart?.seams });
|
|
366
|
+
}
|
|
367
|
+
if (startArgs.tuiBinary !== undefined) {
|
|
368
|
+
write(agent
|
|
369
|
+
? "Toolroll detected a coding-agent session. Open the workbench launcher yourself from a fresh terminal session."
|
|
370
|
+
: "The workbench needs interactive input and output. Run the launcher in a terminal window.");
|
|
371
|
+
return USAGE_EXIT;
|
|
356
372
|
}
|
|
357
373
|
}
|
|
358
374
|
const scanNamed = first === "scan";
|
|
@@ -1358,6 +1374,109 @@ function hushExperimentalSqlite() {
|
|
|
1358
1374
|
original(warning, ...rest);
|
|
1359
1375
|
});
|
|
1360
1376
|
}
|
|
1377
|
+
async function runRemoteTuiCommand(argv, write, connectOptions) {
|
|
1378
|
+
let profileName;
|
|
1379
|
+
let devBinary = null;
|
|
1380
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
1381
|
+
const arg = argv[i];
|
|
1382
|
+
if (arg === "--help" || arg === "-h") {
|
|
1383
|
+
write("toolroll --remote [--profile <name>]\n Open the terminal workbench connected to your saved central Toolroll server.\n Connect first with: toolroll connect <https://origin> --browser");
|
|
1384
|
+
return 0;
|
|
1385
|
+
}
|
|
1386
|
+
if (arg === "--profile" || arg === "--tui-binary") {
|
|
1387
|
+
const next = argv[++i];
|
|
1388
|
+
if (!next || next.startsWith("--")) {
|
|
1389
|
+
write(`${arg} needs a value.`);
|
|
1390
|
+
return 2;
|
|
1391
|
+
}
|
|
1392
|
+
if (arg === "--profile")
|
|
1393
|
+
profileName = next;
|
|
1394
|
+
else
|
|
1395
|
+
devBinary = next;
|
|
1396
|
+
continue;
|
|
1397
|
+
}
|
|
1398
|
+
write(`Unknown option for --remote: ${arg}`);
|
|
1399
|
+
return 2;
|
|
1400
|
+
}
|
|
1401
|
+
let profile;
|
|
1402
|
+
try {
|
|
1403
|
+
profile = centralProfile(connectOptions, profileName);
|
|
1404
|
+
}
|
|
1405
|
+
catch (error) {
|
|
1406
|
+
write(error instanceof Error ? error.message : "Could not read saved remote profile.");
|
|
1407
|
+
return 2;
|
|
1408
|
+
}
|
|
1409
|
+
if (profile === null) {
|
|
1410
|
+
write("No central server connected yet. Run: toolroll connect <https://origin> --browser");
|
|
1411
|
+
return 2;
|
|
1412
|
+
}
|
|
1413
|
+
if (!profile.apiToken) {
|
|
1414
|
+
write("Remote terminal mode requires an API token (so_...). Reconnect with --token-stdin or --token-file.");
|
|
1415
|
+
return 2;
|
|
1416
|
+
}
|
|
1417
|
+
if (!profile.origin.startsWith("https://")) {
|
|
1418
|
+
write("Remote terminal mode requires an HTTPS origin (for example over Tailscale HTTPS).");
|
|
1419
|
+
return 2;
|
|
1420
|
+
}
|
|
1421
|
+
let workspaceId = profile.workspaceId;
|
|
1422
|
+
let recoveryGeneration = profile.recoveryGeneration;
|
|
1423
|
+
if (workspaceId === undefined || recoveryGeneration === undefined) {
|
|
1424
|
+
const probed = await probeTerminalConnection(profile, connectOptions);
|
|
1425
|
+
if (probed === null) {
|
|
1426
|
+
write(`Could not verify ${profile.origin}/engine/connection with your saved API token.`);
|
|
1427
|
+
return 1;
|
|
1428
|
+
}
|
|
1429
|
+
workspaceId = probed.workspace.id;
|
|
1430
|
+
recoveryGeneration = probed.workspace.recoveryGeneration;
|
|
1431
|
+
saveCentralBinding(connectOptions, profile.name, { workspaceId, recoveryGeneration, label: probed.workspace.label });
|
|
1432
|
+
}
|
|
1433
|
+
const { engineContractDigest } = await import("./contracts/engine-api.js");
|
|
1434
|
+
const { chooseTuiBinary, formatCentralBootstrapPayload, runTuiBinary } = await import("./tui-launch.js");
|
|
1435
|
+
const chosen = chooseTuiBinary({
|
|
1436
|
+
env: process.env,
|
|
1437
|
+
screenReader: false,
|
|
1438
|
+
platform: process.platform,
|
|
1439
|
+
arch: process.arch,
|
|
1440
|
+
contract: engineContractDigest(),
|
|
1441
|
+
devBinary,
|
|
1442
|
+
});
|
|
1443
|
+
if (!chosen.ok) {
|
|
1444
|
+
write(`Could not start the terminal workbench: ${chosen.why}.`);
|
|
1445
|
+
return 1;
|
|
1446
|
+
}
|
|
1447
|
+
const payload = formatCentralBootstrapPayload({
|
|
1448
|
+
origin: profile.origin,
|
|
1449
|
+
workspaceId,
|
|
1450
|
+
recoveryGeneration,
|
|
1451
|
+
account: profile.account,
|
|
1452
|
+
token: profile.token,
|
|
1453
|
+
});
|
|
1454
|
+
const origin = profile.origin;
|
|
1455
|
+
const openUrl = async (path) => {
|
|
1456
|
+
const target = new URL(path, origin).href;
|
|
1457
|
+
(await import("./operate.js")).openBrowser(target);
|
|
1458
|
+
return `Opened ${target} in your browser.`;
|
|
1459
|
+
};
|
|
1460
|
+
const ended = await runTuiBinary({
|
|
1461
|
+
binary: chosen.binary,
|
|
1462
|
+
identity: chosen.identity,
|
|
1463
|
+
link: payload,
|
|
1464
|
+
project: null,
|
|
1465
|
+
session: {
|
|
1466
|
+
owned: () => false,
|
|
1467
|
+
openBrowser: async (page) => openUrl(page === "projects" ? "/projects" : page === "lead-providers" ? "/settings/lead#lead-config" : "/"),
|
|
1468
|
+
list: async () => [],
|
|
1469
|
+
detail: async () => null,
|
|
1470
|
+
decide: async () => ({ ok: false, words: "Approvals open in your browser." }),
|
|
1471
|
+
addTask: async () => ({ ok: false, words: "Handled by remote CLI." }),
|
|
1472
|
+
steer: async () => ({ ok: false, words: "Handled by remote CLI." }),
|
|
1473
|
+
revise: async () => ({ ok: false, words: "Handled by remote CLI." }),
|
|
1474
|
+
complete: async () => ({ ok: false, words: "Handled by remote CLI." }),
|
|
1475
|
+
stop: async () => ({ ok: false, words: "Handled by remote CLI." }),
|
|
1476
|
+
},
|
|
1477
|
+
});
|
|
1478
|
+
return ended === "central-unavailable" || ended === "changed" ? 1 : 0;
|
|
1479
|
+
}
|
|
1361
1480
|
export async function runCliProcess(argv) {
|
|
1362
1481
|
hushExperimentalSqlite();
|
|
1363
1482
|
process.exitCode = await main(argv);
|
package/dist/codex-limits.js
CHANGED
|
@@ -2,6 +2,7 @@ import { spawn } from "node:child_process";
|
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { codingEnvironment } from "./coding-provider.js";
|
|
4
4
|
import { codexLimitsOf, record } from "./provider-limits.js";
|
|
5
|
+
import { refreshSubscriptions } from "./subscription-usage.js";
|
|
5
6
|
import { billingOf } from "./spend.js";
|
|
6
7
|
import { envValue } from "./names.js";
|
|
7
8
|
function accountBilling(account) {
|
|
@@ -109,6 +110,9 @@ export function startCodexLimits(store, signedIn, everyMs = 5 * 60_000) {
|
|
|
109
110
|
busy = true;
|
|
110
111
|
try {
|
|
111
112
|
await codexLimitsPass(store, { signedIn, stopped: () => stopped });
|
|
113
|
+
if (!stopped) {
|
|
114
|
+
await refreshSubscriptions(store, store.databaseFile(), { skipCodex: true });
|
|
115
|
+
}
|
|
112
116
|
}
|
|
113
117
|
catch {
|
|
114
118
|
}
|
package/dist/connect-cli.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
1
2
|
import { constants, closeSync, existsSync, fstatSync, fsyncSync, lstatSync, mkdirSync, openSync, readFileSync, renameSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { request as httpRequest } from 'node:http';
|
|
4
|
+
import { request as httpsRequest } from 'node:https';
|
|
2
5
|
import { homedir } from 'node:os';
|
|
3
6
|
import { dirname, join } from 'node:path';
|
|
4
7
|
import { savedLoginFile } from './login-secrets.js';
|
|
@@ -7,13 +10,19 @@ import { envelopeJson } from './envelope.js';
|
|
|
7
10
|
import { databasePath } from './store.js';
|
|
8
11
|
import { configBase, namedPath } from './names.js';
|
|
9
12
|
import { parseApiToken } from './api-tokens.js';
|
|
13
|
+
import { TERMINAL_CONNECTION_PROTOCOL, terminalConnectionSchema } from './contracts/terminal-connection.js';
|
|
14
|
+
import { RECOVERY_GENERATION_PATTERN, WORKSPACE_ID_PATTERN } from './workspace-identity-schema.js';
|
|
10
15
|
import { deprecationWarning } from './deprecations.js';
|
|
11
16
|
import { PASSWORD_PROFILE_WARNING } from './password-bearer.js';
|
|
12
|
-
const HELP = `toolroll connect <HTTPS-origin> --
|
|
17
|
+
const HELP = `toolroll connect <HTTPS-origin> --browser [--profile <name>]
|
|
18
|
+
Opens your browser to confirm an 8-character code and mint a personal API token automatically.
|
|
19
|
+
toolroll connect <HTTPS-origin> --as <account> --token-stdin
|
|
13
20
|
Pipe your API token (so_…, from Settings → API tokens) or use --token-file <private-file>;
|
|
14
21
|
--local-login uses your existing local sign-in.
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
toolroll connect --list
|
|
23
|
+
List saved central profiles (never prints tokens).
|
|
24
|
+
toolroll connect --use <name>
|
|
25
|
+
Switch the active central profile.`;
|
|
17
26
|
export class UsageError extends Error {
|
|
18
27
|
}
|
|
19
28
|
export function serviceOrigin(raw) {
|
|
@@ -75,6 +84,12 @@ function profiles(options) {
|
|
|
75
84
|
for (const [name, one] of Object.entries(parsed.profiles)) {
|
|
76
85
|
if (!/^[A-Za-z0-9_-]{1,64}$/.test(name) || !record(one) || typeof one.origin !== 'string' || serviceOrigin(one.origin) !== one.origin || typeof one.account !== 'string' || !accountValid(one.account) || typeof one.token !== 'string' || !tokenValid(one.token))
|
|
77
86
|
throw new Error();
|
|
87
|
+
if (one.workspaceId !== undefined && (typeof one.workspaceId !== 'string' || !WORKSPACE_ID_PATTERN.test(one.workspaceId)))
|
|
88
|
+
throw new Error();
|
|
89
|
+
if (one.recoveryGeneration !== undefined && (typeof one.recoveryGeneration !== 'string' || !RECOVERY_GENERATION_PATTERN.test(one.recoveryGeneration)))
|
|
90
|
+
throw new Error();
|
|
91
|
+
if (one.label !== undefined && (typeof one.label !== 'string' || one.label.length === 0 || one.label.length > 200))
|
|
92
|
+
throw new Error();
|
|
78
93
|
}
|
|
79
94
|
if (!Object.hasOwn(parsed.profiles, parsed.active))
|
|
80
95
|
throw new Error();
|
|
@@ -131,6 +146,89 @@ export function centralProfile(options, name) {
|
|
|
131
146
|
const profile = saved.profiles[chosen];
|
|
132
147
|
return { name: chosen, ...profile, apiToken: parseApiToken(profile.token) !== null };
|
|
133
148
|
}
|
|
149
|
+
export async function probeTerminalConnection(profile, options = {}) {
|
|
150
|
+
if (parseApiToken(profile.token) === null)
|
|
151
|
+
return null;
|
|
152
|
+
try {
|
|
153
|
+
const headers = {
|
|
154
|
+
authorization: `Bearer ${profile.token}`,
|
|
155
|
+
'x-toolroll-client': 'terminal-remote',
|
|
156
|
+
accept: 'application/json',
|
|
157
|
+
};
|
|
158
|
+
let payload;
|
|
159
|
+
if (options.fetch !== undefined) {
|
|
160
|
+
const response = await options.fetch(`${profile.origin}/engine/connection`, {
|
|
161
|
+
method: 'GET',
|
|
162
|
+
redirect: 'manual',
|
|
163
|
+
credentials: 'omit',
|
|
164
|
+
signal: options.signal ? AbortSignal.any([options.signal, AbortSignal.timeout(15_000)]) : AbortSignal.timeout(15_000),
|
|
165
|
+
headers,
|
|
166
|
+
});
|
|
167
|
+
if (response.status !== 200) {
|
|
168
|
+
await response.body?.cancel();
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
payload = await responseBody(response);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
const url = new URL('/engine/connection', profile.origin);
|
|
175
|
+
const reqFn = url.protocol === 'https:' ? httpsRequest : httpRequest;
|
|
176
|
+
payload = await new Promise((resolve, reject) => {
|
|
177
|
+
const req = reqFn(url, { method: 'GET', headers, timeout: 15_000 }, res => {
|
|
178
|
+
if (res.statusCode !== 200) {
|
|
179
|
+
res.resume();
|
|
180
|
+
resolve(null);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const chunks = [];
|
|
184
|
+
let size = 0;
|
|
185
|
+
res.on('data', (chunk) => {
|
|
186
|
+
size += chunk.length;
|
|
187
|
+
if (size > 64 * 1024) {
|
|
188
|
+
req.destroy();
|
|
189
|
+
resolve(null);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
chunks.push(chunk);
|
|
193
|
+
});
|
|
194
|
+
res.on('end', () => {
|
|
195
|
+
try {
|
|
196
|
+
resolve(JSON.parse(Buffer.concat(chunks).toString('utf8')));
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
resolve(null);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
req.on('error', reject);
|
|
204
|
+
req.on('timeout', () => { req.destroy(); resolve(null); });
|
|
205
|
+
req.end();
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
const parsed = terminalConnectionSchema.safeParse(payload);
|
|
209
|
+
if (!parsed.success || parsed.data.protocol !== TERMINAL_CONNECTION_PROTOCOL)
|
|
210
|
+
return null;
|
|
211
|
+
if (parsed.data.principal.account !== profile.account)
|
|
212
|
+
return null;
|
|
213
|
+
return parsed.data;
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
export function saveCentralBinding(options, name, binding) {
|
|
220
|
+
const existing = centralProfile(options, name);
|
|
221
|
+
if (existing === null)
|
|
222
|
+
throw new UsageError(`No saved connection named ${name}.`);
|
|
223
|
+
saveProfile(options, name, {
|
|
224
|
+
origin: existing.origin,
|
|
225
|
+
account: existing.account,
|
|
226
|
+
token: existing.token,
|
|
227
|
+
workspaceId: binding.workspaceId,
|
|
228
|
+
recoveryGeneration: binding.recoveryGeneration,
|
|
229
|
+
label: binding.label,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
134
232
|
async function stdinSecret() {
|
|
135
233
|
if (process.stdin.isTTY)
|
|
136
234
|
throw new UsageError('Pipe your sign-in secret into --token-stdin, or use --token-file.');
|
|
@@ -174,8 +272,8 @@ async function responseBody(response) {
|
|
|
174
272
|
return JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(Buffer.concat(chunks)));
|
|
175
273
|
}
|
|
176
274
|
function parse(argv) {
|
|
177
|
-
const allowed = new Set(['profile', 'json', 'help', 'as', 'token-stdin', 'token-file', 'local-login', 'login-file']);
|
|
178
|
-
const switches = new Set(['json', 'help', 'token-stdin', 'local-login']);
|
|
275
|
+
const allowed = new Set(['profile', 'json', 'help', 'as', 'token-stdin', 'token-file', 'local-login', 'login-file', 'browser', 'list', 'use']);
|
|
276
|
+
const switches = new Set(['json', 'help', 'token-stdin', 'local-login', 'browser', 'list']);
|
|
179
277
|
const flags = {}, positions = [];
|
|
180
278
|
for (let index = 1; index < argv.length; index++) {
|
|
181
279
|
const arg = argv[index];
|
|
@@ -197,10 +295,107 @@ function parse(argv) {
|
|
|
197
295
|
flags[name] = next;
|
|
198
296
|
}
|
|
199
297
|
}
|
|
200
|
-
if (positions.length !== 1 && !flags.help)
|
|
298
|
+
if (positions.length !== 1 && !flags.help && !flags.list && !flags.use)
|
|
201
299
|
throw new UsageError('Name one service origin.');
|
|
202
300
|
return { flags, positions };
|
|
203
301
|
}
|
|
302
|
+
function pairPostJson(origin, path, body) {
|
|
303
|
+
const safeOrigin = serviceOrigin(origin);
|
|
304
|
+
const url = new URL(path, safeOrigin);
|
|
305
|
+
const reqFn = url.protocol === 'https:' ? httpsRequest : httpRequest;
|
|
306
|
+
const serialized = body === undefined ? '' : JSON.stringify(body);
|
|
307
|
+
return new Promise((resolve, reject) => {
|
|
308
|
+
const req = reqFn(url, {
|
|
309
|
+
method: 'POST',
|
|
310
|
+
timeout: 15_000,
|
|
311
|
+
headers: {
|
|
312
|
+
accept: 'application/json',
|
|
313
|
+
...(serialized === '' ? {} : { 'content-type': 'application/json', 'content-length': String(Buffer.byteLength(serialized)) }),
|
|
314
|
+
},
|
|
315
|
+
}, res => {
|
|
316
|
+
const status = res.statusCode ?? 0;
|
|
317
|
+
if (status >= 300 && status < 400) {
|
|
318
|
+
res.resume();
|
|
319
|
+
resolve({ status, json: null });
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
const chunks = [];
|
|
323
|
+
let size = 0;
|
|
324
|
+
res.on('data', (chunk) => {
|
|
325
|
+
size += chunk.length;
|
|
326
|
+
if (size > 64 * 1024) {
|
|
327
|
+
req.destroy();
|
|
328
|
+
resolve({ status, json: null });
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
chunks.push(chunk);
|
|
332
|
+
});
|
|
333
|
+
res.on('end', () => {
|
|
334
|
+
try {
|
|
335
|
+
resolve({ status, json: JSON.parse(Buffer.concat(chunks).toString('utf8')) });
|
|
336
|
+
}
|
|
337
|
+
catch {
|
|
338
|
+
resolve({ status, json: null });
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
req.on('error', reject);
|
|
343
|
+
req.on('timeout', () => { req.destroy(); reject(new Error('Request timed out.')); });
|
|
344
|
+
if (serialized !== '')
|
|
345
|
+
req.write(serialized);
|
|
346
|
+
req.end();
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
function launchBrowserUrl(url) {
|
|
350
|
+
const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'cmd' : 'xdg-open';
|
|
351
|
+
const args = process.platform === 'win32' ? ['/c', 'start', '', url] : [url];
|
|
352
|
+
try {
|
|
353
|
+
const child = spawn(cmd, args, { stdio: 'ignore', detached: true });
|
|
354
|
+
child.unref();
|
|
355
|
+
}
|
|
356
|
+
catch { }
|
|
357
|
+
}
|
|
358
|
+
async function pairViaBrowser(origin, stderr, options) {
|
|
359
|
+
const started = await pairPostJson(origin, '/api/connect/pair/start');
|
|
360
|
+
if (started.status !== 200 || started.json === null || started.json['ok'] !== true
|
|
361
|
+
|| typeof started.json['userCode'] !== 'string' || typeof started.json['pollSecret'] !== 'string'
|
|
362
|
+
|| typeof started.json['verificationPath'] !== 'string') {
|
|
363
|
+
const msg = typeof started.json?.['message'] === 'string' ? started.json['message'] : `Central server refused browser pairing (status ${started.status}).`;
|
|
364
|
+
throw new UsageError(msg);
|
|
365
|
+
}
|
|
366
|
+
const userCode = started.json['userCode'];
|
|
367
|
+
const pollSecret = started.json['pollSecret'];
|
|
368
|
+
const verifyUrl = `${origin}${started.json['verificationPath']}`;
|
|
369
|
+
stderr(`Confirm code ${userCode} in your browser:`);
|
|
370
|
+
stderr(` ${verifyUrl}`);
|
|
371
|
+
if (options.openBrowser)
|
|
372
|
+
options.openBrowser(verifyUrl);
|
|
373
|
+
else
|
|
374
|
+
launchBrowserUrl(verifyUrl);
|
|
375
|
+
const deadline = Date.now() + 5 * 60_000;
|
|
376
|
+
const intervalMs = Math.max(10, Math.min(5_000, options.pollIntervalMs ?? 1_500));
|
|
377
|
+
while (Date.now() < deadline) {
|
|
378
|
+
if (options.signal?.aborted)
|
|
379
|
+
throw new UsageError('Browser pairing cancelled.');
|
|
380
|
+
const polled = await pairPostJson(origin, '/api/connect/pair/poll', { pollSecret });
|
|
381
|
+
if (polled.status === 200 && polled.json !== null) {
|
|
382
|
+
if (polled.json['status'] === 'approved' && typeof polled.json['account'] === 'string' && typeof polled.json['token'] === 'string') {
|
|
383
|
+
return { account: polled.json['account'], token: polled.json['token'] };
|
|
384
|
+
}
|
|
385
|
+
if (polled.json['status'] === 'pending') {
|
|
386
|
+
await new Promise(resolve => {
|
|
387
|
+
const timer = setTimeout(resolve, intervalMs);
|
|
388
|
+
if (options.signal)
|
|
389
|
+
options.signal.addEventListener('abort', () => { clearTimeout(timer); resolve(); }, { once: true });
|
|
390
|
+
});
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
const msg = typeof polled.json?.['message'] === 'string' ? polled.json['message'] : 'Browser pairing expired or was cancelled.';
|
|
395
|
+
throw new UsageError(msg);
|
|
396
|
+
}
|
|
397
|
+
throw new UsageError('Browser pairing timed out. Run toolroll connect --browser again.');
|
|
398
|
+
}
|
|
204
399
|
function isMessage(one) {
|
|
205
400
|
return record(one) && Number.isSafeInteger(one.id) && typeof one.author === 'string' && ['operator', 'assistant'].includes(String(one.role)) && typeof one.text === 'string' && ['queued', 'running', 'answered', 'failed', 'cancelled', 'uncertain'].includes(String(one.status)) && Number.isSafeInteger(one.revision) && typeof one.createdAt === 'string' && (one.requestId === null || typeof one.requestId === 'string') && (one.turnId === null || Number.isSafeInteger(one.turnId)) && (one.error === null || typeof one.error === 'string');
|
|
206
401
|
}
|
|
@@ -265,6 +460,41 @@ export async function maybeRunConnectCommand(argv, write, options = {}) {
|
|
|
265
460
|
write(HELP);
|
|
266
461
|
return 0;
|
|
267
462
|
}
|
|
463
|
+
if (flags.list) {
|
|
464
|
+
const saved = profiles(options);
|
|
465
|
+
const list = saved === null ? [] : Object.entries(saved.profiles).map(([name, one]) => ({
|
|
466
|
+
name,
|
|
467
|
+
active: name === saved.active,
|
|
468
|
+
origin: one.origin,
|
|
469
|
+
account: one.account,
|
|
470
|
+
...(one.label === undefined ? {} : { label: one.label }),
|
|
471
|
+
...(one.workspaceId === undefined ? {} : { workspaceId: one.workspaceId }),
|
|
472
|
+
}));
|
|
473
|
+
if (json) {
|
|
474
|
+
write(envelopeJson({ version: 1, ok: true, code: 'ok', message: `${list.length} saved profile${list.length === 1 ? '' : 's'}.`, command: 'team connect', result: { profiles: list } }));
|
|
475
|
+
}
|
|
476
|
+
else if (list.length === 0) {
|
|
477
|
+
write('No saved central profiles. Run: toolroll connect <https://origin> --browser');
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
for (const item of list) {
|
|
481
|
+
const mark = item.active ? '*' : ' ';
|
|
482
|
+
const label = item.label ? ` (${item.label})` : '';
|
|
483
|
+
write(`${mark} ${item.name} ${item.account}@${item.origin}${label}`);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return 0;
|
|
487
|
+
}
|
|
488
|
+
if (flags.use) {
|
|
489
|
+
const chosen = value(flags, 'use');
|
|
490
|
+
const saved = profiles(options);
|
|
491
|
+
if (saved === null || !/^[A-Za-z0-9_-]{1,64}$/.test(chosen) || !Object.hasOwn(saved.profiles, chosen)) {
|
|
492
|
+
throw new UsageError(`No saved connection named ${chosen}. Run toolroll connect --list to see saved profiles.`);
|
|
493
|
+
}
|
|
494
|
+
saveProfile(options, chosen, saved.profiles[chosen]);
|
|
495
|
+
emit({ version: 1, ok: true, code: 'switched', message: `Active profile switched to ${chosen} (${saved.profiles[chosen].origin}).`, result: { profile: chosen, origin: saved.profiles[chosen].origin, account: saved.profiles[chosen].account } });
|
|
496
|
+
return 0;
|
|
497
|
+
}
|
|
268
498
|
const profileName = value(flags, 'profile') || 'default';
|
|
269
499
|
if (!/^[A-Za-z0-9_-]{1,64}$/.test(profileName))
|
|
270
500
|
throw new UsageError('Profile names use 1–64 letters, digits, underscores or hyphens.');
|
|
@@ -275,12 +505,19 @@ export async function maybeRunConnectCommand(argv, write, options = {}) {
|
|
|
275
505
|
catch {
|
|
276
506
|
throw new UsageError('Use an HTTPS service origin (loopback HTTP is allowed), without credentials, paths, query or fragment.');
|
|
277
507
|
}
|
|
278
|
-
if (['token-stdin', 'token-file', 'local-login'].filter(name => flags[name]).length !== 1)
|
|
279
|
-
throw new UsageError('Choose one credential source: --token-stdin, --token-file or --local-login.');
|
|
508
|
+
if (['browser', 'token-stdin', 'token-file', 'local-login'].filter(name => flags[name]).length !== 1)
|
|
509
|
+
throw new UsageError('Choose one credential source: --browser, --token-stdin, --token-file or --local-login.');
|
|
280
510
|
if (flags['login-file'] && !flags['local-login'])
|
|
281
511
|
throw new UsageError('--login-file requires --local-login.');
|
|
282
512
|
let account = value(flags, 'as');
|
|
283
|
-
if (flags
|
|
513
|
+
if (flags.browser) {
|
|
514
|
+
const paired = await pairViaBrowser(origin, stderr, options);
|
|
515
|
+
if (account && account !== paired.account)
|
|
516
|
+
throw new UsageError(`Browser signed in as ${paired.account}, not ${account}.`);
|
|
517
|
+
account = paired.account;
|
|
518
|
+
secret = paired.token;
|
|
519
|
+
}
|
|
520
|
+
else if (flags['local-login']) {
|
|
284
521
|
const login = privateFile(value(flags, 'login-file') || savedLoginFile(dirname(databasePath(options.env ?? process.env, options.home ?? homedir()))), 8192).trim().split(/\s+/);
|
|
285
522
|
if (login.length !== 2 || account && account !== login[0])
|
|
286
523
|
throw new UsageError('The local sign-in does not match the requested account.');
|
|
@@ -293,13 +530,22 @@ export async function maybeRunConnectCommand(argv, write, options = {}) {
|
|
|
293
530
|
throw new UsageError('Provide an account name and a valid sign-in secret from your selected source.');
|
|
294
531
|
if (parseApiToken(secret) === null)
|
|
295
532
|
stderr(PASSWORD_PROFILE_WARNING);
|
|
296
|
-
const profile = { origin, account, token: secret }
|
|
533
|
+
const profile = { origin, account, token: secret };
|
|
534
|
+
const connection = await probeTerminalConnection(profile, options);
|
|
535
|
+
if (connection !== null) {
|
|
536
|
+
profile.workspaceId = connection.workspace.id;
|
|
537
|
+
profile.recoveryGeneration = connection.workspace.recoveryGeneration;
|
|
538
|
+
profile.label = connection.workspace.label;
|
|
539
|
+
}
|
|
540
|
+
const checked = connection !== null
|
|
541
|
+
? { version: 1, ok: true, code: 'connected', message: `Connected to ${origin} as ${account}.` }
|
|
542
|
+
: await verify(profile, options);
|
|
297
543
|
if (!checked.ok) {
|
|
298
544
|
emit(checked);
|
|
299
545
|
return 1;
|
|
300
546
|
}
|
|
301
547
|
saveProfile(options, profileName, profile);
|
|
302
|
-
emit({ version: 1, ok: true, code: 'connected', message: `Connected to ${origin} as ${account}.`, result: { profile: profileName, origin, account } });
|
|
548
|
+
emit({ version: 1, ok: true, code: 'connected', message: `Connected to ${origin} as ${account}.`, result: { profile: profileName, origin, account, ...(profile.workspaceId === undefined ? {} : { workspaceId: profile.workspaceId }) } });
|
|
303
549
|
return 0;
|
|
304
550
|
}
|
|
305
551
|
catch (error) {
|
|
@@ -84,6 +84,10 @@ export const chatActionRequestSchemas = {
|
|
|
84
84
|
task_cancel: z.strictObject({ task: words }),
|
|
85
85
|
task_resume: z.strictObject({ task: words, run: id }),
|
|
86
86
|
task_start: z.strictObject({ repo: words, preview: words }),
|
|
87
|
+
direct_chat_start: z.strictObject({ repo: words, prompt: words, provider: words, model: words, effort: words.nullable().optional() }),
|
|
88
|
+
direct_chat_reply: z.strictObject({ repo: words, chat: words, prompt: words }),
|
|
89
|
+
direct_chat_promote: z.strictObject({ repo: words, chat: words, title: words, goal: words, planning: z.enum(["auto", "required", "skip"]).optional() }),
|
|
90
|
+
direct_chat_ship: z.strictObject({ repo: words, chat: words, mode: z.enum(["ship", "keep-branch"]).optional(), title: words.optional(), goal: words.optional() }),
|
|
87
91
|
};
|
|
88
92
|
export const CHAT_ACTION_OPERATIONS = Object.keys(chatActionRequestSchemas);
|
|
89
93
|
export const CHAT_ACTION_FIELDS = Object.fromEntries(CHAT_ACTION_OPERATIONS.map(operation => [operation, Object.keys(chatActionRequestSchemas[operation].shape)]));
|
|
@@ -69,13 +69,13 @@ export const CONSOLE_FORMS = {
|
|
|
69
69
|
skillsRevise: formContract("POST /settings/skills/revise", ["run", "repo", "feedback", "nonce"]),
|
|
70
70
|
skillsChange: formContract("POST /settings/skills/import, /settings/skills/change", ["repo", "identity", "revision", "method", "content", "files", "url", "action", "sha", "sample", "nonce", "restore"]),
|
|
71
71
|
kit: formContract("POST /kits/<kit>/<act>", ["repo", "password"]),
|
|
72
|
-
subagents: formContract("POST /settings/lead/subagents/new, /settings/lead/subagents/<id>/<part>, /settings/lead/subagents/questions/<id>/answer", ["choice", "text", "repo", "template", "name", "soul", "op", "id", "schedule", "tool", "state", "note", "model", "dailyTurns", "manager", "password"], { prefixes: ["use.", "undo.", "field.", "over."] }),
|
|
72
|
+
subagents: formContract("POST /settings/lead/subagents/new, /settings/lead/subagents/<id>/<part>, /settings/lead/subagents/questions/<id>/answer", ["choice", "text", "repo", "template", "name", "soul", "op", "id", "schedule", "tool", "state", "note", "model", "dailyTurns", "manager", "password", "backupPresent", "codexBackupModel"], { prefixes: ["use.", "undo.", "field.", "over."] }),
|
|
73
73
|
galleryUse: formContract("POST /flows/new/<template>", ["repo", "send-result", "name", "intent", "previewed", "password"], { dynamic: true }),
|
|
74
74
|
flows: formContract("POST /flows/new, /flows/example, /flows/import, /flows/<id>/<act>, /flows/<id>/cards/<card>/<act>, /flows/<id>/triggers/<trigger>/<act>", ["repo", "document", "url", "confirm", "previewed", "template", "name", "answers", "password", "secret", "sender", "project", "team", "trigger", "approve", "remove", "about", "body", "timeoutMinutes", "language", "file", "address", "key", "definition", "owner", "revision", "value", "title", "description", "stage", "decision", "note", "draft", "choice", "entry", "label", "watching", "days", "budget", "runs", "include", "schedules", "digest", "version"], { prefixes: ["param."] }),
|
|
75
75
|
spendBudget: formContract("POST /spend/budget", ["password", "target", "action", "usd", "stop"]),
|
|
76
76
|
projectConcurrency: formContract("POST /settings/project/concurrency", ["repo", "concurrency"]),
|
|
77
77
|
projectLiveView: formContract("POST /settings/project/live-view", ["repo", "act", "password", "nonce"]),
|
|
78
|
-
projectNetwork: formContract("POST /settings/project/network", ["repo", "mode", "local", "hosts", "password"]),
|
|
78
|
+
projectNetwork: formContract("POST /settings/project/network", ["repo", "mode", "local", "hosts", "request", "digest", "password"]),
|
|
79
79
|
projectFallback: formContract("POST /settings/project/fallback", ["repo", "agents", "paid", "password"]),
|
|
80
80
|
projectWrites: formContract("POST /settings/project/writes", ["repo", "writes", "password"]),
|
|
81
81
|
projectCheckAccess: formContract("POST /settings/project/check-access", ["repo", "level", "confirm-open", "password"]),
|
|
@@ -173,7 +173,7 @@ export const CONSOLE_FORMS = {
|
|
|
173
173
|
agentWatch: formContract("POST /agents/watch", ["run", "view", "op"]),
|
|
174
174
|
leadProposal: formContract("POST /chat/proposal/<id>/confirm|dismiss", ["return", "nonce", "confirm", "token"]),
|
|
175
175
|
coordinatorProposal: formContract("POST /proposals/<id>/confirm|dismiss", ["return", "confirm"]),
|
|
176
|
-
chat: formContract("POST /chat", ["task", "project", "result", "mode", "request", "request-session", "message", "token"]),
|
|
176
|
+
chat: formContract("POST /chat", ["task", "project", "result", "mode", "request", "request-session", "message", "images", "instant", "token"]),
|
|
177
177
|
chatFile: formContract("POST /chat/file/<id>", ["token"]),
|
|
178
178
|
chatAck: formContract("POST /chat/ack/<id>", ["token", "nonce"]),
|
|
179
179
|
recipes: formContract("POST /recipes/prepare, /recipes/preview, /recipes/import, /recipes/launch, /recipes/save", ["repo", "projectRevision", "recipe", "recipeRevision", "document", "purpose", "source", "sourceRevision", "preview", "next"]),
|
|
@@ -200,7 +200,7 @@ export const CONSOLE_FORMS = {
|
|
|
200
200
|
taskPlanEdit: formContract("POST /t/<task>/plan-edit", ["saw-plan", "plan-document"]),
|
|
201
201
|
taskRevision: formContract("POST /t/<task>/accept-revision|reject-revision", ["revision-id", "token"]),
|
|
202
202
|
taskCancel: formContract("POST /t/<task>/cancel", ["reason", "state", "run"]),
|
|
203
|
-
taskRoute: formContract("POST /t/<task>/route", ["size", "risky", "phase", "clear-phase", "agent", "provider", "model", "sawDigest", "return"]),
|
|
203
|
+
taskRoute: formContract("POST /t/<task>/route", ["size", "risky", "phase", "clear-phase", "agent", "provider", "model", "sawDigest", "when", "return"]),
|
|
204
204
|
taskScope: formContract("POST /t/<task>/scope", ["sawDigest", "permission-mode", "quality-mode", "budget-usd", "budget-microusd", "requirement", "requirement-new", "requirement-how", "requirement-new-how", "goal-brief", "goal", "not", "touches", "acceptance"]),
|
|
205
205
|
taskApprove: formContract("POST /t/<task>/approve", ["return", "digest", "token", "nonce", "rebuild", "sheet"]),
|
|
206
206
|
taskAcceptProof: formContract("POST /t/<task>/accept-proof", ["run", "note", "return"]),
|
|
@@ -208,6 +208,14 @@ export const CONSOLE_FORMS = {
|
|
|
208
208
|
taskStop: formContract("POST /t/<task>/stop", ["run", "return"]),
|
|
209
209
|
taskPause: formContract("POST /t/<task>/pause", ["run", "request", "note", "mode", "return", "key"]),
|
|
210
210
|
taskResume: formContract("POST /t/<task>/resume|resume-arm", ["run", "token", "nonce", "return"]),
|
|
211
|
+
directChatStart: formContract("POST /engine/direct-chats", ["project", "prompt", "provider", "model", "effort", "request"]),
|
|
212
|
+
directChatSend: formContract("POST /engine/direct-chats/<id>/messages", ["prompt", "request"]),
|
|
213
|
+
directChatModel: formContract("POST /engine/direct-chats/<id>/model", ["provider", "model", "effort"]),
|
|
214
|
+
directChatDelete: formContract("POST /engine/direct-chats/<id>/delete", ["discard", "keepBranch"]),
|
|
215
|
+
directChatAttach: formContract("POST /engine/direct-chats/<id>/attachments", ["filename", "mimeType", "dataBase64"]),
|
|
216
|
+
directChatShipPreview: formContract("POST /engine/direct-chats/<id>/ship-preview", ["mode", "title", "goal"]),
|
|
217
|
+
directChatShip: formContract("POST /engine/direct-chats/<id>/ship", ["mode", "title", "goal", "termsDigest", "password"]),
|
|
218
|
+
directChatShipCancel: formContract("POST /engine/direct-chats/<id>/ship-cancel", ["shipId"]),
|
|
211
219
|
};
|
|
212
220
|
export const BODILESS_POSTS = [
|
|
213
221
|
"POST /settings/models/<unknown action>",
|
|
@@ -224,6 +232,9 @@ export const BODILESS_POSTS = [
|
|
|
224
232
|
"POST /settings/storage/check",
|
|
225
233
|
"POST /projects/github",
|
|
226
234
|
"POST /code/<session>/ship/preview",
|
|
235
|
+
"POST /engine/direct-chats/<id>/stop",
|
|
236
|
+
"POST /engine/direct-chats/<id>/apply-main-edits",
|
|
237
|
+
"POST /engine/direct-chats/<id>/repair",
|
|
227
238
|
];
|
|
228
239
|
const ledgerEntrySchema = z.looseObject({
|
|
229
240
|
id: z.number(), at: z.string(), actor: z.string(), repo: z.string().nullable(), taskId: z.string().nullable(), runId: z.number().nullable(),
|