@songsid/agend 2.4.0-beta.2 → 2.4.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accounts-profiles.d.ts +1 -1
- package/dist/accounts-view.d.ts +32 -0
- package/dist/accounts-view.js +2 -14
- package/dist/accounts-view.js.map +1 -1
- package/dist/agent-cli-instructions.md +17 -7
- package/dist/agent-cli.js +163 -51
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-endpoint.d.ts +4 -1
- package/dist/agent-endpoint.js +47 -11
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/agent-export.d.ts +3 -1
- package/dist/agent-export.js +18 -1
- package/dist/agent-export.js.map +1 -1
- package/dist/agent-token-header.d.ts +1 -1
- package/dist/agent-token-header.js +1 -1
- package/dist/agent-whats-new.js +15 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/app-message-origin.d.ts +2 -0
- package/dist/app-message-origin.js +3 -0
- package/dist/app-message-origin.js.map +1 -0
- package/dist/apply-job.d.ts +2 -2
- package/dist/auth-api.d.ts +10 -0
- package/dist/auth-api.js +81 -4
- package/dist/auth-api.js.map +1 -1
- package/dist/authority/authority-state.d.ts +7 -0
- package/dist/authority/authority-state.js +17 -2
- package/dist/authority/authority-state.js.map +1 -1
- package/dist/authority/web-authority.d.ts +11 -1
- package/dist/authority/web-authority.js +11 -1
- package/dist/authority/web-authority.js.map +1 -1
- package/dist/backend/agy-model-switch.d.ts +22 -0
- package/dist/backend/agy-model-switch.js +62 -0
- package/dist/backend/agy-model-switch.js.map +1 -0
- package/dist/backend/antigravity.d.ts +9 -2
- package/dist/backend/antigravity.js +84 -9
- package/dist/backend/antigravity.js.map +1 -1
- package/dist/backend/claude-carry.d.ts +11 -0
- package/dist/backend/claude-carry.js +88 -6
- package/dist/backend/claude-carry.js.map +1 -1
- package/dist/backend/claude-code.d.ts +24 -7
- package/dist/backend/claude-code.js +206 -29
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/claude-transcript-errors.d.ts +4 -0
- package/dist/backend/claude-transcript-errors.js +5 -1
- package/dist/backend/claude-transcript-errors.js.map +1 -1
- package/dist/backend/cli-env-probe.js +1 -1
- package/dist/backend/cli-env-probe.js.map +1 -1
- package/dist/backend/cli-runtime-switch.d.ts +90 -0
- package/dist/backend/cli-runtime-switch.js +273 -0
- package/dist/backend/cli-runtime-switch.js.map +1 -0
- package/dist/backend/codex-footer-hints.d.ts +1 -0
- package/dist/backend/codex-footer-hints.js +15 -0
- package/dist/backend/codex-footer-hints.js.map +1 -1
- package/dist/backend/codex-model-switch.d.ts +41 -0
- package/dist/backend/codex-model-switch.js +170 -0
- package/dist/backend/codex-model-switch.js.map +1 -0
- package/dist/backend/codex-precaution.d.ts +7 -0
- package/dist/backend/codex-precaution.js +103 -0
- package/dist/backend/codex-precaution.js.map +1 -0
- package/dist/backend/codex.d.ts +7 -4
- package/dist/backend/codex.js +56 -10
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/credential-profile.js +1 -1
- package/dist/backend/credential-profile.js.map +1 -1
- package/dist/backend/grok-model-switch.d.ts +16 -0
- package/dist/backend/grok-model-switch.js +45 -0
- package/dist/backend/grok-model-switch.js.map +1 -0
- package/dist/backend/grok.js +33 -7
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/kiro.js +10 -5
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/muse.d.ts +2 -0
- package/dist/backend/muse.js +7 -3
- package/dist/backend/muse.js.map +1 -1
- package/dist/backend/native-pane.js +1 -1
- package/dist/backend/native-pane.js.map +1 -1
- package/dist/backend/types.d.ts +29 -2
- package/dist/backend/types.js.map +1 -1
- package/dist/backend-availability.d.ts +23 -16
- package/dist/backend-availability.js +73 -93
- package/dist/backend-availability.js.map +1 -1
- package/dist/backend-command.d.ts +4 -2
- package/dist/backend-command.js +3 -0
- package/dist/backend-command.js.map +1 -1
- package/dist/backend-signin-guide.js +1 -1
- package/dist/backend-signin-guide.js.map +1 -1
- package/dist/backend-version-static.d.ts +15 -0
- package/dist/backend-version-static.js +95 -0
- package/dist/backend-version-static.js.map +1 -0
- package/dist/browser-backend-signins.d.ts +1 -0
- package/dist/browser-backend-signins.js +3 -1
- package/dist/browser-backend-signins.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/adapters/discord.d.ts +10 -0
- package/dist/channel/adapters/discord.js +35 -0
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/adapters/telegram.d.ts +2 -0
- package/dist/channel/adapters/telegram.js +6 -1
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/mcp-server.js +36 -4
- package/dist/channel/mcp-server.js.map +1 -1
- package/dist/channel/mcp-tools.d.ts +27 -1
- package/dist/channel/mcp-tools.js +91 -8
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/channel/tool-router.d.ts +4 -0
- package/dist/channel/tool-router.js +50 -19
- package/dist/channel/tool-router.js.map +1 -1
- package/dist/channel/types.d.ts +10 -0
- package/dist/chat-task-refs.d.ts +61 -0
- package/dist/chat-task-refs.js +112 -0
- package/dist/chat-task-refs.js.map +1 -0
- package/dist/classic-channel-manager.d.ts +6 -2
- package/dist/classic-channel-manager.js +29 -4
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/classic-cli-guard.d.ts +66 -0
- package/dist/classic-cli-guard.js +209 -0
- package/dist/classic-cli-guard.js.map +1 -0
- package/dist/claude-credential-change.d.ts +22 -0
- package/dist/claude-credential-change.js +47 -0
- package/dist/claude-credential-change.js.map +1 -0
- package/dist/claude-credential-launch.d.ts +69 -0
- package/dist/claude-credential-launch.js +328 -0
- package/dist/claude-credential-launch.js.map +1 -0
- package/dist/claude-credential-runner.d.ts +1 -0
- package/dist/claude-credential-runner.js +58 -0
- package/dist/claude-credential-runner.js.map +1 -0
- package/dist/claude-credential-vault.d.ts +57 -0
- package/dist/claude-credential-vault.js +277 -0
- package/dist/claude-credential-vault.js.map +1 -0
- package/dist/claude-install-kind.d.ts +19 -0
- package/dist/claude-install-kind.js +54 -0
- package/dist/claude-install-kind.js.map +1 -0
- package/dist/claude-request-observation.d.ts +7 -0
- package/dist/claude-request-observation.js +26 -0
- package/dist/claude-request-observation.js.map +1 -0
- package/dist/claude-setup-token-transport.d.ts +9 -0
- package/dist/claude-setup-token-transport.js +104 -0
- package/dist/claude-setup-token-transport.js.map +1 -0
- package/dist/claude-setup-token.d.ts +51 -0
- package/dist/claude-setup-token.js +83 -0
- package/dist/claude-setup-token.js.map +1 -0
- package/dist/cli-audited.js +24 -17
- package/dist/cli-audited.js.map +1 -1
- package/dist/cli-capability.d.ts +3 -0
- package/dist/cli-capability.js.map +1 -1
- package/dist/cli-registry-check.js +1 -1
- package/dist/cli-registry-check.js.map +1 -1
- package/dist/cli-registry.d.ts +1 -0
- package/dist/cli-spec-antigravity.d.ts +1 -0
- package/dist/cli-spec-antigravity.js +3 -1
- package/dist/cli-spec-antigravity.js.map +1 -1
- package/dist/cli.js +8 -0
- package/dist/cli.js.map +1 -1
- package/dist/command-report.d.ts +11 -0
- package/dist/command-report.js +2 -0
- package/dist/command-report.js.map +1 -0
- package/dist/composite-tools.d.ts +11 -0
- package/dist/composite-tools.js +29 -0
- package/dist/composite-tools.js.map +1 -0
- package/dist/config-validator.js +52 -2
- package/dist/config-validator.js.map +1 -1
- package/dist/config.js +15 -2
- package/dist/config.js.map +1 -1
- package/dist/connect/control.d.ts +20 -0
- package/dist/connect/control.js +236 -0
- package/dist/connect/control.js.map +1 -0
- package/dist/connect/install.d.ts +13 -0
- package/dist/connect/install.js +12 -0
- package/dist/connect/install.js.map +1 -0
- package/dist/connect/mcp.d.ts +9 -0
- package/dist/connect/mcp.js +10 -0
- package/dist/connect/mcp.js.map +1 -0
- package/dist/connect/protocol.d.ts +38 -0
- package/dist/connect/protocol.js +36 -0
- package/dist/connect/protocol.js.map +1 -0
- package/dist/connect/service.d.ts +19 -0
- package/dist/connect/service.js +79 -0
- package/dist/connect/service.js.map +1 -0
- package/dist/connect/stdio-entry.d.ts +1 -0
- package/dist/connect/stdio-entry.js +6 -0
- package/dist/connect/stdio-entry.js.map +1 -0
- package/dist/connect/stdio.d.ts +5 -0
- package/dist/connect/stdio.js +33 -0
- package/dist/connect/stdio.js.map +1 -0
- package/dist/contact-auth-api.d.ts +17 -0
- package/dist/contact-auth-api.js +88 -0
- package/dist/contact-auth-api.js.map +1 -0
- package/dist/contact-auth-files.d.ts +6 -0
- package/dist/contact-auth-files.js +29 -0
- package/dist/contact-auth-files.js.map +1 -0
- package/dist/contact-auth-policy.d.ts +81 -0
- package/dist/contact-auth-policy.js +26 -0
- package/dist/contact-auth-policy.js.map +1 -0
- package/dist/contact-auth-service.d.ts +32 -0
- package/dist/contact-auth-service.js +101 -0
- package/dist/contact-auth-service.js.map +1 -0
- package/dist/contact-auth-store.d.ts +86 -0
- package/dist/contact-auth-store.js +372 -0
- package/dist/contact-auth-store.js.map +1 -0
- package/dist/contact-auth-types.d.ts +198 -0
- package/dist/contact-auth-types.js +7 -0
- package/dist/contact-auth-types.js.map +1 -0
- package/dist/contact-change-proposals.d.ts +47 -0
- package/dist/contact-change-proposals.js +131 -0
- package/dist/contact-change-proposals.js.map +1 -0
- package/dist/daemon.d.ts +98 -3
- package/dist/daemon.js +673 -59
- package/dist/daemon.js.map +1 -1
- package/dist/darwin-memory.js +2 -1
- package/dist/darwin-memory.js.map +1 -1
- package/dist/dashboard-permissions.d.ts +15 -8
- package/dist/dashboard-permissions.js +25 -10
- package/dist/dashboard-permissions.js.map +1 -1
- package/dist/delivery-consumed-watch.js +3 -0
- package/dist/delivery-consumed-watch.js.map +1 -1
- package/dist/delivery-outbox.d.ts +6 -6
- package/dist/delivery-outbox.js +19 -25
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/delivery-outbox.test.js +132 -96
- package/dist/delivery-outbox.test.js.map +1 -1
- package/dist/dispatcher-liveness.d.ts +51 -1
- package/dist/dispatcher-liveness.js +94 -4
- package/dist/dispatcher-liveness.js.map +1 -1
- package/dist/event-log.d.ts +13 -1
- package/dist/event-log.js +41 -1
- package/dist/event-log.js.map +1 -1
- package/dist/fleet-context.d.ts +1 -0
- package/dist/fleet-level-config.d.ts +1 -1
- package/dist/fleet-level-config.js +1 -0
- package/dist/fleet-level-config.js.map +1 -1
- package/dist/fleet-manager.d.ts +530 -14
- package/dist/fleet-manager.js +3323 -266
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-windows-runtime.d.ts +2 -2
- package/dist/fleet-windows-runtime.js +13 -4
- package/dist/fleet-windows-runtime.js.map +1 -1
- package/dist/fleet-yaml-stringify.d.ts +3 -0
- package/dist/fleet-yaml-stringify.js +132 -0
- package/dist/fleet-yaml-stringify.js.map +1 -0
- package/dist/general-knowledge/skills/concepts/SKILL.md +72 -4
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +23 -1
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +52 -0
- package/dist/general-knowledge/skills/fleet-config/SKILL.md +21 -1
- package/dist/general-knowledge/skills/fleet-health/SKILL.md +18 -0
- package/dist/general-knowledge/skills/hub/SKILL.md +369 -27
- package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +5 -1
- package/dist/general-knowledge/skills/model-discovery/SKILL.md +7 -2
- package/dist/general-knowledge/skills/persona-emoji/SKILL.md +3 -0
- package/dist/general-knowledge/skills/task-board/SKILL.md +67 -0
- package/dist/general-knowledge/skills/web-appearance/SKILL.md +29 -3
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +224 -43
- package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +6 -0
- package/dist/general-knowledge/steering/core-rules.md +15 -78
- package/dist/general-role-block.d.ts +19 -0
- package/dist/general-role-block.js +56 -0
- package/dist/general-role-block.js.map +1 -0
- package/dist/general-role.d.ts +1 -1
- package/dist/general-role.js +1 -0
- package/dist/general-role.js.map +1 -1
- package/dist/host-memory.d.ts +3 -0
- package/dist/host-memory.js.map +1 -1
- package/dist/host-monitoring/darwin/collector.d.ts +18 -0
- package/dist/host-monitoring/darwin/collector.js +65 -0
- package/dist/host-monitoring/darwin/collector.js.map +1 -0
- package/dist/host-monitoring/darwin/defaults.d.ts +2 -0
- package/dist/host-monitoring/darwin/defaults.js +9 -0
- package/dist/host-monitoring/darwin/defaults.js.map +1 -0
- package/dist/host-monitoring/darwin/interpretation.d.ts +20 -0
- package/dist/host-monitoring/darwin/interpretation.js +73 -0
- package/dist/host-monitoring/darwin/interpretation.js.map +1 -0
- package/dist/host-monitoring/linux/collector.d.ts +17 -0
- package/dist/host-monitoring/linux/collector.js +55 -0
- package/dist/host-monitoring/linux/collector.js.map +1 -0
- package/dist/host-monitoring/linux/defaults.d.ts +2 -0
- package/dist/host-monitoring/linux/defaults.js +9 -0
- package/dist/host-monitoring/linux/defaults.js.map +1 -0
- package/dist/host-monitoring/linux/interpretation.d.ts +22 -0
- package/dist/host-monitoring/linux/interpretation.js +76 -0
- package/dist/host-monitoring/linux/interpretation.js.map +1 -0
- package/dist/host-monitoring/transport.d.ts +42 -0
- package/dist/host-monitoring/transport.js +101 -0
- package/dist/host-monitoring/transport.js.map +1 -0
- package/dist/host-monitoring/wsl/collector.d.ts +19 -0
- package/dist/host-monitoring/wsl/collector.js +72 -0
- package/dist/host-monitoring/wsl/collector.js.map +1 -0
- package/dist/host-monitoring/wsl/defaults.d.ts +2 -0
- package/dist/host-monitoring/wsl/defaults.js +9 -0
- package/dist/host-monitoring/wsl/defaults.js.map +1 -0
- package/dist/host-monitoring/wsl/interpretation.d.ts +22 -0
- package/dist/host-monitoring/wsl/interpretation.js +77 -0
- package/dist/host-monitoring/wsl/interpretation.js.map +1 -0
- package/dist/host-monitoring-alert-policy.d.ts +73 -0
- package/dist/host-monitoring-alert-policy.js +152 -0
- package/dist/host-monitoring-alert-policy.js.map +1 -0
- package/dist/host-monitoring-alert-resources.d.ts +11 -0
- package/dist/host-monitoring-alert-resources.js +16 -0
- package/dist/host-monitoring-alert-resources.js.map +1 -0
- package/dist/host-monitoring-alert-settings.d.ts +16 -0
- package/dist/host-monitoring-alert-settings.js +68 -0
- package/dist/host-monitoring-alert-settings.js.map +1 -0
- package/dist/host-monitoring-alert-store.d.ts +49 -0
- package/dist/host-monitoring-alert-store.js +228 -0
- package/dist/host-monitoring-alert-store.js.map +1 -0
- package/dist/host-monitoring-alert-text.d.ts +7 -0
- package/dist/host-monitoring-alert-text.js +10 -0
- package/dist/host-monitoring-alert-text.js.map +1 -0
- package/dist/host-monitoring-alerts.d.ts +79 -0
- package/dist/host-monitoring-alerts.js +276 -0
- package/dist/host-monitoring-alerts.js.map +1 -0
- package/dist/host-monitoring-config.d.ts +15 -0
- package/dist/host-monitoring-config.js +36 -0
- package/dist/host-monitoring-config.js.map +1 -0
- package/dist/host-monitoring-defaults.d.ts +19 -0
- package/dist/host-monitoring-defaults.js +10 -0
- package/dist/host-monitoring-defaults.js.map +1 -0
- package/dist/host-monitoring-footprint-policy.d.ts +45 -0
- package/dist/host-monitoring-footprint-policy.js +150 -0
- package/dist/host-monitoring-footprint-policy.js.map +1 -0
- package/dist/host-monitoring-footprint.d.ts +42 -0
- package/dist/host-monitoring-footprint.js +169 -0
- package/dist/host-monitoring-footprint.js.map +1 -0
- package/dist/host-monitoring-history-files.d.ts +2 -0
- package/dist/host-monitoring-history-files.js +16 -0
- package/dist/host-monitoring-history-files.js.map +1 -0
- package/dist/host-monitoring-history-policy.d.ts +57 -0
- package/dist/host-monitoring-history-policy.js +107 -0
- package/dist/host-monitoring-history-policy.js.map +1 -0
- package/dist/host-monitoring-history-store.d.ts +52 -0
- package/dist/host-monitoring-history-store.js +178 -0
- package/dist/host-monitoring-history-store.js.map +1 -0
- package/dist/host-monitoring-history-worker.d.ts +1 -0
- package/dist/host-monitoring-history-worker.js +66 -0
- package/dist/host-monitoring-history-worker.js.map +1 -0
- package/dist/host-monitoring-history.d.ts +80 -0
- package/dist/host-monitoring-history.js +301 -0
- package/dist/host-monitoring-history.js.map +1 -0
- package/dist/host-monitoring-platform.d.ts +21 -0
- package/dist/host-monitoring-platform.js +18 -0
- package/dist/host-monitoring-platform.js.map +1 -0
- package/dist/host-monitoring-process-identity.d.ts +8 -0
- package/dist/host-monitoring-process-identity.js +81 -0
- package/dist/host-monitoring-process-identity.js.map +1 -0
- package/dist/host-monitoring-runtime.d.ts +42 -0
- package/dist/host-monitoring-runtime.js +95 -0
- package/dist/host-monitoring-runtime.js.map +1 -0
- package/dist/host-monitoring-settings-store.d.ts +5 -0
- package/dist/host-monitoring-settings-store.js +49 -0
- package/dist/host-monitoring-settings-store.js.map +1 -0
- package/dist/host-monitoring.d.ts +121 -0
- package/dist/host-monitoring.js +157 -0
- package/dist/host-monitoring.js.map +1 -0
- package/dist/hub/admin-dashboard.d.ts +85 -0
- package/dist/hub/admin-dashboard.js +177 -0
- package/dist/hub/admin-dashboard.js.map +1 -0
- package/dist/hub/agent-catalog-model.d.ts +297 -0
- package/dist/hub/agent-catalog-model.js +57 -0
- package/dist/hub/agent-catalog-model.js.map +1 -0
- package/dist/hub/agent-catalog.d.ts +140 -0
- package/dist/hub/agent-catalog.js +129 -0
- package/dist/hub/agent-catalog.js.map +1 -0
- package/dist/hub/agent-intro-model.d.ts +38 -0
- package/dist/hub/agent-intro-model.js +14 -0
- package/dist/hub/agent-intro-model.js.map +1 -0
- package/dist/hub/agent-intro-tool.d.ts +35 -0
- package/dist/hub/agent-intro-tool.js +83 -0
- package/dist/hub/agent-intro-tool.js.map +1 -0
- package/dist/hub/agent-intro.d.ts +31 -0
- package/dist/hub/agent-intro.js +51 -0
- package/dist/hub/agent-intro.js.map +1 -0
- package/dist/hub/agent-pictures-model.d.ts +147 -0
- package/dist/hub/agent-pictures-model.js +64 -0
- package/dist/hub/agent-pictures-model.js.map +1 -0
- package/dist/hub/agent-pictures.d.ts +52 -0
- package/dist/hub/agent-pictures.js +202 -0
- package/dist/hub/agent-pictures.js.map +1 -0
- package/dist/hub/attachments/store.d.ts +2 -0
- package/dist/hub/attachments/store.js +6 -0
- package/dist/hub/attachments/store.js.map +1 -1
- package/dist/hub/audit/index.d.ts +5 -1
- package/dist/hub/audit/index.js +43 -3
- package/dist/hub/audit/index.js.map +1 -1
- package/dist/hub/buttons.js +3 -1
- package/dist/hub/buttons.js.map +1 -1
- package/dist/hub/catalog.d.ts +19 -6
- package/dist/hub/catalog.js +89 -17
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/client.d.ts +18 -0
- package/dist/hub/client.js +149 -12
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +56 -7
- package/dist/hub/compose/member.js +371 -31
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +24 -0
- package/dist/hub/compose/server.js +130 -16
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/direct-posts-model.d.ts +1 -0
- package/dist/hub/direct-posts-model.js +2 -0
- package/dist/hub/direct-posts-model.js.map +1 -0
- package/dist/hub/direct-posts.d.ts +36 -0
- package/dist/hub/direct-posts.js +145 -0
- package/dist/hub/direct-posts.js.map +1 -0
- package/dist/hub/directory/directory.js +5 -2
- package/dist/hub/directory/directory.js.map +1 -1
- package/dist/hub/directory/types.d.ts +5 -1
- package/dist/hub/directory/types.js.map +1 -1
- package/dist/hub/display-name.d.ts +10 -0
- package/dist/hub/display-name.js +35 -0
- package/dist/hub/display-name.js.map +1 -0
- package/dist/hub/execution/service.d.ts +2 -1
- package/dist/hub/execution/service.js +2 -1
- package/dist/hub/execution/service.js.map +1 -1
- package/dist/hub/fleet-info.d.ts +12 -0
- package/dist/hub/fleet-info.js +14 -0
- package/dist/hub/fleet-info.js.map +1 -0
- package/dist/hub/fleet-update-model.d.ts +100 -0
- package/dist/hub/fleet-update-model.js +15 -0
- package/dist/hub/fleet-update-model.js.map +1 -0
- package/dist/hub/fleet-updates.d.ts +46 -0
- package/dist/hub/fleet-updates.js +282 -0
- package/dist/hub/fleet-updates.js.map +1 -0
- package/dist/hub/fleet-versions.d.ts +28 -0
- package/dist/hub/fleet-versions.js +80 -0
- package/dist/hub/fleet-versions.js.map +1 -0
- package/dist/hub/group-policy/admin-api.d.ts +1 -0
- package/dist/hub/group-policy/admin-api.js +10 -1
- package/dist/hub/group-policy/admin-api.js.map +1 -1
- package/dist/hub/group-policy/admin-control.d.ts +1 -0
- package/dist/hub/group-policy/admin-control.js +13 -4
- package/dist/hub/group-policy/admin-control.js.map +1 -1
- package/dist/hub/group-policy/admin-dto.d.ts +39 -1
- package/dist/hub/group-policy/admin-dto.js.map +1 -1
- package/dist/hub/group-policy/admin-facts.d.ts +4 -2
- package/dist/hub/group-policy/admin-facts.js +17 -2
- package/dist/hub/group-policy/admin-facts.js.map +1 -1
- package/dist/hub/group-policy/admin-impact.d.ts +36 -6
- package/dist/hub/group-policy/admin-impact.js +21 -7
- package/dist/hub/group-policy/admin-impact.js.map +1 -1
- package/dist/hub/group-policy/admin-inventory.d.ts +2 -0
- package/dist/hub/group-policy/admin-inventory.js +13 -4
- package/dist/hub/group-policy/admin-inventory.js.map +1 -1
- package/dist/hub/group-policy/admin-search.d.ts +2 -1
- package/dist/hub/group-policy/admin-search.js +56 -7
- package/dist/hub/group-policy/admin-search.js.map +1 -1
- package/dist/hub/group-policy/authorization.d.ts +2 -0
- package/dist/hub/group-policy/authorization.js +7 -2
- package/dist/hub/group-policy/authorization.js.map +1 -1
- package/dist/hub/group-policy/impact-inventory.d.ts +4 -1
- package/dist/hub/group-policy/impact-inventory.js +23 -2
- package/dist/hub/group-policy/impact-inventory.js.map +1 -1
- package/dist/hub/group-policy/model.d.ts +52 -1
- package/dist/hub/group-policy/model.js +20 -7
- package/dist/hub/group-policy/model.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +2 -0
- package/dist/hub/group-policy/resources.js +12 -1
- package/dist/hub/group-policy/resources.js.map +1 -1
- package/dist/hub/group-policy/store.js +22 -3
- package/dist/hub/group-policy/store.js.map +1 -1
- package/dist/hub/group-policy/team-subjects.d.ts +16 -0
- package/dist/hub/group-policy/team-subjects.js +32 -0
- package/dist/hub/group-policy/team-subjects.js.map +1 -0
- package/dist/hub/http/compose.d.ts +14 -0
- package/dist/hub/http/compose.js +771 -47
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.d.ts +9 -1
- package/dist/hub/http/core.js +53 -3
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/http/deps.d.ts +19 -0
- package/dist/hub/http/schema.js +50 -1
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/invitations.js +15 -7
- package/dist/hub/invitations.js.map +1 -1
- package/dist/hub/join/client.js +75 -42
- package/dist/hub/join/client.js.map +1 -1
- package/dist/hub/join/service.d.ts +3 -1
- package/dist/hub/join/service.js +7 -3
- package/dist/hub/join/service.js.map +1 -1
- package/dist/hub/lapse-carry.d.ts +45 -0
- package/dist/hub/lapse-carry.js +62 -0
- package/dist/hub/lapse-carry.js.map +1 -0
- package/dist/hub/mcp/auth-schema.d.ts +7 -0
- package/dist/hub/mcp/auth-schema.js +31 -0
- package/dist/hub/mcp/auth-schema.js.map +1 -0
- package/dist/hub/mcp/auth.d.ts +89 -0
- package/dist/hub/mcp/auth.js +374 -0
- package/dist/hub/mcp/auth.js.map +1 -0
- package/dist/hub/mcp/catalog.d.ts +44 -0
- package/dist/hub/mcp/catalog.js +31 -0
- package/dist/hub/mcp/catalog.js.map +1 -0
- package/dist/hub/mcp/door-schema.d.ts +7 -0
- package/dist/hub/mcp/door-schema.js +20 -0
- package/dist/hub/mcp/door-schema.js.map +1 -0
- package/dist/hub/mcp/http.d.ts +25 -0
- package/dist/hub/mcp/http.js +259 -0
- package/dist/hub/mcp/http.js.map +1 -0
- package/dist/hub/mcp/policy.d.ts +65 -0
- package/dist/hub/mcp/policy.js +153 -0
- package/dist/hub/mcp/policy.js.map +1 -0
- package/dist/hub/mcp/server.d.ts +3 -0
- package/dist/hub/mcp/server.js +32 -0
- package/dist/hub/mcp/server.js.map +1 -0
- package/dist/hub/mcp/tools.d.ts +31 -0
- package/dist/hub/mcp/tools.js +177 -0
- package/dist/hub/mcp/tools.js.map +1 -0
- package/dist/hub/member/agent-catalog.d.ts +31 -0
- package/dist/hub/member/agent-catalog.js +91 -0
- package/dist/hub/member/agent-catalog.js.map +1 -0
- package/dist/hub/member/agent-intro.d.ts +29 -0
- package/dist/hub/member/agent-intro.js +73 -0
- package/dist/hub/member/agent-intro.js.map +1 -0
- package/dist/hub/member/agent-pictures.d.ts +43 -0
- package/dist/hub/member/agent-pictures.js +125 -0
- package/dist/hub/member/agent-pictures.js.map +1 -0
- package/dist/hub/member/direct-rooms.d.ts +9 -0
- package/dist/hub/member/direct-rooms.js +14 -0
- package/dist/hub/member/direct-rooms.js.map +1 -0
- package/dist/hub/member/display-name.d.ts +9 -0
- package/dist/hub/member/display-name.js +71 -0
- package/dist/hub/member/display-name.js.map +1 -0
- package/dist/hub/member/exposure-api.d.ts +11 -3
- package/dist/hub/member/exposure-api.js +24 -10
- package/dist/hub/member/exposure-api.js.map +1 -1
- package/dist/hub/member/exposures.d.ts +16 -4
- package/dist/hub/member/exposures.js +47 -13
- package/dist/hub/member/exposures.js.map +1 -1
- package/dist/hub/member/pairing-api.js +3 -2
- package/dist/hub/member/pairing-api.js.map +1 -1
- package/dist/hub/member/recommendations.d.ts +37 -0
- package/dist/hub/member/recommendations.js +129 -0
- package/dist/hub/member/recommendations.js.map +1 -0
- package/dist/hub/member/room-ask.d.ts +78 -5
- package/dist/hub/member/room-ask.js +337 -26
- package/dist/hub/member/room-ask.js.map +1 -1
- package/dist/hub/member/room-context-budget.d.ts +5 -0
- package/dist/hub/member/room-context-budget.js +34 -0
- package/dist/hub/member/room-context-budget.js.map +1 -0
- package/dist/hub/member/room-mention-feedback.d.ts +44 -0
- package/dist/hub/member/room-mention-feedback.js +121 -0
- package/dist/hub/member/room-mention-feedback.js.map +1 -0
- package/dist/hub/member/room-notification.d.ts +9 -0
- package/dist/hub/member/room-notification.js +2 -0
- package/dist/hub/member/room-notification.js.map +1 -0
- package/dist/hub/member/room-post-answers.d.ts +46 -0
- package/dist/hub/member/room-post-answers.js +152 -0
- package/dist/hub/member/room-post-answers.js.map +1 -0
- package/dist/hub/member/room-post-receipt.d.ts +21 -0
- package/dist/hub/member/room-post-receipt.js +49 -0
- package/dist/hub/member/room-post-receipt.js.map +1 -0
- package/dist/hub/member/room-post.d.ts +135 -0
- package/dist/hub/member/room-post.js +311 -0
- package/dist/hub/member/room-post.js.map +1 -0
- package/dist/hub/member/sharing-journal.d.ts +252 -0
- package/dist/hub/member/sharing-journal.js +212 -0
- package/dist/hub/member/sharing-journal.js.map +1 -0
- package/dist/hub/member/sharing-link.d.ts +25 -0
- package/dist/hub/member/sharing-link.js +68 -0
- package/dist/hub/member/sharing-link.js.map +1 -0
- package/dist/hub/member/sharing-result.d.ts +6 -0
- package/dist/hub/member/sharing-result.js +46 -0
- package/dist/hub/member/sharing-result.js.map +1 -0
- package/dist/hub/member/sharing.d.ts +39 -0
- package/dist/hub/member/sharing.js +188 -0
- package/dist/hub/member/sharing.js.map +1 -0
- package/dist/hub/member/updates.d.ts +92 -0
- package/dist/hub/member/updates.js +316 -0
- package/dist/hub/member/updates.js.map +1 -0
- package/dist/hub/pairing.d.ts +15 -1
- package/dist/hub/pairing.js +33 -2
- package/dist/hub/pairing.js.map +1 -1
- package/dist/hub/personal/owner-host.d.ts +146 -0
- package/dist/hub/personal/owner-host.js +289 -0
- package/dist/hub/personal/owner-host.js.map +1 -0
- package/dist/hub/personal/refusals.d.ts +11 -0
- package/dist/hub/personal/refusals.js +33 -0
- package/dist/hub/personal/refusals.js.map +1 -0
- package/dist/hub/personal/runtime-host.d.ts +26 -0
- package/dist/hub/personal/runtime-host.js +51 -0
- package/dist/hub/personal/runtime-host.js.map +1 -0
- package/dist/hub/personal/schema.d.ts +4 -0
- package/dist/hub/personal/schema.js +54 -0
- package/dist/hub/personal/schema.js.map +1 -0
- package/dist/hub/personal/turns.d.ts +39 -0
- package/dist/hub/personal/turns.js +221 -0
- package/dist/hub/personal/turns.js.map +1 -0
- package/dist/hub/personal/types.d.ts +42 -0
- package/dist/hub/personal/types.js +2 -0
- package/dist/hub/personal/types.js.map +1 -0
- package/dist/hub/policy.d.ts +12 -3
- package/dist/hub/policy.js +62 -7
- package/dist/hub/policy.js.map +1 -1
- package/dist/hub/protocol.d.ts +1274 -56
- package/dist/hub/protocol.js +123 -16
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/published-version.d.ts +3 -0
- package/dist/hub/published-version.js +35 -0
- package/dist/hub/published-version.js.map +1 -0
- package/dist/hub/quota.js +3 -1
- package/dist/hub/quota.js.map +1 -1
- package/dist/hub/recommendation-model.d.ts +36 -0
- package/dist/hub/recommendation-model.js +9 -0
- package/dist/hub/recommendation-model.js.map +1 -0
- package/dist/hub/recommendations.d.ts +58 -0
- package/dist/hub/recommendations.js +211 -0
- package/dist/hub/recommendations.js.map +1 -0
- package/dist/hub/representative.d.ts +33 -0
- package/dist/hub/representative.js +132 -12
- package/dist/hub/representative.js.map +1 -1
- package/dist/hub/roles/admin-control.d.ts +29 -0
- package/dist/hub/roles/admin-control.js +187 -0
- package/dist/hub/roles/admin-control.js.map +1 -0
- package/dist/hub/roles/admin-types.d.ts +72 -0
- package/dist/hub/roles/admin-types.js +2 -0
- package/dist/hub/roles/admin-types.js.map +1 -0
- package/dist/hub/roles/allowed-list-control.d.ts +34 -0
- package/dist/hub/roles/allowed-list-control.js +179 -0
- package/dist/hub/roles/allowed-list-control.js.map +1 -0
- package/dist/hub/roles/allowed-list.d.ts +8 -0
- package/dist/hub/roles/allowed-list.js +49 -0
- package/dist/hub/roles/allowed-list.js.map +1 -0
- package/dist/hub/roles/audit-details.d.ts +144 -0
- package/dist/hub/roles/audit-details.js +26 -0
- package/dist/hub/roles/audit-details.js.map +1 -0
- package/dist/hub/roles/authority.d.ts +12 -0
- package/dist/hub/roles/authority.js +39 -3
- package/dist/hub/roles/authority.js.map +1 -1
- package/dist/hub/roles/change.d.ts +3 -1
- package/dist/hub/roles/change.js +7 -2
- package/dist/hub/roles/change.js.map +1 -1
- package/dist/hub/roles/clock.d.ts +3 -0
- package/dist/hub/roles/clock.js +1 -1
- package/dist/hub/roles/clock.js.map +1 -1
- package/dist/hub/roles/convert.js +1 -1
- package/dist/hub/roles/convert.js.map +1 -1
- package/dist/hub/roles/cutover-inventory.d.ts +5 -0
- package/dist/hub/roles/cutover-inventory.js +27 -4
- package/dist/hub/roles/cutover-inventory.js.map +1 -1
- package/dist/hub/roles/cutover-marker.d.ts +18 -2
- package/dist/hub/roles/cutover-marker.js +6 -2
- package/dist/hub/roles/cutover-marker.js.map +1 -1
- package/dist/hub/roles/cutover.d.ts +2 -2
- package/dist/hub/roles/cutover.js +3 -4
- package/dist/hub/roles/cutover.js.map +1 -1
- package/dist/hub/roles/delegation.d.ts +4 -1
- package/dist/hub/roles/delegation.js +7 -2
- package/dist/hub/roles/delegation.js.map +1 -1
- package/dist/hub/roles/evaluate.d.ts +2 -1
- package/dist/hub/roles/evaluate.js +14 -0
- package/dist/hub/roles/evaluate.js.map +1 -1
- package/dist/hub/roles/expiry-effects.d.ts +8 -0
- package/dist/hub/roles/expiry-effects.js +50 -0
- package/dist/hub/roles/expiry-effects.js.map +1 -0
- package/dist/hub/roles/migrations.d.ts +7 -0
- package/dist/hub/roles/migrations.js +44 -0
- package/dist/hub/roles/migrations.js.map +1 -0
- package/dist/hub/roles/model.d.ts +25 -0
- package/dist/hub/roles/model.js +9 -3
- package/dist/hub/roles/model.js.map +1 -1
- package/dist/hub/roles/overview.d.ts +8 -0
- package/dist/hub/roles/overview.js +15 -0
- package/dist/hub/roles/overview.js.map +1 -0
- package/dist/hub/roles/resource-effects.d.ts +17 -0
- package/dist/hub/roles/resource-effects.js +62 -0
- package/dist/hub/roles/resource-effects.js.map +1 -0
- package/dist/hub/roles/review.d.ts +16 -0
- package/dist/hub/roles/review.js +42 -0
- package/dist/hub/roles/review.js.map +1 -0
- package/dist/hub/roles/writer.d.ts +14 -3
- package/dist/hub/roles/writer.js +64 -16
- package/dist/hub/roles/writer.js.map +1 -1
- package/dist/hub/room-agent-discovery-model.d.ts +29 -0
- package/dist/hub/room-agent-discovery-model.js +33 -0
- package/dist/hub/room-agent-discovery-model.js.map +1 -0
- package/dist/hub/room-agent-discovery.d.ts +14 -0
- package/dist/hub/room-agent-discovery.js +65 -0
- package/dist/hub/room-agent-discovery.js.map +1 -0
- package/dist/hub/room-agent-requests.d.ts +71 -0
- package/dist/hub/room-agent-requests.js +377 -0
- package/dist/hub/room-agent-requests.js.map +1 -0
- package/dist/hub/room-answer-status-model.d.ts +3 -0
- package/dist/hub/room-answer-status-model.js +4 -0
- package/dist/hub/room-answer-status-model.js.map +1 -0
- package/dist/hub/room-brief-model.d.ts +30 -0
- package/dist/hub/room-brief-model.js +38 -0
- package/dist/hub/room-brief-model.js.map +1 -0
- package/dist/hub/room-context-model.d.ts +45 -0
- package/dist/hub/room-context-model.js +12 -0
- package/dist/hub/room-context-model.js.map +1 -0
- package/dist/hub/room-members-model.d.ts +63 -0
- package/dist/hub/room-members-model.js +7 -0
- package/dist/hub/room-members-model.js.map +1 -0
- package/dist/hub/room-mention-feedback-model.d.ts +12 -0
- package/dist/hub/room-mention-feedback-model.js +12 -0
- package/dist/hub/room-mention-feedback-model.js.map +1 -0
- package/dist/hub/rooms/agents.d.ts +49 -10
- package/dist/hub/rooms/agents.js +356 -33
- package/dist/hub/rooms/agents.js.map +1 -1
- package/dist/hub/rooms/assistant.d.ts +1 -6
- package/dist/hub/rooms/assistant.js +7 -2
- package/dist/hub/rooms/assistant.js.map +1 -1
- package/dist/hub/rooms/automation.d.ts +24 -0
- package/dist/hub/rooms/automation.js +66 -0
- package/dist/hub/rooms/automation.js.map +1 -0
- package/dist/hub/rooms/brief.d.ts +18 -0
- package/dist/hub/rooms/brief.js +39 -0
- package/dist/hub/rooms/brief.js.map +1 -0
- package/dist/hub/rooms/buttons.d.ts +85 -0
- package/dist/hub/rooms/buttons.js +62 -0
- package/dist/hub/rooms/buttons.js.map +1 -0
- package/dist/hub/rooms/context-cursor.d.ts +18 -0
- package/dist/hub/rooms/context-cursor.js +61 -0
- package/dist/hub/rooms/context-cursor.js.map +1 -0
- package/dist/hub/rooms/context.d.ts +1 -1
- package/dist/hub/rooms/context.js +4 -4
- package/dist/hub/rooms/context.js.map +1 -1
- package/dist/hub/rooms/direct-view.d.ts +12 -3
- package/dist/hub/rooms/direct-view.js +25 -10
- package/dist/hub/rooms/direct-view.js.map +1 -1
- package/dist/hub/rooms/directory.d.ts +13 -0
- package/dist/hub/rooms/directory.js +12 -3
- package/dist/hub/rooms/directory.js.map +1 -1
- package/dist/hub/rooms/members-page.d.ts +33 -0
- package/dist/hub/rooms/members-page.js +37 -0
- package/dist/hub/rooms/members-page.js.map +1 -0
- package/dist/hub/rooms/mentions.d.ts +15 -0
- package/dist/hub/rooms/mentions.js +43 -0
- package/dist/hub/rooms/mentions.js.map +1 -0
- package/dist/hub/rooms/office.d.ts +123 -0
- package/dist/hub/rooms/office.js +79 -0
- package/dist/hub/rooms/office.js.map +1 -0
- package/dist/hub/rooms/post-replies.d.ts +23 -0
- package/dist/hub/rooms/post-replies.js +114 -0
- package/dist/hub/rooms/post-replies.js.map +1 -0
- package/dist/hub/rooms/purpose.d.ts +7 -0
- package/dist/hub/rooms/purpose.js +14 -0
- package/dist/hub/rooms/purpose.js.map +1 -0
- package/dist/hub/rooms/schema.d.ts +14 -0
- package/dist/hub/rooms/schema.js +52 -0
- package/dist/hub/rooms/schema.js.map +1 -1
- package/dist/hub/rooms/service.d.ts +373 -7
- package/dist/hub/rooms/service.js +1056 -47
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +46 -4
- package/dist/hub/rooms.d.ts +22 -2
- package/dist/hub/rooms.js +193 -47
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/runtime.d.ts +1 -1
- package/dist/hub/runtime.js +17 -4
- package/dist/hub/runtime.js.map +1 -1
- package/dist/hub/server.d.ts +8 -1
- package/dist/hub/server.js +165 -7
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/session-directory-transition.d.ts +3 -1
- package/dist/hub/session-directory-transition.js +25 -12
- package/dist/hub/session-directory-transition.js.map +1 -1
- package/dist/hub/session-limits.d.ts +58 -0
- package/dist/hub/session-limits.js +121 -0
- package/dist/hub/session-limits.js.map +1 -0
- package/dist/hub/sessions.d.ts +2 -2
- package/dist/hub/sessions.js +39 -11
- package/dist/hub/sessions.js.map +1 -1
- package/dist/hub/settings-commit.d.ts +32 -1
- package/dist/hub/settings-commit.js +11 -4
- package/dist/hub/settings-commit.js.map +1 -1
- package/dist/hub/settings-directory-ca.js +1 -1
- package/dist/hub/settings-directory-ca.js.map +1 -1
- package/dist/hub/settings-directory-control.js +7 -7
- package/dist/hub/settings-directory-control.js.map +1 -1
- package/dist/hub/settings-directory-decision.js +1 -1
- package/dist/hub/settings-directory-decision.js.map +1 -1
- package/dist/hub/settings-directory-http.d.ts +2 -0
- package/dist/hub/settings-directory-http.js +21 -6
- package/dist/hub/settings-directory-http.js.map +1 -1
- package/dist/hub/settings-directory-proof.d.ts +5 -1
- package/dist/hub/settings-directory-proof.js +49 -10
- package/dist/hub/settings-directory-proof.js.map +1 -1
- package/dist/hub/settings-directory-recovery.js +2 -1
- package/dist/hub/settings-directory-recovery.js.map +1 -1
- package/dist/hub/settings-directory-save.d.ts +2 -0
- package/dist/hub/settings-directory-save.js +9 -6
- package/dist/hub/settings-directory-save.js.map +1 -1
- package/dist/hub/sharing-previous-access.d.ts +22 -0
- package/dist/hub/sharing-previous-access.js +93 -0
- package/dist/hub/sharing-previous-access.js.map +1 -0
- package/dist/hub/sharing-requests.d.ts +174 -0
- package/dist/hub/sharing-requests.js +326 -0
- package/dist/hub/sharing-requests.js.map +1 -0
- package/dist/hub/sharing-retention.d.ts +47 -0
- package/dist/hub/sharing-retention.js +83 -0
- package/dist/hub/sharing-retention.js.map +1 -0
- package/dist/hub/sharing-withdrawal.d.ts +14 -0
- package/dist/hub/sharing-withdrawal.js +28 -0
- package/dist/hub/sharing-withdrawal.js.map +1 -0
- package/dist/hub/sharing.js +2 -2
- package/dist/hub/sharing.js.map +1 -1
- package/dist/hub/socket.d.ts +1 -0
- package/dist/hub/socket.js +39 -2
- package/dist/hub/socket.js.map +1 -1
- package/dist/hub/teams/index.d.ts +8 -3
- package/dist/hub/teams/index.js +106 -31
- package/dist/hub/teams/index.js.map +1 -1
- package/dist/hub/teams/store.d.ts +5 -1
- package/dist/hub/teams/store.js +25 -2
- package/dist/hub/teams/store.js.map +1 -1
- package/dist/hub/teams/types.d.ts +19 -2
- package/dist/hub/types.d.ts +173 -5
- package/dist/hub-classic-private.d.ts +19 -0
- package/dist/hub-classic-private.js +64 -0
- package/dist/hub-classic-private.js.map +1 -0
- package/dist/hub-contact-windows.d.ts +11 -0
- package/dist/hub-contact-windows.js +56 -0
- package/dist/hub-contact-windows.js.map +1 -0
- package/dist/hub-page-sharing-settings.d.ts +6 -0
- package/dist/hub-page-sharing-settings.js +19 -0
- package/dist/hub-page-sharing-settings.js.map +1 -0
- package/dist/hub-pairing-summary.d.ts +1 -1
- package/dist/hub-picture-reduce.d.ts +14 -0
- package/dist/hub-picture-reduce.js +49 -0
- package/dist/hub-picture-reduce.js.map +1 -0
- package/dist/hub-picture-worker.d.ts +1 -0
- package/dist/hub-picture-worker.js +11 -0
- package/dist/hub-picture-worker.js.map +1 -0
- package/dist/hub-report-target.d.ts +6 -0
- package/dist/hub-report-target.js +6 -0
- package/dist/hub-report-target.js.map +1 -1
- package/dist/hub-room-conversation.d.ts +14 -0
- package/dist/hub-room-conversation.js +60 -0
- package/dist/hub-room-conversation.js.map +1 -0
- package/dist/hub-room-reply-warning.d.ts +2 -0
- package/dist/hub-room-reply-warning.js +16 -0
- package/dist/hub-room-reply-warning.js.map +1 -0
- package/dist/hub-sharing-notice.d.ts +43 -0
- package/dist/hub-sharing-notice.js +34 -0
- package/dist/hub-sharing-notice.js.map +1 -0
- package/dist/hub-update-notice.d.ts +12 -0
- package/dist/hub-update-notice.js +35 -0
- package/dist/hub-update-notice.js.map +1 -0
- package/dist/human-delivery-receipts.js +8 -0
- package/dist/human-delivery-receipts.js.map +1 -1
- package/dist/instance-config-impact.js +5 -2
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +21 -1
- package/dist/instance-lifecycle.js +55 -14
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instruction-file-sizes.d.ts +46 -0
- package/dist/instruction-file-sizes.js +115 -0
- package/dist/instruction-file-sizes.js.map +1 -0
- package/dist/instructions.d.ts +35 -1
- package/dist/instructions.js +63 -33
- package/dist/instructions.js.map +1 -1
- package/dist/locale.d.ts +2 -0
- package/dist/locale.js +373 -34
- package/dist/locale.js.map +1 -1
- package/dist/log-steps.d.ts +5 -0
- package/dist/log-steps.js +6 -2
- package/dist/log-steps.js.map +1 -1
- package/dist/login-controller.d.ts +45 -2
- package/dist/login-controller.js +98 -10
- package/dist/login-controller.js.map +1 -1
- package/dist/login-flows.js +1 -1
- package/dist/login-flows.js.map +1 -1
- package/dist/memory-guidance.d.ts +5 -0
- package/dist/memory-guidance.js +14 -0
- package/dist/memory-guidance.js.map +1 -0
- package/dist/model-defaults.d.ts +5 -0
- package/dist/model-defaults.js +6 -0
- package/dist/model-defaults.js.map +1 -0
- package/dist/native-mcp.d.ts +2 -0
- package/dist/native-mcp.js +23 -11
- package/dist/native-mcp.js.map +1 -1
- package/dist/native-model-catalog.d.ts +15 -0
- package/dist/native-model-catalog.js +43 -3
- package/dist/native-model-catalog.js.map +1 -1
- package/dist/native-pane-lifecycle.js +3 -2
- package/dist/native-pane-lifecycle.js.map +1 -1
- package/dist/native-pane-tools.js +3 -0
- package/dist/native-pane-tools.js.map +1 -1
- package/dist/needs-you-hub.d.ts +4 -0
- package/dist/needs-you-hub.js +17 -2
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +40 -2
- package/dist/needs-you.js +18 -0
- package/dist/needs-you.js.map +1 -1
- package/dist/office-share-page.js +4 -4
- package/dist/office-share-page.js.map +1 -1
- package/dist/outbound-handlers.d.ts +28 -4
- package/dist/outbound-handlers.js +150 -13
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +32 -0
- package/dist/outbound-schemas.js +44 -25
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/pane-port.d.ts +2 -0
- package/dist/pause-marker.d.ts +1 -1
- package/dist/pause-marker.js +1 -1
- package/dist/pause-marker.js.map +1 -1
- package/dist/profile-signins.d.ts +1 -0
- package/dist/profile-signins.js +3 -1
- package/dist/profile-signins.js.map +1 -1
- package/dist/public-web-gateway.d.ts +20 -0
- package/dist/public-web-gateway.js +232 -9
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/public-web-link.d.ts +21 -2
- package/dist/public-web-link.js +22 -2
- package/dist/public-web-link.js.map +1 -1
- package/dist/queued-handoffs.d.ts +16 -4
- package/dist/queued-handoffs.js +18 -1
- package/dist/queued-handoffs.js.map +1 -1
- package/dist/quickstart-api.d.ts +0 -1
- package/dist/quickstart-api.js +8 -1
- package/dist/quickstart-api.js.map +1 -1
- package/dist/quickstart.d.ts +1 -1
- package/dist/quickstart.js +2 -3
- package/dist/quickstart.js.map +1 -1
- package/dist/remote-card-answer.d.ts +1 -1
- package/dist/remote-card-answer.js +8 -1
- package/dist/remote-card-answer.js.map +1 -1
- package/dist/remote-card-prompt.d.ts +1 -0
- package/dist/remote-card-prompt.js +2 -2
- package/dist/remote-card-prompt.js.map +1 -1
- package/dist/reply-dedup.js +3 -1
- package/dist/reply-dedup.js.map +1 -1
- package/dist/reply-preview-files.d.ts +38 -0
- package/dist/reply-preview-files.js +142 -0
- package/dist/reply-preview-files.js.map +1 -0
- package/dist/reply-preview-spec.d.ts +18 -0
- package/dist/reply-preview-spec.js +27 -0
- package/dist/reply-preview-spec.js.map +1 -0
- package/dist/restart-progress.d.ts +6 -0
- package/dist/restart-progress.js +5 -0
- package/dist/restart-progress.js.map +1 -1
- package/dist/runtime-api.js +10 -2
- package/dist/runtime-api.js.map +1 -1
- package/dist/runtime-build-info.js +2 -1
- package/dist/runtime-build-info.js.map +1 -1
- package/dist/runtime-cli-install.js +18 -14
- package/dist/runtime-cli-install.js.map +1 -1
- package/dist/runtime-cli.js +31 -5
- package/dist/runtime-cli.js.map +1 -1
- package/dist/runtime-client-store.d.ts +5 -0
- package/dist/runtime-client-store.js +28 -0
- package/dist/runtime-client-store.js.map +1 -1
- package/dist/runtime-client.d.ts +4 -0
- package/dist/runtime-client.js +33 -10
- package/dist/runtime-client.js.map +1 -1
- package/dist/runtime-coordinator.d.ts +4 -2
- package/dist/runtime-coordinator.js +33 -6
- package/dist/runtime-coordinator.js.map +1 -1
- package/dist/runtime-install.d.ts +6 -1
- package/dist/runtime-install.js +12 -4
- package/dist/runtime-install.js.map +1 -1
- package/dist/runtime-pane-mcp.js +7 -3
- package/dist/runtime-pane-mcp.js.map +1 -1
- package/dist/runtime-pane-native.js +5 -2
- package/dist/runtime-pane-native.js.map +1 -1
- package/dist/runtime-personal-answer-only-probe.d.ts +3 -0
- package/dist/runtime-personal-answer-only-probe.js +134 -0
- package/dist/runtime-personal-answer-only-probe.js.map +1 -0
- package/dist/runtime-personal-answer-only.d.ts +16 -0
- package/dist/runtime-personal-answer-only.js +54 -0
- package/dist/runtime-personal-answer-only.js.map +1 -0
- package/dist/runtime-personal-answer.d.ts +30 -0
- package/dist/runtime-personal-answer.js +124 -0
- package/dist/runtime-personal-answer.js.map +1 -0
- package/dist/runtime-personal-preflight.d.ts +8 -0
- package/dist/runtime-personal-preflight.js +103 -0
- package/dist/runtime-personal-preflight.js.map +1 -0
- package/dist/runtime-personal-profile.d.ts +40 -0
- package/dist/runtime-personal-profile.js +81 -0
- package/dist/runtime-personal-profile.js.map +1 -0
- package/dist/runtime-personal-protocol.d.ts +10 -0
- package/dist/runtime-personal-protocol.js +15 -0
- package/dist/runtime-personal-protocol.js.map +1 -0
- package/dist/runtime-personal-stage.d.ts +37 -0
- package/dist/runtime-personal-stage.js +167 -0
- package/dist/runtime-personal-stage.js.map +1 -0
- package/dist/runtime-protocol.d.ts +2 -0
- package/dist/scheduler/db.js +2 -0
- package/dist/scheduler/db.js.map +1 -1
- package/dist/scheduler/task-board-mentions.d.ts +32 -0
- package/dist/scheduler/task-board-mentions.js +97 -0
- package/dist/scheduler/task-board-mentions.js.map +1 -0
- package/dist/scheduler/task-board-text.js +3 -0
- package/dist/scheduler/task-board-text.js.map +1 -1
- package/dist/scheduler/task-board.d.ts +199 -3
- package/dist/scheduler/task-board.js +492 -7
- package/dist/scheduler/task-board.js.map +1 -1
- package/dist/settings-api.d.ts +36 -1
- package/dist/settings-api.js +525 -96
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-baseline.d.ts +4 -0
- package/dist/settings-baseline.js +7 -5
- package/dist/settings-baseline.js.map +1 -1
- package/dist/settings-change.js +47 -7
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.d.ts +7 -0
- package/dist/settings-effect.js +80 -5
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.js +18 -44
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/settings-instance-patch.js +3 -1
- package/dist/settings-instance-patch.js.map +1 -1
- package/dist/setup-form.js +10 -0
- package/dist/setup-form.js.map +1 -1
- package/dist/setup-host.d.ts +2 -3
- package/dist/setup-host.js +3 -5
- package/dist/setup-host.js.map +1 -1
- package/dist/setup-i18n.js +2 -2
- package/dist/setup-i18n.js.map +1 -1
- package/dist/setup-wizard.js +0 -2
- package/dist/setup-wizard.js.map +1 -1
- package/dist/shared-default-adoption.d.ts +24 -0
- package/dist/shared-default-adoption.js +73 -0
- package/dist/shared-default-adoption.js.map +1 -0
- package/dist/subagent-records.d.ts +2 -0
- package/dist/subagent-records.js +64 -12
- package/dist/subagent-records.js.map +1 -1
- package/dist/subagent-service.d.ts +3 -0
- package/dist/subagent-service.js +27 -5
- package/dist/subagent-service.js.map +1 -1
- package/dist/task-board-tool.d.ts +48 -0
- package/dist/task-board-tool.js +89 -6
- package/dist/task-board-tool.js.map +1 -1
- package/dist/task-board-waker.d.ts +23 -30
- package/dist/task-board-waker.js +136 -97
- package/dist/task-board-waker.js.map +1 -1
- package/dist/tmux-manager.d.ts +2 -0
- package/dist/tmux-manager.js +2 -0
- package/dist/tmux-manager.js.map +1 -1
- package/dist/tool-permissions.js +5 -2
- package/dist/tool-permissions.js.map +1 -1
- package/dist/tool-progress.d.ts +9 -0
- package/dist/tool-progress.js +141 -32
- package/dist/tool-progress.js.map +1 -1
- package/dist/topic-commands.d.ts +7 -1
- package/dist/topic-commands.js +103 -91
- package/dist/topic-commands.js.map +1 -1
- package/dist/transcript-monitor.d.ts +1 -0
- package/dist/transcript-monitor.js +18 -0
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/tunnel/lease.d.ts +14 -0
- package/dist/tunnel/lease.js +23 -0
- package/dist/tunnel/lease.js.map +1 -1
- package/dist/turn-reply-guard.d.ts +2 -2
- package/dist/turn-reply-guard.js +3 -3
- package/dist/turn-reply-guard.js.map +1 -1
- package/dist/types.d.ts +37 -2
- package/dist/ui/accounts-keepalive.js +2 -1
- package/dist/ui/accounts-view.js +18 -9
- package/dist/ui/agent-details-settings.js +9 -7
- package/dist/ui/agent-export-dialog.js +4 -3
- package/dist/ui/agent-export-strings.js +4 -4
- package/dist/ui/agent-page-strings.js +18 -0
- package/dist/ui/backend-signin.js +94 -23
- package/dist/ui/chat-activity-groups.js +42 -9
- package/dist/ui/chat-activity.js +22 -3
- package/dist/ui/chat-commands.js +2 -0
- package/dist/ui/chat-mentions.js +13 -0
- package/dist/ui/chat-msg-actions.js +3 -222
- package/dist/ui/chat-pins.js +106 -0
- package/dist/ui/chat-popout-header.js +2 -2
- package/dist/ui/chat-popout-transport.js +49 -19
- package/dist/ui/chat-popout.js +15 -1
- package/dist/ui/chat-quote.js +3 -261
- package/dist/ui/chat-store.js +178 -16
- package/dist/ui/chat-task-ref-strings.js +24 -0
- package/dist/ui/chat-task-refs.js +131 -0
- package/dist/ui/chat-tour.js +1 -1
- package/dist/ui/chat-workspace.js +3 -3
- package/dist/ui/claude-credentials.js +123 -0
- package/dist/ui/claude-setup-token.js +36 -0
- package/dist/ui/contact-auth-client.js +55 -0
- package/dist/ui/contact-auth-strings.js +256 -0
- package/dist/ui/contact-authorizations.js +139 -0
- package/dist/ui/contact-grant-editor.js +50 -0
- package/dist/ui/contact-needs.js +100 -0
- package/dist/ui/contact-permissions.js +251 -0
- package/dist/ui/contact-ticket-badge.js +54 -0
- package/dist/ui/contact-tool-groups.js +39 -0
- package/dist/ui/fleet-canvas.js +20 -7
- package/dist/ui/fleet-office-card.js +446 -41
- package/dist/ui/fleet-office-carousel.d.ts +14 -0
- package/dist/ui/fleet-office-carousel.js +95 -0
- package/dist/ui/fleet-office-dialogue.d.ts +6 -3
- package/dist/ui/fleet-office-dialogue.js +16 -6
- package/dist/ui/fleet-office-editor.js +6 -1
- package/dist/ui/fleet-office-layout.js +13 -13
- package/dist/ui/fleet-office-model.js +5 -3
- package/dist/ui/fleet-office-overview.js +1 -1
- package/dist/ui/fleet-office-pack.d.ts +81 -4
- package/dist/ui/fleet-office-pack.js +514 -48
- package/dist/ui/fleet-office-play.js +498 -0
- package/dist/ui/fleet-office-skin.js +268 -38
- package/dist/ui/fleet-office-store.js +88 -3
- package/dist/ui/fleet-office-talk.js +423 -0
- package/dist/ui/fleet-office-view.js +26 -17
- package/dist/ui/fleet-office-zones.js +151 -38
- package/dist/ui/fleet-office.js +1147 -155
- package/dist/ui/fleet-route.js +44 -6
- package/dist/ui/fleet-task-activity.js +362 -0
- package/dist/ui/fleet-task-card.js +317 -314
- package/dist/ui/fleet-task-common.js +100 -10
- package/dist/ui/fleet-task-create.js +67 -0
- package/dist/ui/fleet-task-edit.js +204 -0
- package/dist/ui/fleet-task-follow.js +123 -0
- package/dist/ui/fleet-task-menu.js +1 -1
- package/dist/ui/fleet-task-owner.js +252 -0
- package/dist/ui/fleet-task-run.js +257 -0
- package/dist/ui/fleet-task-sort.js +88 -0
- package/dist/ui/fleet-task-view.js +209 -40
- package/dist/ui/fleet-task-work.js +2 -2
- package/dist/ui/fleet-tasks.js +294 -134
- package/dist/ui/host-alerts.js +23 -0
- package/dist/ui/host-footprint.js +17 -0
- package/dist/ui/host-health-model.js +42 -0
- package/dist/ui/host-health.js +82 -0
- package/dist/ui/host-install.js +87 -7
- package/dist/ui/host-monitoring-darwin.js +6 -0
- package/dist/ui/host-monitoring-help.js +7 -0
- package/dist/ui/host-monitoring-linux.js +6 -0
- package/dist/ui/host-monitoring-wsl.js +6 -0
- package/dist/ui/host-time.js +5 -0
- package/dist/ui/hub-admin-overview.js +189 -0
- package/dist/ui/hub-admin-rooms.js +1 -1
- package/dist/ui/hub-agent-copy.js +8 -2
- package/dist/ui/hub-agent-intro.js +35 -0
- package/dist/ui/hub-ai-apps-strings.js +6 -0
- package/dist/ui/hub-ai-apps.js +84 -0
- package/dist/ui/hub-attachments.js +81 -3
- package/dist/ui/hub-chat-store.js +4 -3
- package/dist/ui/hub-chat-strings.js +13 -3
- package/dist/ui/hub-client.js +123 -12
- package/dist/ui/hub-directory-editor-strings.js +2 -2
- package/dist/ui/hub-directory-editor.js +1 -0
- package/dist/ui/hub-fleet-versions.js +393 -0
- package/dist/ui/hub-grant-picker.js +28 -47
- package/dist/ui/hub-group-policy.js +26 -13
- package/dist/ui/hub-group-strings.js +28 -18
- package/dist/ui/hub-intro-notice.js +16 -0
- package/dist/ui/hub-invitations.js +5 -1
- package/dist/ui/hub-join-steps.js +27 -15
- package/dist/ui/hub-my-agents-model.js +42 -0
- package/dist/ui/hub-my-agents-strings.js +20 -0
- package/dist/ui/hub-my-agents.js +169 -0
- package/dist/ui/hub-owner-strings.js +9 -8
- package/dist/ui/hub-personal-agent-strings.js +246 -0
- package/dist/ui/hub-personal-agent.js +119 -0
- package/dist/ui/hub-policy-subjects.js +35 -0
- package/dist/ui/hub-quick-pairing.js +7 -2
- package/dist/ui/hub-quota.js +2 -1
- package/dist/ui/hub-role-audit.js +39 -0
- package/dist/ui/hub-role-forms.js +99 -0
- package/dist/ui/hub-role-notices.js +11 -0
- package/dist/ui/hub-role-view.js +86 -0
- package/dist/ui/hub-roles-strings.js +440 -0
- package/dist/ui/hub-roles.js +83 -0
- package/dist/ui/hub-room-agent-strings.js +28 -0
- package/dist/ui/hub-room-composer.js +183 -20
- package/dist/ui/hub-room-list.js +6 -4
- package/dist/ui/hub-room-members-strings.js +11 -4
- package/dist/ui/hub-room-members.js +132 -18
- package/dist/ui/hub-room-new-strings.js +2 -1
- package/dist/ui/hub-room-new.js +17 -7
- package/dist/ui/hub-room-notify.js +161 -0
- package/dist/ui/hub-room-office.js +203 -0
- package/dist/ui/hub-room-owner-requests-strings.js +114 -0
- package/dist/ui/hub-room-owner-requests.js +264 -0
- package/dist/ui/hub-room-pins.js +43 -0
- package/dist/ui/hub-room-presence.js +14 -2
- package/dist/ui/hub-room-purpose.js +35 -0
- package/dist/ui/hub-room-search.js +126 -0
- package/dist/ui/hub-room-settings.js +79 -4
- package/dist/ui/hub-room-source-strings.js +17 -0
- package/dist/ui/hub-room-source.js +37 -0
- package/dist/ui/hub-room-strings.js +102 -7
- package/dist/ui/hub-room-thread.js +510 -65
- package/dist/ui/hub-room-unread.js +2 -1
- package/dist/ui/hub-room-working.js +37 -0
- package/dist/ui/hub-session-limits.js +79 -0
- package/dist/ui/hub-strings.js +19 -10
- package/dist/ui/hub-subject-picker.js +58 -0
- package/dist/ui/hub-switcher.js +2 -2
- package/dist/ui/hub-teams-strings.js +10 -6
- package/dist/ui/hub-teams.js +58 -29
- package/dist/ui/hub-this-hub.js +2 -2
- package/dist/ui/hub-welcome.js +122 -75
- package/dist/ui/image-annotate.js +2 -283
- package/dist/ui/image-lightbox.js +2 -176
- package/dist/ui/image-zoom.js +2 -242
- package/dist/ui/log-row.js +7 -5
- package/dist/ui/model-picker.js +7 -3
- package/dist/ui/native-instance-settings.js +4 -2
- package/dist/ui/notice-hub-sharing.js +81 -0
- package/dist/ui/notice-hub-update.js +94 -0
- package/dist/ui/office-share-dialog.js +2 -2
- package/dist/ui/office-share-page.js +5 -1
- package/dist/ui/panel-chat.js +578 -78
- package/dist/ui/panel-details.js +22 -1
- package/dist/ui/panel-fleet.js +49 -14
- package/dist/ui/panel-hub.js +459 -129
- package/dist/ui/panel-log.js +4 -4
- package/dist/ui/panel-needs.js +78 -24
- package/dist/ui/panel-notices.js +4 -1
- package/dist/ui/panel-runtimes.js +2 -1
- package/dist/ui/panel-settings.js +111 -51
- package/dist/ui/preview-panel.js +3 -1
- package/dist/ui/preview-popout.js +134 -0
- package/dist/ui/reply-file-preview.js +65 -0
- package/dist/ui/runtime-commands.d.ts +2 -2
- package/dist/ui/runtime-commands.js +7 -4
- package/dist/ui/search-dialog.js +8 -1
- package/dist/ui/settings-access-overview.js +5 -4
- package/dist/ui/settings-appearance.js +13 -11
- package/dist/ui/settings-apply.js +8 -3
- package/dist/ui/settings-archive-files.js +109 -0
- package/dist/ui/settings-build-version.js +2 -2
- package/dist/ui/settings-capabilities.js +2 -0
- package/dist/ui/settings-catalog.js +22 -0
- package/dist/ui/settings-connector-strings.js +23 -0
- package/dist/ui/settings-connector.js +40 -0
- package/dist/ui/settings-default-model-scope.js +40 -0
- package/dist/ui/settings-default-model-strings.js +43 -0
- package/dist/ui/settings-dialogs.js +9 -5
- package/dist/ui/settings-guests-entries.js +16 -0
- package/dist/ui/settings-guests.js +57 -15
- package/dist/ui/settings-host-alerts.js +23 -0
- package/dist/ui/settings-host-monitoring.js +71 -0
- package/dist/ui/settings-hub-connection.js +6 -7
- package/dist/ui/settings-hub-membership.js +6 -7
- package/dist/ui/settings-hub-page-sharing.js +52 -0
- package/dist/ui/settings-hub-section.js +2 -4
- package/dist/ui/settings-hub-setup.js +2 -1
- package/dist/ui/settings-hub-updates.js +67 -0
- package/dist/ui/settings-hub.js +35 -7
- package/dist/ui/settings-layout.js +17 -14
- package/dist/ui/settings-model.js +9 -5
- package/dist/ui/settings-quota-notice.js +3 -3
- package/dist/ui/settings-registry.js +27 -5
- package/dist/ui/settings-shared-strings.js +24 -0
- package/dist/ui/settings-shared.js +62 -14
- package/dist/ui/settings-strings.js +15 -6
- package/dist/ui/settings-update.js +11 -5
- package/dist/ui/settings-web-authority.js +7 -5
- package/dist/ui/shared/access-overview.css +1 -1
- package/dist/ui/shared/accounts-keepalive.css +1 -1
- package/dist/ui/shared/accounts.css +9 -5
- package/dist/ui/shared/agent-sheet.js +120 -0
- package/dist/ui/shared/agent-widget.js +1 -2
- package/dist/ui/shared/app-i18n.js +10 -2
- package/dist/ui/shared/app-nav.js +9 -5
- package/dist/ui/shared/app-prefs.js +9 -3
- package/dist/ui/shared/app-route.js +5 -3
- package/dist/ui/shared/app-shell.js +202 -34
- package/dist/ui/shared/app-store.js +7 -3
- package/dist/ui/shared/app-stream.js +8 -2
- package/dist/ui/shared/app-swipe.js +3 -1
- package/dist/ui/shared/app-themes.js +3 -5
- package/dist/ui/shared/app-update.js +90 -8
- package/dist/ui/shared/app.css +1089 -262
- package/dist/ui/shared/app.js +12 -3
- package/dist/ui/shared/asset-url.d.ts +2 -0
- package/dist/ui/shared/asset-url.js +20 -0
- package/dist/ui/shared/chat-composer.js +36 -11
- package/dist/ui/shared/chat-msg-actions.js +233 -0
- package/dist/ui/shared/chat-quote.js +285 -0
- package/dist/ui/shared/chat-render.js +63 -10
- package/dist/ui/shared/chat-strings.js +32 -11
- package/dist/ui/shared/chat-table-select.js +175 -0
- package/dist/ui/shared/chat-thread.js +175 -29
- package/dist/ui/shared/chat-work-bar.css +118 -0
- package/dist/ui/shared/composer-focus.js +21 -0
- package/dist/ui/shared/connector-prompt.d.ts +3 -0
- package/dist/ui/shared/connector-prompt.js +20 -0
- package/dist/ui/shared/hub-ai-apps.css +12 -0
- package/dist/ui/shared/hub-chat.css +117 -4
- package/dist/ui/shared/hub-groups.css +19 -15
- package/dist/ui/shared/hub-my-agents.css +41 -0
- package/dist/ui/shared/hub-owner.css +123 -3
- package/dist/ui/shared/hub-roles.css +99 -0
- package/dist/ui/shared/hub-rooms-u2.css +98 -0
- package/dist/ui/shared/hub.css +23 -5
- package/dist/ui/shared/image-annotate.css +22 -3
- package/dist/ui/shared/image-annotate.js +416 -0
- package/dist/ui/shared/image-lightbox.js +218 -0
- package/dist/ui/shared/image-zoom.js +316 -0
- package/dist/ui/shared/info-tip.js +64 -0
- package/dist/ui/shared/instance-nav.js +166 -19
- package/dist/ui/shared/jump-idle.js +36 -0
- package/dist/ui/shared/loading.css +1 -1
- package/dist/ui/shared/model-picker.css +32 -4
- package/dist/ui/shared/module-warm.d.ts +3 -0
- package/dist/ui/shared/module-warm.js +39 -0
- package/dist/ui/shared/office-dialogue.css +122 -0
- package/dist/ui/shared/owner-css.js +1 -1
- package/dist/ui/shared/panel-view.js +7 -1
- package/dist/ui/shared/preview-panel-actions.js +1 -1
- package/dist/ui/shared/preview-panel.js +50 -20
- package/dist/ui/shared/preview-popout.css +11 -0
- package/dist/ui/shared/reply-previews.css +4 -0
- package/dist/ui/shared/runtime-install.css +5 -0
- package/dist/ui/shared/settings-connector.css +7 -0
- package/dist/ui/shared/signin.js +27 -12
- package/dist/ui/shared/task-board.css +505 -11
- package/dist/ui/shared/text-undo.js +17 -3
- package/dist/ui/shared/theme-picker.js +46 -0
- package/dist/ui/shared/theme.js +101 -2
- package/dist/ui/shared/tokens.css +300 -10
- package/dist/ui/shared/ui-confirm.js +5 -2
- package/dist/ui/shared/ui-icons.js +2 -0
- package/dist/ui/shared/ui-menu.js +17 -11
- package/dist/ui/shared/ui-states.js +3 -2
- package/dist/ui/shared/ui-toast.js +4 -4
- package/dist/ui/shared/usage-dialog.js +88 -17
- package/dist/ui/shared/view-history.js +2 -1
- package/dist/ui/shared/view-strings.js +28 -4
- package/dist/ui/shared/web-authorize.js +3 -3
- package/dist/ui/signin.html +4 -2
- package/dist/ui/structured-signin.js +64 -12
- package/dist/ui/subagent-row.js +3 -2
- package/dist/ui/trigger-complete.js +71 -0
- package/dist/ui/usage-pool.js +2 -1
- package/dist/ui/web-terminal/terminal.css +1 -1
- package/dist/ui/workspace-panel.js +6 -4
- package/dist/update-dispatch.d.ts +8 -1
- package/dist/update-dispatch.js +16 -1
- package/dist/update-dispatch.js.map +1 -1
- package/dist/update-idle.d.ts +65 -0
- package/dist/update-idle.js +190 -0
- package/dist/update-idle.js.map +1 -0
- package/dist/update-launch.d.ts +1 -1
- package/dist/update-launch.js +9 -2
- package/dist/update-launch.js.map +1 -1
- package/dist/usage/i18n-keys.d.ts +1 -1
- package/dist/usage/i18n-keys.js +2 -2
- package/dist/usage/i18n-keys.js.map +1 -1
- package/dist/usage/profile-timeline.d.ts +2 -0
- package/dist/usage/profile-timeline.js +4 -0
- package/dist/usage/profile-timeline.js.map +1 -1
- package/dist/usage/providers.d.ts +1 -0
- package/dist/usage/providers.js +20 -7
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/quota-history.d.ts +1 -1
- package/dist/usage/usage-api.js +5 -2
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/view-api.js +1 -1
- package/dist/view-api.js.map +1 -1
- package/dist/wake-coordinator.js +3 -2
- package/dist/wake-coordinator.js.map +1 -1
- package/dist/web-api.d.ts +62 -6
- package/dist/web-api.js +1050 -212
- package/dist/web-api.js.map +1 -1
- package/dist/web-asset-version.d.ts +65 -0
- package/dist/web-asset-version.js +259 -0
- package/dist/web-asset-version.js.map +1 -0
- package/dist/web-backend-login.d.ts +5 -1
- package/dist/web-backend-login.js +8 -2
- package/dist/web-backend-login.js.map +1 -1
- package/dist/web-chat-archive.d.ts +147 -0
- package/dist/web-chat-archive.js +530 -0
- package/dist/web-chat-archive.js.map +1 -0
- package/dist/web-chat-history.d.ts +128 -2
- package/dist/web-chat-history.js +320 -12
- package/dist/web-chat-history.js.map +1 -1
- package/dist/web-claude-credentials.d.ts +31 -0
- package/dist/web-claude-credentials.js +138 -0
- package/dist/web-claude-credentials.js.map +1 -0
- package/dist/web-commands.d.ts +9 -5
- package/dist/web-commands.js +7 -4
- package/dist/web-commands.js.map +1 -1
- package/dist/web-guest-access.d.ts +3 -0
- package/dist/web-guest-access.js +8 -4
- package/dist/web-guest-access.js.map +1 -1
- package/dist/web-host-guard.js +3 -1
- package/dist/web-host-guard.js.map +1 -1
- package/dist/web-host-install.d.ts +30 -3
- package/dist/web-host-install.js +50 -4
- package/dist/web-host-install.js.map +1 -1
- package/dist/web-icons.js +3 -3
- package/dist/web-icons.js.map +1 -1
- package/dist/web-login.d.ts +7 -0
- package/dist/web-login.js +8 -1
- package/dist/web-login.js.map +1 -1
- package/dist/web-mentions.d.ts +2 -0
- package/dist/web-mentions.js +20 -0
- package/dist/web-mentions.js.map +1 -1
- package/dist/web-notices.d.ts +20 -0
- package/dist/web-notices.js +64 -8
- package/dist/web-notices.js.map +1 -1
- package/dist/web-office-skins.d.ts +14 -3
- package/dist/web-office-skins.js +66 -21
- package/dist/web-office-skins.js.map +1 -1
- package/dist/web-office-store.d.ts +2 -0
- package/dist/web-office-store.js +20 -6
- package/dist/web-office-store.js.map +1 -1
- package/dist/web-pin-store.d.ts +58 -0
- package/dist/web-pin-store.js +170 -0
- package/dist/web-pin-store.js.map +1 -0
- package/dist/web-prefs.js +5 -1
- package/dist/web-prefs.js.map +1 -1
- package/dist/web-reply-files.d.ts +1 -0
- package/dist/web-reply-files.js +2 -0
- package/dist/web-reply-files.js.map +1 -1
- package/dist/web-session-authorization.d.ts +24 -0
- package/dist/web-session-authorization.js +32 -0
- package/dist/web-session-authorization.js.map +1 -1
- package/dist/web-session.d.ts +26 -5
- package/dist/web-session.js +32 -3
- package/dist/web-session.js.map +1 -1
- package/dist/web-settings-patch.d.ts +24 -3
- package/dist/web-settings-patch.js +57 -1
- package/dist/web-settings-patch.js.map +1 -1
- package/dist/web-shell-routes.d.ts +2 -2
- package/dist/web-shell-routes.js +3 -2
- package/dist/web-shell-routes.js.map +1 -1
- package/dist/web-terminal.d.ts +9 -0
- package/dist/web-terminal.js +27 -1
- package/dist/web-terminal.js.map +1 -1
- package/dist/web-theme.js +2 -2
- package/dist/web-update.d.ts +15 -1
- package/dist/web-upload.d.ts +37 -1
- package/dist/web-upload.js +105 -5
- package/dist/web-upload.js.map +1 -1
- package/dist/windows-cli-api.d.ts +10 -7
- package/dist/windows-cli-api.js +13 -12
- package/dist/windows-cli-api.js.map +1 -1
- package/dist/windows-cli-worker.d.ts +10 -0
- package/dist/windows-cli-worker.js +109 -14
- package/dist/windows-cli-worker.js.map +1 -1
- package/dist/windows-cli.d.ts +10 -1
- package/dist/windows-cli.js +47 -13
- package/dist/windows-cli.js.map +1 -1
- package/dist/windows-native-mcp.js +5 -2
- package/dist/windows-native-mcp.js.map +1 -1
- package/dist/workflow-templates/default.md +4 -6
- package/launcher/agend-install.cjs +48 -7
- package/package.json +1 -1
- package/templates/runtime-install/install.ps1 +24 -4
package/dist/web-api.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { historyQuery } from './host-monitoring-history-policy.js';
|
|
2
|
+
import { instructionFileSizes } from "./instruction-file-sizes.js";
|
|
3
|
+
import { handleClaudeCredentials } from "./web-claude-credentials.js";
|
|
4
|
+
import { pipeline } from "node:stream/promises";
|
|
5
|
+
import { handleContactAuthorizationApi } from "./contact-auth-api.js";
|
|
1
6
|
import { buildAgentExport, parseAgentExport } from "./agent-export.js";
|
|
2
7
|
import { STRUCTURED_PROFILE_BACKENDS } from "./structured-signin-transport.js";
|
|
3
8
|
import { hubModeOf, hubNameOf } from "./hub-mode.js";
|
|
@@ -20,6 +25,7 @@ import { buildModBundle } from "./web-mod-export.js";
|
|
|
20
25
|
import { AGENT_WIDGET_SLOTS, checkWidgetData, checkWidgetSpec } from "./web-widget.js";
|
|
21
26
|
import { checkOwnerCss, ownerCssAssetRefs } from "./web-owner-css.js";
|
|
22
27
|
import { canonicalText } from "./web-theme.js";
|
|
28
|
+
import { parsePinKey } from "./web-pin-store.js";
|
|
23
29
|
import { SKIN_WIRE_BYTES } from "./web-office-skins.js";
|
|
24
30
|
import { gatewayRequestContext } from "./web-request-context.js";
|
|
25
31
|
import { crossInstanceVisibility } from "./cross-instance-notice.js";
|
|
@@ -38,14 +44,17 @@ import { MAX_COMMAND_ARGS } from "./web-commands.js";
|
|
|
38
44
|
import { ROUTE_WORKER_CSP, ROUTE_WORKER_PATH, sendPanelHtml } from "./web-host-guard.js";
|
|
39
45
|
import { libavoidFile } from "./web-libavoid.js";
|
|
40
46
|
import { shellRoute } from "./web-shell-routes.js";
|
|
41
|
-
import { createReadStream, createWriteStream, readFileSync } from "node:fs";
|
|
47
|
+
import { createReadStream, createWriteStream, existsSync, readFileSync, closeSync } from "node:fs";
|
|
48
|
+
import { servedAssets } from "./auth-api.js";
|
|
49
|
+
import { assetIntact, assetsUnchanged, assetVersion, assetVersionMark, answerStaleAsset, buildModuleGraph, staticClosure, versionShell, IMMUTABLE_PRIVATE } from "./web-asset-version.js";
|
|
42
50
|
import { join, dirname } from "node:path";
|
|
43
51
|
import { fileURLToPath } from "node:url";
|
|
44
52
|
import { createHash, createHmac, randomUUID } from "node:crypto";
|
|
45
53
|
import { CreateInstanceArgs, CreateScheduleArgs, UpdateScheduleArgs, validateArgs } from "./outbound-schemas.js";
|
|
46
54
|
import { scheduleView } from "./web-schedules.js";
|
|
47
55
|
import { DEFAULT_SCHEDULER_CONFIG } from "./scheduler/index.js";
|
|
48
|
-
import { CARD_PRIORITIES, CARD_SIZES, CARD_STATUSES, TaskBoardError } from "./scheduler/task-board.js";
|
|
56
|
+
import { CARD_PRIORITIES, CARD_SIZES, CARD_STATUSES, TaskBoardError, cardCode } from "./scheduler/task-board.js";
|
|
57
|
+
import { TASK_REF_SEPARATOR, cardsForRefs, taskReadWay, taskRefBlock, taskRefCodes, taskRefView } from "./chat-task-refs.js";
|
|
49
58
|
import { readStatuslineModel, resolveInstanceContext } from "./topic-commands.js";
|
|
50
59
|
import { z } from "zod";
|
|
51
60
|
import { ONBOARDING_BACKENDS } from "./backend-signin-pending.js";
|
|
@@ -58,6 +67,8 @@ import { PAGE_SHARE_LIMITS, htmlFences, htmlTitle } from "./page-share.js";
|
|
|
58
67
|
import { attachmentDelivery, createPartFile, displayName, fileTooLargeText, INLINE_MIME, isFileId, MEDIA_RANGE_MAX, publicAttachment, UPLOAD_LIMITS, UPLOAD_MAX_MS, UPLOAD_STALL_MS, UploadSniffer, uploadLimits, wellFormed } from "./web-upload.js";
|
|
59
68
|
import { getAgendHome } from "./paths.js";
|
|
60
69
|
import { workspaceChanges, workspaceFile, workspaceFileDiff, workspaceImage, workspaceList, workspaceRoot, WorkspaceError } from "./agent-workspace.js";
|
|
70
|
+
import { readReplyPreview, ReplyPreviewError } from "./reply-preview-files.js";
|
|
71
|
+
import { REMOTE_PREVIEW_REFUSAL } from "./reply-preview-spec.js";
|
|
61
72
|
import { resolveFollowSteps } from "./workspace-follow.js";
|
|
62
73
|
import { isGeneralInstance } from "./general-instance.js";
|
|
63
74
|
import { resolveToolSet } from "./tool-permissions.js";
|
|
@@ -80,7 +91,7 @@ import { handleNativeModelCatalog, refreshNativeModelCatalog } from "./native-mo
|
|
|
80
91
|
import { claudeDocumentedModels } from "./model-catalog-defaults.js";
|
|
81
92
|
import { shapeDocumentedClaudeModels, shapeWebModelCatalog } from "./web-model-groups.js";
|
|
82
93
|
import { handleRuntimeRequest } from "./runtime-api.js";
|
|
83
|
-
import { taskBoardOffNames } from "./dashboard-permissions.js";
|
|
94
|
+
import { taskBoardOffIn, taskBoardOffNames } from "./dashboard-permissions.js";
|
|
84
95
|
import { topicFields } from "./instance-topic-delete.js";
|
|
85
96
|
// ── Strict public-facing schemas ────────────────────────────────────────────
|
|
86
97
|
// web-api endpoints must reject unknown fields so the dashboard cannot inject
|
|
@@ -153,6 +164,11 @@ const CardMoveSchema = z.object({
|
|
|
153
164
|
comment: z.string().max(MAX_TEXT).optional(),
|
|
154
165
|
version: z.number().int().optional(),
|
|
155
166
|
}).strict();
|
|
167
|
+
/** Following a card (docs/design/task-board.md): instances to start and to stop watching it, in one write. */
|
|
168
|
+
const CardWatchersSchema = z.object({
|
|
169
|
+
add: z.array(z.string().min(1).max(256)).max(10).optional(),
|
|
170
|
+
remove: z.array(z.string().min(1).max(256)).max(10).optional(),
|
|
171
|
+
}).strict();
|
|
156
172
|
const CardReorderSchema = z.object({ after: CardRef.nullable().optional(), before: CardRef.nullable().optional() }).strict();
|
|
157
173
|
const ProjectCreateSchema = z.object({ name: z.string().max(256), description: z.string().max(BOARD_TEXT).optional(), leadInstance: z.string().max(256).nullable().optional() }).strict();
|
|
158
174
|
/** #2352: a project's lead must be one of the fleet's instances now (the board keeps any name, as for an assignee). */
|
|
@@ -212,11 +228,43 @@ const safeInstanceSegment = (name) => /^[^\\/\x00]+$/.test(name) && name !== "."
|
|
|
212
228
|
*/
|
|
213
229
|
/** #1920 phase 1b: the open streams that are a guest's, and whose — each event is projected for them (guestFrameData). */
|
|
214
230
|
const streamGuests = new WeakMap();
|
|
231
|
+
const streamContactProjection = new WeakMap();
|
|
232
|
+
function contactNeedsFor(req, url, ctx, base) {
|
|
233
|
+
const auth = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
234
|
+
const admin = auth.kind === 'allow' && auth.via === 'session' && auth.session.tier === 'admin';
|
|
235
|
+
base = admin ? base : base.filter(item => !item || typeof item !== 'object' || item.type !== 'host');
|
|
236
|
+
const ordinary = base.filter(item => !item || typeof item !== "object" || item.type !== "contact");
|
|
237
|
+
const actor = ctx.contactActor?.(req, url);
|
|
238
|
+
if (actor && ctx.contactNeeds)
|
|
239
|
+
return [...ordinary, ...ctx.contactNeeds(actor)];
|
|
240
|
+
const observer = ctx.contactSuggestionActor?.(req, url);
|
|
241
|
+
// A session identity may see benign room suggestions, never pending approval tickets.
|
|
242
|
+
const suggestions = observer && ctx.contactNeeds ? ctx.contactNeeds(observer).filter(item => item && typeof item === "object"
|
|
243
|
+
&& item.reason === "contact_restricted_suggestion") : [];
|
|
244
|
+
return [...ordinary, ...suggestions];
|
|
245
|
+
}
|
|
215
246
|
/**
|
|
216
247
|
* The task board's rule over the public link: an instance kept out of sight (cross_instance_visibility: hidden) is not
|
|
217
248
|
* shown, nor a card that names one as its assignee, creator or dispatcher. Off the link nothing is hidden. Read when
|
|
218
249
|
* asked: the fleet's config as it is now.
|
|
219
250
|
*/
|
|
251
|
+
/**
|
|
252
|
+
* M-3278 (decision 7933bf90): whether the public link's own data rules apply to this request — a request over the link that
|
|
253
|
+
* is not an admin's (a read-only session; guests have their own projections). An admin session sees what it would see on
|
|
254
|
+
* the dashboard reached directly.
|
|
255
|
+
*/
|
|
256
|
+
function linkRestricted(req, url, ctx) {
|
|
257
|
+
return !!gatewayRequestContext(req) && !adminAdmissionOf(req, url, ctx);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* M-3278: the usage report (and the Office level numbers) over the public link — an admin's unless
|
|
261
|
+
* `web.usage_report_on_public_link: false`; any other session there only when the owner opted in (`true`), as before
|
|
262
|
+
* (Fable on #4100, F2).
|
|
263
|
+
*/
|
|
264
|
+
function linkUsageOffered(req, url, ctx) {
|
|
265
|
+
const flag = ctx.fleetConfig?.web?.usage_report_on_public_link;
|
|
266
|
+
return linkRestricted(req, url, ctx) ? flag === true : flag !== false;
|
|
267
|
+
}
|
|
220
268
|
function boardHiding(ctx, gateway) {
|
|
221
269
|
const fleet = ctx.fleetConfig;
|
|
222
270
|
const hiddenName = (n) => gateway && typeof n === "string" && !!n && !!ctx.fleetConfig?.instances?.[n] && crossInstanceVisibility(fleet, n) === "hidden";
|
|
@@ -311,7 +359,10 @@ export function broadcastSseEvent(clients, event, data, onError, id) {
|
|
|
311
359
|
client.write(sseFrame(event, shown));
|
|
312
360
|
continue;
|
|
313
361
|
}
|
|
314
|
-
|
|
362
|
+
const project = streamContactProjection.get(client);
|
|
363
|
+
const shown = project ? project(event, data) : data;
|
|
364
|
+
if (shown !== undefined)
|
|
365
|
+
client.write(shown === data ? payload : sseFrame(event, shown, id));
|
|
315
366
|
}
|
|
316
367
|
catch (err) {
|
|
317
368
|
dead.push(client);
|
|
@@ -377,6 +428,35 @@ function webCatalog(ctx, backend, instance, profile, plain) {
|
|
|
377
428
|
const flat = plain ?? (profile !== null ? ctx.modelCatalogFor?.(backend, instance, { profile }) : ctx.modelCatalogFor?.(backend, instance)) ?? [];
|
|
378
429
|
return shapeWebModelCatalog(backend, flat);
|
|
379
430
|
}
|
|
431
|
+
/** GET /ui/models' answer: the cached catalog of this instance/account, else the CLI's own cache, else (claude) the documented ids. */
|
|
432
|
+
function answerModelCatalog(res, ctx, backend, instance, profile, canAnswer) {
|
|
433
|
+
const models = webCatalog(ctx, backend, instance, profile);
|
|
434
|
+
// claude with no account list — with or without a credential profile — is answered with the documentation's ids.
|
|
435
|
+
const answerCatalog = () => {
|
|
436
|
+
if (backend === "claude-code" && !models.length)
|
|
437
|
+
json(res, 200, { backend, models: documentedClaudeCatalog(ctx), source: "official-catalog" });
|
|
438
|
+
else
|
|
439
|
+
json(res, 200, { backend, models });
|
|
440
|
+
};
|
|
441
|
+
// The existing catalog belongs to this instance/account and always wins.
|
|
442
|
+
if (models.length || !ctx.cliModelCatalogFor || profile !== null) {
|
|
443
|
+
answerCatalog();
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
void (async () => {
|
|
447
|
+
const cliModels = await ctx.cliModelCatalogFor?.(backend, instance) ?? [];
|
|
448
|
+
if (!canAnswer())
|
|
449
|
+
return;
|
|
450
|
+
const shaped = shapeWebModelCatalog(backend, cliModels);
|
|
451
|
+
if (shaped.length)
|
|
452
|
+
json(res, 200, { backend, models: shaped, source: "cli-cache" });
|
|
453
|
+
else
|
|
454
|
+
answerCatalog();
|
|
455
|
+
})().catch(() => {
|
|
456
|
+
if (canAnswer())
|
|
457
|
+
json(res, 503, { error: "CLI model cache unavailable" });
|
|
458
|
+
});
|
|
459
|
+
}
|
|
380
460
|
/** claude's fallback when no account list is readable: the documentation's `claude-*` ids for the host's CLI version, unverified. */
|
|
381
461
|
function documentedClaudeCatalog(ctx) {
|
|
382
462
|
const version = ctx.backendAvailabilityRows?.().find(row => row.backend === "claude-code")?.version;
|
|
@@ -397,7 +477,7 @@ function stillAuthorized(req, res, url, ctx) {
|
|
|
397
477
|
/**
|
|
398
478
|
* #2308: the app icon. GET: its state, for the settings card (a signed-in person's session). PUT (one PNG, at most
|
|
399
479
|
* 5 MiB) and DELETE (back to the bundled icon): a signed-in admin's session only — never the CLI's token, a read-only
|
|
400
|
-
* session
|
|
480
|
+
* session or a guest (M-3278: the public link's admin session may); checked again once the body has arrived.
|
|
401
481
|
*/
|
|
402
482
|
/** An app icon refusal as the page reads it: its code, the English detail and, when named, the detail's key (#2390). */
|
|
403
483
|
function appIconRefusal(r) {
|
|
@@ -415,10 +495,6 @@ function handleAppIcon(req, res, url, ctx, method) {
|
|
|
415
495
|
json(res, 405, { error: "method not allowed" });
|
|
416
496
|
return true;
|
|
417
497
|
}
|
|
418
|
-
if (gatewayRequestContext(req)) {
|
|
419
|
-
json(res, reading ? 404 : 403, { error: "app_icon_not_over_public_link" });
|
|
420
|
-
return true;
|
|
421
|
-
}
|
|
422
498
|
const who = () => {
|
|
423
499
|
const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
424
500
|
if (verdict.kind !== "allow")
|
|
@@ -503,7 +579,7 @@ function handleAppIcon(req, res, url, ctx, method) {
|
|
|
503
579
|
* POST /ui/update/check look now (one a minute) → the GET's answer
|
|
504
580
|
* POST /ui/update/start { confirm: "update-agend" } + Idempotency-Key → 202 { started } (the progress is the GET's)
|
|
505
581
|
* GET /ui/update/log { text, error } — the updater's own words, for the failure's "full log"
|
|
506
|
-
* Signed-in sessions only (never the CLI's token
|
|
582
|
+
* Signed-in sessions only (never the CLI's token or a guest; M-3278: the public link's sessions too, as locally); an
|
|
507
583
|
* admin's for all but the version. Asked again once a body is in.
|
|
508
584
|
*/
|
|
509
585
|
function handleWebUpdate(req, res, url, ctx, path, method) {
|
|
@@ -522,10 +598,6 @@ function handleWebUpdate(req, res, url, ctx, path, method) {
|
|
|
522
598
|
json(res, 405, { error: "method not allowed" });
|
|
523
599
|
return true;
|
|
524
600
|
}
|
|
525
|
-
if (gatewayRequestContext(req)) {
|
|
526
|
-
json(res, 404, { error: "not found" });
|
|
527
|
-
return true;
|
|
528
|
-
}
|
|
529
601
|
res.setHeader("Cache-Control", "no-store");
|
|
530
602
|
const who = () => {
|
|
531
603
|
const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
@@ -541,7 +613,7 @@ function handleWebUpdate(req, res, url, ctx, path, method) {
|
|
|
541
613
|
if (!admin)
|
|
542
614
|
return { admin: false, current: st.current };
|
|
543
615
|
const progress = host.updateProgress();
|
|
544
|
-
return { admin: true, current: st.current, offer: st.offer, checked_at: st.checkedAt, check_failed: st.checkFailed, progress, now: Date.now() };
|
|
616
|
+
return { admin: true, current: st.current, offer: st.offer, hubRecommendation: st.hubRecommendation ?? null, checked_at: st.checkedAt, check_failed: st.checkFailed, progress, now: Date.now() };
|
|
545
617
|
};
|
|
546
618
|
const first = who();
|
|
547
619
|
if ("status" in first) {
|
|
@@ -605,7 +677,24 @@ function handleWebUpdate(req, res, url, ctx, path, method) {
|
|
|
605
677
|
}
|
|
606
678
|
// Prism #3505 P2-3: the session that asked, still current and still an admin's, right up to the updater's launch.
|
|
607
679
|
const stillAllowed = () => { const v = who(); return !("status" in v) && v.admin && v.person === now.person; };
|
|
608
|
-
|
|
680
|
+
// M-3140: `recommended` — the Hub's advice this page showed ({ version, revision }); the server re-reads its own.
|
|
681
|
+
const rec = body.recommended;
|
|
682
|
+
if (rec !== undefined && (typeof rec !== "object" || rec === null || typeof rec.version !== "string" || rec.version.length > 128
|
|
683
|
+
|| typeof rec.revision !== "number" || !Number.isSafeInteger(rec.revision) || rec.revision < 1)) {
|
|
684
|
+
json(res, 400, { error: "recommended must be { version, revision }" });
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
const requestId = body.hubRequestId;
|
|
688
|
+
if (requestId !== undefined && (rec !== undefined || typeof requestId !== "string" || !/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/.test(requestId))) {
|
|
689
|
+
json(res, 400, { error: "hubRequestId must name one request, without recommended" });
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
if (requestId !== undefined && !host.startHubRequestedUpdate) {
|
|
693
|
+
json(res, 404, { error: "unavailable" });
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
const r = requestId !== undefined ? await host.startHubRequestedUpdate(key, now.person, stillAllowed, requestId)
|
|
697
|
+
: await host.startWebUpdate(key, now.person, stillAllowed, rec ? { version: rec.version, revision: rec.revision } : undefined);
|
|
609
698
|
if (!r.ok) {
|
|
610
699
|
json(res, r.status, { error: r.error });
|
|
611
700
|
return;
|
|
@@ -856,10 +945,6 @@ function officeSettingPut(req, res, url, ctx, o) {
|
|
|
856
945
|
json(res, 404, { error: "Offices are not kept on this fleet" });
|
|
857
946
|
return true;
|
|
858
947
|
}
|
|
859
|
-
if (gatewayRequestContext(req)) {
|
|
860
|
-
json(res, 403, { error: "offices_not_over_public_link" });
|
|
861
|
-
return true;
|
|
862
|
-
}
|
|
863
948
|
const who = () => {
|
|
864
949
|
const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
865
950
|
if (verdict.kind !== "allow")
|
|
@@ -973,10 +1058,6 @@ function handleOfficeSkins(req, res, url, ctx, path, method) {
|
|
|
973
1058
|
json(res, 404, { error: "not found" });
|
|
974
1059
|
return true;
|
|
975
1060
|
}
|
|
976
|
-
if (gatewayRequestContext(req)) {
|
|
977
|
-
json(res, 403, { error: "skins_not_over_public_link" });
|
|
978
|
-
return true;
|
|
979
|
-
}
|
|
980
1061
|
const who = () => {
|
|
981
1062
|
const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
982
1063
|
if (verdict.kind !== "allow")
|
|
@@ -1067,10 +1148,6 @@ function handleOfficePackChanges(req, res, url, ctx, path, method) {
|
|
|
1067
1148
|
json(res, 404, { error: "not found" });
|
|
1068
1149
|
return true;
|
|
1069
1150
|
}
|
|
1070
|
-
if (gatewayRequestContext(req)) {
|
|
1071
|
-
json(res, 403, { error: "pack_changes_not_over_public_link" });
|
|
1072
|
-
return true;
|
|
1073
|
-
}
|
|
1074
1151
|
const who = () => {
|
|
1075
1152
|
const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
1076
1153
|
if (verdict.kind !== "allow")
|
|
@@ -1147,10 +1224,6 @@ function handleOwnerCss(req, res, url, ctx, path, method) {
|
|
|
1147
1224
|
return true;
|
|
1148
1225
|
}
|
|
1149
1226
|
const reading = method === "GET" || method === "HEAD";
|
|
1150
|
-
if (gatewayRequestContext(req)) {
|
|
1151
|
-
json(res, reading ? 404 : 403, { error: "owner_css_not_over_public_link" });
|
|
1152
|
-
return true;
|
|
1153
|
-
}
|
|
1154
1227
|
const who = () => {
|
|
1155
1228
|
const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
1156
1229
|
if (verdict.kind !== "allow")
|
|
@@ -1323,13 +1396,9 @@ function handleBrowserBackendSignIns(req, res, url, ctx) {
|
|
|
1323
1396
|
res.setHeader("Cache-Control", "private, no-store");
|
|
1324
1397
|
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
1325
1398
|
const reading = req.method === "GET";
|
|
1326
|
-
if (gatewayRequestContext(req)) {
|
|
1327
|
-
json(res, reading ? 404 : 403, { error: "sign_in_not_over_public_link" });
|
|
1328
|
-
return true;
|
|
1329
|
-
}
|
|
1330
1399
|
const who = () => {
|
|
1331
1400
|
const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
1332
|
-
return v.kind === "allow" && v.via === "session" && v.session.tier === "admin"
|
|
1401
|
+
return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" ? v.session : null; // M-3278: the public link's admin too
|
|
1333
1402
|
};
|
|
1334
1403
|
const owner = who();
|
|
1335
1404
|
if (!owner) {
|
|
@@ -1549,23 +1618,19 @@ function handleBrowserBackendSignIns(req, res, url, ctx) {
|
|
|
1549
1618
|
}
|
|
1550
1619
|
/**
|
|
1551
1620
|
* #2233: signing a backend in from the dashboard (web-backend-login.ts). A signed-in admin session on the local surface
|
|
1552
|
-
* only — never the CLI's header token (an agent's), a guest
|
|
1621
|
+
* only (M-3278: the public link's too) — never the CLI's header token (an agent's), a guest or a read session (refused before the body
|
|
1553
1622
|
* is read, and again after it). Every answer is no-store: the starter's view carries the terminal's access code.
|
|
1554
1623
|
*/
|
|
1555
1624
|
function handleBackendLogin(req, res, url, ctx, path, method) {
|
|
1556
1625
|
res.setHeader("Cache-Control", "private, no-store");
|
|
1557
1626
|
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
1558
1627
|
const reading = method === "GET";
|
|
1559
|
-
if (gatewayRequestContext(req)) {
|
|
1560
|
-
json(res, reading ? 404 : 403, { error: "sign_in_not_over_public_link" });
|
|
1561
|
-
return true;
|
|
1562
|
-
}
|
|
1563
1628
|
const who = () => {
|
|
1564
1629
|
const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
1565
1630
|
if (v.kind !== "allow")
|
|
1566
1631
|
return { error: WEB_TOKEN_INVALID_MESSAGE, status: 401 };
|
|
1567
|
-
if (v.via !== "session" || v.session.tier !== "admin"
|
|
1568
|
-
return { error: "sign_in_needs_a_local_admin", status: 403 };
|
|
1632
|
+
if (v.via !== "session" || v.session.tier !== "admin")
|
|
1633
|
+
return { error: "sign_in_needs_a_local_admin", status: 403 }; // M-3278: any listener
|
|
1569
1634
|
return { handle: v.session.handle, label: v.session.label };
|
|
1570
1635
|
};
|
|
1571
1636
|
const first = who();
|
|
@@ -1665,19 +1730,16 @@ function handleBackendLogin(req, res, url, ctx, path, method) {
|
|
|
1665
1730
|
}
|
|
1666
1731
|
/**
|
|
1667
1732
|
* AGEND-133 (upstream #3521): installing a CLI on the AgEnD host from the dashboard (web-host-install.ts). The gate is the sign-in routes' own — a signed-in admin
|
|
1668
|
-
* session
|
|
1733
|
+
* session (M-3278: the public link's too); never the CLI's header token (an agent's), a guest or a read session (refused before the body is read, and again
|
|
1669
1734
|
* after it). `GET` reads the current install; `POST` `{ backend }` starts one — the browser names a CLI, the server looks up the registry's command, nothing it sends
|
|
1670
1735
|
* is ever run; `POST …/cancel` `{}` stops the running one. Every answer is no-store.
|
|
1671
1736
|
*/
|
|
1672
|
-
const HOST_INSTALL_STATUS = { not_allowed: 403, unsupported: 400, already: 409, not_installed: 409, up_to_date: 409, version_unreadable: 409,
|
|
1737
|
+
const HOST_INSTALL_STATUS = { not_allowed: 403, unsupported: 400, already: 409, not_installed: 409, up_to_date: 409, version_unreadable: 409, cli_self_updating: 409,
|
|
1738
|
+
not_npm: 409, still_npm: 409, no_npm_copy: 409, npm_busy: 409, busy: 409, shutting_down: 503, failed: 500 };
|
|
1673
1739
|
function handleHostInstall(req, res, url, ctx, path, method) {
|
|
1674
1740
|
res.setHeader("Cache-Control", "private, no-store");
|
|
1675
1741
|
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
1676
1742
|
const reading = method === "GET";
|
|
1677
|
-
if (gatewayRequestContext(req)) {
|
|
1678
|
-
json(res, reading ? 404 : 403, { error: "install_not_over_public_link" });
|
|
1679
|
-
return true;
|
|
1680
|
-
}
|
|
1681
1743
|
const who = () => {
|
|
1682
1744
|
if (isSettingsReplay(req)) {
|
|
1683
1745
|
const requester = settingsRequestRequester(req);
|
|
@@ -1688,8 +1750,8 @@ function handleHostInstall(req, res, url, ctx, path, method) {
|
|
|
1688
1750
|
const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
1689
1751
|
if (v.kind !== "allow")
|
|
1690
1752
|
return { error: WEB_TOKEN_INVALID_MESSAGE, status: 401 };
|
|
1691
|
-
if (v.via !== "session" || v.session.tier !== "admin"
|
|
1692
|
-
return { error: "install_needs_a_local_admin", status: 403 };
|
|
1753
|
+
if (v.via !== "session" || v.session.tier !== "admin")
|
|
1754
|
+
return { error: "install_needs_a_local_admin", status: 403 }; // M-3278: any listener
|
|
1693
1755
|
return { handle: v.session.handle, label: v.session.label };
|
|
1694
1756
|
};
|
|
1695
1757
|
const first = who();
|
|
@@ -1770,7 +1832,9 @@ function handleHostInstall(req, res, url, ctx, path, method) {
|
|
|
1770
1832
|
}
|
|
1771
1833
|
}
|
|
1772
1834
|
// AGEND-136: `POST /ui/host-update { backend }` is the same request for an update: the server picks the command and the audited release; the page sends only the CLI's id.
|
|
1773
|
-
|
|
1835
|
+
// M-3307: `/ui/host-native-switch` and `/ui/host-npm-remove` are the switch to Claude's native install and the npm copy's removal (web-host-install.ts modes).
|
|
1836
|
+
const mode = path === "/ui/host-update" ? "update" : path === "/ui/host-native-switch" ? "native" : path === "/ui/host-npm-remove" ? "remove-npm" : "install";
|
|
1837
|
+
const result = await installs.begin(now, parsed.data.backend, settingsRequestExecution(req), mode);
|
|
1774
1838
|
if ("error" in result)
|
|
1775
1839
|
json(res, HOST_INSTALL_STATUS[result.error] ?? 409, { error: result.error, ...(result.message ? { message: result.message } : {}) });
|
|
1776
1840
|
else
|
|
@@ -1786,9 +1850,10 @@ function handleHostInstall(req, res, url, ctx, path, method) {
|
|
|
1786
1850
|
* folder); `DELETE /ui/accounts/<backend>/<name>` `{ confirm: <name> }` removes one (accounts-profiles.ts: every refusal
|
|
1787
1851
|
* deletes nothing). PR 3: `POST /ui/accounts/<backend>/signout` `{ profile: <name> | null, confirm: true }` signs an
|
|
1788
1852
|
* account out with the CLI's own logout (accounts-signout.ts). The fleet's local admin session only, as the sign-in routes: never the CLI's header token, a guest,
|
|
1789
|
-
* a read session
|
|
1853
|
+
* or a read session (M-3278: the public link's admin session may) — refused before the body is read, and again after it.
|
|
1790
1854
|
*/
|
|
1791
1855
|
const ACCOUNT_STATUS = {
|
|
1856
|
+
credential_connected: 409,
|
|
1792
1857
|
backend: 400, name: 400, confirm: 400, exists: 409, case_clash: 409, unsafe_root: 409, in_use: 409, users_unknown: 409, signing_in: 409, missing: 404,
|
|
1793
1858
|
unsafe: 409, default_home: 409, failed: 500, unsupported: 400, still_signed_in: 409,
|
|
1794
1859
|
// #3190 Part 3c: a paired computer (the Runtime there decides; these are what the server can say before it asks, or what the computer answered).
|
|
@@ -1798,16 +1863,12 @@ const ACCOUNT_STATUS = {
|
|
|
1798
1863
|
function handleAccountWrite(req, res, url, ctx, path, method) {
|
|
1799
1864
|
res.setHeader("Cache-Control", "private, no-store");
|
|
1800
1865
|
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
1801
|
-
if (gatewayRequestContext(req)) {
|
|
1802
|
-
json(res, 403, { error: "accounts_not_over_public_link" });
|
|
1803
|
-
return true;
|
|
1804
|
-
}
|
|
1805
1866
|
const who = () => {
|
|
1806
1867
|
const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
1807
1868
|
if (v.kind !== "allow")
|
|
1808
1869
|
return { error: WEB_TOKEN_INVALID_MESSAGE, status: 401 };
|
|
1809
|
-
if (v.via !== "session" || v.session.tier !== "admin"
|
|
1810
|
-
return { error: "accounts_need_a_local_admin", status: 403 };
|
|
1870
|
+
if (v.via !== "session" || v.session.tier !== "admin")
|
|
1871
|
+
return { error: "accounts_need_a_local_admin", status: 403 }; // M-3278: any listener
|
|
1811
1872
|
return { handle: v.session.handle, label: v.session.label };
|
|
1812
1873
|
};
|
|
1813
1874
|
const first = who();
|
|
@@ -1943,10 +2004,6 @@ const KEEPALIVE_STATUS = { backend: 400, profile: 400, fallback: 400, write: 500
|
|
|
1943
2004
|
function handleAccountKeepAlive(req, res, url, ctx, method) {
|
|
1944
2005
|
res.setHeader("Cache-Control", "private, no-store");
|
|
1945
2006
|
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
1946
|
-
if (gatewayRequestContext(req)) {
|
|
1947
|
-
json(res, 403, { error: "accounts_not_over_public_link" });
|
|
1948
|
-
return true;
|
|
1949
|
-
}
|
|
1950
2007
|
if (method !== "POST") {
|
|
1951
2008
|
json(res, 405, { error: "method_not_allowed" });
|
|
1952
2009
|
return true;
|
|
@@ -1955,8 +2012,8 @@ function handleAccountKeepAlive(req, res, url, ctx, method) {
|
|
|
1955
2012
|
const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
1956
2013
|
if (v.kind !== "allow")
|
|
1957
2014
|
return { error: WEB_TOKEN_INVALID_MESSAGE, status: 401 };
|
|
1958
|
-
if (v.via !== "session" || v.session.tier !== "admin"
|
|
1959
|
-
return { error: "accounts_need_a_local_admin", status: 403 };
|
|
2015
|
+
if (v.via !== "session" || v.session.tier !== "admin")
|
|
2016
|
+
return { error: "accounts_need_a_local_admin", status: 403 }; // M-3278: any listener
|
|
1960
2017
|
return { handle: v.session.handle, label: v.session.label };
|
|
1961
2018
|
};
|
|
1962
2019
|
const first = who();
|
|
@@ -2014,8 +2071,8 @@ function handleAccountKeepAlive(req, res, url, ctx, method) {
|
|
|
2014
2071
|
}
|
|
2015
2072
|
/**
|
|
2016
2073
|
* #1629 r4 §4 (r4-5): mods — a person's import (stage, then commit), uninstall and export. Every route is a signed-in
|
|
2017
|
-
* session's, writes an admin's: never the CLI's header token (the way an agent could reach it)
|
|
2018
|
-
*
|
|
2074
|
+
* session's, writes an admin's: never the CLI's header token (the way an agent could reach it); M-3278: the public link's
|
|
2075
|
+
* sessions too, as locally. `who()` is asked first and again once a body is in.
|
|
2019
2076
|
*/
|
|
2020
2077
|
function handleMods(req, res, url, ctx, path, method) {
|
|
2021
2078
|
const mods = ctx.mods;
|
|
@@ -2024,10 +2081,6 @@ function handleMods(req, res, url, ctx, path, method) {
|
|
|
2024
2081
|
return true;
|
|
2025
2082
|
}
|
|
2026
2083
|
const reading = method === "GET";
|
|
2027
|
-
if (gatewayRequestContext(req)) {
|
|
2028
|
-
json(res, reading ? 404 : 403, { error: "mods_not_over_public_link" });
|
|
2029
|
-
return true;
|
|
2030
|
-
}
|
|
2031
2084
|
const who = () => {
|
|
2032
2085
|
const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
2033
2086
|
if (verdict.kind !== "allow")
|
|
@@ -2480,8 +2533,6 @@ function webPersonOr401(req, res, url, ctx) {
|
|
|
2480
2533
|
* so neither confirms work waiting for the person.
|
|
2481
2534
|
*/
|
|
2482
2535
|
function boardActor(req, url, ctx, p) {
|
|
2483
|
-
if (gatewayRequestContext(req))
|
|
2484
|
-
return { kind: "script", name: "public-link" };
|
|
2485
2536
|
const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
2486
2537
|
return v.kind === "allow" && v.via === "session" ? { kind: "person", name: p.name } : { kind: "script", name: "web-token" };
|
|
2487
2538
|
}
|
|
@@ -2585,6 +2636,92 @@ function statusTick(ctx, t) {
|
|
|
2585
2636
|
export function handleWebRequest(req, res, url, ctx) {
|
|
2586
2637
|
const path = url.pathname;
|
|
2587
2638
|
const method = req.method ?? "GET";
|
|
2639
|
+
if (path === "/ui/host-history") {
|
|
2640
|
+
res.setHeader("Cache-Control", "private, no-store");
|
|
2641
|
+
const auth = () => evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
2642
|
+
const who = auth();
|
|
2643
|
+
if (who.kind !== "allow" || who.via !== "session" || who.session.tier !== "admin") {
|
|
2644
|
+
json(res, 403, { error: "admin_session_required" });
|
|
2645
|
+
return true;
|
|
2646
|
+
}
|
|
2647
|
+
const range = url.searchParams.get('range'), series = url.searchParams.getAll('series');
|
|
2648
|
+
try {
|
|
2649
|
+
if (method !== "GET" || url.search.length > 4096 || url.searchParams.getAll('range').length !== 1 || [...url.searchParams.keys()].some(k => k !== 'range' && k !== 'series'))
|
|
2650
|
+
throw Error();
|
|
2651
|
+
historyQuery(range, series, Date.now());
|
|
2652
|
+
}
|
|
2653
|
+
catch {
|
|
2654
|
+
json(res, 400, { error: "invalid_history_query" });
|
|
2655
|
+
return true;
|
|
2656
|
+
}
|
|
2657
|
+
if (!ctx.hostHistoryQuery) {
|
|
2658
|
+
json(res, 503, { error: "history_unavailable" });
|
|
2659
|
+
return true;
|
|
2660
|
+
}
|
|
2661
|
+
void Promise.resolve().then(() => ctx.hostHistoryQuery(range, series)).then(answer => {
|
|
2662
|
+
if (res.destroyed)
|
|
2663
|
+
return;
|
|
2664
|
+
const current = auth();
|
|
2665
|
+
if (current.kind !== "allow" || current.via !== "session" || current.session.tier !== "admin" || current.session.idHash !== who.session.idHash) {
|
|
2666
|
+
json(res, 403, { error: "admin_session_required" });
|
|
2667
|
+
return;
|
|
2668
|
+
}
|
|
2669
|
+
json(res, 200, answer);
|
|
2670
|
+
}, () => { if (!res.destroyed)
|
|
2671
|
+
json(res, 503, { error: "history_unavailable" }); });
|
|
2672
|
+
return true;
|
|
2673
|
+
}
|
|
2674
|
+
if (path === '/ui/host-alert-action') {
|
|
2675
|
+
res.setHeader('Cache-Control', 'private, no-store');
|
|
2676
|
+
const auth = () => evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
2677
|
+
const who = auth();
|
|
2678
|
+
if (who.kind !== 'allow' || who.via !== 'session' || who.session.tier !== 'admin') {
|
|
2679
|
+
json(res, 403, { error: 'admin_session_required' });
|
|
2680
|
+
return true;
|
|
2681
|
+
}
|
|
2682
|
+
if (method !== 'POST' || url.search) {
|
|
2683
|
+
json(res, 400, { error: 'invalid_host_alert_action' });
|
|
2684
|
+
return true;
|
|
2685
|
+
}
|
|
2686
|
+
void readBoundedWebBody(req, 2048).then(async (bytes) => {
|
|
2687
|
+
const current = () => { const value = auth(); return value.kind === 'allow' && value.via === 'session' && value.session.tier === 'admin' && value.session.idHash === who.session.idHash; };
|
|
2688
|
+
if (!current())
|
|
2689
|
+
return json(res, 403, { error: 'admin_session_required' });
|
|
2690
|
+
let input;
|
|
2691
|
+
try {
|
|
2692
|
+
input = JSON.parse(bytes.toString('utf8'));
|
|
2693
|
+
}
|
|
2694
|
+
catch {
|
|
2695
|
+
return json(res, 400, { error: 'invalid_host_alert_action' });
|
|
2696
|
+
}
|
|
2697
|
+
if (!input || Array.isArray(input) || Object.keys(input).some(k => !['key', 'revision', 'snoozeMs'].includes(k)) || typeof input.key !== 'string' || !/^[a-zA-Z0-9:_-]{1,128}$/.test(input.key) || !Number.isSafeInteger(input.revision) || input.revision < 1 || (input.snoozeMs !== undefined && (!Number.isSafeInteger(input.snoozeMs) || input.snoozeMs < 60000 || input.snoozeMs > 86400000)))
|
|
2698
|
+
return json(res, 400, { error: 'invalid_host_alert_action' });
|
|
2699
|
+
const ok = await ctx.hostAlertAction?.(input.key, input.revision, 'web:' + who.session.idHash, input.snoozeMs);
|
|
2700
|
+
if (!current())
|
|
2701
|
+
return json(res, 403, { error: 'admin_session_required' });
|
|
2702
|
+
json(res, ok ? 200 : 409, { ok: !!ok, ...(!ok ? { error: 'host_alert_stale' } : {}) });
|
|
2703
|
+
}).catch(() => { if (!res.headersSent)
|
|
2704
|
+
json(res, 503, { error: 'host_alert_unavailable' }); });
|
|
2705
|
+
return true;
|
|
2706
|
+
}
|
|
2707
|
+
if (path === "/ui/host-health") {
|
|
2708
|
+
res.setHeader("Cache-Control", "private, no-store");
|
|
2709
|
+
const who = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
2710
|
+
if (who.kind !== "allow" || who.via !== "session" || who.session.tier !== "admin") {
|
|
2711
|
+
json(res, 403, { error: "admin_session_required" });
|
|
2712
|
+
return true;
|
|
2713
|
+
}
|
|
2714
|
+
if (method !== "GET" || [...url.searchParams.keys()].some(k => k !== "agentOffset") || url.searchParams.getAll("agentOffset").length > 1 || !/^(?:0|50|100)$/.test(url.searchParams.get("agentOffset") ?? "0")) {
|
|
2715
|
+
json(res, 400, { error: "invalid_host_health_request" });
|
|
2716
|
+
return true;
|
|
2717
|
+
}
|
|
2718
|
+
if (!ctx.hostHealthSnapshot) {
|
|
2719
|
+
json(res, 503, { error: "host_monitoring_unavailable" });
|
|
2720
|
+
return true;
|
|
2721
|
+
}
|
|
2722
|
+
json(res, 200, ctx.hostHealthSnapshot(Number(url.searchParams.get("agentOffset") ?? 0)));
|
|
2723
|
+
return true;
|
|
2724
|
+
}
|
|
2588
2725
|
// Auth check for all /ui routes. Defence in depth behind the fleet-manager
|
|
2589
2726
|
// gate: the same session cookie or header token, and an unset token closes
|
|
2590
2727
|
// the panel instead of comparing null against a missing credential.
|
|
@@ -2627,6 +2764,9 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2627
2764
|
}
|
|
2628
2765
|
if (handleAgentRuntimeChange(req, res, url, ctx))
|
|
2629
2766
|
return true;
|
|
2767
|
+
if (ctx.contactPermissions && ctx.writeContactPermissions && ctx.contactAuthorization && ctx.contactAuthorizations && ctx.decideContactAuthorization && ctx.contactActor
|
|
2768
|
+
&& handleContactAuthorizationApi(req, res, url, ctx))
|
|
2769
|
+
return true;
|
|
2630
2770
|
if (handleNativeInstanceRequest(req, res, url, ctx))
|
|
2631
2771
|
return true;
|
|
2632
2772
|
if (handleWindowsCliRequest(req, res, url, ctx))
|
|
@@ -2657,9 +2797,27 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2657
2797
|
json(res, 400, { error: "Invalid file name" });
|
|
2658
2798
|
return true;
|
|
2659
2799
|
}
|
|
2800
|
+
// M-3314: /ui/js/v-<V>/… (rewritten to this path before the gate): this process's <V> is kept for good, privately; an
|
|
2801
|
+
// older tab's gets the stale-tab answer — once the gate above let the session through, as the plain path.
|
|
2802
|
+
const mark = assetVersionMark(req);
|
|
2803
|
+
if (mark && !mark.current) {
|
|
2804
|
+
if (!existsSync(join(__dirname, "ui", fileName))) {
|
|
2805
|
+
json(res, 404, { error: "File not found" });
|
|
2806
|
+
return true;
|
|
2807
|
+
}
|
|
2808
|
+
answerStaleAsset(res, path);
|
|
2809
|
+
return true;
|
|
2810
|
+
}
|
|
2660
2811
|
try {
|
|
2661
2812
|
const js = readFileSync(join(__dirname, "ui", fileName), "utf-8");
|
|
2813
|
+
// A file rewritten under this running process is not what <V> named (an update or a rollback before its restart).
|
|
2814
|
+
if (mark && !assetIntact(fileName, js)) {
|
|
2815
|
+
answerStaleAsset(res, path);
|
|
2816
|
+
return true;
|
|
2817
|
+
}
|
|
2662
2818
|
res.setHeader("Content-Type", "application/javascript; charset=utf-8");
|
|
2819
|
+
if (mark)
|
|
2820
|
+
res.setHeader("Cache-Control", IMMUTABLE_PRIVATE);
|
|
2663
2821
|
// #2182: the route worker's own, narrower-reaching policy (ROUTE_WORKER_CSP); every other file keeps the page's.
|
|
2664
2822
|
if (path === ROUTE_WORKER_PATH)
|
|
2665
2823
|
res.setHeader("Content-Security-Policy", ROUTE_WORKER_CSP);
|
|
@@ -2841,33 +2999,20 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2841
2999
|
}
|
|
2842
3000
|
if (handleNativeModelCatalog(req, res, url, ctx))
|
|
2843
3001
|
return true;
|
|
2844
|
-
const
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
json(res, 200, { backend, models });
|
|
2851
|
-
};
|
|
2852
|
-
// The existing catalog belongs to this instance/account and always wins.
|
|
2853
|
-
if (models.length || !ctx.cliModelCatalogFor || profile !== null) {
|
|
2854
|
-
answerCatalog();
|
|
3002
|
+
const canAnswer = () => !res.headersSent && !res.destroyed && !res.writableEnded && stillAuthorized(req, res, url, ctx);
|
|
3003
|
+
const answer = () => answerModelCatalog(res, ctx, backend, instance, profile, canAnswer);
|
|
3004
|
+
// An empty (or stale) list is discovered once, bounded, before the answer — the page shows its loading state
|
|
3005
|
+
// meanwhile — rather than answered as "no models" until someone presses Refresh. A cached fresh list is answered at once.
|
|
3006
|
+
if (!ctx.ensureModelCatalog) {
|
|
3007
|
+
answer();
|
|
2855
3008
|
return true;
|
|
2856
3009
|
}
|
|
2857
|
-
const canAnswer = () => !res.headersSent && !res.destroyed && !res.writableEnded && stillAuthorized(req, res, url, ctx);
|
|
2858
3010
|
void (async () => {
|
|
2859
|
-
|
|
2860
|
-
if (!canAnswer())
|
|
2861
|
-
return;
|
|
2862
|
-
const shaped = shapeWebModelCatalog(backend, cliModels);
|
|
2863
|
-
if (shaped.length)
|
|
2864
|
-
json(res, 200, { backend, models: shaped, source: "cli-cache" });
|
|
2865
|
-
else
|
|
2866
|
-
answerCatalog();
|
|
2867
|
-
})().catch(() => {
|
|
3011
|
+
await ctx.ensureModelCatalog?.(backend, instance, profile !== null ? { profile } : undefined);
|
|
2868
3012
|
if (canAnswer())
|
|
2869
|
-
|
|
2870
|
-
})
|
|
3013
|
+
answer();
|
|
3014
|
+
})().catch(() => { if (canAnswer())
|
|
3015
|
+
json(res, 503, { error: "model catalog unavailable" }); });
|
|
2871
3016
|
return true;
|
|
2872
3017
|
}
|
|
2873
3018
|
// The effort levels Settings → Runtime & model's dropdown offers for an agent and a (not yet saved) model — the chat chip's list.
|
|
@@ -2952,7 +3097,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2952
3097
|
// M-2260: the newest within the catch-up budget; `truncated` when older ones were left out (the page re-reads its
|
|
2953
3098
|
// chats' newest history, as a reload would) — never megabytes that a slow link cannot bring in time.
|
|
2954
3099
|
...(() => {
|
|
2955
|
-
const w = catchUpWindow(history ? visibleMessages(ctx,
|
|
3100
|
+
const w = catchUpWindow(history ? visibleMessages(ctx, linkRestricted(req, url, ctx), fresh ? history.after(0) : history.replayFor(parseLastEventId(after))) : []);
|
|
2956
3101
|
return w.truncated ? { messages: w.messages, truncated: true } : { messages: w.messages };
|
|
2957
3102
|
})(),
|
|
2958
3103
|
// The ticks too, so polling never has to re-read a chat's history — that read would count as the person's
|
|
@@ -2966,7 +3111,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2966
3111
|
prompts: ctx.listWebPrompts?.() ?? [],
|
|
2967
3112
|
// #1386: "Needs you" rides the passive channels only — no endpoint of its own to poll. Over the public link,
|
|
2968
3113
|
// without the task board's hidden cards (#2306 review).
|
|
2969
|
-
needs: visibleNeeds(ctx,
|
|
3114
|
+
needs: visibleNeeds(ctx, linkRestricted(req, url, ctx), contactNeedsFor(req, url, ctx, ctx.needsYouItems?.() ?? [])),
|
|
2970
3115
|
// #1577: the newest message this answer accounts for — after a restart, the last restored one until this process
|
|
2971
3116
|
// records its own (`<boot>-0` would be after(0): the whole restored history again on every poll).
|
|
2972
3117
|
cursor: history ? history.pollCursor() : null,
|
|
@@ -2976,10 +3121,24 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2976
3121
|
return true;
|
|
2977
3122
|
}
|
|
2978
3123
|
if (method === "GET" && path === "/ui/events") {
|
|
2979
|
-
|
|
3124
|
+
const overLink = !!gatewayRequestContext(req);
|
|
3125
|
+
if (overLink && !namedLinkStream(req, ctx)) {
|
|
2980
3126
|
json(res, 404, { error: "Use polling on the public link" });
|
|
2981
3127
|
return true;
|
|
2982
3128
|
}
|
|
3129
|
+
let open;
|
|
3130
|
+
if (overLink) {
|
|
3131
|
+
open = linkStreams.get(ctx) ?? new Set();
|
|
3132
|
+
linkStreams.set(ctx, open);
|
|
3133
|
+
if (open.size >= LINK_STREAMS_MAX) {
|
|
3134
|
+
json(res, 503, { error: "Too many live streams over the public link; this page polls" });
|
|
3135
|
+
return true;
|
|
3136
|
+
}
|
|
3137
|
+
open.add(res);
|
|
3138
|
+
// Freed when the response closes, however it ends — even if the setup below throws (Fable on #4116).
|
|
3139
|
+
const slots = open;
|
|
3140
|
+
res.on("close", () => { slots.delete(res); });
|
|
3141
|
+
}
|
|
2983
3142
|
res.writeHead(200, {
|
|
2984
3143
|
"Content-Type": "text/event-stream",
|
|
2985
3144
|
"Cache-Control": "no-cache",
|
|
@@ -2994,6 +3153,30 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2994
3153
|
streamGuests.set(res, guest);
|
|
2995
3154
|
guest.streamOpened?.();
|
|
2996
3155
|
}
|
|
3156
|
+
if (!guest)
|
|
3157
|
+
streamContactProjection.set(res, (event, value) => {
|
|
3158
|
+
if (event === "needs")
|
|
3159
|
+
return { items: contactNeedsFor(req, url, ctx, (value && typeof value === "object" && Array.isArray(value.items)) ? value.items : []) };
|
|
3160
|
+
if (event === "contact-auth") {
|
|
3161
|
+
const actor = ctx.contactActor?.(req, url);
|
|
3162
|
+
if (!actor || !value || typeof value !== "object")
|
|
3163
|
+
return undefined;
|
|
3164
|
+
const change = value;
|
|
3165
|
+
try {
|
|
3166
|
+
if (change.ticketId)
|
|
3167
|
+
ctx.contactAuthorization?.(change.ticketId, actor);
|
|
3168
|
+
else if (change.instance)
|
|
3169
|
+
ctx.contactPermissions?.(change.instance, actor);
|
|
3170
|
+
else
|
|
3171
|
+
return undefined;
|
|
3172
|
+
return value;
|
|
3173
|
+
}
|
|
3174
|
+
catch {
|
|
3175
|
+
return undefined;
|
|
3176
|
+
}
|
|
3177
|
+
}
|
|
3178
|
+
return value;
|
|
3179
|
+
});
|
|
2997
3180
|
const statusFrame = () => `event: status\ndata: ${JSON.stringify(guest ? guestStatus(ctx.getUiStatus(), guest.scope()) : ctx.getUiStatus())}\n\n`;
|
|
2998
3181
|
res.write(`${statusFrame()}${sseClock()}`);
|
|
2999
3182
|
// An EventSource that reconnects says what it last saw: send what it missed, before anything new.
|
|
@@ -3021,7 +3204,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3021
3204
|
res.write(`event: prompts\ndata: ${JSON.stringify(ctx.listWebPrompts())}\n\n`);
|
|
3022
3205
|
// #1386: and "Needs you" as it is now; changes follow as `needs` events.
|
|
3023
3206
|
if (!guest && ctx.needsYouItems)
|
|
3024
|
-
res.write(`event: needs\ndata: ${JSON.stringify({ items: ctx.needsYouItems() })}\n\n`);
|
|
3207
|
+
res.write(`event: needs\ndata: ${JSON.stringify({ items: contactNeedsFor(req, url, ctx, ctx.needsYouItems()) })}\n\n`);
|
|
3025
3208
|
ctx.sseClients.add(res);
|
|
3026
3209
|
// #1956: the heartbeat's status comes from the one build every open stream shares each tick (statusTick), with
|
|
3027
3210
|
// this stream's own projection; this stream's checks stay its own.
|
|
@@ -3032,6 +3215,8 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3032
3215
|
// #2049 review: a guest's stream also needs the exact session that opened it — another cookie on the same request
|
|
3033
3216
|
// still authenticating does not keep a revoked device's stream (with its scope) alive.
|
|
3034
3217
|
alive: () => {
|
|
3218
|
+
// M-3278: over the fixed link this check also ends the stream once that link is no longer the current one
|
|
3219
|
+
// (web-auth refuses a request whose gateway is not current).
|
|
3035
3220
|
if (isWebRequestAuthorized(req, url, ctx.webToken, ctx.webSessions, { touch: false }) && (!guest || guest.current()))
|
|
3036
3221
|
return true;
|
|
3037
3222
|
// Close the connection too, not just the response: an ended response leaves the socket idle in
|
|
@@ -3057,6 +3242,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3057
3242
|
if (cleanedUp)
|
|
3058
3243
|
return;
|
|
3059
3244
|
cleanedUp = true;
|
|
3245
|
+
open?.delete(res);
|
|
3060
3246
|
ctx.sseClients.delete(res);
|
|
3061
3247
|
unsubscribe();
|
|
3062
3248
|
};
|
|
@@ -3083,11 +3269,41 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3083
3269
|
// #1920 §5.2: a guest gets what the channel showed of it, and its own messages (the gate checked the scope).
|
|
3084
3270
|
const guest = guestRequestOf(req);
|
|
3085
3271
|
const messages = !ctx.webChatHistory ? [] : guest ? guestHistory(ctx.webChatHistory, instance, limit, guest, guest.scope())
|
|
3086
|
-
: visibleMessages(ctx,
|
|
3272
|
+
: visibleMessages(ctx, linkRestricted(req, url, ctx), ctx.webChatHistory.list(instance, limit));
|
|
3087
3273
|
// #2848: the chat has messages, none of them a guest's to see (all between agents, or kept before they were marked):
|
|
3088
3274
|
// said, so its empty chat is explained rather than blank. Only that there are some — never how many, or what.
|
|
3089
3275
|
const allHidden = !!guest && messages.length === 0 && (ctx.webChatHistory?.list(instance, 1).length ?? 0) > 0;
|
|
3090
|
-
json(res, 200, { messages, boot: ctx.webChatHistory?.boot ?? null, lastId: ctx.webChatHistory?.lastId ?? 0, ...(allHidden ? { allHidden: true } : {}) });
|
|
3276
|
+
json(res, 200, { messages, resendOwner: webPersonOf(req, url, ctx)?.voterKey ?? null, boot: ctx.webChatHistory?.boot ?? null, lastId: ctx.webChatHistory?.lastId ?? 0, ...(allHidden ? { allHidden: true } : {}) });
|
|
3277
|
+
return true;
|
|
3278
|
+
}
|
|
3279
|
+
// ── M-3272: scrolling back past the 500-message window (the archive, web-chat-archive.ts) ──
|
|
3280
|
+
// GET /ui/history/older?instance=&before=<boot>-<id>&limit=1..100 → { messages, more }: older than `before`, oldest first.
|
|
3281
|
+
// GET /ui/history/newer?instance=&after=<boot>-<id>&limit=1..100 → { messages, more }: newer than `after`.
|
|
3282
|
+
// GET /ui/history/around?instance=&key=<boot>-<id>&limit=1..100 → { messages, olderMore, newerMore }: a jump's page.
|
|
3283
|
+
// An admin's, as /ui/subagents (decision 7933bf90: over the public link too, filtered as /ui/history is — linkRestricted);
|
|
3284
|
+
// a guest or a read-only session: 403. A key in neither the window nor the archive: 200 { messages: [], found: false } —
|
|
3285
|
+
// an ordinary answer, not an error (#4103: a pin or search jump to a message no longer kept falls back to its copy; a 404
|
|
3286
|
+
// was a console error on every such jump).
|
|
3287
|
+
const archiveRead = /^\/ui\/history\/(older|newer|around)$/.exec(path);
|
|
3288
|
+
if (method === "GET" && archiveRead) {
|
|
3289
|
+
if (!adminAdmissionOf(req, url, ctx) || guestRequestOf(req)) {
|
|
3290
|
+
json(res, 403, { error: "admin_only" });
|
|
3291
|
+
return true;
|
|
3292
|
+
}
|
|
3293
|
+
const p = url.searchParams, instance = p.get("instance") ?? "", limit = Number(p.get("limit") ?? 100);
|
|
3294
|
+
const key = p.get(archiveRead[1] === "older" ? "before" : archiveRead[1] === "newer" ? "after" : "key") ?? "";
|
|
3295
|
+
if (!instance || instance.length > 128 || !safeInstanceSegment(instance) || !/^[0-9a-f]{1,32}-\d{1,15}$/.test(key) || !Number.isInteger(limit) || limit < 1 || limit > 100) {
|
|
3296
|
+
json(res, 400, { error: "instance, a message key and limit (1-100) required" });
|
|
3297
|
+
return true;
|
|
3298
|
+
}
|
|
3299
|
+
const history = ctx.webChatHistory;
|
|
3300
|
+
const page = !history ? null : archiveRead[1] === "older" ? history.older(instance, key, limit) : archiveRead[1] === "newer" ? history.newer(instance, key, limit) : history.around(instance, key, limit);
|
|
3301
|
+
if (!page) {
|
|
3302
|
+
json(res, 200, { messages: [], more: false, olderMore: false, newerMore: false, found: false });
|
|
3303
|
+
return true;
|
|
3304
|
+
}
|
|
3305
|
+
// M-3278 parity (#4100): what /ui/history shows over the link — an admin sees what it sees directly (linkRestricted).
|
|
3306
|
+
json(res, 200, { ...page, messages: visibleMessages(ctx, linkRestricted(req, url, ctx), page.messages) });
|
|
3091
3307
|
return true;
|
|
3092
3308
|
}
|
|
3093
3309
|
// ── #3212 PR 1: Settings → Agents → Accounts (read-only) ─────────────────────────────────
|
|
@@ -3097,13 +3313,10 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3097
3313
|
// same rule as the sign-in list it extends).
|
|
3098
3314
|
if (method === "GET" && path === "/ui/accounts") {
|
|
3099
3315
|
res.setHeader("Cache-Control", "private, no-store");
|
|
3100
|
-
|
|
3101
|
-
json(res, 404, { error: "not_found" });
|
|
3102
|
-
return true;
|
|
3103
|
-
}
|
|
3316
|
+
// M-3278 (decision 7933bf90): an admin session on any listener, the public link too (temporary or fixed).
|
|
3104
3317
|
const localAdmin = () => {
|
|
3105
3318
|
const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
3106
|
-
return v.kind === "allow" && v.via === "session" && v.session.tier === "admin"
|
|
3319
|
+
return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" ? v.session : null;
|
|
3107
3320
|
};
|
|
3108
3321
|
const who = localAdmin();
|
|
3109
3322
|
if (!who) {
|
|
@@ -3123,20 +3336,89 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3123
3336
|
}, err => { ctx.logger.error({ err: err.message }, "Accounts view failed"); json(res, 500, { error: "could not read the accounts" }); });
|
|
3124
3337
|
return true;
|
|
3125
3338
|
}
|
|
3339
|
+
// M-3283: one reply-linked file, for an admin session on any listener. No folder listing or gateway refusal.
|
|
3340
|
+
if (method === "GET" && path === "/ui/reply-preview") {
|
|
3341
|
+
res.setHeader("Cache-Control", "private, no-store");
|
|
3342
|
+
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
3343
|
+
const admin = () => { const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false }); return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" ? v.session : null; };
|
|
3344
|
+
const who = admin();
|
|
3345
|
+
if (!who) {
|
|
3346
|
+
json(res, 403, { error: "preview_needs_admin" });
|
|
3347
|
+
return true;
|
|
3348
|
+
}
|
|
3349
|
+
const p = url.searchParams, instance = p.get("instance") ?? "", op = p.get("op") ?? "meta";
|
|
3350
|
+
const cfg = ctx.fleetConfig?.instances && Object.hasOwn(ctx.fleetConfig.instances, instance) ? ctx.fleetConfig.instances[instance] : undefined;
|
|
3351
|
+
if (!cfg) {
|
|
3352
|
+
json(res, 404, { error: "not_found" });
|
|
3353
|
+
return true;
|
|
3354
|
+
}
|
|
3355
|
+
if (cfg.runtime === "windows" || cfg.machine_id) {
|
|
3356
|
+
json(res, 403, { error: "preview_remote_unavailable", message: REMOTE_PREVIEW_REFUSAL });
|
|
3357
|
+
return true;
|
|
3358
|
+
}
|
|
3359
|
+
const offered = () => !isGeneralInstance(ctx.fleetConfig, instance) && resolveToolSet(cfg, instance) !== "coordinator" && cfg.runtime !== "windows" && !cfg.machine_id;
|
|
3360
|
+
if (!offered()) {
|
|
3361
|
+
json(res, 404, { error: "workspace_not_offered" });
|
|
3362
|
+
return true;
|
|
3363
|
+
}
|
|
3364
|
+
if (op !== "meta" && op !== "raw") {
|
|
3365
|
+
json(res, 400, { error: "invalid" });
|
|
3366
|
+
return true;
|
|
3367
|
+
}
|
|
3368
|
+
const wd = String(cfg.working_directory ?? "").replace(/^~(?=$|\/)/, process.env.HOME ?? "~");
|
|
3369
|
+
const current = () => admin()?.handle === who.handle && ctx.fleetConfig?.instances[instance] === cfg && String(cfg.working_directory ?? "").replace(/^~(?=$|\/)/, process.env.HOME ?? "~") === wd && offered();
|
|
3370
|
+
void (async () => {
|
|
3371
|
+
let closeRead;
|
|
3372
|
+
try {
|
|
3373
|
+
const r = await readReplyPreview(wd, getAgendHome(), p.get("path"), op === "raw", current, req.headers.range);
|
|
3374
|
+
if (r.kind === "raw")
|
|
3375
|
+
closeRead = r.close;
|
|
3376
|
+
if (!current())
|
|
3377
|
+
throw new ReplyPreviewError("preview_changed");
|
|
3378
|
+
if (r.kind === "meta") {
|
|
3379
|
+
json(res, 200, r.body);
|
|
3380
|
+
return;
|
|
3381
|
+
}
|
|
3382
|
+
if (r.mime === "application/pdf")
|
|
3383
|
+
res.setHeader("X-Frame-Options", "SAMEORIGIN");
|
|
3384
|
+
res.setHeader("Content-Security-Policy", r.mime === "application/pdf" ? "default-src 'none'; frame-ancestors 'self'" : "default-src 'none'; sandbox");
|
|
3385
|
+
res.setHeader("Content-Type", r.mime);
|
|
3386
|
+
res.setHeader("Content-Length", String(r.length));
|
|
3387
|
+
res.setHeader("Accept-Ranges", "bytes");
|
|
3388
|
+
if (r.partial)
|
|
3389
|
+
res.setHeader("Content-Range", `bytes ${r.start}-${r.end}/${r.size}`);
|
|
3390
|
+
res.writeHead(r.partial ? 206 : 200);
|
|
3391
|
+
await pipeline(r.chunks, res, { end: false });
|
|
3392
|
+
res.end();
|
|
3393
|
+
}
|
|
3394
|
+
catch (error) {
|
|
3395
|
+
if (res.headersSent || res.destroyed) {
|
|
3396
|
+
res.destroy();
|
|
3397
|
+
return;
|
|
3398
|
+
}
|
|
3399
|
+
const e = error instanceof ReplyPreviewError ? error : new ReplyPreviewError("unavailable");
|
|
3400
|
+
if (e.code === "range_not_satisfiable")
|
|
3401
|
+
res.setHeader("Content-Range", `bytes */${e.size}`);
|
|
3402
|
+
json(res, e.code === "not_found" || e.code === "not_a_directory" ? 404 : e.code === "range_not_satisfiable" ? 416 : e.code === "too_large" ? 413 : e.code === "unavailable" ? 503 : 403, { error: e.code });
|
|
3403
|
+
}
|
|
3404
|
+
finally {
|
|
3405
|
+
if (closeRead)
|
|
3406
|
+
await closeRead().catch(() => { });
|
|
3407
|
+
}
|
|
3408
|
+
})();
|
|
3409
|
+
return true;
|
|
3410
|
+
}
|
|
3126
3411
|
// ── #3153 P1: an agent's Files / Changes (read-only) ─────────────────────────────────
|
|
3127
|
-
// The fleet's
|
|
3412
|
+
// The fleet's admin session only (M-3278: the public link's too): never a guest or a token. One
|
|
3128
3413
|
// agent's own working directory (agent-workspace.ts confines and filters every path); not General or a coordinator
|
|
3129
3414
|
// (they work in the fleet's own directory), not an agent on another machine.
|
|
3130
3415
|
if (method === "GET" && path === "/ui/workspace") {
|
|
3131
3416
|
res.setHeader("Cache-Control", "private, no-store");
|
|
3132
3417
|
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
3133
|
-
|
|
3134
|
-
json(res, 404, { error: "not_found" });
|
|
3135
|
-
return true;
|
|
3136
|
-
}
|
|
3418
|
+
// M-3278 (decision 7933bf90): an admin session on any listener, the public link too (temporary or fixed).
|
|
3137
3419
|
const localAdmin = () => {
|
|
3138
3420
|
const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
3139
|
-
return v.kind === "allow" && v.via === "session" && v.session.tier === "admin"
|
|
3421
|
+
return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" ? v.session : null;
|
|
3140
3422
|
};
|
|
3141
3423
|
const who = localAdmin();
|
|
3142
3424
|
if (!who) {
|
|
@@ -3230,10 +3512,11 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3230
3512
|
// ── #1218: the Log tab ─────────────────────────────────
|
|
3231
3513
|
// An instance's steps, read on demand from its own transcript (log-service.ts). Read-only, and offered on the public
|
|
3232
3514
|
// link on purpose (the user's decision): the same masking applies to every viewer. Passive (web-auth.ts).
|
|
3233
|
-
// Deliberately absent from
|
|
3515
|
+
// Deliberately absent from guest, View and Hub projections. M-3278 (decision 7933bf90): an admin session reads it over
|
|
3516
|
+
// the public link too (temporary or fixed).
|
|
3234
3517
|
if (method === "GET" && path === "/ui/subagents") {
|
|
3235
3518
|
const admission = adminAdmissionOf(req, url, ctx), name = url.searchParams.get("instance") ?? "";
|
|
3236
|
-
if (!admission ||
|
|
3519
|
+
if (!admission || guestRequestOf(req)) {
|
|
3237
3520
|
json(res, 403, { error: "admin_only" });
|
|
3238
3521
|
return true;
|
|
3239
3522
|
}
|
|
@@ -3248,7 +3531,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3248
3531
|
void ctx.subagentRuns(name).then(answer => {
|
|
3249
3532
|
if (res.destroyed)
|
|
3250
3533
|
return;
|
|
3251
|
-
if (adminAdmissionOf(req, url, ctx) !== admission ||
|
|
3534
|
+
if (adminAdmissionOf(req, url, ctx) !== admission || guestRequestOf(req)) {
|
|
3252
3535
|
json(res, 403, { error: "admin_only" });
|
|
3253
3536
|
return;
|
|
3254
3537
|
}
|
|
@@ -3283,11 +3566,11 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3283
3566
|
json(res, 404, { error: "not available" });
|
|
3284
3567
|
return true;
|
|
3285
3568
|
}
|
|
3286
|
-
// AGEND-181: thinking only for an admin session
|
|
3287
|
-
//
|
|
3569
|
+
// AGEND-181: thinking only for an admin session, decided here — never a guest or a View projection, whatever the query
|
|
3570
|
+
// says (M-3278: the public link's admin session too). The service makes none otherwise (its parser is not asked).
|
|
3288
3571
|
// AGEND-197: the chat's activity block (chat=1) is for the same viewer and no other: a refusal here, not a hidden block.
|
|
3289
3572
|
const admission = adminAdmissionOf(req, url, ctx);
|
|
3290
|
-
const admin = !!admission && !
|
|
3573
|
+
const admin = !!admission && !guestRequestOf(req);
|
|
3291
3574
|
const chat = p.get("chat") === "1";
|
|
3292
3575
|
if (chat && !admin) {
|
|
3293
3576
|
json(res, 403, { error: "admin_only" });
|
|
@@ -3306,7 +3589,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3306
3589
|
// Prism #3709 R1: the transcript read is asynchronous — an admin session revoked, or the web token rotated, while it
|
|
3307
3590
|
// ran must not receive the private steps (the chat's block, thinking) it was admitted for. Asked again here, as
|
|
3308
3591
|
// /ui/subagents does; the Log tab's own read (no chat, no thinking) is not private and is left as it was.
|
|
3309
|
-
if ((chat || thinking) && (adminAdmissionOf(req, url, ctx) !== admission ||
|
|
3592
|
+
if ((chat || thinking) && (adminAdmissionOf(req, url, ctx) !== admission || guestRequestOf(req))) {
|
|
3310
3593
|
json(res, 403, { error: "admin_only" });
|
|
3311
3594
|
return;
|
|
3312
3595
|
}
|
|
@@ -3321,10 +3604,60 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3321
3604
|
return true;
|
|
3322
3605
|
}
|
|
3323
3606
|
// ── Send message ───────────────────────────────────────
|
|
3607
|
+
if (method === "POST" && path === "/ui/resend") {
|
|
3608
|
+
void handleResendMessage(req, res, ctx).catch(() => { if (!res.destroyed && !res.headersSent)
|
|
3609
|
+
json(res, 503, { error: "Resend unavailable" }); });
|
|
3610
|
+
return true;
|
|
3611
|
+
}
|
|
3324
3612
|
if (method === "POST" && path === "/ui/send") {
|
|
3325
3613
|
handleSendMessage(req, res, ctx);
|
|
3326
3614
|
return true;
|
|
3327
3615
|
}
|
|
3616
|
+
// M-3293 (#4119): "Tell" — an Office pat or feed, for the agent's next real message (never a turn, never a wake). The
|
|
3617
|
+
// Office is an admin's (decision 7933bf90: over the public link too), as the archive's reads: a guest (no Office) or a
|
|
3618
|
+
// read-only session is refused; a registered instance; a person (a session revoked meanwhile: 401).
|
|
3619
|
+
if (method === "POST" && path === "/ui/office-tell") {
|
|
3620
|
+
const admission = adminAdmissionOf(req, url, ctx);
|
|
3621
|
+
if (!admission || guestRequestOf(req)) {
|
|
3622
|
+
req.resume();
|
|
3623
|
+
json(res, 403, { error: "admin_only" });
|
|
3624
|
+
return true;
|
|
3625
|
+
}
|
|
3626
|
+
(async () => {
|
|
3627
|
+
let raw;
|
|
3628
|
+
try {
|
|
3629
|
+
raw = await parseBody(req);
|
|
3630
|
+
}
|
|
3631
|
+
catch {
|
|
3632
|
+
json(res, 400, { error: "Invalid JSON" });
|
|
3633
|
+
return;
|
|
3634
|
+
}
|
|
3635
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
3636
|
+
return;
|
|
3637
|
+
// Fable #4130: still that admin once the body is in (a session demoted meanwhile queues nothing), as the other admin POSTs.
|
|
3638
|
+
if (adminAdmissionOf(req, url, ctx) !== admission || guestRequestOf(req)) {
|
|
3639
|
+
json(res, 403, { error: "admin_only" });
|
|
3640
|
+
return;
|
|
3641
|
+
}
|
|
3642
|
+
const b = raw;
|
|
3643
|
+
const instance = typeof b?.instance === "string" ? b.instance : "", kind = b?.kind;
|
|
3644
|
+
if (!instance || instance.length > 128 || !safeInstanceSegment(instance) || (kind !== "pat" && kind !== "feed")) {
|
|
3645
|
+
json(res, 400, { error: "instance and kind (pat or feed) required" });
|
|
3646
|
+
return;
|
|
3647
|
+
}
|
|
3648
|
+
if (!registeredChatInstance(ctx, instance) && !ctx.instanceIpcClients.has(instance)) {
|
|
3649
|
+
json(res, 404, { error: `Instance not found: ${instance}` });
|
|
3650
|
+
return;
|
|
3651
|
+
}
|
|
3652
|
+
const person = webPersonOf(req, new URL(req.url ?? "/", "http://localhost"), ctx);
|
|
3653
|
+
if (!person) {
|
|
3654
|
+
json(res, 401, { error: WEB_TOKEN_INVALID_MESSAGE });
|
|
3655
|
+
return;
|
|
3656
|
+
}
|
|
3657
|
+
json(res, 200, { queued: ctx.officeTell?.(instance, person.name, kind) ?? false });
|
|
3658
|
+
})();
|
|
3659
|
+
return true;
|
|
3660
|
+
}
|
|
3328
3661
|
// ── Files (C2): upload one file for an instance; fetch a file by the id the fleet issued for it ──
|
|
3329
3662
|
if (method === "POST" && path === "/ui/upload") {
|
|
3330
3663
|
handleUpload(req, res, url, ctx);
|
|
@@ -3334,11 +3667,12 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3334
3667
|
if (method === "GET" && fileMatch) {
|
|
3335
3668
|
const id = fileMatch[1];
|
|
3336
3669
|
// #1920: a guest gets a file only when its stored instance is in scope — "no such file" otherwise, like an unknown id
|
|
3337
|
-
// (an id from another instance's chat is useless).
|
|
3670
|
+
// (an id from another instance's chat is useless). M-3281: never an archived message's kept file (the archive is an
|
|
3671
|
+
// admin's: a guest cannot scroll back to it).
|
|
3338
3672
|
const guest = guestRequestOf(req);
|
|
3339
3673
|
if (guest) {
|
|
3340
3674
|
const served = isFileId(id) ? ctx.webFiles?.servedFile?.(id) ?? null : null;
|
|
3341
|
-
if (!served || !guest.scope().has(served.instance)) {
|
|
3675
|
+
if (!served || served.kept || !guest.scope().has(served.instance)) {
|
|
3342
3676
|
json(res, 404, { error: "No such file" });
|
|
3343
3677
|
return true;
|
|
3344
3678
|
}
|
|
@@ -3418,10 +3752,6 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3418
3752
|
json(res, 404, { error: "Themes are not kept on this fleet" });
|
|
3419
3753
|
return true;
|
|
3420
3754
|
}
|
|
3421
|
-
if (gatewayRequestContext(req)) {
|
|
3422
|
-
json(res, 403, { error: "theme_not_over_public_link" });
|
|
3423
|
-
return true;
|
|
3424
|
-
}
|
|
3425
3755
|
let name;
|
|
3426
3756
|
try {
|
|
3427
3757
|
name = decodeURIComponent(themeWrite[1]);
|
|
@@ -3479,6 +3809,103 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3479
3809
|
});
|
|
3480
3810
|
return true;
|
|
3481
3811
|
}
|
|
3812
|
+
// ── M-3271: pinned chat messages (web-pins.json, web-pin-store.ts) ──
|
|
3813
|
+
// GET /ui/pins?instance=<name>: { rev, pins } (newest first). POST /ui/pins/<instance> { pin: "<boot>-<id>" } or
|
|
3814
|
+
// { unpin: "<boot>-<id>" }: { rev, pins }; the copy is taken from the host's chat history, never the page's words.
|
|
3815
|
+
// Admins only, as preference writes (prefsViewer: an admin session, or the CLI token): a guest gets none. M-3278
|
|
3816
|
+
// (decision 7933bf90): the public link's admin session reads and writes them too. A change: an SSE `pins`
|
|
3817
|
+
// frame { instance, rev } (never a guest's: guestFrameData denies it) — every open admin page reads again.
|
|
3818
|
+
if ((path === "/ui/pins" && method === "GET") || (method === "POST" && /^\/ui\/pins\/[^/]+$/.test(path))) {
|
|
3819
|
+
const store = ctx.pinStore;
|
|
3820
|
+
if (!store) {
|
|
3821
|
+
json(res, 404, { error: "Pins are not kept on this fleet" });
|
|
3822
|
+
return true;
|
|
3823
|
+
}
|
|
3824
|
+
if (guestRequestOf(req)) {
|
|
3825
|
+
json(res, 403, { error: "pins_admin_only" });
|
|
3826
|
+
return true;
|
|
3827
|
+
}
|
|
3828
|
+
const refuse = (viewer) => json(res, viewer ? 403 : 401, { error: viewer ? "pins_admin_only" : WEB_TOKEN_INVALID_MESSAGE });
|
|
3829
|
+
const first = prefsViewer(req, url, ctx);
|
|
3830
|
+
if (!first?.canWrite) {
|
|
3831
|
+
refuse(first);
|
|
3832
|
+
return true;
|
|
3833
|
+
}
|
|
3834
|
+
if (method === "GET") {
|
|
3835
|
+
const name = url.searchParams.get("instance") ?? "";
|
|
3836
|
+
if (!name || !ctx.isKnownInstance?.(name)) {
|
|
3837
|
+
json(res, 404, { error: "unknown instance" });
|
|
3838
|
+
return true;
|
|
3839
|
+
}
|
|
3840
|
+
res.setHeader("Cache-Control", "private, no-store");
|
|
3841
|
+
json(res, 200, { rev: store.rev(), pins: store.list(name), readable: store.readable() });
|
|
3842
|
+
return true;
|
|
3843
|
+
}
|
|
3844
|
+
let name;
|
|
3845
|
+
try {
|
|
3846
|
+
name = decodeURIComponent(path.slice("/ui/pins/".length));
|
|
3847
|
+
}
|
|
3848
|
+
catch {
|
|
3849
|
+
json(res, 400, { error: "instance" });
|
|
3850
|
+
return true;
|
|
3851
|
+
}
|
|
3852
|
+
(async () => {
|
|
3853
|
+
let body;
|
|
3854
|
+
try {
|
|
3855
|
+
body = await parseBody(req);
|
|
3856
|
+
}
|
|
3857
|
+
catch {
|
|
3858
|
+
json(res, 400, { error: "Invalid JSON" });
|
|
3859
|
+
return;
|
|
3860
|
+
}
|
|
3861
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
3862
|
+
return;
|
|
3863
|
+
const now = prefsViewer(req, url, ctx);
|
|
3864
|
+
if (!now?.canWrite) {
|
|
3865
|
+
refuse(now);
|
|
3866
|
+
return;
|
|
3867
|
+
}
|
|
3868
|
+
if (now.person !== first.person || now.epoch !== first.epoch || now.via !== first.via) {
|
|
3869
|
+
json(res, 409, { error: "pins_person_changed" });
|
|
3870
|
+
return;
|
|
3871
|
+
}
|
|
3872
|
+
if (!ctx.isKnownInstance?.(name)) {
|
|
3873
|
+
json(res, 404, { error: "unknown instance" });
|
|
3874
|
+
return;
|
|
3875
|
+
}
|
|
3876
|
+
const asked = body && typeof body === "object" && !Array.isArray(body) ? body : {};
|
|
3877
|
+
const pinKey = parsePinKey(asked.pin), unpinKey = parsePinKey(asked.unpin);
|
|
3878
|
+
if (!pinKey === !unpinKey) {
|
|
3879
|
+
json(res, 400, { error: "pin or unpin: one message key" });
|
|
3880
|
+
return;
|
|
3881
|
+
}
|
|
3882
|
+
let r;
|
|
3883
|
+
if (pinKey) {
|
|
3884
|
+
const row = ctx.webChatHistory?.find(name, pinKey.boot, pinKey.id);
|
|
3885
|
+
if (!row) {
|
|
3886
|
+
json(res, 404, { error: "pin_message_gone" });
|
|
3887
|
+
return;
|
|
3888
|
+
}
|
|
3889
|
+
r = store.pin(name, row);
|
|
3890
|
+
}
|
|
3891
|
+
else
|
|
3892
|
+
r = store.unpin(name, asked.unpin);
|
|
3893
|
+
if (!r.ok) {
|
|
3894
|
+
json(res, r.status, { error: r.error });
|
|
3895
|
+
return;
|
|
3896
|
+
}
|
|
3897
|
+
if (r.changed)
|
|
3898
|
+
ctx.emitSseEvent("pins", { instance: name, rev: r.rev });
|
|
3899
|
+
json(res, 200, { rev: r.rev, pins: r.pins });
|
|
3900
|
+
})().catch(err => {
|
|
3901
|
+
ctx.logger.error({ err: err.message }, "Pinning a message failed");
|
|
3902
|
+
try {
|
|
3903
|
+
json(res, 500, { error: "Pinning failed" });
|
|
3904
|
+
}
|
|
3905
|
+
catch { /* already answered */ }
|
|
3906
|
+
});
|
|
3907
|
+
return true;
|
|
3908
|
+
}
|
|
3482
3909
|
// ── Fleet → Org chart → Office: the offices people made (web-offices.json, web-office-store.ts) ──
|
|
3483
3910
|
// GET /ui/offices: { rev, offices, readable } for whoever may open the org chart (the public link too: it reads the
|
|
3484
3911
|
// chart; a guest's routes do not include it). PUT /ui/offices { offices, rev? }: a person's change, as a theme's reset
|
|
@@ -3499,10 +3926,6 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3499
3926
|
json(res, 404, { error: "Offices are not kept on this fleet" });
|
|
3500
3927
|
return true;
|
|
3501
3928
|
}
|
|
3502
|
-
if (gatewayRequestContext(req)) {
|
|
3503
|
-
json(res, 403, { error: "offices_not_over_public_link" });
|
|
3504
|
-
return true;
|
|
3505
|
-
}
|
|
3506
3929
|
// The person (an admin session's account), or the status that refuses the request.
|
|
3507
3930
|
const who = () => {
|
|
3508
3931
|
const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
@@ -3614,7 +4037,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3614
4037
|
return true;
|
|
3615
4038
|
}
|
|
3616
4039
|
const detail = () => ctx.fleetConfig?.web?.usage_panel !== false
|
|
3617
|
-
&& (!gatewayRequestContext(req) ||
|
|
4040
|
+
&& (!gatewayRequestContext(req) || linkUsageOffered(req, url, ctx));
|
|
3618
4041
|
void import("./office-levels.js").then(async ({ LEVEL, levelsFor }) => {
|
|
3619
4042
|
const levels = await ctx.officeLevels();
|
|
3620
4043
|
// Asked again before it is sent (it was awaited): a session signed out or a switch turned off meanwhile.
|
|
@@ -3730,7 +4153,16 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3730
4153
|
json(res, 400, { error: "instance, nonce and action required" });
|
|
3731
4154
|
return;
|
|
3732
4155
|
}
|
|
3733
|
-
const
|
|
4156
|
+
const needsHuman = ctx.webPromptNeedsHuman?.(nonce) === true;
|
|
4157
|
+
if (needsHuman) {
|
|
4158
|
+
const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
4159
|
+
if (verdict.kind !== "allow" || verdict.via !== "session" || verdict.session.tier !== "admin") {
|
|
4160
|
+
json(res, 403, { error: "This decision needs a signed-in administrator" });
|
|
4161
|
+
return;
|
|
4162
|
+
}
|
|
4163
|
+
}
|
|
4164
|
+
const r = needsHuman ? await click(instance, nonce, action, text, true)
|
|
4165
|
+
: text === undefined ? await click(instance, nonce, action) : await click(instance, nonce, action, text);
|
|
3734
4166
|
// 409: answered elsewhere first, expired, or never open — the page drops the buttons on `gone`.
|
|
3735
4167
|
json(res, r.status, r.status === 200 ? { answered: true } : { error: r.error ?? "Refused", ...(r.status === 409 ? { gone: true } : {}) });
|
|
3736
4168
|
})().catch(err => {
|
|
@@ -3897,10 +4329,6 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3897
4329
|
saveGuestPrefs(req, res, ctx, prefs, guest);
|
|
3898
4330
|
return true;
|
|
3899
4331
|
}
|
|
3900
|
-
if (gatewayRequestContext(req)) {
|
|
3901
|
-
json(res, 403, { error: "prefs_not_over_public_link" });
|
|
3902
|
-
return true;
|
|
3903
|
-
}
|
|
3904
4332
|
const refuse = (viewer) => json(res, viewer ? 403 : 401, { error: viewer ? "prefs_read_only" : WEB_TOKEN_INVALID_MESSAGE });
|
|
3905
4333
|
const first = prefsViewer(req, url, ctx);
|
|
3906
4334
|
if (!first?.canWrite) {
|
|
@@ -3960,9 +4388,17 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3960
4388
|
return true;
|
|
3961
4389
|
}
|
|
3962
4390
|
// #1629 r4 §3: owner CSS — one person's own stylesheet, for their own screens. Every route is a signed-in human's
|
|
3963
|
-
// session: never the CLI's header token (no person, and the way an agent could reach it)
|
|
3964
|
-
//
|
|
4391
|
+
// session: never the CLI's header token (no person, and the way an agent could reach it); M-3278: the public link's
|
|
4392
|
+
// sessions too, as locally. The stylesheet and its assets are that session's
|
|
3965
4393
|
// person's only: no name or identity in any URL.
|
|
4394
|
+
// M-3278 (Fable on #4107, N1): owner CSS, AgEnD's update and mods over the public link are an admin session's only —
|
|
4395
|
+
// a guest or read-only session there is answered as the gateway answered it before (not found).
|
|
4396
|
+
const linkPrivileged = path === "/ui/owner-css.css" || path === "/ui/owner-css" || path.startsWith("/ui/owner-css/")
|
|
4397
|
+
|| path === "/ui/update" || path.startsWith("/ui/update/") || path === "/ui/mods" || path.startsWith("/ui/mods/");
|
|
4398
|
+
if (linkPrivileged && linkRestricted(req, url, ctx)) {
|
|
4399
|
+
json(res, 404, { error: "not_found" });
|
|
4400
|
+
return true;
|
|
4401
|
+
}
|
|
3966
4402
|
if (path === "/ui/owner-css.css" || path === "/ui/owner-css" || path.startsWith("/ui/owner-css/")) {
|
|
3967
4403
|
return handleOwnerCss(req, res, url, ctx, path, method);
|
|
3968
4404
|
}
|
|
@@ -3971,7 +4407,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3971
4407
|
return handleAppIcon(req, res, url, ctx, method);
|
|
3972
4408
|
if (path === "/ui/update" || path.startsWith("/ui/update/"))
|
|
3973
4409
|
return handleWebUpdate(req, res, url, ctx, path, method);
|
|
3974
|
-
// #1629 r4-5: mods — a person's import, uninstall and export (handleMods: sessions only
|
|
4410
|
+
// #1629 r4-5: mods — a person's import, uninstall and export (handleMods: sessions only; M-3278: the public link's too).
|
|
3975
4411
|
if (path === "/ui/mods" || path.startsWith("/ui/mods/"))
|
|
3976
4412
|
return handleMods(req, res, url, ctx, path, method);
|
|
3977
4413
|
// #2233: backend sign-in — absent from the public manifest and the guest table, and refused here too.
|
|
@@ -3979,11 +4415,13 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3979
4415
|
return handleBrowserBackendSignIns(req, res, url, ctx);
|
|
3980
4416
|
if (path === "/ui/backend-login" || path.startsWith("/ui/backend-login/"))
|
|
3981
4417
|
return handleBackendLogin(req, res, url, ctx, path, method);
|
|
3982
|
-
if (path === "/ui/host-install" || path === "/ui/host-install/cancel" || path
|
|
4418
|
+
if (path === "/ui/host-install" || path === "/ui/host-install/cancel" || HOST_CLI_PATHS.has(path))
|
|
3983
4419
|
return handleHostInstall(req, res, url, ctx, path, method);
|
|
3984
4420
|
// #3292: before the accounts prefix — its Add pattern (`POST /ui/accounts/<backend>`) would read "keep-alive" as a backend.
|
|
3985
4421
|
if (path === "/ui/accounts/keep-alive")
|
|
3986
4422
|
return handleAccountKeepAlive(req, res, url, ctx, method);
|
|
4423
|
+
if (handleClaudeCredentials(req, res, url, ctx))
|
|
4424
|
+
return true;
|
|
3987
4425
|
if (path.startsWith("/ui/accounts/"))
|
|
3988
4426
|
return handleAccountWrite(req, res, url, ctx, path, method);
|
|
3989
4427
|
// #1386: Acknowledge a "Needs you" delivery item — a session write (CSRF, checked by the gate) or the CLI's header
|
|
@@ -4043,10 +4481,6 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4043
4481
|
return true;
|
|
4044
4482
|
}
|
|
4045
4483
|
if (method === "POST" && (path === "/ui/outside/enroll" || path === "/ui/outside/enroll/confirm" || path === "/ui/outside/remove" || path === "/ui/outside/switch" || path === "/ui/outside/strict")) {
|
|
4046
|
-
if (gatewayRequestContext(req)) {
|
|
4047
|
-
json(res, 403, { error: "outside_not_here" });
|
|
4048
|
-
return true;
|
|
4049
|
-
}
|
|
4050
4484
|
(async () => {
|
|
4051
4485
|
let body;
|
|
4052
4486
|
try {
|
|
@@ -4184,10 +4618,6 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4184
4618
|
// menu's 確定關閉 does (its remembered owner forgotten, so auto_open never reopens a deliberate close). A web-only fleet's
|
|
4185
4619
|
// outside link is the owner's switch on this computer (#3008): 409 outside_link, left open.
|
|
4186
4620
|
if (method === "POST" && path === "/ui/public-link/close") {
|
|
4187
|
-
if (gatewayRequestContext(req)) {
|
|
4188
|
-
json(res, 403, { error: "public_link_close_not_here" });
|
|
4189
|
-
return true;
|
|
4190
|
-
}
|
|
4191
4621
|
const act = ctx.closePublicLinkFromWeb?.bind(ctx);
|
|
4192
4622
|
if (!act) {
|
|
4193
4623
|
json(res, 404, { error: "not_found" });
|
|
@@ -4213,6 +4643,16 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4213
4643
|
return;
|
|
4214
4644
|
}
|
|
4215
4645
|
res.setHeader("Cache-Control", "no-store");
|
|
4646
|
+
// M-3278: closed over the link itself, the close ends the very connection this answer would travel on — so the
|
|
4647
|
+
// answer goes first (202), then the link closes; a refusal (an outside-owned link, say) is logged.
|
|
4648
|
+
if (gatewayRequestContext(req)) {
|
|
4649
|
+
json(res, 202, { ok: true, closing: true });
|
|
4650
|
+
setImmediate(() => {
|
|
4651
|
+
void act().then(r => { if (r.status >= 300)
|
|
4652
|
+
ctx.logger.info({ status: r.status, body: r.body }, "Public link close over the link refused"); }, err => ctx.logger.error({ err: err.message }, "Public link close failed"));
|
|
4653
|
+
});
|
|
4654
|
+
return;
|
|
4655
|
+
}
|
|
4216
4656
|
const r = await act();
|
|
4217
4657
|
json(res, r.status, r.body);
|
|
4218
4658
|
})().catch(err => {
|
|
@@ -4304,6 +4744,35 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4304
4744
|
});
|
|
4305
4745
|
return true;
|
|
4306
4746
|
}
|
|
4747
|
+
// M-3632: Needs you → "Try again" on held Hub work: back through the Hub's checks, never a blind delivery.
|
|
4748
|
+
if (method === "POST" && path === "/ui/needs/hub-retry") {
|
|
4749
|
+
if (!ctx.retryHubHeld) {
|
|
4750
|
+
json(res, 404, { error: "not-found", code: "not-found" });
|
|
4751
|
+
return true;
|
|
4752
|
+
}
|
|
4753
|
+
const retry = ctx.retryHubHeld.bind(ctx);
|
|
4754
|
+
(async () => {
|
|
4755
|
+
let body;
|
|
4756
|
+
try {
|
|
4757
|
+
body = await parseBody(req);
|
|
4758
|
+
}
|
|
4759
|
+
catch {
|
|
4760
|
+
json(res, 400, { error: "Invalid JSON" });
|
|
4761
|
+
return;
|
|
4762
|
+
}
|
|
4763
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
4764
|
+
return;
|
|
4765
|
+
const id = body && typeof body === "object" ? body.id : undefined;
|
|
4766
|
+
if (typeof id !== "string" || id.length > 200) {
|
|
4767
|
+
json(res, 400, { error: "id required" });
|
|
4768
|
+
return;
|
|
4769
|
+
}
|
|
4770
|
+
const out = retry(id);
|
|
4771
|
+
json(res, out.status, out.status === 200 ? { ok: true, code: out.code } : { error: out.code, code: out.code });
|
|
4772
|
+
})().catch(() => { if (!res.headersSent)
|
|
4773
|
+
json(res, 500, { error: "failed" }); });
|
|
4774
|
+
return true;
|
|
4775
|
+
}
|
|
4307
4776
|
if (method === "POST" && path === "/ui/needs/ack") {
|
|
4308
4777
|
if (!ctx.acknowledgeNeedsItem) {
|
|
4309
4778
|
json(res, 404, { error: "Nothing to acknowledge here" });
|
|
@@ -4326,6 +4795,31 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4326
4795
|
json(res, 400, { error: "id required" });
|
|
4327
4796
|
return;
|
|
4328
4797
|
}
|
|
4798
|
+
if (id.startsWith("contact-suggest:")) {
|
|
4799
|
+
try {
|
|
4800
|
+
if (ctx.acknowledgeContactSuggestionFromWeb)
|
|
4801
|
+
ctx.acknowledgeContactSuggestionFromWeb(id.slice("contact-suggest:".length), req, url);
|
|
4802
|
+
else {
|
|
4803
|
+
const actor = ctx.contactActor?.(req, url);
|
|
4804
|
+
if (!actor || !ctx.acknowledgeContactSuggestion)
|
|
4805
|
+
throw Error("verification-required");
|
|
4806
|
+
ctx.acknowledgeContactSuggestion(id.slice("contact-suggest:".length), actor);
|
|
4807
|
+
}
|
|
4808
|
+
json(res, 200, { acknowledged: true });
|
|
4809
|
+
}
|
|
4810
|
+
catch (err) {
|
|
4811
|
+
const code = err instanceof Error ? err.message : "";
|
|
4812
|
+
if (code === "forbidden" || code === "verification-required")
|
|
4813
|
+
json(res, 403, { error: code, code });
|
|
4814
|
+
else {
|
|
4815
|
+
const raw = err && typeof err === "object" ? err.code : undefined;
|
|
4816
|
+
const cause = typeof raw === "string" && /^[A-Z][A-Z0-9_]{1,48}$/.test(raw) ? raw : "unknown";
|
|
4817
|
+
ctx.logger.error({ code: cause }, "Contact suggestion dismissal could not be saved");
|
|
4818
|
+
json(res, 503, { error: "unavailable", code: "unavailable" });
|
|
4819
|
+
}
|
|
4820
|
+
}
|
|
4821
|
+
return;
|
|
4822
|
+
}
|
|
4329
4823
|
const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
4330
4824
|
if (verdict.kind !== "allow") {
|
|
4331
4825
|
json(res, 401, { error: WEB_TOKEN_INVALID_MESSAGE });
|
|
@@ -4506,7 +5000,10 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4506
5000
|
}
|
|
4507
5001
|
try {
|
|
4508
5002
|
const { authority } = confirmAfterBody(arrival, webAuthorityOf(req, url, ctx, instance));
|
|
4509
|
-
const r = await run({ instance, command, args: str(body.args, MAX_COMMAND_ARGS), confirm: body.confirm, ...(body.action ? { action: body.action } : {}) },
|
|
5003
|
+
const r = await run({ instance, command, args: str(body.args, MAX_COMMAND_ARGS), confirm: body.confirm, ...(body.action ? { action: body.action } : {}) },
|
|
5004
|
+
// M-3278 (decision 7933bf90): `publicLink` is a request over the link by anyone but an admin session — the link's
|
|
5005
|
+
// admin runs /save and gets /model and /backend's Sign in, as on the local dashboard.
|
|
5006
|
+
{ publicLink: !!gatewayRequestContext(req) && !adminAdmissionOf(req, url, ctx), person, authority, ...(guest ? { guest: true } : {}) });
|
|
4510
5007
|
if (!stillAuthorized(req, res, url, ctx))
|
|
4511
5008
|
return;
|
|
4512
5009
|
json(res, r.status, r.body);
|
|
@@ -4708,6 +5205,8 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4708
5205
|
effort_source,
|
|
4709
5206
|
statusline,
|
|
4710
5207
|
recent_activity: instanceActivity.slice(0, 20),
|
|
5208
|
+
// M-3522: the files the agent's CLI loads every session and their sizes (stat only), for the Details card.
|
|
5209
|
+
...(room ? {} : { instruction_files: instructionFileSizes(config, backend) }),
|
|
4711
5210
|
});
|
|
4712
5211
|
return true;
|
|
4713
5212
|
}
|
|
@@ -4792,9 +5291,10 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4792
5291
|
json(res, 200, { tasks });
|
|
4793
5292
|
return true;
|
|
4794
5293
|
}
|
|
4795
|
-
//
|
|
4796
|
-
if (method === "POST" && (path === "/ui/tasks" || /^\/ui\/tasks\/[^/]+$/.test(path)) &&
|
|
4797
|
-
|
|
5294
|
+
// M-3278: the old task list's writes are an admin session's too (a read-only session reads), on any listener.
|
|
5295
|
+
if (method === "POST" && (path === "/ui/tasks" || /^\/ui\/tasks\/[^/]+$/.test(path)) && !path.startsWith("/ui/tasks/cards") && !path.startsWith("/ui/tasks/projects")
|
|
5296
|
+
&& !adminAdmissionOf(req, url, ctx)) {
|
|
5297
|
+
json(res, 403, { error: "task_board_needs_an_admin_session", code: "forbidden", key: "needs_admin" });
|
|
4798
5298
|
return true;
|
|
4799
5299
|
}
|
|
4800
5300
|
if (method === "POST" && path === "/ui/tasks") {
|
|
@@ -4830,17 +5330,18 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4830
5330
|
}
|
|
4831
5331
|
// ── Task board (scheduler/task-board.ts) ──────────────
|
|
4832
5332
|
// Reads are the session's; every write is the signed-in person's, through the same rules an instance's tools use.
|
|
4833
|
-
if (path === "/ui/tasks/board" || path === "/ui/tasks/search" || path === "/ui/tasks/work" || path.startsWith("/ui/tasks/cards") || path.startsWith("/ui/tasks/projects")) {
|
|
5333
|
+
if (path === "/ui/tasks/board" || path === "/ui/tasks/search" || path === "/ui/tasks/refs" || path === "/ui/tasks/work" || path.startsWith("/ui/tasks/cards") || path.startsWith("/ui/tasks/projects")) {
|
|
4834
5334
|
const board = ctx.scheduler?.db.board;
|
|
4835
5335
|
if (!board) {
|
|
4836
5336
|
json(res, 503, { error: "The task board is not available", code: "unavailable", key: "unavailable" });
|
|
4837
5337
|
return true;
|
|
4838
5338
|
}
|
|
4839
|
-
//
|
|
4840
|
-
//
|
|
4841
|
-
const gateway =
|
|
4842
|
-
|
|
4843
|
-
|
|
5339
|
+
// M-3278 (decision 7933bf90): an admin session changes the board over the public link too, as itself (boardActor), and
|
|
5340
|
+
// sees it whole; a read-only session over the link keeps the link's hiding.
|
|
5341
|
+
const gateway = linkRestricted(req, url, ctx);
|
|
5342
|
+
// A write is an admin session's (or the CLI's header token): a read-only session reads the board, on any listener.
|
|
5343
|
+
if (method !== "GET" && !adminAdmissionOf(req, url, ctx)) {
|
|
5344
|
+
json(res, 403, { error: "task_board_needs_an_admin_session", code: "forbidden", key: "needs_admin" });
|
|
4844
5345
|
return true;
|
|
4845
5346
|
}
|
|
4846
5347
|
// …nor shows the cards of instances kept out of sight (cross_instance_visibility: hidden).
|
|
@@ -4851,15 +5352,72 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4851
5352
|
const scope = { leaveOutAuthors: gateway ? Object.keys(ctx.fleetConfig?.instances ?? {}).filter(hiddenName) : [] };
|
|
4852
5353
|
const hiddenRef = (ref) => { const c = ref ? board.findCard(ref) : undefined; return !!c && hidden(c); };
|
|
4853
5354
|
const mentionsHidden = (v) => (typeof v === "string" ? hiddenName(v) : !!v && typeof v === "object" && Object.values(v).some(mentionsHidden));
|
|
5355
|
+
// A main task kept out of sight is not numbered by its sub tasks either — a card's `parentId`, and the `parent`
|
|
5356
|
+
// of its "created" event, read as none over the link (the card number alone says a main task is there).
|
|
5357
|
+
// Nor is a card kept out of sight numbered anywhere else a card number is read: a card's `dependsOn` and
|
|
5358
|
+
// `unmetDeps` (a number kept out of the list), the `dependsOn` of an "updated" event's `changes` (kept out of both its
|
|
5359
|
+
// lists; a change that is then the same on both sides is not shown, nor an event with no change left), and the
|
|
5360
|
+
// `cascade` / `restored` of a sub task's "moved" event (the main task it was taken down with). Each number is looked up
|
|
5361
|
+
// once per request, whatever the number of cards that name it.
|
|
5362
|
+
const hiddenCodes = new Map();
|
|
5363
|
+
const hiddenCode = (code) => { let h = hiddenCodes.get(code); if (h === undefined) {
|
|
5364
|
+
h = hiddenRef(code);
|
|
5365
|
+
hiddenCodes.set(code, h);
|
|
5366
|
+
} return h; };
|
|
5367
|
+
// …`hiddenUnmet` (over the link only) says how many of the unfinished dependencies were left out, so a card that waits for
|
|
5368
|
+
// a card kept out of sight still reads as waiting (a clock, not "ready"): how many, never which.
|
|
5369
|
+
const unnumbered = (v) => {
|
|
5370
|
+
if (!gateway)
|
|
5371
|
+
return v;
|
|
5372
|
+
const parentId = v.parentId && hiddenCode(v.parentId) ? null : v.parentId;
|
|
5373
|
+
const dependsOn = v.dependsOn.filter((c) => !hiddenCode(c));
|
|
5374
|
+
const unmetDeps = v.unmetDeps.filter((c) => !hiddenCode(c));
|
|
5375
|
+
return { ...v, parentId, dependsOn, unmetDeps, hiddenUnmet: v.unmetDeps.length - unmetDeps.length };
|
|
5376
|
+
};
|
|
5377
|
+
const numbered = (v) => (Array.isArray(v) ? v.filter((c) => typeof c !== "string" || !hiddenCode(c)) : v);
|
|
5378
|
+
/** An event as the link may read it; null when nothing of it is left to show. */
|
|
5379
|
+
const unnumberedEvent = (e) => {
|
|
5380
|
+
const data = e.data;
|
|
5381
|
+
if (!data || typeof data !== "object")
|
|
5382
|
+
return e;
|
|
5383
|
+
if (e.type === "created")
|
|
5384
|
+
return typeof data.parent === "string" && hiddenCode(data.parent) ? { ...e, data: { ...data, parent: null } } : e;
|
|
5385
|
+
if (e.type === "moved") {
|
|
5386
|
+
const gone = ["cascade", "restored"].filter((k) => typeof data[k] === "string" && hiddenCode(data[k]));
|
|
5387
|
+
if (!gone.length)
|
|
5388
|
+
return e;
|
|
5389
|
+
const rest = { ...data };
|
|
5390
|
+
for (const k of gone)
|
|
5391
|
+
delete rest[k];
|
|
5392
|
+
return { ...e, data: rest };
|
|
5393
|
+
}
|
|
5394
|
+
if (e.type === "updated" && data.changes && typeof data.changes === "object") {
|
|
5395
|
+
const { dependsOn, ...others } = data.changes;
|
|
5396
|
+
const dep = dependsOn && typeof dependsOn === "object" ? dependsOn : null;
|
|
5397
|
+
if (!dep)
|
|
5398
|
+
return e;
|
|
5399
|
+
const from = numbered(dep.from), to = numbered(dep.to);
|
|
5400
|
+
if (JSON.stringify(from) === JSON.stringify(dep.from) && JSON.stringify(to) === JSON.stringify(dep.to))
|
|
5401
|
+
return e;
|
|
5402
|
+
const changes = JSON.stringify(from) === JSON.stringify(to) ? others : { ...others, dependsOn: { ...dep, from, to } };
|
|
5403
|
+
return Object.keys(changes).length ? { ...e, data: { ...data, changes } } : null;
|
|
5404
|
+
}
|
|
5405
|
+
return e;
|
|
5406
|
+
};
|
|
4854
5407
|
const shown = (d) => !gateway ? d : {
|
|
4855
5408
|
...d,
|
|
5409
|
+
card: unnumbered(d.card),
|
|
4856
5410
|
parent: d.card.parentId && hiddenRef(d.card.parentId) ? null : d.parent,
|
|
4857
|
-
children: d.children.filter((c) => !hidden(c)),
|
|
5411
|
+
children: d.children.filter((c) => !hidden(c)).map(unnumbered),
|
|
5412
|
+
watchers: d.watchers.filter((n) => !hiddenName(n)),
|
|
5413
|
+
// A main task kept out of sight is not named here either: its watchers go with it (the `parent` above reads as none).
|
|
5414
|
+
inheritedWatchers: d.card.parentId && hiddenRef(d.card.parentId) ? [] : d.inheritedWatchers.filter((n) => !hiddenName(n)),
|
|
5415
|
+
leader: d.leader && hiddenName(d.leader.name) ? null : d.leader, // as a project's hidden lead: read as none
|
|
4858
5416
|
comments: d.comments.filter((e) => !hiddenName(e.author)),
|
|
4859
5417
|
logs: d.logs.filter((e) => !hiddenName(e.author)),
|
|
4860
|
-
history: d.history.filter((e) => !hiddenName(e.actor) && !mentionsHidden(e.data)),
|
|
5418
|
+
history: d.history.filter((e) => !hiddenName(e.actor) && !mentionsHidden(e.data)).flatMap((e) => unnumberedEvent(e) ?? []),
|
|
4861
5419
|
};
|
|
4862
|
-
const card = /^\/ui\/tasks\/cards\/([^/]+)(?:\/(move|reorder))?$/.exec(path);
|
|
5420
|
+
const card = /^\/ui\/tasks\/cards\/([^/]+)(?:\/(move|reorder|watchers))?$/.exec(path);
|
|
4863
5421
|
const project = /^\/ui\/tasks\/projects\/(\d+)$/.exec(path);
|
|
4864
5422
|
try {
|
|
4865
5423
|
const ref = card ? decodeURIComponent(card[1]) : "";
|
|
@@ -4890,7 +5448,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4890
5448
|
// #2355 review: the names a project's lead may be — the fleet's instances (a Classic-only room is not one); over the
|
|
4891
5449
|
// public link, not a hidden one.
|
|
4892
5450
|
const leads = Object.keys(ctx.fleetConfig?.instances ?? {}).filter((n) => !hiddenName(n)).sort();
|
|
4893
|
-
const body = JSON.stringify({ rev, cards: board.views(cards, scope, ctx.dispatcherGone), projects, leads, boardOff, stats: board.projectStats(ctx.dispatcherGone) });
|
|
5451
|
+
const body = JSON.stringify({ rev, cards: board.views(cards, scope, ctx.dispatcherGone).map(unnumbered), projects, leads, boardOff, stats: board.projectStats(ctx.dispatcherGone) });
|
|
4894
5452
|
if (key)
|
|
4895
5453
|
boardBodies.set(board, { key, body });
|
|
4896
5454
|
jsonText(res, 200, body);
|
|
@@ -4918,7 +5476,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4918
5476
|
for (const c of [...w.doing, ...w.blocked, ...w.review, ...w.ready, ...w.waiting.map((x) => x.card), ...w.mains.map((x) => x.card)])
|
|
4919
5477
|
if (!hidden(c))
|
|
4920
5478
|
all.set(c.uuid, c);
|
|
4921
|
-
const viewOf = new Map(board.views([...all.values()], scope, ctx.dispatcherGone).map((v) => [v.uuid, v]));
|
|
5479
|
+
const viewOf = new Map(board.views([...all.values()], scope, ctx.dispatcherGone).map((v) => [v.uuid, unnumbered(v)]));
|
|
4922
5480
|
const drawn = (cards) => cards.flatMap((c) => (viewOf.has(c.uuid) ? [viewOf.get(c.uuid)] : []));
|
|
4923
5481
|
const codes = (cards) => cards.filter((x) => all.has(x.card.uuid)).map((x) => x.card.code);
|
|
4924
5482
|
const body = JSON.stringify({ instances: works.map(({ name, w }) => ({
|
|
@@ -4935,7 +5493,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4935
5493
|
if (method === "GET" && path === "/ui/tasks/search") {
|
|
4936
5494
|
const names = new Map(board.listProjects(true).map((p) => [p.id, p.name]));
|
|
4937
5495
|
const hits = board.search(url.searchParams.get("q") ?? "", Number(url.searchParams.get("limit")) || 20, scope).filter((h) => !hidden(h.card));
|
|
4938
|
-
const views = board.views(hits.map((h) => h.card), scope, ctx.dispatcherGone);
|
|
5496
|
+
const views = board.views(hits.map((h) => h.card), scope, ctx.dispatcherGone).map(unnumbered);
|
|
4939
5497
|
const results = hits.map(({ card: c, match }, i) => ({
|
|
4940
5498
|
card: views[i],
|
|
4941
5499
|
match,
|
|
@@ -4945,6 +5503,20 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4945
5503
|
json(res, 200, { results });
|
|
4946
5504
|
return true;
|
|
4947
5505
|
}
|
|
5506
|
+
if (method === "GET" && path === "/ui/tasks/refs") {
|
|
5507
|
+
// A card as a chat shows it — number, title, status, who has it — and the cards offered while `#` is typed.
|
|
5508
|
+
// `?codes=M-3,S-4` answers those that are cards (the others are left out, not an error); `?q=` (what follows the `#`,
|
|
5509
|
+
// empty for the latest changes) offers cards. Over the public link, not a card that names a hidden instance.
|
|
5510
|
+
const wanted = url.searchParams.get("codes");
|
|
5511
|
+
if (wanted !== null) {
|
|
5512
|
+
const codes = [...new Set(wanted.split(",").map((c) => cardCode(c.trim().replace(/^#/, ""))).filter((c) => !!c))].slice(0, 50);
|
|
5513
|
+
json(res, 200, { refs: cardsForRefs(board, codes, hidden).map(taskRefView) });
|
|
5514
|
+
return true;
|
|
5515
|
+
}
|
|
5516
|
+
const limit = Number(url.searchParams.get("limit")) || 8;
|
|
5517
|
+
json(res, 200, { refs: board.suggest((url.searchParams.get("q") ?? "").slice(0, 100), limit, (c) => !hidden(c)).map(taskRefView) });
|
|
5518
|
+
return true;
|
|
5519
|
+
}
|
|
4948
5520
|
if (method === "GET" && card && !card[2]) {
|
|
4949
5521
|
const found = board.getCard(ref);
|
|
4950
5522
|
if (hidden(found)) {
|
|
@@ -4968,6 +5540,12 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4968
5540
|
return { card: board.view(moved, {}, ctx.dispatcherGone), notes: said };
|
|
4969
5541
|
});
|
|
4970
5542
|
}
|
|
5543
|
+
else if (card[2] === "watchers") {
|
|
5544
|
+
boardWrite(req, res, url, ctx, board, CardWatchersSchema, (change, person) => {
|
|
5545
|
+
const { card: watched, watchers, said } = board.setWatchers(person, ref, change);
|
|
5546
|
+
return { card: board.view(watched, {}, ctx.dispatcherGone), watchers: watchers.filter((n) => !hiddenName(n)), notes: said };
|
|
5547
|
+
});
|
|
5548
|
+
}
|
|
4971
5549
|
else if (card[2] === "reorder") {
|
|
4972
5550
|
boardWrite(req, res, url, ctx, board, CardReorderSchema, ({ after, before }, person) => ({ card: board.view(board.reorder(person, ref, after ?? null, before ?? null), {}, ctx.dispatcherGone) }));
|
|
4973
5551
|
}
|
|
@@ -5065,10 +5643,6 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5065
5643
|
};
|
|
5066
5644
|
if (method === "POST" && path === "/ui/schedules") {
|
|
5067
5645
|
// #1724: schedules are not created, edited or deleted over the public link (absent from its manifest too, #1689).
|
|
5068
|
-
if (gatewayRequestContext(req)) {
|
|
5069
|
-
json(res, 403, { error: "schedule_not_over_public_link" });
|
|
5070
|
-
return true;
|
|
5071
|
-
}
|
|
5072
5646
|
if (!ctx.scheduler) {
|
|
5073
5647
|
json(res, 500, { error: "Scheduler not initialized" });
|
|
5074
5648
|
return true;
|
|
@@ -5107,10 +5681,6 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5107
5681
|
// #1724: Edit — the update_schedule tool's validation (UpdateScheduleArgs) and its call (scheduler.update): cron and at
|
|
5108
5682
|
// clear each other there; silent is not touched.
|
|
5109
5683
|
if (method === "PATCH" && schedDelMatch) {
|
|
5110
|
-
if (gatewayRequestContext(req)) {
|
|
5111
|
-
json(res, 403, { error: "schedule_not_over_public_link" });
|
|
5112
|
-
return true;
|
|
5113
|
-
}
|
|
5114
5684
|
if (!ctx.scheduler || typeof ctx.scheduler.update !== "function") {
|
|
5115
5685
|
json(res, 500, { error: "Scheduler not initialized" });
|
|
5116
5686
|
return true;
|
|
@@ -5142,8 +5712,10 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5142
5712
|
return true;
|
|
5143
5713
|
}
|
|
5144
5714
|
if (method === "DELETE" && schedDelMatch) {
|
|
5145
|
-
|
|
5146
|
-
|
|
5715
|
+
// Fable on #4100 (F1): a deletion is an admin's (or the CLI token's) as a create or an edit is — never a read-only session's,
|
|
5716
|
+
// on any listener (the link's blanket refusal used to hide that this one never asked).
|
|
5717
|
+
if (scheduleWriterGone()) {
|
|
5718
|
+
json(res, 403, { error: "schedule_needs_an_admin_session" });
|
|
5147
5719
|
return true;
|
|
5148
5720
|
}
|
|
5149
5721
|
if (!ctx.scheduler) {
|
|
@@ -5256,7 +5828,8 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5256
5828
|
const refusal = () => {
|
|
5257
5829
|
if (!ctx.usageReport || ctx.fleetConfig?.web?.usage_panel === false)
|
|
5258
5830
|
return [404, "Not available"];
|
|
5259
|
-
|
|
5831
|
+
// M-3278 (decision 7933bf90): offered to an admin over the public link unless `web.usage_report_on_public_link: false`.
|
|
5832
|
+
if (gatewayRequestContext(req) && !linkUsageOffered(req, url, ctx))
|
|
5260
5833
|
return [403, "usage_report_not_over_public_link"];
|
|
5261
5834
|
return null;
|
|
5262
5835
|
};
|
|
@@ -5318,10 +5891,6 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5318
5891
|
}
|
|
5319
5892
|
if (method === "POST" && path === "/ui/teams") {
|
|
5320
5893
|
// #1689: not over the public link (absent from its manifest too), like editing and deleting a team.
|
|
5321
|
-
if (gatewayRequestContext(req)) {
|
|
5322
|
-
json(res, 403, { error: "teams_not_over_public_link" });
|
|
5323
|
-
return true;
|
|
5324
|
-
}
|
|
5325
5894
|
(async () => {
|
|
5326
5895
|
try {
|
|
5327
5896
|
const body = await parseBody(req);
|
|
@@ -5354,10 +5923,6 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5354
5923
|
// what to add and remove is worked out against the team as it is now. Never over the public link.
|
|
5355
5924
|
const teamEditMatch = path.match(/^\/ui\/teams\/(.+)$/);
|
|
5356
5925
|
if ((method === "PATCH" || method === "PUT") && teamEditMatch) {
|
|
5357
|
-
if (gatewayRequestContext(req)) {
|
|
5358
|
-
json(res, 403, { error: "teams_not_over_public_link" });
|
|
5359
|
-
return true;
|
|
5360
|
-
}
|
|
5361
5926
|
const name = decodeURIComponent(teamEditMatch[1]);
|
|
5362
5927
|
// Who may write, asked again once the body is in (#1693 review): a session revoked or a token rotated meanwhile
|
|
5363
5928
|
// writes nothing.
|
|
@@ -5402,8 +5967,10 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5402
5967
|
}
|
|
5403
5968
|
const teamDelMatch = path.match(/^\/ui\/teams\/(.+)$/);
|
|
5404
5969
|
if (method === "DELETE" && teamDelMatch) {
|
|
5405
|
-
|
|
5406
|
-
|
|
5970
|
+
// Fable on #4100 (F1): an admin's (or the CLI token's) on any listener, as creating and editing a team.
|
|
5971
|
+
const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
5972
|
+
if (v.kind !== "allow" || (v.via === "session" && v.session?.tier !== "admin")) {
|
|
5973
|
+
json(res, 403, { error: "teams_need_an_admin_session" });
|
|
5407
5974
|
return true;
|
|
5408
5975
|
}
|
|
5409
5976
|
const name = decodeURIComponent(teamDelMatch[1]);
|
|
@@ -5525,7 +6092,7 @@ function webDeliveryFailure(err) {
|
|
|
5525
6092
|
if (/No warm slot is free/.test(message))
|
|
5526
6093
|
return { reason: "wake_capacity", error: "No slot is free to wake this instance. Retry when another instance is idle." };
|
|
5527
6094
|
if (/login|log in|sign in|\bauth(?:entication|orization)?\b|credential|api.?key/i.test(message))
|
|
5528
|
-
return { reason: "wake_credentials", error: "The instance could not sign in. Connect its AI account in Settings →
|
|
6095
|
+
return { reason: "wake_credentials", error: "The instance could not sign in. Connect its AI account in Settings → AI accounts & keys → Accounts, or send /login in chat, then retry." };
|
|
5529
6096
|
if (/timed? out|timeout/i.test(message))
|
|
5530
6097
|
return { reason: "wake_timeout", error: "The instance did not become ready in time. Retry, or check its status in Fleet." };
|
|
5531
6098
|
if (/Cannot wake stopped|no longer configured/.test(message))
|
|
@@ -5541,6 +6108,158 @@ function webSendDedupeOf(ctx) {
|
|
|
5541
6108
|
webSendDedupes.set(ctx, d = new WebSendDedupe());
|
|
5542
6109
|
return d;
|
|
5543
6110
|
}
|
|
6111
|
+
/** Resend only retained server content, with one new attempt on the same bubble. */
|
|
6112
|
+
async function handleResendMessage(req, res, ctx) {
|
|
6113
|
+
const url = new URL(req.url ?? "/", "http://localhost"), arrival = webAuthorityOf(req, url, ctx);
|
|
6114
|
+
let raw;
|
|
6115
|
+
try {
|
|
6116
|
+
raw = JSON.parse((await readBoundedWebBody(req, 8192)).toString("utf8"));
|
|
6117
|
+
}
|
|
6118
|
+
catch {
|
|
6119
|
+
json(res, 400, { error: "Invalid resend request" });
|
|
6120
|
+
return;
|
|
6121
|
+
}
|
|
6122
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
6123
|
+
return;
|
|
6124
|
+
const parsed = z.object({ instance: z.string().min(1).max(128), boot: z.string().regex(/^[0-9a-f]{1,32}$/),
|
|
6125
|
+
id: z.number().int().positive().max(Number.MAX_SAFE_INTEGER), attempt: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER) }).strict().safeParse(raw);
|
|
6126
|
+
if (!parsed.success) {
|
|
6127
|
+
json(res, 400, { error: "Invalid resend request" });
|
|
6128
|
+
return;
|
|
6129
|
+
}
|
|
6130
|
+
const { instance, boot, id, attempt } = parsed.data, history = ctx.webChatHistory;
|
|
6131
|
+
const person = webPersonOf(req, url, ctx), guest = guestRequestOf(req), refused = guestChatRefusal(guest, instance);
|
|
6132
|
+
if (!person) {
|
|
6133
|
+
json(res, 401, { error: WEB_TOKEN_INVALID_MESSAGE });
|
|
6134
|
+
return;
|
|
6135
|
+
}
|
|
6136
|
+
if (refused) {
|
|
6137
|
+
json(res, refused.status, { error: refused.error });
|
|
6138
|
+
return;
|
|
6139
|
+
}
|
|
6140
|
+
const native = isWindowsInstance(ctx.fleetConfig?.instances[instance]);
|
|
6141
|
+
if (native && !nativeCliAuthorization(req, url, ctx)) {
|
|
6142
|
+
json(res, 403, { error: "Windows runtime requires an administrator on the local dashboard" });
|
|
6143
|
+
return;
|
|
6144
|
+
}
|
|
6145
|
+
const row = history?.find(instance, boot, id);
|
|
6146
|
+
if (!row || row.role !== "user" || row.retry?.owner !== person.voterKey || (guest && !guestSeesMessage(row, guest, guest.scope()))) {
|
|
6147
|
+
json(res, 404, { error: "Message is not available to resend" });
|
|
6148
|
+
return;
|
|
6149
|
+
}
|
|
6150
|
+
if (native && row.attachments?.length) {
|
|
6151
|
+
json(res, 400, { error: "Attachments are not supported by this runtime yet" });
|
|
6152
|
+
return;
|
|
6153
|
+
}
|
|
6154
|
+
if (guest && guestCommandText(row.text)) {
|
|
6155
|
+
json(res, 403, { error: "guest_no_commands" });
|
|
6156
|
+
return;
|
|
6157
|
+
}
|
|
6158
|
+
if (gatewayRequestContext(req) && row.text.startsWith("/raw ") && !adminAdmissionOf(req, url, ctx)) {
|
|
6159
|
+
json(res, 403, { error: t("web.raw_public_refused") });
|
|
6160
|
+
return;
|
|
6161
|
+
}
|
|
6162
|
+
const registered = registeredChatInstance(ctx, instance);
|
|
6163
|
+
if (!registered && !ctx.instanceIpcClients.has(instance)) {
|
|
6164
|
+
json(res, 404, { error: "Instance not found" });
|
|
6165
|
+
return;
|
|
6166
|
+
}
|
|
6167
|
+
const admission = admissionOf(req, url, ctx);
|
|
6168
|
+
const authorityCurrent = () => admission !== null && admissionOf(req, url, ctx) === admission
|
|
6169
|
+
&& webPersonOf(req, url, ctx)?.voterKey === person.voterKey
|
|
6170
|
+
&& (!guest || (guest.current() && !guestChatRefusal(guest, instance)))
|
|
6171
|
+
&& (native ? isWindowsInstance(ctx.fleetConfig?.instances[instance]) && nativeCliAuthorization(req, url, ctx)
|
|
6172
|
+
: registered ? registeredChatInstance(ctx, instance) : ctx.instanceIpcClients.has(instance));
|
|
6173
|
+
const stillCurrent = () => !res.destroyed && authorityCurrent();
|
|
6174
|
+
const update = () => ctx.emitSseEvent("delivery", { instance, boot: row.boot, id: row.id, messageId: row.messageId, delivery: row.delivery, retry: row.retry });
|
|
6175
|
+
if (row.retry.attempt === attempt + 1 && row.delivery !== "failed") {
|
|
6176
|
+
json(res, 200, { sent: true, repeated: true, message: row });
|
|
6177
|
+
return;
|
|
6178
|
+
}
|
|
6179
|
+
if (row.delivery !== "failed" || row.retry.attempt !== attempt) {
|
|
6180
|
+
json(res, 409, { error: "This delivery changed; refresh and try again" });
|
|
6181
|
+
return;
|
|
6182
|
+
}
|
|
6183
|
+
const quoted = row.replyTo ? history.find(instance, row.replyTo.boot, row.replyTo.id) : undefined;
|
|
6184
|
+
if (row.replyTo && (!quoted || (guest && !guestSeesMessage(quoted, guest, guest.scope())))) {
|
|
6185
|
+
json(res, 409, { error: t("web.reply_gone"), reason: "reply_gone" });
|
|
6186
|
+
return;
|
|
6187
|
+
}
|
|
6188
|
+
const files = [];
|
|
6189
|
+
const limits = uploadLimits(ctx.fleetConfig?.web, { publicLink: gatewayRequestContext(req) !== undefined });
|
|
6190
|
+
let totalBytes = 0;
|
|
6191
|
+
if ((row.attachments?.length ?? 0) > limits.maxFiles) {
|
|
6192
|
+
json(res, 409, { error: "The attachments exceed the current file limit", reason: "attachment_gone" });
|
|
6193
|
+
return;
|
|
6194
|
+
}
|
|
6195
|
+
for (const attachment of row.attachments ?? []) {
|
|
6196
|
+
const opened = "id" in attachment ? ctx.webFiles?.open(attachment.id) : null;
|
|
6197
|
+
if (!opened) {
|
|
6198
|
+
json(res, 409, { error: "An attached file is no longer available", reason: "attachment_gone" });
|
|
6199
|
+
return;
|
|
6200
|
+
}
|
|
6201
|
+
try {
|
|
6202
|
+
if (opened.file.instance !== instance) {
|
|
6203
|
+
json(res, 409, { error: "An attached file is no longer available", reason: "attachment_gone" });
|
|
6204
|
+
return;
|
|
6205
|
+
}
|
|
6206
|
+
totalBytes += opened.file.size;
|
|
6207
|
+
if (opened.file.size > limits.maxFileBytes || totalBytes > limits.maxTotalBytes) {
|
|
6208
|
+
json(res, 409, { error: "The attachments exceed the current file limit", reason: "attachment_gone" });
|
|
6209
|
+
return;
|
|
6210
|
+
}
|
|
6211
|
+
files.push({ kind: opened.file.kind, name: opened.file.name, path: opened.file.realPath });
|
|
6212
|
+
}
|
|
6213
|
+
finally {
|
|
6214
|
+
closeSync(opened.fd);
|
|
6215
|
+
}
|
|
6216
|
+
}
|
|
6217
|
+
if (!stillCurrent()) {
|
|
6218
|
+
json(res, 403, { error: "The session or instance changed" });
|
|
6219
|
+
return;
|
|
6220
|
+
}
|
|
6221
|
+
const { authority } = confirmAfterBody(arrival, webAuthorityOf(req, url, ctx, instance));
|
|
6222
|
+
const nativeRequestId = isNativeExecInstance(ctx.fleetConfig?.instances[instance]) ? randomUUID() : undefined;
|
|
6223
|
+
const nativeJournalIds = nativeRequestId ? new Set((ctx.nativeInstanceRuntime?.().get(instance)?.turns ?? []).map(turn => `native:${turn.id}:user`)) : undefined;
|
|
6224
|
+
const messageId = nativeRequestId ? `native:${nativeRequestId}:user` : newWebMessageId(), claimed = history.beginResend(instance, boot, id, attempt, person.voterKey, messageId, nativeJournalIds);
|
|
6225
|
+
if (claimed.kind === "refused") {
|
|
6226
|
+
json(res, 409, { error: "This delivery changed; refresh and try again" });
|
|
6227
|
+
return;
|
|
6228
|
+
}
|
|
6229
|
+
if (claimed.kind === "already") {
|
|
6230
|
+
json(res, 200, { sent: true, repeated: true, message: claimed.message });
|
|
6231
|
+
return;
|
|
6232
|
+
}
|
|
6233
|
+
update();
|
|
6234
|
+
const delivery = attachmentDelivery(row.text, files);
|
|
6235
|
+
const adapter = ctx.getAdapterForInstance ? ctx.getAdapterForInstance(instance) : ctx.adapter;
|
|
6236
|
+
const reactions = ctx.pendingReactionsMeta?.(instance) ?? { meta: {}, consume: () => { } }; // #4336
|
|
6237
|
+
const payload = { type: "fleet_inbound", content: delivery.text, ...(nativeRequestId ? { requestId: nativeRequestId } : {}), targetSession: instance, meta: {
|
|
6238
|
+
chat_id: ctx.getGroupIdForInstance?.(instance) ?? String(ctx.fleetConfig?.channel?.group_id ?? ""),
|
|
6239
|
+
thread_id: String(ctx.fleetConfig?.instances[instance]?.topic_id ?? ""), message_id: messageId,
|
|
6240
|
+
user: person.name, user_id: person.userId, source: "web", ts: new Date().toISOString(), adapter_id: adapter?.id,
|
|
6241
|
+
...(guest ? { web_guest: "1" } : {}), ...reactions.meta, ...delivery.meta, ...(quoted ? { reply_to_text: webChatReplyText(quoted) } : {}),
|
|
6242
|
+
} };
|
|
6243
|
+
let handedOff = false;
|
|
6244
|
+
try {
|
|
6245
|
+
const delivered = ctx.deliverHumanToInstance ? await ctx.deliverHumanToInstance(instance, payload, webHumanOrigin(false, authority), row.text, { stillCurrent, ...(native ? { authorityCurrent } : {}) })
|
|
6246
|
+
: await ctx.deliverToInstance(instance, payload, { stillCurrent, ...(native ? { authorityCurrent } : {}) });
|
|
6247
|
+
if (delivered === false)
|
|
6248
|
+
throw new Error("delivery changed");
|
|
6249
|
+
handedOff = true;
|
|
6250
|
+
reactions.consume(); // #4336: they rode this message; only now, once accepted
|
|
6251
|
+
if (!res.destroyed)
|
|
6252
|
+
json(res, 200, { sent: true, message: row });
|
|
6253
|
+
}
|
|
6254
|
+
catch (error) {
|
|
6255
|
+
if (handedOff)
|
|
6256
|
+
return; // a lost HTTP answer does not make the accepted pane handoff fail
|
|
6257
|
+
history.setDelivery(instance, messageId, "failed");
|
|
6258
|
+
update();
|
|
6259
|
+
ctx.logger.error({ instance, err: error }, "Web resend handoff failed");
|
|
6260
|
+
json(res, 503, { ...webDeliveryFailure(error), message: row });
|
|
6261
|
+
}
|
|
6262
|
+
}
|
|
5544
6263
|
function handleSendMessage(req, res, ctx) {
|
|
5545
6264
|
const arrival = webAuthorityOf(req, new URL(req.url ?? "/", "http://localhost"), ctx); // #1939 §3: again after the body
|
|
5546
6265
|
let body = "";
|
|
@@ -5560,6 +6279,8 @@ function handleSendMessage(req, res, ctx) {
|
|
|
5560
6279
|
// A claimed clientId is settled however this ends: with the messageId once accepted, else forgotten.
|
|
5561
6280
|
let claim;
|
|
5562
6281
|
let acceptedId = null;
|
|
6282
|
+
let tellPasted; // #4145: the pasted-token line, after this message's own (whatever the send's end)
|
|
6283
|
+
let tellBoardOff; // Cards named for an instance with the task board off, said once the message went
|
|
5563
6284
|
try {
|
|
5564
6285
|
const raw = JSON.parse(body);
|
|
5565
6286
|
const parsed = SendMessageSchema.safeParse(raw);
|
|
@@ -5568,7 +6289,17 @@ function handleSendMessage(req, res, ctx) {
|
|
|
5568
6289
|
json(res, 400, { error: `${issue.path.join(".") || "body"}: ${issue.message}` });
|
|
5569
6290
|
return;
|
|
5570
6291
|
}
|
|
5571
|
-
const { instance, message:
|
|
6292
|
+
const { instance, message: sent, attachments = [], replyTo, clientId } = parsed.data;
|
|
6293
|
+
// #4145: this fleet's sign-in access token pasted here is hidden before it goes anywhere (the agent, the chat's
|
|
6294
|
+
// history, the topic's copy, the activity log), and taken back at once — a new one goes privately.
|
|
6295
|
+
const pasted = ctx.screenLoginToken?.(sent) ?? null;
|
|
6296
|
+
const typed = pasted?.text ?? sent;
|
|
6297
|
+
const pastedNotice = pasted?.live ? (ctx.loginTokenPasted?.() ?? Promise.resolve(null)).catch(() => null) : null;
|
|
6298
|
+
if (pastedNotice)
|
|
6299
|
+
tellPasted = () => void pastedNotice.then(notice => {
|
|
6300
|
+
if (notice)
|
|
6301
|
+
ctx.emitSseEvent("message", { instance, role: "status", sender: "AgEnD", text: notice, ts: new Date().toISOString(), messageId: newWebMessageId() });
|
|
6302
|
+
});
|
|
5572
6303
|
const native = isWindowsInstance(ctx.fleetConfig?.instances[instance]);
|
|
5573
6304
|
if (native && !nativeCliAuthorization(req, new URL(req.url ?? "/", "http://localhost"), ctx)) {
|
|
5574
6305
|
json(res, 403, { error: "Windows runtime requires an administrator on the local dashboard" });
|
|
@@ -5652,10 +6383,28 @@ function handleSendMessage(req, res, ctx) {
|
|
|
5652
6383
|
}
|
|
5653
6384
|
// The same tags and meta a Telegram photo/document produces, so the agent needs nothing new.
|
|
5654
6385
|
const delivery = attachmentDelivery(typed, files);
|
|
6386
|
+
// The task cards the person's words name (`#M-3`, typed or chosen from the list), read from the board now, go to
|
|
6387
|
+
// the agent as a short block under them, so it need not guess. Nothing is added for a number that is no card (never was,
|
|
6388
|
+
// or deleted since), for a guest (a guest has no board), for an instance whose task board is switched off (it is told
|
|
6389
|
+
// nothing of the board: only the person's words go), for a line that starts with "/" (a command for the CLI, or /raw's
|
|
6390
|
+
// exact paste), or for a card that names an instance hidden on the public link. The chat's copy, the channel's echo and
|
|
6391
|
+
// the receipt's "what was typed" stay the person's words.
|
|
6392
|
+
const taskBoard = guest || taskBoardOffIn(ctx.fleetConfig, instance) || /^\s*\//.test(typed) ? undefined : ctx.scheduler?.db.board;
|
|
6393
|
+
const { hidden: hiddenCard } = boardHiding(ctx, linkRestricted(req, new URL(req.url ?? "/", "http://localhost"), ctx));
|
|
6394
|
+
const refCards = taskBoard ? cardsForRefs(taskBoard, taskRefCodes(typed), hiddenCard) : [];
|
|
6395
|
+
const refBlock = taskBoard && refCards.length ? taskRefBlock(taskBoard, refCards, { read: taskReadWay(ctx.fleetConfig?.instances[instance], instance), hidden: hiddenCard }) : "";
|
|
6396
|
+
// Cards named for an instance whose task board is off are not handed over (it has no task tool): the person is
|
|
6397
|
+
// told which instance it is and where to turn it on, as a line in the chat after the message — not left to wonder why it did nothing.
|
|
6398
|
+
if (!guest && !/^\s*\//.test(typed) && taskBoardOffIn(ctx.fleetConfig, instance) && ctx.scheduler?.db.board) {
|
|
6399
|
+
const named = cardsForRefs(ctx.scheduler.db.board, taskRefCodes(typed), hiddenCard).map((c) => c.code);
|
|
6400
|
+
if (named.length)
|
|
6401
|
+
tellBoardOff = () => ctx.emitSseEvent("message", { instance, role: "status", sender: "AgEnD", text: t("web.task_board_off_refs", instance, named.join(", ")), ts: new Date().toISOString(), messageId: newWebMessageId() });
|
|
6402
|
+
}
|
|
6403
|
+
const deliveredText = delivery.text + refBlock;
|
|
5655
6404
|
// #1269: `/raw ` is pasted into the CLI with no [user:] envelope (the daemon's own check, on this exact text).
|
|
5656
|
-
//
|
|
5657
|
-
//
|
|
5658
|
-
if (gatewayRequestContext(req) && delivery.text.startsWith("/raw ")) {
|
|
6405
|
+
// M-3278 (decision 7933bf90): the public link's admin session may do that too, as a local one may; anyone else
|
|
6406
|
+
// over the link (a guest) still may not.
|
|
6407
|
+
if (gatewayRequestContext(req) && delivery.text.startsWith("/raw ") && !adminAdmissionOf(req, new URL(req.url ?? "/", "http://localhost"), ctx)) {
|
|
5659
6408
|
ctx.webFiles?.release(files);
|
|
5660
6409
|
json(res, 403, { error: t("web.raw_public_refused") });
|
|
5661
6410
|
return;
|
|
@@ -5687,10 +6436,10 @@ function handleSendMessage(req, res, ctx) {
|
|
|
5687
6436
|
if (nativeRequestId && ctx.nativeInstanceRuntime) {
|
|
5688
6437
|
const previous = ctx.nativeInstanceRuntime().get(instance)?.turns.find(turn => turn.id === nativeRequestId);
|
|
5689
6438
|
if (previous) {
|
|
5690
|
-
if (previous.prompt !== delivery.text) {
|
|
6439
|
+
if (previous.prompt !== delivery.text && !previous.prompt.startsWith(delivery.text + TASK_REF_SEPARATOR)) {
|
|
5691
6440
|
json(res, 409, { error: "clientId belongs to a different message" });
|
|
5692
6441
|
return;
|
|
5693
|
-
}
|
|
6442
|
+
} // the card block under it is read afresh on a retry
|
|
5694
6443
|
acceptedId = messageId;
|
|
5695
6444
|
json(res, 200, { sent: true, messageId, repeated: true });
|
|
5696
6445
|
return;
|
|
@@ -5739,13 +6488,17 @@ function handleSendMessage(req, res, ctx) {
|
|
|
5739
6488
|
return sent;
|
|
5740
6489
|
}) : undefined;
|
|
5741
6490
|
let delivered;
|
|
6491
|
+
// #4336 (M-3516): the reactions waiting for the agent ride this message, as a platform message's do (one line,
|
|
6492
|
+
// "[Recent reactions: …]"); they are consumed below only once it was accepted. The room's or topic's echo of it is
|
|
6493
|
+
// a bot copy the agent is never handed, so they are delivered exactly once.
|
|
6494
|
+
const reactions = ctx.pendingReactionsMeta?.(instance) ?? { meta: {}, consume: () => { } };
|
|
5742
6495
|
try {
|
|
5743
6496
|
const deliver = (name, payload) => ctx.deliverHumanToInstance
|
|
5744
6497
|
? ctx.deliverHumanToInstance(name, payload, webHumanOrigin(false, authority), typed, { stillCurrent, ...(native ? { authorityCurrent } : {}) })
|
|
5745
6498
|
: ctx.deliverToInstance(name, payload, { stillCurrent, ...(native ? { authorityCurrent } : {}) });
|
|
5746
6499
|
delivered = await deliver(instance, {
|
|
5747
6500
|
type: "fleet_inbound",
|
|
5748
|
-
content:
|
|
6501
|
+
content: deliveredText,
|
|
5749
6502
|
...(nativeRequestId ? { requestId: nativeRequestId } : {}),
|
|
5750
6503
|
targetSession: instance,
|
|
5751
6504
|
meta: {
|
|
@@ -5757,6 +6510,7 @@ function handleSendMessage(req, res, ctx) {
|
|
|
5757
6510
|
source: "web",
|
|
5758
6511
|
...(guest ? { web_guest: "1" } : {}), // #1920: "[user:…@web:g#…]" (authority none)
|
|
5759
6512
|
adapter_id: syncAdapter?.id,
|
|
6513
|
+
...reactions.meta,
|
|
5760
6514
|
...delivery.meta,
|
|
5761
6515
|
// #2272: `(reply_to: "…")`, as a Discord or Telegram reply gives the agent.
|
|
5762
6516
|
...(quoted ? { reply_to_text: webChatReplyText(quoted) } : {}),
|
|
@@ -5785,6 +6539,7 @@ function handleSendMessage(req, res, ctx) {
|
|
|
5785
6539
|
// The agent has it: from here on a repeat of this clientId is this send, whatever fails after (the echo, the
|
|
5786
6540
|
// stream's copy) — a Retry then gets this messageId, never a second delivery.
|
|
5787
6541
|
acceptedId = messageId;
|
|
6542
|
+
reactions.consume();
|
|
5788
6543
|
settleEcho?.(true);
|
|
5789
6544
|
settleClassicEcho?.(true);
|
|
5790
6545
|
// #1666: the same cancel/progress bubble a platform inbound starts, in the topic the echo went to — a second turn
|
|
@@ -5798,7 +6553,7 @@ function handleSendMessage(req, res, ctx) {
|
|
|
5798
6553
|
ctx.lastInboundUser.set(instance, person.name);
|
|
5799
6554
|
ctx.eventLog?.logActivity("message", person.name, (message || `[${files.length} file(s)]`).slice(0, 200), instance);
|
|
5800
6555
|
// #1920: the account that wrote it (a guest sees its own); channel-visible once its copy was sent (above).
|
|
5801
|
-
ctx.emitSseEvent("message", { instance, sender: person.name, role: "user", text: message, ts, attachments: files.map(publicAttachment), messageId, ...(person.bound ? { from: person.voterKey } : {}),
|
|
6556
|
+
ctx.emitSseEvent("message", { instance, sender: person.name, role: "user", retryOwner: person.voterKey, text: message, ts, attachments: files.map(publicAttachment), messageId, ...(person.bound ? { from: person.voterKey } : {}),
|
|
5802
6557
|
...(quoted ? { replyTo: webChatReplyRef(quoted) } : {}), ...(clientId ? { clientId } : {}) });
|
|
5803
6558
|
json(res, 200, { sent: true, messageId });
|
|
5804
6559
|
}
|
|
@@ -5812,6 +6567,9 @@ function handleSendMessage(req, res, ctx) {
|
|
|
5812
6567
|
}
|
|
5813
6568
|
finally {
|
|
5814
6569
|
claim?.settle(acceptedId);
|
|
6570
|
+
tellPasted?.();
|
|
6571
|
+
if (acceptedId)
|
|
6572
|
+
tellBoardOff?.();
|
|
5815
6573
|
}
|
|
5816
6574
|
});
|
|
5817
6575
|
}
|
|
@@ -6113,7 +6871,9 @@ function prefsViewer(req, url, ctx) {
|
|
|
6113
6871
|
return { person: webPersonKey(v.session.owner), epoch: v.session.handle, scope: "person", canWrite: false, via: "session", ...guest,
|
|
6114
6872
|
guestScope: () => g?.scope() ?? new Set() };
|
|
6115
6873
|
}
|
|
6116
|
-
|
|
6874
|
+
// M-3278 (decision 7933bf90): the public link's admin session gets its own person scope, as on the local dashboard.
|
|
6875
|
+
// A read-only session over the link keeps no person scope, as before (Fable on #4107, N1: the decision is an admin's).
|
|
6876
|
+
if (v.via === "session" && v.session && (v.session.tier === "admin" || !gatewayRequestContext(req))) {
|
|
6117
6877
|
const person = webPersonKey(v.session.owner);
|
|
6118
6878
|
return { person, epoch: v.session.handle, scope: person === OPERATOR ? "operator" : "person", canWrite: v.session.tier === "admin", via: "session", ...guest };
|
|
6119
6879
|
}
|
|
@@ -6128,6 +6888,28 @@ const prefsView = (prefs, v) => {
|
|
|
6128
6888
|
// #2855: the host's look, then the guest's own preferences (only on a guest with an account: its bucket).
|
|
6129
6889
|
return v.person ? guestOwnPrefs(view, prefs.readGuestOwn(v.person), v.guestScope?.() ?? new Set()) : guestPrefs(view);
|
|
6130
6890
|
};
|
|
6891
|
+
/** M-3278: an admin session's page over the public link (not a guest, not a read-only session). */
|
|
6892
|
+
/**
|
|
6893
|
+
* M-3278 (decision 7933bf90, part 5): the live stream over the public link — only the admin's own fixed (named) link and
|
|
6894
|
+
* only an admin session: a quick tunnel buffers a stream (its page polls), and guests and read-only sessions keep polling
|
|
6895
|
+
* as before. The header token never works over the link.
|
|
6896
|
+
*/
|
|
6897
|
+
function namedLinkStream(req, ctx) {
|
|
6898
|
+
const link = gatewayRequestContext(req);
|
|
6899
|
+
if (!link?.named)
|
|
6900
|
+
return false; // a link that is no longer current is refused by evaluateWebRequest below
|
|
6901
|
+
const v = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
6902
|
+
return v.kind === "allow" && v.via === "session" && v.session.tier === "admin";
|
|
6903
|
+
}
|
|
6904
|
+
/** At most this many live streams over the public link at once (the gateway keeps 32 connections in all): a tab past it polls. */
|
|
6905
|
+
export const LINK_STREAMS_MAX = 8;
|
|
6906
|
+
const linkStreams = new WeakMap();
|
|
6907
|
+
function linkAdminPage(req, ctx, viewer) {
|
|
6908
|
+
if (!gatewayRequestContext(req) || viewer?.guest)
|
|
6909
|
+
return false;
|
|
6910
|
+
const v = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
6911
|
+
return v.kind === "allow" && v.via === "session" && v.session.tier === "admin";
|
|
6912
|
+
}
|
|
6131
6913
|
function shellHtmlTag(ctx, mode, viewer) {
|
|
6132
6914
|
if (mode !== "full" || !ctx.webPrefs)
|
|
6133
6915
|
return '<html lang="en">';
|
|
@@ -6138,7 +6920,7 @@ function shellHtmlTag(ctx, mode, viewer) {
|
|
|
6138
6920
|
}
|
|
6139
6921
|
/**
|
|
6140
6922
|
* #1629 r4 §3: the owner CSS this load links (its sha), or null. Only the full app of a signed-in human session — never
|
|
6141
|
-
* the
|
|
6923
|
+
* the anonymous View reader, the CLI's header token or the sign-in and setup pages (other panels); M-3278: the public link's too.
|
|
6142
6924
|
*/
|
|
6143
6925
|
function shellOwnerCss(ctx, mode, viewer) {
|
|
6144
6926
|
return mode === "full" && !viewer?.guest && viewer?.person !== null && viewer?.person !== undefined && ctx.ownerCss ? ctx.ownerCss.active(viewer.person) : null;
|
|
@@ -6160,7 +6942,12 @@ function hubBodyAttrs(req, ctx) {
|
|
|
6160
6942
|
config = null;
|
|
6161
6943
|
}
|
|
6162
6944
|
// hub.md §1: member handlers are local-owner-only and unavailable through the public gateway — no member mark there.
|
|
6163
|
-
|
|
6945
|
+
// M-3278 (decision 7933bf90): except for the link's admin session, which the member handlers now answer as locally.
|
|
6946
|
+
const linkAdmin = () => {
|
|
6947
|
+
const v = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
6948
|
+
return v.kind === "allow" && v.via === "session" && v.session.tier === "admin";
|
|
6949
|
+
};
|
|
6950
|
+
const member = hubModeOf(config).member && (!gatewayRequestContext(req) || linkAdmin()) ? ' data-hub="member"' : "";
|
|
6164
6951
|
// #3298 S-89 (leader, #3372 N2): Settings → Hub's Group permissions row only when this fleet's own Hub has them composed —
|
|
6165
6952
|
// learned in this process, never by reading a Hub session across origins. Never over the public link.
|
|
6166
6953
|
let groups = false;
|
|
@@ -6196,7 +6983,7 @@ function guestBodyAttrs(ctx, owner, attr) {
|
|
|
6196
6983
|
function shellBodyTag(req, ctx, mode, viewer) {
|
|
6197
6984
|
const p = shellPreview(req, ctx, mode);
|
|
6198
6985
|
const ownerCss = shellOwnerCss(ctx, mode, viewer);
|
|
6199
|
-
let ownerCssState = mode === "full" &&
|
|
6986
|
+
let ownerCssState = mode === "full" && viewer?.guest ? "off" : "unknown"; // M-3278: the public link's admin as locally
|
|
6200
6987
|
if (mode === "full" && !viewer?.guest && viewer?.person != null && ctx.ownerCss) {
|
|
6201
6988
|
ownerCssState = ctx.ownerCss.effectState(viewer.person);
|
|
6202
6989
|
if (ownerCssState === "off" && ownerCss !== null || ownerCssState === "on" && ownerCss === null)
|
|
@@ -6204,13 +6991,14 @@ function shellBodyTag(req, ctx, mode, viewer) {
|
|
|
6204
6991
|
}
|
|
6205
6992
|
const attr = (v) => String(v ?? "").replace(/[&<>"']/g, c => `&#${c.charCodeAt(0)};`);
|
|
6206
6993
|
const admission = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
6207
|
-
|
|
6994
|
+
// M-3278 (decision 7933bf90): an admin session has these on every listener — the public link too, temporary or fixed.
|
|
6995
|
+
const childMark = mode === "full" && !viewer?.guest && admission.kind === "allow"
|
|
6208
6996
|
&& (admission.via !== "session" || admission.session.tier === "admin");
|
|
6209
6997
|
// #3637: display-only capability and a non-authorizing namespace. No account/session/token value reaches storage.
|
|
6210
|
-
const workspaceMark = mode === "full" && !
|
|
6998
|
+
const workspaceMark = mode === "full" && !viewer?.guest && admission.kind === "allow";
|
|
6211
6999
|
const workspaceScope = workspaceMark && viewer?.person && ctx.webToken
|
|
6212
7000
|
? createHmac("sha256", ctx.webToken).update(`agend-chat-layout-v1\0${viewer.person}`).digest("hex") : null;
|
|
6213
|
-
return `<body data-mode="${mode}"${childMark ? ' data-subagents="1"' : ""}${workspaceMark ? ' data-chat-workspace="1"' : ""}${workspaceScope ? ` data-chat-layout-scope="${workspaceScope}"` : ""}${mode === "full" && gatewayRequestContext(req) ? ' data-web-transport="poll"' : ""} data-dashboard-origin="${attr(p?.dashboardOrigin)}" data-preview-origin="${attr(p?.previewOrigin)}"`
|
|
7001
|
+
return `<body data-mode="${mode}"${childMark ? ' data-subagents="1"' : ""}${workspaceMark ? ' data-chat-workspace="1"' : ""}${workspaceScope ? ` data-chat-layout-scope="${workspaceScope}"` : ""}${mode === "full" && gatewayRequestContext(req) && !namedLinkStream(req, ctx) ? ' data-web-transport="poll"' : ""} data-dashboard-origin="${attr(p?.dashboardOrigin)}" data-preview-origin="${attr(p?.previewOrigin)}"`
|
|
6214
7002
|
+ ` data-preview-boot="${attr(p?.previewOrigin ? p.boot : "")}" data-preview-reason="${attr(p ? p.reason : "Previews are not available on this fleet.")}"`
|
|
6215
7003
|
// #1554: no availability asked (the public link, or not the full app) still says why, in the page's language.
|
|
6216
7004
|
+ ` data-preview-reason-code="${attr(p ? p.code ?? "" : gatewayRequestContext(req) ? "publicLink" : "notOffered")}"`
|
|
@@ -6223,8 +7011,8 @@ function shellBodyTag(req, ctx, mode, viewer) {
|
|
|
6223
7011
|
// AGEND-181: whether thinking may be asked for (web.log_thinking; OFF by default, AGEND-197). The server answers
|
|
6224
7012
|
// `thinking: true` only to an admin session on the local dashboard (GET /ui/steps), whatever this says.
|
|
6225
7013
|
+ ` data-log-thinking="${ctx.fleetConfig?.web?.log_thinking === true ? "1" : "0"}"`
|
|
6226
|
-
// AGEND-197: whether this page may ask for the chat's activity block at all — an admin session on
|
|
6227
|
-
//
|
|
7014
|
+
// AGEND-197: whether this page may ask for the chat's activity block at all — an admin session (M-3278: on any listener,
|
|
7015
|
+
// the public link too); a guest and a read-only session are never offered it, and the server refuses them anyway.
|
|
6228
7016
|
// Each agent's own tool_progress decides whether there is anything to show (the answer's `level`).
|
|
6229
7017
|
+ ` data-chat-activity="${childMark ? "1" : "0"}"`
|
|
6230
7018
|
// #1937: the upload limits in force for this page (the config's; the public link's own cap on it) — what the chat
|
|
@@ -6234,8 +7022,9 @@ function shellBodyTag(req, ctx, mode, viewer) {
|
|
|
6234
7022
|
+ ` data-fleet-tz="${attr(resolveTz())}"`
|
|
6235
7023
|
// #1629 r4 §3: the person's owner CSS in force (a sha), linked by the page unless this device or this load says not.
|
|
6236
7024
|
+ ` data-owner-css-state="${ownerCssState}"${ownerCss ? ` data-owner-css="${attr(ownerCss)}"` : ""}`
|
|
6237
|
-
// #1589: the public link shows attachments as downloads only (no inline text or media):
|
|
6238
|
-
|
|
7025
|
+
// #1589: the public link shows attachments as downloads only (no inline text or media) — M-3278: except to an admin
|
|
7026
|
+
// session (data-link-media="1"), which plays them in the page as on the dashboard reached directly.
|
|
7027
|
+
+ `${gatewayRequestContext(req) ? ' data-public-link="1"' : ""}${gatewayRequestContext(req) && linkAdminPage(req, ctx, viewer) ? ' data-link-media="1"' : ""}`
|
|
6239
7028
|
// #2478: search is offered over the public link unless web.search.public_link is false (the page then shows no entry).
|
|
6240
7029
|
+ `${gatewayRequestContext(req) && ctx.fleetConfig?.web?.search?.public_link === false ? ' data-search-link="0"' : ""}`
|
|
6241
7030
|
// AgEnD Hub P1 (docs/design/hub-ui-client.md): the Hub's marks — only when a switch is on, never on a guest's page.
|
|
@@ -6260,7 +7049,7 @@ export function serveHubWorkspaceShell(res, hub) {
|
|
|
6260
7049
|
const previewAttrs = preview ? ` data-dashboard-origin="${attr(preview.dashboardOrigin)}"`
|
|
6261
7050
|
+ (preview.previewOrigin && preview.bootId ? ` data-preview-origin="${attr(preview.previewOrigin)}" data-preview-boot="${attr(preview.bootId)}"`
|
|
6262
7051
|
: ` data-preview-reason-code="${attr(preview.reasonCode ?? "notOffered")}" data-preview-reason="${attr(preview.reason ?? "")}"`) : "";
|
|
6263
|
-
const body = `<body data-mode="full" data-web-transport="none" data-usage-panel="0" data-log-tab="0" data-hub="hub"${name ? ` data-hub-name="${attr(name)}"` : ""}${previewAttrs}>`;
|
|
7052
|
+
const body = `<body data-mode="full" data-web-transport="none" data-usage-panel="0" data-log-tab="0" data-hub="hub"${name ? ` data-hub-name="${attr(name)}"` : ""}${hub.loginWithoutAt ? ` data-hub-login="no-at"` : ""}${previewAttrs}>`;
|
|
6264
7053
|
sendPanelHtml(res, withAppIconLinks(html).replace("<body>", body), 200, { "Cache-Control": "no-store" }, { mediaSrc: "'none'", ...(preview?.previewOrigin ? { frameSrc: `${preview.previewOrigin}/frame` } : {}) });
|
|
6265
7054
|
}
|
|
6266
7055
|
catch {
|
|
@@ -6273,6 +7062,40 @@ export function serveHubWorkspaceShell(res, hub) {
|
|
|
6273
7062
|
* The app shell page. `opts.hubWorkspace`: the page is a Hub's own workspace (slice 1's Hub listener only — the fleet's
|
|
6274
7063
|
* listener never passes it), so it is drawn as the Hub shell.
|
|
6275
7064
|
*/
|
|
7065
|
+
let moduleGraphMemo = null;
|
|
7066
|
+
/** M-3314: the served modules' static imports, read once per process (its files do not change under it). */
|
|
7067
|
+
export function appModuleGraph() { return moduleGraphMemo ??= buildModuleGraph(join(__dirname, "ui"), servedAssets()); }
|
|
7068
|
+
/** M-3314: the module each panel's route loads (app.js's own dynamic imports). */
|
|
7069
|
+
export const PANEL_MODULES = {
|
|
7070
|
+
chat: "/ui/js/panel-chat.js", fleet: "/ui/js/panel-fleet.js", settings: "/ui/js/panel-settings.js", needs: "/ui/js/panel-needs.js",
|
|
7071
|
+
details: "/ui/js/panel-details.js", log: "/ui/js/panel-log.js", notices: "/ui/js/panel-notices.js", "windows-agent": "/ui/js/panel-windows-agent.js",
|
|
7072
|
+
view: "/assets/panel-view.js",
|
|
7073
|
+
};
|
|
7074
|
+
/**
|
|
7075
|
+
* M-3314: what this load of the shell imports, statically or as app.js boots it, so it can be asked for in one wave:
|
|
7076
|
+
* app.js; for a signed-in page the chat (always booted) and the panel of the route; for an admin's page also what
|
|
7077
|
+
* app.js loads for every admin (backend sign-in, agent proposals) and, with the chat workspace, its modules. Nothing a
|
|
7078
|
+
* page of that kind would not load anyway — a guest's or a reader's page preloads only what it imports itself.
|
|
7079
|
+
*/
|
|
7080
|
+
export function shellPreload(mode, guest, path, workspace) {
|
|
7081
|
+
const graph = appModuleGraph();
|
|
7082
|
+
const entries = ["/assets/app.js"];
|
|
7083
|
+
const route = shellRoute("GET", path);
|
|
7084
|
+
const panel = route?.kind === "shell" ? route.route.panel : null;
|
|
7085
|
+
if (panel === "view")
|
|
7086
|
+
entries.push(PANEL_MODULES.view);
|
|
7087
|
+
if (mode === "full") {
|
|
7088
|
+
entries.push(PANEL_MODULES.chat);
|
|
7089
|
+
if (!guest) {
|
|
7090
|
+
if (panel && panel !== "chat" && panel !== "view" && PANEL_MODULES[panel])
|
|
7091
|
+
entries.push(PANEL_MODULES[panel]);
|
|
7092
|
+
entries.push("/ui/js/backend-signin.js", "/ui/js/agent-proposals.js");
|
|
7093
|
+
if (workspace)
|
|
7094
|
+
entries.push("/ui/js/chat-workspace.js", PANEL_MODULES.details, PANEL_MODULES.log, PANEL_MODULES.view);
|
|
7095
|
+
}
|
|
7096
|
+
}
|
|
7097
|
+
return staticClosure(graph, entries);
|
|
7098
|
+
}
|
|
6276
7099
|
export function serveAppShell(req, res, ctx, mode, opts = {}) {
|
|
6277
7100
|
// A Hub workspace is drawn from nothing of this fleet's: no fleet cookie, session, preference or preview is read.
|
|
6278
7101
|
if (opts.hubWorkspace) {
|
|
@@ -6284,15 +7107,30 @@ export function serveAppShell(req, res, ctx, mode, opts = {}) {
|
|
|
6284
7107
|
const viewer = mode === "full" ? prefsViewer(req, new URL(req.url ?? "/", "http://localhost"), ctx) : null;
|
|
6285
7108
|
const p = shellPreview(req, ctx, mode);
|
|
6286
7109
|
// #1589: media plays only from this listener's own file route (path-scoped, like frame-src), at the address this page
|
|
6287
|
-
// was loaded from (a Host the host guard accepted); never
|
|
6288
|
-
|
|
6289
|
-
|
|
7110
|
+
// was loaded from (a Host the host guard accepted); never where no chat is shown. M-3278 (decision 7933bf90): on the
|
|
7111
|
+
// public link too for an admin session — its own origin (the link's address); a guest or read-only session there keeps
|
|
7112
|
+
// downloads only.
|
|
7113
|
+
const link = gatewayRequestContext(req);
|
|
7114
|
+
const own = mode !== "full" ? null : !link
|
|
7115
|
+
? dashboardOriginFor(typeof req.headers.host === "string" ? req.headers.host : undefined, isSecureRequest(req))
|
|
7116
|
+
: linkAdminPage(req, ctx, viewer) ? link.expectedOrigin : null;
|
|
6290
7117
|
const mediaSrc = own ? `${own}/ui/file/` : "'none'";
|
|
6291
7118
|
// A public-link page frames what its exposure's preview names (the quick-tunnel wildcard: its host is not known when
|
|
6292
7119
|
// the page may load); every other page frames exactly the origin this load chose (#1723).
|
|
6293
7120
|
const previewFrames = p && "frameSrc" in p ? p.frameSrc : p?.previewOrigin ? `${p.previewOrigin}/frame` : null;
|
|
6294
|
-
|
|
6295
|
-
|
|
7121
|
+
// M-3283: frame only the narrow file endpoint, never all of this origin. Recheck the actual session tier locally too.
|
|
7122
|
+
const fileViewer = own ? evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false }) : null;
|
|
7123
|
+
const fileFrame = own && fileViewer?.kind === "allow" && fileViewer.via === "session" && fileViewer.session.tier === "admin" ? `${own}/ui/reply-preview` : null;
|
|
7124
|
+
const frameSrc = [previewFrames, fileFrame].filter(Boolean).join(" ");
|
|
7125
|
+
const bodyTag = shellBodyTag(req, ctx, mode, viewer);
|
|
7126
|
+
const page = withAppIconLinks(html).replace('<html lang="en">', shellHtmlTag(ctx, mode, viewer)).replace("<body>", bodyTag);
|
|
7127
|
+
// M-3314: the shell's files under this version, and the modules this load will import preloaded at once.
|
|
7128
|
+
const guest = mode === "full" && !!viewer?.guest;
|
|
7129
|
+
const preload = shellPreload(mode, guest, new URL(req.url ?? "/", "http://localhost").pathname, bodyTag.includes('data-chat-workspace="1"'));
|
|
7130
|
+
// Only while the files are still the ones <V> names: between an update's install and its restart the shell is the
|
|
7131
|
+
// plain one (no-store files, as before this change), never one that names <V> over files it does not describe.
|
|
7132
|
+
const shell = assetsUnchanged() ? versionShell(page, assetVersion(), preload, mode === "full" && !guest ? appModuleGraph() : undefined) : page;
|
|
7133
|
+
sendPanelHtml(res, shell, 200, {}, { ...(frameSrc ? { frameSrc } : {}), mediaSrc });
|
|
6296
7134
|
}
|
|
6297
7135
|
catch {
|
|
6298
7136
|
json(res, 500, { error: "app.html not found" });
|