@songsid/agend 2.4.0-beta.23 → 2.4.0-beta.25
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/README.md +1 -1
- package/README.zh-TW.md +1 -1
- package/dist/agend-home.js +5 -5
- package/dist/agend-home.js.map +1 -1
- package/dist/agent-cli-instructions.md +4 -3
- package/dist/agent-cli.js +32 -2
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-endpoint.js +10 -0
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/agent-file-read.js +2 -2
- package/dist/agent-file-read.js.map +1 -1
- package/dist/agent-whats-new.js +11 -1
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/agent-workspace.d.ts +18 -2
- package/dist/agent-workspace.js +15 -4
- package/dist/agent-workspace.js.map +1 -1
- package/dist/backend/antigravity.js +8 -6
- package/dist/backend/antigravity.js.map +1 -1
- package/dist/backend/claude-code.d.ts +15 -0
- package/dist/backend/claude-code.js +25 -3
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/claude-mcp-carry.d.ts +63 -0
- package/dist/backend/claude-mcp-carry.js +242 -0
- package/dist/backend/claude-mcp-carry.js.map +1 -0
- package/dist/backend/claude-usage-credits.d.ts +8 -0
- package/dist/backend/claude-usage-credits.js +121 -0
- package/dist/backend/claude-usage-credits.js.map +1 -0
- package/dist/backend/types.d.ts +30 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/adapters/discord.js +7 -1
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/mcp-tools.js +7 -6
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/channel/tool-router.js +1 -0
- package/dist/channel/tool-router.js.map +1 -1
- package/dist/cli-audited.js +9 -4
- package/dist/cli-audited.js.map +1 -1
- package/dist/cli.js +184 -21
- package/dist/cli.js.map +1 -1
- package/dist/config-validator.js +17 -1
- package/dist/config-validator.js.map +1 -1
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/contact-auth-store.d.ts +18 -0
- package/dist/contact-auth-store.js +55 -8
- package/dist/contact-auth-store.js.map +1 -1
- package/dist/contact-auth-types.d.ts +3 -0
- package/dist/contact-auth-types.js.map +1 -1
- package/dist/contact-change-proposals.d.ts +34 -0
- package/dist/contact-change-proposals.js +1 -1
- package/dist/contact-change-proposals.js.map +1 -1
- package/dist/cross-instance-notice.d.ts +1 -0
- package/dist/cross-instance-notice.js +9 -8
- package/dist/cross-instance-notice.js.map +1 -1
- package/dist/daemon.d.ts +46 -0
- package/dist/daemon.js +299 -33
- package/dist/daemon.js.map +1 -1
- package/dist/dashboard-permissions.d.ts +8 -0
- package/dist/dashboard-permissions.js +8 -0
- package/dist/dashboard-permissions.js.map +1 -1
- package/dist/delivery-outbox.d.ts +56 -1
- package/dist/delivery-outbox.js +254 -22
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-context.d.ts +8 -0
- package/dist/fleet-lock.d.ts +67 -2
- package/dist/fleet-lock.js +236 -2
- package/dist/fleet-lock.js.map +1 -1
- package/dist/fleet-manager.d.ts +177 -6
- package/dist/fleet-manager.js +1203 -75
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-windows-runtime.d.ts +20 -1
- package/dist/fleet-windows-runtime.js +98 -18
- package/dist/fleet-windows-runtime.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +22 -9
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +6 -0
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +7 -0
- package/dist/general-knowledge/skills/fleet-config/SKILL.md +3 -3
- package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +1 -1
- package/dist/general-knowledge/skills/task-board/SKILL.md +17 -0
- package/dist/general-knowledge/skills/web-appearance/SKILL.md +4 -0
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +35 -7
- package/dist/home-update-lock.d.ts +35 -0
- package/dist/home-update-lock.js +81 -0
- package/dist/home-update-lock.js.map +1 -0
- package/dist/hub/compose/member.d.ts +5 -1
- package/dist/hub/compose/member.js +9 -5
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +1 -1
- package/dist/hub/member/room-ask.d.ts +5 -0
- package/dist/hub/member/room-ask.js +43 -16
- package/dist/hub/member/room-ask.js.map +1 -1
- package/dist/hub/member/room-mention-feedback.d.ts +2 -0
- package/dist/hub/member/room-mention-feedback.js +1 -1
- package/dist/hub/member/room-mention-feedback.js.map +1 -1
- package/dist/hub/member/room-post-answers.d.ts +2 -0
- package/dist/hub/member/room-post-answers.js +1 -1
- package/dist/hub/member/room-post-answers.js.map +1 -1
- package/dist/hub/member/room-post.d.ts +5 -0
- package/dist/hub/member/room-post.js +4 -1
- package/dist/hub/member/room-post.js.map +1 -1
- package/dist/hub/member/updates.d.ts +7 -1
- package/dist/hub/member/updates.js +7 -1
- package/dist/hub/member/updates.js.map +1 -1
- package/dist/hub/representative.d.ts +7 -0
- package/dist/hub/representative.js +38 -5
- package/dist/hub/representative.js.map +1 -1
- package/dist/install-lock.d.ts +15 -1
- package/dist/install-lock.js +16 -8
- package/dist/install-lock.js.map +1 -1
- package/dist/install-ownership.d.ts +165 -0
- package/dist/install-ownership.js +404 -0
- package/dist/install-ownership.js.map +1 -0
- package/dist/instance-config-impact.js +2 -0
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +2 -0
- package/dist/instance-lifecycle.js +29 -1
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.d.ts +4 -0
- package/dist/instructions.js +4 -0
- package/dist/instructions.js.map +1 -1
- package/dist/local-pane-endpoint.d.ts +4 -1
- package/dist/local-pane-endpoint.js +12 -2
- package/dist/local-pane-endpoint.js.map +1 -1
- package/dist/locale.js +170 -4
- package/dist/locale.js.map +1 -1
- package/dist/native-agent-admission.d.ts +7 -0
- package/dist/native-agent-admission.js +46 -3
- package/dist/native-agent-admission.js.map +1 -1
- package/dist/native-mcp.d.ts +16 -1
- package/dist/native-mcp.js +38 -5
- package/dist/native-mcp.js.map +1 -1
- package/dist/native-pane-lifecycle.d.ts +9 -0
- package/dist/native-pane-lifecycle.js +23 -0
- package/dist/native-pane-lifecycle.js.map +1 -1
- package/dist/native-pane-manager.d.ts +19 -6
- package/dist/native-pane-manager.js +79 -4
- package/dist/native-pane-manager.js.map +1 -1
- package/dist/needs-you-hub.d.ts +3 -0
- package/dist/needs-you-hub.js +31 -5
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +22 -1
- package/dist/needs-you.js +6 -0
- package/dist/needs-you.js.map +1 -1
- package/dist/office-share-page.js +1 -1
- package/dist/office-share-page.js.map +1 -1
- package/dist/office-share.js +2 -1
- package/dist/office-share.js.map +1 -1
- package/dist/outbound-handlers.d.ts +12 -0
- package/dist/outbound-handlers.js +59 -8
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +3 -0
- package/dist/outbound-schemas.js +7 -5
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/package-preimage.js +4 -0
- package/dist/package-preimage.js.map +1 -1
- package/dist/pane-port.d.ts +1 -0
- package/dist/plist-args.d.ts +9 -0
- package/dist/plist-args.js +22 -0
- package/dist/plist-args.js.map +1 -0
- package/dist/public-preview.d.ts +4 -6
- package/dist/public-preview.js +5 -2
- package/dist/public-preview.js.map +1 -1
- package/dist/public-web-gateway.js +11 -3
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/public-web-link.d.ts +13 -1
- package/dist/public-web-link.js +28 -1
- package/dist/public-web-link.js.map +1 -1
- package/dist/recover.cjs +2452 -0
- package/dist/remote-card-prompt.d.ts +6 -2
- package/dist/remote-card-prompt.js +12 -3
- package/dist/remote-card-prompt.js.map +1 -1
- package/dist/reply-draft.d.ts +12 -0
- package/dist/reply-draft.js +81 -0
- package/dist/reply-draft.js.map +1 -0
- package/dist/request-contact-api.d.ts +15 -0
- package/dist/request-contact-api.js +120 -0
- package/dist/request-contact-api.js.map +1 -0
- package/dist/request-contact-card.d.ts +36 -0
- package/dist/request-contact-card.js +206 -0
- package/dist/request-contact-card.js.map +1 -0
- package/dist/request-contact-gate.d.ts +79 -0
- package/dist/request-contact-gate.js +262 -0
- package/dist/request-contact-gate.js.map +1 -0
- package/dist/request-contact-native.d.ts +52 -0
- package/dist/request-contact-native.js +83 -0
- package/dist/request-contact-native.js.map +1 -0
- package/dist/request-contact-types.d.ts +86 -0
- package/dist/request-contact-types.js +7 -0
- package/dist/request-contact-types.js.map +1 -0
- package/dist/request-context-call-protocol.d.ts +12 -0
- package/dist/request-context-call-protocol.js +14 -0
- package/dist/request-context-call-protocol.js.map +1 -0
- package/dist/request-context-call.d.ts +22 -0
- package/dist/request-context-call.js +35 -0
- package/dist/request-context-call.js.map +1 -0
- package/dist/request-context-compatibility.d.ts +20 -0
- package/dist/request-context-compatibility.js +74 -0
- package/dist/request-context-compatibility.js.map +1 -0
- package/dist/request-context-drain.d.ts +39 -0
- package/dist/request-context-drain.js +159 -0
- package/dist/request-context-drain.js.map +1 -0
- package/dist/request-context-fence.d.ts +28 -0
- package/dist/request-context-fence.js +58 -0
- package/dist/request-context-fence.js.map +1 -0
- package/dist/request-context-migration.d.ts +64 -0
- package/dist/request-context-migration.js +158 -0
- package/dist/request-context-migration.js.map +1 -0
- package/dist/request-context-pane.d.ts +25 -0
- package/dist/request-context-pane.js +48 -0
- package/dist/request-context-pane.js.map +1 -0
- package/dist/request-context-policy.d.ts +74 -0
- package/dist/request-context-policy.js +116 -0
- package/dist/request-context-policy.js.map +1 -0
- package/dist/request-context-protocol.d.ts +137 -0
- package/dist/request-context-protocol.js +38 -0
- package/dist/request-context-protocol.js.map +1 -0
- package/dist/request-context-recovery.d.ts +14 -0
- package/dist/request-context-recovery.js +56 -0
- package/dist/request-context-recovery.js.map +1 -0
- package/dist/request-context-relay.d.ts +19 -0
- package/dist/request-context-relay.js +63 -0
- package/dist/request-context-relay.js.map +1 -0
- package/dist/request-context-returns.d.ts +67 -0
- package/dist/request-context-returns.js +211 -0
- package/dist/request-context-returns.js.map +1 -0
- package/dist/request-context-store.d.ts +26 -0
- package/dist/request-context-store.js +144 -0
- package/dist/request-context-store.js.map +1 -0
- package/dist/request-context-turns.d.ts +99 -0
- package/dist/request-context-turns.js +215 -0
- package/dist/request-context-turns.js.map +1 -0
- package/dist/request-context-view.d.ts +33 -0
- package/dist/request-context-view.js +36 -0
- package/dist/request-context-view.js.map +1 -0
- package/dist/request-hub-context.d.ts +130 -0
- package/dist/request-hub-context.js +89 -0
- package/dist/request-hub-context.js.map +1 -0
- package/dist/request-hub-output.d.ts +11 -0
- package/dist/request-hub-output.js +21 -0
- package/dist/request-hub-output.js.map +1 -0
- package/dist/runtime-cli-install.js +13 -11
- package/dist/runtime-cli-install.js.map +1 -1
- package/dist/runtime-client.d.ts +2 -0
- package/dist/runtime-client.js +17 -4
- package/dist/runtime-client.js.map +1 -1
- package/dist/runtime-coordinator.d.ts +4 -1
- package/dist/runtime-coordinator.js +10 -3
- package/dist/runtime-coordinator.js.map +1 -1
- package/dist/runtime-pane-assets.d.ts +1 -1
- package/dist/runtime-pane-assets.js +1 -1
- package/dist/runtime-pane-assets.js.map +1 -1
- package/dist/runtime-pane-host.d.ts +3 -0
- package/dist/runtime-pane-host.js +39 -21
- package/dist/runtime-pane-host.js.map +1 -1
- package/dist/runtime-pane-link.d.ts +6 -2
- package/dist/runtime-pane-link.js +17 -4
- package/dist/runtime-pane-link.js.map +1 -1
- package/dist/runtime-pane-mcp-relay.d.ts +11 -1
- package/dist/runtime-pane-mcp-relay.js +69 -3
- package/dist/runtime-pane-mcp-relay.js.map +1 -1
- package/dist/runtime-pane-mcp.d.ts +28 -1
- package/dist/runtime-pane-mcp.js +92 -15
- package/dist/runtime-pane-mcp.js.map +1 -1
- package/dist/runtime-pane-port.d.ts +6 -0
- package/dist/runtime-pane-port.js +23 -4
- package/dist/runtime-pane-port.js.map +1 -1
- package/dist/runtime-pane-protocol.d.ts +4 -0
- package/dist/runtime-pane-protocol.js +11 -4
- package/dist/runtime-pane-protocol.js.map +1 -1
- package/dist/runtime-pane-service.d.ts +1 -0
- package/dist/runtime-pane-service.js +25 -9
- package/dist/runtime-pane-service.js.map +1 -1
- package/dist/runtime-pane-stdio-protocol.d.ts +4 -0
- package/dist/runtime-pane-stdio-protocol.js +12 -5
- package/dist/runtime-pane-stdio-protocol.js.map +1 -1
- package/dist/runtime-pane-stdio.js +5 -5
- package/dist/runtime-pane-stdio.js.map +1 -1
- package/dist/runtime-protocol.d.ts +3 -0
- package/dist/runtime-protocol.js.map +1 -1
- package/dist/scheduler/db.js +26 -0
- package/dist/scheduler/db.js.map +1 -1
- package/dist/scheduler/scheduler.d.ts +6 -0
- package/dist/scheduler/scheduler.js +19 -1
- package/dist/scheduler/scheduler.js.map +1 -1
- package/dist/scheduler/task-board-text.d.ts +2 -0
- package/dist/scheduler/task-board-text.js +12 -0
- package/dist/scheduler/task-board-text.js.map +1 -1
- package/dist/scheduler/task-board.d.ts +106 -2
- package/dist/scheduler/task-board.js +248 -24
- package/dist/scheduler/task-board.js.map +1 -1
- package/dist/scheduler/task-files.d.ts +80 -0
- package/dist/scheduler/task-files.js +357 -0
- package/dist/scheduler/task-files.js.map +1 -0
- package/dist/scheduler/types.d.ts +1 -1
- package/dist/service-activation.js +3 -13
- package/dist/service-activation.js.map +1 -1
- package/dist/service-lock.d.ts +28 -0
- package/dist/service-lock.js +85 -0
- package/dist/service-lock.js.map +1 -0
- package/dist/settings-api.d.ts +8 -0
- package/dist/settings-api.js +41 -1
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-baseline.d.ts +1 -0
- package/dist/settings-baseline.js +1 -1
- package/dist/settings-baseline.js.map +1 -1
- package/dist/settings-change.js +1 -1
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.d.ts +2 -0
- package/dist/settings-effect.js +5 -1
- package/dist/settings-effect.js.map +1 -1
- package/dist/state-lease.d.ts +24 -0
- package/dist/state-lease.js +103 -0
- package/dist/state-lease.js.map +1 -0
- package/dist/task-attach-client.d.ts +43 -0
- package/dist/task-attach-client.js +125 -0
- package/dist/task-attach-client.js.map +1 -0
- package/dist/task-board-tool.d.ts +12 -0
- package/dist/task-board-tool.js +107 -6
- package/dist/task-board-tool.js.map +1 -1
- package/dist/task-file-limits.d.ts +15 -0
- package/dist/task-file-limits.js +21 -0
- package/dist/task-file-limits.js.map +1 -0
- package/dist/tmux-binary.js +1 -1
- package/dist/tmux-binary.js.map +1 -1
- package/dist/tool-permissions.d.ts +32 -0
- package/dist/tool-permissions.js +63 -0
- package/dist/tool-permissions.js.map +1 -1
- package/dist/tool-receipt-output.d.ts +2 -0
- package/dist/topic-commands.js +21 -1
- package/dist/topic-commands.js.map +1 -1
- package/dist/transcript-monitor.js +3 -0
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/tunnel/named-link-test.d.ts +27 -0
- package/dist/tunnel/named-link-test.js +41 -0
- package/dist/tunnel/named-link-test.js.map +1 -1
- package/dist/types.d.ts +13 -0
- package/dist/ui/agent-details-settings.js +7 -5
- package/dist/ui/agent-who-can-use-strings.js +125 -0
- package/dist/ui/agent-who-can-use.js +238 -0
- package/dist/ui/chat-store.js +5 -4
- package/dist/ui/fleet-office-card.js +37 -6
- package/dist/ui/fleet-office-editor.js +5 -5
- package/dist/ui/fleet-office-pack.d.ts +10 -0
- package/dist/ui/fleet-office-pack.js +65 -2
- package/dist/ui/fleet-office-skin.js +75 -17
- package/dist/ui/fleet-office-store.js +33 -2
- package/dist/ui/fleet-office-vehicles.js +130 -0
- package/dist/ui/fleet-office-zones.js +13 -4
- package/dist/ui/fleet-office.js +245 -46
- package/dist/ui/fleet-task-activity.js +9 -82
- package/dist/ui/fleet-task-archive.js +111 -0
- package/dist/ui/fleet-task-card.js +6 -4
- package/dist/ui/fleet-task-common.js +2 -2
- package/dist/ui/fleet-task-edit.js +8 -1
- package/dist/ui/fleet-task-files.js +196 -0
- package/dist/ui/fleet-task-md.js +98 -0
- package/dist/ui/fleet-task-menu.js +1 -1
- package/dist/ui/fleet-task-stats.js +2 -2
- package/dist/ui/fleet-task-view.js +12 -8
- package/dist/ui/fleet-tasks.js +42 -18
- package/dist/ui/panel-chat.js +15 -2
- package/dist/ui/panel-details.js +3 -1
- package/dist/ui/panel-needs.js +25 -5
- package/dist/ui/panel-settings.js +37 -9
- package/dist/ui/settings-preview-address.js +156 -0
- package/dist/ui/settings-registry.js +3 -0
- package/dist/ui/settings-shared-strings.js +9 -0
- package/dist/ui/settings-shared.js +6 -1
- package/dist/ui/settings-strings.js +6 -6
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app-needs.js +8 -1
- package/dist/ui/shared/app.css +131 -5
- package/dist/ui/shared/chat-strings.js +10 -6
- package/dist/ui/shared/chat-thread.js +7 -1
- package/dist/ui/shared/preview-panel.js +1 -1
- package/dist/ui/shared/preview.js +11 -2
- package/dist/ui/shared/task-board.css +64 -0
- package/dist/ui/shared/tokens.css +18 -3
- package/dist/ui/shared/ui-confirm.js +5 -4
- package/dist/ui/shared/workspace.css +7 -0
- package/dist/ui/usage-credits-card.js +84 -0
- package/dist/ui/workspace-ignored-strings.js +16 -0
- package/dist/ui/workspace-panel.js +15 -6
- package/dist/update-card.d.ts +193 -0
- package/dist/update-card.js +620 -0
- package/dist/update-card.js.map +1 -0
- package/dist/update-dispatch.d.ts +16 -1
- package/dist/update-dispatch.js +12 -4
- package/dist/update-dispatch.js.map +1 -1
- package/dist/update-forward.d.ts +73 -0
- package/dist/update-forward.js +283 -0
- package/dist/update-forward.js.map +1 -0
- package/dist/update-idle.d.ts +1 -0
- package/dist/update-idle.js +12 -3
- package/dist/update-idle.js.map +1 -1
- package/dist/update-install.d.ts +2 -1
- package/dist/update-install.js +18 -10
- package/dist/update-install.js.map +1 -1
- package/dist/update-journal.d.ts +351 -0
- package/dist/update-journal.js +717 -0
- package/dist/update-journal.js.map +1 -0
- package/dist/update-launch.js +1 -1
- package/dist/update-launch.js.map +1 -1
- package/dist/update-npm-env.d.ts +45 -12
- package/dist/update-npm-env.js +48 -0
- package/dist/update-npm-env.js.map +1 -1
- package/dist/update-package-restore.d.ts +75 -0
- package/dist/update-package-restore.js +318 -0
- package/dist/update-package-restore.js.map +1 -0
- package/dist/update-quiescence.d.ts +192 -0
- package/dist/update-quiescence.js +330 -0
- package/dist/update-quiescence.js.map +1 -0
- package/dist/update-readiness-host.d.ts +61 -0
- package/dist/update-readiness-host.js +297 -0
- package/dist/update-readiness-host.js.map +1 -0
- package/dist/update-readiness.d.ts +83 -0
- package/dist/update-readiness.js +459 -0
- package/dist/update-readiness.js.map +1 -0
- package/dist/update-recovery/kit.d.ts +35 -0
- package/dist/update-recovery/kit.js +99 -0
- package/dist/update-recovery/kit.js.map +1 -0
- package/dist/update-recovery/pre-start.d.ts +34 -0
- package/dist/update-recovery/pre-start.js +103 -0
- package/dist/update-recovery/pre-start.js.map +1 -0
- package/dist/update-recovery/recover-main.d.ts +1 -0
- package/dist/update-recovery/recover-main.js +4 -0
- package/dist/update-recovery/recover-main.js.map +1 -0
- package/dist/update-recovery/recover.d.ts +22 -0
- package/dist/update-recovery/recover.js +124 -0
- package/dist/update-recovery/recover.js.map +1 -0
- package/dist/update-recovery/route.d.ts +53 -0
- package/dist/update-recovery/route.js +262 -0
- package/dist/update-recovery/route.js.map +1 -0
- package/dist/update-recovery/runner.d.ts +58 -0
- package/dist/update-recovery/runner.js +196 -0
- package/dist/update-recovery/runner.js.map +1 -0
- package/dist/update-recovery/service-manager.d.ts +39 -0
- package/dist/update-recovery/service-manager.js +57 -0
- package/dist/update-recovery/service-manager.js.map +1 -0
- package/dist/update-restore.d.ts +44 -0
- package/dist/update-restore.js +355 -0
- package/dist/update-restore.js.map +1 -0
- package/dist/update-retained.d.ts +38 -0
- package/dist/update-retained.js +91 -0
- package/dist/update-retained.js.map +1 -0
- package/dist/update-rollback.d.ts +74 -0
- package/dist/update-rollback.js +221 -0
- package/dist/update-rollback.js.map +1 -0
- package/dist/update-settings.d.ts +36 -0
- package/dist/update-settings.js +122 -0
- package/dist/update-settings.js.map +1 -0
- package/dist/update-snapshot-manifest.d.ts +32 -0
- package/dist/update-snapshot-manifest.js +65 -0
- package/dist/update-snapshot-manifest.js.map +1 -0
- package/dist/update-snapshot-scope.d.ts +67 -0
- package/dist/update-snapshot-scope.js +172 -0
- package/dist/update-snapshot-scope.js.map +1 -0
- package/dist/update-snapshot.d.ts +34 -0
- package/dist/update-snapshot.js +246 -0
- package/dist/update-snapshot.js.map +1 -0
- package/dist/update-writers.d.ts +71 -0
- package/dist/update-writers.js +235 -0
- package/dist/update-writers.js.map +1 -0
- package/dist/web-api.d.ts +6 -0
- package/dist/web-api.js +140 -22
- package/dist/web-api.js.map +1 -1
- package/dist/web-chat-history.d.ts +7 -0
- package/dist/web-chat-history.js +15 -0
- package/dist/web-chat-history.js.map +1 -1
- package/dist/web-office-acts.d.ts +16 -0
- package/dist/web-office-acts.js +27 -9
- package/dist/web-office-acts.js.map +1 -1
- package/dist/web-office-pack-read.js +1 -1
- package/dist/web-office-pack-read.js.map +1 -1
- package/dist/web-office-skins.d.ts +5 -3
- package/dist/web-office-skins.js +20 -16
- package/dist/web-office-skins.js.map +1 -1
- package/dist/web-preview.d.ts +5 -0
- package/dist/web-preview.js +1 -1
- package/dist/web-preview.js.map +1 -1
- package/dist/web-settings-patch.d.ts +27 -0
- package/dist/web-settings-patch.js +67 -0
- package/dist/web-settings-patch.js.map +1 -1
- package/dist/web-update.d.ts +6 -0
- package/dist/windows-agents.d.ts +12 -0
- package/dist/windows-agents.js +5 -0
- package/dist/windows-agents.js.map +1 -1
- package/dist/workflow-templates/default.md +1 -0
- package/launcher/agend +4 -1
- package/launcher/agend-agent +4 -1
- package/launcher/agend-install.cjs +16 -8
- package/launcher/install-admission.d.cts +8 -0
- package/launcher/npm-allow-scripts.cjs +72 -0
- package/launcher/npm-global-prefix.cjs +81 -0
- package/launcher/postinstall.cjs +9 -8
- package/launcher/runtime-select.cjs +8 -2
- package/package.json +3 -2
- package/scripts/preinstall-guard.cjs +1 -1
|
@@ -24,22 +24,31 @@ import { backendLabel, modelText, namesOf } from "/assets/instance-nav.js";
|
|
|
24
24
|
import { badgeText, fixedOf, tierOf, titleOf, tokens, xpOf } from "./fleet-office-levels.js";
|
|
25
25
|
import { CARD_ROWS, CARD_SECTIONS, contrastRatio, relativeLuminance } from "./fleet-office-pack.js";
|
|
26
26
|
import { nineSlice } from "./fleet-office-dialogue.js";
|
|
27
|
+
import { RENAME_LEN } from "./fleet-office-store.js";
|
|
27
28
|
|
|
28
29
|
register("ocard", {
|
|
29
30
|
en: {
|
|
30
31
|
card: "{0}'s card", level: "Lv {0}", work: "{0} work tokens", estimated: "estimated", toNext: "{0} to Lv {1}", office: "Office", model: "Model", backend: "Backend",
|
|
31
32
|
today: "Today", todayN: "{0} work tokens · {1} requests", firstSeen: "First seen", day: "Day {0}", now: "Now", nowLabel: "Now: ", find: "Find in office", chat: "Chat", pat: "Pat", feed: "Feed", tell: "Tell {0} (with their next message)", tellNote: "Off: only you see it. On: a line like “[Office] <your name> patted your head ×3” rides the next message they get anyway — it never wakes them.",
|
|
32
33
|
chatWindow: "Open {0}’s chat in a new window",
|
|
33
|
-
close: "Close", xp: "Progress to Lv {0}",
|
|
34
|
+
close: "Close", xp: "Progress to Lv {0}", rename: "Rename (only you see it)", renameField: "Name you see",
|
|
35
|
+
previewPose: "Preview pose", previewOff: "Off", replay: "Replay", poseOption: "{0} ({1})",
|
|
36
|
+
pose_idle: "Idle", pose_working: "Working", pose_paused: "Paused", pose_needs: "Needs a person", pose_walkDown: "Walk down", pose_walkUp: "Walk up",
|
|
37
|
+
pose_walkSide: "Walk sideways", pose_walkLeft: "Walk left", pose_eat: "Eat", pose_pat: "Patted", pose_dragged: "Dragged", pose_stand: "Card pose",
|
|
34
38
|
},
|
|
35
39
|
"zh-TW": {
|
|
36
40
|
card: "{0} 的名片", level: "Lv {0}", work: "{0} 工作 token", estimated: "估算", toNext: "再 {0} 到 Lv {1}", office: "辦公室", model: "模型", backend: "後端",
|
|
37
41
|
today: "今天", todayN: "{0} 工作 token · {1} 次請求", firstSeen: "首次出現", day: "第 {0} 天", now: "現在", nowLabel: "現在:", find: "在辦公室找它", chat: "聊天", pat: "摸頭", feed: "餵點心", tell: "讓 {0} 知道(隨下一則訊息)", tellNote: "關閉:只有你看得到。開啟:下一則本來就會送給它的訊息會附上一行,例如「[Office] <你的名字> patted your head ×3」,不會叫醒它。",
|
|
38
42
|
chatWindow: "在新視窗開啟 {0} 的聊天",
|
|
39
|
-
close: "關閉", xp: "升到 Lv {0} 的進度",
|
|
43
|
+
close: "關閉", xp: "升到 Lv {0} 的進度", rename: "改名(只有你看得到)", renameField: "你看到的名字",
|
|
44
|
+
previewPose: "預覽動作", previewOff: "關閉", replay: "重播", poseOption: "{0}({1})",
|
|
45
|
+
pose_idle: "閒置", pose_working: "工作", pose_paused: "暫停", pose_needs: "呼叫人", pose_walkDown: "向下走", pose_walkUp: "向上走",
|
|
46
|
+
pose_walkSide: "側著走", pose_walkLeft: "向左走", pose_eat: "吃點心", pose_pat: "被摸頭", pose_dragged: "被拖著", pose_stand: "名片站姿",
|
|
40
47
|
},
|
|
41
48
|
});
|
|
42
49
|
const tc = (k, ...v) => t(`ocard.${k}`, ...v);
|
|
50
|
+
/** #4508 review: a pose's name in the viewer's language, with the strip key a pack author looks for ("Walk up (walkUp)"). */
|
|
51
|
+
export const poseName = (key) => { const k = `pose_${key}`, label = tc(k); return label && label !== `ocard.${k}` ? tc("poseOption", label, key) : key; };
|
|
43
52
|
|
|
44
53
|
/** The days from `first` (YYYY-MM-DD, the fleet's zone) to today on this device's clock, counting the first as day 1. */
|
|
45
54
|
export function dayOf(first, nowMs = Date.now()) {
|
|
@@ -334,7 +343,28 @@ function drawPortraitAvatar(cv, im, W) {
|
|
|
334
343
|
* M-3533 R2b: `photo` (src) the agent's identity-card picture (a Hub room's), drawn as the pack portrait is, in place of
|
|
335
344
|
* the figure once it loads; the figure while it loads or when it fails.
|
|
336
345
|
*/
|
|
337
|
-
|
|
346
|
+
/**
|
|
347
|
+
* The card's name, and with `rename` ({ value, save }) a pencil beside it: a field for the name this browser shows
|
|
348
|
+
* (Enter or leaving it keeps it, Escape does not; empty gives back their own).
|
|
349
|
+
*/
|
|
350
|
+
function CardName({ name, rename }) {
|
|
351
|
+
const [editing, setEditing] = useState(false);
|
|
352
|
+
const field = useRef(null);
|
|
353
|
+
// Filled once, as the field appears: a `value` prop would put the name back over what is typed at each redraw.
|
|
354
|
+
useLayoutEffect(() => { if (editing && field.current) { field.current.value = (rename && rename.value) || name; field.current.focus(); field.current.select(); } }, [editing]);
|
|
355
|
+
if (!rename) return html`<strong class="oo-card-name">${name}</strong>`;
|
|
356
|
+
const done = (keep) => { if (!editing) return; setEditing(false); if (keep && field.current) rename.save(field.current.value.trim()); };
|
|
357
|
+
if (editing) return html`<input ref=${field} class="oo-card-rename" maxlength=${RENAME_LEN} aria-label=${tc("renameField")}
|
|
358
|
+
onKeyDown=${(e) => { if (e.key === "Enter") { e.preventDefault(); done(true); } else if (e.key === "Escape") { e.preventDefault(); e.stopPropagation(); done(false); } }} onBlur=${() => done(true)} />`;
|
|
359
|
+
return html`<span class="oo-card-name-row"><strong class="oo-card-name">${name}</strong><button type="button" class="icon-btn oo-card-rename-btn"
|
|
360
|
+
aria-label=${tc("rename")} title=${tc("rename")} onClick=${() => setEditing(true)}>✎</button></span>`;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export function OfficeCard({ model: m, avatar, sheet, place, onChat, onFind, onClose, onReact = null, tell = null, rename = null, preview = null, packCard = null, picture = null, portrait = null, packScale = 2, action = null, photo = null }) {
|
|
364
|
+
// #4504: a skin pack's pose preview (`preview` = { poses, pose, set, replay }): the person plays the picked pose in place.
|
|
365
|
+
const previewRow = preview ? html`<div key="preview" class="oo-card-preview"><label>${tc("previewPose")}
|
|
366
|
+
<select value=${preview.pose} onChange=${(e) => preview.set(e.target.value)}><option value="">${tc("previewOff")}</option>${preview.poses.map((p) => html`<option value=${p}>${poseName(p)}</option>`)}</select></label>
|
|
367
|
+
<button type="button" class="btn btn-sm oo-card-replay" disabled=${!preview.pose} onClick=${preview.replay}>${tc("replay")}</button></div>` : null;
|
|
338
368
|
// `action`: one, or a list (M-3565: a Hub room's "@ it" and "Chat with it one-to-one"); the first is the primary button.
|
|
339
369
|
const actions = Array.isArray(action) ? action.filter(Boolean) : action ? [action] : [];
|
|
340
370
|
const actionButtons = actions.map((a, i) => html`<button key=${i} type="button" class=${`btn btn-sm ${i === 0 ? "btn-primary " : ""}oo-card-action`} title=${a.title || undefined} aria-label=${a.title || undefined} onClick=${a.run}>${a.label}</button>`);
|
|
@@ -449,7 +479,7 @@ export function OfficeCard({ model: m, avatar, sheet, place, onChat, onFind, onC
|
|
|
449
479
|
<div class="oo-card-avatar"><canvas ref=${canvas} width="56" height="56" aria-hidden="true"></canvas>
|
|
450
480
|
${m.badge ? html`<span class=${`oo-badge tier-${m.badge.tier}${m.badge.mark ? " mark" : ""}`} aria-hidden="true">${m.badge.mark ? "" : m.badge.text}</span>` : null}</div>
|
|
451
481
|
<div class="oo-card-names">
|
|
452
|
-
|
|
482
|
+
<${CardName} name=${m.name} rename=${rename} />
|
|
453
483
|
${m.instance ? html`<div class="oo-card-instance mono" title=${m.instance}>${m.instance}</div>` : null}
|
|
454
484
|
<div class="oo-card-state">${m.stateLine}</div>
|
|
455
485
|
</div>
|
|
@@ -464,6 +494,7 @@ export function OfficeCard({ model: m, avatar, sheet, place, onChat, onFind, onC
|
|
|
464
494
|
${m.now ? html`<div class="oo-card-now"><span class="muted">${tc("nowLabel")}</span>${m.now}</div>` : null}
|
|
465
495
|
${tell ? html`<label class="check oo-card-tell" title=${tc("tellNote")}><input type="checkbox" checked=${tell.on} onChange=${(e) => tell.set(e.target.checked)} />
|
|
466
496
|
<span>${tc("tell", m.name)}</span></label>` : null}
|
|
497
|
+
${previewRow}
|
|
467
498
|
<div class="oo-card-actions">
|
|
468
499
|
${onReact ? html`<button type="button" class="btn btn-sm btn-ghost oo-card-pat" onClick=${() => onReact("pat")}>${tc("pat")}</button>
|
|
469
500
|
<button type="button" class="btn btn-sm btn-ghost oo-card-feed" onClick=${() => onReact("feed")}>${tc("feed")}</button>` : null}
|
|
@@ -493,7 +524,7 @@ export function OfficeCard({ model: m, avatar, sheet, place, onChat, onFind, onC
|
|
|
493
524
|
<div class="oo-card-avatar"><canvas ref=${canvas} width=${avatarPx} height=${avatarPx} aria-hidden="true"></canvas>
|
|
494
525
|
${m.badge && !hide.has("badge") ? html`<span class=${`oo-badge tier-${m.badge.tier}${m.badge.mark ? " mark" : ""}`} aria-hidden="true">${m.badge.mark ? "" : m.badge.text}</span>` : null}</div>
|
|
495
526
|
<div class="oo-card-names">
|
|
496
|
-
|
|
527
|
+
<${CardName} name=${m.name} rename=${rename} />
|
|
497
528
|
${!hide.has("instance") && m.instance ? html`<div class="oo-card-instance mono" title=${m.instance}>${m.instance}</div>` : null}
|
|
498
529
|
<div class="oo-card-state">${stateLine}</div>
|
|
499
530
|
</div>
|
|
@@ -522,7 +553,7 @@ export function OfficeCard({ model: m, avatar, sheet, place, onChat, onFind, onC
|
|
|
522
553
|
<span>${tc("tell", m.name)}</span></label>`;
|
|
523
554
|
}
|
|
524
555
|
if (sec === "actions") {
|
|
525
|
-
return html
|
|
556
|
+
return html`${previewRow}<div key="actions" class="oo-card-actions">
|
|
526
557
|
${onReact ? html`<button type="button" class="btn btn-sm btn-ghost oo-card-pat" onClick=${() => onReact("pat")}>${tc("pat")}</button>
|
|
527
558
|
<button type="button" class="btn btn-sm btn-ghost oo-card-feed" onClick=${() => onReact("feed")}>${tc("feed")}</button>` : null}
|
|
528
559
|
${onFind ? html`<button type="button" class="btn btn-sm btn-ghost oo-card-find" onClick=${onFind}>${tc("find")}</button>` : null}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// whole teams or one instance at a time, or #2752 nobody: its style's NPCs only) and deletes one — then saves the whole list with the rev it read
|
|
4
4
|
// (PUT /ui/offices; a change made meanwhile is a 409: read again, nothing overwritten). A stored office's layout (seats,
|
|
5
5
|
// paths) and its layout overrides (Edit layout, fleet-office-layout.js) are kept as they are. Skin packs (#2513): the
|
|
6
|
-
// packs the host keeps are styles to choose; an admin uploads one here (its manifest.json and its
|
|
6
|
+
// packs the host keeps are styles to choose; an admin uploads one here (its manifest.json and its PNG or WebP pictures, picked together
|
|
7
7
|
// or as a folder — sent at once, checked by the host, which keeps it whole) or deletes one; #2692: which agents may change
|
|
8
8
|
// packs, whether their changes need the admin's yes, those waiting for it, and the newest log entries. Never offered to a guest,
|
|
9
9
|
// the public link or a read-only session (the host refuses them too).
|
|
@@ -30,7 +30,7 @@ register("orge", {
|
|
|
30
30
|
failed: "The offices were not saved ({0}).", layoutKept: "Its seats and paths are kept.",
|
|
31
31
|
stayInArea: "Idle people stay in their own area", stayInAreaNote: "They stroll only within the area they sit in and never go to sit in another area.",
|
|
32
32
|
styleUnknown: "{0} (not available here: drawn as Desks)",
|
|
33
|
-
packs: "Skin packs", packsLead: "Styles drawn from an artist's pictures. Pick a pack's manifest.json and all its PNG files together (or its folder).",
|
|
33
|
+
packs: "Skin packs", packsLead: "Styles drawn from an artist's pictures. Pick a pack's manifest.json and all its PNG or WebP files together (or its folder).",
|
|
34
34
|
packsNone: "No skin packs yet.", upload: "Upload a skin pack", uploadFolder: "Upload a folder", uploading: "Uploading…", uploaded: "Skin pack “{0}” uploaded.",
|
|
35
35
|
uploadFailed: "The skin pack was not uploaded: {0}", noManifest: "no manifest.json among the files", badManifest: "manifest.json is not JSON",
|
|
36
36
|
removePack: "Delete {0}", removedPack: "Skin pack “{0}” deleted.", removeFailed: "The skin pack was not deleted ({0}).",
|
|
@@ -54,7 +54,7 @@ register("orge", {
|
|
|
54
54
|
failed: "辦公室沒有儲存({0})。", layoutKept: "它的座位與路徑會保留。",
|
|
55
55
|
stayInArea: "待命只在自己的區域走動", stayInAreaNote: "待命的人只在自己座位所在的區域裡走動,不會到其他區域去坐。",
|
|
56
56
|
styleUnknown: "{0}(這裡沒有:以辦公桌顯示)",
|
|
57
|
-
packs: "外觀包", packsLead: "用畫師的圖片畫出的風格。請把外觀包的 manifest.json 和所有 PNG 檔一起選取(或選整個資料夾)。",
|
|
57
|
+
packs: "外觀包", packsLead: "用畫師的圖片畫出的風格。請把外觀包的 manifest.json 和所有 PNG 或 WebP 檔一起選取(或選整個資料夾)。",
|
|
58
58
|
packsNone: "還沒有外觀包。", upload: "上傳外觀包", uploadFolder: "上傳資料夾", uploading: "上傳中…", uploaded: "已上傳外觀包「{0}」。",
|
|
59
59
|
uploadFailed: "外觀包沒有上傳:{0}", noManifest: "檔案中沒有 manifest.json", badManifest: "manifest.json 不是 JSON",
|
|
60
60
|
removePack: "刪除 {0}", removedPack: "已刪除外觀包「{0}」。", removeFailed: "外觀包沒有刪除({0})。",
|
|
@@ -91,7 +91,7 @@ export async function packUpload(files) {
|
|
|
91
91
|
try { manifest = JSON.parse(await man.file.text()); } catch { return { error: te("badManifest") }; }
|
|
92
92
|
const out = {};
|
|
93
93
|
for (const x of named) {
|
|
94
|
-
if (x === man || !/\.png$/i.test(x.name)) continue;
|
|
94
|
+
if (x === man || !/\.(png|webp)$/i.test(x.name)) continue;
|
|
95
95
|
out[x.name] = base64Of(new Uint8Array(await x.file.arrayBuffer()));
|
|
96
96
|
}
|
|
97
97
|
return { body: { manifest, files: out } };
|
|
@@ -126,7 +126,7 @@ function Packs({ packs, store }) {
|
|
|
126
126
|
<span>${pk.name}</span>${pk.name !== pk.id ? html` <span class="muted mono">${pk.id}</span>` : null}
|
|
127
127
|
<button type="button" class="btn btn-sm btn-danger oe-pack-remove" onClick=${() => remove(pk)} aria-label=${te("removePack", pk.name)}>${te("remove")}</button></li>`)}</ul>`
|
|
128
128
|
: html`<p class="note" id="oePacksNone">${te("packsNone")}</p>`}
|
|
129
|
-
<label class="btn btn-sm oe-upload">${te("upload")}<input type="file" class="sr-only oe-upload-files" multiple accept=".json,.png,application/json,image/png" onChange=${send} /></label>
|
|
129
|
+
<label class="btn btn-sm oe-upload">${te("upload")}<input type="file" class="sr-only oe-upload-files" multiple accept=".json,.png,.webp,application/json,image/png,image/webp" onChange=${send} /></label>
|
|
130
130
|
<label class="btn btn-sm oe-upload">${te("uploadFolder")}<input type="file" class="sr-only oe-upload-dir" webkitdirectory="" multiple onChange=${send} /></label>
|
|
131
131
|
${msg ? html`<p class="note oe-pack-msg" role="status">${msg}</p>` : null}
|
|
132
132
|
</fieldset>`;
|
|
@@ -50,6 +50,8 @@ export interface CheckedPack {
|
|
|
50
50
|
idleVisits?: Array<{ area: string; weight: number; minSeconds: number; maxSeconds: number }>;
|
|
51
51
|
/** M-3432 (#4255): optional custom snacks the viewer may drag-to-feed or place on the floor. */
|
|
52
52
|
snacks?: PackSnack[];
|
|
53
|
+
/** A train on a loop of track (fleet-office-vehicles.js); agents ride by office_set `ride`. */
|
|
54
|
+
vehicles?: PackVehicle[];
|
|
53
55
|
}
|
|
54
56
|
/** M-3432 (#4255): one custom snack item from a pack's `snacks` list. */
|
|
55
57
|
export interface PackSnack {
|
|
@@ -149,3 +151,11 @@ export function overridesBetween(pack: CheckedPack, edited: CheckedPack): Layout
|
|
|
149
151
|
export function poseStrip(set: Record<string, PackStrip> | null | undefined, pose: string, heading?: { dx: number; dy: number } | null): { strip: PackStrip; mirror: boolean } | null;
|
|
150
152
|
export function walkStrip(f: { walk?: Record<string, PackStrip> | null; walking?: boolean; heading?: { dx: number; dy: number } | null } | null | undefined): { strip: PackStrip; mirror: boolean } | null;
|
|
151
153
|
export function stripBox(st: PackStrip, x: number, y: number, mirror?: boolean): { x: number; y: number; w: number; h: number };
|
|
154
|
+
|
|
155
|
+
/** A pack's vehicle, checked: round its closed `path` at `speed` units a second, waiting at each stop; riders sit at `seats`. */
|
|
156
|
+
export interface PackVehicle {
|
|
157
|
+
id: string; label?: string; sprite: PackStrip | null; sprites?: Partial<Record<"right" | "left" | "up" | "down", PackStrip>>;
|
|
158
|
+
fronts?: Partial<Record<"right" | "left" | "up" | "down", PackStrip>>;
|
|
159
|
+
path: PackPoint[]; speed: number; stops: Array<{ at: number; seconds: number; platform: PackPoint }>; seats: Array<{ dx: number; dy: number }>;
|
|
160
|
+
}
|
|
161
|
+
export const VEHICLE_LIMITS: { vehicles: number; path: number; stops: number; seats: number; minSpeed: number; maxSpeed: number; defaultSpeed: number; maxSeconds: number; defaultSeconds: number; offset: number };
|
|
@@ -693,6 +693,63 @@ function snackLabelOf(v, at) {
|
|
|
693
693
|
return out;
|
|
694
694
|
}
|
|
695
695
|
|
|
696
|
+
/**
|
|
697
|
+
* A pack's `vehicles` (a train on a loop of track): each runs round its closed `path` (logical points; the last joins
|
|
698
|
+
* the first) at `speed` logical units a second, and waits `seconds` at each of its `stops` (a path point's index, with
|
|
699
|
+
* the `platform` point people board from). `seats`: where riders sit, offsets from the vehicle's anchor as drawn
|
|
700
|
+
* heading right (`dx` along the car, `dy` across it; fleet-office-vehicles.js seatAt places them for each heading).
|
|
701
|
+
* `sprite` (its picture heading right; mirrored going left), or `sprites` by heading (`right`, `left`, `up`, `down`),
|
|
702
|
+
* each a strip; `fronts` the same by heading, drawn over the riders (the car's front edge hiding their lower half). Who
|
|
703
|
+
* rides is the agents' own choice (office_set `ride`), not the pack's.
|
|
704
|
+
*/
|
|
705
|
+
export const VEHICLE_LIMITS = { vehicles: 4, path: 64, stops: 8, seats: 16, minSpeed: 5, maxSpeed: 600, defaultSpeed: 80, maxSeconds: 600, defaultSeconds: 8, offset: 2000 };
|
|
706
|
+
const HEADINGS = ["right", "left", "up", "down"];
|
|
707
|
+
function vehiclesOf(v, scale) {
|
|
708
|
+
if (v === undefined) return [];
|
|
709
|
+
const seen = new Set();
|
|
710
|
+
return list(v, VEHICLE_LIMITS.vehicles, "vehicles").map((x, i) => {
|
|
711
|
+
const at = `vehicles[${i}]`;
|
|
712
|
+
obj(x, at); keys(x, ["id", "label", "sprite", "sprites", "fronts", "path", "speed", "stops", "seats"], at);
|
|
713
|
+
if (!nameOk(x.id) || seen.has(x.id)) throw new Refused(`${at}.id`, "a new name of letters, digits, _ or - (not an inherited one)");
|
|
714
|
+
seen.add(x.id);
|
|
715
|
+
if (x.label !== undefined && (typeof x.label !== "string" || !x.label.trim() || [...x.label].length > LIMIT.line || /[\u0000-\u001f\u007f]/.test(x.label))) throw new Refused(`${at}.label`, `1–${LIMIT.line} characters`);
|
|
716
|
+
if (x.sprite === undefined && x.sprites === undefined) throw new Refused(at, "a sprite, or sprites by heading");
|
|
717
|
+
let sprites = null;
|
|
718
|
+
if (x.sprites !== undefined) {
|
|
719
|
+
obj(x.sprites, `${at}.sprites`); keys(x.sprites, HEADINGS, `${at}.sprites`);
|
|
720
|
+
sprites = {};
|
|
721
|
+
for (const h of HEADINGS) if (x.sprites[h] !== undefined) sprites[h] = checkStrip(x.sprites[h], `${at}.sprites.${h}`, scale);
|
|
722
|
+
if (!Object.keys(sprites).length) throw new Refused(`${at}.sprites`, "at least one heading");
|
|
723
|
+
}
|
|
724
|
+
let fronts = null;
|
|
725
|
+
if (x.fronts !== undefined) {
|
|
726
|
+
obj(x.fronts, `${at}.fronts`); keys(x.fronts, HEADINGS, `${at}.fronts`);
|
|
727
|
+
fronts = {};
|
|
728
|
+
for (const h of HEADINGS) if (x.fronts[h] !== undefined) fronts[h] = checkStrip(x.fronts[h], `${at}.fronts.${h}`, scale);
|
|
729
|
+
}
|
|
730
|
+
const path = list(x.path, VEHICLE_LIMITS.path, `${at}.path`).map((p, j) => point(p, `${at}.path[${j}]`));
|
|
731
|
+
if (path.length < 3) throw new Refused(`${at}.path`, "at least 3 points (a loop)");
|
|
732
|
+
const speed = x.speed === undefined ? VEHICLE_LIMITS.defaultSpeed : num(x.speed, VEHICLE_LIMITS.minSpeed, VEHICLE_LIMITS.maxSpeed, `${at}.speed`);
|
|
733
|
+
const taken = new Set();
|
|
734
|
+
const stops = list(x.stops ?? [], VEHICLE_LIMITS.stops, `${at}.stops`).map((s, j) => {
|
|
735
|
+
const here = `${at}.stops[${j}]`;
|
|
736
|
+
obj(s, here); keys(s, ["at", "seconds", "platform"], here);
|
|
737
|
+
const k = int(s.at, 0, path.length - 1, `${here}.at`);
|
|
738
|
+
if (taken.has(k)) throw new Refused(`${here}.at`, "a path point no other stop has");
|
|
739
|
+
taken.add(k);
|
|
740
|
+
return { at: k, seconds: s.seconds === undefined ? VEHICLE_LIMITS.defaultSeconds : num(s.seconds, 1, VEHICLE_LIMITS.maxSeconds, `${here}.seconds`), platform: point(s.platform, `${here}.platform`) };
|
|
741
|
+
});
|
|
742
|
+
const seats = list(x.seats ?? [], VEHICLE_LIMITS.seats, `${at}.seats`).map((s, j) => {
|
|
743
|
+
const here = `${at}.seats[${j}]`;
|
|
744
|
+
obj(s, here); keys(s, ["dx", "dy"], here);
|
|
745
|
+
return { dx: num(s.dx ?? 0, -VEHICLE_LIMITS.offset, VEHICLE_LIMITS.offset, `${here}.dx`), dy: num(s.dy ?? 0, -VEHICLE_LIMITS.offset, VEHICLE_LIMITS.offset, `${here}.dy`) };
|
|
746
|
+
});
|
|
747
|
+
if (seats.length && !stops.length) throw new Refused(`${at}.stops`, "at least one stop, for its seats to be boarded");
|
|
748
|
+
return { id: x.id, ...(x.label !== undefined ? { label: x.label.trim() } : {}), sprite: x.sprite === undefined ? null : checkStrip(x.sprite, `${at}.sprite`, scale),
|
|
749
|
+
...(sprites ? { sprites } : {}), ...(fronts && Object.keys(fronts).length ? { fronts } : {}), path, speed, stops, seats };
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
|
|
696
753
|
/** M-3432 (#4255): a pack's optional `snacks` list — 1–12 snack items with sprites, optional eat overlay, and attraction radius. */
|
|
697
754
|
function snacksOf(v, scale) {
|
|
698
755
|
if (v === undefined) return [];
|
|
@@ -742,7 +799,7 @@ export function checkLevels(v) {
|
|
|
742
799
|
export function checkSkinPack(x, { kept = false } = {}) {
|
|
743
800
|
try {
|
|
744
801
|
obj(x, "pack");
|
|
745
|
-
keys(x, ["format", "id", "scale", "canvas", "background", "foreground", "matte", "areas", "stateZones", "door", "mailDrop", "waypoints", "edges", "straight", "furniture", "characters", "byInstance", "props", "bubbles", "bubblesByInstance", "room", "desk", "levels", "portraits", "dialogBox", "idleVisits", "snacks", "card"], "pack");
|
|
802
|
+
keys(x, ["format", "id", "scale", "canvas", "background", "foreground", "matte", "areas", "stateZones", "door", "mailDrop", "waypoints", "edges", "straight", "furniture", "characters", "byInstance", "props", "bubbles", "bubblesByInstance", "room", "desk", "levels", "portraits", "dialogBox", "idleVisits", "snacks", "card", "vehicles"], "pack");
|
|
746
803
|
if (x.format !== 1) throw new Refused("format", "1");
|
|
747
804
|
if (typeof x.id !== "string" || !ID.test(x.id)) throw new Refused("id", "1–40 letters, digits, _ or -");
|
|
748
805
|
if (BUILT_IN.has(x.id) || (!kept && RESERVED.has(x.id))) throw new Refused("id", "a built-in skin's id");
|
|
@@ -850,6 +907,7 @@ export function checkSkinPack(x, { kept = false } = {}) {
|
|
|
850
907
|
const levels = levelsOf(x.levels);
|
|
851
908
|
const portraits = portraitsOf(x.portraits, fids), dialogBox = dialogBoxOf(x.dialogBox), card = cardOf(x.card);
|
|
852
909
|
const snacks = snacksOf(x.snacks, scale);
|
|
910
|
+
const vehicles = vehiclesOf(x.vehicles, scale);
|
|
853
911
|
const room = x.room === undefined ? {} : obj(x.room, "room"), desk = x.desk === undefined ? {} : obj(x.desk, "desk");
|
|
854
912
|
keys(room, ["floor", "wall"], "room"); keys(desk, ["back", "front", "lit"], "desk");
|
|
855
913
|
const opt = (v, at) => (v === undefined ? undefined : src(v, at));
|
|
@@ -863,7 +921,7 @@ export function checkSkinPack(x, { kept = false } = {}) {
|
|
|
863
921
|
room: { floor: opt(room.floor, "room.floor"), wall: opt(room.wall, "room.wall") }, desk: { back: opt(desk.back, "desk.back"), front: opt(desk.front, "desk.front"), lit: opt(desk.lit, "desk.lit") },
|
|
864
922
|
...(levels ? { levels } : {}), ...(idleVisits.length ? { idleVisits } : {}),
|
|
865
923
|
...(portraits ? { portraits } : {}), ...(dialogBox ? { dialogBox } : {}),
|
|
866
|
-
...(snacks.length ? { snacks } : {}), ...(card ? { card } : {}),
|
|
924
|
+
...(snacks.length ? { snacks } : {}), ...(card ? { card } : {}), ...(vehicles.length ? { vehicles } : {}),
|
|
867
925
|
} };
|
|
868
926
|
} catch (err) {
|
|
869
927
|
if (err instanceof Refused) return { ok: false, error: err.message };
|
|
@@ -908,6 +966,11 @@ export function packStrips(pack) {
|
|
|
908
966
|
if (sn.sprite) out.push({ at: `snacks.${sn.id}.sprite`, strip: sn.sprite });
|
|
909
967
|
if (sn.eat) out.push({ at: `snacks.${sn.id}.eat`, strip: sn.eat });
|
|
910
968
|
}
|
|
969
|
+
for (const v of pack.vehicles || []) {
|
|
970
|
+
if (v.sprite) out.push({ at: `vehicles.${v.id}.sprite`, strip: v.sprite });
|
|
971
|
+
for (const [h, st] of Object.entries(v.sprites || {})) out.push({ at: `vehicles.${v.id}.sprites.${h}`, strip: st });
|
|
972
|
+
for (const [h, st] of Object.entries(v.fronts || {})) out.push({ at: `vehicles.${v.id}.fronts.${h}`, strip: st });
|
|
973
|
+
}
|
|
911
974
|
return out;
|
|
912
975
|
}
|
|
913
976
|
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
// @property {(look, at) => {x, y, w, h}} [charBox] zones: the box drawCharacter covers with the feet at `at`
|
|
39
39
|
// ({ x, y, walking, heading }): what hover and click hit (fleet-office-zones.js personAt)
|
|
40
40
|
// @property {(ctx, prop, ms, env) => void} drawProp a traffic item in the air: { kind, hue, x, y, t }
|
|
41
|
-
// @property {(ctx, x, y, text, env, lift?, flip?) => void} drawBubble a speech bubble whose tail points at (x, y), its box `lift` px higher (`flip`: on the tail's left)
|
|
41
|
+
// @property {(ctx, x, y, text, env, lift?, flip?, fit?) => void} drawBubble a speech bubble whose tail points at (x, y), its box `lift` px higher (`flip`: on the tail's left)
|
|
42
42
|
// @property {(env) => string} matte #2540: the colour around the scene (the Office fills the panel; the scene is 16:9)
|
|
43
43
|
// @property {object|null} [backdrop] a pack's loaded background picture (the page samples its edges for the matte)
|
|
44
44
|
// The desks layout's back and front layers change only when the fleet (or the zoom) does: the renderer keeps them as
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
import { t } from "/assets/app-i18n.js";
|
|
49
49
|
import { frameAt, nameHash } from "./fleet-office-model.js";
|
|
50
50
|
import { CHAR_DEPTH, LOGICAL, canvasOf, checkSkinPack, own, packPortraitImages, packSceneImages, poseStrip, stripBox, stripCell, stripFrameAt, stripImages, walkStrip } from "./fleet-office-pack.js";
|
|
51
|
+
import { facing } from "./fleet-office-vehicles.js";
|
|
51
52
|
import { tierColours } from "./fleet-office-levels.js";
|
|
52
53
|
import { assetUrl } from "/assets/asset-url.js";
|
|
53
54
|
|
|
@@ -342,29 +343,53 @@ const BUBBLE_FONT = "600 11px system-ui, sans-serif";
|
|
|
342
343
|
/**
|
|
343
344
|
* The box a speech bubble with its tail at (x, y) takes for `text` (its tail excluded): what drawBubble draws, and what
|
|
344
345
|
* the Office places so no two overlap (#2431: two neighbours' bubbles covered each other on a phone).
|
|
346
|
+
* M-3743: `fit` { l, r, t, b } (the part of the scene on screen, in its units) keeps the box on screen, as a reply's is
|
|
347
|
+
* (#4406): slid along between l and r, still over its speaker (the tail's foot slides along its edge; the tail still points at the speaker);
|
|
348
|
+
* lowered (a shorter tail) when its top would pass t; under the head (`below`: its tail up) only when even that does not fit.
|
|
349
|
+
* Also returns `foot` (where the tail leaves the box: its left foot, the right one 5 px on) and `tail`, the box its tail
|
|
350
|
+
* covers from that foot to the speaker (#4474 review: a slid foot's tail is not the old strip under the speaker) — what the
|
|
351
|
+
* Office keeps clear of other bubbles and writes an area's name again over. Without `fit` both are as before.
|
|
345
352
|
*/
|
|
346
|
-
export function bubbleBox(ctx, x, y, text, lift = 0, flip = false) {
|
|
353
|
+
export function bubbleBox(ctx, x, y, text, lift = 0, flip = false, fit = null) {
|
|
347
354
|
ctx.save();
|
|
348
355
|
ctx.font = BUBBLE_FONT;
|
|
349
356
|
const t = fitText(ctx, text, 150), w = Math.ceil((ctx.measureText ? ctx.measureText(t).width : t.length * 6) + 14), h = 19;
|
|
350
357
|
ctx.restore();
|
|
351
358
|
// M-3722: `flip` puts the box on the tail's left (its tail still under it), for a call whose usual place covers a name.
|
|
352
|
-
|
|
353
|
-
|
|
359
|
+
let bx = flip ? x - w + 14 : x - 10, by = y - h - 6 - lift, below = false;
|
|
360
|
+
if (fit) {
|
|
361
|
+
// Slid along, but always over its speaker's x (the tail's foot then slides along its edge, `foot`): a speaker
|
|
362
|
+
// in the margin or off screen keeps its bubble with it rather than one pinned to the edge.
|
|
363
|
+
if (Number.isFinite(fit.l) && Number.isFinite(fit.r)) bx = Math.max(x - w + 1, Math.min(x - 1, Math.max(fit.l, Math.min(bx, fit.r - w))));
|
|
364
|
+
if (Number.isFinite(fit.t) && by < fit.t) {
|
|
365
|
+
const lowest = y - h - 3, under = y + 6 + lift; // over the head with a 3 px tail; under it
|
|
366
|
+
if (fit.t <= lowest) by = fit.t;
|
|
367
|
+
else if (!Number.isFinite(fit.b) || under + h <= fit.b) { by = under; below = true; }
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
const box = { x: Math.round(bx), y: Math.round(by), w, h };
|
|
371
|
+
// The tail's foot: under the speaker, else as near as the box's corners allow; its box spans foot … foot + 5 and the speaker.
|
|
372
|
+
const foot = fit ? Math.max(box.x + 4, Math.min(x + 1, box.x + w - 9)) : x + 1;
|
|
373
|
+
const lo = Math.min(foot, x) - 1, hi = Math.max(foot + 5, x) + 2, top = below ? y : box.y + h, bottom = below ? box.y : y;
|
|
374
|
+
return { ...box, text: t, ...(below ? { below: true } : {}), foot, tail: { x: lo, y: top, w: hi - lo, h: Math.max(0, bottom - top) } };
|
|
354
375
|
}
|
|
355
376
|
|
|
356
377
|
/**
|
|
357
378
|
* A speech bubble, its tail at (x, y): short words on light paper in either theme; `lift` raises the box (its tail
|
|
358
|
-
* longer); `flip` (M-3722) draws the box on the tail's left
|
|
379
|
+
* longer); `flip` (M-3722) draws the box on the tail's left; `fit` (M-3743, bubbleBox) keeps it on screen — under the
|
|
380
|
+
* head, its tail up, when there is no room over it.
|
|
359
381
|
*/
|
|
360
|
-
function drawBubble(ctx, x, y, text, env, lift = 0, flip = false) {
|
|
382
|
+
function drawBubble(ctx, x, y, text, env, lift = 0, flip = false, fit = null) {
|
|
361
383
|
if (!text) return;
|
|
362
|
-
const { x: bx, y: by, w, h, text: t } = bubbleBox(ctx, x, y, text, lift, flip);
|
|
384
|
+
const { x: bx, y: by, w, h, text: t, below, foot: f } = bubbleBox(ctx, x, y, text, lift, flip, fit);
|
|
363
385
|
ctx.save();
|
|
364
386
|
ctx.font = BUBBLE_FONT;
|
|
365
387
|
ctx.fillStyle = "#fffdf6"; ctx.strokeStyle = env.mode === "light" ? "rgba(0, 0, 0, 0.35)" : "rgba(0, 0, 0, 0.6)"; ctx.lineWidth = 1;
|
|
366
|
-
ctx.beginPath(); ctx.moveTo(bx + 4, by);
|
|
367
|
-
|
|
388
|
+
ctx.beginPath(); ctx.moveTo(bx + 4, by);
|
|
389
|
+
if (below) { ctx.lineTo(f, by); ctx.lineTo(x, y); ctx.lineTo(f + 5, by); }
|
|
390
|
+
ctx.lineTo(bx + w - 4, by); ctx.lineTo(bx + w, by + 4); ctx.lineTo(bx + w, by + h - 4); ctx.lineTo(bx + w - 4, by + h);
|
|
391
|
+
if (!below) { ctx.lineTo(f + 5, by + h); ctx.lineTo(x, y); ctx.lineTo(f, by + h); }
|
|
392
|
+
ctx.lineTo(bx + 4, by + h); ctx.lineTo(bx, by + h - 4); ctx.lineTo(bx, by + 4); ctx.closePath();
|
|
368
393
|
ctx.fill(); ctx.stroke();
|
|
369
394
|
ctx.fillStyle = "#1d1d22"; ctx.textBaseline = "middle"; ctx.textAlign = "left";
|
|
370
395
|
ctx.fillText(t, bx + 7, by + h / 2 + 0.5);
|
|
@@ -381,13 +406,19 @@ const TAG_FONT = "600 10px system-ui, sans-serif";
|
|
|
381
406
|
const COMPACT = { font: "500 9px system-ui, sans-serif", textW: 48, pad: 6, top: 2, h: 11 };
|
|
382
407
|
const NORMAL = { font: TAG_FONT, textW: TAG_TEXT_W, pad: 10, top: 3, h: 14 };
|
|
383
408
|
/** The box a name tag under feet at (x, y) takes (what drawTag draws; bubbles keep clear of it, #2513). */
|
|
409
|
+
const tagSizes = new Map();
|
|
384
410
|
export function tagBox(ctx, x, y, label, compact = false, fit = null) {
|
|
385
|
-
const k = compact ? COMPACT : NORMAL;
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
411
|
+
const k = compact ? COMPACT : NORMAL, key = `${compact ? 1 : 0}${label}`, keep = !!ctx.measureText && !fit; // a fit of its own: measured each time
|
|
412
|
+
let m = keep ? tagSizes.get(key) : null;
|
|
413
|
+
if (!m) {
|
|
414
|
+
ctx.save();
|
|
415
|
+
ctx.font = k.font;
|
|
416
|
+
const t = fitText(ctx, label, k.textW, fit);
|
|
417
|
+
m = { t, w: Math.ceil((ctx.measureText ? ctx.measureText(t).width : t.length * 6) + k.pad) };
|
|
418
|
+
ctx.restore();
|
|
419
|
+
if (keep) { if (tagSizes.size > 500) tagSizes.clear(); tagSizes.set(key, m); }
|
|
420
|
+
}
|
|
421
|
+
return { x: Math.round(x - m.w / 2), y: y + k.top, w: m.w, h: k.h, text: m.t };
|
|
391
422
|
}
|
|
392
423
|
/** #2860: what a tag covers with its level badge: on a full tag's top-left corner (clear of the first letter); left of a compact one. */
|
|
393
424
|
export function tagFootprint(ctx, box, badge, compact = false) {
|
|
@@ -658,6 +689,19 @@ export function styleSeats(id) {
|
|
|
658
689
|
|
|
659
690
|
// ── Skin packs ──
|
|
660
691
|
|
|
692
|
+
/**
|
|
693
|
+
* A whole-scene picture (`im`, drawn `w` logical units wide): unsmoothed at 1 device px per picture px or more (pixel
|
|
694
|
+
* art), smoothed (high) when shrunk below that — nearest-neighbour there drops most of its thin lines and keeps others
|
|
695
|
+
* in uneven clusters (a big pack's fit on a phone). Read from the canvas's transform (none: unsmoothed, as before).
|
|
696
|
+
*/
|
|
697
|
+
export function sceneSmoothing(ctx, im, w) {
|
|
698
|
+
const t = typeof ctx.getTransform === "function" ? ctx.getTransform() : null;
|
|
699
|
+
const shrunk = !!t && !!im.width && Math.hypot(t.a, t.b) * w < im.width;
|
|
700
|
+
ctx.imageSmoothingEnabled = shrunk;
|
|
701
|
+
if (shrunk) ctx.imageSmoothingQuality = "high";
|
|
702
|
+
return shrunk;
|
|
703
|
+
}
|
|
704
|
+
|
|
661
705
|
/**
|
|
662
706
|
* An OfficeSkin from a checked pack (fleet-office-pack.js checkSkinPack) and its loaded pictures (`images`: src → a
|
|
663
707
|
* drawable image). What it lacks, or a picture not loaded, is drawn by the built-in skins.
|
|
@@ -749,12 +793,26 @@ export function spriteSkin(pack, images, base = pixelSkin) {
|
|
|
749
793
|
drawBackground(ctx, L, env) {
|
|
750
794
|
const im = img(pack.background);
|
|
751
795
|
if (!im) { drawBackground(ctx, L, env); return; }
|
|
752
|
-
ctx.save(); ctx
|
|
796
|
+
ctx.save(); sceneSmoothing(ctx, im, canvasOf(pack).w); ctx.drawImage(im, 0, 0, canvasOf(pack).w, canvasOf(pack).h); ctx.restore();
|
|
753
797
|
},
|
|
754
798
|
drawForeground(ctx, L, env) {
|
|
755
799
|
const im = img(pack.foreground);
|
|
756
800
|
if (!im) return;
|
|
757
|
-
ctx.save(); ctx
|
|
801
|
+
ctx.save(); sceneSmoothing(ctx, im, canvasOf(pack).w); ctx.drawImage(im, 0, 0, canvasOf(pack).w, canvasOf(pack).h); ctx.restore();
|
|
802
|
+
},
|
|
803
|
+
/** A pack's vehicle where it is (`at`, fleet-office-vehicles.js vehicleAt): its picture for the way it faces
|
|
804
|
+
* (`sprites` by heading; else `sprite`, mirrored going left), playing while it moves, its first frame at a stop. */
|
|
805
|
+
drawVehicle(ctx, v, at, ms, env) {
|
|
806
|
+
const dir = facing(at.heading), by = v.sprites || {};
|
|
807
|
+
const st = by[dir] || (dir === "left" && by.right) || v.sprite || by.right || by.left || by.down || by.up;
|
|
808
|
+
if (!st) return;
|
|
809
|
+
const mirror = !by[dir] && dir === "left";
|
|
810
|
+
strip(ctx, st, at.stop === null ? clipMs(env, `v:${v.id}`, st, ms) : 0, at.x, at.y, at.stop === null ? null : 0, mirror);
|
|
811
|
+
},
|
|
812
|
+
/** Its front edge (`fronts` for the way it faces; going left, `right`'s mirrored), over the riders. */
|
|
813
|
+
drawVehicleFront(ctx, v, at, ms, env) {
|
|
814
|
+
const dir = facing(at.heading), by = v.fronts || {}, st = by[dir] || (dir === "left" && by.right) || null;
|
|
815
|
+
if (st) strip(ctx, st, 0, at.x, at.y, 0, !by[dir] && dir === "left");
|
|
758
816
|
},
|
|
759
817
|
drawFurniture(ctx, f, active, ms, env) {
|
|
760
818
|
if (f.shape) { drawFurniture(ctx, f, active, ms, env); return; }
|
|
@@ -26,6 +26,19 @@ const CHOICE_KEY = "agend_org_office", FILTER_KEY = "agend_org_office_filter", S
|
|
|
26
26
|
const PLAY_KEY = "agend_org_office_play";
|
|
27
27
|
/** M-3293: the agents told about their pats and feeds, from this device (a list of names; default: none). */
|
|
28
28
|
const TELL_KEY = "agend_org_office_tell";
|
|
29
|
+
const MINI_OFF_KEY = "agend_org_office_hide_minimap", NAMES_OFF_KEY = "agend_org_office_hide_names", RENAME_KEY = "agend_org_office_names";
|
|
30
|
+
/** A name this browser gives a person: at most this long; at most RENAME_MAX of them kept. */
|
|
31
|
+
export const RENAME_LEN = 24, RENAME_MAX = 200;
|
|
32
|
+
/** The names this browser gives people ({ instance: name }), kept only when each is a short one-line string. */
|
|
33
|
+
export function renamesOk(v) {
|
|
34
|
+
if (!v || typeof v !== "object" || Array.isArray(v)) return {};
|
|
35
|
+
const out = {};
|
|
36
|
+
for (const [k, n] of Object.entries(v).slice(0, RENAME_MAX)) {
|
|
37
|
+
const s = typeof n === "string" ? n.replace(/[\u0000-\u001f\u007f]/g, "").trim() : "";
|
|
38
|
+
if (k && k.length <= 200 && s && s.length <= RENAME_LEN) out[k] = s;
|
|
39
|
+
}
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
29
42
|
const TELL_MAX = 200;
|
|
30
43
|
/** #2554: "0" when All offices leaves the lobby tile out (default: shown). */
|
|
31
44
|
const LOBBY_KEY = "agend_org_office_lobby";
|
|
@@ -100,10 +113,11 @@ export function actsOk(list, now) {
|
|
|
100
113
|
const str = (v) => typeof v === "string" && v.length > 0 && v.length <= 200, num = (v) => typeof v === "number" && Number.isFinite(v);
|
|
101
114
|
return (Array.isArray(list) ? list : []).filter((a) => a && typeof a === "object" && str(a.instance) && str(a.office) && num(a.until)
|
|
102
115
|
&& (a.x === undefined || num(a.x)) && (a.y === undefined || num(a.y)) && (a.person === undefined || str(a.person))
|
|
103
|
-
&& (a.say === undefined || (typeof a.say === "string" && a.say.length <= 40)) && (a.pose === undefined || ["idle", "working", "needs", "paused"].includes(a.pose))
|
|
116
|
+
&& (a.say === undefined || (typeof a.say === "string" && a.say.length <= 40)) && (a.pose === undefined || ["idle", "working", "needs", "paused"].includes(a.pose))
|
|
117
|
+
&& (a.ride === undefined || str(a.ride)))
|
|
104
118
|
.map((a) => ({ instance: a.instance, office: a.office, until: a.until - skew, ...(num(a.since) ? { since: a.since } : {}), ...(str(a.state) ? { state: a.state } : {}),
|
|
105
119
|
...(num(a.x) && num(a.y) ? { x: a.x, y: a.y } : {}),
|
|
106
|
-
...(a.person ? { person: a.person } : {}), ...(a.say ? { say: a.say } : {}), ...(a.pose ? { pose: a.pose } : {}) }));
|
|
120
|
+
...(a.person ? { person: a.person } : {}), ...(a.say ? { say: a.say } : {}), ...(a.pose ? { pose: a.pose } : {}), ...(a.ride ? { ride: a.ride } : {}) }));
|
|
107
121
|
}
|
|
108
122
|
export function createOfficeStore({ fetch: get = globalThis.fetch, storage } = {}) {
|
|
109
123
|
const st = () => { try { return storage || globalThis.localStorage || null; } catch { return null; } };
|
|
@@ -243,6 +257,23 @@ export function createOfficeStore({ fetch: get = globalThis.fetch, storage } = {
|
|
|
243
257
|
/** Whether paused and stopped people are left out of the Office here (default: shown). */
|
|
244
258
|
hideAsleep: () => read(ASLEEP_KEY) === "1",
|
|
245
259
|
saveHideAsleep: (v) => write(ASLEEP_KEY, v ? "1" : "0"),
|
|
260
|
+
/** Whether the name tags (and their level badges) are left out of the scene here (default: shown). */
|
|
261
|
+
namesOff: () => read(NAMES_OFF_KEY) === "1",
|
|
262
|
+
saveNamesOff: (v) => write(NAMES_OFF_KEY, v ? "1" : "0"),
|
|
263
|
+
/** Whether the minimap is left out here (default: shown). */
|
|
264
|
+
miniOff: () => read(MINI_OFF_KEY) === "1",
|
|
265
|
+
saveMiniOff: (v) => write(MINI_OFF_KEY, v ? "1" : "0"),
|
|
266
|
+
/** The names this browser gives people ({ instance: name }); only this browser sees them. */
|
|
267
|
+
renames: () => { try { return renamesOk(JSON.parse(read(RENAME_KEY) || "{}")); } catch { return {}; } },
|
|
268
|
+
/** Give `instance` a name here ("" gives back its own); the names as they are now. */
|
|
269
|
+
saveRename: (instance, name) => {
|
|
270
|
+
let all = {};
|
|
271
|
+
try { all = renamesOk(JSON.parse(read(RENAME_KEY) || "{}")); } catch { /* none */ }
|
|
272
|
+
delete all[instance];
|
|
273
|
+
const next = renamesOk(name ? { ...all, [instance]: name } : all);
|
|
274
|
+
write(RENAME_KEY, JSON.stringify(next));
|
|
275
|
+
return next;
|
|
276
|
+
},
|
|
246
277
|
/** #2568: whether the idle go to bed at night (00:00–06:00 on this device's clock) here (default: off). */
|
|
247
278
|
nightOn: () => read(NIGHT_KEY) === "1",
|
|
248
279
|
saveNightOn: (v) => write(NIGHT_KEY, v ? "1" : "0"),
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// A pack's vehicles (fleet-office-pack.js `vehicles`): a train round a loop of track. Where one is is a function of the
|
|
2
|
+
// wall clock alone, so every page shows it in the same place: it runs round its path at its speed and waits at each
|
|
3
|
+
// stop. People ride by their own choice (an agent's office_set `ride`): they walk to the platform, wait for the train
|
|
4
|
+
// to stop there, board, and ride in a seat (working there, moving with it); they get off only when it stops at a
|
|
5
|
+
// platform, then walk on. Pure — fleet-office.js draws the vehicles and moves the riders (the walkers' `ride`).
|
|
6
|
+
|
|
7
|
+
const LEGS = new WeakMap();
|
|
8
|
+
/** A vehicle's timetable: each leg (a path segment, then its stop's wait), in ms, and the whole lap. */
|
|
9
|
+
function legsOf(v) {
|
|
10
|
+
let t = LEGS.get(v);
|
|
11
|
+
if (t) return t;
|
|
12
|
+
const n = v.path.length, wait = new Map(v.stops.map((s, i) => [s.at, i])), legs = [];
|
|
13
|
+
let at = 0;
|
|
14
|
+
for (let i = 0; i < n; i++) {
|
|
15
|
+
const a = v.path[i], b = v.path[(i + 1) % n], len = Math.hypot(b.x - a.x, b.y - a.y), ms = (len / v.speed) * 1000;
|
|
16
|
+
if (ms > 0) { legs.push({ kind: "run", a, b, from: at, ms }); at += ms; }
|
|
17
|
+
const k = (i + 1) % n;
|
|
18
|
+
if (wait.has(k)) { const si = wait.get(k), s = v.stops[si]; legs.push({ kind: "stop", at: v.path[k], stop: si, from: at, ms: s.seconds * 1000, h: unit(a, b) }); at += s.seconds * 1000; }
|
|
19
|
+
}
|
|
20
|
+
t = { legs, lap: at };
|
|
21
|
+
LEGS.set(v, t);
|
|
22
|
+
return t;
|
|
23
|
+
}
|
|
24
|
+
const unit = (a, b) => { const d = Math.hypot(b.x - a.x, b.y - a.y); return d > 0 ? { x: (b.x - a.x) / d, y: (b.y - a.y) / d } : { x: 1, y: 0 }; };
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Where vehicle `v` is at wall-clock `ms`: { x, y, heading: { x, y } (unit), stop: the stop index it waits at or null,
|
|
28
|
+
* left: ms until it leaves (at a stop) }.
|
|
29
|
+
*/
|
|
30
|
+
export function vehicleAt(v, ms) {
|
|
31
|
+
const { legs, lap } = legsOf(v);
|
|
32
|
+
if (!(lap > 0)) return { x: v.path[0].x, y: v.path[0].y, heading: { x: 1, y: 0 }, stop: null, left: 0 };
|
|
33
|
+
const t = ((ms % lap) + lap) % lap;
|
|
34
|
+
for (const g of legs) {
|
|
35
|
+
if (t >= g.from + g.ms) continue;
|
|
36
|
+
const f = (t - g.from) / g.ms;
|
|
37
|
+
if (g.kind === "stop") return { x: g.at.x, y: g.at.y, heading: g.h, stop: g.stop, left: g.ms - (t - g.from) };
|
|
38
|
+
return { x: g.a.x + (g.b.x - g.a.x) * f, y: g.a.y + (g.b.y - g.a.y) * f, heading: unit(g.a, g.b), stop: null, left: 0 };
|
|
39
|
+
}
|
|
40
|
+
const last = legs[legs.length - 1];
|
|
41
|
+
return last.kind === "stop" ? { x: last.at.x, y: last.at.y, heading: last.h, stop: last.stop, left: 0 } : { x: last.b.x, y: last.b.y, heading: unit(last.a, last.b), stop: null, left: 0 };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Which way a vehicle faces, for its picture: the heading's main axis. */
|
|
45
|
+
export const facing = (h) => (Math.abs(h.x) >= Math.abs(h.y) ? (h.x < 0 ? "left" : "right") : (h.y < 0 ? "up" : "down"));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Seat `i` of vehicle `v` where it is (`at`, vehicleAt's), its offset (`dx` along the car, `dy` across it, as drawn
|
|
49
|
+
* heading right) placed for the way the car faces: right (dx, dy); left (−dx, dy) — the same deck, mirrored, as the
|
|
50
|
+
* picture is; down (−dy, dx); up (dy, −dx) — the car turned a quarter.
|
|
51
|
+
*/
|
|
52
|
+
export function seatAt(v, at, i) {
|
|
53
|
+
const s = v.seats[i] || { dx: 0, dy: 0 }, f = facing(at.heading);
|
|
54
|
+
const [ox, oy] = f === "right" ? [s.dx, s.dy] : f === "left" ? [-s.dx, s.dy] : f === "down" ? [-s.dy, s.dx] : [s.dy, -s.dx];
|
|
55
|
+
return { x: Math.round(at.x + ox), y: Math.round(at.y + oy) };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** How close (logical units) to the platform someone must stand to board, and the least wait left to step on. */
|
|
59
|
+
export const RIDE = { NEAR: 8, BOARD_MS: 400, SETTLE_MS: 60000 };
|
|
60
|
+
/** One lap of vehicle `v`, running and waiting (ms). */
|
|
61
|
+
export const lapMs = (v) => legsOf(v).lap;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Who is riding, waiting or on their way (one page's own; every page works it out alike from the same clock and acts).
|
|
65
|
+
* step({ wants, vehicles, wall, posOf, homeOf }) once a tick:
|
|
66
|
+
* - `wants`: name → the vehicle id they want to ride, or null (`null` for everyone else in the office);
|
|
67
|
+
* - `vehicles`: id → vehicle; `wall`: the wall clock; `posOf(name)`: where they are ({ x, y, walking }) or null;
|
|
68
|
+
* `homeOf(name)`: their seat (to pick the nearest platform); `sinceOf(name)`: when their ride began (wall clock), so
|
|
69
|
+
* a page opened long after shows them on board, not walking to a train they took long ago; `urgent(name)`: they
|
|
70
|
+
* must get off now (a call: #4415, nothing keeps a caller from the Help desk), where their seat is, between stops too.
|
|
71
|
+
* Returns { targets: name → where to walk now (the platform), board: [{ name, vehicle, seat }], alight: [{ name, at }] };
|
|
72
|
+
* `riding(name)` → { vehicle, seat } while on board; `clear()` forgets everyone and returns who was on board.
|
|
73
|
+
*/
|
|
74
|
+
export function createRiders() {
|
|
75
|
+
const by = new Map();
|
|
76
|
+
const near = (a, b) => !!a && !!b && Math.hypot(a.x - b.x, a.y - b.y) <= RIDE.NEAR;
|
|
77
|
+
return {
|
|
78
|
+
step({ wants, vehicles, wall, posOf, homeOf, sinceOf = null, urgent = null }) {
|
|
79
|
+
const targets = new Map(), board = [], alight = [];
|
|
80
|
+
for (const name of [...by.keys()]) if (!wants.has(name)) by.delete(name); // gone from the office
|
|
81
|
+
const used = (vid) => new Set([...by.values()].filter((r) => r.phase === "riding" && r.vehicle === vid).map((r) => r.seat));
|
|
82
|
+
for (const [name, vid] of wants) {
|
|
83
|
+
let r = by.get(name);
|
|
84
|
+
const v = vid ? vehicles.get(vid) : null;
|
|
85
|
+
if (r && r.phase === "riding") {
|
|
86
|
+
const rv = vehicles.get(r.vehicle);
|
|
87
|
+
if (!rv) { // its vehicle is gone: off where they are
|
|
88
|
+
const p = posOf(name);
|
|
89
|
+
if (p) alight.push({ name, at: { x: p.x, y: p.y } });
|
|
90
|
+
by.delete(name); continue;
|
|
91
|
+
}
|
|
92
|
+
const at = vehicleAt(rv, wall);
|
|
93
|
+
if (urgent && urgent(name)) { alight.push({ name, at: seatAt(rv, at, r.seat) }); by.delete(name); continue; }
|
|
94
|
+
if (v && vid === r.vehicle) continue; // riding on
|
|
95
|
+
if (at.stop !== null) { alight.push({ name, at: rv.stops[at.stop].platform }); by.delete(name); }
|
|
96
|
+
continue; // off only at a stop
|
|
97
|
+
}
|
|
98
|
+
if (!v || !v.seats.length || !v.stops.length) { if (r) by.delete(name); continue; }
|
|
99
|
+
// A page opened long after the ride began (more than a lap and the walk ago, `since`): they are on board already.
|
|
100
|
+
const since = sinceOf ? sinceOf(name) : null;
|
|
101
|
+
if (!r && since !== null && wall - since > lapMs(v) + RIDE.SETTLE_MS) {
|
|
102
|
+
const taken = used(vid), seat = v.seats.findIndex((_, i) => !taken.has(i));
|
|
103
|
+
if (seat >= 0) { by.set(name, { phase: "riding", vehicle: vid, seat }); board.push({ name, vehicle: vid, seat }); continue; }
|
|
104
|
+
}
|
|
105
|
+
if (!r || r.vehicle !== vid) {
|
|
106
|
+
const home = homeOf(name) || posOf(name) || v.stops[0].platform;
|
|
107
|
+
let best = 0;
|
|
108
|
+
v.stops.forEach((s, i) => { if (Math.hypot(s.platform.x - home.x, s.platform.y - home.y) < Math.hypot(v.stops[best].platform.x - home.x, v.stops[best].platform.y - home.y)) best = i; });
|
|
109
|
+
r = { phase: "going", vehicle: vid, stop: best };
|
|
110
|
+
by.set(name, r);
|
|
111
|
+
}
|
|
112
|
+
const platform = v.stops[r.stop].platform, here = posOf(name);
|
|
113
|
+
targets.set(name, platform);
|
|
114
|
+
if (r.phase === "going" && here && !here.walking && near(here, platform)) r.phase = "waiting";
|
|
115
|
+
if (r.phase !== "waiting") continue;
|
|
116
|
+
const at = vehicleAt(v, wall);
|
|
117
|
+
if (at.stop !== r.stop || at.left < RIDE.BOARD_MS) continue; // the train is not in (or is leaving)
|
|
118
|
+
const taken = used(vid), seat = v.seats.findIndex((_, i) => !taken.has(i));
|
|
119
|
+
if (seat < 0) continue; // full: wait for the next one
|
|
120
|
+
r.phase = "riding"; r.seat = seat;
|
|
121
|
+
targets.delete(name);
|
|
122
|
+
board.push({ name, vehicle: vid, seat });
|
|
123
|
+
}
|
|
124
|
+
return { targets, board, alight };
|
|
125
|
+
},
|
|
126
|
+
riding(name) { const r = by.get(name); return r && r.phase === "riding" ? { vehicle: r.vehicle, seat: r.seat } : null; },
|
|
127
|
+
phase(name) { const r = by.get(name); return r ? r.phase : null; },
|
|
128
|
+
clear() { const on = [...by].filter(([, r]) => r.phase === "riding").map(([n]) => n); by.clear(); return on; },
|
|
129
|
+
};
|
|
130
|
+
}
|