@songsid/agend 2.3.5-alpha.4 → 2.3.5-alpha.5
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/THIRD_PARTY_NOTICES.md +52 -0
- package/dist/accounts-view.d.ts +97 -0
- package/dist/accounts-view.js +116 -0
- package/dist/accounts-view.js.map +1 -0
- package/dist/agent-cli-instructions.md +1 -1
- package/dist/agent-credentials.d.ts +24 -0
- package/dist/agent-credentials.js +66 -0
- package/dist/agent-credentials.js.map +1 -0
- package/dist/agent-endpoint.d.ts +3 -1
- package/dist/agent-endpoint.js +13 -0
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/agent-file-read.js +1 -1
- package/dist/agent-file-read.js.map +1 -1
- package/dist/agent-runtime-change.d.ts +3 -1
- package/dist/agent-runtime-change.js +15 -3
- package/dist/agent-runtime-change.js.map +1 -1
- package/dist/agent-workspace.d.ts +93 -0
- package/dist/agent-workspace.js +353 -0
- package/dist/agent-workspace.js.map +1 -0
- package/dist/auth-api.d.ts +27 -0
- package/dist/auth-api.js +164 -3
- package/dist/auth-api.js.map +1 -1
- package/dist/authority/session-authorizations.d.ts +28 -4
- package/dist/authority/session-authorizations.js +63 -17
- package/dist/authority/session-authorizations.js.map +1 -1
- package/dist/backend/antigravity.js +3 -1
- package/dist/backend/antigravity.js.map +1 -1
- 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-metadata.d.ts +14 -0
- package/dist/backend/codex-metadata.js +45 -0
- package/dist/backend/codex-metadata.js.map +1 -1
- package/dist/backend/codex-quota-history.d.ts +7 -0
- package/dist/backend/codex-quota-history.js +57 -0
- package/dist/backend/codex-quota-history.js.map +1 -0
- package/dist/backend/codex-session-lookup.d.ts +6 -0
- package/dist/backend/codex-session-lookup.js +1 -1
- package/dist/backend/codex-session-lookup.js.map +1 -1
- package/dist/backend/codex-speed.d.ts +14 -0
- package/dist/backend/codex-speed.js +35 -0
- package/dist/backend/codex-speed.js.map +1 -0
- package/dist/backend/codex.d.ts +7 -0
- package/dist/backend/codex.js +78 -15
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/grok-weekly-reset.d.ts +24 -0
- package/dist/backend/grok-weekly-reset.js +95 -0
- package/dist/backend/grok-weekly-reset.js.map +1 -0
- package/dist/backend/grok.d.ts +30 -1
- package/dist/backend/grok.js +301 -54
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/kiro.d.ts +3 -0
- package/dist/backend/kiro.js +50 -2
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/muse.js +5 -3
- package/dist/backend/muse.js.map +1 -1
- package/dist/backend/native-pane.d.ts +3 -1
- package/dist/backend/native-pane.js +2 -2
- package/dist/backend/native-pane.js.map +1 -1
- package/dist/backend/types.d.ts +13 -1
- package/dist/backend/types.js +3 -0
- package/dist/backend/types.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/cache-ledger.d.ts +95 -0
- package/dist/cache-ledger.js +276 -4
- package/dist/cache-ledger.js.map +1 -1
- package/dist/cache-service.d.ts +5 -0
- package/dist/cache-service.js +16 -4
- package/dist/cache-service.js.map +1 -1
- package/dist/channel/adapters/discord.js +11 -3
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/adapters/telegram.d.ts +51 -0
- package/dist/channel/adapters/telegram.js +235 -17
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/mcp-tools.js +3 -3
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/channel/types.d.ts +2 -0
- package/dist/claude-auth-status.d.ts +48 -0
- package/dist/claude-auth-status.js +149 -0
- package/dist/claude-auth-status.js.map +1 -0
- package/dist/cli.js +138 -37
- package/dist/cli.js.map +1 -1
- package/dist/config-validator.js +21 -1
- package/dist/config-validator.js.map +1 -1
- package/dist/cross-instance-notice.d.ts +10 -0
- package/dist/cross-instance-notice.js +67 -5
- package/dist/cross-instance-notice.js.map +1 -1
- package/dist/daemon.d.ts +70 -1
- package/dist/daemon.js +547 -25
- package/dist/daemon.js.map +1 -1
- package/dist/dashboard-permissions.d.ts +8 -0
- package/dist/dashboard-permissions.js +16 -0
- package/dist/dashboard-permissions.js.map +1 -1
- package/dist/delivery-consumed-watch.d.ts +23 -1
- package/dist/delivery-consumed-watch.js +30 -3
- package/dist/delivery-consumed-watch.js.map +1 -1
- package/dist/delivery-reconciliation.d.ts +1 -1
- package/dist/delivery-reconciliation.js +1 -1
- package/dist/delivery-reconciliation.js.map +1 -1
- package/dist/doctor.js +20 -9
- package/dist/doctor.js.map +1 -1
- package/dist/export-import.d.ts +7 -0
- package/dist/export-import.js +44 -10
- package/dist/export-import.js.map +1 -1
- package/dist/fleet-context.d.ts +2 -0
- package/dist/fleet-manager.d.ts +359 -7
- package/dist/fleet-manager.js +1365 -90
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-windows-runtime.d.ts +2 -1
- package/dist/fleet-windows-runtime.js +25 -7
- package/dist/fleet-windows-runtime.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +425 -0
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +5 -2
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +1 -0
- package/dist/general-knowledge/skills/fleet-health/SKILL.md +2 -2
- package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +3 -1
- package/dist/general-knowledge/skills/kiro-engine-migration/SKILL.md +41 -4
- 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 +31 -15
- package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +1 -1
- package/dist/general-role.d.ts +1 -1
- package/dist/general-role.js +1 -0
- package/dist/general-role.js.map +1 -1
- package/dist/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 +344 -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 +346 -0
- package/dist/hub/buttons.js.map +1 -0
- package/dist/hub/catalog.d.ts +74 -0
- package/dist/hub/catalog.js +195 -0
- package/dist/hub/catalog.js.map +1 -0
- package/dist/hub/client.d.ts +69 -0
- package/dist/hub/client.js +300 -0
- package/dist/hub/client.js.map +1 -0
- package/dist/hub/compose/member.d.ts +139 -0
- package/dist/hub/compose/member.js +450 -0
- package/dist/hub/compose/member.js.map +1 -0
- package/dist/hub/compose/server.d.ts +77 -0
- package/dist/hub/compose/server.js +349 -0
- package/dist/hub/compose/server.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 +56 -0
- package/dist/hub/db.js +188 -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 +18 -0
- package/dist/hub/directory/directory.js +320 -0
- package/dist/hub/directory/directory.js.map +1 -0
- package/dist/hub/directory/index.d.ts +7 -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 +71 -0
- package/dist/hub/directory/types.js +14 -0
- package/dist/hub/directory/types.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/http/compose.d.ts +20 -0
- package/dist/hub/http/compose.js +518 -0
- package/dist/hub/http/compose.js.map +1 -0
- package/dist/hub/http/core.d.ts +49 -0
- package/dist/hub/http/core.js +124 -0
- package/dist/hub/http/core.js.map +1 -0
- package/dist/hub/http/deps.d.ts +61 -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 +80 -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 +9 -0
- package/dist/hub/init/browser-certificate.js +78 -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 +222 -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 +24 -0
- package/dist/hub/init/initializer.js +385 -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 +18 -0
- package/dist/hub/init/network.js +104 -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 +47 -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 +110 -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 +127 -0
- package/dist/hub/init/text.js +247 -0
- package/dist/hub/init/text.js.map +1 -0
- package/dist/hub/init/types.d.ts +114 -0
- package/dist/hub/init/types.js +9 -0
- package/dist/hub/init/types.js.map +1 -0
- package/dist/hub/init/wizard.d.ts +34 -0
- package/dist/hub/init/wizard.js +554 -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/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 +87 -0
- package/dist/hub/member/exposure-api.js +64 -0
- package/dist/hub/member/exposure-api.js.map +1 -0
- package/dist/hub/member/exposures.d.ts +123 -0
- package/dist/hub/member/exposures.js +282 -0
- package/dist/hub/member/exposures.js.map +1 -0
- package/dist/hub/member/pairing-api.d.ts +85 -0
- package/dist/hub/member/pairing-api.js +385 -0
- package/dist/hub/member/pairing-api.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 +39 -0
- package/dist/hub/mount.js +123 -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.d.ts +65 -0
- package/dist/hub/pairing.js +211 -0
- package/dist/hub/pairing.js.map +1 -0
- package/dist/hub/policy.d.ts +63 -0
- package/dist/hub/policy.js +147 -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 +779 -0
- package/dist/hub/protocol.js +93 -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/rooms.d.ts +120 -0
- package/dist/hub/rooms.js +535 -0
- package/dist/hub/rooms.js.map +1 -0
- package/dist/hub/runtime.d.ts +106 -0
- package/dist/hub/runtime.js +298 -0
- package/dist/hub/runtime.js.map +1 -0
- package/dist/hub/server.d.ts +56 -0
- package/dist/hub/server.js +202 -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/sessions.d.ts +53 -0
- package/dist/hub/sessions.js +196 -0
- package/dist/hub/sessions.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 +77 -0
- package/dist/hub/store.js +88 -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 +401 -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-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 +48 -0
- package/dist/hub-pairing-summary.js +36 -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/instance-config-impact.js +3 -0
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +17 -2
- package/dist/instance-lifecycle.js +58 -8
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instance-topic-delete.d.ts +77 -0
- package/dist/instance-topic-delete.js +123 -0
- package/dist/instance-topic-delete.js.map +1 -0
- package/dist/instructions.d.ts +1 -1
- package/dist/instructions.js +1 -1
- package/dist/instructions.js.map +1 -1
- package/dist/kiro-engine-status.d.ts +11 -0
- package/dist/kiro-engine-status.js +6 -0
- package/dist/kiro-engine-status.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/locale.js +125 -3
- package/dist/locale.js.map +1 -1
- package/dist/log-service.d.ts +28 -0
- package/dist/log-service.js +29 -0
- package/dist/log-service.js.map +1 -1
- package/dist/log-steps.d.ts +4 -3
- package/dist/log-steps.js +32 -7
- package/dist/log-steps.js.map +1 -1
- package/dist/logger.d.ts +16 -2
- package/dist/logger.js +346 -66
- package/dist/logger.js.map +1 -1
- package/dist/login-flows.d.ts +15 -7
- package/dist/login-flows.js +29 -3
- package/dist/login-flows.js.map +1 -1
- package/dist/login-manager.js +25 -4
- package/dist/login-manager.js.map +1 -1
- package/dist/ls-rows.js +3 -4
- package/dist/ls-rows.js.map +1 -1
- package/dist/missed-offline.d.ts +25 -0
- package/dist/missed-offline.js +79 -0
- package/dist/missed-offline.js.map +1 -0
- package/dist/native-instance-api.d.ts +0 -1
- package/dist/native-instance-api.js +15 -3
- package/dist/native-instance-api.js.map +1 -1
- package/dist/native-instance-input.d.ts +3 -0
- package/dist/native-instance-input.js +6 -1
- package/dist/native-instance-input.js.map +1 -1
- package/dist/native-instance-registry.d.ts +6 -0
- package/dist/native-instance-registry.js +24 -0
- package/dist/native-instance-registry.js.map +1 -1
- package/dist/native-mcp.d.ts +3 -0
- package/dist/native-mcp.js +15 -2
- package/dist/native-mcp.js.map +1 -1
- package/dist/native-pane-lifecycle.d.ts +8 -0
- package/dist/native-pane-lifecycle.js +13 -4
- package/dist/native-pane-lifecycle.js.map +1 -1
- package/dist/native-pane-manager.js +17 -9
- package/dist/native-pane-manager.js.map +1 -1
- package/dist/needs-you-hub.d.ts +9 -1
- package/dist/needs-you-hub.js +46 -8
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +47 -2
- package/dist/needs-you.js +31 -3
- package/dist/needs-you.js.map +1 -1
- package/dist/office-share-page.js +2 -2
- package/dist/office-share-page.js.map +1 -1
- package/dist/office-share.d.ts +11 -0
- package/dist/office-share.js +14 -0
- 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 +14 -0
- package/dist/outbound-handlers.js +49 -6
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +33 -1
- package/dist/outbound-schemas.js +29 -16
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/pane-quota-history.d.ts +9 -0
- package/dist/pane-quota-history.js +67 -0
- package/dist/pane-quota-history.js.map +1 -0
- package/dist/pause-marker.d.ts +1 -1
- package/dist/pause-marker.js +1 -1
- package/dist/pause-marker.js.map +1 -1
- package/dist/platform-general.d.ts +46 -0
- package/dist/platform-general.js +91 -0
- package/dist/platform-general.js.map +1 -0
- package/dist/public-web-gateway.js +7 -0
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/queued-handoffs.d.ts +33 -0
- package/dist/queued-handoffs.js +75 -0
- package/dist/queued-handoffs.js.map +1 -0
- package/dist/quickstart.d.ts +13 -0
- package/dist/quickstart.js +81 -5
- package/dist/quickstart.js.map +1 -1
- package/dist/quota-notice.d.ts +7 -0
- package/dist/quota-notice.js +40 -0
- package/dist/quota-notice.js.map +1 -1
- package/dist/reply-buttons-controller.js +10 -6
- package/dist/reply-buttons-controller.js.map +1 -1
- package/dist/reply-polls.d.ts +2 -2
- package/dist/reply-polls.js +3 -3
- package/dist/reply-polls.js.map +1 -1
- package/dist/runtime-api.d.ts +2 -0
- package/dist/runtime-api.js +25 -7
- package/dist/runtime-api.js.map +1 -1
- package/dist/runtime-build-info.js +5 -3
- package/dist/runtime-build-info.js.map +1 -1
- package/dist/runtime-bundle.d.ts +3 -0
- package/dist/runtime-bundle.js +3 -1
- package/dist/runtime-bundle.js.map +1 -1
- package/dist/runtime-cli.d.ts +8 -1
- package/dist/runtime-cli.js +127 -8
- package/dist/runtime-cli.js.map +1 -1
- package/dist/runtime-client-store.d.ts +7 -0
- package/dist/runtime-client-store.js +30 -2
- package/dist/runtime-client-store.js.map +1 -1
- package/dist/runtime-client.d.ts +63 -1
- package/dist/runtime-client.js +295 -21
- package/dist/runtime-client.js.map +1 -1
- package/dist/runtime-coordinator.d.ts +7 -0
- package/dist/runtime-coordinator.js +213 -35
- package/dist/runtime-coordinator.js.map +1 -1
- package/dist/runtime-credential-profiles.d.ts +78 -0
- package/dist/runtime-credential-profiles.js +280 -0
- package/dist/runtime-credential-profiles.js.map +1 -0
- package/dist/runtime-install.d.ts +50 -0
- package/dist/runtime-install.js +186 -0
- package/dist/runtime-install.js.map +1 -0
- package/dist/runtime-pane-assets.d.ts +1 -1
- package/dist/runtime-pane-assets.js +1 -1
- package/dist/runtime-pane-assets.js.map +1 -1
- package/dist/runtime-pane-codex-index.d.ts +10 -1
- package/dist/runtime-pane-codex-index.js +131 -27
- package/dist/runtime-pane-codex-index.js.map +1 -1
- package/dist/runtime-pane-host.d.ts +19 -0
- package/dist/runtime-pane-host.js +50 -7
- package/dist/runtime-pane-host.js.map +1 -1
- package/dist/runtime-pane-link.d.ts +7 -0
- package/dist/runtime-pane-link.js +93 -2
- package/dist/runtime-pane-link.js.map +1 -1
- package/dist/runtime-pane-mcp-relay.d.ts +1 -0
- package/dist/runtime-pane-mcp-relay.js +10 -0
- package/dist/runtime-pane-mcp-relay.js.map +1 -1
- package/dist/runtime-pane-mcp.d.ts +4 -0
- package/dist/runtime-pane-mcp.js +6 -3
- package/dist/runtime-pane-mcp.js.map +1 -1
- package/dist/runtime-pane-native.d.ts +32 -2
- package/dist/runtime-pane-native.js +55 -6
- package/dist/runtime-pane-native.js.map +1 -1
- package/dist/runtime-pane-port.d.ts +5 -0
- package/dist/runtime-pane-port.js +17 -1
- package/dist/runtime-pane-port.js.map +1 -1
- package/dist/runtime-pane-process.d.ts +1 -1
- package/dist/runtime-pane-process.js +11 -2
- package/dist/runtime-pane-process.js.map +1 -1
- package/dist/runtime-pane-protocol.d.ts +11 -1
- package/dist/runtime-pane-protocol.js +27 -5
- package/dist/runtime-pane-protocol.js.map +1 -1
- 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-service.d.ts +5 -0
- package/dist/runtime-pane-service.js +47 -12
- package/dist/runtime-pane-service.js.map +1 -1
- package/dist/runtime-pane-transcript.d.ts +5 -0
- package/dist/runtime-pane-transcript.js +66 -5
- package/dist/runtime-pane-transcript.js.map +1 -1
- package/dist/runtime-pane-worker.js +19 -6
- package/dist/runtime-pane-worker.js.map +1 -1
- package/dist/runtime-protocol.d.ts +17 -2
- package/dist/runtime-protocol.js +12 -0
- package/dist/runtime-protocol.js.map +1 -1
- 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-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-journal.d.ts +44 -0
- package/dist/runtime-update-journal.js +121 -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 +217 -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-windows-bridge.d.ts +2 -1
- package/dist/runtime-windows-bridge.js +11 -1
- package/dist/runtime-windows-bridge.js.map +1 -1
- package/dist/scheduler/db.d.ts +2 -1
- package/dist/scheduler/db.js +23 -9
- 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 +13 -0
- package/dist/scheduler/task-board.js +28 -3
- package/dist/scheduler/task-board.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 +13 -10
- package/dist/service-installer.js.map +1 -1
- package/dist/settings-api.d.ts +20 -0
- package/dist/settings-api.js +414 -4
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-baseline.d.ts +6 -0
- package/dist/settings-baseline.js +3 -1
- package/dist/settings-baseline.js.map +1 -1
- package/dist/settings-change.js +29 -6
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.d.ts +13 -0
- package/dist/settings-effect.js +97 -0
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.js +13 -1
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/settings-instance-patch.js +27 -0
- package/dist/settings-instance-patch.js.map +1 -1
- package/dist/setup-wizard.js +6 -2
- package/dist/setup-wizard.js.map +1 -1
- package/dist/task-board-tool.d.ts +13 -1
- package/dist/task-board-tool.js +104 -4
- package/dist/task-board-tool.js.map +1 -1
- package/dist/task-board-waker.d.ts +6 -0
- package/dist/task-board-waker.js +4 -0
- package/dist/task-board-waker.js.map +1 -1
- package/dist/tmux-binary.d.ts +59 -0
- package/dist/tmux-binary.js +200 -0
- package/dist/tmux-binary.js.map +1 -0
- 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-manager.d.ts +1 -1
- package/dist/tmux-manager.js +45 -36
- package/dist/tmux-manager.js.map +1 -1
- package/dist/tmux-read.js +4 -3
- package/dist/tmux-read.js.map +1 -1
- package/dist/tool-permissions.d.ts +5 -2
- package/dist/tool-permissions.js +6 -5
- package/dist/tool-permissions.js.map +1 -1
- package/dist/tool-progress.d.ts +2 -0
- package/dist/tool-progress.js +19 -3
- package/dist/tool-progress.js.map +1 -1
- package/dist/topic-commands.js +10 -5
- package/dist/topic-commands.js.map +1 -1
- package/dist/transcript-monitor.d.ts +20 -0
- package/dist/transcript-monitor.js +47 -3
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/transcript-needles.d.ts +7 -0
- package/dist/transcript-needles.js +9 -1
- package/dist/transcript-needles.js.map +1 -1
- package/dist/transcript-records.d.ts +1 -1
- package/dist/transcript-records.js +2 -1
- package/dist/transcript-records.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/ui/account-identity.js +27 -0
- package/dist/ui/accounts-view.js +214 -0
- package/dist/ui/agent-runtime-settings.js +9 -8
- package/dist/ui/backend-signin.js +4 -1
- package/dist/ui/chat-ambient.js +1 -1
- package/dist/ui/chat-md-strings.js +3 -0
- package/dist/ui/chat-render.js +3 -670
- package/dist/ui/chat-store.js +1 -1
- package/dist/ui/chat-strings.js +3 -333
- package/dist/ui/chat-thread.js +3 -919
- package/dist/ui/chat-time.js +3 -80
- package/dist/ui/chat-tour.js +1 -1
- package/dist/ui/credential-profile-select.js +54 -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-pack.d.ts +9 -0
- package/dist/ui/fleet-office-pack.js +76 -4
- package/dist/ui/fleet-office-skin.js +23 -5
- package/dist/ui/fleet-office-store.js +5 -0
- package/dist/ui/fleet-office.js +173 -6
- package/dist/ui/fleet-task-card.js +10 -6
- package/dist/ui/fleet-task-common.js +12 -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 +131 -43
- package/dist/ui/fleet-usage.js +90 -27
- package/dist/ui/html-attachment.js +3 -40
- package/dist/ui/hub-agent-copy.js +23 -0
- package/dist/ui/hub-button-actions.js +65 -0
- package/dist/ui/hub-chat-store.js +158 -0
- package/dist/ui/hub-chat-strings.js +77 -0
- package/dist/ui/hub-client.js +329 -0
- package/dist/ui/hub-owner-strings.js +51 -0
- package/dist/ui/hub-provider-guidance.js +31 -0
- package/dist/ui/hub-quota.js +85 -0
- package/dist/ui/hub-strings.js +162 -0
- package/dist/ui/hub-switcher.js +27 -0
- package/dist/ui/native-pane-recovery.js +1 -1
- package/dist/ui/office-share-page.js +4 -2
- package/dist/ui/panel-chat.js +34 -48
- package/dist/ui/panel-details.js +1 -1
- package/dist/ui/panel-fleet.js +78 -10
- package/dist/ui/panel-hub.js +619 -0
- package/dist/ui/panel-log.js +2 -2
- package/dist/ui/panel-needs.js +24 -8
- package/dist/ui/panel-runtimes.js +114 -23
- package/dist/ui/panel-settings.js +69 -80
- package/dist/ui/panel-windows-cli.js +12 -2
- package/dist/ui/preview-pages.js +1 -1
- package/dist/ui/preview-panel.js +92 -6
- package/dist/ui/preview-versions.js +1 -1
- package/dist/ui/preview.js +3 -476
- package/dist/ui/runtime-commands.d.ts +4 -0
- package/dist/ui/runtime-commands.js +59 -0
- package/dist/ui/search-dialog.js +2 -0
- package/dist/ui/settings-access-strings.js +42 -0
- package/dist/ui/settings-build-version.js +35 -0
- package/dist/ui/settings-codex-copy.js +19 -0
- package/dist/ui/settings-devices.js +253 -0
- package/dist/ui/settings-dialogs.js +28 -7
- package/dist/ui/settings-hub-browser-certificate.js +74 -0
- package/dist/ui/settings-hub-membership.js +72 -0
- package/dist/ui/settings-hub-retention.js +52 -0
- package/dist/ui/settings-hub.js +196 -0
- package/dist/ui/settings-layout.js +8 -11
- package/dist/ui/settings-model.js +16 -2
- package/dist/ui/settings-outside.js +104 -38
- package/dist/ui/settings-registry.js +4 -1
- package/dist/ui/settings-shared-strings.js +143 -0
- package/dist/ui/settings-shared.js +345 -0
- package/dist/ui/settings-strings.js +10 -46
- package/dist/ui/settings-web-authority.js +5 -2
- package/dist/ui/shared/accounts.css +15 -0
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app-needs.js +1 -1
- package/dist/ui/shared/app-route.js +6 -1
- package/dist/ui/shared/app-session.js +6 -2
- package/dist/ui/shared/app-shell.js +64 -8
- package/dist/ui/shared/app.css +121 -30
- package/dist/ui/shared/app.js +12 -3
- package/dist/ui/shared/chat-composer.js +68 -0
- package/dist/ui/shared/chat-md-strings.js +9 -0
- package/dist/ui/shared/chat-render.js +682 -0
- package/dist/ui/shared/chat-strings.js +333 -0
- package/dist/ui/shared/chat-thread.js +969 -0
- package/dist/ui/shared/chat-time.js +80 -0
- package/dist/ui/shared/header-tools.js +3 -5
- package/dist/ui/shared/html-attachment.js +42 -0
- package/dist/ui/shared/hub-chat.css +85 -0
- package/dist/ui/shared/hub-owner.css +33 -0
- package/dist/ui/shared/hub-quota.css +8 -0
- package/dist/ui/shared/hub.css +71 -0
- package/dist/ui/shared/page-head.js +8 -0
- package/dist/ui/shared/panel-view.js +77 -4
- package/dist/ui/shared/preview.js +476 -0
- package/dist/ui/shared/runtime-install.css +26 -0
- package/dist/ui/shared/side-rail.js +15 -0
- package/dist/ui/shared/signin.js +172 -0
- package/dist/ui/shared/task-board.css +95 -0
- package/dist/ui/shared/usage-dialog.js +18 -1
- package/dist/ui/shared/view-history.css +17 -0
- package/dist/ui/shared/view-history.js +438 -0
- package/dist/ui/shared/view-strings.js +16 -0
- package/dist/ui/shared/workspace.css +20 -0
- package/dist/ui/signin.html +21 -0
- package/dist/ui/workspace-panel.js +189 -0
- package/dist/ui/workspace-strings.js +35 -0
- package/dist/unattended-install.d.ts +11 -2
- package/dist/unattended-install.js +41 -6
- package/dist/unattended-install.js.map +1 -1
- package/dist/usage/capacity.d.ts +69 -0
- package/dist/usage/capacity.js +119 -0
- package/dist/usage/capacity.js.map +1 -0
- package/dist/usage/i18n-keys.d.ts +1 -1
- package/dist/usage/i18n-keys.js +3 -0
- package/dist/usage/i18n-keys.js.map +1 -1
- package/dist/usage/profile-timeline.d.ts +16 -0
- package/dist/usage/profile-timeline.js +58 -0
- package/dist/usage/profile-timeline.js.map +1 -0
- package/dist/usage/providers.js +2 -1
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/quota-history.d.ts +43 -0
- package/dist/usage/quota-history.js +168 -0
- package/dist/usage/quota-history.js.map +1 -0
- package/dist/usage/usage-api.d.ts +31 -0
- package/dist/usage/usage-api.js +80 -1
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/usage-report.d.ts +25 -1
- package/dist/usage-report.js +55 -4
- package/dist/usage-report.js.map +1 -1
- package/dist/usage-rollup.d.ts +6 -1
- package/dist/usage-rollup.js +16 -4
- package/dist/usage-rollup.js.map +1 -1
- package/dist/view-api.d.ts +16 -0
- package/dist/view-api.js +105 -23
- package/dist/view-api.js.map +1 -1
- package/dist/view-history.d.ts +84 -0
- package/dist/view-history.js +116 -0
- package/dist/view-history.js.map +1 -0
- package/dist/web-api.d.ts +48 -2
- package/dist/web-api.js +276 -8
- package/dist/web-api.js.map +1 -1
- package/dist/web-backend-login.d.ts +23 -1
- package/dist/web-backend-login.js +11 -17
- package/dist/web-backend-login.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-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-session-authorization.d.ts +13 -2
- package/dist/web-session-authorization.js +10 -3
- package/dist/web-session-authorization.js.map +1 -1
- package/dist/web-session.d.ts +35 -0
- package/dist/web-session.js +7 -0
- package/dist/web-session.js.map +1 -1
- package/dist/web-settings-patch.d.ts +3 -1
- package/dist/web-settings-patch.js +4 -1
- package/dist/web-settings-patch.js.map +1 -1
- package/dist/web-shell-routes.d.ts +6 -0
- package/dist/web-shell-routes.js +7 -0
- package/dist/web-shell-routes.js.map +1 -1
- package/dist/web-terminal.d.ts +4 -30
- package/dist/web-terminal.js +9 -6
- package/dist/web-terminal.js.map +1 -1
- package/dist/windows-agents.d.ts +1 -0
- package/dist/windows-agents.js +1 -0
- package/dist/windows-agents.js.map +1 -1
- package/dist/windows-cli-api.d.ts +12 -1
- package/dist/windows-cli-api.js +27 -1
- package/dist/windows-cli-api.js.map +1 -1
- package/dist/windows-cli-providers.d.ts +0 -9
- package/dist/windows-cli-providers.js +4 -9
- package/dist/windows-cli-providers.js.map +1 -1
- package/dist/windows-cli-worker.d.ts +24 -0
- package/dist/windows-cli-worker.js +96 -5
- package/dist/windows-cli-worker.js.map +1 -1
- package/dist/windows-cli.d.ts +10 -0
- package/dist/windows-cli.js +10 -1
- package/dist/windows-cli.js.map +1 -1
- package/dist/yaml-shared-nodes.js +8 -3
- package/dist/yaml-shared-nodes.js.map +1 -1
- package/launcher/agend-install.cjs +8 -1
- package/launcher/launchd-session-type.cjs +14 -0
- package/launcher/postinstall.cjs +27 -2
- package/launcher/private-home.cjs +1 -1
- package/launcher/tmux-bundle.cjs +247 -0
- package/package.json +3 -2
- package/templates/launchd.plist.ejs +3 -1
- package/templates/runtime-install/install.ps1 +270 -0
package/dist/ui/preview.js
CHANGED
|
@@ -1,476 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* The HTML runs in a frame from a SEPARATE listener (the preview origin), sandboxed to an opaque origin, so it cannot
|
|
5
|
-
* act as the signed-in person: it has no dashboard origin, no cookie it can use, no CSRF value. It reaches the frame
|
|
6
|
-
* only by postMessage, after the frame proved it is this fleet's listener (the boot id). What it is NOT promised: that
|
|
7
|
-
* it cannot send data out — so previews are off on every device until that device opts in, and every preview carries
|
|
8
|
-
* the banner saying so.
|
|
9
|
-
*
|
|
10
|
-
* This file knows nothing about the chat, the composer, the fleet's API or navigation: the message listener below can
|
|
11
|
-
* reach the frames it made and nothing else (a test asserts it). Imported by the chat panel (#1408: the import sets globalThis.AgendPreview); also
|
|
12
|
-
* exports itself for the tests.
|
|
13
|
-
*/
|
|
14
|
-
(function (root, factory) {
|
|
15
|
-
"use strict";
|
|
16
|
-
var api = factory(root);
|
|
17
|
-
if (typeof module === "object" && module && module.exports) module.exports = api;
|
|
18
|
-
// The global as well: the chat imports this file for its side effect (#1408), in the browser and under the tests.
|
|
19
|
-
if (root) root.AgendPreview = api;
|
|
20
|
-
})(typeof globalThis !== "undefined" ? globalThis : this, function (root) {
|
|
21
|
-
"use strict";
|
|
22
|
-
|
|
23
|
-
// #2863: askBytes — above it the person is asked first ("Preview anyway?"); maxBytes — above it only a download (the
|
|
24
|
-
// frame's own ceiling, web-preview.ts PREVIEW_HTML_MAX_BYTES; html-attachment.js reads with the same two).
|
|
25
|
-
var LIMITS = { askBytes: 8 * 1024 * 1024, maxBytes: 50 * 1024 * 1024, minHeight: 40, maxHeight: 4000, readyMs: 3000, watchdogMs: 10000, resizePerSec: 10, minDelta: 2, growthFreeze: 5, growthWindowMs: 2000 };
|
|
26
|
-
var OPT_IN_KEY = "agend_html_preview"; // localStorage: "on" — this device allows previews
|
|
27
|
-
var NEVER_KEY = "agend_html_preview_never"; // sessionStorage: "1" — never preview on this device (this session)
|
|
28
|
-
// #1568: the banner was acknowledged ("I understand"). localStorage: the sign-in's session handle — hidden while the
|
|
29
|
-
// page belongs to that sign-in; sessionStorage: "1" — no sign-in session known, this tab only.
|
|
30
|
-
var BANNER_ACK_KEY = "agend_html_preview_banner_ack";
|
|
31
|
-
var BANNER = "Previews run the agent's HTML in an isolated frame. It cannot use your login, but it may be able to send data out. Only preview content you trust. A preview can slow or freeze this tab.";
|
|
32
|
-
|
|
33
|
-
var cfg = { dashboardOrigin: "", previewOrigin: "", boot: "", reason: "", reasonCode: "", detail: "" };
|
|
34
|
-
// Why it failed, in English when the app's dictionary has no word for it (chat-strings.js pvFail_*).
|
|
35
|
-
var FAIL_EN = { exited: "its address closed unexpectedly", "spawn-failed": "cloudflared could not start for it", "no-address": "no address was given for it",
|
|
36
|
-
unreachable: "its address could not be reached", "lease-held": "an earlier preview tunnel is still being cleaned up", "gateway-failed": "its local listener could not start",
|
|
37
|
-
// #1767: what cloudflared's exit before an address really was.
|
|
38
|
-
"rate-limited": "Cloudflare is limiting new temporary links from this machine — try again in a while",
|
|
39
|
-
"provisioning-failed": "Cloudflare refused to create its address right now", "process-exited": "cloudflared stopped before it gave an address",
|
|
40
|
-
"bad-address": "Cloudflare gave an address that could not be used" };
|
|
41
|
-
// #1554: the page's words. `say(key, english, …values)` asks the app's dictionary (init's opts.text) and keeps the
|
|
42
|
-
// English here when it has none — so this file still works, and reads the same, without the app.
|
|
43
|
-
var text = null;
|
|
44
|
-
function say(key, english) {
|
|
45
|
-
var values = Array.prototype.slice.call(arguments, 2);
|
|
46
|
-
var s = null;
|
|
47
|
-
if (text) { try { s = text.apply(null, [key].concat(values)); } catch (e) { s = null; } }
|
|
48
|
-
if (typeof s === "string" && s && s !== key) return s;
|
|
49
|
-
for (var i = 0; i < values.length; i++) english = english.split("{" + i + "}").join(String(values[i]));
|
|
50
|
-
return english;
|
|
51
|
-
}
|
|
52
|
-
var changed = []; // the page's "this device's choice changed" callbacks (checkbox, cards)
|
|
53
|
-
var live = new Map(); // cardKey → { key, iframe, ch, holder, state, … } (at most one: one running preview per page)
|
|
54
|
-
var listening = false;
|
|
55
|
-
|
|
56
|
-
function now() { return root.performance && typeof root.performance.now === "function" ? root.performance.now() : Date.now(); }
|
|
57
|
-
function store(kind) { try { return root[kind] || null; } catch (e) { return null; } }
|
|
58
|
-
function utf8Bytes(s) { try { return new root.TextEncoder().encode(s).length; } catch (e) { return String(s).length * 3; } }
|
|
59
|
-
/** #2863: "12 MB" / "8.4 MB" (1 MB = 1024 × 1024 bytes, as the caps are; html-attachment.js sizeLabel). */
|
|
60
|
-
function sizeLabel(bytes) { var mb = bytes / (1024 * 1024); return (mb >= 10 ? Math.round(mb) : Math.round(mb * 10) / 10) + " MB"; }
|
|
61
|
-
function randomCh() {
|
|
62
|
-
var b = new Uint8Array(16);
|
|
63
|
-
root.crypto.getRandomValues(b);
|
|
64
|
-
var s = "";
|
|
65
|
-
for (var i = 0; i < b.length; i++) s += (b[i] < 16 ? "0" : "") + b[i].toString(16);
|
|
66
|
-
return s;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* What the server said about this page load (the <body data-*> attributes /ui was served with). opts.text(key,
|
|
71
|
-
* …values): the app's dictionary for this file's words (#1554); without it they are the English below.
|
|
72
|
-
*/
|
|
73
|
-
function init(data, opts) {
|
|
74
|
-
cfg = {
|
|
75
|
-
dashboardOrigin: String((data && data.dashboardOrigin) || ""),
|
|
76
|
-
previewOrigin: String((data && data.previewOrigin) || ""),
|
|
77
|
-
boot: String((data && data.previewBoot) || ""),
|
|
78
|
-
reason: String((data && data.previewReason) || ""),
|
|
79
|
-
reasonCode: String((data && data.previewReasonCode) || ""),
|
|
80
|
-
detail: String((data && data.previewDetail) || ""),
|
|
81
|
-
};
|
|
82
|
-
if (opts && typeof opts.text === "function") text = opts.text;
|
|
83
|
-
if (!listening && typeof root.addEventListener === "function") {
|
|
84
|
-
root.addEventListener("message", onMessage);
|
|
85
|
-
// The opt-in is per device: another tab of this dashboard turning it off (or clearing storage) stops the
|
|
86
|
-
// previews running here at once. Turning it on elsewhere starts nothing here — only a click on Preview does.
|
|
87
|
-
root.addEventListener("storage", onStorage);
|
|
88
|
-
listening = true;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* #1723: the public link's own preview tunnel was still starting when this page loaded; preview-status.js asks the
|
|
93
|
-
* page's server and hands each answer here (this file reaches no network). Ready → previews run at the origin it
|
|
94
|
-
* names — only an https quick-tunnel origin other than this page's is ever taken: the page's frame-src allows no
|
|
95
|
-
* other; failed or off → the page says why. Returns true once there is nothing more to wait for.
|
|
96
|
-
*/
|
|
97
|
-
function waitingForPublicPreview() { return cfg.reasonCode === "publicLinkStarting"; }
|
|
98
|
-
function applyPublicPreviewStatus(j) {
|
|
99
|
-
if (cfg.reasonCode !== "publicLinkStarting") return true;
|
|
100
|
-
var at = root.location && root.location.origin;
|
|
101
|
-
if (j && typeof j.previewOrigin === "string" && /^https:\/\/[a-z0-9-]+\.trycloudflare\.com$/.test(j.previewOrigin) && j.previewOrigin !== at
|
|
102
|
-
&& typeof j.boot === "string" && /^[0-9a-f]{32}$/.test(j.boot)) {
|
|
103
|
-
cfg.previewOrigin = j.previewOrigin; cfg.boot = j.boot; cfg.reasonCode = ""; cfg.reason = "";
|
|
104
|
-
notify();
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
if (j && (j.code === "publicLinkPreviewFailed" || j.code === "publicLink" || j.code === "fleetOff" || j.code === "listenFailed" || j.code === "notListening")) {
|
|
108
|
-
cfg.reasonCode = j.code; cfg.reason = ""; cfg.detail = typeof j.detail === "string" ? j.detail : "";
|
|
109
|
-
notify();
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
function onStorage(event) {
|
|
115
|
-
// #1568: the banner acknowledged in another tab of this sign-in: hide it here too (nothing starts or stops).
|
|
116
|
-
if (event && event.key === BANNER_ACK_KEY) { notify(); return; }
|
|
117
|
-
if (event && event.key !== OPT_IN_KEY && event.key !== null) return; // key null: storage was cleared
|
|
118
|
-
if (!optedIn()) stopAll("off");
|
|
119
|
-
notify();
|
|
120
|
-
}
|
|
121
|
-
/** Call `fn` whenever this device's choice may have changed (here or in another tab). Returns the unsubscribe: a
|
|
122
|
-
* chat that leaves takes its callback with it (#1408 §4), so 50 visits leave no callback behind. */
|
|
123
|
-
function onChange(fn) {
|
|
124
|
-
if (typeof fn !== "function") return function () {};
|
|
125
|
-
changed.push(fn);
|
|
126
|
-
return function () { var i = changed.indexOf(fn); if (i >= 0) changed.splice(i, 1); };
|
|
127
|
-
}
|
|
128
|
-
function listeners() { return changed.length; }
|
|
129
|
-
function notify() { for (var i = 0; i < changed.length; i++) { try { changed[i](); } catch (e) { /* one listener's error stops no other */ } } }
|
|
130
|
-
|
|
131
|
-
// ── This device's choice ────────────────────────────────
|
|
132
|
-
|
|
133
|
-
function optedIn() { var s = store("localStorage"); try { return !!s && s.getItem(OPT_IN_KEY) === "on"; } catch (e) { return false; } }
|
|
134
|
-
/** Allow (or stop allowing) previews on this device. Turning it off stops every running preview at once. */
|
|
135
|
-
function setOptIn(on) {
|
|
136
|
-
var s = store("localStorage");
|
|
137
|
-
try { if (s) { if (on) s.setItem(OPT_IN_KEY, "on"); else s.removeItem(OPT_IN_KEY); } } catch (e) { /* this page only */ }
|
|
138
|
-
if (!on) stopAll("off");
|
|
139
|
-
notify();
|
|
140
|
-
}
|
|
141
|
-
function never() { var s = store("sessionStorage"); try { return !!s && s.getItem(NEVER_KEY) === "1"; } catch (e) { return false; } }
|
|
142
|
-
function setNever(on) {
|
|
143
|
-
var s = store("sessionStorage");
|
|
144
|
-
try { if (s) { if (on) s.setItem(NEVER_KEY, "1"); else s.removeItem(NEVER_KEY); } } catch (e) { /* this page only */ }
|
|
145
|
-
if (on) stopAll("off");
|
|
146
|
-
notify();
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// ── #1568: the banner, acknowledged until the next sign-in ────────
|
|
150
|
-
|
|
151
|
-
// The page's sign-in, as the page found it out (AgendAuth): undefined — not known yet; null — no sign-in session (a
|
|
152
|
-
// loopback page without one, a session that ended, a failed read); otherwise the session's handle.
|
|
153
|
-
var bannerScope;
|
|
154
|
-
// Pressed on this page: { scope } — the sign-in it was pressed under (undefined: before the page knew). Holds for
|
|
155
|
-
// this page and that sign-in whatever storage does (blocked, full); null: not pressed here.
|
|
156
|
-
var pressed = null;
|
|
157
|
-
function validHandle(h) { return typeof h === "string" && /^[0-9a-f]{16}$/.test(h); }
|
|
158
|
-
/**
|
|
159
|
-
* Whether the banner was acknowledged for this page's sign-in: the handle stored is this session's (a new sign-in
|
|
160
|
-
* has a new handle, so it shows again); with no sign-in session, for this tab only. Not known yet: shown.
|
|
161
|
-
*/
|
|
162
|
-
function bannerAcked() {
|
|
163
|
-
if (pressed && (pressed.scope === undefined || pressed.scope === bannerScope)) return true;
|
|
164
|
-
if (bannerScope === undefined) return false;
|
|
165
|
-
if (bannerScope === null) { var t = store("sessionStorage"); try { return !!t && t.getItem(BANNER_ACK_KEY) === "1"; } catch (e) { return false; } }
|
|
166
|
-
var s = store("localStorage");
|
|
167
|
-
try { return !!s && s.getItem(BANNER_ACK_KEY) === bannerScope; } catch (e) { return false; }
|
|
168
|
-
}
|
|
169
|
-
function writeBannerAck() {
|
|
170
|
-
if (bannerScope === undefined) return;
|
|
171
|
-
var kind = bannerScope === null ? "sessionStorage" : "localStorage";
|
|
172
|
-
var s = store(kind);
|
|
173
|
-
try { if (s) s.setItem(BANNER_ACK_KEY, bannerScope === null ? "1" : bannerScope); } catch (e) { /* this page only */ }
|
|
174
|
-
}
|
|
175
|
-
/** "I understand": the banner is hidden until the next sign-in (or, with no sign-in session, for this tab). */
|
|
176
|
-
function ackBanner() {
|
|
177
|
-
pressed = { scope: bannerScope };
|
|
178
|
-
writeBannerAck();
|
|
179
|
-
notify();
|
|
180
|
-
}
|
|
181
|
-
/** The page's sign-in: the session handle, or null when there is no sign-in session. Set once the page knows. */
|
|
182
|
-
function setBannerScope(handle) {
|
|
183
|
-
bannerScope = validHandle(handle) ? handle : null;
|
|
184
|
-
// Pressed before the page knew its sign-in: it was this one — recorded for it now.
|
|
185
|
-
if (pressed && pressed.scope === undefined) { pressed = { scope: bannerScope }; writeBannerAck(); }
|
|
186
|
-
notify();
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Whether this page may run a preview at all, and why not: the server must have chosen a preview origin for this
|
|
191
|
-
* load, the browser must really be at the origin the server believed (a proxy that rewrites Host would otherwise get
|
|
192
|
-
* a frame from the wrong place), and the device must have opted in and not switched previews off.
|
|
193
|
-
*/
|
|
194
|
-
function availability() {
|
|
195
|
-
if (!cfg.previewOrigin || !cfg.boot) {
|
|
196
|
-
// The server's reason, in the page's language when the server named it (a code), else as the server wrote it.
|
|
197
|
-
// #1723: a failed public-link preview names why ({0} is the reason, in the page's words).
|
|
198
|
-
var arg = cfg.reasonCode === "publicLinkPreviewFailed" ? say("pvFail_" + (cfg.detail || "unknown"), Object.prototype.hasOwnProperty.call(FAIL_EN, cfg.detail) ? FAIL_EN[cfg.detail] : "an unexpected error")
|
|
199
|
-
: cfg.reasonCode === "listenFailed" ? cfg.detail : cfg.dashboardOrigin;
|
|
200
|
-
var english = cfg.reasonCode === "publicLinkPreviewFailed" ? "Previews are unavailable on this public link: {0}. The link itself keeps working."
|
|
201
|
-
: cfg.reason || "Previews are not available here.";
|
|
202
|
-
var server = cfg.reasonCode ? say("pvServer_" + cfg.reasonCode, english, arg) : "";
|
|
203
|
-
return { ok: false, why: "server", reason: server || cfg.reason || say("pvWhyServer", "Previews are not available here.") };
|
|
204
|
-
}
|
|
205
|
-
var at = root.location && root.location.origin;
|
|
206
|
-
if (!cfg.dashboardOrigin || at !== cfg.dashboardOrigin) {
|
|
207
|
-
return { ok: false, why: "origin", reason: say("pvWhyOrigin", "Previews are off: this page is at {0}, but the fleet believes it is at {1} (a proxy that rewrites Host). Pass the external Host through, or set web.preview_origin.",
|
|
208
|
-
at, cfg.dashboardOrigin || say("pvUnknownAddress", "an unknown address")) };
|
|
209
|
-
}
|
|
210
|
-
if (never()) return { ok: false, why: "never", reason: say("pvWhyNever", "Previews are switched off on this device for this session.") };
|
|
211
|
-
if (!optedIn()) return { ok: false, why: "optin", reason: say("pvWhyOptin", "Previews are off on this device. Allow them from the card's menu or the sidebar.") };
|
|
212
|
-
return { ok: true, why: "", reason: "" };
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// ── The frame ───────────────────────────────────────────
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* The ONE place the dashboard makes an iframe or writes `sandbox` (a test fails if anything else does):
|
|
219
|
-
* opaque origin (allow-scripts only — never allow-same-origin, forms, popups, top navigation, modals, downloads),
|
|
220
|
-
* no permissions, no referrer, from <preview origin>/frame — the only URL the dashboard's frame-src allows.
|
|
221
|
-
*/
|
|
222
|
-
function mountPreview(doc) {
|
|
223
|
-
var f = doc.createElement("iframe");
|
|
224
|
-
f.setAttribute("sandbox", "allow-scripts");
|
|
225
|
-
f.setAttribute("allow", "");
|
|
226
|
-
f.setAttribute("referrerpolicy", "no-referrer");
|
|
227
|
-
f.setAttribute("loading", "eager");
|
|
228
|
-
f.setAttribute("title", "Untrusted HTML preview");
|
|
229
|
-
f.className = "preview-frame";
|
|
230
|
-
f.src = cfg.previewOrigin + "/frame";
|
|
231
|
-
return f;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Run `html` in `holder` (a node of the card) for `key`. `ui` is told what happened: ui.state(name, reason) with
|
|
236
|
-
* "starting" | "running" | "stopped" | "unavailable" | "large" (#2863: over LIMITS.askBytes — nothing runs until it is
|
|
237
|
-
* asked again with opts.anyway, the person's "Preview anyway"). One preview at a time: any other running one stops first.
|
|
238
|
-
* opts.fill (#1481, the side panel): the frame fills its holder — the same frame from mountPreview, only sized by the
|
|
239
|
-
* panel instead of by the frame's height messages, which it then ignores.
|
|
240
|
-
*/
|
|
241
|
-
/** How many previews this page has started: a click whose HTML arrives late asks whether another started meanwhile. */
|
|
242
|
-
var starts = 0;
|
|
243
|
-
function startCount() { return starts; }
|
|
244
|
-
function start(key, holder, html, ui, opts) {
|
|
245
|
-
var a = availability();
|
|
246
|
-
if (!a.ok) { ui.state("unavailable", a.reason); return false; }
|
|
247
|
-
var bytes = typeof html === "string" ? utf8Bytes(html) : Infinity;
|
|
248
|
-
if (bytes > LIMITS.maxBytes) { ui.state("unavailable", say("pvHtmlOver", "This HTML is over 50 MB; it is not previewed. Download it to open it.")); return false; }
|
|
249
|
-
if (bytes > LIMITS.askBytes && !(opts && opts.anyway)) { ui.state("large", say("pvLarge", "This file is large ({0}). Preview anyway?", sizeLabel(bytes))); return false; }
|
|
250
|
-
stopAll("another");
|
|
251
|
-
starts++;
|
|
252
|
-
resetErrors(key);
|
|
253
|
-
var doc = holder.ownerDocument;
|
|
254
|
-
var iframe = mountPreview(doc);
|
|
255
|
-
var card = {
|
|
256
|
-
key: key, iframe: iframe, ch: randomCh(), holder: holder, html: html, ui: ui, rendered: false,
|
|
257
|
-
height: LIMITS.minHeight, lastApplied: -Infinity, appliedInSecond: [], frozen: false, growth: [], pendingFrame: false,
|
|
258
|
-
readyTimer: null, watchdogTimer: null, fill: !!(opts && opts.fill),
|
|
259
|
-
};
|
|
260
|
-
if (card.fill) iframe.classList.add("fill");
|
|
261
|
-
live.set(key, card);
|
|
262
|
-
card.readyTimer = root.setTimeout(function () {
|
|
263
|
-
if (live.get(key) === card && !card.rendered) stop(key, "unavailable", say("pvNoAnswer", "Preview unavailable: the preview did not answer within 3 s. If an earlier preview froze, it may still be running — open the dashboard in a new tab. Over SSH, forward the preview port too."));
|
|
264
|
-
}, LIMITS.readyMs);
|
|
265
|
-
holder.appendChild(iframe);
|
|
266
|
-
if (!card.fill) setHeight(card, LIMITS.minHeight);
|
|
267
|
-
ui.state("starting", "");
|
|
268
|
-
return true;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
function setHeight(card, px) { card.height = px; card.iframe.style.height = px + "px"; } // CSSOM — never a style attribute
|
|
272
|
-
|
|
273
|
-
function armWatchdog(card) {
|
|
274
|
-
if (card.watchdogTimer) root.clearTimeout(card.watchdogTimer);
|
|
275
|
-
card.watchdogTimer = root.setTimeout(function () {
|
|
276
|
-
if (live.get(card.key) !== card) return;
|
|
277
|
-
// Best effort: a frame that froze this tab freezes this timer too. Only while the page is visible.
|
|
278
|
-
var hidden = root.document && root.document.visibilityState === "hidden";
|
|
279
|
-
if (hidden) { armWatchdog(card); return; }
|
|
280
|
-
stop(card.key, "stopped", say("pvStoppedAnswering", "The preview stopped answering, so it was closed."));
|
|
281
|
-
}, LIMITS.watchdogMs);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/** Stop the preview for `key`: remove its frame and its timers. A preview is never moved or reloaded silently. */
|
|
285
|
-
function stop(key, state, reason) {
|
|
286
|
-
var card = live.get(key);
|
|
287
|
-
if (!card) return false;
|
|
288
|
-
live.delete(key);
|
|
289
|
-
if (card.picking) { card.picking = false; tellPick(key, null, false); }
|
|
290
|
-
if (card.readyTimer) root.clearTimeout(card.readyTimer);
|
|
291
|
-
if (card.watchdogTimer) root.clearTimeout(card.watchdogTimer);
|
|
292
|
-
if (card.iframe.parentNode) card.iframe.parentNode.removeChild(card.iframe);
|
|
293
|
-
card.ui.state(state || "stopped", reason || "");
|
|
294
|
-
return true;
|
|
295
|
-
}
|
|
296
|
-
function stopAll(why) {
|
|
297
|
-
var keys = [];
|
|
298
|
-
live.forEach(function (_c, k) { keys.push(k); });
|
|
299
|
-
for (var i = 0; i < keys.length; i++) stop(keys[i], "stopped", why === "off" ? say("pvSwitchedOff", "Previews were switched off on this device.") : why === "another" ? say("pvAnother", "Another preview started.") : "");
|
|
300
|
-
return keys;
|
|
301
|
-
}
|
|
302
|
-
/** Stop every preview inside `node` (before the chat replaces, moves or removes it); returns the stopped keys. */
|
|
303
|
-
function stopIn(node) {
|
|
304
|
-
var keys = [];
|
|
305
|
-
live.forEach(function (c, k) { if (node && (node === c.holder || (typeof node.contains === "function" && node.contains(c.holder)))) keys.push(k); });
|
|
306
|
-
for (var i = 0; i < keys.length; i++) stop(keys[i], "stopped", "");
|
|
307
|
-
return keys;
|
|
308
|
-
}
|
|
309
|
-
function running(key) { return live.has(key); }
|
|
310
|
-
function liveCount() { return live.size; }
|
|
311
|
-
function liveFrame(key) { var c = live.get(key); return c ? c.iframe : null; }
|
|
312
|
-
|
|
313
|
-
// ── Messages from frames (design §4.2) ──────────────────
|
|
314
|
-
|
|
315
|
-
var KEYS = { ready: "boot,ch,type,v", resize: "ch,height,type,v", heartbeat: "ch,type,v", error: "ch,col,kind,line,message,type,v",
|
|
316
|
-
pick: "ch,h,selector,text,type,v,w,x,y", pickend: "ch,type,v" };
|
|
317
|
-
|
|
318
|
-
// ── #2911: the errors a running preview reported (design §4.1 amendment) ──
|
|
319
|
-
// Recorded only: a count, and the first few distinct ones as one line of plain text each. Nothing here passes them on;
|
|
320
|
-
// a person's click in the panel (preview-panel-actions.js) puts them in the composer, quoted, for them to edit.
|
|
321
|
-
var ERRORS = { maxCount: 999, keep: 5, messageMax: 200, rawMax: 1000, notifyMs: 200 };
|
|
322
|
-
var ERROR_KINDS = { error: 1, rejection: 1, console: 1, blocked: 1 }; // blocked: #2911 (7), a CSP-blocked script/style/font URL
|
|
323
|
-
var errorLog = new Map(); // frame key → { count, items: [{ kind, message, line, col }] }
|
|
324
|
-
var errorListeners = new Set();
|
|
325
|
-
var errorNotify = new Map(); // frame key → a pending notification's timer
|
|
326
|
-
function oneLine(v, max) {
|
|
327
|
-
// Format characters (\p{Cf}: bidi overrides and isolates, zero-widths, U+FEFF…) go first: a quoted line must read
|
|
328
|
-
// as its bytes say (#2914 review — the Trojan Source reordering, text hidden between zero-widths).
|
|
329
|
-
var t = String(v).replace(/\p{Cf}+/gu, "").replace(/[\s\u0000-\u001f\u007f-\u009f\u2028\u2029]+/g, " ").trim();
|
|
330
|
-
var chars = Array.from(t);
|
|
331
|
-
return chars.length > max ? chars.slice(0, max - 1).join("") + "\u2026" : t;
|
|
332
|
-
}
|
|
333
|
-
function tellErrors(key) {
|
|
334
|
-
if (errorNotify.has(key)) return;
|
|
335
|
-
errorNotify.set(key, root.setTimeout(function () {
|
|
336
|
-
errorNotify.delete(key);
|
|
337
|
-
errorListeners.forEach(function (fn) { try { fn(key); } catch (e) { /* one listener's error stops no other */ } });
|
|
338
|
-
}, ERRORS.notifyMs));
|
|
339
|
-
}
|
|
340
|
-
// A new run: its chip goes at once (not after the notification delay), and a notification still pending is dropped.
|
|
341
|
-
function resetErrors(key) {
|
|
342
|
-
if (!errorLog.delete(key)) return;
|
|
343
|
-
if (errorNotify.has(key)) { root.clearTimeout(errorNotify.get(key)); errorNotify.delete(key); }
|
|
344
|
-
errorListeners.forEach(function (fn) { try { fn(key); } catch (e) { /* one listener's error stops no other */ } });
|
|
345
|
-
}
|
|
346
|
-
function recordError(card, d) {
|
|
347
|
-
if (!Object.prototype.hasOwnProperty.call(ERROR_KINDS, d.kind) || typeof d.message !== "string" || d.message.length > ERRORS.rawMax) return;
|
|
348
|
-
var pos = function (n) { return typeof n === "number" && isFinite(n) && Math.floor(n) === n && n >= 0 && n <= 1e7; };
|
|
349
|
-
if (!pos(d.line) || !pos(d.col)) return;
|
|
350
|
-
var log = errorLog.get(card.key);
|
|
351
|
-
if (!log) { log = { count: 0, items: [] }; errorLog.set(card.key, log); }
|
|
352
|
-
if (log.count >= ERRORS.maxCount) return;
|
|
353
|
-
log.count++;
|
|
354
|
-
var item = { kind: d.kind, message: oneLine(d.message, ERRORS.messageMax) || "(no message)", line: d.line, col: d.col };
|
|
355
|
-
if (log.items.length < ERRORS.keep && !log.items.some(function (x) { return x.kind === item.kind && x.message === item.message && x.line === item.line && x.col === item.col; })) log.items.push(item);
|
|
356
|
-
tellErrors(card.key);
|
|
357
|
-
}
|
|
358
|
-
/** What the preview under `key` reported since it started: { count, items } (copies), or null when nothing. */
|
|
359
|
-
function errors(key) {
|
|
360
|
-
var log = errorLog.get(key);
|
|
361
|
-
return log ? { count: log.count, items: log.items.map(function (x) { return { kind: x.kind, message: x.message, line: x.line, col: x.col }; }) } : null;
|
|
362
|
-
}
|
|
363
|
-
// ── #2911: pick mode — the person points at an element of a running preview (design §4.1 amendment) ──
|
|
364
|
-
// Only on a person's request (pick(key, true)), and only one answer per request: a `pick` from a frame that was not
|
|
365
|
-
// asked is dropped. The answer is the page's text — a selector it built and the element's words — kept one line each
|
|
366
|
-
// and handed to the listeners; the panel puts it in the composer for the person to edit. Nothing here sends it.
|
|
367
|
-
var PICK = { selectorMax: 300, textMax: 200 };
|
|
368
|
-
var pickListeners = new Set();
|
|
369
|
-
function tellPick(key, result, on) { pickListeners.forEach(function (fn) { try { fn(key, result, on); } catch (e) { /* one listener's error stops no other */ } }); }
|
|
370
|
-
/** Turn pick mode on or off for the running preview `key`; false when it is not running (rendered). */
|
|
371
|
-
function pick(key, on) {
|
|
372
|
-
var card = live.get(key);
|
|
373
|
-
if (!card || !card.rendered) return false;
|
|
374
|
-
card.picking = !!on;
|
|
375
|
-
try { card.iframe.contentWindow.postMessage({ v: 1, type: "pick", ch: card.ch, on: !!on }, "*"); } catch (e) { /* the frame went: its stop says so */ }
|
|
376
|
-
tellPick(key, null, card.picking);
|
|
377
|
-
return true;
|
|
378
|
-
}
|
|
379
|
-
function picking(key) { var c = live.get(key); return !!(c && c.picking); }
|
|
380
|
-
/** fn(key, result | null, on): a picked element ({ selector, text, x, y, w, h }), or the mode changing; returns the unsubscribe. */
|
|
381
|
-
function onPick(fn) { pickListeners.add(fn); return function () { pickListeners.delete(fn); }; }
|
|
382
|
-
function recordPick(card, d) {
|
|
383
|
-
if (!card.picking) return;
|
|
384
|
-
if (d.type === "pickend") { card.picking = false; tellPick(card.key, null, false); return; }
|
|
385
|
-
var box = function (n) { return typeof n === "number" && isFinite(n) && Math.floor(n) === n && n >= 0 && n < 1e6; };
|
|
386
|
-
if (typeof d.selector !== "string" || d.selector.length > 1000 || typeof d.text !== "string" || d.text.length > 1000) return;
|
|
387
|
-
if (!box(d.x) || !box(d.y) || !box(d.w) || !box(d.h)) return;
|
|
388
|
-
card.picking = false;
|
|
389
|
-
tellPick(card.key, { selector: oneLine(d.selector, PICK.selectorMax), text: oneLine(d.text, PICK.textMax), x: d.x, y: d.y, w: d.w, h: d.h }, false);
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/** fn(key) after a preview's errors changed (at most every 200 ms per preview); returns the unsubscribe. */
|
|
393
|
-
function onErrors(fn) { errorListeners.add(fn); return function () { errorListeners.delete(fn); }; }
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* The only window message listener. A message counts only from one of OUR frames (event.source is that frame's
|
|
397
|
-
* window, and its origin is the opaque "null"), with one of six exact shapes; each has one effect, on that frame
|
|
398
|
-
* only: ready → send the HTML once (boot checked, opt-in checked again), resize → its height, heartbeat → its
|
|
399
|
-
* watchdog, error (#2911) → its error log (recorded, never passed on), pick / pickend (#2911) → the answer to the
|
|
400
|
-
* person's own pick request, handed to the pick listeners (dropped when none was asked). It has no reference to the chat, the
|
|
401
|
-
* composer, the fleet's API, navigation or storage.
|
|
402
|
-
*/
|
|
403
|
-
function onMessage(event) {
|
|
404
|
-
var card = null;
|
|
405
|
-
live.forEach(function (c) { if (event.source && event.source === c.iframe.contentWindow) card = c; });
|
|
406
|
-
if (!card || event.origin !== "null") return;
|
|
407
|
-
var d = event.data;
|
|
408
|
-
if (!d || typeof d !== "object" || Array.isArray(d) || d.v !== 1 || typeof d.type !== "string" || !Object.prototype.hasOwnProperty.call(KEYS, d.type)) return;
|
|
409
|
-
if (Object.keys(d).sort().join(",") !== KEYS[d.type]) return;
|
|
410
|
-
if (d.type === "ready") {
|
|
411
|
-
if (d.ch !== null || typeof d.boot !== "string" || card.rendered) return;
|
|
412
|
-
if (d.boot !== cfg.boot) { stop(card.key, "unavailable", say("pvWrongBoot", "Preview unavailable: something else answered on the preview port.")); return; }
|
|
413
|
-
if (!availability().ok) { stop(card.key, "unavailable", availability().reason); return; }
|
|
414
|
-
card.rendered = true;
|
|
415
|
-
root.clearTimeout(card.readyTimer); card.readyTimer = null;
|
|
416
|
-
card.iframe.contentWindow.postMessage({ v: 1, type: "render", ch: card.ch, html: card.html }, "*");
|
|
417
|
-
armWatchdog(card);
|
|
418
|
-
card.ui.state("running", "");
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
if (d.ch !== card.ch || !card.rendered) return;
|
|
422
|
-
if (d.type === "heartbeat") {
|
|
423
|
-
// A heartbeat never outlives the permission: if this device stopped allowing previews (and the storage event
|
|
424
|
-
// was missed), the next heartbeat ends it.
|
|
425
|
-
if (!availability().ok) { stop(card.key, "stopped", say("pvSwitchedOff", "Previews were switched off on this device.")); return; }
|
|
426
|
-
armWatchdog(card);
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
if (d.type === "error") { recordError(card, d); return; }
|
|
430
|
-
if (d.type === "pick" || d.type === "pickend") { recordPick(card, d); return; }
|
|
431
|
-
if (typeof d.height !== "number" || !isFinite(d.height) || Math.floor(d.height) !== d.height) return;
|
|
432
|
-
requestHeight(card, d.height);
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
/** Height rules (design §4.2): clamp to [40, 4000]; ≤ 1 per animation frame and ≤ 10 per second; Δ < 2 px ignored;
|
|
436
|
-
* after 5 consecutive increases within 2 s the height freezes and the frame scrolls. */
|
|
437
|
-
function requestHeight(card, h) {
|
|
438
|
-
if (card.fill) return; // the panel sizes it (#1481)
|
|
439
|
-
var want = Math.max(LIMITS.minHeight, Math.min(LIMITS.maxHeight, h));
|
|
440
|
-
if (Math.abs(want - card.height) < LIMITS.minDelta) return;
|
|
441
|
-
var t = now();
|
|
442
|
-
if (want > card.height) {
|
|
443
|
-
card.growth = card.growth.filter(function (x) { return t - x < LIMITS.growthWindowMs; });
|
|
444
|
-
card.growth.push(t);
|
|
445
|
-
if (card.growth.length > LIMITS.growthFreeze) card.frozen = true;
|
|
446
|
-
} else card.growth = [];
|
|
447
|
-
if (card.frozen) return;
|
|
448
|
-
card.appliedInSecond = card.appliedInSecond.filter(function (x) { return t - x < 1000; });
|
|
449
|
-
if (card.appliedInSecond.length >= LIMITS.resizePerSec) return;
|
|
450
|
-
card.wanted = want;
|
|
451
|
-
if (card.pendingFrame) return;
|
|
452
|
-
card.pendingFrame = true;
|
|
453
|
-
var raf = typeof root.requestAnimationFrame === "function" ? root.requestAnimationFrame : function (f) { return root.setTimeout(f, 16); };
|
|
454
|
-
raf(function () {
|
|
455
|
-
card.pendingFrame = false;
|
|
456
|
-
if (live.get(card.key) !== card) return;
|
|
457
|
-
card.appliedInSecond.push(now());
|
|
458
|
-
setHeight(card, card.wanted);
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
return {
|
|
463
|
-
init: init, availability: availability, optedIn: optedIn, setOptIn: setOptIn, never: never, setNever: setNever, onChange: onChange, listeners: listeners, onStorage: onStorage,
|
|
464
|
-
errors: errors, onErrors: onErrors, ERRORS: ERRORS, pick: pick, picking: picking, onPick: onPick, PICK: PICK,
|
|
465
|
-
start: start, startCount: startCount, stop: stop, stopAll: stopAll, stopIn: stopIn, running: running, liveCount: liveCount, liveFrame: liveFrame,
|
|
466
|
-
mountPreview: mountPreview, onMessage: onMessage, BANNER: BANNER, LIMITS: LIMITS,
|
|
467
|
-
/** The banner every running preview carries, in the page's language (#1554); BANNER is its English. */
|
|
468
|
-
banner: function () { return say("pvBanner", BANNER); },
|
|
469
|
-
/** #1568: its "I understand", and whether it was pressed for this sign-in. The frame's border stays either way. */
|
|
470
|
-
bannerAckLabel: function () { return say("pvBannerAck", "I understand"); },
|
|
471
|
-
bannerAckTitle: function () { return say("pvBannerAckTitle", "Hide this notice until you sign in again"); },
|
|
472
|
-
bannerAcked: bannerAcked, ackBanner: ackBanner, setBannerScope: setBannerScope,
|
|
473
|
-
/** #1723: the public link's preview, while it starts (preview-status.js asks; this only takes the answer). */
|
|
474
|
-
waitingForPublicPreview: waitingForPublicPreview, applyPublicPreviewStatus: applyPublicPreviewStatus,
|
|
475
|
-
};
|
|
476
|
-
});
|
|
1
|
+
// Hub PR A (#3226): this script moved to /assets/preview.js (src/ui/shared/), shared by the fleet and the Hub. A tab opened
|
|
2
|
+
// before the move still imports it from here for its effect (the global it sets): the same module, once.
|
|
3
|
+
import "/assets/preview.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export function safeRuntimeOrigin(server: unknown): string;
|
|
2
|
+
export function runtimeConnectCommand(server: unknown): string;
|
|
3
|
+
export function runtimeInstallCommand(server: unknown, scriptSha256: unknown): string;
|
|
4
|
+
export function runtimeWindowsConnectCommand(server: unknown): string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The commands Settings -> Runtime -> Connect a computer offers to copy. Pure functions, no DOM and no network, so the page and the tests
|
|
3
|
+
* build exactly the same text.
|
|
4
|
+
*
|
|
5
|
+
* A command only ever contains: the origin the administrator reviewed in step 1 (inert host and port characters, https or loopback
|
|
6
|
+
* http), and, for the install command, the SHA-256 of install.ps1 that the AgEnD server itself reported to this signed-in page. No
|
|
7
|
+
* pairing code, token, credential or flag the page did not choose is ever put in one.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** The origin, only when it is composed of inert hostname/port characters; "" otherwise. Nothing else is placed in a copyable shell command. */
|
|
11
|
+
export function safeRuntimeOrigin(server) {
|
|
12
|
+
try {
|
|
13
|
+
const url = new URL(server);
|
|
14
|
+
const local = ["localhost","127.0.0.1","[::1]"].includes(url.hostname);
|
|
15
|
+
if (!/^([a-z0-9.-]+|\[[a-f0-9:]+\])$/i.test(url.hostname) || url.username || url.password || url.search || url.hash || url.pathname !== "/"
|
|
16
|
+
|| !(url.protocol === "https:" || url.protocol === "http:" && local)) return "";
|
|
17
|
+
return url.origin;
|
|
18
|
+
} catch { return ""; }
|
|
19
|
+
}
|
|
20
|
+
/** ZIP flow: run from the extracted folder. */
|
|
21
|
+
export function runtimeConnectCommand(server) {
|
|
22
|
+
const origin = safeRuntimeOrigin(server);
|
|
23
|
+
return origin ? `.\\agend-runtime.cmd connect --server "${origin}"` : "";
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Windows one-line install. The script and its bundle come from the same server over the same TLS channel, so a hash inside the script
|
|
27
|
+
* cannot vouch for the script. This page is the trust anchor: the command downloads install.ps1, hashes the bytes it received, compares
|
|
28
|
+
* the result with the SHA-256 shown here and runs the text (iex) only when they are equal. A copy that was modified, or fetched from
|
|
29
|
+
* another server, is refused before anything of it runs, whatever the TLS trust decision was. The address is handed to the script by
|
|
30
|
+
* `$agend`: the script reads it from nowhere else. It never skips certificate validation, and says not to.
|
|
31
|
+
*
|
|
32
|
+
* The rule for every step is that NO FAILURE MAY REACH `iex`. In PowerShell a failing method call is only statement-terminating: the
|
|
33
|
+
* statement is skipped and the next one runs. So `if (<check that can fail>) { throw }; iex $s` is fail-OPEN (in ConstrainedLanguage
|
|
34
|
+
* `[Security.Cryptography.SHA256]::Create()` is refused, the `if` is skipped, and the unverified script runs). Here:
|
|
35
|
+
* - `$s` and `$h` are reset to $null first, so a failed download or a failed hash leaves nothing from an earlier command to act on;
|
|
36
|
+
* - the hash is computed into `$h` in a statement of its own, so a failure there leaves `$h` null;
|
|
37
|
+
* - the condition is only `$s -and $h -eq '<hex>'` (no method call that could throw), and `iex` is inside the branch it passes: when
|
|
38
|
+
* anything above failed, `$h` is null, the condition is false, and the else branch says why and throws. (The message is written with
|
|
39
|
+
* Write-Host first because under `$ErrorActionPreference = 'SilentlyContinue'` a bare `throw` is swallowed and prints nothing; the
|
|
40
|
+
* script still does not run, as `iex` is not in that branch.)
|
|
41
|
+
* - the first statement (TLS 1.2, which Windows PowerShell 5.1 may not offer by default) touches nothing the check depends on: if it
|
|
42
|
+
* fails, the rest still runs and the rest still refuses.
|
|
43
|
+
* This differs from the shape in the upstream design review (`if (-not $s -or <hash> -ne …) { throw }; iex $s`) for exactly that reason.
|
|
44
|
+
*/
|
|
45
|
+
export function runtimeInstallCommand(server, scriptSha256) {
|
|
46
|
+
const origin = safeRuntimeOrigin(server);
|
|
47
|
+
if (!origin || typeof scriptSha256 !== "string" || !/^[a-f0-9]{64}$/.test(scriptSha256)) return "";
|
|
48
|
+
return `[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor 3072; `
|
|
49
|
+
+ `$agend = '${origin}'; $s = $null; $h = $null; `
|
|
50
|
+
+ `$s = (iwr "$agend/runtime/install.ps1" -UseBasicParsing).Content; `
|
|
51
|
+
+ `$h = (-join ([Security.Cryptography.SHA256]::Create().ComputeHash([Text.Encoding]::UTF8.GetBytes($s)) | % { $_.ToString('x2') })); `
|
|
52
|
+
+ `if ($s -and $h -eq '${scriptSha256}') { iex $s } `
|
|
53
|
+
+ `else { Write-Host 'install.ps1 could not be verified against the hash on the AgEnD page (a certificate or download error above is the usual cause: trust this AgEnD certificate, or use the ZIP; otherwise reload the page and copy the command again)' -ForegroundColor Red; throw 'install.ps1 was not run' }`;
|
|
54
|
+
}
|
|
55
|
+
/** After the install script: agend-runtime is on the user's PATH. The pairing code is typed into the terminal, never here. */
|
|
56
|
+
export function runtimeWindowsConnectCommand(server) {
|
|
57
|
+
const origin = safeRuntimeOrigin(server);
|
|
58
|
+
return origin ? `agend-runtime connect --server "${origin}"` : "";
|
|
59
|
+
}
|
package/dist/ui/search-dialog.js
CHANGED
|
@@ -14,6 +14,8 @@ import { namesOf, namesStore } from "/assets/instance-nav.js";
|
|
|
14
14
|
import { Icon } from "/assets/ui-icons.js";
|
|
15
15
|
import { goToSetting, searchSettings, settingLabel } from "./settings-registry.js";
|
|
16
16
|
import "./settings-strings.js";
|
|
17
|
+
import "./settings-shared-strings.js"; // the "where" of a result is settings.sec_<section>; sec_agent-defaults is one of these words
|
|
18
|
+
import "./settings-access-strings.js"; // a result shows its label: settings.webLoginQr is one of these words (#3061)
|
|
17
19
|
|
|
18
20
|
register("search", {
|
|
19
21
|
en: {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Refs #3061: the words Access & security added to modules a tab can already hold from before an upgrade, kept in a file of their
|
|
2
|
+
// own on purpose (the pattern settings-shared-strings.js documents, #3087).
|
|
3
|
+
//
|
|
4
|
+
// Why a file of their own: Fleet and search import settings-strings.js and settings-layout.js (panel-fleet.js → settings-dialogs.js,
|
|
5
|
+
// search-dialog.js → settings-registry.js). A tab that visited either before the upgrade has already run the old copies, and the
|
|
6
|
+
// browser hands the same module back when the new Settings page imports that URL again — so a key only the new file had would read
|
|
7
|
+
// as the raw `settings.…` / `settingsLayout.…` key there, in both languages. This file's URL is new, so no tab can hold an old
|
|
8
|
+
// copy of it: every module that draws one of these words imports it, and register() merges its words into the same tables.
|
|
9
|
+
//
|
|
10
|
+
// Rules for this file (the same as settings-shared-strings.js):
|
|
11
|
+
// - A key lives here or in settings-strings.js / settings-layout.js, never in both. A change to Access & security that adds a word
|
|
12
|
+
// to one of those modules (one an open Fleet or search tab already holds) puts it here instead.
|
|
13
|
+
// - Every module that reads one of these keys imports "./settings-access-strings.js": the Settings page (panel-settings.js), the
|
|
14
|
+
// search path (settings-registry.js, search-dialog.js) and the Web authorization card (settings-web-authority.js).
|
|
15
|
+
// tests/settings-access-strings-3061.test.ts checks that every module that reads a key from here imports this file.
|
|
16
|
+
// - The strings of modules no tab can have loaded before (settings-devices.js is new) stay in the module that draws them.
|
|
17
|
+
import { register } from "/assets/app-i18n.js";
|
|
18
|
+
|
|
19
|
+
register("settings", {
|
|
20
|
+
en: {
|
|
21
|
+
webLoginQr: "Show a QR code when a new device signs in with another device",
|
|
22
|
+
webLoginQrHint: "On the new device's sign-in page, beside the 8-character code. It holds only that page's address and the code, never a credential, and approving still takes a device signed in as the owner. Off by default; it has no effect on a fleet with a chat connection.",
|
|
23
|
+
},
|
|
24
|
+
"zh-TW": {
|
|
25
|
+
webLoginQr: "新裝置用其他裝置登入時顯示 QR Code",
|
|
26
|
+
webLoginQrHint: "顯示在新裝置登入頁、8 碼代碼旁邊。裡面只有該頁面的網址和代碼,沒有任何憑證;核准仍需要已登入並驗證擁有者的裝置。預設關閉;有連接聊天平台的 fleet 不受影響。",
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// The Web authorization card on a fleet with no chat connection (settings-web-authority.js; layoutText reads settingsLayout.*).
|
|
31
|
+
register("settingsLayout", {
|
|
32
|
+
en: {
|
|
33
|
+
revAuthorityBriefWeb: "This fleet has no chat platform connected. The host owner can verify directly; a remote session confirms who the owner is with the authenticator.",
|
|
34
|
+
revAuthorityEnabledWeb: "Allow web authorization by a verified owner",
|
|
35
|
+
revAuthorityRule: "Signing in a device and authorizing an action are judged separately. When this is off, even a verified web session cannot approve actions that need authority.",
|
|
36
|
+
},
|
|
37
|
+
"zh-TW": {
|
|
38
|
+
revAuthorityBriefWeb: "這個 fleet 未連接聊天平台。主機 owner 可直接驗證;遠端工作階段需透過驗證器確認擁有者身分。",
|
|
39
|
+
revAuthorityEnabledWeb: "允許已驗證擁有者的網頁授權",
|
|
40
|
+
revAuthorityRule: "裝置登入與擁有者授權分開判斷。關閉後,已驗證的網頁工作階段也不能核准需授權的操作。",
|
|
41
|
+
},
|
|
42
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Lazy-owned copy survives an open shell with cached i18n modules. No new shared exports are required.
|
|
2
|
+
import { html, useEffect, useState } from "/assets/app-html.js";
|
|
3
|
+
import { register, t } from "/assets/app-i18n.js";
|
|
4
|
+
register("installedBuild", {
|
|
5
|
+
en: { alphaShort: "α", source: "Source build", modified: "modified", unknown: "changes unknown", detail: "Package {0}; source {1}" },
|
|
6
|
+
"zh-TW": { alphaShort: "α", source: "原始碼建置", modified: "含未提交變更", unknown: "變更狀態不明", detail: "套件 {0};原始碼 {1}" },
|
|
7
|
+
});
|
|
8
|
+
const copy = (key, ...args) => t(`installedBuild.${key}`, ...args);
|
|
9
|
+
const releases = "https://github.com/songsid/AgEnD/releases";
|
|
10
|
+
export function SettingsBuildVersion({ version, build }) {
|
|
11
|
+
const [narrow, setNarrow] = useState(() => globalThis.matchMedia?.("(max-width: 899px)").matches ?? false);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const media = globalThis.matchMedia?.("(max-width: 899px)"); if (!media) return;
|
|
14
|
+
const sync = () => setNarrow(media.matches); media.addEventListener("change", sync); sync();
|
|
15
|
+
return () => media.removeEventListener("change", sync);
|
|
16
|
+
}, []);
|
|
17
|
+
if (!version) return null;
|
|
18
|
+
const source = build?.version === version ? build.source : null;
|
|
19
|
+
const valid = source && /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(source.commit)
|
|
20
|
+
&& ["alpha", "source", "release"].includes(source.channel)
|
|
21
|
+
&& (source.modified === null || typeof source.modified === "boolean");
|
|
22
|
+
const released = valid && source.channel === "release" && source.ref === `v${version}`;
|
|
23
|
+
const alpha = valid && source.channel === "alpha" && /^release\/\d+\.\d+\.\d+-alpha$/.test(source.ref);
|
|
24
|
+
const stamped = valid && (!released || source.modified === true);
|
|
25
|
+
const status = source?.modified === true ? copy("modified") : source?.modified === null ? copy("unknown") : "";
|
|
26
|
+
const label = stamped ? `${released ? `v${version}` : alpha ? source.ref.slice(8) : copy("source")} · ${source.commit.slice(0, 12)}${status ? ` (${status})` : ""}` : `v${version}`;
|
|
27
|
+
const href = stamped ? `https://github.com/songsid/AgEnD/commit/${source.commit}`
|
|
28
|
+
: version.includes("-") ? `${releases}/latest` : `${releases}/tag/v${version}`;
|
|
29
|
+
const detail = valid ? `${label}; ${copy("detail", version, source.commit)}` : undefined;
|
|
30
|
+
// The existing phone header has only a small version slot. No new shared CSS is needed in a cached shell.
|
|
31
|
+
const shown = alpha && stamped && narrow ? `${copy("alphaShort")}·${source.commit.slice(0, 7)}` : label;
|
|
32
|
+
return html`<a class="pill ver" href=${href} target="_blank" rel="noopener"
|
|
33
|
+
ref=${el => { if (el) el.style.paddingInline = alpha && narrow ? "2px" : ""; }}
|
|
34
|
+
title=${detail} aria-label=${detail}>${shown}</a>`;
|
|
35
|
+
}
|