toolroll 0.9.119 → 0.9.122
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 +77 -0
- package/README.md +18 -31
- package/dist/agent-fence.js +57 -9
- package/dist/assignment.js +9 -7
- package/dist/batch-checks.js +2 -2
- package/dist/browser/workspace.js +23 -23
- package/dist/builder.js +12 -8
- package/dist/central-recovery-stage.js +3 -3
- package/dist/cli-help.js +1 -0
- package/dist/codex-limits.js +40 -22
- package/dist/coding-provider.js +3 -3
- package/dist/contracts/console-api.js +3 -0
- package/dist/direct-chat-fence.js +9 -3
- package/dist/direct-chat.js +82 -10
- package/dist/engine-reads.js +3 -1
- package/dist/flexible-agents.js +16 -2
- package/dist/flexible-import.js +38 -0
- package/dist/flexible-save.js +128 -0
- package/dist/flexible-session.js +11 -3
- package/dist/flexible-ship.js +3 -3
- package/dist/flexible-thread.js +7 -3
- package/dist/install-method.js +1 -3
- package/dist/invoke.js +11 -9
- package/dist/lead-tools.js +3 -2
- package/dist/live-terminal.js +24 -3
- package/dist/local-checks.js +32 -0
- package/dist/local-landing.js +321 -63
- package/dist/local-owner.js +3 -0
- package/dist/operate.js +25 -7
- package/dist/plan-limits-demand.js +48 -0
- package/dist/planner.js +2 -0
- package/dist/project-delete.js +1 -1
- package/dist/project-skills.js +105 -17
- package/dist/result-follow-ups.js +24 -10
- package/dist/review-context.js +2 -1
- package/dist/scout.js +2 -1
- package/dist/serve.js +8 -1
- package/dist/server/direct-chat.js +25 -3
- package/dist/server/engine-api.js +24 -3
- package/dist/server/render-release.js +27 -15
- package/dist/server/render-results.js +6 -4
- package/dist/server/route-table.js +8 -1
- package/dist/server/send-back-build.js +4 -0
- package/dist/server/settings.js +153 -3
- package/dist/server/task-views.js +8 -3
- package/dist/server/tasks.js +51 -9
- package/dist/server/terminals.js +3 -1
- package/dist/settings-groups-ui.js +1 -1
- package/dist/skill-library-schema.js +70 -0
- package/dist/skill-library.js +693 -0
- package/dist/skill-local-sync.js +334 -0
- package/dist/skills-manifest.js +6 -3
- package/dist/skills-ui.js +122 -1
- package/dist/store.js +22 -4
- package/dist/subscription-usage.js +11 -5
- package/dist/surface.js +3 -2
- package/dist/task-base.js +23 -4
- package/dist/task-outcome-cli.js +10 -1
- 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/verification-evidence.js +3 -1
- package/package.json +2 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { html,
|
|
2
|
-
import { ciWords
|
|
1
|
+
import { html, postForm } from "../html.js";
|
|
2
|
+
import { ciWords } from "../release-approval.js";
|
|
3
|
+
import { releaseAccessWords } from "../release-card.js";
|
|
3
4
|
import { checkAccessWords } from "../check-access.js";
|
|
4
5
|
import { projectName } from "../project.js";
|
|
5
6
|
import { screen } from "./chrome.js";
|
|
@@ -15,23 +16,36 @@ function changesHtml(card) {
|
|
|
15
16
|
const head = changes.baseline === null ? `Pull request #${id.pr}'s commits` : `Since the last verified release (${changes.baseline.slice(0, 7)})`;
|
|
16
17
|
const list = changes.commits.length === 0 ? note("No commits.")
|
|
17
18
|
: html `<ul class="k-list">${changes.commits.map(one => html `<li><code class="k-mono">${one.sha.slice(0, 7)}</code> ${one.subject}</li>`)}</ul>`;
|
|
18
|
-
return disclose(`What changed: ${changes.commits.length} commit${changes.commits.length === 1 ? "" : "s"}`, html `<p class="k-note">${head}</p>${list}
|
|
19
|
+
return disclose(`What changed: ${changes.commits.length} commit${changes.commits.length === 1 ? "" : "s"}`, html `<p class="k-note">${head}</p>${list}`, changes.commits.length > 0 && changes.commits.length <= 5);
|
|
20
|
+
}
|
|
21
|
+
function releaseSummaryHtml(card) {
|
|
22
|
+
const id = card.seal.identity;
|
|
23
|
+
const carries = card.seal.kind === "terms" && card.seal.terms.policy.carry;
|
|
24
|
+
const checkKind = card.seal.kind === "check" && card.seal.purpose.check === "deploy"
|
|
25
|
+
? "Deploy check (~4 min)"
|
|
26
|
+
: checkAccessWords(id.access);
|
|
27
|
+
const accessWarning = releaseAccessWords(id.access);
|
|
28
|
+
const rows = [
|
|
29
|
+
["Commit", html `<code class="k-mono" title="${id.approvedSha}">${id.approvedSha.slice(0, 7)}</code> · <code class="k-mono">${id.branch}</code>`],
|
|
30
|
+
["Check", checkKind],
|
|
31
|
+
["On approve", `Runs the release check on ${id.approvedSha.slice(0, 7)}, then deploys, merges, tags and publishes once GitHub CI and the check pass.`],
|
|
32
|
+
["Later commits", carries ? "Later commits that only change tests, docs or the changelog carry this approval." : "Every later commit asks again."],
|
|
33
|
+
];
|
|
34
|
+
return html `${accessWarning === null ? "" : notice(accessWarning)}${facts(rows)}`;
|
|
19
35
|
}
|
|
20
36
|
function termsHtml(card) {
|
|
21
|
-
|
|
37
|
+
const isRelease = (key) => key.startsWith("release.") || key.startsWith("releaseCheck.");
|
|
38
|
+
const releaseTerms = card.terms.filter(line => isRelease(line.key));
|
|
39
|
+
const scopeTerms = card.terms.filter(line => !isRelease(line.key));
|
|
40
|
+
const renderRows = (lines) => facts(lines.map(line => [line.label, html `<span class="k-mono">${line.value}</span>`]));
|
|
41
|
+
const inner = html `${releaseTerms.length === 0 ? "" : html `<h3>Release</h3>${renderRows(releaseTerms)}`}${scopeTerms.length === 0 ? "" : html `<h3>Underlying scope & settings</h3>${renderRows(scopeTerms)}`}`;
|
|
42
|
+
return disclose(`Every term (${card.terms.length})`, inner, false);
|
|
22
43
|
}
|
|
23
44
|
export function releaseSheetPage(chrome, data) {
|
|
24
45
|
const card = data.card;
|
|
25
46
|
const id = card.seal.identity;
|
|
26
47
|
const title = `Release ${id.packageVersion}`;
|
|
27
|
-
const
|
|
28
|
-
["Pull request", `#${id.pr}`],
|
|
29
|
-
["Branch", html `<code class="k-mono">${id.branch}</code>`],
|
|
30
|
-
["Commit", html `<code class="k-mono">${id.approvedSha}</code>`],
|
|
31
|
-
["Project", projectName(id.repo)],
|
|
32
|
-
["Checks", checkAccessWords(id.access)],
|
|
33
|
-
]);
|
|
34
|
-
const consequence = releaseConsequence(card);
|
|
48
|
+
const summaryHtml = releaseSummaryHtml(card);
|
|
35
49
|
const ci = ciWords(card.ci, id.approvedSha);
|
|
36
50
|
const notRunning = card.stopped === null ? "" : infoLine(html `The release isn't running (it stopped at ${card.stopped.step}). After you approve, run <code class="k-mono">toolroll release ${id.branch}</code>.`);
|
|
37
51
|
let status, text, acts, terms, wait = false;
|
|
@@ -60,12 +74,10 @@ export function releaseSheetPage(chrome, data) {
|
|
|
60
74
|
text = ci;
|
|
61
75
|
acts = data.nonce === "" ? "" : approveForm({
|
|
62
76
|
action: `${taskHref(card.taskId)}/approve`, kind: "standard", facts: data.facts, label: "Approve release", primary: true,
|
|
63
|
-
before: html `<section class="k-sec"><h3>What approving does</h3>${joinHtml(consequence.map(line => html `<p class="k-note">${line}</p>`))}${termsHtml(card)}</section>`,
|
|
64
77
|
form: { hidden: { nonce: data.nonce, digest: card.digest, sheet: "release" }, attrs: { class: "k-form", "data-release-approve": card.digest } },
|
|
65
78
|
});
|
|
66
79
|
terms = approvalTerms("standard", data.facts);
|
|
67
80
|
}
|
|
68
|
-
const
|
|
69
|
-
const body = doc(docHeader({ title, back: [taskHref(card.taskId), "Task"], meta: `${projectName(id.repo)} · pull request #${id.pr}` }), data.problem === null ? "" : notice(data.problem), summary, changesHtml(card), slots({ wait, attrs: { "data-release-sheet": card.taskId }, status, text, acts, terms }), notRunning, data.held == null ? "" : html `<section class="k-sec" data-release-held><h3>Held after its merge</h3><p class="k-note">${data.held}.</p>${postForm(`${taskHref(card.taskId)}/release/go-on`, html `${field({ id: "go-on-password", label: "Your password", control: input({ id: "go-on-password", name: "password", type: "password", attrs: { required: true, autocomplete: "current-password" } }) })}${btn("Let it go on", { variant: "primary", type: "submit" })}`, { attrs: { class: "k-form" } })}</section>`, formShown ? "" : html `<section class="k-sec"><h3>What approving does</h3>${joinHtml(consequence.map(line => html `<p class="k-note">${line}</p>`))}</section>${termsHtml(card)}`);
|
|
81
|
+
const body = doc(docHeader({ title, back: [taskHref(card.taskId), "Task"], meta: `${projectName(id.repo)} · pull request #${id.pr}` }), data.problem === null ? "" : notice(data.problem), slots({ wait, attrs: { "data-release-sheet": card.taskId }, status, text, body: summaryHtml, acts, terms }), notRunning, data.held == null ? "" : html `<section class="k-sec" data-release-held><h3>Held after its merge</h3><p class="k-note">${data.held}.</p>${postForm(`${taskHref(card.taskId)}/release/go-on`, html `${field({ id: "go-on-password", label: "Your password", control: input({ id: "go-on-password", name: "password", type: "password", attrs: { required: true, autocomplete: "current-password" } }) })}${btn("Let it go on", { variant: "primary", type: "submit" })}`, { attrs: { class: "k-form" } })}</section>`, changesHtml(card), termsHtml(card));
|
|
70
82
|
return screen(title, body, { chrome });
|
|
71
83
|
}
|
|
@@ -581,8 +581,8 @@ export function reviewCockpitDetailParts(view, csrf, noted, canRetryReview, tab,
|
|
|
581
581
|
const blocked = hardStop ?? cantAcceptYetOf(proof?.verdict ?? null, proof?.reasons ?? [], accepted);
|
|
582
582
|
const youCheck = panel.panel.youCheck;
|
|
583
583
|
const shared = accepted || assignment?.receipt == null ? null : owedAcceptance(assignment.receipt, assignment.readiness?.blockers ?? []);
|
|
584
|
-
const owed = accepted ? null : youCheck?.accept != null
|
|
585
|
-
: shared === "
|
|
584
|
+
const owed = accepted ? null : youCheck?.accept != null || shared === "person-check" ? { note: null }
|
|
585
|
+
: shared === "exception" || blocked === ACCEPT_NEEDS_REASON ? { note: "Why is this safe to accept?" } : null;
|
|
586
586
|
const complete = hardStop === null && assignment?.state === "ready-to-check" && assignment.receipt !== null && canRetryReview && csrf !== ""
|
|
587
587
|
? { action: `${taskHref(view.taskId)}/complete`, receipt: assignment.receipt.digest, run: run.id, accept: owed, ...(host.kind === "task" ? { returnTo: at() } : {}) } : null;
|
|
588
588
|
if (complete !== null)
|
|
@@ -1332,6 +1332,7 @@ export function resultPanelParts(detail, o) {
|
|
|
1332
1332
|
const humanReview = manualReviewOnly(proof === null ? null : { ...proof, verdict: proof.verdict ?? "" });
|
|
1333
1333
|
const need = needActionOf(current, taskStatus, o.csrf, o.returnTo, {
|
|
1334
1334
|
accepted: proof?.accepted != null, humanReview, run: run.id, action: `${taskHref(detail.taskId)}/accept-proof`, refuted: proof?.verdict === "refuted",
|
|
1335
|
+
exception: current?.receipt == null ? !humanReview : owedAcceptance(current.receipt, current.readiness?.blockers ?? []) === "exception",
|
|
1335
1336
|
rebuildable: proof?.accepted == null && proof?.verdict !== "verified" && proof?.verdict !== "attested" && !(detail.publication !== null && ["pushed", "opened"].includes(detail.publication.state))
|
|
1336
1337
|
});
|
|
1337
1338
|
const directAssessment = proof?.matrix.some(row => row.assessment !== undefined) === true;
|
|
@@ -1704,9 +1705,10 @@ export function needActionOf(assignment, status, csrf, returnTo, result) {
|
|
|
1704
1705
|
if (action?.code === "retry-task" && status.need.key === "rebuild" && csrf !== "")
|
|
1705
1706
|
return { label: status.need.action.label, ...rebuild };
|
|
1706
1707
|
if (result !== undefined) {
|
|
1708
|
+
const exception = result.refuted === true || (result.exception ?? !result.humanReview);
|
|
1707
1709
|
if ((status.need.key === "review-result" || result.refuted === true) && !result.accepted && csrf !== "")
|
|
1708
|
-
return { label:
|
|
1709
|
-
accept: { action: result.action, run: result.run, returnTo, note:
|
|
1710
|
+
return { label: exception ? "Accept with exception" : "Accept result", href: null, confirm: null,
|
|
1711
|
+
accept: { action: result.action, run: result.run, returnTo, note: exception ? "Why is this safe to accept?" : null } };
|
|
1710
1712
|
const here = (action?.code === "open-result" || action?.code === "inspect-run") && action.target.runId === result.run;
|
|
1711
1713
|
if (here && csrf !== "" && !result.accepted && result.humanReview)
|
|
1712
1714
|
return { label: "Accept result", href: null, confirm: null, accept: { action: result.action, run: result.run, returnTo, note: null } };
|
|
@@ -55,6 +55,7 @@ const LOCAL_POSTS = Object.freeze({
|
|
|
55
55
|
"agents.live.thread.ship": "ship-thread",
|
|
56
56
|
"agents.live.thread.ship-cancel": "cancel-ship",
|
|
57
57
|
"agents.live.thread.ship-send-back": "reply-thread",
|
|
58
|
+
"agents.live.thread.save": "save-thread",
|
|
58
59
|
"task.act.reply": "answer-question",
|
|
59
60
|
"task.act.stop": "stop-run",
|
|
60
61
|
"task.act.cancel": "stop-run",
|
|
@@ -72,6 +73,7 @@ const LOCAL_POSTS = Object.freeze({
|
|
|
72
73
|
"flow.trigger.resume": "trigger-resume",
|
|
73
74
|
"flow.trigger.check": "trigger-run",
|
|
74
75
|
"flow.trigger.press": "trigger-run",
|
|
76
|
+
"run.act.checks": "run-checks",
|
|
75
77
|
"run.act.revise": "request-revision",
|
|
76
78
|
"run.act.note": "request-revision",
|
|
77
79
|
"run.act.comment": "request-revision",
|
|
@@ -90,11 +92,13 @@ const LOCAL_POSTS = Object.freeze({
|
|
|
90
92
|
"direct-chat.ship": "direct-chat-ship",
|
|
91
93
|
"direct-chat.page-ship-review": "read",
|
|
92
94
|
"direct-chat.page-ship": "direct-chat-ship",
|
|
95
|
+
"direct-chat.page-reply": "direct-chat-send",
|
|
93
96
|
"direct-chat.ship-cancel": "direct-chat-manage",
|
|
94
97
|
"term.agent-sign-in": "agent-sign-in",
|
|
95
98
|
"term.agent-install": "agent-install",
|
|
96
99
|
"engine.agents-check": "check-agents",
|
|
97
100
|
"settings.models-agent": "change-models",
|
|
101
|
+
"settings.skills-library": "skill-library",
|
|
98
102
|
"task.act.archive": "archive-task",
|
|
99
103
|
"task.act.restore": "archive-task",
|
|
100
104
|
"projects.open": "add-project",
|
|
@@ -336,6 +340,7 @@ post("pages", "agents.live.thread.end", "^\\/agents\\/live\\/thread\\/[0-9a-f]{3
|
|
|
336
340
|
post("pages", "agents.live.thread.ship", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/ship$", { limited: "unscoped", callers: ["cookie"], project: "none", ...approver("An approver ships their own thread's work."), sample: `/agents/live/thread/${"a".repeat(32)}/ship` });
|
|
337
341
|
post("pages", "agents.live.thread.ship-cancel", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/ship\\/cancel$", { limited: "unscoped", callers: ["cookie"], project: "none", sample: `/agents/live/thread/${"a".repeat(32)}/ship/cancel` });
|
|
338
342
|
post("pages", "agents.live.thread.ship-send-back", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/ship\\/send-back$", { limited: "unscoped", callers: ["cookie"], project: "none", ...approver("An approver sends back their own thread's Ship."), sample: `/agents/live/thread/${"a".repeat(32)}/ship/send-back` });
|
|
343
|
+
post("pages", "agents.live.thread.save", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/save$", { limited: "unscoped", callers: ["cookie"], project: "none", ...approver("An approver saves their own thread's work as a branch."), sample: `/agents/live/thread/${"a".repeat(32)}/save` });
|
|
339
344
|
get("pages", "agents.terminals", "/agents/terminals", TERM);
|
|
340
345
|
get("pages", "fleet", "/fleet", free);
|
|
341
346
|
get("tasks", "tasks.new", "/tasks/new", { limited: "collection", ...free });
|
|
@@ -448,6 +453,7 @@ post("tasks", "direct-chat.ship-preview", `^\\/engine\\/direct-chats\\/${TERMINA
|
|
|
448
453
|
post("tasks", "direct-chat.ship", `^\\/engine\\/direct-chats\\/${TERMINAL}\\/ship$`, { ...DIRECT_CHAT, scope: "step-up", sample: `/engine/direct-chats/${"a".repeat(32)}/ship` });
|
|
449
454
|
post("tasks", "direct-chat.page-ship-review", `^\\/direct-chats\\/${TERMINAL}\\/ship-review$`, { ...DIRECT_CHAT, sample: `/direct-chats/${"a".repeat(32)}/ship-review` });
|
|
450
455
|
post("tasks", "direct-chat.page-ship", `^\\/direct-chats\\/${TERMINAL}\\/ship$`, { ...DIRECT_CHAT, scope: "step-up", sample: `/direct-chats/${"a".repeat(32)}/ship` });
|
|
456
|
+
post("tasks", "direct-chat.page-reply", `^\\/direct-chats\\/${TERMINAL}\\/reply$`, { ...DIRECT_CHAT, scope: "step-up", sample: `/direct-chats/${"a".repeat(32)}/reply` });
|
|
451
457
|
post("tasks", "direct-chat.ship-cancel", `^\\/engine\\/direct-chats\\/${TERMINAL}\\/ship-cancel$`, { ...DIRECT_CHAT, sample: `/engine/direct-chats/${"a".repeat(32)}/ship-cancel` });
|
|
452
458
|
for (const one of ["send", "stop", "resume", "recover", "continue", "ship", "answer"])
|
|
453
459
|
post("tasks", `code.${one}-send`, `^\\/code\\/${SESSION}\\/${one}$`, { ...CODING_ACT, sample: `/code/${"a".repeat(32)}/${one}` });
|
|
@@ -457,6 +463,7 @@ post("tasks", "code.act-other", "^\\/code(\\/.*)?$", { ...CODING_ACT, sample: "/
|
|
|
457
463
|
post("settings", "settings.skills-revise", "/settings/skills/revise", { project: "form", limited: "unscoped", ...approver("Sign in to revise a test.", "/settings/skills") });
|
|
458
464
|
post("settings", "settings.skills-import", "/settings/skills/import", { project: "form", limited: "unscoped", bodyCap: 2 * 1024 * 1024, ...approver("Sign in as an approver to manage skills.", "/settings/skills") });
|
|
459
465
|
post("settings", "settings.skills-change", "/settings/skills/change", { project: "form", limited: "unscoped", ...approver("Sign in as an approver to manage skills.", "/settings/skills") });
|
|
466
|
+
post("settings", "settings.skills-library", "/settings/skills/library", { project: "none", limited: "unscoped", bodyCap: 2 * 1024 * 1024, ...approver("Sign in as an approver to manage the skill library.", "/settings/skills") });
|
|
460
467
|
for (const one of ["setup", "sample", "github"])
|
|
461
468
|
post("flows", `kit.${one}`, `^\\/kits\\/[a-z-]{1,40}\\/${one}$`, { project: "form", sample: `/kits/support/${one}`, ...approver("Sign in as an approver to set kits up.", "/kits") });
|
|
462
469
|
const SUBAGENTS = anyApprover("Sign in as an approver to look after subagents.", "/settings/lead/subagents");
|
|
@@ -660,7 +667,7 @@ for (const one of ["prepare", "preview", "import", "save"])
|
|
|
660
667
|
post("flows", `recipes.${one}-send`, `/recipes/${one}`, { limited: "collection" });
|
|
661
668
|
post("flows", "recipes.launch-send", "/recipes/launch", { limited: "collection" });
|
|
662
669
|
for (const one of ["note", "comment", "revise", "draft-repair", "checks", "add-tests"])
|
|
663
|
-
post("tasks", `run.act.${one}`, `^\\/r\\/${ID}\\/${one}$`, { project: "run", limited: "resource", sample: `/r/1/${one}
|
|
670
|
+
post("tasks", `run.act.${one}`, `^\\/r\\/${ID}\\/${one}$`, { project: "run", limited: "resource", sample: `/r/1/${one}`, ...(one === "comment" ? { freshness: "allowlist" } : {}) });
|
|
664
671
|
post("tasks", "run.act.reveal", `^\\/r\\/${ID}\\/reveal$`, { project: "run", limited: "resource", callers: ["cookie"], sample: "/r/1/reveal", ...approver("Only an approver can show an agent's files.") });
|
|
665
672
|
post("tasks", "session.editor-links", "/session/editor-links", { viewer: true });
|
|
666
673
|
post("tasks", "agents.seen", "/agents/seen", { callers: ["cookie"], project: "none", limited: "unscoped", viewer: true });
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { freshnessFor, passwordlessSessionFor, ssoNowAvailable, withFreshness } from "../scope.js";
|
|
2
|
+
export function sessionYesPossible(store, by, preview) {
|
|
3
|
+
return passwordlessSessionFor(store, by) || ssoNowAvailable(by) || withFreshness("approve-standard", () => freshnessFor(by, Date.now(), preview)) !== null;
|
|
4
|
+
}
|
package/dist/server/settings.js
CHANGED
|
@@ -122,6 +122,9 @@ import { applySavedKnowledge, changeKnowledge, knowledgeVersion, knowledgeView }
|
|
|
122
122
|
import { changeLearning } from "../project-learning.js";
|
|
123
123
|
import { listDecisions, recordDecision, retireDecision, searchMemory } from "../project-memory.js";
|
|
124
124
|
import { changeSkills, githubSkill, importSkill, reviseSkillTest, skillsView, testSkill } from "../project-skills.js";
|
|
125
|
+
import { changeLibrarySkill, currentLibrary, dismissHeldBundleUpdate, enabledLibrarySkills, importGithubSkillBundle, importLibrarySkill, rollbackSkillBundle, setBundleAutoUpdate, setProjectSkillOptOut, skillLibraryView, sweepSkillBundleUpdates } from "../skill-library.js";
|
|
126
|
+
import { LOCAL_SKILL_TOOLS, setLocalSkillSync, syncEnabledLocalTools } from "../skill-local-sync.js";
|
|
127
|
+
import { skillLibrarySectionHtml } from "../skills-ui.js";
|
|
125
128
|
import { signedIn } from "../oauth-run-token.js";
|
|
126
129
|
import { addToolTo, catalogTool, localAppOf, removeToolFrom, setToolSecret, splitCommandLine, testToolOf, toolSecretStorage } from "../project-tools.js";
|
|
127
130
|
import { liftAuthPause } from "../provider-auth.js";
|
|
@@ -146,6 +149,7 @@ import { approvalFactsNow } from "./kit.js";
|
|
|
146
149
|
import { spendReport, spendReportCsv, spendRows } from "../spend-report.js";
|
|
147
150
|
import { savingsReportOrError } from "../route-savings.js";
|
|
148
151
|
import { limitsView } from "../limits-ui.js";
|
|
152
|
+
import { notePlanLimitsViewed } from "../plan-limits-demand.js";
|
|
149
153
|
import { budgetStates, monthNamed, spendItems, usd as spendUsd, subagentNames as subagentNamesOf } from "../spend.js";
|
|
150
154
|
import { removeSsoSettings, saveSsoSettings, SSO_CALLBACK, ssoChangeWords } from "../sso-settings.js";
|
|
151
155
|
import { ssoSettingsHtml } from "../sso-ui.js";
|
|
@@ -209,6 +213,7 @@ export function createSettingsHandlers(runtime) {
|
|
|
209
213
|
fieldError: url.searchParams.get("field") === "usd" ? url.searchParams.get("problem") : null,
|
|
210
214
|
problem: url.searchParams.get("field") === "usd" ? null : url.searchParams.get("problem"),
|
|
211
215
|
};
|
|
216
|
+
notePlanLimitsViewed(store, now);
|
|
212
217
|
const windows = limitsView(store.providerLimits(), [], { project: projectName, subagent: id => subagentNames.get(id) ?? `Subagent ${id}` }, now);
|
|
213
218
|
const view = { month: month.name, previous: shift(-1), next: month.name === current.name ? null : shift(1), current: current.name, report: spendReport(rows),
|
|
214
219
|
budgets, unlimited, targets, windows, subagentNames, edit, facts: approvalFactsNow(),
|
|
@@ -313,17 +318,31 @@ ${connectionHtml(asked, connection, task)}${command === null ? "" : html `<p>On
|
|
|
313
318
|
if (chosen && !projects.includes(chosen))
|
|
314
319
|
return refuse(response, who, 403, "That project is outside your access.", "/projects");
|
|
315
320
|
const selector = projectPicker("/settings/skills", projects.map(repo => ({ repo, name: projectName(repo) })), chosen);
|
|
316
|
-
|
|
321
|
+
const canManage = who.role === "approver";
|
|
322
|
+
const csrf = who.via === "cookie" ? who.session.csrf : "";
|
|
323
|
+
let globalContent = html ``;
|
|
324
|
+
try {
|
|
325
|
+
const libView = skillLibraryView(store, { repo: chosen || null });
|
|
326
|
+
globalContent = skillLibrarySectionHtml(libView, libView.localSync, csrf, canManage, {
|
|
327
|
+
repo: chosen,
|
|
328
|
+
said: url.searchParams.get("said"),
|
|
329
|
+
error: url.searchParams.get("problem"),
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
catch (error) {
|
|
333
|
+
globalContent = html `<p class="problem" role="alert">${error instanceof Error ? error.message : "Global skill library is unavailable."}</p>`;
|
|
334
|
+
}
|
|
335
|
+
let content = html `<p>Add a project to manage project-specific skills.</p>`;
|
|
317
336
|
if (chosen) {
|
|
318
337
|
try {
|
|
319
338
|
const agent = resolvePhaseAgent(store, 'build', chosen, {});
|
|
320
|
-
content = (skillsHtml(skillsView(store, chosen, who.name),
|
|
339
|
+
content = (skillsHtml(skillsView(store, chosen, who.name), csrf, canManage, { focus: url.searchParams.get('skill') ?? '', agent: agent.ok ? `Report agent: ${agent.spec.provider} · ${agent.spec.model ?? 'default'}. Change it on the test task before approval` : 'Choose a report agent on the test task before approval' }));
|
|
321
340
|
}
|
|
322
341
|
catch (error) {
|
|
323
342
|
content = html `<p class="problem" role="alert">${error instanceof Error ? error.message : 'Skills are unavailable. Reload to retry.'}</p>`;
|
|
324
343
|
}
|
|
325
344
|
}
|
|
326
|
-
return sendScreen(response, 200, screen('Skills', settingsSubPage("agents", "Skills", html `${url.searchParams.get('saved') === '1' ? html `<p role="status">Saved.</p>` : ''}${selector}${content}`), { chrome: chromeFor(chosen || project, 'settings'), functional: { script: skillsScript() } }));
|
|
345
|
+
return sendScreen(response, 200, screen('Skills', settingsSubPage("agents", "Skills", html `${url.searchParams.get('saved') === '1' ? html `<p role="status">Saved.</p>` : ''}${globalContent}${selector}${content}`), { chrome: chromeFor(chosen || project, 'settings'), functional: { script: skillsScript() } }));
|
|
327
346
|
}
|
|
328
347
|
async function toolsPage(ctx) {
|
|
329
348
|
const { url, who, response, project } = ctx;
|
|
@@ -2684,6 +2703,7 @@ ${postForm("/settings/chat-approval/save", html `\
|
|
|
2684
2703
|
"settings.skills-revise": skillsRevise,
|
|
2685
2704
|
"settings.skills-import": skillsAct("import"),
|
|
2686
2705
|
"settings.skills-change": skillsAct("change"),
|
|
2706
|
+
"settings.skills-library": skillsLibraryAct,
|
|
2687
2707
|
"spend.budget": spendBudget,
|
|
2688
2708
|
"settings.project-concurrency": projectConcurrency,
|
|
2689
2709
|
"settings.project-live-view": projectLiveView,
|
|
@@ -3456,6 +3476,136 @@ ${postForm("/settings/chat-approval/save", html `\
|
|
|
3456
3476
|
sendScreen(response, 200, screen(title, settingsSubPage("projects", title, body), { chrome: chromeFor(project, "projects") }));
|
|
3457
3477
|
return null;
|
|
3458
3478
|
}
|
|
3479
|
+
async function skillsLibraryAct(ctx) {
|
|
3480
|
+
const { response, posted } = ctx;
|
|
3481
|
+
const who = browserCaller(ctx.who);
|
|
3482
|
+
const body = readForm(posted, CONSOLE_FORMS.skillsLibrary);
|
|
3483
|
+
const repo = body.get("repo") ?? "";
|
|
3484
|
+
const backBase = repo ? `/settings/skills?repo=${encodeURIComponent(repo)}` : "/settings/skills";
|
|
3485
|
+
const backWith = (key, msg) => redirect(response, `${backBase}${backBase.includes("?") ? "&" : "?"}${key}=${encodeURIComponent(msg)}`);
|
|
3486
|
+
if (repo && (!visible(repo) || !consoleProjects().includes(repo))) {
|
|
3487
|
+
return refuse(response, who, 403, "That project is outside your access.", "/projects");
|
|
3488
|
+
}
|
|
3489
|
+
const action = body.get("action") ?? "";
|
|
3490
|
+
const now = clock();
|
|
3491
|
+
try {
|
|
3492
|
+
let said = "Saved.";
|
|
3493
|
+
if (action === "import-bundle") {
|
|
3494
|
+
const res = await importGithubSkillBundle(store, {
|
|
3495
|
+
url: body.get("url") ?? "",
|
|
3496
|
+
actor: who.name,
|
|
3497
|
+
autoUpdate: body.get("autoUpdate") === "1",
|
|
3498
|
+
}, now);
|
|
3499
|
+
said = `Imported ${res.importedCount} skill${res.importedCount === 1 ? "" : "s"} from ${res.bundle.owner}/${res.bundle.repoName} (${res.bundle.pinnedCommit.slice(0, 12)}).`;
|
|
3500
|
+
}
|
|
3501
|
+
else if (action === "import-skill") {
|
|
3502
|
+
const method = body.get("method") ?? "paste";
|
|
3503
|
+
let files, source;
|
|
3504
|
+
if (method === "paste") {
|
|
3505
|
+
files = [{ path: "SKILL.md", base64: Buffer.from(body.get("content") ?? "").toString("base64") }];
|
|
3506
|
+
source = "Global library (pasted SKILL.md)";
|
|
3507
|
+
}
|
|
3508
|
+
else if (method === "folder") {
|
|
3509
|
+
files = JSON.parse(body.get("files") ?? "[]");
|
|
3510
|
+
source = "Global library (uploaded folder)";
|
|
3511
|
+
}
|
|
3512
|
+
else if (method === "github") {
|
|
3513
|
+
const imported = await githubSkill(body.get("url") ?? "");
|
|
3514
|
+
files = imported.files;
|
|
3515
|
+
source = imported.source;
|
|
3516
|
+
}
|
|
3517
|
+
else {
|
|
3518
|
+
throw Error("Choose how to add the skill.");
|
|
3519
|
+
}
|
|
3520
|
+
const saved = importLibrarySkill(store, { actor: who.name, files, source, enable: true }, now);
|
|
3521
|
+
said = `Added ${saved.skill.name} to the global skill library.`;
|
|
3522
|
+
}
|
|
3523
|
+
else if (action === "enable-skill" || action === "disable-skill") {
|
|
3524
|
+
const revRaw = body.get("revision");
|
|
3525
|
+
const revision = revRaw !== null && revRaw !== "" ? Number(revRaw) : currentLibrary(store).revision;
|
|
3526
|
+
changeLibrarySkill(store, {
|
|
3527
|
+
actor: who.name,
|
|
3528
|
+
revision,
|
|
3529
|
+
action: action === "enable-skill" ? "enable" : "disable",
|
|
3530
|
+
sha: body.get("sha") ?? "",
|
|
3531
|
+
}, now);
|
|
3532
|
+
said = action === "enable-skill" ? "Skill enabled across all projects." : "Skill disabled globally.";
|
|
3533
|
+
}
|
|
3534
|
+
else if (action === "project-opt-out") {
|
|
3535
|
+
if (!repo)
|
|
3536
|
+
throw Error("Choose a project first.");
|
|
3537
|
+
const skillName = body.get("skill") ?? "*";
|
|
3538
|
+
const optOut = body.get("optedOut") === "1";
|
|
3539
|
+
setProjectSkillOptOut(store, { repo, skillName, optOut, actor: who.name }, now);
|
|
3540
|
+
said = skillName === "*"
|
|
3541
|
+
? (optOut ? "This project opted out of the global skill library." : "Global skill library re-enabled for this project.")
|
|
3542
|
+
: (optOut ? `Opted this project out of ${skillName}.` : `Included ${skillName} in this project.`);
|
|
3543
|
+
}
|
|
3544
|
+
else if (action === "sweep-bundle") {
|
|
3545
|
+
const bundleId = body.get("bundle") ?? "";
|
|
3546
|
+
const results = await sweepSkillBundleUpdates(store, { actor: who.name, ...(bundleId ? { onlyBundleId: bundleId } : {}), force: true, now });
|
|
3547
|
+
const hit = results[0];
|
|
3548
|
+
if (!hit)
|
|
3549
|
+
said = "No matching bundle found.";
|
|
3550
|
+
else if (hit.status === "updated") {
|
|
3551
|
+
said = `Updated bundle to ${hit.commit?.slice(0, 12) ?? "latest"}.`;
|
|
3552
|
+
}
|
|
3553
|
+
else if (hit.status === "held") {
|
|
3554
|
+
said = `Held update (${hit.commit?.slice(0, 12) ?? "latest"}) for review: ${(hit.reasons ?? []).join(" ")}`;
|
|
3555
|
+
}
|
|
3556
|
+
else if (hit.status === "up-to-date" || hit.status === "skipped-recent") {
|
|
3557
|
+
said = "Bundle is already up to date.";
|
|
3558
|
+
}
|
|
3559
|
+
else {
|
|
3560
|
+
throw Error(hit.error ?? "Bundle update check failed.");
|
|
3561
|
+
}
|
|
3562
|
+
}
|
|
3563
|
+
else if (action === "apply-held") {
|
|
3564
|
+
const bundleId = body.get("bundle") ?? "";
|
|
3565
|
+
const results = await sweepSkillBundleUpdates(store, { actor: who.name, onlyBundleId: bundleId, allowSuspiciousForId: bundleId, force: true, now });
|
|
3566
|
+
const hit = results[0];
|
|
3567
|
+
if (hit?.status === "error")
|
|
3568
|
+
throw Error(hit.error ?? "Could not apply held update.");
|
|
3569
|
+
said = hit?.status === "updated" ? `Applied held update (${hit.commit?.slice(0, 12) ?? ""}).` : "No held update to apply.";
|
|
3570
|
+
}
|
|
3571
|
+
else if (action === "dismiss-held") {
|
|
3572
|
+
dismissHeldBundleUpdate(store, body.get("bundle") ?? "");
|
|
3573
|
+
said = "Dismissed held update.";
|
|
3574
|
+
}
|
|
3575
|
+
else if (action === "bundle-auto-update") {
|
|
3576
|
+
const autoUpdate = body.get("autoUpdate") === "1";
|
|
3577
|
+
setBundleAutoUpdate(store, body.get("bundle") ?? "", autoUpdate);
|
|
3578
|
+
said = autoUpdate ? "Daily automatic updates enabled." : "Daily automatic updates paused.";
|
|
3579
|
+
}
|
|
3580
|
+
else if (action === "rollback-bundle") {
|
|
3581
|
+
const rolled = rollbackSkillBundle(store, { id: body.get("bundle") ?? "", actor: who.name }, now);
|
|
3582
|
+
said = `Rolled back ${rolled.bundle.owner}/${rolled.bundle.repoName} to ${rolled.bundle.pinnedCommit.slice(0, 12)}.`;
|
|
3583
|
+
}
|
|
3584
|
+
else if (action === "local-sync") {
|
|
3585
|
+
const tool = body.get("tool") ?? "";
|
|
3586
|
+
if (!LOCAL_SKILL_TOOLS.includes(tool))
|
|
3587
|
+
throw Error("Unknown local tool.");
|
|
3588
|
+
const enabled = body.get("enabled") === "1";
|
|
3589
|
+
const lib = enabledLibrarySkills(store);
|
|
3590
|
+
const res = setLocalSkillSync(store, { tool: tool, enabled, actor: who.name, skills: lib.packages, libraryRevision: lib.revision }, now);
|
|
3591
|
+
said = enabled && res
|
|
3592
|
+
? `Synced ${res.written.length} skill${res.written.length === 1 ? "" : "s"} to ${tool}${res.skippedForeign.length ? ` (left ${res.skippedForeign.length} of your own skills untouched)` : ""}.`
|
|
3593
|
+
: `Turned off local sync for ${tool} and removed Toolroll-managed skills.`;
|
|
3594
|
+
}
|
|
3595
|
+
else if (action === "local-sync-now") {
|
|
3596
|
+
const lib = enabledLibrarySkills(store);
|
|
3597
|
+
const synced = syncEnabledLocalTools(store, { actor: who.name, skills: lib.packages, libraryRevision: lib.revision }, now);
|
|
3598
|
+
said = synced.length ? "Local tool skill folders synced." : "No local tools have sync enabled.";
|
|
3599
|
+
}
|
|
3600
|
+
else {
|
|
3601
|
+
throw Error("Choose a supported skill library action.");
|
|
3602
|
+
}
|
|
3603
|
+
return backWith("said", said);
|
|
3604
|
+
}
|
|
3605
|
+
catch (error) {
|
|
3606
|
+
return backWith("problem", error instanceof Error ? error.message : "Could not update the skill library.");
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3459
3609
|
return { registrations, modelsView };
|
|
3460
3610
|
}
|
|
3461
3611
|
function savedLoginOf(store) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { localOwnerRefusal } from "../local-owner.js";
|
|
2
|
-
import { landedWords, landingOf, publishesThroughPullRequests } from "../local-landing.js";
|
|
2
|
+
import { broughtInOnBranch, landedWords, landingOf, publishesThroughPullRequests, recognisedOnBranch } from "../local-landing.js";
|
|
3
3
|
import { requestContext } from "./request-context.js";
|
|
4
4
|
import { heldFindingCount } from "../findings.js";
|
|
5
5
|
import { familyInWebReach } from "../findings.js";
|
|
@@ -14,6 +14,7 @@ import { agentSaidOf, releaseProgressFor, shipChecksForTask } from "../store.js"
|
|
|
14
14
|
import { releaseCiRunningOf } from "../release-ci-hold.js";
|
|
15
15
|
import { releaseObligationsOf } from "../release-recheck.js";
|
|
16
16
|
import { approvalProofOf, freshnessFor, withFreshness } from "../scope.js";
|
|
17
|
+
import { sessionYesPossible } from "./send-back-build.js";
|
|
17
18
|
import { approvalPasswordField } from "../approval-password.js";
|
|
18
19
|
import { fastChangeProblem, fastStarted } from "../fast-start.js";
|
|
19
20
|
import { routeChangeOf } from "../route-change.js";
|
|
@@ -612,10 +613,14 @@ export function createTaskViews(runtime) {
|
|
|
612
613
|
return null;
|
|
613
614
|
const rootId = runtime.familyOf(taskId)?.root.id ?? taskId;
|
|
614
615
|
const record = landingOf(runtime.store, rootId);
|
|
615
|
-
const
|
|
616
|
+
const assignment = assignmentOf(runtime.store, taskId, runtime.clock(), runtime.workAccess(), runtime.evidenceRoot);
|
|
617
|
+
const complete = assignment?.state === "complete";
|
|
616
618
|
if (!complete && record === null)
|
|
617
619
|
return null;
|
|
618
620
|
const person = who.via === "cookie" && who.role === "approver";
|
|
621
|
+
const onBranch = record === null || record.undone ? recognisedOnBranch(runtime.store, repo, rootId, complete ? assignment?.receipt?.head ?? null : null, baseGit) : null;
|
|
622
|
+
if (onBranch !== null)
|
|
623
|
+
return { taskId: rootId, landed: onBranch, canLand: false, canUndo: person && broughtInOnBranch(runtime.store, repo, rootId, baseGit) };
|
|
619
624
|
return { taskId: rootId, landed: landedWords(runtime.store, rootId), canLand: person && complete && (record === null || record.undone), canUndo: person && record !== null && !record.undone };
|
|
620
625
|
}
|
|
621
626
|
function failureOf(runs, assignment, readLog = true) {
|
|
@@ -1052,7 +1057,7 @@ export function createTaskViews(runtime) {
|
|
|
1052
1057
|
terminal,
|
|
1053
1058
|
publication,
|
|
1054
1059
|
pullRequestTo: pullRequestTargetOf(run.id),
|
|
1055
|
-
buildNowOnSendBack: who.via === "cookie" && who.
|
|
1060
|
+
buildNowOnSendBack: who.via === "cookie" && who.role === "approver" && (who.authority === "local-owner" || sessionYesPossible(runtime.store, who.name, true)),
|
|
1056
1061
|
publishing: pullRequestTargetOf(run.id) !== null ? "pull-request" : publishingOf(runtime.store, runtime.store.refById(run.taskRef)?.repo ?? null).on ? "other" : "off",
|
|
1057
1062
|
ciFailing: publication !== null && publication.prNumber !== null && runtime.store.hasOpenCiEpisode(publication.githubRepo, publication.prNumber),
|
|
1058
1063
|
files,
|
package/dist/server/tasks.js
CHANGED
|
@@ -94,8 +94,10 @@ import {} from "./session.js";
|
|
|
94
94
|
import { approveReleaseCard, releaseApprovalCard, releaseSheetHref, releaseTaskOf } from "../release-approval.js";
|
|
95
95
|
import { releaseSheetPage } from "./render-release.js";
|
|
96
96
|
import { approvalFactsNow, btn } from "./kit.js";
|
|
97
|
-
import { land, landingWords, publishesThroughPullRequests, PULL_REQUESTS_INSTEAD, readLanding } from "../local-landing.js";
|
|
98
|
-
import { localOwnerRefusal, withLocalAct } from "../local-owner.js";
|
|
97
|
+
import { handoffWords, land, landingWords, publishesThroughPullRequests, PULL_REQUESTS_INSTEAD, readLanding } from "../local-landing.js";
|
|
98
|
+
import { localActNow, localOwnerRefusal, withLocalAct } from "../local-owner.js";
|
|
99
|
+
import { localChecksRefusal } from "../local-checks.js";
|
|
100
|
+
import { sessionYesPossible } from "./send-back-build.js";
|
|
99
101
|
import { firstTaskRouted } from "../welcome-facts.js";
|
|
100
102
|
import { plural } from "../design/kit.js";
|
|
101
103
|
export const FIRST_TASK_DETECT_WAIT_MS = 8_000;
|
|
@@ -1088,8 +1090,10 @@ export function createTasksHandlers(runtime) {
|
|
|
1088
1090
|
const typedNote = (body.get("note") ?? "").trim();
|
|
1089
1091
|
const sentNote = withContext(body.get("context"), typedNote);
|
|
1090
1092
|
if (body.get("intent") === "revise") {
|
|
1091
|
-
const
|
|
1092
|
-
const
|
|
1093
|
+
const localBuild = who.via === "cookie" && who.authority === "local-owner" && who.role === "approver";
|
|
1094
|
+
const sessionBuild = who.via === "cookie" && who.authority !== "local-owner" && who.role === "approver" && sessionYesPossible(store, who.name, false);
|
|
1095
|
+
const buildNow = body.get("approve") === "1" && (localBuild || sessionBuild);
|
|
1096
|
+
const result = spendingOnlyOnSuccess(() => requestResultChanges(store, evidenceRoot, {
|
|
1093
1097
|
...(buildNow ? {
|
|
1094
1098
|
currentResult: () => {
|
|
1095
1099
|
const task = store.externalIdFor(found.taskRef);
|
|
@@ -1097,16 +1101,16 @@ export function createTasksHandlers(runtime) {
|
|
|
1097
1101
|
return current !== null && current.activeTaskId === task && current.receipt?.runId === id ? null
|
|
1098
1102
|
: "A newer build of this task came in since this page was drawn. Open the current result, then send it back.";
|
|
1099
1103
|
},
|
|
1100
|
-
approveNow: (child) => withLocalAct("approve-plan", () => {
|
|
1104
|
+
approveNow: localBuild ? (child) => withLocalAct("approve-plan", () => {
|
|
1101
1105
|
const filed = store.getScope(child);
|
|
1102
1106
|
return filed !== null && !approvalOf(filed).approved && approveScope(store, child, who.name, now, filed.digest, "").ok;
|
|
1103
|
-
}),
|
|
1107
|
+
}) : (child) => sessionYesNow(store, child, who.name, now),
|
|
1104
1108
|
} : {}),
|
|
1105
1109
|
run: id, batch: body.get("batch"), source: body.get("source"), actor: who.name,
|
|
1106
1110
|
repos: admissionList(), includeUnplaced: visible(null), allowMode: who.via === "cookie",
|
|
1107
1111
|
origin: who.via === "cookie" ? "person" : "machine", typedWords: who.via === "cookie" ? typedNote : null,
|
|
1108
1112
|
note: sentNote, path: body.get("path") ?? "", line: body.get("line") ?? "", request: body.get("request"), image,
|
|
1109
|
-
}, now);
|
|
1113
|
+
}, now), revised => !revised.ok);
|
|
1110
1114
|
if (answersInPlace(incoming))
|
|
1111
1115
|
return result.ok ? answerActInPlace(response, "done", "Sent back. The revision is filed.", 200) : answerActInPlace(response, "refused", result.message, result.status);
|
|
1112
1116
|
if (!result.ok) {
|
|
@@ -1216,7 +1220,17 @@ export function createTasksHandlers(runtime) {
|
|
|
1216
1220
|
if (store.isDemo())
|
|
1217
1221
|
return refuse(response, who, 403, "The demo runs no checks.", back);
|
|
1218
1222
|
const level = body.get("level") === "full" ? "full" : "quick";
|
|
1219
|
-
const asked =
|
|
1223
|
+
const asked = who.authority === "local-owner"
|
|
1224
|
+
? store.transact(() => {
|
|
1225
|
+
if (localActNow(store, "run-checks") === null)
|
|
1226
|
+
return { ok: false, message: "Sign in with your password to do this." };
|
|
1227
|
+
const task = store.externalIdFor(found.taskRef);
|
|
1228
|
+
const problem = task === null ? "No such result." : localChecksRefusal(store, who.name, task);
|
|
1229
|
+
if (problem !== null)
|
|
1230
|
+
return { ok: false, message: problem };
|
|
1231
|
+
return requestFollowUpChecks(store, { runId: id, level, actor: who.name, why: "local-owner" }, now);
|
|
1232
|
+
})
|
|
1233
|
+
: requestFollowUpChecks(store, { runId: id, level, actor: who.name }, now);
|
|
1220
1234
|
if (!asked.ok)
|
|
1221
1235
|
return refuse(response, who, 409, asked.message, back);
|
|
1222
1236
|
return redirect(response, back.startsWith("/t/") && !/[?&]tab=result(?:[&#]|$)/.test(back) ? back : `${back.split("#")[0]}#follow-ups`);
|
|
@@ -2813,15 +2827,24 @@ export function createTasksHandlers(runtime) {
|
|
|
2813
2827
|
const read = await readLanding(store, act.taskId, access, now, options);
|
|
2814
2828
|
if (!read.ok)
|
|
2815
2829
|
return taskScreen(response, who, act.taskId, read.message, 409);
|
|
2816
|
-
if (!("plan" in read))
|
|
2830
|
+
if (!("plan" in read)) {
|
|
2831
|
+
if (answersInPlace(ctx.request))
|
|
2832
|
+
return answerActInPlace(response, "done", `Already on ${read.landed.ref.replace(/^refs\/heads\//, "")} (${read.landed.commit.slice(0, 7)}).`, 200);
|
|
2817
2833
|
return redirect(response, taskHref(act.taskId));
|
|
2834
|
+
}
|
|
2818
2835
|
const plan = read.plan;
|
|
2836
|
+
if (answersInPlace(ctx.request))
|
|
2837
|
+
return respond(response, 200, "application/json; charset=utf-8", JSON.stringify({ outcome: "land-terms", key: plan.key, lines: landingWords(plan) }));
|
|
2819
2838
|
const title = undo ? "Undo landing" : `Land on ${plan.branch}`;
|
|
2820
2839
|
return sendScreen(response, 200, screen(title, html `<h1>${title}</h1>${landingWords(plan).map(line => html `<p>${line}</p>`)}${postForm(`${taskHref(act.taskId)}/land`, html `${btn(undo ? "Undo it" : "Land it", { variant: "primary", type: "submit" })} ${btn("Cancel", { variant: "ghost", href: taskHref(act.taskId) })}`, { hidden: { key: plan.key, ...(into === "" ? {} : { into }), ...(undo ? { undo: "1" } : {}) } })}`, { chrome: chromeFor(ref.repo, "tasks") }));
|
|
2821
2840
|
}
|
|
2822
2841
|
const done = await land(store, act.taskId, { key, ...(into === "" ? {} : { into }), ...(undo ? { undo: true } : {}) }, principal !== null ? { kind: "person", who: principal } : { kind: "local" }, access, now, { root: evidenceRoot });
|
|
2823
2842
|
if (!done.ok)
|
|
2824
2843
|
return taskScreen(response, who, act.taskId, done.message, done.reason === "authority" ? 403 : 409);
|
|
2844
|
+
if (done.handoff !== null) {
|
|
2845
|
+
const words = `Landing commit ${done.commit.slice(0, 7)} is ready. Your project folder has ${done.branch} checked out, so Toolroll didn't touch it. ${handoffWords(done.handoff, done.commit)}`;
|
|
2846
|
+
return answersInPlace(ctx.request) ? answerActInPlace(response, "done", words, 200) : taskScreen(response, who, act.taskId, words, 200);
|
|
2847
|
+
}
|
|
2825
2848
|
if (answersInPlace(ctx.request))
|
|
2826
2849
|
return answerActInPlace(response, "done", `${done.kind === "undo" ? "Undone" : "Landed"} on ${done.branch} (${done.commit.slice(0, 7)}).`, 200);
|
|
2827
2850
|
return redirect(response, taskHref(act.taskId));
|
|
@@ -3086,3 +3109,22 @@ export function localOwnerRoute(store, taskId, body, now) {
|
|
|
3086
3109
|
const done = localOwnerChangeAgents(store, taskId, { phase, provider, model, sawDigest }, when, now);
|
|
3087
3110
|
return done.ok ? { ok: true, words: done.words } : done;
|
|
3088
3111
|
}
|
|
3112
|
+
const NOT_SEALED = Symbol("not sealed");
|
|
3113
|
+
function sessionYesNow(store, child, by, now) {
|
|
3114
|
+
try {
|
|
3115
|
+
return store.savepoint(() => {
|
|
3116
|
+
const filed = store.getScope(child);
|
|
3117
|
+
if (filed === null || approvalOf(filed).approved)
|
|
3118
|
+
throw NOT_SEALED;
|
|
3119
|
+
const yes = spendingOnlyOnSuccess(() => withFreshness("approve-standard", () => approveScope(store, child, by, now, filed.digest, "")), result => !result.ok);
|
|
3120
|
+
if (!yes.ok)
|
|
3121
|
+
throw NOT_SEALED;
|
|
3122
|
+
return true;
|
|
3123
|
+
});
|
|
3124
|
+
}
|
|
3125
|
+
catch (error) {
|
|
3126
|
+
if (error === NOT_SEALED)
|
|
3127
|
+
return false;
|
|
3128
|
+
throw error;
|
|
3129
|
+
}
|
|
3130
|
+
}
|
package/dist/server/terminals.js
CHANGED
|
@@ -14,6 +14,7 @@ import { SHELL_NO_COMMIT, SHELL_NO_RESULT, takeOverRevisionOf, takeOverRunsOf }
|
|
|
14
14
|
import { failedAttemptSentence } from "../needs-you.js";
|
|
15
15
|
import { checkEngineResponse } from "../contracts/engine-api.js";
|
|
16
16
|
import { projectName, rowVisible } from "../project.js";
|
|
17
|
+
import { effectiveSkillsForRepo } from "../project-skills.js";
|
|
17
18
|
import { transportOf } from "../public-access.js";
|
|
18
19
|
import { agentSaidOf } from "../store.js";
|
|
19
20
|
import { agentSetupOf } from "../agent-detect.js";
|
|
@@ -41,7 +42,8 @@ export function terminalHostFor(store, options) {
|
|
|
41
42
|
return { host: null, problem: "This install has no terminal support (the optional @lydell/node-pty package didn't load). Reinstall Toolroll to add it." };
|
|
42
43
|
const ledger = openTerminalLedger(store.raw());
|
|
43
44
|
const buildWritable = () => [dirname(database), ...store.knownRepos()];
|
|
44
|
-
|
|
45
|
+
const skillsForRepo = (repo) => effectiveSkillsForRepo(store, repo);
|
|
46
|
+
return { host: new TerminalHost({ spawn, worktreeRoot: join(dirname(database), "live-worktrees"), buildWritable, skillsForRepo, ...(ledger === null ? {} : { ledger }) }), problem: null };
|
|
45
47
|
}
|
|
46
48
|
export function createTerminalHandlers(runtime, deps) {
|
|
47
49
|
const { store, codingActorAllowed, codingProjectAllowed, liveCeiling } = runtime;
|
|
@@ -360,7 +360,7 @@ export function accessGroup(facts, flags) {
|
|
|
360
360
|
const people = facts.people;
|
|
361
361
|
const links = [
|
|
362
362
|
settingsLink({ href: "/people", title: "People", status: people === null ? "Your own access" : [accessWords({ ...facts, passwordless: null }), people.invites === 0 ? "no open invites" : plural(people.invites, "open invite", "open invites")].join(" · ") }),
|
|
363
|
-
settingsLink({ href: "/settings/sessions", title: "Sessions and tokens", status:
|
|
363
|
+
settingsLink({ href: "/settings/sessions", title: "Sessions and tokens", status: `${plural(facts.access.sessions, "session", "sessions")} signed in · ${plural(facts.access.tokens, "API token", "API tokens")}` }),
|
|
364
364
|
...(facts.operator && (advancedOn(facts) || facts.sso !== null) ? [
|
|
365
365
|
settingsLink({ href: "/settings/sign-in", title: "Sign-in with a provider", status: facts.sso === null ? "Not set up: everyone uses a password" : `People sign in with ${facts.sso}` })
|
|
366
366
|
] : []),
|