clay-server 5.1.1-beta.1 → 5.2.0-beta.10
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/lib/account-auth-policy.js +21 -0
- package/lib/account-auth-socket.js +30 -0
- package/lib/account-auth-throttle.js +44 -0
- package/lib/account-auth-transport.js +48 -0
- package/lib/account-login-page.js +28 -0
- package/lib/account-passkey-challenges.js +31 -0
- package/lib/account-passkey-page.js +89 -0
- package/lib/account-passkey-policy.js +39 -0
- package/lib/account-password-page.js +69 -0
- package/lib/account-passwords.js +36 -0
- package/lib/account-remembered.js +77 -0
- package/lib/account-session-page.js +51 -0
- package/lib/account-session-store.js +82 -0
- package/lib/builtin-mates.js +19 -16
- package/lib/bundled-skills/clay-agent-browser/SKILL.md +6 -2
- package/lib/canonical-clay-record-authority.js +15 -0
- package/lib/canonical-clay-scheduling-authority.js +19 -0
- package/lib/claude-hook-installer.js +1 -239
- package/lib/claude-jsonl-watcher.js +1 -204
- package/lib/clay-control-presentation-binding.js +96 -0
- package/lib/clay-control-presentation.js +128 -0
- package/lib/clay-control-target-projection.js +26 -0
- package/lib/clay-mate-chat-receipts.js +26 -0
- package/lib/clay-mate-chat.js +88 -0
- package/lib/clay-mate-knowledge-input.js +26 -0
- package/lib/clay-mate-knowledge.js +95 -0
- package/lib/clay-mate-lifecycle.js +95 -0
- package/lib/clay-product-control-input.js +33 -0
- package/lib/clay-product-control-tools.js +51 -0
- package/lib/clay-product-control.js +247 -0
- package/lib/clay-project-lifecycle.js +154 -0
- package/lib/clay-project-record-input.js +44 -0
- package/lib/clay-project-records.js +84 -0
- package/lib/clay-scheduling-input.js +21 -0
- package/lib/clay-scheduling-receipts.js +26 -0
- package/lib/clay-scheduling.js +119 -0
- package/lib/clay-screen-controls.js +104 -0
- package/lib/clay-skill-install.js +1 -33
- package/lib/clay-workspace-controls.js +84 -0
- package/lib/clay-workspace-input.js +17 -0
- package/lib/clay-workspace-receipts.js +26 -0
- package/lib/cli-sessions.js +1 -300
- package/lib/codex-defaults.js +1 -28
- package/lib/context-usage.js +3 -2
- package/lib/contextual-screen-snapshot.js +38 -0
- package/lib/daemon-project-access.js +11 -0
- package/lib/daemon-project-lifecycle-callbacks.js +15 -0
- package/lib/daemon-project-lifecycle.js +262 -0
- package/lib/daemon-projects.js +1 -1
- package/lib/daemon.js +80 -276
- package/lib/default-ai-runtime.js +4 -8
- package/lib/dm-digest-cursor.js +120 -0
- package/lib/email-mcp-server.js +1 -1
- package/lib/issues-service.js +29 -15
- package/lib/kiro-defaults.js +1 -22
- package/lib/knowledge-db-import-validation.js +46 -0
- package/lib/knowledge-db-import.js +99 -0
- package/lib/knowledge-db-service.js +24 -33
- package/lib/knowledge-db-storage-nedb-maintenance.js +99 -0
- package/lib/knowledge-db-storage-nedb.js +66 -0
- package/lib/knowledge-db-storage.js +72 -0
- package/lib/knowledge-db-validation.js +0 -0
- package/lib/knowledge-document-index.js +2 -1
- package/lib/knowledge-file-store.js +7 -1
- package/lib/knowledge-product-operations.js +46 -0
- package/lib/mate-avatar-catalog.js +12 -0
- package/lib/mate-avatar-migration.js +41 -0
- package/lib/mate-context-service.js +138 -0
- package/lib/mate-context-tools.js +21 -0
- package/lib/mate-creation-mcp-server.js +2 -0
- package/lib/mate-knowledge-canonical-access.js +10 -0
- package/lib/mate-knowledge-mate-bound.js +53 -0
- package/lib/mate-knowledge-mcp-server.js +55 -8
- package/lib/mate-knowledge-service.js +16 -34
- package/lib/mate-knowledge-text-tools.js +106 -0
- package/lib/mate-lifecycle-service.js +94 -0
- package/lib/mate-message-delivery.js +43 -0
- package/lib/mate-ready-creation.js +9 -1
- package/lib/mate-schedule-input.js +29 -0
- package/lib/mate-schedule-lifecycle.js +151 -0
- package/lib/mate-scheduling.js +103 -0
- package/lib/mates.js +18 -6
- package/lib/mcp-agent-tools.js +117 -0
- package/lib/mcp-connection-store.js +119 -15
- package/lib/mcp-import-credentials.js +31 -0
- package/lib/mcp-local-transport.js +13 -0
- package/lib/mcp-oauth.js +8 -6
- package/lib/mcp-proxy.js +2 -32
- package/lib/mcp-query-bridge.js +30 -0
- package/lib/mcp-remote-connections.js +74 -20
- package/lib/mcp-source-adapters.js +1 -0
- package/lib/mcp-source-context.js +1 -0
- package/lib/mcp-source-discovery.js +1 -0
- package/lib/mcp-source-plugins.js +1 -0
- package/lib/mcp-source-restrictions.js +1 -0
- package/lib/mcp-tool-policy.js +9 -0
- package/lib/migrate-single-user.js +3 -23
- package/lib/notes-checklist.js +50 -0
- package/lib/notes.js +49 -3
- package/lib/os-user-diagnostics.js +2 -4
- package/lib/os-users.js +24 -70
- package/lib/pane-pending-interactions.js +20 -0
- package/lib/pane-session-activation.js +114 -0
- package/lib/pane-session-transport.js +26 -0
- package/lib/project-admin-overview.js +51 -0
- package/lib/project-ask-user.js +8 -4
- package/lib/project-connection.js +14 -10
- package/lib/project-control-git-view.js +12 -0
- package/lib/project-debate.js +1 -0
- package/lib/project-delegated-follow-up.js +2 -1
- package/lib/project-directory-claim.js +65 -0
- package/lib/project-file-operations.js +61 -0
- package/lib/project-filesystem.js +15 -85
- package/lib/project-full-access.js +23 -2
- package/lib/project-http.js +7 -4
- package/lib/project-knowledge.js +32 -18
- package/lib/project-lifecycle-operations.js +98 -0
- package/lib/project-lifecycle-process-witness.js +32 -0
- package/lib/project-lifecycle-runtime.js +50 -0
- package/lib/project-linux-access.js +22 -0
- package/lib/project-logs-canonical-clay.js +27 -0
- package/lib/project-logs-clay-query.js +16 -0
- package/lib/project-logs-schema.js +4 -2
- package/lib/project-logs-service.js +8 -7
- package/lib/project-logs.js +1 -0
- package/lib/project-loop.js +1 -0
- package/lib/project-mate-chat-control.js +55 -0
- package/lib/project-mate-creation-proposal.js +18 -3
- package/lib/project-mate-interaction.js +40 -62
- package/lib/project-mcp.js +54 -16
- package/lib/project-models.js +14 -31
- package/lib/project-notifications.js +76 -17
- package/lib/project-ownership.js +77 -0
- package/lib/project-pair-result-delivery.js +14 -3
- package/lib/project-pair-usage.js +12 -13
- package/lib/project-pending-message-queue.js +4 -1
- package/lib/project-product-control.js +89 -0
- package/lib/project-product-session-queue.js +46 -0
- package/lib/project-push-access.js +28 -0
- package/lib/project-scheduled-message-queue.js +30 -0
- package/lib/project-scheduled-messages.js +67 -68
- package/lib/project-scheduled-task-control.js +83 -0
- package/lib/project-scheduled-tasks.js +13 -2
- package/lib/project-scheduling-access.js +10 -0
- package/lib/project-server-settings.js +1 -0
- package/lib/project-session-actions.js +65 -0
- package/lib/project-session-delete.js +8 -1
- package/lib/project-session-document.js +27 -7
- package/lib/project-session-github.js +63 -19
- package/lib/project-session-history-actions.js +167 -0
- package/lib/project-session-linear.js +14 -6
- package/lib/project-session-notes.js +7 -3
- package/lib/project-session-pair.js +1 -1
- package/lib/project-session-runtime-actions.js +64 -0
- package/lib/project-session-spawn.js +2 -3
- package/lib/project-session-vendor.js +55 -0
- package/lib/project-sessions.js +103 -272
- package/lib/project-shared-browser.js +78 -17
- package/lib/project-studio-presentation.js +58 -0
- package/lib/project-user-knowledge.js +2 -1
- package/lib/project-user-message.js +67 -1
- package/lib/project-vendor-login.js +6 -36
- package/lib/project-workspace-operations.js +126 -0
- package/lib/project-workspace-query.js +19 -2
- package/lib/project.js +178 -45
- package/lib/public/app.js +46 -0
- package/lib/public/appearance-bootstrap.js +16 -0
- package/lib/public/auth/account-login.css +98 -0
- package/lib/public/auth/account-login.js +104 -0
- package/lib/public/css/clay-tool-activity.css +51 -0
- package/lib/public/css/clay-workspace.css +29 -0
- package/lib/public/css/command-palette.css +12 -33
- package/lib/public/css/contextual-clay.css +240 -0
- package/lib/public/css/home-debate-planning.css +2 -0
- package/lib/public/css/home-mate-creation.css +5 -0
- package/lib/public/css/input.css +6 -0
- package/lib/public/css/mate-avatar-gallery.css +12 -0
- package/lib/public/css/mate-conversation.css +10 -5
- package/lib/public/css/messages.css +6 -2
- package/lib/public/css/overlays.css +4 -2
- package/lib/public/css/project-admin-overview.css +13 -0
- package/lib/public/css/session-folders.css +11 -0
- package/lib/public/css/session-github.css +46 -1
- package/lib/public/css/shared-browser.css +35 -1
- package/lib/public/css/sticky-notes.css +87 -1
- package/lib/public/css/user-settings-sessions.css +42 -0
- package/lib/public/index.html +28 -10
- package/lib/public/mate-avatars/B01.png +0 -0
- package/lib/public/mate-avatars/B02.png +0 -0
- package/lib/public/mate-avatars/B03.png +0 -0
- package/lib/public/mate-avatars/B04.png +0 -0
- package/lib/public/mate-avatars/B05.png +0 -0
- package/lib/public/mate-avatars/B06.png +0 -0
- package/lib/public/mate-avatars/B07.png +0 -0
- package/lib/public/mate-avatars/B08.png +0 -0
- package/lib/public/mate-avatars/B09.png +0 -0
- package/lib/public/mate-avatars/B10.png +0 -0
- package/lib/public/mate-avatars/B11.png +0 -0
- package/lib/public/mate-avatars/B12.png +0 -0
- package/lib/public/mate-avatars/B13.png +0 -0
- package/lib/public/mate-avatars/B14.png +0 -0
- package/lib/public/mate-avatars/B15.png +0 -0
- package/lib/public/mate-avatars/B16.png +0 -0
- package/lib/public/mate-avatars/B17.png +0 -0
- package/lib/public/mate-avatars/B18.png +0 -0
- package/lib/public/mate-avatars/B19.png +0 -0
- package/lib/public/mate-avatars/B20.png +0 -0
- package/lib/public/mate-avatars/B21.png +0 -0
- package/lib/public/mate-avatars/B22.png +0 -0
- package/lib/public/mate-avatars/B23.png +0 -0
- package/lib/public/mate-avatars/B24.png +0 -0
- package/lib/public/mate-avatars/B25.png +0 -0
- package/lib/public/mate-avatars/B26.png +0 -0
- package/lib/public/mate-avatars/B27.png +0 -0
- package/lib/public/mate-avatars/B28.png +0 -0
- package/lib/public/mate-avatars/B29.png +0 -0
- package/lib/public/mate-avatars/B30.png +0 -0
- package/lib/public/mate-avatars/B31.png +0 -0
- package/lib/public/mate-avatars/B32.png +0 -0
- package/lib/public/mate-avatars/B33.png +0 -0
- package/lib/public/mate-avatars/B34.png +0 -0
- package/lib/public/mate-avatars/B35.png +0 -0
- package/lib/public/mate-avatars/B36.png +0 -0
- package/lib/public/mate-avatars/B37.png +0 -0
- package/lib/public/mate-avatars/B38.png +0 -0
- package/lib/public/mate-avatars/B39.png +0 -0
- package/lib/public/mate-avatars/B40.png +0 -0
- package/lib/public/mate-avatars/B41.png +0 -0
- package/lib/public/mate-avatars/B42.png +0 -0
- package/lib/public/mate-avatars/B43.png +0 -0
- package/lib/public/mate-avatars/B44.png +0 -0
- package/lib/public/mate-avatars/B45.png +0 -0
- package/lib/public/mate-avatars/B46.png +0 -0
- package/lib/public/mate-avatars/B47.png +0 -0
- package/lib/public/mate-avatars/B48.png +0 -0
- package/lib/public/mate-avatars/C01.png +0 -0
- package/lib/public/mate-avatars/C02.png +0 -0
- package/lib/public/mate-avatars/C03.png +0 -0
- package/lib/public/mate-avatars/C04.png +0 -0
- package/lib/public/mate-avatars/C05.png +0 -0
- package/lib/public/mate-avatars/C06.png +0 -0
- package/lib/public/mate-avatars/C07.png +0 -0
- package/lib/public/mate-avatars/C08.png +0 -0
- package/lib/public/mate-avatars/C09.png +0 -0
- package/lib/public/mate-avatars/C10.png +0 -0
- package/lib/public/mate-avatars/C11.png +0 -0
- package/lib/public/mate-avatars/C12.png +0 -0
- package/lib/public/mate-avatars/C13.png +0 -0
- package/lib/public/mate-avatars/C14.png +0 -0
- package/lib/public/mate-avatars/C15.png +0 -0
- package/lib/public/mate-avatars/C16.png +0 -0
- package/lib/public/mate-avatars/C17.png +0 -0
- package/lib/public/mate-avatars/C18.png +0 -0
- package/lib/public/mate-avatars/C19.png +0 -0
- package/lib/public/mate-avatars/C20.png +0 -0
- package/lib/public/mate-avatars/C21.png +0 -0
- package/lib/public/mate-avatars/C22.png +0 -0
- package/lib/public/mate-avatars/C23.png +0 -0
- package/lib/public/mate-avatars/C24.png +0 -0
- package/lib/public/mate-avatars/C25.png +0 -0
- package/lib/public/mate-avatars/C26.png +0 -0
- package/lib/public/mate-avatars/C27.png +0 -0
- package/lib/public/mate-avatars/C28.png +0 -0
- package/lib/public/mate-avatars/C29.png +0 -0
- package/lib/public/mate-avatars/C30.png +0 -0
- package/lib/public/mate-avatars/C31.png +0 -0
- package/lib/public/mate-avatars/C32.png +0 -0
- package/lib/public/mate-avatars/C33.png +0 -0
- package/lib/public/mate-avatars/C34.png +0 -0
- package/lib/public/mate-avatars/C35.png +0 -0
- package/lib/public/mate-avatars/C36.png +0 -0
- package/lib/public/mate-avatars/C37.png +0 -0
- package/lib/public/mate-avatars/C38.png +0 -0
- package/lib/public/mate-avatars/C39.png +0 -0
- package/lib/public/mate-avatars/C40.png +0 -0
- package/lib/public/mate-avatars/C41.png +0 -0
- package/lib/public/mate-avatars/C42.png +0 -0
- package/lib/public/mate-avatars/C43.png +0 -0
- package/lib/public/mate-avatars/C44.png +0 -0
- package/lib/public/mate-avatars/C45.png +0 -0
- package/lib/public/mate-avatars/C46.png +0 -0
- package/lib/public/mate-avatars/C47.png +0 -0
- package/lib/public/mate-avatars/C48.png +0 -0
- package/lib/public/mate-avatars/catalog.json +482 -0
- package/lib/public/mate-avatars/lead-clay.png +0 -0
- package/lib/public/modules/account-auth-settings.js +71 -0
- package/lib/public/modules/account-transport-settings.js +51 -0
- package/lib/public/modules/admin-settings-projects.js +6 -2
- package/lib/public/modules/app-connection.js +11 -1
- package/lib/public/modules/app-favicon.js +18 -9
- package/lib/public/modules/app-header.js +7 -4
- package/lib/public/modules/app-loop-ui.js +2 -0
- package/lib/public/modules/app-message-router.js +22 -1
- package/lib/public/modules/app-messages.js +119 -17
- package/lib/public/modules/app-misc.js +3 -1
- package/lib/public/modules/app-notifications.js +11 -5
- package/lib/public/modules/app-panels.js +61 -123
- package/lib/public/modules/app-projects.js +13 -0
- package/lib/public/modules/app-rate-limit.js +7 -27
- package/lib/public/modules/app-rendering.js +4 -3
- package/lib/public/modules/avatar.js +15 -41
- package/lib/public/modules/chat-render-runtime.js +20 -0
- package/lib/public/modules/clay-browser-links.js +47 -0
- package/lib/public/modules/clay-control-activity.js +214 -0
- package/lib/public/modules/clay-control-copy.js +36 -0
- package/lib/public/modules/clay-control-detail-targets.js +44 -0
- package/lib/public/modules/clay-control-object-targets.js +52 -0
- package/lib/public/modules/clay-control-target-visibility.js +12 -0
- package/lib/public/modules/clay-control-targets.js +44 -0
- package/lib/public/modules/clay-log-links.js +23 -0
- package/lib/public/modules/clay-navigation-render.js +52 -0
- package/lib/public/modules/clay-owner-navigation.js +33 -0
- package/lib/public/modules/clay-session-links.js +31 -0
- package/lib/public/modules/clay-studio-bridge.js +20 -0
- package/lib/public/modules/clay-studio-document.js +67 -0
- package/lib/public/modules/clay-studio-render.js +146 -0
- package/lib/public/modules/clay-tool-activity.js +140 -0
- package/lib/public/modules/clay-tool-presentation.js +342 -0
- package/lib/public/modules/command-palette.js +162 -40
- package/lib/public/modules/contextual-ask-session.js +26 -0
- package/lib/public/modules/contextual-clay-geometry.js +155 -0
- package/lib/public/modules/contextual-clay-session.js +130 -0
- package/lib/public/modules/contextual-clay-workspace.js +169 -0
- package/lib/public/modules/contextual-clay.js +250 -0
- package/lib/public/modules/contextual-composer.js +91 -0
- package/lib/public/modules/contextual-mate-context.js +117 -0
- package/lib/public/modules/contextual-mate-hint.js +40 -0
- package/lib/public/modules/contextual-mate-identity.js +23 -0
- package/lib/public/modules/contextual-mate-sessions.js +134 -0
- package/lib/public/modules/contextual-search.js +137 -0
- package/lib/public/modules/contextual-session-citations.js +58 -0
- package/lib/public/modules/debate.js +1 -0
- package/lib/public/modules/default-ai.js +11 -3
- package/lib/public/modules/elicitation-form.js +5 -0
- package/lib/public/modules/filebrowser.js +20 -1
- package/lib/public/modules/generation-stop.js +8 -5
- package/lib/public/modules/git-panel.js +3 -1
- package/lib/public/modules/history-replay-batch.js +13 -1
- package/lib/public/modules/home-debate-live.js +2 -0
- package/lib/public/modules/home-debate-planning.js +7 -7
- package/lib/public/modules/home-mate-avatar-editor.js +127 -208
- package/lib/public/modules/home-mate-chat.js +8 -6
- package/lib/public/modules/home-mate-creation.js +73 -1
- package/lib/public/modules/home-mate-settings.js +19 -12
- package/lib/public/modules/icon-strip-tooltip.js +2 -1
- package/lib/public/modules/input.js +88 -10
- package/lib/public/modules/issues-render.js +3 -2
- package/lib/public/modules/knowledge-db-workbench.js +4 -4
- package/lib/public/modules/markdown.js +6 -34
- package/lib/public/modules/mate-avatar-catalog.js +97 -0
- package/lib/public/modules/mate-knowledge-workbench.js +1 -1
- package/lib/public/modules/mate-management.js +40 -7
- package/lib/public/modules/mcp-connection-view.js +31 -13
- package/lib/public/modules/mcp-discovery-view.js +31 -0
- package/lib/public/modules/mcp-ui.js +23 -4
- package/lib/public/modules/mention.js +3 -0
- package/lib/public/modules/message-delivery.js +20 -2
- package/lib/public/modules/model-picker.js +2 -0
- package/lib/public/modules/pane-activation.js +214 -0
- package/lib/public/modules/pane-binding.js +82 -0
- package/lib/public/modules/pane-bridge.js +7 -4
- package/lib/public/modules/pane-browser-bridge.js +22 -0
- package/lib/public/modules/pane-file-bridge.js +4 -0
- package/lib/public/modules/pane-issue-bridge.js +4 -1
- package/lib/public/modules/passkey-browser.js +69 -0
- package/lib/public/modules/passkey-server-settings.js +57 -0
- package/lib/public/modules/pending-message-queue.js +1 -0
- package/lib/public/modules/permission-control.js +5 -4
- package/lib/public/modules/personal-settings-dialog.js +7 -1
- package/lib/public/modules/product-review.js +26 -0
- package/lib/public/modules/profile.js +1 -238
- package/lib/public/modules/project-access-recovery.js +17 -0
- package/lib/public/modules/project-admin-overview.js +21 -0
- package/lib/public/modules/project-chat-identity.js +13 -4
- package/lib/public/modules/project-logs-render.js +6 -2
- package/lib/public/modules/project-mate-navigation.js +144 -22
- package/lib/public/modules/rewind.js +5 -0
- package/lib/public/modules/scheduled-tasks.js +2 -0
- package/lib/public/modules/scheduler.js +2 -0
- package/lib/public/modules/search-clay-chat.js +5 -440
- package/lib/public/modules/server-settings-controls.js +10 -0
- package/lib/public/modules/server-settings.js +7 -2
- package/lib/public/modules/session-actions.js +5 -2
- package/lib/public/modules/session-context-menu.js +5 -0
- package/lib/public/modules/session-create-form.js +10 -10
- package/lib/public/modules/session-folder-layout.js +1 -1
- package/lib/public/modules/session-folder-view-menu.js +9 -0
- package/lib/public/modules/session-github.js +85 -14
- package/lib/public/modules/session-rich-drafts.js +21 -0
- package/lib/public/modules/session-switch-defer.js +67 -0
- package/lib/public/modules/session-work-primary.js +51 -0
- package/lib/public/modules/settings-defaults.js +27 -28
- package/lib/public/modules/shared-browser-settings.js +112 -0
- package/lib/public/modules/shared-browser-tabs.js +13 -3
- package/lib/public/modules/shared-browser.js +29 -6
- package/lib/public/modules/sidebar-mobile.js +4 -3
- package/lib/public/modules/sidebar-projects.js +1 -0
- package/lib/public/modules/sidebar-session-folders-ui.js +1 -1
- package/lib/public/modules/sidebar-sessions.js +1 -0
- package/lib/public/modules/split-group-restore.js +68 -0
- package/lib/public/modules/split-pair-ui.js +1 -0
- package/lib/public/modules/split-pane-reconciler.js +15 -0
- package/lib/public/modules/split-pane-renderer.js +87 -6
- package/lib/public/modules/split-session-boundary.js +1 -1
- package/lib/public/modules/split-view.js +60 -68
- package/lib/public/modules/sticky-note-markdown.js +72 -6
- package/lib/public/modules/sticky-notes-actions.js +30 -0
- package/lib/public/modules/sticky-notes-browser.js +9 -2
- package/lib/public/modules/sticky-notes-card.js +23 -7
- package/lib/public/modules/sticky-notes-checklist.js +116 -0
- package/lib/public/modules/sticky-notes-editor.js +108 -44
- package/lib/public/modules/sticky-notes-shared.js +50 -2
- package/lib/public/modules/sticky-notes-state.js +66 -0
- package/lib/public/modules/sticky-notes.js +34 -51
- package/lib/public/modules/stt-controller.js +4 -1
- package/lib/public/modules/stt-recording.js +1 -1
- package/lib/public/modules/stt.js +7 -2
- package/lib/public/modules/terminal.js +9 -0
- package/lib/public/modules/theme.js +8 -1
- package/lib/public/modules/thinking-lifecycle.js +33 -3
- package/lib/public/modules/thinking-view.js +23 -1
- package/lib/public/modules/tools.js +60 -11
- package/lib/public/modules/tui-grab.js +1 -2
- package/lib/public/modules/user-settings-account.js +14 -1
- package/lib/public/modules/user-settings-appearance.js +10 -3
- package/lib/public/modules/user-settings-editors.js +1 -1
- package/lib/public/modules/user-settings-layout.js +11 -2
- package/lib/public/modules/user-settings-preferences.js +6 -2
- package/lib/public/modules/user-settings-profile.js +12 -2
- package/lib/public/modules/user-settings-sessions.js +120 -0
- package/lib/public/modules/user-settings.js +6 -2
- package/lib/public/modules/vendor-login-browser.js +5 -3
- package/lib/public/modules/vendor-login.js +2 -2
- package/lib/public/modules/vendor-priority.js +15 -1
- package/lib/public/modules/wireframe-workbench.js +5 -2
- package/lib/public/modules/you-activity.js +3 -1
- package/lib/public/modules/you.js +91 -6
- package/lib/public/muse-avatar.svg +4 -0
- package/lib/public/style.css +6 -0
- package/lib/public/sw.js +3 -1
- package/lib/safe-bash-commands.js +3 -45
- package/lib/scheduled-task-records.js +3 -1
- package/lib/scheduler.js +2 -0
- package/lib/sdk-bridge.js +342 -401
- package/lib/sdk-foreground-admission.js +16 -0
- package/lib/sdk-mcp-descriptors.js +2 -37
- package/lib/sdk-message-processor.js +52 -17
- package/lib/sdk-quota-snapshot.js +1 -1
- package/lib/sdk-response-recovery.js +1 -0
- package/lib/sdk-worker.js +2 -677
- package/lib/server-account-passkeys.js +186 -0
- package/lib/server-account-passwords.js +127 -0
- package/lib/server-account-security.js +53 -0
- package/lib/server-admin.js +63 -16
- package/lib/server-appearance-settings.js +13 -1
- package/lib/server-auth.js +107 -79
- package/lib/server-contextual-clay-settings.js +40 -0
- package/lib/server-contextual-mate-sessions.js +70 -0
- package/lib/server-dm.js +2 -1
- package/lib/server-global-ws.js +10 -20
- package/lib/server-home-chat-events.js +18 -4
- package/lib/server-home-chat.js +22 -20
- package/lib/server-home-clay-entry.js +23 -4
- package/lib/server-home-clay-session-links.js +29 -9
- package/lib/server-home-mate-creation.js +1 -0
- package/lib/server-home-mcp-consent.js +14 -0
- package/lib/server-mates.js +25 -62
- package/lib/server-owner-ui.js +118 -0
- package/lib/server-path-access.js +38 -0
- package/lib/server-project-removal.js +22 -0
- package/lib/server-settings.js +8 -2
- package/lib/server.js +165 -43
- package/lib/session-config-transition.js +45 -0
- package/lib/session-folders.js +7 -2
- package/lib/session-fork-history.js +21 -0
- package/lib/session-github.js +9 -2
- package/lib/session-hygiene.js +3 -35
- package/lib/session-permission-mode.js +4 -3
- package/lib/session-skill-scope.js +11 -0
- package/lib/session-visibility.js +5 -2
- package/lib/session-work-primary.js +50 -0
- package/lib/sessions.js +64 -99
- package/lib/shared-browser-cookie-sync.js +32 -0
- package/lib/shared-browser-cookies.js +79 -0
- package/lib/shared-browser-runtime.js +25 -9
- package/lib/shared-browser-storage-sync.js +43 -0
- package/lib/shared-browser-storage.js +101 -0
- package/lib/shared-browser-tools.js +2 -1
- package/lib/shared-browser-worker.js +46 -10
- package/lib/terminal-manager.js +65 -6
- package/lib/tool-llm.js +1 -1
- package/lib/tui-transcript-index.js +1 -132
- package/lib/user-knowledge-service.js +23 -1
- package/lib/users-auth.js +38 -3
- package/lib/users-contextual-clay-preferences.js +31 -0
- package/lib/users-create.js +97 -0
- package/lib/users-permissions.js +2 -8
- package/lib/users-server-pin.js +37 -0
- package/lib/users.js +18 -84
- package/lib/vendor-login-browser.js +1 -11
- package/lib/workspace-assignment-service.js +25 -0
- package/lib/workspace-query-access.js +4 -1
- package/lib/workspace-query-mcp-server.js +1 -1
- package/lib/workspace-query-service.js +13 -2
- package/lib/ws-request.js +1 -0
- package/lib/ws-schema.js +18 -2
- package/lib/yoke/acp-agent-profiles.js +7 -5
- package/lib/yoke/adapters/antigravity.js +3 -14
- package/lib/yoke/adapters/claude-query-contract.js +9 -0
- package/lib/yoke/adapters/claude.js +54 -50
- package/lib/yoke/adapters/codex-query-contract.js +24 -0
- package/lib/yoke/adapters/codex.js +53 -111
- package/lib/yoke/adapters/kiro.js +3 -1
- package/lib/yoke/adapters/muse-query-contract.js +7 -0
- package/lib/yoke/adapters/muse.js +122 -0
- package/lib/yoke/auth-events.js +17 -0
- package/lib/yoke/claude-hook-installer.js +271 -0
- package/lib/yoke/claude-jsonl-watcher.js +204 -0
- package/lib/yoke/claude-maintenance.js +55 -0
- package/lib/yoke/claude-permission-patterns.js +53 -0
- package/lib/yoke/claude-response-recovery.js +155 -0
- package/lib/yoke/claude-transcript-hygiene.js +34 -0
- package/lib/yoke/claude-worker-startup.js +28 -0
- package/lib/yoke/clay-skill-install.js +33 -0
- package/lib/yoke/cli-sessions.js +300 -0
- package/lib/yoke/codex-app-server.js +7 -12
- package/lib/yoke/codex-idle-recovery.js +81 -1
- package/lib/yoke/codex-recovery-admission.js +164 -0
- package/lib/yoke/configuration.js +13 -0
- package/lib/yoke/discovery.js +70 -0
- package/lib/yoke/errors.js +8 -0
- package/lib/yoke/host-environment.js +7 -0
- package/lib/yoke/index.js +9 -51
- package/lib/yoke/interface.js +116 -0
- package/lib/yoke/kiro-acp-server.js +5 -5
- package/lib/yoke/legacy-sessions.js +89 -0
- package/lib/yoke/login-protocol.js +25 -0
- package/lib/yoke/maintenance.js +12 -0
- package/lib/yoke/mcp-proxy.js +32 -0
- package/lib/yoke/mcp-source-adapters.js +91 -0
- package/lib/yoke/mcp-source-context.js +42 -0
- package/lib/yoke/mcp-source-discovery.js +169 -0
- package/lib/yoke/mcp-source-plugins.js +68 -0
- package/lib/yoke/mcp-source-restrictions.js +47 -0
- package/lib/yoke/mcp-tool-policy-normalize.js +28 -0
- package/lib/yoke/model-preferences.js +6 -0
- package/lib/yoke/muse-artifacts.js +36 -0
- package/lib/yoke/muse-controls.js +50 -0
- package/lib/yoke/muse-input.js +64 -0
- package/lib/yoke/muse-items.js +157 -0
- package/lib/yoke/muse-policy.js +52 -0
- package/lib/yoke/muse-query.js +428 -0
- package/lib/yoke/muse-runtime.js +211 -0
- package/lib/yoke/muse-services.js +79 -0
- package/lib/yoke/muse-skills.js +79 -0
- package/lib/yoke/muse-turns.js +71 -0
- package/lib/yoke/options/acp.js +2 -0
- package/lib/yoke/options/antigravity.js +2 -0
- package/lib/yoke/options/claude.js +21 -0
- package/lib/yoke/options/codex-defaults.js +29 -0
- package/lib/yoke/options/codex-settings.js +21 -0
- package/lib/yoke/options/codex.js +6 -0
- package/lib/yoke/options/kiro-defaults.js +22 -0
- package/lib/yoke/options/kiro.js +5 -0
- package/lib/yoke/options/muse.js +5 -0
- package/lib/yoke/provider-contract.js +5 -0
- package/lib/yoke/providers/antigravity-executable.js +8 -0
- package/lib/yoke/providers/claude-executable.js +40 -0
- package/lib/yoke/providers/claude-model-descriptions.js +14 -0
- package/lib/yoke/providers/claude-process.js +97 -0
- package/lib/yoke/providers/claude-provision.js +75 -0
- package/lib/yoke/providers/codex-errors.js +8 -0
- package/lib/yoke/providers/muse-executable.js +17 -0
- package/lib/yoke/provisioning.js +6 -0
- package/lib/yoke/query-options.js +10 -0
- package/lib/yoke/response-recovery.js +41 -0
- package/lib/yoke/sdk-mcp-descriptors.js +37 -0
- package/lib/yoke/sdk-server-factory.js +7 -0
- package/lib/yoke/session-history.js +8 -0
- package/lib/yoke/session-tool-transport.js +34 -13
- package/lib/yoke/settings.js +23 -0
- package/lib/yoke/source-locations.js +4 -0
- package/lib/yoke/title-query.js +18 -7
- package/lib/yoke/tui-transcript-index.js +132 -0
- package/lib/yoke/usage.js +48 -0
- package/lib/yoke/user-input.js +13 -0
- package/lib/yoke/vendor-registry.js +81 -1
- package/package.json +11 -4
|
@@ -103,7 +103,8 @@ function renderFileRow(file, staged) {
|
|
|
103
103
|
var actionTitle = staged ? "Unstage file — keep its changes" : "Stage file for commit";
|
|
104
104
|
var actionIcon = staged ? "minus" : "plus";
|
|
105
105
|
var actionsOpen = expandedFileActionsPath === file.path;
|
|
106
|
-
|
|
106
|
+
var control = currentStatus && currentStatus.controlView, view = control && control.files.find(function (item) { return item.path === file.path; });
|
|
107
|
+
return '<div data-control-git-path="' + escapeHtml(file.path) + '" data-control-revision="' + escapeHtml(view && view.revision || '') + '" data-control-runtime="' + escapeHtml(control && control.runtimeId || '') + '" class="git-file-row' + (actionsOpen ? ' active' : '') + '">' +
|
|
107
108
|
'<span class="git-file-status' + statusClass + '">' + escapeHtml(fileStatusLabel(file, staged)) + '</span>' +
|
|
108
109
|
'<div class="git-file-main" data-git-file-item="' + pathKey + '" tabindex="0" aria-label="File actions for ' + escapeHtml(parts.name) + '" aria-expanded="' + (actionsOpen ? 'true' : 'false') + '">' +
|
|
109
110
|
'<div class="git-file-name">' + escapeHtml(parts.name) + '</div>' +
|
|
@@ -282,6 +283,7 @@ export function refreshGitStatus() {
|
|
|
282
283
|
return requestJson(basePath + "api/git/status", { cache: "no-store" }).then(function (status) {
|
|
283
284
|
if (statusBasePath !== basePath) return status;
|
|
284
285
|
currentStatus = status;
|
|
286
|
+
store.set({ clayControlGitView: status.controlView ? Object.assign({ projectSlug: store.get('currentSlug') }, status.controlView) : null });
|
|
285
287
|
if (expandedFileActionsPath && !status.files.some(function (file) { return file.path === expandedFileActionsPath; })) {
|
|
286
288
|
expandedFileActionsPath = null;
|
|
287
289
|
}
|
|
@@ -27,7 +27,15 @@ function canCombine(previous, message) {
|
|
|
27
27
|
// can differ; the first token still supplies the message's display time.
|
|
28
28
|
var keys = Object.keys(previous).concat(Object.keys(message));
|
|
29
29
|
return keys.every(function (key) {
|
|
30
|
-
|
|
30
|
+
// Socket JSON gives each event its own activation object. Compare every
|
|
31
|
+
// field, including future metadata, without weakening replay boundaries.
|
|
32
|
+
if (key === 'paneActivation' && previous[key] && message[key]) {
|
|
33
|
+
var before = previous[key], after = message[key];
|
|
34
|
+
return Object.keys(before).concat(Object.keys(after)).every(function (field) {
|
|
35
|
+
return before[field] === after[field];
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return key === 'text' || key === '_ts' || key === '_historyIndex' || key === '_historyIndexes' || previous[key] === message[key];
|
|
31
39
|
});
|
|
32
40
|
}
|
|
33
41
|
|
|
@@ -105,6 +113,10 @@ export function receiveHistoryReplay(msg, dispatch) {
|
|
|
105
113
|
if (canCombine(previous, msg)) {
|
|
106
114
|
if (!batch.textParts) batch.textParts = [previous.text];
|
|
107
115
|
batch.textParts.push(msg.text);
|
|
116
|
+
if (Number.isSafeInteger(msg._historyIndex) && msg._historyIndex >= 0) {
|
|
117
|
+
if (!previous._historyIndexes) previous._historyIndexes = Number.isSafeInteger(previous._historyIndex) ? [previous._historyIndex] : [];
|
|
118
|
+
previous._historyIndexes.push(msg._historyIndex);
|
|
119
|
+
}
|
|
108
120
|
} else {
|
|
109
121
|
finishText(batch);
|
|
110
122
|
batch.items.push(Object.assign({}, msg));
|
|
@@ -23,6 +23,7 @@ function debateIdentity(message, prior) {
|
|
|
23
23
|
return {
|
|
24
24
|
mateId: message.speakerMateId || message.mateId || previous.mateId || null,
|
|
25
25
|
mateName: name,
|
|
26
|
+
avatarCatalogId: message.avatarCatalogId || previous.avatarCatalogId || cachedProfile.avatarCatalogId || "",
|
|
26
27
|
avatarStyle: message.avatarStyle || previous.avatarStyle || cachedProfile.avatarStyle || "imprint",
|
|
27
28
|
avatarSeed: message.avatarSeed || previous.avatarSeed || cachedProfile.avatarSeed || message.speakerMateId || message.mateId || name,
|
|
28
29
|
avatarColor: message.avatarColor || previous.avatarColor || cachedProfile.avatarColor || "",
|
|
@@ -37,6 +38,7 @@ function mateForTurn(message) {
|
|
|
37
38
|
name: identity.mateName,
|
|
38
39
|
profile: {
|
|
39
40
|
displayName: identity.mateName,
|
|
41
|
+
avatarCatalogId: identity.avatarCatalogId,
|
|
40
42
|
avatarStyle: identity.avatarStyle,
|
|
41
43
|
avatarSeed: identity.avatarSeed,
|
|
42
44
|
avatarColor: identity.avatarColor,
|
|
@@ -123,11 +123,11 @@ export function createHomeDebateProposalCard(message, respond) {
|
|
|
123
123
|
export function createHomeDebateQuestionCard(message, respond) {
|
|
124
124
|
var question = Array.isArray(message.questions) && message.questions.length ? message.questions[0] : {};
|
|
125
125
|
var card = document.createElement("section");
|
|
126
|
-
card.className = "home-debate-question";
|
|
126
|
+
card.className = "home-debate-question" + (message.flow === "mcp_import" ? " mcp-import-consent" : "");
|
|
127
127
|
card.dataset.toolId = message.toolId || "";
|
|
128
128
|
card.setAttribute("aria-busy", message.status === "submitting" ? "true" : "false");
|
|
129
|
-
var isMateCreation = message.flow === "mate_creation";
|
|
130
|
-
card.setAttribute("aria-label", (isMateCreation ? "Mate creation interview question: " : "Debate planning question: ") + (question.question || "Question"));
|
|
129
|
+
var isMateQuestion = message.flow === "mate_question", isMateCreation = message.flow === "mate_creation", isMcpImport = message.flow === "mcp_import";
|
|
130
|
+
card.setAttribute("aria-label", (isMateQuestion ? "Mate question: " : isMcpImport ? "MCP import consent: " : isMateCreation ? "Mate creation interview question: " : "Debate planning question: ") + (question.question || "Question"));
|
|
131
131
|
if (question.header) card.appendChild(textElement("div", "home-debate-question-header", question.header));
|
|
132
132
|
card.appendChild(textElement("h3", "home-debate-question-text", question.question || "Clay has a question."));
|
|
133
133
|
var form = document.createElement("div");
|
|
@@ -162,8 +162,8 @@ export function createHomeDebateQuestionCard(message, respond) {
|
|
|
162
162
|
answerControl.className = freeform ? "home-debate-question-freeform" : "home-debate-question-other";
|
|
163
163
|
answerControl.placeholder = freeform ? (isMateCreation ? "Describe what you want in your own words" : "Describe the topic in your own words") : "Type another answer";
|
|
164
164
|
answerLabel.appendChild(answerControl);
|
|
165
|
-
form.appendChild(answerLabel);
|
|
166
|
-
var submit = textElement("button", "home-debate-question-submit", message.status === "submitting" ? "Submitting…" : "Submit answer");
|
|
165
|
+
if (freeform || question.allowOther !== false) form.appendChild(answerLabel);
|
|
166
|
+
var submit = textElement("button", "home-debate-question-submit", message.status === "submitting" ? "Submitting…" : (isMcpImport || isMateQuestion) ? "Confirm choice" : "Submit answer");
|
|
167
167
|
submit.type = "button";
|
|
168
168
|
submit.disabled = message.status !== "pending" || !selected;
|
|
169
169
|
function submitAnswer() {
|
|
@@ -253,7 +253,7 @@ export function normalizeHomeTranscript(raw) {
|
|
|
253
253
|
export function applyHomeDebateQuestion(messages, msg) {
|
|
254
254
|
if (!msg || !msg.toolId) return messages;
|
|
255
255
|
for (var i = 0; i < messages.length; i++) if (messages[i].role === "question" && messages[i].toolId === msg.toolId) return messages;
|
|
256
|
-
return messages.concat([{ role: "question", flow: msg.type === "home_mate_creation_question" ? "mate_creation" : "debate", toolId: msg.toolId, questions: msg.questions || [], status: "pending", error: "" }]);
|
|
256
|
+
return messages.concat([{ role: "question", flow: msg.type === "home_mate_question" ? "mate_question" : msg.type === "home_mcp_import_question" ? "mcp_import" : msg.type === "home_mate_creation_question" ? "mate_creation" : "debate", toolId: msg.toolId, questions: msg.questions || [], status: "pending", error: "" }]);
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
export function resolveHomeDebateQuestion(messages, msg) {
|
|
@@ -296,7 +296,7 @@ export function markHomeDebateQuestionSubmitting(message, opener) {
|
|
|
296
296
|
export function createHomeDebateResponder(sendMessage, getContext, onChange) {
|
|
297
297
|
return function respond(message, action, opener, answers, modelOverrides) {
|
|
298
298
|
if (!message || message.status === "submitting") return;
|
|
299
|
-
var payload = message.role === "question" ? { type: message.flow === "mate_creation" ? "home_mate_creation_question_response" : "home_debate_question_response", toolId: message.toolId, answers: answers || {} } : { type: "home_debate_proposal_response", proposalId: message.proposal.proposalId, action: action, modelOverrides: Array.isArray(modelOverrides) ? modelOverrides : [] };
|
|
299
|
+
var payload = message.role === "question" ? { type: message.flow === "mate_question" ? "home_mate_question_response" : message.flow === "mcp_import" ? "home_mcp_import_response" : message.flow === "mate_creation" ? "home_mate_creation_question_response" : "home_debate_question_response", toolId: message.toolId, answers: answers || {} } : { type: "home_debate_proposal_response", proposalId: message.proposal.proposalId, action: action, modelOverrides: Array.isArray(modelOverrides) ? modelOverrides : [] };
|
|
300
300
|
Object.assign(payload, getContext());
|
|
301
301
|
if (!sendMessage(payload)) return;
|
|
302
302
|
if (message.role === "question") markHomeDebateQuestionSubmitting(message, opener);
|
|
@@ -1,228 +1,147 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
import { mateStyleAvatarUrl, mateAvatarUrl, MATE_AVATAR_STYLES } from './avatar.js';
|
|
1
|
+
// Explicit avatar drafts in the existing owner-scoped Mate settings surface.
|
|
2
|
+
import { mateAvatarUrl, mateCatalogAvatarUrl } from './avatar.js';
|
|
4
3
|
import { showAvatarPositioner } from './profile.js';
|
|
5
4
|
import { getWs } from './ws-ref.js';
|
|
6
5
|
import { store } from './store.js';
|
|
6
|
+
import { MATE_AVATAR_COLLECTIONS } from './mate-avatar-catalog.js';
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function mateName(mate) {
|
|
15
|
-
var profile = mate && mate.profile ? mate.profile : {};
|
|
16
|
-
return profile.displayName || (mate && (mate.displayName || mate.name)) || 'Mate';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function mateProfile(mate) {
|
|
20
|
-
return Object.assign({}, mate && mate.profile ? mate.profile : {});
|
|
8
|
+
var timer = null;
|
|
9
|
+
function state() { return store.get('mateAvatarDraft'); }
|
|
10
|
+
function put(value) { store.set({ mateAvatarDraft: value }); }
|
|
11
|
+
function profile(mate) { return Object.assign({}, mate.profile || {}); }
|
|
12
|
+
function currentMate(mate) {
|
|
13
|
+
return (store.get('cachedMatesList') || []).find(function (item) { return item.id === mate.id; }) || mate;
|
|
21
14
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return false;
|
|
15
|
+
function ensure(mate) {
|
|
16
|
+
var s = state();
|
|
17
|
+
if (!s || s.mateId !== mate.id) {
|
|
18
|
+
s = { mateId: mate.id, selected: (mate.profile || {}).avatarCatalogId || '', dirty: false, requestId: null, error: '', saved: false, uploading: false };
|
|
19
|
+
put(s);
|
|
20
|
+
} else if (!s.dirty && !s.requestId && !s.uploading && s.selected !== ((mate.profile || {}).avatarCatalogId || '')) {
|
|
21
|
+
s = Object.assign({}, s, { selected: (mate.profile || {}).avatarCatalogId || '' }); put(s);
|
|
30
22
|
}
|
|
31
|
-
|
|
32
|
-
statusByMate[mate.id] = { kind: 'pending', text: message || 'Saving avatar…' };
|
|
33
|
-
ws.send(JSON.stringify({ type: 'mate_update', mateId: mate.id, updates: { profile: profile } }));
|
|
34
|
-
rerender();
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function appendStatus(body, mate) {
|
|
39
|
-
var state = statusByMate[mate.id];
|
|
40
|
-
var status = document.createElement('div');
|
|
41
|
-
status.className = 'home-mate-avatar-status' + (state ? ' is-' + state.kind : '');
|
|
42
|
-
status.setAttribute('aria-live', 'polite');
|
|
43
|
-
status.textContent = state ? state.text : '';
|
|
44
|
-
body.appendChild(status);
|
|
23
|
+
return s;
|
|
45
24
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
button.setAttribute('aria-label', label + ' avatar');
|
|
52
|
-
button.setAttribute('aria-pressed', selected ? 'true' : 'false');
|
|
53
|
-
button.title = label;
|
|
54
|
-
var image = document.createElement('img');
|
|
55
|
-
image.src = src;
|
|
56
|
-
image.alt = '';
|
|
57
|
-
image.draggable = false;
|
|
58
|
-
var text = document.createElement('span');
|
|
59
|
-
text.textContent = label;
|
|
60
|
-
button.appendChild(image);
|
|
61
|
-
button.appendChild(text);
|
|
62
|
-
return button;
|
|
25
|
+
function button(label, id, action) {
|
|
26
|
+
var b = document.createElement('button');
|
|
27
|
+
b.type = 'button'; b.textContent = label; b.id = id;
|
|
28
|
+
b.addEventListener('click', action);
|
|
29
|
+
return b;
|
|
63
30
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
profile.avatarCustom = '';
|
|
70
|
-
sendProfile(mate, profile, rerender);
|
|
31
|
+
function closePicker(render) {
|
|
32
|
+
clearHomeMateAvatarEditor();
|
|
33
|
+
store.set({ mateSettingsAvatarOpen: false }); render();
|
|
34
|
+
var opener = document.getElementById('mate-profile-avatar');
|
|
35
|
+
if (opener) opener.focus();
|
|
71
36
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}).then(function (response) {
|
|
84
|
-
return response.json().then(function (data) {
|
|
85
|
-
if (!response.ok || !data.ok || !data.avatar) throw new Error(data.error || 'Upload failed');
|
|
86
|
-
return data.avatar;
|
|
87
|
-
});
|
|
88
|
-
}).then(function (avatar) {
|
|
89
|
-
if (token !== activeToken) return;
|
|
90
|
-
var profile = mateProfile(mate);
|
|
91
|
-
profile.avatarCustom = avatar;
|
|
92
|
-
draftByMate[mate.id] = profile;
|
|
93
|
-
statusByMate[mate.id] = { kind: 'saved', text: 'Image saved.' };
|
|
94
|
-
var mates = store.get('cachedMatesList') || [];
|
|
95
|
-
store.set({ cachedMatesList: mates.map(function (item) {
|
|
96
|
-
return item && item.id === mate.id ? Object.assign({}, item, { profile: profile }) : item;
|
|
97
|
-
}) });
|
|
98
|
-
var ws = getWs();
|
|
99
|
-
if (ws && ws.readyState === 1) {
|
|
100
|
-
ws.send(JSON.stringify({ type: 'mate_update', mateId: mate.id, updates: { profile: profile } }));
|
|
101
|
-
}
|
|
102
|
-
rerender();
|
|
103
|
-
}).catch(function (error) {
|
|
104
|
-
if (token !== activeToken) return;
|
|
105
|
-
statusByMate[mate.id] = { kind: 'error', text: error && error.message ? error.message : 'Could not upload this image.' };
|
|
106
|
-
rerender();
|
|
107
|
-
});
|
|
37
|
+
function save(mate, render) {
|
|
38
|
+
var s = state(); var ws = getWs();
|
|
39
|
+
if (!s || s.requestId || !s.dirty) return;
|
|
40
|
+
if (!ws || ws.readyState !== 1) { put(Object.assign({}, s, { error: 'Clay is offline. Your choice was not saved.' })); render(); return; }
|
|
41
|
+
var requestId = 'mate-avatar-' + Date.now() + '-' + Math.random().toString(36).slice(2);
|
|
42
|
+
var p = profile(currentMate(mate)); p.avatarCatalogId = s.selected; p.avatarCustom = '';
|
|
43
|
+
put(Object.assign({}, s, { requestId: requestId, error: '', saved: false })); render();
|
|
44
|
+
try { ws.send(JSON.stringify({ type: 'mate_update', mateId: mate.id, requestId: requestId, updates: { profile: p } })); }
|
|
45
|
+
catch (error) { failHomeMateAvatar(mate.id, 'Could not send your choice. Try again.', requestId); render(); return; }
|
|
46
|
+
clearTimeout(timer);
|
|
47
|
+
timer = setTimeout(function () { if (failHomeMateAvatar(mate.id, 'No response received. Your choice is retained; try again.', requestId)) render(); }, 15000);
|
|
108
48
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
var
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
49
|
+
function upload(mate, input, render) {
|
|
50
|
+
var file = input.files && input.files[0]; if (!file) return;
|
|
51
|
+
var image = new Image(); var url = URL.createObjectURL(file); var originalState = state();
|
|
52
|
+
image.onerror = function () {
|
|
53
|
+
URL.revokeObjectURL(url);
|
|
54
|
+
if (state() === originalState) { put(Object.assign({}, originalState, { error: 'Could not read this image.' })); render(); }
|
|
55
|
+
};
|
|
116
56
|
image.onload = function () {
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
57
|
+
if (state() !== originalState) { URL.revokeObjectURL(url); return; }
|
|
58
|
+
showAvatarPositioner(image, url, function (blob) {
|
|
59
|
+
URL.revokeObjectURL(url);
|
|
60
|
+
if (state() !== originalState) return;
|
|
61
|
+
var uploadingState = Object.assign({}, originalState, { uploading: true, error: '' }); put(uploadingState); render();
|
|
62
|
+
blob.arrayBuffer().then(function (buffer) {
|
|
63
|
+
return fetch('/api/mate-avatar/' + encodeURIComponent(mate.id), { method: 'POST', headers: { 'Content-Type': 'application/octet-stream' }, body: new Uint8Array(buffer) });
|
|
64
|
+
}).then(function (response) {
|
|
65
|
+
return response.json().then(function (data) { if (!response.ok || !data.ok || !data.avatar) throw new Error(data.error || 'Upload failed.'); return data.avatar; });
|
|
66
|
+
}).then(function (avatar) {
|
|
67
|
+
if (state() !== uploadingState) return;
|
|
68
|
+
var p = profile(currentMate(mate)); p.avatarCustom = avatar;
|
|
69
|
+
store.set({ cachedMatesList: (store.get('cachedMatesList') || []).map(function (item) { return item.id === mate.id ? Object.assign({}, item, { profile: p }) : item; }) });
|
|
70
|
+
put(Object.assign({}, uploadingState, { uploading: false, dirty: false, saved: true }));
|
|
71
|
+
// The HTTP upload is persisted; the update also refreshes other owner tabs.
|
|
72
|
+
var ws = getWs();
|
|
73
|
+
if (ws && ws.readyState === 1) {
|
|
74
|
+
try { ws.send(JSON.stringify({ type: 'mate_update', mateId: mate.id, updates: { profile: p } })); }
|
|
75
|
+
catch (error) { /* The acknowledged upload remains saved. */ }
|
|
76
|
+
}
|
|
77
|
+
render();
|
|
78
|
+
}).catch(function (error) {
|
|
79
|
+
if (state() !== uploadingState) return;
|
|
80
|
+
put(Object.assign({}, uploadingState, { uploading: false, error: error.message || 'Could not upload this image.' })); render();
|
|
81
|
+
});
|
|
124
82
|
});
|
|
125
83
|
};
|
|
126
|
-
image.
|
|
127
|
-
URL.revokeObjectURL(objectUrl);
|
|
128
|
-
if (token !== activeToken) return;
|
|
129
|
-
statusByMate[mate.id] = { kind: 'error', text: 'Could not read this image.' };
|
|
130
|
-
rerender();
|
|
131
|
-
};
|
|
132
|
-
image.src = objectUrl;
|
|
84
|
+
image.src = url;
|
|
133
85
|
}
|
|
134
|
-
|
|
135
|
-
export function renderHomeMateAvatarEditor(body, mate, rerender) {
|
|
86
|
+
export function renderHomeMateAvatarEditor(body, mate, render, onCancel) {
|
|
136
87
|
if (!mate) return;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
var
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
choice.addEventListener('click', function () { selectStyle(mate, entry.id, seed, rerender); });
|
|
173
|
-
choices.appendChild(choice);
|
|
174
|
-
})(MATE_AVATAR_STYLES[i]);
|
|
175
|
-
}
|
|
176
|
-
section.appendChild(choices);
|
|
177
|
-
var actions = document.createElement('div');
|
|
178
|
-
actions.className = 'home-mate-avatar-actions';
|
|
179
|
-
var shuffle = document.createElement('button');
|
|
180
|
-
shuffle.type = 'button';
|
|
181
|
-
shuffle.textContent = 'Shuffle selected style';
|
|
182
|
-
shuffle.disabled = style === 'imprint' || style === 'initial' || !!profile.avatarCustom;
|
|
183
|
-
shuffle.addEventListener('click', function () {
|
|
184
|
-
selectStyle(mate, style, Math.random().toString(36).substring(2, 10), rerender);
|
|
88
|
+
var s = ensure(mate); var p = profile(mate); var busy = !!s.requestId || s.uploading;
|
|
89
|
+
var section = document.createElement('section'); section.className = 'home-mate-avatar-editor';
|
|
90
|
+
var preview = document.createElement('div'); preview.className = 'home-mate-avatar-selection';
|
|
91
|
+
var image = document.createElement('img'); image.className = 'home-mate-avatar-preview';
|
|
92
|
+
image.src = s.dirty ? mateCatalogAvatarUrl(s.selected) : mateAvatarUrl(mate, 52); image.alt = 'Avatar preview';
|
|
93
|
+
var caption = document.createElement('p'); caption.textContent = s.dirty ? 'Preview' : 'Current avatar';
|
|
94
|
+
preview.appendChild(image); preview.appendChild(caption); section.appendChild(preview);
|
|
95
|
+
if (!p.avatarLocked) {
|
|
96
|
+
MATE_AVATAR_COLLECTIONS.forEach(function (collection) {
|
|
97
|
+
var family = collection.id;
|
|
98
|
+
var heading = document.createElement('h4'); heading.textContent = collection.name;
|
|
99
|
+
heading.id = 'mate-avatar-family-' + family; section.appendChild(heading);
|
|
100
|
+
var grid = document.createElement('div'); grid.className = 'home-mate-avatar-choices';
|
|
101
|
+
grid.setAttribute('role', 'group'); grid.setAttribute('aria-labelledby', heading.id);
|
|
102
|
+
collection.avatars.forEach(function (entry) {
|
|
103
|
+
var id = entry.id;
|
|
104
|
+
var choice = button(id, 'mate-avatar-' + id, function () {
|
|
105
|
+
put(Object.assign({}, state(), { selected: id, dirty: id !== (currentMate(mate).profile || {}).avatarCatalogId || !!(currentMate(mate).profile || {}).avatarCustom, error: '', saved: false }));
|
|
106
|
+
render(); var target = document.getElementById('mate-avatar-' + id); if (target) target.focus({ preventScroll: true });
|
|
107
|
+
});
|
|
108
|
+
choice.textContent = ''; choice.className = 'home-mate-avatar-choice'; choice.disabled = busy;
|
|
109
|
+
choice.setAttribute('aria-label', entry.name + ' avatar'); choice.title = entry.name; choice.setAttribute('aria-pressed', String(s.selected === id && (s.dirty || !p.avatarCustom)));
|
|
110
|
+
var img = document.createElement('img'); img.src = mateCatalogAvatarUrl(id); img.alt = ''; img.draggable = false;
|
|
111
|
+
choice.appendChild(img);
|
|
112
|
+
choice.addEventListener('keydown', function (event) {
|
|
113
|
+
var buttons = Array.from(grid.querySelectorAll('button')); var index = buttons.indexOf(choice);
|
|
114
|
+
var columns = getComputedStyle(grid).gridTemplateColumns.split(' ').length;
|
|
115
|
+
var offset = { ArrowRight: 1, ArrowLeft: -1, ArrowDown: columns, ArrowUp: -columns }[event.key];
|
|
116
|
+
if (offset !== undefined || event.key === 'Home' || event.key === 'End') {
|
|
117
|
+
event.preventDefault(); var next = event.key === 'Home' ? 0 : event.key === 'End' ? 47 : Math.max(0, Math.min(47, index + offset)); buttons[next].focus();
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
grid.appendChild(choice);
|
|
121
|
+
});
|
|
122
|
+
section.appendChild(grid);
|
|
185
123
|
});
|
|
186
|
-
var
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
input.type = 'file';
|
|
191
|
-
input.
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
input.tabIndex = -1;
|
|
195
|
-
input.setAttribute('aria-hidden', 'true');
|
|
196
|
-
input.addEventListener('change', function () { openUpload(mate, input, rerender); });
|
|
197
|
-
upload.addEventListener('click', function () { input.click(); });
|
|
198
|
-
actions.appendChild(shuffle);
|
|
199
|
-
actions.appendChild(upload);
|
|
200
|
-
actions.appendChild(input);
|
|
201
|
-
section.appendChild(actions);
|
|
124
|
+
var actions = document.createElement('div'); actions.className = 'home-mate-avatar-actions';
|
|
125
|
+
var cancel = button('Cancel', 'mate-avatar-cancel', function () { if (onCancel) onCancel(); else closePicker(render); }); cancel.disabled = busy;
|
|
126
|
+
var saveButton = button('Save avatar', 'mate-avatar-save', function () { save(mate, render); }); saveButton.disabled = busy || !s.dirty;
|
|
127
|
+
saveButton.className = 'primary';
|
|
128
|
+
var input = document.createElement('input'); input.type = 'file'; input.accept = 'image/png,image/jpeg,image/gif,image/webp'; input.hidden = true; input.tabIndex = -1;
|
|
129
|
+
input.className = 'home-mate-avatar-file-input'; input.addEventListener('change', function () { upload(mate, input, render); });
|
|
130
|
+
var uploadButton = button('Upload image', 'mate-avatar-upload', function () { input.click(); }); uploadButton.disabled = busy;
|
|
131
|
+
actions.appendChild(cancel); actions.appendChild(saveButton); actions.appendChild(uploadButton); actions.appendChild(input); section.appendChild(actions);
|
|
202
132
|
}
|
|
203
|
-
|
|
204
|
-
|
|
133
|
+
var status = document.createElement('p'); status.className = 'home-mate-avatar-status' + (s.error ? ' is-error' : '');
|
|
134
|
+
status.setAttribute('aria-live', 'polite'); status.setAttribute('role', s.error ? 'alert' : 'status'); status.textContent = s.error || (s.requestId ? 'Saving avatar…' : s.uploading ? 'Uploading image…' : s.saved ? 'Avatar saved.' : 'Choose a face, then save.');
|
|
135
|
+
(actions || section).appendChild(status); body.appendChild(section);
|
|
205
136
|
}
|
|
206
|
-
|
|
207
|
-
export function
|
|
208
|
-
|
|
209
|
-
var
|
|
210
|
-
|
|
211
|
-
pending = null;
|
|
212
|
-
delete draftByMate[mate.id];
|
|
213
|
-
statusByMate[mate.id] = { kind: 'saved', text: 'Avatar saved.' };
|
|
214
|
-
return true;
|
|
137
|
+
export function hasHomeMateAvatarDraft() { var s = state(); return !!s && s.dirty; }
|
|
138
|
+
export function homeMateAvatarSaving() { var s = state(); return !!s && (!!s.requestId || s.uploading); }
|
|
139
|
+
export function confirmHomeMateAvatar(mate, requestId) {
|
|
140
|
+
var s = state(); if (!mate || !s || s.mateId !== mate.id || !s.requestId || s.requestId !== requestId || (mate.profile || {}).avatarCatalogId !== s.selected) return false;
|
|
141
|
+
clearTimeout(timer); put(Object.assign({}, s, { requestId: null, dirty: false, saved: true, error: '' })); return true;
|
|
215
142
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
statusByMate[pending.mateId] = { kind: 'error', text: message || 'Could not save this avatar.' };
|
|
220
|
-
pending = null;
|
|
221
|
-
return true;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
export function clearHomeMateAvatarEditor() {
|
|
225
|
-
activeToken++;
|
|
226
|
-
activeMateId = null;
|
|
227
|
-
pending = null;
|
|
143
|
+
export function failHomeMateAvatar(mateId, message, requestId) {
|
|
144
|
+
var s = state(); if (!s || !s.requestId || s.mateId !== mateId || s.requestId !== requestId) return false;
|
|
145
|
+
clearTimeout(timer); put(Object.assign({}, s, { requestId: null, error: message || 'Could not save this avatar.' })); return true;
|
|
228
146
|
}
|
|
147
|
+
export function clearHomeMateAvatarEditor() { clearTimeout(timer); put(null); }
|
|
@@ -340,24 +340,26 @@ export function handleHomeDebateTranscript(msg) {
|
|
|
340
340
|
if (!isCurrentSessionMessage(msg)) return;
|
|
341
341
|
markHomeChatActivity();
|
|
342
342
|
settleHomeDebateLaunch(msg);
|
|
343
|
-
|
|
343
|
+
var questionMessage = ["home_debate_question", "home_mcp_import_question", "home_mate_question"].indexOf(msg.type) >= 0;
|
|
344
|
+
var questionResolved = ["home_debate_question_resolved", "home_mcp_import_question_resolved", "home_mate_question_resolved"].indexOf(msg.type) >= 0;
|
|
345
|
+
if (msg.type === "home_debate_proposal" || questionMessage || msg.type === "home_debate_event" || msg.type === "home_mate_creation_proposal" || msg.type === "home_mate_creation_question") messages = finalizeHomeAssistant(messages, streamingText, "", Date.now());
|
|
344
346
|
if (msg.type === "home_debate_event") messages = applyHomeDebateEvent(messages, msg);
|
|
345
347
|
if (msg.type === "home_debate_proposal") messages = applyHomeDebateProposal(messages, msg);
|
|
346
348
|
if (msg.type === "home_debate_proposal_resolved") messages = resolveHomeDebateProposal(messages, msg);
|
|
347
|
-
if (
|
|
348
|
-
if (
|
|
349
|
+
if (questionMessage) messages = applyHomeDebateQuestion(messages, msg);
|
|
350
|
+
if (questionResolved) messages = resolveHomeDebateQuestion(messages, msg);
|
|
349
351
|
if (msg.type === "home_mate_creation_question") messages = applyHomeDebateQuestion(messages, msg);
|
|
350
352
|
if (msg.type === "home_mate_creation_question_resolved") messages = resolveHomeDebateQuestion(messages, msg);
|
|
351
353
|
if (msg.type === "home_mate_creation_proposal") messages = applyHomeMateProposal(messages, msg);
|
|
352
354
|
if (msg.type === "home_mate_creation_proposal_resolved") messages = resolveHomeMateProposal(messages, msg);
|
|
353
355
|
if (msg.type === "home_mate_error" && /^question_/.test(msg.code || "")) messages = failHomeDebateQuestion(messages, msg);
|
|
354
|
-
if (msg.type === "home_debate_proposal" ||
|
|
355
|
-
if ((
|
|
356
|
+
if (msg.type === "home_debate_proposal" || questionMessage || msg.type === "home_debate_event" || msg.type === "home_mate_creation_proposal" || msg.type === "home_mate_creation_question") { clearHomeDebatePlanningPending(); streaming = false; streamingText = ""; }
|
|
357
|
+
if ((questionResolved || msg.type === "home_mate_creation_question_resolved") && msg.status === "expired") clearHomeDebatePlanningPending();
|
|
356
358
|
renderHomeChat();
|
|
357
359
|
if (msg.proposalId) restoreHomeDebateProposalFocus(msg.proposalId);
|
|
358
360
|
if (msg.proposalId && msg.type === "home_mate_creation_proposal_resolved") restoreHomeMateProposalFocus(msg.proposalId);
|
|
359
361
|
if (msg.toolId && msg.type === "home_mate_creation_question") restoreHomeDebateQuestionFocus(msg.toolId);
|
|
360
|
-
if (msg.toolId &&
|
|
362
|
+
if (msg.toolId && questionResolved) restoreHomeDebateQuestionFocus(msg.toolId);
|
|
361
363
|
if (msg.toolId && msg.type === "home_mate_error") restoreHomeDebateQuestionFocus(msg.toolId);
|
|
362
364
|
}
|
|
363
365
|
export function handleHomeMateDelta(msg) {
|
|
@@ -7,6 +7,67 @@ function textElement(tag, className, text) {
|
|
|
7
7
|
return element;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
function scheduleDate(value) {
|
|
11
|
+
var parts = String(value || "").split("-").map(Number);
|
|
12
|
+
var date = new Date(Date.UTC(parts[0], parts[1] - 1, parts[2]));
|
|
13
|
+
return Number.isFinite(date.getTime()) ? date.toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric", timeZone: "UTC" }) : value;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function exactScheduleFact(proposal) {
|
|
17
|
+
var intent = proposal.scheduleIntent;
|
|
18
|
+
var schedule = intent.scheduleRule;
|
|
19
|
+
var recurrence = schedule.recurrence;
|
|
20
|
+
var timing = "On " + scheduleDate(schedule.anchorDate);
|
|
21
|
+
if (recurrence) {
|
|
22
|
+
var days = (recurrence.weekdays || []).map(function (day) { return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][day]; });
|
|
23
|
+
if (recurrence.unit === "week" && recurrence.every === 1 && (recurrence.weekdays || []).join(",") === "1,2,3,4,5") timing = "Every weekday";
|
|
24
|
+
else if (recurrence.unit === "week" && recurrence.every === 1 && days.length) timing = "Every " + days.join(", ");
|
|
25
|
+
else timing = "Every " + (recurrence.every === 1 ? recurrence.unit : recurrence.every + " " + recurrence.unit + "s") + (days.length ? " on " + days.join(", ") : "");
|
|
26
|
+
}
|
|
27
|
+
timing += " at " + schedule.time + " (" + (proposal.scheduleTimezone || "server local") + ")";
|
|
28
|
+
if (recurrence) timing += ", starting " + scheduleDate(schedule.anchorDate);
|
|
29
|
+
if (schedule.recurrenceEnd) timing += schedule.recurrenceEnd.type === "after" ? "; for " + schedule.recurrenceEnd.count + " deliveries" : "; through " + scheduleDate(schedule.recurrenceEnd.date);
|
|
30
|
+
if (schedule.interval) {
|
|
31
|
+
var interval = schedule.interval;
|
|
32
|
+
timing += "; every " + interval.every + " " + interval.unit + (interval.every === 1 ? "" : "s");
|
|
33
|
+
timing += !interval.end ? " until end of day" : interval.end.type === "after" ? ", " + interval.end.count + " deliveries per day" : " until " + interval.end.time;
|
|
34
|
+
}
|
|
35
|
+
return timing + ": " + intent.message;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function friendlyTime(value) {
|
|
39
|
+
var parts = value.split(":");
|
|
40
|
+
var hour = Number(parts[0]);
|
|
41
|
+
if (parts[1] === "00" && (hour === 0 || hour === 12)) return hour === 0 ? "midnight" : "noon";
|
|
42
|
+
return (hour % 12 || 12) + (parts[1] === "00" ? "" : ":" + parts[1]) + (hour < 12 ? " AM" : " PM");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function scheduleSummary(proposal) {
|
|
46
|
+
var intent = proposal.scheduleIntent;
|
|
47
|
+
var schedule = intent.scheduleRule;
|
|
48
|
+
var recurrence = schedule.recurrence;
|
|
49
|
+
var timing = scheduleDate(schedule.anchorDate);
|
|
50
|
+
if (recurrence) {
|
|
51
|
+
var days = (recurrence.weekdays || []).map(function (day) { return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][day]; });
|
|
52
|
+
if (recurrence.unit === "week" && recurrence.every === 1 && (recurrence.weekdays || []).join(",") === "1,2,3,4,5") timing = "Every weekday";
|
|
53
|
+
else if (recurrence.unit === "week" && recurrence.every === 1 && days.length) timing = "Every " + days.join(", ");
|
|
54
|
+
else timing = "Every " + (recurrence.every === 1 ? recurrence.unit : recurrence.every + " " + recurrence.unit + "s") + (days.length ? " on " + days.join(", ") : "");
|
|
55
|
+
}
|
|
56
|
+
var hour = Number(schedule.time.split(":")[0]);
|
|
57
|
+
var time = friendlyTime(schedule.time);
|
|
58
|
+
var period = hour >= 5 && hour < 12 ? "morning" : hour >= 13 && hour < 17 ? "afternoon" : hour >= 17 && hour < 21 ? "evening" : "";
|
|
59
|
+
if (recurrence && period && recurrence.unit === "day" && recurrence.every === 1) timing = "Every " + period + " at " + time.replace(/ (AM|PM)$/, "");
|
|
60
|
+
else if (recurrence && period && timing === "Every weekday") timing += " " + period + " at " + time.replace(/ (AM|PM)$/, "");
|
|
61
|
+
else timing += " at " + time;
|
|
62
|
+
if (schedule.recurrenceEnd) timing += schedule.recurrenceEnd.type === "after" ? ", for " + schedule.recurrenceEnd.count + (schedule.recurrenceEnd.count === 1 ? " delivery" : " deliveries") : ", through " + scheduleDate(schedule.recurrenceEnd.date);
|
|
63
|
+
if (schedule.interval) {
|
|
64
|
+
var interval = schedule.interval;
|
|
65
|
+
timing += ", then every " + interval.every + " " + interval.unit + (interval.every === 1 ? "" : "s");
|
|
66
|
+
timing += !interval.end ? " until the end of the day" : interval.end.type === "after" ? ", " + interval.end.count + " deliveries a day" : " until " + friendlyTime(interval.end.time);
|
|
67
|
+
}
|
|
68
|
+
return timing + ": " + intent.message;
|
|
69
|
+
}
|
|
70
|
+
|
|
10
71
|
export function createHomeMateProposalCard(message, respond, openMate) {
|
|
11
72
|
var proposal = message.proposal || {};
|
|
12
73
|
var card = document.createElement("section");
|
|
@@ -21,12 +82,23 @@ export function createHomeMateProposalCard(message, respond, openMate) {
|
|
|
21
82
|
function fact(label, value) {
|
|
22
83
|
if (!value) return;
|
|
23
84
|
facts.appendChild(textElement("dt", "", label));
|
|
24
|
-
|
|
85
|
+
var description = textElement("dd", "", typeof value === "string" ? value : "");
|
|
86
|
+
if (typeof value !== "string") description.appendChild(value);
|
|
87
|
+
facts.appendChild(description);
|
|
88
|
+
return description;
|
|
25
89
|
}
|
|
26
90
|
fact("Relationship", proposal.relationship);
|
|
27
91
|
fact("Activities", Array.isArray(proposal.activities) ? proposal.activities.join(", ") : "");
|
|
28
92
|
fact("Communication", Array.isArray(proposal.communicationStyle) ? proposal.communicationStyle.join(", ") : "");
|
|
29
93
|
fact("Autonomy", proposal.autonomy);
|
|
94
|
+
if (proposal.scheduleIntent && proposal.scheduleIntent.message && proposal.scheduleIntent.scheduleRule) {
|
|
95
|
+
var scheduleItem = fact("Schedule", textElement("span", "home-mate-proposal-schedule-summary", scheduleSummary(proposal)));
|
|
96
|
+
var exactTiming = document.createElement("details");
|
|
97
|
+
exactTiming.className = "home-mate-proposal-schedule-details";
|
|
98
|
+
exactTiming.appendChild(textElement("summary", "", "Exact timing"));
|
|
99
|
+
exactTiming.appendChild(textElement("div", "", exactScheduleFact(proposal)));
|
|
100
|
+
scheduleItem.appendChild(exactTiming);
|
|
101
|
+
}
|
|
30
102
|
card.appendChild(facts);
|
|
31
103
|
if (proposal.identityMarkdown) {
|
|
32
104
|
var details = document.createElement("details");
|