@songsid/agend 2.3.5-alpha.3 → 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-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-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 +168 -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 +7 -0
- package/dist/backend/codex-footer-hints.js +41 -0
- package/dist/backend/codex-footer-hints.js.map +1 -0
- 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 +85 -24
- 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 +362 -7
- package/dist/fleet-manager.js +1522 -91
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-windows-runtime.d.ts +8 -2
- package/dist/fleet-windows-runtime.js +93 -6
- 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 +3 -3
- 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/public-web-link.d.ts +6 -0
- package/dist/public-web-link.js +9 -0
- package/dist/public-web-link.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 +106 -13
- package/dist/runtime-api.js.map +1 -1
- package/dist/runtime-build-info.d.ts +9 -0
- package/dist/runtime-build-info.js +59 -0
- package/dist/runtime-build-info.js.map +1 -0
- package/dist/runtime-bundle.d.ts +6 -1
- package/dist/runtime-bundle.js +17 -9
- package/dist/runtime-bundle.js.map +1 -1
- package/dist/runtime-cli.d.ts +13 -1
- package/dist/runtime-cli.js +173 -19
- package/dist/runtime-cli.js.map +1 -1
- package/dist/runtime-client-store.d.ts +27 -1
- package/dist/runtime-client-store.js +86 -6
- package/dist/runtime-client-store.js.map +1 -1
- package/dist/runtime-client.d.ts +74 -0
- package/dist/runtime-client.js +336 -26
- package/dist/runtime-client.js.map +1 -1
- 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 +16 -0
- package/dist/runtime-coordinator.js +287 -62
- 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-boot.d.ts +7 -0
- package/dist/runtime-pane-boot.js +23 -0
- package/dist/runtime-pane-boot.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 +30 -2
- package/dist/runtime-protocol.js +30 -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 +98 -1
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.d.ts +3 -0
- package/dist/settings-http-confirmation.js +28 -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 +68 -0
- package/dist/ui/agent-runtime.js +20 -2
- package/dist/ui/backend-signin.js +39 -21
- 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-instance-settings.js +5 -8
- package/dist/ui/native-pane-recovery.js +1 -1
- package/dist/ui/office-share-page.js +4 -2
- package/dist/ui/panel-chat.js +36 -49
- package/dist/ui/panel-details.js +1 -1
- package/dist/ui/panel-fleet.js +82 -12
- 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 +239 -45
- package/dist/ui/panel-settings.js +266 -192
- package/dist/ui/panel-windows-cli.js +88 -42
- 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-agent-filters.js +94 -0
- package/dist/ui/settings-appearance.js +122 -23
- 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 +33 -12
- package/dist/ui/settings-guests.js +25 -11
- 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 +242 -0
- package/dist/ui/settings-model.js +24 -2
- package/dist/ui/settings-outside.js +104 -38
- package/dist/ui/settings-registry.js +9 -4
- package/dist/ui/settings-shared-strings.js +143 -0
- package/dist/ui/settings-shared.js +345 -0
- package/dist/ui/settings-shortcuts.js +65 -0
- package/dist/ui/settings-strings.js +89 -32
- package/dist/ui/settings-web-authority.js +17 -11
- 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 +81 -15
- package/dist/ui/shared/app.css +1114 -13
- 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/instance-nav.js +3 -2
- package/dist/ui/shared/machine-name.js +13 -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/settings-width.js +31 -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/tokens.css +1 -0
- package/dist/ui/shared/ui-dialog.js +2 -2
- package/dist/ui/shared/ui-menu.js +3 -3
- 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/windows-cli-catalog.js +41 -12
- 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 +49 -2
- package/dist/web-api.js +279 -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 +4 -1
- package/dist/windows-agents.js +14 -10
- package/dist/windows-agents.js.map +1 -1
- package/dist/windows-cli-api.d.ts +12 -1
- package/dist/windows-cli-api.js +29 -2
- 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 +25 -0
- package/dist/windows-cli-worker.js +98 -7
- package/dist/windows-cli-worker.js.map +1 -1
- package/dist/windows-cli.d.ts +11 -0
- package/dist/windows-cli.js +17 -3
- 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
|
@@ -0,0 +1,682 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Markdown for the web chat, safe by construction: the text is HTML-escaped FIRST, and only then are a few
|
|
3
|
+
* Markdown forms turned into a fixed set of tags. Nothing in a message can produce a tag, an attribute or an
|
|
4
|
+
* event handler of its own; the only attribute that carries message text is a link's href, and only an
|
|
5
|
+
* http(s)/mailto URL gets one (rendered with target=_blank rel="noopener noreferrer").
|
|
6
|
+
*
|
|
7
|
+
* Imported by the chat panel (#1408: the import sets globalThis.AgendChatRender); also exports itself for the tests.
|
|
8
|
+
*/
|
|
9
|
+
(function (root, factory) {
|
|
10
|
+
"use strict";
|
|
11
|
+
var api = factory();
|
|
12
|
+
if (typeof module === "object" && module && module.exports) module.exports = api;
|
|
13
|
+
// The global as well: the chat imports this file for its side effect (#1408), in the browser and under the tests.
|
|
14
|
+
if (root) root.AgendChatRender = api;
|
|
15
|
+
})(typeof globalThis !== "undefined" ? globalThis : this, function () {
|
|
16
|
+
"use strict";
|
|
17
|
+
|
|
18
|
+
function escapeHtml(s) {
|
|
19
|
+
return String(s == null ? "" : s)
|
|
20
|
+
.replace(/&/g, "&")
|
|
21
|
+
.replace(/</g, "<")
|
|
22
|
+
.replace(/>/g, ">")
|
|
23
|
+
.replace(/"/g, """)
|
|
24
|
+
.replace(/'/g, "'");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** An escaped URL is linkable only with an explicit http(s)/mailto scheme; anything else stays text. */
|
|
28
|
+
function safeHref(escapedUrl) {
|
|
29
|
+
var u = escapedUrl.trim();
|
|
30
|
+
if (!/^(https?:\/\/|mailto:)[^\s]+$/i.test(u)) return null;
|
|
31
|
+
// A quote or an angle bracket is never part of a URL we link: such text stays text (it could only be an attempt).
|
|
32
|
+
if (/&(?:quot|#39|lt|gt);/.test(u)) return null;
|
|
33
|
+
// A placeholder in a URL would be expanded into markup inside the attribute: never trust one there.
|
|
34
|
+
if (u.indexOf("\u0000") !== -1) return null;
|
|
35
|
+
return u;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function link(href, label) {
|
|
39
|
+
return '<a href="' + href + '" target="_blank" rel="noopener noreferrer" data-trust="link">' + label + "</a>";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Placeholders survive the later passes untouched (they contain no Markdown characters).
|
|
43
|
+
function stash(store, html) { store.push(html); return "\u0000" + (store.length - 1) + "\u0000"; }
|
|
44
|
+
function unstash(store, s) {
|
|
45
|
+
// A stashed fragment can hold another placeholder (a `code` span inside a link label): expand until
|
|
46
|
+
// none is left. Every fragment is the renderer's own output, so this cannot introduce message markup;
|
|
47
|
+
// bounded so a malformed store cannot loop.
|
|
48
|
+
for (var pass = 0; pass < 4 && s.indexOf("\u0000") !== -1; pass++) {
|
|
49
|
+
s = s.replace(/\u0000(\d+)\u0000/g, function (_m, i) { var f = store[Number(i)]; return f === undefined ? "" : f; });
|
|
50
|
+
}
|
|
51
|
+
return s;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// #1630: a Discord server emoji, `<:name:id>` / `<a:name:id>` — escaped by now — drawn as its picture. Only an id the
|
|
55
|
+
// page knows (the fleet's servers: /ui/emojis) and only from the dashboard's own route; the src is built from the
|
|
56
|
+
// matched digits, the name (word characters only) goes into alt/title. Any other — an id the page does not know, or
|
|
57
|
+
// before the list has come — reads `:name:` (never the raw markup); so does a picture that does not load
|
|
58
|
+
// (chat-thread.js swaps it: an <img> sized to an emoji showed an empty box, the user's "tofu").
|
|
59
|
+
var EMOJI_RE = /<(a?):([A-Za-z0-9_]{2,32}):(\d{15,25})>/g;
|
|
60
|
+
function emojiImg(id, name) {
|
|
61
|
+
return '<img class="emoji" src="/ui/img/emoji/' + id + '" alt=":' + name + ':" title=":' + name + ':" decoding="async">';
|
|
62
|
+
}
|
|
63
|
+
function emojiText(name) { return '<span class="emoji-text" title=":' + name + ':">:' + name + ':</span>'; }
|
|
64
|
+
|
|
65
|
+
// #1682: Discord mentions — `<@id>` / `<@!id>` (a user), `<@&id>` (a role), `<#id>` (a channel) — escaped by now (the
|
|
66
|
+
// role's & too), drawn as a pill: the name the page knows (store.mentions(kind, id), inserted escaped), else @user /
|
|
67
|
+
// @role / #channel; never the raw token. The id is the token's own digits (title, data-mention: the page fills a
|
|
68
|
+
// name in later). And a Telegram @username (a letter, then 4–31 word characters; not part of a word, an e-mail
|
|
69
|
+
// or a path) gets the same look — no lookup, no link. It runs after the links (see inline()).
|
|
70
|
+
var MENTION_RE = /<(@!?|@&|#)(\d{15,25})>/g;
|
|
71
|
+
// Not a package or a path either: `@scope/pkg`, `@anthropic-ai/sdk` (followed by - or /) stay text.
|
|
72
|
+
var TG_MENTION_RE = /(^|[^\w@\/.&;])@([A-Za-z][A-Za-z0-9_]{4,31})(?![\w@\/-])/g;
|
|
73
|
+
var MENTION_KIND = { "@": "u", "@!": "u", "@&": "r", "#": "c" };
|
|
74
|
+
var MENTION_UNKNOWN = { u: "@user", r: "@role", c: "#channel" };
|
|
75
|
+
function mentionPill(kind, id, name) {
|
|
76
|
+
var label = name ? (kind === "c" ? "#" : "@") + escapeHtml(name) : MENTION_UNKNOWN[kind];
|
|
77
|
+
return '<span class="mention" data-mention="' + kind + ":" + id + '" title="' + id + '">' + label + "</span>";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Inline Markdown over ALREADY-ESCAPED text. */
|
|
81
|
+
function inline(escaped, store) {
|
|
82
|
+
var s = escaped;
|
|
83
|
+
// `code` first: nothing inside it is Markdown.
|
|
84
|
+
// #1812: in a table cell a path may wrap after its separators — the cell keeps words whole, so without these a long
|
|
85
|
+
// path held its whole column wide.
|
|
86
|
+
s = s.replace(/`([^`\n]+)`/g, function (_m, code) { return stash(store, "<code>" + (store.inCell ? code.replace(/\//g, "/<wbr>") : code) + "</code>"); });
|
|
87
|
+
var known = store.emojis;
|
|
88
|
+
s = s.replace(EMOJI_RE, function (_m, _a, name, id) { return stash(store, known && known(id) ? emojiImg(id, name) : emojiText(name)); });
|
|
89
|
+
var names = store.mentions;
|
|
90
|
+
s = s.replace(MENTION_RE, function (_m, sigil, id) {
|
|
91
|
+
var kind = MENTION_KIND[sigil];
|
|
92
|
+
var name = names ? names(kind, id) : null;
|
|
93
|
+
return stash(store, mentionPill(kind, id, typeof name === "string" && name ? name : null));
|
|
94
|
+
});
|
|
95
|
+
// [label](url)
|
|
96
|
+
s = s.replace(/\[([^\]\n]+)\]\(([^)\s]+)\)/g, function (m, label, url) {
|
|
97
|
+
var href = safeHref(url);
|
|
98
|
+
return href ? stash(store, link(href, emphasis(label))) : m;
|
|
99
|
+
});
|
|
100
|
+
// bare URLs
|
|
101
|
+
s = s.replace(/(^|[\s(])((?:https?:\/\/)[^\s<]+[^\s<.,;:!?)\]'"&])/g, function (m, pre, url) {
|
|
102
|
+
var href = safeHref(url);
|
|
103
|
+
return href ? pre + stash(store, link(href, url)) : m;
|
|
104
|
+
});
|
|
105
|
+
// #1682: a Telegram @username — after the links (a link is stashed by now, so an @ inside a URL is never touched).
|
|
106
|
+
s = s.replace(TG_MENTION_RE, function (_m, pre, user) { return pre + stash(store, '<span class="mention tg">@' + user + "</span>"); });
|
|
107
|
+
return emphasis(s);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Bold, strike-through and italics, over escaped text (a link's label gets them too). */
|
|
111
|
+
function emphasis(s) {
|
|
112
|
+
s = s.replace(/\*\*([^*\n]+)\*\*/g, "<strong>$1</strong>");
|
|
113
|
+
s = s.replace(/~~([^~\n]+)~~/g, "<del>$1</del>");
|
|
114
|
+
s = s.replace(/(^|[^*\w])\*([^*\s][^*\n]*?)\*(?![*\w])/g, "$1<em>$2</em>");
|
|
115
|
+
s = s.replace(/(^|[^_\w])_([^_\s][^_\n]*?)_(?![_\w])/g, "$1<em>$2</em>");
|
|
116
|
+
return s;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** How deep a list may nest: deeper items stay at the deepest level (a message cannot build an unbounded tree). */
|
|
120
|
+
var MAX_LIST_DEPTH = 6;
|
|
121
|
+
/** The widest table rendered as a table; a wider one stays text. */
|
|
122
|
+
var MAX_TABLE_COLUMNS = 20;
|
|
123
|
+
|
|
124
|
+
/** Leading whitespace as columns: a tab counts four. */
|
|
125
|
+
function indentOf(ws) { var n = 0; for (var i = 0; i < ws.length; i++) n += ws[i] === "\t" ? 4 : 1; return n; }
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* A run of list items as nested lists. An item indented deeper than the one before opens a list inside that
|
|
129
|
+
* item; a shallower one closes lists back to its level; at the same level a change of kind (- vs 1.) starts a
|
|
130
|
+
* new list. Every tag is the renderer's own; item text goes through inline() like any other text.
|
|
131
|
+
*/
|
|
132
|
+
function renderList(items, store) {
|
|
133
|
+
var html = "";
|
|
134
|
+
var stack = []; // { indent, tag }
|
|
135
|
+
for (var i = 0; i < items.length; i++) {
|
|
136
|
+
var it = items[i];
|
|
137
|
+
while (stack.length && it.indent < stack[stack.length - 1].indent) html += "</li></" + stack.pop().tag + ">";
|
|
138
|
+
var top = stack[stack.length - 1];
|
|
139
|
+
if (!top || (it.indent > top.indent && stack.length < MAX_LIST_DEPTH)) {
|
|
140
|
+
html += "<" + it.tag + ">";
|
|
141
|
+
stack.push({ indent: it.indent, tag: it.tag });
|
|
142
|
+
} else if (top.tag !== it.tag) {
|
|
143
|
+
html += "</li></" + top.tag + "><" + it.tag + ">";
|
|
144
|
+
top.tag = it.tag;
|
|
145
|
+
} else {
|
|
146
|
+
html += "</li>";
|
|
147
|
+
}
|
|
148
|
+
html += "<li>" + inline(it.text, store);
|
|
149
|
+
}
|
|
150
|
+
while (stack.length) html += "</li></" + stack.pop().tag + ">";
|
|
151
|
+
return html;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** The cells of one table row (escaped text). A leading/trailing pipe is optional; `\|` is a literal pipe. */
|
|
155
|
+
function tableCells(line) {
|
|
156
|
+
var t = line.trim();
|
|
157
|
+
if (t.charAt(0) === "|") t = t.slice(1);
|
|
158
|
+
if (t.charAt(t.length - 1) === "|" && t.charAt(t.length - 2) !== "\\") t = t.slice(0, -1);
|
|
159
|
+
var cells = [];
|
|
160
|
+
var cur = "";
|
|
161
|
+
for (var i = 0; i < t.length; i++) {
|
|
162
|
+
if (t[i] === "\\" && t[i + 1] === "|") { cur += "|"; i++; continue; }
|
|
163
|
+
if (t[i] === "|") { cells.push(cur.trim()); cur = ""; continue; }
|
|
164
|
+
cur += t[i];
|
|
165
|
+
}
|
|
166
|
+
cells.push(cur.trim());
|
|
167
|
+
return cells;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* The alignments of a separator row (`|---|:--:|--:|`), or null when the line is not one. Checked cell by cell
|
|
172
|
+
* with linear tests only (#1287 review: one regex with adjacent optional whitespace backtracked for seconds on a
|
|
173
|
+
* few KB of spaces with a bad tail, blocking the page).
|
|
174
|
+
*/
|
|
175
|
+
function tableAligns(line) {
|
|
176
|
+
if (line.indexOf("-") === -1 || !/^[\s|:-]*$/.test(line)) return null;
|
|
177
|
+
var cells = tableCells(line);
|
|
178
|
+
for (var i = 0; i < cells.length; i++) if (!/^:?-+:?$/.test(cells[i])) return null;
|
|
179
|
+
return cells.map(function (c) {
|
|
180
|
+
var l = c.charAt(0) === ":", r = c.charAt(c.length - 1) === ":";
|
|
181
|
+
return l && r ? "c" : r ? "r" : l ? "l" : "";
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function renderTable(header, aligns, rows, store) {
|
|
186
|
+
function cell(tag, text, i) {
|
|
187
|
+
var a = aligns[i] ? ' class="al-' + aligns[i] + '"' : "";
|
|
188
|
+
store.inCell = true;
|
|
189
|
+
try { return "<" + tag + a + ">" + inline(text, store) + "</" + tag + ">"; } finally { store.inCell = false; }
|
|
190
|
+
}
|
|
191
|
+
function row(tag, cells) {
|
|
192
|
+
var out = "";
|
|
193
|
+
for (var i = 0; i < aligns.length; i++) out += cell(tag, cells[i] === undefined ? "" : cells[i], i);
|
|
194
|
+
return "<tr>" + out + "</tr>";
|
|
195
|
+
}
|
|
196
|
+
return '<div class="tbl"><table><thead>' + row("th", header) + "</thead><tbody>" +
|
|
197
|
+
rows.map(function (r) { return row("td", r); }).join("") + "</tbody></table></div>";
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** Block Markdown (headings, lists, tables, quotes, rules, paragraphs) over one run of non-code text. */
|
|
201
|
+
function blocks(text, store) {
|
|
202
|
+
var lines = escapeHtml(text).split("\n");
|
|
203
|
+
var out = [];
|
|
204
|
+
var para = [];
|
|
205
|
+
var list = []; // [{ indent, tag, text }]
|
|
206
|
+
var quote = [];
|
|
207
|
+
function flushPara() { if (para.length) { out.push("<p>" + para.map(function (l) { return inline(l, store); }).join("<br>") + "</p>"); para = []; } }
|
|
208
|
+
function flushList() { if (list.length) { out.push(renderList(list, store)); list = []; } }
|
|
209
|
+
function flushQuote() { if (quote.length) { out.push("<blockquote>" + quote.map(function (l) { return inline(l, store); }).join("<br>") + "</blockquote>"); quote = []; } }
|
|
210
|
+
function flushAll() { flushPara(); flushList(); flushQuote(); }
|
|
211
|
+
for (var i = 0; i < lines.length; i++) {
|
|
212
|
+
var line = lines[i];
|
|
213
|
+
var m;
|
|
214
|
+
if (/^\s*$/.test(line)) { flushAll(); continue; }
|
|
215
|
+
// A table: a header row with a pipe, then a separator row with the same number of columns.
|
|
216
|
+
if (line.indexOf("|") !== -1 && i + 1 < lines.length) {
|
|
217
|
+
var aligns = tableAligns(lines[i + 1]);
|
|
218
|
+
var header = aligns && tableCells(line);
|
|
219
|
+
if (aligns && header.length === aligns.length && aligns.length <= MAX_TABLE_COLUMNS) {
|
|
220
|
+
flushAll();
|
|
221
|
+
var rows = [];
|
|
222
|
+
var j = i + 2;
|
|
223
|
+
for (; j < lines.length && lines[j].indexOf("|") !== -1 && !/^\s*$/.test(lines[j]); j++) rows.push(tableCells(lines[j]));
|
|
224
|
+
out.push(renderTable(header, aligns, rows, store));
|
|
225
|
+
i = j - 1;
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if ((m = /^(#{1,6})\s+(.*)$/.exec(line))) { flushAll(); var n = Math.min(m[1].length + 2, 6); out.push("<h" + n + ">" + inline(m[2], store) + "</h" + n + ">"); continue; }
|
|
230
|
+
if (/^\s*(?:-{3,}|\*{3,}|_{3,})\s*$/.test(line)) { flushAll(); out.push("<hr>"); continue; }
|
|
231
|
+
if ((m = /^>\s?(.*)$/.exec(line))) { flushPara(); flushList(); quote.push(m[1]); continue; }
|
|
232
|
+
if ((m = /^([ \t]*)([-*+]|\d{1,9}[.)])\s+(.*)$/.exec(line))) {
|
|
233
|
+
flushPara(); flushQuote();
|
|
234
|
+
list.push({ indent: indentOf(m[1]), tag: /\d/.test(m[2]) ? "ol" : "ul", text: m[3] });
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
flushList(); flushQuote();
|
|
238
|
+
para.push(line);
|
|
239
|
+
}
|
|
240
|
+
flushAll();
|
|
241
|
+
return out.join("");
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// ── Code highlighting: a small tokenizer, never a library. Every token is escaped and wrapped in one of four
|
|
245
|
+
// fixed classes; what is not recognised stays plain escaped text. Unknown languages are not highlighted. ──
|
|
246
|
+
var KEYWORDS = {
|
|
247
|
+
js: "break case catch class const continue default delete do else export extends false finally for function if import in instanceof let new null of return static super switch this throw true try typeof undefined var void while yield async await",
|
|
248
|
+
py: "and as assert async await break class continue def del elif else except False finally for from global if import in is lambda None nonlocal not or pass raise return True try while with yield",
|
|
249
|
+
sh: "if then else elif fi for while until do done case esac function in return local export set unset echo exit",
|
|
250
|
+
json: "true false null"
|
|
251
|
+
};
|
|
252
|
+
KEYWORDS.ts = KEYWORDS.js + " interface type enum implements private public protected readonly declare namespace keyof as";
|
|
253
|
+
var LANG_ALIAS = { javascript: "js", jsx: "js", mjs: "js", cjs: "js", typescript: "ts", tsx: "ts", python: "py", bash: "sh", shell: "sh", zsh: "sh", console: "sh" };
|
|
254
|
+
var TOKEN_RE = {
|
|
255
|
+
// An unclosed string or comment runs to the end of its line (or of the code): it matches once instead of
|
|
256
|
+
// failing and being re-scanned from every later quote, which made a run of unclosed quotes quadratic.
|
|
257
|
+
js: /(\/\/[^\n]*|\/\*[\s\S]*?(?:\*\/|$))|("(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?|`(?:[^`\\]|\\.)*`?)|(\b\d+(?:\.\d+)?\b)|([A-Za-z_$][\w$]*)/g,
|
|
258
|
+
py: /(#[^\n]*)|("""[\s\S]*?(?:"""|$)|'''[\s\S]*?(?:'''|$)|"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?)|(\b\d+(?:\.\d+)?\b)|([A-Za-z_]\w*)/g,
|
|
259
|
+
sh: /(#[^\n]*)|("(?:[^"\\]|\\.)*"?|'[^']*'?)|(\b\d+\b)|([A-Za-z_][\w-]*)/g,
|
|
260
|
+
json: /(\u0001)|("(?:[^"\\\n]|\\.)*"?)|(-?\b\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b)|([A-Za-z_]\w*)/g
|
|
261
|
+
};
|
|
262
|
+
TOKEN_RE.ts = TOKEN_RE.js;
|
|
263
|
+
|
|
264
|
+
/** Code as highlighted HTML for a known language, or null (then the caller escapes it as before). */
|
|
265
|
+
function highlight(code, lang) {
|
|
266
|
+
var key = String(lang || "").toLowerCase();
|
|
267
|
+
if (Object.prototype.hasOwnProperty.call(LANG_ALIAS, key)) key = LANG_ALIAS[key];
|
|
268
|
+
if (!Object.prototype.hasOwnProperty.call(TOKEN_RE, key)) return null;
|
|
269
|
+
var words = {};
|
|
270
|
+
KEYWORDS[key].split(" ").forEach(function (w) { words[w] = true; });
|
|
271
|
+
var re = new RegExp(TOKEN_RE[key].source, "g");
|
|
272
|
+
var out = "";
|
|
273
|
+
var last = 0;
|
|
274
|
+
var m;
|
|
275
|
+
while ((m = re.exec(code)) !== null) {
|
|
276
|
+
if (m[0] === "") { re.lastIndex++; continue; }
|
|
277
|
+
out += escapeHtml(code.slice(last, m.index));
|
|
278
|
+
var cls = m[1] ? "tk-c" : m[2] ? "tk-s" : m[3] ? "tk-n" : (m[4] && Object.prototype.hasOwnProperty.call(words, m[4])) ? "tk-k" : null;
|
|
279
|
+
out += cls ? '<span class="' + cls + '">' + escapeHtml(m[0]) + "</span>" : escapeHtml(m[0]);
|
|
280
|
+
last = re.lastIndex;
|
|
281
|
+
}
|
|
282
|
+
return out + escapeHtml(code.slice(last));
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// A fenced code block: ```lang …``` — or unterminated to the end of the text (what a length cut leaves).
|
|
286
|
+
var FENCE_RE = /```([A-Za-z0-9_+.-]{0,32})[^\n]*\n([\s\S]*?)(?:```|$)/g;
|
|
287
|
+
function isHtmlLang(lang) { return String(lang || "").toLowerCase() === "html"; }
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* The ```html fences of a message, in order (#1306): each one's code, and whether it was closed. The n-th entry is
|
|
291
|
+
* the card renderMarkdown(text, { htmlCards: true }) numbered n. Only `html` exactly (any case) — not html5, xhtml, htm.
|
|
292
|
+
*/
|
|
293
|
+
function htmlFences(text) {
|
|
294
|
+
var src = String(text == null ? "" : text).replace(/\r\n?/g, "\n").replace(/\u0000/g, "");
|
|
295
|
+
var re = new RegExp(FENCE_RE.source, "g");
|
|
296
|
+
var out = [];
|
|
297
|
+
var m;
|
|
298
|
+
while ((m = re.exec(src)) !== null) {
|
|
299
|
+
if (isHtmlLang(m[1])) out.push({ code: m[2].replace(/\n$/, ""), terminated: m[0].slice(-3) === "```" });
|
|
300
|
+
if (m[0].length === 0) break;
|
|
301
|
+
}
|
|
302
|
+
return out;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* The whole message: fenced code blocks verbatim (escaped), everything else as Markdown. With { htmlCards: true }
|
|
307
|
+
* (only ever for a message the server marked `agent` — #1306), each ```html fence is followed by an empty card
|
|
308
|
+
* placeholder <div class="html-card" data-card="n">, or — for a fence a cut left open — one marked "truncated",
|
|
309
|
+
* which gets no Preview. No text of the HTML goes into an attribute: the page reads it from the message, by n.
|
|
310
|
+
*/
|
|
311
|
+
function renderMarkdown(text, opts) {
|
|
312
|
+
var cards = !!(opts && opts.htmlCards);
|
|
313
|
+
var src = String(text == null ? "" : text).replace(/\r\n?/g, "\n").replace(/\u0000/g, ""); // \u0000 is the placeholder mark
|
|
314
|
+
var store = [];
|
|
315
|
+
// #1630: which server emoji ids the page knows (a function id → boolean); without it every `<:name:id>` stays text.
|
|
316
|
+
store.emojis = opts && typeof opts.emojis === "function" ? opts.emojis : null;
|
|
317
|
+
// #1682: the names the page knows for mentions (a function (kind "u" | "r" | "c", id) → name or null).
|
|
318
|
+
store.mentions = opts && typeof opts.mentions === "function" ? opts.mentions : null;
|
|
319
|
+
var html = "";
|
|
320
|
+
var re = new RegExp(FENCE_RE.source, "g");
|
|
321
|
+
var last = 0;
|
|
322
|
+
var n = 0;
|
|
323
|
+
var m;
|
|
324
|
+
while ((m = re.exec(src)) !== null) {
|
|
325
|
+
html += blocks(src.slice(last, m.index), store);
|
|
326
|
+
var lang = m[1] ? ' data-lang="' + escapeHtml(m[1]) + '"' : "";
|
|
327
|
+
var code = m[2].replace(/\n$/, "");
|
|
328
|
+
var lit = highlight(code, m[1]);
|
|
329
|
+
html += "<pre" + lang + "><code>" + (lit === null ? escapeHtml(code) : lit) + "</code></pre>";
|
|
330
|
+
if (cards && isHtmlLang(m[1])) {
|
|
331
|
+
html += '<div class="html-card' + (m[0].slice(-3) === "```" ? "" : " truncated") + '" data-card="' + n + '"></div>';
|
|
332
|
+
n++;
|
|
333
|
+
}
|
|
334
|
+
last = re.lastIndex;
|
|
335
|
+
if (m[0].length === 0) break;
|
|
336
|
+
}
|
|
337
|
+
html += blocks(src.slice(last), store);
|
|
338
|
+
return unstash(store, html);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* The chat's message list after `incoming` arrives (history, a live SSE message or an SSE replay): one entry per
|
|
343
|
+
* id, in id order, the newest `cap` kept. The same message can arrive twice — from /ui/history and from the
|
|
344
|
+
* stream — and must show once.
|
|
345
|
+
*/
|
|
346
|
+
function buttonsRank(b) { return b && b.state !== "open" ? 1 : 0; }
|
|
347
|
+
/**
|
|
348
|
+
* Whether `next` is an older view than `had` of the same buttons: they only go forward (open → ended), and a poll's
|
|
349
|
+
* views (#1823), which change while it is open, by their `rev`.
|
|
350
|
+
*/
|
|
351
|
+
function olderButtons(next, had) {
|
|
352
|
+
var d = buttonsRank(next) - buttonsRank(had);
|
|
353
|
+
if (d) return d < 0;
|
|
354
|
+
return !!(next && had && next.poll && had.poll && next.poll.rev < had.poll.rev);
|
|
355
|
+
}
|
|
356
|
+
/** #1823: a poll's time left, counted down by the page every second: m:ss, or h:mm:ss. */
|
|
357
|
+
function pollRemaining(ms) {
|
|
358
|
+
var s = Math.max(0, Math.ceil(ms / 1000));
|
|
359
|
+
var h = Math.floor(s / 3600), m = Math.floor((s % 3600) / 60), r = s % 60;
|
|
360
|
+
var mm = h ? String(m).padStart(2, "0") : String(m);
|
|
361
|
+
return (h ? h + ":" : "") + mm + ":" + String(r).padStart(2, "0");
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* #1266: a reply's buttons changed (one was chosen, or they expired): the message carrying them, by its set id.
|
|
365
|
+
* Returns the list unchanged when no message carries that set.
|
|
366
|
+
*/
|
|
367
|
+
function applyReplyButtons(list, buttons) {
|
|
368
|
+
if (!Array.isArray(list) || !buttons || typeof buttons.id !== "string") return list;
|
|
369
|
+
var i = -1;
|
|
370
|
+
for (var j = list.length - 1; j >= 0; j--) if (list[j] && list[j].buttons && list[j].buttons.id === buttons.id) { i = j; break; }
|
|
371
|
+
if (i < 0 || olderButtons(buttons, list[i].buttons)) return list;
|
|
372
|
+
var out = list.slice();
|
|
373
|
+
out[i] = Object.assign({}, list[i], { buttons: buttons });
|
|
374
|
+
return out;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function mergeMessages(existing, incoming, cap) {
|
|
378
|
+
var seen = {};
|
|
379
|
+
var out = [];
|
|
380
|
+
// Ids restart with every fleet process; the boot generation makes them an identity again.
|
|
381
|
+
function key(m) { return String(m.boot || "") + ":" + m.id; }
|
|
382
|
+
function add(m) {
|
|
383
|
+
if (!m || typeof m.id !== "number") return;
|
|
384
|
+
var k = key(m);
|
|
385
|
+
if (seen[k] !== undefined) {
|
|
386
|
+
// The same message again (history after the stream): the copy that got further shows its ticks.
|
|
387
|
+
var had = out[seen[k]];
|
|
388
|
+
var next = nextDeliveryState(had.delivery, m.delivery);
|
|
389
|
+
if (next !== had.delivery) out[seen[k]] = had = Object.assign({}, had, { delivery: next });
|
|
390
|
+
// #1266: …and the copy whose buttons got further (open → chosen / expired) shows them.
|
|
391
|
+
if (m.buttons && (!had.buttons || buttonsRank(m.buttons) > buttonsRank(had.buttons) || (buttonsRank(m.buttons) === buttonsRank(had.buttons) && m.buttons.poll && had.buttons.poll && m.buttons.poll.rev > had.buttons.poll.rev))) out[seen[k]] = Object.assign({}, had, { buttons: m.buttons });
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
seen[k] = out.length;
|
|
395
|
+
out.push(m);
|
|
396
|
+
}
|
|
397
|
+
(existing || []).forEach(add);
|
|
398
|
+
(incoming || []).forEach(add);
|
|
399
|
+
// Within one boot the id is the order; across boots (a restart) the time is.
|
|
400
|
+
out.sort(function (a, b) {
|
|
401
|
+
if ((a.boot || "") === (b.boot || "")) return a.id - b.id;
|
|
402
|
+
var ta = String(a.ts || ""), tb = String(b.ts || "");
|
|
403
|
+
return ta < tb ? -1 : ta > tb ? 1 : 0;
|
|
404
|
+
});
|
|
405
|
+
var limit = typeof cap === "number" && cap > 0 ? cap : 500;
|
|
406
|
+
return out.length > limit ? out.slice(out.length - limit) : out;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* The delivery ticks of a web user's message (web track C3) — the same order the fleet keeps
|
|
411
|
+
* (web-chat-history.ts nextDeliveryState): a report that arrives late or twice never moves a tick back;
|
|
412
|
+
* delivered and failed are final, cancelled gives way to what the agent actually got.
|
|
413
|
+
*/
|
|
414
|
+
var DELIVERY_RANK = { queued: 1, processing: 2, cancelled: 3, delivered: 4, failed: 4 };
|
|
415
|
+
function nextDeliveryState(prev, next) {
|
|
416
|
+
if (!Object.prototype.hasOwnProperty.call(DELIVERY_RANK, next)) return prev;
|
|
417
|
+
if (prev === undefined || !Object.prototype.hasOwnProperty.call(DELIVERY_RANK, prev)) return next;
|
|
418
|
+
return DELIVERY_RANK[next] > DELIVERY_RANK[prev] ? next : prev;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/** The list after a delivery report for `messageId`: the same list when nothing moved, else a copy. */
|
|
422
|
+
function applyDelivery(list, messageId, delivery) {
|
|
423
|
+
var msgs = list || [];
|
|
424
|
+
for (var i = msgs.length - 1; i >= 0; i--) {
|
|
425
|
+
if (!msgs[i] || msgs[i].messageId !== messageId) continue;
|
|
426
|
+
var next = nextDeliveryState(msgs[i].delivery, delivery);
|
|
427
|
+
if (next === msgs[i].delivery) return msgs;
|
|
428
|
+
var out = msgs.slice();
|
|
429
|
+
out[i] = Object.assign({}, msgs[i], { delivery: next });
|
|
430
|
+
return out;
|
|
431
|
+
}
|
|
432
|
+
return msgs;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* #2305: the list after a reactions update for the row `boot`/`id` (the instance's reactions — its minimal reply): the
|
|
437
|
+
* same list when nothing changed, else a copy. At most 8 distinct short strings are taken; the server sent them.
|
|
438
|
+
*/
|
|
439
|
+
function applyReactions(list, boot, id, reactions) {
|
|
440
|
+
var msgs = list || [];
|
|
441
|
+
if (!Array.isArray(reactions)) return msgs;
|
|
442
|
+
var clean = [];
|
|
443
|
+
for (var j = 0; j < reactions.length && clean.length < 8; j++) {
|
|
444
|
+
var e = reactions[j];
|
|
445
|
+
if (typeof e === "string" && e.length > 0 && e.length <= 16 && clean.indexOf(e) < 0) clean.push(e);
|
|
446
|
+
}
|
|
447
|
+
for (var i = msgs.length - 1; i >= 0; i--) {
|
|
448
|
+
if (!msgs[i] || msgs[i].boot !== boot || msgs[i].id !== id) continue;
|
|
449
|
+
var had = msgs[i].reactions || [];
|
|
450
|
+
var same = had.length === clean.length;
|
|
451
|
+
for (var k = 0; same && k < had.length; k++) if (had[k] !== clean[k]) same = false;
|
|
452
|
+
if (same) return msgs;
|
|
453
|
+
var out = msgs.slice();
|
|
454
|
+
out[i] = Object.assign({}, msgs[i], { reactions: clean });
|
|
455
|
+
return out;
|
|
456
|
+
}
|
|
457
|
+
return msgs;
|
|
458
|
+
}
|
|
459
|
+
/** #2305: an emoji drawn as one — a heart, ☃, ✍ and the like have a text form unless U+FE0F follows. */
|
|
460
|
+
function emojiForm(e) { return /\p{Emoji_Presentation}/u.test(e) ? e : e + "\uFE0F"; }
|
|
461
|
+
/** #2305: a message's reactions under its bubble, labelled for a screen reader (`label`: who reacted); "" when none. */
|
|
462
|
+
function reactionsHtml(reactions, label) {
|
|
463
|
+
if (!Array.isArray(reactions) || !reactions.length) return "";
|
|
464
|
+
var items = "";
|
|
465
|
+
for (var i = 0; i < reactions.length; i++) {
|
|
466
|
+
if (typeof reactions[i] !== "string") continue;
|
|
467
|
+
items += '<span class="reaction" role="img" aria-label="' + escapeHtml(reactions[i]) + '">' + escapeHtml(emojiForm(reactions[i])) + "</span>";
|
|
468
|
+
}
|
|
469
|
+
var l = escapeHtml(label || "");
|
|
470
|
+
return items ? '<div class="msg-reactions" role="group" aria-label="' + l + '" title="' + l + '">' + items + "</div>" : "";
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
var TICK_GLYPH = { queued: "◷", processing: "✓", delivered: "✓✓", failed: "!", cancelled: "⊘" };
|
|
474
|
+
/** The ticks for one state, labelled for a screen reader as well as a pointer; "" when there is none. */
|
|
475
|
+
function deliveryHtml(state, labels) {
|
|
476
|
+
if (!Object.prototype.hasOwnProperty.call(TICK_GLYPH, state)) return "";
|
|
477
|
+
var label = escapeHtml((labels && labels[state]) || state);
|
|
478
|
+
return '<span class="tick tick-' + state + '" role="img" aria-label="' + label + '" title="' + label + '">' + TICK_GLYPH[state] + "</span>";
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* Whether a scrolled list counts as "at the bottom" (#1307): within `slack` px of it. Only then does a new message
|
|
483
|
+
* pull the view down; a reader who scrolled up stays where they are.
|
|
484
|
+
*/
|
|
485
|
+
function isNearBottom(scrollTop, clientHeight, scrollHeight, slack) {
|
|
486
|
+
return Number(scrollHeight) - Number(scrollTop) - Number(clientHeight) <= (slack == null ? 48 : slack);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/** A paste longer than this many characters becomes a text file instead of filling the composer (#1307; 4,000 per #1269). */
|
|
490
|
+
var LONG_PASTE_CHARS = 4000;
|
|
491
|
+
function isLongPaste(text) { return typeof text === "string" && text.length > LONG_PASTE_CHARS; }
|
|
492
|
+
|
|
493
|
+
/** How long a turn has run, as m:ss (h:mm:ss past an hour); never negative. */
|
|
494
|
+
function formatElapsed(ms) {
|
|
495
|
+
var t = Math.max(0, Math.floor((Number(ms) || 0) / 1000));
|
|
496
|
+
var h = Math.floor(t / 3600), m = Math.floor((t % 3600) / 60), sec = t % 60;
|
|
497
|
+
var two = function (n) { return (n < 10 ? "0" : "") + n; };
|
|
498
|
+
return h ? h + ":" + two(m) + ":" + two(sec) : m + ":" + two(sec);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/** A code block longer than this many lines is folded until it is opened. */
|
|
502
|
+
var CODE_FOLD_LINES = 30;
|
|
503
|
+
/** Lines in a block of code (a trailing newline does not start another). */
|
|
504
|
+
function lineCount(code) {
|
|
505
|
+
var s = String(code == null ? "" : code).replace(/\n$/, "");
|
|
506
|
+
return s === "" ? 0 : s.split("\n").length;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/** Whether the chat shows "working" and its Stop button for an instance in this execution state. */
|
|
510
|
+
function isBusy(state) { return state === "working" || state === "stuck"; }
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* What a key in the composer does: Enter sends, Shift+Enter is a new line, nothing happens mid-IME-composition.
|
|
514
|
+
* #2478 (the user's request): on a touch screen (a coarse pointer) Return is a new line — the Send button sends.
|
|
515
|
+
*/
|
|
516
|
+
function composerKey(ev, opts) {
|
|
517
|
+
if (!ev || ev.key !== "Enter" || ev.isComposing || ev.keyCode === 229) return "none";
|
|
518
|
+
if (opts && opts.touch) return "newline";
|
|
519
|
+
if (ev.shiftKey || ev.altKey || ev.ctrlKey || ev.metaKey) return "newline";
|
|
520
|
+
return "send";
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/** The defaults of the upload limits the server enforces (web-upload.ts UPLOAD_LIMITS), for a page that was given none. */
|
|
524
|
+
var FILE_LIMITS = { maxFileBytes: 50 * 1024 * 1024, maxFiles: 5, maxTotalBytes: 100 * 1024 * 1024 };
|
|
525
|
+
/**
|
|
526
|
+
* #1937: the limits in force for this page — the server's (web.upload_max_file_mb / _total_mb, and the public link's
|
|
527
|
+
* own cap), on <body data-upload-limits>. Checked here first only to say so early: the server checks every upload.
|
|
528
|
+
*/
|
|
529
|
+
function fileLimits() {
|
|
530
|
+
try {
|
|
531
|
+
var raw = JSON.parse(document.body.dataset.uploadLimits || "null");
|
|
532
|
+
var ok = function (n) { return typeof n === "number" && isFinite(n) && n > 0; };
|
|
533
|
+
if (raw && ok(raw.maxFileBytes) && ok(raw.maxFiles) && ok(raw.maxTotalBytes)) {
|
|
534
|
+
return { maxFileBytes: raw.maxFileBytes, maxFiles: raw.maxFiles, maxTotalBytes: raw.maxTotalBytes, publicLinkCapped: raw.publicLinkCapped === true };
|
|
535
|
+
}
|
|
536
|
+
} catch (e) { /* no page, or no limits on it */ }
|
|
537
|
+
return { maxFileBytes: FILE_LIMITS.maxFileBytes, maxFiles: FILE_LIMITS.maxFiles, maxTotalBytes: FILE_LIMITS.maxTotalBytes, publicLinkCapped: false };
|
|
538
|
+
}
|
|
539
|
+
/** A size in MB as the limits are worded ("50", "2.5") — web-upload.ts mbText. */
|
|
540
|
+
function mbText(bytes) { return String(Math.round((bytes / 1024 / 1024) * 10) / 10); }
|
|
541
|
+
/** #1937: the words for a file checkFiles() refused — a chat string key and the numbers it says, from fileLimits(). */
|
|
542
|
+
function fileRejection(reason) {
|
|
543
|
+
var l = fileLimits();
|
|
544
|
+
if (reason === "too-large") return { key: l.publicLinkCapped ? "chat.file_too_large_public" : "chat.file_too_large", values: [mbText(l.maxFileBytes)] };
|
|
545
|
+
if (reason === "too-many") return { key: "chat.file_too_many", values: [l.maxFiles] };
|
|
546
|
+
if (reason === "too-much") return { key: "chat.file_too_much", values: [mbText(l.maxTotalBytes)] };
|
|
547
|
+
return { key: "chat.file_" + String(reason).replace(/-/g, "_"), values: [] };
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function formatSize(n) {
|
|
551
|
+
var b = Number(n) || 0;
|
|
552
|
+
if (b < 1024) return b + " B";
|
|
553
|
+
if (b < 1024 * 1024) return (b / 1024).toFixed(b < 10 * 1024 ? 1 : 0) + " KB";
|
|
554
|
+
return (b / 1024 / 1024).toFixed(1) + " MB";
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* Which of `adding` can join `pending` on one message: within the count, per-file and total limits.
|
|
559
|
+
* Returns the files kept (pending first, then the accepted new ones) and, for each refused one, why.
|
|
560
|
+
*/
|
|
561
|
+
function checkFiles(pending, adding) {
|
|
562
|
+
var limits = fileLimits();
|
|
563
|
+
var kept = (pending || []).slice();
|
|
564
|
+
var total = 0;
|
|
565
|
+
kept.forEach(function (f) { total += Number(f.size) || 0; });
|
|
566
|
+
var rejected = [];
|
|
567
|
+
(adding || []).forEach(function (f) {
|
|
568
|
+
var size = Number(f.size) || 0;
|
|
569
|
+
if (size === 0) rejected.push({ name: f.name, reason: "empty" });
|
|
570
|
+
else if (size > limits.maxFileBytes) rejected.push({ name: f.name, reason: "too-large" });
|
|
571
|
+
else if (kept.length >= limits.maxFiles) rejected.push({ name: f.name, reason: "too-many" });
|
|
572
|
+
else if (total + size > limits.maxTotalBytes) rejected.push({ name: f.name, reason: "too-much" });
|
|
573
|
+
else { kept.push(f); total += size; }
|
|
574
|
+
});
|
|
575
|
+
return { kept: kept, rejected: rejected };
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
/** #1306 §6.1 (Q4): an attachment a preview card is offered for — a fleet-issued id, a non-image named *.html / *.htm. */
|
|
579
|
+
function isHtmlAttachment(a) {
|
|
580
|
+
return !!a && typeof a.id === "string" && /^[0-9a-f]{32}$/.test(a.id) && a.kind !== "photo" && typeof a.name === "string" && /\.html?$/i.test(a.name.trim());
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* #1589: how an attachment is shown inline, by its name (agents' files carry their extension; uploads keep theirs):
|
|
585
|
+
* "video" / "audio" (native controls, by id), "md", "csv" / "tsv", "json", "code:<lang>", "text" — or null (a
|
|
586
|
+
* download only: an image, an .html file, a PDF, anything else). Text is always shown escaped, never run.
|
|
587
|
+
*/
|
|
588
|
+
var MEDIA_EXT = { mp4: "video", m4v: "video", webm: "video", mov: "video", mp3: "audio", m4a: "audio", wav: "audio", ogg: "audio", oga: "audio", opus: "audio" };
|
|
589
|
+
var CODE_EXT = { js: "js", jsx: "js", mjs: "js", cjs: "js", ts: "ts", tsx: "ts", py: "py", sh: "sh", bash: "sh", zsh: "sh" };
|
|
590
|
+
var TEXT_EXT = { txt: 1, log: 1, toml: 1, yaml: 1, yml: 1, ini: 1, cfg: 1, conf: 1, xml: 1, diff: 1, patch: 1, sql: 1, css: 1, scss: 1, go: 1, rs: 1,
|
|
591
|
+
java: 1, kt: 1, c: 1, h: 1, cc: 1, cpp: 1, hpp: 1, rb: 1, php: 1, swift: 1, jsonl: 1 };
|
|
592
|
+
function attachmentPreviewType(a) {
|
|
593
|
+
if (!a || a.gone === true || typeof a.id !== "string" || !/^[0-9a-f]{32}$/.test(a.id) || a.kind === "photo" || typeof a.name !== "string") return null;
|
|
594
|
+
var m = /\.([A-Za-z0-9]{1,8})$/.exec(a.name.trim());
|
|
595
|
+
var ext = m ? m[1].toLowerCase() : "";
|
|
596
|
+
if (Object.prototype.hasOwnProperty.call(MEDIA_EXT, ext)) return MEDIA_EXT[ext];
|
|
597
|
+
if (ext === "md" || ext === "markdown") return "md";
|
|
598
|
+
if (ext === "csv" || ext === "tsv") return ext;
|
|
599
|
+
if (ext === "json") return "json";
|
|
600
|
+
if (Object.prototype.hasOwnProperty.call(CODE_EXT, ext)) return "code:" + CODE_EXT[ext];
|
|
601
|
+
if (Object.prototype.hasOwnProperty.call(TEXT_EXT, ext)) return "text";
|
|
602
|
+
return null;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* The files shown with a message. Only an id the fleet issued (32 hex) becomes a URL, and only under
|
|
607
|
+
* /ui/file/; a name is text. Images are shown (and open full size), other files are download links.
|
|
608
|
+
* With { htmlCards: true } (a server-marked agent reply, as for renderMarkdown) each .html/.htm file also gets an
|
|
609
|
+
* empty card placeholder <div class="html-card" data-att="<id>"> after the list — the id is 32 hex, nothing else.
|
|
610
|
+
*/
|
|
611
|
+
// The box a photo is drawn in (app.css: .msg .att-img img, max 260 × 220): its own size, scaled down to fit.
|
|
612
|
+
var PHOTO_MAX_W = 260, PHOTO_MAX_H = 220;
|
|
613
|
+
/**
|
|
614
|
+
* #2184: a photo's drawn size as width/height attributes, from the size the server read from its headers: the box is there
|
|
615
|
+
* before the picture loads, so the text around it never moves when it does (a chat opened cold jittered, as each
|
|
616
|
+
* photo grew from nothing). Nothing when the size is not known (drawn as before).
|
|
617
|
+
*/
|
|
618
|
+
function photoBox(a) {
|
|
619
|
+
var w = a.width, h = a.height;
|
|
620
|
+
var ok = function (v) { return typeof v === "number" && v >= 1 && v <= 65535 && Math.floor(v) === v; };
|
|
621
|
+
if (!ok(w) || !ok(h)) return "";
|
|
622
|
+
var k = Math.min(1, PHOTO_MAX_W / w, PHOTO_MAX_H / h);
|
|
623
|
+
return ' width="' + Math.max(1, Math.round(w * k)) + '" height="' + Math.max(1, Math.round(h * k)) + '"';
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Hub PR A (#3226): where a file is read. The Hub's files carry their own room-scoped `url`; it is used only when it is a
|
|
628
|
+
* plain same-origin path (a leading "/", then letters, digits, "_-./" only: no "//", no "..", nothing to escape), else the
|
|
629
|
+
* fleet's /ui/file/<id> as always. The id is still the 32-hex one every file has (the Hub issues the same kind).
|
|
630
|
+
*/
|
|
631
|
+
var SAFE_FILE_PATH = /^\/(?!\/)[A-Za-z0-9_\-.\/]{1,256}$/;
|
|
632
|
+
function attachmentUrl(a) {
|
|
633
|
+
var u = a && a.url;
|
|
634
|
+
if (typeof u === "string" && SAFE_FILE_PATH.test(u) && !/(^|\/)\.\.?(\/|$)/.test(u)) return u;
|
|
635
|
+
return "/ui/file/" + a.id;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
function attachmentsHtml(attachments, opts) {
|
|
639
|
+
if (!Array.isArray(attachments)) return "";
|
|
640
|
+
var cards = !!(opts && opts.htmlCards);
|
|
641
|
+
// #1589: { inlinePreviews: true } (not on the public link) plays media and offers text inline, after the file list.
|
|
642
|
+
// #2547: { textPreviews: true } offers the text cards (Markdown, CSV/TSV, JSON, code, text) on the public link too:
|
|
643
|
+
// the same capped, same-origin read and the same rendering (nothing in the file ever runs); media stays local.
|
|
644
|
+
var inline = !!(opts && opts.inlinePreviews), texts = inline || !!(opts && opts.textPreviews);
|
|
645
|
+
var out = [], after = [];
|
|
646
|
+
attachments.forEach(function (a) {
|
|
647
|
+
// #1565: a file from before the fleet restarted that could not be served again — its name, marked unavailable;
|
|
648
|
+
// no link (it has no id), no card.
|
|
649
|
+
if (a && a.gone === true && typeof a.name === "string") {
|
|
650
|
+
out.push('<span class="att-file att-gone"' + (opts && opts.goneTitle ? ' title="' + escapeHtml(opts.goneTitle) + '"' : "") + ">📎 " + escapeHtml(a.name) + ' <span class="att-size">' + escapeHtml(opts && opts.goneLabel ? opts.goneLabel : formatSize(a.size)) + "</span></span>");
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
if (!a || typeof a.id !== "string" || !/^[0-9a-f]{32}$/.test(a.id)) return;
|
|
654
|
+
if (cards && isHtmlAttachment(a)) after.push('<div class="html-card" data-att="' + a.id + '"></div>');
|
|
655
|
+
var url = attachmentUrl(a);
|
|
656
|
+
var kind = texts ? attachmentPreviewType(a) : null;
|
|
657
|
+
if ((kind === "video" || kind === "audio") && !inline) kind = null;
|
|
658
|
+
if (kind === "video") after.push('<div data-trust="media" class="att-media"><video class="att-video" controls preload="metadata" src="' + url + '"></video></div>');
|
|
659
|
+
else if (kind === "audio") after.push('<div data-trust="media" class="att-media"><audio class="att-audio" controls preload="metadata" src="' + url + '"></audio></div>');
|
|
660
|
+
else if (kind) after.push('<div class="text-card" data-att="' + a.id + '" data-type="' + kind + '"></div>');
|
|
661
|
+
var name = escapeHtml(a.name || "file");
|
|
662
|
+
if (a.kind === "photo") {
|
|
663
|
+
out.push('<a class="att-img" href="' + url + '" target="_blank" rel="noopener noreferrer"><img src="' + url + '" alt="' + name + '"' + photoBox(a) + ' loading="lazy"></a>');
|
|
664
|
+
} else {
|
|
665
|
+
out.push('<a class="att-file" href="' + url + '" download="' + name + '">📎 ' + name + ' <span class="att-size">' + escapeHtml(formatSize(a.size)) + "</span></a>");
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
return (out.length ? '<div data-trust="attachment" class="atts">' + out.join("") + "</div>" : "") + after.join("");
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
return {
|
|
672
|
+
renderMarkdown: renderMarkdown, escapeHtml: escapeHtml, attachmentUrl: attachmentUrl, mergeMessages: mergeMessages, applyReplyButtons: applyReplyButtons, composerKey: composerKey,
|
|
673
|
+
pollRemaining: pollRemaining,
|
|
674
|
+
|
|
675
|
+
FILE_LIMITS: FILE_LIMITS, fileLimits: fileLimits, fileRejection: fileRejection, formatSize: formatSize, checkFiles: checkFiles, attachmentsHtml: attachmentsHtml, isHtmlAttachment: isHtmlAttachment,
|
|
676
|
+
nextDeliveryState: nextDeliveryState, applyDelivery: applyDelivery, deliveryHtml: deliveryHtml, isBusy: isBusy,
|
|
677
|
+
applyReactions: applyReactions, reactionsHtml: reactionsHtml,
|
|
678
|
+
isNearBottom: isNearBottom, CODE_FOLD_LINES: CODE_FOLD_LINES, lineCount: lineCount,
|
|
679
|
+
LONG_PASTE_CHARS: LONG_PASTE_CHARS, isLongPaste: isLongPaste, formatElapsed: formatElapsed,
|
|
680
|
+
htmlFences: htmlFences, attachmentPreviewType: attachmentPreviewType, highlight: highlight,
|
|
681
|
+
};
|
|
682
|
+
});
|