@songsid/agend 2.3.5-alpha.6 → 2.3.5-alpha.8
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/dist/accounts-view.d.ts +17 -0
- package/dist/accounts-view.js +33 -6
- package/dist/accounts-view.js.map +1 -1
- package/dist/apply-job.d.ts +5 -0
- package/dist/apply-job.js +10 -3
- package/dist/apply-job.js.map +1 -1
- package/dist/auth-api.d.ts +1 -1
- package/dist/auth-api.js +15 -2
- package/dist/auth-api.js.map +1 -1
- package/dist/authority/web-authority.d.ts +13 -0
- package/dist/authority/web-authority.js +12 -0
- package/dist/authority/web-authority.js.map +1 -1
- package/dist/backend/claude-code.js +47 -9
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/kiro.js +1 -1
- package/dist/backend/kiro.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/access-manager.d.ts +1 -6
- package/dist/channel/access-manager.js +4 -94
- package/dist/channel/access-manager.js.map +1 -1
- package/dist/channel/adapters/discord.d.ts +0 -2
- package/dist/channel/adapters/discord.js +0 -8
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/adapters/telegram.d.ts +0 -3
- package/dist/channel/adapters/telegram.js +1 -30
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/types.d.ts +0 -2
- package/dist/cli.js +1 -19
- package/dist/cli.js.map +1 -1
- package/dist/config-validator.js +2 -1
- package/dist/config-validator.js.map +1 -1
- package/dist/fleet-manager.d.ts +84 -3
- package/dist/fleet-manager.js +494 -51
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +22 -7
- package/dist/general-knowledge/steering/core-rules.md +7 -5
- package/dist/hub/buttons.js +4 -2
- package/dist/hub/buttons.js.map +1 -1
- package/dist/hub/catalog.d.ts +2 -2
- package/dist/hub/catalog.js +233 -48
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/client.js +2 -0
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +6 -0
- package/dist/hub/compose/member.js +9 -1
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +11 -1
- package/dist/hub/compose/server.js +70 -3
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/directory/directory.d.ts +1 -1
- package/dist/hub/directory/directory.js +32 -23
- package/dist/hub/directory/directory.js.map +1 -1
- package/dist/hub/directory/index.d.ts +1 -1
- package/dist/hub/directory/types.d.ts +8 -2
- package/dist/hub/directory/types.js.map +1 -1
- package/dist/hub/group-policy/admin-api.d.ts +30 -0
- package/dist/hub/group-policy/admin-api.js +83 -0
- package/dist/hub/group-policy/admin-api.js.map +1 -0
- package/dist/hub/group-policy/admin-context.d.ts +23 -0
- package/dist/hub/group-policy/admin-context.js +52 -0
- package/dist/hub/group-policy/admin-context.js.map +1 -0
- package/dist/hub/group-policy/admin-control.d.ts +34 -0
- package/dist/hub/group-policy/admin-control.js +258 -0
- package/dist/hub/group-policy/admin-control.js.map +1 -0
- package/dist/hub/group-policy/admin-dto.d.ts +243 -0
- package/dist/hub/group-policy/admin-dto.js +55 -0
- package/dist/hub/group-policy/admin-dto.js.map +1 -0
- package/dist/hub/group-policy/admin-facts.d.ts +17 -0
- package/dist/hub/group-policy/admin-facts.js +33 -0
- package/dist/hub/group-policy/admin-facts.js.map +1 -0
- package/dist/hub/group-policy/admin-impact.d.ts +51 -0
- package/dist/hub/group-policy/admin-impact.js +88 -0
- package/dist/hub/group-policy/admin-impact.js.map +1 -0
- package/dist/hub/group-policy/admin-inventory.d.ts +24 -0
- package/dist/hub/group-policy/admin-inventory.js +72 -0
- package/dist/hub/group-policy/admin-inventory.js.map +1 -0
- package/dist/hub/group-policy/admin-read.d.ts +21 -0
- package/dist/hub/group-policy/admin-read.js +90 -0
- package/dist/hub/group-policy/admin-read.js.map +1 -0
- package/dist/hub/group-policy/authorization.d.ts +60 -0
- package/dist/hub/group-policy/authorization.js +292 -0
- package/dist/hub/group-policy/authorization.js.map +1 -0
- package/dist/hub/group-policy/impact-inventory.d.ts +21 -0
- package/dist/hub/group-policy/impact-inventory.js +75 -0
- package/dist/hub/group-policy/impact-inventory.js.map +1 -0
- package/dist/hub/group-policy/resources.d.ts +22 -2
- package/dist/hub/group-policy/resources.js +119 -25
- package/dist/hub/group-policy/resources.js.map +1 -1
- package/dist/hub/group-policy/store.d.ts +19 -2
- package/dist/hub/group-policy/store.js +66 -5
- package/dist/hub/group-policy/store.js.map +1 -1
- package/dist/hub/group-policy/welcome.d.ts +36 -0
- package/dist/hub/group-policy/welcome.js +55 -0
- package/dist/hub/group-policy/welcome.js.map +1 -0
- package/dist/hub/http/compose.d.ts +2 -0
- package/dist/hub/http/compose.js +133 -12
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.d.ts +23 -3
- package/dist/hub/http/core.js +138 -5
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/http/deps.d.ts +10 -0
- package/dist/hub/member/pairing-api.d.ts +2 -0
- package/dist/hub/member/pairing-api.js +1 -0
- package/dist/hub/member/pairing-api.js.map +1 -1
- package/dist/hub/member/pairing-notices.d.ts +18 -0
- package/dist/hub/member/pairing-notices.js +58 -0
- package/dist/hub/member/pairing-notices.js.map +1 -0
- package/dist/hub/pairing-notices.d.ts +47 -0
- package/dist/hub/pairing-notices.js +241 -0
- package/dist/hub/pairing-notices.js.map +1 -0
- package/dist/hub/pairing.d.ts +33 -1
- package/dist/hub/pairing.js +315 -15
- package/dist/hub/pairing.js.map +1 -1
- package/dist/hub/policy.d.ts +3 -1
- package/dist/hub/policy.js +13 -6
- package/dist/hub/policy.js.map +1 -1
- package/dist/hub/protocol.d.ts +32 -0
- package/dist/hub/protocol.js +6 -1
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/rooms.d.ts +1 -0
- package/dist/hub/rooms.js +76 -26
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/runtime.d.ts +4 -1
- package/dist/hub/runtime.js +11 -0
- package/dist/hub/runtime.js.map +1 -1
- package/dist/hub/server.js +4 -0
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/sessions.js +2 -1
- package/dist/hub/sessions.js.map +1 -1
- package/dist/hub/store.d.ts +10 -1
- package/dist/hub/store.js +7 -4
- package/dist/hub/store.js.map +1 -1
- package/dist/hub/types.d.ts +15 -2
- package/dist/locale.js +48 -36
- package/dist/locale.js.map +1 -1
- package/dist/login-controller.d.ts +9 -1
- package/dist/login-controller.js +20 -1
- package/dist/login-controller.js.map +1 -1
- package/dist/login-flows.js +4 -2
- package/dist/login-flows.js.map +1 -1
- package/dist/office-share-page.js +1 -1
- package/dist/office-share-page.js.map +1 -1
- package/dist/outbound-handlers.js +1 -1
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/quickstart-api.js +2 -2
- package/dist/quickstart-api.js.map +1 -1
- package/dist/reply-buttons-controller.d.ts +5 -1
- package/dist/reply-buttons-controller.js +8 -4
- package/dist/reply-buttons-controller.js.map +1 -1
- package/dist/reply-buttons.d.ts +6 -2
- package/dist/reply-buttons.js +7 -3
- package/dist/reply-buttons.js.map +1 -1
- package/dist/runtime-api.js +10 -2
- package/dist/runtime-api.js.map +1 -1
- package/dist/settings-api.d.ts +2 -1
- package/dist/settings-api.js +7 -5
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.d.ts +10 -0
- package/dist/settings-change.js +17 -1
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-confirmation.d.ts +25 -1
- package/dist/settings-confirmation.js +11 -3
- package/dist/settings-confirmation.js.map +1 -1
- package/dist/settings-effect.js +18 -6
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.d.ts +21 -0
- package/dist/settings-http-confirmation.js +74 -3
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/signin-keepalive.d.ts +2 -0
- package/dist/signin-keepalive.js +30 -2
- package/dist/signin-keepalive.js.map +1 -1
- package/dist/structured-signin.js +3 -1
- package/dist/structured-signin.js.map +1 -1
- package/dist/tips.js +4 -4
- package/dist/tips.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.js.map +1 -1
- package/dist/ui/accounts-keepalive.js +14 -8
- package/dist/ui/accounts-manage.js +31 -13
- package/dist/ui/accounts-view.js +93 -35
- package/dist/ui/backend-signin.js +22 -4
- package/dist/ui/general-location.js +28 -14
- package/dist/ui/hub-chat-store.js +2 -1
- package/dist/ui/hub-client.js +43 -3
- package/dist/ui/hub-grant-strings.js +13 -0
- package/dist/ui/hub-group-policy.js +170 -0
- package/dist/ui/hub-group-strings.js +97 -0
- package/dist/ui/hub-owner-strings.js +6 -2
- package/dist/ui/hub-pairing-progress-strings.js +15 -0
- package/dist/ui/hub-quick-pairing.js +202 -0
- package/dist/ui/hub-quick-strings.js +43 -0
- package/dist/ui/hub-read-strings.js +7 -0
- package/dist/ui/hub-strings.js +4 -2
- package/dist/ui/hub-welcome.js +99 -0
- package/dist/ui/panel-hub.js +115 -33
- package/dist/ui/panel-log.js +2 -2
- package/dist/ui/panel-runtimes.js +14 -6
- package/dist/ui/panel-settings.js +12 -21
- package/dist/ui/runtime-cli-install.js +24 -4
- package/dist/ui/settings-apply.js +12 -5
- package/dist/ui/settings-confirm.js +28 -0
- package/dist/ui/settings-devices.js +8 -12
- package/dist/ui/settings-dialogs.js +3 -1
- package/dist/ui/settings-hub-membership.js +24 -10
- package/dist/ui/settings-hub-section.js +60 -0
- package/dist/ui/settings-hub.js +58 -13
- package/dist/ui/settings-layout.js +6 -2
- package/dist/ui/settings-named-test.js +2 -2
- package/dist/ui/settings-outside.js +1 -1
- package/dist/ui/settings-quota-notice.js +8 -6
- package/dist/ui/settings-registry.js +3 -0
- package/dist/ui/settings-restart-strings.js +17 -0
- package/dist/ui/settings-strings.js +12 -10
- package/dist/ui/shared/accounts-keepalive.css +11 -6
- package/dist/ui/shared/accounts.css +68 -18
- package/dist/ui/shared/app-i18n.js +7 -2
- package/dist/ui/shared/app-route.js +1 -1
- package/dist/ui/shared/app-shell.js +114 -7
- package/dist/ui/shared/app.css +16 -0
- package/dist/ui/shared/chat-strings.js +8 -8
- package/dist/ui/shared/hub-groups.css +26 -0
- package/dist/ui/shared/hub-owner.css +2 -2
- package/dist/ui/shared/hub-signin.css +24 -0
- package/dist/ui/shared/hub.css +1 -0
- package/dist/ui/shared/setup-host-text.js +4 -1
- package/dist/ui/shared/signin.js +3 -1
- package/dist/ui/shared/usage-dialog.js +3 -72
- package/dist/ui/shared/usage-meter.js +84 -0
- package/dist/ui/shared/view-strings.js +4 -4
- package/dist/ui/shared/web-authorize.js +4 -4
- package/dist/ui/structured-signin.js +16 -8
- package/dist/update-marker.d.ts +2 -0
- package/dist/update-marker.js.map +1 -1
- package/dist/usage/providers.d.ts +1 -0
- package/dist/usage/providers.js +13 -9
- package/dist/usage/providers.js.map +1 -1
- package/dist/web-api.d.ts +10 -1
- package/dist/web-api.js +40 -11
- package/dist/web-api.js.map +1 -1
- package/dist/web-backend-login.d.ts +16 -2
- package/dist/web-backend-login.js +14 -0
- package/dist/web-backend-login.js.map +1 -1
- package/dist/web-notices.d.ts +9 -0
- package/dist/web-notices.js +19 -0
- package/dist/web-notices.js.map +1 -1
- package/dist/web-remote-access.d.ts +6 -0
- package/dist/web-remote-access.js +10 -1
- package/dist/web-remote-access.js.map +1 -1
- package/dist/web-shell-routes.d.ts +1 -1
- package/dist/web-shell-routes.js +1 -1
- package/dist/web-shell-routes.js.map +1 -1
- package/dist/web-terminal.d.ts +7 -0
- package/dist/web-terminal.js +14 -2
- package/dist/web-terminal.js.map +1 -1
- package/dist/windows-cli-api.d.ts +8 -0
- package/dist/windows-cli-api.js +10 -0
- package/dist/windows-cli-api.js.map +1 -1
- package/package.json +2 -1
|
@@ -27,6 +27,7 @@ import { toast } from "/assets/ui-toast.js";
|
|
|
27
27
|
import { GroupMark, groupLabel, groupOf as navGroupOf, modelText } from "/assets/instance-nav.js";
|
|
28
28
|
import "./settings-strings.js";
|
|
29
29
|
import "./settings-shared-strings.js"; // see settings-shared.js: the words Shared agent settings added, which an older settings-strings.js in an open tab lacks
|
|
30
|
+
import "./settings-restart-strings.js"; // S-92: the restart words for a fleet with no chat connection (a file of its own: an open tab may hold an old settings-strings.js)
|
|
30
31
|
import "./settings-access-strings.js"; // the words Access & security added (settings.webLoginQr…): an older settings-strings.js from a tab that visited Fleet first lacks them (#3061)
|
|
31
32
|
import { api, attach, confirmedWrite, newKey } from "./settings-confirm.js";
|
|
32
33
|
import { dismissOperation, operationActive, restartFleet, startOperation, takeLeftover } from "./settings-apply.js";
|
|
@@ -60,22 +61,7 @@ import { syncStage, useDraft } from "./settings-draft.js";
|
|
|
60
61
|
import { WebAuthorityCard } from "./settings-web-authority.js";
|
|
61
62
|
import { OutsideCard } from "./settings-outside.js";
|
|
62
63
|
import { DevicesCard } from "./settings-devices.js";
|
|
63
|
-
|
|
64
|
-
function HubCardSlot() {
|
|
65
|
-
const [Card, setCard] = useState(null);
|
|
66
|
-
useEffect(() => { let live = true; import("./settings-hub-membership.js").then((m) => { if (live) setCard(() => m.HubMembershipSettings); }, () => {}); return () => { live = false; }; }, []);
|
|
67
|
-
return Card ? html`<${Card} />` : null;
|
|
68
|
-
}
|
|
69
|
-
function HubBrowserCertificateSlot() {
|
|
70
|
-
const [Card, setCard] = useState(null);
|
|
71
|
-
useEffect(() => { let live = true; import("./settings-hub-browser-certificate.js").then(m => { if (live) setCard(() => m.HubBrowserCertificateSettings); }, () => {}); return () => { live = false; }; }, []);
|
|
72
|
-
return Card ? html`<${Card} />` : null;
|
|
73
|
-
}
|
|
74
|
-
function HubRetentionSlot() {
|
|
75
|
-
const [Card, setCard] = useState(null);
|
|
76
|
-
useEffect(() => { let live = true; import("./settings-hub-retention.js").then(m => { if (live) setCard(() => m.HubRetentionSettings); }, () => {}); return () => { live = false; }; }, []);
|
|
77
|
-
return Card ? html`<${Card} />` : null;
|
|
78
|
-
}
|
|
64
|
+
import { HubSection, hubSectionText } from "./settings-hub-section.js";
|
|
79
65
|
import { NamedLinkTest, setTypedTunnelToken } from "./settings-named-test.js";
|
|
80
66
|
import { SignInList } from "./backend-signin.js";
|
|
81
67
|
import { AccountsView, defaultsBackendOptions } from "./accounts-view.js"; // #3212: SignInList stays exported for a page that still imports it
|
|
@@ -93,7 +79,7 @@ const APPLY_ERRORS = new Set(["unsupported_sensitive_effect", "confirmation_diff
|
|
|
93
79
|
"request_no_longer_current", "too_many_pending_changes", "fleet_unavailable", "invalid_settings_effect", "settings_confirmation_unavailable", "failed"]);
|
|
94
80
|
// #2726: a code or words of the setup host (the wizard's commit) in the page's language; anything else as it came.
|
|
95
81
|
export const applyErrorText = (code) => (APPLY_ERRORS.has(code) ? tn(`applyError_${code}`) : tn("applyErrorOther", hostText(String(code), lang())));
|
|
96
|
-
const ICONS = { preferences: "user", look: "palette", agents: "bot", notifications: "sliders", runtimes: "view", "agent-defaults": "sliders", chat: "chat", "web-dashboard": "globe", access: "key", advanced: "code" };
|
|
82
|
+
const ICONS = { preferences: "user", look: "palette", agents: "bot", notifications: "sliders", runtimes: "view", "agent-defaults": "sliders", chat: "chat", "web-dashboard": "globe", access: "key", hub: "plug", advanced: "code" };
|
|
97
83
|
|
|
98
84
|
/** GET under the panel's lease → { ok, status, body }. */
|
|
99
85
|
async function read(lease, path) {
|
|
@@ -434,6 +420,8 @@ export function SettingsPanel({ route, navKey }) {
|
|
|
434
420
|
<details class="s-ui-disclosure s-classic-defaults"><summary>${layoutText("classicDefaults")}</summary><div class="s-disclosure-body"><${General} key=${formKey} ctx=${ctx} part="classic" /></div></details></div>`
|
|
435
421
|
: section === "web-dashboard" ? html`<${WebSection} key=${formKey} ctx=${ctx} staged=${staged} part="dashboard" /><${AppearanceSection} ...${you} part="dashboard" />`
|
|
436
422
|
: section === "access" ? html`<${WebSection} key=${formKey} ctx=${ctx} staged=${staged} part="access" />`
|
|
423
|
+
// alpha.6 feedback (#2): the Hub cards have their own section (they were under Access & security, unfound by search).
|
|
424
|
+
: section === "hub" ? html`<${HubSection} overPublicLink=${typeof document !== "undefined" && document.body?.dataset?.publicLink === "1"} hubHost=${!!ctx.fleet.hub?.hubId} hubOrigin=${ctx.fleet.hub?.webOrigin} />`
|
|
437
425
|
: html`<${AdvancedSettings} ctx=${ctx} staged=${staged} formKey=${formKey} draftEpoch=${draftEpoch} />`;
|
|
438
426
|
// #2347 §6: the setting a search result opened — brought into view once its section is drawn (its data may still be
|
|
439
427
|
// on its way), focused, and flashed for 2 s.
|
|
@@ -1414,8 +1402,8 @@ function WebSection({ ctx, staged, part = "all" }) {
|
|
|
1414
1402
|
<details class="s-setting-details"><summary>${layoutText("revSessionDetails")}</summary><p class="note">${tn("webSessionHint")}</p><p class="note">${tn("webNotifyLoginHint")}</p></details>
|
|
1415
1403
|
</section>`)}
|
|
1416
1404
|
${!overPublicLink ? html`<${WebAuthorityCard} ctx=${ctx} staged=${staged} />` : null}
|
|
1417
|
-
${
|
|
1418
|
-
${!overPublicLink
|
|
1405
|
+
${/* A tab whose shell is from before Settings → Hub (its app-route.js has no "hub"): the Hub cards stay here. */ ""}
|
|
1406
|
+
${!SETTINGS_SECTIONS.includes("hub") ? html`<${HubSection} overPublicLink=${overPublicLink} hubHost=${!!ctx.fleet.hub?.hubId} hubOrigin=${ctx.fleet.hub?.webOrigin} />` : null}
|
|
1419
1407
|
<details class="drawer s-terminal-disclosure"><summary>${tn("webTerminalTitle")}</summary><div class="drawer-body">${lock(html`<section class="card s-access-terminal"><h3>${tn("webTerminalTitle")}</h3>
|
|
1420
1408
|
<p class="note">${tn("webTerminalHint")}</p>
|
|
1421
1409
|
<label class=${fc("check", "termOn")}><input id="webTerminalEnabled" type="checkbox" checked=${f.termOn} onChange=${(e) => set("termOn")(e.target.checked)} /><span>${tn("webTerminalEnabled")}</span><${Impact} schema=${schema} field="web_terminal.enabled" /></label>
|
|
@@ -1428,6 +1416,7 @@ function WebSection({ ctx, staged, part = "all" }) {
|
|
|
1428
1416
|
</div><aside class="card s-access-related"><h3>${layoutText("revRelatedAccess")}</h3>
|
|
1429
1417
|
<button type="button" onClick=${() => setAccessTab("guests")}><${Icon} name="user" size=${18} /><span><strong>${layoutText("accessGuests")}</strong><small>${layoutText("revRelatedGuests")}</small></span><${Icon} name="chevron" size=${16} /></button>
|
|
1430
1418
|
<button type="button" onClick=${() => setAccessTab("sharing")}><${Icon} name="globe" size=${18} /><span><strong>${layoutText("accessSharing")}</strong><small>${layoutText("revRelatedSharing")}</small></span><${Icon} name="chevron" size=${16} /></button>
|
|
1419
|
+
${!overPublicLink && SETTINGS_SECTIONS.includes("hub") ? html`<button type="button" onClick=${() => navigate(sectionPath("hub"))}><${Icon} name="plug" size=${18} /><span><strong>${hubSectionText("relatedTitle")}</strong><small>${hubSectionText("relatedHint")}</small></span><${Icon} name="chevron" size=${16} /></button>` : null}
|
|
1431
1420
|
</aside></div>
|
|
1432
1421
|
</${SettingsTabPanel}>
|
|
1433
1422
|
<${SettingsTabPanel} group="access" id="guests" active=${accessTab === "guests"}>
|
|
@@ -1586,17 +1575,19 @@ function OperationCard({ op, schema }) {
|
|
|
1586
1575
|
const needsRestart = rows.some((r) => r.status === "restart-required");
|
|
1587
1576
|
const failedRows = rows.some((r) => r.status === "failed");
|
|
1588
1577
|
const mismatch = schema && schema.fleet_signature_mismatch;
|
|
1578
|
+
// S-92: a fleet with no chat connection — its restart is recorded in the dashboard's Notices, not a chat channel.
|
|
1579
|
+
const webOnly = useStore(appStore).connections === 0;
|
|
1589
1580
|
const title = op.phase === "failed" ? tn("applyPartial") : fleetRestarting ? tn("restartFleetTitle") : busy ? tn("applying")
|
|
1590
1581
|
: failedRows ? tn("applyPartial") : needsRestart ? tn("applyRestartNeeded") : tn("applyDone");
|
|
1591
1582
|
const note = op.phase === "failed" ? (op.error === "busy" ? tn("applyBusy") : op.error ? tn("applyStepFailed", applyErrorText(op.error)) : "")
|
|
1592
1583
|
: fleetRestarting ? tn("restartFleetWaiting") : op.lostJob ? tn("applyLostJob")
|
|
1593
1584
|
: job && job.overdue ? tn("applyStillWorking", Math.round((job.elapsed_ms || 0) / 1000))
|
|
1594
|
-
: mismatch && needsRestart ? tn("signatureMismatch", mismatch.join(", ")) : needsRestart ? tn("applyRestartHint") : "";
|
|
1585
|
+
: mismatch && needsRestart ? tn("signatureMismatch", mismatch.join(", ")) : needsRestart ? tn(webOnly ? "applyRestartHintWebOnly" : "applyRestartHint") : "";
|
|
1595
1586
|
const lease = useLease("operation-card");
|
|
1596
1587
|
const restart = async () => {
|
|
1597
1588
|
// The yes is for the job this card shows: it restarts AgEnD for that job only, and only while the card stands.
|
|
1598
1589
|
const forJob = { opId: op.id, jobId: op.job && op.job.id };
|
|
1599
|
-
if (!(await ask(tn("restartFleetConfirm"), { title: tn("restartFleetButton"), confirmLabel: tn("restartFleetButton"), danger: true }))) return;
|
|
1590
|
+
if (!(await ask(tn(webOnly ? "restartFleetConfirmWebOnly" : "restartFleetConfirm"), { title: tn("restartFleetButton"), confirmLabel: tn("restartFleetButton"), danger: true }))) return;
|
|
1600
1591
|
if (!lease.current()) return;
|
|
1601
1592
|
setRestarting(true);
|
|
1602
1593
|
const res = await restartFleet(forJob);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
2
2
|
import { register, t } from "/assets/app-i18n.js";
|
|
3
3
|
import { confirmDialog } from "/assets/ui-confirm.js";
|
|
4
|
+
import { ErrorState, Skeleton } from "/assets/ui-states.js";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* #3190 Part 3b: install a CLI on a paired Windows computer, from Settings → Runtime. The page sends only a CLI id; the Runtime on that computer decides the
|
|
@@ -43,6 +44,20 @@ export const OFFICIAL_COMMANDS = [
|
|
|
43
44
|
export const versionNumber = printed => typeof printed === "string" ? /(?<![\d.])\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?![\d.])/.exec(printed)?.[0] ?? null : null;
|
|
44
45
|
export const offersCliInstall = machine => !!machine && !machine.isLocal && machine.runtimeInfo?.capabilities?.includes("cli-install") === true && ["online", "offline"].includes(machine.status);
|
|
45
46
|
|
|
47
|
+
// Ridge #3321 S06 / S09: the words of the loading state and the copyable commands.
|
|
48
|
+
register("runtimeInstall", {
|
|
49
|
+
en: { loading: "Reading this computer's install setting…", copy: "Copy", copied: "Copied", switchCommand: "Command for that computer" },
|
|
50
|
+
"zh-TW": { loading: "正在讀取這台電腦的安裝設定…", copy: "複製", copied: "已複製", switchCommand: "在那台電腦執行的指令" },
|
|
51
|
+
});
|
|
52
|
+
/** Ridge #3321 S09: a command to run on that computer — Runtime's labelled command card (runtime-install.css), with Copy. */
|
|
53
|
+
function CommandCard({ label, command }) {
|
|
54
|
+
const [copied, setCopied] = useState(false);
|
|
55
|
+
const copy = async () => { try { await navigator.clipboard.writeText(command); setCopied(true); } catch { /* it is on screen to copy by hand */ } };
|
|
56
|
+
return html`<div class="runtime-command-card"><span class="runtime-command-label">${label}</span><div class="runtime-command-row">
|
|
57
|
+
<pre class="runtime-command-text" tabindex="0" aria-label=${label}><code>${command}</code></pre>
|
|
58
|
+
<button type="button" class="btn btn-sm" onClick=${copy}>${text(copied ? "copied" : "copy")}</button></div></div>`;
|
|
59
|
+
}
|
|
60
|
+
|
|
46
61
|
export function CliInstall({ machine, lease, onChanged }) {
|
|
47
62
|
const [view, setView] = useState(null), [error, setError] = useState(""), [note, setNote] = useState(""), [busy, setBusy] = useState(false);
|
|
48
63
|
const last = useRef("");
|
|
@@ -56,7 +71,8 @@ export function CliInstall({ machine, lease, onChanged }) {
|
|
|
56
71
|
setView(value);
|
|
57
72
|
return value;
|
|
58
73
|
};
|
|
59
|
-
|
|
74
|
+
const [attempt, setAttempt] = useState(0);
|
|
75
|
+
useEffect(() => { if (online) { setError(""); load().catch(() => { if (lease.current()) setError(text("unreadable")); }); } }, [lease, machine.id, online, attempt]);
|
|
60
76
|
const job = view?.job, running = job?.state === "installing";
|
|
61
77
|
// While an install runs the page asks again every few seconds; when it ends the computer's list is refreshed once.
|
|
62
78
|
useEffect(() => {
|
|
@@ -100,15 +116,19 @@ export function CliInstall({ machine, lease, onChanged }) {
|
|
|
100
116
|
${upToDate ? null : html`<button type="button" class="btn btn-sm" disabled=${!allowed || !online || busy || running || !pinned} onClick=${start}>${entry ? text("reinstall", pinned) : text("install", pinned)}</button>`}</li>`;
|
|
101
117
|
};
|
|
102
118
|
return html`<div class="runtime-cli-install"><h4>${text("title")}</h4><p class="note">${text("lead")}</p>
|
|
103
|
-
${!online ? html`<p class="note" role="status">${text("offline")}</p>`
|
|
119
|
+
${!online ? html`<p class="note" role="status">${text("offline")}</p>`
|
|
120
|
+
// Ridge #3321 S06: until the computer's setting and the pinned versions are read, the shared loading state — not a
|
|
121
|
+
// settled-looking form of disabled buttons with empty versions; a first read that fails says so, with Retry.
|
|
122
|
+
: !view ? (error ? html`<${ErrorState} message=${error} onRetry=${() => setAttempt((n) => n + 1)} />` : html`<${Skeleton} variant="rows" lines=${2} label=${text("loading")} />`)
|
|
123
|
+
: !view.capable ? html`<p class="note" role="status">${text("old")}</p>` : html`
|
|
104
124
|
<ul class="runtime-cli-install-list" aria-label=${text("title")}>${INSTALL_CLIS.map(row)}</ul>
|
|
105
125
|
${view && !view.switches ? html`<p class="note" role="status">${text("unreadable")}</p>` : null}
|
|
106
|
-
${switchState && !allowed ? html`<p class="note runtime-cli-install-off" role="status">${text("switchOff")}</p
|
|
126
|
+
${switchState && !allowed ? html`<p class="note runtime-cli-install-off" role="status">${text("switchOff")}</p><${CommandCard} label=${text("switchCommand")} command=${SWITCH_COMMAND} />` : null}
|
|
107
127
|
${allowed ? html`<p class="note">${switchState.until ? text("switchUntil", new Date(switchState.until).toLocaleString()) : text("switchOn")}</p>` : null}
|
|
108
128
|
${running ? html`<p class="note" role="status" aria-busy="true"><span class="out-spin" aria-hidden="true"></span> ${text("installing")}</p>` : null}
|
|
109
129
|
${note ? html`<p class="note" role="status">${note}</p>` : null}
|
|
110
130
|
${error ? html`<p class="runtime-error" role="alert">${error}</p>` : null}`}
|
|
111
131
|
<details class="runtime-cli-install-others"><summary>${text("othersTitle")}</summary><p class="note">${text("othersLead")}</p>
|
|
112
|
-
<ul>${OFFICIAL_COMMANDS.map(item => html`<li key=${item.id}
|
|
132
|
+
<ul>${OFFICIAL_COMMANDS.map(item => html`<li key=${item.id}><${CommandCard} label=${item.administrator ? `${item.label} (${text("needsAdmin")})` : item.label} command=${item.command} /></li>`)}</ul></details>
|
|
113
133
|
</div>`;
|
|
114
134
|
}
|
|
@@ -213,12 +213,16 @@ async function watch(o, id) {
|
|
|
213
213
|
* A full AgEnD restart for a job that needs one: its own confirmation (the caller's), its own key, one at a time. The
|
|
214
214
|
* job's fleet row moves to "running" on the server; that job is watched again.
|
|
215
215
|
*/
|
|
216
|
-
/**
|
|
216
|
+
/**
|
|
217
|
+
* POST /api/settings/restart-fleet for `jobId`, with its own key: { ok, status, body } (a lost answer: status 0). `jobId`
|
|
218
|
+
* null (S-92): the pending changes' own restart, when no Settings job carries it (a hand edit) — the server makes one.
|
|
219
|
+
* The confirmation is this request's value; the person only clicks (and answers the restart's own dialog).
|
|
220
|
+
*/
|
|
217
221
|
async function postRestart(jobId) {
|
|
218
222
|
const key = newKey("restart");
|
|
219
223
|
try {
|
|
220
224
|
return await api("/api/settings/restart-fleet", { method: "POST", headers: { "Idempotency-Key": key },
|
|
221
|
-
body: JSON.stringify({ job_id: jobId, confirm: "restart-agend", idempotency_key: key }) });
|
|
225
|
+
body: JSON.stringify({ ...(jobId ? { job_id: jobId } : { pending: true }), confirm: "restart-agend", idempotency_key: key }) });
|
|
222
226
|
} catch { return { ok: false, status: 0, body: null }; }
|
|
223
227
|
}
|
|
224
228
|
|
|
@@ -247,11 +251,14 @@ export async function restartFleet(forJob) {
|
|
|
247
251
|
* become the operation, so its card and line follow the restart as they follow any other (a refusal leaves the banner
|
|
248
252
|
* as it was). The caller asked first.
|
|
249
253
|
*/
|
|
250
|
-
export async function restartPendingChanges(
|
|
254
|
+
export async function restartPendingChanges(asked) {
|
|
251
255
|
if (operationActive()) return { ok: false, busy: true };
|
|
252
|
-
if (op && op.job && op.job.id ===
|
|
253
|
-
const res = await postRestart(
|
|
256
|
+
if (asked && op && op.job && op.job.id === asked) return restartFleet({ opId: op.id, jobId: asked });
|
|
257
|
+
const res = await postRestart(asked || null);
|
|
254
258
|
if (!res.ok || operationActive()) return res;
|
|
259
|
+
// The job that carries it: the one asked for, or (S-92) the one the server made for it.
|
|
260
|
+
const jobId = asked || (res.body && typeof res.body.job_id === "string" ? res.body.job_id : null);
|
|
261
|
+
if (!jobId) return res;
|
|
255
262
|
toast(t("settings.restartFleetStarted"));
|
|
256
263
|
let fresh = null;
|
|
257
264
|
try { fresh = await api(`/api/settings/apply/${encodeURIComponent(jobId)}`); } catch { fresh = null; }
|
|
@@ -67,6 +67,13 @@ function publish() {
|
|
|
67
67
|
withdraw: view.can_withdraw && view.state === "pending" ? () => withdraw(view.id) : null,
|
|
68
68
|
// #2868: this browser may confirm it itself now (the server's read says so; it checks again on the click).
|
|
69
69
|
applyNow: view.can_self_confirm && view.state === "pending" ? () => applyNow(view.id) : null,
|
|
70
|
+
// alpha.6 #2c (hmsg-468cc290): a web-only fleet's own page may confirm it with the authenticator's code.
|
|
71
|
+
confirmWithCode: view.totp === "ready" && view.state === "pending" ? (code) => confirmWithCode(view.id, code) : null,
|
|
72
|
+
totpNotSetUp: view.totp === "not_set_up" && view.state === "pending",
|
|
73
|
+
// Over a link (the leader's ruling (b)): no code here — confirm it in the host computer's own browser, or in General.
|
|
74
|
+
onHost: view.totp === "on_host" && view.state === "pending",
|
|
75
|
+
// A link option turned on (#2453, the leader's ruling on D3): only the browser on the AgEnD computer itself confirms it.
|
|
76
|
+
hostBrowser: view.totp === "host_browser" && view.state === "pending",
|
|
70
77
|
dismiss: TERMINAL.has(view.state) ? () => forget(view.id) : null,
|
|
71
78
|
})),
|
|
72
79
|
});
|
|
@@ -168,6 +175,27 @@ export async function applyNow(id) {
|
|
|
168
175
|
return { ok: false, status: res.status };
|
|
169
176
|
}
|
|
170
177
|
|
|
178
|
+
/**
|
|
179
|
+
* alpha.6 feedback #2c (the user's decision hmsg-468cc290): confirm a pending change on this computer's own page with the
|
|
180
|
+
* owner's authenticator code. The server checks the code (each time step once, the fleet-wide wrong-code limit) and asks
|
|
181
|
+
* again at execution. { ok } or why not: "wrong", "paused" (retryAfterMs), "not_here" (this page can no longer), "unavailable".
|
|
182
|
+
*/
|
|
183
|
+
export async function confirmWithCode(id, code) {
|
|
184
|
+
const e = tracked.get(id);
|
|
185
|
+
if (!e) return { ok: false, error: "not_here" };
|
|
186
|
+
const token = ticket(e);
|
|
187
|
+
let res;
|
|
188
|
+
try { res = await api(`/api/settings/pending/${encodeURIComponent(id)}/confirm-totp`, { method: "POST", body: JSON.stringify({ code: String(code || "").replace(/\s+/g, ""), digest: String(e.view.confirm_digest || "") }) }); }
|
|
189
|
+
catch { return { ok: false, error: "unavailable" }; }
|
|
190
|
+
if (isPendingResponse(res) && res.body.pending_change.id === id) { update(res.body.pending_change, token); schedule(); return { ok: true }; }
|
|
191
|
+
if (res.status === 401 && res.body && res.body.error === "wrong_code") return { ok: false, error: "wrong" };
|
|
192
|
+
if (res.status === 429) return { ok: false, error: "paused", retryAfterMs: Number(res.body && res.body.retryAfterMs) || null };
|
|
193
|
+
// The change is not the one this page showed (#3352 security review, point 2): read it again; the code was not used.
|
|
194
|
+
if (res.status === 409 && res.body && res.body.error === "confirmation_changed") return { ok: false, error: "changed" };
|
|
195
|
+
if (res.status === 403) { if (e.view.totp) update({ ...e.view, totp: undefined }, token); return { ok: false, error: "not_here" }; }
|
|
196
|
+
return { ok: false, error: "unavailable" };
|
|
197
|
+
}
|
|
198
|
+
|
|
171
199
|
/** This session's requests still open on the server (after a reload): followed like new ones. */
|
|
172
200
|
export async function attach() {
|
|
173
201
|
let res;
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
// with the authenticator's code. Anyone else sees the card, the explanation and a disabled button. The server decides
|
|
13
13
|
// that on every request and refuses everything else regardless (POST /ui/devices/{lookup,approve,deny} → 403).
|
|
14
14
|
// Refs #3061 (review of P2b): with web authorization off nobody is an owner, so nobody can add a device or sign another out —
|
|
15
|
-
//
|
|
16
|
-
// confirm screen leads with where the request is from and its address (the device
|
|
17
|
-
// faked) and says to allow only when the new device shows the same code.
|
|
15
|
+
// this card is web-only (the reader is on the AgEnD computer's dashboard), so it explains that and does not name General
|
|
16
|
+
// or ask the computer's owner; and the confirm screen leads with where the request is from and its address (the device
|
|
17
|
+
// name is the browser's own word and can be faked) and says to allow only when the new device shows the same code.
|
|
18
18
|
// The words are English and 繁體中文, as everything in src/ui (tests/i18n-ui-literals-2390.test.ts).
|
|
19
19
|
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
20
20
|
import { t, register } from "/assets/app-i18n.js";
|
|
@@ -45,9 +45,8 @@ register("devices", {
|
|
|
45
45
|
signOutOwnerOnly: "Only a device whose owner is verified can sign out another device.",
|
|
46
46
|
signOutTitle: "Sign out this device?", signOutLead: "{0} will have to sign in again.", signOutGo: "Sign out",
|
|
47
47
|
signedOut: "{0} was signed out.", alreadyGone: "That device is already signed out.",
|
|
48
|
-
notSaved: "Signed out for now, but the change could not be saved: a restart may bring the session back.
|
|
49
|
-
|
|
50
|
-
authorityOffB: " on the AgEnD computer. It ends every session, this one included, and every device has to sign in again.",
|
|
48
|
+
notSaved: "Signed out for now, but the change could not be saved: a restart may bring the session back. This page cannot repair session storage.",
|
|
49
|
+
authorityOff: "Web authorization is off, so no device is the owner: none can add a device or sign another one out.",
|
|
51
50
|
},
|
|
52
51
|
"zh-TW": {
|
|
53
52
|
title: "裝置與登入", lead: "用 8 碼代碼讓新裝置登入。在已登入且已驗證擁有者的裝置上,到這裡核准。",
|
|
@@ -72,14 +71,11 @@ register("devices", {
|
|
|
72
71
|
signOutOwnerOnly: "只有已驗證擁有者的裝置才能登出其他裝置。",
|
|
73
72
|
signOutTitle: "登出這台裝置?", signOutLead: "{0} 需要重新登入。", signOutGo: "登出",
|
|
74
73
|
signedOut: "已登出 {0}。", alreadyGone: "這台裝置已經登出了。",
|
|
75
|
-
notSaved: "
|
|
76
|
-
|
|
77
|
-
authorityOffB: "。這個指令會結束所有工作階段(包括目前這個),每台裝置都要重新登入。",
|
|
74
|
+
notSaved: "暫時登出了,但變更沒能儲存:重新啟動後這個工作階段可能會回來。這個頁面無法修復工作階段的儲存問題。",
|
|
75
|
+
authorityOff: "網頁授權已關閉,所以沒有任何裝置是擁有者:不能新增裝置,也不能登出其他裝置。",
|
|
78
76
|
},
|
|
79
77
|
});
|
|
80
78
|
const td = (k, ...v) => t(`devices.${k}`, ...v);
|
|
81
|
-
/** The one thing that signs other devices out when nobody is an owner: a command, the same in both languages. */
|
|
82
|
-
export const ROTATE_COMMAND = "agend web-token rotate";
|
|
83
79
|
|
|
84
80
|
/** A wait as words: "2 minutes" / 「2 分鐘」 (rounded up). */
|
|
85
81
|
export function pauseWords(ms) {
|
|
@@ -241,7 +237,7 @@ export function DevicesCard() {
|
|
|
241
237
|
</li>`)}</ul>
|
|
242
238
|
${others && !s.owner && !authorityOff ? html`<p class="note" id="devicesSignOutOwnerOnly">${td("signOutOwnerOnly")}</p>` : null}
|
|
243
239
|
${note ? html`<p class=${`note ${note.ok ? "" : "error"}`} role=${note.ok ? "status" : "alert"} id="devicesNote">${note.text}</p>` : null}` : null}
|
|
244
|
-
${authorityOff ? html`<p class="note s-va-warn" id="devicesAuthorityOff">${td("
|
|
240
|
+
${authorityOff ? html`<p class="note s-va-warn" id="devicesAuthorityOff">${td("authorityOff")}</p>`
|
|
245
241
|
: !s.owner ? html`<p class="note" id="devicesOwnerOnly">${td("ownerOnly")}</p>` : null}
|
|
246
242
|
<div class="save-row"><button type="button" class="btn btn-primary" id="devicesAdd" disabled=${!s.owner} onClick=${open}>${td("add")}</button></div>
|
|
247
243
|
${dlg ? html`<${Dialog} title=${td("dlgTitle")} onClose=${close} busy=${busy} actions=${actions}>${body}</${Dialog}>` : null}
|
|
@@ -36,6 +36,8 @@ const CODEX_SPEED_CHOICES = ["", "standard", "fast"];
|
|
|
36
36
|
const byId = (id) => (typeof document !== "undefined" ? document.getElementById(id) : null);
|
|
37
37
|
|
|
38
38
|
const tn = (k, ...v) => t(`settings.${k}`, ...v);
|
|
39
|
+
// A cached older dictionary keeps the old alias label until reload, never a missing translation key.
|
|
40
|
+
const legacyPairingLabel = () => { const label = tn("legacyPairing"); return label === "settings.legacyPairing" ? "pairing" : label; };
|
|
39
41
|
export const impactText = (kind) => tn(kind === "now" ? "impactNow" : kind === "fleet" ? "impactFleet" : "impactAgent");
|
|
40
42
|
/** Ask in the app's own dialog (#1408 step 5): resolves true for the confirm button, false otherwise. */
|
|
41
43
|
export const ask = (message, opts = {}) => confirmDialog({ message, ...opts });
|
|
@@ -544,7 +546,7 @@ export function BotDialog({ id, ctx, onClose }) {
|
|
|
544
546
|
if (!ch) return null;
|
|
545
547
|
return html`<${EditDialog} title=${type === "telegram" ? "Telegram" : "Discord"} subtitle=${id} onClose=${onClose} onStage=${stage} impacts=${pendingImpacts()} schema=${schema}>
|
|
546
548
|
<div class="grid2">
|
|
547
|
-
<div class="field">${L(tn("accessMode"), "fleet.channel.access.mode", "bot-mode")}<${Select} id="bot-mode" value=${mode} onChange=${setMode} options=${ACCESS_MODES} />
|
|
549
|
+
<div class="field">${L(tn("accessMode"), "fleet.channel.access.mode", "bot-mode")}<${Select} id="bot-mode" value=${mode} onChange=${setMode} options=${ACCESS_MODES.map((value) => value === "pairing" ? { value, label: legacyPairingLabel() } : value)} />
|
|
548
550
|
<${Feedback} warning=${accessWarn} /></div>
|
|
549
551
|
<div class="field">${L(tn("allowedUsers"), "fleet.channel.access.allowed_users")}<${ChipList} items=${users} onChange=${setUsers} placeholder=${tn("userIdPlaceholder")} label=${tn("allowedUsers")} /></div>
|
|
550
552
|
</div>
|
|
@@ -11,21 +11,36 @@ register("hubMembership", {
|
|
|
11
11
|
loading: "Reading membership settings…", pending: "Waiting for owner confirmation…",
|
|
12
12
|
failed: "The membership change could not be verified. Check again before trying another change.",
|
|
13
13
|
unavailable: "Membership settings are unavailable. Open this fleet's own owner Settings and check again.",
|
|
14
|
-
retry: "Check again",
|
|
14
|
+
retry: "Check again",
|
|
15
15
|
},
|
|
16
16
|
"zh-TW": {
|
|
17
|
-
title: "Hub 成員功能", enabled: "
|
|
18
|
-
hint: "預設關閉。啟用不會自動配對 Hub
|
|
19
|
-
off: "關閉後會停止新的 Hub
|
|
17
|
+
title: "Hub 成員功能", enabled: "允許這個 Fleet 連線至 Hub",
|
|
18
|
+
hint: "預設關閉。啟用不會自動配對 Hub 或分享 Agent;請在下方另外選擇。",
|
|
19
|
+
off: "關閉後會停止新的 Hub 工作與回答傳送,既有 Agent 對話會保留。",
|
|
20
20
|
loading: "正在讀取成員設定…", pending: "等待擁有者確認…",
|
|
21
21
|
failed: "無法確認成員設定是否已變更。請再次檢查,再嘗試其他變更。",
|
|
22
|
-
unavailable: "
|
|
23
|
-
retry: "再次檢查",
|
|
22
|
+
unavailable: "目前無法使用成員設定。請開啟這個 Fleet 自己的擁有者設定頁面,再次檢查。",
|
|
23
|
+
retry: "再次檢查",
|
|
24
24
|
},
|
|
25
25
|
});
|
|
26
26
|
const copy = key => t(`hubMembership.${key}`);
|
|
27
27
|
const path = "/api/settings/hub/membership";
|
|
28
28
|
const markedMember = () => String(globalThis.document?.body?.dataset?.hub || "").split(/\s+/).includes("member");
|
|
29
|
+
/**
|
|
30
|
+
* The leader's cid-hub-no-reload (#3319: the user stuck on "Reload page"): the page's Hub mark follows the saved switch, in
|
|
31
|
+
* place — what the server would mark a fresh page with (web-api hubBodyAttrs: `hub_member.enabled`, never over a public
|
|
32
|
+
* link, which this card never renders on). So once turning membership on is applied — confirmed here, in General, or by the
|
|
33
|
+
* host's Apply now: confirmedWrite follows it to the end either way, then this card reads it again — the Connect card loads
|
|
34
|
+
* with its address and code fields, and no reload is asked for. Nothing has loaded the Hub client before (no Hub module loads
|
|
35
|
+
* on an unmarked page), so it starts as the member client. Presentation only: a mark confers no authority.
|
|
36
|
+
*/
|
|
37
|
+
const markMember = on => {
|
|
38
|
+
const body = globalThis.document?.body;
|
|
39
|
+
if (!body || markedMember() === on) return;
|
|
40
|
+
const tokens = String(body.dataset.hub || "").split(/\s+/).filter(t => t && t !== "member");
|
|
41
|
+
if (on) tokens.push("member");
|
|
42
|
+
if (tokens.length) body.dataset.hub = tokens.join(" "); else delete body.dataset.hub;
|
|
43
|
+
};
|
|
29
44
|
export function HubMembershipSettings() {
|
|
30
45
|
const publicPage = globalThis.document?.body?.dataset?.publicLink === "1";
|
|
31
46
|
const [view, setView] = useState(null), [busy, setBusy] = useState(false), [messageKey, setMessageKey] = useState("loading");
|
|
@@ -37,7 +52,7 @@ export function HubMembershipSettings() {
|
|
|
37
52
|
if (!view) setMessageKey("loading");
|
|
38
53
|
let result; try { result = await api(path); } catch { result = null; }
|
|
39
54
|
if (!owner.current.mounted || owner.current.seq !== seq) return;
|
|
40
|
-
if (result?.ok && typeof result.body?.enabled === "boolean") { setView({ enabled: result.body.enabled }); setMessageKey(""); }
|
|
55
|
+
if (result?.ok && typeof result.body?.enabled === "boolean") { markMember(result.body.enabled); setView({ enabled: result.body.enabled }); setMessageKey(""); }
|
|
41
56
|
else { setView(null); setMessageKey("unavailable"); }
|
|
42
57
|
};
|
|
43
58
|
useEffect(() => {
|
|
@@ -66,13 +81,12 @@ export function HubMembershipSettings() {
|
|
|
66
81
|
finally { owner.current.busy = false; if (owner.current.mounted) setBusy(false); }
|
|
67
82
|
};
|
|
68
83
|
if (publicPage) return null;
|
|
69
|
-
return html`<div class="form hub-membership-settings"><section class="card">
|
|
84
|
+
return html`<div class="form hub-membership-settings"><section class="card" id="hub-membership">
|
|
70
85
|
<h3>${copy("title")}</h3><p class="note">${copy("hint")}</p>
|
|
71
|
-
${!view && messageKey === "loading" ? html`<${Skeleton} variant="rows" lines=${2} label=${copy("loading")} />` : html`<label class="check"><input class="s-ui-toggle" type="checkbox" role="switch" checked=${view?.enabled === true}
|
|
86
|
+
${!view && messageKey === "loading" ? html`<${Skeleton} variant="rows" lines=${2} label=${copy("loading")} />` : html`<label class="check"><input id="hubMemberEnabled" class="s-ui-toggle" type="checkbox" role="switch" checked=${view?.enabled === true}
|
|
72
87
|
disabled=${!view || busy} onChange=${e => change(e.target.checked)} /><span>${copy("enabled")}</span></label>`}
|
|
73
88
|
<p class="note">${copy("off")}</p>
|
|
74
89
|
${messageKey && messageKey !== "loading" ? html`<p role="status">${copy(messageKey)}</p>` : null}
|
|
75
90
|
${!view && !busy && messageKey !== "loading" ? html`<button class="btn btn-sm" type="button" onClick=${read}>${copy("retry")}</button>` : null}
|
|
76
|
-
${view && view.enabled !== markedMember() ? html`<p class="note">${copy("reloadHint")} <button class="btn btn-sm" type="button" disabled=${busy} onClick=${() => location.reload()}>${copy("reload")}</button></p>` : null}
|
|
77
91
|
</section>${view?.enabled && markedMember() ? Connect ? html`<${Connect} />` : connectError ? html`<${ErrorState} message=${copy("unavailable")} onRetry=${() => setAttempt(n => n + 1)} />` : html`<${Skeleton} variant="form" lines=${4} />` : null}</div>`;
|
|
78
92
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// alpha.6 feedback (#2): Settings → Hub. Everything about this fleet and a Hub in one section, found by search: the
|
|
2
|
+
// membership switch, then (once it is on and the page is marked a member) Connect to a Hub — address and pairing code,
|
|
3
|
+
// the fingerprint to compare, the approval steps, then paired (open, disconnect) — with the agents shared there; and on
|
|
4
|
+
// a fleet that runs a Hub itself, its retention and browser-certificate cards. Each card stays its own lazy module, as
|
|
5
|
+
// it was under Access & security. Never over the public link: the member handlers are this computer's owner's only.
|
|
6
|
+
import { html, useEffect, useState } from "/assets/app-html.js";
|
|
7
|
+
import { register, t } from "/assets/app-i18n.js";
|
|
8
|
+
|
|
9
|
+
register("settingsHubSection", {
|
|
10
|
+
en: {
|
|
11
|
+
publicLink: "Hub settings are only on this fleet's own dashboard, not over the public link.",
|
|
12
|
+
relatedTitle: "Hub", relatedHint: "Connect this fleet to a team Hub and choose which agents to share.",
|
|
13
|
+
groupsTitle: "Group permissions", groupsHint: "Let members of chosen directory groups chat with agents, share agents or connect their fleet. Set on the Hub, signed in as its administrator.",
|
|
14
|
+
groupsOpen: "Open on the Hub", experimental: "Experimental",
|
|
15
|
+
},
|
|
16
|
+
"zh-TW": {
|
|
17
|
+
publicLink: "Hub 設定只在這個 Fleet 自己的儀表板上提供,公開連結上沒有。",
|
|
18
|
+
relatedTitle: "Hub", relatedHint: "將這個 Fleet 連線至團隊 Hub,並選擇要分享的 Agent。",
|
|
19
|
+
groupsTitle: "群組權限", groupsHint: "讓指定目錄群組的成員與 Agent 對話、分享 Agent 或連接自己的 Fleet。在 Hub 上以管理員身分登入後設定。",
|
|
20
|
+
groupsOpen: "在 Hub 上開啟", experimental: "實驗性",
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export const hubSectionText = (key) => t(`settingsHubSection.${key}`);
|
|
24
|
+
|
|
25
|
+
/** A card from its own lazy module (it loads only when this section is drawn). */
|
|
26
|
+
function Lazy({ load, pick }) {
|
|
27
|
+
const [Card, setCard] = useState(null);
|
|
28
|
+
useEffect(() => { let live = true; load().then((m) => { if (live) setCard(() => pick(m)); }, () => {}); return () => { live = false; }; }, []);
|
|
29
|
+
return Card ? html`<${Card} />` : null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* #3298 S-89: where the Hub's group permissions are set, found from this fleet's Settings. Only a link: the Hub's own sign-in and
|
|
34
|
+
* its own capability marks decide what opens there (this page never reads a Hub session across origins). The address is this
|
|
35
|
+
* fleet's own configured Hub web origin, accepted only as a bare HTTPS origin.
|
|
36
|
+
*/
|
|
37
|
+
export function hubGroupsHref(webOrigin) {
|
|
38
|
+
try { const u = new URL(String(webOrigin || "")); return u.protocol === "https:" && u.origin === String(webOrigin).replace(/\/$/, "") ? `${u.origin}/ui/hub/admin?view=groups` : null; } catch { return null; }
|
|
39
|
+
}
|
|
40
|
+
/** The page mark the fleet's server sets when its own Hub has group permissions composed (#3372 N2). */
|
|
41
|
+
export function hubGroupsMarked(doc = typeof document !== "undefined" ? document : null) {
|
|
42
|
+
try { return !!doc && !!doc.body && doc.body.dataset.hubGroups === "1"; } catch { return false; }
|
|
43
|
+
}
|
|
44
|
+
function GroupPermissionsRow({ href }) {
|
|
45
|
+
return html`<section class="card s-group" id="hub-group-permissions"><h3>${hubSectionText("groupsTitle")} <span class="tag warn">${hubSectionText("experimental")}</span></h3>
|
|
46
|
+
<p class="note">${hubSectionText("groupsHint")}</p>
|
|
47
|
+
<div class="s-row"><a class="btn btn-sm" href=${href} target="_blank" rel="noopener noreferrer">${hubSectionText("groupsOpen")}</a></div></section>`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function HubSection({ overPublicLink, hubHost, hubOrigin }) {
|
|
51
|
+
// Only when this fleet's own Hub offers group permissions (the server's page mark), the same gate as the Hub's editor.
|
|
52
|
+
const groupsHref = hubHost && hubGroupsMarked() ? hubGroupsHref(hubOrigin) : null;
|
|
53
|
+
if (overPublicLink) return html`<section class="card s-group" id="hub-public-link"><p class="note">${hubSectionText("publicLink")}</p></section>`;
|
|
54
|
+
return html`<div class="s-hub-section">
|
|
55
|
+
<${Lazy} load=${() => import("./settings-hub-membership.js")} pick=${(m) => m.HubMembershipSettings} />
|
|
56
|
+
${hubHost ? html`<${Lazy} load=${() => import("./settings-hub-retention.js")} pick=${(m) => m.HubRetentionSettings} />
|
|
57
|
+
<${Lazy} load=${() => import("./settings-hub-browser-certificate.js")} pick=${(m) => m.HubBrowserCertificateSettings} />` : null}
|
|
58
|
+
${groupsHref ? html`<${GroupPermissionsRow} href=${groupsHref} />` : null}
|
|
59
|
+
</div>`;
|
|
60
|
+
}
|
package/dist/ui/settings-hub.js
CHANGED
|
@@ -12,11 +12,25 @@ import { compareGroups, hubClient, safeWebOrigin, ADDRESS_HINT, CODE_HINT } from
|
|
|
12
12
|
import { hw, linkHubCss } from "./hub-strings.js";
|
|
13
13
|
import { guidanceFor } from "./hub-provider-guidance.js";
|
|
14
14
|
import { AGENT_CHOICE } from "./hub-agent-copy.js";
|
|
15
|
+
import { PairingNotices } from "./hub-quick-pairing.js";
|
|
16
|
+
import { hq } from "./hub-quick-strings.js";
|
|
17
|
+
import { hp } from "./hub-pairing-progress-strings.js";
|
|
15
18
|
|
|
16
19
|
const CONNECT_ERRORS = { address: "errAddress", code: "errCode", busy: "errBusy", unreachable: "errUnreachable", refused: "errRefused" };
|
|
17
20
|
const HOLDS = new Set(["unknown_outcome", "expired", "unsaved", "refused", "revoked", "disconnected"]);
|
|
18
21
|
const PUBLISH_ERRORS = { conflict: "errConflict", unsaved: "errUnsaved", not_paired: "errNotPaired", not_enforceable: "agentNotShareable",
|
|
19
22
|
unknown_view: "agentNotShareable", limit: "errLimit", unavailable: "notAvailable" };
|
|
23
|
+
// The switcher may have cached hub-strings before this action existed. Its original Allow word is still available.
|
|
24
|
+
const allowOnHubLabel = () => { const label = hw("allowOnHub"); return label === "hub.allowOnHub" ? `${hw("allow")}…` : label; };
|
|
25
|
+
|
|
26
|
+
// A queued local confirmation describes one operation, not every later pairing or link state.
|
|
27
|
+
function waitingForPairing(msg, p) {
|
|
28
|
+
const pending = msg?.pending;
|
|
29
|
+
if (!pending) return true;
|
|
30
|
+
if (pending.action === "connect") return p?.state === "unpaired";
|
|
31
|
+
if (pending.action === "confirm") return p?.state === "pending" && p.localConfirmed === false && p.fingerprint?.digest === pending.fingerprint;
|
|
32
|
+
return pending.action === "disconnect" && p?.state === "paired" && p.binding === pending.binding && p.hub?.hubId === pending.hubId;
|
|
33
|
+
}
|
|
20
34
|
|
|
21
35
|
/** A fingerprint: its first 128 bits in groups people compare, the whole digest on request. */
|
|
22
36
|
function Fingerprint({ label, fp }) {
|
|
@@ -38,6 +52,33 @@ export function HubConnectCard() {
|
|
|
38
52
|
const [busy, setBusy] = useState(false);
|
|
39
53
|
const [msg, setMsg] = useState(null);
|
|
40
54
|
const live = useRef(true);
|
|
55
|
+
const generation = useRef(0), activePending = useRef(null);
|
|
56
|
+
const pendingMessage = (action, shown, result, token) => {
|
|
57
|
+
const pending = { action, fingerprint: shown?.fingerprint?.digest, binding: shown?.binding, hubId: shown?.hub?.hubId };
|
|
58
|
+
activePending.current = pending;
|
|
59
|
+
setMsg({ error: false, text: hw("waitingConfirm"), pending });
|
|
60
|
+
if (!result.settled?.then) return; // An older client still clears its hint when the projection advances.
|
|
61
|
+
const current = () => live.current && generation.current === token && activePending.current === pending;
|
|
62
|
+
const finish = async outcome => {
|
|
63
|
+
if (!current()) return;
|
|
64
|
+
let next;
|
|
65
|
+
try { next = await client.pairing(); } catch { /* unknown result, never a retry/success claim */ }
|
|
66
|
+
if (!current()) return;
|
|
67
|
+
if (next) setPairing(next);
|
|
68
|
+
activePending.current = null;
|
|
69
|
+
const text = !next || !["applied", "failed", "expired", "rejected", "stale"].includes(outcome?.state) ? hp("unknown")
|
|
70
|
+
: outcome.state === "applied" || !waitingForPairing({ pending }, next) ? null
|
|
71
|
+
: action === "connect" && next.state === "unpaired" && ["failed", "expired"].includes(outcome.state) ? hp("connectFailed") : hp("notApplied");
|
|
72
|
+
setMsg(old => old?.pending === pending ? text ? { error: true, text } : null : old);
|
|
73
|
+
};
|
|
74
|
+
void Promise.resolve(result.settled).then(finish, () => finish(null));
|
|
75
|
+
};
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (msg?.pending && !waitingForPairing(msg, pairing)) {
|
|
78
|
+
if (activePending.current === msg.pending) activePending.current = null;
|
|
79
|
+
setMsg(null);
|
|
80
|
+
}
|
|
81
|
+
}, [msg, pairing]);
|
|
41
82
|
const readPairing = () => {
|
|
42
83
|
setReadError(false);
|
|
43
84
|
return client.pairing().then((p) => { if (live.current) setPairing(p); }, () => { if (live.current) setReadError(true); });
|
|
@@ -47,28 +88,29 @@ export function HubConnectCard() {
|
|
|
47
88
|
live.current = true;
|
|
48
89
|
readPairing();
|
|
49
90
|
const off = client.subscribe((p) => { if (live.current) setPairing(p); });
|
|
50
|
-
return () => { live.current = false; off(); };
|
|
91
|
+
return () => { live.current = false; generation.current++; activePending.current = null; off(); };
|
|
51
92
|
}, []);
|
|
52
93
|
const act = async (fn) => {
|
|
53
94
|
if (busy) return;
|
|
95
|
+
const token = ++generation.current; activePending.current = null;
|
|
54
96
|
setBusy(true); setMsg(null);
|
|
55
|
-
try { await fn(); } catch { if (live.current) setMsg({ error: true, text: hw("errFailed") }); }
|
|
97
|
+
try { await fn(token); } catch { if (live.current && token === generation.current) setMsg({ error: true, text: hw("errFailed") }); }
|
|
56
98
|
finally { if (live.current) setBusy(false); }
|
|
57
99
|
};
|
|
58
|
-
const connect = () => act(async
|
|
100
|
+
const connect = () => act(async token => {
|
|
59
101
|
const r = await client.connect({ address: form.address.trim(), code: form.code.trim() });
|
|
60
102
|
if (!live.current) return;
|
|
61
|
-
if (r.ok) { setPairing(r.pairing); setForm({ address: "", code: "" }); if (r.pendingConfirmation)
|
|
103
|
+
if (r.ok) { setPairing(r.pairing); setForm({ address: "", code: "" }); if (r.pendingConfirmation) pendingMessage("connect", null, r, token); }
|
|
62
104
|
else setMsg({ error: true, text: hw(CONNECT_ERRORS[r.error] || "errFailed") });
|
|
63
105
|
});
|
|
64
|
-
const disconnect = (name) => act(async
|
|
106
|
+
const disconnect = (name) => act(async token => {
|
|
65
107
|
const shown = pairing; // #3115 r2: the pairing on screen now, before the dialog
|
|
66
108
|
if (!(await confirmDialog({ message: hw("disconnectAsk", name), confirmLabel: hw("disconnect"), danger: true }))) return;
|
|
67
109
|
const r = await client.disconnect(shown);
|
|
68
110
|
if (!live.current) return;
|
|
69
111
|
if (!r.ok) { setMsg({ error: true, text: hw("errUnsaved") }); return; }
|
|
70
112
|
setPairing(await client.pairing());
|
|
71
|
-
if (r.pendingConfirmation) {
|
|
113
|
+
if (r.pendingConfirmation) { pendingMessage("disconnect", shown, r, token); return; }
|
|
72
114
|
if (r.remote === "pending") setMsg({ error: false, text: hw("disconnectPending") });
|
|
73
115
|
});
|
|
74
116
|
const cancel = () => act(async () => { const p = await client.cancel(); if (live.current) setPairing(p); });
|
|
@@ -93,14 +135,14 @@ export function HubConnectCard() {
|
|
|
93
135
|
<${Fingerprint} label=${hw("pairingFp")} fp=${p.fingerprint} />
|
|
94
136
|
<p class="note">${hw("pendingCompare")}</p>
|
|
95
137
|
${p.localConfirmed === false && client.confirmFingerprint ? html`<div class="field-row"><button type="button" class="btn btn-primary hub-local-confirm" disabled=${busy}
|
|
96
|
-
onClick=${() => act(async
|
|
97
|
-
if (r.ok) { setPairing(r.pairing); if (r.pendingConfirmation)
|
|
138
|
+
onClick=${() => act(async token => { const r = await client.confirmFingerprint(p.fingerprint.digest); if (!live.current) return;
|
|
139
|
+
if (r.ok) { setPairing(r.pairing); if (r.pendingConfirmation) pendingMessage("confirm", p, r, token); }
|
|
98
140
|
else setMsg({ error: true, text: hw(r.error === "expired" ? "hold_expired" : r.error === "conflict" ? "errConflict" : "errUnsaved") }); })}>${hw("localMatch")}</button></div>`
|
|
99
141
|
: p.localConfirmed === true ? html`<p class="note hub-local-confirmed">${hw("localConfirmed")}</p>` : null}
|
|
100
142
|
${p.ownerConfirmed === null && p.adminApproved === null
|
|
101
143
|
// S3c: the member cannot see the Hub's progress — the two steps as instructions, no marks.
|
|
102
|
-
? html`<p class="hub-steps-lead">${
|
|
103
|
-
<ul class="hub-steps hub-steps-unknown"><li><span>${
|
|
144
|
+
? html`<p class="hub-steps-lead">${hq("remoteSteps")}</p>
|
|
145
|
+
<ul class="hub-steps hub-steps-unknown"><li><span>${hq("ownerStep")}</span></li><li><span>${hq("policyStep")}</span></li></ul>
|
|
104
146
|
<p class="note">${hw("hubProgressHidden")}</p>`
|
|
105
147
|
: html`<p class="hub-steps-lead">${hw("pendingSteps")}</p>
|
|
106
148
|
<ul class="hub-steps">${step(p.ownerConfirmed, "ownerStep")}${step(p.adminApproved, "adminStep")}</ul>`}
|
|
@@ -146,8 +188,9 @@ export function HubConnectCard() {
|
|
|
146
188
|
<p class="note">${hw("lead")}</p>
|
|
147
189
|
${client.stub ? html`<p class="note hub-preview" role="note">${hw("preview")}</p>` : null}
|
|
148
190
|
${body}
|
|
149
|
-
${
|
|
150
|
-
${
|
|
191
|
+
${p?.state === "paired" && client.pairingNotices?.().length ? html`<${PairingNotices} memberNotices=${client.pairingNotices()} memberOrigin=${safeWebOrigin(p)} />` : null}
|
|
192
|
+
${msg && waitingForPairing(msg, p) ? html`<p class=${msg.error ? "err" : "note"} role=${msg.error ? "alert" : "status"}>${msg.text}</p>` : null}
|
|
193
|
+
${p && p.state === "paired" ? html`<${HubExposures} key=${`${p.binding}|${p.hub.hubId}|${p.hub.fingerprint?.digest}|${safeWebOrigin(p)}`} client=${client} pairing=${p} />` : null}
|
|
151
194
|
</section>`;
|
|
152
195
|
}
|
|
153
196
|
|
|
@@ -156,7 +199,7 @@ export function HubConnectCard() {
|
|
|
156
199
|
* itself (docs/design/hub-representative-agent.md): switching on sends AGENT_CHOICE for the owner's confirmation; a row
|
|
157
200
|
* shared under the older restricted mode says so and offers "Share again" (a new, confirmed revision).
|
|
158
201
|
*/
|
|
159
|
-
function HubExposures({ client }) {
|
|
202
|
+
function HubExposures({ client, pairing }) {
|
|
160
203
|
const [rows, setRows] = useState(null);
|
|
161
204
|
const [readError, setReadError] = useState(false);
|
|
162
205
|
const [busy, setBusy] = useState(null);
|
|
@@ -198,6 +241,8 @@ function HubExposures({ client }) {
|
|
|
198
241
|
: row.policy ? html`<small class="hub-exposure-why">${hw("policy", row.policy.dataView, row.policy.tools.join(", ") || "—")}</small>` : null}
|
|
199
242
|
${!row.enforceable && row.state !== "frozen" && guidanceFor(row.reason)
|
|
200
243
|
? html`<small class="hub-exposure-why hub-provider-guidance">${hw(guidanceFor(row.reason))}</small>` : null}
|
|
244
|
+
${row.state === "published" && !row.pending && /^[a-f0-9-]{36}$/.test(row.exposureId || "") && safeWebOrigin(pairing)
|
|
245
|
+
? html`<div class="field-row"><a class="btn btn-sm" href=${`${safeWebOrigin(pairing)}/ui/hub/exposures?agent=${encodeURIComponent(row.exposureId)}&grant=1`} target="_blank" rel="noopener noreferrer">${allowOnHubLabel()}</a></div>` : null}
|
|
201
246
|
</li>`)}</ul>` : null}
|
|
202
247
|
${msg ? html`<p class=${msg.error ? "err" : "note"} role=${msg.error ? "alert" : "status"}>${msg.text}</p>` : null}
|
|
203
248
|
</div>`;
|