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
|
@@ -43,7 +43,9 @@ import { modelChipForms, modelChipName, modelChipTag } from './asst-model-chip.j
|
|
|
43
43
|
import {
|
|
44
44
|
ACCOUNT_PROVIDERS,
|
|
45
45
|
BRAIN_PROVIDERS,
|
|
46
|
+
brainEffortChoices,
|
|
46
47
|
brainRequiresSwitch,
|
|
48
|
+
isAutoBrainEffort,
|
|
47
49
|
emptyProjectView,
|
|
48
50
|
modelShortName,
|
|
49
51
|
normalizeBrain,
|
|
@@ -157,7 +159,9 @@ export function fmtModelPrice(price) {
|
|
|
157
159
|
const a = trimNumber(price.input);
|
|
158
160
|
const b = trimNumber(price.output);
|
|
159
161
|
if (!a && !b) return '';
|
|
160
|
-
|
|
162
|
+
// Maritaca's rows are priced in BRL (per million tokens), never converted.
|
|
163
|
+
const c = price.unit === 'brl_per_mtok' ? 'R$' : '$';
|
|
164
|
+
return b ? `${c}${a || '?'}/${c}${b}` : `${c}${a}`;
|
|
161
165
|
}
|
|
162
166
|
|
|
163
167
|
function normalizeCatalogModel(m, extra = {}) {
|
|
@@ -297,6 +301,57 @@ function catalogSaysNone(remote, provider, local) {
|
|
|
297
301
|
return !(source === 'fallback' && local.length > 0 && !local.some(m => m.catalogSource === 'fallback'));
|
|
298
302
|
}
|
|
299
303
|
|
|
304
|
+
/** The OpenCode provider id Maritaca is registered under: its OpenCode rows are `maritaca/<id>`. */
|
|
305
|
+
export const MARITACA_PREFIX = 'maritaca/';
|
|
306
|
+
export function isMaritacaOpenCodeId(id) { return String(id || '').toLowerCase().startsWith(MARITACA_PREFIX); }
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Picker groups that list another provider's rows: the Maritaca group shows OpenCode's `maritaca/<id>` rows
|
|
310
|
+
* (`via: 'opencode'`), so a pick, a saved route and a dispatch keep the runnable spec
|
|
311
|
+
* { provider: 'opencode', model: 'maritaca/<id>' }. The menus place a group right after the provider it runs on.
|
|
312
|
+
*/
|
|
313
|
+
export const VIA_GROUPS = Object.freeze({ maritaca: 'opencode' });
|
|
314
|
+
|
|
315
|
+
/** The provider a row of `group` runs on (`maritaca` → `opencode`; a plain provider is itself). */
|
|
316
|
+
export function runnableProvider(group, row = null) { return row?.via || VIA_GROUPS[group] || group; }
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* The Maritaca group's rows: OpenCode's `maritaca/<id>` rows as this window merged them (hidden ones already out),
|
|
320
|
+
* ordered and labelled by the server's group (`remoteGroup`: catalog.routeGroups.maritaca, the Maritaca panel's
|
|
321
|
+
* order, BRL prices). While OpenCode lists no Maritaca model, the group's own rows come back `status: 'unavailable'`
|
|
322
|
+
* with their hint, so the group never vanishes. An older server (no group) gets the OpenCode rows as they are.
|
|
323
|
+
*/
|
|
324
|
+
export function maritacaGroupRows(opencodeRows, remoteGroup = null) {
|
|
325
|
+
const own = (Array.isArray(opencodeRows) ? opencodeRows : []).filter(m => isMaritacaOpenCodeId(m?.id));
|
|
326
|
+
const remote = Array.isArray(remoteGroup?.models) ? remoteGroup.models : [];
|
|
327
|
+
const deco = (m, r) => ({
|
|
328
|
+
...m, via: 'opencode', group: 'maritaca',
|
|
329
|
+
label: r?.label || m.label, tier: r?.tier || m.tier || null, price: r?.price || m.price || null,
|
|
330
|
+
isDefault: r ? r.isDefault === true : m.isDefault === true,
|
|
331
|
+
});
|
|
332
|
+
if (!own.length) {
|
|
333
|
+
if (remoteGroup && remoteGroup.available === false) {
|
|
334
|
+
return remote.map(r => ({
|
|
335
|
+
id: String(r.id), label: String(r.label || r.model || r.id), desc: '', tier: r.tier || null, price: r.price || null,
|
|
336
|
+
efforts: Array.isArray(r.efforts) ? r.efforts : null, contextWindow: r.contextWindow ?? null, vision: false,
|
|
337
|
+
outputs: { image: false, video: false }, via: 'opencode', group: 'maritaca', status: 'unavailable',
|
|
338
|
+
hint: r.hint || remoteGroup.hint || null, selector: String(r.id),
|
|
339
|
+
}));
|
|
340
|
+
}
|
|
341
|
+
return [];
|
|
342
|
+
}
|
|
343
|
+
const byId = new Map(own.map(m => [String(m.id).toLowerCase(), m]));
|
|
344
|
+
const out = [];
|
|
345
|
+
for (const r of remote) {
|
|
346
|
+
const m = byId.get(String(r?.id || '').toLowerCase());
|
|
347
|
+
if (!m) continue;
|
|
348
|
+
byId.delete(String(r.id).toLowerCase());
|
|
349
|
+
out.push(deco(m, r));
|
|
350
|
+
}
|
|
351
|
+
for (const m of own) if (byId.has(String(m.id).toLowerCase())) out.push(deco(m, null));
|
|
352
|
+
return out;
|
|
353
|
+
}
|
|
354
|
+
|
|
300
355
|
/**
|
|
301
356
|
* { 'claude-code': [...], codex: [...], opencode: [...], antigravity: [...] }: the models of every
|
|
302
357
|
* Assistant model menu and of the Routes editor, from GET /api/assistant/catalog
|
|
@@ -327,6 +382,13 @@ export async function loadModelCatalog({ force = false } = {}) {
|
|
|
327
382
|
? []
|
|
328
383
|
: mergeProviderModels(provider, remote?.models?.[provider], local, { sets, remoteSource: remote?.sources?.[provider] || null });
|
|
329
384
|
}
|
|
385
|
+
// The Maritaca group (its rows stay in `opencode` too, for every lookup by the runnable spec; menus list them once).
|
|
386
|
+
out.maritaca = maritacaGroupRows(out.opencode, remote?.routeGroups?.maritaca || null);
|
|
387
|
+
// A lookup by the runnable spec (a saved route's label) reads the same row the group shows.
|
|
388
|
+
if (out.maritaca.length && out.maritaca[0].status !== 'unavailable') {
|
|
389
|
+
const shown = new Map(out.maritaca.map(m => [m.id, m]));
|
|
390
|
+
out.opencode = out.opencode.map(m => shown.get(m.id) || m);
|
|
391
|
+
}
|
|
330
392
|
_catalog = out;
|
|
331
393
|
// Not kept when built without the server's catalog, or when the lists changed
|
|
332
394
|
// while it loaded: the next open asks again.
|
|
@@ -580,17 +642,28 @@ export async function openModelMenu(anchor, opts = {}) {
|
|
|
580
642
|
}
|
|
581
643
|
// Without `providers` the menu is a brain's (the toolbar's model field, the WhatsApp brain): every provider the
|
|
582
644
|
// Assistant can run on (BRAIN_PROVIDERS, Antigravity included); a route or a dispatch names its own providers.
|
|
583
|
-
const list = Array.isArray(providers) && providers.length ? PROVIDERS.filter(p => providers.includes(p)) : BRAIN_PROVIDERS;
|
|
645
|
+
const list = withViaGroups(Array.isArray(providers) && providers.length ? PROVIDERS.filter(p => providers.includes(p)) : BRAIN_PROVIDERS);
|
|
584
646
|
let listed = 0;
|
|
585
647
|
for (const provider of list) {
|
|
586
|
-
const
|
|
648
|
+
const run = runnableProvider(provider);
|
|
649
|
+
// A row listed in a group (Maritaca) is shown there only, never twice.
|
|
650
|
+
const rows = (catalog[provider] || []).filter(m => !(provider === 'opencode' && Array.isArray(catalog.maritaca) && isMaritacaOpenCodeId(m?.id)));
|
|
651
|
+
const models = rows.filter(m => m.status === 'unavailable' || typeof accept !== 'function' || accept(run, m));
|
|
652
|
+
if (provider !== run && !models.length) continue;
|
|
587
653
|
if (!models.length && !opts.routingEditor) continue;
|
|
588
654
|
listed += models.length;
|
|
589
655
|
const meta = providerMeta(provider);
|
|
590
656
|
const hiddenCount = metadata.hiddenCounts[provider] || 0;
|
|
591
|
-
const note = opts.routingEditor ? tr('assistant.routes.menu.hiddenCount', '{count} hidden in Models', { count: hiddenCount }) : warnSwitch &&
|
|
657
|
+
const note = opts.routingEditor && provider === run ? tr('assistant.routes.menu.hiddenCount', '{count} hidden in Models', { count: hiddenCount }) : warnSwitch && run !== b.provider ? tr('assistant.brain.newConversation', 'starts a new conversation') : '';
|
|
592
658
|
items.push({ kind: 'header', label: meta.label, icon: meta.icon, color: meta.color, note });
|
|
659
|
+
const unavailable = models.filter(m => m.status === 'unavailable');
|
|
660
|
+
if (unavailable.length) items.push({ kind: 'info', label: tr('assistant.routes.menu.maritacaUnavailable', 'Register Maritaca under Settings → OpenCode → Providers') });
|
|
593
661
|
for (const m of models) {
|
|
662
|
+
if (m.status === 'unavailable') {
|
|
663
|
+
items.push({ id: `${provider}:${m.id}`, label: m.label, desc: modelDesc(m, tr, false), tag: tierTag(m, tr), keywords: `${meta.label} ${m.id}`, disabled: true, title: m.hint || '' });
|
|
664
|
+
continue;
|
|
665
|
+
}
|
|
666
|
+
const target = runnableProvider(provider, m);
|
|
594
667
|
items.push({
|
|
595
668
|
kind: 'radio',
|
|
596
669
|
id: `${provider}:${m.id}`,
|
|
@@ -599,8 +672,8 @@ export async function openModelMenu(anchor, opts = {}) {
|
|
|
599
672
|
title: `${m.label || m.id} · ${m.id}`,
|
|
600
673
|
tag: tierTag(m, tr),
|
|
601
674
|
keywords: `${meta.label} ${m.id}`,
|
|
602
|
-
selected: !!current && current.provider ===
|
|
603
|
-
onSelect: () => onSelect?.({ provider, model: m.id, label: m.label, tier: m.tier || null, vision: m.vision ?? null, outputs: m.outputs || null, efforts: m.efforts || null, price: m.price || null }),
|
|
675
|
+
selected: !!current && current.provider === target && sameModel(current.model, m),
|
|
676
|
+
onSelect: () => onSelect?.({ provider: target, model: m.id, label: m.label, tier: m.tier || null, vision: m.vision ?? null, outputs: m.outputs || null, efforts: m.efforts || null, price: m.price || null }),
|
|
604
677
|
});
|
|
605
678
|
}
|
|
606
679
|
if (opts.routingEditor && !models.length) items.push({ kind: 'info', label: typeof accept === 'function' ? tr('assistant.routes.menu.noCompatible', 'No compatible models shown for this provider.') : tr('assistant.routes.menu.providerEmpty', 'No models shown for this provider.') });
|
|
@@ -663,6 +736,16 @@ export async function openModelMenu(anchor, opts = {}) {
|
|
|
663
736
|
}
|
|
664
737
|
}
|
|
665
738
|
|
|
739
|
+
/** `list` with each via-group placed right after the provider it runs on (opencode → opencode, maritaca). */
|
|
740
|
+
export function withViaGroups(list) {
|
|
741
|
+
const out = [];
|
|
742
|
+
for (const p of list) {
|
|
743
|
+
out.push(p);
|
|
744
|
+
for (const [group, via] of Object.entries(VIA_GROUPS)) if (via === p && !list.includes(group)) out.push(group);
|
|
745
|
+
}
|
|
746
|
+
return out;
|
|
747
|
+
}
|
|
748
|
+
|
|
666
749
|
/** What a model menu lists, for telling a fresher read from the one on screen. */
|
|
667
750
|
function menuItemsSignature(items) {
|
|
668
751
|
return JSON.stringify((items || []).map((item) => [item.kind || '', item.id ?? '', item.label || '', item.desc || '', item.tag || '', item.note || '', !!item.selected]));
|
|
@@ -770,9 +853,13 @@ export function createBrainPicker(host, hooks = {}) {
|
|
|
770
853
|
|
|
771
854
|
// Per model, from the catalog row (which also covers "[1m]" / "[extended]" ids);
|
|
772
855
|
// the provider list only for a model nothing is known about. OpenCode: variants.
|
|
856
|
+
// Claude Code: Auto (the model's default) and Off (`none`, no thinking) where the model thinks, then
|
|
857
|
+
// its levels (asst-state.js brainEffortChoices); their words here.
|
|
773
858
|
function effortsFor(brain) {
|
|
774
859
|
const model = catalogModelRow(brain.provider, brain.model) || modelOf(brain);
|
|
775
|
-
return getEffortLevelsForModel(brain.provider, model)
|
|
860
|
+
return brainEffortChoices(brain.provider, getEffortLevelsForModel(brain.provider, model)).map((e) => (e.key === 'auto'
|
|
861
|
+
? { ...e, label: t('assistant.brain.effortAuto', e.label), desc: t('assistant.brain.effortAutoDesc', e.desc) }
|
|
862
|
+
: e.key === 'none' ? { ...e, label: t('assistant.brain.effortNone', e.label), desc: t('assistant.brain.effortNoneDesc', e.desc) } : e));
|
|
776
863
|
}
|
|
777
864
|
|
|
778
865
|
function accountOf(brain) {
|
|
@@ -831,7 +918,9 @@ export function createBrainPicker(host, hooks = {}) {
|
|
|
831
918
|
function values(brain = currentBrain()) {
|
|
832
919
|
const meta = getProviderMeta(brain.provider);
|
|
833
920
|
const efforts = effortsFor(brain);
|
|
834
|
-
|
|
921
|
+
// Claude's Auto row stands for no effort and for the `off` a server writes when it resets a level.
|
|
922
|
+
const level = efforts.find(e => e.id === brain.effort)
|
|
923
|
+
|| (brain.provider === 'claude-code' && isAutoBrainEffort(brain.effort) ? efforts.find(e => e.key === 'auto') : null);
|
|
835
924
|
const hasEfforts = efforts.some(e => e.id !== 'off');
|
|
836
925
|
const toolCatalog = getCachedToolCatalog();
|
|
837
926
|
return {
|
|
@@ -1246,7 +1335,8 @@ export function createBrainPicker(host, hooks = {}) {
|
|
|
1246
1335
|
const efforts = effortsFor(brain);
|
|
1247
1336
|
menu(t('assistant.brain.effort', 'Thinking effort'), efforts.map((e) => ({
|
|
1248
1337
|
kind: 'radio', id: e.id, label: e.label, desc: e.desc || '',
|
|
1249
|
-
|
|
1338
|
+
// Auto (`off`) is stored as no effort; Off is `none` and is kept on every turn.
|
|
1339
|
+
selected: (e.id === 'off' ? isAutoBrainEffort(brain.effort) : e.id === brain.effort),
|
|
1250
1340
|
onSelect: () => commit({ effort: e.id === 'off' ? null : e.id }, 'effort'),
|
|
1251
1341
|
})));
|
|
1252
1342
|
return;
|
|
@@ -967,7 +967,7 @@ export function decorateControlHead(head, kindEl) {
|
|
|
967
967
|
const face = el('span', 'asst-control-face');
|
|
968
968
|
face.setAttribute('aria-hidden', 'true');
|
|
969
969
|
try {
|
|
970
|
-
face.innerHTML = mascotSvg({ width:
|
|
970
|
+
face.innerHTML = mascotSvg({ width: 56, height: 28, className: 'synabun-mascot asst-still' });
|
|
971
971
|
if (face.firstElementChild) paintMascot(face.firstElementChild, stillFrame('blocked'));
|
|
972
972
|
} catch { /* no SVG here (a test DOM): the capsule says it */ }
|
|
973
973
|
if (typeof head.insertBefore === 'function') head.insertBefore(face, kindEl);
|
|
@@ -135,13 +135,13 @@ export function createLimitWait(opts = {}) {
|
|
|
135
135
|
if (reducedMotion()) {
|
|
136
136
|
try { rig?.destroy(); } catch { /* gone */ }
|
|
137
137
|
rig = null;
|
|
138
|
-
face.innerHTML = mascotLib.mascotSvg({ width:
|
|
138
|
+
face.innerHTML = mascotLib.mascotSvg({ width: 72, height: 36, className: 'synabun-mascot asst-still' });
|
|
139
139
|
try { mascotLib.paintMascot(face.firstElementChild, mascotLib.stillFrame(next)); } catch { /* the plain face */ }
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
142
|
if (!rig) {
|
|
143
143
|
face.textContent = '';
|
|
144
|
-
try { rig = mascotLib.createMascot(face, { width:
|
|
144
|
+
try { rig = mascotLib.createMascot(face, { width: 72, height: 36, pose: next }); return; } catch { rig = null; }
|
|
145
145
|
}
|
|
146
146
|
try { rig?.setPose(next, next === 'success' ? { then: 'idle' } : undefined); } catch { /* keeps its pose */ }
|
|
147
147
|
}
|
|
@@ -295,7 +295,7 @@ const CSS = `
|
|
|
295
295
|
.asst-limit-wait.is-indeterminate .asst-limit-ring-fill { stroke-dasharray: 18 82; animation: asst-limit-orbit 2.6s linear infinite; }
|
|
296
296
|
@keyframes asst-limit-orbit { to { transform: rotate(360deg); } }
|
|
297
297
|
.asst-limit-wait-face { position: absolute; inset: 0; display: grid; place-items: center; color: var(--lw-tone); line-height: 0; }
|
|
298
|
-
.asst-limit-wait-face svg { display: block; width:
|
|
298
|
+
.asst-limit-wait-face svg { display: block; width: 72px; height: 36px; }
|
|
299
299
|
.asst-limit-wait-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
|
300
300
|
.asst-limit-wait-title { color: var(--asst-text-2); font-size: 12px; font-weight: 500; }
|
|
301
301
|
.asst-limit-wait[data-state="restored"] .asst-limit-wait-title { color: var(--asst-brand); }
|
|
@@ -310,7 +310,7 @@ const CSS = `
|
|
|
310
310
|
@container asst (max-width: 320px) {
|
|
311
311
|
.asst-limit-wait { grid-template-columns: 44px minmax(0, 1fr); gap: 10px; padding: 10px; }
|
|
312
312
|
.asst-limit-wait-stage, .asst-limit-ring { width: 44px; height: 44px; }
|
|
313
|
-
.asst-limit-wait-face svg { width:
|
|
313
|
+
.asst-limit-wait-face svg { width: 56px; height: 28px; }
|
|
314
314
|
.asst-limit-wait-clock { font-size: 17px; }
|
|
315
315
|
}
|
|
316
316
|
body.ui-interacting .asst-limit-ring-fill { animation-play-state: paused !important; }
|
|
@@ -59,12 +59,13 @@ import { activityOf } from './asst-scenes.js';
|
|
|
59
59
|
import { createUsageGauge } from './asst-usage.js';
|
|
60
60
|
import { closeMenu, currentMenuAnchor, isMenuOpen, openMenu } from './asst-menu.js';
|
|
61
61
|
import { createRouteModeControl, openModelsManager, openRoutesEditor, refreshModelsManager, renderRouteCard, routeModeLabel } from './asst-route.js';
|
|
62
|
+
import { prewarmRoutesEditor } from './asst-route-models.js';
|
|
62
63
|
import { budgetChipText, budgetSpendText, budgetTone, closeBudgetEditor, createBudgetController, mountBudgetChip, openBudgetEditor } from './asst-budget.js';
|
|
63
64
|
import { computerRemoteView, createComputerPanel, createComputerToggle, normalizeComputerRemote, openFrameLightbox, closeFrameLightbox, requestDesktopStatus, requestDesktopStop } from './asst-computer.js';
|
|
64
65
|
import {
|
|
65
66
|
applyLimit, applyLimitPacket, applyUsagePacket, BRAIN_PROVIDERS, brainLabel, createRenameWriter, createTabState, DEFAULT_ROUTE_MODE, deserializeTabState, fmtCost, fmtRunLine, limitExpiresIn, limitNoticeText, modelShortName,
|
|
66
67
|
brainModePatch, isBrainProvider, normalizeBrain, normalizeComputerMode, permissionModeLabel, normalizeRouteMode, normalizeTestDensity, projectLabel, providerMeta, providerShortLabel, readStoredBrain, runFromPayload,
|
|
67
|
-
serializeTabState, sessionStatus, tabStorageKey, userSessionTitle,
|
|
68
|
+
serializeTabState, sessionStatus, slashBrainEffort, tabStorageKey, userSessionTitle,
|
|
68
69
|
} from './asst-state.js';
|
|
69
70
|
import {
|
|
70
71
|
closeAssistantSession, dispatchAssistantRun, escalateAssistantRun, focusAssistantRun, getAssistantRun,
|
|
@@ -1046,6 +1047,8 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
1046
1047
|
}
|
|
1047
1048
|
if (meta.features && typeof meta.features === 'object') {
|
|
1048
1049
|
if (typeof meta.features.routing === 'boolean') st.features.routing = meta.features.routing;
|
|
1050
|
+
// The Model routes editor paints from these at once: read them now, in idle time, not at its first open.
|
|
1051
|
+
if (st.features.routing === true) prewarmRoutesEditor();
|
|
1049
1052
|
if (typeof meta.features.computer === 'boolean') st.features.computer = meta.features.computer;
|
|
1050
1053
|
if (typeof meta.features.testDensity === 'boolean') st.features.testDensity = meta.features.testDensity;
|
|
1051
1054
|
if (typeof meta.features.rename === 'boolean') st.features.rename = meta.features.rename;
|
|
@@ -1518,7 +1521,8 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
1518
1521
|
let requiresSwitch = false;
|
|
1519
1522
|
if (parsed.provider && parsed.provider !== st.brain.provider) { next.provider = parsed.provider; next.model = ''; next.effort = null; next.agent = null; next.accountId = null; requiresSwitch = true; }
|
|
1520
1523
|
if (parsed.model) next.model = parsed.model;
|
|
1521
|
-
|
|
1524
|
+
// Claude Code: `off` is Off (no thinking, `none`), as the picker's Off; auto / default is the model's default.
|
|
1525
|
+
if (parsed.effort) next.effort = slashBrainEffort(next.provider, parsed.effort);
|
|
1522
1526
|
applyBrain(normalizeBrain(next), { requiresSwitch, field: 'model' });
|
|
1523
1527
|
picker.refresh().catch(() => {});
|
|
1524
1528
|
return true;
|
|
@@ -104,7 +104,7 @@ export const RACK_CSS = `
|
|
|
104
104
|
mascot and the bubble's notch: under the mascot here (the bubble is beside it), after it ≤400 (the bubble is under it). */
|
|
105
105
|
.asst-rack-set { grid-area: face; align-self: start; display: flex; flex-direction: column; align-items: center; gap: 4px 6px; min-width: 0; line-height: 0; }
|
|
106
106
|
.asst-rack-face { color: var(--rk-text); line-height: 0; }
|
|
107
|
-
.asst-rack-face svg { display: block; width:
|
|
107
|
+
.asst-rack-face svg { display: block; width: 144px; height: 72px; }
|
|
108
108
|
.asst-rack-scene { color: var(--rk-text-2); line-height: 0; }
|
|
109
109
|
.asst-rack-scene:empty { display: none; }
|
|
110
110
|
/* 96×32 (the 120×40 scene at .8, strokes held near the run stage's weight). */
|
|
@@ -305,7 +305,7 @@ export const RACK_CSS = `
|
|
|
305
305
|
.asst-rack.is-staged > .asst-rack-receipt,
|
|
306
306
|
.asst-rack.is-live.is-nested > .asst-rack-receipt { display: none; }
|
|
307
307
|
.asst-rack-receipt-face { flex: none; align-self: stretch; display: inline-flex; align-items: center; justify-content: center; width: 46px; box-shadow: inset -1px 0 0 var(--rk-line); color: var(--rk-text-2); line-height: 0; }
|
|
308
|
-
.asst-rack-receipt-face svg { display: block; width:
|
|
308
|
+
.asst-rack-receipt-face svg { display: block; width: 64px; height: 32px; }
|
|
309
309
|
.asst-rack-receipt-text {
|
|
310
310
|
flex: 0 1 auto;
|
|
311
311
|
min-width: 0;
|
|
@@ -387,7 +387,7 @@ export const RACK_CSS = `
|
|
|
387
387
|
.asst-station[data-state="waiting"] > .asst-station-hdr { box-shadow: inset 0 0 0 1px var(--rk-line-2); }
|
|
388
388
|
/* The glyph slot: the kind's prop alone (rows differ at a squint); the awake row wears the eyes. */
|
|
389
389
|
.asst-station-face { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 16px; color: var(--rk-text-2); line-height: 0; }
|
|
390
|
-
.asst-station-face svg { display: block; width:
|
|
390
|
+
.asst-station-face svg { display: block; width: 56px; height: 28px; }
|
|
391
391
|
.asst-station-face svg.asst-prop-glyph { width: 24px; height: 16px; }
|
|
392
392
|
.asst-station[data-state="awake"] .asst-station-face { color: var(--rk-text); }
|
|
393
393
|
.asst-station-label { flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--rk-text-2); font-weight: 500; }
|
|
@@ -586,7 +586,7 @@ export const RACK_CSS = `
|
|
|
586
586
|
.asst-bubble-meta { display: none; }
|
|
587
587
|
}
|
|
588
588
|
@container asst (max-width: 299px) {
|
|
589
|
-
.asst-rack-face svg { width:
|
|
589
|
+
.asst-rack-face svg { width: 112px; height: 56px; }
|
|
590
590
|
.asst-rack-scene .asst-scene { width: 72px; height: 24px; stroke-width: 2.2; }
|
|
591
591
|
.asst-bubble::before { left: 22px; }
|
|
592
592
|
}
|
|
@@ -1840,7 +1840,7 @@ export function createRenderer(transcriptEl, hooks = {}) {
|
|
|
1840
1840
|
rack.row.classList.add('is-staged');
|
|
1841
1841
|
watchStageWidth(rack, true);
|
|
1842
1842
|
if (!rack.rig) {
|
|
1843
|
-
try { rack.rig = mascotLib.createMascot(rack.stage.face, { width:
|
|
1843
|
+
try { rack.rig = mascotLib.createMascot(rack.stage.face, { width: 144, height: 72, rangeX: 10, rangeY: 7, pose: 'idle' }); } catch { rack.rig = null; }
|
|
1844
1844
|
rack.pose = null;
|
|
1845
1845
|
rack.target = rack.rig ? stageTarget(rack) : null;
|
|
1846
1846
|
if (hero?.parked) dropHero(); // the stage is the character now: a hero still on its way out goes at once
|
|
@@ -2335,7 +2335,7 @@ export function createRenderer(transcriptEl, hooks = {}) {
|
|
|
2335
2335
|
* and observes nothing. Without poses: the plain mascot (receipt) or the
|
|
2336
2336
|
* kind's glyph (rows). Returns the SVG to repaint, or null.
|
|
2337
2337
|
*/
|
|
2338
|
-
function mountStill(host, pose, glyph, { staticGlyph = false, width =
|
|
2338
|
+
function mountStill(host, pose, glyph, { staticGlyph = false, width = 56, height = 28 } = {}) {
|
|
2339
2339
|
host.textContent = '';
|
|
2340
2340
|
if (typeof mascotLib.paintMascot === 'function' && typeof mascotLib.stillFrame === 'function') {
|
|
2341
2341
|
try {
|
|
@@ -2573,7 +2573,7 @@ export function createRenderer(transcriptEl, hooks = {}) {
|
|
|
2573
2573
|
if (!r.faceBuilt && !rack.staged && !(rack.nested && live)) {
|
|
2574
2574
|
r.faceBuilt = true;
|
|
2575
2575
|
r.pose = pose;
|
|
2576
|
-
r.svg = mountStill(r.face, pose, '✓', { width:
|
|
2576
|
+
r.svg = mountStill(r.face, pose, '✓', { width: 64, height: 32 });
|
|
2577
2577
|
} else if (r.faceBuilt && r.pose !== pose) {
|
|
2578
2578
|
r.pose = pose;
|
|
2579
2579
|
repaintStill(r.svg, pose);
|
|
@@ -3148,11 +3148,11 @@ export function createRenderer(transcriptEl, hooks = {}) {
|
|
|
3148
3148
|
if (workingFace && workingFace.still === calm()) return;
|
|
3149
3149
|
dropWorkingFace();
|
|
3150
3150
|
if (calm()) {
|
|
3151
|
-
workingFace = { still: true, el: mountStill(host, 'think', '…', { width:
|
|
3151
|
+
workingFace = { still: true, el: mountStill(host, 'think', '…', { width: 112, height: 56 }) };
|
|
3152
3152
|
return;
|
|
3153
3153
|
}
|
|
3154
3154
|
try {
|
|
3155
|
-
const rig = mascotLib.createMascot(host, { width:
|
|
3155
|
+
const rig = mascotLib.createMascot(host, { width: 112, height: 56, pose: 'think' });
|
|
3156
3156
|
const face = { still: false, rig, el: rig.el, held: false };
|
|
3157
3157
|
face.target = { kind: 'working', rig, el: rig.el, hold(on) { face.held = !!on; }, restore() { if (workingFace === face) rig.setPose('think'); } };
|
|
3158
3158
|
workingFace = face;
|
|
@@ -3613,7 +3613,7 @@ export function createRenderer(transcriptEl, hooks = {}) {
|
|
|
3613
3613
|
<div class="asst-empty-project" role="group" aria-label="${esc(t('assistant.empty.context', 'Context'))}" hidden></div>`;
|
|
3614
3614
|
const box = emptyEl.querySelector('.asst-empty-mascot');
|
|
3615
3615
|
try {
|
|
3616
|
-
const rig = mascotLib.createMascot(box, { width:
|
|
3616
|
+
const rig = mascotLib.createMascot(box, { width: 280, height: 140, idleVariant: 'hero' });
|
|
3617
3617
|
hero = { rig, el: rig.el, box, parked: false, leaving: false, held: false, dock: null, egg: false, leaveTimer: 0 };
|
|
3618
3618
|
hero.target = heroTarget(hero);
|
|
3619
3619
|
wireEgg(hero);
|
|
@@ -11,12 +11,72 @@
|
|
|
11
11
|
// list of models: a label, a tier, a price or an effort level is read from the
|
|
12
12
|
// catalog row each time it is drawn.
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import { fetchClaudeAccounts, fetchCodexAccounts } from '../agent-runtime-options.js';
|
|
15
|
+
import { on } from '../state.js';
|
|
16
|
+
import { getRouting } from './asst-api.js';
|
|
17
|
+
import { cachedModelCatalog, catalogModelRow, loadModelCatalog, modelCatalogStatus, onModelCatalogChange } from './asst-brain-picker.js';
|
|
15
18
|
import { routeTargetLabel } from './asst-state.js';
|
|
16
19
|
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* A new build of the catalog, never the copy another menu loaded a minute ago.
|
|
22
|
+
* The editor paints from cachedRouteModels() first and asks for this in the
|
|
23
|
+
* background; Reload models asks for it too.
|
|
24
|
+
*/
|
|
25
|
+
export function loadRouteModels({ force = true } = {}) {
|
|
26
|
+
return loadModelCatalog({ force });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The last catalog this page loaded, synchronously (null before the first load): what the editor paints from at once. */
|
|
30
|
+
export function cachedRouteModels() { return cachedModelCatalog(); }
|
|
31
|
+
|
|
32
|
+
// ── Routing settings kept for the next open ──────────────────────────────────
|
|
33
|
+
// GET /api/assistant/routing is small and fast, but it is still a round trip the
|
|
34
|
+
// first paint would wait for. The last answer is kept for the page's lifetime;
|
|
35
|
+
// the editor paints from it and reads the live one right after. A version the
|
|
36
|
+
// server moved past is caught by the PUT (409) and by the refresh on open.
|
|
37
|
+
let _routing = null;
|
|
38
|
+
let _routingLoading = null;
|
|
39
|
+
|
|
40
|
+
/** The last routing answer (null before the first load or after a change elsewhere). */
|
|
41
|
+
export function cachedRouting() { return _routing; }
|
|
42
|
+
|
|
43
|
+
/** Keep a routing answer (the editor's own load, or a save's reply merged over the last one). */
|
|
44
|
+
export function rememberRouting(data) {
|
|
45
|
+
if (!data || typeof data !== 'object' || !data.routing) return _routing;
|
|
46
|
+
_routing = { ..._routing, ...data, taskClasses: Array.isArray(data.taskClasses) ? data.taskClasses : _routing?.taskClasses || [] };
|
|
47
|
+
return _routing;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Drop the kept answer (a change in another window): the next open reads the server before it paints. */
|
|
51
|
+
export function forgetRouting() { _routing = null; }
|
|
52
|
+
|
|
53
|
+
/** GET the routing settings, once at a time, and keep the answer. */
|
|
54
|
+
export function loadRouting({ get = getRouting } = {}) {
|
|
55
|
+
if (_routingLoading) return _routingLoading;
|
|
56
|
+
_routingLoading = Promise.resolve().then(get).then(data => { rememberRouting(data); return data; }).finally(() => { _routingLoading = null; });
|
|
57
|
+
return _routingLoading;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (typeof document !== 'undefined') on('sync:assistant:routing-changed', forgetRouting);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Warm what the editor's first paint reads, in idle time, once the Assistant
|
|
64
|
+
* panel learns that routing is available: the routing settings, the catalog
|
|
65
|
+
* (the page's cached build is enough: an open asks for a new one in the
|
|
66
|
+
* background) and the account lists. Every failure is silent; an open loads
|
|
67
|
+
* again whatever is missing. Once per page; returns the promise for tests.
|
|
68
|
+
*/
|
|
69
|
+
let _prewarmed = null;
|
|
70
|
+
export function prewarmRoutesEditor({ routing = loadRouting, catalog = () => loadModelCatalog(), accounts = () => Promise.allSettled([fetchClaudeAccounts(), fetchCodexAccounts()]), idle = defaultIdle, force = false } = {}) {
|
|
71
|
+
if (_prewarmed && !force) return _prewarmed;
|
|
72
|
+
_prewarmed = new Promise(resolve => idle(() => {
|
|
73
|
+
Promise.allSettled([Promise.resolve().then(routing), Promise.resolve().then(catalog), Promise.resolve().then(accounts)]).then(() => resolve(true), () => resolve(false));
|
|
74
|
+
}));
|
|
75
|
+
return _prewarmed;
|
|
76
|
+
}
|
|
77
|
+
function defaultIdle(fn) {
|
|
78
|
+
if (typeof requestIdleCallback === 'function') requestIdleCallback(() => fn(), { timeout: 2000 });
|
|
79
|
+
else setTimeout(fn, 250);
|
|
20
80
|
}
|
|
21
81
|
|
|
22
82
|
/** Loading/partial state belongs to the same model source, without changing the catalog shape. */
|
|
@@ -38,11 +38,28 @@ import {
|
|
|
38
38
|
ROUTE_MODES,
|
|
39
39
|
routeKindLabel,
|
|
40
40
|
routeTargetLabel,
|
|
41
|
+
routeEffortWord,
|
|
42
|
+
ROUTE_EFFORT_OFF,
|
|
41
43
|
OPTIONAL_PROVIDERS,
|
|
42
44
|
UNPRICED_PROVIDERS,
|
|
43
45
|
} from './asst-state.js';
|
|
44
46
|
|
|
45
47
|
function str(v) { return v == null ? '' : String(v).trim(); }
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The route card's effort choices for a model (Auto is the card's own first item): Off (`none`, no
|
|
51
|
+
* thinking) first where the model can honor it, then its levels. Mirrors lib/effort-levels.js
|
|
52
|
+
* supportsEffortOff: Claude Code whenever the model thinks at all (the SDK disables thinking);
|
|
53
|
+
* Codex / OpenCode only when the model lists `none`; Antigravity never. → [{ id, label, off }].
|
|
54
|
+
*/
|
|
55
|
+
export function routeEffortChoices(provider, row) {
|
|
56
|
+
const levels = getEffortLevelsForModel(provider, row).filter(e => e.id !== 'off');
|
|
57
|
+
const offId = ROUTE_EFFORT_OFF;
|
|
58
|
+
const rest = levels.filter(e => String(e.id).toLowerCase() !== offId).map(e => ({ id: e.id, label: e.label || e.id, off: false }));
|
|
59
|
+
const listsOff = levels.some(e => String(e.id).toLowerCase() === offId);
|
|
60
|
+
const canOff = provider === 'claude-code' ? rest.length > 0 : provider === 'antigravity' ? false : listsOff;
|
|
61
|
+
return canOff ? [{ id: offId, label: 'Off', off: true }, ...rest] : rest;
|
|
62
|
+
}
|
|
46
63
|
function num(v) { const n = Number(v); return v != null && v !== '' && typeof v !== 'boolean' && Number.isFinite(n) ? n : null; }
|
|
47
64
|
function obj(v) { return v && typeof v === 'object' && !Array.isArray(v) ? v : null; }
|
|
48
65
|
function arr(v) { return Array.isArray(v) ? v : []; }
|
|
@@ -497,7 +514,7 @@ export function routeLineParts(route, phase = 'decided', { brainLabel = '', t =
|
|
|
497
514
|
const meta = [];
|
|
498
515
|
const accountLabel = routeDisplayAccount(target, t);
|
|
499
516
|
if (accountLabel) meta.push(accountLabel);
|
|
500
|
-
if (effort && effort !== 'off') meta.push(effort);
|
|
517
|
+
if (effort && effort !== 'off') meta.push(routeEffortWord(effort));
|
|
501
518
|
if (confidence) meta.push(confidence);
|
|
502
519
|
return {
|
|
503
520
|
taskClass: cls,
|
|
@@ -877,7 +894,7 @@ export function renderRouteCard(container, input, hooks = {}) {
|
|
|
877
894
|
row.setAttribute('aria-disabled', o.disabled ? 'true' : 'false');
|
|
878
895
|
row.tabIndex = -1;
|
|
879
896
|
const kindWord = o.kind && o.kind !== 'direct' ? routeKindWord(o.kind, hooks.t) : '';
|
|
880
|
-
const sub = [kindWord, routeDisplayAccount(o, hooks.t), o.effort && o.effort !== 'off' ? o.effort : '', o.price ? priceText(o.price) : '', o.vision ? tr('assistant.brain.vision', 'vision') : '', o.reason].filter(Boolean).join(' · ');
|
|
897
|
+
const sub = [kindWord, routeDisplayAccount(o, hooks.t), o.effort && o.effort !== 'off' ? routeEffortWord(o.effort) : '', o.price ? priceText(o.price) : '', o.vision ? tr('assistant.brain.vision', 'vision') : '', o.reason].filter(Boolean).join(' · ');
|
|
881
898
|
row.innerHTML = `
|
|
882
899
|
<span class="asst-route-num" aria-hidden="true">${esc(o.number)}</span>
|
|
883
900
|
<span class="asst-route-opt-icon asst-icon" aria-hidden="true"${o.provider ? ` style="color:${esc(providerColor(o.provider))}"` : ''}>${providerIconHtml(o.provider, hooks)}</span>
|
|
@@ -996,12 +1013,12 @@ export function renderRouteCard(container, input, hooks = {}) {
|
|
|
996
1013
|
setFieldLabel(otherBtn, target ? routeTargetLabel(target) : tr('assistant.routes.other', 'Other model…'));
|
|
997
1014
|
otherBtn.setAttribute('aria-label', tr('assistant.brain.model', 'Model'));
|
|
998
1015
|
otherBtn.disabled = busy();
|
|
999
|
-
setFieldLabel(effortBtn, target?.effort
|
|
1016
|
+
setFieldLabel(effortBtn, !target?.effort ? tr('assistant.routes.editorEffortAuto', 'Auto')
|
|
1017
|
+
: target.effort === ROUTE_EFFORT_OFF ? tr('assistant.routes.editorEffortOff', 'Off') : target.effort);
|
|
1000
1018
|
effortBtn.setAttribute('aria-label', tr('assistant.brain.effort', 'Thinking effort'));
|
|
1001
1019
|
setFieldLabel(accountBtn, routeDisplayAccount(target, hooks.t) || tr('assistant.routes.account.workersDefault', 'Workers default'));
|
|
1002
1020
|
accountBtn.setAttribute('aria-label', tr('assistant.brain.account', 'Account profile'));
|
|
1003
|
-
|
|
1004
|
-
effortBtn.disabled = busy() || !target || !levels.some(e => e.id !== 'off');
|
|
1021
|
+
effortBtn.disabled = busy() || !target || !routeEffortChoices(target.provider, catalogModelRow(target.provider, target.model)).length;
|
|
1005
1022
|
// Here runs on this conversation's own account (another one is a worker): only a worker picks one.
|
|
1006
1023
|
accountBtn.hidden = state.side === 'direct' || !['claude-code', 'codex'].includes(target?.provider);
|
|
1007
1024
|
accountBtn.disabled = busy();
|
|
@@ -1009,10 +1026,10 @@ export function renderRouteCard(container, input, hooks = {}) {
|
|
|
1009
1026
|
effortBtn.addEventListener('click', () => {
|
|
1010
1027
|
const target = selected();
|
|
1011
1028
|
if (!target) return;
|
|
1012
|
-
const
|
|
1029
|
+
const choices = routeEffortChoices(target.provider, catalogModelRow(target.provider, target.model));
|
|
1013
1030
|
openMenu(effortBtn, { title: tr('assistant.brain.effort', 'Thinking effort'), placement: 'auto', items: [
|
|
1014
1031
|
{ kind: 'radio', label: tr('assistant.routes.editorEffortAuto', 'Auto'), selected: !target.effort, onSelect: () => editTarget({ effort: null }) },
|
|
1015
|
-
...
|
|
1032
|
+
...choices.map(e => ({ kind: 'radio', label: e.off ? tr('assistant.routes.editorEffortOff', 'Off') : e.label, selected: target.effort === e.id, onSelect: () => editTarget({ effort: e.id }) })),
|
|
1016
1033
|
] });
|
|
1017
1034
|
});
|
|
1018
1035
|
accountBtn.addEventListener('click', async () => {
|