@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
package/dist/ui/contact-needs.js
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
import { html, useEffect, useState } from "/assets/app-html.js";
|
|
11
11
|
import { detailsPath } from "/assets/app-route.js";
|
|
12
12
|
import { Icon } from "/assets/ui-icons.js";
|
|
13
|
+
import { appStore, useStore } from "/assets/app-store.js";
|
|
14
|
+
import { labelOf } from "/assets/instance-nav.js";
|
|
13
15
|
import { toast } from "/assets/ui-toast.js";
|
|
14
16
|
import { confirmDialog } from "/assets/ui-confirm.js";
|
|
15
17
|
import { ca } from "./contact-auth-strings.js";
|
|
@@ -22,12 +24,15 @@ const ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
|
22
24
|
function RequestNeed({ item }) {
|
|
23
25
|
const ref = item.contactTicket || {};
|
|
24
26
|
const [tk, setTk] = useState(null);
|
|
27
|
+
// M-3680: the agents by the names the page shows them (the request card below does the same).
|
|
28
|
+
const { instances } = useStore(appStore);
|
|
29
|
+
const agent = (name) => (name ? labelOf((instances || []).find((i) => i.name === name) || { name }) : "");
|
|
25
30
|
useEffect(() => {
|
|
26
31
|
let live = true;
|
|
27
32
|
if (ID.test(String(ref.id || ""))) void getTicket(ref.id).then((r) => { if (live && r.ok) setTk(r.data); });
|
|
28
33
|
return () => { live = false; };
|
|
29
34
|
}, [ref.id]);
|
|
30
|
-
return html`<div class="n-title"><strong>${ca("needsTitle", ref.source
|
|
35
|
+
return html`<div class="n-title"><strong>${ca("needsTitle", agent(ref.source), agent(ref.target))}</strong></div>
|
|
31
36
|
${tk ? html`<${TicketCard} ticket=${tk} onChange=${setTk} />` : null}
|
|
32
37
|
<div class="n-actions">${ID.test(String(ref.id || "")) ? html`<a class="btn btn-sm btn-ghost" href=${`/ui/fleet/authorizations?ticket=${encodeURIComponent(ref.id)}`}>${ca("needsOpen")}</a>` : null}</div>`;
|
|
33
38
|
}
|
|
@@ -19,8 +19,9 @@ import { labelOf } from "/assets/instance-nav.js";
|
|
|
19
19
|
import { ContactGrantEditor } from "./contact-grant-editor.js";
|
|
20
20
|
import { REASONS } from "./contact-authorizations.js";
|
|
21
21
|
import { groupWouldDisable } from "./contact-tool-groups.js";
|
|
22
|
+
import { dateTimeText } from "/assets/clock-text.js";
|
|
22
23
|
|
|
23
|
-
const when = (iso) => { const d = new Date(iso); return Number.isFinite(d.getTime()) ? d
|
|
24
|
+
const when = (iso) => { const d = new Date(iso); return Number.isFinite(d.getTime()) ? dateTimeText(d, { dateStyle: "medium", timeStyle: "short" }, []) : ""; };
|
|
24
25
|
/** A3's guard reason codes (ContactGuardStatus.reason), each said in words (contact-auth-strings.js guardReason_<code>). */
|
|
25
26
|
const GUARD_REASONS = new Set(["legacy-mode", "unsupported-backend", "unsupported-platform", "unsupported-version", "cli-mode", "load-not-verified", "stale-policy",
|
|
26
27
|
"stale-launch", "not-running", "invalid-policy", "missing-bound-mcp", "missing-selected-mcp", "guard-files-changed", "invalid-load-receipt", "guard-unavailable", "binary-changed"]);
|
|
@@ -105,7 +106,8 @@ export function ContactPermissionsPanel({ name }) {
|
|
|
105
106
|
const p = perm.data;
|
|
106
107
|
useEffect(() => { setEditing(null); }, [name, p?.revision]);
|
|
107
108
|
if (!p && perm.loading !== false && !perm.error) return html`<${Skeleton} lines=${5} label=${ca("loading")} />`;
|
|
108
|
-
if (!p) return perm.error === "
|
|
109
|
+
if (!p) return perm.error === "verification-required" ? html`<p class="note contact-verify">${ca("verifyFirst")}</p>`
|
|
110
|
+
: perm.error === "forbidden" ? html`<p class="note contact-forbidden">${ca("forbidden")}</p>`
|
|
109
111
|
: html`<${ErrorState} message=${ca(perm.error === "unavailable" ? "unavailable" : "loadFailed")} onRetry=${() => void perm.read()} />`;
|
|
110
112
|
// Who may change what (the server says; Sentinel's seam): the source room's admins its mode and tools (canSetMode); the
|
|
111
113
|
// target's approvers its approvers and allowed contacts (canManage).
|
|
@@ -119,7 +121,7 @@ export function ContactPermissionsPanel({ name }) {
|
|
|
119
121
|
setBusy(false);
|
|
120
122
|
if (r.ok) { perm.setData(r.data); toast(ca("saved"), true); return true; }
|
|
121
123
|
if (r.code === "conflict") { await perm.read(); toast(ca("stale"), false); return false; }
|
|
122
|
-
toast(ca(r.code === "forbidden" ? "forbidden" : r.code === "unavailable" ? "unavailable" : r.code === "invalid-approver" ? "invalidApprover" : "saveFailed"), false);
|
|
124
|
+
toast(ca(r.code === "verification-required" ? "verifyFirst" : r.code === "forbidden" ? "forbidden" : r.code === "unavailable" ? "unavailable" : r.code === "invalid-approver" ? "invalidApprover" : "saveFailed"), false);
|
|
123
125
|
return false;
|
|
124
126
|
};
|
|
125
127
|
const switchMode = async (mode) => {
|
|
@@ -140,7 +142,7 @@ export function ContactPermissionsPanel({ name }) {
|
|
|
140
142
|
setBusy(false);
|
|
141
143
|
if (r.ok) { perm.setData(r.data); toast(ca("originCleared"), true); return; }
|
|
142
144
|
if (r.code === "conflict") { await perm.read(); toast(ca("stale"), false); return; }
|
|
143
|
-
toast(ca(r.code === "forbidden" ? "forbidden" : r.code === "unavailable" ? "unavailable" : "saveFailed"), false);
|
|
145
|
+
toast(ca(r.code === "verification-required" ? "verifyFirst" : r.code === "forbidden" ? "forbidden" : r.code === "unavailable" ? "unavailable" : "saveFailed"), false);
|
|
144
146
|
};
|
|
145
147
|
const tools = p.roomTools || { publicRead: false, allowedMcpTools: [], wouldDisable: [] };
|
|
146
148
|
const setTools = (next) => write({ roomTools: { publicRead: next.publicRead, allowedMcpTools: next.allowedMcpTools } });
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
/** The kinds of AgEnD tools a restricted room loses, in the order they are shown; each tool in exactly one. */
|
|
12
12
|
export const TOOL_GROUPS = Object.freeze([
|
|
13
13
|
{ id: "fleet", tools: ["get_fleet_status", "get_fleet_config", "validate_config", "get_effort", "list_models", "kiro_engine_status",
|
|
14
|
-
"update_instance_config", "update_fleet_defaults", "migrate_kiro_instance", "reconcile_kiro_instance", "get_web_settings", "set_web_settings", "propose_contact_change"] },
|
|
14
|
+
"update_instance_config", "update_fleet_defaults", "migrate_kiro_instance", "reconcile_kiro_instance", "get_web_settings", "set_web_settings", "propose_contact_change", "contact_state"] },
|
|
15
15
|
{ id: "agents", tools: ["create_instance", "delete_instance", "replace_instance", "start_instance", "stop_instance", "restart_instance",
|
|
16
16
|
"pause_instance", "wake_instance", "create_team", "update_team", "delete_team"] },
|
|
17
17
|
{ id: "usage", tools: ["get_usage", "get_usage_report", "get_cache_report", "get_instance_logs"] },
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// M-3710 (R21079937, 11-25: a pending contact request was in no list, not even on this computer). Needs you's line for an
|
|
2
|
+
// admin session with no verified person behind it: how many requests wait (the server sends the count only —
|
|
3
|
+
// reason "contact_verify_needed", contactVerify { count }; never which, who or what), and this browser's own
|
|
4
|
+
// "Authorize this browser" (web-authorize.js: the button, or why it can't be authorized here and where to fix that).
|
|
5
|
+
// Once the account confirms, the server sends Needs you again and the requests themselves replace this line.
|
|
6
|
+
// A module of its own, with its own words (#4447 review): a page still holding an older contact-needs.js or
|
|
7
|
+
// contact-auth-strings.js keeps working and says these words, never their keys.
|
|
8
|
+
import { html } from "/assets/app-html.js";
|
|
9
|
+
import { register, t } from "/assets/app-i18n.js";
|
|
10
|
+
import { Icon } from "/assets/ui-icons.js";
|
|
11
|
+
import { AuthorizeChip } from "/assets/web-authorize.js";
|
|
12
|
+
|
|
13
|
+
register("contactVerifyNeed", {
|
|
14
|
+
en: {
|
|
15
|
+
one: "1 contact request needs a verified browser", many: "{0} contact requests need a verified browser",
|
|
16
|
+
body: "Authorize this browser to see who is asking, and to approve or decline.",
|
|
17
|
+
},
|
|
18
|
+
"zh-TW": {
|
|
19
|
+
one: "有 1 個聯絡申請需要已驗證的瀏覽器", many: "有 {0} 個聯絡申請需要已驗證的瀏覽器",
|
|
20
|
+
body: "授權這個瀏覽器後,才能看到是誰提出,並核准或拒絕。",
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
const tv = (k, ...a) => t(`contactVerifyNeed.${k}`, ...a);
|
|
24
|
+
/** The line's title for `count` waiting requests (at least 1). */
|
|
25
|
+
export const verifyNeedTitle = (count) => (count === 1 ? tv("one") : tv("many", count));
|
|
26
|
+
export const verifyNeedBody = () => tv("body");
|
|
27
|
+
|
|
28
|
+
/** A Needs you item that says contact requests wait for a verified browser. */
|
|
29
|
+
export const isContactVerify = (item) => item?.type === "contact" && item.reason === "contact_verify_needed";
|
|
30
|
+
/** How many requests the line stands for: what Needs you's counts add for it (#4447 capture check). */
|
|
31
|
+
export const contactVerifyCount = (item) => Math.max(1, Math.floor(Number(item?.contactVerify?.count) || 1));
|
|
32
|
+
|
|
33
|
+
export function ContactVerifyNeed({ item }) {
|
|
34
|
+
const count = contactVerifyCount(item);
|
|
35
|
+
const title = verifyNeedTitle(count);
|
|
36
|
+
return html`<section class="n-group n-contact-verify" aria-label=${title}>
|
|
37
|
+
<article data-trust="permission" class="n-item contact-need contact-verify-need" data-reason="contact_verify_needed">
|
|
38
|
+
<span class="n-icon"><${Icon} name="key" size=${18} /></span>
|
|
39
|
+
<div class="n-body">
|
|
40
|
+
<div class="n-title"><strong>${title}</strong></div>
|
|
41
|
+
<p class="n-detail">${verifyNeedBody()}</p>
|
|
42
|
+
<${AuthorizeChip} />
|
|
43
|
+
</div>
|
|
44
|
+
</article>
|
|
45
|
+
</section>`;
|
|
46
|
+
}
|
package/dist/ui/fleet-cache.js
CHANGED
|
@@ -8,6 +8,7 @@ import { html } from "/assets/app-html.js";
|
|
|
8
8
|
import { t, register } from "/assets/app-i18n.js";
|
|
9
9
|
import { Empty } from "/assets/ui-states.js";
|
|
10
10
|
import { Icon } from "/assets/ui-icons.js";
|
|
11
|
+
import { unitText } from "/assets/clock-text.js";
|
|
11
12
|
|
|
12
13
|
register("cache", {
|
|
13
14
|
en: {
|
|
@@ -43,19 +44,19 @@ register("cache", {
|
|
|
43
44
|
pricesNote: "牌價查證日期:{0}。", quotaNote: "訂閱方案:Anthropic 與 OpenAI 未公布快取讀取如何計入方案額度,因此節省金額以牌價計算為準,換算成額度則是估算。",
|
|
44
45
|
estimateNote: "估算:Codex 不記錄快取寫入,寫入量以該次請求未命中快取的輸入估算。",
|
|
45
46
|
notPricedNote: "有些模型不在價目表中,這些 Agent 以「輸入價格單位」比較。",
|
|
46
|
-
scanning: "
|
|
47
|
+
scanning: "仍在讀取對話紀錄——還剩 {0}。重新整理可看到更多。", scanningFirst: "第一次讀取對話紀錄中——重新整理可看到更多。", refresh: "重新整理",
|
|
47
48
|
keepWarm: "建議保溫", leaveOff: "不需保溫", estimate: "估算", notPriced: "未定價",
|
|
48
49
|
requests: "請求數", pastTtl: "超過 TTL({0})", expired: "已過期(重寫)", rewritten: "重寫的 token",
|
|
49
|
-
expiryCost: "過期成本", share: "
|
|
50
|
+
expiryCost: "過期成本", share: "佔其成本 {0}", pings: "保溫 ping 次數", pingsAfter: "其中 {0} 次在最後一次請求之後",
|
|
50
51
|
pingCost: "ping 成本", net: "保溫後淨額", gaps: "請求間隔", ttlLine: "TTL {0}",
|
|
51
52
|
quiet: "這段期間活動太少,無法判斷。",
|
|
52
53
|
neverExpired: "沒有任何間隔超過 {0} 的快取時效。", survived: "有 {0} 個間隔超過 {1} TTL,但快取仍在。",
|
|
53
|
-
onlyIdle: "
|
|
54
|
+
onlyIdle: "沒有任何請求在快取過期後回來使用:每個工作階段閒置後就不再使用。保溫只會送出 {0} 次沒人讀的 ping。",
|
|
54
55
|
saves: "常閒置超過 {0} TTL 後又再使用:保溫可省 {1}(過期成本的 {2})。",
|
|
55
56
|
costsMore: "每次過期約需送 {0} 次 ping——保溫的花費比省下的多 {1}。",
|
|
56
57
|
costsMoreUnits: "每次過期約需送 {0} 次 ping——保溫的花費比省下的多。",
|
|
57
|
-
unavailable: "不提供", creditBilled: "
|
|
58
|
-
shared: "與 {0}
|
|
58
|
+
unavailable: "不提供", creditBilled: "以點數計費,沒有快取資料", unsupported: "這個 CLI 沒有快取資料", noData: "尚未讀到任何請求",
|
|
59
|
+
shared: "與 {0} 共用工作目錄,無法分辨各自的對話紀錄",
|
|
59
60
|
empty: "沒有 Agent", emptyHint: "fleet 有 Agent 後會顯示在這裡。",
|
|
60
61
|
b0: "≤5分", b1: "≤30分", b2: "≤1時", b3: "≤2時", b4: "≤6時", b5: "≤24時", b6: ">24時", tokensUnit: "輸入 token 當量",
|
|
61
62
|
writeMix: "快取寫入 5 分 / 1 時", effectiveTtl: "實際存活", gapMiss: "{1} 個 5–60 分鐘空檔中有 {0} 個重寫", gapMissNone: "還沒有 5–60 分鐘的空檔",
|
|
@@ -82,7 +83,7 @@ export function tokens(n) {
|
|
|
82
83
|
return String(Math.round(n));
|
|
83
84
|
}
|
|
84
85
|
export function bytes(n) { return n >= 1e9 ? `${(n / 1e9).toFixed(1)} GB` : n >= 1e6 ? `${Math.round(n / 1e6)} MB` : `${Math.max(1, Math.round(n / 1e3))} KB`; }
|
|
85
|
-
export function ttlText(sec) { return sec >= 3600 ?
|
|
86
|
+
export function ttlText(sec) { return sec >= 3600 ? unitText(sec / 3600, "h") : unitText(Math.round(sec / 60), "min"); }
|
|
86
87
|
const pct = (x) => `${x >= 0.1 ? Math.round(x * 100) : (x * 100).toFixed(1)}%`;
|
|
87
88
|
|
|
88
89
|
/** The one line under an instance's recommendation. */
|
package/dist/ui/fleet-canvas.js
CHANGED
|
@@ -56,7 +56,7 @@ register("orgc", {
|
|
|
56
56
|
expand: "展開", collapse: "收合", members: "{0} 名成員", member: "1 名成員", inFolded: "找到 {0} 個 · 展開", noMembers: "沒有成員",
|
|
57
57
|
openChat: "開啟聊天", minimap: "總覽:點一下移到那裡",
|
|
58
58
|
live: "即時", liveOn: "隱藏即時往來", liveOff: "顯示即時往來", lgTask: "delegate_task", lgSend: "send_to_instance",
|
|
59
|
-
lgReport: "report_result", lgBroadcast: "broadcast", lgQueued: "排隊中", lgFading: "已送達", lgTeam: "
|
|
59
|
+
lgReport: "report_result", lgBroadcast: "broadcast", lgQueued: "排隊中", lgFading: "已送達", lgTeam: "團隊之間", legend: "圖例",
|
|
60
60
|
lgWork: "進行中(直到回報)", lgReturn: "完成(回報送回)", lgStale: "尚未回報",
|
|
61
61
|
},
|
|
62
62
|
});
|
|
@@ -411,8 +411,32 @@ export function OfficeCard({ model: m, avatar, sheet, place, onChat, onFind, onC
|
|
|
411
411
|
const placeNow = useRef(place);
|
|
412
412
|
placeNow.current = place;
|
|
413
413
|
useEffect(() => () => { if (placeNow.current) placeNow.current(null); }, []);
|
|
414
|
-
// A bottom sheet closes on a swipe down (60 px or more).
|
|
415
|
-
|
|
414
|
+
// A bottom sheet closes on a swipe down (60 px or more). M-3633 (Prism #4414): a sheet whose content scrolls lets the
|
|
415
|
+
// browser scroll it (touch-action pan-y — and a browser that takes a touch for scrolling cancels the pointer, so a
|
|
416
|
+
// swipe there could never finish): it closes from its grip, a handle the browser leaves to the page (touch-action
|
|
417
|
+
// none, kept at its top). One that fits closes from anywhere, as before. `data-scrolls` says which (the CSS).
|
|
418
|
+
const scrolls = () => { const t = box.current, sc = t && ((typeof t.querySelector === "function" && t.querySelector(".oo-card-body")) || t); return !!sc && sc.scrollHeight > sc.clientHeight + 1; };
|
|
419
|
+
// …and (Leader #4414) a card whose content scrolls — a sheet, or a desk card held shorter under an area's name —
|
|
420
|
+
// says there is more below: `data-more` while it is not scrolled to its end, a fade over the pinned actions (the CSS).
|
|
421
|
+
useLayoutEffect(() => {
|
|
422
|
+
const t = box.current;
|
|
423
|
+
if (!t || typeof t.setAttribute !== "function") return undefined;
|
|
424
|
+
const sc = (typeof t.querySelector === "function" && t.querySelector(".oo-card-body")) || t;
|
|
425
|
+
const mark = () => {
|
|
426
|
+
if (sheet && scrolls()) t.setAttribute("data-scrolls", ""); else t.removeAttribute("data-scrolls");
|
|
427
|
+
if (sc.scrollHeight - sc.scrollTop - sc.clientHeight > 2) t.setAttribute("data-more", ""); else t.removeAttribute("data-more");
|
|
428
|
+
};
|
|
429
|
+
mark();
|
|
430
|
+
const RO = globalThis.ResizeObserver, ro = typeof RO === "function" ? new RO(mark) : null;
|
|
431
|
+
if (ro) { ro.observe(t); for (const el of t.querySelectorAll?.(".oo-card-body, .oo-card-body > *, .oo-card > *") ?? []) ro.observe(el); }
|
|
432
|
+
if (typeof sc.addEventListener === "function") sc.addEventListener("scroll", mark, { passive: true });
|
|
433
|
+
return () => { if (ro) ro.disconnect(); if (typeof sc.removeEventListener === "function") sc.removeEventListener("scroll", mark); };
|
|
434
|
+
});
|
|
435
|
+
const down = (e) => {
|
|
436
|
+
if (!sheet) return;
|
|
437
|
+
const onGrip = !!(e.target && typeof e.target.closest === "function" && e.target.closest(".oo-card-grip"));
|
|
438
|
+
swipe.current = onGrip || !scrolls() ? e.clientY : null;
|
|
439
|
+
};
|
|
416
440
|
const up = (e) => { if (sheet && swipe.current !== null && e.clientY - swipe.current > 60) onClose(); swipe.current = null; };
|
|
417
441
|
|
|
418
442
|
// Legacy default path (packs without `card`): preserve exact markup and classes.
|
|
@@ -42,9 +42,9 @@ register("orgl", {
|
|
|
42
42
|
"zh-TW": {
|
|
43
43
|
edit: "編輯配置", title: "編輯配置", coords: "顯示座標", addWaypoint: "新增路徑點", removeWaypoint: "移除路徑點",
|
|
44
44
|
joinTo: "連到", join: "連接", unjoin: "取消連接 {0}", corridors: "走道", none: "尚未選取:請選座位、家具、門、信件落點或路徑點。",
|
|
45
|
-
reset: "
|
|
45
|
+
reset: "還原成外觀包的配置", save: "儲存配置", cancel: "取消", saved: "配置已儲存。", hint: "拖曳,或用方向鍵移動(Shift:一次 10)。",
|
|
46
46
|
seat: "{1} 的座位 {0}", furniture: "家具 {0}", night: "家具 {0}(夜間)", door: "門", mail: "信件落點", mailAuto: "信件落點(目前信件落下的位置;拖曳即可指定)", waypoint: "路徑點 {0}", at: "{0},位置 {1}, {2}",
|
|
47
|
-
nightReset: "
|
|
47
|
+
nightReset: "回到外觀包的夜間位置",
|
|
48
48
|
seatFor: "{1} 的座位 {0},保留給 {2}", reservedFor: "保留給", lend: "不在時借給別人", nobody: "沒有可選的成員。",
|
|
49
49
|
changed: "有人在這期間修改了辦公室。你的配置已保留:再按一次儲存,會套用到目前的清單。",
|
|
50
50
|
failed: "配置沒有儲存({0})。", rateLimited: "儲存太頻繁,請一分鐘後再試。",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
// @property {(look, at) => {x, y, w, h}} [charBox] zones: the box drawCharacter covers with the feet at `at`
|
|
39
39
|
// ({ x, y, walking, heading }): what hover and click hit (fleet-office-zones.js personAt)
|
|
40
40
|
// @property {(ctx, prop, ms, env) => void} drawProp a traffic item in the air: { kind, hue, x, y, t }
|
|
41
|
-
// @property {(ctx, x, y, text, env, lift?) => void} drawBubble a speech bubble whose tail points at (x, y), its box `lift` px higher
|
|
41
|
+
// @property {(ctx, x, y, text, env, lift?, flip?) => void} drawBubble a speech bubble whose tail points at (x, y), its box `lift` px higher (`flip`: on the tail's left)
|
|
42
42
|
// @property {(env) => string} matte #2540: the colour around the scene (the Office fills the panel; the scene is 16:9)
|
|
43
43
|
// @property {object|null} [backdrop] a pack's loaded background picture (the page samples its edges for the matte)
|
|
44
44
|
// The desks layout's back and front layers change only when the fleet (or the zoom) does: the renderer keeps them as
|
|
@@ -343,19 +343,23 @@ const BUBBLE_FONT = "600 11px system-ui, sans-serif";
|
|
|
343
343
|
* The box a speech bubble with its tail at (x, y) takes for `text` (its tail excluded): what drawBubble draws, and what
|
|
344
344
|
* the Office places so no two overlap (#2431: two neighbours' bubbles covered each other on a phone).
|
|
345
345
|
*/
|
|
346
|
-
export function bubbleBox(ctx, x, y, text, lift = 0) {
|
|
346
|
+
export function bubbleBox(ctx, x, y, text, lift = 0, flip = false) {
|
|
347
347
|
ctx.save();
|
|
348
348
|
ctx.font = BUBBLE_FONT;
|
|
349
349
|
const t = fitText(ctx, text, 150), w = Math.ceil((ctx.measureText ? ctx.measureText(t).width : t.length * 6) + 14), h = 19;
|
|
350
350
|
ctx.restore();
|
|
351
|
-
|
|
351
|
+
// M-3722: `flip` puts the box on the tail's left (its tail still under it), for a call whose usual place covers a name.
|
|
352
|
+
const bx = Math.round(flip ? x - w + 14 : x - 10), by = Math.round(y - h - 6 - lift);
|
|
352
353
|
return { x: bx, y: by, w, h, text: t };
|
|
353
354
|
}
|
|
354
355
|
|
|
355
|
-
/**
|
|
356
|
-
|
|
356
|
+
/**
|
|
357
|
+
* A speech bubble, its tail at (x, y): short words on light paper in either theme; `lift` raises the box (its tail
|
|
358
|
+
* longer); `flip` (M-3722) draws the box on the tail's left.
|
|
359
|
+
*/
|
|
360
|
+
function drawBubble(ctx, x, y, text, env, lift = 0, flip = false) {
|
|
357
361
|
if (!text) return;
|
|
358
|
-
const { x: bx, y: by, w, h, text: t } = bubbleBox(ctx, x, y, text, lift);
|
|
362
|
+
const { x: bx, y: by, w, h, text: t } = bubbleBox(ctx, x, y, text, lift, flip);
|
|
359
363
|
ctx.save();
|
|
360
364
|
ctx.font = BUBBLE_FONT;
|
|
361
365
|
ctx.fillStyle = "#fffdf6"; ctx.strokeStyle = env.mode === "light" ? "rgba(0, 0, 0, 0.35)" : "rgba(0, 0, 0, 0.6)"; ctx.lineWidth = 1;
|
|
@@ -983,6 +987,22 @@ export function loadBuiltInSkin(id, { image = defaultImage } = {}) {
|
|
|
983
987
|
}, () => { p.job = null; return null; });
|
|
984
988
|
return p.job;
|
|
985
989
|
}
|
|
990
|
+
/**
|
|
991
|
+
* M-3533 R2c: a style with some people drawn in their own characters (a Hub room office: each agent's set from its owner's
|
|
992
|
+
* pack, hub-character-plan.ts). `sets`: name → { pose: strip } (strips as a checked pack's, each a single sheet);
|
|
993
|
+
* `images`: src → a loaded picture. Only the drawing of people changes — the style's scene, desks, tags and words are its
|
|
994
|
+
* own. Someone without a set, or whose set is not wholly loaded, is the style's figure. Set ids are made here, so a name
|
|
995
|
+
* (even "default") never becomes everyone's fallback.
|
|
996
|
+
*/
|
|
997
|
+
export function withCharacters(base, sets, images) {
|
|
998
|
+
const names = sets ? Object.keys(sets) : [];
|
|
999
|
+
if (!names.length) return base;
|
|
1000
|
+
const characters = Object.create(null), byInstance = Object.create(null);
|
|
1001
|
+
names.forEach((name, i) => { characters[`set${i}`] = sets[name]; byInstance[name] = `set${i}`; });
|
|
1002
|
+
const sk = spriteSkin({ id: base.id, characters, byInstance, props: {}, room: {}, desk: {} }, images, base);
|
|
1003
|
+
// `ownCharacters`: the scene keeps their speech bubbles inside their area (a taller character's would rise above it).
|
|
1004
|
+
return { ...base, drawCharacter: sk.drawCharacter, charBox: sk.charBox, ownCharacters: true };
|
|
1005
|
+
}
|
|
986
1006
|
/** #2631: the cozy's picture (loadBuiltInSkin for "cozy"). */
|
|
987
1007
|
export const loadCozySkin = (opts = {}) => loadBuiltInSkin("cozy", opts);
|
|
988
1008
|
/** A skin by id: a built-in one, else a pack loaded here (`packs`: id → skin), else the default (pixel). */
|
|
@@ -79,6 +79,38 @@ export const desksK = (dpr = 1) => Math.max(1, Math.round(dpr)) / dpr;
|
|
|
79
79
|
export const openingView = (w, h, size, dpr, zones, mode = "contain") => (zones ? fitScene(w, h, size, mode) : { k: desksK(dpr), x: 0, y: 0 });
|
|
80
80
|
/** One axis of clampPan: offset `o` of a scene `s` long in a viewport `n` long. */
|
|
81
81
|
const clampAxis = (o, s, n) => (s >= n ? Math.min(0, Math.max(n - s, o)) : (n - s) / 2);
|
|
82
|
+
/** How much of the area labels a `cw`×`ch` box at (x, y) covers (px²). */
|
|
83
|
+
const covered = (x, y, cw, ch, avoid) => avoid.reduce((a, r) => a + Math.max(0, Math.min(x + cw, r.x + r.w) - Math.max(x, r.x)) * Math.max(0, Math.min(y + ch, r.y + r.h) - Math.max(y, r.y)), 0);
|
|
84
|
+
/**
|
|
85
|
+
* M-3633: where a person's floating card goes (stage px): beside them — right of `px` by `gap`, else left — level with
|
|
86
|
+
* their head (`py` − 24), inside the stage (`w`×`h`, 8 px clear). Clear of the areas' labels (`avoid`, rects on the
|
|
87
|
+
* stage) where it can be: the same spot when it covers none, else that side lower (just under the label it met), else
|
|
88
|
+
* the other side; else held shorter under a label (`maxH`: it scrolls; at least CARD_MIN_H); with none clear, the spot
|
|
89
|
+
* covering the least.
|
|
90
|
+
*/
|
|
91
|
+
export const CARD_MIN_H = 240;
|
|
92
|
+
export function cardSpot({ px, py, gap, cw, ch, w, h, avoid = [] }) {
|
|
93
|
+
const cx = (x) => Math.max(8, Math.min(x, w - cw - 8)), cy = (y) => Math.max(8, Math.min(y, h - ch - 8));
|
|
94
|
+
const right = px + gap, left = px - gap - cw;
|
|
95
|
+
const sides = right + cw > w - 8 ? [left, right] : [right, left];
|
|
96
|
+
const spots = [];
|
|
97
|
+
for (const s of sides) {
|
|
98
|
+
const x = cx(s), y = cy(py - 24);
|
|
99
|
+
spots.push({ x, y });
|
|
100
|
+
for (const r of avoid) if (r.y + r.h + 6 > y && r.y + r.h + 6 + ch <= h - 8) spots.push({ x, y: r.y + r.h + 6 });
|
|
101
|
+
}
|
|
102
|
+
for (const s of sides) for (const r of avoid) {
|
|
103
|
+
const y = r.y + r.h + 6, room = h - 8 - y;
|
|
104
|
+
if (room >= CARD_MIN_H && room < ch) spots.push({ x: cx(s), y, maxH: room });
|
|
105
|
+
}
|
|
106
|
+
let best = spots[0], least = Infinity;
|
|
107
|
+
for (const p of spots) {
|
|
108
|
+
const c = covered(p.x, p.y, cw, p.maxH ?? ch, avoid);
|
|
109
|
+
if (c === 0) return p;
|
|
110
|
+
if (c < least) { least = c; best = p; }
|
|
111
|
+
}
|
|
112
|
+
return best;
|
|
113
|
+
}
|
|
82
114
|
/**
|
|
83
115
|
* The view kept on the scene: along an axis where the scene is at least the viewport it covers the viewport (no gap at
|
|
84
116
|
* either edge); where it is smaller it is centred on that axis. Nothing can be scrolled off-screen.
|
|
@@ -610,22 +610,35 @@ export function bubbleAt(name, state, ms, lines) {
|
|
|
610
610
|
* another bubble (no two bubbles overlap) — so a name alone never keeps a call out (on Cozy a stuck agent stands right
|
|
611
611
|
* under "Help desk", and its "Hmm, stuck?" went missing in beta.20).
|
|
612
612
|
*/
|
|
613
|
-
|
|
613
|
+
/** M-3722: the space (logical px) a bubble's box keeps off an area's name (placeBubbles' `air`). */
|
|
614
|
+
export const NAME_AIR = 3;
|
|
615
|
+
export function placeBubbles(items, lift = 22, blocked = [], soft = [], air = 0) {
|
|
616
|
+
if (air) soft = soft.map((b) => ({ x: b.x - air, y: b.y - air, w: b.w + 2 * air, h: b.h + 2 * air }));
|
|
614
617
|
const rank = (it) => (it.rank ?? (it.calling ? 0 : 2));
|
|
615
618
|
const order = [...items].sort((a, b) => (rank(a) - rank(b)) || (b.shown - a.shown) || (a.key < b.key ? -1 : a.key > b.key ? 1 : 0));
|
|
616
619
|
const taken = [...blocked], out = [];
|
|
617
620
|
const hit = (list, r) => list.some((t) => r.x < t.x + t.w && t.x < r.x + r.w && r.y < t.y + t.h && t.y < r.y + r.h);
|
|
618
|
-
|
|
619
|
-
|
|
621
|
+
// M-3722: `flipBox` (the box on the tail's left) is a call's other side: tried before a call covers an area's name.
|
|
622
|
+
const at = (it, dy, flip = false) => {
|
|
623
|
+
const box = flip && it.flipBox ? it.flipBox : it.box;
|
|
624
|
+
const r = { x: box.x, y: box.y + dy, w: box.w, h: box.h };
|
|
620
625
|
return { r, t: it.tail ? { x: it.tail.x - 1, y: r.y + r.h, w: 9, h: Math.max(0, it.tail.y - (r.y + r.h)) } : null };
|
|
621
626
|
};
|
|
622
|
-
|
|
627
|
+
// M-3722: an area's name (`soft`) keeps a bubble's BOX off it; a tail may cross a name (the Office writes the name again
|
|
628
|
+
// over it) — a caller standing at a name's height would otherwise always cover it.
|
|
629
|
+
const free = (it, [dy, flip], names) => { const { r, t } = at(it, dy, flip); return !hit(taken, r) && !(t && hit(taken, t)) && !(names && hit(soft, r)); };
|
|
630
|
+
const first = (it, spots, names) => spots.find((spot) => free(it, spot, names));
|
|
631
|
+
const sides = (dys) => dys.map((dy) => [dy, false]);
|
|
623
632
|
for (const it of order) {
|
|
624
|
-
let
|
|
625
|
-
if (
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
633
|
+
let spot = first(it, sides([0, -lift]), true);
|
|
634
|
+
if (spot === undefined && it.calling) {
|
|
635
|
+
spot = (it.flipBox ? first(it, [[0, true], [-lift, true]], true) : undefined)
|
|
636
|
+
?? first(it, [[-2 * lift, false], ...(it.flipBox ? [[-2 * lift, true]] : [])], true)
|
|
637
|
+
?? first(it, sides([0, -lift, -2 * lift]), false); // M-3648: a name never keeps a call out
|
|
638
|
+
}
|
|
639
|
+
if (spot === undefined) continue;
|
|
640
|
+
const [dy, flip] = spot, { r, t } = at(it, dy, flip);
|
|
641
|
+
taken.push(r); if (t) taken.push(t); out.push({ ...it, dy, ...(flip ? { flip: true } : {}) });
|
|
629
642
|
}
|
|
630
643
|
return out;
|
|
631
644
|
}
|