synabun 2.2.2 → 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 +26 -0
- package/README.md +1 -1
- package/docs/whatsapp.md +52 -20
- package/lib/mcp-build.js +519 -0
- package/lib/mcp-dist.js +10 -4
- package/lib/server-supervisor.js +7 -1
- package/lib/virustotal.mjs +4 -2
- package/mcp-server/dist/http.d.ts +38 -0
- package/mcp-server/dist/http.d.ts.map +1 -1
- package/mcp-server/dist/http.js +75 -7
- package/mcp-server/dist/http.js.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.d.ts +3 -2
- package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.js +4 -3
- package/mcp-server/dist/services/browser-route-flow.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/neural-interface.d.ts +21 -0
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +76 -4
- 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/browser-advanced.d.ts +3 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.js +30 -8
- package/mcp-server/dist/tools/browser-advanced.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 +81 -20
- package/mcp-server/dist/tools/morelogin.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 +79 -7
- package/mcp-server/src/services/browser-route-flow.ts +4 -3
- package/mcp-server/src/services/embedding-service.ts +2 -1
- package/mcp-server/src/services/neural-interface.ts +77 -4
- package/mcp-server/src/services/tool-catalog.ts +2 -2
- package/mcp-server/src/tools/agents.ts +8 -4
- package/mcp-server/src/tools/browser-advanced.ts +29 -8
- 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 +81 -20
- package/mcp-server/src/tools/youtube/upload.ts +218 -99
- package/neural-interface/i18n/en.json +631 -123
- package/neural-interface/i18n/pt-BR.json +518 -10
- package/neural-interface/lib/assistant-api.js +26 -0
- package/neural-interface/lib/assistant-brains/claude.js +5 -0
- package/neural-interface/lib/assistant-catalog.js +114 -1
- package/neural-interface/lib/assistant-dispatch.js +71 -1
- package/neural-interface/lib/assistant-persona.js +14 -7
- package/neural-interface/lib/assistant-router.js +6 -4
- package/neural-interface/lib/assistant-runtime.js +3 -0
- package/neural-interface/lib/assistant-task-prompt.js +5 -0
- 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-background-tab.js +72 -3
- package/neural-interface/lib/browser-extraction.js +106 -45
- package/neural-interface/lib/browser-profile-choices.js +143 -0
- package/neural-interface/lib/browser-profiles.js +142 -0
- package/neural-interface/lib/browser-tab-recovery.js +153 -0
- package/neural-interface/lib/browser-tool-policy.js +2 -0
- package/neural-interface/lib/chromium-on-device-model.js +67 -0
- package/neural-interface/lib/claude-agent-bridge.js +7 -4
- package/neural-interface/lib/claude-model-catalog.js +12 -0
- package/neural-interface/lib/effort-levels.js +28 -2
- 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 +25 -4
- 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/morelogin-agent-profiles.js +149 -0
- package/neural-interface/lib/morelogin.js +278 -14
- package/neural-interface/lib/native-loop-providers.js +3 -1
- package/neural-interface/lib/owner-authority.js +30 -12
- package/neural-interface/lib/page-session.js +43 -17
- package/neural-interface/lib/request-gate.js +2 -0
- package/neural-interface/lib/system-activity.js +1 -1
- package/neural-interface/lib/terminal-tokens.js +82 -5
- 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/api.js +4 -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-control.js +1 -1
- package/neural-interface/public/shared/assistant/asst-limit-wait.js +4 -4
- package/neural-interface/public/shared/assistant/asst-panel.js +6 -2
- package/neural-interface/public/shared/assistant/asst-rack-styles.js +4 -4
- package/neural-interface/public/shared/assistant/asst-render.js +6 -6
- 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 +58 -14
- 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/context-menu-model.js +2 -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/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-panel.js +6 -2
- 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 +1 -0
- package/neural-interface/public/shared/settings/settings-ia.js +3 -1
- 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/sidepanel-session-status.js +16 -2
- package/neural-interface/public/shared/state.js +1 -1
- package/neural-interface/public/shared/styles.css +356 -157
- 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/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 +130 -90
- package/neural-interface/public/shared/ui-claude-panel.js +50 -2
- package/neural-interface/public/shared/ui-maritaca-panel.js +15 -0
- package/neural-interface/public/shared/ui-navbar.js +17 -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-settings.js +590 -27
- 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/scripts/build-mascot-assets.mjs +30 -0
- package/neural-interface/server.js +1784 -195
- 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
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════
|
|
2
|
+
// SynaBun — Maritaca panel: the HTML (no DOM access: strings in, strings out)
|
|
3
|
+
// ═══════════════════════════════════════════
|
|
4
|
+
|
|
5
|
+
import { durationLabel, usageParts } from './mtc-logic.js';
|
|
6
|
+
import { formatBytes } from './mtc-compose.js';
|
|
7
|
+
|
|
8
|
+
export function esc(value) {
|
|
9
|
+
return String(value ?? '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// The Maritaca mark (maritaca.ai favicon.svg, the bird), drawn in currentColor so the brand colour is a token.
|
|
13
|
+
export const ICONS = {
|
|
14
|
+
mark: '<svg viewBox="0 0 12.48 13.73" fill="currentColor" aria-hidden="true"><path d="M10.11 11.01h1.9S7.21 5.97 5.72 4.4a.62.62 0 0 0-.93.04c-.48.59-.76 1.33-.81 2.1-.06 1.04.32 2.06 1.04 2.8l4.35 4.4h3.1l-2.37-2.72Z"/><path d="M5.69 11 4.52 9.82c-.86-.89-1.31-2.1-1.24-3.33s.67-2.38 1.62-3.16c.35.06.71-.02 1.01-.24-.07-.24-.16-.55-.22-.75-.02-.07.06-.13.12-.09l1.16.77c.3-.61.22-1.37-.26-1.9.1-.18.06-.44-.15-.57C6.07.26 5.36 0 4.41 0 2.76 0 0 1.5 0 5.18c0 2.12 1.36 4.57 3.86 5.47l-1.43 3.08h1.05L4.8 10.9c.29.05.58.09.89.1l-1.27 2.73h1.05l.94-2.01L5.7 11ZM4.84.67c.23 0 .42.19.42.42s-.19.42-.42.42-.42-.19-.42-.42.19-.42.42-.42"/></svg>',
|
|
15
|
+
copy: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>',
|
|
16
|
+
retry: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/></svg>',
|
|
17
|
+
// The sibling panels' icons (cdx/cdx-icons.js ICON_PLAN / ICON_BRAIN, cdx-context-menu.js's cog), so the controls read the same.
|
|
18
|
+
plan: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2"/><rect x="9" y="3" width="6" height="4" rx="1"/><path d="M9 14l2 2 4-4"/></svg>',
|
|
19
|
+
brain: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 2a7 7 0 0 0-4.6 12.3L12 22l4.6-7.7A7 7 0 0 0 12 2z"/></svg>',
|
|
20
|
+
cog: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>',
|
|
21
|
+
attach: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** One transcript row. `md(text)` renders markdown to safe HTML. */
|
|
25
|
+
export function rowHtml(row, { T, md, last = false, disabled = false, editable = false }) {
|
|
26
|
+
if (row.kind === 'user') {
|
|
27
|
+
return `<div class="mtc-msg mtc-msg-user" data-row="${esc(row.id)}"><div class="mtc-msg-card"><div class="mtc-msg-text">${esc(row.text)}</div>${attachmentsHtml(row.attachments, T, false)}<div class="mtc-turn-actions"><button type="button" class="mtc-icon-btn" data-copy-row="${esc(row.id)}" aria-label="${esc(T('copy'))}">${ICONS.copy}</button>${editable ? `<button type="button" class="mtc-icon-btn" data-edit-row="${esc(row.id)}" aria-label="${esc(T('editResend'))}" title="${esc(T('editResend'))}"${disabled ? ' disabled' : ''}>↶</button>` : ''}</div></div></div>`;
|
|
28
|
+
}
|
|
29
|
+
if (row.kind !== 'assistant') return '';
|
|
30
|
+
const reasoning = row.reasoning
|
|
31
|
+
? `<details class="mtc-thought${row.streaming && !row.text ? ' thinking' : ''}"${row.streaming && !row.text ? ' open' : ''}><summary>${esc(row.streaming && !row.text ? T('working') : T('reasoningFor'))}</summary><div class="mtc-thought-body">${esc(row.reasoning)}</div></details>`
|
|
32
|
+
: '';
|
|
33
|
+
const body = row.text ? `<div class="mtc-md">${md(row.text)}</div>` : row.streaming && !row.reasoning ? `<div class="mtc-system working" role="status">${esc(T('working'))}</div>` : '';
|
|
34
|
+
const notices = [];
|
|
35
|
+
if (row.error) notices.push(`<div class="mtc-system error" role="alert">${esc(row.error)}</div>`);
|
|
36
|
+
else if (row.finishReason === 'length') notices.push(`<div class="mtc-system warning" role="status">${esc(T('finishLength'))}</div>`);
|
|
37
|
+
else if (row.finishReason === 'cancelled') notices.push(`<div class="mtc-system" role="status">${esc(T('finishCancelled'))}</div>`);
|
|
38
|
+
return `<div class="mtc-msg mtc-msg-agent${row.streaming ? ' streaming' : ''}" data-row="${esc(row.id)}">${reasoning}${body}${notices.join('')}${row.streaming ? '<span class="mtc-stream-cursor" aria-hidden="true"></span>' : footerHtml(row, T, { last, disabled })}</div>`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** The line under a finished reply: tokens, cost in BRL, time, Copy and Retry. */
|
|
42
|
+
export function footerHtml(row, T, { last = false, disabled = false } = {}) {
|
|
43
|
+
const parts = usageParts(row.usage, row.costBrl, T);
|
|
44
|
+
const duration = durationLabel(row.startedAt, row.endedAt);
|
|
45
|
+
const plan = row.mode === 'plan' ? `<span class="mtc-plan-chip">${esc(T('planBadge'))}</span>` : '';
|
|
46
|
+
if (duration) parts.push(duration);
|
|
47
|
+
if (row.model) parts.push(row.model);
|
|
48
|
+
return `<div class="mtc-turn-foot" data-row="${esc(row.id)}"><span class="mtc-turn-meta">${plan}${parts.map((p) => `<span class="${p.startsWith('R$') ? 'mtc-cost-pill' : 'mtc-usage-chip'}">${esc(p)}</span>`).join('')}</span>`
|
|
49
|
+
+ `<span class="mtc-turn-actions">${row.text ? `<button type="button" class="mtc-icon-btn" data-copy-row="${esc(row.id)}" aria-label="${esc(T('copyAnswer'))}" title="${esc(T('copyAnswer'))}">${ICONS.copy}</button>` : ''}`
|
|
50
|
+
+ `${last ? `<button type="button" class="mtc-icon-btn" data-retry-row="${esc(row.id)}" aria-label="${esc(T('retry'))}" title="${esc(T('retry'))}"${disabled ? ' disabled' : ''}>${ICONS.retry}</button>` : ''}</span></div>`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function attachmentsHtml(files = [], T, removable = true) {
|
|
54
|
+
return files.map((file, i) => `<span class="mtc-attachment" title="${esc(file.name)}"><span class="mtc-attachment-name">${esc(file.name)}</span><span class="mtc-attachment-size">${esc(formatBytes(file.size))}</span>${removable ? `<button type="button" class="mtc-icon-btn" data-remove-attachment="${i}" aria-label="${esc(T('attachmentRemove', { name: file.name }))}">×</button>` : ''}</span>`).join('');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** The empty transcript: the mark, a sentence, and the key prompt when none is saved. */
|
|
58
|
+
export function emptyHtml({ T, configured = true, blocked = null }) {
|
|
59
|
+
const body = blocked ? T(`connBlocked_${blocked.reason}`, { message: blocked.message || '' }) : configured ? T('emptyBody') : T('emptyNoKey');
|
|
60
|
+
const action = !blocked && !configured
|
|
61
|
+
? `<div class="mtc-empty-actions"><button type="button" class="mtc-action mtc-btn-primary" data-open-settings="1">${esc(T('emptyKeyButton'))}</button>`
|
|
62
|
+
+ `<a class="mtc-link" href="https://plataforma.maritaca.ai/chaves-de-api" target="_blank" rel="noopener noreferrer">${esc(T('emptyKeyLink'))}</a></div>`
|
|
63
|
+
: '';
|
|
64
|
+
return `<div class="mtc-empty"><span class="mtc-empty-mark" aria-hidden="true">${ICONS.mark}</span><div class="mtc-empty-name">${esc(T('emptyTitle'))}</div><div class="mtc-empty-status">${esc(body)}</div>${action}</div>`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The settings dialog (the Codex panel's in-panel settings overlay, `.mtc-settings-*`): the key with Save / Test /
|
|
69
|
+
* Forget, the defaults (model and reasoning, the app's dropdowns), the system prompt and the temperature, links.
|
|
70
|
+
* `status` is GET /api/maritaca/settings; `keyLine` is keyStatusLine()'s sentence. Every value is escaped.
|
|
71
|
+
*/
|
|
72
|
+
export function settingsHtml({ T, status, keyLine, modelDropdown, effortDropdown, systemMax = 8000 }) {
|
|
73
|
+
const s = status?.settings || {};
|
|
74
|
+
const tone = status?.configured ? 'ok' : 'err';
|
|
75
|
+
const prompt = String(s.systemPrompt || '');
|
|
76
|
+
const temp = s.temperature === null || s.temperature === undefined ? '' : esc(s.temperature);
|
|
77
|
+
return `<div class="mtc-settings-header"><span class="mtc-settings-title" id="mtc-settings-title">${esc(T('settingsTitle'))}</span><button type="button" class="mtc-settings-close" data-close-settings="1" aria-label="${esc(T('settingsClose'))}" title="${esc(T('settingsClose'))}">×</button></div>
|
|
78
|
+
<div class="mtc-settings-body">
|
|
79
|
+
<section class="mtc-settings-section" data-section="key">
|
|
80
|
+
<h3 class="mtc-settings-section-title">${esc(T('settingsSectionKey'))}</h3>
|
|
81
|
+
<div class="mtc-settings-status"><span class="mtc-ctxpop-dot mtc-ctxpop-dot-${tone} mtc-key-dot" aria-hidden="true"></span><span class="mtc-key-status">${esc(keyLine)}</span></div>
|
|
82
|
+
<label class="mtc-config-stack"><span class="mtc-config-label" id="mtc-settings-key-label">${esc(T('settingsKey'))}</span>
|
|
83
|
+
<input type="password" class="mtc-config-input mtc-key-input" autocomplete="off" spellcheck="false" aria-labelledby="mtc-settings-key-label" placeholder="${esc(T('settingsKeyPlaceholder'))}"></label>
|
|
84
|
+
<div class="mtc-settings-actions">
|
|
85
|
+
<button type="button" class="mtc-request-btn" data-save-key="1">${esc(T('settingsKeySave'))}</button>
|
|
86
|
+
<button type="button" class="mtc-request-btn secondary" data-test-key="1">${esc(T('settingsKeyTest'))}</button>
|
|
87
|
+
<button type="button" class="mtc-request-btn danger" data-forget-key="1"${status?.source === 'file' ? '' : ' hidden'}>${esc(T('settingsKeyForget'))}</button>
|
|
88
|
+
</div>
|
|
89
|
+
<div class="mtc-settings-notice" role="status" aria-live="polite"></div>
|
|
90
|
+
<div class="mtc-settings-hint">${esc(T('settingsKeyHint'))} <a class="mtc-link" href="https://plataforma.maritaca.ai/chaves-de-api" target="_blank" rel="noopener noreferrer">${esc(T('settingsKeys'))}</a></div>
|
|
91
|
+
</section>
|
|
92
|
+
<section class="mtc-settings-section" data-section="defaults">
|
|
93
|
+
<h3 class="mtc-settings-section-title">${esc(T('settingsSectionDefaults'))}</h3>
|
|
94
|
+
<div class="mtc-config-row"><span class="mtc-config-label" id="mtc-settings-model-label">${esc(T('settingsModel'))}</span><div class="mtc-config-control">${modelDropdown}</div></div>
|
|
95
|
+
${effortDropdown ? `<div class="mtc-config-row"><span class="mtc-config-label" id="mtc-settings-effort-label">${esc(T('settingsEffort'))}</span><div class="mtc-config-control">${effortDropdown}</div></div>` : ''}
|
|
96
|
+
<div class="mtc-settings-hint">${esc(T('settingsDefaultsHint'))}</div>
|
|
97
|
+
</section>
|
|
98
|
+
<section class="mtc-settings-section" data-section="instructions">
|
|
99
|
+
<h3 class="mtc-settings-section-title">${esc(T('settingsSectionInstructions'))}</h3>
|
|
100
|
+
<label class="mtc-config-stack"><span class="mtc-config-label">${esc(T('settingsSystem'))}</span>
|
|
101
|
+
<textarea class="mtc-config-input mtc-system-input" rows="4" maxlength="${Number(systemMax) || 8000}" placeholder="${esc(T('settingsSystemPlaceholder'))}">${esc(prompt)}</textarea></label>
|
|
102
|
+
<div class="mtc-settings-hint mtc-system-count">${esc(T('settingsSystemCount', { count: prompt.length, max: Number(systemMax) || 8000 }))}</div>
|
|
103
|
+
</section>
|
|
104
|
+
<section class="mtc-settings-section" data-section="sampling">
|
|
105
|
+
<h3 class="mtc-settings-section-title">${esc(T('settingsSectionSampling'))}</h3>
|
|
106
|
+
<div class="mtc-config-row"><label class="mtc-config-label" for="mtc-settings-temp">${esc(T('settingsTemperature'))}</label><div class="mtc-config-control"><input type="number" id="mtc-settings-temp" class="mtc-config-input mtc-temp-input" min="0" max="2" step="0.1" inputmode="decimal" placeholder="${esc(T('settingsTemperatureDefault'))}" value="${temp}"></div></div>
|
|
107
|
+
<div class="mtc-settings-hint">${esc(T('settingsTemperatureHint'))}</div>
|
|
108
|
+
</section>
|
|
109
|
+
<section class="mtc-settings-section" data-section="about">
|
|
110
|
+
<h3 class="mtc-settings-section-title">${esc(T('settingsSectionAbout'))}</h3>
|
|
111
|
+
<div class="mtc-settings-hint">${esc(T('providerNote'))}</div>
|
|
112
|
+
<div class="mtc-settings-links"><a class="mtc-link" href="https://docs.maritaca.ai" target="_blank" rel="noopener noreferrer">${esc(T('settingsDocs'))}</a></div>
|
|
113
|
+
</section>
|
|
114
|
+
</div>
|
|
115
|
+
<div class="mtc-settings-footer"><span class="mtc-settings-result" role="status" aria-live="polite"></span><button type="button" class="mtc-request-btn secondary" data-close-settings="1">${esc(T('cancel'))}</button><button type="button" class="mtc-request-btn" data-save-settings="1">${esc(T('settingsSaveDefaults'))}</button></div>`;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** The footer Effort toggle's menu: Default (and what it is now), then each level with a line on what it does. */
|
|
119
|
+
export function effortMenuHtml(items = [], T) {
|
|
120
|
+
return items.map((item) => `<button type="button" class="mtc-effort-menu-item${item.selected ? ' selected' : ''}" role="menuitemradio" aria-checked="${item.selected ? 'true' : 'false'}" data-effort-value="${esc(item.value)}"><span class="mtc-effort-menu-label">${esc(item.label)}</span><span class="mtc-effort-menu-desc">${esc(item.desc || '')}</span></button>`).join('')
|
|
121
|
+
|| `<div class="mtc-effort-menu-empty">${esc(T('effortUnsupportedShort'))}</div>`;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The plan review under a finished plan reply (the Codex panel's post-plan card): continue with the plan, suggest
|
|
126
|
+
* changes (a new plan turn), copy, dismiss. `disabled` while a reply streams or a send is on its way.
|
|
127
|
+
*/
|
|
128
|
+
export function planCardHtml({ T, row, feedback = '', disabled = false }) {
|
|
129
|
+
const off = disabled ? ' disabled' : '';
|
|
130
|
+
const id = `mtc-plan-feedback-${esc(row?.turnId || row?.id || 'x')}`;
|
|
131
|
+
return `<div class="mtc-plan-msg" data-plan-row="${esc(row?.id || '')}"><div class="mtc-plan-card${disabled ? ' is-busy' : ''}" role="group" aria-label="${esc(T('planReview'))}" aria-busy="${disabled ? 'true' : 'false'}">`
|
|
132
|
+
+ `<div class="mtc-plan-header">${esc(T('planHeader'))}</div><div class="mtc-plan-note">${esc(T('planNote'))}</div>`
|
|
133
|
+
+ `<div class="mtc-plan-decision"><button type="button" class="mtc-request-btn" data-plan-action="continue"${off}>${esc(T('planContinue'))}</button></div>`
|
|
134
|
+
+ `<div class="mtc-plan-feedback-group"><label class="mtc-plan-feedback-label" for="${id}">${esc(T('planFeedbackLabel'))}</label>`
|
|
135
|
+
+ `<textarea id="${id}" class="mtc-plan-feedback" rows="2" maxlength="4000" placeholder="${esc(T('planFeedbackPlaceholder'))}"${off}>${esc(feedback)}</textarea>`
|
|
136
|
+
+ `<div class="mtc-plan-feedback-footer"><span class="mtc-plan-feedback-hint">${esc(T('planFeedbackHint'))}</span><button type="button" class="mtc-request-btn secondary mtc-plan-update" data-plan-action="feedback"${disabled || !String(feedback).trim() ? ' disabled' : ''}>${esc(T('planUpdate'))}</button></div></div>`
|
|
137
|
+
+ `<div class="mtc-plan-utilities"><button type="button" class="mtc-request-btn secondary" data-plan-action="copy">${esc(T('planCopy'))}</button><button type="button" class="mtc-request-btn secondary" data-plan-action="dismiss"${off}>${esc(T('planDismiss'))}</button></div>`
|
|
138
|
+
+ '</div></div>';
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The header cog's Context settings popover (contextMenuModel() in mtc-logic.js), in the sibling panels' grammar:
|
|
143
|
+
* sections with a 28px head (title, at most one action) and 28px rows (label left, value right).
|
|
144
|
+
*/
|
|
145
|
+
export function contextPopHtml(m, { T, copied = false } = {}) {
|
|
146
|
+
const muted = (v) => v === T('ctxNotReported') || v === '—';
|
|
147
|
+
const row = (k, v, { cls = '', tip = '' } = {}) => `<div class="mtc-ctxpop-row"><span class="mtc-ctxpop-k">${esc(k)}</span><span class="mtc-ctxpop-v${muted(v) ? ' mtc-ctxpop-muted' : ''}${cls}"${tip ? ` title="${esc(tip)}"` : ''}>${esc(v)}</span></div>`;
|
|
148
|
+
const status = (k, s) => `<div class="mtc-ctxpop-row"><span class="mtc-ctxpop-k">${esc(k)}</span><span class="mtc-ctxpop-v mtc-ctxpop-status"><span class="mtc-ctxpop-dot mtc-ctxpop-dot-${esc(s.tone)}" aria-hidden="true"></span><span>${esc(s.word)}</span></span></div>`;
|
|
149
|
+
const head = (title, act = '') => `<div class="mtc-ctxpop-head"><h3 class="mtc-ctxpop-title">${esc(title)}</h3>${act}</div>`;
|
|
150
|
+
const pct = m.context.pct == null ? 0 : m.context.pct;
|
|
151
|
+
const ctx = `<section class="mtc-ctxpop-section">${head(T('ctxSectionContext'))}`
|
|
152
|
+
+ `<div class="mtc-ctxpop-bar" role="progressbar" aria-label="${esc(T('ctxMeterLabel'))}" aria-valuemin="0" aria-valuemax="100"${m.context.pct != null ? ` aria-valuenow="${Math.round(pct)}"` : ''} aria-valuetext="${esc(m.context.headline)}"><div class="mtc-ctxpop-fill${m.pressure ? ` mtc-ctxpop-${esc(m.pressure)}` : ''}" style="width:${Math.max(0, Math.min(100, pct))}%"></div></div>`
|
|
153
|
+
+ `<div class="mtc-ctxpop-usage" title="${esc(m.context.headline)}"><span class="mtc-ctxpop-used${muted(m.context.usage) ? ' mtc-ctxpop-muted' : ''}">${esc(m.context.usage)}</span>${m.context.share ? `<span class="mtc-ctxpop-share">${esc(m.context.share)}</span>` : ''}</div>`
|
|
154
|
+
+ m.context.rows.map(([k, v]) => row(k, v)).join('') + '</section>';
|
|
155
|
+
const settingsLink = `<button type="button" class="mtc-ctxpop-link" data-act="settings" aria-label="${esc(T('ctxSettingsName'))}">${esc(T('ctxSettings'))}</button>`;
|
|
156
|
+
const idRow = m.conversation.id
|
|
157
|
+
? `<div class="mtc-ctxpop-row"><span class="mtc-ctxpop-k">${esc(T('ctxConversationId'))}</span><button type="button" class="mtc-ctxpop-v mtc-ctxpop-copy${copied ? ' mtc-ctxpop-copied' : ''}" data-act="copy-id" data-value="${esc(m.conversation.id)}" aria-label="${esc(T('ctxCopyId'))}" title="${esc(m.conversation.id)}">${esc(copied ? T('ctxCopied') : m.conversation.id)}</button></div>`
|
|
158
|
+
: row(T('ctxConversationId'), T('ctxNotStarted'), { cls: ' mtc-ctxpop-muted' });
|
|
159
|
+
const conv = `<section class="mtc-ctxpop-section">${head(T('ctxSectionConversation'), settingsLink)}${idRow}${m.conversation.rows.map(([k, v]) => row(k, v)).join('')}</section>`;
|
|
160
|
+
const conn = `<section class="mtc-ctxpop-section">${head(T('ctxSectionConnection'))}${status(T('ctxKey'), m.connection.key)}${status(T('ctxServer'), m.connection.server)}</section>`;
|
|
161
|
+
return ctx + conv + conn;
|
|
162
|
+
}
|
|
163
|
+
/** The conversations popover: a search box and the list. */
|
|
164
|
+
export function sessionsHtml({ T, sessions, loading = false, error = null, activeId = null, deletePending = null }) {
|
|
165
|
+
const list = loading ? `<div class="mtc-pop-note">${esc(T('sessionsLoading'))}</div>`
|
|
166
|
+
: error ? `<div class="mtc-pop-note error">${esc(T('sessionsFailed', { error }))}</div>`
|
|
167
|
+
: !sessions.length ? `<div class="mtc-pop-note">${esc(T('sessionsEmpty'))}</div>`
|
|
168
|
+
: sessions.map((s) => `<div class="mtc-session-row${s.id === activeId ? ' active' : ''}" role="option" aria-selected="${s.id === activeId}" tabindex="0" data-session="${esc(s.id)}">`
|
|
169
|
+
+ `<span class="mtc-session-title">${esc(s.title || T('tabTitleFallback'))}</span><span class="mtc-session-meta">${esc([s.model, s.costBrl != null ? T('costBrl', { value: Number(s.costBrl).toFixed(4).replace('.', ',') }) : '', s.messageCount ? `${s.messageCount}` : ''].filter(Boolean).join(' · '))}</span>`
|
|
170
|
+
+ `<button type="button" class="mtc-icon-btn mtc-session-delete" data-delete-session="${esc(s.id)}" aria-label="${esc(T('delete'))}" title="${esc(T('delete'))}">×</button>${deletePending === s.id ? `<span class="mtc-delete-confirm" role="alert">${esc(T('deleteConfirm', { title: s.title || T('tabTitleFallback') }))}<button type="button" class="mtc-action" data-confirm-delete="${esc(s.id)}">${esc(T('delete'))}</button><button type="button" class="mtc-action" data-cancel-delete>${esc(T('cancel'))}</button></span>` : ''}</div>`).join('');
|
|
171
|
+
return `<input type="search" class="mtc-session-search" placeholder="${esc(T('sessionsSearch'))}" aria-label="${esc(T('sessionsSearch'))}"><div class="mtc-session-list" role="listbox" aria-label="${esc(T('sessions'))}">${list}</div>`;
|
|
172
|
+
}
|