@songsid/agend 2.3.5-alpha.11 → 2.3.5-alpha.13
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 +4 -0
- package/dist/accounts-view.d.ts +3 -0
- package/dist/accounts-view.js +2 -2
- package/dist/accounts-view.js.map +1 -1
- package/dist/agent-workspace.d.ts +1 -2
- package/dist/agent-workspace.js +8 -29
- package/dist/agent-workspace.js.map +1 -1
- package/dist/auth-api.js +15 -29
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/claude-code.js +16 -3
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/codex.d.ts +7 -14
- package/dist/backend/codex.js +25 -29
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/credential-profile.d.ts +16 -0
- package/dist/backend/credential-profile.js +44 -0
- package/dist/backend/credential-profile.js.map +1 -1
- package/dist/backend/grok-mcp.d.ts +5 -0
- package/dist/backend/grok-mcp.js +221 -0
- package/dist/backend/grok-mcp.js.map +1 -0
- package/dist/backend/grok.d.ts +0 -10
- package/dist/backend/grok.js +5 -82
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/muse.d.ts +3 -1
- package/dist/backend/muse.js +31 -1
- package/dist/backend/muse.js.map +1 -1
- package/dist/backend/types.d.ts +18 -1
- package/dist/backend/types.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/cli.js +18 -0
- package/dist/cli.js.map +1 -1
- package/dist/codex-pane-ownership.d.ts +13 -0
- package/dist/codex-pane-ownership.js +192 -0
- package/dist/codex-pane-ownership.js.map +1 -0
- package/dist/create-host-account.d.ts +17 -0
- package/dist/create-host-account.js +47 -0
- package/dist/create-host-account.js.map +1 -0
- package/dist/daemon.d.ts +25 -0
- package/dist/daemon.js +203 -16
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-outbox.js +7 -0
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-manager.d.ts +40 -9
- package/dist/fleet-manager.js +198 -47
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +1 -1
- package/dist/general-knowledge/skills/kiro-engine-migration/SKILL.md +1 -1
- package/dist/hub/client.d.ts +1 -1
- package/dist/hub/client.js +11 -0
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +2 -2
- package/dist/hub/compose/member.js +11 -3
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/member/exposure-api.d.ts +2 -0
- package/dist/hub/member/exposure-api.js +4 -2
- package/dist/hub/member/exposure-api.js.map +1 -1
- package/dist/hub/member/pairing-api.d.ts +2 -2
- package/dist/hub/member/pairing-api.js +2 -2
- package/dist/hub/member/pairing-api.js.map +1 -1
- package/dist/hub/server.js +8 -0
- package/dist/hub/server.js.map +1 -1
- package/dist/hub-pairing-summary.d.ts +3 -1
- package/dist/hub-pairing-summary.js +6 -3
- package/dist/hub-pairing-summary.js.map +1 -1
- package/dist/instance-lifecycle.js +29 -1
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +13 -9
- package/dist/locale.js.map +1 -1
- package/dist/public-web-link.d.ts +5 -0
- package/dist/public-web-link.js +8 -0
- package/dist/public-web-link.js.map +1 -1
- package/dist/runtime-client-store.js +5 -0
- package/dist/runtime-client-store.js.map +1 -1
- package/dist/runtime-pane-private.d.ts +2 -0
- package/dist/runtime-pane-private.js +25 -0
- package/dist/runtime-pane-private.js.map +1 -1
- package/dist/runtime-pane-private.ps1 +74 -7
- package/dist/selection-card.d.ts +4 -3
- package/dist/selection-card.js +2 -1
- package/dist/selection-card.js.map +1 -1
- package/dist/settings-api.js +5 -17
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.d.ts +2 -0
- package/dist/settings-change.js +74 -31
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-confirmation.d.ts +23 -0
- package/dist/settings-confirmation.js +13 -2
- package/dist/settings-confirmation.js.map +1 -1
- package/dist/settings-effect.d.ts +4 -0
- package/dist/settings-effect.js +14 -14
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.d.ts +3 -1
- package/dist/settings-http-confirmation.js +12 -7
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/settings-summary.d.ts +24 -0
- package/dist/settings-summary.js +42 -0
- package/dist/settings-summary.js.map +1 -0
- package/dist/signin-keepalive.d.ts +25 -1
- package/dist/signin-keepalive.js +44 -1
- package/dist/signin-keepalive.js.map +1 -1
- package/dist/transcript-delta-reader.d.ts +9 -1
- package/dist/transcript-delta-reader.js +37 -8
- package/dist/transcript-delta-reader.js.map +1 -1
- package/dist/ui/accounts-view.js +9 -7
- package/dist/ui/agent-details-settings.js +253 -0
- package/dist/ui/agent-instructions-field.js +69 -0
- package/dist/ui/agent-page-strings.js +148 -0
- package/dist/ui/chat-quote.js +12 -17
- package/dist/ui/hub-client.js +1 -1
- package/dist/ui/hub-company-join-strings.js +1 -1
- package/dist/ui/hub-company-join.js +7 -0
- package/dist/ui/hub-strings.js +10 -6
- package/dist/ui/native-instance-settings.js +47 -14
- package/dist/ui/panel-chat.js +2 -1
- package/dist/ui/panel-details.js +38 -14
- package/dist/ui/panel-fleet.js +9 -3
- package/dist/ui/panel-settings.js +17 -8
- package/dist/ui/settings-access-overview.js +188 -0
- package/dist/ui/settings-access-strings.js +1 -1
- package/dist/ui/settings-confirm.js +5 -5
- package/dist/ui/settings-devices.js +5 -5
- package/dist/ui/settings-dialogs.js +208 -100
- package/dist/ui/settings-hub-company-join.js +69 -14
- package/dist/ui/settings-hub.js +13 -5
- package/dist/ui/settings-layout.js +1 -1
- package/dist/ui/settings-model.js +15 -0
- package/dist/ui/settings-strings.js +8 -8
- package/dist/ui/shared/access-overview.css +48 -0
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app-shell.js +145 -4
- package/dist/ui/shared/app-store.js +2 -0
- package/dist/ui/shared/app.css +69 -7
- package/dist/ui/shared/chat-render.js +17 -5
- package/dist/ui/shared/device-roles.js +1 -1
- package/dist/ui/shared/instance-nav.js +5 -1
- package/dist/ui/shared/signin.js +130 -43
- package/dist/ui/shared/usage-dialog.js +27 -15
- package/dist/ui/shared/view-strings.js +2 -0
- package/dist/ui/shared/web-authorize.js +2 -2
- package/dist/ui/signin.html +19 -8
- package/dist/update-dispatch.d.ts +50 -0
- package/dist/update-dispatch.js +58 -2
- package/dist/update-dispatch.js.map +1 -1
- package/dist/usage/format-rich.js +1 -1
- package/dist/usage/format-rich.js.map +1 -1
- package/dist/usage/usage-api.d.ts +8 -2
- package/dist/usage/usage-api.js +12 -5
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/web-api.d.ts +5 -0
- package/dist/web-api.js +58 -0
- package/dist/web-api.js.map +1 -1
- package/dist/web-backend-login.d.ts +2 -0
- package/dist/web-backend-login.js.map +1 -1
- package/dist/web-remote-access.d.ts +71 -3
- package/dist/web-remote-access.js +197 -6
- package/dist/web-remote-access.js.map +1 -1
- package/dist/web-session.d.ts +4 -2
- package/dist/web-session.js +5 -2
- package/dist/web-session.js.map +1 -1
- package/dist/workspace-file-policy.d.ts +2 -0
- package/dist/workspace-file-policy.js +31 -0
- package/dist/workspace-file-policy.js.map +1 -0
- package/dist/workspace-follow.js +2 -1
- package/dist/workspace-follow.js.map +1 -1
- package/package.json +2 -2
- package/templates/runtime-assets/runtime-pane-private.ps1 +74 -7
- package/dist/ui/shared/signin-authenticator.js +0 -60
- package/dist/ui/signin-authenticator.html +0 -60
|
@@ -57,6 +57,8 @@ export function applyStatus(d) {
|
|
|
57
57
|
startup: d.startup?.phase === "starting" ? d.startup : null,
|
|
58
58
|
connections: typeof d.connections === "number" ? d.connections : null,
|
|
59
59
|
windowsCli: d.windows_cli === true,
|
|
60
|
+
// S-120: the public link's state as the status frame carries it ({ state, expiresAt?, noExpiry? }), for 存取與安全 → 總覽.
|
|
61
|
+
publicLink: d.publicLink && typeof d.publicLink.state === "string" ? d.publicLink : null,
|
|
60
62
|
// #1665: the host preferences' revision (app-prefs.js re-reads them when it moves).
|
|
61
63
|
prefsRev: typeof d.prefs_rev === "number" ? d.prefs_rev : null,
|
|
62
64
|
// #1629: the agents' themes' revision (app-themes.js re-reads them when it moves).
|
package/dist/ui/shared/app.css
CHANGED
|
@@ -299,6 +299,10 @@ html:has(.shell), html:has(.shell) body { overflow: hidden; }
|
|
|
299
299
|
.p-chat .panel-sub > :not(.status) { display: none; }
|
|
300
300
|
}
|
|
301
301
|
.status { display: inline-flex; align-items: center; gap: 6px; }
|
|
302
|
+
/* An agent's page, on a phone: the status is its dot only (the word is the status's title and accessible name), so the name keeps the room. */
|
|
303
|
+
@media (max-width: 479px) {
|
|
304
|
+
.p-agent-page .panel-sub .status-text { display: none; }
|
|
305
|
+
}
|
|
302
306
|
/* #2015: the largest processes, after the host memory chip's text. */
|
|
303
307
|
.host-mem-top { margin-left: var(--s-2); opacity: 0.8; overflow-wrap: anywhere; }
|
|
304
308
|
/* M-2556: bound Fleet's warning independently of tab placement. Cached panels without a tooltip keep wrapping. */
|
|
@@ -363,7 +367,6 @@ html:has(.shell), html:has(.shell) body { overflow: hidden; }
|
|
|
363
367
|
.p-log .log-sec-h { font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
|
|
364
368
|
.p-log .log-older, .p-log .log-start { text-align: center; margin: var(--s-2) 0; }
|
|
365
369
|
.p-log .log-off { padding: var(--s-6) var(--s-4); }
|
|
366
|
-
.p-details .d-edit { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-2); }
|
|
367
370
|
/* The header's controls are one height, the icon buttons' (36 px): its small buttons, and the instance tabs when they share
|
|
368
371
|
its row (a phone puts them on a row of their own, under it). */
|
|
369
372
|
.panel-head .btn-sm { min-height: 36px; }
|
|
@@ -1511,10 +1514,6 @@ body.side-resizing, body.side-resizing * { cursor: col-resize !important; user-s
|
|
|
1511
1514
|
.u-stale-detail { color: var(--text-3); font-size: var(--fs-xs); }
|
|
1512
1515
|
.u-sub { color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
|
|
1513
1516
|
/* #3066 §1: a weekly quota's measured 100% under its bar, and its notes (the fleet-only limit always). */
|
|
1514
|
-
.u-cap { margin-top: 4px; font-size: var(--fs-xs); }
|
|
1515
|
-
.u-cap-line { color: var(--text-2); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
|
|
1516
|
-
.u-cap-wait .u-cap-line { color: var(--text-3); }
|
|
1517
|
-
.u-cap-note { color: var(--text-3); overflow-wrap: anywhere; }
|
|
1518
1517
|
.u-err { color: var(--warn); font-size: var(--fs-sm); }
|
|
1519
1518
|
.u-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
|
|
1520
1519
|
/* #1673: the usage rail beside the page on a wide screen (header-tools.js UsageRail; shown only at min-width 1200px). */
|
|
@@ -1553,6 +1552,8 @@ body.side-resizing, body.side-resizing * { cursor: col-resize !important; user-s
|
|
|
1553
1552
|
.u-cm-tag { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
1554
1553
|
/* #2240: an account of several pools (agy) names each pool's line: a wider label, ending in an ellipsis if it must. */
|
|
1555
1554
|
.u-crow.is-pooled .u-cm { grid-template-columns: minmax(0, 7.0em) minmax(0, 1fr) 2.9em 3.7em; column-gap: 7px; }
|
|
1555
|
+
/* M-2815: a per-model weekly on its own bar ("Fable"): a wider tag for every bar of that login, so they line up. */
|
|
1556
|
+
.u-crow.has-models .u-cm { grid-template-columns: minmax(0, 3.6em) minmax(0, 1fr) 2.9em 3.7em; }
|
|
1556
1557
|
.u-cm-bar { height: 6px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; }
|
|
1557
1558
|
.u-cm-fill { display: block; height: 100%; width: 0; min-width: 2px; border-radius: var(--r-full); background: var(--accent); }
|
|
1558
1559
|
.u-cm-fill.warn { background: var(--warn); } .u-cm-fill.crit { background: var(--danger); }
|
|
@@ -1708,8 +1709,9 @@ body.side-resizing, body.side-resizing * { cursor: col-resize !important; user-s
|
|
|
1708
1709
|
.pill.ver { text-transform: none; letter-spacing: 0; }
|
|
1709
1710
|
/* #2347 §7: Settings' title stays whole on a narrow phone (at 320 px it was cut to "S…"): the version beside it takes the
|
|
1710
1711
|
room that is left — shortened, or not shown when too little is. */
|
|
1711
|
-
|
|
1712
|
-
.p-settings .panel-
|
|
1712
|
+
/* the version pill of the Settings header; an agent's page (p-agent-page) keeps Details' own header (its status must not shrink to nothing). */
|
|
1713
|
+
.p-settings:not(.p-agent-page) .panel-title h1 { flex: none; }
|
|
1714
|
+
.p-settings:not(.p-agent-page) .panel-sub { flex: 1 1 0; min-width: 0; container: settings-ver / inline-size; }
|
|
1713
1715
|
.p-settings .panel-sub .pill.ver { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
|
|
1714
1716
|
@container settings-ver (max-width: 56px) { .p-settings .panel-sub .pill.ver { display: none; } }
|
|
1715
1717
|
.s-key { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-2) 0; border-top: 1px solid var(--border); }
|
|
@@ -4226,3 +4228,63 @@ html.oo-immersive .p-fleet > .panel-body { z-index: 50; }
|
|
|
4226
4228
|
.s-hub-connection .field-row > .btn-primary { width: 100%; }
|
|
4227
4229
|
.s-hub-connection .hub-fp .btn { white-space: normal; }
|
|
4228
4230
|
}
|
|
4231
|
+
|
|
4232
|
+
/* Agent page: the menu of Settings and of an agent's Details & settings page (both are `.p-settings` with a `.s-nav`):
|
|
4233
|
+
what is a menu and what is content has to read at a glance. These five rules change the shared Settings page too. */
|
|
4234
|
+
/* S1. A hairline under the page header, so the header (with the instance tabs) no longer runs into the content. */
|
|
4235
|
+
.p-settings > .panel-head { border-bottom: 1px solid var(--border); }
|
|
4236
|
+
/* S2. A group title is a label, not a link: smaller, dim, not hoverable; a hairline starts the next group; its items are what you click. */
|
|
4237
|
+
.p-settings .s-nav .s-nav-head { font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: 0.06em; color: var(--text-3); cursor: default; user-select: none; pointer-events: none; }
|
|
4238
|
+
.p-settings .s-nav .s-nav-group + .s-nav-group { border-top: 1px solid var(--border); padding-top: var(--s-3); }
|
|
4239
|
+
.p-settings .s-nav .seg-item .icon { color: var(--text-3); }
|
|
4240
|
+
.p-settings .s-nav .seg-item.active .icon { color: inherit; }
|
|
4241
|
+
.p-settings .s-nav .seg-item .count { color: var(--warn); font-size: var(--fs-xs); }
|
|
4242
|
+
/* S2b. A label too long for the column is cut with an ellipsis (its `title` has the whole word), never drawn past the column;
|
|
4243
|
+
the current item is bold, so it is the one that grew. The row of tabs (S4) scrolls instead, and the phone's list wraps. */
|
|
4244
|
+
.p-settings > .s-nav .seg-item { min-width: 0; max-width: 100%; }
|
|
4245
|
+
.p-settings > .s-nav .seg-item > span:not(.count) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
4246
|
+
@media (min-width: 900px) and (max-width: 1099px) { .p-settings > .s-nav .seg-item > span:not(.count) { overflow: visible; text-overflow: clip; } }
|
|
4247
|
+
@media (max-width: 899px) { .p-settings > .s-nav .seg-item > span:not(.count) { overflow: visible; text-overflow: clip; white-space: normal; } }
|
|
4248
|
+
/* S3. Wide (≥1100px): the category column is its own panel — the sidebar's tone and a divider on its right edge. */
|
|
4249
|
+
@media (min-width: 1100px) {
|
|
4250
|
+
.p-settings > .s-nav { background: var(--bg-sidebar); border-right: 1px solid var(--border); padding: var(--s-4) var(--s-3) var(--s-4) var(--s-3); }
|
|
4251
|
+
.p-settings > .s-nav .seg-item { padding-left: var(--s-4); min-height: 38px; }
|
|
4252
|
+
.p-settings > .s-nav .s-nav-head { padding-left: var(--s-4); }
|
|
4253
|
+
}
|
|
4254
|
+
/* S4. Middle (900–1099px): the row becomes real tabs — an underline for the current one, no group titles (a divider instead),
|
|
4255
|
+
and a fade at the right edge that says it scrolls. */
|
|
4256
|
+
@media (min-width: 900px) and (max-width: 1099px) {
|
|
4257
|
+
.p-settings > .s-nav { background: var(--bg); border-bottom: 1px solid var(--border); padding: 0 var(--s-4); }
|
|
4258
|
+
.p-settings > .s-nav .s-nav-head { display: none; }
|
|
4259
|
+
.p-settings > .s-nav .s-nav-groups { align-items: stretch; column-gap: 0; flex-wrap: nowrap; overflow-x: auto; -webkit-mask-image: linear-gradient(to right, black calc(100% - 32px), transparent); mask-image: linear-gradient(to right, black calc(100% - 32px), transparent); }
|
|
4260
|
+
.p-settings > .s-nav .s-nav-group { align-items: stretch; flex-wrap: nowrap; flex-shrink: 0; gap: 0; }
|
|
4261
|
+
.p-settings > .s-nav .s-nav-group + .s-nav-group { border-top: 0; padding-top: 0; border-left: 1px solid var(--border); margin-left: var(--s-2); padding-left: var(--s-2); }
|
|
4262
|
+
.p-settings > .s-nav .seg-item { min-height: 46px; padding: 0 var(--s-3); border-radius: 0; border-bottom: 2px solid transparent; background: none; font-weight: var(--fw-medium); }
|
|
4263
|
+
.p-settings > .s-nav .seg-item:hover { background: var(--surface); }
|
|
4264
|
+
.p-settings > .s-nav .seg-item.active { background: none; color: var(--accent); border-bottom-color: var(--accent); }
|
|
4265
|
+
.p-settings > .s-nav .seg-item.active::before { display: none; }
|
|
4266
|
+
}
|
|
4267
|
+
/* S5. Phone: "‹ Settings" becomes a full-width bar under the header (tinted, bordered, 48px, the section's name at its right). */
|
|
4268
|
+
@media (max-width: 899px) {
|
|
4269
|
+
.p-settings > .panel-body .s-back { min-height: 48px; margin: calc(-1 * var(--s-4)) calc(-1 * var(--s-4)) var(--s-4); padding: 0 var(--s-4); background: var(--surface); border-bottom: 1px solid var(--border); font-weight: var(--fw-semibold); }
|
|
4270
|
+
.p-settings .s-back .s-back-here { font-weight: var(--fw-semibold); }
|
|
4271
|
+
.p-settings[data-view="index"] > .s-nav .s-nav-group + .s-nav-group { border-top: 0; padding-top: 0; }
|
|
4272
|
+
}
|
|
4273
|
+
/* The agent page's cards: two columns on a wide page (`.ap-span2` across both), one column when it is narrow. */
|
|
4274
|
+
.ap-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
|
|
4275
|
+
@container settings-page (min-width: 820px) { .ap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
|
|
4276
|
+
.ap-grid > .card { margin-bottom: 0; }
|
|
4277
|
+
.ap-grid > .ap-span2 { grid-column: 1 / -1; }
|
|
4278
|
+
.ap-danger { border-color: var(--danger-line); }
|
|
4279
|
+
/* A category's panel takes no box of its own: its cards are stacked by .s-section-layout's gap, like Settings' cards. */
|
|
4280
|
+
.ap-panel { display: contents; }
|
|
4281
|
+
.ap-panel[hidden] { display: none; }
|
|
4282
|
+
.p-details .d-actions .field-row { flex-wrap: wrap; }
|
|
4283
|
+
/* The sidebar's ⚙: one step to an agent's settings — on hover or focus on a desktop and on the open row, always on a touch screen. */
|
|
4284
|
+
.inst-gear { flex: none; width: 28px; height: 28px; padding: 0; color: var(--text-3); display: inline-grid; place-items: center; }
|
|
4285
|
+
@media (hover: hover) { .inst-nav .v-li:not(:hover):not(:focus-within):not(:has(> .inst.active)) > .inst-gear:not(:focus-visible) { visibility: hidden; } }
|
|
4286
|
+
.v-li.two-line > .inst-gear { align-self: flex-start; margin-top: 6px; }
|
|
4287
|
+
/* The Agent instructions field: the Edit / Preview switch, the box under it (the editor or the preview) and the notes are one column with the form's standard gap; the preview scrolls inside its own box (the chat's Markdown look, .pv-code.pv-md). */
|
|
4288
|
+
.instructions-field { display: flex; flex-direction: column; gap: var(--s-2); }
|
|
4289
|
+
.instructions-field > .seg-inline { align-self: flex-start; }
|
|
4290
|
+
.instructions-field .pv-code { max-height: 24rem; }
|
|
@@ -122,13 +122,16 @@
|
|
|
122
122
|
var MAX_TABLE_COLUMNS = 20;
|
|
123
123
|
|
|
124
124
|
/** Leading whitespace as columns: a tab counts four. */
|
|
125
|
+
var LIST_ITEM = /^([ \t]*)([-*+]|\d{1,9}[.)])\s+(.*)$/;
|
|
125
126
|
function indentOf(ws) { var n = 0; for (var i = 0; i < ws.length; i++) n += ws[i] === "\t" ? 4 : 1; return n; }
|
|
126
127
|
|
|
127
128
|
/**
|
|
128
129
|
* A run of list items as nested lists. An item indented deeper than the one before opens a list inside that
|
|
129
130
|
* item; a shallower one closes lists back to its level; at the same level a change of kind (- vs 1.) starts a
|
|
130
131
|
* new list. Every tag is the renderer's own; item text goes through inline() like any other text.
|
|
132
|
+
* M-2811: a numbered list keeps its first number ("3." after a paragraph reads 3 — `start`, digits only).
|
|
131
133
|
*/
|
|
134
|
+
function openList(it) { return it.tag === "ol" && it.num > 1 ? '<ol start="' + it.num + '">' : "<" + it.tag + ">"; }
|
|
132
135
|
function renderList(items, store) {
|
|
133
136
|
var html = "";
|
|
134
137
|
var stack = []; // { indent, tag }
|
|
@@ -137,10 +140,10 @@
|
|
|
137
140
|
while (stack.length && it.indent < stack[stack.length - 1].indent) html += "</li></" + stack.pop().tag + ">";
|
|
138
141
|
var top = stack[stack.length - 1];
|
|
139
142
|
if (!top || (it.indent > top.indent && stack.length < MAX_LIST_DEPTH)) {
|
|
140
|
-
html +=
|
|
143
|
+
html += openList(it);
|
|
141
144
|
stack.push({ indent: it.indent, tag: it.tag });
|
|
142
145
|
} else if (top.tag !== it.tag) {
|
|
143
|
-
html += "</li></" + top.tag + "
|
|
146
|
+
html += "</li></" + top.tag + ">" + openList(it);
|
|
144
147
|
top.tag = it.tag;
|
|
145
148
|
} else {
|
|
146
149
|
html += "</li>";
|
|
@@ -211,7 +214,16 @@
|
|
|
211
214
|
for (var i = 0; i < lines.length; i++) {
|
|
212
215
|
var line = lines[i];
|
|
213
216
|
var m;
|
|
214
|
-
if (/^\s*$/.test(line)) {
|
|
217
|
+
if (/^\s*$/.test(line)) {
|
|
218
|
+
// M-2811: a blank line between list items (a "loose" list: "1. a\n\n2. b") keeps one list — its numbering runs
|
|
219
|
+
// on instead of starting at 1 again for every item.
|
|
220
|
+
if (list.length) {
|
|
221
|
+
var k = i + 1;
|
|
222
|
+
while (k < lines.length && /^\s*$/.test(lines[k])) k++;
|
|
223
|
+
if (k < lines.length && LIST_ITEM.test(lines[k])) { i = k - 1; continue; }
|
|
224
|
+
}
|
|
225
|
+
flushAll(); continue;
|
|
226
|
+
}
|
|
215
227
|
// A table: a header row with a pipe, then a separator row with the same number of columns.
|
|
216
228
|
if (line.indexOf("|") !== -1 && i + 1 < lines.length) {
|
|
217
229
|
var aligns = tableAligns(lines[i + 1]);
|
|
@@ -229,9 +241,9 @@
|
|
|
229
241
|
if ((m = /^(#{1,6})\s+(.*)$/.exec(line))) { flushAll(); var n = Math.min(m[1].length + 2, 6); out.push("<h" + n + ">" + inline(m[2], store) + "</h" + n + ">"); continue; }
|
|
230
242
|
if (/^\s*(?:-{3,}|\*{3,}|_{3,})\s*$/.test(line)) { flushAll(); out.push("<hr>"); continue; }
|
|
231
243
|
if ((m = /^>\s?(.*)$/.exec(line))) { flushPara(); flushList(); quote.push(m[1]); continue; }
|
|
232
|
-
if ((m =
|
|
244
|
+
if ((m = LIST_ITEM.exec(line))) {
|
|
233
245
|
flushPara(); flushQuote();
|
|
234
|
-
list.push({ indent: indentOf(m[1]), tag: /\d/.test(m[2]) ? "ol" : "ul", text: m[3] });
|
|
246
|
+
list.push({ indent: indentOf(m[1]), tag: /\d/.test(m[2]) ? "ol" : "ul", num: /\d/.test(m[2]) ? parseInt(m[2], 10) : 0, text: m[3] });
|
|
235
247
|
continue;
|
|
236
248
|
}
|
|
237
249
|
flushList(); flushQuote();
|
|
@@ -8,7 +8,7 @@ import { register, t } from "./app-i18n.js";
|
|
|
8
8
|
|
|
9
9
|
register("webauth", {
|
|
10
10
|
en: { role: "Role", roleOwner: "Owner ✓", roleAdminUnverified: "Admin · not verified", roleGuest: "Guest", roleRead: "Read-only" },
|
|
11
|
-
"zh-TW": { role: "角色", roleOwner: "擁有者 ✓", roleAdminUnverified: "
|
|
11
|
+
"zh-TW": { role: "角色", roleOwner: "擁有者 ✓", roleAdminUnverified: "管理員 · 未驗證", roleGuest: "訪客", roleRead: "唯讀" },
|
|
12
12
|
});
|
|
13
13
|
register("app", {
|
|
14
14
|
en: { manageDevices: "Manage devices" },
|
|
@@ -524,6 +524,7 @@ export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting =
|
|
|
524
524
|
const favs = nav.favorites.filter((n) => known.has(n) && n !== generalName);
|
|
525
525
|
const favSet = new Set(favs);
|
|
526
526
|
const canStar = !viewOnly && prefsWritable("nav.favorites");
|
|
527
|
+
const canConfigure = !viewOnly && !guestPage(); // Details needs a session: not the anonymous reader, not a guest
|
|
527
528
|
// #1920: a guest's list is not reordered (the order is the host's). #2855: it stars, sorts and filters as its own
|
|
528
529
|
// preferences (kept on the host under its account), with reply times that only count replies its channel showed.
|
|
529
530
|
const guest = guestPage();
|
|
@@ -640,7 +641,10 @@ export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting =
|
|
|
640
641
|
onClick=${() => { if (!shown.active && !favsSorted) moveFavorite(name, 1, known); }}><${Icon} name="down" size=${14} /></button>` : null}${canStar
|
|
641
642
|
? html`<button type="button" class=${`icon-btn inst-star${starred ? " on" : ""}`} aria-pressed=${starred ? "true" : "false"} disabled=${full}
|
|
642
643
|
aria-label=${tn(starred ? "favRemove" : "favAdd", { name: label })} title=${full ? tn("favFull", { max: MAX_FAVORITES }) : tn(starred ? "favRemove" : "favAdd", { name: label })}
|
|
643
|
-
onClick=${() => toggleFavorite(name, known)}><${Icon} name="star" size=${14} /></button>` : null}
|
|
644
|
+
onClick=${() => toggleFavorite(name, known)}><${Icon} name="star" size=${14} /></button>` : null}${canConfigure && supportsInstanceFeature(it, "details")
|
|
645
|
+
// one step to this agent's settings (its Details & settings page, Basic info; a kind with no Basic info — a ClassicBot room — starts at its first category); the row itself still opens the chat.
|
|
646
|
+
? html`<a class="icon-btn inst-gear" href=${`${detailsPath(name)}?cat=basic`} aria-label=${tn("gearOpen", { name: label })} title=${tn("gearOpen", { name: label })}
|
|
647
|
+
onClick=${onPick}><${Icon} name="settings" size=${14} /></a>` : null}</li>`;
|
|
644
648
|
};
|
|
645
649
|
// #2401: an open list of two or more lines leaves room under the count for "shown" and Clear (stacked); otherwise compact.
|
|
646
650
|
const facetSet = f.status.length > 0 || f.cli.length > 0;
|
package/dist/ui/shared/signin.js
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
const T = {
|
|
13
13
|
en: {
|
|
14
14
|
signout_unsaved: "Signed out for now, but the change could not be saved: a restart may bring the session back. This page cannot repair session storage.",
|
|
15
|
-
checking: "Checking your session…", title: "Sign in to AgEnD", lead: "Enter your sign
|
|
16
|
-
label: "
|
|
17
|
-
hint: "
|
|
15
|
+
checking: "Checking your session…", title: "Sign in to AgEnD", lead: "Enter your authenticator app’s 6-digit code to sign in automatically.",
|
|
16
|
+
label: "Authenticator or device sign-in code", submit: "Sign in", working: "Signing in…",
|
|
17
|
+
hint: "Paste an 8-character device sign-in code",
|
|
18
18
|
nobot: "No chat bot?", nobot_body: "Ask the operator to run agend web --code on the AgEnD computer.",
|
|
19
19
|
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.",
|
|
20
20
|
refused: "The code is invalid or no longer works. Send /web in General, then press a sign-in button for a new code.",
|
|
@@ -42,6 +42,14 @@
|
|
|
42
42
|
hint_outside: "Lost your phone? On the AgEnD computer, choose \u201cSet up again\u201d.",
|
|
43
43
|
refused_outside: "That code didn't work. Check that your phone's clock is right and try the newest code.",
|
|
44
44
|
paused_outside: "Too many wrong codes. Try again in {duration}.",
|
|
45
|
+
totp_refused: "Code not accepted. Try the next code.",
|
|
46
|
+
totp_help: "Sign-in may be limited. If the code is right, use an 8-character code or a signed-in device.",
|
|
47
|
+
unavailable: "Authenticator sign-in is not available here. Paste an 8-character device sign-in code, or use a device you have signed in from before.",
|
|
48
|
+
invalid: "Enter a 6-digit authenticator code or an 8-character device sign-in code.",
|
|
49
|
+
pause_for: "Sign-in is paused. Please wait {duration}, then try again.", pause_button: "Sign-in paused", ready_again: "You can try signing in again.",
|
|
50
|
+
reach_title: "How does my phone reach AgEnD?", reach_lead: "Open the AgEnD address in your phone’s browser:",
|
|
51
|
+
reach_wifi: "Same Wi-Fi: use the computer’s local network address.", reach_private: "Private network, such as Tailscale: connect both devices to that network first.",
|
|
52
|
+
reach_outside: "Outside connection: use the address your admin provides.",
|
|
45
53
|
minutes: "{0} minutes", minute: "1 minute", hours: "{0} hours", hour: "1 hour",
|
|
46
54
|
// #3061: sign in with another device — an 8-character code shown here, approved on a device that is already signed in.
|
|
47
55
|
another: "Sign in with another device", dev_title: "Sign in with another device",
|
|
@@ -55,9 +63,9 @@
|
|
|
55
63
|
},
|
|
56
64
|
"zh-TW": {
|
|
57
65
|
signout_unsaved: "暫時登出了,但變更沒能儲存:重新啟動後這個工作階段可能會回來。這個頁面無法修復工作階段的儲存問題。",
|
|
58
|
-
checking: "正在確認登入狀態…", title: "登入 AgEnD", lead: "
|
|
59
|
-
label: "
|
|
60
|
-
hint: "
|
|
66
|
+
checking: "正在確認登入狀態…", title: "登入 AgEnD", lead: "填入驗證器 App 的 6 位數驗證碼,即可自動登入。",
|
|
67
|
+
label: "驗證碼或裝置登入碼", submit: "登入", working: "登入中…",
|
|
68
|
+
hint: "也可以貼上 8 字元裝置登入碼",
|
|
61
69
|
nobot: "沒有聊天 bot?", nobot_body: "請管理員在 AgEnD 電腦執行 agend web --code。",
|
|
62
70
|
safe: "登入後畫面不對勁?", safe_body: "可能是你的自訂 CSS 把東西藏起來了。在網址最後加上 ?safe=1,就會不套用它地載入;再到「設定 → 外觀」修正或關閉。",
|
|
63
71
|
refused: "裝置登入碼無效或已失效。請在 General 傳 /web,再按登入按鈕取新碼。",
|
|
@@ -80,6 +88,14 @@
|
|
|
80
88
|
hint_outside: "手機遺失?請在 AgEnD 電腦上選「重新設定」。",
|
|
81
89
|
refused_outside: "驗證碼不對。請確認手機時間正確,並輸入最新的驗證碼。",
|
|
82
90
|
paused_outside: "錯誤次數太多,請 {duration} 後再試。",
|
|
91
|
+
totp_refused: "驗證碼未通過;若剛換碼,請等下一組再試。",
|
|
92
|
+
totp_help: "驗證碼正確也可能暫時受限。請改貼 8 字元裝置登入碼,或使用先前登入過的裝置。",
|
|
93
|
+
unavailable: "這裡無法使用驗證器 App 登入。請貼上 8 字元裝置登入碼,或使用先前登入過的裝置。",
|
|
94
|
+
invalid: "請輸入 6 位數驗證碼或 8 字元裝置登入碼。",
|
|
95
|
+
pause_for: "登入已暫停,請等 {duration}後再試。", pause_button: "暫時無法登入", ready_again: "可以再次嘗試登入。",
|
|
96
|
+
reach_title: "如何在手機開啟 AgEnD?", reach_lead: "在手機瀏覽器開啟 AgEnD 網址:",
|
|
97
|
+
reach_wifi: "同一個 Wi-Fi:使用電腦的區網網址。", reach_private: "私人網路(如 Tailscale):兩台裝置先連上同一個網路。",
|
|
98
|
+
reach_outside: "外部連線:使用管理員提供的網址。",
|
|
83
99
|
minutes: "{0} 分鐘", minute: "1 分鐘", hours: "{0} 小時", hour: "1 小時",
|
|
84
100
|
another: "使用其他裝置登入", dev_title: "使用其他裝置登入",
|
|
85
101
|
dev_lead: "在已登入且已驗證擁有者的裝置上,開啟「設定 → 存取與安全」,在「裝置與登入」選「新增裝置」,輸入這組裝置登入碼。",
|
|
@@ -111,8 +127,21 @@
|
|
|
111
127
|
// here (a WSL install) is pointed at its desktop shortcut. Only words change: the page issues nothing itself (D3).
|
|
112
128
|
const local = !outside && /^(localhost|127(\.\d{1,3}){3}|\[?::1\]?)$/i.test((typeof location !== "undefined" && location.hostname) || "");
|
|
113
129
|
const win = local && /Windows/i.test((typeof navigator !== "undefined" && navigator.userAgent) || "");
|
|
114
|
-
const
|
|
130
|
+
const deviceText = (k) => (win && (T[lang][`${k}_local_win`] || T.en[`${k}_local_win`]))
|
|
115
131
|
|| (local && (T[lang][`${k}_local`] || T.en[`${k}_local`])) || (noChat && (T[lang][`${k}_web`] || T.en[`${k}_web`])) || T[lang][k] || T.en[k] || k;
|
|
132
|
+
// Input routing is by the complete code, on every surface; device-code recovery retains its existing local/chat words.
|
|
133
|
+
const t = (k) => ["lead", "label", "hint"].includes(k) ? T[lang][k] : (outside && (T[lang][`${k}_outside`] || T.en[`${k}_outside`])) || deviceText(k);
|
|
134
|
+
function paint(node, text) {
|
|
135
|
+
if (!node) return;
|
|
136
|
+
if (typeof node.replaceChildren !== "function") { node.textContent = text; return; }
|
|
137
|
+
const terms = lang === "zh-TW" ? /(8 字元裝置登入碼|使用先前登入過的裝置|驗證器 App|驗證器|驗證碼|同一個網路|自動登入|每組|立即|直接|核准)/g : /(8-character)/g;
|
|
138
|
+
const parts = text.split(terms);
|
|
139
|
+
if (parts.length === 1) { node.textContent = text; return; }
|
|
140
|
+
node.replaceChildren(...parts.map((part, i) => {
|
|
141
|
+
if (i % 2 === 0) return part;
|
|
142
|
+
const span = document.createElement("span"); span.className = "signin-term"; span.textContent = part; return span;
|
|
143
|
+
}));
|
|
144
|
+
}
|
|
116
145
|
/** A wait as words: "15 minutes" / 「15 分鐘」, "2 hours" / 「2 小時」 (rounded up). */
|
|
117
146
|
const duration = (ms) => {
|
|
118
147
|
const minutes = Math.max(1, Math.ceil(ms / 60000));
|
|
@@ -124,11 +153,9 @@
|
|
|
124
153
|
if (noChat || local) document.querySelectorAll("details.help").forEach((d) => { if (d.querySelector && d.querySelector('[data-i18n="nobot"]')) d.hidden = true; });
|
|
125
154
|
document.documentElement.lang = lang === "zh-TW" ? "zh-Hant" : "en";
|
|
126
155
|
$("checking").setAttribute?.("aria-label", t("checking"));
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
input.setAttribute("pattern", "[0-9 ]*");
|
|
131
|
-
}
|
|
156
|
+
// Also repairs an old cached HTML shell’s numeric/short field constraints.
|
|
157
|
+
$("code").setAttribute("inputmode", "text"); $("code").setAttribute("maxlength", "32"); $("code").setAttribute("placeholder", "");
|
|
158
|
+
$("code").removeAttribute?.("pattern");
|
|
132
159
|
|
|
133
160
|
// #3270: `agend web` opens this page on this computer as /signin#code=XXXX-XXXX. A fragment is never sent to the server, a
|
|
134
161
|
// log or a Referer; it is read here and taken out of the address bar and the history entry BEFORE anything else runs —
|
|
@@ -170,12 +197,18 @@
|
|
|
170
197
|
document.querySelectorAll("[data-i18n]").forEach((el) => {
|
|
171
198
|
const text = t(el.getAttribute("data-i18n"));
|
|
172
199
|
const m = CMD.exec(text);
|
|
173
|
-
if (!m) { el
|
|
200
|
+
if (!m) { paint(el, text); return; }
|
|
174
201
|
const code = document.createElement("code");
|
|
175
202
|
code.textContent = m[0];
|
|
176
203
|
el.replaceChildren(text.slice(0, m.index), code, text.slice(m.index + m[0].length));
|
|
177
204
|
});
|
|
178
205
|
|
|
206
|
+
// New help is optional: new JS still works with cached HTML, and old JS leaves it hidden.
|
|
207
|
+
if ($("reachHelp")) {
|
|
208
|
+
for (const [id, key] of [["reachTitle", "reach_title"], ["reachLead", "reach_lead"], ["reachWifi", "reach_wifi"], ["reachPrivate", "reach_private"], ["reachOutside", "reach_outside"]]) paint($(id), t(key));
|
|
209
|
+
$("reachHelp").hidden = false;
|
|
210
|
+
}
|
|
211
|
+
|
|
179
212
|
// An old deep link, /ui#instance=<name> (#1408 §3): the fragment never reaches the server, and the sign-in page is
|
|
180
213
|
// served at the URL that was asked for, so it is still in location.hash here. Exactly that one form becomes the new
|
|
181
214
|
// path /ui/chat/<name>; any other fragment is dropped. The name is held to the same rule as the server's.
|
|
@@ -337,6 +370,7 @@
|
|
|
337
370
|
$("devQr").hidden = false;
|
|
338
371
|
}
|
|
339
372
|
async function devStart() {
|
|
373
|
+
retireEntries();
|
|
340
374
|
devStop();
|
|
341
375
|
$("form").hidden = true; $("device").hidden = false; $("devNew").hidden = true;
|
|
342
376
|
hideQr();
|
|
@@ -419,7 +453,7 @@
|
|
|
419
453
|
}
|
|
420
454
|
|
|
421
455
|
// What a refused POST /auth/login says (the form's and the fragment's exchange alike): 429 and 5xx are not a wrong code.
|
|
422
|
-
const failureText = (status) => (status === 429 ?
|
|
456
|
+
const failureText = (status) => (status === 429 ? deviceText("paused") : status >= 500 ? deviceText("unconfirmed") : deviceText("refused"));
|
|
423
457
|
|
|
424
458
|
// #3270: the exchange of the code `agend web` put in the fragment. Resolves null once the browser is on its way into the
|
|
425
459
|
// app, else the words for why not — the form then shows them, so an expired or used code never leaves a blank page. The
|
|
@@ -440,38 +474,91 @@
|
|
|
440
474
|
}
|
|
441
475
|
}
|
|
442
476
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
477
|
+
// S-118: one complete value chooses one existing route. Never strip a letter/dash into a TOTP.
|
|
478
|
+
function codeValue() {
|
|
479
|
+
const raw = $("code").value.trim();
|
|
480
|
+
if (/^[0-9]{6}$/.test(raw)) return { path: "/auth/totp", code: raw, wait: /^[2-7]{6}$/.test(raw) };
|
|
481
|
+
if (/^(?:[A-Z2-7]{8}|[A-Z2-7]{4}-[A-Z2-7]{4})$/i.test(raw)) return { path: "/auth/login", code: raw.replace("-", "").toUpperCase(), wait: false };
|
|
482
|
+
return null;
|
|
483
|
+
}
|
|
484
|
+
const autoAttempts = new Set(), activeEntries = new Map();
|
|
485
|
+
let entryTimer = 0, pauseTimer = 0, pausedUntil = 0, entryVersion = 0, latestEntry = null;
|
|
486
|
+
let composing = false, pasteInput = false, entryStopped = false, signedIn = false, observedValue = "";
|
|
487
|
+
const entryKey = (value) => value ? `${value.path}:${value.code}` : `invalid:${$("code").value}`;
|
|
488
|
+
function cancelEntryTimer() { clearTimeout(entryTimer); entryTimer = 0; }
|
|
489
|
+
function retireEntries() {
|
|
490
|
+
cancelEntryTimer(); entryVersion++; latestEntry = null;
|
|
491
|
+
for (const attempt of activeEntries.values()) attempt.controller?.abort();
|
|
492
|
+
activeEntries.clear();
|
|
493
|
+
}
|
|
494
|
+
function entryCurrent(mine) {
|
|
495
|
+
return !entryStopped && !signedIn && !$("form").hidden && mine === latestEntry && mine.version === entryVersion && entryKey(codeValue()) === mine.key;
|
|
496
|
+
}
|
|
497
|
+
function entryMessage(text, hint = "") {
|
|
498
|
+
paint($("msg"), text); $("msg").classList?.remove("ok");
|
|
499
|
+
if ($("authHint")) { paint($("authHint"), hint); $("authHint").hidden = !hint; }
|
|
500
|
+
else if (hint) paint($("msg"), `${text} ${hint}`); // cached HTML still gets the complete recovery guidance
|
|
501
|
+
}
|
|
502
|
+
function entryButton() {
|
|
503
|
+
const paused = pausedUntil > Date.now();
|
|
504
|
+
$("go").disabled = paused || !!(latestEntry && activeEntries.get(latestEntry.key) === latestEntry);
|
|
505
|
+
$("go").textContent = paused ? t("pause_button") : $("go").disabled ? t("working") : t("submit");
|
|
506
|
+
}
|
|
507
|
+
async function submitEntry(manual = false) {
|
|
508
|
+
cancelEntryTimer();
|
|
509
|
+
if (entryStopped || signedIn || $("form").hidden || composing || pausedUntil > Date.now()) return;
|
|
510
|
+
const value = codeValue();
|
|
511
|
+
if (!value) { if (manual) entryMessage(t("invalid")); return; }
|
|
512
|
+
const key = entryKey(value);
|
|
513
|
+
if (activeEntries.has(key) || (!manual && autoAttempts.has(key))) return;
|
|
514
|
+
// Explicit submit may be the first observation of the value (autofill or an old HTML form).
|
|
515
|
+
if (observedValue !== key) { retireEntries(); observedValue = key; }
|
|
516
|
+
autoAttempts.add(key);
|
|
517
|
+
const mine = { key, version: entryVersion, controller: typeof AbortController === "function" ? new AbortController() : null };
|
|
518
|
+
latestEntry = mine; activeEntries.set(key, mine); entryMessage(""); entryButton();
|
|
451
519
|
try {
|
|
452
|
-
const r = await fetch(
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
});
|
|
458
|
-
if (r.ok) { clearBounce(); location.replace(nextTarget()); return; }
|
|
459
|
-
if (outside && r.status === 429) {
|
|
520
|
+
const r = await fetch(value.path, { method: "POST", credentials: "same-origin", headers: { "Content-Type": "application/json" },
|
|
521
|
+
body: JSON.stringify({ code: value.code }), ...(mine.controller ? { signal: mine.controller.signal } : {}) });
|
|
522
|
+
if (!entryCurrent(mine)) return;
|
|
523
|
+
if (r.ok) { signedIn = true; cancelEntryTimer(); clearTimeout(pauseTimer); clearBounce(); location.replace(nextTarget()); return; }
|
|
524
|
+
if (r.status === 429) {
|
|
460
525
|
let wait = Number(r.headers.get("Retry-After")) * 1000;
|
|
461
|
-
try { const body = await r.json(); if (Number.isFinite(body && body.retryAfterMs)
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
526
|
+
try { const body = await r.json(); if (Number.isFinite(body?.retryAfterMs) && body.retryAfterMs > 0) wait = body.retryAfterMs; } catch { /* use the header */ }
|
|
527
|
+
if (!entryCurrent(mine)) return;
|
|
528
|
+
wait = Number.isFinite(wait) && wait > 0 ? wait : 60000;
|
|
529
|
+
pausedUntil = Date.now() + wait;
|
|
530
|
+
entryMessage(t("pause_for").replace("{duration}", duration(wait))); $("msg").classList?.add("ok");
|
|
531
|
+
clearTimeout(pauseTimer);
|
|
532
|
+
pauseTimer = setTimeout(() => {
|
|
533
|
+
if (entryStopped || signedIn) return;
|
|
534
|
+
pausedUntil = 0; entryMessage(t("ready_again")); $("msg").classList?.add("ok"); entryButton();
|
|
535
|
+
}, wait);
|
|
536
|
+
} else if (value.path === "/auth/totp" && r.status === 404) entryMessage(t("unavailable"));
|
|
537
|
+
else if (value.path === "/auth/totp" && r.status === 401) entryMessage(t("totp_refused"), t("totp_help"));
|
|
538
|
+
else entryMessage(failureText(r.status));
|
|
539
|
+
} catch {
|
|
540
|
+
if (entryCurrent(mine)) entryMessage(t("network"));
|
|
541
|
+
} finally {
|
|
542
|
+
if (activeEntries.get(key) === mine) activeEntries.delete(key);
|
|
543
|
+
if (entryCurrent(mine)) { entryButton(); if (!(pausedUntil > Date.now())) $("code").select(); }
|
|
470
544
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
545
|
+
}
|
|
546
|
+
function entryInput(event = {}) {
|
|
547
|
+
cancelEntryTimer();
|
|
548
|
+
const value = codeValue(), key = entryKey(value);
|
|
549
|
+
if (key !== observedValue) { retireEntries(); observedValue = key; if (!(pausedUntil > Date.now())) entryMessage(""); entryButton(); }
|
|
550
|
+
const pasted = pasteInput || event.inputType === "insertFromPaste"; pasteInput = false;
|
|
551
|
+
if (entryStopped || signedIn || $("form").hidden || composing || event.isComposing || pausedUntil > Date.now() || !value) return;
|
|
552
|
+
if (!pasted && value.wait) entryTimer = setTimeout(() => { submitEntry(); }, 800);
|
|
553
|
+
else void submitEntry();
|
|
554
|
+
}
|
|
555
|
+
$("code").addEventListener("keydown", cancelEntryTimer);
|
|
556
|
+
$("code").addEventListener("paste", () => { cancelEntryTimer(); pasteInput = true; Promise.resolve().then(() => { pasteInput = false; }); });
|
|
557
|
+
$("code").addEventListener("input", entryInput);
|
|
558
|
+
$("code").addEventListener("compositionstart", () => { composing = true; cancelEntryTimer(); });
|
|
559
|
+
$("code").addEventListener("compositionend", () => { composing = false; entryInput(); });
|
|
560
|
+
$("form").addEventListener("submit", (event) => { event.preventDefault(); return submitEntry(true); });
|
|
561
|
+
globalThis.addEventListener?.("pagehide", () => { entryStopped = true; retireEntries(); clearTimeout(pauseTimer); });
|
|
475
562
|
|
|
476
563
|
(async () => {
|
|
477
564
|
// Someone who already has a session is simply let in: the code in the link is not exchanged over it (it stays unspent
|
|
@@ -39,20 +39,16 @@ function expiryText(iso) {
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* #3066 §1: a server line ({ text, i18n }) in this page's language — or, when this tab's strings predate the key (a
|
|
42
|
-
* stale tab), the server's own English text, never the bare key.
|
|
42
|
+
* stale tab), the server's own English text, never the bare key. M-2815: the card no longer draws capacity; kept
|
|
43
|
+
* exported so a module from another release that imports it still links (settings-stale-module-link-3321).
|
|
43
44
|
*/
|
|
44
45
|
export function capacityLine(x) {
|
|
45
46
|
if (!x || typeof x.text !== "string") return "";
|
|
46
47
|
const key = x.i18n && typeof x.i18n.key === "string" ? `view.${x.i18n.key}` : null;
|
|
47
48
|
return key && t(key) !== key ? usageText(x.text, x.i18n) : x.text;
|
|
48
49
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const notes = Array.isArray(c.notes) ? c.notes : [];
|
|
52
|
-
return html`<div class=${`u-cap${c.status === "ok" ? "" : " u-cap-wait"}`}>
|
|
53
|
-
<div class="u-cap-line">${capacityLine(c.line)}</div>
|
|
54
|
-
${notes.map((n, i) => html`<div key=${i} class="u-cap-note">${capacityLine(n)}</div>`)}</div>`;
|
|
55
|
-
}
|
|
50
|
+
// M-2815 (the user): the card shows no measured capacity ("100% ≈ …" and its fleet-only note) — get_usage and the usage
|
|
51
|
+
// report keep it (#3066 §1); a weekly metric's `capacity` is left unread here.
|
|
56
52
|
export function UsageMetric({ m }) {
|
|
57
53
|
const bar = useRef(null);
|
|
58
54
|
const label = usageText(m.label, m.labelI18n);
|
|
@@ -67,8 +63,7 @@ export function UsageMetric({ m }) {
|
|
|
67
63
|
const sub = [note, resetText(m.resetsAt)].filter(Boolean).join(" · ");
|
|
68
64
|
return html`<div class="u-metric"><div class="u-row"><span class="u-label">${label}</span>${word ? html`<span class=${`u-status ${cls}`}>${word}</span>` : null}
|
|
69
65
|
<span class=${`u-pct ${cls}`}>${pct.toFixed(0)}<span class="u-unit">%</span></span></div>
|
|
70
|
-
<div class="u-meter"><div ref=${bar} class=${`u-fill ${cls}`}></div></div>${sub ? html`<div class="u-sub">${sub}</div>` : null}
|
|
71
|
-
${m.capacity ? html`<${UsageCapacity} c=${m.capacity} />` : null}</div>`;
|
|
66
|
+
<div class="u-meter"><div ref=${bar} class=${`u-fill ${cls}`}></div></div>${sub ? html`<div class="u-sub">${sub}</div>` : null}</div>`;
|
|
72
67
|
}
|
|
73
68
|
if (m.type === "dollars") {
|
|
74
69
|
const val = m.limit ? `$${(m.used ?? 0).toFixed(2)} / $${m.limit.toFixed(2)}` : `$${(m.used ?? 0).toFixed(2)}`;
|
|
@@ -149,12 +144,28 @@ export function compactSlots(p) {
|
|
|
149
144
|
const pct = ((p && p.metrics) || []).filter((m) => m && m.type === "percent" && !m.resetPassed);
|
|
150
145
|
const isShort = (m) => Number(m.windowMs) > 0 && m.windowMs < TWO_DAYS;
|
|
151
146
|
const short = pct.filter(isShort).sort((a, b) => a.windowMs - b.windowMs)[0] || null;
|
|
152
|
-
|
|
147
|
+
// M-2815: the long column is the account's own week; a per-model one (scope "model") only when it has nothing else.
|
|
148
|
+
const longest = (list) => list.map((m, i) => ({ m, i }))
|
|
153
149
|
.sort((a, b) => ((Number(b.m.windowMs) || -1) - (Number(a.m.windowMs) || -1)) || a.i - b.i)[0]?.m || null;
|
|
150
|
+
const longs = pct.filter((m) => !isShort(m));
|
|
151
|
+
const long = longest(longs.filter((m) => m.scope !== "model")) || longest(longs);
|
|
154
152
|
return { short, long };
|
|
155
153
|
}
|
|
156
|
-
/**
|
|
157
|
-
|
|
154
|
+
/**
|
|
155
|
+
* The windows a compact line shows, short first; then (M-2815, the user) each per-model weekly ("Fable (weekly)") the
|
|
156
|
+
* server sends, on its own labelled bar — a per-model window under two days stays in the full card.
|
|
157
|
+
*/
|
|
158
|
+
export const compactMetrics = (p) => {
|
|
159
|
+
const { short, long } = compactSlots(p);
|
|
160
|
+
const models = ((p && p.metrics) || []).filter((m) => m && m.type === "percent" && !m.resetPassed && m.scope === "model"
|
|
161
|
+
&& m !== long && Number(m.windowMs) >= TWO_DAYS);
|
|
162
|
+
return [short, long, ...models].filter(Boolean);
|
|
163
|
+
};
|
|
164
|
+
/** A per-model window's tag on the compact line: the model's name ("Fable"), the window's full name in its tooltip. */
|
|
165
|
+
export function modelTag(m) {
|
|
166
|
+
const arg = m && m.labelI18n && Array.isArray(m.labelI18n.args) ? m.labelI18n.args[0] : null;
|
|
167
|
+
return typeof arg === "string" && arg ? arg : String((m && m.label) || "").replace(/\s*\(weekly\)$/i, "");
|
|
168
|
+
}
|
|
158
169
|
/**
|
|
159
170
|
* The logins grouped by provider for the compact view (nine logins, five of them Claude's: the provider once, then a
|
|
160
171
|
* line per login), in the order the person set (↑↓): a group where its first login is, its logins in their order.
|
|
@@ -206,13 +217,14 @@ export function CompactRow({ p, onExpand }) {
|
|
|
206
217
|
const say = stale ? stale.mark : note || tn("usage.no_data");
|
|
207
218
|
const detail = stale ? [stale.mark, stale.detail].filter(Boolean).join(" — ") : say;
|
|
208
219
|
const name = title.profile || title.base;
|
|
209
|
-
|
|
220
|
+
const models = !pools && metrics.some((m) => m.scope === "model");
|
|
221
|
+
return html`<button type="button" class=${`u-crow${p.stale ? " is-stale" : ""}${pools ? " is-pooled" : ""}${models ? " has-models" : ""}`} aria-expanded="false" title=${`${p.name} — ${tn("usageExpand")}`} onClick=${onExpand}>
|
|
210
222
|
<span class="u-crow-head"><span class="u-crow-name">${name}</span>
|
|
211
223
|
${p.plan ? html`<span class="pill u-plan" title=${p.plan}><span aria-hidden="true">${planBadge(p.plan)}</span><span class="sr-only">${p.plan}</span></span>` : null}
|
|
212
224
|
${stale && metrics.length ? html`<span class="u-crow-stale" title=${detail}>${p.cachedAt ? tn("usageCachedAt", { at: usageClock(p.cachedAt) }) : stale.mark}<span class="sr-only"> (${detail})</span></span>` : null}</span>
|
|
213
225
|
${pools ? pools.map((x) => html`<${CompactMeter} key=${x.pool.label} m=${x.worst} tag=${usageText(x.pool.label, x.pool.labelI18n)}
|
|
214
226
|
title=${x.metrics.map((m) => { const c = resetClock(m); return `${usageText(m.label, m.labelI18n)}: ${pctOf(m).toFixed(0)}%${c ? ` (${c})` : ""}`; }).join(" · ")} />`)
|
|
215
|
-
: metrics.length ? metrics.map((m, j) => html`<${CompactMeter} key=${j} m=${m} />`)
|
|
227
|
+
: metrics.length ? metrics.map((m, j) => html`<${CompactMeter} key=${j} m=${m} tag=${m.scope === "model" ? modelTag(m) : undefined} />`)
|
|
216
228
|
: html`<span class=${`u-crow-note${(stale || (p.status === "error" && !p.transient)) ? " is-alert" : ""}`} title=${detail}>${say}</span>`}
|
|
217
229
|
</button>`;
|
|
218
230
|
}
|
|
@@ -249,6 +249,7 @@ register("view", {
|
|
|
249
249
|
"instancesLabel": "Instances",
|
|
250
250
|
"favorites": "Favorites",
|
|
251
251
|
"generalGroup": "General",
|
|
252
|
+
"gearOpen": "Settings of {name}",
|
|
252
253
|
"favAdd": "Add {name} to favorites",
|
|
253
254
|
"favRemove": "Remove {name} from favorites",
|
|
254
255
|
"favEdit": "Edit",
|
|
@@ -519,6 +520,7 @@ register("view", {
|
|
|
519
520
|
"instancesLabel": "Agent",
|
|
520
521
|
"favorites": "最愛",
|
|
521
522
|
"generalGroup": "General",
|
|
523
|
+
"gearOpen": "{name} 的設定",
|
|
522
524
|
"favAdd": "把 {name} 加入最愛",
|
|
523
525
|
"favRemove": "把 {name} 從最愛移除",
|
|
524
526
|
"favEdit": "編輯",
|
|
@@ -55,8 +55,8 @@ register("webauth", {
|
|
|
55
55
|
reason_disabled: "網頁授權已關閉。",
|
|
56
56
|
reason_loopback_only: "只有這台電腦可以授權,而這個瀏覽器不在這台電腦上。",
|
|
57
57
|
reason_no_account: "這個瀏覽器沒有聊天帳號身分。請到 Telegram 或 Discord 的 General 傳送 /web,以你的帳號登入。",
|
|
58
|
-
reason_host_sign_in: "
|
|
59
|
-
reason_not_admin: "你的帳號在這裡不是 fleet
|
|
58
|
+
reason_host_sign_in: "這個瀏覽器已沒有這台電腦的管理員授權。請用這台電腦的新登入碼重新綁定。",
|
|
59
|
+
reason_not_admin: "你的帳號在這裡不是 fleet 管理員。",
|
|
60
60
|
reason_not_admin_session: "訪客無法授權。",
|
|
61
61
|
reason_token_rotated: "儀表板的 token 已變更:請重新登入。",
|
|
62
62
|
reason_public_link: "這個登入無法透過這個連結授權。",
|