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/serve.js
CHANGED
|
@@ -48,7 +48,7 @@ import { createSharedGuards } from "./server/guards.js";
|
|
|
48
48
|
import { createHandlerRegistry } from "./server/handler-registry.js";
|
|
49
49
|
import {} from "./server/remote-hooks.js";
|
|
50
50
|
import { createRemoteHandlers } from "./server/remote.js";
|
|
51
|
-
import { evaluateRoutePolicy, withEdgePolicy } from "./server/route-policy.js";
|
|
51
|
+
import { evaluateRoutePolicy, holdsRole, routePrincipalOf, withEdgePolicy } from "./server/route-policy.js";
|
|
52
52
|
import { matchRoute, ROUTES } from "./server/route-table.js";
|
|
53
53
|
import { createTaskViews } from "./server/task-views.js";
|
|
54
54
|
import { runActivityOf } from "./task-activity.js";
|
|
@@ -57,6 +57,7 @@ import { createTeamRuntime } from './team-runtime.js';
|
|
|
57
57
|
import { createPersonalQueueRuntime } from './lead-queue-runtime.js';
|
|
58
58
|
import {} from "./tools-ui.js";
|
|
59
59
|
import { WORK_INDEX_MAX_LIMIT, workCountsByProject, workIndexPage } from "./work-index.js";
|
|
60
|
+
import { withWorkReads } from "./work-reads.js";
|
|
60
61
|
import { WORKSPACE_MOTION_SCRIPT } from "./workspace-motion.js";
|
|
61
62
|
import { prepareWorkspaceRevision, WorkspaceValidatorCache } from "./workspace-revision.js";
|
|
62
63
|
import { createHash, randomBytes } from "node:crypto";
|
|
@@ -128,7 +129,7 @@ import { createBrowserKeys, KEY_FILL_SCRIPT, pagePathOf } from './server/mutatio
|
|
|
128
129
|
import { DEFAULT_GUARD_POLICY, passwordGuardOf, provenPasswordAccount, SourceBudget, withPasswordSource } from "./sign-in-guard.js";
|
|
129
130
|
import { sourceKey } from "./source-key.js";
|
|
130
131
|
import { readSsoSettings } from "./sso-settings.js";
|
|
131
|
-
import { LEAD_THREAD, latestLeadTurnOfThread, localOwnerBinding } from "./store.js";
|
|
132
|
+
import { LEAD_THREAD, latestLeadTurnOfThread, localOwnerBinding, projectRowKnown } from "./store.js";
|
|
132
133
|
import { waitingUpdate } from "./toolroll-update.js";
|
|
133
134
|
import { PACKAGE_VERSION } from "./version.js";
|
|
134
135
|
import { loadConsoleUrl } from "./webhooks.js";
|
|
@@ -155,7 +156,7 @@ export function createDecisionServer(options) {
|
|
|
155
156
|
get dockedConversation() { return dockedConversation; },
|
|
156
157
|
get liveRefreshSeconds() { return liveRefreshSeconds; },
|
|
157
158
|
});
|
|
158
|
-
const { authenticateApprover, authenticateCredential, authorizeMutation, projectOf, projectRequestAllowed, identify, lookupSession, restricted, visible, admissionList, codingActorAllowed, codingProjectAllowed, workAccess, familyOf, taskRepoOf, runVisible } = createSharedGuards({
|
|
159
|
+
const { authenticateApprover, authenticateCredential, authorizeMutation, projectOf, projectRequestAllowed, identify, lookupSession, restricted, visible, visibleNow, admissionList, codingActorAllowed, codingProjectAllowed, workAccess, familyOf, taskRepoOf, runVisible } = createSharedGuards({
|
|
159
160
|
get store() { return store; },
|
|
160
161
|
get liveCeiling() { return liveCeiling; },
|
|
161
162
|
identities,
|
|
@@ -291,7 +292,7 @@ export function createDecisionServer(options) {
|
|
|
291
292
|
const known = store.accountOf(account);
|
|
292
293
|
if (known === null || known.role !== "approver" || known.revokedAt !== null || !known.passwordSet)
|
|
293
294
|
return null;
|
|
294
|
-
return holdSignInLink({ kind: "full", account, expires: Date.now() + SIGN_IN_LINK_MS });
|
|
295
|
+
return holdSignInLink({ kind: "full", account, accountGeneration: known.generation, expires: Date.now() + SIGN_IN_LINK_MS });
|
|
295
296
|
}
|
|
296
297
|
const keyEpoch = options.keyEpoch ?? randomBytes(16).toString("hex");
|
|
297
298
|
const fromThisComputer = (request) => requestFromThisComputer(request);
|
|
@@ -356,10 +357,12 @@ export function createDecisionServer(options) {
|
|
|
356
357
|
const { ceiling, unresolved: unresolvedRepos, defaultProject, configured, configuredPaths } = startupCeiling([...(options.repo === undefined ? [] : [options.repo]), ...(options.repos ?? [])], options.projectRoots ?? [], options.identities === undefined ? undefined : identities, identities.strict);
|
|
357
358
|
const unscopedMode = !configured && options.admittedRepos === undefined;
|
|
358
359
|
const exactRepos = () => options.admittedRepos?.() ?? ceiling.repos;
|
|
360
|
+
const consoleAdmitted = new Set();
|
|
359
361
|
const liveCeiling = () => {
|
|
360
|
-
const repos = [...exactRepos(), ...(options.additionalProjectRepos?.() ?? [])];
|
|
362
|
+
const repos = [...exactRepos(), ...(options.additionalProjectRepos?.() ?? []), ...stillAdmitted(consoleAdmitted, deletedRepos, repo => projectRowKnown(store, repo))];
|
|
361
363
|
return { repos: repos.length === 0 && ceiling.roots.length === 0 && !unscopedMode ? [NO_PROJECT] : repos, roots: ceiling.roots, canon: identities.strict };
|
|
362
364
|
};
|
|
365
|
+
const outsideAdmissions = outsideAdmissionsOf(consoleAdmitted);
|
|
363
366
|
const deletedRepos = new Set();
|
|
364
367
|
const goneRepos = () => {
|
|
365
368
|
if (deletedRepos.size === 0)
|
|
@@ -371,10 +374,10 @@ export function createDecisionServer(options) {
|
|
|
371
374
|
const managedRepos = () => {
|
|
372
375
|
const seen = new Set();
|
|
373
376
|
const repos = [];
|
|
374
|
-
const gone = goneRepos();
|
|
377
|
+
const gone = goneRepos(), shown = visibleNow();
|
|
375
378
|
for (const path of [...exactRepos(), ...(options.currentRepos?.() ?? [])]) {
|
|
376
379
|
const canonical = identities.hot(path);
|
|
377
|
-
if (seen.has(canonical) || !
|
|
380
|
+
if (seen.has(canonical) || !shown(canonical) || gone.has(canonical))
|
|
378
381
|
continue;
|
|
379
382
|
seen.add(canonical);
|
|
380
383
|
repos.push(canonical);
|
|
@@ -521,8 +524,8 @@ export function createDecisionServer(options) {
|
|
|
521
524
|
return presentsPassword(request) ? passwordAccountBudget.admit(actor.name) : { ok: true };
|
|
522
525
|
};
|
|
523
526
|
const consoleProjects = () => {
|
|
524
|
-
const gone = goneRepos();
|
|
525
|
-
return [...new Set([...(admissionList() ?? []), ...managedRepos(), ...store.knownRepos()])].filter(one =>
|
|
527
|
+
const gone = goneRepos(), shown = visibleNow();
|
|
528
|
+
return [...new Set([...(admissionList() ?? []), ...managedRepos(), ...store.knownRepos()])].filter(one => shown(one) && !gone.has(one));
|
|
526
529
|
};
|
|
527
530
|
const server = createServer((request, response) => {
|
|
528
531
|
instrumentRequest(store.telemetry, request, response);
|
|
@@ -638,11 +641,14 @@ export function createDecisionServer(options) {
|
|
|
638
641
|
const held = approvalNonces.get(nonce);
|
|
639
642
|
if (held === undefined)
|
|
640
643
|
return false;
|
|
644
|
+
if (held.expiresAt < Date.now()) {
|
|
645
|
+
approvalNonces.delete(nonce);
|
|
646
|
+
return false;
|
|
647
|
+
}
|
|
648
|
+
if (held.name !== name || held.taskId !== taskId || held.digest !== digest)
|
|
649
|
+
return false;
|
|
641
650
|
approvalNonces.delete(nonce);
|
|
642
|
-
return
|
|
643
|
-
held.taskId === taskId &&
|
|
644
|
-
held.digest === digest &&
|
|
645
|
-
held.expiresAt >= Date.now());
|
|
651
|
+
return true;
|
|
646
652
|
}
|
|
647
653
|
const hookContext = { store, clock, options };
|
|
648
654
|
async function handle(request, response) {
|
|
@@ -794,7 +800,7 @@ export function createDecisionServer(options) {
|
|
|
794
800
|
request.resume();
|
|
795
801
|
return refuseLocalOwner(response, who, method, url, request.headers.accept);
|
|
796
802
|
}
|
|
797
|
-
const policy = evaluateRoutePolicy(route,
|
|
803
|
+
const policy = evaluateRoutePolicy(route, routePrincipalOf(who), source => projectRequestAllowed(route, source, url, who, request, response, body));
|
|
798
804
|
if (!policy.ok) {
|
|
799
805
|
if (policy.reason === "project")
|
|
800
806
|
return;
|
|
@@ -834,7 +840,7 @@ export function createDecisionServer(options) {
|
|
|
834
840
|
if (!projectRequestAllowed(route, route.project, url, who, request, response, null))
|
|
835
841
|
return;
|
|
836
842
|
}
|
|
837
|
-
return handleGet(route, url, who, request, response);
|
|
843
|
+
return withWorkReads(() => handleGet(route, url, who, request, response));
|
|
838
844
|
}
|
|
839
845
|
return handlePost(route, url, who, request, response, body);
|
|
840
846
|
};
|
|
@@ -947,7 +953,7 @@ export function createDecisionServer(options) {
|
|
|
947
953
|
const namedProject = url.searchParams.get("project");
|
|
948
954
|
if (url.searchParams.getAll("result").length !== 1 || url.searchParams.getAll("run").length > 1 || url.searchParams.getAll("project").length > 1 ||
|
|
949
955
|
(namedProject !== null && (ref === null || !visible(ref.repo) || namedProject !== ref.repo))) {
|
|
950
|
-
return refuse(response, who, 404, "No such result in your projects.", "/
|
|
956
|
+
return refuse(response, who, 404, "No such result in your projects.", "/");
|
|
951
957
|
}
|
|
952
958
|
if (who.via === "cookie" && ref !== null && visible(ref.repo))
|
|
953
959
|
project = ref.repo;
|
|
@@ -1193,15 +1199,15 @@ export function createDecisionServer(options) {
|
|
|
1193
1199
|
function paletteIndexTag(project) {
|
|
1194
1200
|
const admitted = project === null ? admissionList() : null;
|
|
1195
1201
|
const entries = [
|
|
1196
|
-
{ label: "tasks", href: "/
|
|
1197
|
-
{ label: "needs you", href: "
|
|
1202
|
+
{ label: "tasks", href: "/" },
|
|
1203
|
+
{ label: "needs you", href: "/?view=needs-you" },
|
|
1198
1204
|
{ label: "home", href: "/" },
|
|
1199
|
-
{ label: "board", href: "
|
|
1205
|
+
{ label: "board", href: "/?view=board" },
|
|
1200
1206
|
{ label: "queue", href: QUEUE_VIEW },
|
|
1201
|
-
{ label: "every project", href: "/
|
|
1207
|
+
{ label: "every project", href: "/" },
|
|
1202
1208
|
{ label: "flows", href: "/flows" },
|
|
1203
|
-
{ label: "finished", href: "
|
|
1204
|
-
{ label: "ready for review", href: "
|
|
1209
|
+
{ label: "finished", href: "/?view=done" },
|
|
1210
|
+
{ label: "ready for review", href: "/?view=ready" },
|
|
1205
1211
|
{ label: "fleet", href: "/fleet" },
|
|
1206
1212
|
{ label: "activity", href: "/activity" },
|
|
1207
1213
|
{ label: "action ledger", href: "/ledger" },
|
|
@@ -1216,8 +1222,8 @@ export function createDecisionServer(options) {
|
|
|
1216
1222
|
entries.push({ label: `${one.id} — ${one.title}`, href: `/t/${encodeURIComponent(one.id)}` });
|
|
1217
1223
|
}
|
|
1218
1224
|
const saturated = open.length > 200;
|
|
1219
|
-
const safeEntries = restricted() ? entries.filter(one => ["/
|
|
1220
|
-
return jsonScript(saturated ? [...safeEntries, { label: "… more in
|
|
1225
|
+
const safeEntries = restricted() ? entries.filter(one => ["/", "/?view=needs-you", "/", "/?view=board", "/flows", "/?view=done", "/?view=ready", "/runs", "/projects", "/ledger"].includes(one.href) || one.href.startsWith("/t/")) : entries;
|
|
1226
|
+
return jsonScript(saturated ? [...safeEntries, { label: "… more in Work", href: "/" }] : safeEntries, { id: "palette-index" });
|
|
1221
1227
|
}
|
|
1222
1228
|
const paletteCache = new Map();
|
|
1223
1229
|
function paletteTagCached(project) {
|
|
@@ -1371,11 +1377,11 @@ export function createDecisionServer(options) {
|
|
|
1371
1377
|
catchUpHtml: extras.catchUpHtml === undefined ? '' : htmlString(extras.catchUpHtml), controlsHtml: extras.controlsHtml === undefined ? '' : htmlString(extras.controlsHtml), notices, view: extras.view ?? null,
|
|
1372
1378
|
...(s.chrome.demo ? { demo: { text: DEMO_BANNER, short: DEMO_BANNER_SHORT } } : {}),
|
|
1373
1379
|
pageHtml: extras.pageHtml === undefined ? (conversation === null ? pageHtml : null) : extras.pageHtml === null ? null : htmlString(extras.pageHtml),
|
|
1374
|
-
navigation: browserNavigationOf(currentPath,
|
|
1380
|
+
navigation: browserNavigationOf(currentPath, needsYou, s.chrome.inboxLabel),
|
|
1375
1381
|
...(requestFacts.advanced === false ? { advanced: false } : {}),
|
|
1376
1382
|
needsYou: { count: needsYou, saturated: s.chrome.inboxSaturated === true, scope: tasksProject ?? null,
|
|
1377
1383
|
label: s.chrome.inboxLabel ?? `${needsYou} ${needsYou === 1 ? 'needs' : 'need'} you`,
|
|
1378
|
-
href: tasksProject === null ? '
|
|
1384
|
+
href: tasksProject === null ? '/?view=needs-you' : `/?project=${encodeURIComponent(tasksProject)}&view=needs-you` },
|
|
1379
1385
|
chats,
|
|
1380
1386
|
...(() => { if (sensitive)
|
|
1381
1387
|
return {}; try {
|
|
@@ -1444,11 +1450,12 @@ export function createDecisionServer(options) {
|
|
|
1444
1450
|
function sidebarProjects() {
|
|
1445
1451
|
const seen = new Set();
|
|
1446
1452
|
const rows = [];
|
|
1453
|
+
const shown = visibleNow();
|
|
1447
1454
|
for (const one of [
|
|
1448
1455
|
...store.listProjects().map(one => ({ path: one.path, name: one.name })),
|
|
1449
1456
|
...managedRepos().map(path => ({ path, name: projectName(path) })),
|
|
1450
1457
|
]) {
|
|
1451
|
-
if (seen.has(one.path) || !
|
|
1458
|
+
if (seen.has(one.path) || !shown(one.path) || goneRepos().has(one.path))
|
|
1452
1459
|
continue;
|
|
1453
1460
|
seen.add(one.path);
|
|
1454
1461
|
rows.push(one);
|
|
@@ -1465,7 +1472,7 @@ export function createDecisionServer(options) {
|
|
|
1465
1472
|
const access = workAccess();
|
|
1466
1473
|
return JSON.stringify({ projects: sidebarProjects().map(one => one.path).sort(), access: { ...access, repos: access.repos === null ? null : [...access.repos].sort() } });
|
|
1467
1474
|
});
|
|
1468
|
-
const projectSummaryFor = (account, scope) => projectScopeFor(account) !== scope ? null : requestContext.run({ csrf: '', returnTo: '/', actor: account }, () => JSON.stringify(projectSummary()));
|
|
1475
|
+
const projectSummaryFor = (account, scope) => projectScopeFor(account) !== scope ? null : requestContext.run({ csrf: '', returnTo: '/', actor: account }, () => withWorkReads(() => JSON.stringify(projectSummary())));
|
|
1469
1476
|
function chromeFor(project, active, listPane, scope) {
|
|
1470
1477
|
if (restricted() && !visible(project))
|
|
1471
1478
|
project = null;
|
|
@@ -1920,9 +1927,10 @@ export function createDecisionServer(options) {
|
|
|
1920
1927
|
get identities() { return identities; },
|
|
1921
1928
|
get keyEpoch() { return keyEpoch; },
|
|
1922
1929
|
get browserKeys() { return browserKeys; },
|
|
1930
|
+
get outsideAdmissions() { return outsideAdmissions; },
|
|
1923
1931
|
};
|
|
1924
1932
|
const tasksHandlers = createTasksHandlers(handlerRuntime);
|
|
1925
|
-
const pagesHandlers = createPagesHandlers(handlerRuntime);
|
|
1933
|
+
const pagesHandlers = createPagesHandlers(handlerRuntime, { listFor: tasksHandlers.workListFor, showOrder: tasksHandlers.showOrder });
|
|
1926
1934
|
const flowsHandlers = createFlowsHandlers(handlerRuntime);
|
|
1927
1935
|
const chatHandlers = createChatHandlers(handlerRuntime);
|
|
1928
1936
|
const settingsHandlers = createSettingsHandlers(handlerRuntime);
|
|
@@ -1966,9 +1974,7 @@ export function createDecisionServer(options) {
|
|
|
1966
1974
|
]);
|
|
1967
1975
|
function dispatchConsole(route, ctx) {
|
|
1968
1976
|
const { who, response } = ctx;
|
|
1969
|
-
|
|
1970
|
-
(route.role === "approver" ? who.role === "approver" : store.isInstanceOperator(who.name)));
|
|
1971
|
-
if (!held) {
|
|
1977
|
+
if (!holdsRole(route, who, name => store.isInstanceOperator(name))) {
|
|
1972
1978
|
ctx.request.resume();
|
|
1973
1979
|
const refusal = route.roleRefusal;
|
|
1974
1980
|
return Promise.resolve("message" in refusal ? refuse(response, who, 403, refusal.message, refusal.back) : respond(response, refusal.status, refusal.type, refusal.body));
|
|
@@ -2066,3 +2072,12 @@ function consoleFolders(options, identities, work) {
|
|
|
2066
2072
|
}
|
|
2067
2073
|
return inFolderScope(gate, work);
|
|
2068
2074
|
}
|
|
2075
|
+
function stillAdmitted(admitted, gone, added) {
|
|
2076
|
+
for (const repo of admitted)
|
|
2077
|
+
if (gone.has(repo) || !added(repo))
|
|
2078
|
+
admitted.delete(repo);
|
|
2079
|
+
return [...admitted];
|
|
2080
|
+
}
|
|
2081
|
+
function outsideAdmissionsOf(admitted) {
|
|
2082
|
+
return { admit: repo => { admitted.add(repo); } };
|
|
2083
|
+
}
|
package/dist/server/chat.js
CHANGED
|
@@ -40,7 +40,7 @@ import { WORK_INDEX_MAX_LIMIT, workIndexPage } from "../work-index.js";
|
|
|
40
40
|
import { html, htmlString, postForm, reauth } from "../html.js";
|
|
41
41
|
import { requestContext } from "./request-context.js";
|
|
42
42
|
import { refuse, screen, whenTime } from "./chrome.js";
|
|
43
|
-
import {
|
|
43
|
+
import { chatPanelResultHref, chatReturnWithLatest, chatRefusal, chatReturnWithSaid, projectChatHref, redirect, respond, safeChatReturn, safeReturn, taskChatHref, taskHref } from "./http.js";
|
|
44
44
|
import { chatAckPage, chatPage, NOT_STARTED_SESSION, coordinatorProposalsSection, decisionsFor, leadAfterComposerHtml, leadChatVersion, leadMintCard, leadPage, leadThreadHtml, PHONE_CARD_FACT, TASK_COMPOSER_MODES, taskChatLiveRegion, teamProposalCardParts } from "./render-chat.js";
|
|
45
45
|
import {} from "./render-pages.js";
|
|
46
46
|
import { completionForm, hardBlockerOf, homePhaseWords, owedAcceptanceOf, resultPanelHtml } from "./render-results.js";
|
|
@@ -151,7 +151,7 @@ export function createChatHandlers(runtime) {
|
|
|
151
151
|
const requestedRevision = url.searchParams.get("revision");
|
|
152
152
|
if (requestedRevision !== null) {
|
|
153
153
|
if (focusTask === null || !focusTask.family.versions.some(one => one.id === requestedRevision) || url.searchParams.has("result")) {
|
|
154
|
-
return refuse(response, who, 404, "That revision is not available for this task.", "/
|
|
154
|
+
return refuse(response, who, 404, "That revision is not available for this task.", "/");
|
|
155
155
|
}
|
|
156
156
|
if (requestedRevision !== focusTask.executionId)
|
|
157
157
|
return redirect(response, `${taskHref(focusTask.id)}?version=${encodeURIComponent(requestedRevision)}`);
|
|
@@ -180,8 +180,8 @@ export function createChatHandlers(runtime) {
|
|
|
180
180
|
user: who.name,
|
|
181
181
|
noted: url.searchParams.get("noted") !== null,
|
|
182
182
|
requestToken: randomBytes(16).toString("hex"),
|
|
183
|
-
hrefFor: one => resultLink(
|
|
184
|
-
returnTo: resultLink(
|
|
183
|
+
hrefFor: one => resultLink(chatPanelResultHref(focusTask?.id ?? "", resultRun.id, one)),
|
|
184
|
+
returnTo: resultLink(chatPanelResultHref(focusTask?.id ?? "", resultRun.id)),
|
|
185
185
|
back: { href: roomId ? "/chat?conversation=" + encodeURIComponent(roomId) : taskChatHref(focusTask?.id ?? ""), label: "Back to chat" },
|
|
186
186
|
finishes,
|
|
187
187
|
})}${finishes && focusTask?.assignment?.receipt != null
|
|
@@ -1297,10 +1297,10 @@ export function createChatHandlers(runtime) {
|
|
|
1297
1297
|
const all = view("all"), needs = view("needs-you"), done = view("completed");
|
|
1298
1298
|
const weekAgo = new Date(now.getTime() - 7 * 86_400_000).toISOString();
|
|
1299
1299
|
const counts = [
|
|
1300
|
-
{ key: "working", label: "Working now", value: agents.length, href: "
|
|
1301
|
-
{ key: "waiting", label: "Waiting on you", value: needs.items.filter(one => one.status.label !== "Ready for review").length, href: "
|
|
1302
|
-
{ key: "ready", label: "Ready to review", value: needs.items.filter(one => one.status.label === "Ready for review").length, href: "
|
|
1303
|
-
{ key: "done", label: "Done this week", value: done.items.filter(one => (one.completion?.at ?? one.updatedAt) >= weekAgo).length, href: "
|
|
1300
|
+
{ key: "working", label: "Working now", value: agents.length, href: "/?view=running" },
|
|
1301
|
+
{ key: "waiting", label: "Waiting on you", value: needs.items.filter(one => one.status.label !== "Ready for review").length, href: "/?view=needs-you" },
|
|
1302
|
+
{ key: "ready", label: "Ready to review", value: needs.items.filter(one => one.status.label === "Ready for review").length, href: "/?view=needs-you" },
|
|
1303
|
+
{ key: "done", label: "Done this week", value: done.items.filter(one => (one.completion?.at ?? one.updatedAt) >= weekAgo).length, href: "/?view=completed" },
|
|
1304
1304
|
];
|
|
1305
1305
|
const tabOf = (one) => one.assignmentState === "ready-to-check" ? one.status.label === "Ready for review" ? "ready" : "needs-you"
|
|
1306
1306
|
: one.assignmentState === "needs-decision" ? "needs-you" : one.assignmentState === "working" || one.assignmentState === "checking" ? "running" : "finished";
|
|
@@ -1318,7 +1318,7 @@ export function createChatHandlers(runtime) {
|
|
|
1318
1318
|
const lead = activity === null ? null : { name: activity.name, doing: activity.doing, at: activity.at,
|
|
1319
1319
|
href: leadTask == null || !admitted(leadTask.repo) ? null : taskHref(familyOf(activity.taskId)?.root.id ?? activity.taskId) };
|
|
1320
1320
|
return {
|
|
1321
|
-
agents, counts, catchUp, allHref: "/
|
|
1321
|
+
agents, counts, catchUp, allHref: "/", ...(lead === null ? {} : { lead }),
|
|
1322
1322
|
planUse: (windows?.tiles ?? []).map(one => ({ name: one.name, window: one.window, percent: one.percent, detail: one.detail, tone: one.tone })),
|
|
1323
1323
|
};
|
|
1324
1324
|
}
|
package/dist/server/chrome.js
CHANGED
|
@@ -89,7 +89,7 @@ export function refuse(response, who, status, message, backHref = "/", act) {
|
|
|
89
89
|
const path = new URL(requestContext.getStore()?.returnTo ?? "/", "http://standing-orders.local").pathname;
|
|
90
90
|
const generic = /^there'?s no page at this address\.?$/i.test(message.replace("\u2019", "'"));
|
|
91
91
|
const body = html `<div class="k-refusal">${status === 404
|
|
92
|
-
? kitNotFound(path, generic ? {} : { title: message, text: "
|
|
92
|
+
? kitNotFound(path, generic ? {} : { title: message, text: "Work has every task and what needs you." })
|
|
93
93
|
: kitDoc(kitDocHeader({ title: "Request refused", back: [backHref, "Back"] }), kitNotice(message), kitActs(act === undefined ? kitBtn("Go back", { href: backHref }) : kitBtn(act.label, { href: act.href, variant: "primary" })))}</div>`;
|
|
94
94
|
const framed = requestContext.getStore()?.refusal;
|
|
95
95
|
if (framed !== undefined && who.via === "cookie")
|
|
@@ -97,7 +97,7 @@ export function refuse(response, who, status, message, backHref = "/", act) {
|
|
|
97
97
|
return page(response, status, shell(status === 404 ? "Not found" : "Request refused", outPage({
|
|
98
98
|
brand: BRAND_HTML, title: status === 404 ? "Not found" : "Request refused",
|
|
99
99
|
body: html `<div class="k-refusal">${kitNotice(status === 404 && generic ? `There\u2019s no page at ${path}.` : message)}</div>`,
|
|
100
|
-
foot: act === undefined ? html `<a class="k-link" href="${status === 404 ? "/" : backHref}">${status === 404 ? "Go to
|
|
100
|
+
foot: act === undefined ? html `<a class="k-link" href="${status === 404 ? "/" : backHref}">${status === 404 ? "Go to Work" : "Go back"}</a>` : html `<a class="k-link" href="${act.href}">${act.label}</a>`,
|
|
101
101
|
})));
|
|
102
102
|
}
|
|
103
103
|
export const DEMO_BANNER = `Demo: a scripted chat and sample projects. Nothing calls a model, reaches outside or costs anything. For your own project, run ${START_COMMAND} in its folder.`;
|
|
@@ -349,8 +349,8 @@ ${count !== undefined && count > 0 ? html ` <span class="count badge badge-open"
|
|
|
349
349
|
const scopeStatus = peekCounts === null
|
|
350
350
|
? null
|
|
351
351
|
: html `<span class="scope-status">\
|
|
352
|
-
${peekCounts.waiting > 0 ? html `<a class="hot" href="
|
|
353
|
-
<a href="/runs">${peekCounts.running} live</a><a href="
|
|
352
|
+
${peekCounts.waiting > 0 ? html `<a class="hot" href="/?view=needs-you">${peekCounts.waiting} needs you</a>` : html `<a href="/?view=needs-you">0 needs you</a>`}\
|
|
353
|
+
<a href="/runs">${peekCounts.running} live</a><a href="/?view=order">${peekCounts.queued} queued</a></span>`;
|
|
354
354
|
const scopeName = effectiveScope === "project" && chrome.project !== null ? projectName(chrome.project) : "All projects";
|
|
355
355
|
const canSwitch = options.sensitive !== true && chrome.csrf !== undefined && chrome.csrf !== "" && chrome.projects !== undefined;
|
|
356
356
|
const switcherMenu = (foot) => {
|
|
@@ -380,14 +380,14 @@ ${scopeStatus}</div>`;
|
|
|
380
380
|
${count !== undefined && count > 0 ? html ` <span${chrome.inboxLabel === undefined ? "" : html ` aria-label="${chrome.inboxLabel}" title="${chrome.inboxLabel}"`} class="count badge badge-open">${count}${chrome.inboxSaturated ? "+" : ""}</span>` : ""}</a>`;
|
|
381
381
|
const side = joinHtml([
|
|
382
382
|
html `<aside class="side">`,
|
|
383
|
-
html `<div class="side-head"><a class="brand" href="${chrome.chat === true ? "/chat" : "/
|
|
383
|
+
html `<div class="side-head"><a class="brand" href="${chrome.chat === true ? "/chat" : "/"}"><span class="brand-long">Toolroll</span><span class="brand-short">T</span></a>`,
|
|
384
384
|
...(options.sidebarToggle === true
|
|
385
385
|
? [html `<button type="button" class="side-toggle" aria-label="collapse sidebar" aria-expanded="true" title="collapse sidebar">${strokeIcon(html `<path d="m15 18-6-6 6-6"/>`)}</button>`]
|
|
386
386
|
: []),
|
|
387
387
|
html `</div>`,
|
|
388
388
|
html `<nav>`,
|
|
389
389
|
...(chrome.chat ? [primaryItem("chat", "/chat", "Chat")] : []),
|
|
390
|
-
primaryItem("work", "/
|
|
390
|
+
primaryItem("work", "/", "Tasks", chrome.inboxCount),
|
|
391
391
|
...(advanced ? [primaryItem("flows", "/flows", "Flows")] : []),
|
|
392
392
|
primaryItem("projects", "/projects", "Projects"),
|
|
393
393
|
html `</nav>`,
|
|
@@ -417,7 +417,7 @@ ${postForm(update.dismissHref, html `<button type="submit">Dismiss</button>`, {
|
|
|
417
417
|
</div></div>`;
|
|
418
418
|
const mobileTop = joinHtml([
|
|
419
419
|
html `<header class="mobile-top">`,
|
|
420
|
-
html `<a class="brand-mini" href="${chrome.chat === true ? "/chat" : "/
|
|
420
|
+
html `<a class="brand-mini" href="${chrome.chat === true ? "/chat" : "/"}">T</a>`,
|
|
421
421
|
canSwitch
|
|
422
422
|
? html `<details class="project-pill switcher"><summary><span class="name">${scopeName}${CHEVRON_ICON}</span>${scopeCounts === null ? "" : html `<span class="pill-status">${scopeCounts}</span>`}</summary>${switcherMenu(html `<a class="manage" href="/projects">manage projects</a>`)}</details>`
|
|
423
423
|
: html `<a class="project-pill" href="/projects"><span class="name">${scopeName}</span>${scopeCounts === null ? "" : html `<span class="pill-status">${scopeCounts}</span>`}</a>`,
|
|
@@ -437,7 +437,7 @@ ${count !== undefined && count > 0 ? html `<span class="dot-badge" role="img" ar
|
|
|
437
437
|
const tabbar = joinHtml([
|
|
438
438
|
html `<nav class="tabbar">`,
|
|
439
439
|
...(chrome.chat ? [tab("chat", "/chat", "Chat")] : []),
|
|
440
|
-
tab("work", "/
|
|
440
|
+
tab("work", "/", "Tasks", chrome.inboxCount),
|
|
441
441
|
...(advanced ? [tab("flows", "/flows", "Flows")] : []),
|
|
442
442
|
tab("projects", "/projects", "Projects"),
|
|
443
443
|
html `</nav>`,
|
|
@@ -483,7 +483,7 @@ export const GRIP_ICON = html `<svg viewBox="0 0 24 24" fill="currentColor" aria
|
|
|
483
483
|
export const TO_FRONT_ICON = html `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">\
|
|
484
484
|
<path d="M12 19V5"/><path d="m5 12 7-7 7 7"/></svg>`;
|
|
485
485
|
export const strokeIcon = (paths) => html `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${paths}</svg>`;
|
|
486
|
-
export const QUEUE_VIEW = "
|
|
486
|
+
export const QUEUE_VIEW = "/?view=order";
|
|
487
487
|
export const FOLDER_PATHS = html `<path d="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"/>`;
|
|
488
488
|
export const CHAT_PATHS = html `<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>`;
|
|
489
489
|
export const WORK_PATHS = html `<path d="M9 6h11"/><path d="M9 12h11"/><path d="M9 18h11"/><path d="m4 6 1 1 2-2"/><path d="m4 12 1 1 2-2"/><path d="m4 18 1 1 2-2"/>`;
|
|
@@ -498,10 +498,10 @@ export function workToolRows(scoped = false, _offersChat = false, offersCode = f
|
|
|
498
498
|
const rows = [
|
|
499
499
|
...(offersCode && advanced ? [{ key: "code", href: "/term", label: "Live", hint: "your own terminals: Claude Code, Codex or a shell" }] : []),
|
|
500
500
|
{ key: "inbox", href: "/", label: "Home", hint: "what needs you, what runs, and what waits" },
|
|
501
|
-
{ key: "board", href: "
|
|
502
|
-
{ key: "tasks", href: "/
|
|
501
|
+
{ key: "board", href: "/?view=board", label: "Board", hint: "lanes by state, with the order view" },
|
|
502
|
+
{ key: "tasks", href: "/", label: "Task list", hint: "everything, filterable by state" },
|
|
503
503
|
{ key: "recipes", href: "/recipes", label: "Recipes", hint: "choose, customize, and reuse a workflow" },
|
|
504
|
-
{ key: "workbench", href: "/
|
|
504
|
+
{ key: "workbench", href: "/", label: "Every project", hint: "every project's tasks in one list" },
|
|
505
505
|
{ key: "ledger", href: "/ledger", label: "Audit log", hint: "who acted, what happened, and the result" },
|
|
506
506
|
{ key: "spend", href: "/spend", label: "Spend", hint: "what agent work cost, and monthly budgets" },
|
|
507
507
|
];
|
|
@@ -511,13 +511,13 @@ export function workToolRows(scoped = false, _offersChat = false, offersCode = f
|
|
|
511
511
|
export function settingsRows(scoped = false, offersSettings = false, advanced = true) {
|
|
512
512
|
const rows = [
|
|
513
513
|
...(offersSettings ? [{ key: "settings", href: "/settings", label: "Settings", hint: "agent defaults, alerts, credentials" }] : []),
|
|
514
|
-
{ key: "fleet", href: "/
|
|
514
|
+
{ key: "fleet", href: "/settings/computers", label: "Computers", hint: "the computers that build, and connecting one" },
|
|
515
515
|
{ key: "caps", href: "/caps", label: "Requirements", hint: "tools and credentials builds need" },
|
|
516
516
|
{ key: "people", href: "/people", label: "People", hint: "who can sign in, and what they have done" },
|
|
517
517
|
{ key: "mode", href: "/mode", label: "Operating mode", hint: "how much this project may do without asking" },
|
|
518
518
|
{ key: "system", href: "/system", label: "System", hint: "workers, providers, and grants" },
|
|
519
519
|
];
|
|
520
|
-
const shown = advanced ? rows : rows.filter(row => row.key !== "
|
|
520
|
+
const shown = advanced ? rows : rows.filter(row => row.key !== "mode");
|
|
521
521
|
return scoped ? shown.filter(row => row.key === "people" || row.key === "settings") : shown;
|
|
522
522
|
}
|
|
523
523
|
export const TOOL_KEYS = new Set(["code", "inbox", "board", "queue", "tasks", "workbench", "recipes", "ledger", "spend"]);
|
|
@@ -525,8 +525,8 @@ export const SETTINGS_KEYS = new Set(["settings", "fleet", "caps", "people", "mo
|
|
|
525
525
|
export function buildsViews(current) {
|
|
526
526
|
const views = [
|
|
527
527
|
["builds", "/runs", "builds"],
|
|
528
|
-
["done", "
|
|
529
|
-
["review", "
|
|
528
|
+
["done", "/?view=done", "done"],
|
|
529
|
+
["review", "/?view=ready", "review"],
|
|
530
530
|
["activity", "/activity", "activity"],
|
|
531
531
|
];
|
|
532
532
|
return html `<p class="meta board-view">${joinHtml(views.map(([key, href, label]) => (key === current ? html `<strong>${label}</strong>` : html `<a href="${href}">${label}</a>`)), " \u00b7 ")}</p>`;
|
package/dist/server/guards.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { syncProjectIdentities } from "../project-identity.js";
|
|
2
2
|
import { OWNER_ACTIONS, sharedActionPayload } from '../chat-actions.js';
|
|
3
3
|
import { CONSOLE_FORMS, readForm } from "../contracts/console-api.js";
|
|
4
|
+
import { accountAccessOf } from "../store.js";
|
|
4
5
|
import { timingSafeEqual } from "node:crypto";
|
|
5
6
|
import {} from "node:http";
|
|
6
7
|
import { tokenLive, tokenProjects } from "../api-tokens.js";
|
|
@@ -41,9 +42,9 @@ export function createSharedGuards(runtime) {
|
|
|
41
42
|
return rowVisible(runtime.liveCeiling(), repo) && (actor === undefined || runtime.store.accountCanAccess(actor, repo));
|
|
42
43
|
};
|
|
43
44
|
function codingProjectAllowed(repo) { return runtime.codingProjects().includes(repo); }
|
|
44
|
-
const admissionList = () => restricted() ? [...(runtime.store.accountOf(requestContext.getStore().actor)?.projects ?? [])].filter(
|
|
45
|
+
const admissionList = () => restricted() ? [...(runtime.store.accountOf(requestContext.getStore().actor)?.projects ?? [])].filter(visibleNow()) : runtime.unscopedMode
|
|
45
46
|
? null
|
|
46
|
-
: [...new Set([...runtime.managedRepos(), ...(runtime.ceiling.roots.length === 0 ? [] : runtime.store.knownRepos().filter(
|
|
47
|
+
: [...new Set([...runtime.managedRepos(), ...(runtime.ceiling.roots.length === 0 ? [] : runtime.store.knownRepos().filter(visibleNow()))])];
|
|
47
48
|
const taskRepoOf = (taskRef) => runtime.store.refForId(taskRef)?.repo ?? null;
|
|
48
49
|
function authorizeMutation(request, who, body) {
|
|
49
50
|
if (who.via === "bearer") {
|
|
@@ -217,7 +218,7 @@ export function createSharedGuards(runtime) {
|
|
|
217
218
|
if (url.searchParams.get("view") === "order")
|
|
218
219
|
url.searchParams.delete("view");
|
|
219
220
|
}
|
|
220
|
-
if (route.id === "tasks" && url.searchParams.get("view") === "order")
|
|
221
|
+
if ((route.id === "tasks" || route.id === "home") && url.searchParams.get("view") === "order")
|
|
221
222
|
url.searchParams.set("view", "board");
|
|
222
223
|
return true;
|
|
223
224
|
}
|
|
@@ -326,5 +327,10 @@ export function createSharedGuards(runtime) {
|
|
|
326
327
|
}
|
|
327
328
|
function identities() { return runtime.identities ?? syncIdentities; }
|
|
328
329
|
function savedIdentities() { return runtime.managedRepos(); }
|
|
329
|
-
|
|
330
|
+
const visibleNow = () => {
|
|
331
|
+
const actor = requestContext.getStore()?.actor;
|
|
332
|
+
const ceiling = runtime.liveCeiling(), reaches = actor === undefined ? null : accountAccessOf(runtime.store, actor);
|
|
333
|
+
return repo => rowVisible(ceiling, repo) && (reaches === null || reaches(repo));
|
|
334
|
+
};
|
|
335
|
+
return { authenticateApprover, authenticateCredential, authorizeMutation, projectOf, resolveRouteProject, projectRequestAllowed, identify, lookupSession, restricted, visible, visibleNow, admissionList, codingActorAllowed, codingProjectAllowed, workAccess, familyOf, taskRepoOf, runVisible };
|
|
330
336
|
}
|
package/dist/server/home.js
CHANGED
|
@@ -4,6 +4,7 @@ import { projectName } from "../project.js";
|
|
|
4
4
|
import { workIndexPage } from "../work-index.js";
|
|
5
5
|
import { oneLineOf, relativeAge } from "./chrome.js";
|
|
6
6
|
import { taskHref } from "./http.js";
|
|
7
|
+
import { taskLinkOf } from "../task-link.js";
|
|
7
8
|
import { NO_HOME_ASKS, releaseSheetHref } from "./home-asks.js";
|
|
8
9
|
export const HOME_NEEDS_SHOWN = 30;
|
|
9
10
|
const HOME_RUNNING_SHOWN = 8;
|
|
@@ -38,13 +39,13 @@ export function startOfToday(now) {
|
|
|
38
39
|
function rowOf(store, item, now, multi, canAnswer, closedDoor, state, release) {
|
|
39
40
|
if (state === "needs" && item.askGroup === "release" && release !== null) {
|
|
40
41
|
const href = releaseSheetHref(item.activeTaskId);
|
|
41
|
-
return { id: item.rootId, title: item.title, href, state, ask: "release", reason: null,
|
|
42
|
+
return { id: item.rootId, title: item.title, href, state, ask: "release", group: "decide", reason: null,
|
|
42
43
|
project: multi || item.repo === null ? (item.repo === null ? "Unplaced" : projectName(item.repo)) : null,
|
|
43
44
|
age: relativeAge(item.updatedAt, now), line: release(item.activeTaskId), action: { label: "Review the release", href }, question: null };
|
|
44
45
|
}
|
|
45
46
|
const action = item.primaryAction;
|
|
46
47
|
const href = action?.code === "open-result" && action.target.runId != null
|
|
47
|
-
?
|
|
48
|
+
? taskLinkOf({ task: action.target.taskId, run: action.target.runId }) : browserWorkActionHref(item);
|
|
48
49
|
const decisionId = action?.target.decisionId ?? null;
|
|
49
50
|
const decision = decisionId === null ? null : store.getDecision(decisionId);
|
|
50
51
|
const open = decision !== null && decision.state === "open" && decision.supersededReason === null;
|
|
@@ -58,13 +59,17 @@ function rowOf(store, item, now, multi, canAnswer, closedDoor, state, release) {
|
|
|
58
59
|
const reason = ask === "wrong" ? oneLineOf((said !== null && said !== NO_REASON_RECORDED ? said : item.status.label).replace(/[.\s]+$/, ""), 120) : null;
|
|
59
60
|
const door = state === "needs" && action?.code === "approve-scope" ? closedDoor(action.target.taskId) : null;
|
|
60
61
|
return {
|
|
61
|
-
id: item.rootId, title: item.title, href: taskHref(item.rootId), state, ask, reason,
|
|
62
|
+
id: item.rootId, title: item.title, href: taskHref(item.rootId), state, ask, ...(state === "needs" && item.ask !== null ? { group: item.ask } : {}), reason,
|
|
62
63
|
project: multi || item.repo === null ? (item.repo === null ? "Unplaced" : projectName(item.repo)) : null,
|
|
63
64
|
age: relativeAge(item.updatedAt, now), line: door === null ? line : door.title,
|
|
64
65
|
action: door !== null ? { label: door.road === "agents" ? "Change the agents" : "Edit the plan", href: `${taskHref(action.target.taskId)}#${door.road === "agents" ? "agents" : "scope"}` }
|
|
65
66
|
: href === null || action === null ? null : { label: action.label, href }, question,
|
|
66
67
|
};
|
|
67
68
|
}
|
|
69
|
+
function askRowOf(one, ask, multi, now) {
|
|
70
|
+
return { id: one.id, title: one.title, href: one.href, state: "needs", ask, group: WORK_GROUP_OF_ASK[ask], reason: null,
|
|
71
|
+
project: multi && one.repo !== null ? projectName(one.repo) : null, age: one.at === null ? "" : relativeAge(one.at, now), line: one.line, action: one.action, question: null };
|
|
72
|
+
}
|
|
68
73
|
export function homeView(facts) {
|
|
69
74
|
const { store, now, access, project } = facts;
|
|
70
75
|
const read = (view, limit, completedSince) => workIndexPage(store, now, access, { view, limit, project, ...(completedSince === undefined ? {} : { completedSince }),
|
|
@@ -100,8 +105,7 @@ export function homeView(facts) {
|
|
|
100
105
|
const multi = project === null && new Set([...yours, ...live, ...queued, ...done].map(one => one.repo ?? "").concat(extra.flatMap(one => one.repo === null ? [] : [one.repo]))).size > 1;
|
|
101
106
|
const row = (item, state) => rowOf(store, item, now, multi, facts.canAnswer, facts.closedDoor, state, approver ? asks.release : null);
|
|
102
107
|
const rows = yours.map(one => row(one, "needs"));
|
|
103
|
-
const askRow = (one, ask) => (
|
|
104
|
-
project: multi && one.repo !== null ? projectName(one.repo) : null, age: one.at === null ? "" : relativeAge(one.at, now), line: one.line, action: one.action, question: null });
|
|
108
|
+
const askRow = (one, ask) => askRowOf(one, ask, multi, now);
|
|
105
109
|
const askTotals = {
|
|
106
110
|
release: (approver ? needs.asks.release : 0) + held.length, approve: needs.asks.approve + (approver ? 0 : needs.asks.release), answer: needs.asks.answer,
|
|
107
111
|
flow: flows.length, wrong: needs.asks.wrong, review: needs.asks.review, setup: setup.length, other: needs.asks.other,
|
|
@@ -136,3 +140,31 @@ export function homeView(facts) {
|
|
|
136
140
|
empty: any || others > 0 ? null : { title: "No tasks yet", text: "Describe a change in a sentence; an agent writes a plan for you to approve." },
|
|
137
141
|
};
|
|
138
142
|
}
|
|
143
|
+
export const WORK_GROUP_OF_ASK = {
|
|
144
|
+
release: "decide", approve: "decide", answer: "decide", flow: "decide", review: "review", wrong: "unblock", setup: "unblock", other: "unblock",
|
|
145
|
+
};
|
|
146
|
+
export const WORK_GROUP_LABEL = { decide: "Decide", review: "Review", unblock: "Unblock" };
|
|
147
|
+
const WORK_GROUP_ORDER = ["decide", "review", "unblock"];
|
|
148
|
+
export function workNeeds(facts, page, filtered) {
|
|
149
|
+
const { store, now, project } = facts;
|
|
150
|
+
const yours = page.items.filter(one => one.status.views.includes("needs-you") && one.archived === undefined);
|
|
151
|
+
const approver = facts.approver ?? facts.canAnswer;
|
|
152
|
+
const asks = facts.asks ?? NO_HOME_ASKS;
|
|
153
|
+
const held = approver && !filtered ? asks.held : [], flows = approver && !filtered ? asks.flows : [];
|
|
154
|
+
const setup = approver && !filtered ? asks.setup.filter(one => one.key !== "builder" || page.builderWaits === 0) : [];
|
|
155
|
+
const multi = project === null && new Set(yours.map(one => one.repo ?? "").concat([...held, ...flows, ...setup].flatMap(one => one.repo === null ? [] : [one.repo]))).size > 1;
|
|
156
|
+
const rows = [
|
|
157
|
+
...yours.map(one => rowOf(store, one, now, multi, facts.canAnswer, facts.closedDoor, "needs", approver ? asks.release : null)),
|
|
158
|
+
...held.map(one => askRowOf(one, "release", multi, now)), ...flows.map(one => askRowOf(one, "flow", multi, now)), ...setup.map(one => askRowOf(one, "setup", multi, now)),
|
|
159
|
+
];
|
|
160
|
+
const groupOf = (row) => row.group ?? WORK_GROUP_OF_ASK[row.ask ?? "other"];
|
|
161
|
+
const extra = { decide: held.length + flows.length, review: 0, unblock: setup.length };
|
|
162
|
+
const groups = WORK_GROUP_ORDER.flatMap(key => {
|
|
163
|
+
const listed = rows.filter(row => groupOf(row) === key);
|
|
164
|
+
const count = Math.max(page.groups[key] + extra[key], listed.length);
|
|
165
|
+
return count === 0 ? [] : [{ key, label: WORK_GROUP_LABEL[key], count, rows: listed }];
|
|
166
|
+
});
|
|
167
|
+
const tasks = page.totals["needs-you"];
|
|
168
|
+
const any = page.totals.all > 0 || page.totals.completed > 0 || (page.totals.archived ?? 0) > 0;
|
|
169
|
+
return { groups, total: tasks + held.length + flows.length + setup.length, tasks, any };
|
|
170
|
+
}
|
package/dist/server/http.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { html, htmlString, isHtml } from "../html.js";
|
|
2
2
|
import { chatResultHref as sharedResultHref } from "../chat-controls.js";
|
|
3
|
+
import { taskLinkOf } from "../task-link.js";
|
|
3
4
|
import {} from "../cli-http.js";
|
|
4
5
|
import {} from "../coding-workspace.js";
|
|
5
6
|
import { hasForbiddenControls } from "../decision.js";
|
|
@@ -115,7 +116,7 @@ export function safeReturn(raw) {
|
|
|
115
116
|
}
|
|
116
117
|
return raw;
|
|
117
118
|
}
|
|
118
|
-
export const LOGIN_RETURN_PAGES = /^\/(oauth\/authorize|t\/[^/]+|r\/[1-9]\d*|code(?:\/[a-f0-9]{32}(?:\/ship)?)?|review|chat|tasks|work|board|projects|routines|recipes|fleet|settings(\/[a-z-]+)?|mode)$/;
|
|
119
|
+
export const LOGIN_RETURN_PAGES = /^\/(oauth\/authorize|t\/[^/]+|r\/[1-9]\d*|code(?:\/[a-f0-9]{32}(?:\/ship)?)?|review|chat|tasks|work|board|projects|routines|recipes|fleet|settings(\/[a-z-]+|\/change\/[a-z-]+)?|mode)$/;
|
|
119
120
|
export function loginReturn(raw) {
|
|
120
121
|
const safe = safeReturn(raw);
|
|
121
122
|
if (safe === "/")
|
|
@@ -178,8 +179,9 @@ export function chatReturnWithSaid(back, said) {
|
|
|
178
179
|
return `${back}${back.includes("?") ? "&" : "?"}said=${encodeURIComponent(said)}`;
|
|
179
180
|
}
|
|
180
181
|
export const chatReturnWithLatest = (back) => `${back}#latest`;
|
|
181
|
-
export const reviewHref = (taskId, runId = null) =>
|
|
182
|
+
export const reviewHref = (taskId, runId = null) => taskLinkOf({ task: taskId, run: runId, result: true });
|
|
182
183
|
export const chatResultHref = (taskId, runId, tab = "summary") => sharedResultHref(taskId, runId, tab);
|
|
184
|
+
export const chatPanelResultHref = (taskId, runId, tab = "summary") => `/chat?task=${encodeURIComponent(taskId)}&result=${runId}${tab === "summary" ? "" : `&tab=${tab}`}`;
|
|
183
185
|
export async function form(request, cap = BODY_CAP) {
|
|
184
186
|
const chunks = [];
|
|
185
187
|
let size = 0;
|
package/dist/server/in-place.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
const SETTINGS_PAGES = [
|
|
2
2
|
"settings.page",
|
|
3
|
-
...["general", "agents", "alerts", "projects", "access", "system"].map(one => `settings.group-${one}`),
|
|
3
|
+
...["general", "agents", "computers", "alerts", "projects", "access", "system"].map(one => `settings.group-${one}`),
|
|
4
4
|
...["models", "tools", "project", "approval", "policy", "sessions", "integrations", "monitoring", "updates", "retention", "storage",
|
|
5
5
|
"pull-requests", "checks", "backups", "data", "sign-in", "lead", "teams", "discord", "slack",
|
|
6
6
|
"skills", "flows", "knowledge", "learning", "spend", "passwordless"].map(one => `settings.${one}`),
|
|
7
7
|
];
|
|
8
|
-
export const IN_PLACE_ROUTES = new Set(["home", "
|
|
9
|
-
export const PREFETCH_ROUTES = new Set(["home", "
|
|
8
|
+
export const IN_PLACE_ROUTES = new Set(["home", "task.page", "projects.page", "agents", "search", ...SETTINGS_PAGES]);
|
|
9
|
+
export const PREFETCH_ROUTES = new Set(["home", "projects.page", "agents", "search", "task.page"]);
|
|
10
10
|
const liveGrid = (id, url) => id === "agents" && url.searchParams.get("view") === "live";
|
|
11
|
+
const changeDocument = (id) => id.startsWith("settings.change.");
|
|
11
12
|
export function inPlaceRoute(id, url) {
|
|
12
|
-
return id !== undefined && IN_PLACE_ROUTES.has(id) && !liveGrid(id, url);
|
|
13
|
+
return id !== undefined && IN_PLACE_ROUTES.has(id) && !changeDocument(id) && !liveGrid(id, url);
|
|
13
14
|
}
|
|
14
15
|
const openedAgent = (id, url) => id === "agents" && url.searchParams.has("run");
|
|
15
16
|
export function prefetchRoute(id, url) {
|
package/dist/server/kit.js
CHANGED
|
@@ -158,7 +158,7 @@ export const card = (options) => html `<a class="k-card" href="${options.href}">
|
|
|
158
158
|
export function notFound(path, options = {}) {
|
|
159
159
|
return html `${pageHeader("Not found")}<div class="k-nf">${empty({
|
|
160
160
|
title: options.title ?? NOT_FOUND.title(path), text: options.text ?? NOT_FOUND.text,
|
|
161
|
-
action: acts(btn("Go to
|
|
161
|
+
action: acts(btn("Go to Work", { sm: true, href: "/" })),
|
|
162
162
|
})}</div>`;
|
|
163
163
|
}
|
|
164
164
|
export function settingsShell(options) {
|
|
@@ -265,7 +265,7 @@ export function ideas(options) {
|
|
|
265
265
|
}
|
|
266
266
|
export function settingsSection(options) {
|
|
267
267
|
const head = `${options.id}-h`;
|
|
268
|
-
return html `<section class="k-ssec" id="${options.id}" aria-labelledby="${head}"><div class="k-secthead"><h3 id="${head}">${options.title}\
|
|
268
|
+
return html `<section class="k-ssec" id="${options.id}" aria-labelledby="${head}"${attributes(options.attrs ?? {})}><div class="k-secthead"><h3 id="${head}">${options.title}\
|
|
269
269
|
${options.state ? html `<span class="k-ssec-state">${options.state}</span>` : ""}</h3>${options.right ?? ""}</div>\
|
|
270
270
|
${options.lead ? html `<p class="k-ssec-lead">${options.lead}</p>` : ""}${options.body}</section>`;
|
|
271
271
|
}
|