@songsid/agend 2.4.0-beta.21 → 2.4.0-beta.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-whats-new.js +6 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/auth-api.d.ts +2 -0
- package/dist/auth-api.js +5 -2
- package/dist/auth-api.js.map +1 -1
- package/dist/authority/web-authority.d.ts +17 -3
- package/dist/authority/web-authority.js +56 -3
- package/dist/authority/web-authority.js.map +1 -1
- package/dist/backend/claude-code.js +3 -0
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/cache-ledger.d.ts +23 -21
- package/dist/cache-ledger.js +70 -6
- package/dist/cache-ledger.js.map +1 -1
- package/dist/cache-prices.d.ts +8 -6
- package/dist/cache-prices.js +12 -5
- package/dist/cache-prices.js.map +1 -1
- package/dist/cache-service.d.ts +9 -5
- package/dist/cache-service.js +202 -50
- package/dist/cache-service.js.map +1 -1
- package/dist/channel/mcp-tools.js +8 -1
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/classic-channel-manager.d.ts +1 -1
- package/dist/classic-channel-manager.js +2 -2
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/cli-audited.js +2 -1
- package/dist/cli-audited.js.map +1 -1
- package/dist/cli.js +4 -1
- package/dist/cli.js.map +1 -1
- package/dist/contact-auth-api.js +3 -1
- package/dist/contact-auth-api.js.map +1 -1
- package/dist/contact-auth-policy.js +1 -1
- package/dist/contact-auth-policy.js.map +1 -1
- package/dist/contact-auth-service.js +8 -2
- package/dist/contact-auth-service.js.map +1 -1
- package/dist/contact-auth-store.d.ts +31 -2
- package/dist/contact-auth-store.js +106 -12
- package/dist/contact-auth-store.js.map +1 -1
- package/dist/contact-auth-types.d.ts +3 -2
- package/dist/contact-auth-types.js.map +1 -1
- package/dist/contact-change-proposals.d.ts +18 -1
- package/dist/contact-change-proposals.js +41 -6
- package/dist/contact-change-proposals.js.map +1 -1
- package/dist/contact-state-view.d.ts +103 -0
- package/dist/contact-state-view.js +80 -0
- package/dist/contact-state-view.js.map +1 -0
- package/dist/daemon.d.ts +31 -0
- package/dist/daemon.js +149 -2
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-outbox.d.ts +10 -0
- package/dist/delivery-outbox.js +21 -0
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-manager.d.ts +183 -15
- package/dist/fleet-manager.js +628 -96
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/admin/SKILL.md +52 -0
- package/dist/general-knowledge/skills/concepts/SKILL.md +14 -17
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +6 -3
- package/dist/general-knowledge/skills/hub/SKILL.md +12 -4
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +54 -9
- package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +1 -1
- package/dist/general-role.d.ts +1 -1
- package/dist/general-role.js +1 -0
- package/dist/general-role.js.map +1 -1
- package/dist/hub/agent-pictures-model.d.ts +128 -0
- package/dist/hub/agent-pictures-model.js +43 -4
- package/dist/hub/agent-pictures-model.js.map +1 -1
- package/dist/hub/agent-pictures.d.ts +14 -2
- package/dist/hub/agent-pictures.js +65 -12
- package/dist/hub/agent-pictures.js.map +1 -1
- package/dist/hub/client.d.ts +2 -0
- package/dist/hub/client.js +14 -2
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +6 -2
- package/dist/hub/compose/member.js +19 -6
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +5 -5
- package/dist/hub/compose/server.js +6 -3
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +1 -1
- package/dist/hub/http/compose.d.ts +3 -0
- package/dist/hub/http/compose.js +14 -7
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/deps.d.ts +1 -0
- package/dist/hub/http/schema.js +2 -1
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/init/text.js +1 -1
- package/dist/hub/mcp/policy.d.ts +1 -1
- package/dist/hub/member/agent-pictures.d.ts +34 -1
- package/dist/hub/member/agent-pictures.js +80 -9
- package/dist/hub/member/agent-pictures.js.map +1 -1
- package/dist/hub/member/room-ask.d.ts +22 -1
- package/dist/hub/member/room-ask.js +99 -5
- package/dist/hub/member/room-ask.js.map +1 -1
- package/dist/hub/member/room-asker-store.d.ts +48 -0
- package/dist/hub/member/room-asker-store.js +181 -0
- package/dist/hub/member/room-asker-store.js.map +1 -0
- package/dist/hub/protocol.d.ts +152 -0
- package/dist/hub/protocol.js +6 -1
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/question-close-model.d.ts +17 -0
- package/dist/hub/question-close-model.js +7 -0
- package/dist/hub/question-close-model.js.map +1 -0
- package/dist/hub/representative.d.ts +15 -0
- package/dist/hub/representative.js +64 -1
- package/dist/hub/representative.js.map +1 -1
- package/dist/hub/room-asker-identity-model.d.ts +53 -0
- package/dist/hub/room-asker-identity-model.js +14 -0
- package/dist/hub/room-asker-identity-model.js.map +1 -0
- package/dist/hub/room-asker-identity.d.ts +22 -0
- package/dist/hub/room-asker-identity.js +43 -0
- package/dist/hub/room-asker-identity.js.map +1 -0
- package/dist/hub/rooms/agents.js +16 -0
- package/dist/hub/rooms/agents.js.map +1 -1
- package/dist/hub/rooms/asker-identity.d.ts +21 -0
- package/dist/hub/rooms/asker-identity.js +86 -0
- package/dist/hub/rooms/asker-identity.js.map +1 -0
- package/dist/hub/rooms/direct-view.js +1 -0
- package/dist/hub/rooms/direct-view.js.map +1 -1
- package/dist/hub/rooms/office.d.ts +18 -0
- package/dist/hub/rooms/office.js +3 -1
- package/dist/hub/rooms/office.js.map +1 -1
- package/dist/hub/rooms/service.d.ts +6 -0
- package/dist/hub/rooms/service.js +19 -0
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +1 -1
- package/dist/hub/rooms.d.ts +3 -0
- package/dist/hub/rooms.js +27 -1
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/server.js +12 -2
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/types.d.ts +3 -2
- package/dist/hub-character-plan.d.ts +47 -0
- package/dist/hub-character-plan.js +70 -0
- package/dist/hub-character-plan.js.map +1 -0
- package/dist/hub-contact-windows.d.ts +13 -1
- package/dist/hub-contact-windows.js +35 -2
- package/dist/hub-contact-windows.js.map +1 -1
- package/dist/hub-picture-reduce.d.ts +21 -1
- package/dist/hub-picture-reduce.js +65 -13
- package/dist/hub-picture-reduce.js.map +1 -1
- package/dist/hub-picture-worker.js +12 -4
- package/dist/hub-picture-worker.js.map +1 -1
- package/dist/human-delivery-receipts.d.ts +12 -2
- package/dist/human-delivery-receipts.js +19 -4
- package/dist/human-delivery-receipts.js.map +1 -1
- package/dist/instructions.d.ts +1 -1
- package/dist/instructions.js +1 -1
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +367 -275
- package/dist/locale.js.map +1 -1
- package/dist/ls-rows.d.ts +2 -0
- package/dist/ls-rows.js.map +1 -1
- package/dist/needs-you.d.ts +4 -0
- package/dist/needs-you.js +3 -2
- package/dist/needs-you.js.map +1 -1
- package/dist/office-share-page.js +1 -1
- package/dist/office-share-page.js.map +1 -1
- package/dist/outbound-handlers.d.ts +8 -0
- package/dist/outbound-handlers.js +56 -7
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +2 -1
- package/dist/outbound-schemas.js +3 -2
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/public-web-gateway.js +18 -0
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/reply-buttons-controller.d.ts +2 -1
- package/dist/reply-buttons-controller.js +1 -1
- package/dist/reply-buttons-controller.js.map +1 -1
- package/dist/runtime-cli-install.js +4 -4
- package/dist/runtime-cli-install.js.map +1 -1
- package/dist/tips.js +3 -3
- package/dist/tool-permissions.js +1 -1
- package/dist/tool-permissions.js.map +1 -1
- package/dist/ui/accounts-keepalive.js +2 -1
- package/dist/ui/agent-export-strings.js +1 -1
- package/dist/ui/agent-page-strings.js +5 -5
- package/dist/ui/chat-activity.js +2 -1
- package/dist/ui/chat-pins.js +2 -1
- package/dist/ui/claude-credentials.js +2 -1
- package/dist/ui/contact-auth-client.js +2 -2
- package/dist/ui/contact-auth-strings.js +28 -17
- package/dist/ui/contact-authorizations.js +6 -4
- package/dist/ui/contact-needs.js +6 -1
- package/dist/ui/contact-permissions.js +6 -4
- package/dist/ui/contact-tool-groups.js +1 -1
- package/dist/ui/contact-verify-need.js +46 -0
- package/dist/ui/fleet-cache.js +7 -6
- package/dist/ui/fleet-canvas.js +1 -1
- package/dist/ui/fleet-office-card.js +26 -2
- package/dist/ui/fleet-office-layout.js +2 -2
- package/dist/ui/fleet-office-skin.js +26 -6
- package/dist/ui/fleet-office-view.js +32 -0
- package/dist/ui/fleet-office-zones.js +22 -9
- package/dist/ui/fleet-office.js +92 -29
- package/dist/ui/fleet-org.js +9 -4
- package/dist/ui/fleet-tab-icons.js +19 -0
- package/dist/ui/fleet-task-activity.js +2 -1
- package/dist/ui/fleet-task-common.js +2 -2
- package/dist/ui/fleet-task-view.js +2 -1
- package/dist/ui/fleet-usage.js +8 -7
- package/dist/ui/hub-admin-overview.js +3 -2
- package/dist/ui/hub-agent-intro.js +2 -1
- package/dist/ui/hub-assistant-admin.js +2 -1
- package/dist/ui/hub-chat-strings.js +1 -1
- package/dist/ui/hub-directory-notices.js +2 -1
- package/dist/ui/hub-enrolment-code.js +2 -1
- package/dist/ui/hub-my-agents-strings.js +2 -2
- package/dist/ui/hub-my-agents.js +3 -2
- package/dist/ui/hub-quick-pairing.js +2 -1
- package/dist/ui/hub-role-audit.js +2 -1
- package/dist/ui/hub-role-forms.js +3 -2
- package/dist/ui/hub-role-view.js +3 -2
- package/dist/ui/hub-roles.js +2 -1
- package/dist/ui/hub-room-agent-strings.js +2 -1
- package/dist/ui/hub-room-list.js +2 -1
- package/dist/ui/hub-room-office.js +70 -2
- package/dist/ui/hub-room-owner-requests.js +2 -1
- package/dist/ui/hub-room-pins.js +2 -1
- package/dist/ui/hub-room-presence.js +5 -0
- package/dist/ui/hub-room-strings.js +2 -2
- package/dist/ui/hub-room-thread.js +1 -1
- package/dist/ui/log-row.js +4 -3
- package/dist/ui/office-share-dialog.js +2 -1
- package/dist/ui/office-share-page.js +2 -1
- package/dist/ui/page-share-dialog.js +3 -2
- package/dist/ui/panel-chat.js +2 -1
- package/dist/ui/panel-details.js +2 -1
- package/dist/ui/panel-fleet.js +15 -10
- package/dist/ui/panel-hub.js +2 -1
- package/dist/ui/panel-log.js +3 -3
- package/dist/ui/panel-needs.js +31 -3
- package/dist/ui/panel-notices.js +2 -1
- package/dist/ui/panel-runtimes.js +4 -3
- package/dist/ui/panel-windows-cli.js +3 -2
- package/dist/ui/runtime-cli-install.js +3 -2
- package/dist/ui/runtime-update-status.js +1 -1
- package/dist/ui/settings-access-strings.js +1 -1
- package/dist/ui/settings-appearance.js +2 -1
- package/dist/ui/settings-guests.js +4 -3
- package/dist/ui/settings-hub-member-address.js +2 -1
- package/dist/ui/settings-hub-setup-strings.js +1 -1
- package/dist/ui/settings-hub-setup.js +2 -1
- package/dist/ui/settings-hub-web-address.js +2 -1
- package/dist/ui/settings-hub.js +2 -1
- package/dist/ui/settings-layout.js +2 -2
- package/dist/ui/settings-named-test.js +16 -16
- package/dist/ui/settings-public-session-strings.js +2 -2
- package/dist/ui/settings-revoke-strings.js +1 -1
- package/dist/ui/settings-shared-strings.js +2 -2
- package/dist/ui/settings-strings.js +40 -40
- package/dist/ui/settings-update.js +2 -1
- package/dist/ui/settings-web-authority.js +2 -1
- package/dist/ui/shared/agent-sheet.js +2 -1
- package/dist/ui/shared/app-session.js +4 -3
- package/dist/ui/shared/app-shell.js +7 -3
- package/dist/ui/shared/app.css +60 -11
- package/dist/ui/shared/chat-strings.js +8 -8
- package/dist/ui/shared/chat-time.js +7 -4
- package/dist/ui/shared/clock-text.js +57 -0
- package/dist/ui/shared/device-roles.js +6 -5
- package/dist/ui/shared/instance-nav.js +31 -2
- package/dist/ui/shared/usage-dialog.js +2 -1
- package/dist/ui/shared/view-strings.js +13 -9
- package/dist/ui/shared/web-authorize.js +3 -2
- package/dist/ui/subagent-row.js +2 -1
- package/dist/web-api.d.ts +15 -2
- package/dist/web-api.js +62 -13
- package/dist/web-api.js.map +1 -1
- package/dist/web-login.d.ts +6 -1
- package/dist/web-login.js +8 -3
- package/dist/web-login.js.map +1 -1
- package/dist/web-session-authorization.d.ts +3 -0
- package/dist/web-session-authorization.js +1 -1
- package/dist/web-session-authorization.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// M-3730 (the user, 2026-11-25): a time in the zh-TW interface is a 24-hour clock, 00:19 and 19:45, never 上午12:19 or
|
|
2
|
+
// 下午07:45. Every time and date-with-time the web UI shows goes through here; English keeps what each screen showed.
|
|
3
|
+
// No imports: the language is the page's own <html lang> (app-i18n.js sets "zh-Hant" or "en"), so the fleet, the Hub,
|
|
4
|
+
// a share page and the tests can all read it as it is.
|
|
5
|
+
|
|
6
|
+
/** True when the page shows zh-TW. */
|
|
7
|
+
export function zhClock() { return /^zh/i.test(globalThis.document?.documentElement?.lang || ""); }
|
|
8
|
+
|
|
9
|
+
/** The locale to format with: zh-TW on a zh-TW page, else the screen's own (English: what it always used). */
|
|
10
|
+
export function clockLocale(enLocale) { return zhClock() ? "zh-TW" : enLocale; }
|
|
11
|
+
|
|
12
|
+
const hasTime = (o) => Boolean(o && (o.hour || o.timeStyle));
|
|
13
|
+
const DATE = { year: "numeric", month: "numeric", day: "numeric" }, HMS = { hour: "2-digit", minute: "2-digit", second: "2-digit" };
|
|
14
|
+
/**
|
|
15
|
+
* Intl options for that locale: a zh-TW time is on the 24-hour cycle. A date-only format is left as it is. With no
|
|
16
|
+
* fields (none, {} or only a timeZone) each wrapper keeps its native default: `datetime` (toLocaleString) is a date and
|
|
17
|
+
* a time, `time` (toLocaleTimeString) a time alone, `format` (Intl.DateTimeFormat) a date alone (#4455 review).
|
|
18
|
+
*/
|
|
19
|
+
export function clockOptions(o, kind = "datetime") {
|
|
20
|
+
if (!zhClock()) return o;
|
|
21
|
+
if (!o || !Object.keys(o).some((k) => k !== "timeZone")) {
|
|
22
|
+
if (kind === "format") return o;
|
|
23
|
+
return { ...(kind === "datetime" ? DATE : {}), ...HMS, hourCycle: "h23", ...(o?.timeZone ? { timeZone: o.timeZone } : {}) };
|
|
24
|
+
}
|
|
25
|
+
if (!hasTime(o)) return o;
|
|
26
|
+
const { hour12: _ignored, dateStyle, timeStyle, ...rest } = o;
|
|
27
|
+
// ICU drops a dateStyle's words when an hourCycle comes with it (2026年12月2日 turns into 2026/12/2), so the styles
|
|
28
|
+
// become the parts they stand for.
|
|
29
|
+
const day = dateStyle === "full" ? { year: "numeric", month: "long", day: "numeric", weekday: "long" }
|
|
30
|
+
: dateStyle === "long" || dateStyle === "medium" ? { year: "numeric", month: "long", day: "numeric" }
|
|
31
|
+
: dateStyle === "short" ? { year: "numeric", month: "numeric", day: "numeric" } : {};
|
|
32
|
+
const time = !timeStyle ? {} : { hour: "2-digit", minute: "2-digit", ...(timeStyle === "short" ? {} : { second: "2-digit" }),
|
|
33
|
+
...(timeStyle === "long" || timeStyle === "full" ? { timeZoneName: "short" } : {}) };
|
|
34
|
+
return { ...day, ...time, ...rest, hourCycle: "h23" };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** An Intl.DateTimeFormat that follows the rule above. */
|
|
38
|
+
export function clockFormat(o, enLocale) { return new Intl.DateTimeFormat(clockLocale(enLocale), clockOptions(o, "format")); }
|
|
39
|
+
|
|
40
|
+
const date = (v) => (v instanceof Date ? v : new Date(v));
|
|
41
|
+
/** A time of day ("19:45" in zh-TW; the screen's English format otherwise). No `o`: toLocaleTimeString's own default
|
|
42
|
+
* (hours, minutes and seconds). */
|
|
43
|
+
export function timeText(v, o, enLocale) {
|
|
44
|
+
const d = date(v);
|
|
45
|
+
if (!Number.isFinite(d.getTime())) return "";
|
|
46
|
+
return d.toLocaleTimeString(clockLocale(enLocale), clockOptions(o, "time"));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** A date with its time (toLocaleString), with the screen's options. */
|
|
50
|
+
export function dateTimeText(v, o, enLocale) {
|
|
51
|
+
const d = date(v);
|
|
52
|
+
return Number.isFinite(d.getTime()) ? d.toLocaleString(clockLocale(enLocale), clockOptions(o)) : "";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const ZH_UNIT = { ms: "毫秒", s: "秒", m: "分鐘", min: "分鐘", h: "小時" };
|
|
56
|
+
/** A number with its time unit: "2 h" / "5 min" / "3 s" in English, "2 小時" / "5 分鐘" / "3 秒" on a zh-TW page. */
|
|
57
|
+
export function unitText(n, unit) { return `${n} ${zhClock() ? ZH_UNIT[unit] ?? unit : unit}`; }
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import { register, t } from "./app-i18n.js";
|
|
8
8
|
|
|
9
9
|
register("webauth", {
|
|
10
|
-
en: { role: "Role", roleOwner: "Owner ✓", roleAdminUnverified: "Admin · not verified", roleGuest: "Guest", roleRead: "Read-only" },
|
|
11
|
-
"zh-TW": { role: "角色", roleOwner: "擁有者 ✓", roleAdminUnverified: "管理員 · 未驗證", roleGuest: "訪客", roleRead: "唯讀" },
|
|
10
|
+
en: { role: "Role", roleOwner: "Owner ✓", roleAdminUnverified: "Admin · not verified", roleGuest: "Guest", roleGuestVerified: "Guest · Verified until {0}", roleRead: "Read-only" },
|
|
11
|
+
"zh-TW": { role: "角色", roleOwner: "擁有者 ✓", roleAdminUnverified: "管理員 · 未驗證", roleGuest: "訪客", roleGuestVerified: "訪客 · 驗證有效至 {0}", roleRead: "唯讀" },
|
|
12
12
|
});
|
|
13
13
|
register("app", {
|
|
14
14
|
en: { manageDevices: "Manage devices" },
|
|
@@ -18,10 +18,11 @@ register("app", {
|
|
|
18
18
|
/**
|
|
19
19
|
* A sign-in's role as one of four words — the session menu's and Settings → Devices' alike. `tier` is the session's (admin /
|
|
20
20
|
* read / guest); `verified`: its owner authorization is valid now (this computer's code sign-in or a chat account's confirm).
|
|
21
|
-
* Only an admin can be an owner; an admin without that is "Admin · not verified".
|
|
21
|
+
* Only an admin can be an owner; an admin without that is "Admin · not verified". M-3651: a guest verified as its account
|
|
22
|
+
* (its private code) is "Guest · Verified until …" when `until` (the time, as shown) is given — who it is, never an owner.
|
|
22
23
|
*/
|
|
23
|
-
export function roleName(tier, verified) {
|
|
24
|
-
if (tier === "guest") return t("webauth.roleGuest");
|
|
24
|
+
export function roleName(tier, verified, until) {
|
|
25
|
+
if (tier === "guest") return verified && until ? t("webauth.roleGuestVerified", until) : t("webauth.roleGuest");
|
|
25
26
|
if (tier === "read") return t("webauth.roleRead");
|
|
26
27
|
return verified ? t("webauth.roleOwner") : t("webauth.roleAdminUnverified");
|
|
27
28
|
}
|
|
@@ -22,6 +22,7 @@ import "./view-strings.js";
|
|
|
22
22
|
import { themesShown, themesStore } from "./app-themes.js";
|
|
23
23
|
import { machineName } from "./machine-name.js";
|
|
24
24
|
import { identityClasses, identityOf, paintIdentity, useIdentityColors } from "./identity-color.js";
|
|
25
|
+
import { dateTimeText } from "./clock-text.js";
|
|
25
26
|
|
|
26
27
|
// Keep new copy beside its caller: a retained view-strings.js still links and renders the menu.
|
|
27
28
|
register("agentRow", {
|
|
@@ -501,6 +502,31 @@ export function replyText(mins) {
|
|
|
501
502
|
if (mins < 2880) return tn("replyYesterday");
|
|
502
503
|
return tn("replyDays", { n: Math.floor(mins / 1440) });
|
|
503
504
|
}
|
|
505
|
+
/**
|
|
506
|
+
* M-3674: minutes since another agent last started a turn for the instance (a message it took up from another
|
|
507
|
+
* instance: the status frame's last_agent_turn), or null. Its last reply to a person (replyAge) counts only turns a
|
|
508
|
+
* person started, so an agent kept busy by others looked idle ("33 天").
|
|
509
|
+
*/
|
|
510
|
+
export function agentTurnAge(it, now = Date.now()) {
|
|
511
|
+
const at = it && typeof it.last_agent_turn === "string" ? Date.parse(it.last_agent_turn) : NaN;
|
|
512
|
+
return Number.isFinite(at) ? Math.max(0, (now - at) / 60000) : null;
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* The row's time (M-3707, the user 11-25: one time again, not M-3674's 人/Agent pair): the most recent response, to a
|
|
516
|
+
* person (last_reply) or to another agent (last_agent_turn), unlabelled, as a reply's time always read ("2 min ago");
|
|
517
|
+
* null for neither. `person`: the time shown is the reply to a person. The title says which kind each was, the newer
|
|
518
|
+
* first, each with its full time. Only a reply to a person highlights the row or moves it in "Recent" (replyAge, below):
|
|
519
|
+
* a turn another agent started updates the time silently.
|
|
520
|
+
*/
|
|
521
|
+
export function activityText(it, replyMins, agentMins) {
|
|
522
|
+
if (replyMins == null && agentMins == null) return null;
|
|
523
|
+
const at = (k) => dateTimeText(Date.parse(it[k]));
|
|
524
|
+
const agentNewer = agentMins != null && (replyMins == null || agentMins < replyMins);
|
|
525
|
+
const lines = [replyMins != null ? tn("whenPersonTitle", { time: at("last_reply") }) : null, agentMins != null ? tn("whenAgentTitle", { time: at("last_agent_turn") }) : null]
|
|
526
|
+
.filter(Boolean);
|
|
527
|
+
if (agentNewer) lines.reverse();
|
|
528
|
+
return { text: replyText(agentNewer ? agentMins : replyMins), title: lines.join("\n"), person: !agentNewer };
|
|
529
|
+
}
|
|
504
530
|
/** How strong the highlight is: 1 just after a reply, down to 0 at REPLY_FRESH_MIN minutes. */
|
|
505
531
|
export function replyFade(mins) { return mins == null || mins >= REPLY_FRESH_MIN ? 0 : 1 - mins / REPLY_FRESH_MIN; }
|
|
506
532
|
/** The highlight's strength on the row, through the CSSOM (style-src has no 'unsafe-inline'). */
|
|
@@ -789,7 +815,10 @@ export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting =
|
|
|
789
815
|
// #2179 (B5, the user's pick): the % (and the ★ beside the row) on the name's line; the time of the last reply at the
|
|
790
816
|
// end of the second line, highlighted for REPLY_FRESH_MIN minutes, fading by itself (a reply under a minute pulses once).
|
|
791
817
|
const mins = ageOf(name), fade = replyFade(mins);
|
|
792
|
-
|
|
818
|
+
// M-3674/M-3707: the time is the newer of that reply and the last turn another agent started (a busy agent no longer
|
|
819
|
+
// reads "33 天前"); the highlight and "Recent" stay the reply's.
|
|
820
|
+
const amins = viewOnly ? null : agentTurnAge(byName.get(name), now), act = activityText(byName.get(name) || {}, mins, amins);
|
|
821
|
+
const two = !!secondary || !!act;
|
|
793
822
|
const menuItems = [
|
|
794
823
|
canStar ? { key: "favorite", label: t(`agentRow.${starred ? "remove" : "add"}`), icon: "star", disabled: full,
|
|
795
824
|
iconClass: starred ? "menu-starred" : undefined,
|
|
@@ -821,7 +850,7 @@ export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting =
|
|
|
821
850
|
<span class="inst-text"><span class="inst-line"><span class="inst-name" title=${label}>${label}</span>
|
|
822
851
|
${!compact ? html`<span class="v-meta">${it.runtime === "windows" ? "Windows" : it.context_pct != null ? `${Math.round(it.context_pct)}%` : ""}</span>` : null}</span>
|
|
823
852
|
${two ? html`<span class="inst-line inst-line2">${!compact ? html`<span class="inst-alt" title=${secondary || undefined}>${secondary || ""}</span>` : null}
|
|
824
|
-
${
|
|
853
|
+
${act ? html`<span class=${`inst-when${fade > 0 && act.person ? " fresh" : ""}`} title=${act.title}>${act.text}</span>` : null}</span>` : null}
|
|
825
854
|
${!compact && it.machine_id ? html`<span class=${`inst-machine${it.machine_status !== "online" ? " offline" : ""}`} title=${tn("tooltipMachine",{value:machineName(it.machine_id,it.machine_name)})}><span class="inst-machine-name">${machineName(it.machine_id,it.machine_name)}</span>${it.machine_status !== "online" ? html`<span class="inst-machine-status">${tn(it.machine_status === "revoked" ? "machineRevoked" : "machineOffline")}</span>` : null}</span>` : null}
|
|
826
855
|
${!compact && facet === "needs" ? html`<span class="inst-sub"><span class="badge-await" title=${waiting || t("app.approxNote")}>${t("app.needsYou")}</span></span>` : null}
|
|
827
856
|
<span class="sr-only">${tn("tooltipBackend", { value: backendLabel(it.backend) })}</span></span>
|
|
@@ -13,6 +13,7 @@ import { Icon } from "./ui-icons.js";
|
|
|
13
13
|
import { InfoTip } from "./info-tip.js";
|
|
14
14
|
import "./view-strings.js";
|
|
15
15
|
import { CompactMeter, level, resetClock, resetText, tn, usageClock, usageDuration, usageText, windowTag } from "./usage-meter.js";
|
|
16
|
+
import { dateTimeText } from "./clock-text.js";
|
|
16
17
|
// What this file exported before the meter moved out of it (#3321), for what imports it from here.
|
|
17
18
|
export { usageClock, windowTag, soonestReset } from "./usage-meter.js";
|
|
18
19
|
|
|
@@ -391,7 +392,7 @@ export function UsageBody({ owner }) {
|
|
|
391
392
|
${compact ? compactGroups(providers).map((g) => html`<${CompactGroup} key=${g.base} group=${g} mode=${modes[g.base] || "expanded"} onCycle=${(m) => setGroupMode(g.base, m)}
|
|
392
393
|
line=${({ p, i }) => (expanded.has(key(p)) ? card(p, i) : html`<${CompactRow} key=${key(p)} p=${p} one=${(modes[g.base] || "expanded") === "compact" && g.items.length > 1} onExpand=${() => toggleOne(key(p))} />`)} />`)
|
|
393
394
|
: providers.map((p, i) => card(p, i))}
|
|
394
|
-
<div class="u-foot"><span class="note" title=${
|
|
395
|
+
<div class="u-foot"><span class="note" title=${dateTimeText(data.fetchedAt)}>${failed ? html`${updatedAgo(data.fetchedAt)} · <span class="u-refresh-failed" role="status">${tn("usageRefreshFailed")}</span>` : data.refreshing ? html`<span class="u-refreshing">${tn("usageRefreshing")}</span>` : updatedAgo(data.fetchedAt)}</span>
|
|
395
396
|
${byAgent() ? html`<a class="btn btn-ghost btn-sm u-by-agent" href="/ui/fleet/usage" title=${tn("usageByAgentTitle")}>${tn("usageByAgent")}</a>` : null}
|
|
396
397
|
<button type="button" class="btn btn-sm" onClick=${() => load(true)}>${tn("usageRefresh")}</button></div>`;
|
|
397
398
|
}
|
|
@@ -272,6 +272,8 @@ register("view", {
|
|
|
272
272
|
"replyYesterday": "yesterday",
|
|
273
273
|
"replyDays": "{n} d ago",
|
|
274
274
|
"replyTitle": "Last replied: {time}",
|
|
275
|
+
"whenPersonTitle": "Last reply to a person: {time}",
|
|
276
|
+
"whenAgentTitle": "Last turn another agent started (send_to_instance, a task, a report, a broadcast): {time}",
|
|
275
277
|
"sortTitle": "Sort the list",
|
|
276
278
|
"sortCustom": "Custom",
|
|
277
279
|
"sortCustomHint": "Your own order (drag rows); replies never move them",
|
|
@@ -310,7 +312,7 @@ register("view", {
|
|
|
310
312
|
"displayName": "顯示名稱",
|
|
311
313
|
"role": "角色",
|
|
312
314
|
"description": "描述",
|
|
313
|
-
"saveHint": "
|
|
315
|
+
"saveHint": "儲存需要已登入的工作階段。請在 AgEnD bot 傳 /web 取得裝置登入碼。",
|
|
314
316
|
"helpTitle": "📖 使用說明",
|
|
315
317
|
"help1": "在清單裡選一個 Agent:它的即時終端畫面會顯示在這裡。",
|
|
316
318
|
"help2": "點群組名稱可以收合或展開。",
|
|
@@ -378,7 +380,7 @@ register("view", {
|
|
|
378
380
|
"usageFail": "無法載入用量資料。",
|
|
379
381
|
"usage.title": "AI 訂閱用量",
|
|
380
382
|
"usage.title_plain": "AI 訂閱用量",
|
|
381
|
-
"usage.empty_active": "
|
|
383
|
+
"usage.empty_active": "沒有使用中且支援用量追蹤的後端",
|
|
382
384
|
"usage.not_logged_in": "未登入",
|
|
383
385
|
"usage.default_login": "預設",
|
|
384
386
|
"usage.no_agents": "此帳號目前沒有 Agent",
|
|
@@ -421,10 +423,10 @@ register("view", {
|
|
|
421
423
|
"usage.note.used_limit_unit": "{0} / {1} {2}",
|
|
422
424
|
"usage.note.bonus_codes": "{0} / {1} {2} · {3} 組兌換碼",
|
|
423
425
|
"usage.metric.agy_claude_others": "Claude 與其他模型",
|
|
424
|
-
"usage.metric.agy_claude_others_session": "Claude
|
|
426
|
+
"usage.metric.agy_claude_others_session": "Claude 與其他模型(工作階段)",
|
|
425
427
|
"usage.metric.agy_claude_others_weekly": "Claude 與其他模型(每週)",
|
|
426
|
-
"usage.hint.statusline_now": "來自 {0}
|
|
427
|
-
"usage.hint.statusline_minutes": "來自 {0}
|
|
428
|
+
"usage.hint.statusline_now": "來自 {0} 的狀態列(剛剛);未呼叫 API,方案與各模型上限需要 CLI 登入資料",
|
|
429
|
+
"usage.hint.statusline_minutes": "來自 {0} 的狀態列({1} 分鐘前);未呼叫 API,方案與各模型上限需要 CLI 登入資料",
|
|
428
430
|
"usage.hint.claude_api_key": "API key 登入沒有訂閱用量資料。請使用 `claude /login`,或設定 CLAUDE_CODE_OAUTH_TOKEN(由 `claude setup-token` 取得)。",
|
|
429
431
|
"usage.hint.login_claude": "請使用 Claude Code CLI(`claude`)登入。",
|
|
430
432
|
"usage.hint.login_agy": "請使用 Antigravity CLI(`agy`)登入。",
|
|
@@ -465,7 +467,7 @@ register("view", {
|
|
|
465
467
|
"usage.error.invalid_kiro_response": "GetUsageLimits 回傳了無效資料。",
|
|
466
468
|
"usage.error.claude_token_expired": "Access token 已過期;下次啟動任一使用 Claude Code 的 Agent 時會重新整理。",
|
|
467
469
|
"usage.error.codex_token_expired": "Access token 已過期。請執行一次 `codex` 以重新整理。",
|
|
468
|
-
"usage.error.grok_expired": "Grok
|
|
470
|
+
"usage.error.grok_expired": "Grok 工作階段已過期。請再次執行 `grok login`。",
|
|
469
471
|
"usage.error.grok_response_changed": "Grok 計費回應格式已變更。",
|
|
470
472
|
"usage.error.agy_cap": "個人上限已用完,CLI 正受到速率限制(約 {0} 後重置)。各模型的額度池是另一組計數,因此仍可能顯示 0% 已使用。",
|
|
471
473
|
"usage.error.agy_no_refresh": "Access token 已過期,且未儲存 refresh token。請執行一次 `agy`。",
|
|
@@ -481,13 +483,13 @@ register("view", {
|
|
|
481
483
|
"helpButton": "說明",
|
|
482
484
|
"close": "關閉",
|
|
483
485
|
"rosterFailed": "載入 Agent 清單失敗:{error}\n(Fleet 是否正在執行?)",
|
|
484
|
-
"paneFailed": "⚠ 無法載入 {name}
|
|
485
|
-
"signInToSave": "
|
|
486
|
+
"paneFailed": "⚠ 無法載入 {name} 的窗格(HTTP {status})。",
|
|
487
|
+
"signInToSave": "請先登入才能儲存:你的工作階段可能已結束。",
|
|
486
488
|
"avatarFailed": "上傳頭像失敗:{error}",
|
|
487
489
|
"avatarRemoveFailed": "無法移除圖片:{error}",
|
|
488
490
|
"removePicture": "移除圖片",
|
|
489
491
|
"keepPicture": "保留圖片",
|
|
490
|
-
"removePictureNote": "儲存後移除,改顯示 Bot
|
|
492
|
+
"removePictureNote": "儲存後移除,改顯示 Bot 的頭像、人設 emoji 或名稱第一個字。",
|
|
491
493
|
"cardSection": "身分卡",
|
|
492
494
|
"cardLead": "你設定的欄位優先於 agent 的,逐欄比較。欄位留空就顯示 agent 的。",
|
|
493
495
|
"cardTagline": "標語(一行,最多 60 個字)",
|
|
@@ -556,6 +558,8 @@ register("view", {
|
|
|
556
558
|
"replyYesterday": "昨天",
|
|
557
559
|
"replyDays": "{n} 天前",
|
|
558
560
|
"replyTitle": "最後回覆:{time}",
|
|
561
|
+
"whenPersonTitle": "最後回覆人的時間:{time}",
|
|
562
|
+
"whenAgentTitle": "最後一次由其他 Agent 發起的回合(send_to_instance、任務、回報、廣播):{time}",
|
|
559
563
|
"sortTitle": "排序方式",
|
|
560
564
|
"sortCustom": "自訂",
|
|
561
565
|
"sortCustomHint": "你拖曳排好的順序,有回覆也不會跳動",
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { html, useEffect, useLayoutEffect, useRef, useState } from "./app-html.js";
|
|
5
5
|
import { register, t } from "./app-i18n.js";
|
|
6
6
|
import { guestPage } from "./app-store.js";
|
|
7
|
+
import { dateTimeText, timeText } from "./clock-text.js";
|
|
7
8
|
|
|
8
9
|
register("webauth", {
|
|
9
10
|
en: {
|
|
@@ -93,8 +94,8 @@ const REASONS = ["disabled", "loopback_only", "no_account", "host_sign_in", "not
|
|
|
93
94
|
// Until when: the time, with the day when it isn't today (an authorization lasts up to 48 h).
|
|
94
95
|
const clock = (ms) => {
|
|
95
96
|
const d = new Date(ms), today = new Date().toDateString() === d.toDateString();
|
|
96
|
-
return today ? d
|
|
97
|
-
: d
|
|
97
|
+
return today ? timeText(d, { hour: "2-digit", minute: "2-digit" }, [])
|
|
98
|
+
: dateTimeText(d, { weekday: "short", month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" }, []);
|
|
98
99
|
};
|
|
99
100
|
const mmss = (ms) => { const s = Math.max(0, Math.ceil(ms / 1000)); return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`; };
|
|
100
101
|
|
package/dist/ui/subagent-row.js
CHANGED
|
@@ -3,6 +3,7 @@ import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
|
3
3
|
import { register, t } from "/assets/app-i18n.js";
|
|
4
4
|
import { ErrorState } from "/assets/ui-states.js";
|
|
5
5
|
import { assetUrl } from "/assets/asset-url.js";
|
|
6
|
+
import { dateTimeText } from "/assets/clock-text.js";
|
|
6
7
|
register("subagents", {
|
|
7
8
|
en: { title: "Subagents", completed: "{0} finished", running: "{0} running", unknown: "{0} unconfirmed", parent: "Main Agent task: {0}", turn: "Main Agent task turn: {0}", done: "Finished", live: "Running", unsure: "Unconfirmed", seconds: "{0} s", elapsed: "{0} s elapsed", note: "A subagent's report is not the main Agent's final answer.", gap: "Some records are missing or no longer current. Their state is unconfirmed.", failed: "Subagent status could not be checked.", fallback: "Subagent", scroll: "Scroll to see all child runs.", bound: "Up to 16 recent child runs are shown." },
|
|
8
9
|
"zh-TW": { title: "子 Agent", completed: "{0} 已完成", running: "{0} 執行中", unknown: "{0} 待確認", parent: "主 Agent 工作:{0}", turn: "主 Agent 工作回合:{0}", done: "已完成", live: "執行中", unsure: "待確認", seconds: "{0} 秒", elapsed: "已經過 {0} 秒", note: "子 Agent 的回報不是主 Agent 的最終答覆。", gap: "部分紀錄缺漏或已不再是目前的紀錄,狀態待確認。", failed: "暫時無法確認子 Agent 的狀態。", fallback: "子 Agent", scroll: "捲動檢視所有子工作回合。", bound: "最多顯示最近 16 個子工作回合。" },
|
|
@@ -63,7 +64,7 @@ export function SubagentRow({ name }) {
|
|
|
63
64
|
for (const row of runs) { if (!groups.has(row.parentTurn)) groups.set(row.parentTurn, []); groups.get(row.parentTurn).push(row); }
|
|
64
65
|
return html`<details class="subagent-progress" data-trust="subagent-observation"><summary><span>${copy("title")}</span><span class="note">${counts.join(" · ")}</span></summary><p class="note subagent-scroll-hint">${copy("scroll")}</p><div class="subagent-scroll">
|
|
65
66
|
${value.error ? html`<${ErrorState} message=${copy("failed")} onRetry=${() => observer.current?.retry()} />` : null}
|
|
66
|
-
${[...groups].map(([turn, rows]) => html`<section key=${turn} class="subagent-group"><p class="note subagent-parent">${rows[0].parentTask ? copy("parent", rows[0].parentTask) : copy("turn",
|
|
67
|
+
${[...groups].map(([turn, rows]) => html`<section key=${turn} class="subagent-group"><p class="note subagent-parent">${rows[0].parentTask ? copy("parent", rows[0].parentTask) : copy("turn", dateTimeText(Math.min(...rows.map(r => r.parentStartedAt))))}</p>
|
|
67
68
|
${rows.map(r => html`<article key=${r.key} class="subagent-item"><div class="subagent-head"><strong>${r.name || copy("fallback")}</strong>${r.type ? html`<span class="note">${r.type}</span>` : null}<span class="tag">${copy(r.state === "completed" ? "done" : r.state === "running" ? "live" : "unsure")}</span></div>
|
|
68
69
|
<p>${r.task}</p>${r.state === "completed" && Number.isFinite(r.durationMs) ? html`<p class="note">${copy("seconds", (r.durationMs / 1000).toFixed(1).replace(/\.0$/, ""))}</p>` : r.state === "running" ? html`<p class="note">${copy("elapsed", Math.max(0, Math.floor((tick - r.startedAt) / 1000)))}</p>` : null}
|
|
69
70
|
${r.state === "completed" && r.summary ? html`<p class="subagent-report">${r.summary}</p>` : null}</article>`)}
|
package/dist/web-api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ClaudeCredentialApi } from "./web-claude-credentials.js";
|
|
2
2
|
import { type ContactApiHost } from "./contact-auth-api.js";
|
|
3
|
-
import { type HumanOrigin } from "./human-delivery-receipts.js";
|
|
3
|
+
import { type HumanOrigin, type WebSessionIdentity } from "./human-delivery-receipts.js";
|
|
4
4
|
import { type HumanAuthority, type WebAuthorityResult, type WebPeer } from "./authority/web-authority.js";
|
|
5
5
|
import type { CachedImage } from "./web-images.js";
|
|
6
6
|
import type { SettingsExecution } from "./settings-transaction.js";
|
|
@@ -70,6 +70,11 @@ export interface WebApiContext extends ClaudeCredentialApi {
|
|
|
70
70
|
decideContactAuthorization?: ContactApiHost["decideContactAuthorization"];
|
|
71
71
|
contactActor?(req: IncomingMessage, url: URL): import("./contact-auth-types.js").ContactPerson | null;
|
|
72
72
|
contactNeeds?(actor: import("./contact-auth-types.js").ContactPerson): unknown[];
|
|
73
|
+
/** M-3710: the pending contact requests' count and the oldest one's time — nothing that names them. */
|
|
74
|
+
contactPendingCount?(): {
|
|
75
|
+
count: number;
|
|
76
|
+
since: number;
|
|
77
|
+
};
|
|
73
78
|
acknowledgeContactSuggestion?(instance: string, actor: import("./contact-auth-types.js").ContactPerson): void;
|
|
74
79
|
acknowledgeContactSuggestionFromWeb?(instance: string, req: IncomingMessage, url: URL): void;
|
|
75
80
|
contactSuggestionActor?(req: IncomingMessage, url: URL): import("./contact-auth-types.js").ContactPerson | null;
|
|
@@ -424,6 +429,7 @@ export interface WebApiContext extends ClaudeCredentialApi {
|
|
|
424
429
|
publicLink: boolean;
|
|
425
430
|
person?: WebPerson;
|
|
426
431
|
authority?: HumanAuthority;
|
|
432
|
+
identity?: WebSessionIdentity;
|
|
427
433
|
guest?: boolean;
|
|
428
434
|
}): Promise<{
|
|
429
435
|
status: number;
|
|
@@ -452,7 +458,9 @@ export interface WebApiContext extends ClaudeCredentialApi {
|
|
|
452
458
|
expiresInMs?: number;
|
|
453
459
|
reason?: string;
|
|
454
460
|
};
|
|
455
|
-
/**
|
|
461
|
+
/** Session-account recognition only, independent of verification and action authority. */
|
|
462
|
+
webSessionIdentity?(session: SessionRecord): WebSessionIdentity | undefined;
|
|
463
|
+
/** #1939 S1: authority for one request; absent means no web authority. */
|
|
456
464
|
webAuthority?(input: {
|
|
457
465
|
session: SessionRecord | null;
|
|
458
466
|
gateway: boolean;
|
|
@@ -479,6 +487,10 @@ export interface WebApiContext extends ClaudeCredentialApi {
|
|
|
479
487
|
message: string;
|
|
480
488
|
};
|
|
481
489
|
/** M-3632: Needs you → "Try again" on held Hub work. */
|
|
490
|
+
closeHubHeld?(id: string, actor: import("./contact-auth-types.js").ContactPerson): Promise<{
|
|
491
|
+
status: number;
|
|
492
|
+
code: string;
|
|
493
|
+
}>;
|
|
482
494
|
retryHubHeld?(id: string): {
|
|
483
495
|
status: number;
|
|
484
496
|
code: string;
|
|
@@ -555,6 +567,7 @@ export interface WebApiContext extends ClaudeCredentialApi {
|
|
|
555
567
|
name: string;
|
|
556
568
|
guest?: true;
|
|
557
569
|
authority?: HumanAuthority;
|
|
570
|
+
identity?: WebSessionIdentity;
|
|
558
571
|
}): Promise<{
|
|
559
572
|
status: number;
|
|
560
573
|
error?: string;
|
package/dist/web-api.js
CHANGED
|
@@ -241,7 +241,12 @@ function contactNeedsFor(req, url, ctx, base) {
|
|
|
241
241
|
// A session identity may see benign room suggestions, never pending approval tickets.
|
|
242
242
|
const suggestions = observer && ctx.contactNeeds ? ctx.contactNeeds(observer).filter(item => item && typeof item === "object"
|
|
243
243
|
&& item.reason === "contact_restricted_suggestion") : [];
|
|
244
|
-
|
|
244
|
+
// M-3710 (R21079937, 11-25: a pending request was in no list, even on this computer): an admin session with no verified
|
|
245
|
+
// person behind it is told how many requests wait and to authorize this browser — the count only, never which.
|
|
246
|
+
const waiting = admin ? ctx.contactPendingCount?.() : undefined;
|
|
247
|
+
const verify = waiting && waiting.count > 0 ? [{ id: "contact-verify", type: "contact", reason: "contact_verify_needed", instance: "",
|
|
248
|
+
since: waiting.since, detail: "", contactVerify: { count: waiting.count } }] : [];
|
|
249
|
+
return [...ordinary, ...verify, ...suggestions];
|
|
245
250
|
}
|
|
246
251
|
/**
|
|
247
252
|
* The task board's rule over the public link: an instance kept out of sight (cross_instance_visibility: hidden) is not
|
|
@@ -936,7 +941,7 @@ function handlePageShare(req, res, url, ctx, path, method) {
|
|
|
936
941
|
}
|
|
937
942
|
/**
|
|
938
943
|
* #2716/#3679: an Office-wide setting kept in web-offices.json beside the offices (PUT { <key>: value }): who may save
|
|
939
|
-
* the offices may set it — an admin session
|
|
944
|
+
* the offices may set it — an admin session (over the public link too, M-3278), never the CLI token; asked again once the body is in;
|
|
940
945
|
* counted with the offices' saves (OfficeWriteLimiter); every page hears `offices` and reads again.
|
|
941
946
|
*/
|
|
942
947
|
function officeSettingPut(req, res, url, ctx, o) {
|
|
@@ -2332,6 +2337,11 @@ function webPersonOf(req, url, ctx) {
|
|
|
2332
2337
|
const who = webAccountOf(req, url, ctx);
|
|
2333
2338
|
return who ? ctx.webPerson(who.owner) : null;
|
|
2334
2339
|
}
|
|
2340
|
+
/** Current session recognition only; no header token, body, display name or voter key supplies an account. */
|
|
2341
|
+
function webIdentityOf(req, url, ctx) {
|
|
2342
|
+
const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
2343
|
+
return v.kind === "allow" && v.via === "session" ? ctx.webSessionIdentity?.(v.session) : undefined;
|
|
2344
|
+
}
|
|
2335
2345
|
/**
|
|
2336
2346
|
* #1939 S1: whether this request carries `web-session` authority, asked as it stands now — on arrival without an instance,
|
|
2337
2347
|
* after the body with the one it names (then confirmAfterBody joins the two). Never touches the session.
|
|
@@ -3909,8 +3919,9 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3909
3919
|
// ── Fleet → Org chart → Office: the offices people made (web-offices.json, web-office-store.ts) ──
|
|
3910
3920
|
// GET /ui/offices: { rev, offices, readable } for whoever may open the org chart (the public link too: it reads the
|
|
3911
3921
|
// chart; a guest's routes do not include it). PUT /ui/offices { offices, rev? }: a person's change, as a theme's reset
|
|
3912
|
-
// or lock is — an admin session only
|
|
3913
|
-
// refused
|
|
3922
|
+
// or lock is — an admin session only (over the public link too since M-3278, decision 7933bf90; a read-only session
|
|
3923
|
+
// there is refused below), never the CLI token; asked again once the body is in. Every page hears `offices` on the
|
|
3924
|
+
// stream and reads again.
|
|
3914
3925
|
if (method === "GET" && path === "/ui/offices") {
|
|
3915
3926
|
const store = ctx.officeStore;
|
|
3916
3927
|
if (!store) {
|
|
@@ -3998,7 +4009,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3998
4009
|
}
|
|
3999
4010
|
// #2716: PUT /ui/office-style { skin }: the whole-fleet office's style for every viewer, device and share link (a skin
|
|
4000
4011
|
// id, or null for the default; read back as GET /ui/offices's autoSkin). Who may save the offices may set it, as they
|
|
4001
|
-
// would: an admin session
|
|
4012
|
+
// would: an admin session (over the public link too, M-3278), never the CLI token; asked again once the body is in; counted with the
|
|
4002
4013
|
// offices' saves. Every page hears `offices` and reads again.
|
|
4003
4014
|
if (method === "PUT" && path === "/ui/office-style") {
|
|
4004
4015
|
return officeSettingPut(req, res, url, ctx, { key: "skin", invalid: "office_style_invalid", shape: "{ skin: a skin id, or null }", failed: "Saving the office style failed",
|
|
@@ -4278,7 +4289,8 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4278
4289
|
return;
|
|
4279
4290
|
// #1920 review: a guest's choice reaches the agent marked as a guest's, as its typed messages do.
|
|
4280
4291
|
const { authority } = confirmAfterBody(arrival, webAuthorityOf(req, url, ctx, instance));
|
|
4281
|
-
const
|
|
4292
|
+
const identity = webIdentityOf(req, url, ctx);
|
|
4293
|
+
const r = await click(instance, id, index, { key: person.voterKey, userId: person.userId, name: person.name, ...(guest ? { guest: true } : {}), authority, ...(identity ? { identity } : {}) });
|
|
4282
4294
|
json(res, r.status, r.status === 200 ? { answered: true, ...(r.options ? { options: r.options } : {}) } : { error: r.error ?? "Refused", ...(r.status === 409 ? { gone: true } : {}) });
|
|
4283
4295
|
})().catch(err => {
|
|
4284
4296
|
ctx.logger.error({ err: err.message }, "Web reply-button click failed");
|
|
@@ -4744,12 +4756,48 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4744
4756
|
});
|
|
4745
4757
|
return true;
|
|
4746
4758
|
}
|
|
4759
|
+
if (method === "POST" && path === "/ui/needs/hub-close") {
|
|
4760
|
+
(async () => {
|
|
4761
|
+
let body;
|
|
4762
|
+
try {
|
|
4763
|
+
body = await parseBody(req);
|
|
4764
|
+
}
|
|
4765
|
+
catch {
|
|
4766
|
+
json(res, 400, { error: "invalid" });
|
|
4767
|
+
return;
|
|
4768
|
+
}
|
|
4769
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
4770
|
+
return;
|
|
4771
|
+
const actor = ctx.contactActor?.(req, url);
|
|
4772
|
+
if (!actor) {
|
|
4773
|
+
json(res, 403, { error: "verification-required", code: "verification-required" });
|
|
4774
|
+
return;
|
|
4775
|
+
}
|
|
4776
|
+
if (typeof body.id !== "string" || body.id.length > 200) {
|
|
4777
|
+
json(res, 400, { error: "invalid" });
|
|
4778
|
+
return;
|
|
4779
|
+
}
|
|
4780
|
+
if (!ctx.closeHubHeld) {
|
|
4781
|
+
json(res, 503, { error: "unavailable", code: "unavailable" });
|
|
4782
|
+
return;
|
|
4783
|
+
}
|
|
4784
|
+
const out = await ctx.closeHubHeld(body.id, actor);
|
|
4785
|
+
json(res, out.status, { code: out.code, ...(out.status === 200 ? { ok: true } : { error: out.code }) });
|
|
4786
|
+
})().catch(() => { if (!res.headersSent)
|
|
4787
|
+
json(res, 503, { error: "unavailable", code: "unavailable" }); });
|
|
4788
|
+
return true;
|
|
4789
|
+
}
|
|
4747
4790
|
// M-3632: Needs you → "Try again" on held Hub work: back through the Hub's checks, never a blind delivery.
|
|
4748
4791
|
if (method === "POST" && path === "/ui/needs/hub-retry") {
|
|
4749
4792
|
if (!ctx.retryHubHeld) {
|
|
4750
4793
|
json(res, 404, { error: "not-found", code: "not-found" });
|
|
4751
4794
|
return true;
|
|
4752
4795
|
}
|
|
4796
|
+
// M-3680: over the public link, an admin session's (decision 7933bf90); a read-only session or a guest there: no.
|
|
4797
|
+
if (linkRestricted(req, url, ctx)) {
|
|
4798
|
+
json(res, 403, { error: "forbidden", code: "forbidden" });
|
|
4799
|
+
return true;
|
|
4800
|
+
}
|
|
4753
4801
|
const retry = ctx.retryHubHeld.bind(ctx);
|
|
4754
4802
|
(async () => {
|
|
4755
4803
|
let body;
|
|
@@ -5000,10 +5048,11 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5000
5048
|
}
|
|
5001
5049
|
try {
|
|
5002
5050
|
const { authority } = confirmAfterBody(arrival, webAuthorityOf(req, url, ctx, instance));
|
|
5051
|
+
const identity = webIdentityOf(req, url, ctx);
|
|
5003
5052
|
const r = await run({ instance, command, args: str(body.args, MAX_COMMAND_ARGS), confirm: body.confirm, ...(body.action ? { action: body.action } : {}) },
|
|
5004
5053
|
// M-3278 (decision 7933bf90): `publicLink` is a request over the link by anyone but an admin session — the link's
|
|
5005
5054
|
// admin runs /save and gets /model and /backend's Sign in, as on the local dashboard.
|
|
5006
|
-
{ publicLink: !!gatewayRequestContext(req) && !adminAdmissionOf(req, url, ctx), person, authority, ...(guest ? { guest: true } : {}) });
|
|
5055
|
+
{ publicLink: !!gatewayRequestContext(req) && !adminAdmissionOf(req, url, ctx), person, authority, ...(identity ? { identity } : {}), ...(guest ? { guest: true } : {}) });
|
|
5007
5056
|
if (!stillAuthorized(req, res, url, ctx))
|
|
5008
5057
|
return;
|
|
5009
5058
|
json(res, r.status, r.body);
|
|
@@ -5642,7 +5691,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5642
5691
|
return verdict.kind !== "allow" || (verdict.via === "session" && verdict.session?.tier !== "admin");
|
|
5643
5692
|
};
|
|
5644
5693
|
if (method === "POST" && path === "/ui/schedules") {
|
|
5645
|
-
// #1724:
|
|
5694
|
+
// #1724: an admin session's (M-3278, decision 7933bf90: over the public link too).
|
|
5646
5695
|
if (!ctx.scheduler) {
|
|
5647
5696
|
json(res, 500, { error: "Scheduler not initialized" });
|
|
5648
5697
|
return true;
|
|
@@ -5890,7 +5939,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5890
5939
|
return true;
|
|
5891
5940
|
}
|
|
5892
5941
|
if (method === "POST" && path === "/ui/teams") {
|
|
5893
|
-
// #1689:
|
|
5942
|
+
// #1689: an admin session's (M-3278, decision 7933bf90: over the public link too), like editing and deleting a team.
|
|
5894
5943
|
(async () => {
|
|
5895
5944
|
try {
|
|
5896
5945
|
const body = await parseBody(req);
|
|
@@ -5920,7 +5969,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5920
5969
|
return true;
|
|
5921
5970
|
}
|
|
5922
5971
|
// #1689: edit a team — the same update as the update_team tool (applyTeamUpdate), from the members the page sends:
|
|
5923
|
-
// what to add and remove is worked out against the team as it is now.
|
|
5972
|
+
// what to add and remove is worked out against the team as it is now. An admin session's, over the public link too (M-3278).
|
|
5924
5973
|
const teamEditMatch = path.match(/^\/ui\/teams\/(.+)$/);
|
|
5925
5974
|
if ((method === "PATCH" || method === "PUT") && teamEditMatch) {
|
|
5926
5975
|
const name = decodeURIComponent(teamEditMatch[1]);
|
|
@@ -6242,7 +6291,7 @@ async function handleResendMessage(req, res, ctx) {
|
|
|
6242
6291
|
} };
|
|
6243
6292
|
let handedOff = false;
|
|
6244
6293
|
try {
|
|
6245
|
-
const delivered = ctx.deliverHumanToInstance ? await ctx.deliverHumanToInstance(instance, payload, webHumanOrigin(false, authority), row.text, { stillCurrent, ...(native ? { authorityCurrent } : {}) })
|
|
6294
|
+
const delivered = ctx.deliverHumanToInstance ? await ctx.deliverHumanToInstance(instance, payload, webHumanOrigin(false, authority, webIdentityOf(req, new URL(req.url ?? "/", "http://localhost"), ctx)), row.text, { stillCurrent, ...(native ? { authorityCurrent } : {}) })
|
|
6246
6295
|
: await ctx.deliverToInstance(instance, payload, { stillCurrent, ...(native ? { authorityCurrent } : {}) });
|
|
6247
6296
|
if (delivered === false)
|
|
6248
6297
|
throw new Error("delivery changed");
|
|
@@ -6494,7 +6543,7 @@ function handleSendMessage(req, res, ctx) {
|
|
|
6494
6543
|
const reactions = ctx.pendingReactionsMeta?.(instance) ?? { meta: {}, consume: () => { } };
|
|
6495
6544
|
try {
|
|
6496
6545
|
const deliver = (name, payload) => ctx.deliverHumanToInstance
|
|
6497
|
-
? ctx.deliverHumanToInstance(name, payload, webHumanOrigin(false, authority), typed, { stillCurrent, ...(native ? { authorityCurrent } : {}) })
|
|
6546
|
+
? ctx.deliverHumanToInstance(name, payload, webHumanOrigin(false, authority, webIdentityOf(req, new URL(req.url ?? "/", "http://localhost"), ctx)), typed, { stillCurrent, ...(native ? { authorityCurrent } : {}) })
|
|
6498
6547
|
: ctx.deliverToInstance(name, payload, { stillCurrent, ...(native ? { authorityCurrent } : {}) });
|
|
6499
6548
|
delivered = await deliver(instance, {
|
|
6500
6549
|
type: "fleet_inbound",
|
|
@@ -6928,7 +6977,7 @@ function shellOwnerCss(ctx, mode, viewer) {
|
|
|
6928
6977
|
/**
|
|
6929
6978
|
* AgEnD Hub P1 (docs/design/hub.md, docs/design/hub-ui-client.md): the page's Hub mark — presentation only, never
|
|
6930
6979
|
* authority, set by the listener that serves the page (never a client's choice): `member` on this fleet's listener when
|
|
6931
|
-
* `hub_member.enabled
|
|
6980
|
+
* `hub_member.enabled` (over the public link, an admin session's only: M-3278). `hub` is only the Hub listener's own workspace page
|
|
6932
6981
|
* (serveHubWorkspaceShell). Nothing otherwise: no Hub UI is drawn and no Hub module loads.
|
|
6933
6982
|
*/
|
|
6934
6983
|
function hubBodyAttrs(req, ctx) {
|