zelio-cli 0.1.0-beta.7 → 0.1.0-beta.9
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 +2 -0
- package/dist/cli-main.js +521 -0
- package/dist/cli-main.js.map +1 -0
- package/dist/cli.js +17 -495
- package/dist/cli.js.map +1 -1
- package/dist/cloud/account.js +109 -0
- package/dist/cloud/account.js.map +1 -0
- package/dist/cloud/command.js +4 -20
- package/dist/cloud/command.js.map +1 -1
- package/dist/cloud/login.js +2 -1
- package/dist/cloud/login.js.map +1 -1
- package/dist/db/db.js +42 -15
- package/dist/db/db.js.map +1 -1
- package/dist/db/lifecycle.js.map +1 -1
- package/dist/limits.js +1 -1
- package/dist/orchestrator/contract.js +4 -0
- package/dist/orchestrator/contract.js.map +1 -1
- package/dist/orchestrator/pi-session.js +6 -0
- package/dist/orchestrator/pi-session.js.map +1 -1
- package/dist/orchestrator/runtime.js +8 -0
- package/dist/orchestrator/runtime.js.map +1 -1
- package/dist/repo/linked-boards.js +12 -0
- package/dist/repo/linked-boards.js.map +1 -1
- package/dist/run/auto-review.js +17 -3
- package/dist/run/auto-review.js.map +1 -1
- package/dist/run/claude-runtime.js +17 -3
- package/dist/run/claude-runtime.js.map +1 -1
- package/dist/run/codex-client.js +14 -3
- package/dist/run/codex-client.js.map +1 -1
- package/dist/run/codex-runtime.js +1 -1
- package/dist/run/codex-runtime.js.map +1 -1
- package/dist/run/consult.js +5 -1
- package/dist/run/consult.js.map +1 -1
- package/dist/run/developer-sandbox.js +67 -0
- package/dist/run/developer-sandbox.js.map +1 -0
- package/dist/run/finish.js +34 -12
- package/dist/run/finish.js.map +1 -1
- package/dist/run/harnesses.js +15 -0
- package/dist/run/harnesses.js.map +1 -1
- package/dist/run/lead.js +25 -1
- package/dist/run/lead.js.map +1 -1
- package/dist/run/manager.js +199 -28
- package/dist/run/manager.js.map +1 -1
- package/dist/run/pi-packages.js +72 -0
- package/dist/run/pi-packages.js.map +1 -0
- package/dist/run/pi-rpc.js +30 -5
- package/dist/run/pi-rpc.js.map +1 -1
- package/dist/run/prompt.js +17 -0
- package/dist/run/prompt.js.map +1 -1
- package/dist/run/settings.js.map +1 -1
- package/dist/run/watchdog.js +12 -5
- package/dist/run/watchdog.js.map +1 -1
- package/dist/server/app.js +122 -88
- package/dist/server/app.js.map +1 -1
- package/dist/setup/config.js +0 -31
- package/dist/setup/config.js.map +1 -1
- package/dist/setup/onboarding.js +0 -9
- package/dist/setup/onboarding.js.map +1 -1
- package/dist/setup/run.js +4 -5
- package/dist/setup/run.js.map +1 -1
- package/dist/web/assets/index-D48AtOGe.js +258 -0
- package/dist/web/assets/index-TN5sUF2z.css +1 -0
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +3 -2
- package/dist/web/assets/index-C65GAaps.js +0 -255
- package/dist/web/assets/index-cF8zhiLs.css +0 -1
package/dist/server/app.js
CHANGED
|
@@ -33,13 +33,13 @@ import { pullRequestUrlIn } from "../run/pull-request.js";
|
|
|
33
33
|
import { createIssue, prepareIssue } from "../run/issue.js";
|
|
34
34
|
import { hasMentionInstruction, mentionedProfiles } from "../run/mentions.js";
|
|
35
35
|
import { HarnessRuntime } from "../run/harness-runtime.js";
|
|
36
|
-
import { handoffBrief, handoffCommand, handoffHarness } from "../run/handoff.js";
|
|
36
|
+
import { handoffBrief, handoffCommand, handoffHarness, shellQuote } from "../run/handoff.js";
|
|
37
37
|
import { consultLead } from "../run/lead.js";
|
|
38
38
|
import { consultWatchdog } from "../run/watchdog.js";
|
|
39
39
|
import { consultReviewer } from "../run/auto-review.js";
|
|
40
40
|
import { buildCheckFixPrompt, buildCommentPrompt, buildConflictPrompt, buildReviewPrompt, COMMENT_AGENT_PROMPT, CONFLICT_AGENT_PROMPT, REVIEW_AGENT_PROMPT, VERIFIED_CODING_AGENT_PROMPT, } from "../run/prompt.js";
|
|
41
41
|
import { listCodexModels } from "../run/codex-client.js";
|
|
42
|
-
import { HARNESSES, checkHarnessAuth, checkPiModelAuth, detectHarnesses, installHarness, listHarnessModels, } from "../run/harnesses.js";
|
|
42
|
+
import { HARNESSES, checkHarnessAuth, checkPiModelAuth, detectHarnesses, installHarness, listHarnessModels, modelFitsHarness, } from "../run/harnesses.js";
|
|
43
43
|
import { profileFor } from "../run/profiles.js";
|
|
44
44
|
import { readSkills, skillBriefs, skillStoreOf } from "../run/skills.js";
|
|
45
45
|
import { asMaxAgents, asPlannerThinking } from "../run/settings.js";
|
|
@@ -218,7 +218,7 @@ function applyDecided(cards, decided) {
|
|
|
218
218
|
}
|
|
219
219
|
return out;
|
|
220
220
|
}
|
|
221
|
-
export function createApp({ db, token, port, webRoot, repoRoot,
|
|
221
|
+
export function createApp({ db, token, port, webRoot, repoRoot, account, providerAuth, plan, summarize, harness, setup, listModels, skills: skillStore, plannerThinking, plannerToolBudget, summaryTimeoutMs, runtime, runTimeoutMs, retro, lead, leadEnabled, watchdog, watchdogEnabled, watchdogTickMs, watchdogBackstopMs, autoReview, autoReviewEnabled, redCheckEnabled, testsFirstEnabled, research, search, areaNote, areaNotesEnabled, researchEnabled, maxRunning, prepare, prepareTicket, agentPath, ghCommand, factsPollMs, retryPolicy, tokenPublishMs, mergePollMs, index: indexOverride, indexOnStart, onRunsChange, voice: voiceOverride, build: buildOption, cliVersion = "unknown", phone, terminals: terminalOverride, onLiveChange, repoRegistryFile, repoPicker = { available: process.platform === "darwin", pick: pickRepoFolder }, }) {
|
|
222
222
|
const app = new Hono();
|
|
223
223
|
const auth = createAuth({ token, port });
|
|
224
224
|
const idempotency = createIdempotency(db);
|
|
@@ -226,19 +226,18 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
226
226
|
const voice = voiceOverride ?? createVoice();
|
|
227
227
|
const root = repoRoot ?? process.cwd();
|
|
228
228
|
const skills = skillStore ?? skillStoreOf(db);
|
|
229
|
-
const setupStore = setup ?? memorySetupStore({ harness: "pi"
|
|
229
|
+
const setupStore = setup ?? memorySetupStore({ harness: "pi" });
|
|
230
230
|
const effectiveHarness = () => harness?.trim() || process.env.ZELIO_HARNESS?.trim() || setupStore.read().harness || "pi";
|
|
231
|
-
//
|
|
232
|
-
//
|
|
231
|
+
// The planner is the board's: the harness and model the person picked in the
|
|
232
|
+
// New task dialog. The machine setup never chooses a planner.
|
|
233
|
+
const boardPlannerHarness = () => db.getBoardSettings().plannerHarness?.trim() || effectiveHarness();
|
|
234
|
+
// A model belongs to the harness it was saved under, so a model picked on
|
|
235
|
+
// another harness never falls back to the saved one.
|
|
233
236
|
const plannerModelFor = (command) => {
|
|
234
|
-
const
|
|
235
|
-
return command ===
|
|
236
|
-
};
|
|
237
|
-
const effectivePlannerModel = () => plannerModelFor(effectiveHarness());
|
|
238
|
-
const effectiveDeveloperModel = () => {
|
|
239
|
-
const saved = setupStore.read();
|
|
240
|
-
return effectiveHarness() === saved.harness ? saved.developerModel : "";
|
|
237
|
+
const settings = db.getBoardSettings();
|
|
238
|
+
return command === settings.plannerHarness?.trim() ? (settings.plannerModel ?? "").trim() : "";
|
|
241
239
|
};
|
|
240
|
+
const effectivePlannerModel = () => plannerModelFor(boardPlannerHarness());
|
|
242
241
|
// The bottom panel's shells live in the repo root, never in a worktree.
|
|
243
242
|
const terminals = terminalOverride ?? new TerminalManager({ root });
|
|
244
243
|
// Config, not a constant: the person can raise the ceiling while the board
|
|
@@ -247,6 +246,16 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
247
246
|
// Likewise for the planner: a CLI flag beats the saved choice; the saved
|
|
248
247
|
// choice beats the runtime's env/default.
|
|
249
248
|
const plannerThinkingForTurn = () => plannerThinking ?? db.getBoardSettings().plannerThinking;
|
|
249
|
+
// Reviewer, lead and watchdog run on the planner's setup: the harness, model
|
|
250
|
+
// and thinking the person picked in New task. Only the developer has its own.
|
|
251
|
+
const plannerSetup = () => {
|
|
252
|
+
const model = effectivePlannerModel();
|
|
253
|
+
return {
|
|
254
|
+
command: boardPlannerHarness(),
|
|
255
|
+
...(model ? { model } : {}),
|
|
256
|
+
thinking: plannerThinkingForTurn(),
|
|
257
|
+
};
|
|
258
|
+
};
|
|
250
259
|
const testsFirstForcedOff = () => testsFirstEnabled === false || process.env.ZELIO_TESTS_FIRST === "off";
|
|
251
260
|
const testsFirstForRun = () => !testsFirstForcedOff() && db.getBoardSettings().testsFirstEnabled;
|
|
252
261
|
const plannerChoiceForRun = () => db.getBoardSettings().plannerChoiceEnabled;
|
|
@@ -312,7 +321,7 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
312
321
|
cwd: root,
|
|
313
322
|
cwdFor: (name) => linkedBoards().find((board) => board.name === name)?.root,
|
|
314
323
|
command: choice?.command || effectiveHarness(),
|
|
315
|
-
model: choice ? choice.model || undefined :
|
|
324
|
+
model: choice ? choice.model || undefined : undefined,
|
|
316
325
|
onFinding,
|
|
317
326
|
})
|
|
318
327
|
: undefined);
|
|
@@ -535,36 +544,15 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
535
544
|
};
|
|
536
545
|
const leadConsultant = lead ??
|
|
537
546
|
(leadEnabled
|
|
538
|
-
? (input) => consultLead(input, {
|
|
539
|
-
runtime: agentRuntime,
|
|
540
|
-
command: effectiveHarness(),
|
|
541
|
-
model: effectivePlannerModel() || undefined,
|
|
542
|
-
})
|
|
547
|
+
? (input) => consultLead(input, { runtime: agentRuntime, ...plannerSetup() })
|
|
543
548
|
: undefined);
|
|
544
549
|
const watchdogConsultant = watchdog ??
|
|
545
550
|
(watchdogEnabled
|
|
546
|
-
? (input) => consultWatchdog(input, {
|
|
547
|
-
runtime: agentRuntime,
|
|
548
|
-
command: effectiveHarness(),
|
|
549
|
-
model: effectivePlannerModel() || undefined,
|
|
550
|
-
})
|
|
551
|
+
? (input) => consultWatchdog(input, { runtime: agentRuntime, ...plannerSetup() })
|
|
551
552
|
: undefined);
|
|
552
|
-
// The reviewer profile, as the person edited it on the Agents page, decides
|
|
553
|
-
// the harness, model and effort; an empty field falls back like a run's does.
|
|
554
553
|
const reviewConsultant = autoReview ??
|
|
555
554
|
(autoReviewEnabled
|
|
556
|
-
? (input) => {
|
|
557
|
-
const profile = db.getProfile("reviewer") ?? profileFor("reviewer");
|
|
558
|
-
const command = profile.harness.trim() || effectiveHarness();
|
|
559
|
-
const model = profile.model.trim() ||
|
|
560
|
-
(command === effectiveHarness() ? effectiveDeveloperModel() : "");
|
|
561
|
-
return consultReviewer(input, {
|
|
562
|
-
runtime: agentRuntime,
|
|
563
|
-
command,
|
|
564
|
-
thinking: profile.thinking,
|
|
565
|
-
...(model ? { model } : {}),
|
|
566
|
-
});
|
|
567
|
-
}
|
|
555
|
+
? (input) => consultReviewer(input, { runtime: agentRuntime, ...plannerSetup() })
|
|
568
556
|
: undefined);
|
|
569
557
|
/**
|
|
570
558
|
* The checkout root a ticket's worktree, branch and merge watch live in: its
|
|
@@ -589,7 +577,7 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
589
577
|
return null;
|
|
590
578
|
}
|
|
591
579
|
}
|
|
592
|
-
const runs = new RunManager(db, agentRuntime, publishRun, `http://127.0.0.1:${port}`, agentPath, ghCommand, factsPollMs, retryPolicy, tokenPublishMs, root, retro, () => ({ harness: effectiveHarness(), model:
|
|
580
|
+
const runs = new RunManager(db, agentRuntime, publishRun, `http://127.0.0.1:${port}`, agentPath, ghCommand, factsPollMs, retryPolicy, tokenPublishMs, root, retro, () => ({ harness: effectiveHarness(), model: "" }), leadConsultant, rootFor, reviewConsultant, redCheckEnabled ?? false, testsFirstForRun, skills, (command) => harnessModels(command), watchdogConsultant
|
|
593
581
|
? {
|
|
594
582
|
consult: watchdogConsultant,
|
|
595
583
|
...(watchdogTickMs ? { tickMs: watchdogTickMs } : {}),
|
|
@@ -694,6 +682,7 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
694
682
|
acceptance: ticket.acceptance,
|
|
695
683
|
likely_files: [...ticket.likely_files],
|
|
696
684
|
context: [...(ticket.context ?? [])],
|
|
685
|
+
plan: ticket.plan ?? undefined,
|
|
697
686
|
verify: [...ticket.verify],
|
|
698
687
|
rationale: "",
|
|
699
688
|
assumed: [],
|
|
@@ -710,6 +699,7 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
710
699
|
...(typeof value.acceptance === "string" ? { acceptance: value.acceptance } : {}),
|
|
711
700
|
...(Array.isArray(value.likely_files) ? { likely_files: value.likely_files } : {}),
|
|
712
701
|
...(Array.isArray(value.context) ? { context: value.context } : {}),
|
|
702
|
+
...(typeof value.plan === "string" ? { plan: value.plan } : {}),
|
|
713
703
|
// Only a non-empty list is carried. The prepare pass hands back a card that
|
|
714
704
|
// always has a verify array (an omitted one reads as []), so an empty one
|
|
715
705
|
// here means "not said", and a prepare pass must not wipe checks a person set.
|
|
@@ -759,6 +749,11 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
759
749
|
const requested = missing.length
|
|
760
750
|
? missing.join(", ")
|
|
761
751
|
: "anything the prepare pass finds uncheckable";
|
|
752
|
+
const choice = plannerChoice(ticket.planner_harness?.trim() || undefined);
|
|
753
|
+
if (choice.model &&
|
|
754
|
+
!modelFitsHarness(choice.command, choice.model, await harnessModels(choice.command))) {
|
|
755
|
+
throw new Error(`Planner model "${choice.model}" isn't available on ${choice.command}. Pick another planner model in New task.`);
|
|
756
|
+
}
|
|
762
757
|
const prepared = await runPlan([
|
|
763
758
|
{
|
|
764
759
|
role: "user",
|
|
@@ -779,7 +774,7 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
779
774
|
id: item.id,
|
|
780
775
|
title: item.title,
|
|
781
776
|
state: item.state,
|
|
782
|
-
})), undefined, null, "new-task");
|
|
777
|
+
})), undefined, null, "new-task", undefined, undefined, undefined, undefined, undefined, undefined, undefined, choice.model, choice.command);
|
|
783
778
|
planned.push(...prepared.cards);
|
|
784
779
|
return (prepared.cards.find((card) => card.id === ticket.id) ?? prepared.cards[0] ?? null);
|
|
785
780
|
})();
|
|
@@ -923,11 +918,14 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
923
918
|
return;
|
|
924
919
|
}
|
|
925
920
|
const reviewer = profile.name === "reviewer";
|
|
921
|
+
// The reviewer runs on the planner's setup, like the automatic review.
|
|
922
|
+
const reviewerSetup = reviewer ? plannerSetup() : null;
|
|
926
923
|
const job = {
|
|
927
924
|
prompt: reviewer
|
|
928
925
|
? buildReviewPrompt(ticket, comment, latestPullRequestUrl(ticket.id), absoluteAttachments(root, ticket.attachments))
|
|
929
926
|
: buildCommentPrompt(ticket, comment, absoluteAttachments(root, ticket.attachments)),
|
|
930
927
|
profile: profile.name,
|
|
928
|
+
...(reviewerSetup ? { ...reviewerSetup, model: reviewerSetup.model ?? "" } : {}),
|
|
931
929
|
// A verified ticket's developer never commits or reports Review: the board
|
|
932
930
|
// checks and publishes, so its comment runs get the verified doctrine.
|
|
933
931
|
systemPrompt: reviewer
|
|
@@ -999,6 +997,7 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
999
997
|
*/
|
|
1000
998
|
const discover = listModels ?? ((value) => listHarnessModels(value, { listCodex: listCodexModels }));
|
|
1001
999
|
const listedModels = new Map();
|
|
1000
|
+
const hiddenModels = (command, models) => models.filter((model) => !(db.getBoardSettings().hiddenModels?.[command] ?? []).includes(model));
|
|
1002
1001
|
const harnessModels = (command) => {
|
|
1003
1002
|
const cached = listedModels.get(command);
|
|
1004
1003
|
if (cached && Date.now() - cached.at < MODEL_LIST_TTL_MS)
|
|
@@ -1017,9 +1016,8 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
1017
1016
|
const profileHarness = profile.harness.trim() || effectiveHarness();
|
|
1018
1017
|
return {
|
|
1019
1018
|
harness: command,
|
|
1020
|
-
models: await harnessModels(command),
|
|
1021
|
-
model:
|
|
1022
|
-
(command === effectiveHarness() ? effectiveDeveloperModel() : ""),
|
|
1019
|
+
models: hiddenModels(command, await harnessModels(command)),
|
|
1020
|
+
model: command === profileHarness ? profile.model.trim() : "",
|
|
1023
1021
|
thinking: profile.thinking,
|
|
1024
1022
|
skills: skillBriefs(readSkills(skills)),
|
|
1025
1023
|
};
|
|
@@ -1029,7 +1027,7 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
1029
1027
|
* turn, else the board's harness and its saved model.
|
|
1030
1028
|
*/
|
|
1031
1029
|
const plannerChoice = (turnHarness, turnModel) => {
|
|
1032
|
-
const command = turnHarness ||
|
|
1030
|
+
const command = turnHarness || boardPlannerHarness();
|
|
1033
1031
|
return {
|
|
1034
1032
|
command,
|
|
1035
1033
|
model: turnModel === undefined ? plannerModelFor(command) : turnModel.trim(),
|
|
@@ -1084,8 +1082,8 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
1084
1082
|
plan: request.plan,
|
|
1085
1083
|
board: request.board,
|
|
1086
1084
|
priorSummary: request.priorSummary,
|
|
1087
|
-
command:
|
|
1088
|
-
planner: createPlanner(
|
|
1085
|
+
command: boardPlannerHarness(),
|
|
1086
|
+
planner: createPlanner(boardPlannerHarness(), effectivePlannerModel()),
|
|
1089
1087
|
model: effectivePlannerModel() || undefined,
|
|
1090
1088
|
timeoutMs: summaryTimeoutMs,
|
|
1091
1089
|
thinking: plannerThinkingForTurn(),
|
|
@@ -1191,16 +1189,22 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
1191
1189
|
testsFirstForcedOff: forcedOff,
|
|
1192
1190
|
};
|
|
1193
1191
|
};
|
|
1194
|
-
app.get("/api/settings", (c) => c.json({ settings: effectiveBoardSettings() }));
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1192
|
+
app.get("/api/settings", auth, (c) => c.json({ settings: effectiveBoardSettings() }));
|
|
1193
|
+
// The machine setup carries the harness only. Models come from the board
|
|
1194
|
+
// settings, the Agents page, or the harness's own default.
|
|
1195
|
+
app.get("/api/setup", auth, (c) => {
|
|
1196
|
+
const saved = setupStore.read();
|
|
1197
|
+
return c.json({
|
|
1198
|
+
setup: {
|
|
1199
|
+
harness: saved.harness,
|
|
1200
|
+
completedAt: saved.completedAt,
|
|
1201
|
+
effectiveHarness: effectiveHarness(),
|
|
1202
|
+
},
|
|
1203
|
+
});
|
|
1199
1204
|
});
|
|
1200
|
-
app.get("/api/setup", (c) => c.json({ setup: setupResponse() }));
|
|
1201
1205
|
const providerSignIns = new ProviderSignIns(providerAuth?.signIn);
|
|
1202
1206
|
const keyDeps = providerAuth?.keys ?? {};
|
|
1203
|
-
app.get("/api/providers", async (c) => {
|
|
1207
|
+
app.get("/api/providers", auth, async (c) => {
|
|
1204
1208
|
const detected = await detectHarnesses();
|
|
1205
1209
|
const installed = Object.fromEntries(detected.map((item) => [item.id, item.installed]));
|
|
1206
1210
|
const [claude, openai, piOpenAISubscription, piOpenAIKey, deepseek, googleSubscription, googleApiKey,] = await Promise.all([
|
|
@@ -1226,7 +1230,7 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
1226
1230
|
},
|
|
1227
1231
|
});
|
|
1228
1232
|
});
|
|
1229
|
-
app.post("/api/providers/pi/install", async (c) => {
|
|
1233
|
+
app.post("/api/providers/pi/install", auth, async (c) => {
|
|
1230
1234
|
if (c.get("principal").kind !== "local") {
|
|
1231
1235
|
return c.json({ error: "Pi can only be installed from the local board" }, 403);
|
|
1232
1236
|
}
|
|
@@ -1239,35 +1243,7 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
1239
1243
|
return c.json({ error: message }, 500);
|
|
1240
1244
|
}
|
|
1241
1245
|
});
|
|
1242
|
-
app.put("/api/
|
|
1243
|
-
const body = await c.req
|
|
1244
|
-
.json()
|
|
1245
|
-
.catch(() => ({}));
|
|
1246
|
-
const legacy = typeof body.model === "string" ? body.model.trim() : undefined;
|
|
1247
|
-
const plannerModel = typeof body.plannerModel === "string" ? body.plannerModel.trim() : legacy;
|
|
1248
|
-
const developerModel = typeof body.developerModel === "string" ? body.developerModel.trim() : legacy;
|
|
1249
|
-
if (plannerModel !== undefined && developerModel === undefined && legacy === undefined) {
|
|
1250
|
-
if (plannerModel.length > 200)
|
|
1251
|
-
return c.json({ error: "model is too long" }, 400);
|
|
1252
|
-
setupStore.save({ plannerModel, modelChosen: true });
|
|
1253
|
-
return c.json({ setup: setupResponse() });
|
|
1254
|
-
}
|
|
1255
|
-
if (plannerModel === undefined || developerModel === undefined) {
|
|
1256
|
-
return c.json({ error: "plannerModel and developerModel must be strings" }, 400);
|
|
1257
|
-
}
|
|
1258
|
-
if (plannerModel.length > 200 || developerModel.length > 200) {
|
|
1259
|
-
return c.json({ error: "model is too long" }, 400);
|
|
1260
|
-
}
|
|
1261
|
-
db.clearProfileRuntimeOverrides();
|
|
1262
|
-
setupStore.save({
|
|
1263
|
-
...(legacy === undefined ? {} : { model: legacy }),
|
|
1264
|
-
plannerModel,
|
|
1265
|
-
developerModel,
|
|
1266
|
-
modelChosen: true,
|
|
1267
|
-
});
|
|
1268
|
-
return c.json({ setup: setupResponse() });
|
|
1269
|
-
});
|
|
1270
|
-
app.put("/api/settings", async (c) => {
|
|
1246
|
+
app.put("/api/settings", auth, async (c) => {
|
|
1271
1247
|
const body = await c.req
|
|
1272
1248
|
.json()
|
|
1273
1249
|
.catch(() => ({}));
|
|
@@ -1302,6 +1278,14 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
1302
1278
|
return c.json({ error: `unknown harness: ${invalidHarness}` }, 400);
|
|
1303
1279
|
patch.plannerHarness = body.plannerHarness.trim();
|
|
1304
1280
|
}
|
|
1281
|
+
if (body.hiddenModels !== undefined) {
|
|
1282
|
+
if (!body.hiddenModels ||
|
|
1283
|
+
typeof body.hiddenModels !== "object" ||
|
|
1284
|
+
Array.isArray(body.hiddenModels) ||
|
|
1285
|
+
Object.values(body.hiddenModels).some((models) => !Array.isArray(models) || models.some((model) => typeof model !== "string")))
|
|
1286
|
+
return c.json({ error: "hiddenModels must map harnesses to model lists" }, 400);
|
|
1287
|
+
patch.hiddenModels = body.hiddenModels;
|
|
1288
|
+
}
|
|
1305
1289
|
if (body.plannerModel !== undefined) {
|
|
1306
1290
|
if (typeof body.plannerModel !== "string" || body.plannerModel.trim().length > 200)
|
|
1307
1291
|
return c.json({ error: "plannerModel must be a string up to 200 characters" }, 400);
|
|
@@ -1563,12 +1547,23 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
1563
1547
|
: { kind: "local" },
|
|
1564
1548
|
capabilities: capabilitiesFor(principal),
|
|
1565
1549
|
build,
|
|
1566
|
-
// The account is the Mac's: a phone tunnel never gets its picture.
|
|
1567
|
-
avatarUrl: principal.kind === "local" ? (accountAvatarUrl?.() ?? null) : null,
|
|
1568
1550
|
});
|
|
1569
1551
|
});
|
|
1552
|
+
/**
|
|
1553
|
+
* Who is signed in with Zelio Cloud: name, email and picture. The account is
|
|
1554
|
+
* the Mac's, so the tunnel allowlist does not carry this route and a phone
|
|
1555
|
+
* is refused here too. `no-store`: a new login must show on the next read.
|
|
1556
|
+
*/
|
|
1557
|
+
app.get("/api/account", async (c) => {
|
|
1558
|
+
if (c.get("principal").kind !== "local")
|
|
1559
|
+
return c.json({ error: "Not available" }, 403);
|
|
1560
|
+
const current = account ? await account().catch(() => null) : null;
|
|
1561
|
+
return c.json({ account: current }, 200, { "Cache-Control": "no-store" });
|
|
1562
|
+
});
|
|
1570
1563
|
/** Version skew: the phone compares this with the build in the tunnel hello. */
|
|
1571
|
-
app.get("/api/version", (c) => c.json({ version: "1", protocol: 1, build }, 200, {
|
|
1564
|
+
app.get("/api/version", (c) => c.json({ version: "1", protocol: 1, build, cliVersion }, 200, {
|
|
1565
|
+
"Cache-Control": "no-store",
|
|
1566
|
+
}));
|
|
1572
1567
|
/**
|
|
1573
1568
|
* The whole board in one read. `rev` is the persisted board revision; the
|
|
1574
1569
|
* ETag adds the in-memory live counter so a turn or run status change also
|
|
@@ -1747,7 +1742,13 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
1747
1742
|
app.get("/api/agent-models", async (c) => {
|
|
1748
1743
|
const command = asText(c.req.query("harness")) || effectiveHarness();
|
|
1749
1744
|
const result = await discover(command);
|
|
1750
|
-
|
|
1745
|
+
const includeHidden = c.req.query("includeHidden") === "true";
|
|
1746
|
+
return c.json({
|
|
1747
|
+
harness: command,
|
|
1748
|
+
models: includeHidden ? result.models : hiddenModels(command, result.models),
|
|
1749
|
+
hiddenModels: db.getBoardSettings().hiddenModels?.[command] ?? [],
|
|
1750
|
+
error: result.error,
|
|
1751
|
+
});
|
|
1751
1752
|
});
|
|
1752
1753
|
/**
|
|
1753
1754
|
* Standing instructions per stage. This is config, not board state: the
|
|
@@ -2151,6 +2152,9 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
2151
2152
|
if (named && !db.listRepos().some((repo) => repo.name === named)) {
|
|
2152
2153
|
return c.json({ error: `${named} is not a repository on this board` }, 400);
|
|
2153
2154
|
}
|
|
2155
|
+
const developerHarness = typeof body.developer_harness === "string" ? body.developer_harness.trim() : "";
|
|
2156
|
+
if (developerHarness && unknownHarness(developerHarness))
|
|
2157
|
+
return c.json({ error: "Unknown developer harness" }, 400);
|
|
2154
2158
|
const originalIntent = originalIntentOf(draft.conversationId);
|
|
2155
2159
|
const goal = asText(body.goal);
|
|
2156
2160
|
const ticket = db.createTicket({
|
|
@@ -2163,6 +2167,7 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
2163
2167
|
likely_files: Array.isArray(body.likely_files)
|
|
2164
2168
|
? body.likely_files.filter((file) => typeof file === "string")
|
|
2165
2169
|
: [],
|
|
2170
|
+
plan: typeof body.plan === "string" ? body.plan : null,
|
|
2166
2171
|
context: [
|
|
2167
2172
|
...(Array.isArray(body.context)
|
|
2168
2173
|
? body.context.filter((line) => typeof line === "string")
|
|
@@ -2190,6 +2195,7 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
2190
2195
|
quick: body.quick === true,
|
|
2191
2196
|
thinking: asThinking(body.thinking) ?? null,
|
|
2192
2197
|
model: typeof body.model === "string" ? body.model.trim().slice(0, 200) || null : null,
|
|
2198
|
+
developer_harness: developerHarness || null,
|
|
2193
2199
|
planner_harness: (() => {
|
|
2194
2200
|
const source = typeof draft.conversationId === "string"
|
|
2195
2201
|
? db.getConversation(draft.conversationId)
|
|
@@ -2763,7 +2769,18 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
2763
2769
|
// A model the developer harness does not list is cleared, as a planner turn
|
|
2764
2770
|
// clears it, so the card shows the default instead of a model it cannot run.
|
|
2765
2771
|
const plannerHarness = conversation.plannerHarness ?? undefined;
|
|
2766
|
-
|
|
2772
|
+
if (cards.some((card) => card.developer_harness && unknownHarness(card.developer_harness)))
|
|
2773
|
+
return c.json({ error: "Unknown developer harness" }, 400);
|
|
2774
|
+
const filteredCards = await Promise.all(cards.map(async (card) => {
|
|
2775
|
+
const developer = card.developer_harness
|
|
2776
|
+
? {
|
|
2777
|
+
...(await developerBrief(plannerHarness)),
|
|
2778
|
+
models: hiddenModels(card.developer_harness, await harnessModels(card.developer_harness)),
|
|
2779
|
+
}
|
|
2780
|
+
: await developerBrief(plannerHarness);
|
|
2781
|
+
return keepListedModels({ ...conversation.plan, cards: [card] }, developer).cards[0];
|
|
2782
|
+
}));
|
|
2783
|
+
const filteredPlan = { ...conversation.plan, cards: filteredCards };
|
|
2767
2784
|
return c.json({
|
|
2768
2785
|
conversation: db.setPlan(filteredPlan, conversation.id),
|
|
2769
2786
|
});
|
|
@@ -3109,6 +3126,23 @@ export function createApp({ db, token, port, webRoot, repoRoot, accountAvatarUrl
|
|
|
3109
3126
|
* end mistakes it for a run to restart. The token in the returned command is
|
|
3110
3127
|
* shown once; the database keeps only its hash.
|
|
3111
3128
|
*/
|
|
3129
|
+
/**
|
|
3130
|
+
* Where the ticket's checkout is, as a `cd` the person can paste into their own
|
|
3131
|
+
* terminal to test what the agent built. Read-only: no run, state or worktree
|
|
3132
|
+
* changes. Local only, the same as the checks it sits beside.
|
|
3133
|
+
*/
|
|
3134
|
+
app.get("/api/tickets/:id/worktree", (c) => {
|
|
3135
|
+
if (c.get("principal").kind !== "local") {
|
|
3136
|
+
return c.json({ error: "the worktree is available from the local board only" }, 403);
|
|
3137
|
+
}
|
|
3138
|
+
const ticket = db.getTicket(c.req.param("id"));
|
|
3139
|
+
if (!ticket)
|
|
3140
|
+
return c.json({ error: "no such ticket" }, 404);
|
|
3141
|
+
const path = worktreePath(rootFor(ticket), ticket.id);
|
|
3142
|
+
if (!existsSync(join(path, ".git")))
|
|
3143
|
+
return c.json({ error: "ticket checkout is missing" }, 409);
|
|
3144
|
+
return c.json({ path, branch: ticket.branch ?? null, command: `cd ${shellQuote(path)}` });
|
|
3145
|
+
});
|
|
3112
3146
|
app.post("/api/tickets/:id/handoff", async (c) => {
|
|
3113
3147
|
const id = c.req.param("id");
|
|
3114
3148
|
const ticket = db.getTicket(id);
|