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
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { ADVANCED_PAGES } from "../advanced-view.js";
|
|
2
|
+
import { accentNote, ACCENT_PRESETS } from "../accent-colors.js";
|
|
3
|
+
import { installModeLine, justMeAllowed, TEAM_FACT_WORDS } from "../install-mode.js";
|
|
4
|
+
import { html, joinHtml, postForm } from "../html.js";
|
|
5
|
+
import { kitSectionForm } from "../settings-kit.js";
|
|
6
|
+
import { evaluateRoutePolicy, holdsRole } from "./route-policy.js";
|
|
7
|
+
import { btn, codeLine, disclose, doc, docHeader, formRow, infoLine, input, notice, phoneHeader, select, settingsLink, settingsSection } from "./kit.js";
|
|
8
|
+
import { changeDocumentOf, changeHref, sectionHref, SETTINGS_SECTIONS } from "./settings-section-table.js";
|
|
9
|
+
export function gateHolds(gate, person) {
|
|
10
|
+
switch (gate) {
|
|
11
|
+
case "installation": return person.installation && !person.restricted;
|
|
12
|
+
case "cookie-session": return person.via === "cookie";
|
|
13
|
+
case "full-session": return person.via === "cookie" && person.authority === "full";
|
|
14
|
+
case "operator": return person.via === "cookie" && person.operator;
|
|
15
|
+
case "approver": return person.role === "approver";
|
|
16
|
+
case "password-holder": return !(person.via === "cookie" && person.authority !== "full" && !person.passwordSet);
|
|
17
|
+
case "whole-installation": return !person.restricted;
|
|
18
|
+
case "not-demo": return !person.demo;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const SECTION_RESOLVERS = new Set(["none", "session", "form", "form-path"]);
|
|
22
|
+
const SECTION_LIMITED = new Set(["deny", "collection", "unscoped", "self", "conversation"]);
|
|
23
|
+
export function admitSection(declaration, person, project = null) {
|
|
24
|
+
const policy = declaration.policy;
|
|
25
|
+
if (person.via === "cookie" && person.authority !== "full" && policy.local !== "allow")
|
|
26
|
+
return { ok: false, why: "local" };
|
|
27
|
+
let why = null;
|
|
28
|
+
const projectAdmits = (source) => {
|
|
29
|
+
if (!SECTION_RESOLVERS.has(source) || !SECTION_LIMITED.has(policy.limited)) {
|
|
30
|
+
why = "project";
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
if (person.restricted && (policy.limited === "deny" || policy.limited === "conversation")) {
|
|
34
|
+
why = "limited";
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
if (person.restricted && policy.limited !== "unscoped" && policy.limited !== "self" && project === null) {
|
|
38
|
+
why = "limited";
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
if (policy.needsProject && person.via === "cookie" && project === null && !person.unscopedConsole) {
|
|
42
|
+
why = "project";
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
};
|
|
47
|
+
const checked = evaluateRoutePolicy(policy, person.principal, projectAdmits);
|
|
48
|
+
if (!checked.ok)
|
|
49
|
+
return { ok: false, why: checked.reason === "project" ? why ?? "project" : checked.reason };
|
|
50
|
+
if (!holdsRole(policy, person, name => name === person.name && person.operator))
|
|
51
|
+
return { ok: false, why: "role" };
|
|
52
|
+
for (const gate of declaration.read)
|
|
53
|
+
if (!gateHolds(gate, person))
|
|
54
|
+
return { ok: false, why: `read:${gate}` };
|
|
55
|
+
const scopes = new Set(Object.entries(declaration.scope).filter(([, gates]) => gates.every(gate => gateHolds(gate, person))).map(([name]) => name));
|
|
56
|
+
const can = Object.fromEntries(Object.entries(declaration.act).map(([act, gates]) => [act, gates.every(gate => gateHolds(gate, person))]));
|
|
57
|
+
return { ok: true, scopes, can };
|
|
58
|
+
}
|
|
59
|
+
export const PROJECT_NOT_AVAILABLE = "That project is not available in this workspace.";
|
|
60
|
+
export function resolveSettingsProject(url, session, deps) {
|
|
61
|
+
const named = url.searchParams.getAll("repo");
|
|
62
|
+
if (named.length > 1)
|
|
63
|
+
return { ok: false, status: 400, message: "Name one project." };
|
|
64
|
+
if (named.length === 1) {
|
|
65
|
+
const repo = named[0];
|
|
66
|
+
if (repo === "" || !deps.projects().includes(repo) || !deps.canOpen(repo))
|
|
67
|
+
return { ok: false, status: 404, message: PROJECT_NOT_AVAILABLE };
|
|
68
|
+
return { ok: true, project: repo, requested: true };
|
|
69
|
+
}
|
|
70
|
+
return { ok: true, project: session, requested: false };
|
|
71
|
+
}
|
|
72
|
+
export function sessionProjectCheck(posted, session, projectName) {
|
|
73
|
+
if (posted.length !== 1 || posted[0] === "")
|
|
74
|
+
return { ok: false, rendered: null, session, message: "This form names no project. Open the project and try again." };
|
|
75
|
+
const rendered = posted[0];
|
|
76
|
+
if (session === null || rendered !== session) {
|
|
77
|
+
return { ok: false, rendered, session, message: `${projectName(rendered)} is no longer the open project${session === null ? "" : ` (${projectName(session)} is)`}. Nothing changed.` };
|
|
78
|
+
}
|
|
79
|
+
return { ok: true, project: rendered };
|
|
80
|
+
}
|
|
81
|
+
export function openProjectAgain(rendered, name, back) {
|
|
82
|
+
return postForm("/projects/select", btn(`Open ${name}`, { sm: true, type: "submit", variant: "primary" }), { hidden: { path: rendered, return: back } });
|
|
83
|
+
}
|
|
84
|
+
export function askedSection(url) {
|
|
85
|
+
const sections = url.searchParams.getAll("section");
|
|
86
|
+
const section = sections.length === 1 && /^[a-z][a-z-]{0,39}$/.test(sections[0]) ? sections[0] : null;
|
|
87
|
+
return { section, open: section !== null && url.searchParams.getAll("open").length === 1 && url.searchParams.get("open") === "1" };
|
|
88
|
+
}
|
|
89
|
+
export function renderArea(area, impls, base, asked, declarations = SETTINGS_SECTIONS) {
|
|
90
|
+
const sections = [];
|
|
91
|
+
const shown = [];
|
|
92
|
+
let jump = html ``;
|
|
93
|
+
for (const declaration of declarations.filter(one => one.area === area)) {
|
|
94
|
+
const impl = impls[declaration.id];
|
|
95
|
+
if (impl === undefined)
|
|
96
|
+
throw new Error(`settings section ${declaration.id} has no implementation`);
|
|
97
|
+
const admitted = admitSection(declaration, base.person, base.project);
|
|
98
|
+
if (!admitted.ok)
|
|
99
|
+
continue;
|
|
100
|
+
const ctx = { ...base, scopes: admitted.scopes, can: admitted.can };
|
|
101
|
+
const summary = impl.loadSummary(ctx);
|
|
102
|
+
if (summary === null)
|
|
103
|
+
continue;
|
|
104
|
+
const isAsked = asked.section === declaration.id;
|
|
105
|
+
const detail = isAsked && asked.open && declaration.opens && impl.loadDetail !== undefined ? impl.loadDetail(ctx) : null;
|
|
106
|
+
sections.push(impl.render({ declaration, ctx, summary, detail, asked: isAsked, attrs: { "data-section": declaration.id, tabindex: isAsked ? "-1" : null } }));
|
|
107
|
+
shown.push(declaration.id);
|
|
108
|
+
if (isAsked)
|
|
109
|
+
jump = html `<p class="k-note k-jump"><a href="#${declaration.id}">Jump to ${declaration.title}</a></p>`;
|
|
110
|
+
}
|
|
111
|
+
return { sections, jump, shown };
|
|
112
|
+
}
|
|
113
|
+
export function changeDocument(id, impls, base, problem) {
|
|
114
|
+
const change = changeDocumentOf(id);
|
|
115
|
+
const declaration = change?.section;
|
|
116
|
+
const impl = declaration === undefined ? undefined : impls[declaration.id];
|
|
117
|
+
if (change === undefined || declaration === undefined || impl?.renderChange === undefined)
|
|
118
|
+
return { ok: false, status: 404, message: "There's no page at this address." };
|
|
119
|
+
const admitted = admitSection(declaration, base.person, base.project);
|
|
120
|
+
if (!admitted.ok || admitted.can[change.act] !== true)
|
|
121
|
+
return { ok: false, status: 403, message: impl.refusal ?? "You can't change this here." };
|
|
122
|
+
const ctx = { ...base, scopes: admitted.scopes, can: admitted.can };
|
|
123
|
+
const drawn = impl.renderChange({ declaration, ctx, summary: impl.loadSummary(ctx), detail: null, asked: true, attrs: {}, problem, document: change.id });
|
|
124
|
+
return { ok: true, ...drawn };
|
|
125
|
+
}
|
|
126
|
+
const ACCENT_CHOICES = ACCENT_PRESETS.slice(0, 6);
|
|
127
|
+
const back = "/settings/general";
|
|
128
|
+
function appearanceSection() {
|
|
129
|
+
return {
|
|
130
|
+
loadSummary: ctx => ctx.prefs,
|
|
131
|
+
render: ({ summary: prefs, attrs }) => {
|
|
132
|
+
const themeButton = (value, label) => html `<button type="submit" name="theme" value="${value}" aria-pressed="${String(prefs.theme === value)}">${label}</button>`;
|
|
133
|
+
const custom = ACCENT_CHOICES.some(one => one.hex === prefs.accent) ? null : prefs.accent;
|
|
134
|
+
const accentNoteWords = accentNote(prefs.accent);
|
|
135
|
+
return settingsSection({
|
|
136
|
+
id: "appearance", title: "Appearance", state: " · saved for this browser", attrs,
|
|
137
|
+
body: joinHtml([
|
|
138
|
+
formRow("Theme", "Light, dark, or whatever this device uses.", postForm("/settings/appearance", html `<div class="k-seg" role="group" aria-label="Theme">${themeButton("system", "Match device")}${themeButton("light", "Light")}${themeButton("dark", "Dark")}</div>`, { returnTo: back })),
|
|
139
|
+
kitSectionForm({ proof: "appearance", action: "/settings/appearance", id: "accent", gate: true, hidden: { return: back },
|
|
140
|
+
body: joinHtml([
|
|
141
|
+
formRow("Accent", "Buttons, focus and what needs you.", select({ name: "accent", label: "Accent", current: prefs.accent, items: [...ACCENT_CHOICES.map(one => [one.hex, one.id === "ink" ? "Ink (default)" : one.name]), ...(custom === null ? [] : [[custom, `Your own colour (${custom})`]])] })),
|
|
142
|
+
accentNoteWords === null ? "" : html `<p class="k-note">${accentNoteWords}</p>`,
|
|
143
|
+
]) }),
|
|
144
|
+
disclose("Use your own colour", kitSectionForm({ proof: "appearance", action: "/settings/appearance", id: "accent-own", gate: true, hidden: { return: back },
|
|
145
|
+
body: formRow("Your own colour", "Six hex digits, like #6e56cf.", input({ id: "accent-hex", name: "accent", value: custom ?? "", attrs: { placeholder: "#6e56cf", spellcheck: "false", autocomplete: "off", "aria-label": "Your own colour", pattern: "#?[0-9a-fA-F]{6}", required: true } })) }), custom !== null),
|
|
146
|
+
]),
|
|
147
|
+
});
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function thisBrowserSection() {
|
|
152
|
+
return {
|
|
153
|
+
loadSummary: ctx => ({ forget: ctx.can["forget"] === true }),
|
|
154
|
+
render: ({ summary, attrs }) => settingsSection({
|
|
155
|
+
id: "this-browser", title: "This browser", attrs,
|
|
156
|
+
body: formRow("Remembered password", "After you type your password, standard approvals skip it on this computer for 15 minutes. Forget ends that now.", summary.forget ? postForm("/session/forget-password", btn("Forget now", { sm: true, type: "submit" }), { returnTo: back }) : html ``, "inline"),
|
|
157
|
+
}),
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function yourPasswordSection(deps) {
|
|
161
|
+
return {
|
|
162
|
+
loadSummary: ctx => ({ passwordless: ctx.scopes.has("passwordless") ? deps.passwordless() : null }),
|
|
163
|
+
render: ({ summary, attrs }) => settingsSection({
|
|
164
|
+
id: "your-password", title: "Your password", attrs,
|
|
165
|
+
body: joinHtml([
|
|
166
|
+
formRow("Where it is", "If you started Toolroll with toolroll up, your password is saved on the computer running Toolroll. Toolroll never shows it in a browser. To read it, run this there:", html ``, "wide"),
|
|
167
|
+
codeLine("cat ~/.config/toolroll/.toolroll-secrets/up-login.txt"),
|
|
168
|
+
summary.passwordless === null ? "" : formRow("Passwordless", "Sign in once; most approvals then need no password.", btn(`${summary.passwordless ? "On" : "Off"} · Change`, { sm: true, href: "/settings/passwordless" }), "inline"),
|
|
169
|
+
]),
|
|
170
|
+
}),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function versionSection(deps) {
|
|
174
|
+
return {
|
|
175
|
+
loadSummary: ctx => {
|
|
176
|
+
const version = (ctx.scopes.has("updates-version") ? deps.updatesVersion(ctx.person.name) : null) ?? (ctx.scopes.has("package-version") ? deps.packageVersion : null);
|
|
177
|
+
return version === null ? null : { version, firstResult: deps.firstResult(ctx.now), updates: ctx.can["updates"] === true };
|
|
178
|
+
},
|
|
179
|
+
render: ({ summary, attrs }) => settingsSection({
|
|
180
|
+
id: "version", title: "Version", attrs,
|
|
181
|
+
body: joinHtml([
|
|
182
|
+
formRow("Toolroll", summary.firstResult ?? "Installed on this computer.", html `<span class="k-mono">${summary.version}</span>`, "inline"),
|
|
183
|
+
summary.updates ? formRow("Updates", null, btn("Open updates", { sm: true, variant: "ghost", href: "/settings/updates" }), "inline") : "",
|
|
184
|
+
]),
|
|
185
|
+
}),
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function advancedSection() {
|
|
189
|
+
return {
|
|
190
|
+
loadSummary: ctx => ({ on: ctx.prefs.advanced, canSwitch: ctx.can["switch"] === true }),
|
|
191
|
+
loadDetail: ctx => ADVANCED_PAGES.filter(one => one.operator !== true || ctx.scopes.has("operator-pages")),
|
|
192
|
+
render: ({ declaration, summary, detail, attrs }) => {
|
|
193
|
+
const change = summary.canSwitch
|
|
194
|
+
? postForm("/settings/advanced", btn(summary.on ? "Turn off" : "Turn on", { sm: true, type: "submit" }), { hidden: { advanced: summary.on ? "off" : "on" } })
|
|
195
|
+
: html ``;
|
|
196
|
+
const pages = detail === null
|
|
197
|
+
? html `<div class="k-acts">${btn("See advanced pages", { sm: true, variant: "ghost", href: `${sectionHref(declaration, { open: true })}#advanced` })}</div>`
|
|
198
|
+
: html `<div class="k-slinks" aria-label="Advanced pages">${detail.map(one => settingsLink({ href: one.href, title: one.title, status: one.words }))}</div>`;
|
|
199
|
+
return settingsSection({
|
|
200
|
+
id: "advanced", title: "Show advanced features", state: summary.on ? " · on" : " · off", attrs,
|
|
201
|
+
right: html `<span id="show-advanced">${change}</span>`,
|
|
202
|
+
lead: "Flows, other computers, spend limits, operating modes and the rest, in your menus. They keep working either way.",
|
|
203
|
+
body: pages,
|
|
204
|
+
});
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function localModeSection(deps) {
|
|
209
|
+
return {
|
|
210
|
+
loadSummary: ctx => {
|
|
211
|
+
if (!deps.localModeOn())
|
|
212
|
+
return null;
|
|
213
|
+
const owner = ctx.person.authority !== "full";
|
|
214
|
+
if (owner)
|
|
215
|
+
return ctx.person.passwordSet ? null : { owner, turnOff: false };
|
|
216
|
+
return ctx.can["turn-off"] === true ? { owner, turnOff: true } : null;
|
|
217
|
+
},
|
|
218
|
+
render: ({ declaration, summary, attrs }) => summary.owner
|
|
219
|
+
? settingsSection({ id: "local-mode", title: "Let agents work on their own", attrs,
|
|
220
|
+
lead: "Agents can work on their own, merge and release only after you set a password.",
|
|
221
|
+
body: html `<div class="k-acts">${btn("Set a password", { sm: true, href: "/password/set?next=%2Fsettings%2Fgeneral" })}</div>` })
|
|
222
|
+
: settingsSection({ id: "local-mode", title: "Local mode", state: " · on", attrs,
|
|
223
|
+
lead: "A browser on this computer can file tasks, approve plans and add projects without your password.",
|
|
224
|
+
right: btn("Turn off local mode", { sm: true, href: changeHref(declaration.changes[0]) }), body: html `` }),
|
|
225
|
+
refusal: "An instance operator signed in with a password turns off local mode.",
|
|
226
|
+
renderChange: ({ declaration, summary, problem }) => {
|
|
227
|
+
const home = sectionHref(declaration);
|
|
228
|
+
const title = "Turn off local mode";
|
|
229
|
+
const words = summary === null || !summary.turnOff
|
|
230
|
+
? html `${infoLine("Local mode is off. This computer's browser signs in with a password.")}<div class="k-acts">${btn("Back to General", { href: home })}</div>`
|
|
231
|
+
: joinHtml([
|
|
232
|
+
html `<p>Local mode lets a browser on this computer file tasks, approve plans and add projects without a password. Turned off, every browser signs in with a password, and the local owner's sessions and links stop working. You can't turn it back on here.</p>`,
|
|
233
|
+
problem === null ? "" : notice(problem),
|
|
234
|
+
kitSectionForm({ proof: "local-mode-off", action: "/settings/local-mode/off", id: "local-mode-form", native: true, save: { label: "Turn off" }, confirm: title, body: html `` }),
|
|
235
|
+
html `<div class="k-acts">${btn("Cancel", { variant: "ghost", href: home })}</div>`,
|
|
236
|
+
]);
|
|
237
|
+
return { title, body: html `<div data-kit-page>${phoneHeader(title, { back: home })}${doc(docHeader({ title, back: [home, "General"], same: true }), words)}</div>` };
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function installModeSection(deps) {
|
|
242
|
+
return {
|
|
243
|
+
loadSummary: ctx => {
|
|
244
|
+
const read = deps.installMode();
|
|
245
|
+
const canSwitch = ctx.can["just-me"] === true;
|
|
246
|
+
return { mode: read.mode, facts: read.facts, canSwitch, offered: canSwitch && justMeAllowed(read) };
|
|
247
|
+
},
|
|
248
|
+
render: ({ declaration, summary, attrs }) => {
|
|
249
|
+
const line = installModeLine(summary.mode);
|
|
250
|
+
return settingsSection({ id: "install-mode", title: line.label, attrs, lead: line.words,
|
|
251
|
+
...(summary.offered ? { right: btn("It's just me", { sm: true, href: changeHref(declaration.changes[0]) }) } : {}), body: html `` });
|
|
252
|
+
},
|
|
253
|
+
refusal: "An instance operator signed in with a password says it's just them.",
|
|
254
|
+
renderChange: ({ declaration, summary, problem }) => {
|
|
255
|
+
const home = sectionHref(declaration);
|
|
256
|
+
const title = "It's just me";
|
|
257
|
+
const blocked = summary === null ? [] : summary.facts.filter(fact => fact !== "existing-install" && !fact.endsWith("-added"));
|
|
258
|
+
const words = summary === null || summary.mode === "solo"
|
|
259
|
+
? html `${infoLine("This install is solo.")}<div class="k-acts">${btn("Back to General", { href: home })}</div>`
|
|
260
|
+
: !summary.offered
|
|
261
|
+
? html `${blocked.map(fact => notice(TEAM_FACT_WORDS[fact]))}<div class="k-acts">${btn("Back to General", { href: home })}</div>`
|
|
262
|
+
: joinHtml([
|
|
263
|
+
html `<p>Approvals and Accept then need only you signed in. Signing in, tokens and connecting things still ask for your password. If anyone joins, this install switches back to Team.</p>`,
|
|
264
|
+
problem === null ? "" : notice(problem),
|
|
265
|
+
kitSectionForm({ proof: "install-solo", action: "/settings/install-mode/solo", id: "just-me-form", native: true, save: { label: title }, confirm: title, body: html `` }),
|
|
266
|
+
html `<div class="k-acts">${btn("Cancel", { variant: "ghost", href: home })}</div>`,
|
|
267
|
+
]);
|
|
268
|
+
return { title, body: html `<div data-kit-page>${phoneHeader(title, { back: home })}${doc(docHeader({ title, back: [home, "General"], same: true }), words)}</div>` };
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
export function generalSections(deps) {
|
|
273
|
+
return {
|
|
274
|
+
appearance: appearanceSection(),
|
|
275
|
+
"this-browser": thisBrowserSection(),
|
|
276
|
+
"your-password": yourPasswordSection(deps),
|
|
277
|
+
version: versionSection(deps),
|
|
278
|
+
"install-mode": installModeSection(deps),
|
|
279
|
+
advanced: advancedSection(),
|
|
280
|
+
"local-mode": localModeSection(deps),
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
export function generalBody(impls, base, asked, said) {
|
|
284
|
+
return areaBody("general", impls, base, asked, said);
|
|
285
|
+
}
|
|
286
|
+
export function areaBody(name, impls, base, asked, said) {
|
|
287
|
+
const area = renderArea(name, impls, base, asked);
|
|
288
|
+
const sentence = (text) => `${text.charAt(0).toUpperCase()}${text.slice(1)}`;
|
|
289
|
+
const answered = said.problem ? notice(sentence(said.problem)) : said.said ? infoLine(sentence(said.said)) : html ``;
|
|
290
|
+
return { body: joinHtml([answered, area.jump, ...area.sections]), shown: area.shown };
|
|
291
|
+
}
|