synabun 2.4.2 → 2.4.4
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 +39 -0
- package/README.md +1 -1
- package/docs/browser-extension-bridge.md +83 -34
- package/lib/release-npm-ci.mjs +23 -1
- package/mcp-server/dist/http.d.ts.map +1 -1
- package/mcp-server/dist/http.js +8 -1
- package/mcp-server/dist/http.js.map +1 -1
- package/mcp-server/dist/services/identity.d.ts +2 -0
- package/mcp-server/dist/services/identity.d.ts.map +1 -1
- package/mcp-server/dist/services/identity.js +4 -0
- package/mcp-server/dist/services/identity.js.map +1 -1
- package/mcp-server/dist/services/memory-client.d.ts +5 -0
- package/mcp-server/dist/services/memory-client.d.ts.map +1 -1
- package/mcp-server/dist/services/memory-client.js +21 -2
- package/mcp-server/dist/services/memory-client.js.map +1 -1
- package/mcp-server/dist/services/memory-writer.d.ts +3 -0
- package/mcp-server/dist/services/memory-writer.d.ts.map +1 -1
- package/mcp-server/dist/services/memory-writer.js +7 -1
- package/mcp-server/dist/services/memory-writer.js.map +1 -1
- package/mcp-server/dist/services/neural-interface.d.ts +11 -1
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +68 -18
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/services/typesafe-config.d.ts +38 -2
- package/mcp-server/dist/services/typesafe-config.d.ts.map +1 -1
- package/mcp-server/dist/services/typesafe-config.js +260 -8
- package/mcp-server/dist/services/typesafe-config.js.map +1 -1
- package/mcp-server/dist/tools/agent-definition.d.ts +2 -2
- package/mcp-server/dist/tools/agents.d.ts +3 -1
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +11 -6
- package/mcp-server/dist/tools/agents.js.map +1 -1
- package/mcp-server/dist/tools/browser-extension-setup.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-extension-setup.js +8 -2
- package/mcp-server/dist/tools/browser-extension-setup.js.map +1 -1
- package/mcp-server/dist/tools/browser-observe.d.ts +11 -0
- package/mcp-server/dist/tools/browser-observe.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-observe.js +113 -27
- package/mcp-server/dist/tools/browser-observe.js.map +1 -1
- package/mcp-server/dist/tools/browser-readers.d.ts +6 -0
- package/mcp-server/dist/tools/browser-readers.d.ts.map +1 -0
- package/mcp-server/dist/tools/browser-readers.js +17 -0
- package/mcp-server/dist/tools/browser-readers.js.map +1 -0
- package/mcp-server/dist/tools/remember.d.ts.map +1 -1
- package/mcp-server/dist/tools/remember.js +6 -2
- package/mcp-server/dist/tools/remember.js.map +1 -1
- package/mcp-server/dist/tools/youtube/analytics.d.ts +4 -0
- package/mcp-server/dist/tools/youtube/analytics.d.ts.map +1 -1
- package/mcp-server/dist/tools/youtube/analytics.js +25 -20
- package/mcp-server/dist/tools/youtube/analytics.js.map +1 -1
- package/mcp-server/dist/tools/youtube/helpers.d.ts +5 -1
- package/mcp-server/dist/tools/youtube/helpers.d.ts.map +1 -1
- package/mcp-server/dist/tools/youtube/helpers.js +7 -3
- package/mcp-server/dist/tools/youtube/helpers.js.map +1 -1
- package/mcp-server/dist/tools/youtube/navigate.d.ts +2 -0
- package/mcp-server/dist/tools/youtube/navigate.d.ts.map +1 -1
- package/mcp-server/dist/tools/youtube/navigate.js +5 -3
- package/mcp-server/dist/tools/youtube/navigate.js.map +1 -1
- package/mcp-server/dist/tools/youtube/playlist.js +2 -2
- package/mcp-server/dist/tools/youtube/playlist.js.map +1 -1
- package/mcp-server/dist/tools/youtube/readers.d.ts +4 -0
- package/mcp-server/dist/tools/youtube/readers.d.ts.map +1 -0
- package/mcp-server/dist/tools/youtube/readers.js +15 -0
- package/mcp-server/dist/tools/youtube/readers.js.map +1 -0
- package/mcp-server/package-lock.json +5 -5
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/http.ts +8 -1
- package/mcp-server/src/services/identity.ts +5 -0
- package/mcp-server/src/services/memory-client.ts +32 -12
- package/mcp-server/src/services/memory-writer.ts +5 -2
- package/mcp-server/src/services/neural-interface.ts +66 -19
- package/mcp-server/src/services/typesafe-config.ts +268 -7
- package/mcp-server/src/tools/agents.ts +12 -6
- package/mcp-server/src/tools/browser-extension-setup.ts +8 -2
- package/mcp-server/src/tools/browser-observe.ts +117 -28
- package/mcp-server/src/tools/browser-readers.ts +19 -0
- package/mcp-server/src/tools/remember.ts +6 -1
- package/mcp-server/src/tools/youtube/analytics.ts +26 -28
- package/mcp-server/src/tools/youtube/helpers.ts +8 -2
- package/mcp-server/src/tools/youtube/navigate.ts +6 -7
- package/mcp-server/src/tools/youtube/playlist.ts +2 -2
- package/mcp-server/src/tools/youtube/readers.ts +15 -0
- package/neural-interface/i18n/en.json +189 -1
- package/neural-interface/i18n/pt-BR.json +196 -8
- package/neural-interface/lib/assistant-api.js +123 -0
- package/neural-interface/lib/assistant-brains/claude.js +10 -0
- package/neural-interface/lib/assistant-brains/opencode.js +121 -7
- package/neural-interface/lib/assistant-dispatch.js +302 -44
- package/neural-interface/lib/assistant-envelope.js +40 -0
- package/neural-interface/lib/assistant-memory.js +3 -1
- package/neural-interface/lib/assistant-persona.js +6 -0
- package/neural-interface/lib/assistant-router.js +18 -8
- package/neural-interface/lib/assistant-runtime.js +182 -11
- package/neural-interface/lib/assistant-task-prompt.js +15 -2
- package/neural-interface/lib/browser-connection-state.js +20 -0
- package/neural-interface/lib/browser-extension-adapter.js +221 -17
- package/neural-interface/lib/browser-extension-archive.js +149 -0
- package/neural-interface/lib/browser-extension-bridge.js +46 -10
- package/neural-interface/lib/browser-extension-folder.js +635 -76
- package/neural-interface/lib/browser-extension-package.js +201 -0
- package/neural-interface/lib/browser-extension-pin.js +84 -0
- package/neural-interface/lib/browser-extension-pin.json +35 -0
- package/{browser-extension/protocol.js → neural-interface/lib/browser-extension-protocol.js} +111 -13
- package/neural-interface/lib/browser-extension-setup.js +108 -19
- package/neural-interface/lib/browser-extension-update.js +104 -0
- package/neural-interface/lib/browser-extraction.js +38 -14
- package/neural-interface/lib/claude-bg-tasks.js +183 -0
- package/neural-interface/lib/claude-history.js +12 -1
- package/neural-interface/lib/cli-install.js +23 -3
- package/neural-interface/lib/cli-update-planner.js +67 -4
- package/neural-interface/lib/confined-fs.js +25 -0
- package/neural-interface/lib/coordination/operations.js +2 -0
- package/neural-interface/lib/db.js +39 -16
- package/neural-interface/lib/editor-completion-opencode.js +2 -2
- package/neural-interface/lib/git-bash/manager.js +28 -3
- package/neural-interface/lib/git-status-runner.js +31 -3
- package/neural-interface/lib/loop-inventory.js +162 -0
- package/neural-interface/lib/loop-stall.js +74 -4
- package/neural-interface/lib/memory-session-capture.js +157 -66
- package/neural-interface/lib/native-loop-providers.js +82 -13
- package/neural-interface/lib/native-loop-runtime.js +23 -2
- package/neural-interface/lib/opencode-protocol.js +4 -2
- package/neural-interface/lib/opencode-shell-read.js +107 -0
- package/neural-interface/lib/opencode-stop-failures.js +40 -0
- package/neural-interface/lib/opencode-turn-release.js +173 -0
- package/neural-interface/lib/opencode-v2-client.js +4 -1
- package/neural-interface/lib/opencode-v2-ws-requests.js +34 -0
- package/neural-interface/lib/opencode2-client.js +341 -6
- package/neural-interface/lib/opencode2-translate.js +161 -4
- package/neural-interface/lib/peer-identity.js +62 -16
- package/neural-interface/lib/session-cache-builder.js +66 -18
- package/neural-interface/lib/session-capture-gate.js +42 -0
- package/neural-interface/lib/session-indexer.js +28 -20
- package/neural-interface/lib/teams/scheduler.js +3 -2
- package/neural-interface/lib/terminal-token-redaction.js +83 -0
- package/neural-interface/lib/ui-blob-api.js +14 -5
- package/neural-interface/lib/ui-blob-store.js +302 -39
- package/neural-interface/lib/whatsapp/bridge.js +52 -6
- package/neural-interface/package-lock.json +5 -5
- package/neural-interface/package.json +1 -1
- package/neural-interface/public/extension-setup.html +6 -2
- package/neural-interface/public/shared/agy/agy-panel.js +38 -10
- package/neural-interface/public/shared/assistant/asst-agents-dock.js +4 -0
- package/neural-interface/public/shared/assistant/asst-api.js +67 -0
- package/neural-interface/public/shared/assistant/asst-composer.js +85 -12
- package/neural-interface/public/shared/assistant/asst-panel.js +354 -11
- package/neural-interface/public/shared/assistant/asst-rack-styles.js +23 -0
- package/neural-interface/public/shared/assistant/asst-render.js +343 -10
- package/neural-interface/public/shared/assistant/asst-scenes.js +12 -0
- package/neural-interface/public/shared/assistant/asst-shell-logic.js +200 -0
- package/neural-interface/public/shared/assistant/asst-shell.js +111 -0
- package/neural-interface/public/shared/assistant/asst-sidepanel.js +18 -1
- package/neural-interface/public/shared/assistant/asst-state.js +241 -2
- package/neural-interface/public/shared/assistant/asst-steer.js +294 -0
- package/neural-interface/public/shared/assistant/asst-styles.js +21 -0
- package/neural-interface/public/shared/bg-tasks/bg-tasks-claude.js +147 -0
- package/neural-interface/public/shared/bg-tasks/bg-tasks-model.js +527 -0
- package/neural-interface/public/shared/bg-tasks/bg-tasks-panel.js +161 -0
- package/neural-interface/public/shared/bg-tasks/bg-tasks-view.js +508 -0
- package/neural-interface/public/shared/browser-extension-updates.js +88 -0
- package/neural-interface/public/shared/cdx/cdx-tabs.js +25 -0
- package/neural-interface/public/shared/cp/cp-bg-tasks.js +130 -0
- package/neural-interface/public/shared/extension-setup/es-page.js +25 -12
- package/neural-interface/public/shared/extension-setup/es-view.js +25 -10
- package/neural-interface/public/shared/extension-update-view.js +34 -0
- package/neural-interface/public/shared/mtc/mtc-panel.js +17 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-events.js +5 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-manager.js +1 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +34 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-rehydrate.js +7 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +26 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send.js +39 -6
- package/neural-interface/public/shared/ocp-v2/ocp-v2-session-actions.js +20 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-shell-block.js +165 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-shell-logic.js +350 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-shell.js +108 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-state.js +49 -3
- package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +40 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-tools-logic.js +20 -5
- package/neural-interface/public/shared/ocp-v2/ocp-v2-tools.js +7 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +7 -2
- package/neural-interface/public/shared/settings/settings-browser-extension.js +61 -13
- package/neural-interface/public/shared/settings/settings-extension-update.js +114 -0
- package/neural-interface/public/shared/shell-stop-view.js +83 -0
- package/neural-interface/public/shared/styles.css +4 -0
- package/neural-interface/public/shared/tour/tour-actor.js +14 -3
- package/neural-interface/public/shared/tray-auto-close.js +36 -6
- package/neural-interface/public/shared/ui-claude-panel.js +130 -1
- package/neural-interface/public/shared/ui-native-loop-router.js +45 -3
- package/neural-interface/public/shared/ui-notifications.js +23 -4
- package/neural-interface/public/shared/ui-scroll-follow.js +4 -0
- package/neural-interface/public/shared/ui-settings-entry.js +6 -0
- package/neural-interface/public/shared/ui-tray-columns.js +9 -2
- package/neural-interface/public/shared/worker-end.js +18 -0
- package/neural-interface/scripts/patch-node-pty.mjs +151 -0
- package/neural-interface/scripts/rebuild-pty.js +10 -0
- package/neural-interface/server.js +725 -308
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -2
- package/browser-extension/content.js +0 -231
- package/browser-extension/engine.js +0 -658
- package/browser-extension/icons/icon-128.png +0 -0
- package/browser-extension/icons/icon-16.png +0 -0
- package/browser-extension/icons/icon-32.png +0 -0
- package/browser-extension/icons/icon-48.png +0 -0
- package/browser-extension/icons/status-off-16.png +0 -0
- package/browser-extension/icons/status-off-32.png +0 -0
- package/browser-extension/icons/status-off-48.png +0 -0
- package/browser-extension/icons/status-on-16.png +0 -0
- package/browser-extension/icons/status-on-32.png +0 -0
- package/browser-extension/icons/status-on-48.png +0 -0
- package/browser-extension/manifest.json +0 -58
- package/browser-extension/popup-strings.js +0 -250
- package/browser-extension/popup-view.js +0 -151
- package/browser-extension/popup.css +0 -166
- package/browser-extension/popup.html +0 -108
- package/browser-extension/popup.js +0 -359
- package/browser-extension/service-worker.js +0 -283
- package/browser-extension/setup-content.js +0 -36
- package/browser-extension/tokens.css +0 -326
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
status, then automatic pairing. Every string comes from i18n browserExtension.setup.* (es-page.js); es-view.js
|
|
15
15
|
decides. Stable hooks: #es-setup[data-state], #es-title, #es-lead, #es-live[data-tone], #es-browser,
|
|
16
16
|
#es-steps > li[data-step][data-done], #es-extensions-url + #es-copy-url, #es-folder + #es-copy-folder + #es-reveal,
|
|
17
|
-
#es-alternatives, #es-reload, #es-restart, #es-copied
|
|
18
|
-
|
|
17
|
+
#es-alternatives, #es-reload, #es-restart, #es-copied, #es-progress (the bytes of the extension's download, while
|
|
18
|
+
the state is "downloading"). The ticket element is the only thing the extension's content script reads; it is
|
|
19
|
+
filled only while the extension is on this page and the server waits for it. -->
|
|
19
20
|
<main id="es-setup" class="es-setup" data-state="idle" data-layout="result" aria-busy="true">
|
|
20
21
|
<div class="es-top">
|
|
21
22
|
<p class="es-brand"><img src="/icon-192.png" alt="" width="32" height="32"><span>SynaBun</span></p>
|
|
@@ -75,12 +76,14 @@
|
|
|
75
76
|
<h2 class="es-status-title" id="es-status-title"></h2>
|
|
76
77
|
<p id="es-live" class="es-live" role="status" aria-live="polite" data-tone=""></p>
|
|
77
78
|
<p id="es-help" class="es-note" hidden></p>
|
|
79
|
+
<p id="es-progress" class="es-note es-progress" hidden></p>
|
|
78
80
|
<section id="es-alternatives" class="es-alternatives" hidden aria-labelledby="es-alternatives-title">
|
|
79
81
|
<h3 id="es-alternatives-title" class="es-subtitle"></h3>
|
|
80
82
|
<div id="es-alternatives-list" class="es-row"></div>
|
|
81
83
|
</section>
|
|
82
84
|
<p id="es-reload" class="es-note es-warn" hidden></p>
|
|
83
85
|
<div class="es-row es-actions" id="es-actions" hidden>
|
|
86
|
+
<a class="es-button es-button-primary" id="es-update-flow" href="/#browser-extension-update" hidden></a>
|
|
84
87
|
<a class="es-button es-button-primary" id="es-back" href="/" hidden></a>
|
|
85
88
|
<button type="button" class="es-button es-button-primary" id="es-restart" data-action="restart" hidden></button>
|
|
86
89
|
</div>
|
|
@@ -95,6 +98,7 @@
|
|
|
95
98
|
<details class="es-surface es-info es-help" id="es-trouble">
|
|
96
99
|
<summary id="es-trouble-title"></summary>
|
|
97
100
|
<p id="es-trouble-help" class="es-note"></p>
|
|
101
|
+
<p id="es-moved-help" class="es-note"></p>
|
|
98
102
|
<p id="es-policy-help" class="es-note"></p>
|
|
99
103
|
</details>
|
|
100
104
|
</div>
|
|
@@ -58,6 +58,7 @@ import { runAwaitsAnswer, runTurnLive } from '../sidepanel-session-status.js';
|
|
|
58
58
|
import { wireFileLinks } from '../ui-file-links.js';
|
|
59
59
|
import { notify, NOTIF_TYPE } from '../ui-notifications.js';
|
|
60
60
|
import { forgetGreeting, mountGreeting } from '../greeting/greeting-card.js';
|
|
61
|
+
import { composerHoldsDraft, markAutoCloseKeep } from '../tray-auto-close.js';
|
|
61
62
|
|
|
62
63
|
export const PANEL_OWNER = 'antigravity-sidepanel';
|
|
63
64
|
const ICON = ICONS.mark;
|
|
@@ -557,10 +558,12 @@ function blockedNow() {
|
|
|
557
558
|
return '';
|
|
558
559
|
}
|
|
559
560
|
|
|
560
|
-
|
|
561
|
-
|
|
561
|
+
// `tab` is the tab the message is for: the one on screen, or (from drainQueue only) a tab in the background
|
|
562
|
+
// whose turn ended with its queue to go on, whose composer is not the one on screen and is never touched.
|
|
563
|
+
async function send({ text: given = null, staged: givenStaged = null, fromQueue = false, tab = activeTab() } = {}) {
|
|
562
564
|
if (!tab || tab.automationActive) return;
|
|
563
|
-
const
|
|
565
|
+
const onScreen = tab === activeTab();
|
|
566
|
+
const input = onScreen ? $('.agy-input') : null;
|
|
564
567
|
const text = given ?? (input?.value || '');
|
|
565
568
|
const rt = runtimeOf(tab);
|
|
566
569
|
const staged = givenStaged ?? rt.staged;
|
|
@@ -645,7 +648,7 @@ async function send({ text: given = null, staged: givenStaged = null, fromQueue
|
|
|
645
648
|
rt.notice = null;
|
|
646
649
|
tab.running = true;
|
|
647
650
|
tab.startedAt = Date.now();
|
|
648
|
-
hideHints();
|
|
651
|
+
if (onScreen) hideHints();
|
|
649
652
|
saveTabs();
|
|
650
653
|
renderTabs();
|
|
651
654
|
renderAttachments();
|
|
@@ -667,13 +670,20 @@ async function send({ text: given = null, staged: givenStaged = null, fromQueue
|
|
|
667
670
|
}
|
|
668
671
|
}
|
|
669
672
|
|
|
673
|
+
/**
|
|
674
|
+
* Send the next prompt queued in `tab`, the tab it was typed in, as the Claude Code and Codex panels do: a tab in
|
|
675
|
+
* the background whose turn ends goes on with its own queue, one prompt per turn in the order they were queued
|
|
676
|
+
* (the next one goes at that prompt's turn:end). A paused queue waits; so does one that cannot be sent now (a
|
|
677
|
+
* send under way, a running automation, a missing or broken agy): the prompt stays first in its queue.
|
|
678
|
+
*/
|
|
670
679
|
function drainQueue(tab) {
|
|
671
680
|
const rt = runtimeOf(tab);
|
|
672
|
-
if (!rt.queue.length || rt.queuePaused || tab.running) { renderQueue(); return; }
|
|
681
|
+
if (!rt.queue.length || rt.queuePaused || tab.running || rt.sending || tab.automationActive) { renderQueue(tab); return; }
|
|
682
|
+
if (blockedNow()) { if (tab === activeTab()) nudgeSetup(); renderQueue(tab); return; }
|
|
673
683
|
const next = rt.queue.shift();
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
684
|
+
// send() takes the prompt before its first await (rt.sending), so the mark below still says 'queue'.
|
|
685
|
+
send({ tab, text: next.text, staged: next.staged, fromQueue: true });
|
|
686
|
+
renderQueue(tab);
|
|
677
687
|
}
|
|
678
688
|
|
|
679
689
|
async function stop() {
|
|
@@ -1261,9 +1271,13 @@ function renderAttachments() {
|
|
|
1261
1271
|
box.innerHTML = staged.map((file, idx) => `<span class="agy-chip" title="${esc(file.path || file.name)}">${file.mimeType?.startsWith('image/') && file.dataUrl ? `<img src="${esc(file.dataUrl)}" alt="">` : ''}<span>${esc(file.name)}</span><button type="button" data-unstage="${idx}" aria-label="${esc(T('attachmentRemove', { name: file.name }))}">×</button></span>`).join('');
|
|
1262
1272
|
}
|
|
1263
1273
|
|
|
1264
|
-
function renderQueue() {
|
|
1274
|
+
function renderQueue(tab = activeTab()) {
|
|
1275
|
+
// The tray's auto-close keeps a tab while its queue holds prompts (autoCloseKeepOf): said at every change,
|
|
1276
|
+
// for a tab in the background too; only the tab on screen has its queue drawn.
|
|
1277
|
+
if (tab?.pillEl) markAutoCloseKeep(tab.pillEl, autoCloseKeepOf(tab));
|
|
1278
|
+
if (tab !== activeTab()) return;
|
|
1265
1279
|
const box = $('.agy-queue');
|
|
1266
|
-
const rt = runtimeOf(
|
|
1280
|
+
const rt = runtimeOf(tab);
|
|
1267
1281
|
if (!box) return;
|
|
1268
1282
|
const queue = rt?.queue || [];
|
|
1269
1283
|
box.hidden = !queue.length;
|
|
@@ -1581,6 +1595,18 @@ function chooseHint(idx) {
|
|
|
1581
1595
|
renderComposer();
|
|
1582
1596
|
}
|
|
1583
1597
|
|
|
1598
|
+
// What the tray's auto-close must leave open (tray-auto-close.js), or '': a tab with prompts in its queue that
|
|
1599
|
+
// were never sent ('queue': paused or not, and while one taken off it is still on its way, `sending`), else a tab
|
|
1600
|
+
// holding an unsent draft, its text (in the composer while the tab is the one on screen) and its staged
|
|
1601
|
+
// attachments. The user's X closes it as before. renderQueue repaints the mark at every change of a queue.
|
|
1602
|
+
function autoCloseKeepOf(tab) {
|
|
1603
|
+
if (!tab) return '';
|
|
1604
|
+
const rt = _runtime.get(tab.id);
|
|
1605
|
+
if (rt?.queue.length || rt?.sending) return 'queue';
|
|
1606
|
+
const input = tab === activeTab() ? $('.agy-input') : null;
|
|
1607
|
+
return composerHoldsDraft(input ? input.value : tab.draft, rt?.staged) ? 'draft' : '';
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1584
1610
|
// ── Tray pills (shown for tabs with something in them while the panel is closed, or not the active tab) ──
|
|
1585
1611
|
function renderPills() {
|
|
1586
1612
|
const tray = document.getElementById('term-minimized-tray');
|
|
@@ -1591,6 +1617,7 @@ function renderPills() {
|
|
|
1591
1617
|
pill.className = 'term-minimized-pill agy-session-pill';
|
|
1592
1618
|
pill.dataset.tabId = tab.id;
|
|
1593
1619
|
pill.getAutomationRunId = () => tab.automationRunId;
|
|
1620
|
+
pill.keepFromAutoClose = () => autoCloseKeepOf(tab);
|
|
1594
1621
|
pill.tabIndex = 0;
|
|
1595
1622
|
pill.innerHTML = `<span class="term-minimized-pill-icon agy-mark">${ICON}</span><span class="term-minimized-pill-label"></span><button class="term-minimized-pill-close" data-tooltip="${esc(T('closeTab'))}" data-tooltip-pos="top">×</button>`;
|
|
1596
1623
|
const openIt = () => {
|
|
@@ -1622,6 +1649,7 @@ function renderPills() {
|
|
|
1622
1649
|
const needsYou = !!(tab.needsYou || tab.automationAwaits);
|
|
1623
1650
|
tab.pillEl.classList.toggle('agy-pill-attention', needsYou);
|
|
1624
1651
|
tab.pillEl.classList.toggle('agy-pill-running', !needsYou && !!tab.running);
|
|
1652
|
+
markAutoCloseKeep(tab.pillEl, autoCloseKeepOf(tab));
|
|
1625
1653
|
const meaningful = !!(tab.sessionId || tab.running || tab.draft || tab.automationRunId || tab.needsYou);
|
|
1626
1654
|
tab.pillEl.style.display = meaningful && (!_visible || tab !== activeTab()) ? '' : 'none';
|
|
1627
1655
|
}
|
|
@@ -53,6 +53,7 @@ function esc(value) {
|
|
|
53
53
|
* createAgentsDock(hostEl, hooks)
|
|
54
54
|
* hooks: { t, sessionId, onFocus(runId), onStop(runId), onRead(runId), onEscalate(runId, target),
|
|
55
55
|
* onStopAll() (the second press of "Stop all"; stopAllConfirmMs / stopAllMinGapMs time it),
|
|
56
|
+
* onSteer(runId, text) → truthy when sent, onSteerInComposer(runId, text), locale() (asst-steer.js),
|
|
56
57
|
* onRemove(runId), onClearFinished(runIds), onReveal(runId), onRunChange(run),
|
|
57
58
|
* open, showAll, onToggle(open), onShowAllChange(showAll),
|
|
58
59
|
* onCountChange({ total, active, attention, answer, idle, working, waiting, visible }) }
|
|
@@ -172,6 +173,9 @@ export function createAgentsDock(hostEl, hooks = {}) {
|
|
|
172
173
|
onRead: hooks.onRead,
|
|
173
174
|
onEscalate: hooks.onEscalate,
|
|
174
175
|
onRemove: typeof hooks.onRemove === 'function' ? hooks.onRemove : null,
|
|
176
|
+
onSteer: hooks.onSteer,
|
|
177
|
+
onSteerInComposer: hooks.onSteerInComposer,
|
|
178
|
+
locale: hooks.locale,
|
|
175
179
|
};
|
|
176
180
|
}
|
|
177
181
|
|
|
@@ -40,6 +40,73 @@ function jsonBody(data, method = 'POST') {
|
|
|
40
40
|
|
|
41
41
|
const enc = encodeURIComponent;
|
|
42
42
|
|
|
43
|
+
// ── A shell command's output (OpenCode brain) ─
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* One page of what a command of this conversation printed. Never throws and raises no guest toast: a page that
|
|
47
|
+
* cannot be read is the terminal block's to say. → { status, data: { output, cursor, size, from } } or { ok: false, status, error }.
|
|
48
|
+
*/
|
|
49
|
+
export async function readAssistantShellOutput(sessionId, { shellId, cursor, tail, limit } = {}) {
|
|
50
|
+
const query = new URLSearchParams();
|
|
51
|
+
if (Number.isSafeInteger(cursor) && cursor >= 0) query.set('cursor', String(cursor));
|
|
52
|
+
if (Number.isSafeInteger(tail) && tail > 0) query.set('tail', String(tail));
|
|
53
|
+
if (Number.isSafeInteger(limit) && limit > 0) query.set('limit', String(limit));
|
|
54
|
+
const search = query.toString();
|
|
55
|
+
let res;
|
|
56
|
+
try {
|
|
57
|
+
res = await fetch(`/api/assistant/sessions/${enc(sessionId)}/shells/${enc(shellId)}/output${search ? `?${search}` : ''}`, { credentials: 'same-origin' });
|
|
58
|
+
} catch (error) {
|
|
59
|
+
return { ok: false, error: error?.message || 'The output could not be read.' };
|
|
60
|
+
}
|
|
61
|
+
let body = null;
|
|
62
|
+
try { body = await res.json(); } catch { /* not JSON */ }
|
|
63
|
+
if (!res.ok || !body?.ok) return { ok: false, status: res.status, error: body?.error || `HTTP ${res.status}` };
|
|
64
|
+
const { ok: _ok, ...data } = body;
|
|
65
|
+
return { status: res.status, data };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ── Background tasks of a Claude brain (the Background tasks view) ─
|
|
69
|
+
|
|
70
|
+
/** The brain's background shells and watches, rebuilt from its transcript, and its live set. Never throws: null. */
|
|
71
|
+
export async function listAssistantBackgroundTasks(sessionId) {
|
|
72
|
+
try {
|
|
73
|
+
const res = await fetch(`/api/assistant/sessions/${enc(sessionId)}/background-tasks`, { credentials: 'same-origin' });
|
|
74
|
+
const body = await res.json().catch(() => null);
|
|
75
|
+
// A server from before this view has no such route (its 404 names no code): its output waits for a restart.
|
|
76
|
+
if (res.status === 404 && !body?.code) return { unsupported: true };
|
|
77
|
+
return res.ok && body?.ok ? body : null;
|
|
78
|
+
} catch { return null; }
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** One page of what a background task printed. → { status, data } or { ok: false, status, error }; never throws. */
|
|
82
|
+
export async function readAssistantBackgroundOutput(sessionId, { taskId, cursor, tail, limit } = {}) {
|
|
83
|
+
const query = new URLSearchParams();
|
|
84
|
+
if (Number.isSafeInteger(cursor) && cursor >= 0) query.set('cursor', String(cursor));
|
|
85
|
+
if (Number.isSafeInteger(tail) && tail > 0) query.set('tail', String(tail));
|
|
86
|
+
if (Number.isSafeInteger(limit) && limit > 0) query.set('limit', String(limit));
|
|
87
|
+
const search = query.toString();
|
|
88
|
+
let res;
|
|
89
|
+
try {
|
|
90
|
+
res = await fetch(`/api/assistant/sessions/${enc(sessionId)}/background-tasks/${enc(taskId)}/output${search ? `?${search}` : ''}`, { credentials: 'same-origin' });
|
|
91
|
+
} catch (error) {
|
|
92
|
+
return { ok: false, error: error?.message || 'The output could not be read.' };
|
|
93
|
+
}
|
|
94
|
+
let body = null;
|
|
95
|
+
try { body = await res.json(); } catch { /* not JSON */ }
|
|
96
|
+
if (!res.ok || !body?.ok) return { ok: false, status: res.status, error: body?.error || `HTTP ${res.status}` };
|
|
97
|
+
const { ok: _ok, ...data } = body;
|
|
98
|
+
return { status: res.status, data };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** The owner's Stop of one background task (the SDK's stopTask). → { ok, error }; never throws. */
|
|
102
|
+
export async function stopAssistantBackgroundTask(sessionId, taskId) {
|
|
103
|
+
try {
|
|
104
|
+
const res = await fetch(`/api/assistant/sessions/${enc(sessionId)}/background-tasks/${enc(taskId)}/stop`, { method: 'POST', credentials: 'same-origin', headers: { 'Content-Type': 'application/json', 'X-SynaBun-UI': '1' }, body: '{}' });
|
|
105
|
+
const body = await res.json().catch(() => null);
|
|
106
|
+
return res.ok && body?.ok ? { ok: true } : { ok: false, error: body?.error || `HTTP ${res.status}` };
|
|
107
|
+
} catch (error) { return { ok: false, error: error?.message || String(error) }; }
|
|
108
|
+
}
|
|
109
|
+
|
|
43
110
|
// ── Catalog ──────────────────────────────────
|
|
44
111
|
|
|
45
112
|
export function fetchAssistantCatalog({ force = false } = {}) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// ═══════════════════════════════════════════
|
|
2
2
|
// SynaBun Assistant — composer
|
|
3
3
|
// ═══════════════════════════════════════════
|
|
4
|
-
// Enter sends
|
|
4
|
+
// Enter sends (while a turn runs: steers it, Alt+Enter queues instead; a run
|
|
5
|
+
// targeted from its card is steered), Shift+Enter inserts a newline, Esc aborts the running turn (or
|
|
5
6
|
// closes the slash menu). Attachments: images (paste / file picker / drop),
|
|
6
7
|
// text files, memory chips (drag from the graph), and any other file — the
|
|
7
8
|
// picker and drop upload it to the server and the prompt carries its path
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
|
|
14
15
|
import { matchSlashCommands, SLASH_COMMANDS } from './asst-slash.js';
|
|
15
16
|
import { isLongPaste, typedText } from './asst-automation.js';
|
|
17
|
+
import { composerKeyIntent, steerTranslator, targetChipText } from './asst-state.js'; // steer's boot part (asst-steer.js loads on demand)
|
|
16
18
|
|
|
17
19
|
const TEXT_EXTENSIONS = new Set([
|
|
18
20
|
'txt', 'md', 'js', 'ts', 'jsx', 'tsx', 'json', 'html', 'css', 'scss', 'less', 'xml', 'svg',
|
|
@@ -121,15 +123,22 @@ export function createComposer(hostEl, hooks = {}) {
|
|
|
121
123
|
return params ? String(fallback).replace(/\{(\w+)\}/g, (_, k) => (params[k] != null ? params[k] : `{${k}}`)) : fallback;
|
|
122
124
|
};
|
|
123
125
|
|
|
126
|
+
// The steer sentences (asst-steer.js): the page's `assistant.steer.*`, else its own English / Portuguese.
|
|
127
|
+
const st8 = steerTranslator(hooks.t, typeof hooks.locale === 'function' ? hooks.locale() : hooks.locale);
|
|
124
128
|
const root = el('div', 'asst-composer');
|
|
125
129
|
root.innerHTML = `
|
|
126
130
|
<div class="asst-slash-menu" role="listbox" id="asst-slash-${Math.random().toString(36).slice(2, 8)}" aria-label="${esc(t('assistant.composer.commands', 'Commands'))}" hidden></div>
|
|
127
131
|
<div class="asst-composer-queue" hidden></div>
|
|
132
|
+
<div class="asst-composer-target" hidden></div>
|
|
128
133
|
<div class="asst-composer-attachments" hidden></div>
|
|
129
134
|
<textarea class="asst-input" rows="1" spellcheck="true" aria-label="${esc(t('assistant.composer.aria', 'Message the assistant'))}" aria-autocomplete="list"></textarea>
|
|
130
135
|
<div class="asst-composer-actions">
|
|
131
136
|
<button type="button" class="asst-tb-btn asst-attach" data-tooltip="${esc(t('assistant.composer.attach', 'Attach files'))}" aria-label="${esc(t('assistant.composer.attach', 'Attach files'))}">${ICON_ATTACH}</button>
|
|
132
137
|
<div class="asst-composer-brain"></div>
|
|
138
|
+
<span class="asst-steer-actions" role="group" aria-label="${esc(st8('steer'))}" hidden>
|
|
139
|
+
<button type="button" class="asst-tb-btn asst-queue-btn" data-tooltip="${esc(st8('queueTip'))}" aria-label="${esc(st8('queueTip'))}">${esc(st8('queue'))}</button>
|
|
140
|
+
<button type="button" class="asst-btn asst-steer-btn" data-tooltip="${esc(st8('steerNow'))}" aria-label="${esc(st8('steerNow'))}">${esc(st8('steer'))}</button>
|
|
141
|
+
</span>
|
|
133
142
|
<button type="button" class="asst-send" data-state="empty" aria-label="${esc(t('assistant.composer.send', 'Send'))}">${ICON_SEND}</button>
|
|
134
143
|
</div>
|
|
135
144
|
<input type="file" class="asst-file-input" multiple hidden tabindex="-1">
|
|
@@ -142,6 +151,10 @@ export function createComposer(hostEl, hooks = {}) {
|
|
|
142
151
|
const fileInput = root.querySelector('.asst-file-input');
|
|
143
152
|
const attachmentsEl = root.querySelector('.asst-composer-attachments');
|
|
144
153
|
const queueEl = root.querySelector('.asst-composer-queue');
|
|
154
|
+
const targetEl = root.querySelector('.asst-composer-target');
|
|
155
|
+
const steerActions = root.querySelector('.asst-steer-actions');
|
|
156
|
+
const queueBtn = root.querySelector('.asst-queue-btn');
|
|
157
|
+
const steerBtn = root.querySelector('.asst-steer-btn');
|
|
145
158
|
const slashMenu = root.querySelector('.asst-slash-menu');
|
|
146
159
|
textarea.setAttribute('aria-controls', slashMenu.id);
|
|
147
160
|
|
|
@@ -160,6 +173,10 @@ export function createComposer(hostEl, hooks = {}) {
|
|
|
160
173
|
// A composer under 300px says the short form, so the placeholder never wraps to three lines.
|
|
161
174
|
placeholderShort: t('assistant.composer.placeholderShort', 'Ask SynaBun…'),
|
|
162
175
|
narrow: false,
|
|
176
|
+
// The run the next message steers ({ runId, title, index }), set from its card; null: the Assistant.
|
|
177
|
+
target: null,
|
|
178
|
+
// The server can steer (an older one cannot: Enter while busy queues, as before).
|
|
179
|
+
steerable: hooks.steerable !== false,
|
|
163
180
|
};
|
|
164
181
|
const placeholderNow = () => (state.narrow ? state.placeholderShort : state.placeholder);
|
|
165
182
|
textarea.placeholder = placeholderNow();
|
|
@@ -199,6 +216,42 @@ export function createComposer(hostEl, hooks = {}) {
|
|
|
199
216
|
sendBtn.setAttribute('aria-label', label);
|
|
200
217
|
sendBtn.setAttribute('data-tooltip', label);
|
|
201
218
|
sendBtn.disabled = mode === 'empty';
|
|
219
|
+
// While a turn runs and there is something to send: Steer (Enter) and Queue (Alt+Enter) beside Stop.
|
|
220
|
+
// A targeted run while busy: Steer only (Queue is for the Assistant's own turn). Not busy with a target:
|
|
221
|
+
// the send button itself steers that run.
|
|
222
|
+
const ready = hasContent() && !state.disabled && !waiting;
|
|
223
|
+
steerActions.hidden = !(ready && state.running && (state.steerable || state.target));
|
|
224
|
+
queueBtn.hidden = !!state.target;
|
|
225
|
+
if (state.target && !state.running) {
|
|
226
|
+
const tip = st8('targetLabel', { title: state.target.title || state.target.runId });
|
|
227
|
+
sendBtn.setAttribute('aria-label', tip);
|
|
228
|
+
sendBtn.setAttribute('data-tooltip', tip);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function renderTarget() {
|
|
233
|
+
const target = state.target;
|
|
234
|
+
if (!target) {
|
|
235
|
+
targetEl.hidden = true;
|
|
236
|
+
targetEl.innerHTML = '';
|
|
237
|
+
if (!state.disabled) textarea.placeholder = placeholderNow();
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const label = st8('targetLabel', { title: target.title || target.runId });
|
|
241
|
+
targetEl.innerHTML = `<span class="asst-chip static asst-steer-target" data-run-id="${esc(target.runId)}" aria-label="${esc(label)}"><span class="asst-chip-text">${esc(targetChipText(target, st8))}</span><button type="button" class="asst-chip-x" aria-label="${esc(st8('targetClear'))}" data-tooltip="${esc(st8('targetClear'))}">${ICON_X}</button></span>`;
|
|
242
|
+
targetEl.hidden = false;
|
|
243
|
+
if (!state.disabled) textarea.placeholder = st8('targetPlaceholder', { title: target.title || target.runId });
|
|
244
|
+
}
|
|
245
|
+
targetEl.addEventListener('click', (e) => {
|
|
246
|
+
if (!e.target.closest('.asst-chip-x')) return;
|
|
247
|
+
setSteerTarget(null);
|
|
248
|
+
textarea.focus();
|
|
249
|
+
});
|
|
250
|
+
function setSteerTarget(target) {
|
|
251
|
+
state.target = target && target.runId ? { runId: String(target.runId), title: String(target.title || ''), index: target.index ?? null } : null;
|
|
252
|
+
renderTarget();
|
|
253
|
+
updateSendButton();
|
|
254
|
+
hooks.onTargetChange?.(state.target ? { ...state.target } : null);
|
|
202
255
|
}
|
|
203
256
|
|
|
204
257
|
function renderAttachments() {
|
|
@@ -316,7 +369,7 @@ export function createComposer(hostEl, hooks = {}) {
|
|
|
316
369
|
});
|
|
317
370
|
|
|
318
371
|
// ── Submit ──
|
|
319
|
-
async function submit() {
|
|
372
|
+
async function submit(mode = null) {
|
|
320
373
|
if (state.disabled) return;
|
|
321
374
|
if (uploading()) { hooks.onToast?.(t('assistant.composer.waitUploads', 'Wait for the upload to finish, then send')); return; }
|
|
322
375
|
const text = textarea.value.trim();
|
|
@@ -331,20 +384,30 @@ export function createComposer(hostEl, hooks = {}) {
|
|
|
331
384
|
uploads: state.uploads.map(({ name, size, mime, path }) => ({ name, size, mime, path })),
|
|
332
385
|
memories: state.memories.slice(),
|
|
333
386
|
};
|
|
387
|
+
// 'steer' / 'queue' only when the user chose one (Enter or Alt+Enter while busy, the buttons); a target always steers.
|
|
388
|
+
if (state.target) { payload.mode = 'steer'; payload.steerTarget = { ...state.target }; }
|
|
389
|
+
else if (mode === 'steer' || mode === 'queue') payload.mode = mode;
|
|
390
|
+
// What this send took, by reference: the send is awaited, and the user may type or attach the next message meanwhile.
|
|
391
|
+
const took = { images: state.images.slice(), files: state.files.slice(), uploads: state.uploads.slice(), memories: state.memories.slice(), pastes: state.pastes.slice() };
|
|
334
392
|
let outcome;
|
|
335
393
|
try { outcome = await hooks.onSubmit?.(payload); } catch { outcome = false; }
|
|
336
394
|
if (outcome === false) return;
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
state.
|
|
342
|
-
state.
|
|
395
|
+
// Clear only what went: words typed and attachments added while the send was on its way stay for the next one.
|
|
396
|
+
const textWent = textarea.value.trim() === text;
|
|
397
|
+
if (textWent) textarea.value = '';
|
|
398
|
+
const keep = (list, sent) => list.filter((item) => !sent.includes(item));
|
|
399
|
+
state.images = keep(state.images, took.images);
|
|
400
|
+
state.files = keep(state.files, took.files);
|
|
401
|
+
state.uploads = keep(state.uploads, took.uploads);
|
|
402
|
+
state.memories = keep(state.memories, took.memories);
|
|
403
|
+
state.pastes = textWent ? [] : keep(state.pastes, took.pastes);
|
|
343
404
|
renderAttachments();
|
|
344
|
-
closeSlash();
|
|
405
|
+
if (textWent) closeSlash();
|
|
345
406
|
autoResize();
|
|
346
407
|
updateSendButton();
|
|
347
|
-
hooks.onDraftChange?.('');
|
|
408
|
+
hooks.onDraftChange?.(textWent ? '' : textarea.value);
|
|
409
|
+
// One steer per target: the next message goes to the Assistant again unless a card sets it once more.
|
|
410
|
+
if (outcome === 'steered' && state.target) setSteerTarget(null);
|
|
348
411
|
if (outcome === 'queued') hooks.onToast?.(t('assistant.composer.queued', 'Queued — will send when the current turn finishes'));
|
|
349
412
|
}
|
|
350
413
|
|
|
@@ -352,6 +415,9 @@ export function createComposer(hostEl, hooks = {}) {
|
|
|
352
415
|
if (state.running) { hooks.onAbort?.(); return; }
|
|
353
416
|
submit();
|
|
354
417
|
});
|
|
418
|
+
// Focus stays in (and returns to) the composer after either choice.
|
|
419
|
+
steerBtn.addEventListener('click', () => { Promise.resolve(submit('steer')).finally(() => textarea.focus()); });
|
|
420
|
+
queueBtn.addEventListener('click', () => { Promise.resolve(submit('queue')).finally(() => textarea.focus()); });
|
|
355
421
|
|
|
356
422
|
textarea.addEventListener('keydown', (e) => {
|
|
357
423
|
if (state.slashOpen) {
|
|
@@ -366,9 +432,11 @@ export function createComposer(hostEl, hooks = {}) {
|
|
|
366
432
|
}
|
|
367
433
|
if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); closeSlash(); return; }
|
|
368
434
|
}
|
|
369
|
-
|
|
435
|
+
// Enter: send, or Steer while a turn runs (or a run is targeted); Alt+Enter while busy: Queue (asst-steer.js).
|
|
436
|
+
const intent = composerKeyIntent(e, { running: state.running, targeted: !!state.target, steerable: state.steerable });
|
|
437
|
+
if (intent) {
|
|
370
438
|
e.preventDefault();
|
|
371
|
-
submit();
|
|
439
|
+
submit(intent === 'send' ? null : intent);
|
|
372
440
|
return;
|
|
373
441
|
}
|
|
374
442
|
if (e.key === 'Escape') {
|
|
@@ -643,6 +711,11 @@ export function createComposer(hostEl, hooks = {}) {
|
|
|
643
711
|
clearAttachments() { abortUploads(); state.images = []; state.files = []; state.uploads = []; state.memories = []; renderAttachments(); },
|
|
644
712
|
setQueue,
|
|
645
713
|
hasContent,
|
|
714
|
+
/** The run the next message steers ({ runId, title, index }), or null for the Assistant. */
|
|
715
|
+
setSteerTarget,
|
|
716
|
+
getSteerTarget: () => (state.target ? { ...state.target } : null),
|
|
717
|
+
/** Whether the server can steer: without it Enter while busy queues, as before. */
|
|
718
|
+
setSteerable(value) { state.steerable = value !== false; updateSendButton(); },
|
|
646
719
|
destroy() { abortUploads(); closeSlash(); resizeObserver?.disconnect(); root.remove(); },
|
|
647
720
|
};
|
|
648
721
|
}
|