@songsid/agend 2.3.5 → 2.4.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/README.zh-TW.md +3 -1
- package/THIRD_PARTY_NOTICES.md +71 -0
- package/dist/accounts-profiles.d.ts +102 -0
- package/dist/accounts-profiles.js +194 -0
- package/dist/accounts-profiles.js.map +1 -0
- package/dist/accounts-signout.d.ts +59 -0
- package/dist/accounts-signout.js +181 -0
- package/dist/accounts-signout.js.map +1 -0
- package/dist/accounts-view.d.ts +189 -0
- package/dist/accounts-view.js +204 -0
- package/dist/accounts-view.js.map +1 -0
- package/dist/agent-endpoint.d.ts +5 -1
- package/dist/agent-endpoint.js +12 -2
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/agent-export.d.ts +74 -0
- package/dist/agent-export.js +362 -0
- package/dist/agent-export.js.map +1 -0
- package/dist/agent-file-read.js +1 -1
- package/dist/agent-file-read.js.map +1 -1
- package/dist/agent-runtime-api.d.ts +4 -0
- package/dist/agent-runtime-api.js +59 -0
- package/dist/agent-runtime-api.js.map +1 -0
- package/dist/agent-runtime-change.d.ts +76 -0
- package/dist/agent-runtime-change.js +114 -0
- package/dist/agent-runtime-change.js.map +1 -0
- package/dist/agent-whats-new.js +12 -3
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/agent-workspace.d.ts +103 -0
- package/dist/agent-workspace.js +360 -0
- package/dist/agent-workspace.js.map +1 -0
- package/dist/apply-job.d.ts +5 -0
- package/dist/apply-job.js +10 -3
- package/dist/apply-job.js.map +1 -1
- package/dist/auth-api.d.ts +78 -0
- package/dist/auth-api.js +352 -16
- package/dist/auth-api.js.map +1 -1
- package/dist/authority/company-join.d.ts +16 -0
- package/dist/authority/company-join.js +37 -0
- package/dist/authority/company-join.js.map +1 -0
- package/dist/authority/hub-initialization.d.ts +13 -0
- package/dist/authority/hub-initialization.js +30 -0
- package/dist/authority/hub-initialization.js.map +1 -0
- package/dist/authority/settings-role.d.ts +56 -0
- package/dist/authority/settings-role.js +48 -0
- package/dist/authority/settings-role.js.map +1 -0
- package/dist/authority/web-authority.d.ts +25 -2
- package/dist/authority/web-authority.js +37 -4
- package/dist/authority/web-authority.js.map +1 -1
- package/dist/backend/claude-code.d.ts +19 -16
- package/dist/backend/claude-code.js +183 -144
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/claude-context.d.ts +17 -0
- package/dist/backend/claude-context.js +30 -0
- package/dist/backend/claude-context.js.map +1 -0
- package/dist/backend/codex-footer-hints.d.ts +3 -0
- package/dist/backend/codex-footer-hints.js +14 -0
- package/dist/backend/codex-footer-hints.js.map +1 -1
- package/dist/backend/codex-package.d.ts +5 -2
- package/dist/backend/codex-package.js +1 -5
- package/dist/backend/codex-package.js.map +1 -1
- package/dist/backend/codex-quota-history.js +4 -19
- package/dist/backend/codex-quota-history.js.map +1 -1
- package/dist/backend/codex.d.ts +149 -129
- package/dist/backend/codex.js +1323 -1233
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/credential-profile.d.ts +21 -0
- package/dist/backend/credential-profile.js +48 -1
- package/dist/backend/credential-profile.js.map +1 -1
- package/dist/backend/effort-metadata.d.ts +38 -2
- package/dist/backend/effort-metadata.js +145 -8
- package/dist/backend/effort-metadata.js.map +1 -1
- package/dist/backend/grok-mcp.d.ts +5 -0
- package/dist/backend/grok-mcp.js +221 -0
- package/dist/backend/grok-mcp.js.map +1 -0
- package/dist/backend/grok-model-cache.d.ts +7 -0
- package/dist/backend/grok-model-cache.js +65 -0
- package/dist/backend/grok-model-cache.js.map +1 -0
- package/dist/backend/grok.d.ts +7 -10
- package/dist/backend/grok.js +44 -88
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/kiro.js +1 -1
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/launch-effort.d.ts +1 -1
- package/dist/backend/launch-effort.js +7 -3
- package/dist/backend/launch-effort.js.map +1 -1
- package/dist/backend/native-pane.d.ts +11 -0
- package/dist/backend/native-pane.js +59 -0
- package/dist/backend/native-pane.js.map +1 -0
- package/dist/backend/types.d.ts +26 -1
- package/dist/backend/types.js.map +1 -1
- package/dist/backend-availability.d.ts +16 -1
- package/dist/backend-availability.js +65 -2
- package/dist/backend-availability.js.map +1 -1
- package/dist/backend-signin-pending.d.ts +8 -2
- package/dist/backend-signin-pending.js +6 -2
- package/dist/backend-signin-pending.js.map +1 -1
- package/dist/browser-backend-signins.d.ts +9 -2
- package/dist/browser-backend-signins.js +9 -5
- package/dist/browser-backend-signins.js.map +1 -1
- package/dist/build-provenance-cli.d.ts +3 -0
- package/dist/build-provenance-cli.js +11 -0
- package/dist/build-provenance-cli.js.map +1 -0
- package/dist/build-provenance.d.ts +20 -0
- package/dist/build-provenance.js +67 -0
- package/dist/build-provenance.js.map +1 -0
- package/dist/build-provenance.json +1 -0
- package/dist/bundled-tmux-guard.d.ts +0 -2
- package/dist/bundled-tmux-guard.js +10 -23
- package/dist/bundled-tmux-guard.js.map +1 -1
- package/dist/channel/ipc-bridge.d.ts +2 -0
- package/dist/channel/mcp-tools.js +4 -4
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/classic-bindings.d.ts +13 -0
- package/dist/classic-bindings.js +28 -2
- package/dist/classic-bindings.js.map +1 -1
- package/dist/claude-auth-status.d.ts +60 -0
- package/dist/claude-auth-status.js +165 -0
- package/dist/claude-auth-status.js.map +1 -0
- package/dist/cli-audited.d.ts +60 -0
- package/dist/cli-audited.js +84 -0
- package/dist/cli-audited.js.map +1 -0
- package/dist/cli-capability.d.ts +217 -0
- package/dist/cli-capability.js +55 -0
- package/dist/cli-capability.js.map +1 -0
- package/dist/cli-caps-module.d.ts +33 -0
- package/dist/cli-caps-module.js +45 -0
- package/dist/cli-caps-module.js.map +1 -0
- package/dist/cli-registry-check.d.ts +28 -0
- package/dist/cli-registry-check.js +237 -0
- package/dist/cli-registry-check.js.map +1 -0
- package/dist/cli-registry.d.ts +578 -0
- package/dist/cli-registry.js +83 -0
- package/dist/cli-registry.js.map +1 -0
- package/dist/cli-spec-antigravity.d.ts +71 -0
- package/dist/cli-spec-antigravity.js +47 -0
- package/dist/cli-spec-antigravity.js.map +1 -0
- package/dist/cli-spec-claude-code.d.ts +93 -0
- package/dist/cli-spec-claude-code.js +37 -0
- package/dist/cli-spec-claude-code.js.map +1 -0
- package/dist/cli-spec-codex.d.ts +87 -0
- package/dist/cli-spec-codex.js +40 -0
- package/dist/cli-spec-codex.js.map +1 -0
- package/dist/cli-spec-grok.d.ts +64 -0
- package/dist/cli-spec-grok.js +40 -0
- package/dist/cli-spec-grok.js.map +1 -0
- package/dist/cli-spec-kiro-cli.d.ts +79 -0
- package/dist/cli-spec-kiro-cli.js +40 -0
- package/dist/cli-spec-kiro-cli.js.map +1 -0
- package/dist/cli-spec-muse.d.ts +54 -0
- package/dist/cli-spec-muse.js +40 -0
- package/dist/cli-spec-muse.js.map +1 -0
- package/dist/cli-spec-opencode.d.ts +60 -0
- package/dist/cli-spec-opencode.js +42 -0
- package/dist/cli-spec-opencode.js.map +1 -0
- package/dist/cli.js +311 -54
- package/dist/cli.js.map +1 -1
- package/dist/codex-pane-ownership.d.ts +13 -0
- package/dist/codex-pane-ownership.js +192 -0
- package/dist/codex-pane-ownership.js.map +1 -0
- package/dist/config-validator.js +140 -9
- package/dist/config-validator.js.map +1 -1
- package/dist/config.js +16 -0
- package/dist/config.js.map +1 -1
- package/dist/create-host-account.d.ts +17 -0
- package/dist/create-host-account.js +47 -0
- package/dist/create-host-account.js.map +1 -0
- package/dist/daemon.d.ts +104 -7
- package/dist/daemon.js +1062 -282
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-consumed-watch.d.ts +15 -3
- package/dist/delivery-consumed-watch.js +23 -1
- package/dist/delivery-consumed-watch.js.map +1 -1
- package/dist/delivery-outbox.d.ts +9 -0
- package/dist/delivery-outbox.js +43 -4
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/delivery-reconciliation.d.ts +2 -42
- package/dist/delivery-reconciliation.js +2 -164
- package/dist/delivery-reconciliation.js.map +1 -1
- package/dist/dispatcher-liveness.d.ts +172 -0
- package/dist/dispatcher-liveness.js +238 -0
- package/dist/dispatcher-liveness.js.map +1 -0
- package/dist/doctor.js +19 -9
- package/dist/doctor.js.map +1 -1
- package/dist/e2e-isolation.js +5 -2
- package/dist/e2e-isolation.js.map +1 -1
- package/dist/fleet-context.d.ts +7 -3
- package/dist/fleet-control-audit.d.ts +1 -1
- package/dist/fleet-level-config.d.ts +1 -1
- package/dist/fleet-level-config.js +2 -0
- package/dist/fleet-level-config.js.map +1 -1
- package/dist/fleet-manager.d.ts +1112 -33
- package/dist/fleet-manager.js +5754 -528
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-windows-runtime.d.ts +98 -0
- package/dist/fleet-windows-runtime.js +467 -0
- package/dist/fleet-windows-runtime.js.map +1 -0
- package/dist/general-binding.d.ts +85 -0
- package/dist/general-binding.js +298 -0
- package/dist/general-binding.js.map +1 -0
- package/dist/general-host-owner.d.ts +8 -0
- package/dist/general-host-owner.js +26 -0
- package/dist/general-host-owner.js.map +1 -0
- package/dist/general-instance.d.ts +7 -0
- package/dist/general-instance.js +20 -3
- package/dist/general-instance.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +75 -23
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +42 -9
- package/dist/general-knowledge/skills/fleet-config/SKILL.md +1 -1
- package/dist/general-knowledge/skills/fleet-health/SKILL.md +2 -2
- package/dist/general-knowledge/skills/fleet-restart/SKILL.md +1 -1
- package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +1 -1
- package/dist/general-knowledge/skills/session-management/SKILL.md +1 -1
- package/dist/general-knowledge/skills/tui-effort/SKILL.md +10 -10
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +48 -26
- package/dist/general-knowledge/steering/core-rules.md +2 -2
- package/dist/general-role.d.ts +5 -0
- package/dist/general-role.js +27 -0
- package/dist/general-role.js.map +1 -0
- package/dist/hub/admission.d.ts +28 -0
- package/dist/hub/admission.js +62 -0
- package/dist/hub/admission.js.map +1 -0
- package/dist/hub/attachments/limits.d.ts +20 -0
- package/dist/hub/attachments/limits.js +48 -0
- package/dist/hub/attachments/limits.js.map +1 -0
- package/dist/hub/attachments/store.d.ts +116 -0
- package/dist/hub/attachments/store.js +246 -0
- package/dist/hub/attachments/store.js.map +1 -0
- package/dist/hub/audit/index.d.ts +62 -0
- package/dist/hub/audit/index.js +351 -0
- package/dist/hub/audit/index.js.map +1 -0
- package/dist/hub/browser-certificate.d.ts +38 -0
- package/dist/hub/browser-certificate.js +247 -0
- package/dist/hub/browser-certificate.js.map +1 -0
- package/dist/hub/buttons-model.d.ts +9 -0
- package/dist/hub/buttons-model.js +42 -0
- package/dist/hub/buttons-model.js.map +1 -0
- package/dist/hub/buttons.d.ts +54 -0
- package/dist/hub/buttons.js +348 -0
- package/dist/hub/buttons.js.map +1 -0
- package/dist/hub/catalog.d.ts +80 -0
- package/dist/hub/catalog.js +390 -0
- package/dist/hub/catalog.js.map +1 -0
- package/dist/hub/client.d.ts +71 -0
- package/dist/hub/client.js +335 -0
- package/dist/hub/client.js.map +1 -0
- package/dist/hub/compose/member.d.ts +147 -0
- package/dist/hub/compose/member.js +476 -0
- package/dist/hub/compose/member.js.map +1 -0
- package/dist/hub/compose/server.d.ts +170 -0
- package/dist/hub/compose/server.js +495 -0
- package/dist/hub/compose/server.js.map +1 -0
- package/dist/hub/compose/storage.d.ts +5 -0
- package/dist/hub/compose/storage.js +28 -0
- package/dist/hub/compose/storage.js.map +1 -0
- package/dist/hub/compose/views.d.ts +12 -0
- package/dist/hub/compose/views.js +4 -0
- package/dist/hub/compose/views.js.map +1 -0
- package/dist/hub/db.d.ts +58 -0
- package/dist/hub/db.js +215 -0
- package/dist/hub/db.js.map +1 -0
- package/dist/hub/directory/config.d.ts +39 -0
- package/dist/hub/directory/config.js +108 -0
- package/dist/hub/directory/config.js.map +1 -0
- package/dist/hub/directory/directory.d.ts +25 -0
- package/dist/hub/directory/directory.js +588 -0
- package/dist/hub/directory/directory.js.map +1 -0
- package/dist/hub/directory/groups.d.ts +55 -0
- package/dist/hub/directory/groups.js +30 -0
- package/dist/hub/directory/groups.js.map +1 -0
- package/dist/hub/directory/index.d.ts +8 -0
- package/dist/hub/directory/index.js +4 -0
- package/dist/hub/directory/index.js.map +1 -0
- package/dist/hub/directory/profiles.d.ts +41 -0
- package/dist/hub/directory/profiles.js +90 -0
- package/dist/hub/directory/profiles.js.map +1 -0
- package/dist/hub/directory/types.d.ts +84 -0
- package/dist/hub/directory/types.js +14 -0
- package/dist/hub/directory/types.js.map +1 -0
- package/dist/hub/directory-response-owner.d.ts +38 -0
- package/dist/hub/directory-response-owner.js +191 -0
- package/dist/hub/directory-response-owner.js.map +1 -0
- package/dist/hub/enrollment-budget.d.ts +6 -0
- package/dist/hub/enrollment-budget.js +24 -0
- package/dist/hub/enrollment-budget.js.map +1 -0
- package/dist/hub/enrolment-code.d.ts +126 -0
- package/dist/hub/enrolment-code.js +266 -0
- package/dist/hub/enrolment-code.js.map +1 -0
- package/dist/hub/execution/cli-provider.d.ts +23 -0
- package/dist/hub/execution/cli-provider.js +341 -0
- package/dist/hub/execution/cli-provider.js.map +1 -0
- package/dist/hub/execution/index.d.ts +13 -0
- package/dist/hub/execution/index.js +8 -0
- package/dist/hub/execution/index.js.map +1 -0
- package/dist/hub/execution/model-broker.d.ts +24 -0
- package/dist/hub/execution/model-broker.js +208 -0
- package/dist/hub/execution/model-broker.js.map +1 -0
- package/dist/hub/execution/provider-setup.d.ts +11 -0
- package/dist/hub/execution/provider-setup.js +21 -0
- package/dist/hub/execution/provider-setup.js.map +1 -0
- package/dist/hub/execution/sandbox-runner.d.ts +1 -0
- package/dist/hub/execution/sandbox-runner.js +221 -0
- package/dist/hub/execution/sandbox-runner.js.map +1 -0
- package/dist/hub/execution/service.d.ts +136 -0
- package/dist/hub/execution/service.js +459 -0
- package/dist/hub/execution/service.js.map +1 -0
- package/dist/hub/execution/store.d.ts +61 -0
- package/dist/hub/execution/store.js +182 -0
- package/dist/hub/execution/store.js.map +1 -0
- package/dist/hub/execution/views.d.ts +20 -0
- package/dist/hub/execution/views.js +48 -0
- package/dist/hub/execution/views.js.map +1 -0
- package/dist/hub/fleet-revocation.d.ts +3 -0
- package/dist/hub/fleet-revocation.js +7 -0
- package/dist/hub/fleet-revocation.js.map +1 -0
- package/dist/hub/group-policy/admin-api.d.ts +30 -0
- package/dist/hub/group-policy/admin-api.js +92 -0
- package/dist/hub/group-policy/admin-api.js.map +1 -0
- package/dist/hub/group-policy/admin-context.d.ts +23 -0
- package/dist/hub/group-policy/admin-context.js +52 -0
- package/dist/hub/group-policy/admin-context.js.map +1 -0
- package/dist/hub/group-policy/admin-control.d.ts +35 -0
- package/dist/hub/group-policy/admin-control.js +260 -0
- package/dist/hub/group-policy/admin-control.js.map +1 -0
- package/dist/hub/group-policy/admin-dto.d.ts +259 -0
- package/dist/hub/group-policy/admin-dto.js +57 -0
- package/dist/hub/group-policy/admin-dto.js.map +1 -0
- package/dist/hub/group-policy/admin-facts.d.ts +17 -0
- package/dist/hub/group-policy/admin-facts.js +33 -0
- package/dist/hub/group-policy/admin-facts.js.map +1 -0
- package/dist/hub/group-policy/admin-impact.d.ts +51 -0
- package/dist/hub/group-policy/admin-impact.js +90 -0
- package/dist/hub/group-policy/admin-impact.js.map +1 -0
- package/dist/hub/group-policy/admin-inventory.d.ts +24 -0
- package/dist/hub/group-policy/admin-inventory.js +72 -0
- package/dist/hub/group-policy/admin-inventory.js.map +1 -0
- package/dist/hub/group-policy/admin-read.d.ts +21 -0
- package/dist/hub/group-policy/admin-read.js +95 -0
- package/dist/hub/group-policy/admin-read.js.map +1 -0
- package/dist/hub/group-policy/admin-search.d.ts +14 -0
- package/dist/hub/group-policy/admin-search.js +72 -0
- package/dist/hub/group-policy/admin-search.js.map +1 -0
- package/dist/hub/group-policy/authorization.d.ts +79 -0
- package/dist/hub/group-policy/authorization.js +379 -0
- package/dist/hub/group-policy/authorization.js.map +1 -0
- package/dist/hub/group-policy/impact-inventory.d.ts +21 -0
- package/dist/hub/group-policy/impact-inventory.js +75 -0
- package/dist/hub/group-policy/impact-inventory.js.map +1 -0
- package/dist/hub/group-policy/model.d.ts +56 -0
- package/dist/hub/group-policy/model.js +46 -0
- package/dist/hub/group-policy/model.js.map +1 -0
- package/dist/hub/group-policy/resources.d.ts +111 -0
- package/dist/hub/group-policy/resources.js +298 -0
- package/dist/hub/group-policy/resources.js.map +1 -0
- package/dist/hub/group-policy/store.d.ts +75 -0
- package/dist/hub/group-policy/store.js +255 -0
- package/dist/hub/group-policy/store.js.map +1 -0
- package/dist/hub/group-policy/welcome.d.ts +36 -0
- package/dist/hub/group-policy/welcome.js +55 -0
- package/dist/hub/group-policy/welcome.js.map +1 -0
- package/dist/hub/http/compose.d.ts +24 -0
- package/dist/hub/http/compose.js +766 -0
- package/dist/hub/http/compose.js.map +1 -0
- package/dist/hub/http/core.d.ts +71 -0
- package/dist/hub/http/core.js +266 -0
- package/dist/hub/http/core.js.map +1 -0
- package/dist/hub/http/deps.d.ts +79 -0
- package/dist/hub/http/deps.js +2 -0
- package/dist/hub/http/deps.js.map +1 -0
- package/dist/hub/http/schema.d.ts +14 -0
- package/dist/hub/http/schema.js +84 -0
- package/dist/hub/http/schema.js.map +1 -0
- package/dist/hub/identity.d.ts +32 -0
- package/dist/hub/identity.js +80 -0
- package/dist/hub/identity.js.map +1 -0
- package/dist/hub/init/browser-certificate.d.ts +14 -0
- package/dist/hub/init/browser-certificate.js +99 -0
- package/dist/hub/init/browser-certificate.js.map +1 -0
- package/dist/hub/init/browser-tls.d.ts +18 -0
- package/dist/hub/init/browser-tls.js +62 -0
- package/dist/hub/init/browser-tls.js.map +1 -0
- package/dist/hub/init/cli.d.ts +3 -0
- package/dist/hub/init/cli.js +83 -0
- package/dist/hub/init/cli.js.map +1 -0
- package/dist/hub/init/directory-certificate.d.ts +24 -0
- package/dist/hub/init/directory-certificate.js +229 -0
- package/dist/hub/init/directory-certificate.js.map +1 -0
- package/dist/hub/init/existing-fleet.d.ts +6 -0
- package/dist/hub/init/existing-fleet.js +58 -0
- package/dist/hub/init/existing-fleet.js.map +1 -0
- package/dist/hub/init/handoff.d.ts +8 -0
- package/dist/hub/init/handoff.js +36 -0
- package/dist/hub/init/handoff.js.map +1 -0
- package/dist/hub/init/identity.d.ts +5 -0
- package/dist/hub/init/identity.js +24 -0
- package/dist/hub/init/identity.js.map +1 -0
- package/dist/hub/init/initializer.d.ts +34 -0
- package/dist/hub/init/initializer.js +504 -0
- package/dist/hub/init/initializer.js.map +1 -0
- package/dist/hub/init/inventory.d.ts +17 -0
- package/dist/hub/init/inventory.js +33 -0
- package/dist/hub/init/inventory.js.map +1 -0
- package/dist/hub/init/layout.d.ts +32 -0
- package/dist/hub/init/layout.js +53 -0
- package/dist/hub/init/layout.js.map +1 -0
- package/dist/hub/init/network.d.ts +20 -0
- package/dist/hub/init/network.js +108 -0
- package/dist/hub/init/network.js.map +1 -0
- package/dist/hub/init/plan-digest.d.ts +5 -0
- package/dist/hub/init/plan-digest.js +49 -0
- package/dist/hub/init/plan-digest.js.map +1 -0
- package/dist/hub/init/prompt.d.ts +26 -0
- package/dist/hub/init/prompt.js +111 -0
- package/dist/hub/init/prompt.js.map +1 -0
- package/dist/hub/init/secret-file.d.ts +1 -0
- package/dist/hub/init/secret-file.js +59 -0
- package/dist/hub/init/secret-file.js.map +1 -0
- package/dist/hub/init/text.d.ts +129 -0
- package/dist/hub/init/text.js +251 -0
- package/dist/hub/init/text.js.map +1 -0
- package/dist/hub/init/types.d.ts +142 -0
- package/dist/hub/init/types.js +9 -0
- package/dist/hub/init/types.js.map +1 -0
- package/dist/hub/init/web-audit-import.d.ts +12 -0
- package/dist/hub/init/web-audit-import.js +39 -0
- package/dist/hub/init/web-audit-import.js.map +1 -0
- package/dist/hub/init/web-audit.d.ts +30 -0
- package/dist/hub/init/web-audit.js +42 -0
- package/dist/hub/init/web-audit.js.map +1 -0
- package/dist/hub/init/web-error.d.ts +6 -0
- package/dist/hub/init/web-error.js +8 -0
- package/dist/hub/init/web-error.js.map +1 -0
- package/dist/hub/init/web-http.d.ts +9 -0
- package/dist/hub/init/web-http.js +103 -0
- package/dist/hub/init/web-http.js.map +1 -0
- package/dist/hub/init/web.d.ts +125 -0
- package/dist/hub/init/web.js +433 -0
- package/dist/hub/init/web.js.map +1 -0
- package/dist/hub/init/wizard.d.ts +34 -0
- package/dist/hub/init/wizard.js +580 -0
- package/dist/hub/init/wizard.js.map +1 -0
- package/dist/hub/initialization.d.ts +23 -0
- package/dist/hub/initialization.js +28 -0
- package/dist/hub/initialization.js.map +1 -0
- package/dist/hub/join/client.d.ts +52 -0
- package/dist/hub/join/client.js +136 -0
- package/dist/hub/join/client.js.map +1 -0
- package/dist/hub/join/descriptor.d.ts +52 -0
- package/dist/hub/join/descriptor.js +59 -0
- package/dist/hub/join/descriptor.js.map +1 -0
- package/dist/hub/join/display.d.ts +18 -0
- package/dist/hub/join/display.js +53 -0
- package/dist/hub/join/display.js.map +1 -0
- package/dist/hub/join/fleet-authority.d.ts +2 -0
- package/dist/hub/join/fleet-authority.js +3 -0
- package/dist/hub/join/fleet-authority.js.map +1 -0
- package/dist/hub/join/http.d.ts +8 -0
- package/dist/hub/join/http.js +122 -0
- package/dist/hub/join/http.js.map +1 -0
- package/dist/hub/join/invitation.d.ts +28 -0
- package/dist/hub/join/invitation.js +28 -0
- package/dist/hub/join/invitation.js.map +1 -0
- package/dist/hub/join/local-journal.d.ts +84 -0
- package/dist/hub/join/local-journal.js +65 -0
- package/dist/hub/join/local-journal.js.map +1 -0
- package/dist/hub/join/local.d.ts +255 -0
- package/dist/hub/join/local.js +678 -0
- package/dist/hub/join/local.js.map +1 -0
- package/dist/hub/join/private.d.ts +3 -0
- package/dist/hub/join/private.js +46 -0
- package/dist/hub/join/private.js.map +1 -0
- package/dist/hub/join/protocol.d.ts +69 -0
- package/dist/hub/join/protocol.js +96 -0
- package/dist/hub/join/protocol.js.map +1 -0
- package/dist/hub/join/receipt.d.ts +43 -0
- package/dist/hub/join/receipt.js +75 -0
- package/dist/hub/join/receipt.js.map +1 -0
- package/dist/hub/join/service.d.ts +280 -0
- package/dist/hub/join/service.js +802 -0
- package/dist/hub/join/service.js.map +1 -0
- package/dist/hub/join/store.d.ts +135 -0
- package/dist/hub/join/store.js +136 -0
- package/dist/hub/join/store.js.map +1 -0
- package/dist/hub/join/trust.d.ts +19 -0
- package/dist/hub/join/trust.js +94 -0
- package/dist/hub/join/trust.js.map +1 -0
- package/dist/hub/member/agent-mode.d.ts +6 -0
- package/dist/hub/member/agent-mode.js +23 -0
- package/dist/hub/member/agent-mode.js.map +1 -0
- package/dist/hub/member/attachments.d.ts +29 -0
- package/dist/hub/member/attachments.js +107 -0
- package/dist/hub/member/attachments.js.map +1 -0
- package/dist/hub/member/exposure-api.d.ts +91 -0
- package/dist/hub/member/exposure-api.js +67 -0
- package/dist/hub/member/exposure-api.js.map +1 -0
- package/dist/hub/member/exposures.d.ts +127 -0
- package/dist/hub/member/exposures.js +292 -0
- package/dist/hub/member/exposures.js.map +1 -0
- package/dist/hub/member/pairing-api.d.ts +101 -0
- package/dist/hub/member/pairing-api.js +429 -0
- package/dist/hub/member/pairing-api.js.map +1 -0
- package/dist/hub/member/pairing-notices.d.ts +18 -0
- package/dist/hub/member/pairing-notices.js +62 -0
- package/dist/hub/member/pairing-notices.js.map +1 -0
- package/dist/hub/member/quota.d.ts +20 -0
- package/dist/hub/member/quota.js +98 -0
- package/dist/hub/member/quota.js.map +1 -0
- package/dist/hub/member-journal.d.ts +104 -0
- package/dist/hub/member-journal.js +336 -0
- package/dist/hub/member-journal.js.map +1 -0
- package/dist/hub/member-reconciliation.d.ts +14 -0
- package/dist/hub/member-reconciliation.js +97 -0
- package/dist/hub/member-reconciliation.js.map +1 -0
- package/dist/hub/mount.d.ts +50 -0
- package/dist/hub/mount.js +157 -0
- package/dist/hub/mount.js.map +1 -0
- package/dist/hub/pairing-client.d.ts +17 -0
- package/dist/hub/pairing-client.js +108 -0
- package/dist/hub/pairing-client.js.map +1 -0
- package/dist/hub/pairing-notices.d.ts +50 -0
- package/dist/hub/pairing-notices.js +271 -0
- package/dist/hub/pairing-notices.js.map +1 -0
- package/dist/hub/pairing.d.ts +116 -0
- package/dist/hub/pairing.js +526 -0
- package/dist/hub/pairing.js.map +1 -0
- package/dist/hub/policy.d.ts +65 -0
- package/dist/hub/policy.js +154 -0
- package/dist/hub/policy.js.map +1 -0
- package/dist/hub/preview.d.ts +32 -0
- package/dist/hub/preview.js +64 -0
- package/dist/hub/preview.js.map +1 -0
- package/dist/hub/private-files.d.ts +5 -0
- package/dist/hub/private-files.js +44 -0
- package/dist/hub/private-files.js.map +1 -0
- package/dist/hub/profile.d.ts +59 -0
- package/dist/hub/profile.js +73 -0
- package/dist/hub/profile.js.map +1 -0
- package/dist/hub/protocol.d.ts +895 -0
- package/dist/hub/protocol.js +105 -0
- package/dist/hub/protocol.js.map +1 -0
- package/dist/hub/quota.d.ts +24 -0
- package/dist/hub/quota.js +112 -0
- package/dist/hub/quota.js.map +1 -0
- package/dist/hub/representative.d.ts +141 -0
- package/dist/hub/representative.js +528 -0
- package/dist/hub/representative.js.map +1 -0
- package/dist/hub/retention.d.ts +17 -0
- package/dist/hub/retention.js +45 -0
- package/dist/hub/retention.js.map +1 -0
- package/dist/hub/room-read-pacer.d.ts +14 -0
- package/dist/hub/room-read-pacer.js +51 -0
- package/dist/hub/room-read-pacer.js.map +1 -0
- package/dist/hub/rooms.d.ts +127 -0
- package/dist/hub/rooms.js +597 -0
- package/dist/hub/rooms.js.map +1 -0
- package/dist/hub/runtime.d.ts +163 -0
- package/dist/hub/runtime.js +708 -0
- package/dist/hub/runtime.js.map +1 -0
- package/dist/hub/server.d.ts +61 -0
- package/dist/hub/server.js +263 -0
- package/dist/hub/server.js.map +1 -0
- package/dist/hub/service-start.d.ts +17 -0
- package/dist/hub/service-start.js +109 -0
- package/dist/hub/service-start.js.map +1 -0
- package/dist/hub/session-directory-transition.d.ts +48 -0
- package/dist/hub/session-directory-transition.js +118 -0
- package/dist/hub/session-directory-transition.js.map +1 -0
- package/dist/hub/session-epoch.d.ts +16 -0
- package/dist/hub/session-epoch.js +50 -0
- package/dist/hub/session-epoch.js.map +1 -0
- package/dist/hub/sessions.d.ts +66 -0
- package/dist/hub/sessions.js +217 -0
- package/dist/hub/sessions.js.map +1 -0
- package/dist/hub/settings-api.d.ts +50 -0
- package/dist/hub/settings-api.js +92 -0
- package/dist/hub/settings-api.js.map +1 -0
- package/dist/hub/settings-commit.d.ts +108 -0
- package/dist/hub/settings-commit.js +537 -0
- package/dist/hub/settings-commit.js.map +1 -0
- package/dist/hub/settings-directory-ca.d.ts +31 -0
- package/dist/hub/settings-directory-ca.js +115 -0
- package/dist/hub/settings-directory-ca.js.map +1 -0
- package/dist/hub/settings-directory-control.d.ts +58 -0
- package/dist/hub/settings-directory-control.js +117 -0
- package/dist/hub/settings-directory-control.js.map +1 -0
- package/dist/hub/settings-directory-decision.d.ts +465 -0
- package/dist/hub/settings-directory-decision.js +322 -0
- package/dist/hub/settings-directory-decision.js.map +1 -0
- package/dist/hub/settings-directory-host-http.d.ts +9 -0
- package/dist/hub/settings-directory-host-http.js +75 -0
- package/dist/hub/settings-directory-host-http.js.map +1 -0
- package/dist/hub/settings-directory-host-notice-http.d.ts +9 -0
- package/dist/hub/settings-directory-host-notice-http.js +78 -0
- package/dist/hub/settings-directory-host-notice-http.js.map +1 -0
- package/dist/hub/settings-directory-host-notices.d.ts +11 -0
- package/dist/hub/settings-directory-host-notices.js +39 -0
- package/dist/hub/settings-directory-host-notices.js.map +1 -0
- package/dist/hub/settings-directory-http.d.ts +33 -0
- package/dist/hub/settings-directory-http.js +109 -0
- package/dist/hub/settings-directory-http.js.map +1 -0
- package/dist/hub/settings-directory-mount.d.ts +24 -0
- package/dist/hub/settings-directory-mount.js +77 -0
- package/dist/hub/settings-directory-mount.js.map +1 -0
- package/dist/hub/settings-directory-notices.d.ts +61 -0
- package/dist/hub/settings-directory-notices.js +132 -0
- package/dist/hub/settings-directory-notices.js.map +1 -0
- package/dist/hub/settings-directory-proof.d.ts +77 -0
- package/dist/hub/settings-directory-proof.js +313 -0
- package/dist/hub/settings-directory-proof.js.map +1 -0
- package/dist/hub/settings-directory-recovery-intent.d.ts +13 -0
- package/dist/hub/settings-directory-recovery-intent.js +29 -0
- package/dist/hub/settings-directory-recovery-intent.js.map +1 -0
- package/dist/hub/settings-directory-recovery.d.ts +45 -0
- package/dist/hub/settings-directory-recovery.js +178 -0
- package/dist/hub/settings-directory-recovery.js.map +1 -0
- package/dist/hub/settings-directory-runtime.d.ts +17 -0
- package/dist/hub/settings-directory-runtime.js +2 -0
- package/dist/hub/settings-directory-runtime.js.map +1 -0
- package/dist/hub/settings-directory-save.d.ts +37 -0
- package/dist/hub/settings-directory-save.js +175 -0
- package/dist/hub/settings-directory-save.js.map +1 -0
- package/dist/hub/settings-web-address-control.d.ts +49 -0
- package/dist/hub/settings-web-address-control.js +99 -0
- package/dist/hub/settings-web-address-control.js.map +1 -0
- package/dist/hub/settings-web-address-decision.d.ts +91 -0
- package/dist/hub/settings-web-address-decision.js +163 -0
- package/dist/hub/settings-web-address-decision.js.map +1 -0
- package/dist/hub/settings-web-address-http.d.ts +9 -0
- package/dist/hub/settings-web-address-http.js +74 -0
- package/dist/hub/settings-web-address-http.js.map +1 -0
- package/dist/hub/settings-web-address-network.d.ts +2 -0
- package/dist/hub/settings-web-address-network.js +25 -0
- package/dist/hub/settings-web-address-network.js.map +1 -0
- package/dist/hub/settings-web-address-policy.d.ts +27 -0
- package/dist/hub/settings-web-address-policy.js +47 -0
- package/dist/hub/settings-web-address-policy.js.map +1 -0
- package/dist/hub/settings-web-address.d.ts +64 -0
- package/dist/hub/settings-web-address.js +226 -0
- package/dist/hub/settings-web-address.js.map +1 -0
- package/dist/hub/socket.d.ts +24 -0
- package/dist/hub/socket.js +79 -0
- package/dist/hub/socket.js.map +1 -0
- package/dist/hub/store.d.ts +87 -0
- package/dist/hub/store.js +108 -0
- package/dist/hub/store.js.map +1 -0
- package/dist/hub/tls.d.ts +31 -0
- package/dist/hub/tls.js +135 -0
- package/dist/hub/tls.js.map +1 -0
- package/dist/hub/types.d.ts +429 -0
- package/dist/hub/types.js +2 -0
- package/dist/hub/types.js.map +1 -0
- package/dist/hub/validation.d.ts +33 -0
- package/dist/hub/validation.js +136 -0
- package/dist/hub/validation.js.map +1 -0
- package/dist/hub/version-floor.d.ts +10 -0
- package/dist/hub/version-floor.js +45 -0
- package/dist/hub/version-floor.js.map +1 -0
- package/dist/hub-browser-certificate-policy.d.ts +31 -0
- package/dist/hub-browser-certificate-policy.js +25 -0
- package/dist/hub-browser-certificate-policy.js.map +1 -0
- package/dist/hub-host-settings.d.ts +48 -0
- package/dist/hub-host-settings.js +85 -0
- package/dist/hub-host-settings.js.map +1 -0
- package/dist/hub-membership-settings.d.ts +6 -0
- package/dist/hub-membership-settings.js +21 -0
- package/dist/hub-membership-settings.js.map +1 -0
- package/dist/hub-mode.d.ts +15 -0
- package/dist/hub-mode.js +17 -0
- package/dist/hub-mode.js.map +1 -0
- package/dist/hub-pairing-summary.d.ts +50 -0
- package/dist/hub-pairing-summary.js +39 -0
- package/dist/hub-pairing-summary.js.map +1 -0
- package/dist/hub-report-target.d.ts +32 -0
- package/dist/hub-report-target.js +33 -0
- package/dist/hub-report-target.js.map +1 -0
- package/dist/hub-retention-policy.d.ts +14 -0
- package/dist/hub-retention-policy.js +15 -0
- package/dist/hub-retention-policy.js.map +1 -0
- package/dist/install-user-systemd.d.ts +20 -0
- package/dist/install-user-systemd.js +55 -0
- package/dist/install-user-systemd.js.map +1 -0
- package/dist/instance-config-impact.js +13 -0
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +42 -4
- package/dist/instance-lifecycle.js +464 -202
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.d.ts +2 -0
- package/dist/instructions.js +6 -0
- package/dist/instructions.js.map +1 -1
- package/dist/launchd-service-domain.d.ts +5 -0
- package/dist/launchd-service-domain.js +21 -0
- package/dist/launchd-service-domain.js.map +1 -0
- package/dist/linux-launchers.d.ts +88 -0
- package/dist/linux-launchers.js +296 -0
- package/dist/linux-launchers.js.map +1 -0
- package/dist/local-pane-endpoint.d.ts +46 -0
- package/dist/local-pane-endpoint.js +189 -0
- package/dist/local-pane-endpoint.js.map +1 -0
- package/dist/local-pane-launcher.d.ts +2 -0
- package/dist/local-pane-launcher.js +38 -0
- package/dist/local-pane-launcher.js.map +1 -0
- package/dist/local-pane-stage.ps1 +101 -0
- package/dist/locale.js +406 -14
- package/dist/locale.js.map +1 -1
- package/dist/log-service.d.ts +62 -6
- package/dist/log-service.js +135 -28
- package/dist/log-service.js.map +1 -1
- package/dist/log-steps-agy-grok.d.ts +74 -0
- package/dist/log-steps-agy-grok.js +440 -0
- package/dist/log-steps-agy-grok.js.map +1 -0
- package/dist/log-steps.d.ts +62 -3
- package/dist/log-steps.js +188 -22
- package/dist/log-steps.js.map +1 -1
- package/dist/log-transcript-paths.d.ts +29 -0
- package/dist/log-transcript-paths.js +109 -0
- package/dist/log-transcript-paths.js.map +1 -0
- package/dist/login-controller.d.ts +31 -4
- package/dist/login-controller.js +88 -6
- package/dist/login-controller.js.map +1 -1
- package/dist/login-flows.d.ts +12 -8
- package/dist/login-flows.js +34 -16
- package/dist/login-flows.js.map +1 -1
- package/dist/login-manager.d.ts +2 -2
- package/dist/login-manager.js +3 -2
- package/dist/login-manager.js.map +1 -1
- package/dist/login-window-lock.d.ts +20 -7
- package/dist/login-window-lock.js +35 -16
- package/dist/login-window-lock.js.map +1 -1
- package/dist/ls-rows.d.ts +1 -1
- package/dist/ls-rows.js +3 -4
- package/dist/ls-rows.js.map +1 -1
- package/dist/machine-accounts.d.ts +110 -0
- package/dist/machine-accounts.js +229 -0
- package/dist/machine-accounts.js.map +1 -0
- package/dist/machine-signins.d.ts +89 -0
- package/dist/machine-signins.js +182 -0
- package/dist/machine-signins.js.map +1 -0
- package/dist/model-catalog-defaults.d.ts +14 -0
- package/dist/model-catalog-defaults.js +20 -0
- package/dist/model-catalog-defaults.js.map +1 -0
- package/dist/native-agent-admission.d.ts +7 -0
- package/dist/native-agent-admission.js +26 -0
- package/dist/native-agent-admission.js.map +1 -0
- package/dist/native-daemon-client.d.ts +13 -0
- package/dist/native-daemon-client.js +28 -0
- package/dist/native-daemon-client.js.map +1 -0
- package/dist/native-instance-api.d.ts +13 -0
- package/dist/native-instance-api.js +217 -0
- package/dist/native-instance-api.js.map +1 -0
- package/dist/native-instance-input.d.ts +87 -0
- package/dist/native-instance-input.js +59 -0
- package/dist/native-instance-input.js.map +1 -0
- package/dist/native-instance-registry.d.ts +38 -0
- package/dist/native-instance-registry.js +129 -0
- package/dist/native-instance-registry.js.map +1 -0
- package/dist/native-mcp.d.ts +43 -0
- package/dist/native-mcp.js +291 -0
- package/dist/native-mcp.js.map +1 -0
- package/dist/native-model-catalog.d.ts +25 -0
- package/dist/native-model-catalog.js +181 -0
- package/dist/native-model-catalog.js.map +1 -0
- package/dist/native-pane-crash-budget.d.ts +20 -0
- package/dist/native-pane-crash-budget.js +60 -0
- package/dist/native-pane-crash-budget.js.map +1 -0
- package/dist/native-pane-create.d.ts +26 -0
- package/dist/native-pane-create.js +53 -0
- package/dist/native-pane-create.js.map +1 -0
- package/dist/native-pane-lifecycle.d.ts +73 -0
- package/dist/native-pane-lifecycle.js +239 -0
- package/dist/native-pane-lifecycle.js.map +1 -0
- package/dist/native-pane-manager.d.ts +59 -0
- package/dist/native-pane-manager.js +592 -0
- package/dist/native-pane-manager.js.map +1 -0
- package/dist/native-pane-output-log.d.ts +15 -0
- package/dist/native-pane-output-log.js +108 -0
- package/dist/native-pane-output-log.js.map +1 -0
- package/dist/native-pane-reconciliation.d.ts +4 -0
- package/dist/native-pane-reconciliation.js +40 -0
- package/dist/native-pane-reconciliation.js.map +1 -0
- package/dist/native-pane-recovery.d.ts +12 -0
- package/dist/native-pane-recovery.js +10 -0
- package/dist/native-pane-recovery.js.map +1 -0
- package/dist/native-pane-tools.d.ts +2 -0
- package/dist/native-pane-tools.js +14 -0
- package/dist/native-pane-tools.js.map +1 -0
- package/dist/needs-you-hub.d.ts +8 -0
- package/dist/needs-you-hub.js +31 -5
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +80 -3
- package/dist/needs-you.js +46 -3
- package/dist/needs-you.js.map +1 -1
- package/dist/office-share-page.js +3 -3
- package/dist/office-share-page.js.map +1 -1
- package/dist/office-share.d.ts +28 -2
- package/dist/office-share.js +32 -3
- package/dist/office-share.js.map +1 -1
- package/dist/office-talk.d.ts +26 -0
- package/dist/office-talk.js +50 -0
- package/dist/office-talk.js.map +1 -0
- package/dist/outbound-handlers.d.ts +44 -2
- package/dist/outbound-handlers.js +169 -5
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +79 -1
- package/dist/outbound-schemas.js +37 -14
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/pane-port.d.ts +118 -0
- package/dist/pane-port.js +2 -0
- package/dist/pane-port.js.map +1 -0
- package/dist/pane-quota-history.d.ts +2 -0
- package/dist/pane-quota-history.js +20 -0
- package/dist/pane-quota-history.js.map +1 -1
- 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 +109 -0
- package/dist/profile-signins.js +249 -0
- package/dist/profile-signins.js.map +1 -0
- package/dist/public-web-gateway.js +17 -1
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/public-web-link.d.ts +16 -0
- package/dist/public-web-link.js +21 -0
- package/dist/public-web-link.js.map +1 -1
- package/dist/quickstart-api.js +9 -5
- package/dist/quickstart-api.js.map +1 -1
- package/dist/quickstart.d.ts +6 -0
- package/dist/quickstart.js +31 -4
- package/dist/quickstart.js.map +1 -1
- package/dist/quiet-run.d.ts +31 -0
- package/dist/quiet-run.js +50 -0
- package/dist/quiet-run.js.map +1 -0
- package/dist/runtime-api.d.ts +23 -0
- package/dist/runtime-api.js +413 -0
- package/dist/runtime-api.js.map +1 -0
- package/dist/runtime-assets/@xterm/addon-serialize/LICENSE +21 -0
- package/dist/runtime-assets/@xterm/addon-serialize/lib/addon-serialize.js +2 -0
- package/dist/runtime-assets/@xterm/addon-serialize/lib/addon-serialize.mjs +19 -0
- package/dist/runtime-assets/@xterm/addon-serialize/package.json +29 -0
- package/dist/runtime-assets/@xterm/headless/LICENSE +21 -0
- package/dist/runtime-assets/@xterm/headless/lib-headless/xterm-headless.js +2 -0
- package/dist/runtime-assets/@xterm/headless/lib-headless/xterm-headless.mjs +46 -0
- package/dist/runtime-assets/@xterm/headless/package.json +29 -0
- package/dist/runtime-assets/node-pty/CONPTY-LICENSE +21 -0
- package/dist/runtime-assets/node-pty/CONPTY-NOTICE.md +503 -0
- package/dist/runtime-assets/node-pty/LICENSE +69 -0
- package/dist/runtime-assets/node-pty/lib/conpty_console_list_agent.js +16 -0
- package/dist/runtime-assets/node-pty/lib/eventEmitter2.js +47 -0
- package/dist/runtime-assets/node-pty/lib/index.js +52 -0
- package/dist/runtime-assets/node-pty/lib/interfaces.js +7 -0
- package/dist/runtime-assets/node-pty/lib/shared/conout.js +11 -0
- package/dist/runtime-assets/node-pty/lib/terminal.js +190 -0
- package/dist/runtime-assets/node-pty/lib/types.js +7 -0
- package/dist/runtime-assets/node-pty/lib/unixTerminal.js +346 -0
- package/dist/runtime-assets/node-pty/lib/utils.js +39 -0
- package/dist/runtime-assets/node-pty/lib/windowsConoutConnection.js +125 -0
- package/dist/runtime-assets/node-pty/lib/windowsPtyAgent.js +320 -0
- package/dist/runtime-assets/node-pty/lib/windowsTerminal.js +199 -0
- package/dist/runtime-assets/node-pty/lib/worker/conoutSocketWorker.js +22 -0
- package/dist/runtime-assets/node-pty/package.json +64 -0
- package/dist/runtime-assets/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
- package/dist/runtime-assets/node-pty/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
- package/dist/runtime-assets/node-pty/prebuilds/win32-arm64/conpty.node +0 -0
- package/dist/runtime-assets/node-pty/prebuilds/win32-arm64/conpty_console_list.node +0 -0
- package/dist/runtime-assets/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
- package/dist/runtime-assets/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
- package/dist/runtime-assets/node-pty/prebuilds/win32-x64/conpty.node +0 -0
- package/dist/runtime-assets/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
- package/dist/runtime-autostart.d.ts +61 -0
- package/dist/runtime-autostart.js +161 -0
- package/dist/runtime-autostart.js.map +1 -0
- package/dist/runtime-background.d.ts +200 -0
- package/dist/runtime-background.js +480 -0
- package/dist/runtime-background.js.map +1 -0
- package/dist/runtime-build-info.d.ts +10 -0
- package/dist/runtime-build-info.js +64 -0
- package/dist/runtime-build-info.js.map +1 -0
- package/dist/runtime-bundle.d.ts +22 -0
- package/dist/runtime-bundle.js +158 -0
- package/dist/runtime-bundle.js.map +1 -0
- package/dist/runtime-cli-background.d.ts +92 -0
- package/dist/runtime-cli-background.js +336 -0
- package/dist/runtime-cli-background.js.map +1 -0
- package/dist/runtime-cli-install.d.ts +295 -0
- package/dist/runtime-cli-install.js +869 -0
- package/dist/runtime-cli-install.js.map +1 -0
- package/dist/runtime-cli.d.ts +21 -0
- package/dist/runtime-cli.js +578 -0
- package/dist/runtime-cli.js.map +1 -0
- package/dist/runtime-client-store.d.ts +86 -0
- package/dist/runtime-client-store.js +392 -0
- package/dist/runtime-client-store.js.map +1 -0
- package/dist/runtime-client.d.ts +258 -0
- package/dist/runtime-client.js +1353 -0
- package/dist/runtime-client.js.map +1 -0
- package/dist/runtime-connection.d.ts +22 -0
- package/dist/runtime-connection.js +93 -0
- package/dist/runtime-connection.js.map +1 -0
- package/dist/runtime-coordinator.d.ts +201 -0
- package/dist/runtime-coordinator.js +1514 -0
- package/dist/runtime-coordinator.js.map +1 -0
- package/dist/runtime-credential-profiles.d.ts +89 -0
- package/dist/runtime-credential-profiles.js +304 -0
- package/dist/runtime-credential-profiles.js.map +1 -0
- package/dist/runtime-enroll-notice.d.ts +4 -0
- package/dist/runtime-enroll-notice.js +21 -0
- package/dist/runtime-enroll-notice.js.map +1 -0
- package/dist/runtime-enrollment.d.ts +21 -0
- package/dist/runtime-enrollment.js +52 -0
- package/dist/runtime-enrollment.js.map +1 -0
- package/dist/runtime-general-protocol.d.ts +22 -0
- package/dist/runtime-general-protocol.js +57 -0
- package/dist/runtime-general-protocol.js.map +1 -0
- package/dist/runtime-general-workspace.d.ts +17 -0
- package/dist/runtime-general-workspace.js +213 -0
- package/dist/runtime-general-workspace.js.map +1 -0
- package/dist/runtime-install.d.ts +50 -0
- package/dist/runtime-install.js +189 -0
- package/dist/runtime-install.js.map +1 -0
- package/dist/runtime-pane-assets.d.ts +17 -0
- package/dist/runtime-pane-assets.js +23 -0
- package/dist/runtime-pane-assets.js.map +1 -0
- package/dist/runtime-pane-boot.d.ts +9 -0
- package/dist/runtime-pane-boot.js +47 -0
- package/dist/runtime-pane-boot.js.map +1 -0
- package/dist/runtime-pane-codex-index.d.ts +10 -0
- package/dist/runtime-pane-codex-index.js +151 -0
- package/dist/runtime-pane-codex-index.js.map +1 -0
- package/dist/runtime-pane-config.d.ts +16 -0
- package/dist/runtime-pane-config.js +54 -0
- package/dist/runtime-pane-config.js.map +1 -0
- package/dist/runtime-pane-host.d.ts +63 -0
- package/dist/runtime-pane-host.js +467 -0
- package/dist/runtime-pane-host.js.map +1 -0
- package/dist/runtime-pane-job-owner.d.ts +1 -0
- package/dist/runtime-pane-job-owner.js +29 -0
- package/dist/runtime-pane-job-owner.js.map +1 -0
- package/dist/runtime-pane-job.ps1 +116 -0
- package/dist/runtime-pane-link.d.ts +47 -0
- package/dist/runtime-pane-link.js +338 -0
- package/dist/runtime-pane-link.js.map +1 -0
- package/dist/runtime-pane-mcp-protocol.d.ts +32 -0
- package/dist/runtime-pane-mcp-protocol.js +39 -0
- package/dist/runtime-pane-mcp-protocol.js.map +1 -0
- package/dist/runtime-pane-mcp-relay.d.ts +18 -0
- package/dist/runtime-pane-mcp-relay.js +80 -0
- package/dist/runtime-pane-mcp-relay.js.map +1 -0
- package/dist/runtime-pane-mcp.d.ts +55 -0
- package/dist/runtime-pane-mcp.js +153 -0
- package/dist/runtime-pane-mcp.js.map +1 -0
- package/dist/runtime-pane-native.d.ts +75 -0
- package/dist/runtime-pane-native.js +114 -0
- package/dist/runtime-pane-native.js.map +1 -0
- package/dist/runtime-pane-output.d.ts +19 -0
- package/dist/runtime-pane-output.js +53 -0
- package/dist/runtime-pane-output.js.map +1 -0
- package/dist/runtime-pane-port.d.ts +144 -0
- package/dist/runtime-pane-port.js +574 -0
- package/dist/runtime-pane-port.js.map +1 -0
- package/dist/runtime-pane-private.d.ts +16 -0
- package/dist/runtime-pane-private.js +76 -0
- package/dist/runtime-pane-private.js.map +1 -0
- package/dist/runtime-pane-private.ps1 +81 -0
- package/dist/runtime-pane-process.d.ts +4 -0
- package/dist/runtime-pane-process.js +117 -0
- package/dist/runtime-pane-process.js.map +1 -0
- package/dist/runtime-pane-protocol.d.ts +182 -0
- package/dist/runtime-pane-protocol.js +217 -0
- package/dist/runtime-pane-protocol.js.map +1 -0
- package/dist/runtime-pane-quota-history.d.ts +6 -0
- package/dist/runtime-pane-quota-history.js +44 -0
- package/dist/runtime-pane-quota-history.js.map +1 -0
- package/dist/runtime-pane-screen.d.ts +19 -0
- package/dist/runtime-pane-screen.js +76 -0
- package/dist/runtime-pane-screen.js.map +1 -0
- package/dist/runtime-pane-service.d.ts +16 -0
- package/dist/runtime-pane-service.js +256 -0
- package/dist/runtime-pane-service.js.map +1 -0
- package/dist/runtime-pane-stdio-protocol.d.ts +54 -0
- package/dist/runtime-pane-stdio-protocol.js +94 -0
- package/dist/runtime-pane-stdio-protocol.js.map +1 -0
- package/dist/runtime-pane-stdio.d.ts +3 -0
- package/dist/runtime-pane-stdio.js +123 -0
- package/dist/runtime-pane-stdio.js.map +1 -0
- package/dist/runtime-pane-store.d.ts +43 -0
- package/dist/runtime-pane-store.js +176 -0
- package/dist/runtime-pane-store.js.map +1 -0
- package/dist/runtime-pane-transcript-protocol.d.ts +43 -0
- package/dist/runtime-pane-transcript-protocol.js +58 -0
- package/dist/runtime-pane-transcript-protocol.js.map +1 -0
- package/dist/runtime-pane-transcript.d.ts +50 -0
- package/dist/runtime-pane-transcript.js +666 -0
- package/dist/runtime-pane-transcript.js.map +1 -0
- package/dist/runtime-pane-worker.d.ts +1 -0
- package/dist/runtime-pane-worker.js +167 -0
- package/dist/runtime-pane-worker.js.map +1 -0
- package/dist/runtime-profile-ownership.d.ts +66 -0
- package/dist/runtime-profile-ownership.js +391 -0
- package/dist/runtime-profile-ownership.js.map +1 -0
- package/dist/runtime-protocol.d.ts +340 -0
- package/dist/runtime-protocol.js +179 -0
- package/dist/runtime-protocol.js.map +1 -0
- package/dist/runtime-remote-accounts.d.ts +209 -0
- package/dist/runtime-remote-accounts.js +714 -0
- package/dist/runtime-remote-accounts.js.map +1 -0
- package/dist/runtime-remote-setup.d.ts +108 -0
- package/dist/runtime-remote-setup.js +532 -0
- package/dist/runtime-remote-setup.js.map +1 -0
- package/dist/runtime-signin-transport.d.ts +39 -0
- package/dist/runtime-signin-transport.js +111 -0
- package/dist/runtime-signin-transport.js.map +1 -0
- package/dist/runtime-signin.d.ts +132 -0
- package/dist/runtime-signin.js +290 -0
- package/dist/runtime-signin.js.map +1 -0
- package/dist/runtime-switches.d.ts +79 -0
- package/dist/runtime-switches.js +90 -0
- package/dist/runtime-switches.js.map +1 -0
- package/dist/runtime-transcript-delta-reader.d.ts +23 -0
- package/dist/runtime-transcript-delta-reader.js +74 -0
- package/dist/runtime-transcript-delta-reader.js.map +1 -0
- package/dist/runtime-transcript-source.d.ts +36 -0
- package/dist/runtime-transcript-source.js +189 -0
- package/dist/runtime-transcript-source.js.map +1 -0
- package/dist/runtime-update-activity.d.ts +21 -0
- package/dist/runtime-update-activity.js +51 -0
- package/dist/runtime-update-activity.js.map +1 -0
- package/dist/runtime-update-artifact.d.ts +31 -0
- package/dist/runtime-update-artifact.js +252 -0
- package/dist/runtime-update-artifact.js.map +1 -0
- package/dist/runtime-update-attention.d.ts +4 -0
- package/dist/runtime-update-attention.js +11 -0
- package/dist/runtime-update-attention.js.map +1 -0
- package/dist/runtime-update-controller.d.ts +86 -0
- package/dist/runtime-update-controller.js +743 -0
- package/dist/runtime-update-controller.js.map +1 -0
- package/dist/runtime-update-install.d.ts +31 -0
- package/dist/runtime-update-install.js +205 -0
- package/dist/runtime-update-install.js.map +1 -0
- package/dist/runtime-update-ipc.d.ts +42 -0
- package/dist/runtime-update-ipc.js +144 -0
- package/dist/runtime-update-ipc.js.map +1 -0
- package/dist/runtime-update-journal.d.ts +49 -0
- package/dist/runtime-update-journal.js +128 -0
- package/dist/runtime-update-journal.js.map +1 -0
- package/dist/runtime-update-lock.d.ts +48 -0
- package/dist/runtime-update-lock.js +232 -0
- package/dist/runtime-update-lock.js.map +1 -0
- package/dist/runtime-update-owners.d.ts +29 -0
- package/dist/runtime-update-owners.js +240 -0
- package/dist/runtime-update-owners.js.map +1 -0
- package/dist/runtime-update-protocol.d.ts +15 -0
- package/dist/runtime-update-protocol.js +13 -0
- package/dist/runtime-update-protocol.js.map +1 -0
- package/dist/runtime-update-status.d.ts +30 -0
- package/dist/runtime-update-status.js +31 -0
- package/dist/runtime-update-status.js.map +1 -0
- package/dist/runtime-windows-bridge.d.ts +42 -0
- package/dist/runtime-windows-bridge.js +167 -0
- package/dist/runtime-windows-bridge.js.map +1 -0
- package/dist/scheduler/db.d.ts +3 -0
- package/dist/scheduler/db.js +4 -0
- package/dist/scheduler/db.js.map +1 -1
- package/dist/scheduler/task-board-text.js +1 -1
- package/dist/scheduler/task-board-text.js.map +1 -1
- package/dist/scheduler/task-board.d.ts +4 -0
- package/dist/scheduler/task-board.js +9 -3
- package/dist/scheduler/task-board.js.map +1 -1
- package/dist/scheduler/task-liveness.d.ts +34 -0
- package/dist/scheduler/task-liveness.js +49 -0
- package/dist/scheduler/task-liveness.js.map +1 -0
- package/dist/selection-card.d.ts +4 -3
- package/dist/selection-card.js +2 -1
- package/dist/selection-card.js.map +1 -1
- package/dist/service-drain.d.ts +19 -0
- package/dist/service-drain.js +64 -0
- package/dist/service-drain.js.map +1 -0
- package/dist/service-installer.d.ts +7 -2
- package/dist/service-installer.js +24 -12
- package/dist/service-installer.js.map +1 -1
- package/dist/settings-api.d.ts +71 -2
- package/dist/settings-api.js +1048 -16
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-baseline.d.ts +7 -0
- package/dist/settings-baseline.js +3 -1
- package/dist/settings-baseline.js.map +1 -1
- package/dist/settings-change.d.ts +7 -3
- package/dist/settings-change.js +166 -31
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-confirmation.d.ts +67 -7
- package/dist/settings-confirmation.js +68 -15
- package/dist/settings-confirmation.js.map +1 -1
- package/dist/settings-effect.d.ts +26 -0
- package/dist/settings-effect.js +331 -5
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.d.ts +37 -0
- package/dist/settings-http-confirmation.js +162 -15
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/settings-request-capability.d.ts +14 -0
- package/dist/settings-request-capability.js +12 -1
- package/dist/settings-request-capability.js.map +1 -1
- package/dist/settings-route-lifetime.d.ts +14 -0
- package/dist/settings-route-lifetime.js +48 -0
- package/dist/settings-route-lifetime.js.map +1 -0
- package/dist/settings-summary.d.ts +24 -0
- package/dist/settings-summary.js +42 -0
- package/dist/settings-summary.js.map +1 -0
- package/dist/settings-transaction.d.ts +4 -0
- package/dist/settings-transaction.js +9 -0
- package/dist/settings-transaction.js.map +1 -1
- package/dist/setup-form.js +6 -3
- package/dist/setup-form.js.map +1 -1
- package/dist/setup-host.js +1 -1
- package/dist/setup-host.js.map +1 -1
- package/dist/setup-i18n.js +3 -0
- package/dist/setup-i18n.js.map +1 -1
- package/dist/setup-wizard.js +4 -2
- package/dist/setup-wizard.js.map +1 -1
- package/dist/signin-keepalive.d.ts +206 -0
- package/dist/signin-keepalive.js +681 -0
- package/dist/signin-keepalive.js.map +1 -0
- package/dist/structured-signin-transport.d.ts +20 -2
- package/dist/structured-signin-transport.js +57 -2
- package/dist/structured-signin-transport.js.map +1 -1
- package/dist/structured-signin.d.ts +11 -2
- package/dist/structured-signin.js +5 -7
- package/dist/structured-signin.js.map +1 -1
- package/dist/task-board-tool.d.ts +2 -1
- package/dist/task-board-tool.js +76 -7
- package/dist/task-board-tool.js.map +1 -1
- package/dist/tmux-binary.d.ts +59 -0
- package/dist/tmux-binary.js +189 -0
- package/dist/tmux-binary.js.map +1 -0
- package/dist/tmux-control.d.ts +2 -1
- package/dist/tmux-control.js +4 -4
- package/dist/tmux-control.js.map +1 -1
- package/dist/tmux-exec-helper.js +32 -1
- package/dist/tmux-exec-helper.js.map +1 -1
- package/dist/tmux-legacy.d.ts +94 -0
- package/dist/tmux-legacy.js +309 -0
- package/dist/tmux-legacy.js.map +1 -0
- package/dist/tmux-manager.d.ts +11 -4
- package/dist/tmux-manager.js +61 -40
- package/dist/tmux-manager.js.map +1 -1
- package/dist/tmux-pane-host.d.ts +26 -0
- package/dist/tmux-pane-host.js +25 -0
- package/dist/tmux-pane-host.js.map +1 -0
- package/dist/tmux-read.js +4 -3
- package/dist/tmux-read.js.map +1 -1
- package/dist/tmux-rollback.d.ts +42 -0
- package/dist/tmux-rollback.js +78 -0
- package/dist/tmux-rollback.js.map +1 -0
- package/dist/tmux-server.d.ts +102 -0
- package/dist/tmux-server.js +248 -0
- package/dist/tmux-server.js.map +1 -0
- package/dist/tool-permissions.js +2 -1
- package/dist/tool-permissions.js.map +1 -1
- package/dist/tool-progress.d.ts +7 -0
- package/dist/tool-progress.js +21 -9
- package/dist/tool-progress.js.map +1 -1
- package/dist/topic-commands.js +9 -5
- package/dist/topic-commands.js.map +1 -1
- package/dist/transcript-delta-reader.d.ts +10 -2
- package/dist/transcript-delta-reader.js +38 -9
- package/dist/transcript-delta-reader.js.map +1 -1
- package/dist/transcript-monitor.d.ts +3 -0
- package/dist/transcript-monitor.js +68 -54
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/transcript-needles.d.ts +42 -0
- package/dist/transcript-needles.js +166 -0
- package/dist/transcript-needles.js.map +1 -0
- package/dist/transcript-records.d.ts +22 -0
- package/dist/transcript-records.js +144 -0
- package/dist/transcript-records.js.map +1 -0
- package/dist/transcript-sources.d.ts +5 -0
- package/dist/transcript-sources.js +11 -79
- package/dist/transcript-sources.js.map +1 -1
- package/dist/types.d.ts +52 -0
- package/dist/ui/account-identity.js +29 -0
- package/dist/ui/accounts-keepalive.js +111 -0
- package/dist/ui/accounts-manage.js +256 -0
- package/dist/ui/accounts-view.js +491 -0
- package/dist/ui/agent-details-settings.js +326 -0
- package/dist/ui/agent-export-dialog.js +170 -0
- package/dist/ui/agent-export-strings.js +81 -0
- package/dist/ui/agent-instructions-field.js +69 -0
- package/dist/ui/agent-page-strings.js +148 -0
- package/dist/ui/agent-proposals.js +90 -0
- package/dist/ui/agent-runtime-settings.js +70 -0
- package/dist/ui/agent-runtime.js +124 -0
- package/dist/ui/backend-signin.js +153 -48
- package/dist/ui/chat-activity-groups.js +225 -0
- package/dist/ui/chat-activity.js +355 -0
- package/dist/ui/chat-ambient.js +1 -1
- package/dist/ui/chat-md-strings.js +3 -9
- package/dist/ui/chat-popout-header.js +35 -0
- package/dist/ui/chat-popout-transport.js +80 -0
- package/dist/ui/chat-popout.js +63 -0
- package/dist/ui/chat-quote.js +22 -17
- package/dist/ui/chat-render.js +3 -682
- package/dist/ui/chat-store.js +84 -11
- package/dist/ui/chat-strings.js +3 -285
- package/dist/ui/chat-thread.js +3 -969
- package/dist/ui/chat-time.js +3 -80
- package/dist/ui/chat-tour.js +2 -2
- package/dist/ui/chat-workspace-gestures.js +177 -0
- package/dist/ui/chat-workspace-navigation.js +149 -0
- package/dist/ui/chat-workspace.js +319 -0
- package/dist/ui/cli-caps.js +15 -0
- package/dist/ui/cli-picker.js +42 -0
- package/dist/ui/credential-profile-select.js +54 -0
- package/dist/ui/effort-field-strings.js +18 -0
- package/dist/ui/fleet-office-dialogue.d.ts +30 -0
- package/dist/ui/fleet-office-dialogue.js +382 -0
- package/dist/ui/fleet-office-levels.js +17 -1
- package/dist/ui/fleet-office-pack.d.ts +19 -1
- package/dist/ui/fleet-office-pack.js +177 -24
- package/dist/ui/fleet-office-skin.js +23 -5
- package/dist/ui/fleet-office-store.js +13 -3
- package/dist/ui/fleet-office-zones.js +124 -9
- package/dist/ui/fleet-office.js +203 -19
- package/dist/ui/fleet-task-card.js +8 -4
- package/dist/ui/fleet-task-common.js +2 -2
- package/dist/ui/fleet-task-menu.js +188 -0
- package/dist/ui/fleet-task-stats.js +124 -0
- package/dist/ui/fleet-task-view.js +340 -0
- package/dist/ui/fleet-tasks.js +125 -39
- package/dist/ui/general-location.js +85 -0
- package/dist/ui/host-install.js +290 -0
- package/dist/ui/html-attachment.js +3 -40
- package/dist/ui/hub-agent-copy.js +23 -0
- package/dist/ui/hub-attachments.js +90 -0
- package/dist/ui/hub-button-actions.js +65 -0
- package/dist/ui/hub-chat-store.js +168 -0
- package/dist/ui/hub-chat-strings.js +79 -0
- package/dist/ui/hub-client.js +470 -0
- package/dist/ui/hub-company-join-strings.js +79 -0
- package/dist/ui/hub-company-join.js +178 -0
- package/dist/ui/hub-confirm-place.js +44 -0
- package/dist/ui/hub-directory-editor-strings.js +56 -0
- package/dist/ui/hub-directory-editor.js +163 -0
- package/dist/ui/hub-directory-notice-strings.js +28 -0
- package/dist/ui/hub-directory-notices.js +66 -0
- package/dist/ui/hub-enrolment-code-strings.js +44 -0
- package/dist/ui/hub-enrolment-code.js +159 -0
- package/dist/ui/hub-grant-strings.js +13 -0
- package/dist/ui/hub-group-policy.js +183 -0
- package/dist/ui/hub-group-search.js +82 -0
- package/dist/ui/hub-group-strings.js +110 -0
- package/dist/ui/hub-host-security-notices.js +28 -0
- package/dist/ui/hub-join-approval.js +31 -0
- package/dist/ui/hub-join-code-input.js +66 -0
- package/dist/ui/hub-join-one-strings.js +131 -0
- package/dist/ui/hub-join-queue.js +62 -0
- package/dist/ui/hub-join-steps.js +231 -0
- package/dist/ui/hub-joincode-flow-strings.js +22 -0
- package/dist/ui/hub-owner-strings.js +56 -0
- package/dist/ui/hub-pairing-progress-strings.js +15 -0
- package/dist/ui/hub-preview.js +101 -0
- package/dist/ui/hub-provider-guidance.js +31 -0
- package/dist/ui/hub-quick-pairing.js +213 -0
- package/dist/ui/hub-quick-strings.js +43 -0
- package/dist/ui/hub-quota.js +85 -0
- package/dist/ui/hub-read-strings.js +7 -0
- package/dist/ui/hub-share-refused.js +17 -0
- package/dist/ui/hub-strings.js +168 -0
- package/dist/ui/hub-switcher.js +27 -0
- package/dist/ui/hub-this-hub.js +113 -0
- package/dist/ui/hub-welcome.js +123 -0
- package/dist/ui/image-annotate.js +283 -0
- package/dist/ui/image-lightbox.js +36 -8
- package/dist/ui/log-row.js +327 -0
- package/dist/ui/machine-signin.js +56 -0
- package/dist/ui/model-picker.js +18 -14
- package/dist/ui/native-instance-settings.js +81 -0
- package/dist/ui/native-pane-recovery.js +45 -0
- package/dist/ui/office-share-page.js +4 -2
- package/dist/ui/panel-chat.js +391 -123
- package/dist/ui/panel-details.js +55 -18
- package/dist/ui/panel-fleet.js +113 -20
- package/dist/ui/panel-hub.js +1003 -0
- package/dist/ui/panel-log.js +16 -158
- package/dist/ui/panel-needs.js +175 -9
- package/dist/ui/panel-runtimes.js +645 -0
- package/dist/ui/panel-settings.js +366 -217
- package/dist/ui/panel-windows-agent.js +87 -0
- package/dist/ui/panel-windows-cli.js +189 -0
- package/dist/ui/preview-pages.js +3 -41
- package/dist/ui/preview-panel-actions.js +3 -161
- package/dist/ui/preview-panel.js +11 -550
- package/dist/ui/preview-versions.js +3 -155
- package/dist/ui/preview.js +3 -476
- package/dist/ui/provider-marks.js +83 -0
- package/dist/ui/runtime-catalog.js +55 -0
- package/dist/ui/runtime-cli-install.js +214 -0
- package/dist/ui/runtime-commands.d.ts +6 -0
- package/dist/ui/runtime-commands.js +92 -0
- package/dist/ui/runtime-update-commands.d.ts +2 -0
- package/dist/ui/runtime-update-commands.js +11 -0
- package/dist/ui/runtime-update-status.js +53 -0
- package/dist/ui/search-dialog.js +4 -0
- package/dist/ui/settings-access-overview.js +188 -0
- package/dist/ui/settings-access-strings.js +42 -0
- package/dist/ui/settings-agent-filters.js +94 -0
- package/dist/ui/settings-appearance.js +122 -23
- package/dist/ui/settings-apply.js +12 -5
- package/dist/ui/settings-build-version.js +35 -0
- package/dist/ui/settings-catalog.js +68 -16
- package/dist/ui/settings-confirm.js +112 -14
- package/dist/ui/settings-devices.js +283 -0
- package/dist/ui/settings-dialogs.js +360 -140
- package/dist/ui/settings-guests.js +25 -11
- package/dist/ui/settings-hub-browser-certificate.js +76 -0
- package/dist/ui/settings-hub-company-join.js +281 -0
- package/dist/ui/settings-hub-connection.js +175 -0
- package/dist/ui/settings-hub-directory.js +29 -0
- package/dist/ui/settings-hub-membership.js +93 -0
- package/dist/ui/settings-hub-preview.js +74 -0
- package/dist/ui/settings-hub-retention.js +54 -0
- package/dist/ui/settings-hub-run.js +61 -0
- package/dist/ui/settings-hub-section.js +67 -0
- package/dist/ui/settings-hub-setup-strings.js +70 -0
- package/dist/ui/settings-hub-setup.js +233 -0
- package/dist/ui/settings-hub.js +301 -0
- package/dist/ui/settings-layout.js +248 -0
- package/dist/ui/settings-level-titles.js +73 -0
- package/dist/ui/settings-model.js +26 -2
- package/dist/ui/settings-named-test.js +2 -2
- package/dist/ui/settings-outside.js +310 -0
- package/dist/ui/settings-public-session-strings.js +37 -0
- package/dist/ui/settings-quota-notice.js +3 -3
- package/dist/ui/settings-registry.js +30 -5
- package/dist/ui/settings-restart-strings.js +17 -0
- package/dist/ui/settings-revoke-strings.js +28 -0
- package/dist/ui/settings-shared-strings.js +161 -0
- package/dist/ui/settings-shared.js +354 -0
- package/dist/ui/settings-shortcuts.js +65 -0
- package/dist/ui/settings-strings.js +129 -48
- package/dist/ui/settings-web-authority.js +27 -14
- package/dist/ui/shared/access-overview.css +48 -0
- package/dist/ui/shared/accounts-keepalive.css +12 -0
- package/dist/ui/shared/accounts.css +88 -0
- package/dist/ui/shared/agend-auth.js +8 -1
- package/dist/ui/shared/app-ctx.js +22 -1
- package/dist/ui/shared/app-i18n.js +17 -16
- package/dist/ui/shared/app-nav.js +34 -11
- package/dist/ui/shared/app-route.js +12 -3
- package/dist/ui/shared/app-session.js +17 -12
- package/dist/ui/shared/app-shell.js +462 -57
- package/dist/ui/shared/app-store.js +3 -0
- package/dist/ui/shared/app-stream.js +3 -1
- package/dist/ui/shared/app.css +1780 -39
- package/dist/ui/shared/app.js +35 -3
- package/dist/ui/shared/chat-composer.js +74 -0
- package/dist/ui/shared/chat-md-strings.js +9 -0
- package/dist/ui/shared/chat-render.js +703 -0
- package/dist/ui/shared/chat-strings.js +333 -0
- package/dist/ui/shared/chat-thread.js +986 -0
- package/dist/ui/shared/chat-time.js +80 -0
- package/dist/ui/shared/chat-work-bar.css +12 -0
- package/dist/ui/shared/chat-workspace-memory.js +14 -0
- package/dist/ui/shared/chat-workspace-model.js +106 -0
- package/dist/ui/shared/device-roles.js +27 -0
- package/dist/ui/shared/header-tools.js +9 -9
- package/dist/ui/shared/host-install.css +10 -0
- package/dist/ui/shared/html-attachment.js +42 -0
- package/dist/ui/shared/hub-chat.css +98 -0
- package/dist/ui/shared/hub-groups.css +28 -0
- package/dist/ui/shared/hub-owner.css +65 -0
- package/dist/ui/shared/hub-quota.css +8 -0
- package/dist/ui/shared/hub-signin.css +24 -0
- package/dist/ui/shared/hub.css +78 -0
- package/dist/ui/shared/identity-color.js +9 -3
- package/dist/ui/shared/image-annotate.css +45 -0
- package/dist/ui/shared/instance-nav.js +94 -21
- package/dist/ui/shared/instance-switch.js +12 -4
- package/dist/ui/shared/machine-name.js +13 -0
- package/dist/ui/shared/model-picker.css +13 -1
- package/dist/ui/shared/page-head.js +8 -0
- package/dist/ui/shared/pane-geometry.js +29 -0
- package/dist/ui/shared/panel-view.js +39 -26
- package/dist/ui/shared/preview-pages.js +41 -0
- package/dist/ui/shared/preview-panel-actions.js +168 -0
- package/dist/ui/shared/preview-panel.js +576 -0
- package/dist/ui/shared/preview-versions.js +155 -0
- package/dist/ui/shared/preview.js +476 -0
- package/dist/ui/shared/qrcode.module.js +2237 -0
- package/dist/ui/shared/runtime-install.css +55 -0
- package/dist/ui/shared/settings-width.js +31 -0
- package/dist/ui/shared/side-rail.js +15 -0
- package/dist/ui/shared/signin.js +392 -34
- package/dist/ui/shared/task-board.css +95 -0
- package/dist/ui/shared/tokens.css +15 -0
- package/dist/ui/shared/ui-dialog.js +2 -2
- package/dist/ui/shared/ui-menu.js +54 -13
- package/dist/ui/shared/usage-dialog.js +3 -72
- package/dist/ui/shared/usage-meter.js +84 -0
- package/dist/ui/shared/vendor/qrcode-generator.LICENSE +27 -0
- package/dist/ui/shared/vendor/vendor.json +19 -2
- package/dist/ui/shared/view-roster-store.js +8 -0
- package/dist/ui/shared/view-strings.js +14 -4
- package/dist/ui/shared/web-authorize.js +53 -3
- package/dist/ui/shared/workspace-follow.css +19 -0
- package/dist/ui/shared/workspace.css +20 -0
- package/dist/ui/signin.html +41 -8
- package/dist/ui/structured-signin.js +74 -17
- package/dist/ui/windows-agents-nav.js +2 -0
- package/dist/ui/windows-cli-catalog.js +108 -0
- package/dist/ui/workspace-follow-strings.js +28 -0
- package/dist/ui/workspace-panel.js +378 -0
- package/dist/ui/workspace-strings.js +35 -0
- package/dist/unattended-install.js +2 -1
- package/dist/unattended-install.js.map +1 -1
- package/dist/update-dispatch.d.ts +62 -0
- package/dist/update-dispatch.js +69 -2
- package/dist/update-dispatch.js.map +1 -1
- package/dist/update-install.d.ts +7 -0
- package/dist/update-install.js +23 -0
- package/dist/update-install.js.map +1 -1
- package/dist/update-marker.d.ts +2 -0
- package/dist/update-marker.js.map +1 -1
- package/dist/usage/providers.d.ts +2 -0
- package/dist/usage/providers.js +20 -19
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/usage-api.d.ts +1 -1
- package/dist/usage/usage-api.js +3 -10
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/view-api.js +5 -7
- package/dist/view-api.js.map +1 -1
- package/dist/web-api.d.ts +168 -4
- package/dist/web-api.js +1611 -268
- package/dist/web-api.js.map +1 -1
- package/dist/web-backend-login.d.ts +50 -6
- package/dist/web-backend-login.js +32 -21
- package/dist/web-backend-login.js.map +1 -1
- package/dist/web-chat-history.d.ts +30 -2
- package/dist/web-chat-history.js +81 -4
- package/dist/web-chat-history.js.map +1 -1
- package/dist/web-commands.d.ts +10 -1
- package/dist/web-commands.js +1 -1
- package/dist/web-commands.js.map +1 -1
- package/dist/web-device-login.d.ts +153 -0
- package/dist/web-device-login.js +278 -0
- package/dist/web-device-login.js.map +1 -0
- package/dist/web-guest-access.js +2 -2
- package/dist/web-guest-access.js.map +1 -1
- package/dist/web-host-install.d.ts +127 -0
- package/dist/web-host-install.js +165 -0
- package/dist/web-host-install.js.map +1 -0
- package/dist/web-login.d.ts +35 -1
- package/dist/web-login.js +51 -5
- package/dist/web-login.js.map +1 -1
- package/dist/web-model-groups.d.ts +40 -0
- package/dist/web-model-groups.js +70 -0
- package/dist/web-model-groups.js.map +1 -0
- package/dist/web-notices.d.ts +9 -0
- package/dist/web-notices.js +19 -0
- package/dist/web-notices.js.map +1 -1
- package/dist/web-office-skins.d.ts +9 -0
- package/dist/web-office-skins.js +16 -1
- package/dist/web-office-skins.js.map +1 -1
- package/dist/web-office-store.d.ts +35 -2
- package/dist/web-office-store.js +64 -15
- package/dist/web-office-store.js.map +1 -1
- package/dist/web-only-fleet.d.ts +20 -0
- package/dist/web-only-fleet.js +21 -0
- package/dist/web-only-fleet.js.map +1 -1
- package/dist/web-remote-access.d.ts +341 -0
- package/dist/web-remote-access.js +801 -0
- package/dist/web-remote-access.js.map +1 -0
- package/dist/web-session.d.ts +94 -3
- package/dist/web-session.js +75 -5
- package/dist/web-session.js.map +1 -1
- package/dist/web-settings-patch.d.ts +10 -2
- package/dist/web-settings-patch.js +25 -10
- package/dist/web-settings-patch.js.map +1 -1
- package/dist/web-shell-routes.d.ts +10 -1
- package/dist/web-shell-routes.js +14 -2
- package/dist/web-shell-routes.js.map +1 -1
- package/dist/web-signin-device.d.ts +16 -0
- package/dist/web-signin-device.js +81 -0
- package/dist/web-signin-device.js.map +1 -0
- package/dist/web-signin-link.d.ts +42 -0
- package/dist/web-signin-link.js +110 -0
- package/dist/web-signin-link.js.map +1 -0
- package/dist/web-terminal.d.ts +11 -30
- package/dist/web-terminal.js +23 -8
- package/dist/web-terminal.js.map +1 -1
- package/dist/web-update.d.ts +1 -0
- package/dist/web-update.js +4 -2
- package/dist/web-update.js.map +1 -1
- package/dist/windows-agents.d.ts +127 -0
- package/dist/windows-agents.js +491 -0
- package/dist/windows-agents.js.map +1 -0
- package/dist/windows-cli-api.d.ts +48 -0
- package/dist/windows-cli-api.js +207 -0
- package/dist/windows-cli-api.js.map +1 -0
- package/dist/windows-cli-providers.d.ts +109 -0
- package/dist/windows-cli-providers.js +396 -0
- package/dist/windows-cli-providers.js.map +1 -0
- package/dist/windows-cli-worker.d.ts +99 -0
- package/dist/windows-cli-worker.js +729 -0
- package/dist/windows-cli-worker.js.map +1 -0
- package/dist/windows-cli.d.ts +130 -0
- package/dist/windows-cli.js +424 -0
- package/dist/windows-cli.js.map +1 -0
- package/dist/windows-native-mcp.d.ts +19 -0
- package/dist/windows-native-mcp.js +143 -0
- package/dist/windows-native-mcp.js.map +1 -0
- package/dist/windows-pane-mcp.d.ts +26 -0
- package/dist/windows-pane-mcp.js +187 -0
- package/dist/windows-pane-mcp.js.map +1 -0
- package/dist/windows-shortcuts.d.ts +29 -5
- package/dist/windows-shortcuts.js +52 -9
- package/dist/windows-shortcuts.js.map +1 -1
- package/dist/workspace-file-policy.d.ts +2 -0
- package/dist/workspace-file-policy.js +31 -0
- package/dist/workspace-file-policy.js.map +1 -0
- package/dist/workspace-follow-parse.d.ts +36 -0
- package/dist/workspace-follow-parse.js +208 -0
- package/dist/workspace-follow-parse.js.map +1 -0
- package/dist/workspace-follow-records.d.ts +17 -0
- package/dist/workspace-follow-records.js +88 -0
- package/dist/workspace-follow-records.js.map +1 -0
- package/dist/workspace-follow.d.ts +41 -0
- package/dist/workspace-follow.js +144 -0
- package/dist/workspace-follow.js.map +1 -0
- package/dist/wsl-detect.d.ts +1 -0
- package/dist/wsl-detect.js +20 -0
- package/dist/wsl-detect.js.map +1 -0
- package/dist/yaml-shared-nodes.js +8 -3
- package/dist/yaml-shared-nodes.js.map +1 -1
- package/launcher/agend-install.cjs +15 -2
- package/launcher/launchd-session-type.cjs +14 -0
- package/launcher/postinstall.cjs +27 -2
- package/launcher/tmux-bundle.cjs +263 -0
- package/package.json +16 -5
- package/templates/icons/agend-restart.ico +0 -0
- package/templates/icons/agend.ico +0 -0
- package/templates/launchd.plist.ejs +3 -1
- package/templates/runtime-assets/conpty-LICENSE +21 -0
- package/templates/runtime-assets/conpty-NOTICE.md +503 -0
- package/templates/runtime-assets/local-pane-stage.ps1 +101 -0
- package/templates/runtime-assets/runtime-pane-job.ps1 +116 -0
- package/templates/runtime-assets/runtime-pane-private.ps1 +81 -0
- package/templates/runtime-assets/xterm-LICENSE +21 -0
- package/templates/runtime-install/install.ps1 +618 -0
- package/templates/windows-shortcuts.ps1 +45 -12
package/dist/web-api.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { buildAgentExport, parseAgentExport } from "./agent-export.js";
|
|
2
|
+
import { hubModeOf, hubNameOf } from "./hub-mode.js";
|
|
3
|
+
import { validCredentialProfileName } from "./runtime-credential-profiles.js";
|
|
1
4
|
import { CANVAS_WORKER_EXPERIMENTAL_MESSAGE } from "./web-experimental.js";
|
|
5
|
+
import { MachineSlotLimitError } from "./windows-agents.js";
|
|
2
6
|
import { daemonTopicMode } from "./web-only-fleet.js";
|
|
3
7
|
import { webHumanOrigin } from "./human-delivery-receipts.js";
|
|
4
8
|
import { classifyWebPeer, confirmAfterBody, noAuthority } from "./authority/web-authority.js";
|
|
5
9
|
import { guestChatRefusal, guestCommandText, guestDeliveries, GUEST_PREF_MAX_BYTES, GUEST_SEARCHES, guestFrameData, guestHistory, guestMessages, guestOwnPrefs, guestPollBody, guestPrefs, guestRequestOf, guestSeesMessage, guestStatus } from "./web-guest-access.js";
|
|
6
10
|
import { withSpawnHoldReply } from "./spawn-hold-reply.js";
|
|
7
11
|
import { binaryProbe } from "./binary-probe.js";
|
|
8
|
-
import { settingsRequestExecution, settingsWrite, isSettingsReplay } from "./settings-request-capability.js";
|
|
12
|
+
import { settingsRequestExecution, settingsRequestLocalAdmin, settingsRequestRequester, settingsWrite, isSettingsReplay } from "./settings-request-capability.js";
|
|
9
13
|
import { readBoundedWebBody } from "./web-body.js";
|
|
10
14
|
import { APP_ICON_MAX_BYTES } from "./web-app-icon.js";
|
|
11
15
|
import { withAppIconLinks } from "./web-icons.js";
|
|
@@ -18,6 +22,9 @@ import { SKIN_WIRE_BYTES } from "./web-office-skins.js";
|
|
|
18
22
|
import { gatewayRequestContext } from "./web-request-context.js";
|
|
19
23
|
import { crossInstanceVisibility } from "./cross-instance-notice.js";
|
|
20
24
|
import { permitWebContinuation } from "./web-continuation.js";
|
|
25
|
+
import { HOST_CLI_PATHS, isRuntimeCliInstallPath } from "./settings-effect.js";
|
|
26
|
+
import { hostUpdateAckError } from "./web-host-install.js";
|
|
27
|
+
import { LATEST_ACK_FIELD } from "./cli-audited.js";
|
|
21
28
|
/**
|
|
22
29
|
* Web UI HTTP API handler.
|
|
23
30
|
* All /ui/* routes are handled here, extracted from fleet-manager.ts.
|
|
@@ -32,18 +39,24 @@ import { shellRoute } from "./web-shell-routes.js";
|
|
|
32
39
|
import { createReadStream, createWriteStream, readFileSync } from "node:fs";
|
|
33
40
|
import { join, dirname } from "node:path";
|
|
34
41
|
import { fileURLToPath } from "node:url";
|
|
42
|
+
import { createHash, createHmac, randomUUID } from "node:crypto";
|
|
35
43
|
import { CreateInstanceArgs, CreateScheduleArgs, UpdateScheduleArgs, validateArgs } from "./outbound-schemas.js";
|
|
36
44
|
import { scheduleView } from "./web-schedules.js";
|
|
37
45
|
import { DEFAULT_SCHEDULER_CONFIG } from "./scheduler/index.js";
|
|
38
46
|
import { CARD_PRIORITIES, CARD_SIZES, CARD_STATUSES, TaskBoardError } from "./scheduler/task-board.js";
|
|
39
47
|
import { readStatuslineModel, resolveInstanceContext } from "./topic-commands.js";
|
|
40
48
|
import { z } from "zod";
|
|
49
|
+
import { ONBOARDING_BACKENDS, ONBOARDING_BROWSER_BACKENDS } from "./backend-signin-pending.js";
|
|
41
50
|
import { evaluateWebRequest, isPassiveWebRead, isSecureRequest, isWebRequestAuthorized, WEB_TOKEN_INVALID_MESSAGE } from "./web-auth.js";
|
|
42
51
|
import { dashboardOriginFor } from "./web-preview.js";
|
|
43
52
|
import { WEB_CHAT_CARDS_OVERFLOW, catchUpWindow, newWebMessageId, parseLastEventId, webChatReplyRef, webChatReplyText } from "./web-chat-history.js";
|
|
44
53
|
import { PAGE_SHARE_LIMITS, htmlFences, htmlTitle } from "./page-share.js";
|
|
45
54
|
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";
|
|
46
55
|
import { getAgendHome } from "./paths.js";
|
|
56
|
+
import { workspaceChanges, workspaceFile, workspaceFileDiff, workspaceImage, workspaceList, workspaceRoot, WorkspaceError } from "./agent-workspace.js";
|
|
57
|
+
import { resolveFollowSteps } from "./workspace-follow.js";
|
|
58
|
+
import { isGeneralInstance } from "./general-instance.js";
|
|
59
|
+
import { resolveToolSet } from "./tool-permissions.js";
|
|
47
60
|
import { OPERATOR, isOwnerEffectKey } from "./web-prefs.js";
|
|
48
61
|
import { WEB_NAME_FALLBACK, webPersonKey } from "./web-profile.js";
|
|
49
62
|
import { commitTeamCreate, commitTeamUpdate } from "./outbound-handlers.js";
|
|
@@ -54,6 +67,15 @@ import { resolveTz } from "./tz-utils.js";
|
|
|
54
67
|
import { QUERY_MAX_CHARS, RESULT_MAX, SEARCH_SOURCES } from "./search/search-store.js";
|
|
55
68
|
import { xmsgShown } from "./search/search-docs.js";
|
|
56
69
|
import { WebSendDedupe } from "./web-send-dedupe.js";
|
|
70
|
+
import { handleWindowsCliRequest, nativeCliAuthorization } from "./windows-cli-api.js";
|
|
71
|
+
import { resolveCreateAccount } from "./create-host-account.js";
|
|
72
|
+
import { createNativeInstance, handleNativeInstanceRequest } from "./native-instance-api.js";
|
|
73
|
+
import { handleAgentRuntimeChange } from "./agent-runtime-api.js";
|
|
74
|
+
import { isWindowsInstance, isNativePaneInstance, isNativeExecInstance } from "./native-instance-registry.js";
|
|
75
|
+
import { handleNativeModelCatalog, refreshNativeModelCatalog } from "./native-model-catalog.js";
|
|
76
|
+
import { claudeDocumentedModels } from "./model-catalog-defaults.js";
|
|
77
|
+
import { shapeDocumentedClaudeModels, shapeWebModelCatalog } from "./web-model-groups.js";
|
|
78
|
+
import { handleRuntimeRequest } from "./runtime-api.js";
|
|
57
79
|
import { taskBoardOffNames } from "./dashboard-permissions.js";
|
|
58
80
|
import { topicFields } from "./instance-topic-delete.js";
|
|
59
81
|
// ── Strict public-facing schemas ────────────────────────────────────────────
|
|
@@ -234,8 +256,10 @@ function visibleNeeds(ctx, gateway, items) {
|
|
|
234
256
|
const { hidden } = boardHiding(ctx, true);
|
|
235
257
|
return items.filter((i) => {
|
|
236
258
|
const item = i;
|
|
237
|
-
if (item.type === "config")
|
|
238
|
-
return false; //
|
|
259
|
+
if (item.type === "config" || item.type === "hub")
|
|
260
|
+
return false; // member-local diagnostics/proposals never cross a public link
|
|
261
|
+
if (item.type === "runtime")
|
|
262
|
+
return false;
|
|
239
263
|
if (item.type !== "task")
|
|
240
264
|
return true;
|
|
241
265
|
const code = item.card?.code;
|
|
@@ -339,6 +363,21 @@ function jsonText(res, status, body) {
|
|
|
339
363
|
const boardBodies = new WeakMap();
|
|
340
364
|
/** #2316 review: the same for who works on what (GET /ui/tasks/work), per (revision, names asked for). */
|
|
341
365
|
const workBodies = new WeakMap();
|
|
366
|
+
/**
|
|
367
|
+
* The catalog Web Settings lists for a backend and instance (and credential profile): the fleet's shaped cache
|
|
368
|
+
* (web-model-groups.ts), else — a hand-built context — the plain list, shaped the same way.
|
|
369
|
+
*/
|
|
370
|
+
function webCatalog(ctx, backend, instance, profile, plain) {
|
|
371
|
+
if (ctx.modelCatalogForWeb)
|
|
372
|
+
return profile !== null ? ctx.modelCatalogForWeb(backend, instance, { profile }) : ctx.modelCatalogForWeb(backend, instance);
|
|
373
|
+
const flat = plain ?? (profile !== null ? ctx.modelCatalogFor?.(backend, instance, { profile }) : ctx.modelCatalogFor?.(backend, instance)) ?? [];
|
|
374
|
+
return shapeWebModelCatalog(backend, flat);
|
|
375
|
+
}
|
|
376
|
+
/** claude's fallback when no account list is readable: the documentation's `claude-*` ids for the host's CLI version, unverified. */
|
|
377
|
+
function documentedClaudeCatalog(ctx) {
|
|
378
|
+
const version = ctx.backendAvailabilityRows?.().find(row => row.backend === "claude-code")?.version;
|
|
379
|
+
return shapeDocumentedClaudeModels(claudeDocumentedModels(version));
|
|
380
|
+
}
|
|
342
381
|
/**
|
|
343
382
|
* #1630 (#1635 review): an answer that waited on something (a list, a download) is sent only if the request is still
|
|
344
383
|
* allowed — the session not revoked meanwhile, a public link's exposure still current. Otherwise 401, and nothing.
|
|
@@ -802,6 +841,76 @@ function handlePageShare(req, res, url, ctx, path, method) {
|
|
|
802
841
|
});
|
|
803
842
|
return true;
|
|
804
843
|
}
|
|
844
|
+
/**
|
|
845
|
+
* #2716/#3679: an Office-wide setting kept in web-offices.json beside the offices (PUT { <key>: value }): who may save
|
|
846
|
+
* the offices may set it — an admin session, never the CLI token or the public link; asked again once the body is in;
|
|
847
|
+
* counted with the offices' saves (OfficeWriteLimiter); every page hears `offices` and reads again.
|
|
848
|
+
*/
|
|
849
|
+
function officeSettingPut(req, res, url, ctx, o) {
|
|
850
|
+
const store = ctx.officeStore;
|
|
851
|
+
if (!store) {
|
|
852
|
+
json(res, 404, { error: "Offices are not kept on this fleet" });
|
|
853
|
+
return true;
|
|
854
|
+
}
|
|
855
|
+
if (gatewayRequestContext(req)) {
|
|
856
|
+
json(res, 403, { error: "offices_not_over_public_link" });
|
|
857
|
+
return true;
|
|
858
|
+
}
|
|
859
|
+
const who = () => {
|
|
860
|
+
const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
861
|
+
if (verdict.kind !== "allow")
|
|
862
|
+
return { status: 401 };
|
|
863
|
+
return verdict.via === "session" && verdict.session?.tier === "admin" ? { person: verdict.session.owner ? webPersonKey(verdict.session.owner) : "admin-session" } : { status: 403 };
|
|
864
|
+
};
|
|
865
|
+
const refuse = (status) => json(res, status, { error: status === 401 ? WEB_TOKEN_INVALID_MESSAGE : "offices_need_an_admin_session" });
|
|
866
|
+
const first = who();
|
|
867
|
+
if ("status" in first) {
|
|
868
|
+
refuse(first.status);
|
|
869
|
+
return true;
|
|
870
|
+
}
|
|
871
|
+
(async () => {
|
|
872
|
+
let body;
|
|
873
|
+
try {
|
|
874
|
+
body = await parseBody(req);
|
|
875
|
+
}
|
|
876
|
+
catch {
|
|
877
|
+
json(res, 400, { error: "Invalid JSON" });
|
|
878
|
+
return;
|
|
879
|
+
}
|
|
880
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
881
|
+
return;
|
|
882
|
+
const now = who();
|
|
883
|
+
if ("status" in now) {
|
|
884
|
+
refuse(now.status);
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
if (!body || typeof body !== "object" || Array.isArray(body) || !(o.key in body) || Object.keys(body).some(k => k !== o.key)) {
|
|
888
|
+
json(res, 400, { error: o.invalid, detail: o.shape });
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
const limiter = ctx.officeWrites, allowed = limiter ? limiter.check(now.person) : { ok: true };
|
|
892
|
+
if (!allowed.ok) {
|
|
893
|
+
res.setHeader("Retry-After", String(allowed.retry_after_s));
|
|
894
|
+
json(res, 429, { error: "offices_rate_limited", retry_after_s: allowed.retry_after_s });
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
const r = o.apply(store, body[o.key]);
|
|
898
|
+
if (!r.ok) {
|
|
899
|
+
json(res, r.status, { error: r.error, ...(r.detail ? { detail: r.detail } : {}) });
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
limiter?.record(now.person);
|
|
903
|
+
ctx.emitSseEvent("offices", { rev: r.rev });
|
|
904
|
+
json(res, 200, { rev: r.rev, ...r.answer });
|
|
905
|
+
})().catch(err => {
|
|
906
|
+
ctx.logger.error({ err: err.message }, o.failed);
|
|
907
|
+
try {
|
|
908
|
+
json(res, 500, { error: o.failed });
|
|
909
|
+
}
|
|
910
|
+
catch { /* already answered */ }
|
|
911
|
+
});
|
|
912
|
+
return true;
|
|
913
|
+
}
|
|
805
914
|
/**
|
|
806
915
|
* #2513: the Office view's skin packs (web-office-skins.ts). The reads are the offices' (GET /ui/offices): whoever may
|
|
807
916
|
* open the org chart, the public link too (its manifest lists them; a guest's routes do not): the list, a pack's
|
|
@@ -1223,18 +1332,142 @@ function handleBrowserBackendSignIns(req, res, url, ctx) {
|
|
|
1223
1332
|
json(res, 403, { error: "sign_in_needs_a_local_admin" });
|
|
1224
1333
|
return true;
|
|
1225
1334
|
}
|
|
1226
|
-
if (!["GET", "POST"].includes(req.method ?? "")
|
|
1335
|
+
if (!["GET", "POST"].includes(req.method ?? "")) {
|
|
1227
1336
|
json(res, 404, { error: "not_found" });
|
|
1228
1337
|
return true;
|
|
1229
1338
|
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1339
|
+
// #3190 Part 3c: `?machine=<id>&profile=<name>` addresses the same sign-in controls for a credential profile on a paired computer (machine-signins.ts). #3212:
|
|
1340
|
+
// `?backend=<cli>&profile=<name>` addresses them for a named account on THIS host (profile-signins.ts). Nothing else is accepted in the query, and both are checked
|
|
1341
|
+
// in full before anything else happens.
|
|
1342
|
+
const keys = [...url.searchParams.keys()];
|
|
1343
|
+
let target = null;
|
|
1344
|
+
let account = null;
|
|
1345
|
+
if (keys.length) {
|
|
1346
|
+
const machine = url.searchParams.get("machine"), backend = url.searchParams.get("backend"), profile = url.searchParams.get("profile");
|
|
1347
|
+
const shape = keys.length === 2 && new Set(keys).size === 2 && profile && validCredentialProfileName(profile);
|
|
1348
|
+
if (shape && machine && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(machine) && !backend)
|
|
1349
|
+
target = { machine, profile };
|
|
1350
|
+
else if (shape && backend === "claude-code" && !machine)
|
|
1351
|
+
account = { backend, profile };
|
|
1352
|
+
else {
|
|
1353
|
+
json(res, 404, { error: "not_found" });
|
|
1354
|
+
return true;
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
// Only the one that is asked for is looked up: the host's creates its checklist state, a computer's or a named account's does not need it.
|
|
1358
|
+
const service = target || account ? undefined : ctx.browserBackendSignIns, machines = target ? ctx.machineSignIns : undefined, accounts = account ? ctx.profileSignIns : undefined;
|
|
1359
|
+
if (target ? !machines : account ? !accounts : !service) {
|
|
1232
1360
|
json(res, 404, { error: "sign_in_unavailable" });
|
|
1233
1361
|
return true;
|
|
1234
1362
|
}
|
|
1235
1363
|
void (async () => {
|
|
1236
1364
|
let result;
|
|
1237
|
-
if (
|
|
1365
|
+
if (target && machines) {
|
|
1366
|
+
if (reading)
|
|
1367
|
+
result = machines.snapshot(owner, target);
|
|
1368
|
+
else {
|
|
1369
|
+
let bytes;
|
|
1370
|
+
try {
|
|
1371
|
+
bytes = await readBoundedWebBody(req, 8192);
|
|
1372
|
+
}
|
|
1373
|
+
catch {
|
|
1374
|
+
json(res, 413, { error: "sign_in_body_bound" });
|
|
1375
|
+
return;
|
|
1376
|
+
}
|
|
1377
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
1378
|
+
return;
|
|
1379
|
+
if (who() !== owner) {
|
|
1380
|
+
json(res, 409, { error: "signin_session_expired" });
|
|
1381
|
+
return;
|
|
1382
|
+
}
|
|
1383
|
+
let body;
|
|
1384
|
+
try {
|
|
1385
|
+
body = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
1386
|
+
}
|
|
1387
|
+
catch {
|
|
1388
|
+
json(res, 400, { error: "sign_in_json" });
|
|
1389
|
+
return;
|
|
1390
|
+
}
|
|
1391
|
+
// Only what a computer's sign-in can do: start (Claude Code, subscription: the Runtime builds the command), answer a prompt, cancel, read again.
|
|
1392
|
+
const parsed = z.discriminatedUnion("operation", [
|
|
1393
|
+
z.strictObject({ operation: z.literal("start"), backend: z.literal("claude-code"), relogin: z.boolean().optional() }),
|
|
1394
|
+
z.strictObject({ operation: z.literal("input"), id: z.string().regex(/^[0-9a-f]{32}$/), revision: z.number().int().nonnegative(), action: z.discriminatedUnion("kind", [
|
|
1395
|
+
z.strictObject({ kind: z.literal("method"), choice: z.string().max(32) }),
|
|
1396
|
+
z.strictObject({ kind: z.enum(["code", "start_url", "region"]), value: z.string().max(4096) }),
|
|
1397
|
+
]) }),
|
|
1398
|
+
z.strictObject({ operation: z.literal("cancel") }), z.strictObject({ operation: z.literal("refresh") }),
|
|
1399
|
+
]).safeParse(body);
|
|
1400
|
+
if (!parsed.success) {
|
|
1401
|
+
json(res, 400, { error: "invalid_signin_action" });
|
|
1402
|
+
return;
|
|
1403
|
+
}
|
|
1404
|
+
const action = parsed.data;
|
|
1405
|
+
if (action.operation === "start")
|
|
1406
|
+
result = await machines.begin(owner, target, action.relogin === true);
|
|
1407
|
+
else if (action.operation === "input")
|
|
1408
|
+
result = await machines.input(owner, target, action.id, action.revision, action.action);
|
|
1409
|
+
else if (action.operation === "cancel")
|
|
1410
|
+
result = await machines.cancel(owner, target);
|
|
1411
|
+
else
|
|
1412
|
+
result = machines.snapshot(owner, target);
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
else if (account && accounts) {
|
|
1416
|
+
if (reading)
|
|
1417
|
+
result = await accounts.refresh(owner, account);
|
|
1418
|
+
else {
|
|
1419
|
+
let bytes;
|
|
1420
|
+
try {
|
|
1421
|
+
bytes = await readBoundedWebBody(req, 8192);
|
|
1422
|
+
}
|
|
1423
|
+
catch {
|
|
1424
|
+
json(res, 413, { error: "sign_in_body_bound" });
|
|
1425
|
+
return;
|
|
1426
|
+
}
|
|
1427
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
1428
|
+
return;
|
|
1429
|
+
if (who() !== owner) {
|
|
1430
|
+
json(res, 409, { error: "signin_session_expired" });
|
|
1431
|
+
return;
|
|
1432
|
+
}
|
|
1433
|
+
let body;
|
|
1434
|
+
try {
|
|
1435
|
+
body = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
1436
|
+
}
|
|
1437
|
+
catch {
|
|
1438
|
+
json(res, 400, { error: "sign_in_json" });
|
|
1439
|
+
return;
|
|
1440
|
+
}
|
|
1441
|
+
// The same controls as the default account's, for the one account in the address: start (its backend must be the address's), answer a prompt, cancel, read again.
|
|
1442
|
+
// No checklist here: no select, no skip.
|
|
1443
|
+
const parsed = z.discriminatedUnion("operation", [
|
|
1444
|
+
z.strictObject({ operation: z.literal("start"), backend: z.literal(account.backend), relogin: z.boolean().optional() }),
|
|
1445
|
+
z.strictObject({ operation: z.literal("input"), id: z.string().regex(/^[0-9a-f]{32}$/), revision: z.number().int().nonnegative(), action: z.discriminatedUnion("kind", [
|
|
1446
|
+
z.strictObject({ kind: z.literal("method"), choice: z.string().max(32) }),
|
|
1447
|
+
z.strictObject({ kind: z.enum(["code", "start_url", "region"]), value: z.string().max(4096) }),
|
|
1448
|
+
]) }),
|
|
1449
|
+
z.strictObject({ operation: z.literal("cancel"), id: z.string().regex(/^[0-9a-f]{32}$/).optional() }), z.strictObject({ operation: z.literal("refresh") }),
|
|
1450
|
+
]).safeParse(body);
|
|
1451
|
+
if (!parsed.success) {
|
|
1452
|
+
json(res, 400, { error: "invalid_signin_action" });
|
|
1453
|
+
return;
|
|
1454
|
+
}
|
|
1455
|
+
const action = parsed.data;
|
|
1456
|
+
if (action.operation === "start")
|
|
1457
|
+
result = await accounts.begin(owner, account, action.relogin === true);
|
|
1458
|
+
else if (action.operation === "input")
|
|
1459
|
+
result = await accounts.input(owner, account, action.id, action.revision, action.action);
|
|
1460
|
+
else if (action.operation === "cancel")
|
|
1461
|
+
result = await accounts.cancel(owner, account, action.id);
|
|
1462
|
+
else
|
|
1463
|
+
result = await accounts.refresh(owner, account, true);
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
else if (!service) {
|
|
1467
|
+
json(res, 404, { error: "sign_in_unavailable" });
|
|
1468
|
+
return;
|
|
1469
|
+
}
|
|
1470
|
+
else if (reading)
|
|
1238
1471
|
result = await service.refresh(owner);
|
|
1239
1472
|
else {
|
|
1240
1473
|
let bytes;
|
|
@@ -1260,14 +1493,14 @@ function handleBrowserBackendSignIns(req, res, url, ctx) {
|
|
|
1260
1493
|
return;
|
|
1261
1494
|
}
|
|
1262
1495
|
const parsed = z.discriminatedUnion("operation", [
|
|
1263
|
-
z.strictObject({ operation: z.literal("select"), backends: z.array(z.enum(
|
|
1264
|
-
z.strictObject({ operation: z.literal("start"), backend: z.enum(
|
|
1496
|
+
z.strictObject({ operation: z.literal("select"), backends: z.array(z.enum(ONBOARDING_BACKENDS)).max(ONBOARDING_BACKENDS.length) }),
|
|
1497
|
+
z.strictObject({ operation: z.literal("start"), backend: z.enum(ONBOARDING_BROWSER_BACKENDS), relogin: z.boolean().optional() }),
|
|
1265
1498
|
z.strictObject({ operation: z.literal("input"), id: z.string().regex(/^[0-9a-f]{32}$/), revision: z.number().int().nonnegative(), action: z.discriminatedUnion("kind", [
|
|
1266
1499
|
z.strictObject({ kind: z.literal("method"), choice: z.string().max(32) }),
|
|
1267
1500
|
z.strictObject({ kind: z.enum(["code", "start_url", "region"]), value: z.string().max(4096) }),
|
|
1268
1501
|
]) }),
|
|
1269
|
-
z.strictObject({ operation: z.literal("skip"), backend: z.enum(
|
|
1270
|
-
z.strictObject({ operation: z.literal("cancel") }), z.strictObject({ operation: z.literal("refresh") }),
|
|
1502
|
+
z.strictObject({ operation: z.literal("skip"), backend: z.enum(ONBOARDING_BACKENDS) }),
|
|
1503
|
+
z.strictObject({ operation: z.literal("cancel"), id: z.string().regex(/^[0-9a-f]{32}$/).optional(), backend: z.enum(ONBOARDING_BACKENDS).optional() }), z.strictObject({ operation: z.literal("refresh") }),
|
|
1271
1504
|
]).safeParse(body);
|
|
1272
1505
|
if (!parsed.success) {
|
|
1273
1506
|
json(res, 400, { error: "invalid_signin_action" });
|
|
@@ -1283,7 +1516,7 @@ function handleBrowserBackendSignIns(req, res, url, ctx) {
|
|
|
1283
1516
|
else if (action.operation === "skip")
|
|
1284
1517
|
result = await service.skip(owner, action.backend);
|
|
1285
1518
|
else if (action.operation === "cancel")
|
|
1286
|
-
result = await service.cancel(owner);
|
|
1519
|
+
result = await service.cancel(owner, action.id, action.backend);
|
|
1287
1520
|
else
|
|
1288
1521
|
result = await service.refresh(owner, true);
|
|
1289
1522
|
}
|
|
@@ -1296,7 +1529,7 @@ function handleBrowserBackendSignIns(req, res, url, ctx) {
|
|
|
1296
1529
|
json(res, 200, result);
|
|
1297
1530
|
})().catch(error => {
|
|
1298
1531
|
const code = error instanceof Error ? error.message : "";
|
|
1299
|
-
const safe = /^(?:signin_(?:session_expired|console_only|cleanup_failed|action_(?:stale|invalid|ended|busy))|invalid_signin_(?:action|checklist))$/.test(code) ? code : "signin_failed";
|
|
1532
|
+
const safe = /^(?:signin_(?:session_expired|console_only|cleanup_failed|busy|profile_unknown|action_(?:stale|invalid|ended|busy))|invalid_signin_(?:action|checklist|target)|machine_(?:unknown|offline|unsupported|accounts_off|unreachable|profile_not_owned|busy)|invalid_machine_target)$/.test(code) ? code : "signin_failed";
|
|
1300
1533
|
if (!res.destroyed && !res.writableEnded)
|
|
1301
1534
|
json(res, safe === "signin_cleanup_failed" || safe === "signin_failed" ? 503 : 409, { error: safe });
|
|
1302
1535
|
});
|
|
@@ -1335,7 +1568,18 @@ function handleBackendLogin(req, res, url, ctx, path, method) {
|
|
|
1335
1568
|
}
|
|
1336
1569
|
const action = /^\/ui\/backend-login\/(check|start|cancel)$/.exec(path)?.[1];
|
|
1337
1570
|
if (reading && path === "/ui/backend-login" && [...url.searchParams.keys()].length === 0) {
|
|
1338
|
-
|
|
1571
|
+
// The sign-in view (its access code included) is answered at once and never waits for an account to be read: that happens in the background
|
|
1572
|
+
// and the page is told to read again when something new is known.
|
|
1573
|
+
try {
|
|
1574
|
+
ctx.refreshSignInIdentities?.();
|
|
1575
|
+
}
|
|
1576
|
+
catch { /* the list is served with what is known */ }
|
|
1577
|
+
try {
|
|
1578
|
+
json(res, 200, { login: logins.view(first.handle), targets: ctx.backendSignInTargets?.() ?? [] });
|
|
1579
|
+
}
|
|
1580
|
+
catch {
|
|
1581
|
+
json(res, 503, { error: "sign_in_unavailable" });
|
|
1582
|
+
}
|
|
1339
1583
|
return true;
|
|
1340
1584
|
}
|
|
1341
1585
|
if (method !== "POST" || !action) {
|
|
@@ -1388,11 +1632,18 @@ function handleBackendLogin(req, res, url, ctx, path, method) {
|
|
|
1388
1632
|
json(res, "error" in result ? 409 : 200, result);
|
|
1389
1633
|
}
|
|
1390
1634
|
else {
|
|
1391
|
-
|
|
1635
|
+
// `{}`: the explicit "Cancel sign-in" — whatever sign-in is running, as ever. `{ run, ifUnopened }`: the dialog's own Close (#3321 review), for
|
|
1636
|
+
// that one run and only while its terminal is unopened and it is this session's own; anything else is left alone and `cancelled` is false.
|
|
1637
|
+
// `{ backend }` (AGEND-203): the "Cancel the running sign-in" a refused start offers — only the sign-in or install on that backend.
|
|
1638
|
+
const parsed = z.union([z.strictObject({}), z.strictObject({ backend: z.string().regex(/^[a-z][a-z0-9-]{0,31}$/i) }), z.strictObject({ run: z.string().regex(/^[0-9a-f]{32}$/), ifUnopened: z.literal(true) })]).safeParse(body);
|
|
1639
|
+
if (!parsed.success) {
|
|
1392
1640
|
json(res, 400, { error: "sign_in_args" });
|
|
1393
1641
|
return;
|
|
1394
1642
|
}
|
|
1395
|
-
|
|
1643
|
+
if ("run" in parsed.data)
|
|
1644
|
+
json(res, 200, await logins.closeRun(now, parsed.data.run));
|
|
1645
|
+
else
|
|
1646
|
+
json(res, 200, { message: await logins.cancel("backend" in parsed.data ? parsed.data.backend.toLowerCase() : undefined) });
|
|
1396
1647
|
}
|
|
1397
1648
|
})().catch(() => { try {
|
|
1398
1649
|
json(res, 500, { error: "sign_in_request_failed" });
|
|
@@ -1401,166 +1652,515 @@ function handleBackendLogin(req, res, url, ctx, path, method) {
|
|
|
1401
1652
|
return true;
|
|
1402
1653
|
}
|
|
1403
1654
|
/**
|
|
1404
|
-
*
|
|
1405
|
-
* session
|
|
1406
|
-
*
|
|
1655
|
+
* 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
|
|
1656
|
+
* session on the local surface; never the CLI's header token (an agent's), a guest, a read session, or the public link (refused before the body is read, and again
|
|
1657
|
+
* 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
|
|
1658
|
+
* is ever run; `POST …/cancel` `{}` stops the running one. Every answer is no-store.
|
|
1407
1659
|
*/
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
return true;
|
|
1413
|
-
}
|
|
1660
|
+
const HOST_INSTALL_STATUS = { not_allowed: 403, unsupported: 400, already: 409, not_installed: 409, up_to_date: 409, version_unreadable: 409, busy: 409, shutting_down: 503, failed: 500 };
|
|
1661
|
+
function handleHostInstall(req, res, url, ctx, path, method) {
|
|
1662
|
+
res.setHeader("Cache-Control", "private, no-store");
|
|
1663
|
+
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
1414
1664
|
const reading = method === "GET";
|
|
1415
1665
|
if (gatewayRequestContext(req)) {
|
|
1416
|
-
json(res, reading ? 404 : 403, { error: "
|
|
1666
|
+
json(res, reading ? 404 : 403, { error: "install_not_over_public_link" });
|
|
1417
1667
|
return true;
|
|
1418
1668
|
}
|
|
1419
1669
|
const who = () => {
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
return
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1670
|
+
if (isSettingsReplay(req)) {
|
|
1671
|
+
const requester = settingsRequestRequester(req);
|
|
1672
|
+
if (!requester || !settingsRequestLocalAdmin(req))
|
|
1673
|
+
return { error: "install_needs_a_local_admin", status: 403 };
|
|
1674
|
+
return requester;
|
|
1675
|
+
}
|
|
1676
|
+
const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
1677
|
+
if (v.kind !== "allow")
|
|
1678
|
+
return { error: WEB_TOKEN_INVALID_MESSAGE, status: 401 };
|
|
1679
|
+
if (v.via !== "session" || v.session.tier !== "admin" || v.session.surface !== "local")
|
|
1680
|
+
return { error: "install_needs_a_local_admin", status: 403 };
|
|
1681
|
+
return { handle: v.session.handle, label: v.session.label };
|
|
1428
1682
|
};
|
|
1429
1683
|
const first = who();
|
|
1430
|
-
if ("
|
|
1684
|
+
if ("error" in first) {
|
|
1431
1685
|
json(res, first.status, { error: first.error });
|
|
1432
1686
|
return true;
|
|
1433
1687
|
}
|
|
1434
|
-
const
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
const now = who();
|
|
1438
|
-
if ("status" in now) {
|
|
1439
|
-
json(res, now.status, { error: now.error });
|
|
1440
|
-
return null;
|
|
1441
|
-
}
|
|
1442
|
-
if (now.person !== first.person) {
|
|
1443
|
-
json(res, 409, { error: "mods_person_changed" });
|
|
1444
|
-
return null;
|
|
1445
|
-
}
|
|
1446
|
-
return now.person;
|
|
1447
|
-
};
|
|
1448
|
-
const answer = (r, body) => {
|
|
1449
|
-
if (r.ok)
|
|
1450
|
-
json(res, 200, body);
|
|
1451
|
-
else
|
|
1452
|
-
json(res, r.status ?? 500, { error: r.error, ...(r.detail ? { detail: r.detail } : {}), ...(r.problems ? { problems: r.problems } : {}) });
|
|
1453
|
-
};
|
|
1454
|
-
const fail = (err) => {
|
|
1455
|
-
ctx.logger.error({ err: err.message }, "Mod request failed");
|
|
1456
|
-
try {
|
|
1457
|
-
json(res, 500, { error: "Mod request failed" });
|
|
1458
|
-
}
|
|
1459
|
-
catch { /* already answered */ }
|
|
1460
|
-
};
|
|
1461
|
-
if (path === "/ui/mods" && method === "GET") {
|
|
1462
|
-
json(res, 200, { ...mods.list(), staged: mods.staged(first.person), proposals: mods.proposals() });
|
|
1463
|
-
return true;
|
|
1464
|
-
}
|
|
1465
|
-
// A staged mod's picture (this session's person's stage only): the plan shows the actual pictures before install.
|
|
1466
|
-
const stagedPic = /^\/ui\/mods\/staged\/([0-9a-f]{32})$/.exec(path);
|
|
1467
|
-
if (stagedPic && method === "GET") {
|
|
1468
|
-
const pic = mods.stagedPicture(first.person, stagedPic[1]);
|
|
1469
|
-
if (!pic) {
|
|
1470
|
-
json(res, 404, { error: "No such image" });
|
|
1471
|
-
return true;
|
|
1472
|
-
}
|
|
1473
|
-
res.writeHead(200, { "Content-Type": pic.mime, "X-Content-Type-Options": "nosniff", "Cache-Control": "private, no-store", "Content-Security-Policy": "default-src 'none'; sandbox" });
|
|
1474
|
-
res.end(Buffer.from(pic.bytes));
|
|
1688
|
+
const installs = ctx.webHostInstalls;
|
|
1689
|
+
if (!installs) {
|
|
1690
|
+
json(res, 404, { error: "install_unavailable" });
|
|
1475
1691
|
return true;
|
|
1476
1692
|
}
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
const rec = mods.list().mods.find(m => m.id === fileMatch[1]);
|
|
1481
|
-
if (text === null || !rec) {
|
|
1482
|
-
json(res, 404, { error: "no_such_mod" });
|
|
1483
|
-
return true;
|
|
1693
|
+
if (reading && path === "/ui/host-install" && [...url.searchParams.keys()].length === 0) {
|
|
1694
|
+
try {
|
|
1695
|
+
json(res, 200, { install: installs.view() });
|
|
1484
1696
|
}
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
const fx = mods.bundleEffects(fileMatch[1]);
|
|
1488
|
-
if (fx === "unknown" || (fx?.length ?? 0) > 0) {
|
|
1489
|
-
json(res, 403, { error: "canvas_worker_experimental", message: CANVAS_WORKER_EXPERIMENTAL_MESSAGE });
|
|
1490
|
-
return true;
|
|
1697
|
+
catch {
|
|
1698
|
+
json(res, 503, { error: "install_unavailable" });
|
|
1491
1699
|
}
|
|
1492
|
-
res.writeHead(200, { "Content-Type": "application/json; charset=utf-8", "X-Content-Type-Options": "nosniff", "Cache-Control": "private, no-store",
|
|
1493
|
-
"Content-Disposition": `attachment; filename="${rec.name}-${rec.version}.agendmod.json"` });
|
|
1494
|
-
res.end(text);
|
|
1495
1700
|
return true;
|
|
1496
1701
|
}
|
|
1497
|
-
|
|
1498
|
-
|
|
1702
|
+
// Cancel only takes something away (any local admin may stop it, as `/login cancel`): it is not a held change. Install and Update (AGEND-136) are, and run only as the gate's confirmed replay.
|
|
1703
|
+
if (method !== "POST" || (path !== "/ui/host-install/cancel" && !HOST_CLI_PATHS.has(path))) {
|
|
1704
|
+
json(res, 404, { error: "not_found" });
|
|
1499
1705
|
return true;
|
|
1500
1706
|
}
|
|
1501
1707
|
(async () => {
|
|
1502
|
-
|
|
1503
|
-
// Too large by its own declared length: answered before a byte is read (the body is drained, not cut off).
|
|
1504
|
-
if (Number(req.headers["content-length"]) > MOD_MAX_BYTES) {
|
|
1505
|
-
req.resume();
|
|
1506
|
-
json(res, 413, { error: "mod_too_large", detail: `at most ${MOD_MAX_BYTES / 1024 / 1024} MiB` });
|
|
1507
|
-
return;
|
|
1508
|
-
}
|
|
1509
|
-
let raw;
|
|
1510
|
-
try {
|
|
1511
|
-
raw = await readBoundedWebBody(req, MOD_MAX_BYTES);
|
|
1512
|
-
}
|
|
1513
|
-
catch {
|
|
1514
|
-
json(res, 413, { error: "mod_too_large", detail: `at most ${MOD_MAX_BYTES / 1024 / 1024} MiB` });
|
|
1515
|
-
return;
|
|
1516
|
-
}
|
|
1517
|
-
const person = again();
|
|
1518
|
-
if (!person)
|
|
1519
|
-
return;
|
|
1520
|
-
let text;
|
|
1521
|
-
try {
|
|
1522
|
-
text = new TextDecoder("utf-8", { fatal: true }).decode(raw);
|
|
1523
|
-
}
|
|
1524
|
-
catch {
|
|
1525
|
-
json(res, 400, { error: "mod_invalid", problems: [{ path: "", problem: "not UTF-8" }] });
|
|
1526
|
-
return;
|
|
1527
|
-
}
|
|
1528
|
-
const r = mods.stage(person, text);
|
|
1529
|
-
answer(r, r.ok ? { stage: r.stage, plan: r.plan, plan_hash: r.plan_hash } : null);
|
|
1530
|
-
return;
|
|
1531
|
-
}
|
|
1532
|
-
let body;
|
|
1708
|
+
let bytes;
|
|
1533
1709
|
try {
|
|
1534
|
-
|
|
1710
|
+
bytes = await readBoundedWebBody(req, 1024);
|
|
1535
1711
|
}
|
|
1536
1712
|
catch {
|
|
1537
|
-
json(res,
|
|
1713
|
+
json(res, 413, { error: "install_body_bound" });
|
|
1538
1714
|
return;
|
|
1539
1715
|
}
|
|
1540
|
-
|
|
1541
|
-
if (!person)
|
|
1716
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
1542
1717
|
return;
|
|
1543
|
-
|
|
1544
|
-
|
|
1718
|
+
const now = who();
|
|
1719
|
+
if ("error" in now) {
|
|
1720
|
+
json(res, now.status, { error: now.error });
|
|
1545
1721
|
return;
|
|
1546
1722
|
}
|
|
1547
|
-
if (
|
|
1548
|
-
|
|
1549
|
-
answer(r, { ok: true });
|
|
1723
|
+
if (now.handle !== first.handle) {
|
|
1724
|
+
json(res, 409, { error: "install_session_changed" });
|
|
1550
1725
|
return;
|
|
1551
1726
|
}
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
answer(r, r.ok ? { stage: r.stage, plan: r.plan, plan_hash: r.plan_hash } : null);
|
|
1556
|
-
return;
|
|
1727
|
+
let body;
|
|
1728
|
+
try {
|
|
1729
|
+
body = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
1557
1730
|
}
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
answer(r, { ok: true });
|
|
1731
|
+
catch {
|
|
1732
|
+
json(res, 400, { error: "install_json" });
|
|
1561
1733
|
return;
|
|
1562
1734
|
}
|
|
1563
|
-
if (path === "/ui/
|
|
1735
|
+
if (path === "/ui/host-install/cancel") {
|
|
1736
|
+
if (!z.strictObject({}).safeParse(body).success) {
|
|
1737
|
+
json(res, 400, { error: "install_args" });
|
|
1738
|
+
return;
|
|
1739
|
+
}
|
|
1740
|
+
json(res, 200, { cancelled: await installs.cancel() });
|
|
1741
|
+
return;
|
|
1742
|
+
}
|
|
1743
|
+
// AGEND-154 (Prism P2-1 on #3552): an update may carry `acceptLatestUnaudited: true` (only the page that knows the named exception sends it); the request and the registry must agree (below).
|
|
1744
|
+
const parsed = z.strictObject({ backend: z.string().regex(/^[a-z][a-z0-9-]{0,31}$/), ...(path === "/ui/host-update" ? { [LATEST_ACK_FIELD]: z.literal(true).optional() } : {}) }).safeParse(body);
|
|
1745
|
+
if (!parsed.success) {
|
|
1746
|
+
json(res, 400, { error: "install_args" });
|
|
1747
|
+
return;
|
|
1748
|
+
}
|
|
1749
|
+
if (!isSettingsReplay(req) || !settingsRequestExecution(req)) {
|
|
1750
|
+
json(res, 403, { error: "install_confirmation_required" });
|
|
1751
|
+
return;
|
|
1752
|
+
}
|
|
1753
|
+
if (path === "/ui/host-update") {
|
|
1754
|
+
const ackError = hostUpdateAckError(parsed.data.backend, parsed.data[LATEST_ACK_FIELD]);
|
|
1755
|
+
if (ackError) {
|
|
1756
|
+
json(res, 409, { error: ackError });
|
|
1757
|
+
return;
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
// 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.
|
|
1761
|
+
const result = await installs.begin(now, parsed.data.backend, settingsRequestExecution(req), path === "/ui/host-update" ? "update" : "install");
|
|
1762
|
+
if ("error" in result)
|
|
1763
|
+
json(res, HOST_INSTALL_STATUS[result.error] ?? 409, { error: result.error, ...(result.message ? { message: result.message } : {}) });
|
|
1764
|
+
else
|
|
1765
|
+
json(res, 200, result);
|
|
1766
|
+
})().catch(() => { try {
|
|
1767
|
+
json(res, 500, { error: "install_request_failed" });
|
|
1768
|
+
}
|
|
1769
|
+
catch { /* response ended */ } });
|
|
1770
|
+
return true;
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* #3212 PR 2: Settings → Accounts — `POST /ui/accounts/<backend>` `{ name }` adds a named account (a credential profile's
|
|
1774
|
+
* folder); `DELETE /ui/accounts/<backend>/<name>` `{ confirm: <name> }` removes one (accounts-profiles.ts: every refusal
|
|
1775
|
+
* deletes nothing). PR 3: `POST /ui/accounts/<backend>/signout` `{ profile: <name> | null, confirm: true }` signs an
|
|
1776
|
+
* 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,
|
|
1777
|
+
* a read session, the public link or the gateway — refused before the body is read, and again after it.
|
|
1778
|
+
*/
|
|
1779
|
+
const ACCOUNT_STATUS = {
|
|
1780
|
+
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,
|
|
1781
|
+
unsafe: 409, default_home: 409, failed: 500, unsupported: 400,
|
|
1782
|
+
// #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).
|
|
1783
|
+
machine_unknown: 404, machine_offline: 409, machine_unsupported: 409, machine_accounts_off: 409, machine_unreachable: 502, machine_profile_not_owned: 409,
|
|
1784
|
+
machine_refused: 409, machine_default_login: 409,
|
|
1785
|
+
};
|
|
1786
|
+
function handleAccountWrite(req, res, url, ctx, path, method) {
|
|
1787
|
+
res.setHeader("Cache-Control", "private, no-store");
|
|
1788
|
+
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
1789
|
+
if (gatewayRequestContext(req)) {
|
|
1790
|
+
json(res, 403, { error: "accounts_not_over_public_link" });
|
|
1791
|
+
return true;
|
|
1792
|
+
}
|
|
1793
|
+
const who = () => {
|
|
1794
|
+
const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
1795
|
+
if (v.kind !== "allow")
|
|
1796
|
+
return { error: WEB_TOKEN_INVALID_MESSAGE, status: 401 };
|
|
1797
|
+
if (v.via !== "session" || v.session.tier !== "admin" || v.session.surface !== "local")
|
|
1798
|
+
return { error: "accounts_need_a_local_admin", status: 403 };
|
|
1799
|
+
return { handle: v.session.handle, label: v.session.label };
|
|
1800
|
+
};
|
|
1801
|
+
const first = who();
|
|
1802
|
+
if ("error" in first) {
|
|
1803
|
+
json(res, first.status, { error: first.error });
|
|
1804
|
+
return true;
|
|
1805
|
+
}
|
|
1806
|
+
const add = method === "POST" ? /^\/ui\/accounts\/([a-z][a-z0-9-]{0,31})$/.exec(path) : null;
|
|
1807
|
+
const remove = method === "DELETE" ? /^\/ui\/accounts\/([a-z][a-z0-9-]{0,31})\/([^/]{1,200})$/.exec(path) : null;
|
|
1808
|
+
const signout = method === "POST" ? /^\/ui\/accounts\/([a-z][a-z0-9-]{0,31})\/signout$/.exec(path) : null;
|
|
1809
|
+
if (!add && !remove && !signout) {
|
|
1810
|
+
json(res, 404, { error: "not_found" });
|
|
1811
|
+
return true;
|
|
1812
|
+
}
|
|
1813
|
+
const handler = add ? ctx.addAccountProfile : remove ? ctx.removeAccountProfile : ctx.signOutAccount;
|
|
1814
|
+
if (typeof handler !== "function") {
|
|
1815
|
+
json(res, 404, { error: "not_found" });
|
|
1816
|
+
return true;
|
|
1817
|
+
}
|
|
1818
|
+
let target = "";
|
|
1819
|
+
if (remove) {
|
|
1820
|
+
try {
|
|
1821
|
+
target = decodeURIComponent(remove[2]);
|
|
1822
|
+
}
|
|
1823
|
+
catch {
|
|
1824
|
+
json(res, 400, { error: "name" });
|
|
1825
|
+
return true;
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
(async () => {
|
|
1829
|
+
let bytes;
|
|
1830
|
+
try {
|
|
1831
|
+
bytes = await readBoundedWebBody(req, 1024);
|
|
1832
|
+
}
|
|
1833
|
+
catch {
|
|
1834
|
+
json(res, 413, { error: "accounts_body_bound" });
|
|
1835
|
+
return;
|
|
1836
|
+
}
|
|
1837
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
1838
|
+
return;
|
|
1839
|
+
const now = who();
|
|
1840
|
+
if ("error" in now) {
|
|
1841
|
+
json(res, now.status, { error: now.error });
|
|
1842
|
+
return;
|
|
1843
|
+
}
|
|
1844
|
+
if (now.handle !== first.handle) {
|
|
1845
|
+
json(res, 409, { error: "accounts_session_changed" });
|
|
1846
|
+
return;
|
|
1847
|
+
}
|
|
1848
|
+
let body;
|
|
1849
|
+
try {
|
|
1850
|
+
body = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
1851
|
+
}
|
|
1852
|
+
catch {
|
|
1853
|
+
json(res, 400, { error: "accounts_json" });
|
|
1854
|
+
return;
|
|
1855
|
+
}
|
|
1856
|
+
// #3190 Part 3c: `machine` (a paired computer's id) turns the same route into that computer's account; the person's audit name is the session's opaque handle.
|
|
1857
|
+
const machineId = z.string().regex(/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/).optional();
|
|
1858
|
+
const onMachine = (id) => {
|
|
1859
|
+
if (id === undefined)
|
|
1860
|
+
return undefined;
|
|
1861
|
+
return /^[a-f0-9]{16}$/.test(now.handle) ? { id, actor: `admin:${now.handle}` } : "refused";
|
|
1862
|
+
};
|
|
1863
|
+
const fail = (r) => json(res, ACCOUNT_STATUS[r.error] ?? 409, { error: r.error, ...(r.clash ? { clash: r.clash } : {}), ...(r.users ? { users: r.users } : {}), ...(r.message ? { message: r.message } : {}) });
|
|
1864
|
+
if (add) {
|
|
1865
|
+
const parsed = z.strictObject({ name: z.string().max(200), machine: machineId }).safeParse(body);
|
|
1866
|
+
if (!parsed.success) {
|
|
1867
|
+
json(res, 400, { error: "accounts_args" });
|
|
1868
|
+
return;
|
|
1869
|
+
}
|
|
1870
|
+
const machine = onMachine(parsed.data.machine);
|
|
1871
|
+
if (machine === "refused") {
|
|
1872
|
+
json(res, 403, { error: "accounts_need_a_local_admin" });
|
|
1873
|
+
return;
|
|
1874
|
+
}
|
|
1875
|
+
const r = await (machine ? ctx.addAccountProfile(add[1], parsed.data.name, now.label, machine) : ctx.addAccountProfile(add[1], parsed.data.name, now.label));
|
|
1876
|
+
if (r.ok)
|
|
1877
|
+
json(res, 200, { added: parsed.data.name, ...(machine ? { machine: machine.id } : {}) });
|
|
1878
|
+
else
|
|
1879
|
+
fail(r);
|
|
1880
|
+
}
|
|
1881
|
+
else if (remove) {
|
|
1882
|
+
// `cancelSignIn` (#3321 review): "Cancel sign-in and remove" — end the running sign-in of THIS account (and no other), then remove it, in one request.
|
|
1883
|
+
// A paired computer's sign-in is cancelled from that computer's side, so it is refused there.
|
|
1884
|
+
const parsed = z.strictObject({ confirm: z.string().max(200), machine: machineId, cancelSignIn: z.literal(true).optional() }).refine(a => !(a.machine && a.cancelSignIn)).safeParse(body);
|
|
1885
|
+
if (!parsed.success) {
|
|
1886
|
+
json(res, 400, { error: "accounts_args" });
|
|
1887
|
+
return;
|
|
1888
|
+
}
|
|
1889
|
+
const machine = onMachine(parsed.data.machine);
|
|
1890
|
+
if (machine === "refused") {
|
|
1891
|
+
json(res, 403, { error: "accounts_need_a_local_admin" });
|
|
1892
|
+
return;
|
|
1893
|
+
}
|
|
1894
|
+
const r = await (machine ? ctx.removeAccountProfile(remove[1], target, parsed.data.confirm, now.label, machine)
|
|
1895
|
+
: parsed.data.cancelSignIn ? ctx.removeAccountProfile(remove[1], target, parsed.data.confirm, now.label, undefined, { cancelSignIn: true })
|
|
1896
|
+
: ctx.removeAccountProfile(remove[1], target, parsed.data.confirm, now.label));
|
|
1897
|
+
if (r.ok)
|
|
1898
|
+
json(res, 200, { removed: target, ...(r.keychainLeft ? { keychainLeft: true } : {}) });
|
|
1899
|
+
else
|
|
1900
|
+
fail(r);
|
|
1901
|
+
}
|
|
1902
|
+
else {
|
|
1903
|
+
const parsed = z.strictObject({ profile: z.string().max(200).nullable(), confirm: z.literal(true), machine: machineId }).safeParse(body);
|
|
1904
|
+
if (!parsed.success) {
|
|
1905
|
+
json(res, 400, { error: "accounts_args" });
|
|
1906
|
+
return;
|
|
1907
|
+
}
|
|
1908
|
+
const machine = onMachine(parsed.data.machine);
|
|
1909
|
+
if (machine === "refused") {
|
|
1910
|
+
json(res, 403, { error: "accounts_need_a_local_admin" });
|
|
1911
|
+
return;
|
|
1912
|
+
}
|
|
1913
|
+
const r = await (machine ? ctx.signOutAccount(signout[1], parsed.data.profile, parsed.data.confirm, now.label, machine) : ctx.signOutAccount(signout[1], parsed.data.profile, parsed.data.confirm, now.label));
|
|
1914
|
+
if (r.ok)
|
|
1915
|
+
json(res, 200, { signedOut: parsed.data.profile, ...(r.keychainLeft ? { keychainLeft: true } : {}) });
|
|
1916
|
+
else
|
|
1917
|
+
fail(r);
|
|
1918
|
+
}
|
|
1919
|
+
})().catch(() => { try {
|
|
1920
|
+
json(res, 500, { error: "accounts_request_failed" });
|
|
1921
|
+
}
|
|
1922
|
+
catch { /* response ended */ } });
|
|
1923
|
+
return true;
|
|
1924
|
+
}
|
|
1925
|
+
/**
|
|
1926
|
+
* #3292: Settings → Accounts → Keep sign-in alive — `POST /ui/accounts/keep-alive` `{ backend, profile: <name> | null,
|
|
1927
|
+
* enabled, fallback? }`. The same gate as the other account writes: the fleet's local admin session only, refused before
|
|
1928
|
+
* the body is read and again after it; never the gateway, a guest, a read session or the CLI's header token.
|
|
1929
|
+
*/
|
|
1930
|
+
const KEEPALIVE_STATUS = { backend: 400, profile: 400, fallback: 400, write: 500 };
|
|
1931
|
+
function handleAccountKeepAlive(req, res, url, ctx, method) {
|
|
1932
|
+
res.setHeader("Cache-Control", "private, no-store");
|
|
1933
|
+
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
1934
|
+
if (gatewayRequestContext(req)) {
|
|
1935
|
+
json(res, 403, { error: "accounts_not_over_public_link" });
|
|
1936
|
+
return true;
|
|
1937
|
+
}
|
|
1938
|
+
if (method !== "POST") {
|
|
1939
|
+
json(res, 405, { error: "method_not_allowed" });
|
|
1940
|
+
return true;
|
|
1941
|
+
}
|
|
1942
|
+
const who = () => {
|
|
1943
|
+
const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
1944
|
+
if (v.kind !== "allow")
|
|
1945
|
+
return { error: WEB_TOKEN_INVALID_MESSAGE, status: 401 };
|
|
1946
|
+
if (v.via !== "session" || v.session.tier !== "admin" || v.session.surface !== "local")
|
|
1947
|
+
return { error: "accounts_need_a_local_admin", status: 403 };
|
|
1948
|
+
return { handle: v.session.handle, label: v.session.label };
|
|
1949
|
+
};
|
|
1950
|
+
const first = who();
|
|
1951
|
+
if ("error" in first) {
|
|
1952
|
+
json(res, first.status, { error: first.error });
|
|
1953
|
+
return true;
|
|
1954
|
+
}
|
|
1955
|
+
if (typeof ctx.setAccountKeepAlive !== "function") {
|
|
1956
|
+
json(res, 404, { error: "not_found" });
|
|
1957
|
+
return true;
|
|
1958
|
+
}
|
|
1959
|
+
(async () => {
|
|
1960
|
+
let bytes;
|
|
1961
|
+
try {
|
|
1962
|
+
bytes = await readBoundedWebBody(req, 1024);
|
|
1963
|
+
}
|
|
1964
|
+
catch {
|
|
1965
|
+
json(res, 413, { error: "accounts_body_bound" });
|
|
1966
|
+
return;
|
|
1967
|
+
}
|
|
1968
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
1969
|
+
return;
|
|
1970
|
+
const now = who();
|
|
1971
|
+
if ("error" in now) {
|
|
1972
|
+
json(res, now.status, { error: now.error });
|
|
1973
|
+
return;
|
|
1974
|
+
}
|
|
1975
|
+
if (now.handle !== first.handle) {
|
|
1976
|
+
json(res, 409, { error: "accounts_session_changed" });
|
|
1977
|
+
return;
|
|
1978
|
+
}
|
|
1979
|
+
let body;
|
|
1980
|
+
try {
|
|
1981
|
+
body = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
1982
|
+
}
|
|
1983
|
+
catch {
|
|
1984
|
+
json(res, 400, { error: "accounts_json" });
|
|
1985
|
+
return;
|
|
1986
|
+
}
|
|
1987
|
+
const parsed = z.strictObject({ backend: z.string().max(32), profile: z.string().max(200).nullable(), enabled: z.boolean(), fallback: z.boolean().optional() }).safeParse(body);
|
|
1988
|
+
if (!parsed.success) {
|
|
1989
|
+
json(res, 400, { error: "accounts_args" });
|
|
1990
|
+
return;
|
|
1991
|
+
}
|
|
1992
|
+
const r = ctx.setAccountKeepAlive(parsed.data.backend, parsed.data.profile, parsed.data.enabled, parsed.data.fallback, now.label);
|
|
1993
|
+
if (r.ok)
|
|
1994
|
+
json(res, 200, { backend: parsed.data.backend, profile: parsed.data.profile, enabled: parsed.data.enabled });
|
|
1995
|
+
else
|
|
1996
|
+
json(res, KEEPALIVE_STATUS[r.error] ?? 409, { error: r.error });
|
|
1997
|
+
})().catch(() => { try {
|
|
1998
|
+
json(res, 500, { error: "accounts_request_failed" });
|
|
1999
|
+
}
|
|
2000
|
+
catch { /* response ended */ } });
|
|
2001
|
+
return true;
|
|
2002
|
+
}
|
|
2003
|
+
/**
|
|
2004
|
+
* #1629 r4 §4 (r4-5): mods — a person's import (stage, then commit), uninstall and export. Every route is a signed-in
|
|
2005
|
+
* session's, writes an admin's: never the CLI's header token (the way an agent could reach it) and never the public link
|
|
2006
|
+
* (absent from its manifest, and refused here too). `who()` is asked first and again once a body is in.
|
|
2007
|
+
*/
|
|
2008
|
+
function handleMods(req, res, url, ctx, path, method) {
|
|
2009
|
+
const mods = ctx.mods;
|
|
2010
|
+
if (!mods) {
|
|
2011
|
+
json(res, 404, { error: "Mods are not kept on this fleet" });
|
|
2012
|
+
return true;
|
|
2013
|
+
}
|
|
2014
|
+
const reading = method === "GET";
|
|
2015
|
+
if (gatewayRequestContext(req)) {
|
|
2016
|
+
json(res, reading ? 404 : 403, { error: "mods_not_over_public_link" });
|
|
2017
|
+
return true;
|
|
2018
|
+
}
|
|
2019
|
+
const who = () => {
|
|
2020
|
+
const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
2021
|
+
if (verdict.kind !== "allow")
|
|
2022
|
+
return { status: 401, error: WEB_TOKEN_INVALID_MESSAGE };
|
|
2023
|
+
if (verdict.via !== "session" || !verdict.session)
|
|
2024
|
+
return { status: 403, error: "mods_need_a_signed_in_session" };
|
|
2025
|
+
if (!reading && verdict.session.tier !== "admin")
|
|
2026
|
+
return { status: 403, error: "mods_need_an_admin_session" };
|
|
2027
|
+
return { person: webPersonKey(verdict.session.owner) };
|
|
2028
|
+
};
|
|
2029
|
+
const first = who();
|
|
2030
|
+
if ("status" in first) {
|
|
2031
|
+
json(res, first.status, { error: first.error });
|
|
2032
|
+
return true;
|
|
2033
|
+
}
|
|
2034
|
+
const again = () => {
|
|
2035
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
2036
|
+
return null;
|
|
2037
|
+
const now = who();
|
|
2038
|
+
if ("status" in now) {
|
|
2039
|
+
json(res, now.status, { error: now.error });
|
|
2040
|
+
return null;
|
|
2041
|
+
}
|
|
2042
|
+
if (now.person !== first.person) {
|
|
2043
|
+
json(res, 409, { error: "mods_person_changed" });
|
|
2044
|
+
return null;
|
|
2045
|
+
}
|
|
2046
|
+
return now.person;
|
|
2047
|
+
};
|
|
2048
|
+
const answer = (r, body) => {
|
|
2049
|
+
if (r.ok)
|
|
2050
|
+
json(res, 200, body);
|
|
2051
|
+
else
|
|
2052
|
+
json(res, r.status ?? 500, { error: r.error, ...(r.detail ? { detail: r.detail } : {}), ...(r.problems ? { problems: r.problems } : {}) });
|
|
2053
|
+
};
|
|
2054
|
+
const fail = (err) => {
|
|
2055
|
+
ctx.logger.error({ err: err.message }, "Mod request failed");
|
|
2056
|
+
try {
|
|
2057
|
+
json(res, 500, { error: "Mod request failed" });
|
|
2058
|
+
}
|
|
2059
|
+
catch { /* already answered */ }
|
|
2060
|
+
};
|
|
2061
|
+
if (path === "/ui/mods" && method === "GET") {
|
|
2062
|
+
json(res, 200, { ...mods.list(), staged: mods.staged(first.person), proposals: mods.proposals() });
|
|
2063
|
+
return true;
|
|
2064
|
+
}
|
|
2065
|
+
// A staged mod's picture (this session's person's stage only): the plan shows the actual pictures before install.
|
|
2066
|
+
const stagedPic = /^\/ui\/mods\/staged\/([0-9a-f]{32})$/.exec(path);
|
|
2067
|
+
if (stagedPic && method === "GET") {
|
|
2068
|
+
const pic = mods.stagedPicture(first.person, stagedPic[1]);
|
|
2069
|
+
if (!pic) {
|
|
2070
|
+
json(res, 404, { error: "No such image" });
|
|
2071
|
+
return true;
|
|
2072
|
+
}
|
|
2073
|
+
res.writeHead(200, { "Content-Type": pic.mime, "X-Content-Type-Options": "nosniff", "Cache-Control": "private, no-store", "Content-Security-Policy": "default-src 'none'; sandbox" });
|
|
2074
|
+
res.end(Buffer.from(pic.bytes));
|
|
2075
|
+
return true;
|
|
2076
|
+
}
|
|
2077
|
+
const fileMatch = /^\/ui\/mods\/file\/([0-9a-f]{32})$/.exec(path);
|
|
2078
|
+
if (fileMatch && method === "GET") {
|
|
2079
|
+
const text = mods.bundleText(fileMatch[1]);
|
|
2080
|
+
const rec = mods.list().mods.find(m => m.id === fileMatch[1]);
|
|
2081
|
+
if (text === null || !rec) {
|
|
2082
|
+
json(res, 404, { error: "no_such_mod" });
|
|
2083
|
+
return true;
|
|
2084
|
+
}
|
|
2085
|
+
// The file is the installed bundle, effects and all. #2799: a file that carries Canvas Worker effects (or can't be
|
|
2086
|
+
// read to tell) is not handed out; one without is any admin's.
|
|
2087
|
+
const fx = mods.bundleEffects(fileMatch[1]);
|
|
2088
|
+
if (fx === "unknown" || (fx?.length ?? 0) > 0) {
|
|
2089
|
+
json(res, 403, { error: "canvas_worker_experimental", message: CANVAS_WORKER_EXPERIMENTAL_MESSAGE });
|
|
2090
|
+
return true;
|
|
2091
|
+
}
|
|
2092
|
+
res.writeHead(200, { "Content-Type": "application/json; charset=utf-8", "X-Content-Type-Options": "nosniff", "Cache-Control": "private, no-store",
|
|
2093
|
+
"Content-Disposition": `attachment; filename="${rec.name}-${rec.version}.agendmod.json"` });
|
|
2094
|
+
res.end(text);
|
|
2095
|
+
return true;
|
|
2096
|
+
}
|
|
2097
|
+
if (method !== "POST" || !["/ui/mods/stage", "/ui/mods/abort", "/ui/mods/commit", "/ui/mods/uninstall", "/ui/mods/export", "/ui/mods/proposal/stage", "/ui/mods/proposal/dismiss"].includes(path)) {
|
|
2098
|
+
json(res, 404, { error: "not found" });
|
|
2099
|
+
return true;
|
|
2100
|
+
}
|
|
2101
|
+
(async () => {
|
|
2102
|
+
if (path === "/ui/mods/stage") {
|
|
2103
|
+
// Too large by its own declared length: answered before a byte is read (the body is drained, not cut off).
|
|
2104
|
+
if (Number(req.headers["content-length"]) > MOD_MAX_BYTES) {
|
|
2105
|
+
req.resume();
|
|
2106
|
+
json(res, 413, { error: "mod_too_large", detail: `at most ${MOD_MAX_BYTES / 1024 / 1024} MiB` });
|
|
2107
|
+
return;
|
|
2108
|
+
}
|
|
2109
|
+
let raw;
|
|
2110
|
+
try {
|
|
2111
|
+
raw = await readBoundedWebBody(req, MOD_MAX_BYTES);
|
|
2112
|
+
}
|
|
2113
|
+
catch {
|
|
2114
|
+
json(res, 413, { error: "mod_too_large", detail: `at most ${MOD_MAX_BYTES / 1024 / 1024} MiB` });
|
|
2115
|
+
return;
|
|
2116
|
+
}
|
|
2117
|
+
const person = again();
|
|
2118
|
+
if (!person)
|
|
2119
|
+
return;
|
|
2120
|
+
let text;
|
|
2121
|
+
try {
|
|
2122
|
+
text = new TextDecoder("utf-8", { fatal: true }).decode(raw);
|
|
2123
|
+
}
|
|
2124
|
+
catch {
|
|
2125
|
+
json(res, 400, { error: "mod_invalid", problems: [{ path: "", problem: "not UTF-8" }] });
|
|
2126
|
+
return;
|
|
2127
|
+
}
|
|
2128
|
+
const r = mods.stage(person, text);
|
|
2129
|
+
answer(r, r.ok ? { stage: r.stage, plan: r.plan, plan_hash: r.plan_hash } : null);
|
|
2130
|
+
return;
|
|
2131
|
+
}
|
|
2132
|
+
let body;
|
|
2133
|
+
try {
|
|
2134
|
+
body = await parseBody(req);
|
|
2135
|
+
}
|
|
2136
|
+
catch {
|
|
2137
|
+
json(res, 400, { error: "Invalid JSON" });
|
|
2138
|
+
return;
|
|
2139
|
+
}
|
|
2140
|
+
const person = again();
|
|
2141
|
+
if (!person)
|
|
2142
|
+
return;
|
|
2143
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) {
|
|
2144
|
+
json(res, 400, { error: "an object" });
|
|
2145
|
+
return;
|
|
2146
|
+
}
|
|
2147
|
+
if (path === "/ui/mods/abort") {
|
|
2148
|
+
const r = mods.abort(person, body.stage);
|
|
2149
|
+
answer(r, { ok: true });
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
2152
|
+
// r4-5b: an agent's proposal, opened into the usual review (staged as this person's), or dismissed.
|
|
2153
|
+
if (path === "/ui/mods/proposal/stage") {
|
|
2154
|
+
const r = mods.stageProposal(person, body.instance);
|
|
2155
|
+
answer(r, r.ok ? { stage: r.stage, plan: r.plan, plan_hash: r.plan_hash } : null);
|
|
2156
|
+
return;
|
|
2157
|
+
}
|
|
2158
|
+
if (path === "/ui/mods/proposal/dismiss") {
|
|
2159
|
+
const r = mods.dismiss(body.instance);
|
|
2160
|
+
answer(r, { ok: true });
|
|
2161
|
+
return;
|
|
2162
|
+
}
|
|
2163
|
+
if (path === "/ui/mods/commit") {
|
|
1564
2164
|
const r = mods.commit(person, body);
|
|
1565
2165
|
if (r.ok)
|
|
1566
2166
|
ctx.emitSseEvent("status", ctx.getUiStatus()); // themes_rev and prefs_rev moved: every page re-reads
|
|
@@ -1978,7 +2578,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
1978
2578
|
// the panel instead of comparing null against a missing credential.
|
|
1979
2579
|
if (path.startsWith("/ui")) {
|
|
1980
2580
|
const approved = isSettingsReplay(req) && method === "POST"
|
|
1981
|
-
&& (path === "/ui/config" || path === "/ui/instances" || /^\/ui\/instances\/[^/]+\/delete$/.test(path))
|
|
2581
|
+
&& (path === "/ui/config" || path === "/ui/instances" || /^\/ui\/instances\/[^/]+\/delete$/.test(path) || HOST_CLI_PATHS.has(path) || isRuntimeCliInstallPath(path))
|
|
1982
2582
|
? settingsRequestExecution(req) : undefined;
|
|
1983
2583
|
if (approved) {
|
|
1984
2584
|
try {
|
|
@@ -1998,6 +2598,29 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
1998
2598
|
return false;
|
|
1999
2599
|
}
|
|
2000
2600
|
// ── Static files ───────────────────────────────────────
|
|
2601
|
+
// Native local tools retain their administrator boundary on the shared chat/read/action routes.
|
|
2602
|
+
const nativePath = /^\/ui\/(?:chat|instance|cancel|stop|start|restart)\/([^/]+)$/.exec(path);
|
|
2603
|
+
let nativeTarget = url.searchParams.get("instance") ?? "";
|
|
2604
|
+
if (nativePath) {
|
|
2605
|
+
try {
|
|
2606
|
+
nativeTarget = decodeURIComponent(nativePath[1]);
|
|
2607
|
+
}
|
|
2608
|
+
catch {
|
|
2609
|
+
nativeTarget = "";
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
if (isWindowsInstance(ctx.fleetConfig?.instances?.[nativeTarget]) && !nativeCliAuthorization(req, url, ctx)) {
|
|
2613
|
+
json(res, 403, { error: "Windows runtime requires an administrator on the local dashboard" });
|
|
2614
|
+
return true;
|
|
2615
|
+
}
|
|
2616
|
+
if (handleAgentRuntimeChange(req, res, url, ctx))
|
|
2617
|
+
return true;
|
|
2618
|
+
if (handleNativeInstanceRequest(req, res, url, ctx))
|
|
2619
|
+
return true;
|
|
2620
|
+
if (handleWindowsCliRequest(req, res, url, ctx))
|
|
2621
|
+
return true;
|
|
2622
|
+
if (handleRuntimeRequest(req, res, url, ctx))
|
|
2623
|
+
return true;
|
|
2001
2624
|
// #1408: the app shell, for exactly the paths the classifier names (src/web-shell-routes.ts). One page for every
|
|
2002
2625
|
// route; the client router mounts the panel. A malformed instance name is a 400, an unknown one is the shell (the
|
|
2003
2626
|
// panel says "not found"), so the response never tells which names exist.
|
|
@@ -2006,6 +2629,11 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2006
2629
|
json(res, 400, { error: "invalid instance name" });
|
|
2007
2630
|
return true;
|
|
2008
2631
|
}
|
|
2632
|
+
// AgEnD Hub P1: the Hub's pages live on a Hub's own listener (slice 1), never on this fleet's: the ordinary not-found.
|
|
2633
|
+
if (shell?.kind === "shell" && shell.route.panel === "hub") {
|
|
2634
|
+
json(res, 404, { error: "not found" });
|
|
2635
|
+
return true;
|
|
2636
|
+
}
|
|
2009
2637
|
if (shell?.kind === "shell") {
|
|
2010
2638
|
serveAppShell(req, res, ctx, "full");
|
|
2011
2639
|
return true;
|
|
@@ -2067,7 +2695,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2067
2695
|
json(res, 403, { error: "admin_required" });
|
|
2068
2696
|
return;
|
|
2069
2697
|
}
|
|
2070
|
-
if (!body || Array.isArray(body) || typeof body !== "object" || Object.keys(body).some(k =>
|
|
2698
|
+
if (!body || Array.isArray(body) || typeof body !== "object" || Object.keys(body).some(k => !["backend", "instance", "runtime", "machineId", "profile"].includes(k))) {
|
|
2071
2699
|
json(res, 400, { error: "invalid model target" });
|
|
2072
2700
|
return;
|
|
2073
2701
|
}
|
|
@@ -2076,22 +2704,107 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2076
2704
|
json(res, 400, { error: "invalid model target" });
|
|
2077
2705
|
return;
|
|
2078
2706
|
}
|
|
2079
|
-
|
|
2707
|
+
const runtime = body.runtime, machineId = body.machineId, profile = body.profile;
|
|
2708
|
+
if (runtime !== undefined && runtime !== "windows" && runtime !== "wsl" || machineId !== undefined && (typeof machineId !== "string" || !/^[a-f0-9-]{36}$/i.test(machineId)) || profile !== undefined && (typeof profile !== "string" || profile !== "" && !/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.test(profile))) {
|
|
2709
|
+
json(res, 400, { error: "invalid model target" });
|
|
2710
|
+
return;
|
|
2711
|
+
}
|
|
2712
|
+
const target = { backend, instance, ...(runtime ? { runtime: runtime } : {}), ...(machineId ? { machineId: machineId } : {}), ...(profile !== undefined ? { profile: profile } : {}) };
|
|
2713
|
+
let result, fleetAnswered = false;
|
|
2714
|
+
try {
|
|
2715
|
+
result = await refreshNativeModelCatalog(req, url, ctx, target);
|
|
2716
|
+
// Recheck after runtime selection, before any portable probe is admitted.
|
|
2717
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
2718
|
+
return;
|
|
2719
|
+
if (adminAdmissionOf(req, url, ctx) !== admission) {
|
|
2720
|
+
json(res, 403, { error: "admin_required" });
|
|
2721
|
+
return;
|
|
2722
|
+
}
|
|
2723
|
+
if (!result) {
|
|
2724
|
+
if (machineId || !ctx.refreshModelCatalogFor) {
|
|
2725
|
+
json(res, 503, { error: "model_refresh_unavailable" });
|
|
2726
|
+
return;
|
|
2727
|
+
}
|
|
2728
|
+
result = await (profile !== undefined ? ctx.refreshModelCatalogFor(backend, instance, { profile: profile }) : ctx.refreshModelCatalogFor(backend, instance));
|
|
2729
|
+
fleetAnswered = true;
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
catch {
|
|
2733
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
2734
|
+
return;
|
|
2080
2735
|
json(res, 503, { error: "model_refresh_unavailable" });
|
|
2081
2736
|
return;
|
|
2082
2737
|
}
|
|
2083
|
-
const result = await ctx.refreshModelCatalogFor(backend, instance);
|
|
2084
2738
|
if (!permitWebContinuation(req, res, ctx))
|
|
2085
2739
|
return;
|
|
2086
2740
|
if (adminAdmissionOf(req, url, ctx) !== admission) {
|
|
2087
2741
|
json(res, 403, { error: "admin_required" });
|
|
2088
2742
|
return;
|
|
2089
2743
|
}
|
|
2090
|
-
|
|
2744
|
+
// The refreshed list is shaped as the passive read is (a refresh answered by a computer's own runtime is its own).
|
|
2745
|
+
// When the fleet answered, `webCatalog` re-reads the cache the refresh has just written, through the same shaping
|
|
2746
|
+
// as GET /ui/models, rather than shaping `result.models`: that list is the flat one (it has lost which tier each
|
|
2747
|
+
// model came from, and claude's aliases / [1m] variants are in it), so only the cache read can be grouped right.
|
|
2748
|
+
const models = fleetAnswered && Array.isArray(result.models) ? webCatalog(ctx, backend, instance, typeof profile === "string" ? profile : null, result.models) : result.models;
|
|
2749
|
+
// claude with no account list (the refresh could not read it, or the account has none) is answered as GET /ui/models
|
|
2750
|
+
// answers it: the documentation's ids, marked unverified — never an empty list that shows nothing to pick.
|
|
2751
|
+
if (fleetAnswered && backend === "claude-code" && Array.isArray(models) && models.length === 0) {
|
|
2752
|
+
json(res, 200, { backend, ...result, models: documentedClaudeCatalog(ctx), source: "official-catalog" });
|
|
2753
|
+
return;
|
|
2754
|
+
}
|
|
2755
|
+
json(res, 200, { backend, ...result, models });
|
|
2091
2756
|
})().catch(() => { if (!res.headersSent)
|
|
2092
2757
|
json(res, 500, { error: "model_refresh_failed" }); });
|
|
2093
2758
|
return true;
|
|
2094
2759
|
}
|
|
2760
|
+
// AGEND-163: an agent's portable settings as a file, and the way back. Both only compute (nothing is written: loading a
|
|
2761
|
+
// file fills the Settings form, and the person still saves it there), and both are for the admin, as Settings is.
|
|
2762
|
+
if (method === "POST" && (path === "/ui/agent-export/build" || path === "/ui/agent-export/parse")) {
|
|
2763
|
+
const admission = adminAdmissionOf(req, url, ctx);
|
|
2764
|
+
if (!admission) {
|
|
2765
|
+
json(res, 403, { error: "admin_required" });
|
|
2766
|
+
return true;
|
|
2767
|
+
}
|
|
2768
|
+
void (async () => {
|
|
2769
|
+
let body;
|
|
2770
|
+
try {
|
|
2771
|
+
body = await parseBody(req);
|
|
2772
|
+
}
|
|
2773
|
+
catch {
|
|
2774
|
+
json(res, 400, { error: "Invalid JSON" });
|
|
2775
|
+
return;
|
|
2776
|
+
}
|
|
2777
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
2778
|
+
return;
|
|
2779
|
+
if (adminAdmissionOf(req, url, ctx) !== admission) {
|
|
2780
|
+
json(res, 403, { error: "admin_required" });
|
|
2781
|
+
return;
|
|
2782
|
+
}
|
|
2783
|
+
if (!body || Array.isArray(body) || typeof body !== "object") {
|
|
2784
|
+
json(res, 400, { error: "invalid_request" });
|
|
2785
|
+
return;
|
|
2786
|
+
}
|
|
2787
|
+
if (path === "/ui/agent-export/parse") {
|
|
2788
|
+
json(res, 200, parseAgentExport(body.text));
|
|
2789
|
+
return;
|
|
2790
|
+
}
|
|
2791
|
+
const name = body.instance, include = body.include;
|
|
2792
|
+
if (typeof name !== "string" || !isSafeInstanceName(name) || !Array.isArray(include) || include.some(g => typeof g !== "string")) {
|
|
2793
|
+
json(res, 400, { error: "invalid_request" });
|
|
2794
|
+
return;
|
|
2795
|
+
}
|
|
2796
|
+
// The agent's own saved settings: `ctx.fleetConfig.instances[name]` has the fleet's defaults merged into it, and an export
|
|
2797
|
+
// must hold only what this agent itself sets.
|
|
2798
|
+
const inst = Object.hasOwn(ctx.fleetConfig?.instances ?? {}, name) ? ctx.rawInstanceConfig?.(name) : undefined;
|
|
2799
|
+
if (!inst) {
|
|
2800
|
+
json(res, 404, { error: "unknown_instance" });
|
|
2801
|
+
return;
|
|
2802
|
+
}
|
|
2803
|
+
json(res, 200, buildAgentExport(name, inst, include));
|
|
2804
|
+
})().catch(() => { if (!res.headersSent)
|
|
2805
|
+
json(res, 500, { error: "agent_export_failed" }); });
|
|
2806
|
+
return true;
|
|
2807
|
+
}
|
|
2095
2808
|
if (method === "GET" && path === "/ui/models") {
|
|
2096
2809
|
const backend = url.searchParams.get("backend") ?? "";
|
|
2097
2810
|
const instance = url.searchParams.get("instance");
|
|
@@ -2099,7 +2812,67 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2099
2812
|
json(res, 400, { error: "backend (and optional instance) required" });
|
|
2100
2813
|
return true;
|
|
2101
2814
|
}
|
|
2102
|
-
|
|
2815
|
+
const runtime = url.searchParams.get("runtime"), refresh = url.searchParams.get("refresh");
|
|
2816
|
+
const machineId = url.searchParams.get("machineId");
|
|
2817
|
+
if (machineId !== null && (!/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(machineId) || runtime === "wsl")) {
|
|
2818
|
+
json(res, 400, { error: "Invalid model runtime machine" });
|
|
2819
|
+
return true;
|
|
2820
|
+
}
|
|
2821
|
+
if ((runtime !== null && runtime !== "wsl" && runtime !== "windows") || (refresh !== null && refresh !== "1")) {
|
|
2822
|
+
json(res, 400, { error: "Invalid model catalog options" });
|
|
2823
|
+
return true;
|
|
2824
|
+
}
|
|
2825
|
+
const profile = url.searchParams.get("profile");
|
|
2826
|
+
if (profile !== null && profile !== "" && !/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.test(profile)) {
|
|
2827
|
+
json(res, 400, { error: "Invalid model account" });
|
|
2828
|
+
return true;
|
|
2829
|
+
}
|
|
2830
|
+
if (handleNativeModelCatalog(req, res, url, ctx))
|
|
2831
|
+
return true;
|
|
2832
|
+
const models = webCatalog(ctx, backend, instance, profile);
|
|
2833
|
+
// claude with no account list — with or without a credential profile — is answered with the documentation's ids.
|
|
2834
|
+
const answerCatalog = () => {
|
|
2835
|
+
if (backend === "claude-code" && !models.length)
|
|
2836
|
+
json(res, 200, { backend, models: documentedClaudeCatalog(ctx), source: "official-catalog" });
|
|
2837
|
+
else
|
|
2838
|
+
json(res, 200, { backend, models });
|
|
2839
|
+
};
|
|
2840
|
+
// The existing catalog belongs to this instance/account and always wins.
|
|
2841
|
+
if (models.length || !ctx.cliModelCatalogFor || profile !== null) {
|
|
2842
|
+
answerCatalog();
|
|
2843
|
+
return true;
|
|
2844
|
+
}
|
|
2845
|
+
const canAnswer = () => !res.headersSent && !res.destroyed && !res.writableEnded && stillAuthorized(req, res, url, ctx);
|
|
2846
|
+
void (async () => {
|
|
2847
|
+
const cliModels = await ctx.cliModelCatalogFor?.(backend, instance) ?? [];
|
|
2848
|
+
if (!canAnswer())
|
|
2849
|
+
return;
|
|
2850
|
+
const shaped = shapeWebModelCatalog(backend, cliModels);
|
|
2851
|
+
if (shaped.length)
|
|
2852
|
+
json(res, 200, { backend, models: shaped, source: "cli-cache" });
|
|
2853
|
+
else
|
|
2854
|
+
answerCatalog();
|
|
2855
|
+
})().catch(() => {
|
|
2856
|
+
if (canAnswer())
|
|
2857
|
+
json(res, 503, { error: "CLI model cache unavailable" });
|
|
2858
|
+
});
|
|
2859
|
+
return true;
|
|
2860
|
+
}
|
|
2861
|
+
// The effort levels Settings → Runtime & model's dropdown offers for an agent and a (not yet saved) model — the chat chip's list.
|
|
2862
|
+
if (method === "GET" && path === "/ui/effort-options") {
|
|
2863
|
+
const instance = url.searchParams.get("instance") ?? "", model = url.searchParams.get("model");
|
|
2864
|
+
if (!instance || !isSafeInstanceName(instance) || (model !== null && (model.length > 256 || /[\x00-\x1f\x7f]/.test(model)))) {
|
|
2865
|
+
json(res, 400, { error: "instance (and optional model) required" });
|
|
2866
|
+
return true;
|
|
2867
|
+
}
|
|
2868
|
+
if (!Object.hasOwn(ctx.fleetConfig?.instances ?? {}, instance) || !ctx.effortOptionsFor) {
|
|
2869
|
+
json(res, 404, { error: "Not available" });
|
|
2870
|
+
return true;
|
|
2871
|
+
}
|
|
2872
|
+
const { levels, effort, source } = ctx.effortOptionsFor(instance, model || null);
|
|
2873
|
+
// `model`: the one saved for the agent (empty: it follows the default), so the page can tell a model it has not saved yet.
|
|
2874
|
+
const saved = ctx.fleetConfig.instances[instance].model;
|
|
2875
|
+
json(res, 200, { instance, levels, effort, source, model: typeof saved === "string" ? saved : "" });
|
|
2103
2876
|
return true;
|
|
2104
2877
|
}
|
|
2105
2878
|
if (method === "GET" && path === "/ui/backends") {
|
|
@@ -2305,6 +3078,143 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2305
3078
|
json(res, 200, { messages, boot: ctx.webChatHistory?.boot ?? null, lastId: ctx.webChatHistory?.lastId ?? 0, ...(allHidden ? { allHidden: true } : {}) });
|
|
2306
3079
|
return true;
|
|
2307
3080
|
}
|
|
3081
|
+
// ── #3212 PR 1: Settings → Agents → Accounts (read-only) ─────────────────────────────────
|
|
3082
|
+
// Each CLI's default sign-in and credential profiles, who uses them and their weekly usage. Names, states, the masked
|
|
3083
|
+
// identity and the host login command (which, as in the sign-in list, names the profile's folder) — no credential or
|
|
3084
|
+
// full e-mail: only for the fleet's local admin session — never the public link, a guest, a token or the gateway (the
|
|
3085
|
+
// same rule as the sign-in list it extends).
|
|
3086
|
+
if (method === "GET" && path === "/ui/accounts") {
|
|
3087
|
+
res.setHeader("Cache-Control", "private, no-store");
|
|
3088
|
+
if (gatewayRequestContext(req)) {
|
|
3089
|
+
json(res, 404, { error: "not_found" });
|
|
3090
|
+
return true;
|
|
3091
|
+
}
|
|
3092
|
+
const localAdmin = () => {
|
|
3093
|
+
const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
3094
|
+
return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" && v.session.surface === "local" ? v.session : null;
|
|
3095
|
+
};
|
|
3096
|
+
const who = localAdmin();
|
|
3097
|
+
if (!who) {
|
|
3098
|
+
json(res, 403, { error: "accounts_need_a_local_admin" });
|
|
3099
|
+
return true;
|
|
3100
|
+
}
|
|
3101
|
+
if (typeof ctx.accountsView !== "function") {
|
|
3102
|
+
json(res, 404, { error: "not_found" });
|
|
3103
|
+
return true;
|
|
3104
|
+
}
|
|
3105
|
+
void ctx.accountsView().then(view => {
|
|
3106
|
+
if (localAdmin()?.handle !== who.handle) {
|
|
3107
|
+
json(res, 403, { error: "accounts_need_a_local_admin" });
|
|
3108
|
+
return;
|
|
3109
|
+
}
|
|
3110
|
+
json(res, 200, view);
|
|
3111
|
+
}, err => { ctx.logger.error({ err: err.message }, "Accounts view failed"); json(res, 500, { error: "could not read the accounts" }); });
|
|
3112
|
+
return true;
|
|
3113
|
+
}
|
|
3114
|
+
// ── #3153 P1: an agent's Files / Changes (read-only) ─────────────────────────────────
|
|
3115
|
+
// The fleet's local admin session only: never the public link, a guest, a token or a connection from outside. One
|
|
3116
|
+
// agent's own working directory (agent-workspace.ts confines and filters every path); not General or a coordinator
|
|
3117
|
+
// (they work in the fleet's own directory), not an agent on another machine.
|
|
3118
|
+
if (method === "GET" && path === "/ui/workspace") {
|
|
3119
|
+
res.setHeader("Cache-Control", "private, no-store");
|
|
3120
|
+
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
3121
|
+
if (gatewayRequestContext(req)) {
|
|
3122
|
+
json(res, 404, { error: "not_found" });
|
|
3123
|
+
return true;
|
|
3124
|
+
}
|
|
3125
|
+
const localAdmin = () => {
|
|
3126
|
+
const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
3127
|
+
return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" && v.session.surface === "local" ? v.session : null;
|
|
3128
|
+
};
|
|
3129
|
+
const who = localAdmin();
|
|
3130
|
+
if (!who) {
|
|
3131
|
+
json(res, 403, { error: "workspace_needs_a_local_admin" });
|
|
3132
|
+
return true;
|
|
3133
|
+
}
|
|
3134
|
+
const p = url.searchParams, instance = p.get("instance") ?? "", op = p.get("op") ?? "";
|
|
3135
|
+
const cfg = ctx.fleetConfig?.instances && Object.hasOwn(ctx.fleetConfig.instances, instance) ? ctx.fleetConfig.instances[instance] : undefined;
|
|
3136
|
+
if (!cfg) {
|
|
3137
|
+
json(res, 404, { error: "not_found" });
|
|
3138
|
+
return true;
|
|
3139
|
+
}
|
|
3140
|
+
const offered = !isGeneralInstance(ctx.fleetConfig, instance) && resolveToolSet(cfg, instance) !== "coordinator"
|
|
3141
|
+
&& cfg.runtime !== "windows" && !cfg.machine_id;
|
|
3142
|
+
if (!offered) {
|
|
3143
|
+
json(res, 404, { error: "workspace_not_offered" });
|
|
3144
|
+
return true;
|
|
3145
|
+
}
|
|
3146
|
+
if (!["changes", "list", "file", "image", "diff", "follow"].includes(op)) {
|
|
3147
|
+
json(res, 400, { error: "op: changes | list | file | image | diff | follow" });
|
|
3148
|
+
return true;
|
|
3149
|
+
}
|
|
3150
|
+
const workDir = String(cfg.working_directory ?? "").replace(/^~(?=$|\/)/, process.env.HOME ?? "~");
|
|
3151
|
+
const backend = String(cfg.backend ?? ctx.fleetConfig?.defaults?.backend ?? "claude-code");
|
|
3152
|
+
const daemon = ctx.daemons.get(instance);
|
|
3153
|
+
void (async () => {
|
|
3154
|
+
try {
|
|
3155
|
+
const ws = await workspaceRoot(workDir, getAgendHome());
|
|
3156
|
+
// The session must still be the same one when the answer goes out (it may have ended while git ran).
|
|
3157
|
+
const answer = async () => {
|
|
3158
|
+
if (op === "changes")
|
|
3159
|
+
return { kind: "json", body: await workspaceChanges(ws) };
|
|
3160
|
+
if (op === "list")
|
|
3161
|
+
return { kind: "json", body: await workspaceList(ws, p.get("path") ?? "") };
|
|
3162
|
+
if (op === "file")
|
|
3163
|
+
return { kind: "json", body: await workspaceFile(ws, p.get("path")) };
|
|
3164
|
+
if (op === "diff")
|
|
3165
|
+
return { kind: "json", body: await workspaceFileDiff(ws, p.get("path")) };
|
|
3166
|
+
if (op === "follow") {
|
|
3167
|
+
// #3160: this turn's file steps, from the CLI's own record, confined to this folder (outside paths dropped,
|
|
3168
|
+
// secret-looking ones marked hidden). Polled by an open panel with Follow on; nothing is pushed.
|
|
3169
|
+
const supported = backend === "claude-code" || backend === "codex";
|
|
3170
|
+
const d = daemon;
|
|
3171
|
+
const after = Number(p.get("after") ?? 0), turnQ = p.get("turn");
|
|
3172
|
+
const snap = supported && d && typeof d.workspaceFollow === "function"
|
|
3173
|
+
? d.workspaceFollow(Number.isSafeInteger(after) && after >= 0 ? after : 0, turnQ !== null && /^\d{1,9}$/.test(turnQ) ? Number(turnQ) : undefined, p.get("scope") ?? undefined)
|
|
3174
|
+
: { scope: "", turn: 0, steps: [], last: 0 };
|
|
3175
|
+
return { kind: "json", body: { supported, running: !!d, scope: snap.scope, turn: snap.turn, last: snap.last, steps: await resolveFollowSteps(ws, snap.steps) } };
|
|
3176
|
+
}
|
|
3177
|
+
return { kind: "image", body: await workspaceImage(ws, p.get("path")) };
|
|
3178
|
+
};
|
|
3179
|
+
const out = await answer();
|
|
3180
|
+
if (localAdmin()?.handle !== who.handle) {
|
|
3181
|
+
json(res, 403, { error: "workspace_needs_a_local_admin" });
|
|
3182
|
+
return;
|
|
3183
|
+
}
|
|
3184
|
+
const current = ctx.fleetConfig?.instances[instance];
|
|
3185
|
+
if (current !== cfg || String(current.working_directory ?? "").replace(/^~(?=$|\/)/, process.env.HOME ?? "~") !== workDir
|
|
3186
|
+
|| String(current.backend ?? ctx.fleetConfig?.defaults?.backend ?? "claude-code") !== backend
|
|
3187
|
+
|| current.runtime === "windows" || current.machine_id || isGeneralInstance(ctx.fleetConfig, instance)
|
|
3188
|
+
|| resolveToolSet(current, instance) === "coordinator" || (op === "follow" && ctx.daemons.get(instance) !== daemon)) {
|
|
3189
|
+
json(res, 403, { error: "workspace_changed" });
|
|
3190
|
+
return;
|
|
3191
|
+
}
|
|
3192
|
+
if (op === "follow" && out.kind === "json") {
|
|
3193
|
+
const frame = out.body;
|
|
3194
|
+
const live = daemon;
|
|
3195
|
+
if (frame.supported && frame.running && frame.scope && live?.workspaceFollow?.(0).scope !== frame.scope) {
|
|
3196
|
+
json(res, 403, { error: "workspace_changed" });
|
|
3197
|
+
return;
|
|
3198
|
+
}
|
|
3199
|
+
}
|
|
3200
|
+
if (out.kind === "image") {
|
|
3201
|
+
res.writeHead(200, { "Content-Type": out.body.mime, "Content-Length": String(out.body.bytes.length), "Content-Security-Policy": "default-src 'none'; sandbox" });
|
|
3202
|
+
res.end(out.body.bytes);
|
|
3203
|
+
return;
|
|
3204
|
+
}
|
|
3205
|
+
json(res, 200, out.body);
|
|
3206
|
+
}
|
|
3207
|
+
catch (err) {
|
|
3208
|
+
if (err instanceof WorkspaceError) {
|
|
3209
|
+
json(res, err.code === "not_found" || err.code === "not_a_directory" ? 404 : 403, { error: err.code });
|
|
3210
|
+
return;
|
|
3211
|
+
}
|
|
3212
|
+
ctx.logger.error({ err: err.message, instance }, "Workspace read failed");
|
|
3213
|
+
json(res, 500, { error: "could not read the folder" });
|
|
3214
|
+
}
|
|
3215
|
+
})();
|
|
3216
|
+
return true;
|
|
3217
|
+
}
|
|
2308
3218
|
// ── #1218: the Log tab ─────────────────────────────────
|
|
2309
3219
|
// An instance's steps, read on demand from its own transcript (log-service.ts). Read-only, and offered on the public
|
|
2310
3220
|
// link on purpose (the user's decision): the same masking applies to every viewer. Passive (web-auth.ts).
|
|
@@ -2361,11 +3271,33 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2361
3271
|
json(res, 404, { error: "not available" });
|
|
2362
3272
|
return true;
|
|
2363
3273
|
}
|
|
3274
|
+
// AGEND-181: thinking only for an admin session on the local dashboard, decided here — never the public link, a
|
|
3275
|
+
// guest or a View projection, whatever the query says. The service makes none otherwise (its parser is not asked).
|
|
3276
|
+
// AGEND-197: the chat's activity block (chat=1) is for the same viewer and no other: a refusal here, not a hidden block.
|
|
3277
|
+
const admission = adminAdmissionOf(req, url, ctx);
|
|
3278
|
+
const admin = !!admission && !gatewayRequestContext(req) && !guestRequestOf(req);
|
|
3279
|
+
const chat = p.get("chat") === "1";
|
|
3280
|
+
if (chat && !admin) {
|
|
3281
|
+
json(res, 403, { error: "admin_only" });
|
|
3282
|
+
return true;
|
|
3283
|
+
}
|
|
3284
|
+
const thinking = p.get("thinking") === "1" && admin;
|
|
2364
3285
|
ctx.logSteps(instance, {
|
|
3286
|
+
...(chat ? { chat: true } : {}),
|
|
3287
|
+
...(thinking ? { thinking: true } : {}),
|
|
2365
3288
|
...(after !== undefined ? { after } : {}), ...(before !== undefined ? { before } : {}), ...(ev !== undefined ? { ev } : {}),
|
|
2366
3289
|
...(limit !== undefined ? { limit } : {}), ...(key !== null ? { key } : {}),
|
|
2367
3290
|
skip: p.get("skip") === "1", watch: p.get("watch") === "1",
|
|
2368
3291
|
}).then(answer => {
|
|
3292
|
+
if (res.destroyed)
|
|
3293
|
+
return;
|
|
3294
|
+
// Prism #3709 R1: the transcript read is asynchronous — an admin session revoked, or the web token rotated, while it
|
|
3295
|
+
// ran must not receive the private steps (the chat's block, thinking) it was admitted for. Asked again here, as
|
|
3296
|
+
// /ui/subagents does; the Log tab's own read (no chat, no thinking) is not private and is left as it was.
|
|
3297
|
+
if ((chat || thinking) && (adminAdmissionOf(req, url, ctx) !== admission || gatewayRequestContext(req) || guestRequestOf(req))) {
|
|
3298
|
+
json(res, 403, { error: "admin_only" });
|
|
3299
|
+
return;
|
|
3300
|
+
}
|
|
2369
3301
|
if (answer === null)
|
|
2370
3302
|
json(res, 404, { error: `Instance not found: ${instance}` });
|
|
2371
3303
|
else
|
|
@@ -2525,115 +3457,31 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2525
3457
|
json(res, typeof r.status === "number" ? r.status : 503, { error: r.error });
|
|
2526
3458
|
return;
|
|
2527
3459
|
}
|
|
2528
|
-
json(res, 200, r);
|
|
2529
|
-
})().catch(err => {
|
|
2530
|
-
ctx.logger.error({ err: err.message }, "Theme reset/lock failed");
|
|
2531
|
-
try {
|
|
2532
|
-
json(res, 500, { error: "Theme change failed" });
|
|
2533
|
-
}
|
|
2534
|
-
catch { /* already answered */ }
|
|
2535
|
-
});
|
|
2536
|
-
return true;
|
|
2537
|
-
}
|
|
2538
|
-
// ── Fleet → Org chart → Office: the offices people made (web-offices.json, web-office-store.ts) ──
|
|
2539
|
-
// GET /ui/offices: { rev, offices, readable } for whoever may open the org chart (the public link too: it reads the
|
|
2540
|
-
// chart; a guest's routes do not include it). PUT /ui/offices { offices, rev? }: a person's change, as a theme's reset
|
|
2541
|
-
// or lock is — an admin session only, never the CLI token, never the public link (absent from its manifest, and
|
|
2542
|
-
// refused here too); asked again once the body is in. Every page hears `offices` on the stream and reads again.
|
|
2543
|
-
if (method === "GET" && path === "/ui/offices") {
|
|
2544
|
-
const store = ctx.officeStore;
|
|
2545
|
-
if (!store) {
|
|
2546
|
-
json(res, 404, { error: "Offices are not kept on this fleet" });
|
|
2547
|
-
return true;
|
|
2548
|
-
}
|
|
2549
|
-
json(res, 200, store.list());
|
|
2550
|
-
return true;
|
|
2551
|
-
}
|
|
2552
|
-
if (method === "PUT" && path === "/ui/offices") {
|
|
2553
|
-
const store = ctx.officeStore;
|
|
2554
|
-
if (!store) {
|
|
2555
|
-
json(res, 404, { error: "Offices are not kept on this fleet" });
|
|
2556
|
-
return true;
|
|
2557
|
-
}
|
|
2558
|
-
if (gatewayRequestContext(req)) {
|
|
2559
|
-
json(res, 403, { error: "offices_not_over_public_link" });
|
|
2560
|
-
return true;
|
|
2561
|
-
}
|
|
2562
|
-
// The person (an admin session's account), or the status that refuses the request.
|
|
2563
|
-
const who = () => {
|
|
2564
|
-
const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
2565
|
-
if (verdict.kind !== "allow")
|
|
2566
|
-
return { status: 401 };
|
|
2567
|
-
return verdict.via === "session" && verdict.session?.tier === "admin" ? { person: verdict.session.owner ? webPersonKey(verdict.session.owner) : "admin-session" } : { status: 403 };
|
|
2568
|
-
};
|
|
2569
|
-
const refuse = (status) => json(res, status, { error: status === 401 ? WEB_TOKEN_INVALID_MESSAGE : "offices_need_an_admin_session" });
|
|
2570
|
-
const first = who();
|
|
2571
|
-
if ("status" in first) {
|
|
2572
|
-
refuse(first.status);
|
|
2573
|
-
return true;
|
|
2574
|
-
}
|
|
2575
|
-
(async () => {
|
|
2576
|
-
let body;
|
|
2577
|
-
try {
|
|
2578
|
-
body = await parseBody(req);
|
|
2579
|
-
}
|
|
2580
|
-
catch {
|
|
2581
|
-
json(res, 400, { error: "Invalid JSON" });
|
|
2582
|
-
return;
|
|
2583
|
-
}
|
|
2584
|
-
if (!permitWebContinuation(req, res, ctx))
|
|
2585
|
-
return;
|
|
2586
|
-
const now = who();
|
|
2587
|
-
if ("status" in now) {
|
|
2588
|
-
refuse(now.status);
|
|
2589
|
-
return;
|
|
2590
|
-
}
|
|
2591
|
-
if (!body || typeof body !== "object" || Array.isArray(body)) {
|
|
2592
|
-
json(res, 400, { error: "offices required" });
|
|
2593
|
-
return;
|
|
2594
|
-
}
|
|
2595
|
-
const extra = Object.keys(body).find(k => k !== "offices" && k !== "rev");
|
|
2596
|
-
if (extra !== undefined) {
|
|
2597
|
-
json(res, 400, { error: "offices_invalid", detail: `unknown key "${extra}"` });
|
|
2598
|
-
return;
|
|
2599
|
-
}
|
|
2600
|
-
// Office review: the rev the page read is required — a save without one would overwrite another person's unseen.
|
|
2601
|
-
if (body.rev === undefined) {
|
|
2602
|
-
json(res, 428, { error: "offices_rev_required", detail: "send the rev you read (GET /ui/offices)" });
|
|
2603
|
-
return;
|
|
2604
|
-
}
|
|
2605
|
-
if (!Number.isSafeInteger(body.rev)) {
|
|
2606
|
-
json(res, 400, { error: "offices_invalid", detail: "rev: an integer" });
|
|
2607
|
-
return;
|
|
2608
|
-
}
|
|
2609
|
-
const limiter = ctx.officeWrites, allowed = limiter ? limiter.check(now.person) : { ok: true };
|
|
2610
|
-
if (!allowed.ok) {
|
|
2611
|
-
res.setHeader("Retry-After", String(allowed.retry_after_s));
|
|
2612
|
-
json(res, 429, { error: "offices_rate_limited", retry_after_s: allowed.retry_after_s });
|
|
2613
|
-
return;
|
|
2614
|
-
}
|
|
2615
|
-
const r = store.replace(body.offices, body.rev);
|
|
2616
|
-
if (!r.ok) {
|
|
2617
|
-
json(res, r.status, { error: r.error, ...(r.detail ? { detail: r.detail } : {}) });
|
|
2618
|
-
return;
|
|
2619
|
-
}
|
|
2620
|
-
limiter?.record(now.person);
|
|
2621
|
-
ctx.emitSseEvent("offices", { rev: r.rev });
|
|
2622
|
-
json(res, 200, { rev: r.rev, offices: r.offices });
|
|
3460
|
+
json(res, 200, r);
|
|
2623
3461
|
})().catch(err => {
|
|
2624
|
-
ctx.logger.error({ err: err.message }, "
|
|
3462
|
+
ctx.logger.error({ err: err.message }, "Theme reset/lock failed");
|
|
2625
3463
|
try {
|
|
2626
|
-
json(res, 500, { error: "
|
|
3464
|
+
json(res, 500, { error: "Theme change failed" });
|
|
2627
3465
|
}
|
|
2628
3466
|
catch { /* already answered */ }
|
|
2629
3467
|
});
|
|
2630
3468
|
return true;
|
|
2631
3469
|
}
|
|
2632
|
-
//
|
|
2633
|
-
//
|
|
2634
|
-
//
|
|
2635
|
-
//
|
|
2636
|
-
|
|
3470
|
+
// ── Fleet → Org chart → Office: the offices people made (web-offices.json, web-office-store.ts) ──
|
|
3471
|
+
// GET /ui/offices: { rev, offices, readable } for whoever may open the org chart (the public link too: it reads the
|
|
3472
|
+
// chart; a guest's routes do not include it). PUT /ui/offices { offices, rev? }: a person's change, as a theme's reset
|
|
3473
|
+
// or lock is — an admin session only, never the CLI token, never the public link (absent from its manifest, and
|
|
3474
|
+
// refused here too); asked again once the body is in. Every page hears `offices` on the stream and reads again.
|
|
3475
|
+
if (method === "GET" && path === "/ui/offices") {
|
|
3476
|
+
const store = ctx.officeStore;
|
|
3477
|
+
if (!store) {
|
|
3478
|
+
json(res, 404, { error: "Offices are not kept on this fleet" });
|
|
3479
|
+
return true;
|
|
3480
|
+
}
|
|
3481
|
+
json(res, 200, store.list());
|
|
3482
|
+
return true;
|
|
3483
|
+
}
|
|
3484
|
+
if (method === "PUT" && path === "/ui/offices") {
|
|
2637
3485
|
const store = ctx.officeStore;
|
|
2638
3486
|
if (!store) {
|
|
2639
3487
|
json(res, 404, { error: "Offices are not kept on this fleet" });
|
|
@@ -2643,6 +3491,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2643
3491
|
json(res, 403, { error: "offices_not_over_public_link" });
|
|
2644
3492
|
return true;
|
|
2645
3493
|
}
|
|
3494
|
+
// The person (an admin session's account), or the status that refuses the request.
|
|
2646
3495
|
const who = () => {
|
|
2647
3496
|
const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
2648
3497
|
if (verdict.kind !== "allow")
|
|
@@ -2671,8 +3520,22 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2671
3520
|
refuse(now.status);
|
|
2672
3521
|
return;
|
|
2673
3522
|
}
|
|
2674
|
-
if (!body || typeof body !== "object" || Array.isArray(body)
|
|
2675
|
-
json(res, 400, { error: "
|
|
3523
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) {
|
|
3524
|
+
json(res, 400, { error: "offices required" });
|
|
3525
|
+
return;
|
|
3526
|
+
}
|
|
3527
|
+
const extra = Object.keys(body).find(k => k !== "offices" && k !== "rev");
|
|
3528
|
+
if (extra !== undefined) {
|
|
3529
|
+
json(res, 400, { error: "offices_invalid", detail: `unknown key "${extra}"` });
|
|
3530
|
+
return;
|
|
3531
|
+
}
|
|
3532
|
+
// Office review: the rev the page read is required — a save without one would overwrite another person's unseen.
|
|
3533
|
+
if (body.rev === undefined) {
|
|
3534
|
+
json(res, 428, { error: "offices_rev_required", detail: "send the rev you read (GET /ui/offices)" });
|
|
3535
|
+
return;
|
|
3536
|
+
}
|
|
3537
|
+
if (!Number.isSafeInteger(body.rev)) {
|
|
3538
|
+
json(res, 400, { error: "offices_invalid", detail: "rev: an integer" });
|
|
2676
3539
|
return;
|
|
2677
3540
|
}
|
|
2678
3541
|
const limiter = ctx.officeWrites, allowed = limiter ? limiter.check(now.person) : { ok: true };
|
|
@@ -2681,23 +3544,38 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2681
3544
|
json(res, 429, { error: "offices_rate_limited", retry_after_s: allowed.retry_after_s });
|
|
2682
3545
|
return;
|
|
2683
3546
|
}
|
|
2684
|
-
const r = store.
|
|
3547
|
+
const r = store.replace(body.offices, body.rev);
|
|
2685
3548
|
if (!r.ok) {
|
|
2686
3549
|
json(res, r.status, { error: r.error, ...(r.detail ? { detail: r.detail } : {}) });
|
|
2687
3550
|
return;
|
|
2688
3551
|
}
|
|
2689
3552
|
limiter?.record(now.person);
|
|
2690
3553
|
ctx.emitSseEvent("offices", { rev: r.rev });
|
|
2691
|
-
json(res, 200, { rev: r.rev,
|
|
3554
|
+
json(res, 200, { rev: r.rev, offices: r.offices });
|
|
2692
3555
|
})().catch(err => {
|
|
2693
|
-
ctx.logger.error({ err: err.message }, "Saving
|
|
3556
|
+
ctx.logger.error({ err: err.message }, "Saving offices failed");
|
|
2694
3557
|
try {
|
|
2695
|
-
json(res, 500, { error: "Saving
|
|
3558
|
+
json(res, 500, { error: "Saving offices failed" });
|
|
2696
3559
|
}
|
|
2697
3560
|
catch { /* already answered */ }
|
|
2698
3561
|
});
|
|
2699
3562
|
return true;
|
|
2700
3563
|
}
|
|
3564
|
+
// #2716: PUT /ui/office-style { skin }: the whole-fleet office's style for every viewer, device and share link (a skin
|
|
3565
|
+
// id, or null for the default; read back as GET /ui/offices's autoSkin). Who may save the offices may set it, as they
|
|
3566
|
+
// would: an admin session, never the CLI token or the public link; asked again once the body is in; counted with the
|
|
3567
|
+
// offices' saves. Every page hears `offices` and reads again.
|
|
3568
|
+
if (method === "PUT" && path === "/ui/office-style") {
|
|
3569
|
+
return officeSettingPut(req, res, url, ctx, { key: "skin", invalid: "office_style_invalid", shape: "{ skin: a skin id, or null }", failed: "Saving the office style failed",
|
|
3570
|
+
apply: (store, v) => { const r = store.setAutoSkin(v); return r.ok ? { ok: true, rev: r.rev, answer: { autoSkin: r.autoSkin } } : r; } });
|
|
3571
|
+
}
|
|
3572
|
+
// #3679: PUT /ui/office-level-titles { levels }: the fleet's own Office level titles for every office (`{ titles?,
|
|
3573
|
+
// fixed? }`, a pack's rules; null: none — read back as GET /ui/offices's levels). A pack's own `levels` still win for
|
|
3574
|
+
// the offices drawn in it (on the page). Who may set the style may set these, the same way.
|
|
3575
|
+
if (method === "PUT" && path === "/ui/office-level-titles") {
|
|
3576
|
+
return officeSettingPut(req, res, url, ctx, { key: "levels", invalid: "office_levels_invalid", shape: "{ levels: { titles?, fixed? }, or null }", failed: "Saving the level titles failed",
|
|
3577
|
+
apply: (store, v) => { const r = store.setLevels(v); return r.ok ? { ok: true, rev: r.rev, answer: { levels: r.levels } } : r; } });
|
|
3578
|
+
}
|
|
2701
3579
|
// #2578: GET /ui/office-acts { acts }: the agents' live acts (office_set), read as the offices are (the public link
|
|
2702
3580
|
// too, which has no stream); every change also comes as `office_acts` on the stream. Nothing here writes one.
|
|
2703
3581
|
if (method === "GET" && path === "/ui/office-acts") {
|
|
@@ -3089,6 +3967,13 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3089
3967
|
return handleBrowserBackendSignIns(req, res, url, ctx);
|
|
3090
3968
|
if (path === "/ui/backend-login" || path.startsWith("/ui/backend-login/"))
|
|
3091
3969
|
return handleBackendLogin(req, res, url, ctx, path, method);
|
|
3970
|
+
if (path === "/ui/host-install" || path === "/ui/host-install/cancel" || path === "/ui/host-update")
|
|
3971
|
+
return handleHostInstall(req, res, url, ctx, path, method);
|
|
3972
|
+
// #3292: before the accounts prefix — its Add pattern (`POST /ui/accounts/<backend>`) would read "keep-alive" as a backend.
|
|
3973
|
+
if (path === "/ui/accounts/keep-alive")
|
|
3974
|
+
return handleAccountKeepAlive(req, res, url, ctx, method);
|
|
3975
|
+
if (path.startsWith("/ui/accounts/"))
|
|
3976
|
+
return handleAccountWrite(req, res, url, ctx, path, method);
|
|
3092
3977
|
// #1386: Acknowledge a "Needs you" delivery item — a session write (CSRF, checked by the gate) or the CLI's header
|
|
3093
3978
|
// token. Who did it is recorded by principal: the session's public handle, never the session id or a credential.
|
|
3094
3979
|
// #2910 D2: a web-only fleet's Notices — what General would have said. Admins only (never a guest: not in
|
|
@@ -3132,6 +4017,281 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3132
4017
|
});
|
|
3133
4018
|
return true;
|
|
3134
4019
|
}
|
|
4020
|
+
// ── #3008: connections from outside (a web-only fleet) ──
|
|
4021
|
+
// GET /ui/outside: the state (any admin; over the outside link too, read-only). What changes it is an admin's, over a
|
|
4022
|
+
// direct connection (the fleet asks the live session each time; the public link refuses these routes outright):
|
|
4023
|
+
// POST /ui/outside/enroll (a new secret, shown once; AGEND-122: {code} — the current one — while the owner's stricter
|
|
4024
|
+
// option is on and this is not the AgEnD computer), POST /ui/outside/enroll/confirm {code}, POST /ui/outside/remove
|
|
4025
|
+
// ({code} likewise), POST /ui/outside/strict {on, code?} (your own "ask for my code" switch) and POST /ui/outside/switch {on} — the
|
|
4026
|
+
// switch stays this computer's admin's, on a web-only fleet. Each acts on the caller's own authenticator only (per admin).
|
|
4027
|
+
// Never a guest (not in GUEST_ROUTES).
|
|
4028
|
+
if (method === "GET" && path === "/ui/outside") {
|
|
4029
|
+
res.setHeader("Cache-Control", "no-store");
|
|
4030
|
+
json(res, 200, ctx.webOutsideStatus?.(req) ?? { webOnly: false, here: false, manage: false, codeNeeded: false, strict: false, enrolled: false, enrolledAt: null, outside: false, pausedForMs: 0, link: null });
|
|
4031
|
+
return true;
|
|
4032
|
+
}
|
|
4033
|
+
if (method === "POST" && (path === "/ui/outside/enroll" || path === "/ui/outside/enroll/confirm" || path === "/ui/outside/remove" || path === "/ui/outside/switch" || path === "/ui/outside/strict")) {
|
|
4034
|
+
if (gatewayRequestContext(req)) {
|
|
4035
|
+
json(res, 403, { error: "outside_not_here" });
|
|
4036
|
+
return true;
|
|
4037
|
+
}
|
|
4038
|
+
(async () => {
|
|
4039
|
+
let body;
|
|
4040
|
+
try {
|
|
4041
|
+
body = await parseBody(req);
|
|
4042
|
+
}
|
|
4043
|
+
catch {
|
|
4044
|
+
json(res, 400, { error: "Invalid JSON" });
|
|
4045
|
+
return;
|
|
4046
|
+
}
|
|
4047
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
4048
|
+
return;
|
|
4049
|
+
res.setHeader("Cache-Control", "no-store");
|
|
4050
|
+
// AGEND-122: replacing or removing the authenticator asks for the current code while the owner's stricter option is on
|
|
4051
|
+
// and this is not the AgEnD computer's own browser (the fleet decides); the answer to a missing or wrong one is its own.
|
|
4052
|
+
const stepCode = body && typeof body === "object" && typeof body.code === "string" && body.code.length <= 32 ? body.code : undefined;
|
|
4053
|
+
const refusal = (r) => {
|
|
4054
|
+
if (r.error === "paused") {
|
|
4055
|
+
res.setHeader("Retry-After", String(Math.ceil((r.retryAfterMs ?? 60_000) / 1000)));
|
|
4056
|
+
json(res, 429, { error: "paused", retryAfterMs: r.retryAfterMs ?? null });
|
|
4057
|
+
return;
|
|
4058
|
+
}
|
|
4059
|
+
json(res, r.error === "wrong" ? 401 : r.error === "unavailable" ? 503 : r.error === "code_required" ? 400 : 403, { error: r.error === "not_here" ? "outside_not_here" : r.error });
|
|
4060
|
+
};
|
|
4061
|
+
if (path === "/ui/outside/enroll") {
|
|
4062
|
+
const r = ctx.webOutsideBeginEnrollment?.(req, stepCode) ?? null;
|
|
4063
|
+
if (!r) {
|
|
4064
|
+
json(res, 403, { error: "outside_not_here" });
|
|
4065
|
+
return;
|
|
4066
|
+
}
|
|
4067
|
+
if ("error" in r) {
|
|
4068
|
+
refusal(r);
|
|
4069
|
+
return;
|
|
4070
|
+
}
|
|
4071
|
+
json(res, 200, r);
|
|
4072
|
+
return;
|
|
4073
|
+
}
|
|
4074
|
+
if (path === "/ui/outside/enroll/confirm") {
|
|
4075
|
+
const code = body && typeof body === "object" ? body.code : undefined;
|
|
4076
|
+
if (typeof code !== "string" || code.length > 32) {
|
|
4077
|
+
json(res, 400, { error: "code required" });
|
|
4078
|
+
return;
|
|
4079
|
+
}
|
|
4080
|
+
const r = ctx.webOutsideConfirmEnrollment?.(req, code) ?? "not_here";
|
|
4081
|
+
json(res, r === "ok" ? 200 : r === "not_here" ? 403 : r === "unsaved" ? 503 : r === "full" ? 409 : 400, r === "ok" ? { ok: true } : { error: r === "not_here" ? "outside_not_here" : r });
|
|
4082
|
+
return;
|
|
4083
|
+
}
|
|
4084
|
+
if (path === "/ui/outside/remove") {
|
|
4085
|
+
const r = ctx.webOutsideRemove?.(req, stepCode) ?? "not_here";
|
|
4086
|
+
if (typeof r === "object") {
|
|
4087
|
+
refusal(r);
|
|
4088
|
+
return;
|
|
4089
|
+
}
|
|
4090
|
+
json(res, r === "ok" ? 200 : r === "unsaved" ? 503 : 403, r === "ok" ? { ok: true } : { error: r === "unsaved" ? "unsaved" : "outside_not_here" });
|
|
4091
|
+
return;
|
|
4092
|
+
}
|
|
4093
|
+
const on = body && typeof body === "object" ? body.on : undefined;
|
|
4094
|
+
if (typeof on !== "boolean") {
|
|
4095
|
+
json(res, 400, { error: "on must be true or false" });
|
|
4096
|
+
return;
|
|
4097
|
+
}
|
|
4098
|
+
if (path === "/ui/outside/strict") {
|
|
4099
|
+
// AGEND-122 (per admin): the caller's OWN "ask for my code" switch — on needs their app and asks nothing, off asks their current code.
|
|
4100
|
+
const sr = ctx.webOutsideStrict?.(req, on, stepCode) ?? "not_here";
|
|
4101
|
+
if (typeof sr === "object") {
|
|
4102
|
+
refusal(sr);
|
|
4103
|
+
return;
|
|
4104
|
+
}
|
|
4105
|
+
json(res, sr === "ok" ? 200 : sr === "not_here" ? 403 : sr === "unsaved" ? 503 : 409, sr === "ok" ? { ok: true } : { error: sr === "not_here" ? "outside_not_here" : sr });
|
|
4106
|
+
return;
|
|
4107
|
+
}
|
|
4108
|
+
const r = ctx.webOutsideSwitch?.(req, on) ?? "not_here";
|
|
4109
|
+
json(res, r === "ok" ? 200 : r === "not_here" ? 403 : r === "unsaved" ? 503 : 409, r === "ok" ? { ok: true } : { error: r === "not_here" ? "outside_not_here" : r });
|
|
4110
|
+
})().catch(err => {
|
|
4111
|
+
ctx.logger.error({ err: err.message }, "Outside connections change failed");
|
|
4112
|
+
try {
|
|
4113
|
+
json(res, 500, { error: "outside_failed" });
|
|
4114
|
+
}
|
|
4115
|
+
catch { /* already answered */ }
|
|
4116
|
+
});
|
|
4117
|
+
return true;
|
|
4118
|
+
}
|
|
4119
|
+
// ── Refs #3061 (P2a): signing a new device in with its 8-character code (a web-only fleet) ──
|
|
4120
|
+
// GET /ui/devices: whether this is such a fleet and whether THIS session may approve (it is the verified owner — this
|
|
4121
|
+
// computer's admin here, or signed in from outside with the authenticator's code). POST /ui/devices/lookup {code}: the
|
|
4122
|
+
// request that code names, for the confirm screen; POST /ui/devices/approve {code} and /ui/devices/deny {code}. Every
|
|
4123
|
+
// one asks the live session again in the fleet (webDeviceLoginAct) and answers 403 `owner_required` to anyone else —
|
|
4124
|
+
// a guest, a LAN or device-approved session, the CLI's header token. Over the public link only for the owner who
|
|
4125
|
+
// signed in from outside. A decision hands the new device nothing: its session is made by its own next poll.
|
|
4126
|
+
if (method === "GET" && path === "/ui/devices") {
|
|
4127
|
+
res.setHeader("Cache-Control", "no-store");
|
|
4128
|
+
json(res, 200, ctx.webDevicesStatus?.(req) ?? { webOnly: false, owner: false, devices: [] });
|
|
4129
|
+
return true;
|
|
4130
|
+
}
|
|
4131
|
+
// Refs #3061 (P2b): POST /ui/devices/signout {handle} — the verified owner ends another signed-in device. The same
|
|
4132
|
+
// authority as approving one, asked of the live session in the fleet after the body is in (webDeviceSignOut answers
|
|
4133
|
+
// 403 `owner_required` to anyone else before it looks the handle up). Over the public link only for the owner signed in
|
|
4134
|
+
// from outside, like approving.
|
|
4135
|
+
if (method === "POST" && path === "/ui/devices/signout") {
|
|
4136
|
+
const act = ctx.webDeviceSignOut?.bind(ctx);
|
|
4137
|
+
if (!act) {
|
|
4138
|
+
json(res, 404, { error: "not_found" });
|
|
4139
|
+
return true;
|
|
4140
|
+
}
|
|
4141
|
+
(async () => {
|
|
4142
|
+
let body;
|
|
4143
|
+
try {
|
|
4144
|
+
body = await parseBody(req);
|
|
4145
|
+
}
|
|
4146
|
+
catch {
|
|
4147
|
+
json(res, 400, { error: "Invalid JSON" });
|
|
4148
|
+
return;
|
|
4149
|
+
}
|
|
4150
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
4151
|
+
return;
|
|
4152
|
+
const handle = body && typeof body === "object" ? body.handle : undefined;
|
|
4153
|
+
if (typeof handle !== "string" || !/^[0-9a-f]{16}$/.test(handle)) {
|
|
4154
|
+
json(res, 400, { error: "handle required" });
|
|
4155
|
+
return;
|
|
4156
|
+
}
|
|
4157
|
+
res.setHeader("Cache-Control", "no-store");
|
|
4158
|
+
const r = act(req, handle);
|
|
4159
|
+
json(res, r.status, r.body);
|
|
4160
|
+
})().catch(err => {
|
|
4161
|
+
ctx.logger.error({ err: err.message }, "Device sign-out failed");
|
|
4162
|
+
try {
|
|
4163
|
+
json(res, 500, { error: "devices_failed" });
|
|
4164
|
+
}
|
|
4165
|
+
catch { /* already answered */ }
|
|
4166
|
+
});
|
|
4167
|
+
return true;
|
|
4168
|
+
}
|
|
4169
|
+
// S-120 (D2a): POST /ui/public-link/close — 「立即關閉公開連結」 in Settings → 存取與安全 → 總覽. An admin session on this
|
|
4170
|
+
// fleet's own listener only: never over the public link itself (the gateway does not route it; refused here too), never
|
|
4171
|
+
// a guest, a read-only session or the CLI's header token. It only closes — nothing here opens a link — the way the chat
|
|
4172
|
+
// menu's 確定關閉 does (its remembered owner forgotten, so auto_open never reopens a deliberate close). A web-only fleet's
|
|
4173
|
+
// outside link is the owner's switch on this computer (#3008): 409 outside_link, left open.
|
|
4174
|
+
if (method === "POST" && path === "/ui/public-link/close") {
|
|
4175
|
+
if (gatewayRequestContext(req)) {
|
|
4176
|
+
json(res, 403, { error: "public_link_close_not_here" });
|
|
4177
|
+
return true;
|
|
4178
|
+
}
|
|
4179
|
+
const act = ctx.closePublicLinkFromWeb?.bind(ctx);
|
|
4180
|
+
if (!act) {
|
|
4181
|
+
json(res, 404, { error: "not_found" });
|
|
4182
|
+
return true;
|
|
4183
|
+
}
|
|
4184
|
+
(async () => {
|
|
4185
|
+
try {
|
|
4186
|
+
await parseBody(req);
|
|
4187
|
+
}
|
|
4188
|
+
catch {
|
|
4189
|
+
json(res, 400, { error: "Invalid JSON" });
|
|
4190
|
+
return;
|
|
4191
|
+
}
|
|
4192
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
4193
|
+
return;
|
|
4194
|
+
const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
4195
|
+
if (verdict.kind !== "allow") {
|
|
4196
|
+
json(res, 401, { error: WEB_TOKEN_INVALID_MESSAGE });
|
|
4197
|
+
return;
|
|
4198
|
+
}
|
|
4199
|
+
if (verdict.via !== "session" || verdict.session?.tier !== "admin") {
|
|
4200
|
+
json(res, 403, { error: "public_link_close_needs_an_admin_session" });
|
|
4201
|
+
return;
|
|
4202
|
+
}
|
|
4203
|
+
res.setHeader("Cache-Control", "no-store");
|
|
4204
|
+
const r = await act();
|
|
4205
|
+
json(res, r.status, r.body);
|
|
4206
|
+
})().catch(err => {
|
|
4207
|
+
ctx.logger.error({ err: err.message }, "Public link close failed");
|
|
4208
|
+
try {
|
|
4209
|
+
json(res, 500, { error: "public_link_close_failed" });
|
|
4210
|
+
}
|
|
4211
|
+
catch { /* already answered */ }
|
|
4212
|
+
});
|
|
4213
|
+
return true;
|
|
4214
|
+
}
|
|
4215
|
+
if (method === "POST" && (path === "/ui/devices/lookup" || path === "/ui/devices/approve" || path === "/ui/devices/deny")) {
|
|
4216
|
+
const act = ctx.webDeviceLoginAct?.bind(ctx);
|
|
4217
|
+
if (!act) {
|
|
4218
|
+
json(res, 404, { error: "not_found" });
|
|
4219
|
+
return true;
|
|
4220
|
+
}
|
|
4221
|
+
const op = path === "/ui/devices/lookup" ? "lookup" : path === "/ui/devices/approve" ? "approve" : "deny";
|
|
4222
|
+
(async () => {
|
|
4223
|
+
let body;
|
|
4224
|
+
try {
|
|
4225
|
+
body = await parseBody(req);
|
|
4226
|
+
}
|
|
4227
|
+
catch {
|
|
4228
|
+
json(res, 400, { error: "Invalid JSON" });
|
|
4229
|
+
return;
|
|
4230
|
+
}
|
|
4231
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
4232
|
+
return;
|
|
4233
|
+
const code = body && typeof body === "object" ? body.code : undefined;
|
|
4234
|
+
if (typeof code !== "string" || code.length > 32) {
|
|
4235
|
+
json(res, 400, { error: "code required" });
|
|
4236
|
+
return;
|
|
4237
|
+
}
|
|
4238
|
+
res.setHeader("Cache-Control", "no-store");
|
|
4239
|
+
const r = act(req, op, code);
|
|
4240
|
+
if (typeof r.body.retryAfterMs === "number")
|
|
4241
|
+
res.setHeader("Retry-After", String(Math.ceil(r.body.retryAfterMs / 1000)));
|
|
4242
|
+
json(res, r.status, r.body);
|
|
4243
|
+
})().catch(err => {
|
|
4244
|
+
ctx.logger.error({ err: err.message }, "New device approval failed");
|
|
4245
|
+
try {
|
|
4246
|
+
json(res, 500, { error: "devices_failed" });
|
|
4247
|
+
}
|
|
4248
|
+
catch { /* already answered */ }
|
|
4249
|
+
});
|
|
4250
|
+
return true;
|
|
4251
|
+
}
|
|
4252
|
+
// ── alpha.2 (M-2300): an agent's Windows request, decided by a web-only fleet's owner in Needs you ──
|
|
4253
|
+
// The list is the owner's only: anyone else (a guest, a LAN or public-link session, a chat fleet's admin) reads an
|
|
4254
|
+
// empty one, so nothing actionable ever reaches them. The stream's `agent_proposals` event carries nothing.
|
|
4255
|
+
if (method === "GET" && path === "/ui/agent-proposals") {
|
|
4256
|
+
const list = ctx.webAgentProposals?.(req) ?? null;
|
|
4257
|
+
json(res, 200, { owner: list !== null, proposals: list ?? [] });
|
|
4258
|
+
return true;
|
|
4259
|
+
}
|
|
4260
|
+
const proposalMatch = method === "POST" ? /^\/ui\/agent-proposals\/([0-9a-f]{32})$/.exec(path) : null;
|
|
4261
|
+
if (proposalMatch) {
|
|
4262
|
+
if (!ctx.webDecideAgentProposal) {
|
|
4263
|
+
json(res, 404, { error: "not_found" });
|
|
4264
|
+
return true;
|
|
4265
|
+
}
|
|
4266
|
+
const decide = ctx.webDecideAgentProposal.bind(ctx), id = proposalMatch[1];
|
|
4267
|
+
(async () => {
|
|
4268
|
+
let body;
|
|
4269
|
+
try {
|
|
4270
|
+
body = await parseBody(req);
|
|
4271
|
+
}
|
|
4272
|
+
catch {
|
|
4273
|
+
json(res, 400, { error: "Invalid JSON" });
|
|
4274
|
+
return;
|
|
4275
|
+
}
|
|
4276
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
4277
|
+
return;
|
|
4278
|
+
const decision = body && typeof body === "object" ? body.decision : undefined;
|
|
4279
|
+
if (decision !== "confirm" && decision !== "reject") {
|
|
4280
|
+
json(res, 400, { error: "decision must be confirm or reject" });
|
|
4281
|
+
return;
|
|
4282
|
+
}
|
|
4283
|
+
const r = await decide(req, id, decision);
|
|
4284
|
+
if (!res.headersSent && !res.destroyed)
|
|
4285
|
+
json(res, r.status, r.body);
|
|
4286
|
+
})().catch(err => {
|
|
4287
|
+
ctx.logger.error({ err: err.message }, "Agent request decision failed");
|
|
4288
|
+
try {
|
|
4289
|
+
json(res, 500, { error: "decide_failed" });
|
|
4290
|
+
}
|
|
4291
|
+
catch { /* already answered */ }
|
|
4292
|
+
});
|
|
4293
|
+
return true;
|
|
4294
|
+
}
|
|
3135
4295
|
if (method === "POST" && path === "/ui/needs/ack") {
|
|
3136
4296
|
if (!ctx.acknowledgeNeedsItem) {
|
|
3137
4297
|
json(res, 404, { error: "Nothing to acknowledge here" });
|
|
@@ -3257,6 +4417,20 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3257
4417
|
json(res, 400, { error: "instance and command required" });
|
|
3258
4418
|
return;
|
|
3259
4419
|
}
|
|
4420
|
+
if (isNativeExecInstance(ctx.fleetConfig?.instances[instance])) {
|
|
4421
|
+
json(res, 400, { error: "This runtime does not support CLI control commands; use Agent settings or Cancel" });
|
|
4422
|
+
return;
|
|
4423
|
+
}
|
|
4424
|
+
if (isNativePaneInstance(ctx.fleetConfig?.instances[instance])) {
|
|
4425
|
+
if (!nativeCliAuthorization(req, url, ctx)) {
|
|
4426
|
+
json(res, 403, { error: "Windows runtime requires an administrator on the local dashboard" });
|
|
4427
|
+
return;
|
|
4428
|
+
}
|
|
4429
|
+
if (command !== "model") {
|
|
4430
|
+
json(res, 400, { error: "This persistent Windows runtime supports the model command; use its shared controls for other actions" });
|
|
4431
|
+
return;
|
|
4432
|
+
}
|
|
4433
|
+
}
|
|
3260
4434
|
if (body.args !== undefined && str(body.args, MAX_COMMAND_ARGS) === undefined) {
|
|
3261
4435
|
json(res, 400, { error: "args too long" });
|
|
3262
4436
|
return;
|
|
@@ -3296,6 +4470,28 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3296
4470
|
guestCommandsRunning.add(account);
|
|
3297
4471
|
ctx.guestCommandRuns?.record(account);
|
|
3298
4472
|
}
|
|
4473
|
+
if (isNativePaneInstance(ctx.fleetConfig?.instances[instance]) && body.action) {
|
|
4474
|
+
if (command !== "model" || body.action !== "refresh" || body.args) {
|
|
4475
|
+
json(res, 400, { error: "invalid model action" });
|
|
4476
|
+
return;
|
|
4477
|
+
}
|
|
4478
|
+
const target = ctx.fleetConfig.instances[instance];
|
|
4479
|
+
try {
|
|
4480
|
+
const refreshed = await refreshNativeModelCatalog(req, url, ctx, { backend: target.backend, instance });
|
|
4481
|
+
if (!stillAuthorized(req, res, url, ctx))
|
|
4482
|
+
return;
|
|
4483
|
+
if (!refreshed || ctx.fleetConfig?.instances[instance] !== target || !nativeCliAuthorization(req, url, ctx)) {
|
|
4484
|
+
json(res, 409, { error: "model target changed" });
|
|
4485
|
+
return;
|
|
4486
|
+
}
|
|
4487
|
+
json(res, 200, { choices: { current: target.model ?? null, options: refreshed.models.map(m => ({ id: m.id, label: m.label })), actions: ["refresh"] } });
|
|
4488
|
+
}
|
|
4489
|
+
catch {
|
|
4490
|
+
if (stillAuthorized(req, res, url, ctx))
|
|
4491
|
+
json(res, 503, { error: t("model.refresh_failed") });
|
|
4492
|
+
}
|
|
4493
|
+
return;
|
|
4494
|
+
}
|
|
3299
4495
|
try {
|
|
3300
4496
|
const { authority } = confirmAfterBody(arrival, webAuthorityOf(req, url, ctx, instance));
|
|
3301
4497
|
const r = await run({ instance, command, args: str(body.args, MAX_COMMAND_ARGS), confirm: body.confirm, ...(body.action ? { action: body.action } : {}) }, { publicLink: !!gatewayRequestContext(req), person, authority, ...(guest ? { guest: true } : {}) });
|
|
@@ -3531,11 +4727,26 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3531
4727
|
const body = await parseBody(req);
|
|
3532
4728
|
if (!permitWebContinuation(req, res, ctx))
|
|
3533
4729
|
return;
|
|
4730
|
+
if (body?.runtime === "windows") {
|
|
4731
|
+
await createNativeInstance(req, res, url, ctx, body);
|
|
4732
|
+
return;
|
|
4733
|
+
}
|
|
3534
4734
|
const v = validateArgs(CreateInstanceArgs, body, "create_instance");
|
|
3535
4735
|
if (!v.ok) {
|
|
3536
4736
|
json(res, 400, { error: v.error });
|
|
3537
4737
|
return;
|
|
3538
4738
|
}
|
|
4739
|
+
// The account the form picked for this host's CLI: checked here, before anything is created, and written as the
|
|
4740
|
+
// agent's own backend_options.<cli>.credential_profile so its first start already runs under it.
|
|
4741
|
+
const account = resolveCreateAccount(ctx.dataDir, v.data, ctx.fleetConfig?.defaults?.backend);
|
|
4742
|
+
if (!account.ok) {
|
|
4743
|
+
const { ok: _ok, status, ...rest } = account;
|
|
4744
|
+
json(res, status, rest);
|
|
4745
|
+
return;
|
|
4746
|
+
}
|
|
4747
|
+
delete v.data.credentialProfile;
|
|
4748
|
+
if (account.backendOptions)
|
|
4749
|
+
v.data.backend_options = account.backendOptions;
|
|
3539
4750
|
let result = null;
|
|
3540
4751
|
let error;
|
|
3541
4752
|
const respond = (r, e) => { result = r; error = e; };
|
|
@@ -4295,15 +5506,18 @@ function uploadRecipient(ctx, name) {
|
|
|
4295
5506
|
/** Closed, path-free explanations; arbitrary launch errors stay in the host log. */
|
|
4296
5507
|
function webDeliveryFailure(err) {
|
|
4297
5508
|
const message = err instanceof Error ? err.message : "";
|
|
5509
|
+
// M-2297: the per-PC agent limit — say so, with the agents holding its slots (names only: no path, no id).
|
|
5510
|
+
if (err instanceof MachineSlotLimitError)
|
|
5511
|
+
return { reason: "machine_limit", error: message, limit: err.limit, holders: err.holders.map(h => ({ name: h.name, unknown: h.unknown })) };
|
|
4298
5512
|
if (/No warm slot is free/.test(message))
|
|
4299
5513
|
return { reason: "wake_capacity", error: "No slot is free to wake this instance. Retry when another instance is idle." };
|
|
4300
5514
|
if (/login|log in|sign in|\bauth(?:entication|orization)?\b|credential|api.?key/i.test(message))
|
|
4301
|
-
return { reason: "wake_credentials", error: "The instance could not sign in.
|
|
5515
|
+
return { reason: "wake_credentials", error: "The instance could not sign in. Connect its AI account in Settings → Agents → AI accounts and API keys → Accounts, or send /login in chat, then retry." };
|
|
4302
5516
|
if (/timed? out|timeout/i.test(message))
|
|
4303
|
-
return { reason: "wake_timeout", error: "The instance did not become ready in time. Retry, or check its status
|
|
5517
|
+
return { reason: "wake_timeout", error: "The instance did not become ready in time. Retry, or check its status in Fleet." };
|
|
4304
5518
|
if (/Cannot wake stopped|no longer configured/.test(message))
|
|
4305
|
-
return { reason: "instance_stopped", error: "This instance was stopped or removed. Start it
|
|
4306
|
-
return { reason: "delivery_unavailable", error: "The instance could not receive this message. Check its status
|
|
5519
|
+
return { reason: "instance_stopped", error: "This instance was stopped or removed. Start it from the agent's chat menu → Start instance, then retry." };
|
|
5520
|
+
return { reason: "delivery_unavailable", error: "The instance could not receive this message. Check its status in Fleet, then retry." };
|
|
4307
5521
|
}
|
|
4308
5522
|
/** Handle POST /ui/send — extracted for readability. */
|
|
4309
5523
|
/** Each web server's own memory of the sends it accepted by clientId (web-send-dedupe.ts). */
|
|
@@ -4342,6 +5556,15 @@ function handleSendMessage(req, res, ctx) {
|
|
|
4342
5556
|
return;
|
|
4343
5557
|
}
|
|
4344
5558
|
const { instance, message: typed, attachments = [], replyTo, clientId } = parsed.data;
|
|
5559
|
+
const native = isWindowsInstance(ctx.fleetConfig?.instances[instance]);
|
|
5560
|
+
if (native && !nativeCliAuthorization(req, new URL(req.url ?? "/", "http://localhost"), ctx)) {
|
|
5561
|
+
json(res, 403, { error: "Windows runtime requires an administrator on the local dashboard" });
|
|
5562
|
+
return;
|
|
5563
|
+
}
|
|
5564
|
+
if (native && attachments.length) {
|
|
5565
|
+
json(res, 400, { error: "Attachments are not supported by this runtime yet" });
|
|
5566
|
+
return;
|
|
5567
|
+
}
|
|
4345
5568
|
// #1920 step 2b: a guest writes only to an in-scope instance, while guests may chat, and never a command.
|
|
4346
5569
|
const guest = guestRequestOf(req);
|
|
4347
5570
|
const refused = guestChatRefusal(guest, instance);
|
|
@@ -4395,6 +5618,16 @@ function handleSendMessage(req, res, ctx) {
|
|
|
4395
5618
|
break;
|
|
4396
5619
|
}
|
|
4397
5620
|
}
|
|
5621
|
+
const locationHold = ctx.generalLocationDeliveryHold?.(instance);
|
|
5622
|
+
if (locationHold) {
|
|
5623
|
+
const messageId = newWebMessageId(), ts = new Date().toISOString();
|
|
5624
|
+
// Settle this client ID as answered. A Retry after reconnect must never queue its old input.
|
|
5625
|
+
acceptedId = messageId;
|
|
5626
|
+
ctx.emitSseEvent("message", { instance, sender: person.name, role: "user", text: typed, ts, messageId, ...(person.bound ? { from: person.voterKey } : {}), ...(clientId ? { clientId } : {}) });
|
|
5627
|
+
ctx.emitSseEvent("message", { instance, role: "status", sender: "AgEnD", text: locationHold, ts, messageId: newWebMessageId() });
|
|
5628
|
+
json(res, 200, { sent: true, messageId, serviceResponse: true });
|
|
5629
|
+
return;
|
|
5630
|
+
}
|
|
4398
5631
|
let files = [];
|
|
4399
5632
|
if (attachments.length > 0) {
|
|
4400
5633
|
const taken = ctx.webFiles?.takeForMessage(instance, attachments);
|
|
@@ -4417,15 +5650,39 @@ function handleSendMessage(req, res, ctx) {
|
|
|
4417
5650
|
// Recheck the same admission all the way through a wake, before the facade's actual IPC handoff.
|
|
4418
5651
|
const requestUrl = new URL(req.url ?? "/", "http://localhost");
|
|
4419
5652
|
const admission = admissionOf(req, requestUrl, ctx);
|
|
4420
|
-
|
|
5653
|
+
// The sender's authority, without the request's own lifetime: the same admission, the same guest still allowed, the
|
|
5654
|
+
// instance still registered (a Windows one still Windows). A Windows turn is journaled before /ui/send answers and its
|
|
5655
|
+
// process starts after, so the bridge rechecks this one (a revoke in between still stops it); never res, which a
|
|
5656
|
+
// finished response marks destroyed (S-30: every web-chat turn to a Windows agent was refused).
|
|
5657
|
+
const authorityCurrent = () => admission !== null && admissionOf(req, requestUrl, ctx) === admission
|
|
4421
5658
|
&& (!guest || (guest.current() && !guestChatRefusal(guest, instance)))
|
|
4422
|
-
&& (
|
|
5659
|
+
&& (native ? isWindowsInstance(ctx.fleetConfig?.instances[instance]) && nativeCliAuthorization(req, requestUrl, ctx)
|
|
5660
|
+
: registered ? registeredChatInstance(ctx, instance) : ctx.instanceIpcClients.has(instance));
|
|
5661
|
+
const stillCurrent = () => !res.destroyed && authorityCurrent();
|
|
4423
5662
|
const message = typed;
|
|
4424
5663
|
// #1939 S1: what the receipt records about who authorized it (observe only: agents still read web as recognition).
|
|
4425
5664
|
const { authority } = confirmAfterBody(arrival, webAuthorityOf(req, new URL(req.url ?? "/", "http://localhost"), ctx, instance));
|
|
4426
5665
|
const ts = new Date().toISOString();
|
|
4427
5666
|
// The id the agent is given, and the one its delivery reports come back under: the page's ticks.
|
|
4428
|
-
const
|
|
5667
|
+
const nativeRequestId = isNativeExecInstance(ctx.fleetConfig?.instances[instance]) ? (() => {
|
|
5668
|
+
if (!clientId)
|
|
5669
|
+
return randomUUID();
|
|
5670
|
+
const hash = createHash("sha256").update(`agend-native-web\0${WebSendDedupe.key(person.key, instance, clientId)}`).digest("hex");
|
|
5671
|
+
return `${hash.slice(0, 8)}-${hash.slice(8, 12)}-4${hash.slice(13, 16)}-8${hash.slice(17, 20)}-${hash.slice(20, 32)}`;
|
|
5672
|
+
})() : undefined;
|
|
5673
|
+
const messageId = nativeRequestId ? `native:${nativeRequestId}:user` : newWebMessageId();
|
|
5674
|
+
if (nativeRequestId && ctx.nativeInstanceRuntime) {
|
|
5675
|
+
const previous = ctx.nativeInstanceRuntime().get(instance)?.turns.find(turn => turn.id === nativeRequestId);
|
|
5676
|
+
if (previous) {
|
|
5677
|
+
if (previous.prompt !== delivery.text) {
|
|
5678
|
+
json(res, 409, { error: "clientId belongs to a different message" });
|
|
5679
|
+
return;
|
|
5680
|
+
}
|
|
5681
|
+
acceptedId = messageId;
|
|
5682
|
+
json(res, 200, { sent: true, messageId, repeated: true });
|
|
5683
|
+
return;
|
|
5684
|
+
}
|
|
5685
|
+
}
|
|
4429
5686
|
// Use real Telegram context so daemon's lastChatId/lastThreadId are set,
|
|
4430
5687
|
// enabling reply tool even when first message comes from Web UI.
|
|
4431
5688
|
// Pure Web UI mode (no channel config) leaves these empty; the agent's reply then comes back to the
|
|
@@ -4471,11 +5728,12 @@ function handleSendMessage(req, res, ctx) {
|
|
|
4471
5728
|
let delivered;
|
|
4472
5729
|
try {
|
|
4473
5730
|
const deliver = (name, payload) => ctx.deliverHumanToInstance
|
|
4474
|
-
? ctx.deliverHumanToInstance(name, payload, webHumanOrigin(false, authority), typed, { stillCurrent })
|
|
4475
|
-
: ctx.deliverToInstance(name, payload, { stillCurrent });
|
|
5731
|
+
? ctx.deliverHumanToInstance(name, payload, webHumanOrigin(false, authority), typed, { stillCurrent, ...(native ? { authorityCurrent } : {}) })
|
|
5732
|
+
: ctx.deliverToInstance(name, payload, { stillCurrent, ...(native ? { authorityCurrent } : {}) });
|
|
4476
5733
|
delivered = await deliver(instance, {
|
|
4477
5734
|
type: "fleet_inbound",
|
|
4478
5735
|
content: delivery.text,
|
|
5736
|
+
...(nativeRequestId ? { requestId: nativeRequestId } : {}),
|
|
4479
5737
|
targetSession: instance,
|
|
4480
5738
|
meta: {
|
|
4481
5739
|
chat_id: groupId ? String(groupId) : "",
|
|
@@ -4872,6 +6130,45 @@ function shellHtmlTag(ctx, mode, viewer) {
|
|
|
4872
6130
|
function shellOwnerCss(ctx, mode, viewer) {
|
|
4873
6131
|
return mode === "full" && !viewer?.guest && viewer?.person !== null && viewer?.person !== undefined && ctx.ownerCss ? ctx.ownerCss.active(viewer.person) : null;
|
|
4874
6132
|
}
|
|
6133
|
+
/**
|
|
6134
|
+
* AgEnD Hub P1 (docs/design/hub.md, docs/design/hub-ui-client.md): the page's Hub mark — presentation only, never
|
|
6135
|
+
* authority, set by the listener that serves the page (never a client's choice): `member` on this fleet's listener when
|
|
6136
|
+
* `hub_member.enabled`, never over the public link. `hub` is only the Hub listener's own workspace page
|
|
6137
|
+
* (serveHubWorkspaceShell). Nothing otherwise: no Hub UI is drawn and no Hub module loads.
|
|
6138
|
+
*/
|
|
6139
|
+
function hubBodyAttrs(req, ctx) {
|
|
6140
|
+
// alpha.6 user report: the mark read the parsed FleetConfig, which never has `hub_member` — a saved switch (or one in the
|
|
6141
|
+
// file at start) never marked the page, so Connect to a Hub never loaded. It reads what the runtime reads: the raw file.
|
|
6142
|
+
let config = null;
|
|
6143
|
+
try {
|
|
6144
|
+
config = (ctx.getRawFleetConfig?.() ?? null);
|
|
6145
|
+
}
|
|
6146
|
+
catch {
|
|
6147
|
+
config = null;
|
|
6148
|
+
}
|
|
6149
|
+
// hub.md §1: member handlers are local-owner-only and unavailable through the public gateway — no member mark there.
|
|
6150
|
+
const member = hubModeOf(config).member && !gatewayRequestContext(req) ? ' data-hub="member"' : "";
|
|
6151
|
+
// #3298 S-89 (leader, #3372 N2): Settings → Hub's Group permissions row only when this fleet's own Hub has them composed —
|
|
6152
|
+
// learned in this process, never by reading a Hub session across origins. Never over the public link.
|
|
6153
|
+
let groups = false;
|
|
6154
|
+
try {
|
|
6155
|
+
groups = ctx.hubGroupPermissions?.() === true;
|
|
6156
|
+
}
|
|
6157
|
+
catch {
|
|
6158
|
+
groups = false;
|
|
6159
|
+
}
|
|
6160
|
+
let setup = false;
|
|
6161
|
+
try {
|
|
6162
|
+
setup = !!ctx.hubSetupSession?.(req);
|
|
6163
|
+
}
|
|
6164
|
+
catch { /* unavailable authority never offers setup */ }
|
|
6165
|
+
return member + (groups && !gatewayRequestContext(req) ? ' data-hub-groups="1"' : "")
|
|
6166
|
+
+ (setup && !gatewayRequestContext(req) ? ' data-hub-setup="1"' : "")
|
|
6167
|
+
+ (setup && !gatewayRequestContext(req) && typeof ctx.hubDirectorySettings === "function"
|
|
6168
|
+
&& !!config?.hub?.hubId ? ' data-hub-directory-settings="1"' : "")
|
|
6169
|
+
+ (setup && !gatewayRequestContext(req) && typeof ctx.hubDirectoryNotices === "function"
|
|
6170
|
+
&& !!config?.hub?.hubId ? ' data-hub-directory-notices="1"' : "");
|
|
6171
|
+
}
|
|
4875
6172
|
function guestBodyAttrs(ctx, owner, attr) {
|
|
4876
6173
|
const badge = ctx.guestBadge?.(owner);
|
|
4877
6174
|
const trusted = ctx.guestTrusted?.(owner) ? ' data-guest-level="trusted"' : "";
|
|
@@ -4890,7 +6187,11 @@ function shellBodyTag(req, ctx, mode, viewer) {
|
|
|
4890
6187
|
const admission = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
4891
6188
|
const childMark = mode === "full" && !gatewayRequestContext(req) && !viewer?.guest && admission.kind === "allow"
|
|
4892
6189
|
&& (admission.via !== "session" || admission.session.tier === "admin");
|
|
4893
|
-
|
|
6190
|
+
// #3637: display-only capability and a non-authorizing namespace. No account/session/token value reaches storage.
|
|
6191
|
+
const workspaceMark = mode === "full" && !gatewayRequestContext(req) && !viewer?.guest && admission.kind === "allow";
|
|
6192
|
+
const workspaceScope = workspaceMark && viewer?.person && ctx.webToken
|
|
6193
|
+
? createHmac("sha256", ctx.webToken).update(`agend-chat-layout-v1\0${viewer.person}`).digest("hex") : null;
|
|
6194
|
+
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)}"`
|
|
4894
6195
|
+ ` data-preview-boot="${attr(p?.previewOrigin ? p.boot : "")}" data-preview-reason="${attr(p ? p.reason : "Previews are not available on this fleet.")}"`
|
|
4895
6196
|
// #1554: no availability asked (the public link, or not the full app) still says why, in the page's language.
|
|
4896
6197
|
+ ` data-preview-reason-code="${attr(p ? p.code ?? "" : gatewayRequestContext(req) ? "publicLink" : "notOffered")}"`
|
|
@@ -4900,6 +6201,13 @@ function shellBodyTag(req, ctx, mode, viewer) {
|
|
|
4900
6201
|
+ ` data-usage-panel="${ctx.fleetConfig?.web?.usage_panel === false ? "0" : "1"}"` // #2855: guests' too
|
|
4901
6202
|
// #1218: whether the Log tab is on (web.log_tab; off by default): the tab says so and offers to turn it on.
|
|
4902
6203
|
+ ` data-log-tab="${ctx.fleetConfig?.web?.log_tab === true ? "1" : "0"}"`
|
|
6204
|
+
// AGEND-181: whether thinking may be asked for (web.log_thinking; OFF by default, AGEND-197). The server answers
|
|
6205
|
+
// `thinking: true` only to an admin session on the local dashboard (GET /ui/steps), whatever this says.
|
|
6206
|
+
+ ` data-log-thinking="${ctx.fleetConfig?.web?.log_thinking === true ? "1" : "0"}"`
|
|
6207
|
+
// AGEND-197: whether this page may ask for the chat's activity block at all — an admin session on the local dashboard
|
|
6208
|
+
// only (a guest, the public link and a read-only session are never offered it, and the server refuses them anyway).
|
|
6209
|
+
// Each agent's own tool_progress decides whether there is anything to show (the answer's `level`).
|
|
6210
|
+
+ ` data-chat-activity="${childMark ? "1" : "0"}"`
|
|
4903
6211
|
// #1937: the upload limits in force for this page (the config's; the public link's own cap on it) — what the chat
|
|
4904
6212
|
// checks before sending a file, and the numbers its words say. The server checks again on every upload.
|
|
4905
6213
|
+ ` data-upload-limits="${attr(JSON.stringify(uploadLimits(ctx.fleetConfig?.web, { publicLink: gatewayRequestContext(req) !== undefined })))}"`
|
|
@@ -4911,12 +6219,47 @@ function shellBodyTag(req, ctx, mode, viewer) {
|
|
|
4911
6219
|
+ `${gatewayRequestContext(req) ? ' data-public-link="1"' : ""}`
|
|
4912
6220
|
// #2478: search is offered over the public link unless web.search.public_link is false (the page then shows no entry).
|
|
4913
6221
|
+ `${gatewayRequestContext(req) && ctx.fleetConfig?.web?.search?.public_link === false ? ' data-search-link="0"' : ""}`
|
|
6222
|
+
// 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.
|
|
6223
|
+
+ `${mode === "full" && !viewer?.guest ? hubBodyAttrs(req, ctx) : ""}`
|
|
4914
6224
|
// #1920 phase 3: a guest's page — the shell shows only what a guest may use, and who it is signed in as.
|
|
4915
6225
|
+ `${mode === "full" && viewer?.guest && viewer.owner ? guestBodyAttrs(ctx, viewer.owner, attr) : ""}>`;
|
|
4916
6226
|
}
|
|
6227
|
+
/**
|
|
6228
|
+
* AgEnD Hub P1, slice 3: the app shell as a Hub's own workspace (served only by the Hub's listener, at its own origin).
|
|
6229
|
+
* It boots Hub-only (app.js: no fleet stream, chat, Needs you, preferences or themes). Nothing of the request is read
|
|
6230
|
+
* — no cookie (the fleet's or the Hub's), no session, no Host: who is signed in is the page's own /hub/v1/session.
|
|
6231
|
+
*/
|
|
6232
|
+
export const HUB_SHELL_DROPS = '<script src="/assets/agend-auth.js"></script>';
|
|
6233
|
+
export function serveHubWorkspaceShell(res, hub) {
|
|
6234
|
+
try {
|
|
6235
|
+
// Without the fleet's fetch wrapper (agend-auth.js): it reads the fleet's /auth/session for a CSRF value and answers
|
|
6236
|
+
// a 401 with the fleet's "session ended" banner. The Hub's pages carry the Hub's own CSRF (hub-client.js).
|
|
6237
|
+
const html = readFileSync(join(__dirname, "ui", "app.html"), "utf-8").replace(HUB_SHELL_DROPS, "");
|
|
6238
|
+
const attr = (v) => v.replace(/[&<>"']/g, c => `&#${c.charCodeAt(0)};`);
|
|
6239
|
+
const name = hubNameOf(hub.name);
|
|
6240
|
+
const preview = hub.preview;
|
|
6241
|
+
const previewAttrs = preview ? ` data-dashboard-origin="${attr(preview.dashboardOrigin)}"`
|
|
6242
|
+
+ (preview.previewOrigin && preview.bootId ? ` data-preview-origin="${attr(preview.previewOrigin)}" data-preview-boot="${attr(preview.bootId)}"`
|
|
6243
|
+
: ` data-preview-reason-code="${attr(preview.reasonCode ?? "notOffered")}" data-preview-reason="${attr(preview.reason ?? "")}"`) : "";
|
|
6244
|
+
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}>`;
|
|
6245
|
+
sendPanelHtml(res, withAppIconLinks(html).replace("<body>", body), 200, { "Cache-Control": "no-store" }, { mediaSrc: "'none'", ...(preview?.previewOrigin ? { frameSrc: `${preview.previewOrigin}/frame` } : {}) });
|
|
6246
|
+
}
|
|
6247
|
+
catch {
|
|
6248
|
+
json(res, 500, { error: "app.html not found" });
|
|
6249
|
+
}
|
|
6250
|
+
}
|
|
4917
6251
|
/** The app shell page for one entry, under the panels' CSP; it may frame exactly <preview origin>/frame, and only
|
|
4918
6252
|
* when this load chose one. */
|
|
4919
|
-
|
|
6253
|
+
/**
|
|
6254
|
+
* The app shell page. `opts.hubWorkspace`: the page is a Hub's own workspace (slice 1's Hub listener only — the fleet's
|
|
6255
|
+
* listener never passes it), so it is drawn as the Hub shell.
|
|
6256
|
+
*/
|
|
6257
|
+
export function serveAppShell(req, res, ctx, mode, opts = {}) {
|
|
6258
|
+
// A Hub workspace is drawn from nothing of this fleet's: no fleet cookie, session, preference or preview is read.
|
|
6259
|
+
if (opts.hubWorkspace) {
|
|
6260
|
+
serveHubWorkspaceShell(res, opts.hubWorkspace);
|
|
6261
|
+
return;
|
|
6262
|
+
}
|
|
4920
6263
|
try {
|
|
4921
6264
|
const html = readFileSync(join(__dirname, "ui", "app.html"), "utf-8");
|
|
4922
6265
|
const viewer = mode === "full" ? prefsViewer(req, new URL(req.url ?? "/", "http://localhost"), ctx) : null;
|