@songsid/agend 2.4.0-beta.26 → 2.4.0-beta.28
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 +2 -1
- package/dist/agent-cli.js +6 -0
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-endpoint.d.ts +1 -0
- package/dist/agent-endpoint.js +5 -0
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/agent-whats-new.js +4 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/backend/kiro-auth-store.d.ts +15 -2
- package/dist/backend/kiro-auth-store.js +64 -0
- package/dist/backend/kiro-auth-store.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/adapters/discord.js +4 -4
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/adapters/telegram.js +3 -3
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/ipc-bridge.d.ts +7 -0
- package/dist/channel/ipc-bridge.js +45 -11
- package/dist/channel/ipc-bridge.js.map +1 -1
- package/dist/channel/mcp-server.js +3 -1
- package/dist/channel/mcp-server.js.map +1 -1
- package/dist/channel/mcp-tools.js +6 -4
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/claude-turn-boundaries.d.ts +15 -0
- package/dist/claude-turn-boundaries.js +88 -0
- package/dist/claude-turn-boundaries.js.map +1 -0
- package/dist/cli.js +35 -2
- package/dist/cli.js.map +1 -1
- package/dist/contact-auth-service.js +3 -0
- package/dist/contact-auth-service.js.map +1 -1
- package/dist/contact-auth-store.d.ts +16 -0
- package/dist/contact-auth-store.js +61 -1
- package/dist/contact-auth-store.js.map +1 -1
- package/dist/daemon.d.ts +76 -4
- package/dist/daemon.js +621 -115
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-outbox.d.ts +145 -7
- package/dist/delivery-outbox.js +373 -8
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/detached-fleet-stop.d.ts +40 -0
- package/dist/detached-fleet-stop.js +126 -0
- package/dist/detached-fleet-stop.js.map +1 -0
- package/dist/fleet-lock.d.ts +5 -0
- package/dist/fleet-lock.js +21 -2
- package/dist/fleet-lock.js.map +1 -1
- package/dist/fleet-manager.d.ts +499 -5
- package/dist/fleet-manager.js +2917 -217
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-windows-runtime.d.ts +39 -3
- package/dist/fleet-windows-runtime.js +208 -30
- package/dist/fleet-windows-runtime.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +5 -0
- package/dist/general-knowledge/skills/hub/SKILL.md +5 -1
- package/dist/general-knowledge/skills/task-board/SKILL.md +14 -0
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +96 -26
- package/dist/hub/admin-dashboard.js +1 -1
- package/dist/hub/admin-dashboard.js.map +1 -1
- package/dist/hub/agent-catalog.d.ts +1 -1
- package/dist/hub/agent-catalog.js +4 -3
- package/dist/hub/agent-catalog.js.map +1 -1
- package/dist/hub/agent-intro.d.ts +1 -1
- package/dist/hub/agent-intro.js +1 -1
- package/dist/hub/agent-intro.js.map +1 -1
- package/dist/hub/agent-pictures.d.ts +1 -1
- package/dist/hub/agent-pictures.js +4 -3
- package/dist/hub/agent-pictures.js.map +1 -1
- package/dist/hub/catalog.d.ts +2 -2
- package/dist/hub/catalog.js +16 -13
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/client.js +9 -2
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.js +8 -1
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.js +4 -2
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/fleet-updates.d.ts +2 -2
- package/dist/hub/fleet-updates.js +7 -5
- package/dist/hub/fleet-updates.js.map +1 -1
- package/dist/hub/fleet-versions.d.ts +1 -1
- package/dist/hub/fleet-versions.js +3 -2
- package/dist/hub/fleet-versions.js.map +1 -1
- package/dist/hub/http/compose.js +57 -30
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/schema.js +4 -1
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/join/service.d.ts +6 -0
- package/dist/hub/join/service.js +10 -0
- package/dist/hub/join/service.js.map +1 -1
- package/dist/hub/member/room-ask.js +2 -0
- package/dist/hub/member/room-ask.js.map +1 -1
- package/dist/hub/member/room-post.d.ts +4 -0
- package/dist/hub/member/room-post.js +26 -1
- package/dist/hub/member/room-post.js.map +1 -1
- package/dist/hub/protocol.d.ts +58 -0
- package/dist/hub/protocol.js +3 -2
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/quota.d.ts +2 -2
- package/dist/hub/quota.js +6 -4
- package/dist/hub/quota.js.map +1 -1
- package/dist/hub/read-statement.d.ts +6 -0
- package/dist/hub/read-statement.js +33 -0
- package/dist/hub/read-statement.js.map +1 -0
- package/dist/hub/recommendations.d.ts +1 -1
- package/dist/hub/recommendations.js +3 -2
- package/dist/hub/recommendations.js.map +1 -1
- package/dist/hub/representative.d.ts +2 -0
- package/dist/hub/representative.js +8 -4
- package/dist/hub/representative.js.map +1 -1
- package/dist/hub/roles/clock.d.ts +1 -1
- package/dist/hub/roles/clock.js +9 -7
- package/dist/hub/roles/clock.js.map +1 -1
- package/dist/hub/roles/read.d.ts +4 -0
- package/dist/hub/roles/read.js +37 -7
- package/dist/hub/roles/read.js.map +1 -1
- package/dist/hub/room-history-model.d.ts +87 -0
- package/dist/hub/room-history-model.js +14 -0
- package/dist/hub/room-history-model.js.map +1 -0
- package/dist/hub/rooms/agents.d.ts +1 -1
- package/dist/hub/rooms/agents.js +3 -2
- package/dist/hub/rooms/agents.js.map +1 -1
- package/dist/hub/rooms/history.d.ts +8 -0
- package/dist/hub/rooms/history.js +31 -0
- package/dist/hub/rooms/history.js.map +1 -0
- package/dist/hub/rooms/schema.d.ts +2 -0
- package/dist/hub/rooms/schema.js +4 -0
- package/dist/hub/rooms/schema.js.map +1 -1
- package/dist/hub/rooms/service.d.ts +35 -19
- package/dist/hub/rooms/service.js +105 -26
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/server.js +10 -3
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/session-epoch.js +2 -1
- package/dist/hub/session-epoch.js.map +1 -1
- package/dist/hub/settings-directory-decision.js +14 -7
- package/dist/hub/settings-directory-decision.js.map +1 -1
- package/dist/hub/settings-member-address-decision.js +3 -2
- package/dist/hub/settings-member-address-decision.js.map +1 -1
- package/dist/hub/settings-web-address-decision.js +2 -1
- package/dist/hub/settings-web-address-decision.js.map +1 -1
- package/dist/hub/store.d.ts +5 -0
- package/dist/hub/store.js +28 -5
- package/dist/hub/store.js.map +1 -1
- package/dist/hub/types.d.ts +2 -2
- package/dist/hub-agent-incarnation-record.d.ts +24 -0
- package/dist/hub-agent-incarnation-record.js +46 -0
- package/dist/hub-agent-incarnation-record.js.map +1 -0
- package/dist/human-delivery-receipts.d.ts +16 -4
- package/dist/human-delivery-receipts.js +26 -5
- package/dist/human-delivery-receipts.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +9 -3
- package/dist/instance-lifecycle.js +27 -10
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.d.ts +1 -1
- package/dist/local-pane-endpoint.d.ts +14 -0
- package/dist/local-pane-endpoint.js +32 -0
- package/dist/local-pane-endpoint.js.map +1 -1
- package/dist/locale.js +68 -4
- package/dist/locale.js.map +1 -1
- package/dist/native-agent-admission.js +9 -0
- package/dist/native-agent-admission.js.map +1 -1
- package/dist/native-exec-context.d.ts +11 -0
- package/dist/native-exec-context.js +18 -0
- package/dist/native-exec-context.js.map +1 -0
- package/dist/native-exec-input.d.ts +56 -0
- package/dist/native-exec-input.js +89 -0
- package/dist/native-exec-input.js.map +1 -0
- package/dist/native-mcp.d.ts +9 -1
- package/dist/native-mcp.js +29 -7
- package/dist/native-mcp.js.map +1 -1
- package/dist/native-pane-lifecycle.d.ts +3 -0
- package/dist/native-pane-lifecycle.js +2 -0
- package/dist/native-pane-lifecycle.js.map +1 -1
- package/dist/native-pane-manager.d.ts +18 -0
- package/dist/native-pane-manager.js +85 -8
- package/dist/native-pane-manager.js.map +1 -1
- package/dist/needs-you.d.ts +2 -1
- package/dist/needs-you.js.map +1 -1
- package/dist/outbound-handlers.d.ts +1 -0
- package/dist/outbound-handlers.js +9 -3
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +8 -0
- package/dist/outbound-schemas.js +6 -2
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/public-web-gateway.js +3 -1
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/recover.cjs +1 -0
- package/dist/reply-buttons-controller.d.ts +1 -0
- package/dist/reply-buttons-controller.js +1 -1
- package/dist/reply-buttons-controller.js.map +1 -1
- package/dist/request-contact-gate.d.ts +2 -0
- package/dist/request-contact-gate.js +8 -3
- package/dist/request-contact-gate.js.map +1 -1
- package/dist/request-context-activation.d.ts +29 -0
- package/dist/request-context-activation.js +85 -0
- package/dist/request-context-activation.js.map +1 -0
- package/dist/request-context-admission.d.ts +22 -0
- package/dist/request-context-admission.js +12 -0
- package/dist/request-context-admission.js.map +1 -0
- package/dist/request-context-boot.d.ts +35 -0
- package/dist/request-context-boot.js +97 -0
- package/dist/request-context-boot.js.map +1 -0
- package/dist/request-context-call.d.ts +3 -0
- package/dist/request-context-call.js.map +1 -1
- package/dist/request-context-compatibility.js +10 -2
- package/dist/request-context-compatibility.js.map +1 -1
- package/dist/request-context-continuation.d.ts +6 -0
- package/dist/request-context-continuation.js +24 -0
- package/dist/request-context-continuation.js.map +1 -0
- package/dist/request-context-control-api.d.ts +119 -0
- package/dist/request-context-control-api.js +179 -0
- package/dist/request-context-control-api.js.map +1 -0
- package/dist/request-context-control-copy.d.ts +3 -0
- package/dist/request-context-control-copy.js +7 -0
- package/dist/request-context-control-copy.js.map +1 -0
- package/dist/request-context-controller.d.ts +44 -0
- package/dist/request-context-controller.js +129 -0
- package/dist/request-context-controller.js.map +1 -0
- package/dist/request-context-delivery-resolver.d.ts +13 -0
- package/dist/request-context-delivery-resolver.js +30 -0
- package/dist/request-context-delivery-resolver.js.map +1 -0
- package/dist/request-context-drain-projection.d.ts +8 -0
- package/dist/request-context-drain-projection.js +40 -0
- package/dist/request-context-drain-projection.js.map +1 -0
- package/dist/request-context-drain.d.ts +22 -0
- package/dist/request-context-drain.js +139 -7
- package/dist/request-context-drain.js.map +1 -1
- package/dist/request-context-enable-offer.d.ts +13 -0
- package/dist/request-context-enable-offer.js +31 -0
- package/dist/request-context-enable-offer.js.map +1 -0
- package/dist/request-context-exec-owner.d.ts +39 -0
- package/dist/request-context-exec-owner.js +128 -0
- package/dist/request-context-exec-owner.js.map +1 -0
- package/dist/request-context-go-back-view.d.ts +1 -0
- package/dist/request-context-go-back-view.js +17 -0
- package/dist/request-context-go-back-view.js.map +1 -0
- package/dist/request-context-helper-readiness.d.ts +14 -0
- package/dist/request-context-helper-readiness.js +23 -0
- package/dist/request-context-helper-readiness.js.map +1 -0
- package/dist/request-context-helper.d.ts +20 -0
- package/dist/request-context-helper.js +41 -0
- package/dist/request-context-helper.js.map +1 -0
- package/dist/request-context-hub-resolver.d.ts +29 -0
- package/dist/request-context-hub-resolver.js +90 -0
- package/dist/request-context-hub-resolver.js.map +1 -0
- package/dist/request-context-human-resolver.d.ts +20 -0
- package/dist/request-context-human-resolver.js +77 -0
- package/dist/request-context-human-resolver.js.map +1 -0
- package/dist/request-context-human.d.ts +112 -0
- package/dist/request-context-human.js +176 -0
- package/dist/request-context-human.js.map +1 -0
- package/dist/request-context-inputs.d.ts +21 -0
- package/dist/request-context-inputs.js +63 -0
- package/dist/request-context-inputs.js.map +1 -0
- package/dist/request-context-installation.d.ts +117 -0
- package/dist/request-context-installation.js +328 -0
- package/dist/request-context-installation.js.map +1 -0
- package/dist/request-context-knowledge.d.ts +5 -0
- package/dist/request-context-knowledge.js +32 -0
- package/dist/request-context-knowledge.js.map +1 -0
- package/dist/request-context-migration.d.ts +11 -0
- package/dist/request-context-migration.js +16 -3
- package/dist/request-context-migration.js.map +1 -1
- package/dist/request-context-native-human.d.ts +20 -0
- package/dist/request-context-native-human.js +91 -0
- package/dist/request-context-native-human.js.map +1 -0
- package/dist/request-context-native-output.d.ts +15 -0
- package/dist/request-context-native-output.js +46 -0
- package/dist/request-context-native-output.js.map +1 -0
- package/dist/request-context-native-result.d.ts +15 -0
- package/dist/request-context-native-result.js +46 -0
- package/dist/request-context-native-result.js.map +1 -0
- package/dist/request-context-off.d.ts +22 -0
- package/dist/request-context-off.js +77 -0
- package/dist/request-context-off.js.map +1 -0
- package/dist/request-context-outside-label.d.ts +5 -0
- package/dist/request-context-outside-label.js +28 -0
- package/dist/request-context-outside-label.js.map +1 -0
- package/dist/request-context-pane.d.ts +8 -0
- package/dist/request-context-pane.js +19 -0
- package/dist/request-context-pane.js.map +1 -1
- package/dist/request-context-pending-work.d.ts +11 -0
- package/dist/request-context-pending-work.js +43 -0
- package/dist/request-context-pending-work.js.map +1 -0
- package/dist/request-context-policy.d.ts +17 -1
- package/dist/request-context-policy.js +84 -6
- package/dist/request-context-policy.js.map +1 -1
- package/dist/request-context-readiness.d.ts +49 -0
- package/dist/request-context-readiness.js +64 -0
- package/dist/request-context-readiness.js.map +1 -0
- package/dist/request-context-recovery.d.ts +6 -2
- package/dist/request-context-recovery.js +25 -0
- package/dist/request-context-recovery.js.map +1 -1
- package/dist/request-context-relay.d.ts +2 -2
- package/dist/request-context-relay.js +10 -10
- package/dist/request-context-relay.js.map +1 -1
- package/dist/request-context-reply-pending.d.ts +16 -0
- package/dist/request-context-reply-pending.js +77 -0
- package/dist/request-context-reply-pending.js.map +1 -0
- package/dist/request-context-resolution.d.ts +35 -0
- package/dist/request-context-resolution.js +86 -0
- package/dist/request-context-resolution.js.map +1 -0
- package/dist/request-context-retirement.d.ts +21 -0
- package/dist/request-context-retirement.js +16 -0
- package/dist/request-context-retirement.js.map +1 -0
- package/dist/request-context-start.d.ts +15 -0
- package/dist/request-context-start.js +2 -0
- package/dist/request-context-start.js.map +1 -0
- package/dist/request-context-turns.d.ts +1 -1
- package/dist/request-context-turns.js +3 -2
- package/dist/request-context-turns.js.map +1 -1
- package/dist/request-context-unproved-label.d.ts +4 -0
- package/dist/request-context-unproved-label.js +25 -0
- package/dist/request-context-unproved-label.js.map +1 -0
- package/dist/request-context-update-guard.d.ts +15 -0
- package/dist/request-context-update-guard.js +54 -0
- package/dist/request-context-update-guard.js.map +1 -0
- package/dist/request-context-work.d.ts +50 -0
- package/dist/request-context-work.js +178 -0
- package/dist/request-context-work.js.map +1 -0
- package/dist/request-hub-context.d.ts +1 -0
- package/dist/request-hub-output.d.ts +2 -0
- package/dist/request-hub-output.js +12 -0
- package/dist/request-hub-output.js.map +1 -1
- package/dist/retained-human-control.d.ts +11 -0
- package/dist/retained-human-control.js +11 -0
- package/dist/retained-human-control.js.map +1 -0
- package/dist/runtime-build-info.js +1 -1
- package/dist/runtime-build-info.js.map +1 -1
- package/dist/runtime-cli.js +1 -1
- package/dist/runtime-cli.js.map +1 -1
- package/dist/runtime-client-store.js +7 -1
- package/dist/runtime-client-store.js.map +1 -1
- package/dist/runtime-client.js +15 -3
- package/dist/runtime-client.js.map +1 -1
- package/dist/runtime-coordinator.d.ts +23 -0
- package/dist/runtime-coordinator.js +103 -4
- package/dist/runtime-coordinator.js.map +1 -1
- package/dist/runtime-pane-mcp.d.ts +9 -0
- package/dist/runtime-pane-mcp.js +22 -2
- package/dist/runtime-pane-mcp.js.map +1 -1
- package/dist/runtime-protocol.d.ts +2 -0
- package/dist/runtime-protocol.js.map +1 -1
- package/dist/runtime-update-controller.js +1 -1
- package/dist/runtime-update-controller.js.map +1 -1
- package/dist/runtime-windows-bridge.d.ts +8 -0
- package/dist/runtime-windows-bridge.js +50 -3
- package/dist/runtime-windows-bridge.js.map +1 -1
- package/dist/scheduler/db.js +9 -0
- package/dist/scheduler/db.js.map +1 -1
- package/dist/scheduler/task-board-text.d.ts +3 -6
- package/dist/scheduler/task-board-text.js +15 -10
- package/dist/scheduler/task-board-text.js.map +1 -1
- package/dist/scheduler/task-board-unread.d.ts +90 -0
- package/dist/scheduler/task-board-unread.js +192 -0
- package/dist/scheduler/task-board-unread.js.map +1 -0
- package/dist/scheduler/task-board.d.ts +324 -6
- package/dist/scheduler/task-board.js +786 -47
- package/dist/scheduler/task-board.js.map +1 -1
- package/dist/service-install-handover.d.ts +52 -0
- package/dist/service-install-handover.js +50 -0
- package/dist/service-install-handover.js.map +1 -0
- package/dist/service-installer.d.ts +12 -0
- package/dist/service-installer.js +24 -10
- package/dist/service-installer.js.map +1 -1
- package/dist/settings-api.d.ts +2 -0
- package/dist/settings-api.js +4 -0
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-baseline.d.ts +1 -0
- package/dist/settings-baseline.js +5 -4
- package/dist/settings-baseline.js.map +1 -1
- package/dist/settings-confirmation.d.ts +2 -0
- package/dist/settings-confirmation.js +6 -0
- package/dist/settings-confirmation.js.map +1 -1
- package/dist/settings-effect.d.ts +2 -0
- package/dist/settings-effect.js +59 -1
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.d.ts +3 -0
- package/dist/settings-http-confirmation.js +29 -0
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/settings-route-lifetime.d.ts +3 -1
- package/dist/settings-route-lifetime.js +15 -5
- package/dist/settings-route-lifetime.js.map +1 -1
- package/dist/settings-transaction.d.ts +3 -2
- package/dist/settings-transaction.js.map +1 -1
- package/dist/task-board-tool.js +24 -3
- package/dist/task-board-tool.js.map +1 -1
- package/dist/task-board-waker.d.ts +53 -2
- package/dist/task-board-waker.js +183 -12
- package/dist/task-board-waker.js.map +1 -1
- package/dist/tips.js +1 -1
- package/dist/tips.js.map +1 -1
- package/dist/tool-permissions.js +3 -3
- package/dist/tool-permissions.js.map +1 -1
- package/dist/tool-receipt-output.d.ts +6 -6
- package/dist/transcript-monitor.d.ts +6 -1
- package/dist/transcript-monitor.js +59 -4
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/transcript-turns.d.ts +3 -0
- package/dist/transcript-turns.js +5 -0
- package/dist/transcript-turns.js.map +1 -1
- package/dist/turn-reply-guard.d.ts +16 -1
- package/dist/turn-reply-guard.js +20 -2
- package/dist/turn-reply-guard.js.map +1 -1
- package/dist/ui/app.html +2 -2
- package/dist/ui/contact-auth-strings.js +6 -6
- package/dist/ui/contact-authorizations.js +19 -1
- package/dist/ui/contact-grant-editor.js +71 -11
- package/dist/ui/contact-needs.js +27 -8
- package/dist/ui/contact-permissions.js +25 -8
- package/dist/ui/contact-tool-groups.js +1 -1
- package/dist/ui/fleet-task-activity.js +164 -24
- package/dist/ui/fleet-task-card.js +77 -13
- package/dist/ui/fleet-task-common.js +14 -0
- package/dist/ui/fleet-task-flow.js +353 -0
- package/dist/ui/fleet-task-md.js +1 -1
- package/dist/ui/fleet-task-run.js +98 -22
- package/dist/ui/fleet-task-thread.js +245 -0
- package/dist/ui/fleet-task-unread.js +100 -0
- package/dist/ui/fleet-task-view.js +6 -5
- package/dist/ui/fleet-task-wake.js +140 -0
- package/dist/ui/fleet-tasks.js +13 -6
- package/dist/ui/hub-client.js +3 -0
- package/dist/ui/hub-room-members.js +4 -2
- package/dist/ui/hub-room-settings-strings.js +8 -0
- package/dist/ui/hub-room-settings.js +32 -0
- package/dist/ui/hub-room-thread.js +7 -1
- package/dist/ui/icons/hub-apple-touch-icon.png +0 -0
- package/dist/ui/icons/hub-favicon.ico +0 -0
- package/dist/ui/icons/hub-favicon.svg +10 -0
- package/dist/ui/icons/hub-icon-192.png +0 -0
- package/dist/ui/icons/hub-icon-512.png +0 -0
- package/dist/ui/icons/hub-icon-maskable-192.png +0 -0
- package/dist/ui/icons/hub-icon-maskable-512.png +0 -0
- package/dist/ui/icons/hub-maskable.svg +12 -0
- package/dist/ui/panel-hub.js +14 -3
- package/dist/ui/panel-needs.js +2 -1
- package/dist/ui/panel-settings.js +2 -1
- package/dist/ui/panel-windows-cli.js +2 -2
- package/dist/ui/request-contact-card.js +287 -0
- package/dist/ui/request-contact-client.js +83 -0
- package/dist/ui/request-contact-page.js +78 -0
- package/dist/ui/request-context-control.js +209 -0
- package/dist/ui/settings-registry.js +2 -0
- package/dist/ui/settings-update.js +3 -2
- package/dist/ui/shared/access-overview.css +1 -1
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app-install.js +2 -2
- package/dist/ui/shared/app-shell.js +17 -4
- package/dist/ui/shared/app-stream.js +4 -1
- package/dist/ui/shared/app-update.js +2 -1
- package/dist/ui/shared/app.css +101 -10
- package/dist/ui/shared/app.js +19 -2
- package/dist/ui/shared/task-board.css +164 -0
- package/dist/ui/shared/ui-icons.js +3 -0
- package/dist/ui/shared/ui-states.js +6 -0
- package/dist/ui/shared/update-card-ui.js +178 -11
- package/dist/ui/shared/view-strings.js +18 -0
- package/dist/ui/shared/web-authorize.js +1 -1
- package/dist/ui/task-unread.js +70 -0
- package/dist/ui/windows-cli-catalog.js +33 -6
- package/dist/update-card.d.ts +1 -1
- package/dist/update-card.js +7 -7
- package/dist/update-card.js.map +1 -1
- package/dist/update-fix.d.ts +66 -0
- package/dist/update-fix.js +67 -0
- package/dist/update-fix.js.map +1 -0
- package/dist/update-goback.js +15 -3
- package/dist/update-goback.js.map +1 -1
- package/dist/update-readiness.d.ts +2 -0
- package/dist/update-readiness.js +5 -1
- package/dist/update-readiness.js.map +1 -1
- package/dist/update-snapshot-scope.js +1 -0
- package/dist/update-snapshot-scope.js.map +1 -1
- package/dist/usage/i18n-keys.d.ts +1 -1
- package/dist/usage/i18n-keys.js +9 -0
- package/dist/usage/i18n-keys.js.map +1 -1
- package/dist/usage/providers.d.ts +3 -11
- package/dist/usage/providers.js +93 -131
- package/dist/usage/providers.js.map +1 -1
- package/dist/web-api.d.ts +49 -1
- package/dist/web-api.js +234 -13
- package/dist/web-api.js.map +1 -1
- package/dist/web-chat-history.d.ts +2 -0
- package/dist/web-chat-history.js.map +1 -1
- package/dist/web-icons.d.ts +9 -3
- package/dist/web-icons.js +62 -5
- package/dist/web-icons.js.map +1 -1
- package/dist/web-update.d.ts +9 -0
- package/dist/windows-agents.d.ts +24 -2
- package/dist/windows-agents.js +110 -4
- package/dist/windows-agents.js.map +1 -1
- package/dist/windows-cli-api.js +4 -2
- package/dist/windows-cli-api.js.map +1 -1
- package/dist/windows-cli-worker.js +9 -1
- package/dist/windows-cli-worker.js.map +1 -1
- package/dist/windows-cli.d.ts +55 -1
- package/dist/windows-cli.js +147 -17
- package/dist/windows-cli.js.map +1 -1
- package/dist/windows-shortcuts.d.ts +3 -22
- package/dist/windows-shortcuts.js +5 -45
- package/dist/windows-shortcuts.js.map +1 -1
- package/dist/workflow-templates/default.md +3 -2
- package/dist/wsl-host.d.ts +52 -0
- package/dist/wsl-host.js +97 -0
- package/dist/wsl-host.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
// Comment threads on a card's page (Fleet › Tasks › a card; docs/design/task-board.md, "Comment threads"): what each comment of
|
|
2
|
+
// the activity stream offers — reply, react, edit, resolve a thread, copy, copy link, delete — as an issue tracker's comment
|
|
3
|
+
// menu does, and the recipient chip under the comment box (who a comment is for).
|
|
4
|
+
// Shared with the rest of the page, not new: the app's `Menu` (the ⋯ and the chip's list, `ui-menu.js`), the chat's reaction chip
|
|
5
|
+
// and quick picker (`.msg-reactions .reaction`, `QUICK_REACTIONS` of chat-thread.js), the chat's Markdown (`MdBody`), `confirmDialog`
|
|
6
|
+
// and `toast`. The rules themselves are the board's (scheduler/task-board.ts); this module only asks and shows — a refusal is
|
|
7
|
+
// said in the page's words (`tasks.err.*`). No style attribute anywhere (the CSP).
|
|
8
|
+
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
9
|
+
import { t, register } from "/assets/app-i18n.js";
|
|
10
|
+
import { Icon } from "/assets/ui-icons.js";
|
|
11
|
+
import { Menu } from "/assets/ui-menu.js";
|
|
12
|
+
import { QUICK_REACTIONS } from "/assets/chat-thread.js";
|
|
13
|
+
|
|
14
|
+
register("taskthread", {
|
|
15
|
+
en: {
|
|
16
|
+
reply: "Reply", react: "Add reaction", edit: "Edit", resolve: "Resolve thread", reopen: "Reopen thread", copy: "Copy", copyLink: "Copy link", delete: "Delete",
|
|
17
|
+
more: "Comment actions", copied: "Copied", linkCopied: "Link to the comment copied", copyFailed: "Could not copy",
|
|
18
|
+
edited: "edited", editedTip: "Edited {0}", save: "Save", cancel: "Cancel", editHint: "Ctrl+Enter saves · Esc drops the change", editLabel: "Edit the comment",
|
|
19
|
+
deleted: "This comment was deleted", deleteTitle: "Delete this comment?", deleteMsg: "Its words, reactions and files go. A line stays where it was, so the replies under it still make sense.",
|
|
20
|
+
reactions: "Reactions", reactedWith: "{0} reacted with {1}", reactedYou: "You", reactedMore: "{0} and {1} more", reactMine: "{0} (yours: press to take it back)",
|
|
21
|
+
replyingTo: "Replying to {0}", replyTo: "Reply to {0}", replyHint: "Reply — @ names an instance (Ctrl+Enter sends)",
|
|
22
|
+
resolved: "Resolved thread", resolvedBy: "Resolved by {0}", replyCount: "{0} replies", replyOne: "1 reply", showThread: "Show the thread", hideThread: "Hide the thread",
|
|
23
|
+
toNobody: "No agent notified", toSend: "{0} · starts when sent", toLabel: "Who this comment is for", toTip: "Who is woken when you send this comment. An @name in the text still wakes that instance too.",
|
|
24
|
+
toNobodyTip: "Nobody is woken (an @name in the text still is)", toWaits: "{0} · won't wake until the card is ready",
|
|
25
|
+
toWaitsTip: "This card still waits for another card, so a plain comment does not wake {0} yet (it reads the card when it can start). Choose {0} in the list to wake it now; an @name wakes it too.", groupAssignee: "Assignee", groupDispatcher: "Handed out by", groupWatchers: "Watching the card",
|
|
26
|
+
groupLead: "Project lead", groupLeadBoard: "Board leader", groupOthers: "Other instances", boardOff: "{0} (task board off)",
|
|
27
|
+
},
|
|
28
|
+
"zh-TW": {
|
|
29
|
+
reply: "回覆", react: "新增反應", edit: "編輯", resolve: "解決討論串", reopen: "重新開啟討論串", copy: "複製", copyLink: "複製連結", delete: "刪除",
|
|
30
|
+
more: "留言動作", copied: "已複製", linkCopied: "已複製這則留言的連結", copyFailed: "無法複製",
|
|
31
|
+
edited: "已編輯", editedTip: "編輯於 {0}", save: "儲存", cancel: "取消", editHint: "Ctrl+Enter 儲存 · Esc 放棄修改", editLabel: "編輯留言",
|
|
32
|
+
deleted: "這則留言已刪除", deleteTitle: "刪除這則留言?", deleteMsg: "內容、反應和附件都會移除。原位置會留一行,底下的回覆才讀得通。",
|
|
33
|
+
reactions: "反應", reactedWith: "{0} 用 {1} 回應", reactedYou: "你", reactedMore: "{0} 等 {1} 人", reactMine: "{0}(你按的:再按一次收回)",
|
|
34
|
+
replyingTo: "回覆 {0}", replyTo: "回覆 {0}", replyHint: "回覆 — 輸入 @ 可選 Agent(Ctrl+Enter 送出)",
|
|
35
|
+
resolved: "已解決的討論串", resolvedBy: "由 {0} 解決", replyCount: "{0} 則回覆", replyOne: "1 則回覆", showThread: "展開討論串", hideThread: "收合討論串",
|
|
36
|
+
toNobody: "不通知 Agent", toSend: "{0} · 送出後開始處理", toLabel: "這則留言要給誰", toTip: "送出時叫醒誰。文字裡的 @名稱照樣會叫醒該 Agent。",
|
|
37
|
+
toNobodyTip: "不叫醒任何人(文字裡的 @名稱照樣會)", toWaits: "{0} · 卡片可以開始前不會叫醒",
|
|
38
|
+
toWaitsTip: "這張卡還在等別張卡,所以一般留言暫時不會叫醒 {0}(它能開始時會讀到這張卡)。要現在叫醒它,請在清單裡選 {0};寫 @名稱 也會叫醒。", groupAssignee: "負責人", groupDispatcher: "派工者", groupWatchers: "關注這張卡的",
|
|
39
|
+
groupLead: "專案 leader", groupLeadBoard: "任務板 leader", groupOthers: "其他 Agent", boardOff: "{0}(任務板關閉)",
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// ── Threads (pure: tests import these) ─────────────────────
|
|
44
|
+
|
|
45
|
+
/** The comment entries a thread is made of keep their order; `rootOf` walks a reply up to its thread's first comment. */
|
|
46
|
+
export function rootOf(entry, byId) {
|
|
47
|
+
let cur = entry;
|
|
48
|
+
for (let hops = 0; cur && cur.parentId !== undefined && cur.parentId !== null && hops < 64; hops++) {
|
|
49
|
+
const up = byId.get(cur.parentId);
|
|
50
|
+
if (!up) break;
|
|
51
|
+
cur = up;
|
|
52
|
+
}
|
|
53
|
+
return cur;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The stream's entries with each reply moved under its thread's first comment: `{ ...root, replies: [entries in time order] }`;
|
|
58
|
+
* a comment whose parent is not among `all` (outside the page's window, left out of sight) stands alone. Only comments are
|
|
59
|
+
* grouped; a progress note, a history line or a comment the filter hid keeps its place. `all`: every comment of the card
|
|
60
|
+
* (a reply under a filter still finds its thread).
|
|
61
|
+
*/
|
|
62
|
+
export function threadize(entries, all) {
|
|
63
|
+
const byId = new Map();
|
|
64
|
+
for (const e of all) if (e.type === "comment" && e.id !== undefined) byId.set(e.id, e);
|
|
65
|
+
const shown = new Set(entries.filter((e) => e.type === "comment" && e.id !== undefined).map((e) => e.id));
|
|
66
|
+
const replies = new Map();
|
|
67
|
+
const out = [];
|
|
68
|
+
for (const e of entries) {
|
|
69
|
+
if (e.type !== "comment" || e.parentId === undefined || e.parentId === null) { out.push(e); continue; }
|
|
70
|
+
const root = rootOf(e, byId);
|
|
71
|
+
if (!root || root === e || !shown.has(root.id)) { out.push(e); continue; }
|
|
72
|
+
(replies.get(root.id) || replies.set(root.id, []).get(root.id)).push(e);
|
|
73
|
+
}
|
|
74
|
+
return out.map((e) => (e.type === "comment" && replies.has(e.id) ? { ...e, replies: replies.get(e.id) } : e));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** A reaction as its chip says it: the emoji, the number, whether it is the viewer's, and who (the tooltip). */
|
|
78
|
+
export function reactionView(reaction, viewer) {
|
|
79
|
+
const by = Array.isArray(reaction.by) ? reaction.by : [];
|
|
80
|
+
// The host says whether the chip is the viewer's (by their key); a host that does not, by name and kind as before.
|
|
81
|
+
const mine = typeof reaction.mine === "boolean" ? reaction.mine : !!viewer && by.some((b) => b.name === viewer.name && b.kind === viewer.kind);
|
|
82
|
+
// The viewer's own entry is "You"; another account with the same name still reads as that name.
|
|
83
|
+
let skipped = false;
|
|
84
|
+
const others = by.filter((b) => { if (mine && !skipped && viewer && b.name === viewer.name && b.kind === viewer.kind) { skipped = true; return false; } return true; }).map((b) => b.name);
|
|
85
|
+
const who = [...(mine ? [t("taskthread.reactedYou")] : []), ...others].slice(0, 3);
|
|
86
|
+
const rest = by.length - who.length;
|
|
87
|
+
const list = rest > 0 ? t("taskthread.reactedMore", who.join(", "), rest) : who.join(", ");
|
|
88
|
+
return { emoji: reaction.emoji, count: by.length, mine, label: t("taskthread.reactedWith", list, reaction.emoji) };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Whether the viewer wrote the comment (an edit is its author's). The host says (`mine`, from the writer's own key: two people who
|
|
93
|
+
* are both "web-user" are not each other); a host that does not say is read by the same name and the same kind.
|
|
94
|
+
*/
|
|
95
|
+
export const wroteComment = (entry, viewer) => !!viewer && (typeof entry.mine === "boolean" ? entry.mine : entry.who === viewer.name && entry.by === viewer.kind);
|
|
96
|
+
|
|
97
|
+
/** A comment's address: the card's page, the comment's anchor (`#c42`, which scrolls to it and lights it). */
|
|
98
|
+
export const commentHash = (id) => `#c${id}`;
|
|
99
|
+
export function commentUrl(href, cardId, id) {
|
|
100
|
+
const u = new URL(href);
|
|
101
|
+
u.searchParams.set("card", cardId);
|
|
102
|
+
u.hash = commentHash(id);
|
|
103
|
+
return u.toString();
|
|
104
|
+
}
|
|
105
|
+
/** The comment an address names (`#c42`), or null. */
|
|
106
|
+
export const commentInHash = (hash) => { const m = /^#c(\d{1,12})$/.exec(String(hash || "")); return m ? Number(m[1]) : null; };
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Whom a comment may be for, as the recipient chip lists them: groups in order — the card's assignee, who handed it out, who
|
|
110
|
+
* watches it, its leader, then every other instance of the fleet — each name once (the first group that has it). `fleet`:
|
|
111
|
+
* [{ name, off }] (the fleet's instances; one with the task board off is listed, not choosable). `detail`: the card read
|
|
112
|
+
* (watchers, inheritedWatchers, leader).
|
|
113
|
+
*/
|
|
114
|
+
export function recipientGroups({ card, detail, fleet }) {
|
|
115
|
+
const known = new Map((fleet || []).map((n) => [n.name, n]));
|
|
116
|
+
const seen = new Set();
|
|
117
|
+
const take = (names) => names.filter((n) => known.has(n) && !seen.has(n) && (seen.add(n), true)).map((n) => known.get(n));
|
|
118
|
+
const groups = [];
|
|
119
|
+
const add = (key, title, names) => { const list = take(names); if (list.length) groups.push({ key, title, names: list }); };
|
|
120
|
+
add("assignee", "taskthread.groupAssignee", card.assignee ? [card.assignee] : []);
|
|
121
|
+
add("dispatcher", "taskthread.groupDispatcher", card.dispatcher && card.dispatcher.kind === "instance" ? [card.dispatcher.name] : []);
|
|
122
|
+
add("watchers", "taskthread.groupWatchers", [...((detail && detail.watchers) || []), ...((detail && detail.inheritedWatchers) || [])]);
|
|
123
|
+
const lead = detail && detail.leader;
|
|
124
|
+
add("lead", lead && lead.via === "board" ? "taskthread.groupLeadBoard" : "taskthread.groupLead", lead ? [lead.name] : []);
|
|
125
|
+
add("others", "taskthread.groupOthers", (fleet || []).map((n) => n.name));
|
|
126
|
+
return groups;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Who the comment box starts with (null: nobody is notified). A reply: the author of the comment it answers, when that is an
|
|
131
|
+
* instance the board can wake. Otherwise the card's assignee, when it is an instance the board can wake and the card is not
|
|
132
|
+
* finished (a finished card's talk is rarely an order; choosing someone still wakes them). A person or no assignee: nobody.
|
|
133
|
+
* On a card that still waits on another card the assignee is the chip's name but `holdsRecipient` says it is not woken yet.
|
|
134
|
+
*/
|
|
135
|
+
export function defaultRecipient({ card, reply = null, fleet }) {
|
|
136
|
+
const live = (name) => !!name && (fleet || []).some((n) => n.name === name && !n.off);
|
|
137
|
+
if (reply && reply.by === "instance" && live(reply.who)) return reply.who;
|
|
138
|
+
const finished = card.status === "done" || card.status === "cancelled";
|
|
139
|
+
if (!finished && live(card.assignee)) return card.assignee;
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Whether the chip's starting name is held back: a new comment (not a reply) on an open card that still waits on another card, whose
|
|
145
|
+
* assignee is the name the chip starts with. The comment then goes with no recipient list, as #4367's rule has it: the assignee reads it
|
|
146
|
+
* when the card can start, and is not woken now. Choosing it in the list is asking for it by name — that sends it and wakes it.
|
|
147
|
+
*/
|
|
148
|
+
export function holdsRecipient({ card, reply = null, initial }) {
|
|
149
|
+
if (reply || !initial || initial !== card.assignee) return false;
|
|
150
|
+
return card.status === "open" && ((card.unmetDeps || []).length > 0 || card.hiddenUnmet > 0);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// ── The recipient chip ─────────────────────────────────────
|
|
154
|
+
|
|
155
|
+
/** The chip under the comment box: who this comment is for ("dev · starts when sent"); a click lists the others. `held`: the name is the card's assignee, not woken until the card is ready. */
|
|
156
|
+
export function RecipientChip({ groups, value, onChange, disabled = false, held = false }) {
|
|
157
|
+
const label = value ? t(held ? "taskthread.toWaits" : "taskthread.toSend", value) : t("taskthread.toNobody");
|
|
158
|
+
const items = [];
|
|
159
|
+
for (const g of groups) {
|
|
160
|
+
items.push({ key: `h-${g.key}`, heading: true, label: t(g.title) });
|
|
161
|
+
for (const n of g.names) items.push({ key: `n-${n.name}`, label: n.off ? t("taskthread.boardOff", n.name) : n.name, checked: value === n.name, disabled: !!n.off, title: n.off ? t("tasks.boardOffHint") : undefined, onSelect: () => onChange(n.name) });
|
|
162
|
+
}
|
|
163
|
+
items.push({ key: "nobody", label: t("taskthread.toNobody"), checked: value === null, title: t("taskthread.toNobodyTip"), onSelect: () => onChange(null) });
|
|
164
|
+
return html`<${Menu} cls="tc-to-menu" label=${t("taskthread.toLabel")} fit disabled=${disabled} items=${items} triggerClass="tc-to"
|
|
165
|
+
trigger=${html`<${Icon} name=${value ? "bot" : "bell"} size=${14} /><span class="tc-to-text" title=${value ? (held ? t("taskthread.toWaitsTip", value) : t("taskthread.toTip")) : t("taskthread.toNobodyTip")}>${label}</span><${Icon} name="chevron" size=${14} />`} />`;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// ── A comment's tools ──────────────────────────────────────
|
|
169
|
+
|
|
170
|
+
/** The ⋯ menu's items for one comment (pure: tests import it). `ctx`: { writable, viewer, root, resolved }, `act(name)` runs one. */
|
|
171
|
+
export function commentMenuItems(entry, ctx, act) {
|
|
172
|
+
const writable = !!ctx.writable && !!ctx.viewer;
|
|
173
|
+
const mine = writable && wroteComment(entry, ctx.viewer);
|
|
174
|
+
return [
|
|
175
|
+
writable && !entry.deleted ? { key: "reply", label: t("taskthread.reply"), icon: "reply", onSelect: () => act("reply") } : null,
|
|
176
|
+
writable && !entry.deleted ? { key: "react", label: t("taskthread.react"), icon: "smile", onSelect: () => act("react") } : null,
|
|
177
|
+
mine && !entry.deleted && entry.kind === "comment" ? { key: "edit", label: t("taskthread.edit"), icon: "edit", onSelect: () => act("edit") } : null,
|
|
178
|
+
writable && ctx.root ? { key: "resolve", label: ctx.resolved ? t("taskthread.reopen") : t("taskthread.resolve"), icon: "check", onSelect: () => act("resolve") } : null,
|
|
179
|
+
!entry.deleted ? { key: "copy", label: t("taskthread.copy"), icon: "copy", onSelect: () => act("copy") } : null,
|
|
180
|
+
{ key: "link", label: t("taskthread.copyLink"), icon: "link", onSelect: () => act("link") },
|
|
181
|
+
writable && !entry.deleted ? { key: "delete", label: t("taskthread.delete"), icon: "trash", danger: true, onSelect: () => act("delete") } : null,
|
|
182
|
+
].filter(Boolean);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** The reaction button and the ⋯ menu at a comment's top right. */
|
|
186
|
+
export function CommentTools({ entry, ctx, act }) {
|
|
187
|
+
const items = commentMenuItems(entry, ctx, act);
|
|
188
|
+
const writable = !!ctx.writable && !!ctx.viewer && !entry.deleted;
|
|
189
|
+
return html`<span class="tl-tools">
|
|
190
|
+
${writable ? html`<button type="button" class="icon-btn tl-tool" title=${t("taskthread.react")} aria-label=${t("taskthread.react")} aria-haspopup="true" aria-expanded=${ctx.picking === entry.id ? "true" : "false"}
|
|
191
|
+
onClick=${() => act("react")}><${Icon} name="smile" size=${16} /></button>` : null}
|
|
192
|
+
<${Menu} cls="tl-menu" label=${t("taskthread.more")} fit items=${items} />
|
|
193
|
+
</span>`;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** The quick reactions (the chat's own set), shown under a comment while "Add reaction" is open. */
|
|
197
|
+
export function ReactionPicker({ onPick, onClose }) {
|
|
198
|
+
const ref = useRef(null);
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
const first = ref.current && ref.current.querySelector("button");
|
|
201
|
+
if (first) first.focus({ preventScroll: true });
|
|
202
|
+
const key = (e) => { if (e.key === "Escape") { e.stopPropagation(); onClose(); } };
|
|
203
|
+
const away = (e) => { if (ref.current && !ref.current.contains(e.target) && !(e.target.closest && e.target.closest(".tl-tools"))) onClose(); };
|
|
204
|
+
document.addEventListener("keydown", key, true);
|
|
205
|
+
document.addEventListener("pointerdown", away, true);
|
|
206
|
+
return () => { document.removeEventListener("keydown", key, true); document.removeEventListener("pointerdown", away, true); };
|
|
207
|
+
}, []);
|
|
208
|
+
return html`<div class="react-pick tl-pick" ref=${ref} role="group" aria-label=${t("taskthread.reactions")}>${QUICK_REACTIONS.map((e) =>
|
|
209
|
+
html`<button key=${e} type="button" class="chip-btn react-opt" aria-label=${e} onClick=${() => onPick(e)}>${e}</button>`)}</div>`;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** A comment's reactions as the chat's chips: the emoji and the number; the viewer's is accented, and pressing it takes it back. */
|
|
213
|
+
export function ReactionBar({ entry, ctx, onReact }) {
|
|
214
|
+
const list = (entry.reactions || []).map((r) => reactionView(r, ctx.viewer)).filter((r) => r.count > 0);
|
|
215
|
+
if (!list.length) return null;
|
|
216
|
+
const live = !!ctx.writable && !!ctx.viewer;
|
|
217
|
+
return html`<div class="msg-reactions react-bar tl-reacts" role="group" aria-label=${t("taskthread.reactions")}>${list.map((r) => live
|
|
218
|
+
? html`<button key=${r.emoji} type="button" class=${`reaction react-chip${r.mine ? " mine" : ""}`} aria-pressed=${r.mine ? "true" : "false"} title=${r.mine ? t("taskthread.reactMine", r.label) : r.label} aria-label=${r.label}
|
|
219
|
+
onClick=${() => onReact(r.emoji, !r.mine)}><span class="e">${r.emoji}</span><span class="n">${r.count}</span></button>`
|
|
220
|
+
: html`<span key=${r.emoji} class=${`reaction react-chip${r.mine ? " mine" : ""}`} role="img" title=${r.label} aria-label=${r.label}><span class="e">${r.emoji}</span><span class="n">${r.count}</span></span>`)}</div>`;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** Editing a comment's words in place: Ctrl+Enter or Save keeps them, Esc or Cancel drops the change. `onSave(text)` resolves "ok" when it is kept. */
|
|
224
|
+
export function EditBox({ entry, onSave, onCancel }) {
|
|
225
|
+
const [text, setText] = useState(entry.text);
|
|
226
|
+
const [saving, setSaving] = useState(false);
|
|
227
|
+
const box = useRef(null);
|
|
228
|
+
useEffect(() => { const el = box.current; if (el) { el.focus({ preventScroll: true }); try { el.setSelectionRange(el.value.length, el.value.length); } catch { /* no selection API */ } } }, []);
|
|
229
|
+
const same = text.trim() === entry.text.trim();
|
|
230
|
+
async function save() {
|
|
231
|
+
if (saving || !text.trim() || same) { if (same) onCancel(); return; }
|
|
232
|
+
setSaving(true);
|
|
233
|
+
try { if ((await onSave(text.trim())) === "ok") onCancel(); } finally { setSaving(false); }
|
|
234
|
+
}
|
|
235
|
+
return html`<div class="tl-edit">
|
|
236
|
+
<textarea ref=${box} rows="3" value=${text} aria-label=${t("taskthread.editLabel")} onInput=${(e) => setText(e.target.value)}
|
|
237
|
+
onKeyDown=${(e) => {
|
|
238
|
+
if (e.key === "Escape") { e.preventDefault(); e.stopPropagation(); onCancel(); }
|
|
239
|
+
else if (e.key === "Enter" && (e.ctrlKey || e.metaKey) && !e.isComposing) { e.preventDefault(); void save(); }
|
|
240
|
+
}}></textarea>
|
|
241
|
+
<div class="tl-edit-foot"><span class="muted tl-edit-hint">${t("taskthread.editHint")}</span>
|
|
242
|
+
<button type="button" class="btn btn-sm" onClick=${onCancel}>${t("taskthread.cancel")}</button>
|
|
243
|
+
<button type="button" class="btn btn-primary btn-sm" disabled=${saving || !text.trim()} onClick=${() => void save()}>${t("taskthread.save")}</button></div>
|
|
244
|
+
</div>`;
|
|
245
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// What is new for this person on the board (Fleet › Tasks; docs/design/task-board.md, "Unread"): a dot with the number on the card that has
|
|
2
|
+
// something new (the board's tile, the list's row), and a strip at the top of Home and of a project's board that names the cards and says
|
|
3
|
+
// why — "dev answered you", "web-user replied to your comment", "dev mentioned you", "Waiting for your confirmation". Opening a card marks
|
|
4
|
+
// it read (task-unread.js). The numbers come from the app store (`taskUnread`, read from the server by task-unread.js): nothing here
|
|
5
|
+
// asks for anything, stores anything or carries a comment's words. A tile and a row never subscribe to the store themselves: the board reads
|
|
6
|
+
// it once (`useUnreadCards`) and redraws only when it changes. No style attribute anywhere (the CSP).
|
|
7
|
+
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
8
|
+
import { t, register } from "/assets/app-i18n.js";
|
|
9
|
+
import { appStore } from "/assets/app-store.js";
|
|
10
|
+
import { Icon } from "/assets/ui-icons.js";
|
|
11
|
+
import { relTime } from "./fleet-task-common.js";
|
|
12
|
+
import { installTaskUnread } from "./task-unread.js";
|
|
13
|
+
|
|
14
|
+
register("taskunread", {
|
|
15
|
+
en: {
|
|
16
|
+
title: "{0} task cards with new replies", titleOne: "1 task card has new replies", mark: "{0} new", markTip: "New for you: {0}",
|
|
17
|
+
"reason.answer": "{0} answered you", "reason.reply": "{0} replied to your comment", "reason.mention": "{0} mentioned you",
|
|
18
|
+
"reason.review": "Waiting for your confirmation", "reason.blocked": "Waiting for your answer", more: "+{0} more", seeMore: "{0} more cards", showFewer: "Show fewer",
|
|
19
|
+
short_answer: "Answered", short_reply: "Replied", short_mention: "Mentioned", short_review: "To confirm", short_blocked: "To answer",
|
|
20
|
+
},
|
|
21
|
+
"zh-TW": {
|
|
22
|
+
title: "{0} 張任務卡有新回覆", titleOne: "1 張任務卡有新回覆", mark: "{0} 則新動態", markTip: "給你的新動態:{0}",
|
|
23
|
+
"reason.answer": "{0} 回覆了你", "reason.reply": "{0} 回覆了你的留言", "reason.mention": "{0} 提到了你",
|
|
24
|
+
"reason.review": "等你確認", "reason.blocked": "等你回答", more: "另外 {0} 則", seeMore: "還有 {0} 張卡", showFewer: "收合",
|
|
25
|
+
short_answer: "已回覆", short_reply: "回覆你", short_mention: "提到你", short_review: "待確認", short_blocked: "待回答",
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const EMPTY = Object.freeze({});
|
|
30
|
+
/** The strongest first: what a card with several reasons says (the server orders them so, and sends them so). */
|
|
31
|
+
const SHOWN = 5;
|
|
32
|
+
|
|
33
|
+
/** The unread by card number the board draws marks from, redrawing the board only when the store's unread itself changes. */
|
|
34
|
+
export function useUnreadCards() {
|
|
35
|
+
const [, redraw] = useState(0);
|
|
36
|
+
const seen = useRef(null);
|
|
37
|
+
seen.current = appStore.get().taskUnread || null;
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
installTaskUnread(); // a tab from before an upgrade has this panel but not the new app.js
|
|
40
|
+
const changed = () => (appStore.get().taskUnread || null) !== seen.current;
|
|
41
|
+
if (changed()) redraw((n) => n + 1);
|
|
42
|
+
return appStore.subscribe(() => { if (changed()) redraw((n) => n + 1); });
|
|
43
|
+
}, []);
|
|
44
|
+
const u = seen.current;
|
|
45
|
+
return (u && u.enabled && u.cards) || EMPTY;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* A card's mark: its own unread and, for a main task, its sub tasks' (a reply on a sub task is news on the main task's tile too) —
|
|
50
|
+
* `{ n, reasons }` (reasons strongest first, each once), or null when none. Pure: tests import it.
|
|
51
|
+
*/
|
|
52
|
+
export function markFor(card, subs, unread) {
|
|
53
|
+
const own = unread && unread[card.id];
|
|
54
|
+
const list = [own, ...(subs || []).map((s) => unread && unread[s.id])].filter(Boolean);
|
|
55
|
+
if (!list.length) return null;
|
|
56
|
+
const order = ["review", "blocked", "reply", "answer", "mention"];
|
|
57
|
+
const reasons = order.filter((r) => list.some((u) => (u.reasons || []).includes(r)));
|
|
58
|
+
return { n: list.reduce((a, u) => a + (u.n || 0), 0), reasons };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The strip's heading: how many cards (one has its own sentence: "1 cards" is not English). */
|
|
62
|
+
export const stripTitle = (n) => (n === 1 ? t("taskunread.titleOne") : t("taskunread.title", n));
|
|
63
|
+
|
|
64
|
+
/** The words for one card's reason: who did it (the card's newest) and what. */
|
|
65
|
+
export const reasonText = (u) => {
|
|
66
|
+
const r = (u.reasons && u.reasons[0]) || "answer";
|
|
67
|
+
return t(`taskunread.reason.${r}`, u.by || "");
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/** The dot on a tile or a row: the number, and — to a screen reader — what is new. Nothing when there is none. */
|
|
71
|
+
export function UnreadMark({ unread }) {
|
|
72
|
+
if (!unread || !unread.n) return null;
|
|
73
|
+
const why = t(`taskunread.short_${(unread.reasons && unread.reasons[0]) || "answer"}`);
|
|
74
|
+
return html`<span class="tb-unread" role="img" aria-label=${t("taskunread.markTip", why)} title=${t("taskunread.markTip", why)}><span class="tb-unread-dot" aria-hidden="true"></span>${unread.n > 1 ? html`<span class="tb-unread-n">${unread.n}</span>` : null}</span>`;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The strip: the cards with something new, newest first (the first few; a line says how many more), each with its number, title
|
|
79
|
+
* and why. `cards`: the board's cards, for their titles (a card the board does not carry shows its number). Nothing when there is nothing.
|
|
80
|
+
*/
|
|
81
|
+
export function UnreadStrip({ cards, onOpen }) {
|
|
82
|
+
const unread = useUnreadCards();
|
|
83
|
+
// M-3908: "N more cards" opens the rest in the strip itself (each row opens its card, as the first five do); "Show fewer" folds it again.
|
|
84
|
+
const [all, setAll] = useState(false);
|
|
85
|
+
const codes = Object.keys(unread).sort((a, b) => (unread[a].at < unread[b].at ? 1 : unread[a].at > unread[b].at ? -1 : 0));
|
|
86
|
+
if (!codes.length) return null;
|
|
87
|
+
const byId = new Map((cards || []).map((c) => [c.id, c]));
|
|
88
|
+
const shown = all ? codes : codes.slice(0, SHOWN);
|
|
89
|
+
return html`<section class="tb-waiting tb-unread-strip" aria-label=${stripTitle(codes.length)}>
|
|
90
|
+
<h3 class="tb-section-title"><${Icon} name="bell" size=${16} />${stripTitle(codes.length)}</h3>
|
|
91
|
+
<ul class="rows">${shown.map((code) => {
|
|
92
|
+
const u = unread[code], card = byId.get(code);
|
|
93
|
+
return html`<li key=${code} class="row-item tb-unread-row" data-unread=${code}>
|
|
94
|
+
<button type="button" class="tb-wait-title" onClick=${() => onOpen(code)}><span class="tb-code">${code}</span> ${card ? card.title : ""}</button>
|
|
95
|
+
<span class="muted tb-unread-meta">${reasonText(u)}${u.n > 1 ? ` · ${t("taskunread.more", u.n - 1)}` : ""} · ${relTime(u.at)}</span>
|
|
96
|
+
</li>`;
|
|
97
|
+
})}</ul>
|
|
98
|
+
${codes.length > SHOWN ? html`<p class="tb-unread-more"><button type="button" class="tb-link" aria-expanded=${all ? "true" : "false"} onClick=${() => setAll(!all)}>${all ? t("taskunread.showFewer") : t("taskunread.seeMore", codes.length - SHOWN)}</button></p>` : null}
|
|
99
|
+
</section>`;
|
|
100
|
+
}
|
|
@@ -12,6 +12,7 @@ import { Menu } from "/assets/ui-menu.js";
|
|
|
12
12
|
import { RunMark, runOf } from "./fleet-task-run.js";
|
|
13
13
|
import "./fleet-task-files.js";
|
|
14
14
|
import { OwnerChip } from "./fleet-task-owner.js";
|
|
15
|
+
import { UnreadMark, markFor } from "./fleet-task-unread.js";
|
|
15
16
|
import { COLUMNS, ProgressBar, UNASSIGNED, Who, readStored, recentlyDone, relTime, reviewLabel, waitsForYou, waitsList, waitsOn, wrapUpText, writeStored } from "./fleet-task-common.js";
|
|
16
17
|
import { assetUrl } from "/assets/asset-url.js";
|
|
17
18
|
import { dateTimeText } from "/assets/clock-text.js";
|
|
@@ -444,7 +445,7 @@ function ListHead({ display, onDisplay, who }) {
|
|
|
444
445
|
* count (a click folds it away). A row shows its number, title, priority, assignee and last change; it opens its card; a
|
|
445
446
|
* main task's sub-task progress opens up its sub tasks under it (unless they are rows already); its ⋯ opens the card's menu.
|
|
446
447
|
*/
|
|
447
|
-
export function ListView({ rows, display, subsOf, byId, flashed, now, runs, expanded, onToggleSubs, onOpen, onMore, onOwner, cards = [], lead = null, writable = false, onDisplay, scope = "" }) {
|
|
448
|
+
export function ListView({ rows, display, subsOf, byId, flashed, now, runs, unread = null, expanded, onToggleSubs, onOpen, onMore, onOwner, cards = [], lead = null, writable = false, onDisplay, scope = "" }) {
|
|
448
449
|
const [folded, setFolded] = useState(readCollapsed);
|
|
449
450
|
const toggle = (id) => setFolded((cur) => { const next = new Set(cur); if (next.has(id)) next.delete(id); else next.add(id); writeCollapsed(next); return next; });
|
|
450
451
|
const groups = groupRows(orderRows(rows, display.order, byId, display.dir), display.group);
|
|
@@ -461,7 +462,7 @@ export function ListView({ rows, display, subsOf, byId, flashed, now, runs, expa
|
|
|
461
462
|
${shut ? null : html`<ul class="tb-rows">${g.rows.map((c) => {
|
|
462
463
|
const subs = subsOf.get(c.id) || [];
|
|
463
464
|
const lit = Math.max(flashed.get(c.id) || 0, ...(display.subs ? [] : subs.map((s) => flashed.get(s.id) || 0)));
|
|
464
|
-
return html`<${Row} key=${c.id} card=${c} subs=${subs} main=${c.kind === "sub" ? byId.get(c.parentId) : null} flash=${now - lit < 4000} now=${now} runs=${runs}
|
|
465
|
+
return html`<${Row} key=${c.id} card=${c} subs=${subs} main=${c.kind === "sub" ? byId.get(c.parentId) : null} flash=${now - lit < 4000} now=${now} runs=${runs} unread=${markFor(c, subs, unread)}
|
|
465
466
|
subsAsRows=${display.subs} who=${who} expanded=${!!expanded[c.id]} onToggleSubs=${() => onToggleSubs(c.id)} onOpen=${onOpen} onMore=${onMore}
|
|
466
467
|
onOwner=${onOwner} cards=${cards} lead=${lead} writable=${writable} />`;
|
|
467
468
|
})}</ul>`}
|
|
@@ -470,7 +471,7 @@ export function ListView({ rows, display, subsOf, byId, flashed, now, runs, expa
|
|
|
470
471
|
}
|
|
471
472
|
|
|
472
473
|
/** One card's row; its assignee is left out under an assignee's own heading. */
|
|
473
|
-
function Row({ card, subs, main, flash, now, runs, subsAsRows, who, expanded, onToggleSubs, onOpen, onMore, onOwner, cards, lead, writable }) {
|
|
474
|
+
function Row({ card, subs, main, flash, now, runs, unread = null, subsAsRows, who, expanded, onToggleSubs, onOpen, onMore, onOwner, cards, lead, writable }) {
|
|
474
475
|
const progress = card.progress;
|
|
475
476
|
const hasSubs = card.kind === "main" && !!progress && progress.total > 0;
|
|
476
477
|
const accepted = card.acceptance.filter((a) => a.done).length;
|
|
@@ -479,10 +480,10 @@ function Row({ card, subs, main, flash, now, runs, subsAsRows, who, expanded, on
|
|
|
479
480
|
// Its assignee (or, for a main task, a sub task's) is working on it now.
|
|
480
481
|
const run = runOf(card, runs, subs);
|
|
481
482
|
const bar = hasSubs ? html`<${ProgressBar} progress=${progress} /><span>${t("tasks.subProgress", progress.done, progress.total)}</span>` : null;
|
|
482
|
-
return html`<li class=${`tb-row st-${card.status}${card.kind === "sub" ? " is-sub" : ""}${flash ? " flash" : ""}${run && run.state === "working" && !run.shared ? " running" : ""}`} data-row=${card.id} onClick=${(e) => { if (e.target && e.target.closest && e.target.closest(".tb-owner-pop")) return; onOpen(card.id); }}>
|
|
483
|
+
return html`<li class=${`tb-row st-${card.status}${card.kind === "sub" ? " is-sub" : ""}${flash ? " flash" : ""}${run && run.state === "working" && !run.shared ? " running" : ""}${unread ? " has-unread" : ""}`} data-row=${card.id} onClick=${(e) => { if (e.target && e.target.closest && e.target.closest(".tb-owner-pop")) return; onOpen(card.id); }}>
|
|
483
484
|
<div class="tb-row-line">
|
|
484
485
|
<span class=${`tb-dot st-${card.status}`} role="img" aria-label=${t(`tasks.${card.status}`)} title=${t(`tasks.${card.status}`)}></span>
|
|
485
|
-
<span class="tb-code tb-row-code">${card.id}
|
|
486
|
+
<span class="tb-code tb-row-code">${card.id}<${UnreadMark} unread=${unread} /></span>
|
|
486
487
|
${main ? html`<span class="tb-row-main" title=${t("taskview.inMain", main.id, main.title)}>${main.id} ›</span>` : null}
|
|
487
488
|
<span class="tb-row-text">
|
|
488
489
|
<${RunMark} run=${run} />
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// What became of a comment — the status line under it (Fleet › Tasks › a card; docs/design/task-board.md, "Comment status"). A
|
|
2
|
+
// comment that was written for an instance (the card's assignee, the recipient chip's choice, an `@name`) says where it stands, in a
|
|
3
|
+
// person's words, until the instance has answered: "Sent to test" → "test read it" → "test is working…" → "test replied". When it could not
|
|
4
|
+
// be sent it says why (the instance is offline or paused, its task board is off, the loop guard held it, the delivery failed).
|
|
5
|
+
// It is read from what the card read carries (`comment.wakes`, only for a session that can write — the board's own record and the
|
|
6
|
+
// delivery outbox's state, never a key or the notice's text) and from what the page already knows: the instance's state (the same
|
|
7
|
+
// inference as the card's "Running", fleet-task-run.js — an agent is one continuing session, so "working" says it is busy, not that
|
|
8
|
+
// it is on this very comment) and the card's comments (a later comment by that instance is its reply). Nothing here is stored.
|
|
9
|
+
// Shared with the rest of the page, not new: the status dot's states (`dotState` through `instanceStates`), `Icon`, the page's tags.
|
|
10
|
+
// No style attribute anywhere (the CSP).
|
|
11
|
+
import { html } from "/assets/app-html.js";
|
|
12
|
+
import { t, register } from "/assets/app-i18n.js";
|
|
13
|
+
import { Icon } from "/assets/ui-icons.js";
|
|
14
|
+
|
|
15
|
+
register("taskwake", {
|
|
16
|
+
en: {
|
|
17
|
+
label: "Where this comment stands", sending: "Sent to {0}", queued: "Waiting for {0} to take it", offline: "{0} is offline — it gets this when it is back",
|
|
18
|
+
paused: "{0} is paused — it gets this when it is resumed", delivered: "Delivered to {0}", read: "{0} read it", working: "{0} is working…", replied: "{0} replied",
|
|
19
|
+
workingTip: "From {0}'s state: an agent is one continuing session, so it may be busy with something else", repliedTip: "Go to {0}'s reply",
|
|
20
|
+
failed: "Could not deliver to {0}", "fail.expired": "Could not deliver to {0}: it stayed unavailable until the notice expired",
|
|
21
|
+
"fail.attempts": "Could not deliver to {0}: several tries did not get through", "fail.other": "Could not deliver to {0}: sending it into {0}'s session failed",
|
|
22
|
+
uncertain: "Not sure {0} got it", withdrawn: "The notice to {0} was withdrawn: the card changed again, and {0} hears its new state",
|
|
23
|
+
"skip.board_off": "{0} was not woken: its task board is off", "skip.contact_held": "{0} was not woken: this conversation may not reach another instance on its own",
|
|
24
|
+
"skip.loop_guard": "{0} was not woken: agents have answered each other several times (loop guard) — it wakes again once a person writes",
|
|
25
|
+
"skip.unknown": "There is no instance named {0}, so nobody was woken for it", "skip.cap": "{0} was not woken: an agent's comment wakes only a few instances",
|
|
26
|
+
"skip.wakes_off": "{0} was not woken: comment wakes are switched off for this fleet", "skip.not_waiting": "{0} was not woken: the card no longer waits on it",
|
|
27
|
+
"skip.not_taken": "{0} was not woken: the notice could not be queued", "skip.lost": "The notice to {0} was lost (AgEnD restarted before it was sent)",
|
|
28
|
+
newMark: "New", newTip: "New since you last opened this card",
|
|
29
|
+
},
|
|
30
|
+
"zh-TW": {
|
|
31
|
+
label: "這則留言目前的狀況", sending: "已送給 {0}", queued: "等 {0} 接手", offline: "{0} 離線,上線後就會收到",
|
|
32
|
+
paused: "{0} 已暫停,恢復後就會收到", delivered: "已送達 {0}", read: "{0} 已讀", working: "{0} 處理中…", replied: "{0} 已回覆",
|
|
33
|
+
workingTip: "由 {0} 目前的狀態推論:Agent 只有一個連續的對話,可能在處理別的事", repliedTip: "前往 {0} 的回覆",
|
|
34
|
+
failed: "沒有送達 {0}", "fail.expired": "沒有送達 {0}:它一直無法接收,通知已過期", "fail.attempts": "沒有送達 {0}:試了幾次都沒送進去",
|
|
35
|
+
"fail.other": "沒有送達 {0}:傳進 {0} 的對話時失敗", uncertain: "無法確認 {0} 是否收到", withdrawn: "給 {0} 的通知已撤回:卡片又有變動,{0} 會從新的通知得知最新狀態",
|
|
36
|
+
"skip.board_off": "沒有叫醒 {0}:它的任務板是關閉的", "skip.contact_held": "沒有叫醒 {0}:這段對話不能直接聯絡其他 Agent",
|
|
37
|
+
"skip.loop_guard": "沒有叫醒 {0}:Agent 之間已連續互相回覆多次(防迴圈),有人留言後才會再叫醒",
|
|
38
|
+
"skip.unknown": "沒有叫 {0} 的 Agent,所以沒有叫醒任何人", "skip.cap": "沒有叫醒 {0}:一則 Agent 留言最多只叫醒幾個 Agent",
|
|
39
|
+
"skip.wakes_off": "沒有叫醒 {0}:這個 fleet 關閉了留言喚醒", "skip.not_waiting": "沒有叫醒 {0}:這張卡已經不需要它處理",
|
|
40
|
+
"skip.not_taken": "沒有叫醒 {0}:通知沒能排入傳送", "skip.lost": "給 {0} 的通知遺失了(送出前 AgEnD 重新啟動)",
|
|
41
|
+
newMark: "新", newTip: "自上次開啟這張卡之後的新留言",
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
/** A status older than this and settled (read, delivered, replied) is no longer worth a line; one that went wrong always is. */
|
|
46
|
+
export const FRESH_MS = 24 * 60 * 60 * 1000;
|
|
47
|
+
/** Why a failed notice failed (delivery-outbox.ts NoticeFailure). */
|
|
48
|
+
const FAILURES = ["expired", "attempts", "other"];
|
|
49
|
+
/** A notice that is still on its way (the page reads the card again while any is). */
|
|
50
|
+
const MOVING = ["sending", "queued", "delivered"];
|
|
51
|
+
|
|
52
|
+
/** Each instance's comments on a card (not a person's, not a deleted one), by number — once per timeline, not once per status line. */
|
|
53
|
+
const byWriter = new WeakMap();
|
|
54
|
+
function writersOf(comments) {
|
|
55
|
+
let index = byWriter.get(comments);
|
|
56
|
+
if (!index) {
|
|
57
|
+
index = new Map();
|
|
58
|
+
for (const c of comments) {
|
|
59
|
+
if (c.type !== "comment" || c.id === undefined || c.deleted || c.by === "person") continue;
|
|
60
|
+
const list = index.get(c.who);
|
|
61
|
+
if (list) list.push(c); else index.set(c.who, [c]);
|
|
62
|
+
}
|
|
63
|
+
for (const list of index.values()) list.sort((a, b) => a.id - b.id);
|
|
64
|
+
byWriter.set(comments, index);
|
|
65
|
+
}
|
|
66
|
+
return index;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** The comment an instance answered with: its first one after this comment (not a person's, not a deleted one), or null. */
|
|
70
|
+
export function repliedBy(entry, to, comments) {
|
|
71
|
+
if (!comments || entry.id === undefined) return null;
|
|
72
|
+
const list = writersOf(comments).get(to);
|
|
73
|
+
if (!list) return null;
|
|
74
|
+
let lo = 0, hi = list.length;
|
|
75
|
+
while (lo < hi) { const mid = (lo + hi) >> 1; if (list[mid].id <= entry.id) lo = mid + 1; else hi = mid; }
|
|
76
|
+
return list[lo] || null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The lines under one comment (pure: tests import it), one per instance it was written for: `{ key, to, tone, text, tip?, replyId? }`.
|
|
81
|
+
* `tone`: `wait` (on its way), `ok` (taken), `busy` (working), `done` (replied), `bad` (not sent), `muted` (withdrawn).
|
|
82
|
+
* `entry`: the timeline's comment (`wakes` as the card read carried them); `comments`: the card's timeline comments; `states`: the
|
|
83
|
+
* instances' dot states by name (`instanceStates`); `now`: epoch ms.
|
|
84
|
+
*/
|
|
85
|
+
export function wakeLines(entry, comments, states, now = Date.now()) {
|
|
86
|
+
if (!entry || entry.deleted || !Array.isArray(entry.wakes)) return [];
|
|
87
|
+
const fresh = now - (Date.parse(entry.at) || 0) < FRESH_MS;
|
|
88
|
+
const out = [];
|
|
89
|
+
for (const w of entry.wakes) {
|
|
90
|
+
const to = w.to;
|
|
91
|
+
const key = `${entry.id}:${to}`;
|
|
92
|
+
const state = states && states.get ? states.get(to) : undefined;
|
|
93
|
+
const reply = w.state === "skipped" || w.state === "failed" || w.state === "uncertain" || w.state === "withdrawn" || w.state === "unknown" || w.state === "sending" ? null : repliedBy(entry, to, comments);
|
|
94
|
+
if (w.state === "unknown") continue;
|
|
95
|
+
if (w.state === "skipped") { out.push({ key, to, tone: "bad", text: t(`taskwake.skip.${w.skip}`, to) }); continue; }
|
|
96
|
+
// M-3908: a failure says why, as the other failures do (the outbox's category); a server from before it sends none.
|
|
97
|
+
if (w.state === "failed") { out.push({ key, to, tone: "bad", text: FAILURES.includes(w.failure) ? t(`taskwake.fail.${w.failure}`, to) : t("taskwake.failed", to) }); continue; }
|
|
98
|
+
if (w.state === "uncertain") { out.push({ key, to, tone: "bad", text: t("taskwake.uncertain", to) }); continue; }
|
|
99
|
+
if (w.state === "withdrawn") { if (fresh) out.push({ key, to, tone: "muted", text: t("taskwake.withdrawn", to) }); continue; }
|
|
100
|
+
if (reply) { if (fresh) out.push({ key, to, tone: "done", text: t("taskwake.replied", to), tip: t("taskwake.repliedTip", to), replyId: reply.id }); continue; }
|
|
101
|
+
if (w.state === "sending") { out.push({ key, to, tone: "wait", text: t("taskwake.sending", to) }); continue; }
|
|
102
|
+
if (w.state === "queued") {
|
|
103
|
+
const gone = state === "stopped" || state === "crashed";
|
|
104
|
+
out.push({ key, to, tone: "wait", text: gone ? t("taskwake.offline", to) : state === "paused" ? t("taskwake.paused", to) : t("taskwake.queued", to) });
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
// Delivered, or read: busy while the instance is working (the card's "Running" inference); otherwise where it stands.
|
|
108
|
+
if (state === "working") { out.push({ key, to, tone: "busy", text: t("taskwake.working", to), tip: t("taskwake.workingTip", to) }); continue; }
|
|
109
|
+
if (!fresh) continue;
|
|
110
|
+
out.push({ key, to, tone: "ok", text: t(w.state === "read" ? "taskwake.read" : "taskwake.delivered", to) });
|
|
111
|
+
}
|
|
112
|
+
return out;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Whether any comment of the card has a notice still on its way, so that the page reads the card again soon (the stream's ping is the first way, this the second). */
|
|
116
|
+
export function wakesMoving(detail, now = Date.now()) {
|
|
117
|
+
for (const e of (detail && detail.comments) || []) {
|
|
118
|
+
if (e.deleted || !Array.isArray(e.wakes) || now - (Date.parse(e.at) || 0) > 3 * 60_000) continue;
|
|
119
|
+
if (e.wakes.some((w) => MOVING.includes(w.state))) return true;
|
|
120
|
+
}
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** The names a card's comments were written for, for the page to read the instances' states of. */
|
|
125
|
+
export function wakeNames(detail) {
|
|
126
|
+
const names = new Set();
|
|
127
|
+
for (const e of (detail && detail.comments) || []) for (const w of e.wakes || []) names.add(w.to);
|
|
128
|
+
return [...names];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const ICON = { wait: "clock", ok: "check", busy: "clock", done: "check", bad: "alert", muted: "info" };
|
|
132
|
+
|
|
133
|
+
/** The status line(s) under a comment; nothing when it was written for nobody. */
|
|
134
|
+
export function WakeStatus({ entry, comments, states, onOpen }) {
|
|
135
|
+
const lines = wakeLines(entry, comments, states);
|
|
136
|
+
if (!lines.length) return null;
|
|
137
|
+
return html`<ul class="tl-wakes" aria-label=${t("taskwake.label")}>${lines.map((l) => html`<li key=${l.key} class=${`tl-wake wk-${l.tone}`} title=${l.tip || undefined}>
|
|
138
|
+
<${Icon} name=${ICON[l.tone]} size=${13} cls=${l.tone === "busy" ? "wk-spin" : ""} />
|
|
139
|
+
${l.replyId !== undefined && onOpen ? html`<button type="button" class="tb-link" onClick=${() => onOpen(l.replyId)}>${l.text}</button>` : html`<span>${l.text}</span>`}</li>`)}</ul>`;
|
|
140
|
+
}
|