@songsid/agend 2.4.0-beta.18 → 2.4.0-beta.19
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-cli-instructions.md +13 -7
- package/dist/agent-cli.js +149 -49
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-export.d.ts +3 -1
- package/dist/agent-export.js +18 -1
- package/dist/agent-export.js.map +1 -1
- package/dist/agent-whats-new.js +9 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/apply-job.d.ts +2 -2
- package/dist/auth-api.js +1 -1
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/claude-code.d.ts +0 -6
- package/dist/backend/claude-code.js +23 -3
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/codex-precaution.js +3 -2
- package/dist/backend/codex-precaution.js.map +1 -1
- package/dist/backend/codex.js +1 -1
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/types.d.ts +6 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-server.js +8 -2
- package/dist/channel/mcp-server.js.map +1 -1
- package/dist/channel/mcp-tools.d.ts +27 -1
- package/dist/channel/mcp-tools.js +77 -7
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/chat-task-refs.d.ts +61 -0
- package/dist/chat-task-refs.js +112 -0
- package/dist/chat-task-refs.js.map +1 -0
- package/dist/classic-channel-manager.d.ts +1 -1
- package/dist/classic-channel-manager.js +6 -2
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/claude-credential-launch.d.ts +6 -0
- package/dist/claude-credential-launch.js +16 -3
- package/dist/claude-credential-launch.js.map +1 -1
- package/dist/claude-credential-runner.js +3 -1
- package/dist/claude-credential-runner.js.map +1 -1
- package/dist/claude-setup-token-transport.js +25 -3
- package/dist/claude-setup-token-transport.js.map +1 -1
- package/dist/cli-audited.js +5 -5
- package/dist/cli-audited.js.map +1 -1
- package/dist/composite-tools.d.ts +11 -0
- package/dist/composite-tools.js +29 -0
- package/dist/composite-tools.js.map +1 -0
- package/dist/config-validator.js +22 -1
- package/dist/config-validator.js.map +1 -1
- package/dist/config.js +11 -0
- package/dist/config.js.map +1 -1
- package/dist/contact-auth-policy.d.ts +1 -0
- package/dist/contact-auth-policy.js +2 -1
- package/dist/contact-auth-policy.js.map +1 -1
- package/dist/contact-auth-service.js +2 -0
- package/dist/contact-auth-service.js.map +1 -1
- package/dist/contact-auth-store.js +21 -6
- package/dist/contact-auth-store.js.map +1 -1
- package/dist/contact-auth-types.d.ts +2 -0
- package/dist/contact-auth-types.js.map +1 -1
- package/dist/daemon.js +4 -0
- package/dist/daemon.js.map +1 -1
- package/dist/darwin-memory.js +2 -1
- package/dist/darwin-memory.js.map +1 -1
- package/dist/dashboard-permissions.d.ts +1 -8
- package/dist/dashboard-permissions.js +8 -9
- package/dist/dashboard-permissions.js.map +1 -1
- package/dist/delivery-outbox.d.ts +0 -6
- package/dist/delivery-outbox.js +0 -25
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/delivery-outbox.test.js +132 -96
- package/dist/delivery-outbox.test.js.map +1 -1
- package/dist/fleet-manager.d.ts +45 -7
- package/dist/fleet-manager.js +309 -99
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-windows-runtime.d.ts +1 -1
- package/dist/fleet-windows-runtime.js +8 -1
- package/dist/fleet-windows-runtime.js.map +1 -1
- package/dist/fleet-yaml-stringify.d.ts +1 -1
- package/dist/fleet-yaml-stringify.js +64 -11
- package/dist/fleet-yaml-stringify.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +53 -4
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +4 -0
- package/dist/general-knowledge/skills/fleet-config/SKILL.md +21 -1
- package/dist/general-knowledge/skills/hub/SKILL.md +2 -0
- package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +5 -1
- package/dist/general-knowledge/skills/model-discovery/SKILL.md +3 -2
- package/dist/general-knowledge/skills/persona-emoji/SKILL.md +3 -0
- package/dist/general-knowledge/skills/task-board/SKILL.md +63 -0
- package/dist/general-knowledge/skills/web-appearance/SKILL.md +25 -2
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +38 -9
- package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +4 -0
- package/dist/general-knowledge/steering/core-rules.md +15 -78
- package/dist/general-role-block.d.ts +19 -0
- package/dist/general-role-block.js +56 -0
- package/dist/general-role-block.js.map +1 -0
- 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/host-memory.d.ts +3 -0
- package/dist/host-memory.js.map +1 -1
- package/dist/host-monitoring/darwin/collector.d.ts +18 -0
- package/dist/host-monitoring/darwin/collector.js +65 -0
- package/dist/host-monitoring/darwin/collector.js.map +1 -0
- package/dist/host-monitoring/darwin/defaults.d.ts +2 -0
- package/dist/host-monitoring/darwin/defaults.js +9 -0
- package/dist/host-monitoring/darwin/defaults.js.map +1 -0
- package/dist/host-monitoring/darwin/interpretation.d.ts +20 -0
- package/dist/host-monitoring/darwin/interpretation.js +73 -0
- package/dist/host-monitoring/darwin/interpretation.js.map +1 -0
- package/dist/host-monitoring/linux/collector.d.ts +17 -0
- package/dist/host-monitoring/linux/collector.js +55 -0
- package/dist/host-monitoring/linux/collector.js.map +1 -0
- package/dist/host-monitoring/linux/defaults.d.ts +2 -0
- package/dist/host-monitoring/linux/defaults.js +9 -0
- package/dist/host-monitoring/linux/defaults.js.map +1 -0
- package/dist/host-monitoring/linux/interpretation.d.ts +22 -0
- package/dist/host-monitoring/linux/interpretation.js +76 -0
- package/dist/host-monitoring/linux/interpretation.js.map +1 -0
- package/dist/host-monitoring/transport.d.ts +42 -0
- package/dist/host-monitoring/transport.js +101 -0
- package/dist/host-monitoring/transport.js.map +1 -0
- package/dist/host-monitoring/wsl/collector.d.ts +19 -0
- package/dist/host-monitoring/wsl/collector.js +72 -0
- package/dist/host-monitoring/wsl/collector.js.map +1 -0
- package/dist/host-monitoring/wsl/defaults.d.ts +2 -0
- package/dist/host-monitoring/wsl/defaults.js +9 -0
- package/dist/host-monitoring/wsl/defaults.js.map +1 -0
- package/dist/host-monitoring/wsl/interpretation.d.ts +22 -0
- package/dist/host-monitoring/wsl/interpretation.js +77 -0
- package/dist/host-monitoring/wsl/interpretation.js.map +1 -0
- package/dist/host-monitoring-alert-policy.d.ts +2 -0
- package/dist/host-monitoring-alert-policy.js +4 -2
- package/dist/host-monitoring-alert-policy.js.map +1 -1
- package/dist/host-monitoring-alert-settings.d.ts +3 -1
- package/dist/host-monitoring-alert-settings.js +7 -2
- package/dist/host-monitoring-alert-settings.js.map +1 -1
- package/dist/host-monitoring-alerts.d.ts +3 -0
- package/dist/host-monitoring-alerts.js +18 -3
- package/dist/host-monitoring-alerts.js.map +1 -1
- package/dist/host-monitoring-defaults.d.ts +19 -0
- package/dist/host-monitoring-defaults.js +10 -0
- package/dist/host-monitoring-defaults.js.map +1 -0
- package/dist/host-monitoring-platform.d.ts +18 -70
- package/dist/host-monitoring-platform.js +14 -269
- package/dist/host-monitoring-platform.js.map +1 -1
- package/dist/host-monitoring.d.ts +13 -0
- package/dist/host-monitoring.js.map +1 -1
- package/dist/hub/agent-catalog-model.d.ts +21 -0
- package/dist/hub/agent-catalog-model.js +9 -1
- package/dist/hub/agent-catalog-model.js.map +1 -1
- package/dist/hub/agent-catalog.d.ts +4 -1
- package/dist/hub/agent-catalog.js +11 -0
- package/dist/hub/agent-catalog.js.map +1 -1
- package/dist/hub/catalog.js +12 -0
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/client.js +4 -1
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +5 -0
- package/dist/hub/compose/member.js +25 -5
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +2 -0
- package/dist/hub/compose/server.js +4 -2
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/http/compose.d.ts +5 -0
- package/dist/hub/http/compose.js +25 -2
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/deps.d.ts +2 -0
- package/dist/hub/http/schema.js +4 -0
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/lapse-carry.d.ts +45 -0
- package/dist/hub/lapse-carry.js +62 -0
- package/dist/hub/lapse-carry.js.map +1 -0
- package/dist/hub/member/agent-catalog.d.ts +4 -1
- package/dist/hub/member/agent-catalog.js +15 -4
- package/dist/hub/member/agent-catalog.js.map +1 -1
- package/dist/hub/member/agent-intro.d.ts +4 -3
- package/dist/hub/member/agent-intro.js +7 -0
- package/dist/hub/member/agent-intro.js.map +1 -1
- package/dist/hub/member/exposure-api.d.ts +2 -0
- package/dist/hub/member/exposure-api.js +8 -1
- package/dist/hub/member/exposure-api.js.map +1 -1
- package/dist/hub/member/room-post.d.ts +34 -6
- package/dist/hub/member/room-post.js +30 -0
- package/dist/hub/member/room-post.js.map +1 -1
- package/dist/hub/member/sharing.d.ts +2 -0
- package/dist/hub/member/sharing.js +9 -2
- package/dist/hub/member/sharing.js.map +1 -1
- package/dist/hub/protocol.d.ts +2 -0
- package/dist/hub/room-brief-model.js +2 -1
- package/dist/hub/room-brief-model.js.map +1 -1
- package/dist/hub/rooms/agents.d.ts +2 -0
- package/dist/hub/rooms/agents.js +16 -2
- package/dist/hub/rooms/agents.js.map +1 -1
- package/dist/hub/rooms/office.d.ts +82 -0
- package/dist/hub/rooms/office.js +46 -0
- package/dist/hub/rooms/office.js.map +1 -0
- package/dist/hub/rooms/service.d.ts +66 -1
- package/dist/hub/rooms/service.js +67 -11
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +4 -0
- package/dist/hub/runtime.d.ts +1 -1
- package/dist/hub/server.js +9 -2
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/sharing-requests.d.ts +5 -2
- package/dist/hub/sharing-requests.js +19 -4
- package/dist/hub/sharing-requests.js.map +1 -1
- package/dist/instance-config-impact.js +1 -1
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.js +6 -7
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instruction-file-sizes.d.ts +46 -0
- package/dist/instruction-file-sizes.js +115 -0
- package/dist/instruction-file-sizes.js.map +1 -0
- package/dist/instructions.d.ts +35 -1
- package/dist/instructions.js +59 -33
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +16 -4
- package/dist/locale.js.map +1 -1
- package/dist/log-steps.d.ts +5 -0
- package/dist/log-steps.js +6 -2
- package/dist/log-steps.js.map +1 -1
- package/dist/memory-guidance.d.ts +5 -0
- package/dist/memory-guidance.js +14 -0
- package/dist/memory-guidance.js.map +1 -0
- package/dist/model-defaults.d.ts +5 -0
- package/dist/model-defaults.js +6 -0
- package/dist/model-defaults.js.map +1 -0
- package/dist/native-mcp.d.ts +2 -0
- package/dist/native-mcp.js +16 -6
- package/dist/native-mcp.js.map +1 -1
- package/dist/needs-you-hub.d.ts +2 -0
- package/dist/needs-you-hub.js +6 -1
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +13 -1
- package/dist/needs-you.js +5 -0
- package/dist/needs-you.js.map +1 -1
- package/dist/outbound-handlers.d.ts +3 -3
- package/dist/outbound-schemas.d.ts +3 -0
- package/dist/outbound-schemas.js +27 -26
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/quickstart.d.ts +1 -1
- package/dist/quickstart.js +2 -3
- package/dist/quickstart.js.map +1 -1
- package/dist/remote-card-prompt.d.ts +1 -0
- package/dist/remote-card-prompt.js +1 -1
- package/dist/remote-card-prompt.js.map +1 -1
- package/dist/runtime-build-info.js +1 -1
- package/dist/runtime-build-info.js.map +1 -1
- package/dist/runtime-cli-install.js +5 -5
- package/dist/runtime-cli-install.js.map +1 -1
- package/dist/runtime-pane-mcp.js +7 -3
- package/dist/runtime-pane-mcp.js.map +1 -1
- package/dist/runtime-pane-native.js +2 -1
- package/dist/runtime-pane-native.js.map +1 -1
- package/dist/scheduler/db.js +2 -0
- package/dist/scheduler/db.js.map +1 -1
- package/dist/scheduler/task-board-mentions.d.ts +32 -0
- package/dist/scheduler/task-board-mentions.js +97 -0
- package/dist/scheduler/task-board-mentions.js.map +1 -0
- package/dist/scheduler/task-board-text.js +3 -0
- package/dist/scheduler/task-board-text.js.map +1 -1
- package/dist/scheduler/task-board.d.ts +199 -3
- package/dist/scheduler/task-board.js +492 -7
- package/dist/scheduler/task-board.js.map +1 -1
- package/dist/settings-api.d.ts +3 -1
- package/dist/settings-api.js +23 -4
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.js +4 -2
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.js +1 -1
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-instance-patch.js +3 -1
- package/dist/settings-instance-patch.js.map +1 -1
- package/dist/setup-host.d.ts +2 -3
- package/dist/setup-host.js +3 -5
- package/dist/setup-host.js.map +1 -1
- package/dist/setup-wizard.js +0 -2
- package/dist/setup-wizard.js.map +1 -1
- package/dist/shared-default-adoption.d.ts +24 -0
- package/dist/shared-default-adoption.js +73 -0
- package/dist/shared-default-adoption.js.map +1 -0
- package/dist/subagent-records.d.ts +2 -0
- package/dist/subagent-records.js +11 -1
- package/dist/subagent-records.js.map +1 -1
- package/dist/subagent-service.d.ts +3 -0
- package/dist/subagent-service.js +24 -4
- package/dist/subagent-service.js.map +1 -1
- package/dist/task-board-tool.d.ts +31 -0
- package/dist/task-board-tool.js +31 -0
- package/dist/task-board-tool.js.map +1 -1
- package/dist/task-board-waker.d.ts +23 -30
- package/dist/task-board-waker.js +136 -97
- package/dist/task-board-waker.js.map +1 -1
- package/dist/types.d.ts +23 -0
- package/dist/ui/agent-details-settings.js +2 -2
- package/dist/ui/agent-export-dialog.js +4 -3
- package/dist/ui/agent-export-strings.js +4 -4
- package/dist/ui/agent-page-strings.js +18 -0
- package/dist/ui/chat-activity-groups.js +1 -1
- package/dist/ui/chat-activity.js +17 -0
- package/dist/ui/chat-store.js +13 -4
- package/dist/ui/chat-task-ref-strings.js +24 -0
- package/dist/ui/chat-task-refs.js +129 -0
- package/dist/ui/claude-setup-token.js +3 -3
- package/dist/ui/contact-auth-strings.js +33 -3
- package/dist/ui/contact-authorizations.js +17 -24
- package/dist/ui/contact-grant-editor.js +50 -0
- package/dist/ui/contact-permissions.js +21 -8
- package/dist/ui/fleet-office-card.js +18 -14
- package/dist/ui/fleet-office.js +29 -17
- package/dist/ui/fleet-task-activity.js +362 -0
- package/dist/ui/fleet-task-card.js +317 -314
- package/dist/ui/fleet-task-common.js +99 -9
- package/dist/ui/fleet-task-create.js +67 -0
- package/dist/ui/fleet-task-edit.js +204 -0
- package/dist/ui/fleet-task-follow.js +123 -0
- package/dist/ui/fleet-task-menu.js +1 -1
- package/dist/ui/fleet-task-owner.js +252 -0
- package/dist/ui/fleet-task-run.js +257 -0
- package/dist/ui/fleet-task-view.js +178 -39
- package/dist/ui/fleet-task-work.js +2 -2
- package/dist/ui/fleet-tasks.js +258 -130
- package/dist/ui/host-health.js +9 -6
- package/dist/ui/host-monitoring-darwin.js +6 -0
- package/dist/ui/host-monitoring-help.js +7 -0
- package/dist/ui/host-monitoring-linux.js +6 -0
- package/dist/ui/host-monitoring-wsl.js +6 -0
- package/dist/ui/hub-agent-copy.js +2 -0
- package/dist/ui/hub-client.js +4 -0
- package/dist/ui/hub-my-agents-strings.js +2 -0
- package/dist/ui/hub-my-agents.js +17 -1
- package/dist/ui/hub-room-composer.js +108 -5
- package/dist/ui/hub-room-members-strings.js +9 -2
- package/dist/ui/hub-room-members.js +72 -15
- package/dist/ui/hub-room-office.js +191 -0
- package/dist/ui/hub-room-purpose.js +18 -2
- package/dist/ui/hub-room-settings.js +8 -1
- package/dist/ui/hub-room-strings.js +15 -0
- package/dist/ui/hub-room-thread.js +51 -15
- package/dist/ui/hub-strings.js +1 -1
- package/dist/ui/log-row.js +7 -5
- package/dist/ui/native-instance-settings.js +4 -2
- package/dist/ui/panel-chat.js +96 -17
- package/dist/ui/panel-details.js +17 -0
- package/dist/ui/panel-fleet.js +1 -1
- package/dist/ui/panel-hub.js +4 -1
- package/dist/ui/panel-needs.js +11 -2
- package/dist/ui/panel-settings.js +57 -13
- package/dist/ui/settings-apply.js +8 -3
- package/dist/ui/settings-default-model-scope.js +40 -0
- package/dist/ui/settings-default-model-strings.js +43 -0
- package/dist/ui/settings-dialogs.js +9 -5
- package/dist/ui/settings-host-alerts.js +4 -3
- package/dist/ui/settings-host-monitoring.js +2 -1
- package/dist/ui/settings-hub.js +1 -1
- package/dist/ui/settings-layout.js +7 -2
- package/dist/ui/settings-model.js +9 -5
- package/dist/ui/settings-quota-notice.js +3 -3
- package/dist/ui/settings-registry.js +3 -0
- package/dist/ui/settings-shared-strings.js +22 -0
- package/dist/ui/settings-shared.js +59 -12
- package/dist/ui/settings-strings.js +2 -4
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app.css +124 -46
- package/dist/ui/shared/chat-composer.js +7 -6
- package/dist/ui/shared/chat-render.js +39 -1
- package/dist/ui/shared/chat-thread.js +8 -3
- package/dist/ui/shared/composer-focus.js +21 -0
- package/dist/ui/shared/hub-chat.css +30 -2
- package/dist/ui/shared/hub-rooms-u2.css +17 -0
- package/dist/ui/shared/task-board.css +406 -8
- package/dist/ui/trigger-complete.js +71 -0
- package/dist/web-api.d.ts +9 -0
- package/dist/web-api.js +128 -13
- package/dist/web-api.js.map +1 -1
- package/dist/windows-native-mcp.js +5 -2
- package/dist/windows-native-mcp.js.map +1 -1
- package/dist/workflow-templates/default.md +4 -6
- package/package.json +1 -1
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
// M-3533 R1 (docs/design/hub-office-visit.md §2): a group room's office — the room page's Office tab. The dashboard's
|
|
2
|
+
// own Office drawing (fleet-office.js, loaded with import() only: the Hub serves it as HUB_OFFICE_MODULES), fed the
|
|
3
|
+
// room's office state (GET /hub/v1/rooms/:id/office/state, share-shaped) every POLL_MS while shown, and nothing else:
|
|
4
|
+
// no stream of this page's own (on the Fleet dashboard that is the fleet's), no editing, no sharing, no levels, no
|
|
5
|
+
// skin packs, no words. Each agent says what the room's member list says (hub-room-presence.js), "answering in this
|
|
6
|
+
// room" the more specific form of 處理中; its card the agent's owner and introduction from the room's members.
|
|
7
|
+
import { html, useEffect, useMemo, useRef, useState } from "/assets/app-html.js";
|
|
8
|
+
import { lang } from "/assets/app-i18n.js";
|
|
9
|
+
import { createLease } from "/assets/app-ctx.js";
|
|
10
|
+
import { Skeleton, ErrorState } from "/assets/ui-states.js";
|
|
11
|
+
import { hroom } from "./hub-room-strings.js";
|
|
12
|
+
import { presenceView } from "./hub-room-presence.js";
|
|
13
|
+
|
|
14
|
+
/** How often a shown office is read again (the share page's POLL_MS). */
|
|
15
|
+
export const ROOM_OFFICE_POLL_MS = 5000;
|
|
16
|
+
/** Reads in a row that fail while the office is shown before it says the picture may be old (one or two misses: silent). */
|
|
17
|
+
export const ROOM_OFFICE_STALE_AFTER = 3;
|
|
18
|
+
/** A label longer than this (an agent's name with its owner's) takes the owner's first word instead. */
|
|
19
|
+
const LABEL_MAX = 24;
|
|
20
|
+
/**
|
|
21
|
+
* A figure's name is also its key in the drawing's office (fleet-office-model.js nameList keeps names of at most 200 code
|
|
22
|
+
* units): an agent's name (up to 256 on the Hub) is cut to NAME_MAX characters, a label with its owner to KEY_MAX, with
|
|
23
|
+
* "…" — a name that long cannot be read on the scene anyway; the member list still says it in full.
|
|
24
|
+
*/
|
|
25
|
+
const NAME_MAX = 48, KEY_MAX = 64;
|
|
26
|
+
/**
|
|
27
|
+
* A name the drawing reads as something else — "team:…" (a team, or NOBODY), an Object.prototype key ("__proto__",
|
|
28
|
+
* "constructor"…), a control character (LOBBY) — keyed with an invisible word joiner in front: the same to read, never
|
|
29
|
+
* the same key (#4355 review).
|
|
30
|
+
*/
|
|
31
|
+
const RESERVED = (name) => name.startsWith("team:") || Object.prototype.hasOwnProperty.call(Object.prototype, name) || /[\u0000-\u001f]/.test(name);
|
|
32
|
+
const safeKey = (name) => (RESERVED(name) ? `\u2060${name}` : name);
|
|
33
|
+
const clip = (text, n) => { const c = [...text]; return c.length > n ? `${c.slice(0, n - 1).join("")}…` : text; };
|
|
34
|
+
const STORAGE_PREFIX = "agend_hub_room_office:";
|
|
35
|
+
|
|
36
|
+
/** The Office drawing, loaded once on first use (the Hub serves it; a fleet page has it already). */
|
|
37
|
+
let drawing = null;
|
|
38
|
+
export const loadDrawing = () => (drawing ??= Promise.all([import("./fleet-office.js"), import("./fleet-org.js")])
|
|
39
|
+
.then(([office, org]) => ({ Office: office.Office, buildOrgView: org.buildOrgView }))
|
|
40
|
+
.catch((e) => { drawing = null; throw e; }));
|
|
41
|
+
|
|
42
|
+
/** The state's agents as the app store's status frame (office-share-page.js appFromState): the drawing's input. */
|
|
43
|
+
export function officeApp(d) {
|
|
44
|
+
const instances = Array.isArray(d && d.instances) ? d.instances.filter((i) => i && typeof i.name === "string") : [];
|
|
45
|
+
const exec = Object.create(null);
|
|
46
|
+
for (const i of instances) exec[i.name] = i.execution_state ?? null;
|
|
47
|
+
return { ready: true, instances, exec, awaiting: {}, needs: [], connection: "polling" };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The drawing's reads, answered here from the room's state (`now()`): its one office, no acts, no skin packs; anything
|
|
52
|
+
* else (levels, a pack, a save) is not this page's to answer.
|
|
53
|
+
*/
|
|
54
|
+
export function officeReads(now) {
|
|
55
|
+
const json = (body) => Promise.resolve(new Response(JSON.stringify(body), { status: 200, headers: { "Content-Type": "application/json" } }));
|
|
56
|
+
return (path, opts = {}) => {
|
|
57
|
+
const p = String(path), method = String(opts.method || "GET").toUpperCase();
|
|
58
|
+
if (method !== "GET") return Promise.resolve(new Response("", { status: 404 }));
|
|
59
|
+
if (p === "/ui/offices") return json(now()?.offices ?? { rev: 0, readable: true, offices: [] });
|
|
60
|
+
if (p === "/ui/office-acts") return json({ acts: [], now: Date.now() });
|
|
61
|
+
if (p === "/ui/office-skins") return json({ rev: "", packs: [] });
|
|
62
|
+
return Promise.resolve(new Response("", { status: 404 }));
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** This browser's choices for rooms' offices (zoom, the checkboxes), apart from the Fleet office's. */
|
|
67
|
+
export function roomOfficeStorage(base = (() => { try { return globalThis.localStorage || null; } catch { return null; } })()) {
|
|
68
|
+
if (!base) return undefined;
|
|
69
|
+
return {
|
|
70
|
+
getItem: (k) => { try { return base.getItem(STORAGE_PREFIX + k); } catch { return null; } },
|
|
71
|
+
setItem: (k, v) => { try { base.setItem(STORAGE_PREFIX + k, v); } catch { /* this page only */ } },
|
|
72
|
+
removeItem: (k) => { try { base.removeItem(STORAGE_PREFIX + k); } catch { /* this page only */ } },
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* An agent's state in the member list's own words (presenceView: its reason too, while the list says the same presence),
|
|
78
|
+
* and "answering in this room" as what it is doing now.
|
|
79
|
+
*/
|
|
80
|
+
export function officeWords(node, members) {
|
|
81
|
+
const i = node && node.i;
|
|
82
|
+
if (!i) return { state: hroom("stOffline"), now: "" };
|
|
83
|
+
const kind = i.assistant ? "assistant" : "agent", presence = i.presence || "offline";
|
|
84
|
+
const listed = (Array.isArray(members) ? members : []).find((m) => m && (kind === "assistant" ? m.kind === "assistant" : m.kind === "agent" && m.id === i.member));
|
|
85
|
+
const v = presenceView(listed && listed.presence === presence ? listed : { kind, presence });
|
|
86
|
+
// Answering here is the more specific 處理中: the member list's working word, and what it is doing now.
|
|
87
|
+
return { state: hroom(i.answering ? "stWorking" : v.word), now: i.answering ? hroom("answeringHere") : "" };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** A card's rows: the agent's owner and introduction, from the room's members (the assistant: provided by the Hub). */
|
|
91
|
+
export function officeCardRows(members, id) {
|
|
92
|
+
if (id === "assistant") return [{ key: "owner", label: hroom("cardOwner"), value: hroom("providedByHub") }];
|
|
93
|
+
const m = (Array.isArray(members) ? members : []).find((x) => x && x.kind === "agent" && x.id === id);
|
|
94
|
+
if (!m) return [];
|
|
95
|
+
return [{ key: "owner", label: hroom("cardOwner"), value: String(m.owner?.name || "") }, { key: "intro", label: hroom("cardIntro"), value: String(m.intro || "") }];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The drawing names people by their instance name (and shows it beside a display name, or first when the viewer prefers
|
|
100
|
+
* it): a room's agents are named by what members see — the room assistant by the room's word for it; agents sharing a
|
|
101
|
+
* name told apart by their owner, as the member list's second line does (「Atlas(Alex Sample)」, the owner's first word
|
|
102
|
+
* when that is too long) — and keep their member id as `member` (their card and words read it).
|
|
103
|
+
*/
|
|
104
|
+
export function named(d, members = []) {
|
|
105
|
+
const list = (Array.isArray(d && d.instances) ? d.instances : []).filter((i) => i && typeof i.name === "string");
|
|
106
|
+
const base = (i) => clip(i.assistant ? hroom("roomAssistant") : String(i.display_name || "").trim() || "?", NAME_MAX);
|
|
107
|
+
const count = new Map();
|
|
108
|
+
for (const i of list) count.set(base(i), (count.get(base(i)) || 0) + 1);
|
|
109
|
+
const owners = new Map((Array.isArray(members) ? members : []).filter((m) => m && m.kind === "agent").map((m) => [m.id, String(m.owner?.name || "").trim()]));
|
|
110
|
+
const [open, close] = lang() === "zh-TW" ? ["(", ")"] : [" (", ")"];
|
|
111
|
+
const taken = new Set(), rename = new Map();
|
|
112
|
+
const instances = list.map((i) => {
|
|
113
|
+
const b = base(i), owner = owners.get(i.name) || "";
|
|
114
|
+
let label = b;
|
|
115
|
+
if (count.get(b) > 1 && owner) {
|
|
116
|
+
label = `${b}${open}${owner}${close}`;
|
|
117
|
+
if ([...label].length > LABEL_MAX) label = `${b}${open}${owner.split(/\s+/)[0]}${close}`;
|
|
118
|
+
label = clip(label, KEY_MAX);
|
|
119
|
+
}
|
|
120
|
+
label = safeKey(label);
|
|
121
|
+
for (let n = 2, at = label; taken.has(label); n++) label = `${at} ${n}`;
|
|
122
|
+
taken.add(label); rename.set(i.name, label);
|
|
123
|
+
return { ...i, name: label, display_name: label, member: i.name };
|
|
124
|
+
});
|
|
125
|
+
const offices = d && d.offices && Array.isArray(d.offices.offices)
|
|
126
|
+
? { ...d.offices, offices: d.offices.offices.map((o) => ({ ...o, members: (Array.isArray(o.members) ? o.members : []).map((m) => rename.get(m) ?? m) })) } : d?.offices;
|
|
127
|
+
return { ...d, instances, offices };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* `members` the room's (its detail's: owner, introduction, the list's states); `onMention(member)` the card's "@ it" (the
|
|
132
|
+
* page switches to Chat with the mention in the box); `more` / `onMore` a phone's options sheet, opened from the room's ⋯.
|
|
133
|
+
*/
|
|
134
|
+
export function RoomOffice({ client, roomId, members, onMention = null, more = false, onMore = null, timers = globalThis, pollMs = ROOM_OFFICE_POLL_MS, load = loadDrawing }) {
|
|
135
|
+
const [phase, setPhase] = useState("loading"); // loading | live | failed | off
|
|
136
|
+
const [d, setD] = useState(null);
|
|
137
|
+
const [kit, setKit] = useState(null);
|
|
138
|
+
const [attempt, setAttempt] = useState(0);
|
|
139
|
+
// The drawing's modules failing to load is not the room's state failing to read: a good read must not hide it.
|
|
140
|
+
const [kitFailed, setKitFailed] = useState(false);
|
|
141
|
+
const [stale, setStale] = useState(false);
|
|
142
|
+
const misses = useRef(0);
|
|
143
|
+
const holder = useMemo(() => ({ d: null }), [roomId]);
|
|
144
|
+
const lease = useMemo(() => {
|
|
145
|
+
const reads = officeReads(() => holder.d);
|
|
146
|
+
return createLease({
|
|
147
|
+
setTimeout: (...a) => timers.setTimeout(...a), clearTimeout: (h) => timers.clearTimeout(h),
|
|
148
|
+
setInterval: (...a) => timers.setInterval(...a), clearInterval: (h) => timers.clearInterval(h),
|
|
149
|
+
fetch: (path, opts) => reads(path, opts),
|
|
150
|
+
});
|
|
151
|
+
}, [roomId, holder]);
|
|
152
|
+
useEffect(() => () => lease.dispose(), [lease]);
|
|
153
|
+
const storage = useMemo(() => roomOfficeStorage(), []);
|
|
154
|
+
useEffect(() => {
|
|
155
|
+
let stopped = false;
|
|
156
|
+
if (!kit) load().then((k) => { if (!stopped) { setKit(k); setKitFailed(false); } }, () => { if (!stopped) setKitFailed(true); });
|
|
157
|
+
const read = async () => {
|
|
158
|
+
const r = await client.roomOfficeState(roomId);
|
|
159
|
+
if (stopped || !lease.current()) return;
|
|
160
|
+
if (r && r.ok) { misses.current = 0; setStale(false); setD(r); setPhase("live"); return; }
|
|
161
|
+
if (r && r.status === 409 && r.code === "office-off") { setPhase("off"); return; }
|
|
162
|
+
// A read that fails while the office is shown keeps the last picture; ROOM_OFFICE_STALE_AFTER in a row say it may
|
|
163
|
+
// be old (people shown 處理中 minutes ago). A first read that fails says so at once.
|
|
164
|
+
if (++misses.current >= ROOM_OFFICE_STALE_AFTER) setStale(true);
|
|
165
|
+
setPhase((p) => (p === "live" ? p : "failed"));
|
|
166
|
+
};
|
|
167
|
+
void read();
|
|
168
|
+
const h = lease.interval(() => { if (!stopped && !globalThis.document?.hidden) void read(); }, pollMs);
|
|
169
|
+
return () => { stopped = true; lease.clear(h); };
|
|
170
|
+
}, [lease, attempt]);
|
|
171
|
+
const shown = useMemo(() => (d ? named(d, members) : null), [d, members]);
|
|
172
|
+
holder.d = shown;
|
|
173
|
+
const view = useMemo(() => (kit && shown ? kit.buildOrgView(shown.org, officeApp(shown)) : null), [kit, shown]);
|
|
174
|
+
const memberOf = (name) => {
|
|
175
|
+
const id = shown?.instances.find((i) => i.name === name)?.member;
|
|
176
|
+
return (Array.isArray(members) ? members : []).find((m) => m && (id === "assistant" ? m.kind === "assistant" : m.kind === "agent" && m.id === id)) || null;
|
|
177
|
+
};
|
|
178
|
+
if (phase === "off") return html`<div class="hub-room-office hub-room-office-note"><p class="note" role="status">${hroom("officeOff")}</p></div>`;
|
|
179
|
+
if ((phase === "failed" || kitFailed) && !view) return html`<div class="hub-room-office hub-room-office-note">
|
|
180
|
+
<${ErrorState} message=${hroom("officeFailed")} onRetry=${() => { setPhase("loading"); setKitFailed(false); setAttempt((n) => n + 1); }} /></div>`;
|
|
181
|
+
if (!view) return html`<div class="hub-room-office hub-room-office-loading"><${Skeleton} variant="cards" lines=${3} label=${hroom("officeLoading")} /></div>`;
|
|
182
|
+
const { Office } = kit;
|
|
183
|
+
return html`<div class="hub-room-office" data-trust="panel-content">
|
|
184
|
+
${stale ? html`<p class="note hub-room-office-stale" role="status">${hroom("officeStale")}</p>` : null}
|
|
185
|
+
<${Office} view=${view} traffic=${[]} lease=${lease} opening="room" talk=${{ now: Date.now(), items: [] }}
|
|
186
|
+
oneOffice=${true} readOnly=${true} stream=${false} storage=${storage} words=${(node) => officeWords(node, members)}
|
|
187
|
+
cardRows=${(name) => officeCardRows(members, shown.instances.find((i) => i.name === name)?.member)}
|
|
188
|
+
cardAction=${onMention ? (name) => { const m = memberOf(name); return m ? { label: hroom("mentionIt"), title: hroom("mentionItTitle", name), run: () => onMention(m) } : null; } : null}
|
|
189
|
+
more=${more} onMore=${onMore} officesKey=${shown.offices?.offices?.[0]?.members?.join("\n") ?? ""} />
|
|
190
|
+
</div>`;
|
|
191
|
+
}
|
|
@@ -2,8 +2,8 @@ import {html,useState} from "/assets/app-html.js";
|
|
|
2
2
|
import {register,t} from "/assets/app-i18n.js";
|
|
3
3
|
import {Dialog} from "/assets/ui-dialog.js";
|
|
4
4
|
register("hubRoomPurpose",{
|
|
5
|
-
en:{title:"Purpose",hint:"One line on what this room is for. Members see it, and agents asked here are told.",placeholder:"For example: release questions for the web team",add:"Add a purpose",tooLong:"Use 200 characters or fewer.",close:"Close"},
|
|
6
|
-
"zh-TW":{title:"用途",hint:"用一句話說明這個房間做什麼。成員看得到,在這裡被問的 Agent 也會知道。",placeholder:"例如:網頁組的發版問題",add:"新增用途",tooLong:"最多 200 個字。",close:"關閉"}
|
|
5
|
+
en:{title:"Purpose",hint:"One line on what this room is for. Members see it, and agents asked here are told.",placeholder:"For example: release questions for the web team",add:"Add a purpose",tooLong:"Use 200 characters or fewer.",close:"Close",edit:"Edit"},
|
|
6
|
+
"zh-TW":{title:"用途",hint:"用一句話說明這個房間做什麼。成員看得到,在這裡被問的 Agent 也會知道。",placeholder:"例如:網頁組的發版問題",add:"新增用途",tooLong:"最多 200 個字。",close:"關閉",edit:"編輯"}
|
|
7
7
|
});
|
|
8
8
|
export const rp=(key,...args)=>t(`hubRoomPurpose.${key}`,...args);
|
|
9
9
|
export const purposeCount=value=>[...new Intl.Segmenter(undefined,{granularity:"grapheme"}).segment(String(value??""))].length;
|
|
@@ -17,3 +17,19 @@ export function RoomPurposeHeader({purpose="",onEdit}){
|
|
|
17
17
|
return html`<button type="button" class="hub-room-purpose-trigger" title=${purpose} aria-haspopup="dialog" aria-expanded=${open?"true":"false"} aria-label=${`${rp("title")}: ${purpose}`} onClick=${()=>setOpen(true)}>${purpose}</button>
|
|
18
18
|
${open?html`<${Dialog} title=${rp("title")} onClose=${()=>setOpen(false)} actions=${html`<button type="button" class="btn" onClick=${()=>setOpen(false)}>${rp("close")}</button>`}><p class="hub-room-purpose-full">${purpose}</p></${Dialog}>`:null}`;
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* M-3533 H1 (the user's approved r3, design §2.1a): the room's purpose as the strip under the header that an agent's chat
|
|
23
|
+
* page uses for its identity card (`.chat-card` with `.id-card.card-c`): the room's square picture, "Purpose" and the text
|
|
24
|
+
* beside it, wrapping as it needs; a manager has Edit at its right. No purpose: a manager sees the card with "Add a purpose";
|
|
25
|
+
* a member sees no card. The same card on a phone, where the purpose was only in the members sheet before.
|
|
26
|
+
*/
|
|
27
|
+
export function RoomPurposeCard({initial="?",purpose="",onEdit}){
|
|
28
|
+
if(!purpose&&!onEdit)return null;
|
|
29
|
+
return html`<div class="chat-card open hub-room-card" data-trust="panel-content"><section class="id-card card-c" aria-label=${rp("title")}><div class="id-row">
|
|
30
|
+
<span class="av av-square hub-room-card-av" aria-hidden="true"><span class="av-text">${initial}</span></span>
|
|
31
|
+
<div class="id-text"><p class="id-tagline">${rp("title")}</p>${purpose?html`<p class="id-bio">${purpose}</p>`:null}</div>
|
|
32
|
+
${/* The card's one action is the same button with or without a purpose: Edit, or Add a purpose (Lumen, #4349). */ ""}
|
|
33
|
+
${onEdit?html`<button type="button" class=${`btn btn-sm hub-room-card-edit${purpose?"":" hub-room-card-add"}`} onClick=${onEdit}>${purpose?rp("edit"):rp("add")}</button>`:null}
|
|
34
|
+
</div></section></div>`;
|
|
35
|
+
}
|
|
@@ -56,7 +56,10 @@ export function RoomSettings({ client = hubClient(), roomId, detail, onClose, on
|
|
|
56
56
|
const [offered, setOffered] = useState(assistant === true), [addPeople, setAddPeople] = useState([]), [addAgents, setAddAgents] = useState([]), [peopleNote, setPeopleNote] = useState("");
|
|
57
57
|
const live = useRef(true);
|
|
58
58
|
useEffect(() => () => { live.current = false; }, []);
|
|
59
|
-
|
|
59
|
+
// M-3533 R1 (design §2.1b): Room office, on or off — managers only (this dialog is theirs), when the Hub serves it.
|
|
60
|
+
const officeShown = typeof settings.office?.enabled === "boolean" && client.roomOfficeV1 === true;
|
|
61
|
+
const [office, setOffice] = useState(settings.office?.enabled === true);
|
|
62
|
+
useEffect(() => { setName(room.name ?? ""); setAllMention(settings.allMention !== false); setHistory(settings.historyForNew === "all" ? "all" : "since-join"); setOffice(settings.office?.enabled === true); }, [detail]);
|
|
60
63
|
useEffect(()=>setAiApps(settings.aiApps!==false),[detail]);
|
|
61
64
|
useEffect(() => {
|
|
62
65
|
if (typeof assistant === "boolean") { setOffered(assistant); return; }
|
|
@@ -149,6 +152,10 @@ export function RoomSettings({ client = hubClient(), roomId, detail, onClose, on
|
|
|
149
152
|
${offered || hasAssistant ? html`<label class="check"><input id="hubRoomSettingsAssistant" class="s-ui-toggle" type="checkbox" role="switch" checked=${hasAssistant} disabled=${busy}
|
|
150
153
|
onChange=${(e) => { const v = e.target.checked, id = members.find(m => m.kind === "assistant")?.id; void act(() => v ? client.addRoomMember(roomId, { kind: "assistant" }) : client.removeRoomMember(roomId, id)); }} /><span>${hs("assistantSwitch")}</span></label>` : null}
|
|
151
154
|
</section>
|
|
155
|
+
${officeShown ? html`<section class="form hub-room-office-settings"><h4>${hroom("officeSection")}</h4>
|
|
156
|
+
<label class="check"><input id="hubRoomOffice" class="s-ui-toggle" type="checkbox" role="switch" checked=${office} disabled=${busy}
|
|
157
|
+
onChange=${(e) => { const v = e.target.checked; setOffice(v); void act(() => client.updateRoom(roomId, { office: { enabled: v } }), () => setOffice(!v)); }} /><span>${hroom("officeSetting")}</span></label>
|
|
158
|
+
</section>` : null}
|
|
152
159
|
<section class="form"><h4>${hroom("other")}</h4>
|
|
153
160
|
<button type="button" class="btn btn-danger" disabled=${busy || room.archived === true} onClick=${() => { void archive(); }}>${hroom("archiveRoom")}</button>
|
|
154
161
|
</section>
|
|
@@ -76,6 +76,14 @@ register("hubRoom", {
|
|
|
76
76
|
create: "Create", cancel: "Cancel",
|
|
77
77
|
createdSys: "{0} created this room.",
|
|
78
78
|
purposeSetSys:"{0} set the purpose: {1}",purposeClearedSys:"{0} cleared the purpose.",
|
|
79
|
+
// M-3533 R1: a room's office (docs/design/hub-office-visit.md §2.1).
|
|
80
|
+
officeOnSys: "{0} turned the room office on.", officeOffSys: "{0} turned the room office off.",
|
|
81
|
+
tabChat: "Chat", tabOffice: "Office", roomViews: "{0}: chat or office",
|
|
82
|
+
officeLoading: "Loading the office…", officeFailed: "Can't load the office right now. The chat still works.",
|
|
83
|
+
officeOff: "A room manager turned the office off.",
|
|
84
|
+
cardOwner: "Owner", cardIntro: "Introduction", answeringHere: "Answering a question in this room",
|
|
85
|
+
mentionIt: "@ it", mentionItTitle: "Ask {0} in the chat", officeOptions: "Office options", officeStale: "The office may be out of date. Reconnecting…",
|
|
86
|
+
officeSection: "Room office", officeSetting: "Show the room office",
|
|
79
87
|
sysAdminJoined: "{0} joined as a room manager", composerAssistant: "Ask the Hub assistant", composerDirect: "Ask {0}",
|
|
80
88
|
invitedSys: "{0} agents invited; they join when the owner agrees.",
|
|
81
89
|
nameRequired: "Enter a room name.",
|
|
@@ -208,6 +216,13 @@ register("hubRoom", {
|
|
|
208
216
|
create: "建立", cancel: "取消",
|
|
209
217
|
createdSys: "{0} 建立了這個房間。",
|
|
210
218
|
purposeSetSys:"{0} 設定了用途:{1}",purposeClearedSys:"{0} 清除了用途。",
|
|
219
|
+
officeOnSys: "{0} 開啟了房間辦公室。", officeOffSys: "{0} 關閉了房間辦公室。",
|
|
220
|
+
tabChat: "聊天", tabOffice: "辦公室", roomViews: "{0}:聊天或辦公室",
|
|
221
|
+
officeLoading: "正在載入辦公室…", officeFailed: "目前無法載入辦公室,聊天仍可正常使用。",
|
|
222
|
+
officeOff: "房間管理員已關閉辦公室。",
|
|
223
|
+
cardOwner: "擁有者", cardIntro: "介紹", answeringHere: "正在回答這個房間的問題",
|
|
224
|
+
mentionIt: "@ 它", mentionItTitle: "在聊天裡問 {0}", officeOptions: "辦公室選項", officeStale: "畫面可能不是最新,正在重新連線…",
|
|
225
|
+
officeSection: "房間辦公室", officeSetting: "顯示房間辦公室",
|
|
211
226
|
sysAdminJoined: "{0} 以房間管理的身分加入", composerAssistant: "問 Hub 助理", composerDirect: "問 {0}",
|
|
212
227
|
invitedSys: "已邀請 {0} 個 Agent,擁有者同意後會加入。",
|
|
213
228
|
nameRequired: "請輸入房間名稱。",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {RoomPurposeCard} from "./hub-room-purpose.js";
|
|
2
2
|
import { hi } from "./hub-agent-intro.js";
|
|
3
3
|
import {hp} from "./hub-personal-agent-strings.js";
|
|
4
4
|
// M-3092 PR 2 (Hub rooms, track U): one room of a Hub with rooms, on the Fleet chat's own thread (/assets/chat-thread.js
|
|
@@ -37,6 +37,7 @@ import { countsLine } from "./hub-room-list.js";
|
|
|
37
37
|
import { DropOverlay, MAX_FILES, PendingFiles, hf, hubFileAttachment, pageCarriesFiles, putBackText, roomTakesFiles, uploadChosen, useFileDrop } from "./hub-attachments.js";
|
|
38
38
|
import { LightboxHost, openLightbox } from "/assets/image-lightbox.js";
|
|
39
39
|
import { ROOM_PINS_MAX, RoomPinsButton, RoomPinsDialog } from "./hub-room-pins.js";
|
|
40
|
+
import { RoomOffice } from "./hub-room-office.js";
|
|
40
41
|
// M-3125 PR3: the one quote target an annotated room picture has (here, so a page with an older dictionary has the words).
|
|
41
42
|
register("hubRoomAnnotate", { en: { quote: "Quote in this room" }, "zh-TW": { quote: "引用到這個房間" } });
|
|
42
43
|
|
|
@@ -94,6 +95,7 @@ export function authorLine(author, mine = false, direct = false) {
|
|
|
94
95
|
const SYSTEM = { "room-created": "createdSys", "member-joined": "sysJoined", "admin-joined": "sysAdminJoined", "poll-closed": "sysPollClosed" };
|
|
95
96
|
export function systemText(m) {
|
|
96
97
|
if(m?.system?.kind==="purpose-changed"&&typeof m.system.purpose==="string"&&typeof m.system.name==="string")return hroom(m.system.purpose?"purposeSetSys":"purposeClearedSys",m.system.name,m.system.purpose);
|
|
98
|
+
if (m?.system?.kind === "office-changed" && typeof m.system.enabled === "boolean" && typeof m.system.name === "string") return hroom(m.system.enabled ? "officeOnSys" : "officeOffSys", m.system.name);
|
|
97
99
|
if(m?.system?.kind==="app-rate-limited")return ha("rateLimited",m.system.name||"");
|
|
98
100
|
if (m?.system?.kind === "agent-mention-stopped") return agentStopText(m.system) ?? String(m.text || "");
|
|
99
101
|
const key = m && m.system && SYSTEM[m.system.kind];
|
|
@@ -400,7 +402,8 @@ function useMembersPanel() {
|
|
|
400
402
|
* Fleet chat's thread (panel-hub.js's HubThread, given as `Thread`: the thread wiring is one), the room's composer, and
|
|
401
403
|
* the members panel on the right. `client`: the Hub client; `me`: { id } from the session.
|
|
402
404
|
*/
|
|
403
|
-
export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "", rooms = [], openRoom = () => {}, goList = () => {}, onLeft = () => {}, onMe = () => {}, pinsOn = false
|
|
405
|
+
export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "", rooms = [], openRoom = () => {}, goList = () => {}, onLeft = () => {}, onMe = () => {}, pinsOn = false,
|
|
406
|
+
view = "chat", onView = () => {}, officeHref = (v) => v }) {
|
|
404
407
|
const store = useMemo(() => createRoomStore(roomId, { client, meId, pinsOn }), [roomId]);
|
|
405
408
|
const [pinsOpen, setPinsOpen] = useState(false);
|
|
406
409
|
useEffect(() => () => store.stop(), [store]);
|
|
@@ -430,6 +433,23 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
|
|
|
430
433
|
if (r.ok) onLeft(); else setLeaveError(r.text);
|
|
431
434
|
};
|
|
432
435
|
const detail = store.detail(), room = detail?.room || listed || {}, group = room.kind === "group";
|
|
436
|
+
// M-3533 R1 (design §2.1): the room's office, a tab beside Chat while a manager has it on (and this Hub serves it).
|
|
437
|
+
const officeOn = group && client.roomOfficeV1 === true && detail?.settings?.office?.enabled === true;
|
|
438
|
+
const inOffice = officeOn && view === "office";
|
|
439
|
+
// M-3533 R1: the office card's "@ it" goes back to Chat with the mention in the box, once the box is there again.
|
|
440
|
+
const mentionNext = useRef(null), [officeMore, setOfficeMore] = useState(false);
|
|
441
|
+
// A member as the box mentions it: the room assistant by the composer's own word for it; an agent or a person by name,
|
|
442
|
+
// bound to that member (two agents of one name: this one).
|
|
443
|
+
const insertMention = (m) => {
|
|
444
|
+
if (!m) return;
|
|
445
|
+
if (m.kind === "assistant") insert.current?.(hroom("mentionAssistant"));
|
|
446
|
+
else insert.current?.(`@${m.name}`, m.kind === "agent" ? { name: String(m.name), id: m.id } : null);
|
|
447
|
+
};
|
|
448
|
+
useEffect(() => {
|
|
449
|
+
if (inOffice || !mentionNext.current) return undefined;
|
|
450
|
+
const m = mentionNext.current, h = setTimeout(() => { mentionNext.current = null; insertMention(m); }, 0);
|
|
451
|
+
return () => clearTimeout(h);
|
|
452
|
+
});
|
|
433
453
|
// The page-level rooms notifier learns this person's id for this room from its detail (§12; member
|
|
434
454
|
// ids are per room, so the id is kept under this room's id).
|
|
435
455
|
useEffect(() => { const id = detail && detail.me && detail.me.id; if (id) onMe(roomId, id); }, [detail && detail.me && detail.me.id]);
|
|
@@ -445,7 +465,7 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
|
|
|
445
465
|
} } : null;
|
|
446
466
|
// M-3311 (1): a file dragged onto the conversation is attached, as in the Fleet chat.
|
|
447
467
|
const mainRef = useRef(null);
|
|
448
|
-
useFileDrop(mainRef, attach);
|
|
468
|
+
useFileDrop(mainRef, inOffice ? null : attach);
|
|
449
469
|
// M-3311 (3): a long paste's chip — 「改為文字」 puts its text back into the box (the Fleet chat's), and the chip goes.
|
|
450
470
|
const asText = (key) => { const f = filesRef.current.find((x) => x.key === key); if (!f) return; setFiles(filesRef.current.filter((x) => x.key !== key)); putBackText(input.current, f.text); input.current?.focus(); };
|
|
451
471
|
const pending = files.length || fileMsg ? html`<${PendingFiles} files=${files} onAsText=${asText} onRemove=${(key) => setFiles(filesRef.current.filter((f) => f.key !== key))}
|
|
@@ -551,6 +571,10 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
|
|
|
551
571
|
const [fullWidth, setFullWidth] = useState(hubChatWide);
|
|
552
572
|
const textSize = useStore(textSizeStore), notify = useStore(notifyStore), narrow = useNarrowScreen();
|
|
553
573
|
const menuItems = [
|
|
574
|
+
// M-3533 R1: a phone has no tab row — Office is the first item of ⋯ (in the office, its back returns to the chat).
|
|
575
|
+
narrow && officeOn && !inOffice ? { key: "office", label: hroom("tabOffice"), icon: "org", onSelect: () => onView("office") } : null,
|
|
576
|
+
// In the office a phone's options (hide paused, bedtime, dialogue, key, fit, fill) are one sheet, not rows over the scene.
|
|
577
|
+
narrow && inOffice ? { key: "officeMore", label: hroom("officeOptions"), icon: "settings", onSelect: () => setOfficeMore(true) } : null,
|
|
554
578
|
group && detail?.me?.role === "manager" ? { key: "settings", label: hroom("roomSettings"), icon: "settings", onSelect: openSettings } : null,
|
|
555
579
|
group && detail?.me ? { key: "leave", label: hroom("leaveRoom"), icon: "close", onSelect: () => { void leave(); } } : null,
|
|
556
580
|
pinCount ? { key: "pins", label: `${t("chat.pinsTitle")} · ${pinCount}`, icon: "pin", onSelect: () => setPinsOpen(true) } : null,
|
|
@@ -562,43 +586,55 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
|
|
|
562
586
|
...(notifySupport() === "ok" ? [{ key: "notify", checkbox: true, checked: notify.state === "on", disabled: notify.asking, label: hroom("notifyTitle"), onSelect: () => { void setNotify(notify.state !== "on"); } }] : []),
|
|
563
587
|
] : []),
|
|
564
588
|
].filter(Boolean);
|
|
565
|
-
const line2 = group ? `${countsLine(room.people, room.agents)}${hasAssistant ? ` · ${hroom("roomAssistant")}` : ""}`
|
|
589
|
+
const line2 = narrow && inOffice ? hroom("tabOffice") : group ? `${countsLine(room.people, room.agents)}${hasAssistant ? ` · ${hroom("roomAssistant")}` : ""}`
|
|
566
590
|
: room.assistant ? hroom("providedByHub") : room.agent?.answerOnly ? hp("answerOnlyAsker") : String(room.agent?.owner?.name || "");
|
|
567
591
|
const showRail = wide && rail && Panel && group && detail;
|
|
568
592
|
// The Fleet chat's working bar (Lumen): 「Notes 正在處理」, or 「2 個 Agent 正在處理」 — the answer row only when it arrives.
|
|
569
593
|
// Who: this room's answers being worked on; the words: workingLine() (#3857), the one place that says it.
|
|
570
594
|
const working = workingLine({ members: store.workers().map((w) => ({ ...w, presence: "working" })) });
|
|
571
595
|
const panel = Panel && detail ? html`<${Panel} client=${client} roomId=${roomId} detail=${detail}
|
|
572
|
-
onMention=${(m) => { setSheet(false);
|
|
596
|
+
onMention=${(m) => { setSheet(false); insertMention(m); }}
|
|
573
597
|
onOpenChat=${(m) => { const direct = rooms.find((r) => r.kind === "direct" && r.agent?.exposureId === m.id); if (direct) openRoom(direct.id); }}
|
|
574
598
|
onSettings=${() => { setSheet(false); openSettings(); }} />` : null;
|
|
575
599
|
return html`<div class=${`hub-chat hub-room-page${showRail ? " with-rail" : ""}`} data-room=${roomId} data-width=${fullWidth ? "full" : undefined}>
|
|
576
600
|
<${LightboxHost} />
|
|
577
601
|
${pinsOpen ? html`<${RoomPinsDialog} pins=${store.pins()} onClose=${() => setPinsOpen(false)} onJump=${(p) => void showPin(p)} onUnpin=${(p) => void togglePin(p.messageId)} />` : null}
|
|
578
602
|
<section class="hub-chat-main" ref=${mainRef}>
|
|
579
|
-
${attach ? html`<${DropOverlay} />` : null}
|
|
603
|
+
${attach && !inOffice ? html`<${DropOverlay} />` : null}
|
|
580
604
|
<header class=${`hub-chat-head${room.agent?.answerOnly?" hub-answer-only-head":""}`} data-trust="panel-content">
|
|
581
605
|
${/* Lumen (spec §2): on a phone the header starts with the Fleet chat's back to the list. */ ""}
|
|
582
|
-
<a class="icon-btn hub-back only-narrow" href
|
|
583
|
-
onClick=${(e) => { if (e.metaKey || e.ctrlKey) return; e.preventDefault(); goList(); }}><${Icon} name="back" /></a>
|
|
584
|
-
|
|
585
|
-
|
|
606
|
+
<a class="icon-btn hub-back only-narrow" href=${inOffice ? officeHref("chat") : "/ui/hub"} aria-label=${t("hub.back")} title=${t("hub.back")}
|
|
607
|
+
onClick=${(e) => { if (e.metaKey || e.ctrlKey) return; e.preventDefault(); if (inOffice) onView("chat"); else goList(); }}><${Icon} name="back" /></a>
|
|
608
|
+
${/* M-3533 H1 (r3): a room's header is one line — its name, its counts beside it — and its picture is in the purpose card
|
|
609
|
+
under the header. A one-to-one chat keeps its picture here. */ ""}
|
|
610
|
+
${group ? null : html`<span class="av" aria-hidden="true"><span class="av-text">${firstCharacter(title || "?") || "?"}</span></span>`}
|
|
611
|
+
<span class=${`hub-chat-title${group ? " one-line" : ""}`}><strong>${title}</strong><span class=${`s${room.agent?.answerOnly?" hub-answer-only-note":""}`}>${line2}</span>${room.assistant||room.agent?.intro?html`<span class="s hub-agent-intro-line">${room.assistant?hi("assistant"):room.agent.intro}</span>`:null}</span>
|
|
612
|
+
${officeOn && !narrow ? html`<nav class="inst-switch seg hub-room-tabs" aria-label=${hroom("roomViews", title)}>${["chat", "office"].map((v) => {
|
|
613
|
+
const label = hroom(v === "chat" ? "tabChat" : "tabOffice"), on = (v === "office") === inOffice;
|
|
614
|
+
return html`<a key=${v} class=${`seg-item${on ? " active" : ""}`} href=${officeHref(v)} aria-current=${on ? "page" : undefined} data-label=${label}
|
|
615
|
+
onClick=${(e) => { if (e.metaKey || e.ctrlKey || e.shiftKey || e.button > 0) return; e.preventDefault(); onView(v); }}>${label}</a>`; })}</nav>` : null}
|
|
586
616
|
<span class="hub-head-tools"><${RoomPinsButton} count=${pinCount} onOpen=${() => setPinsOpen(true)} /><${TextSizeButton} /><${HubNotifyToggle} /></span>
|
|
587
617
|
${group && Panel ? html`<button type="button" class="icon-btn hub-room-rail-toggle" aria-pressed=${(wide ? rail : sheet) ? "true" : "false"} title=${hroom("members")} aria-label=${hroom("members")}
|
|
588
618
|
onClick=${() => (wide ? setRail(!rail) : setSheet(true))}><${Icon} name="team" size=${18} /></button>` : null}
|
|
589
619
|
${menuItems.length ? html`<${Menu} cls="hub-room-menu" label=${hroom("menu")} fit=${true} ownerKey=${roomId} items=${menuItems} />` : null}
|
|
590
620
|
</header>
|
|
621
|
+
${inOffice ? html`<${RoomOffice} key=${roomId} client=${client} roomId=${roomId} members=${detail?.members || []}
|
|
622
|
+
onMention=${(m) => { mentionNext.current = m; onView("chat"); }} more=${narrow && officeMore} onMore=${narrow ? setOfficeMore : null} />` : null}
|
|
623
|
+
${!inOffice && group && typeof room.purpose === "string" ? html`<${RoomPurposeCard} initial=${firstCharacter(title || "?") || "?"} purpose=${room.purpose}
|
|
624
|
+
onEdit=${detail?.me?.role === "manager" && client.roomPurposeV1 === true ? openSettings : undefined} />` : null}
|
|
591
625
|
${leaveError ? html`<p class="err hub-room-leave-err" role="alert">${leaveError}</p>` : null}
|
|
592
626
|
${room.closureReason === "owner-stopped-sharing" ? html`<p class="note" role="status">${hroom("noAnswerStopped", room.ownerName || room.agent?.owner?.name || "")}</p>` : null}
|
|
593
|
-
|
|
627
|
+
${inOffice ? null : html`<${Thread} store=${store} name=${title} panelKey=${`hub-room:${roomId}`} threadRef=${threadRef} extra=${extra}
|
|
594
628
|
emptyView=${room.assistant ? html`<div class="hub-assistant-empty"><${Empty} icon="bot" title=${hroom("hubAssistant")} hint=${hroom("hubAssistantEmpty")} /></div>`
|
|
595
|
-
: group ? html`<p class="note">${hroom("composerHint")}</p>` : null}
|
|
596
|
-
${/* M-3117: under the thread, the Fleet chat's dock — its column, its padding, the working line and the box in it.
|
|
597
|
-
|
|
629
|
+
: group ? html`<p class="note">${hroom("composerHint")}</p>` : null} />`}
|
|
630
|
+
${/* M-3117: under the thread, the Fleet chat's dock — its column, its padding, the working line and the box in it.
|
|
631
|
+
M-3533 R1: the office shows none (design §2.1: no message box under it; to ask, back to Chat). It stays mounted, hidden,
|
|
632
|
+
so a draft and the mentions picked into it are still there when Chat comes back. */ ""}
|
|
633
|
+
${html`<div class="dock hub-dock" data-trust="composer" hidden=${inOffice}><div class="dock-col">
|
|
598
634
|
${working ? html`<${WorkBarView} kind="working" label=${working.text} elapsed="" elapsedTitle="" />` : null}
|
|
599
635
|
<${RoomComposer} store=${sendStore} detail=${detail} reply=${reply} onReply=${setReply} closed=${store.closed()} inputRef=${input} insertRef=${insert}
|
|
600
636
|
attach=${attach} pending=${pending} canSendEmpty=${files.some((f) => f.state === "ready")} />
|
|
601
|
-
</div></div
|
|
637
|
+
</div></div>`}
|
|
602
638
|
</section>
|
|
603
639
|
${showRail ? html`<${RailFrame} trust="hub-context" label=${hroom("members")} title=${hroom("members")} closeLabel=${hroom("cancel")} onClose=${() => setRail(false)}>${panel}</${RailFrame}>` : null}
|
|
604
640
|
${!wide && sheet && panel && group ? html`<${Dialog} title=${hroom("members")} label=${hroom("members")} onClose=${() => setSheet(false)}><div class="hub-rail-sheet">${panel}</div></${Dialog}>` : null}
|
package/dist/ui/hub-strings.js
CHANGED
|
@@ -147,7 +147,7 @@ register("hub", {
|
|
|
147
147
|
hold_rejected: "Hub 無法繼續使用這個 Fleet 儲存的連接。Hub 可能已還原至較舊的狀態,或不再接受這個 Fleet;請重新連接。",
|
|
148
148
|
hold_refused: "Hub 拒絕了這次連接。", hold_revoked: "Hub 已撤銷這個 Fleet 的連接。", hold_other: "連接已暫停。",
|
|
149
149
|
contactLimit: "回答 Hub 的提問時,這個 Agent 不能聯絡其他 Agent",
|
|
150
|
-
contactLimitHint: "Hub
|
|
150
|
+
contactLimitHint: "Hub 上的人可以向這個 Agent 提問,但不能透過它找到你的其他 Agent。回答獲接受或經過 30 分鐘後解除。",
|
|
151
151
|
contactLimitNotice: "現有分享已開啟聯絡限制。若要讓 Agent 在回答 Hub 提問時互相協助,請到「設定 → Hub → 分享的 Agent」取消勾選「回答 Hub 的提問時,這個 Agent 不能聯絡其他 Agent」。",
|
|
152
152
|
contactNoticeDone: "知道了",
|
|
153
153
|
sharedTitle: "分享的 Agent",
|
package/dist/ui/log-row.js
CHANGED
|
@@ -12,7 +12,7 @@ register("log", {
|
|
|
12
12
|
en: {
|
|
13
13
|
user: "Asked", assistant: "Replied", error: "Error", errorCode: "Error {0}", turnEnd: "Turn ended", turnEndIn: "Turn ended · {0}",
|
|
14
14
|
compacted: "Conversation compacted", turn: "Turn",
|
|
15
|
-
running: "running", done: "done", failed: "failed", interrupted: "interrupted", exit: "exit {0}",
|
|
15
|
+
running: "running", done: "done", failed: "failed", interrupted: "interrupted", background: "started in the background", exit: "exit {0}",
|
|
16
16
|
showScreen: "Show what was on screen", hideScreen: "Hide what was on screen",
|
|
17
17
|
showOutput: "Show output", hideOutput: "Hide output", args: "Arguments", output: "Output", noOutput: "No output.",
|
|
18
18
|
showAll: "Show all", showLess: "Show less", cut: "… {0} more characters not shown.", tooLarge: "Output of {0}: only its start is shown.",
|
|
@@ -25,12 +25,12 @@ register("log", {
|
|
|
25
25
|
"zh-TW": {
|
|
26
26
|
user: "收到要求", assistant: "回覆", error: "錯誤", errorCode: "錯誤 {0}", turnEnd: "回合結束", turnEndIn: "回合結束 · {0}",
|
|
27
27
|
compacted: "對話已壓縮", turn: "回合",
|
|
28
|
-
running: "執行中", done: "完成", failed: "失敗", interrupted: "中斷", exit: "結束碼 {0}",
|
|
28
|
+
running: "執行中", done: "完成", failed: "失敗", interrupted: "中斷", background: "已在背景啟動", exit: "結束碼 {0}",
|
|
29
29
|
showScreen: "顯示當時的畫面", hideScreen: "隱藏當時的畫面",
|
|
30
30
|
showOutput: "顯示輸出", hideOutput: "隱藏輸出", args: "參數", output: "輸出", noOutput: "沒有輸出。",
|
|
31
31
|
showAll: "顯示全部", showLess: "收合", cut: "… 還有 {0} 個字元沒有顯示。", tooLarge: "輸出共 {0},只顯示開頭。",
|
|
32
32
|
times: "×{0}", newer: "{0} 則新的",
|
|
33
|
-
cat_read: "讀取", cat_edit: "編輯", cat_search: "搜尋", cat_run: "執行", cat_web: "網頁", cat_mcp: "MCP", cat_agent: "子
|
|
33
|
+
cat_read: "讀取", cat_edit: "編輯", cat_search: "搜尋", cat_run: "執行", cat_web: "網頁", cat_mcp: "MCP", cat_agent: "子 Agent",
|
|
34
34
|
cat_plan: "計畫", cat_message: "訊息", cat_other: "工具", plan_items: "{0} 項",
|
|
35
35
|
said: "說了", thinking: "思考", thinkingMore: "顯示完整思考", thinkingLess: "收合",
|
|
36
36
|
expand: "顯示細節", collapse: "隱藏細節", command: "指令", removed: "移除", added: "新增",
|
|
@@ -279,7 +279,9 @@ export function LogRow({ x, prev, paths, chat, compact, latest }) {
|
|
|
279
279
|
const failed = x.status === "failed" || x.status === "interrupted" || (typeof x.exitCode === "number" && x.exitCode !== 0);
|
|
280
280
|
const running = x.status === "running";
|
|
281
281
|
const mark = running ? html`<span class="log-status running"><span class="spinner" aria-hidden="true"></span>${tl("running")}</span>`
|
|
282
|
-
: failed ? html`<span class=${`log-status ${x.status === "interrupted" ? "interrupted" : "failed"}`}>${tl(x.status === "interrupted" ? "interrupted" : "failed")}${typeof x.exitCode === "number" && x.exitCode !== 0 ? ` · ${tl("exit", x.exitCode)}` : ""}${x.durationMs ? ` · ${duration(x.durationMs)}` : ""}</span>`
|
|
282
|
+
: failed ? html`<span class=${`log-status ${x.status === "interrupted" ? "interrupted" : "failed"}`}>${tl(x.status === "interrupted" ? "interrupted" : "failed")}${typeof x.exitCode === "number" && x.exitCode !== 0 ? ` · ${tl("exit", x.exitCode)}` : ""}${x.durationMs ? ` · ${duration(x.durationMs)}` : ""}</span>`
|
|
283
|
+
// M-3541: a subagent started in the background: the call is done, the subagent runs on (the Subagents row).
|
|
284
|
+
: x.background ? html`<span class="log-status background">${tl("background")}</span>` : null;
|
|
283
285
|
const view = inputView(x, cat);
|
|
284
286
|
const has = !!(x.body || x.bodyBytes || (view && (view.code || view.diff || view.raw)));
|
|
285
287
|
const middle = subject || x.tool || tl(`cat_${cat}`);
|
|
@@ -323,7 +325,7 @@ export function LogRow({ x, prev, paths, chat, compact, latest }) {
|
|
|
323
325
|
const cat = x.cat || "other";
|
|
324
326
|
const subject = cat === "plan" && x.subject ? tl("plan_items", x.subject) : short(x.subject || "");
|
|
325
327
|
const quiet = compact && (x.status || "done") === "done" && !(typeof x.exitCode === "number" && x.exitCode !== 0);
|
|
326
|
-
const status = quiet ? null : html`<span class=${`log-status ${x.status || "done"}`}>${x.status === "running" ? html`<span class="spinner" aria-hidden="true"></span>` : null}${tl(x.status || "done")}${typeof x.exitCode === "number" && x.exitCode !== 0 ? ` · ${tl("exit", x.exitCode)}` : ""}${x.durationMs ? ` · ${duration(x.durationMs)}` : ""}</span>`;
|
|
328
|
+
const status = quiet ? null : html`<span class=${`log-status ${x.background && x.status === "done" ? "background" : x.status || "done"}`}>${x.status === "running" ? html`<span class="spinner" aria-hidden="true"></span>` : null}${tl(x.background && x.status === "done" ? "background" : x.status || "done")}${typeof x.exitCode === "number" && x.exitCode !== 0 ? ` · ${tl("exit", x.exitCode)}` : ""}${x.durationMs ? ` · ${duration(x.durationMs)}` : ""}</span>`;
|
|
327
329
|
const label = html`<span class="log-cat">${tl(`cat_${cat}`)}</span>${subject ? html` <span class="log-subject mono" title=${x.subject && subject !== x.subject ? x.subject : null}>${subject}</span>` : null}${x.tool && !subject ? html` <span class="log-tool mono muted">${x.tool}</span>` : null}`;
|
|
328
330
|
const has = !!(x.body || x.input || x.bodyBytes);
|
|
329
331
|
row = html`${head(CAT_ICON[cat] || CAT_ICON.other, label, html`${x.repeat ? html`<span class="log-repeat">${tl("times", x.repeat)}</span>` : null}${status}`)}
|
|
@@ -25,7 +25,7 @@ export function useNativeForm({ name, inst, ctx }) {
|
|
|
25
25
|
const machine = machines.data?.machines?.find(item => item.id === machineId);
|
|
26
26
|
const native = (machineId ? machine?.inventory : catalog.data)?.clis?.find(cli => cli.id === inst.backend);
|
|
27
27
|
const state = (key, initial) => paneState.usePaneState ? paneState.usePaneState(ctx.formMemory, key, initial) : useState(initial);
|
|
28
|
-
const [form,setForm] = state("native", () => ({display_name:inst.display_name || name,description:inst.description || "",model:inst.model || "",systemPrompt:inst.systemPrompt || "",native_sandbox:inst.native_sandbox || "read-only",tags:Array.isArray(inst.tags) ? [...inst.tags] : []}));
|
|
28
|
+
const [form,setForm] = state("native", () => ({display_name:inst.display_name || name,description:inst.description || "",model:inst.model || "",systemPrompt:inst.systemPrompt || "",operations:inst.operations || "",native_sandbox:inst.native_sandbox || "read-only",tags:Array.isArray(inst.tags) ? [...inst.tags] : []}));
|
|
29
29
|
const set = key => value => setForm(current => ({...current,[key]:value}));
|
|
30
30
|
const dirty=Object.entries(form).some(([key,value])=>JSON.stringify(typeof value==="string"?value.trim():value)!==JSON.stringify(key==="display_name"?inst.display_name||name:key==="native_sandbox"?inst.native_sandbox||"read-only":key==="tags"?inst.tags||[]:inst[key]||""));
|
|
31
31
|
const ready = !!form.display_name.trim() && !(form.native_sandbox === "read-only" && native?.readOnlySupport === false);
|
|
@@ -67,7 +67,9 @@ export function NativeFields({ m, cat, idPrefix = "" }) {
|
|
|
67
67
|
<p class="s-info"><span aria-hidden="true">ⓘ</span><span>${pt("nativeLimits")}</span></p></${Card}></div>`;
|
|
68
68
|
return html`<div class="ap-grid"><${Card} title=${pt("cardSystemPrompt")} span=${true}>
|
|
69
69
|
<div class="field"><${Lab} id=${fieldId("ni-sys")} text=${tn("systemPrompt")} tip=${pt("tip_systemPromptNative")} /><textarea id=${fieldId("ni-sys")} rows="5" maxLength=${8000} value=${form.systemPrompt} onInput=${event => set("systemPrompt")(event.target.value)} /></div>
|
|
70
|
-
<p class="note">${pt("note_systemPrompt")}</p
|
|
70
|
+
<p class="note">${pt("note_systemPrompt")}</p>
|
|
71
|
+
<div class="field"><${Lab} id=${fieldId("ni-ops")} text=${pt("lbl_operations")} tip=${pt("tip_operations")} /><textarea id=${fieldId("ni-ops")} rows="4" maxLength=${2000} placeholder=${pt("ph_operations")} value=${form.operations} onInput=${event => set("operations")(event.target.value)} /></div>
|
|
72
|
+
<p class="note">${pt("note_operations")}</p></${Card}></div>`;
|
|
71
73
|
}
|
|
72
74
|
NativeFields.paneIds = true;
|
|
73
75
|
|