@songsid/agend 2.3.5-alpha.5 → 2.3.5-alpha.6
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/THIRD_PARTY_NOTICES.md +0 -1
- package/dist/accounts-profiles.d.ts +96 -0
- package/dist/accounts-profiles.js +178 -0
- package/dist/accounts-profiles.js.map +1 -0
- package/dist/accounts-signout.d.ts +59 -0
- package/dist/accounts-signout.js +184 -0
- package/dist/accounts-signout.js.map +1 -0
- package/dist/accounts-view.d.ts +54 -0
- package/dist/accounts-view.js +55 -11
- package/dist/accounts-view.js.map +1 -1
- package/dist/agent-workspace.d.ts +11 -0
- package/dist/agent-workspace.js +28 -0
- package/dist/agent-workspace.js.map +1 -1
- package/dist/auth-api.js +27 -5
- package/dist/auth-api.js.map +1 -1
- package/dist/authority/session-authorizations.d.ts +2 -0
- package/dist/authority/session-authorizations.js +7 -1
- package/dist/authority/session-authorizations.js.map +1 -1
- package/dist/backend/codex.js +1 -0
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/types.d.ts +2 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/bundled-tmux-guard.d.ts +19 -0
- package/dist/bundled-tmux-guard.js +83 -0
- package/dist/bundled-tmux-guard.js.map +1 -0
- package/dist/classic-bindings.d.ts +13 -0
- package/dist/classic-bindings.js +28 -2
- package/dist/classic-bindings.js.map +1 -1
- package/dist/classic-channel-manager.d.ts +2 -0
- package/dist/classic-channel-manager.js +5 -1
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/cli.js +116 -11
- package/dist/cli.js.map +1 -1
- package/dist/config-validator.js +11 -0
- package/dist/config-validator.js.map +1 -1
- package/dist/config.js +3 -1
- package/dist/config.js.map +1 -1
- package/dist/daemon.d.ts +27 -2
- package/dist/daemon.js +107 -6
- package/dist/daemon.js.map +1 -1
- package/dist/doctor.js +3 -4
- package/dist/doctor.js.map +1 -1
- package/dist/e2e-isolation.js +5 -2
- package/dist/e2e-isolation.js.map +1 -1
- package/dist/fleet-control-audit.d.ts +1 -1
- package/dist/fleet-manager.d.ts +129 -0
- package/dist/fleet-manager.js +725 -53
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +10 -0
- package/dist/hub/compose/server.js +1 -0
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/directory/directory.d.ts +1 -1
- package/dist/hub/directory/directory.js +115 -3
- package/dist/hub/directory/directory.js.map +1 -1
- package/dist/hub/directory/groups.d.ts +29 -0
- package/dist/hub/directory/groups.js +29 -0
- package/dist/hub/directory/groups.js.map +1 -0
- package/dist/hub/directory/index.d.ts +1 -0
- package/dist/hub/directory/types.d.ts +4 -0
- package/dist/hub/directory/types.js.map +1 -1
- package/dist/hub/group-policy/model.d.ts +56 -0
- package/dist/hub/group-policy/model.js +46 -0
- package/dist/hub/group-policy/model.js.map +1 -0
- package/dist/hub/group-policy/resources.d.ts +52 -0
- package/dist/hub/group-policy/resources.js +166 -0
- package/dist/hub/group-policy/resources.js.map +1 -0
- package/dist/hub/group-policy/store.d.ts +52 -0
- package/dist/hub/group-policy/store.js +149 -0
- package/dist/hub/group-policy/store.js.map +1 -0
- package/dist/hub/http/compose.js +4 -3
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/pairing.d.ts +3 -1
- package/dist/hub/pairing.js +6 -3
- package/dist/hub/pairing.js.map +1 -1
- package/dist/hub/server.d.ts +2 -0
- package/dist/hub/server.js +12 -2
- package/dist/hub/server.js.map +1 -1
- package/dist/instance-config-impact.js +4 -3
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +17 -0
- package/dist/instance-lifecycle.js +38 -1
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +21 -0
- package/dist/locale.js.map +1 -1
- package/dist/login-controller.d.ts +5 -0
- package/dist/login-controller.js +11 -0
- package/dist/login-controller.js.map +1 -1
- package/dist/login-window-lock.d.ts +2 -1
- package/dist/login-window-lock.js.map +1 -1
- package/dist/ls-rows.d.ts +1 -1
- package/dist/ls-rows.js +1 -1
- package/dist/ls-rows.js.map +1 -1
- package/dist/machine-accounts.d.ts +110 -0
- package/dist/machine-accounts.js +229 -0
- package/dist/machine-accounts.js.map +1 -0
- package/dist/machine-signins.d.ts +89 -0
- package/dist/machine-signins.js +182 -0
- package/dist/machine-signins.js.map +1 -0
- package/dist/muse-usage-relay.d.ts +2 -0
- package/dist/muse-usage-relay.js +5 -3
- package/dist/muse-usage-relay.js.map +1 -1
- package/dist/needs-you-hub.d.ts +3 -0
- package/dist/needs-you-hub.js +13 -3
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +35 -2
- package/dist/needs-you.js +19 -0
- package/dist/needs-you.js.map +1 -1
- package/dist/quickstart.js +7 -18
- package/dist/quickstart.js.map +1 -1
- package/dist/quiet-run.d.ts +31 -0
- package/dist/quiet-run.js +50 -0
- package/dist/quiet-run.js.map +1 -0
- package/dist/quota-notice-config.d.ts +22 -0
- package/dist/quota-notice-config.js +41 -0
- package/dist/quota-notice-config.js.map +1 -0
- package/dist/runtime-api.d.ts +13 -0
- package/dist/runtime-api.js +125 -1
- package/dist/runtime-api.js.map +1 -1
- package/dist/runtime-build-info.d.ts +2 -1
- package/dist/runtime-build-info.js +7 -3
- package/dist/runtime-build-info.js.map +1 -1
- package/dist/runtime-cli-install.d.ts +153 -0
- package/dist/runtime-cli-install.js +675 -0
- package/dist/runtime-cli-install.js.map +1 -0
- package/dist/runtime-cli.js +157 -12
- package/dist/runtime-cli.js.map +1 -1
- package/dist/runtime-client.d.ts +64 -2
- package/dist/runtime-client.js +277 -20
- package/dist/runtime-client.js.map +1 -1
- package/dist/runtime-coordinator.d.ts +10 -1
- package/dist/runtime-coordinator.js +93 -2
- package/dist/runtime-coordinator.js.map +1 -1
- package/dist/runtime-credential-profiles.d.ts +11 -2
- package/dist/runtime-credential-profiles.js +28 -4
- package/dist/runtime-credential-profiles.js.map +1 -1
- package/dist/runtime-install.js +9 -6
- package/dist/runtime-install.js.map +1 -1
- package/dist/runtime-pane-link.js +2 -1
- package/dist/runtime-pane-link.js.map +1 -1
- package/dist/runtime-pane-service.js +2 -2
- package/dist/runtime-pane-service.js.map +1 -1
- package/dist/runtime-pane-store.d.ts +10 -0
- package/dist/runtime-pane-store.js +13 -1
- package/dist/runtime-pane-store.js.map +1 -1
- package/dist/runtime-profile-ownership.d.ts +66 -0
- package/dist/runtime-profile-ownership.js +391 -0
- package/dist/runtime-profile-ownership.js.map +1 -0
- package/dist/runtime-protocol.d.ts +88 -2
- package/dist/runtime-protocol.js +40 -0
- package/dist/runtime-protocol.js.map +1 -1
- package/dist/runtime-remote-accounts.d.ts +197 -0
- package/dist/runtime-remote-accounts.js +663 -0
- package/dist/runtime-remote-accounts.js.map +1 -0
- package/dist/runtime-remote-setup.d.ts +105 -0
- package/dist/runtime-remote-setup.js +529 -0
- package/dist/runtime-remote-setup.js.map +1 -0
- package/dist/runtime-signin-transport.d.ts +39 -0
- package/dist/runtime-signin-transport.js +110 -0
- package/dist/runtime-signin-transport.js.map +1 -0
- package/dist/runtime-signin.d.ts +132 -0
- package/dist/runtime-signin.js +289 -0
- package/dist/runtime-signin.js.map +1 -0
- package/dist/runtime-update-attention.d.ts +4 -0
- package/dist/runtime-update-attention.js +11 -0
- package/dist/runtime-update-attention.js.map +1 -0
- package/dist/runtime-update-controller.d.ts +75 -0
- package/dist/runtime-update-controller.js +691 -0
- package/dist/runtime-update-controller.js.map +1 -0
- package/dist/runtime-update-ipc.d.ts +42 -0
- package/dist/runtime-update-ipc.js +144 -0
- package/dist/runtime-update-ipc.js.map +1 -0
- package/dist/runtime-update-journal.d.ts +5 -0
- package/dist/runtime-update-journal.js +7 -0
- package/dist/runtime-update-journal.js.map +1 -1
- package/dist/runtime-update-lock.js +17 -2
- package/dist/runtime-update-lock.js.map +1 -1
- package/dist/runtime-update-status.d.ts +30 -0
- package/dist/runtime-update-status.js +31 -0
- package/dist/runtime-update-status.js.map +1 -0
- package/dist/settings-api.js +3 -0
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.js +8 -0
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-instance-patch.js +1 -1
- package/dist/settings-instance-patch.js.map +1 -1
- package/dist/setup-wizard.js +3 -5
- package/dist/setup-wizard.js.map +1 -1
- package/dist/signin-keepalive.d.ts +203 -0
- package/dist/signin-keepalive.js +652 -0
- package/dist/signin-keepalive.js.map +1 -0
- package/dist/structured-signin-transport.js +4 -0
- package/dist/structured-signin-transport.js.map +1 -1
- package/dist/structured-signin.d.ts +7 -0
- package/dist/structured-signin.js +1 -1
- package/dist/structured-signin.js.map +1 -1
- package/dist/tmux-binary.d.ts +23 -23
- package/dist/tmux-binary.js +35 -46
- package/dist/tmux-binary.js.map +1 -1
- package/dist/tmux-exec-helper.js +3 -3
- package/dist/tmux-exec-helper.js.map +1 -1
- package/dist/tmux-legacy.d.ts +94 -0
- package/dist/tmux-legacy.js +309 -0
- package/dist/tmux-legacy.js.map +1 -0
- package/dist/tmux-manager.d.ts +7 -1
- package/dist/tmux-manager.js +21 -11
- package/dist/tmux-manager.js.map +1 -1
- package/dist/tmux-rollback.d.ts +31 -0
- package/dist/tmux-rollback.js +72 -0
- package/dist/tmux-rollback.js.map +1 -0
- package/dist/tmux-server.d.ts +102 -0
- package/dist/tmux-server.js +248 -0
- package/dist/tmux-server.js.map +1 -0
- package/dist/transcript-monitor.js +43 -5
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/transcript-records.d.ts +2 -1
- package/dist/transcript-records.js +3 -0
- package/dist/transcript-records.js.map +1 -1
- package/dist/transcript-sources.js +3 -0
- package/dist/transcript-sources.js.map +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/ui/accounts-keepalive.js +112 -0
- package/dist/ui/accounts-manage.js +237 -0
- package/dist/ui/accounts-view.js +175 -31
- package/dist/ui/agent-runtime-settings.js +2 -1
- package/dist/ui/app.html +8 -1
- package/dist/ui/hub-attachments.js +90 -0
- package/dist/ui/hub-chat-store.js +9 -4
- package/dist/ui/hub-client.js +20 -1
- package/dist/ui/hub-preview.js +101 -0
- package/dist/ui/machine-signin.js +56 -0
- package/dist/ui/panel-fleet.js +1 -1
- package/dist/ui/panel-hub.js +126 -31
- package/dist/ui/panel-needs.js +14 -8
- package/dist/ui/panel-notices.js +4 -3
- package/dist/ui/panel-runtimes.js +19 -6
- package/dist/ui/panel-settings.js +12 -6
- package/dist/ui/panel-windows-agent.js +2 -1
- package/dist/ui/preview-pages.js +3 -41
- package/dist/ui/preview-panel-actions.js +3 -161
- package/dist/ui/preview-panel.js +10 -557
- package/dist/ui/preview-versions.js +3 -155
- package/dist/ui/runtime-cli-install.js +114 -0
- package/dist/ui/runtime-update-commands.d.ts +2 -0
- package/dist/ui/runtime-update-commands.js +11 -0
- package/dist/ui/runtime-update-status.js +53 -0
- package/dist/ui/search-dialog.js +3 -2
- package/dist/ui/settings-guests.js +3 -2
- package/dist/ui/settings-hub-browser-certificate.js +2 -0
- package/dist/ui/settings-hub-membership.js +12 -6
- package/dist/ui/settings-hub-retention.js +2 -0
- package/dist/ui/settings-hub.js +11 -3
- package/dist/ui/settings-quota-notice.js +100 -0
- package/dist/ui/settings-registry.js +1 -0
- package/dist/ui/settings-strings.js +2 -2
- package/dist/ui/settings-web-authority.js +2 -1
- package/dist/ui/shared/accounts-keepalive.css +7 -0
- package/dist/ui/shared/accounts.css +13 -0
- package/dist/ui/shared/app-route.js +1 -1
- package/dist/ui/shared/app-shell.js +9 -3
- package/dist/ui/shared/app-store.js +2 -2
- package/dist/ui/shared/app.css +13 -0
- package/dist/ui/shared/app.js +2 -1
- package/dist/ui/shared/hub-chat.css +1 -0
- package/dist/ui/shared/hub-owner.css +1 -1
- package/dist/ui/shared/loading.css +37 -0
- package/dist/ui/shared/preview-pages.js +41 -0
- package/dist/ui/shared/preview-panel-actions.js +168 -0
- package/dist/ui/shared/preview-panel.js +565 -0
- package/dist/ui/shared/preview-versions.js +155 -0
- package/dist/ui/shared/runtime-install.css +4 -0
- package/dist/ui/shared/signin.js +68 -6
- package/dist/ui/shared/ui-states.js +14 -3
- package/dist/ui/shared/workspace-follow.css +19 -0
- package/dist/ui/signin.html +7 -3
- package/dist/ui/structured-signin.js +31 -7
- package/dist/ui/workspace-follow-strings.js +28 -0
- package/dist/ui/workspace-panel.js +225 -36
- package/dist/update-install.d.ts +7 -0
- package/dist/update-install.js +23 -0
- package/dist/update-install.js.map +1 -1
- package/dist/usage/providers.d.ts +5 -0
- package/dist/usage/providers.js +5 -0
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/quota-notices.d.ts +38 -0
- package/dist/usage/quota-notices.js +160 -0
- package/dist/usage/quota-notices.js.map +1 -0
- package/dist/usage/usage-api.d.ts +1 -0
- package/dist/usage/usage-api.js +16 -0
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/web-api.d.ts +33 -0
- package/dist/web-api.js +342 -8
- package/dist/web-api.js.map +1 -1
- package/dist/web-login.d.ts +35 -1
- package/dist/web-login.js +51 -5
- package/dist/web-login.js.map +1 -1
- package/dist/web-session.d.ts +11 -0
- package/dist/web-session.js +38 -1
- package/dist/web-session.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-signin-link.d.ts +42 -0
- package/dist/web-signin-link.js +110 -0
- package/dist/web-signin-link.js.map +1 -0
- package/dist/windows-cli-api.d.ts +6 -0
- package/dist/windows-cli-api.js +11 -0
- package/dist/windows-cli-api.js.map +1 -1
- package/dist/windows-cli-worker.d.ts +3 -1
- package/dist/windows-cli-worker.js +18 -3
- package/dist/windows-cli-worker.js.map +1 -1
- package/dist/workspace-follow-parse.d.ts +36 -0
- package/dist/workspace-follow-parse.js +208 -0
- package/dist/workspace-follow-parse.js.map +1 -0
- package/dist/workspace-follow-records.d.ts +17 -0
- package/dist/workspace-follow-records.js +88 -0
- package/dist/workspace-follow-records.js.map +1 -0
- package/dist/workspace-follow.d.ts +41 -0
- package/dist/workspace-follow.js +143 -0
- package/dist/workspace-follow.js.map +1 -0
- package/dist/wsl-detect.d.ts +1 -0
- package/dist/wsl-detect.js +20 -0
- package/dist/wsl-detect.js.map +1 -0
- package/launcher/tmux-bundle.cjs +26 -10
- package/package.json +6 -2
- package/templates/runtime-install/install.ps1 +154 -13
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// #2911 (1): the versions of a page in the preview panel, and the changes from one to the next. Pure functions: the
|
|
2
|
+
// panel (preview-panel.js) draws them. Nothing here runs a preview — a version is shown as any block is, waiting for
|
|
3
|
+
// Preview (#1481 §14).
|
|
4
|
+
import "./chat-render.js";
|
|
5
|
+
|
|
6
|
+
const R = () => globalThis.AgendChatRender;
|
|
7
|
+
|
|
8
|
+
/** The text of a block's <title>, or "" — what says two blocks are versions of one thing. */
|
|
9
|
+
export function htmlTitle(code) {
|
|
10
|
+
const m = /<title[^>]*>([\s\S]*?)<\/title>/i.exec(String(code || ""));
|
|
11
|
+
return m ? m[1].replace(/\s+/g, " ").trim() : "";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Every version of the shown block in the loaded thread, oldest first, and where the shown one is in it.
|
|
16
|
+
* - An attached file: the agent's attachments of the same name (case-insensitive). Their HTML is read when picked (code: null).
|
|
17
|
+
* - A titled block: the agent's complete ```html blocks with the same <title>.
|
|
18
|
+
* - An untitled block: the agent's complete untitled blocks — a titled one is another page.
|
|
19
|
+
* Only agent replies count, and only complete blocks, as for a card. `index` is -1 (and `list` is just the shown block)
|
|
20
|
+
* when the block is no longer in the thread.
|
|
21
|
+
*/
|
|
22
|
+
export function versionsOf(open, msgs, keyOf) {
|
|
23
|
+
if (!open) return { list: [], index: -1 };
|
|
24
|
+
const list = [];
|
|
25
|
+
const all = Array.isArray(msgs) ? msgs : [];
|
|
26
|
+
if (open.att) {
|
|
27
|
+
const name = String(open.att.name || "").trim().toLowerCase();
|
|
28
|
+
for (const x of all) {
|
|
29
|
+
if (x.role !== "agent" || !Array.isArray(x.attachments)) continue;
|
|
30
|
+
const msgKey = keyOf(x);
|
|
31
|
+
for (const a of x.attachments) {
|
|
32
|
+
if (!R().isHtmlAttachment(a) || a.name.trim().toLowerCase() !== name) continue;
|
|
33
|
+
list.push({ key: `${msgKey}:a${a.id}`, instance: open.instance, msgKey, att: { id: a.id, name: a.name, size: a.size }, code: null, sender: x.sender, ts: x.ts });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
const title = htmlTitle(open.code);
|
|
38
|
+
for (const x of all) {
|
|
39
|
+
if (x.role !== "agent") continue;
|
|
40
|
+
const msgKey = keyOf(x);
|
|
41
|
+
R().htmlFences(x.text).forEach((f, n) => {
|
|
42
|
+
if (!f.terminated || htmlTitle(f.code) !== title) return;
|
|
43
|
+
list.push({ key: `${msgKey}:f${n}`, instance: open.instance, msgKey, n, code: f.code, sender: x.sender, ts: x.ts });
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const index = list.findIndex(v => v.key === open.key);
|
|
48
|
+
return index < 0 ? { list: [open], index: -1 } : { list, index };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ── Changes: a line diff (Myers), bounded ──
|
|
52
|
+
|
|
53
|
+
/** Past these, "Changes" says the versions are too large or too different to compare here. */
|
|
54
|
+
export const DIFF_LIMITS = { maxChars: 5 * 1024 * 1024, maxInputLines: 50000, maxEdits: 2000, context: 3, maxLines: 3000 };
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* How many lines `lines()` makes of `s`, counted without splitting it (#2915 review: a budget before anything is
|
|
58
|
+
* built) — LF, CRLF and a lone CR each end a line, and a last line without one counts; it stops counting past `max`
|
|
59
|
+
* (anything over `max` is then reported as max + 1).
|
|
60
|
+
*/
|
|
61
|
+
export function lineCount(s, max = Infinity) {
|
|
62
|
+
if (!s) return 0;
|
|
63
|
+
let breaks = 0;
|
|
64
|
+
for (let i = 0; i < s.length; i++) {
|
|
65
|
+
const c = s.charCodeAt(i);
|
|
66
|
+
if (c === 10 || c === 13) {
|
|
67
|
+
if (c === 13 && s.charCodeAt(i + 1) === 10) i++;
|
|
68
|
+
if (++breaks > max) return max + 1;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const last = s.charCodeAt(s.length - 1);
|
|
72
|
+
return Math.min(breaks + (last === 10 || last === 13 ? 0 : 1), max + 1);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const lines = (s) => { if (!s) return []; const v = String(s).replace(/\r\n?/g, "\n").split("\n"); if (v.length > 1 && v[v.length - 1] === "") v.pop(); return v; };
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The line edits from `a` to `b`: [{ t: " " | "-" | "+", text }] in order, or null when it cannot be done within
|
|
79
|
+
* DIFF_LIMITS: either side over maxChars or maxInputLines (checked before anything is split or built: an op per line
|
|
80
|
+
* is made only under that budget), or more than maxEdits lines differ after the common head and tail.
|
|
81
|
+
*/
|
|
82
|
+
export function lineDiff(a, b, limits = DIFF_LIMITS) {
|
|
83
|
+
const sa = String(a ?? ""), sb = String(b ?? "");
|
|
84
|
+
if (sa.length > limits.maxChars || sb.length > limits.maxChars) return null;
|
|
85
|
+
if (lineCount(sa, limits.maxInputLines) > limits.maxInputLines || lineCount(sb, limits.maxInputLines) > limits.maxInputLines) return null;
|
|
86
|
+
a = sa; b = sb;
|
|
87
|
+
const A = lines(a), B = lines(b);
|
|
88
|
+
let head = 0;
|
|
89
|
+
while (head < A.length && head < B.length && A[head] === B[head]) head++;
|
|
90
|
+
let tail = 0;
|
|
91
|
+
while (tail < A.length - head && tail < B.length - head && A[A.length - 1 - tail] === B[B.length - 1 - tail]) tail++;
|
|
92
|
+
const x = A.slice(head, A.length - tail), y = B.slice(head, B.length - tail);
|
|
93
|
+
const mid = myers(x, y, limits.maxEdits);
|
|
94
|
+
if (!mid) return null;
|
|
95
|
+
return [...A.slice(0, head).map(text => ({ t: " ", text })), ...mid, ...A.slice(A.length - tail).map(text => ({ t: " ", text }))];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Myers' O((N+M)·D) shortest edit script, with D capped (the trace is kept for the walk back). */
|
|
99
|
+
function myers(a, b, maxD) {
|
|
100
|
+
const n = a.length, m = b.length, max = n + m;
|
|
101
|
+
if (max === 0) return [];
|
|
102
|
+
const off = max + 1, v = new Int32Array(2 * max + 3), trace = [];
|
|
103
|
+
for (let d = 0; d <= Math.min(max, maxD); d++) {
|
|
104
|
+
trace.push(v.slice(off - d - 1, off + d + 2));
|
|
105
|
+
for (let k = -d; k <= d; k += 2) {
|
|
106
|
+
let i = k === -d || (k !== d && v[off + k - 1] < v[off + k + 1]) ? v[off + k + 1] : v[off + k - 1] + 1;
|
|
107
|
+
let j = i - k;
|
|
108
|
+
while (i < n && j < m && a[i] === b[j]) { i++; j++; }
|
|
109
|
+
v[off + k] = i;
|
|
110
|
+
if (i >= n && j >= m) return walkBack(a, b, trace, d);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function walkBack(a, b, trace, dEnd) {
|
|
117
|
+
const out = [];
|
|
118
|
+
let i = a.length, j = b.length;
|
|
119
|
+
for (let d = dEnd; d >= 0; d--) {
|
|
120
|
+
const vd = trace[d], at = (k) => vd[k + d + 1]; // trace[d] holds v[-d-1 .. d+1] before step d
|
|
121
|
+
const k = i - j;
|
|
122
|
+
if (d === 0) { while (i > 0 && j > 0) { out.push({ t: " ", text: a[--i] }); j--; } break; }
|
|
123
|
+
const down = k === -d || (k !== d && at(k - 1) < at(k + 1));
|
|
124
|
+
const pk = down ? k + 1 : k - 1, pi = at(pk), pj = pi - pk;
|
|
125
|
+
while (i > pi && j > pj) { out.push({ t: " ", text: a[--i] }); j--; }
|
|
126
|
+
if (down) out.push({ t: "+", text: b[--j] }); else out.push({ t: "-", text: a[--i] });
|
|
127
|
+
}
|
|
128
|
+
return out.reverse();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The edits as hunks with `context` lines around each change, as a unified diff shows them:
|
|
133
|
+
* [{ oldStart, oldLines, newStart, newLines, lines: [{ t, text }] }] (1-based starts). [] when nothing changed.
|
|
134
|
+
*/
|
|
135
|
+
export function diffHunks(ops, context = DIFF_LIMITS.context) {
|
|
136
|
+
// Each op's line numbers on either side (before it), then the changed spans widened by `context` and merged.
|
|
137
|
+
const oldAt = [], newAt = [];
|
|
138
|
+
let o = 1, n = 1;
|
|
139
|
+
for (const op of ops) { oldAt.push(o); newAt.push(n); if (op.t !== "+") o++; if (op.t !== "-") n++; }
|
|
140
|
+
const ranges = [];
|
|
141
|
+
ops.forEach((op, idx) => {
|
|
142
|
+
if (op.t === " ") return;
|
|
143
|
+
const from = Math.max(0, idx - context), to = Math.min(ops.length - 1, idx + context);
|
|
144
|
+
const last = ranges[ranges.length - 1];
|
|
145
|
+
if (last && from <= last.to + 1) last.to = Math.max(last.to, to); else ranges.push({ from, to });
|
|
146
|
+
});
|
|
147
|
+
return ranges.map(({ from, to }) => {
|
|
148
|
+
const part = ops.slice(from, to + 1);
|
|
149
|
+
return {
|
|
150
|
+
oldStart: oldAt[from], newStart: newAt[from],
|
|
151
|
+
oldLines: part.filter(x => x.t !== "+").length, newLines: part.filter(x => x.t !== "-").length,
|
|
152
|
+
lines: part,
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
}
|
|
@@ -24,3 +24,7 @@
|
|
|
24
24
|
.runtime-profile-default { padding: 1px 6px; border: 1px solid var(--border); border-radius: 5px; color: var(--text-2); font-size: var(--fs-xs); }
|
|
25
25
|
.runtime-profiles .note, .runtime-profiles-old { margin: 4px 0 0; font-size: var(--fs-xs); }
|
|
26
26
|
.runtime-profiles-old { margin-bottom: 16px; }
|
|
27
|
+
/* Lazy Runtime update diagnostics remain readable with an older app.css. */
|
|
28
|
+
.runtime-update-notice { margin-block: .75rem; padding: .6rem .8rem; border-inline-start: 3px solid var(--border, #777); }
|
|
29
|
+
.runtime-update-notice p { margin-block: .25rem; overflow-wrap: anywhere; }
|
|
30
|
+
.runtime-update-notice[role="alert"] { border-inline-start-color: var(--warning, #b87218); }
|
package/dist/ui/shared/signin.js
CHANGED
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
nobot: "No chat bot?", nobot_body: "Ask the operator to run agend web --code on the AgEnD computer.",
|
|
18
18
|
safe: "Page looks wrong after signing in?", safe_body: "Your custom CSS may be hiding something. Add ?safe=1 to the end of the address to load the page without it, then fix it or turn it off in Settings → Look.",
|
|
19
19
|
refused: "The code is invalid or no longer works. Send /web in General, then press a sign-in button for a new code.",
|
|
20
|
+
// #3270: the code in the opened link did not work (expired, used, or the fleet restarted). It is never put back in the box.
|
|
21
|
+
autofail: "The automatic sign-in did not work — its code has expired or was already used. Run agend web on the AgEnD computer for a new one.",
|
|
20
22
|
unconfirmed: "Sign-in could not be confirmed. Get a new code and try again; if it keeps failing, contact the operator.",
|
|
21
23
|
paused: "Too many wrong codes — sign-in is paused for a few minutes.",
|
|
22
24
|
network: "Could not reach AgEnD. Check the connection and try again.",
|
|
@@ -50,6 +52,7 @@
|
|
|
50
52
|
nobot: "沒有聊天 bot?", nobot_body: "請管理員在 AgEnD 電腦執行 agend web --code。",
|
|
51
53
|
safe: "登入後畫面不對勁?", safe_body: "可能是你的自訂 CSS 把東西藏起來了。在網址最後加上 ?safe=1,就會不套用它地載入;再到「設定 → 外觀」修正或關閉。",
|
|
52
54
|
refused: "登入碼無效或已失效。請在 General 傳 /web,再按登入按鈕取新碼。",
|
|
55
|
+
autofail: "自動登入沒有成功:登入碼已過期或已使用過。請在 AgEnD 電腦上執行 agend web 取得新的登入碼。",
|
|
53
56
|
unconfirmed: "登入暫時無法確認。請重新取碼再試;若仍失敗,請聯絡管理員。",
|
|
54
57
|
paused: "錯誤次數過多,登入暫停幾分鐘。",
|
|
55
58
|
network: "連不上 AgEnD,請檢查連線後再試。",
|
|
@@ -85,6 +88,8 @@
|
|
|
85
88
|
const deviceLogin = webOnly && !outside && document.body.getAttribute("data-device-login") === "1";
|
|
86
89
|
// #3061 (P2b): …and, when `web.login_qr` is on (<body data-login-qr="1">), it also draws the QR code of the approve link.
|
|
87
90
|
const loginQr = deviceLogin && document.body.getAttribute("data-login-qr") === "1";
|
|
91
|
+
// Reserve the gated action while the form is still hidden, so ending the session read does not resize the card.
|
|
92
|
+
if (deviceLogin) $("another").hidden = false;
|
|
88
93
|
const t = (k) => (outside && (T[lang][`${k}_outside`] || T.en[`${k}_outside`])) || (webOnly && (T[lang][`${k}_web`] || T.en[`${k}_web`])) || T[lang][k] || T.en[k] || k;
|
|
89
94
|
/** A wait as words: "15 minutes" / 「15 分鐘」, "2 hours" / 「2 小時」 (rounded up). */
|
|
90
95
|
const duration = (ms) => {
|
|
@@ -96,12 +101,37 @@
|
|
|
96
101
|
// …and no "No chat bot?" help: the hint above already is it.
|
|
97
102
|
if (webOnly) document.querySelectorAll("details.help").forEach((d) => { if (d.querySelector && d.querySelector('[data-i18n="nobot"]')) d.hidden = true; });
|
|
98
103
|
document.documentElement.lang = lang === "zh-TW" ? "zh-Hant" : "en";
|
|
104
|
+
$("checking").setAttribute?.("aria-label", t("checking"));
|
|
99
105
|
if (outside) {
|
|
100
106
|
const input = $("code");
|
|
101
107
|
input.setAttribute("inputmode", "numeric"); input.setAttribute("maxlength", "7"); input.setAttribute("placeholder", "123456");
|
|
102
108
|
input.setAttribute("pattern", "[0-9 ]*");
|
|
103
109
|
}
|
|
104
110
|
|
|
111
|
+
// #3270: `agend web` opens this page on this computer as /signin#code=XXXX-XXXX. A fragment is never sent to the server, a
|
|
112
|
+
// log or a Referer; it is read here and taken out of the address bar and the history entry BEFORE anything else runs —
|
|
113
|
+
// before any request this script makes — so it cannot be copied, bookmarked or shared from the address bar. It is
|
|
114
|
+
// cleared wherever the page is (a link pasted from the terminal must not leave a code behind), but it is only ever
|
|
115
|
+
// exchanged on this computer's own loopback name: a page reached by any other name never spends it on its own. It is
|
|
116
|
+
// also only exchanged on a fresh navigation by a browser with no session yet (below) — a reload or a history entry that
|
|
117
|
+
// still carried a code must not sign a different session in over the one the person has.
|
|
118
|
+
const LOOPBACK_NAMES = /^(localhost|127\.0\.0\.1|::1|\[::1\])$/i;
|
|
119
|
+
let fragmentCode = null;
|
|
120
|
+
try {
|
|
121
|
+
const params = new URLSearchParams(String(location.hash || "").replace(/^#/, ""));
|
|
122
|
+
if (params.has("code")) {
|
|
123
|
+
const raw = params.get("code") || "";
|
|
124
|
+
history.replaceState(null, "", location.pathname + location.search);
|
|
125
|
+
if (/^[A-Za-z0-9]{4}-?[A-Za-z0-9]{4}$/.test(raw)) fragmentCode = raw;
|
|
126
|
+
}
|
|
127
|
+
} catch { /* nothing to clean */ }
|
|
128
|
+
let freshNavigation = true;
|
|
129
|
+
try {
|
|
130
|
+
const nav = typeof performance === "object" && performance && typeof performance.getEntriesByType === "function" ? performance.getEntriesByType("navigation")[0] : null;
|
|
131
|
+
if (nav && nav.type && nav.type !== "navigate") freshNavigation = false;
|
|
132
|
+
} catch { /* no navigation timing: treat as fresh */ }
|
|
133
|
+
const autoCode = fragmentCode && freshNavigation && !outside && LOOPBACK_NAMES.test(location.hostname || "") ? fragmentCode : null;
|
|
134
|
+
|
|
105
135
|
// An old dashboard link carries `?token=`. It is not a credential any more (the server ignored it and
|
|
106
136
|
// answered with this page), but it is still the fleet's token: take it out of the address bar and
|
|
107
137
|
// the history entry at once, so it is not copied, bookmarked or shared from here.
|
|
@@ -171,7 +201,6 @@
|
|
|
171
201
|
} catch { /* private mode */ }
|
|
172
202
|
$("code").focus();
|
|
173
203
|
offerResend();
|
|
174
|
-
if (deviceLogin) $("another").hidden = false;
|
|
175
204
|
}
|
|
176
205
|
|
|
177
206
|
// Only a returning device gets the button; the answer is a boolean and asking has no side effect. Never from outside
|
|
@@ -241,6 +270,7 @@
|
|
|
241
270
|
const clock = (ms) => { const s = Math.max(0, Math.ceil(ms / 1000)); return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`; };
|
|
242
271
|
function devStop() {
|
|
243
272
|
hideQr();
|
|
273
|
+
if ($("devLoading")) $("devLoading").hidden = true;
|
|
244
274
|
if (!dev) return;
|
|
245
275
|
dev.stopped = true;
|
|
246
276
|
clearTimeout(dev.poll); clearInterval(dev.tick);
|
|
@@ -288,13 +318,15 @@
|
|
|
288
318
|
devStop();
|
|
289
319
|
$("form").hidden = true; $("device").hidden = false; $("devNew").hidden = true;
|
|
290
320
|
hideQr();
|
|
291
|
-
$("devCode").textContent = "
|
|
321
|
+
$("devCode").textContent = "";
|
|
322
|
+
if ($("devLoading")) { $("devLoading").hidden = false; $("devLoading").setAttribute?.("aria-label", t("dev_title")); }
|
|
292
323
|
devSay("", false, true);
|
|
293
324
|
const mine = { stopped: false, poll: 0, tick: 0, deadline: 0, lost: 0 };
|
|
294
325
|
dev = mine;
|
|
295
326
|
let made;
|
|
296
327
|
try { made = await devCall("", mine); } catch { if (!mine.stopped) devEnded(t("dev_failed"), true); return; }
|
|
297
328
|
if (mine.stopped || !made) return;
|
|
329
|
+
if ($("devLoading")) $("devLoading").hidden = true;
|
|
298
330
|
const { r, body } = made;
|
|
299
331
|
if (!r.ok || !body || typeof body.code !== "string") {
|
|
300
332
|
if (r.status === 429) {
|
|
@@ -364,6 +396,28 @@
|
|
|
364
396
|
} catch { return false; }
|
|
365
397
|
}
|
|
366
398
|
|
|
399
|
+
// What a refused POST /auth/login says (the form's and the fragment's exchange alike): 429 and 5xx are not a wrong code.
|
|
400
|
+
const failureText = (status) => (status === 429 ? t("paused") : status >= 500 ? t("unconfirmed") : t("refused"));
|
|
401
|
+
|
|
402
|
+
// #3270: the exchange of the code `agend web` put in the fragment. Resolves null once the browser is on its way into the
|
|
403
|
+
// app, else the words for why not — the form then shows them, so an expired or used code never leaves a blank page. The
|
|
404
|
+
// code itself is never shown or put in the box: whatever it was, it is spent or useless now.
|
|
405
|
+
async function autoSignIn(code) {
|
|
406
|
+
$("checking").textContent = t("working");
|
|
407
|
+
try {
|
|
408
|
+
const r = await fetch("/auth/login", {
|
|
409
|
+
method: "POST",
|
|
410
|
+
credentials: "same-origin",
|
|
411
|
+
headers: { "Content-Type": "application/json" },
|
|
412
|
+
body: JSON.stringify({ code }),
|
|
413
|
+
});
|
|
414
|
+
if (r.ok) { clearBounce(); location.replace(nextTarget()); return null; }
|
|
415
|
+
return r.status === 429 || r.status >= 500 ? failureText(r.status) : t("autofail");
|
|
416
|
+
} catch {
|
|
417
|
+
return t("network");
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
367
421
|
$("form").addEventListener("submit", async (event) => {
|
|
368
422
|
event.preventDefault();
|
|
369
423
|
const button = $("go");
|
|
@@ -388,7 +442,7 @@
|
|
|
388
442
|
}
|
|
389
443
|
// #1854: a 5xx is the server failing to confirm the sign-in (503: a public link's notice did not go out), not a
|
|
390
444
|
// wrong code — say so. The code is spent either way: the way on is a new one.
|
|
391
|
-
msg.textContent =
|
|
445
|
+
msg.textContent = failureText(r.status);
|
|
392
446
|
} catch (err) {
|
|
393
447
|
if (err !== "shown") msg.textContent = t("network");
|
|
394
448
|
}
|
|
@@ -397,8 +451,16 @@
|
|
|
397
451
|
$("code").select();
|
|
398
452
|
});
|
|
399
453
|
|
|
400
|
-
|
|
401
|
-
|
|
454
|
+
(async () => {
|
|
455
|
+
// Someone who already has a session is simply let in: the code in the link is not exchanged over it (it stays unspent
|
|
456
|
+
// and, being from a link, short-lived anyway).
|
|
457
|
+
if (await probe()) { markBounce(); location.replace(nextTarget()); return; }
|
|
458
|
+
let failure = null;
|
|
459
|
+
if (autoCode) {
|
|
460
|
+
failure = await autoSignIn(autoCode);
|
|
461
|
+
if (failure === null) return;
|
|
462
|
+
}
|
|
402
463
|
showForm();
|
|
403
|
-
|
|
464
|
+
if (failure) $("msg").textContent = failure;
|
|
465
|
+
})();
|
|
404
466
|
})();
|
|
@@ -3,9 +3,20 @@ import { html } from "./app-html.js";
|
|
|
3
3
|
import { Icon } from "./ui-icons.js";
|
|
4
4
|
import { t } from "./app-i18n.js";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
// Lazy panels can arrive in a shell with an older app.css. Keep the loading shapes in their own public stylesheet.
|
|
7
|
+
function loadingStyles() {
|
|
8
|
+
if (typeof document === "undefined" || !document.head || document.querySelector('link[href="/assets/loading.css"]')) return;
|
|
9
|
+
const link = document.createElement("link"); link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/loading.css");
|
|
10
|
+
document.head.appendChild(link);
|
|
11
|
+
}
|
|
12
|
+
/** Initial data only: retain populated content on refresh. Existing callers still get simple text lines. */
|
|
13
|
+
export function Skeleton({ lines = 3, variant = "lines", label }) {
|
|
14
|
+
loadingStyles();
|
|
15
|
+
return html`<div class=${`skeleton sk-${variant}`} role="status" aria-busy="true" aria-label=${label || t("app.loading")}>
|
|
16
|
+
<div aria-hidden="true">${Array.from({ length: lines }, (_, i) => variant === "rows" || variant === "cards"
|
|
17
|
+
? html`<div key=${i} class="sk-row"><div class="sk-line sk-thumb"></div><div class="sk-copy"><div class="sk-line"></div><div class="sk-line"></div></div><div class="sk-line sk-pill"></div></div>`
|
|
18
|
+
: html`<div key=${i} class="sk-line"></div>`)}</div>
|
|
19
|
+
</div>`;
|
|
9
20
|
}
|
|
10
21
|
|
|
11
22
|
export function Empty({ icon = "info", title, hint, action }) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* #3160: Follow agent in the Files & changes panel — its own stylesheet, linked by workspace-panel.js (a page holding
|
|
2
|
+
an older workspace.css or app.css still draws it). */
|
|
3
|
+
.ws-follow.on { color: var(--accent); }
|
|
4
|
+
.ws-follow.paused { color: var(--warn); }
|
|
5
|
+
.ws-history { display: flex; align-items: center; gap: var(--s-1); padding: 0 var(--s-3) var(--s-2); overflow-x: auto; scrollbar-width: thin; }
|
|
6
|
+
.ws-history-label { flex: none; font-size: var(--fs-xs); color: var(--text-3); }
|
|
7
|
+
.ws-step { flex: none; display: inline-flex; align-items: center; gap: 4px; max-width: 16em; padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px;
|
|
8
|
+
background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-xs); cursor: pointer; }
|
|
9
|
+
.ws-step:hover { background: var(--surface-2); }
|
|
10
|
+
.ws-step.is-current { border-color: var(--accent); }
|
|
11
|
+
.ws-step.is-hidden { color: var(--text-3); cursor: default; }
|
|
12
|
+
.ws-step .ws-step-kind { color: var(--text-3); }
|
|
13
|
+
.ws-step .ws-step-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); }
|
|
14
|
+
.ws-follow-note { margin: 0 var(--s-3) var(--s-2); font-size: var(--fs-xs); color: var(--text-3); }
|
|
15
|
+
.ws-text .ws-line { display: block; }
|
|
16
|
+
.ws-text .ws-line.hl-read { background: color-mix(in srgb, var(--accent) 12%, transparent); }
|
|
17
|
+
.ws-text .ws-line.hl-edit { background: color-mix(in srgb, var(--ok) 18%, transparent); }
|
|
18
|
+
.ws-entry.hl .ws-entry-btn { outline: 2px solid var(--accent); outline-offset: -2px; }
|
|
19
|
+
@media (prefers-reduced-motion: no-preference) { .ws-text .ws-line.hl-edit, .ws-text .ws-line.hl-read { transition: background 0.4s; } }
|
package/dist/ui/signin.html
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
<!--/app-icon-->
|
|
14
14
|
<script src="/assets/theme.js"></script>
|
|
15
15
|
<link rel="stylesheet" href="/assets/tokens.css">
|
|
16
|
+
<link rel="stylesheet" href="/assets/loading.css">
|
|
16
17
|
<style>
|
|
17
18
|
/* #1408 step 5: the app's tokens (tokens.css), light and dark like every page (theme.js before paint). */
|
|
18
19
|
* { box-sizing: border-box; }
|
|
@@ -53,9 +54,11 @@
|
|
|
53
54
|
</style>
|
|
54
55
|
</head>
|
|
55
56
|
<body>
|
|
56
|
-
<main>
|
|
57
|
+
<main class="signin-card">
|
|
57
58
|
<div class="brand">AgEnD</div>
|
|
58
|
-
<div id="checking"
|
|
59
|
+
<div id="checking" class="skeleton sk-signin" role="status" aria-busy="true" aria-label="Checking your session…">
|
|
60
|
+
<div aria-hidden="true"><div class="sk-line"></div><div class="sk-line"></div><div class="sk-line"></div><div class="sk-line"></div><div class="sk-line"></div></div>
|
|
61
|
+
</div>
|
|
59
62
|
<form id="form" hidden autocomplete="off">
|
|
60
63
|
<h1 data-i18n="title">Sign in to AgEnD</h1>
|
|
61
64
|
<p data-i18n="lead">Enter your sign-in code.</p>
|
|
@@ -74,7 +77,8 @@
|
|
|
74
77
|
<div id="device" hidden>
|
|
75
78
|
<h1 data-i18n="dev_title">Sign in with another device</h1>
|
|
76
79
|
<p data-i18n="dev_lead">On a device that is already signed in to AgEnD as the owner, open Settings → Access & security, choose Add device under Devices & sign-in, and enter this code.</p>
|
|
77
|
-
<div id="
|
|
80
|
+
<div id="devLoading" class="skeleton sk-inline" role="status" aria-busy="true" aria-label="Loading…" hidden><div class="sk-line" aria-hidden="true"></div></div>
|
|
81
|
+
<div id="devCode" class="devcode" aria-live="polite" aria-label="Code"></div>
|
|
78
82
|
<div id="devStatus" role="status" aria-live="polite"></div>
|
|
79
83
|
<div id="devQr" class="devqr" hidden><svg id="devQrSvg" viewBox="0 0 1 1" role="img" aria-label="QR code" focusable="false"></svg><p data-i18n="dev_qr">Or scan this QR code with a device that is already signed in as the owner. It holds this page's address and the code above, nothing else.</p></div>
|
|
80
84
|
<button id="devNew" type="button" hidden data-i18n="dev_new">Get a new code</button>
|
|
@@ -24,6 +24,16 @@ export const SIGNIN_STRINGS = {
|
|
|
24
24
|
error_expired: "This login attempt expired. Start a new attempt.",
|
|
25
25
|
error_auth_unconfirmed: "The CLI exited, but credentials could not be verified. Retry or sign in later.",
|
|
26
26
|
error_provider_rejected: "The provider rejected this sign-in. Retry or sign in later.",
|
|
27
|
+
// #3190 Part 3c: a profile on a paired computer (the dashboard's Accounts view).
|
|
28
|
+
error_machine_unknown: "That computer is not paired any more.",
|
|
29
|
+
error_machine_offline: "That computer is offline. Start its Runtime, then try again.",
|
|
30
|
+
error_machine_unsupported: "That computer's Runtime is too old to sign in from here. Update the Runtime on it, then try again.",
|
|
31
|
+
error_machine_accounts_off: "The owner of that computer has not allowed this. On that computer run: agend-runtime remote-setup accounts on",
|
|
32
|
+
error_machine_unreachable: "That computer did not answer. Check its Runtime window, then try again.",
|
|
33
|
+
error_machine_profile_not_owned: "This account was not created by AgEnD's Runtime, so it can only be signed in on that computer: agend-runtime login claude-code NAME",
|
|
34
|
+
error_machine_busy: "Another sign-in is already running on that computer.",
|
|
35
|
+
error_invalid_machine_target: "That is not a valid account on a computer.",
|
|
36
|
+
error_machine_transport_failed: "That computer could not complete the sign-in. Check its Runtime window, then try again.",
|
|
27
37
|
},
|
|
28
38
|
"zh-TW": {
|
|
29
39
|
heading: "登入你的 AI 後端",
|
|
@@ -48,6 +58,16 @@ export const SIGNIN_STRINGS = {
|
|
|
48
58
|
error_expired: "這次登入已過期。請重新開始。",
|
|
49
59
|
error_auth_unconfirmed: "CLI 已結束,但無法確認憑證。請重試或稍後登入。",
|
|
50
60
|
error_provider_rejected: "平台拒絕了這次登入。請重試或稍後登入。",
|
|
61
|
+
// #3190 Part 3c:配對電腦上的憑證設定檔(儀表板的「帳號」頁)。
|
|
62
|
+
error_machine_unknown: "那台電腦已不再配對。",
|
|
63
|
+
error_machine_offline: "那台電腦離線了。請先啟動它的 Runtime,再試一次。",
|
|
64
|
+
error_machine_unsupported: "那台電腦的 Runtime 太舊,無法在這裡登入。請先更新它的 Runtime,再試一次。",
|
|
65
|
+
error_machine_accounts_off: "那台電腦的擁有者尚未允許這件事。請在那台電腦上執行:agend-runtime remote-setup accounts on",
|
|
66
|
+
error_machine_unreachable: "那台電腦沒有回應。請檢查它的 Runtime 視窗,再試一次。",
|
|
67
|
+
error_machine_profile_not_owned: "這個帳號不是 AgEnD 的 Runtime 建立的,只能在那台電腦上登入:agend-runtime login claude-code NAME",
|
|
68
|
+
error_machine_busy: "那台電腦上已經有另一個登入在進行。",
|
|
69
|
+
error_invalid_machine_target: "這不是電腦上的有效帳號。",
|
|
70
|
+
error_machine_transport_failed: "那台電腦沒有完成這次登入。請檢查它的 Runtime 視窗,再試一次。",
|
|
51
71
|
},
|
|
52
72
|
};
|
|
53
73
|
const NAMES = { "kiro-cli": "Kiro", "claude-code": "Claude Code", codex: "Codex", antigravity: "Antigravity" };
|
|
@@ -55,14 +75,19 @@ const CHOICES = { builder_id: "Builder ID", google: "Google", github: "GitHub",
|
|
|
55
75
|
/** The page's language, as its <html lang> says (the setup page and the dashboard both keep it current). */
|
|
56
76
|
const pageLang = doc => /^zh/i.test(doc?.documentElement?.lang || "") ? "zh-TW" : "en";
|
|
57
77
|
|
|
58
|
-
|
|
78
|
+
/**
|
|
79
|
+
* `machine` (#3190 Part 3c): these cards are for ONE credential profile on a paired computer (the endpoint carries `?machine=&profile=`). The dialog around them says
|
|
80
|
+
* so, so the setup page's heading and lead are not repeated; there is no "sign in later" (this is an explicit request); and a sign-in again asks nothing about
|
|
81
|
+
* Kiro (Claude Code's own sign-in replaces the login; it signs nothing out first).
|
|
82
|
+
*/
|
|
83
|
+
export function mountStructuredSignIns(root, { endpoint, fetcher = fetch, changed = () => {}, lang, machine = false } = {}) {
|
|
59
84
|
const doc = root.ownerDocument;
|
|
60
85
|
let view = null, busy = false, disposed = false, timer = null, generation = 0, message = "", rendered = "";
|
|
61
86
|
const language = () => (lang ? lang() : pageLang(doc)) === "zh-TW" ? "zh-TW" : "en";
|
|
62
87
|
const tr = (key, value) => { const text = SIGNIN_STRINGS[language()][key] ?? SIGNIN_STRINGS.en[key] ?? key; return value === undefined ? text : text.split("{0}").join(value); };
|
|
63
88
|
const el = (tag, text, parent = root) => { const node = doc.createElement(tag); if (text) node.textContent = text; parent.append(node); return node; };
|
|
64
89
|
// An error is kept as its code, so it is said again in the other language when that changes.
|
|
65
|
-
const errorText = code => SIGNIN_STRINGS.en["error_" + code] ? tr("error_" + code) : tr("error");
|
|
90
|
+
const errorText = code => machine && SIGNIN_STRINGS.en["error_machine_" + code] ? tr("error_machine_" + code) : SIGNIN_STRINGS.en["error_" + code] ? tr("error_" + code) : tr("error");
|
|
66
91
|
const name = backend => backend === "antigravity" ? tr("antigravity") : NAMES[backend] || backend;
|
|
67
92
|
const choiceName = choice => CHOICES[choice] ?? tr("choice_" + choice);
|
|
68
93
|
const phaseName = phase => SIGNIN_STRINGS.en["phase_" + phase] ? tr("phase_" + phase) : phase.replaceAll("_", " ");
|
|
@@ -85,8 +110,7 @@ export function mountStructuredSignIns(root, { endpoint, fetcher = fetch, change
|
|
|
85
110
|
const signature = JSON.stringify([view, busy, message, language()]);
|
|
86
111
|
if (disposed || rendered === signature) return;
|
|
87
112
|
rendered = signature; root.replaceChildren();
|
|
88
|
-
el("h2", tr("heading"));
|
|
89
|
-
el("p", tr("lead"));
|
|
113
|
+
if (!machine) { el("h2", tr("heading")); el("p", tr("lead")); }
|
|
90
114
|
if (message) { const alert = el("p", errorText(message)); alert.setAttribute("role", "alert"); }
|
|
91
115
|
if (!view) { button(root, tr("check"), () => perform({ operation: "refresh" })); return; }
|
|
92
116
|
for (const backend of view.selected) {
|
|
@@ -122,14 +146,14 @@ export function mountStructuredSignIns(root, { endpoint, fetcher = fetch, change
|
|
|
122
146
|
const usable = !["antigravity"].includes(backend) && state !== "not_installed";
|
|
123
147
|
if (usable) button(card, tr(state === "valid" ? "signInAgain" : "signIn"), () => {
|
|
124
148
|
const relogin = state === "valid";
|
|
125
|
-
if (relogin && !globalThis.confirm(tr("relogin"))) return;
|
|
149
|
+
if (relogin && !machine && !globalThis.confirm(tr("relogin"))) return;
|
|
126
150
|
void perform({ operation: "start", backend, relogin });
|
|
127
151
|
});
|
|
128
152
|
}
|
|
129
|
-
if (pending && !skipped) button(card, tr("later"), () => perform({ operation: "skip", backend }));
|
|
153
|
+
if (pending && !skipped && !machine) button(card, tr("later"), () => perform({ operation: "skip", backend }));
|
|
130
154
|
}
|
|
131
155
|
button(root, tr("check"), () => perform({ operation: "refresh" }));
|
|
132
|
-
if (view.ready) el("p", tr("ready"));
|
|
156
|
+
if (view.ready && !machine) el("p", tr("ready"));
|
|
133
157
|
}
|
|
134
158
|
async function poll() {
|
|
135
159
|
if (disposed) return;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// #3160: Follow agent's words, in their own module (a new URL, so a page that cached an older workspace-strings.js
|
|
2
|
+
// still gets them — never a raw key). Registered by workspace-panel.js.
|
|
3
|
+
import { register } from "/assets/app-i18n.js";
|
|
4
|
+
|
|
5
|
+
register("chat", {
|
|
6
|
+
en: {
|
|
7
|
+
wsFollow: "Follow agent", wsFollowing: "Following", wsFollowPaused: "Paused · Resume",
|
|
8
|
+
wsFollowTitle: "Show the file the agent is reading, editing or searching, as it works",
|
|
9
|
+
wsFollowPausedTitle: "You moved, so Follow paused. Click to follow the agent again",
|
|
10
|
+
wsFollowNotHere: "Follow works for Claude Code and Codex agents",
|
|
11
|
+
wsFollowNotRunning: "The agent isn't running", wsFollowIdle: "Waiting for the agent to read or edit a file…",
|
|
12
|
+
wsThisTurn: "This turn", wsKind_read: "Read", wsKind_edit: "Edit", wsKind_search: "Search", wsKind_list: "List",
|
|
13
|
+
wsBestEffort: "From a shell command, so this is a best guess", wsHiddenStep: "A hidden file (its contents are never shown)",
|
|
14
|
+
wsFollowHlRead: "Lines the agent read", wsFollowHlEdit: "Uncommitted changes (including your edits)",
|
|
15
|
+
wsFollowHlEditExact: "Lines changed by this edit",
|
|
16
|
+
},
|
|
17
|
+
"zh-TW": {
|
|
18
|
+
wsFollow: "跟隨 Agent", wsFollowing: "跟隨中", wsFollowPaused: "已暫停 · 繼續",
|
|
19
|
+
wsFollowTitle: "Agent 工作時,顯示它正在讀、改或搜尋的檔案",
|
|
20
|
+
wsFollowPausedTitle: "你動了畫面,所以先暫停跟隨。按一下繼續跟隨 Agent",
|
|
21
|
+
wsFollowNotHere: "跟隨只支援 Claude Code 與 Codex 的 Agent",
|
|
22
|
+
wsFollowNotRunning: "Agent 沒有在執行", wsFollowIdle: "等 Agent 讀取或修改檔案…",
|
|
23
|
+
wsThisTurn: "這一輪", wsKind_read: "讀取", wsKind_edit: "修改", wsKind_search: "搜尋", wsKind_list: "列出",
|
|
24
|
+
wsBestEffort: "來自 shell 指令,只是推測", wsHiddenStep: "隱藏的檔案(內容一律不顯示)",
|
|
25
|
+
wsFollowHlRead: "Agent 讀過的行", wsFollowHlEdit: "尚未提交的變更(包含你的修改)",
|
|
26
|
+
wsFollowHlEditExact: "這次修改的行",
|
|
27
|
+
},
|
|
28
|
+
});
|