@songsid/agend 2.4.0-beta.11 → 2.4.0-beta.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/dist/accounts-view.d.ts +29 -0
- package/dist/accounts-view.js +2 -14
- package/dist/accounts-view.js.map +1 -1
- package/dist/agent-endpoint.d.ts +1 -0
- package/dist/agent-endpoint.js +4 -2
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/auth-api.d.ts +2 -0
- package/dist/auth-api.js +33 -2
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/codex.js +11 -0
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/types.d.ts +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-server.js +1 -1
- package/dist/channel/mcp-server.js.map +1 -1
- package/dist/channel/mcp-tools.js +3 -1
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/claude-install-kind.d.ts +19 -0
- package/dist/claude-install-kind.js +54 -0
- package/dist/claude-install-kind.js.map +1 -0
- package/dist/daemon.d.ts +13 -1
- package/dist/daemon.js +54 -9
- package/dist/daemon.js.map +1 -1
- package/dist/dispatcher-liveness.js +2 -2
- package/dist/dispatcher-liveness.js.map +1 -1
- package/dist/fleet-manager.d.ts +110 -1
- package/dist/fleet-manager.js +387 -25
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +7 -0
- package/dist/general-knowledge/skills/hub/SKILL.md +25 -0
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +6 -0
- package/dist/hub/agent-intro-model.d.ts +38 -0
- package/dist/hub/agent-intro-model.js +14 -0
- package/dist/hub/agent-intro-model.js.map +1 -0
- package/dist/hub/agent-intro-tool.d.ts +35 -0
- package/dist/hub/agent-intro-tool.js +83 -0
- package/dist/hub/agent-intro-tool.js.map +1 -0
- package/dist/hub/client.d.ts +1 -0
- package/dist/hub/client.js +26 -0
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +13 -5
- package/dist/hub/compose/member.js +28 -5
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +1 -0
- package/dist/hub/compose/server.js +5 -1
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/http/compose.d.ts +1 -0
- package/dist/hub/http/compose.js +28 -5
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/schema.js +6 -0
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/member/agent-intro.d.ts +28 -0
- package/dist/hub/member/agent-intro.js +66 -0
- package/dist/hub/member/agent-intro.js.map +1 -0
- package/dist/hub/member/room-ask.d.ts +10 -0
- package/dist/hub/member/room-ask.js +70 -7
- package/dist/hub/member/room-ask.js.map +1 -1
- package/dist/hub/member/room-notification.d.ts +1 -1
- package/dist/hub/member/room-post.d.ts +6 -3
- package/dist/hub/member/room-post.js +9 -3
- package/dist/hub/member/room-post.js.map +1 -1
- package/dist/hub/protocol.d.ts +172 -4
- package/dist/hub/protocol.js +10 -5
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/room-answer-status-model.d.ts +3 -0
- package/dist/hub/room-answer-status-model.js +4 -0
- package/dist/hub/room-answer-status-model.js.map +1 -0
- package/dist/hub/room-brief-model.d.ts +30 -0
- package/dist/hub/room-brief-model.js +37 -0
- package/dist/hub/room-brief-model.js.map +1 -0
- package/dist/hub/room-context-model.d.ts +2 -0
- package/dist/hub/room-context-model.js +2 -2
- package/dist/hub/room-context-model.js.map +1 -1
- package/dist/hub/room-members-model.d.ts +63 -0
- package/dist/hub/room-members-model.js +7 -0
- package/dist/hub/room-members-model.js.map +1 -0
- package/dist/hub/rooms/agents.js +50 -10
- package/dist/hub/rooms/agents.js.map +1 -1
- package/dist/hub/rooms/brief.d.ts +18 -0
- package/dist/hub/rooms/brief.js +39 -0
- package/dist/hub/rooms/brief.js.map +1 -0
- package/dist/hub/rooms/members-page.d.ts +33 -0
- package/dist/hub/rooms/members-page.js +37 -0
- package/dist/hub/rooms/members-page.js.map +1 -0
- package/dist/hub/rooms/purpose.d.ts +7 -0
- package/dist/hub/rooms/purpose.js +14 -0
- package/dist/hub/rooms/purpose.js.map +1 -0
- package/dist/hub/rooms/service.d.ts +11 -0
- package/dist/hub/rooms/service.js +56 -12
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +6 -2
- package/dist/hub/runtime.d.ts +1 -1
- package/dist/hub/server.js +27 -1
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/types.d.ts +9 -5
- package/dist/hub-room-reply-warning.d.ts +2 -0
- package/dist/hub-room-reply-warning.js +16 -0
- package/dist/hub-room-reply-warning.js.map +1 -0
- package/dist/instance-lifecycle.d.ts +18 -0
- package/dist/instance-lifecycle.js +43 -4
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +26 -0
- package/dist/locale.js.map +1 -1
- package/dist/login-controller.d.ts +26 -0
- package/dist/login-controller.js +72 -2
- package/dist/login-controller.js.map +1 -1
- package/dist/native-mcp.js +1 -1
- package/dist/native-mcp.js.map +1 -1
- package/dist/needs-you-hub.js +1 -1
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +12 -1
- package/dist/needs-you.js +9 -0
- 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 +2 -1
- package/dist/outbound-handlers.js +19 -4
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +10 -0
- package/dist/outbound-schemas.js +3 -1
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/pause-marker.d.ts +1 -1
- package/dist/pause-marker.js +1 -1
- package/dist/pause-marker.js.map +1 -1
- package/dist/public-web-gateway.d.ts +20 -0
- package/dist/public-web-gateway.js +66 -5
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/restart-progress.d.ts +6 -0
- package/dist/restart-progress.js +5 -0
- package/dist/restart-progress.js.map +1 -1
- package/dist/settings-effect.js +17 -1
- package/dist/settings-effect.js.map +1 -1
- package/dist/tool-permissions.js +3 -3
- package/dist/tool-permissions.js.map +1 -1
- package/dist/ui/accounts-keepalive.js +2 -1
- package/dist/ui/accounts-view.js +2 -1
- package/dist/ui/chat-quote.js +3 -261
- package/dist/ui/fleet-canvas.js +3 -1
- package/dist/ui/fleet-office-skin.js +4 -3
- package/dist/ui/fleet-route.js +44 -6
- package/dist/ui/fleet-task-view.js +2 -1
- package/dist/ui/host-install.js +82 -5
- package/dist/ui/hub-agent-intro.js +15 -6
- package/dist/ui/hub-ai-apps.js +2 -1
- package/dist/ui/hub-attachments.js +81 -3
- package/dist/ui/hub-chat-strings.js +2 -1
- package/dist/ui/hub-client.js +4 -0
- package/dist/ui/hub-grant-picker.js +2 -1
- package/dist/ui/hub-group-strings.js +2 -1
- package/dist/ui/hub-intro-notice.js +16 -0
- package/dist/ui/hub-my-agents.js +7 -3
- package/dist/ui/hub-owner-strings.js +2 -1
- package/dist/ui/hub-personal-agent.js +2 -1
- package/dist/ui/hub-quota.js +2 -1
- package/dist/ui/hub-roles-strings.js +2 -1
- package/dist/ui/hub-room-composer.js +10 -2
- package/dist/ui/hub-room-list.js +1 -1
- package/dist/ui/hub-room-members.js +2 -0
- package/dist/ui/hub-room-new-strings.js +2 -1
- package/dist/ui/hub-room-new.js +7 -4
- package/dist/ui/hub-room-purpose.js +19 -0
- package/dist/ui/hub-room-search.js +1 -1
- package/dist/ui/hub-room-settings.js +9 -0
- package/dist/ui/hub-room-source.js +2 -1
- package/dist/ui/hub-room-strings.js +6 -4
- package/dist/ui/hub-room-thread.js +68 -17
- package/dist/ui/hub-strings.js +2 -1
- package/dist/ui/hub-teams.js +2 -1
- package/dist/ui/model-picker.js +3 -2
- package/dist/ui/panel-chat.js +25 -7
- package/dist/ui/panel-hub.js +67 -20
- package/dist/ui/panel-needs.js +3 -2
- package/dist/ui/panel-runtimes.js +2 -1
- package/dist/ui/reply-file-preview.js +2 -1
- package/dist/ui/settings-access-overview.js +2 -1
- package/dist/ui/settings-connector.js +2 -1
- package/dist/ui/shared/agent-sheet.js +2 -1
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app-shell.js +39 -9
- package/dist/ui/shared/app.css +11 -0
- package/dist/ui/shared/app.js +3 -1
- package/dist/ui/shared/asset-url.d.ts +2 -0
- package/dist/ui/shared/asset-url.js +20 -0
- package/dist/ui/shared/chat-msg-actions.js +3 -1
- package/dist/ui/shared/chat-quote.js +261 -0
- package/dist/ui/shared/chat-table-select.js +175 -0
- package/dist/ui/shared/hub-chat.css +28 -0
- package/dist/ui/shared/hub-rooms-u2.css +5 -0
- package/dist/ui/shared/image-annotate.js +2 -1
- package/dist/ui/shared/module-warm.d.ts +3 -0
- package/dist/ui/shared/module-warm.js +39 -0
- package/dist/ui/shared/ui-states.js +3 -2
- package/dist/ui/shared/view-history.js +2 -1
- package/dist/ui/subagent-row.js +3 -2
- package/dist/ui/usage-pool.js +2 -1
- package/dist/ui/workspace-panel.js +2 -1
- package/dist/wake-coordinator.js +3 -2
- package/dist/wake-coordinator.js.map +1 -1
- package/dist/web-api.d.ts +17 -4
- package/dist/web-api.js +83 -6
- package/dist/web-api.js.map +1 -1
- package/dist/web-asset-version.d.ts +65 -0
- package/dist/web-asset-version.js +259 -0
- package/dist/web-asset-version.js.map +1 -0
- package/dist/web-host-guard.js +3 -1
- package/dist/web-host-guard.js.map +1 -1
- package/dist/web-host-install.d.ts +30 -3
- package/dist/web-host-install.js +50 -4
- package/dist/web-host-install.js.map +1 -1
- package/dist/web-terminal.d.ts +5 -0
- package/dist/web-terminal.js +11 -0
- package/dist/web-terminal.js.map +1 -1
- package/launcher/agend-install.cjs +48 -7
- package/package.json +1 -1
|
@@ -47,6 +47,7 @@ import { t } from "/assets/app-i18n.js";
|
|
|
47
47
|
import { frameAt, nameHash } from "./fleet-office-model.js";
|
|
48
48
|
import { CHAR_DEPTH, LOGICAL, checkSkinPack, own, packPortraitImages, packSceneImages, poseStrip, stripBox, walkStrip } from "./fleet-office-pack.js";
|
|
49
49
|
import { tierColours } from "./fleet-office-levels.js";
|
|
50
|
+
import { assetUrl } from "/assets/asset-url.js";
|
|
50
51
|
|
|
51
52
|
export { nameHash };
|
|
52
53
|
|
|
@@ -615,7 +616,7 @@ export function spriteSkin(pack, images, base = pixelSkin) {
|
|
|
615
616
|
// ── The built-in cozy (#2631): the zones layout on a warm pixel-art office drawn as one picture, the built-in people ──
|
|
616
617
|
|
|
617
618
|
/** Its picture, shipped with the page (src/ui/shared/office/cozy.png, auth-api.ts ASSETS: public static, as the font). */
|
|
618
|
-
export const COZY_BACKGROUND = "/assets/office-cozy.png";
|
|
619
|
+
export const COZY_BACKGROUND = assetUrl("/assets/office-cozy.png");
|
|
619
620
|
const pts = (...xy) => xy.map(([x, y]) => ({ x, y }));
|
|
620
621
|
// The seats are feet points on the picture: chairs in front of the desks, the sofa, the coffee table and machine, the
|
|
621
622
|
// beanbags (a sleeper's bottom), in front of the whiteboard. The rects put a crowd's first extra spots (fleet-office-zones.js
|
|
@@ -662,7 +663,7 @@ const wps = (list) => list.map(([id, x, y]) => ({ id, x, y }));
|
|
|
662
663
|
// alert corner bottom-right, one straight aisle up the middle from a bottom-centre door ──
|
|
663
664
|
|
|
664
665
|
/** The guild: a fantasy adventurers' guild hall (src/ui/shared/office/guild.png). */
|
|
665
|
-
export const GUILD_BACKGROUND = "/assets/office-guild.png";
|
|
666
|
+
export const GUILD_BACKGROUND = assetUrl("/assets/office-guild.png");
|
|
666
667
|
// Seats: the chairs at the six map desks, the tavern bench, the stools round the table, the bar; the inn beds (a sleeper's
|
|
667
668
|
// middle); in front of the quest board.
|
|
668
669
|
const GUILD_AREAS = {
|
|
@@ -696,7 +697,7 @@ export const GUILD_PACK = {
|
|
|
696
697
|
};
|
|
697
698
|
|
|
698
699
|
/** The school: a classroom (src/ui/shared/office/school.png). */
|
|
699
|
-
export const SCHOOL_BACKGROUND = "/assets/office-school.png";
|
|
700
|
+
export const SCHOOL_BACKGROUND = assetUrl("/assets/office-school.png");
|
|
700
701
|
// Seats: the chairs at the six student desks; the sofa, the two stools, the vending machine; the nurse's beds; in front
|
|
701
702
|
// of the chalkboard.
|
|
702
703
|
const SCHOOL_AREAS = {
|
package/dist/ui/fleet-route.js
CHANGED
|
@@ -7,6 +7,46 @@ import { routeOk } from "./fleet-route-scene.js";
|
|
|
7
7
|
|
|
8
8
|
export const WORKER_URL = "/ui/js/fleet-route-worker.js";
|
|
9
9
|
export const WASM_URL = "/ui/vendor/libavoid-0.4.5/libavoid.wasm";
|
|
10
|
+
export const LIBAVOID_JS = "/ui/vendor/libavoid-0.4.5/libavoid.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* M-3328 (measured in M-3316): the worker under this module's own version. A worker does not use the page's import
|
|
14
|
+
* map, so a plain WORKER_URL was a `no-store` request on every open, and its `./fleet-route-scene.js` and
|
|
15
|
+
* `./fleet-canvas-layout.js` plain copies of modules the page already holds under its version. Under the version, its
|
|
16
|
+
* relative imports are the page's own (cached) files, and a tab older than the server asks for its own version: the
|
|
17
|
+
* stale-module answer fails the worker, and the lines keep their lane routes — never a newer worker in an older page.
|
|
18
|
+
* Loaded by a plain path (the office share page, tests), the plain WORKER_URL.
|
|
19
|
+
*/
|
|
20
|
+
export function workerUrlFor(url) {
|
|
21
|
+
const m = /\/ui\/js\/(v-[0-9a-f]{12})\/[^/?#]+(?:[?#].*)?$/.exec(String(url || ""));
|
|
22
|
+
return m ? `/ui/js/${m[1]}/fleet-route-worker.js` : WORKER_URL;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const wasmBytes = async (get) => {
|
|
26
|
+
const res = await get(WASM_URL, { credentials: "same-origin" });
|
|
27
|
+
if (!res.ok) throw new Error(`libavoid.wasm: ${res.status}`);
|
|
28
|
+
return res.arrayBuffer();
|
|
29
|
+
};
|
|
30
|
+
let warmed = null;
|
|
31
|
+
/**
|
|
32
|
+
* M-3328: with the org chart's Live traffic on, everything the router needs is asked for at once — the .wasm, libavoid's
|
|
33
|
+
* glue and (under a version, where the answer is cached for good) the worker — instead of one after another once the
|
|
34
|
+
* first scene is routed (.wasm, then the worker, then its imports: about 1.7 s over a slow link). Once per page; a
|
|
35
|
+
* failed .wasm is asked for again by the next try. The bytes it fetched are what the client starts the worker with.
|
|
36
|
+
*/
|
|
37
|
+
export function warmRouter(get = (...a) => fetch(...a), url = import.meta.url) {
|
|
38
|
+
if (warmed) return warmed;
|
|
39
|
+
const worker = workerUrlFor(url);
|
|
40
|
+
for (const u of worker === WORKER_URL ? [LIBAVOID_JS] : [worker, LIBAVOID_JS]) {
|
|
41
|
+
Promise.resolve().then(() => get(u, { credentials: "same-origin" })).then((r) => r && r.arrayBuffer && r.arrayBuffer()).catch(() => {});
|
|
42
|
+
}
|
|
43
|
+
const p = wasmBytes(get);
|
|
44
|
+
warmed = p;
|
|
45
|
+
p.catch(() => { if (warmed === p) warmed = null; });
|
|
46
|
+
return p;
|
|
47
|
+
}
|
|
48
|
+
/** Tests: forget the warmed bytes. */
|
|
49
|
+
export function resetRouterWarm() { warmed = null; }
|
|
10
50
|
export const TIMEOUT_MS = 4000;
|
|
11
51
|
const FAIL_LIMIT = 2;
|
|
12
52
|
|
|
@@ -17,6 +57,7 @@ const FAIL_LIMIT = 2;
|
|
|
17
57
|
export function createRouteClient(deps = {}) {
|
|
18
58
|
const W = deps.Worker ?? (typeof Worker === "function" ? Worker : null);
|
|
19
59
|
const get = deps.fetch ?? ((...a) => fetch(...a));
|
|
60
|
+
const workerUrl = deps.workerUrl ?? workerUrlFor(import.meta.url);
|
|
20
61
|
const timers = deps.timers ?? { set: (f, ms) => setTimeout(f, ms), clear: (t) => clearTimeout(t) };
|
|
21
62
|
let worker = null, wasm = null, fails = 0, nextId = 1;
|
|
22
63
|
let busy = null, waiting = null; // { id, scene, resolve, timer }
|
|
@@ -29,15 +70,12 @@ export function createRouteClient(deps = {}) {
|
|
|
29
70
|
pump();
|
|
30
71
|
};
|
|
31
72
|
async function start(job) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (!res.ok) throw new Error(`libavoid.wasm: ${res.status}`);
|
|
35
|
-
wasm = await res.arrayBuffer();
|
|
36
|
-
}
|
|
73
|
+
// The bytes warmRouter fetched when Live was turned on (this page's), else fetched now.
|
|
74
|
+
if (!wasm) wasm = await (warmed ? warmed.catch(() => wasmBytes(get)) : wasmBytes(get));
|
|
37
75
|
// #2194 review: closed, timed out or replaced while the .wasm was on its way — start nothing (a worker made now
|
|
38
76
|
// would be nobody's, and a later start would make another).
|
|
39
77
|
if (busy !== job || worker) return;
|
|
40
|
-
const w = new W(
|
|
78
|
+
const w = new W(workerUrl, { type: "module" });
|
|
41
79
|
w.onmessage = (ev) => {
|
|
42
80
|
const m = ev.data;
|
|
43
81
|
if (!m || typeof m !== "object" || w !== worker) return;
|
|
@@ -10,13 +10,14 @@ import { t, register, lang } from "/assets/app-i18n.js";
|
|
|
10
10
|
import { Icon } from "/assets/ui-icons.js";
|
|
11
11
|
import { Menu } from "/assets/ui-menu.js";
|
|
12
12
|
import { COLUMNS, ProgressBar, UNASSIGNED, Who, readStored, recentlyDone, relTime, reviewLabel, waitsForYou, wrapUpText, writeStored } from "./fleet-task-common.js";
|
|
13
|
+
import { assetUrl } from "/assets/asset-url.js";
|
|
13
14
|
|
|
14
15
|
/** The task board's stylesheet, linked once (a tab opened before an upgrade has an app.css without these rules). */
|
|
15
16
|
export function linkTaskBoardCss(doc = typeof document !== "undefined" ? document : null) {
|
|
16
17
|
try {
|
|
17
18
|
if (!doc || !doc.head || doc.querySelector('link[data-tb-css="1"]')) return;
|
|
18
19
|
const link = doc.createElement("link");
|
|
19
|
-
link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/task-board.css"); link.setAttribute("data-tb-css", "1");
|
|
20
|
+
link.setAttribute("rel", "stylesheet"); link.setAttribute("href", assetUrl("/assets/task-board.css")); link.setAttribute("data-tb-css", "1");
|
|
20
21
|
doc.head.appendChild(link);
|
|
21
22
|
} catch { /* the board still works without it */ }
|
|
22
23
|
}
|
package/dist/ui/host-install.js
CHANGED
|
@@ -9,6 +9,7 @@ import { register, t } from "/assets/app-i18n.js";
|
|
|
9
9
|
import { createStore, useStore } from "/assets/app-store.js";
|
|
10
10
|
import { toast } from "/assets/ui-toast.js";
|
|
11
11
|
import { confirmedWrite } from "./settings-confirm.js";
|
|
12
|
+
import { assetUrl } from "/assets/asset-url.js";
|
|
12
13
|
|
|
13
14
|
register("hostinstall", {
|
|
14
15
|
en: {
|
|
@@ -23,7 +24,7 @@ register("hostinstall", {
|
|
|
23
24
|
output: "Installer output (last lines)",
|
|
24
25
|
started: "Installing {0}…", confirm: "Install {0} on the AgEnD host",
|
|
25
26
|
err_unsupported: "This CLI cannot be installed from here.", err_already: "{0} is already installed on this host.",
|
|
26
|
-
err_busy: "Another install or sign-in is running. Wait for it to end, or cancel it.", err_shutting_down: "AgEnD is shutting down.",
|
|
27
|
+
err_busy: "Another install or sign-in is running. Wait for it to end, or cancel it.", err_cli_self_updating: "{0} is updating itself right now. Try again in a few minutes.", err_shutting_down: "AgEnD is shutting down.",
|
|
27
28
|
err_not_allowed: "Only a fleet admin signed in on this machine or its network can install a CLI.",
|
|
28
29
|
err_install_needs_a_local_admin: "Only a fleet admin signed in on this machine or its network can install a CLI.",
|
|
29
30
|
err_install_not_over_public_link: "Installing is not available over the public link. Open the dashboard on the machine running AgEnD.",
|
|
@@ -44,7 +45,7 @@ register("hostinstall", {
|
|
|
44
45
|
output: "安裝程式輸出(最後幾行)",
|
|
45
46
|
started: "正在安裝 {0}…", confirm: "在 AgEnD 主機上安裝 {0}",
|
|
46
47
|
err_unsupported: "這個 CLI 不能從這裡安裝。", err_already: "這台主機已經安裝 {0}。",
|
|
47
|
-
err_busy: "另一個安裝或登入正在進行。請等它結束,或先取消它。", err_shutting_down: "AgEnD 正在關閉。",
|
|
48
|
+
err_busy: "另一個安裝或登入正在進行。請等它結束,或先取消它。", err_cli_self_updating: "{0} 正在自行更新,請過幾分鐘再試。", err_shutting_down: "AgEnD 正在關閉。",
|
|
48
49
|
err_not_allowed: "只有在這台機器或它的網路上登入的 fleet 管理員,才能安裝 CLI。",
|
|
49
50
|
err_install_needs_a_local_admin: "只有在這台機器或它的網路上登入的 fleet 管理員,才能安裝 CLI。",
|
|
50
51
|
err_install_not_over_public_link: "公開連結上不能安裝。請在執行 AgEnD 的機器上開啟儀表板。",
|
|
@@ -110,11 +111,53 @@ register("hostinstall", {
|
|
|
110
111
|
updatedLatestNoVersion: "{0} 的更新程式已結束(結束碼 0),但之後讀不到已安裝的版本,不確定現在是哪個版本。",
|
|
111
112
|
},
|
|
112
113
|
});
|
|
114
|
+
// M-3307 (#4146): an npm-global Claude Code is offered a switch to Claude's native install (the audited release through claude.ai/install.sh, in the same window), and afterwards
|
|
115
|
+
// the removal of the npm copy as a separate step that says what it removes. Both are held changes like Install and Update; the page names only "claude-code".
|
|
116
|
+
register("hostinstall", {
|
|
117
|
+
en: {
|
|
118
|
+
nativeOffer: "Claude Code is installed with npm ({0}). An AgEnD restart can interrupt npm's own updates and leave `claude` half-installed. Claude's native install avoids that: switching installs {1}, the release AgEnD has audited, with claude.ai/install.sh.",
|
|
119
|
+
nativeSwitch: "Switch to native install", cardLabelNative: "Switch Claude Code on this AgEnD computer to Claude's native install",
|
|
120
|
+
runningNative: "Installing Claude Code {0} with Claude's native installer (started on {1}).",
|
|
121
|
+
nativeOk: "`claude` now runs from Claude's native install: {0} ({1}).",
|
|
122
|
+
nativeStillNpm: "The native installer finished, but `claude` still runs the npm copy ({0}), which comes first on PATH. Removing the npm copy finishes the switch.",
|
|
123
|
+
nativeUnverified: "The native installer finished, but `claude` could not be found afterwards. Read its last lines below.",
|
|
124
|
+
failedNative: "The switch to Claude's native install did not finish.",
|
|
125
|
+
npmLeft: "The npm copy is still at {0}. Removing it runs npm -g uninstall @anthropic-ai/claude-code in that npm folder; Claude's native install stays.",
|
|
126
|
+
npmRemove: "Remove the npm copy", cardLabelNpmRemove: "Remove the npm copy of Claude Code from this AgEnD computer",
|
|
127
|
+
runningNpmRemove: "Removing the npm copy of Claude Code (started on {0}).",
|
|
128
|
+
npmRemoved: "The npm copy was removed. `claude` runs {0} ({1}).",
|
|
129
|
+
npmNotRemoved: "npm finished, but the npm copy is still at {0}. Read its last lines below: removing it may need the account that installed it.",
|
|
130
|
+
failedNpmRemove: "The npm copy was not removed.",
|
|
131
|
+
err_not_npm: "Claude Code here is not an npm install, so there is nothing to switch.",
|
|
132
|
+
err_still_npm: "There is no native install of Claude Code yet: switch to it first, then remove the npm copy.",
|
|
133
|
+
err_no_npm_copy: "There is no npm copy of Claude Code to remove.",
|
|
134
|
+
err_npm_busy: "Another npm is installing or updating packages on this computer right now (an agent's Claude Code may be updating itself). Nothing was removed: try again in a few minutes.",
|
|
135
|
+
},
|
|
136
|
+
"zh-TW": {
|
|
137
|
+
nativeOffer: "Claude Code 是用 npm 安裝的({0})。AgEnD 重啟時可能打斷 npm 自己的更新,讓 `claude` 只裝了一半。改用 Claude 的原生安裝就不會這樣:切換會用 claude.ai/install.sh 安裝 {1},也就是 AgEnD 稽核過的版本。",
|
|
138
|
+
nativeSwitch: "改用原生安裝", cardLabelNative: "把這台 AgEnD 電腦上的 Claude Code 改成 Claude 的原生安裝",
|
|
139
|
+
runningNative: "正在用 Claude 的原生安裝程式安裝 Claude Code {0}(從 {1} 啟動)。",
|
|
140
|
+
nativeOk: "`claude` 現在使用 Claude 的原生安裝:{0}({1})。",
|
|
141
|
+
nativeStillNpm: "原生安裝程式已結束,但 `claude` 仍然執行 npm 那份({0}),因為它在 PATH 上比較前面。移除 npm 那份就能完成切換。",
|
|
142
|
+
nativeUnverified: "原生安裝程式已結束,但之後找不到 `claude`。請看下方它的最後幾行。",
|
|
143
|
+
failedNative: "改用 Claude 原生安裝沒有完成。",
|
|
144
|
+
npmLeft: "npm 那份還在 {0}。移除會在那個 npm 目錄執行 npm -g uninstall @anthropic-ai/claude-code;Claude 的原生安裝會保留。",
|
|
145
|
+
npmRemove: "移除 npm 那份", cardLabelNpmRemove: "從這台 AgEnD 電腦移除 npm 安裝的 Claude Code",
|
|
146
|
+
runningNpmRemove: "正在移除 npm 安裝的 Claude Code(從 {0} 啟動)。",
|
|
147
|
+
npmRemoved: "已移除 npm 那份。`claude` 現在執行 {0}({1})。",
|
|
148
|
+
npmNotRemoved: "npm 已結束,但 npm 那份還在 {0}。請看下方它的最後幾行:可能需要當初安裝它的帳號才能移除。",
|
|
149
|
+
failedNpmRemove: "npm 那份沒有移除。",
|
|
150
|
+
err_not_npm: "這裡的 Claude Code 不是用 npm 安裝的,不需要切換。",
|
|
151
|
+
err_still_npm: "還沒有 Claude Code 的原生安裝:請先改用原生安裝,再移除 npm 那份。",
|
|
152
|
+
err_no_npm_copy: "沒有 npm 安裝的 Claude Code 可以移除。",
|
|
153
|
+
err_npm_busy: "這台電腦上有另一個 npm 正在安裝或更新套件(可能是 agent 的 Claude Code 在自行更新)。沒有移除任何東西,請過幾分鐘再試。",
|
|
154
|
+
},
|
|
155
|
+
});
|
|
113
156
|
const th = (k, ...v) => t(`hostinstall.${k}`, ...v);
|
|
114
157
|
function installStyles() {
|
|
115
|
-
if (typeof document === "undefined" || !document.head || document.querySelector(
|
|
158
|
+
if (typeof document === "undefined" || !document.head || document.querySelector(`link[href="${assetUrl("/assets/host-install.css")}"]`)) return;
|
|
116
159
|
const link = document.createElement("link");
|
|
117
|
-
link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/host-install.css"); document.head.appendChild(link);
|
|
160
|
+
link.setAttribute("rel", "stylesheet"); link.setAttribute("href", assetUrl("/assets/host-install.css")); document.head.appendChild(link);
|
|
118
161
|
}
|
|
119
162
|
function revealPending(id) {
|
|
120
163
|
const show = () => Array.from(document.querySelectorAll("[data-pending]")).find(n => n.getAttribute("data-pending") === id)?.scrollIntoView?.({ block: "center" });
|
|
@@ -181,6 +224,9 @@ export const startHostInstall = (backend) => startHostCli("/ui/host-install", ba
|
|
|
181
224
|
/** Update `backend` on the host to the audited release (AGEND-136). */
|
|
182
225
|
/** AGEND-154 (Prism P2-1 on #3552): the update to the vendor's latest (`latest`, the one named exception) says so in the request — `acceptLatestUnaudited: true` — which is what lets the server run it; a page without this line sends `{ backend }`, and the server refuses. */
|
|
183
226
|
export const startHostUpdate = (backend, latest = false) => startHostCli("/ui/host-update", backend, latest ? "cardLabelUpdateLatest" : "cardLabelUpdate", latest ? { acceptLatestUnaudited: true } : {});
|
|
227
|
+
/** M-3307: switch the host's npm-global Claude Code to Claude's native install; then, a separate step, remove the npm copy. */
|
|
228
|
+
export const startHostNativeSwitch = () => startHostCli("/ui/host-native-switch", "claude-code", "cardLabelNative");
|
|
229
|
+
export const startHostNpmRemove = () => startHostCli("/ui/host-npm-remove", "claude-code", "cardLabelNpmRemove");
|
|
184
230
|
|
|
185
231
|
export async function cancelHostInstall() {
|
|
186
232
|
const r = await post("/ui/host-install/cancel", {});
|
|
@@ -240,6 +286,14 @@ export function VersionLine({ row, label, blocked = false }) {
|
|
|
240
286
|
return html`<div class="s-account-version" data-cli-update=${u.state} data-via=${u.via} data-latest=${u.latest ? "1" : "0"}>
|
|
241
287
|
<p class="note s-account-why">${text}</p>
|
|
242
288
|
${u.button ? html`<span class="s-actions"><button type="button" class="btn btn-sm btn-primary s-account-update" aria-label=${`${label} — ${buttonLabel}`} disabled=${blocked || installRunning(state)} onClick=${() => { void startHostUpdate(row.backend, !!u.latest); }}>${updating ? th("updating") : buttonLabel}</button></span>` : null}
|
|
289
|
+
${row.npmLeftover && row.backend === "claude-code" && !(runFor(state, row.backend) && runFor(state, row.backend).claude && runFor(state, row.backend).claude.npmLeftover) ? html`<div class="s-account-native" data-npm-left="1">
|
|
290
|
+
<p class="note s-account-why">${th("npmLeft", row.npmLeftover.dir)}</p>
|
|
291
|
+
<span class="s-actions"><button type="button" class="btn btn-sm btn-primary s-account-npm-remove" disabled=${blocked || installRunning(state)} onClick=${() => { void startHostNpmRemove(); }}>${th("npmRemove")}</button></span>
|
|
292
|
+
</div>` : null}
|
|
293
|
+
${row.nativeSwitch && row.backend === "claude-code" ? html`<div class="s-account-native" data-native-offer="1">
|
|
294
|
+
<p class="note s-account-why">${th("nativeOffer", row.nativeSwitch.npmPackageDir, u.audited)}</p>
|
|
295
|
+
<span class="s-actions"><button type="button" class="btn btn-sm btn-primary s-account-native-switch" aria-label=${`${label} — ${th("nativeSwitch")}`} disabled=${blocked || installRunning(state)} onClick=${() => { void startHostNativeSwitch(); }}>${th("nativeSwitch")}</button></span>
|
|
296
|
+
</div>` : null}
|
|
243
297
|
</div>`;
|
|
244
298
|
}
|
|
245
299
|
|
|
@@ -259,7 +313,26 @@ export function HostInstallRun({ backend, label }) {
|
|
|
259
313
|
const lines = Array.isArray(run.lines) ? run.lines : [];
|
|
260
314
|
let text, cls = "";
|
|
261
315
|
const update = run.mode === "update";
|
|
262
|
-
|
|
316
|
+
// M-3307: the switch and the removal say where `claude` resolves afterwards (a fresh login shell) and whether the npm copy is still there, with the removal offered on it.
|
|
317
|
+
const switching = run.mode === "native" || run.mode === "remove-npm";
|
|
318
|
+
const c = run.claude || null;
|
|
319
|
+
let npmLeft = null;
|
|
320
|
+
if (switching) {
|
|
321
|
+
if (run.phase === "running") text = run.mode === "native" ? th("runningNative", run.targetVersion || "?", run.startedOn) : th("runningNpmRemove", run.startedOn);
|
|
322
|
+
else if (run.phase === "ok" && run.mode === "native") {
|
|
323
|
+
if (!c || !c.path) { cls = "signin-message"; text = th("nativeUnverified"); }
|
|
324
|
+
else if (c.kind === "native") { cls = "signin-ok"; text = th("nativeOk", c.path, run.version || "?"); }
|
|
325
|
+
else { cls = "signin-warn"; text = th("nativeStillNpm", c.path); }
|
|
326
|
+
npmLeft = c && c.npmLeftover ? c.npmLeftover : null;
|
|
327
|
+
}
|
|
328
|
+
else if (run.phase === "ok") {
|
|
329
|
+
if (c && c.npmLeftover) { cls = "signin-warn"; text = th("npmNotRemoved", c.npmLeftover); }
|
|
330
|
+
else { cls = "signin-ok"; text = th("npmRemoved", (c && c.path) || "?", run.version || "?"); }
|
|
331
|
+
}
|
|
332
|
+
else if (run.phase === "failed" || run.phase === "timeout" || run.phase === "cancelled") text = th(run.mode === "native" ? "failedNative" : "failedNpmRemove");
|
|
333
|
+
}
|
|
334
|
+
if (switching) { /* said above */ }
|
|
335
|
+
else if (run.phase === "running") text = update ? (run.latest ? th("runningUpdateLatest", label, "", run.startedOn) : th("runningUpdate", label, run.targetVersion || "?", run.startedOn)) : th("running", label, run.startedOn);
|
|
263
336
|
else if (run.phase === "ok" && update) {
|
|
264
337
|
// An update says the version before and after (the binary probe's own readings). Exit code 0 is not enough: when the version read afterwards is not the audited release (`reached`
|
|
265
338
|
// false), or could not be read (null), it is a warning that names the installed and the audited version, not a success.
|
|
@@ -284,6 +357,10 @@ export function HostInstallRun({ backend, label }) {
|
|
|
284
357
|
${lines.length ? html`<pre class="s-account-install-output" aria-label=${th("output")}>${lines.join("\n")}</pre>`
|
|
285
358
|
: run.phase === "running" ? html`<small class="note">${th("runningNoOutput")}</small>` : null}
|
|
286
359
|
${run.cleanupFailed ? html`<p class="note">${th("cleanup")}</p>` : null}
|
|
360
|
+
${npmLeft ? html`<div class="s-account-native" data-npm-left="1">
|
|
361
|
+
<p class="note s-account-why">${th("npmLeft", npmLeft)}</p>
|
|
362
|
+
<span class="s-actions"><button type="button" class="btn btn-sm btn-primary s-account-npm-remove" disabled=${installRunning(state)} onClick=${() => { void startHostNpmRemove(); }}>${th("npmRemove")}</button></span>
|
|
363
|
+
</div>` : null}
|
|
287
364
|
<div class="s-actions">${run.phase === "running"
|
|
288
365
|
? html`<button type="button" class="btn btn-sm btn-ghost" disabled=${busy} onClick=${cancel}>${th(update ? "cancelUpdate" : "cancel")}</button>`
|
|
289
366
|
: html`<button type="button" class="btn btn-sm btn-ghost" onClick=${() => dismissHostInstall(run.id)}>${th("dismiss")}</button>`}</div>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
2
2
|
import { register, t } from "/assets/app-i18n.js";
|
|
3
3
|
register("hubIntro", {
|
|
4
|
-
en: {title:"Introduction",hint:"One line about what this agent handles. Colleagues can see it. Up to 50 characters.",placeholder:"I handle…",save:"Save introduction",failed:"Could not save the introduction. Try again.",saved:"
|
|
5
|
-
"zh-TW": {title:"自我介紹",hint:"用一句話說明這個 Agent 負責什麼,同仁會看到。最多 50 個字。",placeholder:"我負責…",save:"儲存自我介紹",failed:"無法儲存自我介紹,請再試一次。",saved:"
|
|
4
|
+
en: {title:"Introduction",hint:"One line about what this agent handles. Colleagues can see it. Up to 50 characters.",placeholder:"I handle…",save:"Save introduction",failed:"Could not save the introduction. Try again.",saved:"Saved. The agent can still change it later; this line shows who changed it last.",edit:"Edit",close:"Close",owner:"Last changed by the owner",agent:"Last changed by the agent",default:"From the Fleet description",review:"Colleagues will see this line. Check it and save.",cut:"Your earlier description was longer; only the first 50 characters are shown here.",assistant:"Hub assistant. Answers from this room's chat."},
|
|
5
|
+
"zh-TW": {title:"自我介紹",hint:"用一句話說明這個 Agent 負責什麼,同仁會看到。最多 50 個字。",placeholder:"我負責…",save:"儲存自我介紹",failed:"無法儲存自我介紹,請再試一次。",saved:"已儲存。Agent 之後仍然可以更改;這一行會顯示最後是誰改的。",edit:"編輯",close:"關閉",owner:"最後由擁有者修改",agent:"最後由 Agent 修改",default:"來自 Fleet 說明",review:"同仁會看到這一行,請確認後儲存。",cut:"你之前的說明比較長,這裡只顯示前 50 個字。",assistant:"Hub 提供的助理,根據這個房間的對話回答。"}
|
|
6
6
|
});
|
|
7
7
|
export const hi=(key,...args)=>t(`hubIntro.${key}`,...args);
|
|
8
8
|
const split=value=>[...new Intl.Segmenter(undefined,{granularity:"grapheme"}).segment(String(value??""))].map(v=>v.segment);
|
|
9
9
|
export const introCount=value=>split(value).length;
|
|
10
10
|
export const introPreview=value=>split(value).slice(0,50).join("");
|
|
11
|
-
export function AgentIntroEditor({exposure,client,onSaved=()=>{}}){
|
|
11
|
+
export function AgentIntroEditor({exposure,client,onSaved=()=>{},embedded=false}){
|
|
12
12
|
const [text,setText]=useState(exposure.intro??""),[busy,setBusy]=useState(false),[message,setMessage]=useState("");
|
|
13
13
|
const generation=useRef(0),pending=useRef(false);
|
|
14
14
|
useEffect(()=>{generation.current++;setText(exposure.intro??"");setMessage("");return()=>{generation.current++;};},[exposure.id,exposure.intro,exposure.introAt]);
|
|
@@ -17,10 +17,19 @@ export function AgentIntroEditor({exposure,client,onSaved=()=>{}}){
|
|
|
17
17
|
try{result=await client.saveAgentIntro(exposure.id,exposure.revision,text);}catch{result={ok:false};}
|
|
18
18
|
pending.current=false;if(mine!==generation.current)return;setBusy(false);setMessage(hi(result?.ok?"saved":"failed"));if(result?.ok)onSaved(result);
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
const Body=embedded?"div":"form";
|
|
21
|
+
return html`<section class=${embedded?"hub-agent-intro":"card hub-agent-intro"}>${embedded?null:html`<h3>${hi("title")}</h3>`}<${Body} class="form" onSubmit=${embedded?undefined:save}>
|
|
21
22
|
<label class="field"><span>${hi("title")}</span><input value=${text} placeholder=${hi("placeholder")} disabled=${busy} onInput=${e=>setText(e.target.value)} aria-invalid=${count>50?"true":null} /><small class="note">${`${hi("hint")} ${count}/50`}</small></label>
|
|
22
23
|
${exposure.introBy?html`<p class="note">${hi(exposure.introBy)}${exposure.introAt?html` · <time datetime=${new Date(exposure.introAt).toISOString()}>${new Date(exposure.introAt).toLocaleString()}</time>`:null}</p>`:null}
|
|
23
|
-
<div class="field-row"><button class="btn btn-sm btn-primary" disabled=${busy||count>50||text===(exposure.intro??"")}>${hi("save")}</button></div>
|
|
24
|
+
<div class="field-row"><button type=${embedded?"button":"submit"} onClick=${embedded?save:undefined} class="btn btn-sm btn-primary" disabled=${busy||count>50||text===(exposure.intro??"")}>${hi("save")}</button></div>
|
|
24
25
|
${message?html`<p role="status">${message}</p>`:null}
|
|
25
|
-
|
|
26
|
+
</${Body}></section>`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Form-free: the sharing dialog already owns the grant form. */
|
|
30
|
+
export function AgentIntroSharingPreview({exposure,client,onSaved=()=>{}}){
|
|
31
|
+
const [editing,setEditing]=useState(false),[saved,setSaved]=useState(null);
|
|
32
|
+
const value={...exposure,...saved},text=value.introBy?value.intro:(value.introDefault??value.intro??"");
|
|
33
|
+
return html`<div class="hub-intro-sharing-preview"><p class="note">${hi("title")}${text?`: ${text}`:""}</p><button type="button" class="btn btn-sm btn-ghost" onClick=${()=>setEditing(!editing)}>${hi(editing?"close":"edit")}</button>
|
|
34
|
+
${editing?html`<${AgentIntroEditor} embedded=${true} exposure=${{...value,intro:text}} client=${client} onSaved=${result=>{setSaved(result);setEditing(false);onSaved(result);}} />`:null}</div>`;
|
|
26
35
|
}
|
package/dist/ui/hub-ai-apps.js
CHANGED
|
@@ -4,13 +4,14 @@ import {lang} from "/assets/app-i18n.js";
|
|
|
4
4
|
import {hubConnectorPrompt} from "/assets/connector-prompt.js";
|
|
5
5
|
import {SubjectPicker,subjectText} from "./hub-subject-picker.js";
|
|
6
6
|
import {ha} from "./hub-ai-apps-strings.js";
|
|
7
|
+
import { assetUrl } from "/assets/asset-url.js";
|
|
7
8
|
|
|
8
9
|
export const APP_SCOPES=Object.freeze(["rooms:read","rooms:post","agents:ask"]);
|
|
9
10
|
const keys={"rooms:read":"read","rooms:post":"post","agents:ask":"ask"};
|
|
10
11
|
const styles=new WeakMap();
|
|
11
12
|
export function linkHubAppsCss(doc=typeof document==="undefined"?null:document){
|
|
12
13
|
if(!doc?.head)return Promise.resolve(false);if(styles.has(doc))return styles.get(doc);
|
|
13
|
-
const loaded=new Promise(resolve=>{const link=doc.createElement("link");link.setAttribute("rel","stylesheet");link.setAttribute("href","/assets/hub-ai-apps.css");link.setAttribute("data-hub-apps-css","1");
|
|
14
|
+
const loaded=new Promise(resolve=>{const link=doc.createElement("link");link.setAttribute("rel","stylesheet");link.setAttribute("href",assetUrl("/assets/hub-ai-apps.css"));link.setAttribute("data-hub-apps-css","1");
|
|
14
15
|
link.addEventListener("load",()=>resolve(true),{once:true});link.addEventListener("error",()=>{link.remove();styles.delete(doc);resolve(false);},{once:true});doc.head.appendChild(link);});styles.set(doc,loaded);return loaded;
|
|
15
16
|
}
|
|
16
17
|
function useStyle(){const[ready,setReady]=useState(null),[retry,setRetry]=useState(0);useEffect(()=>{let live=true;linkHubAppsCss().then(r=>{if(live)setReady(r);});return()=>{live=false;};},[retry]);return[ready,()=>setRetry(n=>n+1)];}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// stylesheet has had since the fleet chat's own attachments (.pending-files, .file-chip, .chip-x).
|
|
4
4
|
// The server decides everything: a room offers Attach only while its fleet link negotiated attachments-v1 (room.features);
|
|
5
5
|
// each file is uploaded on choice (typed by name, images by their bytes, within the limits), and Send names the ids.
|
|
6
|
-
import { html } from "/assets/app-html.js";
|
|
6
|
+
import { html, useEffect, useRef } from "/assets/app-html.js";
|
|
7
7
|
import { register, t } from "/assets/app-i18n.js";
|
|
8
8
|
import { Icon } from "/assets/ui-icons.js";
|
|
9
9
|
|
|
@@ -67,7 +67,8 @@ export async function uploadChosen(client, roomId, fileList, { current, set, ali
|
|
|
67
67
|
const room = Math.max(0, MAX_FILES - current().length);
|
|
68
68
|
if (chosen.length > room) refusals.push(hf("tooMany", MAX_FILES));
|
|
69
69
|
const admitted = chosen.slice(0, room).map((file) => ({ file, key: `${Date.now()}-${Math.random().toString(36).slice(2)}` }));
|
|
70
|
-
|
|
70
|
+
// M-3311 (3): a long paste's chip keeps its text, for the Fleet chat's 「改為文字」 (PendingFiles' onAsText).
|
|
71
|
+
if (admitted.length) set([...current(), ...admitted.map(({ file, key }) => ({ key, name: file.name, size: file.size, state: "uploading", ...(pastedTexts.has(file) ? { text: pastedTexts.get(file) } : {}) }))]);
|
|
71
72
|
for (const { file, key } of admitted) {
|
|
72
73
|
if (!alive()) break;
|
|
73
74
|
if (!current().some((f) => f.key === key)) continue;
|
|
@@ -80,11 +81,88 @@ export async function uploadChosen(client, roomId, fileList, { current, set, ali
|
|
|
80
81
|
return refusals;
|
|
81
82
|
}
|
|
82
83
|
|
|
84
|
+
// ── M-3308 / M-3311: the Fleet chat's paste and drop (panel-chat.js onPaste, its drag-and-drop), for a Hub conversation — a
|
|
85
|
+
// room and a 1:1 question alike, through their own Attach (`attach`: { onFiles(list) → refusals, left?() → files that still
|
|
86
|
+
// fit, notice?(text) }) and so the Hub's file rules (uploadChosen above). Words: the Fleet chat's own (chat.*).
|
|
87
|
+
|
|
88
|
+
/** Past this many characters a text paste goes as a text file (the Fleet chat's LONG_PASTE_CHARS, chat-render.js). */
|
|
89
|
+
export const LONG_PASTE_CHARS = 4000;
|
|
90
|
+
const isLongPaste = (text) => (globalThis.AgendChatRender?.isLongPaste ? globalThis.AgendChatRender.isLongPaste(text) : typeof text === "string" && text.length > LONG_PASTE_CHARS);
|
|
91
|
+
const stamp = () => new Date().toISOString().slice(0, 19).replace(/[-:T]/g, "");
|
|
92
|
+
const IMAGE_EXT = { "image/png": "png", "image/jpeg": "jpg", "image/gif": "gif", "image/webp": "webp" };
|
|
93
|
+
/**
|
|
94
|
+
* A pasted file as the Hub uploads it. A clipboard picture (a screen capture) may come with no name — the Hub refuses an
|
|
95
|
+
* upload without one — so it is named `screenshot-<time>.<png|jpg|…>` by its type; a named one (Chrome's "image.png", a
|
|
96
|
+
* copied file) keeps its own.
|
|
97
|
+
*/
|
|
98
|
+
export function pastedFile(file) {
|
|
99
|
+
if (!file || (file.name && file.name.trim())) return file;
|
|
100
|
+
const ext = IMAGE_EXT[file.type] || (String(file.type).startsWith("text/") ? "txt" : "bin");
|
|
101
|
+
return new File([file], `${String(file.type).startsWith("image/") ? "screenshot" : "pasted"}-${stamp()}.${ext}`, { type: file.type, lastModified: file.lastModified });
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* A paste into a Hub composer: its files are attached (the paste stops there unless text came with them); a text past
|
|
105
|
+
* LONG_PASTE_CHARS goes as `pasted-<time>.txt` — only when there is room for it (#4151 review: as the Fleet chat keeps it in the
|
|
106
|
+
* box when nothing more fits), and once attached it says so (the Fleet chat's notice). No `attach`: the box takes it, as ever.
|
|
107
|
+
*/
|
|
108
|
+
export function pasteToAttach(e, attach) {
|
|
109
|
+
if (!attach) return;
|
|
110
|
+
const list = e.clipboardData && e.clipboardData.files ? [...e.clipboardData.files] : [];
|
|
111
|
+
const text = e.clipboardData ? e.clipboardData.getData("text") : "";
|
|
112
|
+
if (list.length) { void attach.onFiles(list.map(pastedFile)); if (!text) e.preventDefault(); return; }
|
|
113
|
+
if (!isLongPaste(text)) return;
|
|
114
|
+
if (typeof attach.left === "function" && attach.left() < 1) { attach.notice?.(t("chat.pasteKeptAsText")); return; }
|
|
115
|
+
e.preventDefault();
|
|
116
|
+
const file = new File([text], `pasted-${stamp()}.txt`, { type: "text/plain" });
|
|
117
|
+
pastedTexts.set(file, text);
|
|
118
|
+
Promise.resolve(attach.onFiles([file])).then((refused) => { if (!refused || !refused.length) attach.notice?.(t("chat.pasteAttached", text.length.toLocaleString())); });
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* M-3311 (1): files dragged over a Hub conversation (the `.hub-chat-main` at `ref`) show where they go; a drop attaches them —
|
|
122
|
+
* the Fleet chat's own (counted, so moving over messages does not flicker). Nothing while the conversation takes no files.
|
|
123
|
+
*/
|
|
124
|
+
export function useFileDrop(ref, attach) {
|
|
125
|
+
const on = !!attach, latest = useRef(attach);
|
|
126
|
+
latest.current = attach; // the latest Attach (it closes over the conversation's current list), read at the drop
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
const el = ref.current; if (!el || !on) return undefined;
|
|
129
|
+
let depth = 0;
|
|
130
|
+
const hasFiles = (e) => !!(e.dataTransfer && [...(e.dataTransfer.types || [])].includes("Files"));
|
|
131
|
+
const enter = (e) => { if (hasFiles(e)) { depth++; el.classList.add("dragging"); } };
|
|
132
|
+
const over = (e) => { if (hasFiles(e)) e.preventDefault(); };
|
|
133
|
+
const leave = (e) => { if (hasFiles(e) && --depth <= 0) { depth = 0; el.classList.remove("dragging"); } };
|
|
134
|
+
const drop = (e) => {
|
|
135
|
+
depth = 0; el.classList.remove("dragging");
|
|
136
|
+
const files = e.dataTransfer && e.dataTransfer.files ? [...e.dataTransfer.files] : [];
|
|
137
|
+
if (!files.length) return;
|
|
138
|
+
e.preventDefault(); void latest.current?.onFiles(files.map(pastedFile));
|
|
139
|
+
};
|
|
140
|
+
el.addEventListener("dragenter", enter); el.addEventListener("dragover", over); el.addEventListener("dragleave", leave); el.addEventListener("drop", drop);
|
|
141
|
+
return () => { el.classList.remove("dragging"); el.removeEventListener("dragenter", enter); el.removeEventListener("dragover", over); el.removeEventListener("dragleave", leave); el.removeEventListener("drop", drop); };
|
|
142
|
+
}, [ref.current, on]);
|
|
143
|
+
}
|
|
144
|
+
/** M-3311 (3): what a long paste became a file of — its chip can put it back as text (the Fleet chat's 「改為文字」). */
|
|
145
|
+
const pastedTexts = new WeakMap();
|
|
146
|
+
/**
|
|
147
|
+
* M-3311 (3): a long paste's text back into the box — after what is there, on a new line (the Fleet chat's fileBackAsText) —
|
|
148
|
+
* through the box's own typing path (its value setter and an input event: the composer's draft takes it).
|
|
149
|
+
*/
|
|
150
|
+
export function putBackText(field, text) {
|
|
151
|
+
if (!field || typeof text !== "string") return;
|
|
152
|
+
const value = field.value || "", next = value ? `${value}\n${text}` : text;
|
|
153
|
+
const set = typeof HTMLTextAreaElement === "function" ? Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value")?.set : null;
|
|
154
|
+
if (set) set.call(field, next); else field.value = next;
|
|
155
|
+
field.dispatchEvent(new Event("input", { bubbles: true }));
|
|
156
|
+
}
|
|
157
|
+
/** Where a dragged file goes: the Fleet chat's drop card (shown by `.dragging` on the conversation). */
|
|
158
|
+
export const DropOverlay = () => html`<div data-trust="drop" class="drop-overlay" aria-hidden="true"><div class="drop-card"><${Icon} name="attach" size=${32} /><span>${t("chat.dropHere")}</span></div></div>`;
|
|
159
|
+
|
|
83
160
|
/** The files waiting under the composer. */
|
|
84
|
-
export function PendingFiles({ files, onRemove, formatSize = (n) => `${n} B` }) {
|
|
161
|
+
export function PendingFiles({ files, onRemove, onAsText = null, formatSize = (n) => `${n} B` }) {
|
|
85
162
|
if (!files.length) return null;
|
|
86
163
|
return html`<div class="pending-files hub-pending-files">${files.map((f) => html`<span key=${f.key} class="file-chip" data-state=${f.state}>
|
|
87
164
|
<span class="ic"><${Icon} name="file" size=${16} /></span><span class="nm">${f.name}</span>
|
|
88
165
|
<span class="sz">${f.state === "uploading" ? hf("uploading") : formatSize(f.size)}</span>
|
|
166
|
+
${typeof f.text === "string" && onAsText ? html`<button type="button" class="as-text" onClick=${() => onAsText(f.key)}>${t("chat.asText")}</button>` : null}
|
|
89
167
|
<button type="button" class="chip-x" title=${hf("remove", f.name)} aria-label=${hf("remove", f.name)} onClick=${() => onRemove(f.key)}><${Icon} name="close" size=${14} /></button></span>`)}</div>`;
|
|
90
168
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// its stylesheet. A module of its own (a tab opened before an upgrade holds an older hub-strings.js without these words,
|
|
3
3
|
// and an older hub.css without these rules). The thread's own words are the fleet chat's (/assets/chat-strings.js).
|
|
4
4
|
import { register, t } from "/assets/app-i18n.js";
|
|
5
|
+
import { assetUrl } from "/assets/asset-url.js";
|
|
5
6
|
|
|
6
7
|
register("hubChat", {
|
|
7
8
|
en: {
|
|
@@ -80,7 +81,7 @@ export function linkHubChatCss(doc = typeof document !== "undefined" ? document
|
|
|
80
81
|
try {
|
|
81
82
|
if (!doc || !doc.head || doc.querySelector('link[data-hub-chat-css="1"]')) return;
|
|
82
83
|
const link = doc.createElement("link");
|
|
83
|
-
link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/hub-chat.css"); link.setAttribute("data-hub-chat-css", "1");
|
|
84
|
+
link.setAttribute("rel", "stylesheet"); link.setAttribute("href", assetUrl("/assets/hub-chat.css")); link.setAttribute("data-hub-chat-css", "1");
|
|
84
85
|
doc.head.appendChild(link);
|
|
85
86
|
} catch { /* the chat still works without it */ }
|
|
86
87
|
}
|
package/dist/ui/hub-client.js
CHANGED
|
@@ -378,6 +378,9 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a), readTime
|
|
|
378
378
|
savePersonPrefs(sessionCsrf, favorites, onlyIfUnset = false) {
|
|
379
379
|
return sessionCsrf && sessionCsrf === csrf ? call("PUT", "/hub/v1/me/prefs", { favorites, onlyIfUnset }) : Promise.resolve(retired());
|
|
380
380
|
},
|
|
381
|
+
agentIntroDefaultsV1: true,
|
|
382
|
+
introNotice: () => call("GET", "/hub/v1/me/intro-notice"),
|
|
383
|
+
acknowledgeIntroNotice: () => call("DELETE", "/hub/v1/me/intro-notice"),
|
|
381
384
|
agentSharingV1: true,
|
|
382
385
|
ownAgents(scope) { return scope && scope === csrf ? call("GET", "/hub/v1/me/agents") : Promise.resolve(retired()); },
|
|
383
386
|
refreshOwnAgents(scope, fleetId) { return scope && scope === csrf ? call("POST", "/hub/v1/me/agents/refresh", { fleetId }) : Promise.resolve(retired()); },
|
|
@@ -447,6 +450,7 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a), readTime
|
|
|
447
450
|
/** → { ok, room, me: { role }, members: [Member], settings: { allMention, historyForNew } } */
|
|
448
451
|
room(roomId) { return call("GET", `/hub/v1/rooms/${id(roomId)}`); },
|
|
449
452
|
/** A group room: { name, people: [personId], teams: [teamId], groups: [groupId], agents: [exposureId], assistant }. */
|
|
453
|
+
roomPurposeV1: true,
|
|
450
454
|
createRoom(input) { return call("POST", "/hub/v1/rooms", input); },
|
|
451
455
|
/** { name?, allMention?, historyForNew?, assistant?, archived? } */
|
|
452
456
|
updateRoom(roomId, patch) { return call("PATCH", `/hub/v1/rooms/${id(roomId)}`, patch); },
|
|
@@ -4,6 +4,7 @@ import { register, t } from "/assets/app-i18n.js";
|
|
|
4
4
|
import { Dialog } from "/assets/ui-dialog.js";
|
|
5
5
|
import { SubjectPicker } from "./hub-subject-picker.js";
|
|
6
6
|
import { hubClient } from "./hub-client.js";
|
|
7
|
+
import { assetUrl } from "/assets/asset-url.js";
|
|
7
8
|
register("hubGrantPicker", {
|
|
8
9
|
en: {
|
|
9
10
|
title: "Allow access to {0}", kind: "Allow", person: "A person", group: "An AD security group", team: "A team", teamPick: "Choose a team", teamHint: "The team's current members may ask. Removing someone from the team ends that permission. The grant's expiry keeps running.", findPerson: "Find a person", query: "Name or login", hint: "Type 2 to 64 characters.",
|
|
@@ -28,7 +29,7 @@ export function linkHubGrantPickerCss(doc = typeof document !== "undefined" ? do
|
|
|
28
29
|
try {
|
|
29
30
|
if (!doc?.head || doc.querySelector('link[data-hub-grant-picker-css="1"]')) return;
|
|
30
31
|
const link = doc.createElement("link");
|
|
31
|
-
link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/hub-grant-picker.css"); link.setAttribute("data-hub-grant-picker-css", "1");
|
|
32
|
+
link.setAttribute("rel", "stylesheet"); link.setAttribute("href", assetUrl("/assets/hub-grant-picker.css")); link.setAttribute("data-hub-grant-picker-css", "1");
|
|
32
33
|
doc.head.appendChild(link);
|
|
33
34
|
} catch { /* The form's existing controls still work if the stylesheet cannot be linked. */ }
|
|
34
35
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// module so a tab holding an older hub-strings.js still draws these pages (retained-module SKEW). Preview; off unless the
|
|
3
3
|
// Hub's session says `group-policy-v1`.
|
|
4
4
|
import { register, t } from "/assets/app-i18n.js";
|
|
5
|
+
import { assetUrl } from "/assets/asset-url.js";
|
|
5
6
|
|
|
6
7
|
register("hubGroups", {
|
|
7
8
|
en: {
|
|
@@ -112,7 +113,7 @@ export function linkHubGroupsCss(doc = typeof document !== "undefined" ? documen
|
|
|
112
113
|
try {
|
|
113
114
|
if (!doc || !doc.head || doc.querySelector('link[data-hub-groups-css="1"]')) return;
|
|
114
115
|
const link = doc.createElement("link");
|
|
115
|
-
link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/hub-groups.css"); link.setAttribute("data-hub-groups-css", "1");
|
|
116
|
+
link.setAttribute("rel", "stylesheet"); link.setAttribute("href", assetUrl("/assets/hub-groups.css")); link.setAttribute("data-hub-groups-css", "1");
|
|
116
117
|
doc.head.appendChild(link);
|
|
117
118
|
} catch { /* the pages still work without it */ }
|
|
118
119
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {html,useEffect,useRef,useState} from "/assets/app-html.js";
|
|
2
|
+
import {register,t} from "/assets/app-i18n.js";
|
|
3
|
+
register("hubIntroNotice",{
|
|
4
|
+
en:{title:"Agent introductions",body:"Introductions now show for {0} of your agents. Review them.",more:"Introductions now show for {0} more of your agents, from {1}. Review them.",fleet:"a Fleet",review:"Review {0}",ack:"Done",failed:"Could not load the introduction notice. Try again.",saveFailed:"Could not dismiss the notice. Try again.",retry:"Try again"},
|
|
5
|
+
"zh-TW":{title:"Agent 自我介紹",body:"你的 {0} 個 Agent 現在會顯示自我介紹,請檢查內容。",more:"你在 {1} 的 {0} 個 Agent 現在也會顯示自我介紹,請檢查內容。",fleet:"一個 Fleet",review:"檢查 {0}",ack:"完成",failed:"無法載入自我介紹通知,請再試一次。",saveFailed:"無法關閉通知,請再試一次。",retry:"再試一次"}
|
|
6
|
+
});
|
|
7
|
+
const word=(key,...args)=>t(`hubIntroNotice.${key}`,...args);
|
|
8
|
+
export const introNoticeOffered=(session,client)=>session?.features?.includes("agent-intro-defaults-v1")&&client?.agentIntroDefaultsV1===true;
|
|
9
|
+
export function IntroNotice({client}){
|
|
10
|
+
const [notice,setNotice]=useState(null),[failed,setFailed]=useState(false),[busy,setBusy]=useState(false),epoch=useRef(0);
|
|
11
|
+
const load=async()=>{const mine=epoch.current;try{const out=await client.introNotice();if(mine!==epoch.current)return;if(!out.ok){setFailed(true);return;}setNotice(out.notice);setFailed(false);}catch{if(mine===epoch.current)setFailed(true);}};
|
|
12
|
+
useEffect(()=>{epoch.current++;void load();return()=>{epoch.current++;};},[client]);
|
|
13
|
+
const ack=async()=>{if(busy)return;const mine=epoch.current;setBusy(true);try{const out=await client.acknowledgeIntroNotice();if(mine!==epoch.current)return;if(out.ok)setNotice(null);else setFailed(true);}catch{if(mine===epoch.current)setFailed(true);}finally{if(mine===epoch.current)setBusy(false);}};
|
|
14
|
+
if(!notice&&!failed)return null;
|
|
15
|
+
return html`<section class="card hub-intro-notice"><h3>${word("title")}</h3>${failed?html`<p class="err" role="alert">${word(notice?"saveFailed":"failed")}</p><button class="btn btn-sm" onClick=${load}>${word("retry")}</button>`:null}${notice?html`${notice.batches.map(batch=>html`<article key=${batch.fleetId}><p>${word(batch.more?"more":"body",batch.agents.length,batch.fleet||word("fleet"))}</p><ul>${batch.agents.map(agent=>html`<li key=${agent.id}><a class="btn btn-sm btn-ghost" href=${`/ui/hub/exposures?agent=${encodeURIComponent(agent.id)}`}>${word("review",agent.name)}</a></li>`)}</ul></article>`)}<button class="btn btn-sm" disabled=${busy} onClick=${ack}>${word("ack")}</button>`:null}</section>`;
|
|
16
|
+
}
|
package/dist/ui/hub-my-agents.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AgentIntroSharingPreview } from "./hub-agent-intro.js";
|
|
1
2
|
/** Owner-only inventory. Saved requests survive page refresh; Fleet snapshots decide the result. */
|
|
2
3
|
import { lang } from "/assets/app-i18n.js";
|
|
3
4
|
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
@@ -5,6 +6,7 @@ import { Dialog } from "/assets/ui-dialog.js";
|
|
|
5
6
|
import { ms } from "./hub-my-agents-strings.js";
|
|
6
7
|
import { rowAvailability, rowKey, shareRows, reconcileSharing } from "./hub-my-agents-model.js";
|
|
7
8
|
import { HubGrantPicker } from "./hub-grant-picker.js";
|
|
9
|
+
import { assetUrl } from "/assets/asset-url.js";
|
|
8
10
|
const tone = name => { let h = 0; for (const c of name) h = (h * 31 + c.codePointAt(0)) >>> 0; return h % 6; };
|
|
9
11
|
const shortSeen = at => Number.isFinite(at) ? new Intl.DateTimeFormat(lang() === "zh-TW" ? "zh-TW" : "en-GB", { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit", hourCycle: "h23" }).format(at) : "—";
|
|
10
12
|
const Avatar = ({ name }) => html`<span class=${`hub-av sm t${tone(name)}`} aria-hidden="true">${[...name][0] || "?"}</span>`;
|
|
@@ -13,7 +15,7 @@ const STORE = "agend.hub.owner-sharing";
|
|
|
13
15
|
const safeRead = scope => { try { const v = JSON.parse(sessionStorage.getItem(STORE)); return v?.scope === scope && Array.isArray(v.operations) ? v.operations.filter(op => op && typeof op.at === "number" && Array.isArray(op.rows) && op.input && typeof op.input.idempotencyKey === "string" && typeof op.input.fleetId === "string" && Array.isArray(op.input.share) && Array.isArray(op.input.stop)).slice(-32) : []; } catch { return []; } };
|
|
14
16
|
function css() {
|
|
15
17
|
if (document.querySelector('link[data-hub-my-agents-css]')) return;
|
|
16
|
-
const link = document.createElement("link"); link.rel = "stylesheet"; link.href = "/assets/hub-my-agents.css"; link.setAttribute("data-hub-my-agents-css", "1"); document.head.appendChild(link);
|
|
18
|
+
const link = document.createElement("link"); link.rel = "stylesheet"; link.href = assetUrl("/assets/hub-my-agents.css"); link.setAttribute("data-hub-my-agents-css", "1"); document.head.appendChild(link);
|
|
17
19
|
}
|
|
18
20
|
const summary = x => !x?.grants?.length ? ms("nobody") : x.grants.some(g => g.subject?.kind !== "person") ? ms("subjects", x.grants.length) : mc("people", x.grants.length);
|
|
19
21
|
export function HubMyAgents({ client, scope, shared = [], policy = false, personal = false, apps = false, pausable = false, subjects = false, onChanged, onAllow }) {
|
|
@@ -131,11 +133,13 @@ export function HubMyAgents({ client, scope, shared = [], policy = false, person
|
|
|
131
133
|
</div>`;
|
|
132
134
|
}
|
|
133
135
|
function SharingAccess({ targets, client, scope, subjects, onAllow, onClose }) {
|
|
136
|
+
const [introUpdates,setIntroUpdates]=useState({});
|
|
137
|
+
const introPreview=x=>client.agentIntrosV1?html`<${AgentIntroSharingPreview} key=${x.id} exposure=${{...x,...introUpdates[x.id]}} client=${client} onSaved=${value=>setIntroUpdates(old=>({...old,[x.id]:value}))} />`:null;
|
|
134
138
|
const [mode, setMode] = useState(targets.length === 1 ? "each" : null), [pick, setPick] = useState(null), [previous, setPrevious] = useState({}), [outcomes, setOutcomes] = useState({}), [busy, setBusy] = useState(false);
|
|
135
139
|
const life = useRef(0);
|
|
136
140
|
useEffect(() => { const generation = life.current; void Promise.all(targets.map(async x => [x.id, await client.previousAgentAccess(scope, x.id)])).then(rows => { if (generation === life.current) setPrevious(Object.fromEntries(rows)); }); return () => { life.current++; }; }, [client, scope, targets]);
|
|
137
141
|
useEffect(() => { if (targets.length === 1 && !pick) setPick(targets); }, []);
|
|
138
142
|
const usePrevious = async x => { if (busy) return; const generation = life.current; setBusy(true); const r = await client.usePreviousAgentAccess(scope, x.id, { revision: x.revision, digest: previous[x.id]?.previous?.digest }); if (generation === life.current) { setOutcomes(old => ({ ...old, [x.id]: r.ok ? ms("used") : ms("saveFailed", x.displayName) })); setBusy(false); } };
|
|
139
|
-
if (pick) return html`<${HubGrantPicker} x=${pick[0]} legacy=${!subjects} targets=${pick} client=${client} act=${async fn => fn()} grant=${input => client.ownerGrant(scope, input)} onClose=${() => setPick(null)} onResults=${results => setOutcomes(old => ({ ...old, ...results }))} extra=${pick.length === 1 && previous[pick[0].id]?.previous ? html`<button class="btn" disabled=${busy} onClick=${() => usePrevious(pick[0])}>${ms(previous[pick[0].id].previous.peopleCount === null ? "previousMixed" : "previous", previous[pick[0].id].previous.count)}</button>${outcomes[pick[0].id] ? html`<p role="status">${outcomes[pick[0].id]}</p>` : null}` : null} />`;
|
|
140
|
-
return html`<${Dialog} title=${mc("accessTitle", targets.length)} onClose=${onClose} actions=${html`<button class="btn" onClick=${onClose}>${ms("later")}</button>`}><p>${ms("accessLead")}</p><div class="field-row"><button class="btn btn-primary" onClick=${() => { setMode("same"); setPick(targets); }}>${ms("same", targets.length)}</button><button class="btn" onClick=${() => setMode("each")}>${ms("each")}</button></div><ul class="hub-share-access-list">${targets.map(x => html`<li class="hub-share-access-item"><
|
|
143
|
+
if (pick) return html`<${HubGrantPicker} x=${pick[0]} legacy=${!subjects} targets=${pick} client=${client} act=${async fn => fn()} grant=${input => client.ownerGrant(scope, input)} onClose=${() => setPick(null)} onResults=${results => setOutcomes(old => ({ ...old, ...results }))} extra=${html`${pick.map(x=>html`<div key=${x.id}><strong>${x.displayName}</strong>${introPreview(x)}</div>`)}${pick.length === 1 && previous[pick[0].id]?.previous ? html`<button class="btn" disabled=${busy} onClick=${() => usePrevious(pick[0])}>${ms(previous[pick[0].id].previous.peopleCount === null ? "previousMixed" : "previous", previous[pick[0].id].previous.count)}</button>${outcomes[pick[0].id] ? html`<p role="status">${outcomes[pick[0].id]}</p>` : null}` : null}`} />`;
|
|
144
|
+
return html`<${Dialog} title=${mc("accessTitle", targets.length)} onClose=${onClose} actions=${html`<button class="btn" onClick=${onClose}>${ms("later")}</button>`}><p>${ms("accessLead")}</p><div class="field-row"><button class="btn btn-primary" onClick=${() => { setMode("same"); setPick(targets); }}>${ms("same", targets.length)}</button><button class="btn" onClick=${() => setMode("each")}>${ms("each")}</button></div><ul class="hub-share-access-list">${targets.map(x => html`<li class="hub-share-access-item"><div class="hub-row-text"><strong>${x.displayName}</strong>${introPreview(x)}${outcomes[x.id] ? html`<small role="status">${outcomes[x.id]}</small>` : null}</div>${mode === "each" ? html`<button class="btn btn-sm" onClick=${() => setPick([x])}>${ms("choose")}</button>` : null}${previous[x.id]?.previous ? html`<button class="btn btn-sm" disabled=${busy} onClick=${() => usePrevious(x)}>${ms(previous[x.id].previous.peopleCount === null ? "previousMixed" : "previous", previous[x.id].previous.count)}</button>` : null}</li>`)}</ul></${Dialog}>`;
|
|
141
145
|
}
|