toolroll 0.9.108 → 0.9.110
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 +69 -0
- package/dist/advanced-view.js +0 -1
- package/dist/agent-detect.js +244 -0
- package/dist/agent-fence.js +47 -5
- package/dist/agent-state.js +5 -2
- package/dist/agentconfig.js +2 -2
- package/dist/approval-summary.js +344 -0
- package/dist/assignment-ui.js +5 -5
- package/dist/assignment.js +5 -2
- package/dist/attest.js +2 -2
- package/dist/browser/terminal.js +1 -1
- package/dist/browser/workspace.css +2 -2
- package/dist/browser/workspace.js +37 -34
- package/dist/browser-crew.js +4 -4
- package/dist/browser-workspace.js +4 -11
- package/dist/builder.js +45 -3
- package/dist/chat-actions.js +24 -17
- package/dist/chat-controls.js +6 -5
- package/dist/chat-core.js +3 -1
- package/dist/chat-decide.js +102 -47
- package/dist/chat-delivery-state.js +2 -0
- package/dist/chat-delivery.js +3 -2
- package/dist/chat-live.js +2 -1
- package/dist/chat-quiet.js +3 -3
- package/dist/chat-task-actions.js +6 -0
- package/dist/chat-voice.js +2 -2
- package/dist/check-report.js +1 -1
- package/dist/cli-help.js +12 -13
- package/dist/cli.js +6 -3
- package/dist/console-chrome.js +10 -3
- package/dist/console-instance.js +10 -1
- package/dist/contracts/console-api.js +14 -8
- package/dist/contracts/engine-api.js +271 -0
- package/dist/contracts/handoff.js +4 -0
- package/dist/coordinator.js +2 -2
- 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/discord-api.js +4 -3
- package/dist/discord-chat.js +3 -1
- package/dist/dispatch.js +3 -8
- package/dist/easy-start-args.js +7 -3
- package/dist/easy-start.js +25 -0
- package/dist/egress.js +72 -10
- package/dist/engine-handoff.js +34 -0
- package/dist/engine-reads.js +261 -0
- package/dist/eval-world.js +3 -2
- package/dist/evidence.js +2 -0
- package/dist/fast-start.js +55 -14
- package/dist/fast-terms.js +2 -2
- package/dist/first-run.js +10 -2
- package/dist/flexible-agents.js +234 -0
- package/dist/flexible-answers-schema.js +61 -0
- package/dist/flexible-answers.js +889 -0
- package/dist/flexible-available.js +1 -0
- package/dist/flexible-custody.js +494 -0
- package/dist/flexible-import.js +782 -0
- package/dist/flexible-launch-schema.js +72 -0
- package/dist/flexible-launch.js +331 -0
- package/dist/flexible-launcher.js +88 -0
- package/dist/flexible-levels.js +34 -0
- package/dist/flexible-merge-guard.js +47 -0
- package/dist/flexible-refs.js +47 -0
- package/dist/flexible-relay-cancel.js +19 -0
- package/dist/flexible-relay-schema.js +55 -0
- package/dist/flexible-relay-upstreams.js +36 -0
- package/dist/flexible-relay.js +1032 -0
- package/dist/flexible-schema.js +32 -0
- package/dist/flexible-session.js +732 -0
- package/dist/flexible-ship-schema.js +81 -0
- package/dist/flexible-ship.js +694 -0
- package/dist/flexible-start.js +80 -0
- package/dist/flexible-thread-schema.js +30 -0
- package/dist/flexible-thread.js +676 -0
- package/dist/flexible-turns-schema.js +69 -0
- package/dist/flexible-turns.js +490 -0
- package/dist/flexible-ui.js +44 -0
- package/dist/flexible.js +368 -0
- package/dist/flow-actions.js +6 -4
- package/dist/flow-steps.js +1 -1
- package/dist/flows-cli.js +2 -1
- package/dist/git-views.js +44 -41
- package/dist/guides.js +11 -10
- package/dist/install-mode.js +225 -0
- package/dist/keymap.js +1 -1
- package/dist/lead-context.js +1 -1
- package/dist/lead-doors.js +7 -1
- package/dist/limits-ui.js +8 -1
- package/dist/live-bus.js +70 -13
- package/dist/live-reply.js +6 -0
- package/dist/live-terminal.js +425 -29
- package/dist/local-owner.js +6 -0
- package/dist/model-choices.js +12 -6
- package/dist/needs-you.js +3 -3
- package/dist/nightly-github.js +2 -2
- package/dist/notification-delivery.js +11 -0
- package/dist/operate.js +185 -33
- package/dist/outbound-privacy.js +204 -0
- package/dist/passwordless.js +2 -1
- package/dist/project-delete-ui.js +2 -1
- package/dist/project-delete.js +15 -0
- package/dist/provider-auth.js +1 -1
- package/dist/provider-connection.js +5 -3
- package/dist/publish.js +5 -0
- package/dist/pull-request-flow.js +26 -7
- package/dist/push.js +5 -1
- package/dist/release-card.js +11 -3
- package/dist/release.js +11 -1
- 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-store.js +2 -2
- package/dist/sandbox-launch.js +32 -8
- package/dist/sandbox-runtime.js +16 -7
- package/dist/sandbox-tools.js +176 -0
- package/dist/scope.js +12 -36
- package/dist/scout-net.js +7 -2
- package/dist/serve.js +90 -40
- package/dist/server/chat.js +9 -9
- package/dist/server/chrome.js +19 -17
- package/dist/server/console.css +33 -6
- package/dist/server/engine-api.js +378 -0
- package/dist/server/flows.js +2 -2
- package/dist/server/guards.js +10 -4
- package/dist/server/home.js +37 -5
- package/dist/server/http.js +11 -2
- package/dist/server/in-place.js +5 -4
- package/dist/server/kit.js +2 -2
- package/dist/server/link-redemption.js +52 -0
- package/dist/server/live.js +100 -10
- package/dist/server/mutation-key.js +21 -7
- package/dist/server/pages.js +129 -74
- package/dist/server/people-tokens.js +17 -41
- package/dist/server/render-chat.js +2 -1
- package/dist/server/render-history.js +18 -4
- package/dist/server/render-new-task.js +4 -4
- package/dist/server/render-pages.js +21 -39
- package/dist/server/render-people.js +2 -2
- package/dist/server/render-projects.js +5 -5
- package/dist/server/render-results.js +30 -14
- package/dist/server/render-tasks.js +155 -155
- package/dist/server/retired-routes.js +37 -4
- package/dist/server/route-policy.js +8 -0
- package/dist/server/route-table.js +43 -5
- package/dist/server/settings-computers.js +140 -0
- package/dist/server/settings-scripts.js +15 -0
- package/dist/server/settings-section-table.js +59 -0
- package/dist/server/settings-sections.js +291 -0
- package/dist/server/settings.js +247 -28
- package/dist/server/task-views.js +55 -15
- package/dist/server/tasks.js +168 -98
- package/dist/server/terminals.js +181 -28
- package/dist/server/welcome.js +40 -14
- package/dist/settings-groups-ui.js +26 -107
- package/dist/settings-proofs.js +18 -11
- package/dist/slack-api.js +4 -3
- package/dist/slack-chat.js +5 -3
- package/dist/spend.js +46 -12
- package/dist/sqlite-telemetry.js +70 -21
- package/dist/status-probe.js +343 -0
- package/dist/store.js +206 -10
- package/dist/task-link.js +64 -0
- package/dist/teams-api.js +4 -3
- package/dist/teams-chat.js +4 -2
- package/dist/telegram-lead.js +2 -1
- package/dist/telegram-live.js +2 -1
- package/dist/telegram-team.js +2 -1
- package/dist/telegram.js +17 -5
- package/dist/trusted-path.js +162 -0
- package/dist/tui/darwin-arm64/toolroll-tui +0 -0
- package/dist/tui/darwin-x64/toolroll-tui +0 -0
- package/dist/tui/linux-arm64/toolroll-tui +0 -0
- package/dist/tui/linux-x64/toolroll-tui +0 -0
- package/dist/tui-launch.js +282 -0
- package/dist/tui-source.js +5 -3
- package/dist/tui.js +2 -2
- package/dist/typed-words-schema.js +18 -0
- package/dist/webhooks.js +8 -4
- package/dist/welcome-facts.js +25 -17
- package/dist/work-index.js +126 -29
- package/dist/work-reads.js +279 -0
- package/dist/workspace-ui.js +5 -0
- package/package.json +4 -2
- package/scripts/crash-canary.mjs +1 -1
- package/scripts/pilot.mjs +1 -1
- package/scripts/provider-canary.mjs +5 -3
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { SAFETY } from "./http.js";
|
|
2
|
+
import { taskLinkFromLegacy, taskLinkOf } from "../task-link.js";
|
|
2
3
|
export function tasksHref(over = {}) {
|
|
3
4
|
const q = new URLSearchParams();
|
|
4
|
-
if (over.scope
|
|
5
|
-
q.set("scope", "all");
|
|
6
|
-
else if (over.project != null)
|
|
5
|
+
if (over.scope !== "all" && over.project != null)
|
|
7
6
|
q.set("project", over.project);
|
|
8
7
|
if (over.view != null && over.view !== "all")
|
|
9
8
|
q.set("view", over.view);
|
|
@@ -11,10 +10,26 @@ export function tasksHref(over = {}) {
|
|
|
11
10
|
q.set("state", over.state);
|
|
12
11
|
if (over.cursor != null)
|
|
13
12
|
q.set("cursor", over.cursor);
|
|
14
|
-
return
|
|
13
|
+
return `/${q.size === 0 ? "" : `?${q}`}`;
|
|
15
14
|
}
|
|
16
15
|
const projectOf = (url) => url.searchParams.getAll("project").length === 1 ? url.searchParams.get("project") : null;
|
|
17
16
|
const LIST_VIEWS = { all: "all", "needs-you": "needs-you", running: "running", queued: "queued", completed: "completed", done: "completed", archived: "archived", ready: "ready" };
|
|
17
|
+
export const SETTINGS_RETIRED = {
|
|
18
|
+
"settings.group-advanced": { to: "/settings/general", section: "advanced", keep: ["said", "problem"], open: true },
|
|
19
|
+
"start-builder": { to: "/settings/computers", section: "start", keep: ["task", "said", "problem"] },
|
|
20
|
+
};
|
|
21
|
+
export function settingsRetiredHref(retirement, url) {
|
|
22
|
+
const query = new URLSearchParams();
|
|
23
|
+
for (const key of retirement.keep) {
|
|
24
|
+
const values = url.searchParams.getAll(key);
|
|
25
|
+
if (values.length === 1)
|
|
26
|
+
query.set(key, values[0]);
|
|
27
|
+
}
|
|
28
|
+
query.set("section", retirement.section);
|
|
29
|
+
if (retirement.open === true)
|
|
30
|
+
query.set("open", "1");
|
|
31
|
+
return `${retirement.to}?${query}`;
|
|
32
|
+
}
|
|
18
33
|
export const RETIRED_ROUTES = {
|
|
19
34
|
work: url => {
|
|
20
35
|
const board = url.searchParams.get("layout") === "board";
|
|
@@ -30,8 +45,21 @@ export const RETIRED_ROUTES = {
|
|
|
30
45
|
queue: url => tasksHref({ view: "order", project: projectOf(url) }),
|
|
31
46
|
done: url => tasksHref({ view: "done", project: projectOf(url) }),
|
|
32
47
|
review: url => tasksHref({ view: "ready", project: projectOf(url) }),
|
|
48
|
+
tasks: url => {
|
|
49
|
+
const template = url.searchParams.get("template");
|
|
50
|
+
if (template !== null)
|
|
51
|
+
return `/tasks/new?template=${encodeURIComponent(template)}`;
|
|
52
|
+
return `/${url.search}`;
|
|
53
|
+
},
|
|
33
54
|
"work.put-away": url => { const days = url.searchParams.get("days"); return days !== null && /^[0-9]{1,3}$/.test(days) ? `/tasks/archive?days=${days}` : "/tasks/archive"; },
|
|
55
|
+
...Object.fromEntries(Object.entries(SETTINGS_RETIRED).map(([id, retirement]) => [id, (url) => settingsRetiredHref(retirement, url)])),
|
|
34
56
|
};
|
|
57
|
+
export const TASK_VIEW_REDIRECTS = {
|
|
58
|
+
review: (url) => url.searchParams.has("result") ? taskLinkFromLegacy(`${url.pathname}${url.search}`) : null,
|
|
59
|
+
"run.page": (url, taskId, runId) => url.searchParams.has("record") || url.searchParams.has("fragment") ? null : taskLinkOf({ task: taskId, run: runId, section: sectionOf(url.searchParams.get("tab")) }),
|
|
60
|
+
"task.evidence": (url, rootId) => url.searchParams.get("format") === "json" || url.searchParams.has("print") ? null : taskLinkOf({ task: rootId, record: true }),
|
|
61
|
+
};
|
|
62
|
+
const sectionOf = (raw) => raw === "changes" || raw === "checks" || raw === "summary" ? raw : null;
|
|
35
63
|
export function retiredRedirect(id, url, response) {
|
|
36
64
|
const to = RETIRED_ROUTES[id];
|
|
37
65
|
if (to === undefined)
|
|
@@ -40,3 +68,8 @@ export function retiredRedirect(id, url, response) {
|
|
|
40
68
|
response.writeHead(301, { ...SAFETY });
|
|
41
69
|
response.end();
|
|
42
70
|
}
|
|
71
|
+
export function retiredHandler(id) {
|
|
72
|
+
if (RETIRED_ROUTES[id] === undefined)
|
|
73
|
+
throw new Error(`no retired route ${id}`);
|
|
74
|
+
return async (ctx) => retiredRedirect(id, ctx.url, ctx.response);
|
|
75
|
+
}
|
|
@@ -14,6 +14,14 @@ export function evaluateRoutePolicy(route, principal, resolve, operationScope) {
|
|
|
14
14
|
return { ok: false, status: 403, reason: 'project' };
|
|
15
15
|
return { ok: true };
|
|
16
16
|
}
|
|
17
|
+
export function routePrincipalOf(who) {
|
|
18
|
+
return { caller: who.via, capability: who.via === 'bearer' && who.principal !== undefined ? who.principal.scope : who.role === 'approver' ? 'act' : 'read',
|
|
19
|
+
viewer: who.role === 'viewer', token: who.via === 'bearer' && who.principal !== undefined };
|
|
20
|
+
}
|
|
21
|
+
export function holdsRole(route, who, isOperator) {
|
|
22
|
+
return route.role === 'any' || ((!route.roleBrowser || who.via === 'cookie') &&
|
|
23
|
+
(route.role === 'approver' ? who.role === 'approver' : isOperator(who.name)));
|
|
24
|
+
}
|
|
17
25
|
const edgePolicy = new AsyncLocalStorage();
|
|
18
26
|
export function withEdgePolicy(route, run) { return edgePolicy.run({ route }, run); }
|
|
19
27
|
export function adapterPolicy(principal, scope, resolve = source => source === 'none' || source === 'adapter') {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CHANGE_DOCUMENTS } from "./settings-section-table.js";
|
|
1
2
|
const CONSOLE = ["cookie", "bearer"];
|
|
2
3
|
const exact = (path) => `^${path.replace(/[.*+?^${}()|[\]\\/]/g, m => (m === "/" ? "\\/" : `\\${m}`))}$`;
|
|
3
4
|
const sampleOf = (pattern) => {
|
|
@@ -46,6 +47,8 @@ const LOCAL_POSTS = Object.freeze({
|
|
|
46
47
|
"task.act.approve": "approve-plan",
|
|
47
48
|
"task.act.keep-grown": "approve-plan",
|
|
48
49
|
"decision.answer": "answer-question",
|
|
50
|
+
"agents.live.thread.answer": "answer-question",
|
|
51
|
+
"agents.live.thread.start": "start-thread",
|
|
49
52
|
"task.act.reply": "answer-question",
|
|
50
53
|
"task.act.stop": "stop-run",
|
|
51
54
|
"task.act.cancel": "stop-run",
|
|
@@ -60,6 +63,13 @@ const LOCAL_POSTS = Object.freeze({
|
|
|
60
63
|
"run.act.revise": "request-revision",
|
|
61
64
|
"run.act.note": "request-revision",
|
|
62
65
|
"run.act.comment": "request-revision",
|
|
66
|
+
"term.start": "take-over",
|
|
67
|
+
"term.close": "take-over",
|
|
68
|
+
"term.remove": "take-over",
|
|
69
|
+
"term.agent-sign-in": "agent-sign-in",
|
|
70
|
+
"term.agent-install": "agent-install",
|
|
71
|
+
"engine.agents-check": "check-agents",
|
|
72
|
+
"settings.models-agent": "change-models",
|
|
63
73
|
"task.act.archive": "archive-task",
|
|
64
74
|
"task.act.restore": "archive-task",
|
|
65
75
|
"projects.open": "add-project",
|
|
@@ -107,6 +117,7 @@ export const EDGE_LOCAL = Object.freeze({
|
|
|
107
117
|
"edge.desktop-health": { local: "allow", why: "public read" },
|
|
108
118
|
"edge.login-page": { local: "allow", why: "before sign-in" },
|
|
109
119
|
"edge.login-link": { local: "allow", why: "before sign-in: a one-time link" },
|
|
120
|
+
"edge.login-link-json": { local: "allow", why: "before sign-in: the same one-time local link, redeemed by a terminal client into the same local-owner session (engine-api.ts redeemLink)" },
|
|
110
121
|
"edge.sso-start": { local: "allow", why: "before sign-in" },
|
|
111
122
|
"edge.sso-callback": { local: "allow", why: "before sign-in" },
|
|
112
123
|
"edge.sso-finish": { local: "allow", why: "before sign-in" },
|
|
@@ -120,6 +131,7 @@ export const EDGE_LOCAL = Object.freeze({
|
|
|
120
131
|
"edge.password-set-page": { local: "allow", why: "reads only: the local owner's form for a first password, or \"already set — sign in\"" },
|
|
121
132
|
"edge.password-set": { local: "allow", why: "the one credential act a local owner may make: its first password (Origin, CSRF and key proved by the handler; enrollOwnerPassword re-checks local mode, the owner and password_set=0 in its own transaction); a session with a password set is refused" },
|
|
122
133
|
live: { local: "allow", why: "observational only; the agent watch lease is a keyed POST (agents.watch)" },
|
|
134
|
+
"live.ping": { local: "allow", why: "observational only: asks this session's own open stream for a pong; writes nothing" },
|
|
123
135
|
});
|
|
124
136
|
function localMarkOf(stage, method, id) {
|
|
125
137
|
if (stage === "edge") {
|
|
@@ -172,6 +184,7 @@ edge("pages", "edge.font", "GET", "^\\/fonts\\/geist-(sans|mono)-(400|500|600)\\
|
|
|
172
184
|
edge("pages", "edge.desktop-health", "GET", "/desktop/health");
|
|
173
185
|
edge("people", "edge.login-page", "GET", "/login");
|
|
174
186
|
edge("people", "edge.login-link", "GET", "^\\/login\\/once\\/[^/]+$", { sample: "/login/once/abc" });
|
|
187
|
+
edge("people", "edge.login-link-json", "POST", "/login/once");
|
|
175
188
|
edge("people", "edge.sso-start", "GET", "/login/sso");
|
|
176
189
|
edge("people", "edge.sso-callback", "GET", "/login/sso/callback", { callers: ["service"], proof: "adapter" });
|
|
177
190
|
edge("people", "edge.sso-finish", "GET", "/login/sso/finish");
|
|
@@ -206,6 +219,11 @@ get("pages", "projects.project", "^\\/projects\\/[^/]+$", { limited: "unscoped",
|
|
|
206
219
|
get("pages", "projects.map", "^\\/projects\\/[^/]+\\/map$", { limited: "unscoped", ...free, sample: "/projects/payments-api/map" });
|
|
207
220
|
get("pages", "projects.flaky", "^\\/projects\\/[^/]+\\/flaky$", { limited: "unscoped", ...free, sample: "/projects/payments-api/flaky" });
|
|
208
221
|
get("pages", "home", "/", { limited: "collection", ...free });
|
|
222
|
+
get("pages", "work.rows", "/work/rows", { limited: "collection", ...free });
|
|
223
|
+
get("pages", "engine.hello", "/engine/hello", { limited: "unscoped", ...free });
|
|
224
|
+
get("pages", "engine.agents", "/engine/agents", { limited: "unscoped", callers: ["cookie"], ...free });
|
|
225
|
+
get("settings", "engine.models", "/engine/models", { limited: "unscoped", callers: ["cookie"], ...free });
|
|
226
|
+
post("pages", "engine.agents-check", "/engine/agents/check", { limited: "unscoped", callers: ["cookie"], ...free });
|
|
209
227
|
get("pages", "search", "/search", { limited: "collection", ...free });
|
|
210
228
|
const RETIRED = { limited: "collection", ...free, retired: true };
|
|
211
229
|
get("tasks", "inbox", "/inbox", RETIRED);
|
|
@@ -227,13 +245,18 @@ get("tasks", "done", "/done", RETIRED);
|
|
|
227
245
|
get("settings", "mode", "/mode");
|
|
228
246
|
get("people", "people.page", "/people", { limited: "unscoped", ...free });
|
|
229
247
|
get("pages", "system", "/system", free);
|
|
230
|
-
get("pages", "start-builder", "/start-builder", { limited: "unscoped", ...free });
|
|
231
|
-
get("tasks", "tasks", "/tasks",
|
|
248
|
+
get("pages", "start-builder", "/start-builder", { limited: "unscoped", ...free, retired: true });
|
|
249
|
+
get("tasks", "tasks", "/tasks", RETIRED);
|
|
232
250
|
get("tasks", "queue", "/queue", RETIRED);
|
|
233
251
|
get("pages", "peek", "/peek", free);
|
|
234
252
|
get("pages", "agents", "/agents", { limited: "unscoped", ...free });
|
|
235
253
|
get("pages", "agents.live", "/agents/live", { limited: "unscoped", callers: ["cookie"], ...free });
|
|
236
254
|
get("pages", "agents.live.read", `^\\/agents\\/live\\/${ID}$`, { limited: "unscoped", callers: ["cookie"], ...free, sample: "/agents/live/1" });
|
|
255
|
+
get("pages", "agents.live.run", `^\\/agents\\/live\\/run\\/${ID}$`, { limited: "unscoped", callers: ["cookie"], ...free, sample: "/agents/live/run/1" });
|
|
256
|
+
get("pages", "agents.live.thread", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}$", { limited: "unscoped", callers: ["cookie"], ...free, sample: `/agents/live/thread/${"a".repeat(32)}` });
|
|
257
|
+
get("pages", "agents.live.threads", "/agents/live/threads", { limited: "unscoped", callers: ["cookie"], ...free });
|
|
258
|
+
post("pages", "agents.live.thread.answer", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/answer$", { limited: "unscoped", callers: ["cookie"], project: "none", sample: `/agents/live/thread/${"a".repeat(32)}/answer` });
|
|
259
|
+
post("pages", "agents.live.thread.start", "/agents/live/thread", { limited: "unscoped", callers: ["cookie"], project: "none", ...approver("An approver starts threads.") });
|
|
237
260
|
get("pages", "agents.terminals", "/agents/terminals", TERM);
|
|
238
261
|
get("pages", "fleet", "/fleet", free);
|
|
239
262
|
get("tasks", "tasks.new", "/tasks/new", { limited: "collection", ...free });
|
|
@@ -241,6 +264,8 @@ get("tasks", "welcome", "/welcome", { limited: "collection", ...free });
|
|
|
241
264
|
post("tasks", "welcome.sample", "/welcome/sample", { callers: ["cookie"], project: "none", ...approver("An approver adds projects.", "/welcome") });
|
|
242
265
|
get("tasks", "task.page", `^\\/t\\/${TASK}$`, { project: "task", limited: "resource", ...free, sample: "/t/one" });
|
|
243
266
|
get("tasks", "task.evidence", `^\\/t\\/${TASK}\\/evidence$`, { project: "task", limited: "resource", ...free, sample: "/t/one/evidence" });
|
|
267
|
+
get("tasks", "task.steps", `^\\/t\\/${TASK}\\/steps$`, { project: "task", limited: "resource", ...free, sample: "/t/one/steps" });
|
|
268
|
+
get("tasks", "task.diff", `^\\/t\\/${TASK}\\/diff$`, { project: "task", limited: "resource", ...free, sample: "/t/one/diff" });
|
|
244
269
|
get("tasks", "task.release", `^\\/t\\/${TASK}\\/release$`, { project: "task", limited: "resource", ...free, sample: "/t/one/release" });
|
|
245
270
|
get("tasks", "release.locate", `^\\/approve\\/${ID}$`, { project: "task-ref", limited: "resource", ...free, sample: "/approve/1" });
|
|
246
271
|
get("pages", "ledger.export", "/ledger/export", { limited: "unscoped", ...free });
|
|
@@ -268,6 +293,7 @@ for (const one of ["run", "start", "new", "edit", "from-task", "preview", "expor
|
|
|
268
293
|
get("flows", "recipes.other", "^\\/recipes\\/.*$", { sample: "/recipes/unknown" });
|
|
269
294
|
get("tasks", "routines", "/routines", { limited: "collection" });
|
|
270
295
|
edge("live", "live", "GET", "/live", { callers: ["cookie", "bearer"], scope: "read", project: "adapter", proof: "adapter" });
|
|
296
|
+
edge("live", "live.ping", "GET", "/live/ping", { callers: ["cookie"], scope: "read", project: "adapter", proof: "adapter" });
|
|
271
297
|
get("chat", "chat.mate-status", "/chat/mate/status", { ...free, role: "approver", roleBrowser: true, roleRefusal: SESSION_JSON });
|
|
272
298
|
get("chat", "chat.demo-live", "/chat/demo/live", free);
|
|
273
299
|
get("chat", "chat.page", "/chat", { project: "conversation", limited: "conversation", ...free });
|
|
@@ -300,8 +326,13 @@ get("settings", "settings.knowledge", "/settings/knowledge", { limited: "unscope
|
|
|
300
326
|
get("settings", "settings.learning", "/settings/learning", { limited: "unscoped", ...free });
|
|
301
327
|
get("settings", "settings.telegram", "/settings/telegram", { limited: "self", ...free, ...approver("An approver can pair their own phone.", "/settings") });
|
|
302
328
|
get("settings", "settings.page", "/settings", { limited: "unscoped", ...free });
|
|
303
|
-
for (const one of ["general", "agents", "alerts", "projects", "access", "system"
|
|
329
|
+
for (const one of ["general", "agents", "computers", "alerts", "projects", "access", "system"])
|
|
304
330
|
get("settings", `settings.group-${one}`, `/settings/${one}`, { limited: "unscoped", ...free });
|
|
331
|
+
get("settings", "settings.group-advanced", "/settings/advanced", { limited: "unscoped", ...free, retired: true });
|
|
332
|
+
for (const one of CHANGE_DOCUMENTS) {
|
|
333
|
+
const { local: _local, ...policy } = one.section.policy;
|
|
334
|
+
get("settings", `settings.change.${one.id}`, `/settings/change/${one.id}`, { ...policy });
|
|
335
|
+
}
|
|
305
336
|
get("pages", "health", "/health", { ...free, ...anyOperator("An instance operator reads server health.", "/") });
|
|
306
337
|
get("pages", "metrics", "/metrics", { ...free, ...anyOperator("An instance operator reads metrics.", "/") });
|
|
307
338
|
get("chat", "push.key", "/push/key");
|
|
@@ -320,6 +351,8 @@ post("settings", "settings.advanced", "/settings/advanced", { ...free, limited:
|
|
|
320
351
|
const CODING_ACT = { scope: "step-up", project: "coding", limited: "self" };
|
|
321
352
|
post("tasks", "code.start", "/code/start", CODING_ACT);
|
|
322
353
|
post("tasks", "term.start", "/term/start", { ...TERM, scope: "step-up" });
|
|
354
|
+
for (const one of ["sign-in", "install"])
|
|
355
|
+
post("tasks", `term.agent-${one}`, `/term/agent/${one}`, { ...TERM, scope: "step-up" });
|
|
323
356
|
for (const one of ["close", "remove"])
|
|
324
357
|
post("tasks", `term.${one}`, `^\\/term\\/${TERMINAL}\\/${one}$`, { ...TERM, sample: `/term/${"a".repeat(32)}/${one}` });
|
|
325
358
|
for (const one of ["send", "stop", "resume", "recover", "continue", "ship", "answer"])
|
|
@@ -376,12 +409,14 @@ post("settings", "settings.project-fallback", "/settings/project/fallback", { sc
|
|
|
376
409
|
post("settings", "settings.project-writes", "/settings/project/writes", { scope: "step-up", callers: ["cookie"] });
|
|
377
410
|
post("settings", "settings.project-check-access", "/settings/project/check-access", { scope: "step-up", callers: ["cookie"] });
|
|
378
411
|
post("settings", "settings.project-sandbox", "/settings/project/sandbox", { scope: "step-up", callers: ["cookie"] });
|
|
412
|
+
post("settings", "settings.project-flexible", "/settings/project/flexible", { project: "form", callers: ["cookie"], ...approver("An approver for this project changes how its work starts.", "/settings/project") });
|
|
379
413
|
post("settings", "settings.project-delete", "/settings/project/delete", { scope: "step-up", ...operator("An instance operator deletes projects.", "/settings/project") });
|
|
380
414
|
get("tasks", "sweep.page", "^\\/sweeps\\/[1-9][0-9]{0,9}$", { ...free, limited: "unscoped", sample: "/sweeps/1" });
|
|
381
415
|
post("tasks", "sweep.cancel-rest", "^\\/sweeps\\/[1-9][0-9]{0,9}\\/cancel-rest$", { limited: "unscoped", sample: "/sweeps/1/cancel-rest", ...approver("An approver cancels a sweep's work.", "/chat") });
|
|
382
416
|
get("settings", "settings.passwordless", "/settings/passwordless", { ...free, ...operator("An instance operator sets Passwordless.", "/settings") });
|
|
383
417
|
post("settings", "settings.passwordless-send", "/settings/passwordless", { callers: ["cookie"], ...operator("An instance operator sets Passwordless.", "/settings") });
|
|
384
|
-
post("settings", "settings.local-mode-off", "/settings/local-mode/off", { callers: ["cookie"], scope: "step-up", ...operator("An instance operator turns off local mode.", "/settings/
|
|
418
|
+
post("settings", "settings.local-mode-off", "/settings/local-mode/off", { callers: ["cookie"], scope: "step-up", ...operator("An instance operator turns off local mode.", "/settings/general?section=local-mode") });
|
|
419
|
+
post("settings", "settings.just-me", "/settings/install-mode/solo", { callers: ["cookie"], scope: "step-up", ...operator("An instance operator says it's just them.", "/settings/general?section=install-mode") });
|
|
385
420
|
post("settings", "settings.release-approval-send", "/settings/release-approval", { callers: ["cookie"], ...approver("An approver sets how releases are approved.", "/settings/approval") });
|
|
386
421
|
post("pages", "ledger.checkpoint", "/ledger/checkpoint", operator("An instance operator makes ledger checkpoints.", "/ledger"));
|
|
387
422
|
const SETTINGS_ACT_ROLES = {
|
|
@@ -443,9 +478,12 @@ for (const one of ["confirm", "save", "off"])
|
|
|
443
478
|
post("settings", `settings.chat-approval-${one}`, `/settings/chat-approval/${one}`, { limited: "self", callers: ["cookie"], ...(one === "save" ? { scope: "step-up" } : {}), ...approver("An approver turns on approving from their own chat.", "/settings") });
|
|
444
479
|
post("settings", "settings.telegram-pair", "/settings/telegram/pair", { limited: "self", scope: "step-up", ...approver("An approver can pair their own phone.", "/settings") });
|
|
445
480
|
post("settings", "settings.telegram-unpair", "/settings/telegram/unpair", { limited: "self", scope: "step-up", ...approver("An approver can pair their own phone.", "/settings") });
|
|
446
|
-
for (const one of ["messaging", "permission-default", "quality-default", "notifications", "notifications/mute", "telegram-digest", "provider-key
|
|
481
|
+
for (const one of ["messaging", "permission-default", "quality-default", "notifications", "notifications/mute", "telegram-digest", "provider-key-clear", "email-test", "email-read-test", "google/disconnect"]) {
|
|
447
482
|
post("settings", `settings.${one.replaceAll("/", "-")}-send`, `/settings/${one}`);
|
|
448
483
|
}
|
|
484
|
+
for (const one of ["provider-key", "telegram-token", "email", "google"]) {
|
|
485
|
+
post("settings", `settings.${one}-send`, `/settings/${one}`, { callers: ["cookie"], scope: "step-up" });
|
|
486
|
+
}
|
|
449
487
|
post("pages", "projects.github-list", "/projects/github", { callers: ["cookie"], ...anyApprover("your login can watch — adding projects is an approver's act") });
|
|
450
488
|
post("pages", "projects.select", "/projects/select", { project: "form-path", limited: "unscoped", viewer: true });
|
|
451
489
|
post("pages", "projects.map-refresh", "^\\/projects\\/[^/]+\\/map\\/refresh$", { project: "form", sample: "/projects/payments-api/map/refresh", ...approver("An approver asks for a check of main.", "/projects") });
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { plural, RESOURCE } from "../design/kit.js";
|
|
2
|
+
import { html, joinHtml, postForm } from "../html.js";
|
|
3
|
+
import { START_BUILDER_COMMAND } from "../needs-you.js";
|
|
4
|
+
import { kitSectionForm, textField } from "../settings-kit.js";
|
|
5
|
+
import { btn, chip, codeLine, doc, docHeader, facts, infoLine, note, notice, phoneHeader, select, settingsRecord, settingsSection } from "./kit.js";
|
|
6
|
+
import { changeDocumentOf, changeHref, sectionHref } from "./settings-section-table.js";
|
|
7
|
+
const AREA = "/settings/computers";
|
|
8
|
+
export const RUNNER_REGISTER = "runner-register";
|
|
9
|
+
const chipOf = (one) => one.retired ? chip("Retired") : chip(RESOURCE[one.state].word, RESOURCE[one.state].tone);
|
|
10
|
+
function lineOf(one, now, ago) {
|
|
11
|
+
const reserved = one.reserved.length > 0 ? ` · ${one.reserved.length} reserved` : "";
|
|
12
|
+
if (one.retired)
|
|
13
|
+
return `Retired${reserved}`;
|
|
14
|
+
if (one.state === "offline")
|
|
15
|
+
return `Stopped answering ${ago(one.heardAt, now)}${reserved}`;
|
|
16
|
+
const busy = one.building.length + one.hidden;
|
|
17
|
+
if (one.state === "building")
|
|
18
|
+
return `${busy} of ${one.capacity} building · heard ${ago(one.heardAt, now)}${reserved}`;
|
|
19
|
+
return `Free · ${plural(one.capacity, "slot", "slots")} · heard ${ago(one.heardAt, now)}${reserved}`;
|
|
20
|
+
}
|
|
21
|
+
function startSection(deps, subject) {
|
|
22
|
+
return {
|
|
23
|
+
loadSummary: ctx => {
|
|
24
|
+
const task = subject.task;
|
|
25
|
+
const repo = task?.repo ?? ctx.project;
|
|
26
|
+
return { project: repo === null ? null : deps.projectName(repo), connected: repo === null ? null : deps.connected(repo, ctx.now, task?.runner ?? null),
|
|
27
|
+
whole: !ctx.person.restricted, register: ctx.can["register"] === true };
|
|
28
|
+
},
|
|
29
|
+
render: ({ declaration, summary, attrs }) => {
|
|
30
|
+
const where = summary.project === null ? "" : html ` to <strong>${summary.project}</strong>`;
|
|
31
|
+
const state = summary.connected === null ? html `` : summary.connected
|
|
32
|
+
? html `<p>A builder is connected${where}. Approved tasks there start on their own.</p>`
|
|
33
|
+
: html `<p><strong>No builder is connected</strong>${where}. Tasks wait until one is.</p>`;
|
|
34
|
+
const register = changeDocumentOf("register-computer");
|
|
35
|
+
return settingsSection({
|
|
36
|
+
id: "start", title: declaration.title, attrs,
|
|
37
|
+
...(summary.register && register !== undefined ? { right: btn("Register a computer", { sm: true, href: changeHref(register) }) } : {}),
|
|
38
|
+
body: joinHtml([
|
|
39
|
+
state,
|
|
40
|
+
html `<p>On the computer where ${summary.project ?? "the project"} lives, open the project's folder in a terminal and run:</p>`,
|
|
41
|
+
html `<p id="builder">${codeLine(START_BUILDER_COMMAND)}</p>`,
|
|
42
|
+
summary.whole
|
|
43
|
+
? note(html `Keep it running. Approved tasks start on their own. The console alone (<code>toolroll serve</code>) doesn't build.`)
|
|
44
|
+
: note("Starting a builder takes someone who manages this Toolroll. Ask them to run it there; your tasks start on their own once it connects."),
|
|
45
|
+
]),
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
refusal: "An approver with access to the whole installation registers computers, from a browser.",
|
|
49
|
+
renderChange: ({ ctx, problem }) => {
|
|
50
|
+
const title = "Register a computer";
|
|
51
|
+
const back = sectionHref({ id: "start", area: "computers" });
|
|
52
|
+
const drafts = subject.drafts;
|
|
53
|
+
const capacity = /^(1|2|3|4|6|8)$/.test(drafts["capacity"] ?? "") ? drafts["capacity"] : "1";
|
|
54
|
+
const form = kitSectionForm({ proof: "runner-register", action: "/fleet/runner/register", id: "register-form", native: true, save: { label: "Register computer" },
|
|
55
|
+
hidden: { nonce: deps.registerNonce(ctx.person.name) },
|
|
56
|
+
body: joinHtml([
|
|
57
|
+
textField({ id: "register-name", name: "name", label: "Computer name", value: drafts["name"] ?? "", hint: "One short line, like the computer's own name.",
|
|
58
|
+
error: drafts["field"] === "name" ? problem : null, attrs: { maxlength: 60, autocomplete: "off", spellcheck: "false", required: true } }),
|
|
59
|
+
html `<div class="kit-field"><label for="register-capacity">Tasks at a time</label>${select({ id: "register-capacity", name: "capacity", current: capacity, items: ["1", "2", "3", "4", "6", "8"] })}</div>`,
|
|
60
|
+
]) });
|
|
61
|
+
const body = joinHtml([
|
|
62
|
+
html `<p>Registering makes a token that lets the computer take work. It is shown once, on the next page; only its hash is kept. Most computers don't need this: <code>${START_BUILDER_COMMAND}</code> registers the computer it runs on.</p>`,
|
|
63
|
+
problem === null || drafts["field"] === "name" ? "" : notice(problem),
|
|
64
|
+
form,
|
|
65
|
+
html `<div class="k-acts">${btn("Cancel", { variant: "ghost", href: back })}</div>`,
|
|
66
|
+
]);
|
|
67
|
+
return { title, body: html `<div data-kit-page>${phoneHeader(title, { back })}${doc(docHeader({ title, back: [back, "Computers"], same: true }), body)}</div>` };
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function buildersSection(deps, subject) {
|
|
72
|
+
const detailOf = (computers, name) => name === null ? null : ((one) => one === undefined ? { missing: name } : { one })(computers.list.find(each => each.name === name));
|
|
73
|
+
return {
|
|
74
|
+
loadSummary: ctx => deps.computers(ctx.now, ctx.can["manage"] === true),
|
|
75
|
+
loadDetail: ctx => detailOf(deps.computers(ctx.now, ctx.can["manage"] === true), subject.computer),
|
|
76
|
+
render: ({ declaration, ctx, summary, detail, attrs }) => {
|
|
77
|
+
const retire = changeDocumentOf("retire-computer");
|
|
78
|
+
const rows = summary.list.map(one => {
|
|
79
|
+
const opened = detail !== null && "one" in detail && detail.one.name === one.name;
|
|
80
|
+
return settingsRecord({ attrs: { "data-computer": one.name },
|
|
81
|
+
title: html `${one.name} ${chipOf(one)}`, sub: `${one.host} · ${lineOf(one, ctx.now, deps.ago)}`,
|
|
82
|
+
action: opened ? html `` : btn("Details", { sm: true, variant: "ghost", href: `${sectionHref(declaration, { open: true, extra: { computer: one.name } })}#builders` }),
|
|
83
|
+
more: opened ? detailHtml(one, summary, ctx, deps, retire === undefined ? null : changeHref(retire, null, { computer: one.name })) : undefined });
|
|
84
|
+
});
|
|
85
|
+
return settingsSection({
|
|
86
|
+
id: "builders", title: declaration.title, state: summary.list.length === 0 ? "" : ` · ${summary.list.length}`, attrs,
|
|
87
|
+
body: joinHtml([
|
|
88
|
+
html `<div id="workers">${summary.list.length === 0 ? note("No computer is building yet. Approved tasks wait until one is connected (above).") : joinHtml(rows)}</div>`,
|
|
89
|
+
detail !== null && "missing" in detail ? notice(`There's no computer named ${detail.missing}.`) : "",
|
|
90
|
+
summary.shared > 0 ? note(html `${plural(summary.shared, "task waits", "tasks wait")} in the shared queue for any free computer. <a class="k-link" href="/?view=order">Reserve one for a computer</a>`) : "",
|
|
91
|
+
]),
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
refusal: "An approver with access to the whole installation retires computers, from a browser.",
|
|
95
|
+
renderChange: ({ ctx, problem }) => {
|
|
96
|
+
const back = sectionHref({ id: "builders", area: "computers" });
|
|
97
|
+
const name = subject.computer;
|
|
98
|
+
const one = name === null ? undefined : deps.computers(ctx.now, true).list.find(each => each.name === name);
|
|
99
|
+
const title = one === undefined ? "Retire a computer" : `Retire ${one.name}`;
|
|
100
|
+
const body = one === undefined || one.retired
|
|
101
|
+
? joinHtml([infoLine(one === undefined ? "There's no computer by that name to retire." : `${one.name} is already retired.`), html `<div class="k-acts">${btn("Back to Computers", { href: back })}</div>`])
|
|
102
|
+
: joinHtml([
|
|
103
|
+
html `<p>${one.name} stops taking work. Tasks reserved for it wait until you move them. To use it again, register the name again.</p>`,
|
|
104
|
+
facts([["Computer", one.host], ["Status", lineOf(one, ctx.now, deps.ago)], ["Reserved for it", one.reserved.length === 0 ? "Nothing" : plural(one.reserved.length, "task", "tasks")]]),
|
|
105
|
+
problem === null ? "" : notice(problem),
|
|
106
|
+
kitSectionForm({ proof: "runner-retire", action: "/fleet/runner/retire", id: "retire-form", native: true, save: { label: "Retire computer" }, hidden: { name: one.name }, body: html `` }),
|
|
107
|
+
html `<div class="k-acts">${btn("Cancel", { variant: "ghost", href: `${sectionHref({ id: "builders", area: "computers" }, { open: true, extra: { computer: one.name } })}#builders` })}</div>`,
|
|
108
|
+
]);
|
|
109
|
+
return { title, body: html `<div data-kit-page>${phoneHeader(title, { back })}${doc(docHeader({ title, back: [back, "Computers"], same: true }), body)}</div>` };
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function detailHtml(one, computers, ctx, deps, retireHref) {
|
|
114
|
+
const others = computers.list.filter(other => other.name !== one.name && !other.retired);
|
|
115
|
+
const reserved = one.reserved.length === 0 ? note("Nothing reserved. It takes from the shared queue, top first.")
|
|
116
|
+
: html `<ul class="k-list">${one.reserved.map(task => html `<li data-reserved="${task.id}"><a href="${task.href}">${task.title}</a>${task.project === null ? "" : html ` <span class="k-muted">· ${task.project}</span>`}${task.taken ? html ` <span class="k-note">Being taken</span>`
|
|
117
|
+
: computers.manage ? postForm("/queue/move", html `${select({ name: "column", sm: true, label: `Move ${task.title} to`, current: "anyone", items: [["anyone", "Shared queue"], ...others.map(other => [other.name, other.name])] })}${btn("Move", { sm: true, type: "submit" })}`, { hidden: { queueRevision: String(computers.queueRevision), task: task.id, before: "" }, attrs: { class: "k-acts" } }) : ""}</li>`)}</ul>`;
|
|
118
|
+
return joinHtml([
|
|
119
|
+
facts([
|
|
120
|
+
["Computer", one.host],
|
|
121
|
+
["Takes work from", one.projects.length > 0 ? one.projects.join(", ") : "No projects yet"],
|
|
122
|
+
["Building now", one.building.length === 0 && one.hidden === 0 ? "Nothing"
|
|
123
|
+
: joinHtml([...one.building.map(build => html `<a href="${build.href}">${build.title}</a>`), one.hidden > 0 ? plural(one.hidden, "task in a project you can't see", "tasks in projects you can't see") : ""].filter(Boolean), html `<br>`)],
|
|
124
|
+
["At a time", computers.manage ? html `${plural(one.capacity, "task", "tasks")} <span class="k-muted">· change it there with <code class="k-mono">toolroll runner capacity ${one.name} <n></code></span>` : plural(one.capacity, "task", "tasks")],
|
|
125
|
+
["Last heard", deps.ago(one.heardAt, ctx.now)],
|
|
126
|
+
["Registered", deps.ago(one.registeredAt, ctx.now)],
|
|
127
|
+
...(!computers.manage && one.note !== null ? [["Note", one.note]] : []),
|
|
128
|
+
]),
|
|
129
|
+
one.state === "offline" && !one.retired ? note(html `To bring it back, open a terminal on ${one.host}, go to the project's folder and run ${codeLine(START_BUILDER_COMMAND)}.`) : "",
|
|
130
|
+
html `<h4>Reserved for it</h4>`, reserved,
|
|
131
|
+
computers.manage && !one.retired ? postForm("/queue/note", html `<div class="kit-field"><label for="note-${one.name}">Note on its queue</label>\
|
|
132
|
+
<input class="k-input" id="note-${one.name}" name="note" maxlength="200" value="${one.note ?? ""}">\
|
|
133
|
+
<p class="kit-hint">What it is working through, for whoever looks next.</p></div>${btn("Save note", { sm: true, type: "submit" })}`, { hidden: { runner: one.name, from: "fleet" } }) : "",
|
|
134
|
+
computers.manage && !one.retired && retireHref !== null ? html `<div class="k-acts">${btn(`Retire ${one.name}`, { sm: true, href: retireHref })}</div>` : "",
|
|
135
|
+
]);
|
|
136
|
+
}
|
|
137
|
+
export function computersSections(deps, subject) {
|
|
138
|
+
return { start: startSection(deps, subject), builders: buildersSection(deps, subject) };
|
|
139
|
+
}
|
|
140
|
+
export { AREA as COMPUTERS_PATH };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const SCRIPT_INVENTORY = Object.freeze([
|
|
2
|
+
{ id: "skills", does: "Filters skills, and packages a chosen folder's files into the import form", symbol: "skillsScript", module: "skills-ui.ts", today: "settings.skills", section: "skills", slice: "F5", fetches: false,
|
|
3
|
+
keep: "folder import works only with the script (verified with JavaScript on); paste and GitHub import work without it" },
|
|
4
|
+
{ id: "updates", does: "Polls an update in progress and shows its steps", symbol: "updatesScript", module: "toolroll-update-ui.ts", today: "settings.updates", section: "updates", slice: "S1", fetches: true,
|
|
5
|
+
keep: "an admitted /settings/updates?fragment=steps endpoint (or a retargeted poller) stays when the page retires (round 2, change 3)" },
|
|
6
|
+
{ id: "spend", does: "The monthly limit form's live amount and stop choice", symbol: "spendScript", module: "spend-ui.ts", today: "spend", section: "spend-limit", slice: "S2", fetches: false,
|
|
7
|
+
keep: "/spend joins in-place only once the form and this script are on the spend-limit change document" },
|
|
8
|
+
{ id: "openrouter-picker", does: "Searches OpenRouter's model catalog in project setup", symbol: "openRouterPickerScript", module: "openrouter-models.ts", today: "control", section: "builder", slice: "P5", fetches: false },
|
|
9
|
+
{ id: "models", does: "The models page's choices and preview", symbol: "modelsScript", module: "models-ui.ts", today: "settings.models", section: "models", slice: "F4", fetches: false },
|
|
10
|
+
{ id: "tools", does: "Saves a tool's settings as they change, and switches project", symbol: "TOOLS_PROJECT_SCRIPT", module: "tools-ui.ts", today: "settings.tools", section: "tools", slice: "P4", fetches: false,
|
|
11
|
+
keep: "kit and connect links lead to the tools change document, which owns the script (round 2, change 4)" },
|
|
12
|
+
{ id: "push", does: "Enrolls this device for alerts (a service worker and a push subscription)", symbol: "pushScriptOf", module: "settings-groups-ui.ts", today: "settings.group-alerts", section: "this-device", slice: "C1", fetches: true },
|
|
13
|
+
{ id: "hub-anchors", does: "Forwards the overview's old #anchors to their group pages", symbol: "HUB_ANCHOR_SCRIPT", module: "settings-groups-ui.ts", today: "settings.page", section: "home", slice: "D", fetches: false,
|
|
14
|
+
keep: "replaced by the retired-address resolvers once every anchor's page is an area" },
|
|
15
|
+
]);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const GROUP_PAGE = Object.freeze({
|
|
2
|
+
callers: Object.freeze(["cookie", "bearer"]), scope: "read", project: "session", limited: "unscoped", needsProject: false,
|
|
3
|
+
role: "any", roleBrowser: false, viewer: false, local: "allow",
|
|
4
|
+
});
|
|
5
|
+
const START_BUILDER = Object.freeze({ ...GROUP_PAGE });
|
|
6
|
+
const FLEET = Object.freeze({ ...GROUP_PAGE, limited: "deny" });
|
|
7
|
+
const MANAGE_COMPUTERS = ["full-session", "approver", "whole-installation", "not-demo"];
|
|
8
|
+
export const SETTINGS_SECTIONS = Object.freeze([
|
|
9
|
+
{ id: "appearance", area: "general", title: "Appearance", pinnedFrom: "settings.group-general", policy: GROUP_PAGE,
|
|
10
|
+
read: [], scope: {}, act: {}, changes: [], opens: false, scripts: [], oldIds: ["accent", "accent-own"] },
|
|
11
|
+
{ id: "this-browser", area: "general", title: "This browser", pinnedFrom: "settings.group-general", policy: GROUP_PAGE,
|
|
12
|
+
read: ["password-holder"], scope: {}, act: { forget: ["cookie-session"] }, changes: [], opens: false, scripts: [], oldIds: [] },
|
|
13
|
+
{ id: "your-password", area: "general", title: "Your password", pinnedFrom: "settings.group-general", policy: GROUP_PAGE,
|
|
14
|
+
read: ["password-holder"], scope: { passwordless: ["installation"] }, act: {}, changes: [], opens: false, scripts: [], oldIds: [] },
|
|
15
|
+
{ id: "version", area: "general", title: "Version", pinnedFrom: "settings.group-general", policy: GROUP_PAGE,
|
|
16
|
+
read: [], scope: { "updates-version": ["installation"], "package-version": ["operator"] }, act: { updates: ["operator"] }, changes: [], opens: false, scripts: [], oldIds: [] },
|
|
17
|
+
{ id: "install-mode", area: "general", title: "Solo or team", pinnedFrom: "settings.group-general", policy: GROUP_PAGE,
|
|
18
|
+
read: [], scope: {}, act: { "just-me": ["full-session", "operator"] }, changes: [{ id: "just-me", act: "just-me", proof: "install-solo" }],
|
|
19
|
+
opens: false, scripts: [], oldIds: [] },
|
|
20
|
+
{ id: "advanced", area: "general", title: "Show advanced features", pinnedFrom: "settings.group-advanced", policy: GROUP_PAGE,
|
|
21
|
+
read: [], scope: { "operator-pages": ["operator"] }, act: { switch: ["cookie-session"] }, changes: [], opens: true, scripts: [], oldIds: ["show-advanced"] },
|
|
22
|
+
{ id: "local-mode", area: "general", title: "Local mode", pinnedFrom: "settings.group-access", policy: GROUP_PAGE,
|
|
23
|
+
read: ["cookie-session"], scope: {}, act: { "turn-off": ["full-session", "operator"] }, changes: [{ id: "local-mode", act: "turn-off", proof: "local-mode-off" }],
|
|
24
|
+
opens: false, scripts: [], oldIds: [] },
|
|
25
|
+
{ id: "start", area: "computers", title: "Connect a builder", pinnedFrom: "start-builder", policy: START_BUILDER,
|
|
26
|
+
read: [], scope: {}, act: { register: MANAGE_COMPUTERS }, changes: [{ id: "register-computer", act: "register", proof: "runner-register" }],
|
|
27
|
+
opens: false, scripts: [], oldIds: ["builder"] },
|
|
28
|
+
{ id: "builders", area: "computers", title: "Computers that build", pinnedFrom: "fleet", policy: FLEET,
|
|
29
|
+
read: [], scope: {}, act: { manage: MANAGE_COMPUTERS }, changes: [{ id: "retire-computer", act: "manage", proof: "runner-retire" }],
|
|
30
|
+
opens: true, scripts: [], oldIds: ["workers"] },
|
|
31
|
+
]);
|
|
32
|
+
export const CHANGE_DOCUMENTS = SETTINGS_SECTIONS.flatMap(section => section.changes.map(change => ({ ...change, section })));
|
|
33
|
+
export function changeDocumentOf(id) {
|
|
34
|
+
return CHANGE_DOCUMENTS.find(one => one.id === id);
|
|
35
|
+
}
|
|
36
|
+
export function sectionDeclaration(id) {
|
|
37
|
+
return SETTINGS_SECTIONS.find(one => one.id === id);
|
|
38
|
+
}
|
|
39
|
+
export const AREA_PATHS = Object.freeze({ general: "/settings/general", computers: "/settings/computers" });
|
|
40
|
+
export function sectionHref(declaration, options = {}) {
|
|
41
|
+
const path = AREA_PATHS[declaration.area] ?? "/settings";
|
|
42
|
+
const query = new URLSearchParams();
|
|
43
|
+
if (options.project != null)
|
|
44
|
+
query.set("repo", options.project);
|
|
45
|
+
query.set("section", declaration.id);
|
|
46
|
+
if (options.open === true)
|
|
47
|
+
query.set("open", "1");
|
|
48
|
+
for (const [key, value] of Object.entries(options.extra ?? {}))
|
|
49
|
+
query.set(key, value);
|
|
50
|
+
return `${path}?${query}`;
|
|
51
|
+
}
|
|
52
|
+
export function changeHref(document, project = null, extra = {}) {
|
|
53
|
+
const query = new URLSearchParams();
|
|
54
|
+
if (project !== null)
|
|
55
|
+
query.set("repo", project);
|
|
56
|
+
for (const [key, value] of Object.entries(extra))
|
|
57
|
+
query.set(key, value);
|
|
58
|
+
return `/settings/change/${document.id}${query.size === 0 ? "" : `?${query}`}`;
|
|
59
|
+
}
|