synabun 2.2.1 → 2.3.0
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/CHANGELOG.md +53 -0
- package/README.md +1 -1
- package/docs/whatsapp.md +52 -20
- package/hooks/claude-code/pre-websearch.mjs +4 -1
- package/hooks/claude-code/prompt-submit.mjs +7 -0
- package/lib/mcp-build.js +519 -0
- package/lib/mcp-dist.js +10 -4
- package/lib/release-scan.mjs +23 -10
- package/lib/server-supervisor.js +7 -1
- package/lib/virustotal.mjs +146 -40
- package/mcp-server/dist/http.d.ts +57 -0
- package/mcp-server/dist/http.d.ts.map +1 -1
- package/mcp-server/dist/http.js +128 -18
- package/mcp-server/dist/http.js.map +1 -1
- package/mcp-server/dist/index.d.ts.map +1 -1
- package/mcp-server/dist/index.js +14 -9
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.d.ts +119 -0
- package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -0
- package/mcp-server/dist/services/browser-route-flow.js +340 -0
- package/mcp-server/dist/services/browser-route-flow.js.map +1 -0
- package/mcp-server/dist/services/desktop-client.js +2 -2
- package/mcp-server/dist/services/desktop-client.js.map +1 -1
- package/mcp-server/dist/services/embedding-service.d.ts.map +1 -1
- package/mcp-server/dist/services/embedding-service.js +2 -1
- package/mcp-server/dist/services/embedding-service.js.map +1 -1
- package/mcp-server/dist/services/identity.d.ts +66 -3
- package/mcp-server/dist/services/identity.d.ts.map +1 -1
- package/mcp-server/dist/services/identity.js +61 -4
- package/mcp-server/dist/services/identity.js.map +1 -1
- package/mcp-server/dist/services/neural-interface.d.ts +133 -1
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +630 -64
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/services/tool-catalog.js +2 -2
- package/mcp-server/dist/services/tool-catalog.js.map +1 -1
- package/mcp-server/dist/tools/agents.d.ts +3 -2
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +6 -4
- package/mcp-server/dist/tools/agents.js.map +1 -1
- package/mcp-server/dist/tools/bluesky.d.ts +20 -7
- package/mcp-server/dist/tools/bluesky.d.ts.map +1 -1
- package/mcp-server/dist/tools/bluesky.js +147 -45
- package/mcp-server/dist/tools/bluesky.js.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts +13 -2
- package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.js +153 -18
- package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
- package/mcp-server/dist/tools/browser-cheatsheet.d.ts +2 -0
- package/mcp-server/dist/tools/browser-cheatsheet.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-cheatsheet.js +3 -0
- package/mcp-server/dist/tools/browser-cheatsheet.js.map +1 -1
- package/mcp-server/dist/tools/browser-navigate.d.ts +3 -3
- package/mcp-server/dist/tools/browser-navigate.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-navigate.js +19 -16
- package/mcp-server/dist/tools/browser-navigate.js.map +1 -1
- package/mcp-server/dist/tools/browser-observe.d.ts +2 -1
- package/mcp-server/dist/tools/browser-observe.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-observe.js +61 -20
- package/mcp-server/dist/tools/browser-observe.js.map +1 -1
- package/mcp-server/dist/tools/morelogin.d.ts +13 -3
- package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
- package/mcp-server/dist/tools/morelogin.js +82 -19
- package/mcp-server/dist/tools/morelogin.js.map +1 -1
- package/mcp-server/dist/tools/skill-tools.d.ts +4 -4
- package/mcp-server/dist/tools/youtube/helpers.d.ts +1 -0
- package/mcp-server/dist/tools/youtube/helpers.d.ts.map +1 -1
- package/mcp-server/dist/tools/youtube/helpers.js +1 -1
- package/mcp-server/dist/tools/youtube/helpers.js.map +1 -1
- package/mcp-server/dist/tools/youtube/upload.d.ts.map +1 -1
- package/mcp-server/dist/tools/youtube/upload.js +225 -88
- package/mcp-server/dist/tools/youtube/upload.js.map +1 -1
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/http.ts +135 -17
- package/mcp-server/src/index.ts +15 -9
- package/mcp-server/src/services/browser-route-flow.ts +403 -0
- package/mcp-server/src/services/desktop-client.ts +2 -2
- package/mcp-server/src/services/embedding-service.ts +2 -1
- package/mcp-server/src/services/identity.ts +80 -4
- package/mcp-server/src/services/neural-interface.ts +648 -73
- package/mcp-server/src/services/tool-catalog.ts +2 -2
- package/mcp-server/src/tools/agents.ts +8 -4
- package/mcp-server/src/tools/bluesky.ts +164 -51
- package/mcp-server/src/tools/browser-advanced.ts +142 -17
- package/mcp-server/src/tools/browser-cheatsheet.ts +3 -0
- package/mcp-server/src/tools/browser-navigate.ts +19 -16
- package/mcp-server/src/tools/browser-observe.ts +62 -20
- package/mcp-server/src/tools/morelogin.ts +82 -19
- package/mcp-server/src/tools/youtube/helpers.ts +2 -2
- package/mcp-server/src/tools/youtube/upload.ts +218 -99
- package/neural-interface/i18n/en.json +655 -123
- package/neural-interface/i18n/pt-BR.json +542 -10
- package/neural-interface/lib/assistant-api.js +90 -23
- package/neural-interface/lib/assistant-brains/claude.js +5 -0
- package/neural-interface/lib/assistant-catalog.js +134 -3
- package/neural-interface/lib/assistant-dispatch.js +97 -1
- package/neural-interface/lib/assistant-persona.js +15 -7
- package/neural-interface/lib/assistant-router.js +6 -4
- package/neural-interface/lib/assistant-runtime.js +18 -1
- package/neural-interface/lib/assistant-task-prompt.js +5 -0
- package/neural-interface/lib/assistant-tools.js +10 -1
- package/neural-interface/lib/automation-approval.js +249 -0
- package/neural-interface/lib/automation-browser-owner-access.js +82 -0
- package/neural-interface/lib/backup-service.js +16 -1
- package/neural-interface/lib/browser-automation-routes.js +84 -0
- package/neural-interface/lib/browser-background-tab.js +72 -3
- package/neural-interface/lib/browser-execution.js +16 -3
- package/neural-interface/lib/browser-extraction.js +106 -45
- package/neural-interface/lib/browser-owner.js +48 -0
- package/neural-interface/lib/browser-profile-choices.js +143 -0
- package/neural-interface/lib/browser-profiles.js +142 -0
- package/neural-interface/lib/browser-session-close.js +84 -0
- package/neural-interface/lib/browser-start-handoff.js +202 -0
- package/neural-interface/lib/browser-tab-recovery.js +153 -0
- package/neural-interface/lib/browser-tool-policy.js +23 -4
- package/neural-interface/lib/browser-wedge-retire.js +64 -0
- package/neural-interface/lib/chromium-on-device-model.js +67 -0
- package/neural-interface/lib/claude-agent-bridge.js +43 -5
- package/neural-interface/lib/claude-background-hold.js +239 -0
- package/neural-interface/lib/claude-model-catalog.js +12 -0
- package/neural-interface/lib/effort-levels.js +28 -2
- package/neural-interface/lib/exec-loop-command.js +8 -0
- package/neural-interface/lib/http-guards.js +11 -6
- package/neural-interface/lib/local-profile-proxy.js +362 -0
- package/neural-interface/lib/local-profiles.js +929 -0
- package/neural-interface/lib/loop-logger.js +31 -5
- package/neural-interface/lib/maritaca/api.js +179 -0
- package/neural-interface/lib/maritaca/attachments.js +44 -0
- package/neural-interface/lib/maritaca/client.js +362 -0
- package/neural-interface/lib/maritaca/key-store.js +122 -0
- package/neural-interface/lib/maritaca/models.js +181 -0
- package/neural-interface/lib/maritaca/modes.js +39 -0
- package/neural-interface/lib/maritaca/opencode-proxy.js +236 -0
- package/neural-interface/lib/maritaca/opencode-stream.js +345 -0
- package/neural-interface/lib/maritaca/opencode.js +218 -0
- package/neural-interface/lib/maritaca/panel-bridge.js +273 -0
- package/neural-interface/lib/maritaca/sessions.js +198 -0
- package/neural-interface/lib/mcp-external-servers.js +37 -10
- package/neural-interface/lib/morelogin-agent-profiles.js +149 -0
- package/neural-interface/lib/morelogin.js +278 -14
- package/neural-interface/lib/native-loop-providers.js +124 -11
- package/neural-interface/lib/native-loop-runtime.js +112 -11
- package/neural-interface/lib/owner-authority.js +137 -43
- package/neural-interface/lib/page-session.js +111 -27
- package/neural-interface/lib/peer-identity.js +263 -43
- package/neural-interface/lib/provider-panel-api-key-auth.js +7 -2
- package/neural-interface/lib/pty-host/core.js +36 -0
- package/neural-interface/lib/pty-host/protocol.js +2 -0
- package/neural-interface/lib/request-gate.js +2 -0
- package/neural-interface/lib/skills/api-v2.js +13 -2
- package/neural-interface/lib/skills/creation-api.js +3 -1
- package/neural-interface/lib/skills/evals-api.js +5 -1
- package/neural-interface/lib/social-write-pacing.js +151 -0
- package/neural-interface/lib/system-activity.js +1 -1
- package/neural-interface/lib/terminal-token-redaction.js +293 -0
- package/neural-interface/lib/terminal-tokens.js +436 -0
- package/neural-interface/lib/worker-mcp-channel.js +45 -10
- package/neural-interface/package-lock.json +3 -2
- package/neural-interface/package.json +2 -1
- package/neural-interface/public/assets/mascot/README.md +11 -0
- package/neural-interface/public/assets/mascot/ask.gif +0 -0
- package/neural-interface/public/assets/mascot/ask.png +0 -0
- package/neural-interface/public/assets/mascot/blocked.gif +0 -0
- package/neural-interface/public/assets/mascot/blocked.png +0 -0
- package/neural-interface/public/assets/mascot/budget.gif +0 -0
- package/neural-interface/public/assets/mascot/budget.png +0 -0
- package/neural-interface/public/assets/mascot/computer.gif +0 -0
- package/neural-interface/public/assets/mascot/computer.png +0 -0
- package/neural-interface/public/assets/mascot/edit.gif +0 -0
- package/neural-interface/public/assets/mascot/edit.png +0 -0
- package/neural-interface/public/assets/mascot/error.gif +0 -0
- package/neural-interface/public/assets/mascot/error.png +0 -0
- package/neural-interface/public/assets/mascot/hover-attention.gif +0 -0
- package/neural-interface/public/assets/mascot/hover-attention.png +0 -0
- package/neural-interface/public/assets/mascot/idle-hero.gif +0 -0
- package/neural-interface/public/assets/mascot/idle-hero.png +0 -0
- package/neural-interface/public/assets/mascot/idle.gif +0 -0
- package/neural-interface/public/assets/mascot/idle.png +0 -0
- package/neural-interface/public/assets/mascot/manifest.json +254 -0
- package/neural-interface/public/assets/mascot/mcp.gif +0 -0
- package/neural-interface/public/assets/mascot/mcp.png +0 -0
- package/neural-interface/public/assets/mascot/memory.gif +0 -0
- package/neural-interface/public/assets/mascot/memory.png +0 -0
- package/neural-interface/public/assets/mascot/offline.gif +0 -0
- package/neural-interface/public/assets/mascot/offline.png +0 -0
- package/neural-interface/public/assets/mascot/pick.gif +0 -0
- package/neural-interface/public/assets/mascot/pick.png +0 -0
- package/neural-interface/public/assets/mascot/plan.gif +0 -0
- package/neural-interface/public/assets/mascot/plan.png +0 -0
- package/neural-interface/public/assets/mascot/present.gif +0 -0
- package/neural-interface/public/assets/mascot/present.png +0 -0
- package/neural-interface/public/assets/mascot/project.gif +0 -0
- package/neural-interface/public/assets/mascot/project.png +0 -0
- package/neural-interface/public/assets/mascot/read.gif +0 -0
- package/neural-interface/public/assets/mascot/read.png +0 -0
- package/neural-interface/public/assets/mascot/runs.gif +0 -0
- package/neural-interface/public/assets/mascot/runs.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/automation.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/automation.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/browser.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/browser.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/code.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/code.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/complex.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/complex.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/computer.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/computer.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/design.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/design.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/edit.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/edit.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/generic.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/generic.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/image_gen.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/image_gen.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/manifest.json +173 -0
- package/neural-interface/public/assets/mascot/scenes/memory.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/memory.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/quick.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/quick.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/read.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/read.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/research.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/research.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/review.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/review.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/search.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/search.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/shell.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/shell.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/thinking.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/thinking.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/video_gen.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/video_gen.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/web.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/web.png +0 -0
- package/neural-interface/public/assets/mascot/search.gif +0 -0
- package/neural-interface/public/assets/mascot/search.png +0 -0
- package/neural-interface/public/assets/mascot/shell.gif +0 -0
- package/neural-interface/public/assets/mascot/shell.png +0 -0
- package/neural-interface/public/assets/mascot/skill.gif +0 -0
- package/neural-interface/public/assets/mascot/skill.png +0 -0
- package/neural-interface/public/assets/mascot/sleep.gif +0 -0
- package/neural-interface/public/assets/mascot/sleep.png +0 -0
- package/neural-interface/public/assets/mascot/subagent.gif +0 -0
- package/neural-interface/public/assets/mascot/subagent.png +0 -0
- package/neural-interface/public/assets/mascot/success.gif +0 -0
- package/neural-interface/public/assets/mascot/success.png +0 -0
- package/neural-interface/public/assets/mascot/think.gif +0 -0
- package/neural-interface/public/assets/mascot/think.png +0 -0
- package/neural-interface/public/assets/mascot/wait.gif +0 -0
- package/neural-interface/public/assets/mascot/wait.png +0 -0
- package/neural-interface/public/assets/mascot/watch.gif +0 -0
- package/neural-interface/public/assets/mascot/watch.png +0 -0
- package/neural-interface/public/assets/mascot/web.gif +0 -0
- package/neural-interface/public/assets/mascot/web.png +0 -0
- package/neural-interface/public/onboarding.html +14 -1
- package/neural-interface/public/shared/agent-runtime-options.js +49 -8
- package/neural-interface/public/shared/agy/agy-panel.js +2 -2
- package/neural-interface/public/shared/agy/agy-render.js +41 -1
- package/neural-interface/public/shared/agy/agy-styles.js +5 -0
- package/neural-interface/public/shared/api.js +5 -4
- package/neural-interface/public/shared/assistant/asst-ask-styles.js +8 -8
- package/neural-interface/public/shared/assistant/asst-ask.js +1 -1
- package/neural-interface/public/shared/assistant/asst-brain-picker.js +99 -9
- package/neural-interface/public/shared/assistant/asst-computer.js +47 -2
- package/neural-interface/public/shared/assistant/asst-control.js +1 -1
- package/neural-interface/public/shared/assistant/asst-limit-wait.js +7 -5
- package/neural-interface/public/shared/assistant/asst-panel.js +13 -5
- package/neural-interface/public/shared/assistant/asst-rack-styles.js +4 -4
- package/neural-interface/public/shared/assistant/asst-render.js +16 -10
- package/neural-interface/public/shared/assistant/asst-route-models.js +64 -4
- package/neural-interface/public/shared/assistant/asst-route.js +24 -7
- package/neural-interface/public/shared/assistant/asst-routes-editor.js +154 -39
- package/neural-interface/public/shared/assistant/asst-run-stage.js +3 -3
- package/neural-interface/public/shared/assistant/asst-scene-styles.js +8 -111
- package/neural-interface/public/shared/assistant/asst-scenes.js +46 -318
- package/neural-interface/public/shared/assistant/asst-sidepanel.js +2 -2
- package/neural-interface/public/shared/assistant/asst-state.js +72 -2
- package/neural-interface/public/shared/assistant/asst-styles.js +60 -15
- package/neural-interface/public/shared/automation-approval-view.js +75 -0
- package/neural-interface/public/shared/cdx/cdx-panel.js +2 -2
- package/neural-interface/public/shared/cdx/cdx-render.js +73 -7
- package/neural-interface/public/shared/cdx/cdx-tabs.js +3 -3
- package/neural-interface/public/shared/context-menu-model.js +2 -0
- package/neural-interface/public/shared/cp/cp-agents.js +8 -0
- package/neural-interface/public/shared/cp/cp-permissions.js +6 -2
- package/neural-interface/public/shared/cp/cp-rehydrate.js +25 -1
- package/neural-interface/public/shared/cp/cp-tasks-model.js +33 -0
- package/neural-interface/public/shared/editor/editor-panel-logic.js +10 -0
- package/neural-interface/public/shared/editor/editor-panel.js +10 -2
- package/neural-interface/public/shared/html-shell.js +30 -22
- package/neural-interface/public/shared/judgments-log-origins.js +29 -0
- package/neural-interface/public/shared/morelogin-profile-choices.js +107 -0
- package/neural-interface/public/shared/morelogin-profile-field.js +186 -0
- package/neural-interface/public/shared/mtc/mtc-client.js +181 -0
- package/neural-interface/public/shared/mtc/mtc-compose.js +40 -0
- package/neural-interface/public/shared/mtc/mtc-copy.js +253 -0
- package/neural-interface/public/shared/mtc/mtc-logic.js +478 -0
- package/neural-interface/public/shared/mtc/mtc-panel.js +1354 -0
- package/neural-interface/public/shared/mtc/mtc-render.js +172 -0
- package/neural-interface/public/shared/mtc/mtc-styles.js +437 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-automation-ownership.js +23 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-events.js +13 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-icons.js +3 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +10 -4
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +6 -86
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +5 -2
- package/neural-interface/public/shared/owner-access.js +134 -0
- package/neural-interface/public/shared/owner-authority-view.js +92 -0
- package/neural-interface/public/shared/page-session.js +143 -14
- package/neural-interface/public/shared/poll-backoff.js +59 -0
- package/neural-interface/public/shared/provider-icons.js +3 -0
- package/neural-interface/public/shared/schedules-view.js +7 -0
- package/neural-interface/public/shared/server-back.js +50 -0
- package/neural-interface/public/shared/settings/settings-browser-owner-access.js +72 -0
- package/neural-interface/public/shared/settings/settings-data.js +7 -1
- package/neural-interface/public/shared/settings/settings-ia.js +3 -1
- package/neural-interface/public/shared/settings/settings-kit.js +11 -3
- package/neural-interface/public/shared/settings/settings-local-profiles.js +153 -0
- package/neural-interface/public/shared/settings/settings-maritaca-opencode.js +105 -0
- package/neural-interface/public/shared/settings/settings-shell.js +7 -0
- package/neural-interface/public/shared/shown-children.js +72 -0
- package/neural-interface/public/shared/sidepanel-session-status.js +16 -2
- package/neural-interface/public/shared/state.js +1 -1
- package/neural-interface/public/shared/static-bg-state.js +22 -0
- package/neural-interface/public/shared/styles.css +457 -164
- package/neural-interface/public/shared/synabun-mascot-assets.js +67 -0
- package/neural-interface/public/shared/synabun-mascot.js +136 -12
- package/neural-interface/public/shared/synabun-ticker.js +3 -0
- package/neural-interface/public/shared/synabun-tools.js +173 -0
- package/neural-interface/public/shared/tool-heartbeat.js +43 -0
- package/neural-interface/public/shared/tool-list-picker.js +3 -1
- package/neural-interface/public/shared/tool-list-view.js +23 -4
- package/neural-interface/public/shared/topright-overflow-logic.js +1 -0
- package/neural-interface/public/shared/ui-automation-approval.js +188 -0
- package/neural-interface/public/shared/ui-automation-studio.js +138 -91
- package/neural-interface/public/shared/ui-claude-panel.js +209 -31
- package/neural-interface/public/shared/ui-judgments.js +37 -10
- package/neural-interface/public/shared/ui-maritaca-panel.js +15 -0
- package/neural-interface/public/shared/ui-navbar.js +23 -0
- package/neural-interface/public/shared/ui-owner-access.js +191 -0
- package/neural-interface/public/shared/ui-owner-authority.js +162 -0
- package/neural-interface/public/shared/ui-panels.js +3 -1
- package/neural-interface/public/shared/ui-schedules-studio.js +118 -17
- package/neural-interface/public/shared/ui-scroll-follow.js +3 -0
- package/neural-interface/public/shared/ui-sessions.js +45 -16
- package/neural-interface/public/shared/ui-settings.js +676 -42
- package/neural-interface/public/shared/ui-sidepanel-session-entry.js +8 -2
- package/neural-interface/public/shared/ui-sidepanel-sessions.js +3 -3
- package/neural-interface/public/shared/ui-sidepanel-tray.js +24 -0
- package/neural-interface/public/shared/ui-sidepanel-windows.js +1 -1
- package/neural-interface/public/shared/ui-terminal.js +15 -7
- package/neural-interface/public/shared/ui-tutorial-preview.js +4 -0
- package/neural-interface/public/shared/ui-update.js +3 -0
- package/neural-interface/public/shared/ui-whiteboard.js +4 -0
- package/neural-interface/public/shared/window-keys.js +38 -0
- package/neural-interface/scripts/build-mascot-assets.mjs +30 -0
- package/neural-interface/server.js +2903 -359
- package/npm-shrinkwrap.json +5 -17
- package/package.json +5 -6
- package/postinstall.js +38 -39
- package/setup.js +33 -31
- package/skills/synabun/modules/changelog.md +14 -0
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* look successful).
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import { statSync } from 'node:fs';
|
|
17
18
|
import { z } from 'zod/v3';
|
|
18
19
|
import { v4 as uuidv4 } from 'uuid';
|
|
19
20
|
import * as ni from '../../services/neural-interface.js';
|
|
@@ -25,7 +26,7 @@ import type { MemoryPayload } from '../../types.js';
|
|
|
25
26
|
import { text } from '../response.js';
|
|
26
27
|
import {
|
|
27
28
|
STUDIO_BASE, resolve, ensureAuth, wait, pollFor, safeNavigate,
|
|
28
|
-
clickStudio, fillStudio,
|
|
29
|
+
clickStudio, fillStudio, type Resolved,
|
|
29
30
|
} from './helpers.js';
|
|
30
31
|
import { TRAILER_CATEGORY, ledgerTags } from './dedup.js';
|
|
31
32
|
|
|
@@ -52,7 +53,9 @@ export const youtubeUploadSchema = {
|
|
|
52
53
|
export const youtubeUploadDescription =
|
|
53
54
|
'Upload a local video file to YouTube Studio, publish it, and record it to the youtube-videos dedup ledger. ' +
|
|
54
55
|
'Opens Create → Upload, sets the file, fills title/description/tags, advances the wizard, sets visibility, clicks Done, then verifies the wizard closed and resolves the new video id. [mutating — publishes to the channel]. ' +
|
|
55
|
-
'Pass game/igdbId/appid/sourceTrailerId so the upload is remembered and never re-posted. Default visibility=private so you can schedule afterwards with youtube_schedule.'
|
|
56
|
+
'Pass game/igdbId/appid/sourceTrailerId so the upload is remembered and never re-posted. Default visibility=private so you can schedule afterwards with youtube_schedule. ' +
|
|
57
|
+
'Result JSON: state = "published" (the tool clicked Publish/Save and Studio confirmed it; visibility is then the one applied), "draft" (a video row exists but is NOT published: see draftReason, e.g. processing/checks still running or the publish step not reached; finish it in Studio with Edit draft → Visibility → Publish once processing ends, never re-upload) or "upload_not_confirmed" (no evidence a row exists; check Studio → Content before any retry). ' +
|
|
58
|
+
'videoId is read only from this upload\'s own dialog; idConfirmed=false with videoId null means no trustworthy id was found (never a guess). videoRowExists tells you whether a duplicate upload would be created by retrying.';
|
|
56
59
|
|
|
57
60
|
async function ensureOnStudio(r: Resolved): Promise<string | null> {
|
|
58
61
|
const res = await ni.evaluate(r.sessionId, `location.href`, r.tabId);
|
|
@@ -117,6 +120,86 @@ async function recordTrailerLedger(idy: {
|
|
|
117
120
|
}
|
|
118
121
|
}
|
|
119
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Read the upload dialog's own state. Everything is scoped to
|
|
125
|
+
* ytcp-uploads-dialog (and the share dialog Studio shows after Publish/Save),
|
|
126
|
+
* never the page: the old reader matched the first youtu.be link anywhere in
|
|
127
|
+
* document.body, which picked up other videos of the channel.
|
|
128
|
+
*/
|
|
129
|
+
const DIALOG_PROBE = `(() => {
|
|
130
|
+
const ID = /(?:youtu\\.be\\/|\\/shorts\\/|watch\\?v=|\\/video\\/)([A-Za-z0-9_-]{11})(?![A-Za-z0-9_-])/;
|
|
131
|
+
const deepAll = (root, sel, out) => {
|
|
132
|
+
if (!root) return out;
|
|
133
|
+
root.querySelectorAll(sel).forEach((el) => out.push(el));
|
|
134
|
+
root.querySelectorAll('*').forEach((el) => { if (el.shadowRoot) deepAll(el.shadowRoot, sel, out); });
|
|
135
|
+
return out;
|
|
136
|
+
};
|
|
137
|
+
const visible = (el) => !!el && !el.hidden && el.getAttribute('aria-hidden') !== 'true' && !!(el.offsetWidth || el.offsetHeight || el.getClientRects().length);
|
|
138
|
+
const idIn = (root) => {
|
|
139
|
+
if (!root) return null;
|
|
140
|
+
for (const a of deepAll(root, 'a[href]', [])) { const m = (a.getAttribute('href') || '').match(ID); if (m) return m[1]; }
|
|
141
|
+
for (const el of deepAll(root, '[video-id],[data-video-id]', [])) {
|
|
142
|
+
const v = el.getAttribute('video-id') || el.getAttribute('data-video-id');
|
|
143
|
+
if (v && /^[A-Za-z0-9_-]{11}$/.test(v)) return v;
|
|
144
|
+
}
|
|
145
|
+
return null;
|
|
146
|
+
};
|
|
147
|
+
const dialog = deepAll(document, 'ytcp-uploads-dialog', []).find(visible) || null;
|
|
148
|
+
const share = deepAll(document, 'ytcp-video-share-dialog', []).find(visible) || null;
|
|
149
|
+
const prechecks = deepAll(document, 'ytcp-prechecks-warning-dialog', []).find(visible) || null;
|
|
150
|
+
const progress = dialog ? (deepAll(dialog, 'ytcp-video-upload-progress', [])[0] || null) : null;
|
|
151
|
+
const progressText = progress ? (progress.innerText || progress.textContent || '').replace(/\\s+/g, ' ').trim() : '';
|
|
152
|
+
const pm = progressText.match(/(\\d{1,3})\\s?%/);
|
|
153
|
+
const done = dialog ? (deepAll(dialog, '#done-button', [])[0] || null) : null;
|
|
154
|
+
const doneDisabled = done ? (done.hasAttribute('disabled') || done.getAttribute('aria-disabled') === 'true') : null;
|
|
155
|
+
const uploadingAttr = progress ? (progress.hasAttribute('uploading') || progress.getAttribute('upload-status') === 'UPLOADING') : false;
|
|
156
|
+
const uploadingWord = /upload|envi|carreg/i.test(progressText) && !!pm;
|
|
157
|
+
return {
|
|
158
|
+
dialogOpen: !!dialog,
|
|
159
|
+
shareOpen: !!share,
|
|
160
|
+
prechecksOpen: !!prechecks,
|
|
161
|
+
id: idIn(share) || idIn(dialog),
|
|
162
|
+
percent: pm ? Number(pm[1]) : null,
|
|
163
|
+
uploading: uploadingAttr || uploadingWord,
|
|
164
|
+
progressText: progressText.slice(0, 160),
|
|
165
|
+
doneDisabled,
|
|
166
|
+
formVisible: !!dialog && deepAll(dialog, '#title-textarea', []).some(visible),
|
|
167
|
+
};
|
|
168
|
+
})()`;
|
|
169
|
+
|
|
170
|
+
type DialogState = {
|
|
171
|
+
dialogOpen: boolean; shareOpen: boolean; prechecksOpen: boolean; id: string | null;
|
|
172
|
+
percent: number | null; uploading: boolean; progressText: string; doneDisabled: boolean | null; formVisible: boolean;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
async function probe(r: Resolved): Promise<DialogState | null> {
|
|
176
|
+
const res = await ni.evaluate(r.sessionId, DIALOG_PROBE, r.tabId);
|
|
177
|
+
if (res.error || !res.result || typeof res.result !== 'object') return null;
|
|
178
|
+
return res.result as DialogState;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Wait until the file transfer itself is over (no longer "uploading"), bounded by a size-aware limit. */
|
|
182
|
+
async function waitForTransfer(r: Resolved, limitMs: number): Promise<{ finished: boolean; last: DialogState | null }> {
|
|
183
|
+
const start = Date.now();
|
|
184
|
+
let last: DialogState | null = null;
|
|
185
|
+
while (Date.now() - start < limitMs) {
|
|
186
|
+
last = await probe(r);
|
|
187
|
+
if (last && last.dialogOpen && last.formVisible && !last.uploading) return { finished: true, last };
|
|
188
|
+
if (last && !last.dialogOpen) return { finished: false, last };
|
|
189
|
+
await wait(2000);
|
|
190
|
+
}
|
|
191
|
+
return { finished: false, last };
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function sizeAwareLimitMs(filePath: string): number {
|
|
195
|
+
let bytes = 0;
|
|
196
|
+
try { bytes = statSync(filePath).size; } catch { /* unknown size */ }
|
|
197
|
+
// Assume a slow 0.25 MB/s upstream, plus 2 minutes; cap at 45 minutes.
|
|
198
|
+
return Math.min(45 * 60_000, 120_000 + Math.ceil(bytes / (0.25 * 1024 * 1024)) * 1000);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
type UploadState = 'published' | 'draft' | 'upload_not_confirmed';
|
|
202
|
+
|
|
120
203
|
export async function handleYoutubeUpload(args: {
|
|
121
204
|
filePath: string;
|
|
122
205
|
title: string;
|
|
@@ -138,53 +221,57 @@ export async function handleYoutubeUpload(args: {
|
|
|
138
221
|
const onErr = await ensureOnStudio(r);
|
|
139
222
|
if (onErr) return text(onErr);
|
|
140
223
|
|
|
224
|
+
const requested = args.visibility || 'private';
|
|
225
|
+
const title = args.title.slice(0, 100);
|
|
226
|
+
const limitMs = sizeAwareLimitMs(args.filePath);
|
|
227
|
+
let videoId: string | null = null;
|
|
228
|
+
const notes: string[] = [];
|
|
229
|
+
const noteId = (s: DialogState | null) => { if (!videoId && s?.id) videoId = s.id; };
|
|
230
|
+
|
|
141
231
|
// 1) Open the Create menu → Upload videos.
|
|
142
|
-
// #create-icon is locale-independent in most builds; fall back to aria-label
|
|
143
|
-
// and class-based selectors for PT-BR and other locales where the id is absent.
|
|
144
232
|
let create = await clickStudio(r, '#create-icon', 'Create');
|
|
145
|
-
if (!create.ok)
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
if (!create.ok) {
|
|
149
|
-
create = await clickStudio(r, 'ytcp-button[class*="CreateIcon"]', 'Criar');
|
|
150
|
-
}
|
|
233
|
+
if (!create.ok) create = await clickStudio(r, 'button[aria-label="Criar"]', 'Criar');
|
|
234
|
+
if (!create.ok) create = await clickStudio(r, 'ytcp-button[class*="CreateIcon"]', 'Criar');
|
|
151
235
|
if (!create.ok) return text(`Could not open the Create menu: ${create.error}`);
|
|
152
236
|
await wait(700);
|
|
153
|
-
// The first item in the create menu is "Upload videos" (PT-BR: "Enviar vídeos").
|
|
154
237
|
const uploadItem = await clickStudio(r, 'tp-yt-paper-item#text-item-0', 'Upload videos');
|
|
155
238
|
if (!uploadItem.ok) {
|
|
156
|
-
// Fallback 1: some Studio builds expose a direct upload button id.
|
|
157
239
|
const alt = await clickStudio(r, '#upload-button', 'Upload videos');
|
|
158
240
|
if (!alt.ok) {
|
|
159
|
-
// Fallback 2: PT-BR locale — click first menuitem by role.
|
|
160
241
|
const altPt = await clickStudio(r, '[role="menuitem"]:first-of-type', 'Enviar vídeos');
|
|
161
242
|
if (!altPt.ok) return text(`Could not find the "Upload videos" menu item: ${uploadItem.error}`);
|
|
162
243
|
}
|
|
163
244
|
}
|
|
164
245
|
|
|
165
|
-
// 2) Set the file
|
|
246
|
+
// 2) Set the file. A timeout here does not mean the upload failed: YouTube
|
|
247
|
+
// often has the file already, so look at the dialog before giving up.
|
|
166
248
|
const waitInput = await ni.waitFor(r.sessionId, { selector: 'input[type="file"]', state: 'attached', timeout: 15000 }, r.tabId);
|
|
167
249
|
if (waitInput.error) return text(`Upload dialog did not open: ${waitInput.error}`);
|
|
168
250
|
const up = await ni.upload(r.sessionId, 'input[type="file"]', [args.filePath], undefined, r.tabId);
|
|
169
|
-
if (up.error)
|
|
251
|
+
if (up.error) notes.push(`File input step reported: ${up.error}. Checked the dialog to see whether the upload started anyway.`);
|
|
170
252
|
|
|
171
|
-
// 3) Wait for the details form
|
|
172
|
-
const formReady = await ni.waitFor(r.sessionId, { selector: '#title-textarea', state: 'visible', timeout: 30000 }, r.tabId);
|
|
173
|
-
if (formReady.error)
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
253
|
+
// 3) Wait for the details form of THIS upload.
|
|
254
|
+
const formReady = await ni.waitFor(r.sessionId, { selector: '#title-textarea', state: 'visible', timeout: up.error ? 90000 : 30000 }, r.tabId);
|
|
255
|
+
if (formReady.error) {
|
|
256
|
+
const s = await probe(r);
|
|
257
|
+
noteId(s);
|
|
258
|
+
const started = !!(s && s.dialogOpen && (s.formVisible || s.percent != null || s.id));
|
|
259
|
+
return result({
|
|
260
|
+
state: started ? 'draft' : 'upload_not_confirmed',
|
|
261
|
+
draftReason: started ? 'details form did not finish loading; the upload dialog is still open' : null,
|
|
262
|
+
videoRowExists: started ? true : 'unknown',
|
|
263
|
+
notes: [...notes, `Details form did not appear: ${formReady.error}.`, started
|
|
264
|
+
? 'The upload started: do NOT upload again. Leave the tab on Studio and finish the draft there.'
|
|
265
|
+
: 'No sign of the upload in the dialog. Check Studio → Content before any retry.'],
|
|
266
|
+
});
|
|
183
267
|
}
|
|
268
|
+
await wait(800);
|
|
269
|
+
noteId(await probe(r));
|
|
184
270
|
|
|
185
|
-
// 6)
|
|
186
|
-
|
|
187
|
-
|
|
271
|
+
// 4–6) Metadata.
|
|
272
|
+
const titleOk = await fillStudio(r, '#title-textarea #textbox', title, 'Add a title that describes your video');
|
|
273
|
+
if (!titleOk.ok) notes.push(`Could not set the title: ${titleOk.error}.`);
|
|
274
|
+
if (args.description) await fillStudio(r, '#description-textarea #textbox', args.description, 'Tell viewers about your video');
|
|
188
275
|
if (args.tags && args.tags.length) {
|
|
189
276
|
await clickStudio(r, '#toggle-button', 'Show more');
|
|
190
277
|
await wait(700);
|
|
@@ -192,97 +279,129 @@ export async function handleYoutubeUpload(args: {
|
|
|
192
279
|
const t = tag.trim();
|
|
193
280
|
if (!t) continue;
|
|
194
281
|
const typed = await ni.type(r.sessionId, '#tags-container #text-input', `${t},`, undefined, r.tabId, 'Tags', 'insert');
|
|
195
|
-
if (typed.error) break;
|
|
282
|
+
if (typed.error) break;
|
|
196
283
|
await wait(150);
|
|
197
284
|
}
|
|
198
285
|
await ni.pressKey(r.sessionId, 'Enter', r.tabId);
|
|
199
286
|
await wait(300);
|
|
200
287
|
}
|
|
201
288
|
|
|
202
|
-
// 7) Audience
|
|
289
|
+
// 7) Audience.
|
|
203
290
|
const kidsName = args.madeForKids ? 'VIDEO_MADE_FOR_KIDS_MFK' : 'VIDEO_MADE_FOR_KIDS_NOT_MFK';
|
|
204
291
|
await clickStudio(r, `tp-yt-paper-radio-button[name="${kidsName}"]`, args.madeForKids ? 'Yes, it\'s made for kids' : 'No, it\'s not made for kids');
|
|
205
292
|
await wait(400);
|
|
206
293
|
|
|
207
|
-
// 8)
|
|
294
|
+
// 8) Let the transfer itself finish before anything can close the dialog.
|
|
295
|
+
const transfer = await waitForTransfer(r, limitMs);
|
|
296
|
+
noteId(transfer.last);
|
|
297
|
+
if (!transfer.finished) {
|
|
298
|
+
const open = !!transfer.last?.dialogOpen;
|
|
299
|
+
return result({
|
|
300
|
+
state: open ? 'draft' : 'upload_not_confirmed',
|
|
301
|
+
draftReason: open ? `file transfer still running after ${Math.round(limitMs / 60000)} min (${transfer.last?.progressText || 'no progress text'})` : null,
|
|
302
|
+
videoRowExists: open ? true : 'unknown',
|
|
303
|
+
notes: [...notes, open
|
|
304
|
+
? 'The upload is in progress: do NOT upload again and do not leave the Studio tab until it reaches 100%.'
|
|
305
|
+
: 'The upload dialog closed before the transfer was confirmed. Check Studio → Content before any retry.'],
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// 9) Advance the wizard to Visibility.
|
|
208
310
|
for (let step = 0; step < 3; step++) {
|
|
209
311
|
const next = await clickStudio(r, '#next-button', 'Next');
|
|
210
312
|
if (!next.ok) break;
|
|
211
313
|
await wait(900);
|
|
212
314
|
}
|
|
213
|
-
|
|
214
|
-
// 9) Visibility radio. Wait for the radio group itself (locale-independent
|
|
215
|
-
// name= attribute, shadow-DOM-pierced by Playwright) rather than localized text.
|
|
216
|
-
const vis = (args.visibility || 'private').toUpperCase();
|
|
315
|
+
const vis = requested.toUpperCase();
|
|
217
316
|
const visReady = await ni.waitFor(r.sessionId, { selector: `tp-yt-paper-radio-button[name="${vis}"]`, state: 'visible', timeout: 12000 }, r.tabId);
|
|
218
|
-
|
|
219
|
-
|
|
317
|
+
const visClick = visReady.error ? { ok: false, error: visReady.error } : await clickStudio(r, `tp-yt-paper-radio-button[name="${vis}"]`, vis.charAt(0) + vis.slice(1).toLowerCase());
|
|
318
|
+
noteId(await probe(r));
|
|
319
|
+
if (!visClick.ok) {
|
|
320
|
+
return result({
|
|
321
|
+
state: 'draft',
|
|
322
|
+
draftReason: `publish step not reached: visibility ${vis} could not be selected (${visClick.error})`,
|
|
323
|
+
videoRowExists: true,
|
|
324
|
+
notes,
|
|
325
|
+
});
|
|
220
326
|
}
|
|
221
|
-
const visClick = await clickStudio(r, `tp-yt-paper-radio-button[name="${vis}"]`, vis.charAt(0) + vis.slice(1).toLowerCase());
|
|
222
|
-
if (!visClick.ok) return text(`Could not select visibility ${vis}: ${visClick.error}.`);
|
|
223
327
|
await wait(500);
|
|
224
328
|
|
|
225
|
-
// 10) Publish /
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
// 12) Confirm the wizard actually finished (dialog closed) — the honest
|
|
244
|
-
// success signal. Don't claim a post that didn't complete.
|
|
245
|
-
const closed = await ni.waitFor(r.sessionId, { selector: '#title-textarea', state: 'hidden', timeout: 12000 }, r.tabId);
|
|
246
|
-
const publishConfirmed = !closed.error;
|
|
247
|
-
|
|
248
|
-
// 13) Fallback id resolution from the content grid (navigates away — only once
|
|
249
|
-
// publishing is confirmed, so the just-uploaded video is the newest row).
|
|
250
|
-
if (!videoId && publishConfirmed) {
|
|
251
|
-
videoId = await resolveLatestUploadedVideoId(r);
|
|
329
|
+
// 10) Publish / Save, only when Studio enables the button (it stays
|
|
330
|
+
// disabled while processing or checks run). Wait a bounded time for that.
|
|
331
|
+
const enableDeadline = Date.now() + Math.min(limitMs, 10 * 60_000);
|
|
332
|
+
let s = await probe(r);
|
|
333
|
+
while (s && s.doneDisabled && Date.now() < enableDeadline) { await wait(3000); s = await probe(r); }
|
|
334
|
+
noteId(s);
|
|
335
|
+
if (!s || s.doneDisabled) {
|
|
336
|
+
return result({
|
|
337
|
+
state: 'draft',
|
|
338
|
+
draftReason: 'processing or checks still running: the Publish/Save button stayed disabled',
|
|
339
|
+
videoRowExists: true,
|
|
340
|
+
notes,
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
const done = await clickStudio(r, '#done-button', requested === 'public' ? 'Publish' : 'Save');
|
|
344
|
+
if (!done.ok) {
|
|
345
|
+
return result({ state: 'draft', draftReason: `publish step not completed: could not click Publish/Save (${done.error})`, videoRowExists: true, notes });
|
|
252
346
|
}
|
|
253
347
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
348
|
+
// 11) Confirmation: Studio's share dialog ("Video published" / "saved").
|
|
349
|
+
let confirmed = false;
|
|
350
|
+
let prechecks = false;
|
|
351
|
+
const confirmDeadline = Date.now() + 30000;
|
|
352
|
+
while (Date.now() < confirmDeadline) {
|
|
353
|
+
await wait(1000);
|
|
354
|
+
const c = await probe(r);
|
|
355
|
+
if (!c) continue;
|
|
356
|
+
noteId(c);
|
|
357
|
+
if (c.shareOpen) { confirmed = true; if (c.id) videoId = c.id; break; }
|
|
358
|
+
if (c.prechecksOpen) { prechecks = true; break; }
|
|
359
|
+
}
|
|
360
|
+
if (!confirmed) {
|
|
361
|
+
return result({
|
|
362
|
+
state: 'draft',
|
|
363
|
+
draftReason: prechecks
|
|
364
|
+
? 'checks still running: Studio asked for confirmation before publishing; nothing was confirmed'
|
|
365
|
+
: 'Publish/Save was clicked but Studio showed no confirmation (dialog closed or still saving)',
|
|
366
|
+
videoRowExists: true,
|
|
367
|
+
notes,
|
|
270
368
|
});
|
|
271
369
|
}
|
|
370
|
+
return result({ state: 'published', draftReason: null, videoRowExists: true, notes });
|
|
272
371
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
372
|
+
async function result(o: { state: UploadState; draftReason: string | null; videoRowExists: boolean | 'unknown'; notes: string[] }) {
|
|
373
|
+
const idConfirmed = !!videoId;
|
|
374
|
+
const hasIdentity = !!(args.game || args.igdbId != null || args.appid != null || args.sourceTrailerId);
|
|
375
|
+
let recordedMemoryId: string | null = null;
|
|
376
|
+
// A row exists (published or draft): record it so the trailer is not re-posted.
|
|
377
|
+
if (o.videoRowExists === true && hasIdentity) {
|
|
378
|
+
recordedMemoryId = await recordTrailerLedger({
|
|
379
|
+
game: args.game, igdbId: args.igdbId, appid: args.appid, sourceTrailerId: args.sourceTrailerId,
|
|
380
|
+
source: args.source, videoId, title,
|
|
381
|
+
visibility: o.state === 'published' ? requested : 'draft',
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
const summary = o.state === 'published'
|
|
385
|
+
? `Published as ${requested} and confirmed by Studio.`
|
|
386
|
+
: o.state === 'draft'
|
|
387
|
+
? `Uploaded but NOT published (draft): ${o.draftReason}. Finish it in Studio (Edit draft → Visibility → Publish) once processing ends; do not upload again.`
|
|
388
|
+
: 'Upload not confirmed. Check Studio → Content before any retry to avoid a duplicate.';
|
|
389
|
+
return text(JSON.stringify({
|
|
390
|
+
state: o.state,
|
|
391
|
+
uploaded: o.videoRowExists === true,
|
|
392
|
+
published: o.state === 'published',
|
|
393
|
+
videoRowExists: o.videoRowExists,
|
|
394
|
+
videoId,
|
|
395
|
+
idConfirmed,
|
|
396
|
+
visibility: o.state === 'published' ? requested : null,
|
|
397
|
+
requestedVisibility: requested,
|
|
398
|
+
draftReason: o.draftReason,
|
|
399
|
+
title,
|
|
400
|
+
recordedMemoryId,
|
|
401
|
+
ledger: recordedMemoryId
|
|
402
|
+
? 'Recorded to youtube-videos (dedup ledger).'
|
|
403
|
+
: (hasIdentity ? 'No confirmed video row — ledger NOT recorded.' : 'No game/igdbId/appid/sourceTrailerId passed — ledger NOT recorded.'),
|
|
404
|
+
note: [summary, idConfirmed ? `Video id ${videoId} (read from this upload's dialog).` : 'No trustworthy video id could be read from this upload\'s dialog: videoId is null. Find it in Studio → Content (the draft\'s edit URL).', ...o.notes].join(' '),
|
|
405
|
+
}, null, 2));
|
|
406
|
+
}
|
|
288
407
|
}
|