toolroll 0.9.107 → 0.9.109
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 +54 -0
- package/README.md +4 -3
- package/dist/advanced-view.js +0 -1
- package/dist/agent-fence.js +35 -4
- package/dist/agent-state.js +5 -2
- package/dist/assignment-ui.js +5 -5
- package/dist/assignment.js +5 -2
- package/dist/browser/terminal.js +1 -1
- package/dist/browser/workspace.css +1 -1
- package/dist/browser/workspace.js +38 -33
- package/dist/browser-crew.js +4 -4
- package/dist/browser-shell.js +1 -1
- package/dist/browser-workspace.js +4 -11
- package/dist/builder.js +9 -1
- package/dist/chat-controls.js +6 -5
- package/dist/chat-decide.js +1 -1
- package/dist/chat-quiet.js +3 -3
- package/dist/chat-voice.js +2 -2
- package/dist/cli-help.js +17 -13
- package/dist/cli.js +4 -3
- package/dist/console-chrome.js +10 -3
- package/dist/contracts/cli.js +2 -0
- package/dist/contracts/console-api.js +5 -4
- package/dist/contracts/handoff.js +4 -0
- package/dist/decision.js +17 -0
- package/dist/demo-chat.js +1 -1
- package/dist/demo.js +6 -0
- package/dist/design/kit.js +4 -3
- package/dist/dispatch.js +3 -8
- package/dist/flexible-available.js +1 -0
- package/dist/flexible-schema.js +32 -0
- package/dist/flexible-thread-schema.js +30 -0
- package/dist/flexible-thread.js +526 -0
- package/dist/flexible-ui.js +44 -0
- package/dist/flexible.js +359 -0
- package/dist/folder-look.js +65 -4
- package/dist/git-views.js +38 -38
- package/dist/guides.js +14 -11
- package/dist/keymap.js +1 -1
- package/dist/lead-cli.js +2 -1
- package/dist/lead-context.js +1 -1
- package/dist/limits-ui.js +1 -1
- package/dist/live-bus.js +82 -12
- package/dist/login-secrets.js +43 -0
- package/dist/needs-you.js +3 -3
- package/dist/nightly-github.js +2 -2
- package/dist/operate.js +278 -21
- package/dist/project-admission.js +60 -29
- package/dist/project-delete-ui.js +2 -1
- package/dist/project-delete.js +1 -0
- package/dist/project.js +73 -0
- package/dist/provider-auth.js +1 -1
- package/dist/release.js +1 -0
- package/dist/repos.js +37 -0
- package/dist/result-actions.js +3 -0
- package/dist/result-evidence-readers.js +8 -2
- package/dist/result-review.js +20 -9
- package/dist/route-hooks.js +1 -0
- package/dist/sample-project.js +167 -9
- package/dist/scope.js +17 -2
- package/dist/serve.js +47 -32
- package/dist/server/chat.js +9 -9
- package/dist/server/chrome.js +16 -16
- package/dist/server/guards.js +10 -4
- package/dist/server/home.js +37 -5
- package/dist/server/http.js +4 -2
- package/dist/server/in-place.js +5 -4
- package/dist/server/kit.js +2 -2
- package/dist/server/live.js +103 -10
- package/dist/server/login-help.js +67 -0
- package/dist/server/pages.js +258 -78
- package/dist/server/people-tokens.js +36 -24
- package/dist/server/render-chat.js +1 -1
- package/dist/server/render-history.js +18 -4
- package/dist/server/render-new-task.js +2 -2
- package/dist/server/render-pages.js +21 -39
- package/dist/server/render-people.js +16 -4
- package/dist/server/render-projects.js +63 -15
- package/dist/server/render-results.js +26 -10
- package/dist/server/render-tasks.js +26 -17
- package/dist/server/retired-routes.js +37 -4
- package/dist/server/route-policy.js +8 -0
- package/dist/server/route-table.js +15 -5
- package/dist/server/settings-computers.js +140 -0
- package/dist/server/settings-scripts.js +15 -0
- package/dist/server/settings-section-table.js +56 -0
- package/dist/server/settings-sections.js +258 -0
- package/dist/server/settings.js +167 -19
- package/dist/server/task-views.js +47 -13
- package/dist/server/tasks.js +143 -90
- package/dist/server/welcome.js +35 -23
- package/dist/settings-groups-ui.js +34 -106
- package/dist/settings-proofs.js +5 -2
- package/dist/sqlite-telemetry.js +70 -21
- package/dist/store.js +141 -9
- package/dist/surface.js +4 -1
- package/dist/task-link.js +64 -0
- package/dist/task-outcome-cli.js +99 -4
- package/dist/tui-source.js +11 -3
- package/dist/tui.js +39 -39
- package/dist/typed-words-schema.js +18 -0
- package/dist/welcome-facts.js +15 -7
- package/dist/work-index.js +126 -29
- package/dist/work-reads.js +279 -0
- package/package.json +4 -2
package/dist/server/tasks.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { advancedShownNow } from "../advanced-view.js";
|
|
2
2
|
import { titleWithin } from "../task-text.js";
|
|
3
3
|
import { parseFeedbackImage, sameFeedbackImage } from "../result-review.js";
|
|
4
|
-
import { archiveTaskFamily, dropFeedbackImage, releaseAuthorityOfTask, restoreTaskFamily, revokeRelease, runCheckStamp, runLiveCommands } from "../store.js";
|
|
4
|
+
import { archiveTaskFamily, dropFeedbackImage, markTypedByPerson, typedNotesFor, releaseAuthorityOfTask, restoreTaskFamily, revokeRelease, runCheckStamp, runLiveCommands } from "../store.js";
|
|
5
5
|
import { ranWords } from "../check-stamp.js";
|
|
6
6
|
import { applyTidy, approverStandsNow, familyRepoOf, releaseFactsOf, tidyDays, tidyDigest, tidyPreview, TIDY_DEFAULT_DAYS } from "../tidy.js";
|
|
7
7
|
import { steerCapabilityOf } from "../steer-capabilities.js";
|
|
@@ -42,7 +42,7 @@ import { closeFinding, familyInWebReach, familyRootOf, getFinding, NOT_ON_TASK,
|
|
|
42
42
|
import { labelProviderCapture, providerCapture } from "../provider-capture.js";
|
|
43
43
|
import { fastStartBuild, keepGrownChange, prepareFastStart } from "../fast-start.js";
|
|
44
44
|
import { evidencePack } from "../evidence-pack.js";
|
|
45
|
-
import { decisionPage, evidenceRecordPage, runPage } from "./render-history.js";
|
|
45
|
+
import { decisionPage, evidenceRecordPage, evidenceRecordSection, runPage } from "./render-history.js";
|
|
46
46
|
import { readVerifiedArtifact, readVerifiedReport, writeEvidenceFile } from "../evidence.js";
|
|
47
47
|
import { computeGaps } from "../gaps.js";
|
|
48
48
|
import { limitsView } from "../limits-ui.js";
|
|
@@ -79,8 +79,9 @@ import { WorkIndexCursorError, workIndexPage } from "../work-index.js";
|
|
|
79
79
|
import { buildProgressOf, parseWorkView } from "../workspace-ui.js";
|
|
80
80
|
import { requestContext } from "./request-context.js";
|
|
81
81
|
import { boardTickScript, oneLineOf, QUEUE_VIEW, refuse, regionScript, screen, transcriptScript, whenTime } from "./chrome.js";
|
|
82
|
-
import { retiredRedirect } from "./retired-routes.js";
|
|
82
|
+
import { retiredHandler, retiredRedirect, TASK_VIEW_REDIRECTS } from "./retired-routes.js";
|
|
83
83
|
import { answersInPlace, chatReturnWithSaid, matchTaskPath, redirect, respond, reviewHref, safeChatReturn, safeReturn, SAFETY, taskChatHref, taskHref } from "./http.js";
|
|
84
|
+
import { taskLinkOf } from "../task-link.js";
|
|
84
85
|
import { putAwayPage, boardBody, boardWorkers, QUEUE_FRONT, queueBody, queueScript, TASK_STATES, workPage } from "./render-pages.js";
|
|
85
86
|
import { runEfficiencyOf } from "../run-efficiency.js";
|
|
86
87
|
import { timingFor } from "../latency-timeline.js";
|
|
@@ -99,7 +100,7 @@ export function createTasksHandlers(runtime) {
|
|
|
99
100
|
const showCode = (part, posted = false) => async (ctx) => {
|
|
100
101
|
const { url, who, response, project } = ctx;
|
|
101
102
|
if (who.via !== 'cookie' || !codingActorAllowed({ name: who.name, generation: who.session.generation }))
|
|
102
|
-
return refuse(response, who, 403, 'Coding sessions require installation-wide operator access. You can manage project tasks in Work.', '/
|
|
103
|
+
return refuse(response, who, 403, 'Coding sessions require installation-wide operator access. You can manage project tasks in Work.', '/');
|
|
103
104
|
const actor = { name: who.name, generation: who.session.generation };
|
|
104
105
|
const sessionId = part === "workspace" || part === "unknown" ? null : /^\/code\/([a-f0-9]{32})/.exec(url.pathname)[1];
|
|
105
106
|
const read = part === "state" || part === "changes" ? part : null;
|
|
@@ -140,7 +141,7 @@ export function createTasksHandlers(runtime) {
|
|
|
140
141
|
if (!codingActorAllowed(actor))
|
|
141
142
|
return read !== null
|
|
142
143
|
? respond(response, 403, 'application/json', JSON.stringify({ ok: false, error: 'Your access changed. Sign in again.' }))
|
|
143
|
-
: refuse(response, who, 403, 'Your access changed. Sign in again.', '/
|
|
144
|
+
: refuse(response, who, 403, 'Your access changed. Sign in again.', '/');
|
|
144
145
|
const message = error instanceof Error ? error.message : 'The coding workspace is unavailable.';
|
|
145
146
|
if (part === 'ship')
|
|
146
147
|
return sendScreen(response, 409, screen('Review for shipping', html `<h1>Prepare this result</h1><p>${message}</p><a href="/code/${sessionId}">Back to coding</a>`, { chrome: chromeFor(project, 'code') }));
|
|
@@ -149,12 +150,14 @@ export function createTasksHandlers(runtime) {
|
|
|
149
150
|
return sendScreen(response, 404, screen('Coding session unavailable', html `<h1>Session unavailable</h1><p>${message}</p><a href="/code">Open coding workspace</a>`, { chrome: chromeFor(project, 'code') }));
|
|
150
151
|
}
|
|
151
152
|
};
|
|
152
|
-
async function
|
|
153
|
+
async function workListOf(ctx) {
|
|
153
154
|
const { url, who, response, now, project } = ctx;
|
|
154
155
|
const view = parseWorkView(url.searchParams.get("view"));
|
|
155
156
|
const wantedState = url.searchParams.get("state");
|
|
156
|
-
if (wantedState !== null && !TASK_STATES.includes(wantedState))
|
|
157
|
-
|
|
157
|
+
if (wantedState !== null && !TASK_STATES.includes(wantedState)) {
|
|
158
|
+
refuse(response, who, 400, "no such state", "/");
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
158
161
|
const state = wantedState;
|
|
159
162
|
const rollup = project === null && !unscopedMode;
|
|
160
163
|
let work;
|
|
@@ -171,30 +174,36 @@ export function createTasksHandlers(runtime) {
|
|
|
171
174
|
}
|
|
172
175
|
}
|
|
173
176
|
catch (error) {
|
|
174
|
-
if (error instanceof WorkIndexCursorError)
|
|
175
|
-
|
|
177
|
+
if (error instanceof WorkIndexCursorError) {
|
|
178
|
+
refuse(response, who, 400, 'This task page has expired. Open the first page.', '/');
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
176
181
|
throw error;
|
|
177
182
|
}
|
|
178
|
-
const enrich = (page) =>
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
const enrich = (page) => {
|
|
184
|
+
let admitted;
|
|
185
|
+
return { ...page, items: page.items.map((item) => {
|
|
186
|
+
if (item.liveRunId !== null) {
|
|
187
|
+
const ref = store.lookupRef(item.activeTaskId);
|
|
188
|
+
const recorded = ref === null ? null : store.latestCheckpointForRun(item.liveRunId);
|
|
189
|
+
if (ref === null || recorded === null || recorded.taskRef !== ref.id)
|
|
190
|
+
return item;
|
|
191
|
+
const plan = store.currentPlanRevision(ref.id);
|
|
192
|
+
const parsed = plan === null ? null : (() => { const doc = revisionDocOf(plan); return doc === null ? null : parseExecutionPlanDocument(doc.document); })();
|
|
193
|
+
const words = new Map(parsed?.ok === true ? milestonesOf(parsed.document).map(one => [one.id, one.description]) : []);
|
|
194
|
+
const steps = buildProgressOf(recorded.snapshot.milestones.map(one => ({ description: words.get(one.id) ?? null, state: one.state, note: one.note ?? null })));
|
|
195
|
+
return steps === null ? item : { ...item, progress: steps.line };
|
|
196
|
+
}
|
|
197
|
+
if (item.state !== "failed")
|
|
198
|
+
return item;
|
|
199
|
+
admitted ??= { repos: admissionList(), unplaced: visible(null) };
|
|
200
|
+
const family = store.taskFamilyOf(item.activeTaskId, admitted.repos, admitted.unplaced);
|
|
201
|
+
if (family === null || family.problem !== null)
|
|
183
202
|
return item;
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return steps === null ? item : { ...item, progress: steps.line };
|
|
189
|
-
}
|
|
190
|
-
if (item.state !== "failed")
|
|
191
|
-
return item;
|
|
192
|
-
const family = familyOf(item.activeTaskId);
|
|
193
|
-
if (family === null || family.problem !== null)
|
|
194
|
-
return item;
|
|
195
|
-
const failure = failureOf(family.versions.flatMap(version => store.runsFor(version.refId)), null, false);
|
|
196
|
-
return failure.kind === "reason" ? item : { ...item, status: { ...item.status, detail: failure.line } };
|
|
197
|
-
}) });
|
|
203
|
+
const failure = failureOf(family.versions.flatMap(version => store.runsFor(version.refId)), null, false);
|
|
204
|
+
return failure.kind === "reason" ? item : { ...item, status: { ...item.status, detail: failure.line } };
|
|
205
|
+
}) };
|
|
206
|
+
};
|
|
198
207
|
work = enrich(work);
|
|
199
208
|
const board = url.searchParams.get("layout") !== "board" ? null : (() => {
|
|
200
209
|
const column = (view) => enrich(workIndexPage(store, now, workAccess(), { view, limit: BOARD_COLUMN_LIMIT, project, root: evidenceRoot, ...(state === null ? {} : { state }) }));
|
|
@@ -216,12 +225,7 @@ export function createTasksHandlers(runtime) {
|
|
|
216
225
|
? limitsView(store.providerLimits(), store.budgets().length === 0 ? [] : store.monthSpendCached(now).budgets, { project: projectName, subagent: id => subagentNamesOf(store.handle).get(id) ?? `Subagent ${id}` }, now)
|
|
217
226
|
: null,
|
|
218
227
|
});
|
|
219
|
-
|
|
220
|
-
const docked = projectThread === null ? null : dockedConversation(who, null, projectThread, now, `/tasks?project=${encodeURIComponent(projectThread)}`);
|
|
221
|
-
if (docked !== null)
|
|
222
|
-
page.workspace = { ...page.workspace, conversation: docked, pageHtml: page.body };
|
|
223
|
-
page.refreshSeconds = work.totals.running > 0 ? 10 : 30;
|
|
224
|
-
return sendScreen(response, 200, page);
|
|
228
|
+
return { screen: page, work, filtered: state !== null || url.searchParams.has('cursor') };
|
|
225
229
|
}
|
|
226
230
|
function reviewRowOf(row, now) {
|
|
227
231
|
const assignment = assignmentOf(store, row.taskId, now, workAccess(), evidenceRoot);
|
|
@@ -288,10 +292,13 @@ export function createTasksHandlers(runtime) {
|
|
|
288
292
|
const chosen = picked?.chosen ?? null, attemptRow = picked?.attemptRow ?? null, beyond = picked?.beyond ?? null;
|
|
289
293
|
const selectedRow = wantedId === null ? ranked[0] ?? null : chosen;
|
|
290
294
|
if (expectedRun !== null && wantedId !== null && chosen === null)
|
|
291
|
-
return refuse(response, who, 404, "No such result in your projects.", "/
|
|
295
|
+
return refuse(response, who, 404, "No such result in your projects.", "/");
|
|
292
296
|
if (expectedRun !== null && (!/^[1-9]\d*$/.test(expectedRun) || selectedRow?.runId !== Number(expectedRun))) {
|
|
293
|
-
return sendScreen(response, 409, screen("Result changed", html `<h1>Result changed</h1><p>This acceptance link no longer matches the current result. Review the current task before accepting.</p><p class="refusal-back"><a class="button-link" href="
|
|
297
|
+
return sendScreen(response, 409, screen("Result changed", html `<h1>Result changed</h1><p>This acceptance link no longer matches the current result. Review the current task before accepting.</p><p class="refusal-back"><a class="button-link" href="/?view=ready">Review results</a></p>`, { chrome: chromeFor(project, "runs") }));
|
|
294
298
|
}
|
|
299
|
+
const resultHome = wantedId !== null && chosen !== null ? TASK_VIEW_REDIRECTS.review(url) : null;
|
|
300
|
+
if (resultHome !== null)
|
|
301
|
+
return redirect(response, resultHome);
|
|
295
302
|
const selected = picked !== null ? picked.selected : selectedRow === null ? null : reviewCockpitViewOf(selectedRow, who, now);
|
|
296
303
|
const reviewPage = reviewCockpitPage(chromeFor(wantedId === null ? project : chosenProject, "runs"), {
|
|
297
304
|
queue: ranked,
|
|
@@ -314,14 +321,9 @@ export function createTasksHandlers(runtime) {
|
|
|
314
321
|
reviewPage.workspace = { ...reviewPage.workspace, conversation: reviewDocked, pageHtml: reviewPage.body };
|
|
315
322
|
return sendScreen(response, 200, reviewPage);
|
|
316
323
|
}
|
|
317
|
-
async function
|
|
324
|
+
async function workListFor(ctx) {
|
|
318
325
|
const { url } = ctx;
|
|
319
|
-
const template = url.searchParams.get("template");
|
|
320
|
-
if (template !== null)
|
|
321
|
-
return redirect(ctx.response, `/tasks/new?template=${encodeURIComponent(template)}`);
|
|
322
326
|
const view = url.searchParams.get("view");
|
|
323
|
-
if (view === "order")
|
|
324
|
-
return showOrder(ctx);
|
|
325
327
|
const read = new URL(url.href);
|
|
326
328
|
if (view === "board") {
|
|
327
329
|
read.searchParams.delete("view");
|
|
@@ -333,7 +335,7 @@ export function createTasksHandlers(runtime) {
|
|
|
333
335
|
read.searchParams.delete("scope");
|
|
334
336
|
read.searchParams.set("all", "1");
|
|
335
337
|
}
|
|
336
|
-
return
|
|
338
|
+
return workListOf({ ...ctx, url: read });
|
|
337
339
|
}
|
|
338
340
|
async function showOrder(ctx) {
|
|
339
341
|
const { url, who, response, project } = ctx;
|
|
@@ -344,7 +346,7 @@ export function createTasksHandlers(runtime) {
|
|
|
344
346
|
const region = queueRegionFor(project, csrf, revision, clock());
|
|
345
347
|
return sendScreen(response, 200, screen("order", joinHtml([
|
|
346
348
|
html `<h1>Order the queue</h1>`,
|
|
347
|
-
html `<p class="meta board-view"><a href="
|
|
349
|
+
html `<p class="meta board-view"><a href="/?view=board">Board</a> · <strong>order</strong> <span class="meta">— drag to reorder, or onto a builder to keep it for that builder</span></p>`,
|
|
348
350
|
html `<div id="queue-region">${region}</div>`,
|
|
349
351
|
html `<p class="meta" id="queue-region-stamp"></p>`,
|
|
350
352
|
], "\n"), { chrome: chromeFor(project, "work"), functional: { script: queueScript(), fetches: true } }));
|
|
@@ -355,7 +357,7 @@ export function createTasksHandlers(runtime) {
|
|
|
355
357
|
const ref = Number.isSafeInteger(number) ? store.refForId(number) : null;
|
|
356
358
|
const task = ref === null || ref.backend !== "built-in" ? null : ref.externalId;
|
|
357
359
|
if (task === null || ref === null || ref.repo === null || !visible(ref.repo) || !store.accountCanAccess(who.name, ref.repo)) {
|
|
358
|
-
return refuse(response, who, 404, "There's no page at this address.", "/
|
|
360
|
+
return refuse(response, who, 404, "There's no page at this address.", "/");
|
|
359
361
|
}
|
|
360
362
|
return redirectGet(response, taskHref(task));
|
|
361
363
|
}
|
|
@@ -374,7 +376,7 @@ export function createTasksHandlers(runtime) {
|
|
|
374
376
|
return noPage(who, response);
|
|
375
377
|
const family = familyOf(task.taskId);
|
|
376
378
|
if (family === null)
|
|
377
|
-
return refuse(response, who, 404, "no such task", "/
|
|
379
|
+
return refuse(response, who, 404, "no such task", "/");
|
|
378
380
|
const version = url.searchParams.get("version");
|
|
379
381
|
if (version !== null && !family.versions.some(one => one.id === version))
|
|
380
382
|
return refuse(response, who, 404, "That version is not available for this task.", taskHref(family.root.id));
|
|
@@ -391,21 +393,37 @@ export function createTasksHandlers(runtime) {
|
|
|
391
393
|
return refuse(response, who, 404, "No such result for this task.", taskHref(family.root.id));
|
|
392
394
|
const owner = named === null || version !== null ? null : (() => { const ref = store.getRun(named)?.taskRef; const id = ref === undefined ? null : store.externalIdFor(ref); return id !== null && family.versions.some(one => one.id === id) ? id : null; })();
|
|
393
395
|
const shown = version ?? owner ?? family.current.id;
|
|
394
|
-
const
|
|
395
|
-
|
|
396
|
+
const readProject = (() => { const repo = store.lookupRef(shown)?.repo ?? null; return repo !== null && visible(repo) ? repo : ctx.project; })();
|
|
397
|
+
const picked = selectResultFor(shown, named, readProject, who, ctx.now);
|
|
398
|
+
if (named !== null && picked.chosen?.runId !== named) {
|
|
399
|
+
const ran = store.getRun(named);
|
|
400
|
+
const ours = ran !== null && runVisible(ran) && family.versions.some(one => one.refId === ran.taskRef) && runIsTaskResult(ran);
|
|
401
|
+
if (ours)
|
|
402
|
+
return sendScreen(response, 409, screen("Result changed", html `<h1>Result changed</h1><p>This link no longer matches the current result. Review the current result before accepting.</p><p class="refusal-back"><a class="button-link" href="${taskLinkOf({ task: family.root.id, result: true })}">Open the current result</a></p>`, { chrome: chromeFor(family.root.repo, "tasks") }));
|
|
396
403
|
return refuse(response, who, 404, "No such result for this task.", taskHref(family.root.id));
|
|
404
|
+
}
|
|
397
405
|
const base = `${taskHref(family.root.id)}?${shown !== family.current.id ? `version=${encodeURIComponent(shown)}&` : ""}tab=result`;
|
|
398
406
|
const csrf = who.via === "cookie" ? who.session.csrf : "";
|
|
399
407
|
const result = picked.selected === null ? null : (() => {
|
|
400
|
-
const
|
|
401
|
-
const
|
|
402
|
-
|
|
408
|
+
const latest = named === null ? picked.chosen?.runId ?? null : selectResultFor(shown, null, readProject, who, ctx.now).chosen?.runId ?? null;
|
|
409
|
+
const current = shown === family.current.id && (picked.chosen?.runId ?? null) === latest;
|
|
410
|
+
const parts = reviewCockpitDetailParts(picked.selected, csrf, url.searchParams.get("noted") !== null, who.via === "cookie" && who.role === "approver", parseResultTab(url.searchParams.get("section")), who.name, { kind: "task", base, alone: !current });
|
|
411
|
+
const refusedCode = url.searchParams.get("refused") ?? "";
|
|
412
|
+
const refusal = Object.hasOwn(RESULT_REFUSALS, refusedCode) ? RESULT_REFUSALS[refusedCode] : null;
|
|
413
|
+
return { html: refusal === null ? parts.html : html `<p class="problem" data-result-refusal>${refusal}</p>${parts.html}`,
|
|
414
|
+
selected: refusal === null ? parts.selected : { ...parts.selected, problem: refusal },
|
|
415
|
+
current };
|
|
403
416
|
})();
|
|
417
|
+
const record = url.searchParams.get("tab") === "record" ? (() => {
|
|
418
|
+
const access = workAccess();
|
|
419
|
+
const pack = evidencePack(store, family.root.id, access, who.name, ctx.now, evidenceRoot);
|
|
420
|
+
return pack === null ? null : evidenceRecordSection(pack);
|
|
421
|
+
})() : null;
|
|
404
422
|
const admissible = new Set(family.versions.flatMap(one => {
|
|
405
423
|
const ref = store.lookupRef(one.id);
|
|
406
|
-
return ref === null ? [] : store.runsFor(ref.id).filter(run => resultRunAdmissible(one.id, run,
|
|
424
|
+
return ref === null ? [] : store.runsFor(ref.id).filter(run => resultRunAdmissible(one.id, run, readProject)).map(run => run.id);
|
|
407
425
|
}));
|
|
408
|
-
return taskScreen(response, who, shown, null, 200, undefined, undefined, url.searchParams.get("edit") === "plan", { tab, result, admissible });
|
|
426
|
+
return taskScreen(response, who, shown, null, 200, undefined, undefined, url.searchParams.get("edit") === "plan", { tab, result, admissible, record });
|
|
409
427
|
}
|
|
410
428
|
async function showTaskEvidence(ctx) {
|
|
411
429
|
const { url, who, response, now } = ctx;
|
|
@@ -415,12 +433,15 @@ export function createTasksHandlers(runtime) {
|
|
|
415
433
|
const access = workAccess();
|
|
416
434
|
const family = store.taskFamilyOf(evidence.taskId, access.repos, access.includeUnplaced);
|
|
417
435
|
if (family === null || !visible(family.root.repo))
|
|
418
|
-
return refuse(response, who, 404, "no such task", "/
|
|
436
|
+
return refuse(response, who, 404, "no such task", "/");
|
|
419
437
|
if (evidence.taskId !== family.root.id)
|
|
420
438
|
return redirect(response, `${taskHref(family.root.id)}/evidence${url.search}`);
|
|
439
|
+
const recordHome = TASK_VIEW_REDIRECTS["task.evidence"](url, family.root.id);
|
|
440
|
+
if (recordHome !== null)
|
|
441
|
+
return redirectGet(response, recordHome);
|
|
421
442
|
const pack = evidencePack(store, family.root.id, access, who.name, now, evidenceRoot);
|
|
422
443
|
if (pack === null)
|
|
423
|
-
return refuse(response, who, 404, "no such task", "/
|
|
444
|
+
return refuse(response, who, 404, "no such task", "/");
|
|
424
445
|
if (url.searchParams.get("format") === "json") {
|
|
425
446
|
response.writeHead(200, { "content-type": "application/json; charset=utf-8", "content-disposition": `attachment; filename="evidence-${family.root.id.replace(/[^A-Za-z0-9._-]/g, "_")}.json"`,
|
|
426
447
|
"cache-control": "no-store", "x-content-type-options": "nosniff" });
|
|
@@ -504,14 +525,13 @@ export function createTasksHandlers(runtime) {
|
|
|
504
525
|
const lines = liveWindowLines(window, runLiveCommands(store, found.id), keys);
|
|
505
526
|
return respond(response, 200, "application/json", JSON.stringify({ text: lines.length === 0 ? "" : `${lines.join("\n")}\n`, nextOffset: window.nextOffset, gen: window.gen, inKey: keys.inKey, keyTail: keys.tail ?? "", final }));
|
|
506
527
|
}
|
|
507
|
-
|
|
528
|
+
const resultHome = TASK_VIEW_REDIRECTS["run.page"](url, taskId, found.id);
|
|
529
|
+
if (resultHome !== null && !running && found.role === "builder" && (found.outcome === "built" || found.outcome === "no-change") &&
|
|
508
530
|
completedRowFor(taskId, null)?.runId === found.id) {
|
|
509
|
-
|
|
510
|
-
return redirect(response, `${reviewHref(taskId, found.id)}${tab === "summary" ? "" : `&tab=${tab}`}`);
|
|
531
|
+
return redirect(response, resultHome);
|
|
511
532
|
}
|
|
512
|
-
if (
|
|
513
|
-
|
|
514
|
-
return redirect(response, `${reviewHref(taskId, found.id)}${tab === "summary" ? "" : `&tab=${tab}`}`);
|
|
533
|
+
if (resultHome !== null && !running && (found.role === "builder" || found.role === "scout") && attemptRowFor(taskId, found.id, null) !== null) {
|
|
534
|
+
return redirect(response, resultHome);
|
|
515
535
|
}
|
|
516
536
|
const artifacts = store.artifactsFor(found.id);
|
|
517
537
|
return sendScreen(response, 200, runPage(chromeFor(project, "runs", runListPane(project, found.id)), found, taskId, artifacts, terminalDiffView(artifacts, evidenceRoot), store.notesForRun(found.id), who.via === "cookie" ? who.session.csrf : "", store.liveDiffComments(found.id).filter(isRevisionFeedback), (() => {
|
|
@@ -931,7 +951,7 @@ export function createTasksHandlers(runtime) {
|
|
|
931
951
|
const back = taskHref(act.taskId);
|
|
932
952
|
const ref = store.lookupRef(act.taskId);
|
|
933
953
|
if (ref === null || !visible(ref.repo))
|
|
934
|
-
return refuse(response, who, 404, "no such task", "/
|
|
954
|
+
return refuse(response, who, 404, "no such task", "/");
|
|
935
955
|
const named = (body.get("run") ?? "").trim();
|
|
936
956
|
const run = /^[0-9]{1,15}$/.test(named) ? store.getRun(Number(named)) : null;
|
|
937
957
|
const runTask = run === null ? null : store.externalIdFor(run.taskRef);
|
|
@@ -964,7 +984,7 @@ export function createTasksHandlers(runtime) {
|
|
|
964
984
|
return taskScreen(response, who, act.taskId, "The demo merges nothing.", 403);
|
|
965
985
|
const ref = store.lookupRef(act.taskId);
|
|
966
986
|
if (ref === null || !visible(ref.repo))
|
|
967
|
-
return refuse(response, who, 404, "no such task", "/
|
|
987
|
+
return refuse(response, who, 404, "no such task", "/");
|
|
968
988
|
const named = (body.get("run") ?? "").trim();
|
|
969
989
|
const run = /^[0-9]{1,15}$/.test(named) ? store.getRun(Number(named)) : null;
|
|
970
990
|
const runTask = run === null ? null : store.externalIdFor(run.taskRef);
|
|
@@ -1021,7 +1041,7 @@ export function createTasksHandlers(runtime) {
|
|
|
1021
1041
|
return redirect(response, `/r/${id}`);
|
|
1022
1042
|
}
|
|
1023
1043
|
async function runComment(ctx) {
|
|
1024
|
-
const { url, who, response, now, posted } = ctx;
|
|
1044
|
+
const { url, who, response, now, posted, request: incoming } = ctx;
|
|
1025
1045
|
const diffComment = /^\/r\/([0-9]{1,15})\/comment$/.exec(url.pathname);
|
|
1026
1046
|
if (diffComment === null)
|
|
1027
1047
|
return noPage(who, response);
|
|
@@ -1053,13 +1073,17 @@ export function createTasksHandlers(runtime) {
|
|
|
1053
1073
|
const image = parseFeedbackImage(body.get("image"));
|
|
1054
1074
|
if (image === false)
|
|
1055
1075
|
return refuse(response, who, 400, "Choose a screenshot from this result again. Your draft is unchanged.", back);
|
|
1076
|
+
const typedNote = (body.get("note") ?? "").trim();
|
|
1077
|
+
const sentNote = withContext(body.get("context"), typedNote);
|
|
1056
1078
|
if (body.get("intent") === "revise") {
|
|
1057
1079
|
const result = requestResultChanges(store, evidenceRoot, {
|
|
1058
1080
|
run: id, batch: body.get("batch"), source: body.get("source"), actor: who.name,
|
|
1059
1081
|
repos: admissionList(), includeUnplaced: visible(null), allowMode: who.via === "cookie",
|
|
1060
|
-
origin: who.via === "cookie" ? "person" : "machine",
|
|
1061
|
-
note:
|
|
1082
|
+
origin: who.via === "cookie" ? "person" : "machine", typedWords: who.via === "cookie" ? typedNote : null,
|
|
1083
|
+
note: sentNote, path: body.get("path") ?? "", line: body.get("line") ?? "", request: body.get("request"), image,
|
|
1062
1084
|
}, now);
|
|
1085
|
+
if (answersInPlace(incoming))
|
|
1086
|
+
return result.ok ? answerActInPlace(response, "done", "Sent back. The revision is filed.", 200) : answerActInPlace(response, "refused", result.message, result.status);
|
|
1063
1087
|
if (!result.ok) {
|
|
1064
1088
|
const request = body.get("request") ?? "";
|
|
1065
1089
|
const retryBase = image === null ? back : `/r/${id}?record=1`;
|
|
@@ -1076,7 +1100,7 @@ export function createTasksHandlers(runtime) {
|
|
|
1076
1100
|
if (!proven.ok) {
|
|
1077
1101
|
return refuse(response, who, 409, `the terminal diff no longer verifies (${proven.problem}) — nothing to comment on`, back);
|
|
1078
1102
|
}
|
|
1079
|
-
const note = validateNote(
|
|
1103
|
+
const note = validateNote(sentNote);
|
|
1080
1104
|
if (!note.ok)
|
|
1081
1105
|
return refuse(response, who, 400, note.problem, back);
|
|
1082
1106
|
const rawPath = (body.get("path") ?? "").trim();
|
|
@@ -1095,7 +1119,10 @@ export function createTasksHandlers(runtime) {
|
|
|
1095
1119
|
const imageProblem = feedbackImageProblem(store, evidenceRoot, id, image);
|
|
1096
1120
|
if (imageProblem !== null)
|
|
1097
1121
|
return { problem: imageProblem };
|
|
1098
|
-
|
|
1122
|
+
const inserted = store.addDiffComment({ artifactId: terminal.id, runId: id, path, line, note: note.note, author: who.name, image, ...(sourceKey === undefined ? {} : { sourceKey }) }, now);
|
|
1123
|
+
if (inserted !== null && who.via === "cookie")
|
|
1124
|
+
markTypedByPerson(store, { comment: inserted }, who.name, typedNote, now);
|
|
1125
|
+
return { inserted };
|
|
1099
1126
|
});
|
|
1100
1127
|
if ("problem" in saved)
|
|
1101
1128
|
return refuse(response, who, 409, saved.problem, `/r/${id}?record=1#request-changes`);
|
|
@@ -1167,7 +1194,7 @@ export function createTasksHandlers(runtime) {
|
|
|
1167
1194
|
const asked = requestFollowUpChecks(store, { runId: id, level, actor: who.name }, now);
|
|
1168
1195
|
if (!asked.ok)
|
|
1169
1196
|
return refuse(response, who, 409, asked.message, back);
|
|
1170
|
-
return redirect(response, back.startsWith("/t/") ? back : `${back.split("#")[0]}#follow-ups`);
|
|
1197
|
+
return redirect(response, back.startsWith("/t/") && !/[?&]tab=result(?:[&#]|$)/.test(back) ? back : `${back.split("#")[0]}#follow-ups`);
|
|
1171
1198
|
}
|
|
1172
1199
|
const filed = fileAddTestsTask(store, evidenceRoot, { runId: id, actor: who.name, filedVia: "console", ...(admissionList() === null ? {} : { admittedRepos: admissionList() }) }, now);
|
|
1173
1200
|
if (!filed.ok)
|
|
@@ -1360,10 +1387,10 @@ export function createTasksHandlers(runtime) {
|
|
|
1360
1387
|
function taskMutation(response, who, taskId, verb, posted, now, request = null) {
|
|
1361
1388
|
const ref = store.lookupRef(taskId);
|
|
1362
1389
|
if (ref === null || store.getTask(taskId) === null) {
|
|
1363
|
-
return refuse(response, who, 404, "no such task", "/
|
|
1390
|
+
return refuse(response, who, 404, "no such task", "/");
|
|
1364
1391
|
}
|
|
1365
1392
|
if (!visible(ref.repo)) {
|
|
1366
|
-
return refuse(response, who, 404, "no such task", "/
|
|
1393
|
+
return refuse(response, who, 404, "no such task", "/");
|
|
1367
1394
|
}
|
|
1368
1395
|
switch (verb) {
|
|
1369
1396
|
case "steer": {
|
|
@@ -1384,7 +1411,7 @@ export function createTasksHandlers(runtime) {
|
|
|
1384
1411
|
if (ended === null || ended.taskRef !== ref.id || !/^[A-Za-z0-9-]{8,64}$/.test(keyRaw) || body.has("run") || (afterBack !== null && afterBack !== "task" && afterFlow === null)) {
|
|
1385
1412
|
return taskScreen(response, who, taskId, "that note did not say which agent it came from, so nothing was sent", 400);
|
|
1386
1413
|
}
|
|
1387
|
-
const filed = store.fileSteerNoteForRun(taskId, verifiedAuthor(who.name), body.get("note") ?? "", now, { run: ended.id, key: keyRaw, onward: true });
|
|
1414
|
+
const filed = typedSteer(store, who, () => store.fileSteerNoteForRun(taskId, verifiedAuthor(who.name), body.get("note") ?? "", now, { run: ended.id, key: keyRaw, onward: true }), now, body.get("note"));
|
|
1388
1415
|
if (afterBack !== null) {
|
|
1389
1416
|
if (filed.ok)
|
|
1390
1417
|
return redirect(response, afterFlow !== null ? `/flows/${afterFlow.flow}?card=${afterFlow.card}&sent=${keyRaw}` : `${taskHref(taskId)}?sent=${keyRaw}#steering`);
|
|
@@ -1409,7 +1436,7 @@ export function createTasksHandlers(runtime) {
|
|
|
1409
1436
|
if (capability !== null && capability.send === null) {
|
|
1410
1437
|
return from === "agents" ? redirect(response, `/agents?run=${shown.id}&said=steer-no-notes`) : taskScreen(response, who, taskId, capability.words, 409);
|
|
1411
1438
|
}
|
|
1412
|
-
const bound = store.fileSteerNoteForRun(taskId, verifiedAuthor(who.name), body.get("note") ?? "", now, { run: shown.id, key: keyRaw });
|
|
1439
|
+
const bound = typedSteer(store, who, () => store.fileSteerNoteForRun(taskId, verifiedAuthor(who.name), body.get("note") ?? "", now, { run: shown.id, key: keyRaw }), now, body.get("note"));
|
|
1413
1440
|
if (from === "task") {
|
|
1414
1441
|
if (bound.ok)
|
|
1415
1442
|
return redirect(response, flowBack !== null ? `/flows/${flowBack.flow}?card=${flowBack.card}&sent=${keyRaw}` : `${taskHref(taskId)}?sent=${keyRaw}#steering`);
|
|
@@ -1424,7 +1451,7 @@ export function createTasksHandlers(runtime) {
|
|
|
1424
1451
|
return redirect(response, `/agents?run=${shown.id}&said=steer-invalid`);
|
|
1425
1452
|
return redirect(response, `/agents?run=${shown.id}&said=steer-stale`);
|
|
1426
1453
|
}
|
|
1427
|
-
const filed = store.fileSteerNote(taskId, verifiedAuthor(who.name), body.get("note") ?? "", now);
|
|
1454
|
+
const filed = typedSteer(store, who, () => store.fileSteerNote(taskId, verifiedAuthor(who.name), body.get("note") ?? "", now), now, body.get("note"));
|
|
1428
1455
|
if (!filed.ok) {
|
|
1429
1456
|
const said = filed.reason === "task-finished"
|
|
1430
1457
|
? "this task is finished — a note has no next attempt to reach"
|
|
@@ -1448,7 +1475,7 @@ export function createTasksHandlers(runtime) {
|
|
|
1448
1475
|
if (asked === null || asked.taskRef !== ref.id)
|
|
1449
1476
|
return taskScreen(response, who, taskId, "that question is not on this task", 404);
|
|
1450
1477
|
const answered = answerAgentQuestion(store, { question: id, answer: body.get("answer") ?? "", author: who.name, at: now,
|
|
1451
|
-
file: (task, note) => store.fileSteerNote(task, verifiedAuthor(who.name), note, now) });
|
|
1478
|
+
file: (task, note) => typedSteer(store, who, () => store.fileSteerNote(task, verifiedAuthor(who.name), note, now), now, body.get("answer"), asked.question) });
|
|
1452
1479
|
const said = answered.ok ? "replied" : answered.reason === "invalid-answer" || answered.reason === "not-saved" ? "reply-invalid" : answered.reason === "closed" ? "reply-closed" : "reply-stale";
|
|
1453
1480
|
return redirect(response, `/agents?run=${asked.run}&said=${said}`);
|
|
1454
1481
|
}
|
|
@@ -1582,7 +1609,8 @@ export function createTasksHandlers(runtime) {
|
|
|
1582
1609
|
}
|
|
1583
1610
|
case "requeue": {
|
|
1584
1611
|
const body = readForm(posted, CONSOLE_FORMS.taskRequeue);
|
|
1585
|
-
const
|
|
1612
|
+
const typedNote = (body.get("note") ?? "").trim();
|
|
1613
|
+
const note = withContext(body.get("context"), typedNote);
|
|
1586
1614
|
if (note !== "" && who.via !== "cookie")
|
|
1587
1615
|
return refuse(response, who, 403, "steering is a browser session's act");
|
|
1588
1616
|
if (note !== "" && !validateNote(note).ok)
|
|
@@ -1601,7 +1629,7 @@ export function createTasksHandlers(runtime) {
|
|
|
1601
1629
|
}
|
|
1602
1630
|
}
|
|
1603
1631
|
if (note !== "" && !replayed) {
|
|
1604
|
-
const filed = store.fileSteerNote(taskId, verifiedAuthor(who.name), note, now);
|
|
1632
|
+
const filed = typedSteer(store, who, () => store.fileSteerNote(taskId, verifiedAuthor(who.name), note, now), now, typedNote);
|
|
1605
1633
|
if (!filed.ok)
|
|
1606
1634
|
return taskScreen(response, who, taskId, "Retried. The note wasn't saved; add it under Steering.", 409);
|
|
1607
1635
|
}
|
|
@@ -2011,7 +2039,7 @@ export function createTasksHandlers(runtime) {
|
|
|
2011
2039
|
}
|
|
2012
2040
|
if (note === null && store.getTask(taskId)?.state === "failed") {
|
|
2013
2041
|
const back = body.get("return") === null ? null : safeReturn(body.get("return"));
|
|
2014
|
-
if (back !== null && back.startsWith("/review?"))
|
|
2042
|
+
if (back !== null && (back.startsWith("/review?") || /^\/t\/[^/?#]+\?(?:[^#]*&)?tab=result(?:[&#]|$)/.test(back)))
|
|
2015
2043
|
return redirect(response, withRefusal(back, "reason"));
|
|
2016
2044
|
return taskScreen(response, who, taskId, ACCEPT_ANYWAY_NEEDS_REASON, 400);
|
|
2017
2045
|
}
|
|
@@ -2022,12 +2050,13 @@ export function createTasksHandlers(runtime) {
|
|
|
2022
2050
|
const body = readForm(posted, CONSOLE_FORMS.taskComplete);
|
|
2023
2051
|
const principal = who.via === "cookie" ? leadPrincipal(who) : null;
|
|
2024
2052
|
if (principal === null)
|
|
2025
|
-
return refuse(response, who, 403, "Your access changed. Sign in again.");
|
|
2053
|
+
return answersInPlace(request) ? answerActInPlace(response, "refused", "Your access changed. Sign in again.", 403) : refuse(response, who, 403, "Your access changed. Sign in again.");
|
|
2026
2054
|
const digest = body.get("receipt") ?? "";
|
|
2027
2055
|
const namedRun = body.get("run") ?? "";
|
|
2028
2056
|
const current = assignmentOf(store, taskId, now, { principal: "operator", repos: principal.repos }, evidenceRoot);
|
|
2029
2057
|
if (current === null || current.receipt?.taskId !== taskId || !/^[0-9]{1,15}$/.test(namedRun) || current.receipt.runId !== Number(namedRun)) {
|
|
2030
|
-
|
|
2058
|
+
const changed = "This result changed. Open the current result before marking it complete.";
|
|
2059
|
+
return answersInPlace(request) ? answerActInPlace(response, "refused", changed, 409) : taskScreen(response, who, taskId, changed, 409);
|
|
2031
2060
|
}
|
|
2032
2061
|
if (body.get("accept") === "1") {
|
|
2033
2062
|
const rawNote = (body.get("note") ?? "").trim();
|
|
@@ -2035,13 +2064,16 @@ export function createTasksHandlers(runtime) {
|
|
|
2035
2064
|
if (rawNote !== "") {
|
|
2036
2065
|
const validated = validateNote(rawNote);
|
|
2037
2066
|
if (!validated.ok)
|
|
2038
|
-
return taskScreen(response, who, taskId, validated.problem, 400);
|
|
2067
|
+
return answersInPlace(request) ? answerActInPlace(response, "refused", validated.problem, 400) : taskScreen(response, who, taskId, validated.problem, 400);
|
|
2039
2068
|
note = validated.note;
|
|
2040
2069
|
}
|
|
2041
2070
|
const publish = body.get("publish") === "1";
|
|
2042
2071
|
const finished = acceptAndCompleteAsOperator(store, taskId, { runId: Number(namedRun), receiptDigest: digest, note }, principal, now, evidenceRoot, publish ? accepted => completeAndOpenPullRequest(store, { taskId, digest: accepted, runId: Number(namedRun), who: principal, root: evidenceRoot }, now) : undefined);
|
|
2043
2072
|
if (!finished.ok)
|
|
2044
|
-
return
|
|
2073
|
+
return answersInPlace(request) ? answerActInPlace(response, "refused", finished.message, finished.reason === "needs-reason" ? 400 : 409)
|
|
2074
|
+
: taskScreen(response, who, taskId, finished.message, finished.reason === "needs-reason" ? 400 : 409);
|
|
2075
|
+
if (answersInPlace(request) && !publish)
|
|
2076
|
+
return answerActInPlace(response, "done", "Accepted. The task is complete.", 200);
|
|
2045
2077
|
return redirect(response, publish ? `${taskHref(familyOf(taskId)?.root.id ?? taskId)}#merge` : body.get("return") === null ? reviewHref(taskId, Number(namedRun)) : safeReturn(body.get("return")));
|
|
2046
2078
|
}
|
|
2047
2079
|
if (body.get("publish") === "1") {
|
|
@@ -2052,7 +2084,9 @@ export function createTasksHandlers(runtime) {
|
|
|
2052
2084
|
}
|
|
2053
2085
|
const completed = checkAssignmentAsOperator(store, taskId, digest, principal, now, evidenceRoot);
|
|
2054
2086
|
if (!completed.ok)
|
|
2055
|
-
return taskScreen(response, who, taskId, completed.message, 409);
|
|
2087
|
+
return answersInPlace(request) ? answerActInPlace(response, "refused", completed.message, 409) : taskScreen(response, who, taskId, completed.message, 409);
|
|
2088
|
+
if (answersInPlace(request))
|
|
2089
|
+
return answerActInPlace(response, "done", "Marked complete.", 200);
|
|
2056
2090
|
return redirect(response, body.get("return") === null ? reviewHref(taskId, Number(namedRun)) : safeReturn(body.get("return")));
|
|
2057
2091
|
}
|
|
2058
2092
|
case "retry-review": {
|
|
@@ -2102,7 +2136,10 @@ export function createTasksHandlers(runtime) {
|
|
|
2102
2136
|
const note = (body.get("note") ?? "").trim();
|
|
2103
2137
|
const asked = body.get("mode") === "resume"
|
|
2104
2138
|
? store.requestResume({ taskId, runId: Number(named), by: verifiedAuthor(who.name), via: "web", requestId: body.get("request") ?? "" }, now)
|
|
2105
|
-
: store
|
|
2139
|
+
: typedSteer(store, who, () => {
|
|
2140
|
+
const paused = store.requestPause({ taskId, runId: Number(named), by: verifiedAuthor(who.name), via: "web", requestId: body.get("request") ?? "", ...(note === "" ? {} : { note }) }, now);
|
|
2141
|
+
return paused.ok && !paused.duplicate && paused.note !== null ? { ...paused, id: paused.note } : paused;
|
|
2142
|
+
}, now, note);
|
|
2106
2143
|
if (!asked.ok) {
|
|
2107
2144
|
const words = {
|
|
2108
2145
|
stale: `build #${named} has stopped taking notes — reload to see the current attempt`,
|
|
@@ -2345,6 +2382,7 @@ export function createTasksHandlers(runtime) {
|
|
|
2345
2382
|
reviewRetry: store.reviewRetryStateOf(run.id),
|
|
2346
2383
|
review: reviewFactsFor(run.id),
|
|
2347
2384
|
notes: store.notesForRun(run.id),
|
|
2385
|
+
youSaid: typedNotesFor(store, row.taskId, YOU_SAID_CAP),
|
|
2348
2386
|
};
|
|
2349
2387
|
}
|
|
2350
2388
|
function decisionEvidence(response, decisionId, artifactId) {
|
|
@@ -2482,7 +2520,7 @@ export function createTasksHandlers(runtime) {
|
|
|
2482
2520
|
"board": async (ctx) => retiredRedirect("board", ctx.url, ctx.response),
|
|
2483
2521
|
"review": async (ctx) => ctx.url.searchParams.has("result") ? showReview(ctx) : retiredRedirect("review", ctx.url, ctx.response),
|
|
2484
2522
|
"done": async (ctx) => retiredRedirect("done", ctx.url, ctx.response),
|
|
2485
|
-
"tasks":
|
|
2523
|
+
"tasks": retiredHandler("tasks"),
|
|
2486
2524
|
"queue": async (ctx) => retiredRedirect("queue", ctx.url, ctx.response),
|
|
2487
2525
|
"n.task": showNumberedTask,
|
|
2488
2526
|
"tasks.new": showNewTask,
|
|
@@ -2608,7 +2646,7 @@ export function createTasksHandlers(runtime) {
|
|
|
2608
2646
|
return noPage(who, response);
|
|
2609
2647
|
const { taskId } = act;
|
|
2610
2648
|
if (familyInWebReach(store, who, taskId, visible) === null)
|
|
2611
|
-
return refuse(response, who, 403, "That task is outside your access.", "/
|
|
2649
|
+
return refuse(response, who, 403, "That task is outside your access.", "/");
|
|
2612
2650
|
const number = (name) => Number(body.get(name) ?? "");
|
|
2613
2651
|
const back = () => redirect(response, `${taskHref(taskId)}#findings`);
|
|
2614
2652
|
const refused = (message) => taskScreen(response, who, taskId, message, 409);
|
|
@@ -2667,7 +2705,7 @@ export function createTasksHandlers(runtime) {
|
|
|
2667
2705
|
default: return refused("Reload the page and try again.");
|
|
2668
2706
|
}
|
|
2669
2707
|
}
|
|
2670
|
-
return { registrations, runListPane, peekFragment, taskMutation, queueRegionFor, ciFailingFor, completedRowFor, attemptRowFor, resultRowOf, reviewCockpitViewOf, decisionEvidence, runEvidence, sendArtifact, peekGuards, liveRunIds };
|
|
2708
|
+
return { registrations, workListFor, showOrder, runListPane, peekFragment, taskMutation, queueRegionFor, ciFailingFor, completedRowFor, attemptRowFor, resultRowOf, reviewCockpitViewOf, decisionEvidence, runEvidence, sendArtifact, peekGuards, liveRunIds };
|
|
2671
2709
|
}
|
|
2672
2710
|
export function createTidyHandlers(runtime) {
|
|
2673
2711
|
const { store, sendScreen, chromeFor, authenticateApprover, workAccess, bustBadge } = runtime;
|
|
@@ -2694,13 +2732,13 @@ export function createTidyHandlers(runtime) {
|
|
|
2694
2732
|
if (!done.ok)
|
|
2695
2733
|
return back(done.message);
|
|
2696
2734
|
bustBadge();
|
|
2697
|
-
return redirect(response, "
|
|
2735
|
+
return redirect(response, "/?view=archived");
|
|
2698
2736
|
}
|
|
2699
2737
|
const oneTask = (kind) => async (ctx) => {
|
|
2700
2738
|
const { url, who, response, now, posted } = ctx;
|
|
2701
2739
|
const act = matchTaskPath(url.pathname, `/${kind}$`);
|
|
2702
2740
|
if (act === null)
|
|
2703
|
-
return refuse(response, who, 404, "There's no page at this address.", "/
|
|
2741
|
+
return refuse(response, who, 404, "There's no page at this address.", "/");
|
|
2704
2742
|
const body = readForm(posted, kind === "archive" ? CONSOLE_FORMS.taskArchive : CONSOLE_FORMS.taskRestore);
|
|
2705
2743
|
const standing = (refs) => approverStandsNow(store, who.name, familyRepoOf(store, refs));
|
|
2706
2744
|
const done = kind === "archive"
|
|
@@ -2845,3 +2883,18 @@ export function localOwnerRetry(store, taskId, run, digest, now) {
|
|
|
2845
2883
|
const done = retryAsLocalOwner(store, taskId, { run: Number(run), digest }, now);
|
|
2846
2884
|
return done.ok ? { ok: true, replayed: done.replayed } : { ok: false, status: done.reason === "local-owner" || done.reason === "refused" || done.reason === "limit" ? 403 : 409, message: done.message };
|
|
2847
2885
|
}
|
|
2886
|
+
export function answerActInPlace(response, outcome, words, status) {
|
|
2887
|
+
respond(response, status, "application/json; charset=utf-8", JSON.stringify({ outcome, words }));
|
|
2888
|
+
}
|
|
2889
|
+
function typedSteer(store, who, file, now, words, question = null) {
|
|
2890
|
+
return store.transact(() => {
|
|
2891
|
+
const filed = file();
|
|
2892
|
+
if (filed.ok && typeof filed.id === "number" && who.via === "cookie")
|
|
2893
|
+
markTypedByPerson(store, { steer: filed.id }, who.name, words, now, question);
|
|
2894
|
+
return filed;
|
|
2895
|
+
});
|
|
2896
|
+
}
|
|
2897
|
+
export function withContext(context, typed) {
|
|
2898
|
+
return [(context ?? "").trim(), typed.trim()].filter(one => one !== "").join("\n\n");
|
|
2899
|
+
}
|
|
2900
|
+
export const YOU_SAID_CAP = 8;
|