@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,362 @@
|
|
|
1
|
+
// A card's activity (Fleet › Tasks › a card's page): the comments, the progress log and the history are one timeline, oldest
|
|
2
|
+
// first, with the comment box under it. The card API still returns the three lists apart (comments, logs, history); they are
|
|
3
|
+
// merged here, so nothing on the server changes. A history line that only repeats a comment or a log entry ("commented",
|
|
4
|
+
// "logged") is dropped from the merge — the entry itself is shown. The one
|
|
5
|
+
// "logged" line with no entry of its own, a change of the card's watchers (`data.watchers`), stays as a history line.
|
|
6
|
+
// The timeline is read for progress, so what people and agents SAY and DO leads it: a comment has no box — a name and a time,
|
|
7
|
+
// the text under it, drawn by the chat's own Markdown renderer (safe by construction: it escapes first); a progress note is a
|
|
8
|
+
// line with its words in the text colour; the history is the quietest thing on the page (small, grey, a run of the same line
|
|
9
|
+
// from the same hand is one line "×3"); and a day change is a thin separator.
|
|
10
|
+
// The comment box completes `@` with the fleet's instance names: it only types `@<instance name>` into the text; what an
|
|
11
|
+
// @ does to that instance is the board's business (it reads the same plain text), not this box's.
|
|
12
|
+
// No style attribute anywhere (the CSP).
|
|
13
|
+
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
14
|
+
import { lang, t } from "/assets/app-i18n.js";
|
|
15
|
+
import "/assets/chat-render.js";
|
|
16
|
+
import "/assets/chat-strings.js";
|
|
17
|
+
import { Icon } from "/assets/ui-icons.js";
|
|
18
|
+
import { BoardOffNote, boardOffTargets, relTime } from "./fleet-task-common.js";
|
|
19
|
+
import { AgentTag } from "./fleet-task-run.js";
|
|
20
|
+
import { WhoCard } from "./fleet-task-owner.js";
|
|
21
|
+
import { insertAtTrigger, triggerAt, withoutCode } from "./trigger-complete.js";
|
|
22
|
+
|
|
23
|
+
export const TIMELINE_FILTERS = ["all", "comments", "log", "history"];
|
|
24
|
+
const RANK = { event: 0, log: 1, comment: 2 }; // at one instant: the move first, then the words that came with it
|
|
25
|
+
|
|
26
|
+
const when = (iso) => { const n = Date.parse(iso); return Number.isFinite(n) ? n : 0; };
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The card detail's three lists as one timeline, oldest first (pure: tests import it). Each entry:
|
|
30
|
+
* { key, type: "comment" | "log" | "event", at, who, by, text?, kind?, authorKind?, ev? } — `ev` is the history event;
|
|
31
|
+
* `by` is who made it (person | instance | script | system) when the server said, else "" (an older entry): an instance's is
|
|
32
|
+
* marked in the timeline.
|
|
33
|
+
*/
|
|
34
|
+
export function timelineOf(detail) {
|
|
35
|
+
const out = [];
|
|
36
|
+
for (const e of (detail && detail.comments) || []) out.push({ key: `c${e.id}`, type: "comment", at: e.at, who: e.author, by: e.authorKind || "", text: e.text, kind: e.kind, authorKind: e.authorKind });
|
|
37
|
+
for (const e of (detail && detail.logs) || []) out.push({ key: `l${e.id}`, type: "log", at: e.at, who: e.author, by: e.authorKind || "", text: e.text });
|
|
38
|
+
for (const ev of (detail && detail.history) || []) {
|
|
39
|
+
if (ev.type === "commented" || ev.type === "reordered") continue;
|
|
40
|
+
if (ev.type === "logged" && !(ev.data && ev.data.watchers)) continue; // a log entry is shown as itself; a watcher change has none (the board writes the event only)
|
|
41
|
+
out.push({ key: `h${ev.id}`, type: "event", at: ev.at, who: ev.actor, by: ev.actorKind || "", ev });
|
|
42
|
+
}
|
|
43
|
+
return out.map((e, i) => ({ e, i })).sort((a, b) => when(a.e.at) - when(b.e.at) || RANK[a.e.type] - RANK[b.e.type] || a.i - b.i).map((x) => x.e);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** The entries a filter shows: everything, or one kind of them. */
|
|
47
|
+
export function timelineShown(entries, filter) {
|
|
48
|
+
const type = { comments: "comment", log: "log", history: "event" }[filter];
|
|
49
|
+
return type ? entries.filter((e) => e.type === type) : entries;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ── Completing an @ ───────────────────────────────────────
|
|
53
|
+
|
|
54
|
+
// The word at the caret and its replacement are the shared trigger-complete.js's, with the trigger "@": the list
|
|
55
|
+
// is offered only where the board would read the name as a mention (task-board-mentions.ts), and what is typed in is read
|
|
56
|
+
// back as that instance. withoutCode is the board's own, re-exported for the tests.
|
|
57
|
+
export { withoutCode };
|
|
58
|
+
|
|
59
|
+
/** The `@name` being typed at the caret, or null: { start: where the "@" is, query: the characters after it }. */
|
|
60
|
+
export const mentionAt = (text, caret) => triggerAt(text, caret, "@");
|
|
61
|
+
|
|
62
|
+
/** The names that complete a query: those starting with it first, then those containing it; case does not matter. */
|
|
63
|
+
export function mentionMatches(names, query, limit = 8) {
|
|
64
|
+
const q = query.toLocaleLowerCase();
|
|
65
|
+
const lower = (n) => n.toLocaleLowerCase();
|
|
66
|
+
const starts = names.filter((n) => lower(n).startsWith(q));
|
|
67
|
+
const inside = names.filter((n) => !lower(n).startsWith(q) && lower(n).includes(q));
|
|
68
|
+
return [...starts, ...inside].slice(0, limit);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The text with the `@query` at `m` replaced by `@name ` (one space after, unless one is already there), and where the
|
|
73
|
+
* caret goes. `names`: the fleet's — the board reads the longest instance name that fits, so a name that the text after the
|
|
74
|
+
* caret would run on into a longer one gets a space of its own.
|
|
75
|
+
*/
|
|
76
|
+
export const insertMention = (text, m, caret, name, names = []) => insertAtTrigger(text, m, caret, "@", name, names);
|
|
77
|
+
|
|
78
|
+
// ── The timeline ──────────────────────────────────────────
|
|
79
|
+
|
|
80
|
+
const fullTime = (iso) => { const d = new Date(iso); return Number.isFinite(d.getTime()) ? d.toLocaleString() : ""; };
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* A run of the same history line from the same hand ("web-user changed acceptance" three times in a row) is one entry with a
|
|
84
|
+
* `count` and the latest time (pure: tests import it). Only history lines merge; a comment or a progress note never does.
|
|
85
|
+
* `describe(ev)` words a history event (the page's).
|
|
86
|
+
*/
|
|
87
|
+
export function collapseEvents(entries, describe) {
|
|
88
|
+
const out = [];
|
|
89
|
+
for (const e of entries) {
|
|
90
|
+
const prev = out[out.length - 1];
|
|
91
|
+
if (prev && e.type === "event" && prev.type === "event" && prev.who === e.who && prev.by === e.by && describe(prev.ev) === describe(e.ev)) {
|
|
92
|
+
out[out.length - 1] = { ...prev, count: (prev.count || 1) + 1, at: e.at };
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
out.push(e);
|
|
96
|
+
}
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** The device's calendar day of a time ("2026-11-18"), or "" when it is none. */
|
|
101
|
+
export function dayKey(iso) {
|
|
102
|
+
const d = new Date(iso);
|
|
103
|
+
if (!Number.isFinite(d.getTime())) return "";
|
|
104
|
+
return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** A day's name for the separator: Today, Yesterday, else "Wed, Nov 11" (with the year when it is not this one). */
|
|
108
|
+
export function dayLabel(iso, now = Date.now()) {
|
|
109
|
+
const key = dayKey(iso);
|
|
110
|
+
if (!key) return "";
|
|
111
|
+
if (key === dayKey(now)) return t("taskcard.today");
|
|
112
|
+
if (key === dayKey(new Date(now).setDate(new Date(now).getDate() - 1))) return t("taskcard.yesterday");
|
|
113
|
+
const d = new Date(iso);
|
|
114
|
+
const sameYear = d.getFullYear() === new Date(now).getFullYear();
|
|
115
|
+
return d.toLocaleDateString(lang() === "zh-TW" ? "zh-TW" : "en-US", { weekday: "short", month: "short", day: "numeric", ...(sameYear ? {} : { year: "numeric" }) });
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** A comment's text as the chat draws a message (Markdown, escaped first); the plain text when the renderer is not there. */
|
|
119
|
+
const commentHtml = (text) => {
|
|
120
|
+
const r = globalThis.AgendChatRender;
|
|
121
|
+
return r && typeof r.renderMarkdown === "function" ? { __html: r.renderMarkdown(text) } : null;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The stream's items (pure: tests import it): what people and agents SAY — a comment, a progress note — is a card each; the
|
|
126
|
+
* system's lines (history) between two cards are a run, of any length, and a run is folded into one "› N activities" row at first
|
|
127
|
+
*. `entries` are what the filter shows (a run of equal history lines already one line: `collapseEvents`); `group:
|
|
128
|
+
* false` (the History filter, which asks to see them) keeps every line on its own, open.
|
|
129
|
+
* Each item: { kind: "card", entry } | { kind: "run", key, entries, fold } — `fold`: the run starts closed.
|
|
130
|
+
*/
|
|
131
|
+
export function streamOf(entries, group = true) {
|
|
132
|
+
const out = [];
|
|
133
|
+
for (const entry of entries) {
|
|
134
|
+
if (entry.type !== "event") { out.push({ kind: "card", entry }); continue; }
|
|
135
|
+
const last = out[out.length - 1];
|
|
136
|
+
if (last && last.kind === "run") last.entries.push(entry);
|
|
137
|
+
else out.push({ kind: "run", key: `run-${entry.key}`, entries: [entry] });
|
|
138
|
+
}
|
|
139
|
+
for (const item of out) if (item.kind === "run") item.fold = group;
|
|
140
|
+
return out;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const timeOf = (entry) => html`<time class="muted tl-time" dateTime=${entry.at} title=${fullTime(entry.at)}>${relTime(entry.at)}</time>`;
|
|
144
|
+
|
|
145
|
+
// ── A comment's text as the chat draws a message ─────────────
|
|
146
|
+
|
|
147
|
+
/** The chat's copy: the clipboard, else a hidden text area (a plain-http page has no clipboard API). */
|
|
148
|
+
async function copyText(text) {
|
|
149
|
+
try { if (navigator.clipboard && globalThis.isSecureContext) { await navigator.clipboard.writeText(text); return true; } } catch { /* fall back */ }
|
|
150
|
+
const ta = document.createElement("textarea"); ta.value = text; ta.setAttribute("readonly", ""); ta.className = "offscreen";
|
|
151
|
+
document.body.appendChild(ta); ta.select();
|
|
152
|
+
let ok = false; try { ok = document.execCommand("copy"); } catch { ok = false; }
|
|
153
|
+
ta.remove();
|
|
154
|
+
return ok;
|
|
155
|
+
}
|
|
156
|
+
const storedWrap = () => { try { return localStorage.getItem("agend_code_wrap") === "1"; } catch { return false; } };
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Code blocks as the chat's thread draws them (chat-thread.js `decorateCode`, the same classes, so the same sheet styles them):
|
|
160
|
+
* a header with the language, Wrap and Copy, and a block of more than CODE_FOLD_LINES lines folded until opened. Built from nodes.
|
|
161
|
+
*/
|
|
162
|
+
export function decorateCode(root) {
|
|
163
|
+
if (!root || typeof root.querySelectorAll !== "function") return;
|
|
164
|
+
const doc = root.ownerDocument;
|
|
165
|
+
const R = globalThis.AgendChatRender;
|
|
166
|
+
const limit = R && Number.isFinite(R.CODE_FOLD_LINES) ? R.CODE_FOLD_LINES : 30;
|
|
167
|
+
const lineCount = R && typeof R.lineCount === "function" ? R.lineCount : (c) => String(c).split("\n").length;
|
|
168
|
+
for (const pre of root.querySelectorAll("pre")) {
|
|
169
|
+
if (pre.parentNode && pre.parentNode.classList && pre.parentNode.classList.contains("codeblock")) continue;
|
|
170
|
+
const box = doc.createElement("div"); box.className = "codeblock";
|
|
171
|
+
const head = doc.createElement("div"); head.className = "cb-head";
|
|
172
|
+
const lang = doc.createElement("span"); lang.className = "cb-lang"; lang.textContent = pre.dataset.lang || "text";
|
|
173
|
+
const wrap = doc.createElement("button"); wrap.type = "button"; wrap.className = "chip-btn"; wrap.dataset.act = "toggleWrap"; wrap.textContent = t("chat.wrap");
|
|
174
|
+
const copy = doc.createElement("button"); copy.type = "button"; copy.className = "chip-btn"; copy.dataset.act = "copyCode"; copy.textContent = t("chat.copy");
|
|
175
|
+
head.append(lang, wrap, copy);
|
|
176
|
+
pre.replaceWith(box); box.append(head, pre);
|
|
177
|
+
const lines = lineCount(pre.textContent);
|
|
178
|
+
if (lines > limit) {
|
|
179
|
+
box.classList.add("folded");
|
|
180
|
+
const more = doc.createElement("button"); more.type = "button"; more.className = "cb-more"; more.dataset.act = "toggleFold";
|
|
181
|
+
more.dataset.lines = String(lines); more.textContent = t("chat.showAll", lines);
|
|
182
|
+
box.append(more);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** A click on one of a decorated block's buttons (Copy, Wrap, Show all), as the chat's thread answers it. */
|
|
188
|
+
async function onCodeClick(e) {
|
|
189
|
+
const el = e.target && e.target.closest ? e.target.closest("[data-act]") : null;
|
|
190
|
+
if (!el) return;
|
|
191
|
+
const act = el.dataset.act;
|
|
192
|
+
if (act === "copyCode") {
|
|
193
|
+
const pre = el.closest(".codeblock") && el.closest(".codeblock").querySelector("pre");
|
|
194
|
+
if (!pre) return;
|
|
195
|
+
const ok = await copyText(pre.textContent);
|
|
196
|
+
const was = el.dataset.label || el.textContent; el.dataset.label = was;
|
|
197
|
+
el.textContent = t(ok ? "chat.copied" : "chat.copyFailed");
|
|
198
|
+
setTimeout(() => { el.textContent = was; }, 1200);
|
|
199
|
+
} else if (act === "toggleWrap") {
|
|
200
|
+
const stream = el.closest(".tl");
|
|
201
|
+
if (!stream) return;
|
|
202
|
+
const on = stream.classList.toggle("wrap-code");
|
|
203
|
+
try { localStorage.setItem("agend_code_wrap", on ? "1" : "0"); } catch { /* this page only */ }
|
|
204
|
+
} else if (act === "toggleFold") {
|
|
205
|
+
const box = el.closest(".codeblock");
|
|
206
|
+
if (!box) return;
|
|
207
|
+
const folded = box.classList.toggle("folded");
|
|
208
|
+
el.textContent = !folded ? t("chat.showLess") : t("chat.showAll", el.dataset.lines);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** A comment's body: the chat's Markdown, its code blocks decorated as the chat's are. */
|
|
213
|
+
function MdBody({ body }) {
|
|
214
|
+
const ref = useRef(null);
|
|
215
|
+
useEffect(() => { decorateCode(ref.current); });
|
|
216
|
+
return html`<div class="tl-body md" ref=${ref} onClick=${onCodeClick} dangerouslySetInnerHTML=${body}></div>`;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* One entry. A comment and a progress note are each a card (the same: a head with the avatar — an instance's with its state
|
|
221
|
+
* dot —, the name, an "Agent" badge, a tag for what it is, and the time; the text under the name); a history line is a thin row
|
|
222
|
+
* with an icon (a status change's is the status's), the sentence and the time, no box. `who`: the board's cards and the project's
|
|
223
|
+
* lead, for the avatar's info card.
|
|
224
|
+
*/
|
|
225
|
+
function Entry({ entry, describe, who }) {
|
|
226
|
+
const time = timeOf(entry);
|
|
227
|
+
const agent = entry.by === "instance";
|
|
228
|
+
const mark = agent ? " by-agent" : "";
|
|
229
|
+
const kind = entry.by === "person" ? "person" : entry.by === "instance" ? "instance" : entry.by ? "none" : "";
|
|
230
|
+
const author = html`<${WhoCard} name=${entry.who} kind=${kind} presence=${agent} cards=${who && who.cards} lead=${who && who.lead} />`;
|
|
231
|
+
if (entry.type === "comment") {
|
|
232
|
+
const body = commentHtml(entry.text);
|
|
233
|
+
return html`<li class=${`tl-item tl-card tl-comment${entry.authorKind === "person" ? " person" : ""}${mark}`}>
|
|
234
|
+
<div class="tl-head">${author}${agent ? html`<${AgentTag} />` : null}
|
|
235
|
+
${entry.kind === "reject" ? html`<span class="tb-tag st-blocked">${t("taskcard.rejectTag")}</span>` : null}
|
|
236
|
+
${entry.kind === "approve" ? html`<span class="tb-tag st-done">${t("taskcard.approveTag")}</span>` : null}
|
|
237
|
+
${time}</div>
|
|
238
|
+
${body ? html`<${MdBody} body=${body} />` : html`<div class="tl-body">${entry.text}</div>`}</li>`;
|
|
239
|
+
}
|
|
240
|
+
if (entry.type === "log") {
|
|
241
|
+
return html`<li class=${`tl-item tl-card tl-log${mark}`}>
|
|
242
|
+
<div class="tl-head">${author}${agent ? html`<${AgentTag} />` : null}<span class="tb-tag tl-kind" title=${t("taskcard.logTip")}>${t("taskcard.show.log")}</span>${time}</div>
|
|
243
|
+
<div class="tl-body">${entry.text}</div></li>`;
|
|
244
|
+
}
|
|
245
|
+
const to = entry.ev && entry.ev.type === "moved" && entry.ev.data ? entry.ev.data.to : null;
|
|
246
|
+
return html`<li class="tl-item tl-line tl-event"><span class="tl-mark" aria-hidden="true"><span class=${`tb-dot${to ? ` st-${to}` : ""}`}></span></span>
|
|
247
|
+
<span class="tl-sentence"><span class="tl-who"><b>${entry.who}</b>${agent ? html` <${AgentTag} />` : null}</span> <span class="tl-text">${describe(entry.ev)}${entry.count > 1 ? html` <span class="tl-count" title=${t("taskcard.repeated", entry.count)}>×${entry.count}</span>` : null}</span></span>${time}</li>`;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** A run of system lines: one "› N activities" button that opens and closes them (the History filter's runs are always open, no button). */
|
|
251
|
+
function Run({ run, describe, open, onToggle }) {
|
|
252
|
+
const n = run.entries.length;
|
|
253
|
+
return html`<li class="tl-run">
|
|
254
|
+
${run.fold ? html`<button type="button" class="tl-more" aria-expanded=${open ? "true" : "false"} onClick=${onToggle}>
|
|
255
|
+
<span class="tl-mark" aria-hidden="true"><${Icon} name="chevron" size=${14} cls=${open ? "tb-chev open" : "tb-chev"} /></span><span>${n === 1 ? t("taskcard.activity1") : t("taskcard.activities", n)}</span></button>` : null}
|
|
256
|
+
${open ? html`<ul class="tl-lines">${run.entries.map((e) => html`<${Entry} key=${e.key} entry=${e} describe=${describe} />`)}</ul>` : null}
|
|
257
|
+
</li>`;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** The activity stream with its filter (all, comments, progress log, history). `describe(ev)` words a history event. */
|
|
261
|
+
export function Timeline({ detail, describe, cards = [], lead = null }) {
|
|
262
|
+
const [filter, setFilter] = useState("all");
|
|
263
|
+
const [toggled, setToggled] = useState({});
|
|
264
|
+
const all = timelineOf(detail);
|
|
265
|
+
// The number on a filter button is the number of lines the list shows for it: a run of equal history lines is one.
|
|
266
|
+
const count = (f) => collapseEvents(timelineShown(all, f), describe).length;
|
|
267
|
+
const shown = collapseEvents(timelineShown(all, filter), describe);
|
|
268
|
+
// A day change is a separator — only when the stream spans more than one day (one day needs no heading); a run never crosses it.
|
|
269
|
+
const days = new Set(shown.map((e) => dayKey(e.at)).filter(Boolean));
|
|
270
|
+
const parts = [];
|
|
271
|
+
let day = "";
|
|
272
|
+
for (const e of shown) {
|
|
273
|
+
const k = dayKey(e.at);
|
|
274
|
+
if (!parts.length || (days.size > 1 && k && k !== day)) parts.push({ day: days.size > 1 && k ? e.at : "", entries: [] });
|
|
275
|
+
if (k) day = k;
|
|
276
|
+
parts[parts.length - 1].entries.push(e);
|
|
277
|
+
}
|
|
278
|
+
const who = { cards, lead };
|
|
279
|
+
const rows = [];
|
|
280
|
+
for (const part of parts) {
|
|
281
|
+
if (part.day) rows.push(html`<li key=${`d${dayKey(part.day)}`} class="tl-day" role="presentation"><span>${dayLabel(part.day)}</span></li>`);
|
|
282
|
+
for (const item of streamOf(part.entries, filter === "all")) {
|
|
283
|
+
if (item.kind === "card") rows.push(html`<${Entry} key=${item.entry.key} entry=${item.entry} describe=${describe} who=${who} />`);
|
|
284
|
+
else {
|
|
285
|
+
const open = item.fold ? toggled[item.key] === true : true;
|
|
286
|
+
rows.push(html`<${Run} key=${item.key} run=${item} describe=${describe} open=${open} onToggle=${() => setToggled((cur) => ({ ...cur, [item.key]: !open }))} />`);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return html`<section class=${`tl${storedWrap() ? " wrap-code" : ""}`} aria-label=${t("taskcard.activity")}>
|
|
291
|
+
<div class="tl-bar"><h3>${t("taskcard.activity")}</h3>
|
|
292
|
+
<div class="tb-seg tl-filter" role="group" aria-label=${t("taskcard.activityShow")}>${TIMELINE_FILTERS.map((f) =>
|
|
293
|
+
html`<button key=${f} type="button" aria-pressed=${filter === f ? "true" : "false"} class=${`tb-seg-btn${filter === f ? " active" : ""}`} title=${f === "log" ? t("taskcard.logTip") : undefined} onClick=${() => setFilter(f)}>${t(`taskcard.show.${f}`)}${f === "all" ? "" : ` ${count(f)}`}</button>`)}</div></div>
|
|
294
|
+
${shown.length ? html`<ol class="tl-list">${rows}</ol>`
|
|
295
|
+
: html`<p class="muted tl-none">${t(all.length ? "taskcard.nothingHere" : "taskcard.noActivity")}</p>`}
|
|
296
|
+
</section>`;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// ── The comment box ───────────────────────────────────────
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* The comment box: Ctrl+Enter or Send posts it; typing `@` offers the instance names (arrows and Enter or Tab choose, Esc
|
|
303
|
+
* closes the list, not the box). `names`: [{ name, off }] — an instance with the task board off is listed, not choosable; one the
|
|
304
|
+
* comment would reach (the card's `assignee`, an @name in the text) with the board off is named under the box, with where to turn it on.
|
|
305
|
+
* `onSend(text)` resolves "ok" for the text to clear.
|
|
306
|
+
*/
|
|
307
|
+
export function Composer({ placeholder, names, assignee, onSend }) {
|
|
308
|
+
const [text, setText] = useState("");
|
|
309
|
+
const [caret, setCaret] = useState(0);
|
|
310
|
+
const [hidden, setHidden] = useState(false);
|
|
311
|
+
const [active, setActive] = useState(0);
|
|
312
|
+
const [sending, setSending] = useState(false);
|
|
313
|
+
const busy = useRef(false);
|
|
314
|
+
const box = useRef(null);
|
|
315
|
+
const pending = useRef(null); // where the caret goes once the inserted name is in the box
|
|
316
|
+
const m = hidden ? null : mentionAt(text, caret);
|
|
317
|
+
const found = m ? mentionMatches(names.map((n) => n.name), m.query).map((n) => names.find((x) => x.name === n)) : [];
|
|
318
|
+
const open = found.length > 0;
|
|
319
|
+
useEffect(() => { setActive(0); }, [m ? m.query : null, open]);
|
|
320
|
+
useEffect(() => {
|
|
321
|
+
if (pending.current === null || !box.current) return;
|
|
322
|
+
const c = pending.current;
|
|
323
|
+
pending.current = null;
|
|
324
|
+
try { box.current.focus(); box.current.setSelectionRange(c, c); } catch { /* no selection API */ }
|
|
325
|
+
});
|
|
326
|
+
const note = (e) => setCaret(e.target.selectionStart ?? e.target.value.length);
|
|
327
|
+
function choose(item) {
|
|
328
|
+
if (!item || item.off || !m) return;
|
|
329
|
+
const r = insertMention(text, m, caret, item.name, names.map((n) => n.name));
|
|
330
|
+
pending.current = r.caret;
|
|
331
|
+
setText(r.text);
|
|
332
|
+
setCaret(r.caret);
|
|
333
|
+
}
|
|
334
|
+
async function send() {
|
|
335
|
+
if (!text.trim() || busy.current) return;
|
|
336
|
+
busy.current = true;
|
|
337
|
+
setSending(true);
|
|
338
|
+
try { if ((await onSend(text.trim())) === "ok") { setText(""); setCaret(0); } } finally { setSending(false); busy.current = false; }
|
|
339
|
+
}
|
|
340
|
+
function onKey(e) {
|
|
341
|
+
if (open && (e.key === "ArrowDown" || e.key === "ArrowUp")) { e.preventDefault(); setActive((i) => (i + (e.key === "ArrowDown" ? 1 : found.length - 1)) % found.length); return; }
|
|
342
|
+
if (open && (e.key === "Enter" || e.key === "Tab") && !e.ctrlKey && !e.metaKey && !e.shiftKey && !e.isComposing) {
|
|
343
|
+
if (found[active] && !found[active].off) { e.preventDefault(); choose(found[active]); return; }
|
|
344
|
+
}
|
|
345
|
+
if (e.key === "Escape") { e.preventDefault(); e.stopPropagation(); if (open) setHidden(true); else e.currentTarget.blur(); return; }
|
|
346
|
+
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) { e.preventDefault(); void send(); }
|
|
347
|
+
}
|
|
348
|
+
return html`<${BoardOffNote} names=${boardOffTargets(names, assignee, text)} textKey="tasks.boardOffCommentNote" />
|
|
349
|
+
<div class="tc-composer">
|
|
350
|
+
<div class="tc-compose-box">
|
|
351
|
+
${open ? html`<ul class="tc-mentions" role="listbox" aria-label=${t("taskcard.mentionList")}>${found.map((n, i) => html`<li key=${n.name} role="option" aria-selected=${i === active ? "true" : "false"} class=${i === active ? "active" : ""}>
|
|
352
|
+
<button type="button" tabindex="-1" disabled=${!!n.off} title=${n.off ? t("tasks.boardOffHint") : undefined}
|
|
353
|
+
onPointerDown=${(e) => e.preventDefault()} onClick=${() => choose(n)}>
|
|
354
|
+
<span class="tc-mention-name">@${n.name}</span>${n.off ? html`<span class="muted">${t("taskcard.boardOffShort")}</span>` : null}</button></li>`)}</ul>` : null}
|
|
355
|
+
<textarea ref=${box} rows="3" value=${text} placeholder=${placeholder} aria-label=${t("taskcard.commentHint")}
|
|
356
|
+
aria-autocomplete="list" aria-expanded=${open ? "true" : "false"}
|
|
357
|
+
onInput=${(e) => { setText(e.target.value); setHidden(false); note(e); }} onClick=${note} onKeyUp=${(e) => { if (/^(Arrow|Home$|End$)/.test(String(e.key || ""))) note(e); }}
|
|
358
|
+
onKeyDown=${onKey}></textarea>
|
|
359
|
+
</div>
|
|
360
|
+
<button type="button" class="btn btn-primary btn-sm" disabled=${sending || !text.trim()} onClick=${send}>${t("taskcard.send")}</button>
|
|
361
|
+
</div>`;
|
|
362
|
+
}
|