synabun 2.4.4 → 2.4.6
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 +42 -0
- package/README.md +1 -1
- package/docs/browser-extension-bridge.md +5 -4
- package/docs/whatsapp.md +19 -3
- package/hooks/claude-code/session-start.mjs +21 -18
- package/lib/claude-global-config.js +214 -0
- package/lib/client-config-repair.js +17 -3
- package/mcp-server/dist/index.d.ts.map +1 -1
- package/mcp-server/dist/index.js +6 -1
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/services/neural-interface.d.ts +1 -0
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +1 -0
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/services/tool-catalog.js +1 -1
- package/mcp-server/dist/services/tool-catalog.js.map +1 -1
- package/mcp-server/dist/tools/agents.d.ts +18 -3
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +85 -16
- package/mcp-server/dist/tools/agents.js.map +1 -1
- package/mcp-server/dist/tools/skill-tools.d.ts +24 -5
- package/mcp-server/dist/tools/skill-tools.d.ts.map +1 -1
- package/mcp-server/dist/tools/skill-tools.js +88 -8
- package/mcp-server/dist/tools/skill-tools.js.map +1 -1
- package/mcp-server/dist/tools/tool-groups.d.ts.map +1 -1
- package/mcp-server/dist/tools/tool-groups.js +19 -4
- package/mcp-server/dist/tools/tool-groups.js.map +1 -1
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/index.ts +6 -1
- package/mcp-server/src/services/neural-interface.ts +2 -1
- package/mcp-server/src/services/tool-catalog.ts +1 -1
- package/mcp-server/src/tools/agents.ts +78 -16
- package/mcp-server/src/tools/skill-tools.ts +82 -9
- package/mcp-server/src/tools/tool-groups.ts +19 -4
- package/neural-interface/i18n/en.json +484 -19
- package/neural-interface/i18n/pt-BR.json +484 -19
- package/neural-interface/lib/agents-studio-api.js +7 -2
- package/neural-interface/lib/antigravity/home.js +43 -8
- package/neural-interface/lib/antigravity/panel-bridge.js +7 -3
- package/neural-interface/lib/antigravity/tool-call.js +14 -0
- package/neural-interface/lib/assistant-brains/antigravity.js +4 -2
- package/neural-interface/lib/assistant-dispatch.js +15 -1
- package/neural-interface/lib/assistant-persona.js +8 -3
- package/neural-interface/lib/assistant-route-gate.js +11 -2
- package/neural-interface/lib/assistant-runtime.js +95 -13
- package/neural-interface/lib/assistant-spilled-output.js +53 -0
- package/neural-interface/lib/assistant-user-context.js +7 -3
- package/neural-interface/lib/browser-default.js +22 -2
- package/neural-interface/lib/browser-extension-bridge.js +50 -3
- package/neural-interface/lib/browser-extension-pin.json +7 -7
- package/neural-interface/lib/browser-extension-protocol.js +30 -1
- package/neural-interface/lib/browser-extension-setup.js +204 -36
- package/neural-interface/lib/claude-agent-bridge.js +13 -2
- package/neural-interface/lib/codex-thread-history.js +144 -7
- package/neural-interface/lib/codex-worker-app-server.js +84 -30
- package/neural-interface/lib/db.js +26 -0
- package/neural-interface/lib/greeting/sources.js +7 -3
- package/neural-interface/lib/jsonl-lines.js +10 -11
- package/neural-interface/lib/line-buffer.js +88 -0
- package/neural-interface/lib/loop-stall.js +15 -1
- package/neural-interface/lib/memory-list-read.js +105 -0
- package/neural-interface/lib/memory-timers.js +4 -1
- package/neural-interface/lib/native-loop-runtime.js +7 -3
- package/neural-interface/lib/provider-panel-api-key-auth.js +33 -6
- package/neural-interface/lib/remote-policy.js +24 -7
- package/neural-interface/lib/skills/api-v2.js +18 -3
- package/neural-interface/lib/skills/bundle.js +2 -2
- package/neural-interface/lib/skills/deploy.js +169 -34
- package/neural-interface/lib/skills/digest.js +57 -3
- package/neural-interface/lib/skills/health.js +55 -1
- package/neural-interface/lib/skills/known-bridge-digests.json +12 -0
- package/neural-interface/lib/skills/runtime-checks.js +7 -4
- package/neural-interface/lib/skills/scan-shell.js +56 -7
- package/neural-interface/lib/skills/scan.js +13 -12
- package/neural-interface/lib/skills/service.js +7 -2
- package/neural-interface/lib/skills/telemetry.js +2 -2
- package/neural-interface/lib/teams/README.md +34 -6
- package/neural-interface/lib/teams/api.js +94 -10
- package/neural-interface/lib/teams/index.js +4 -0
- package/neural-interface/lib/teams/landing.js +195 -75
- package/neural-interface/lib/teams/recovery.js +68 -0
- package/neural-interface/lib/teams/scheduler.js +380 -61
- package/neural-interface/lib/teams/worktrees.js +123 -30
- package/neural-interface/lib/terminal-token-redaction.js +228 -58
- package/neural-interface/lib/terminal-tokens.js +18 -0
- package/neural-interface/lib/whatsapp/brain.js +21 -0
- package/neural-interface/lib/whatsapp/bridge.js +40 -4
- package/neural-interface/package-lock.json +2 -2
- package/neural-interface/package.json +1 -1
- package/neural-interface/public/extension-setup.html +6 -2
- package/neural-interface/public/index.html +117 -37
- package/neural-interface/public/shared/agents/studio/ax-api.js +27 -0
- package/neural-interface/public/shared/agents/studio/ax-create-view.js +1 -1
- package/neural-interface/public/shared/agents/studio/ax-icons.js +1 -0
- package/neural-interface/public/shared/agents/studio/ax-library-view.js +3 -2
- package/neural-interface/public/shared/agents/studio/ax-main.js +127 -41
- package/neural-interface/public/shared/agents/studio/ax-review-view.js +3 -2
- package/neural-interface/public/shared/agents/studio/ax-teams-view.js +436 -33
- package/neural-interface/public/shared/agents/studio/ax-teams.js +357 -10
- package/neural-interface/public/shared/agents/studio/ax-ui.js +31 -0
- package/neural-interface/public/shared/agents/studio/ax-views.js +67 -69
- package/neural-interface/public/shared/agents/studio/ax-work-answer.js +86 -0
- package/neural-interface/public/shared/agents/studio/ax-work-view.js +305 -0
- package/neural-interface/public/shared/agents/studio/ax-work.css +74 -0
- package/neural-interface/public/shared/agents/studio/ax-work.js +300 -0
- package/neural-interface/public/shared/browser-extension-updates.js +3 -1
- package/neural-interface/public/shared/cdx/cdx-deferred.js +90 -0
- package/neural-interface/public/shared/cdx/cdx-render.js +18 -7
- package/neural-interface/public/shared/cdx/cdx-tabs.js +2 -1
- package/neural-interface/public/shared/extension-setup/es-page.js +23 -4
- package/neural-interface/public/shared/extension-setup/es-view.js +51 -11
- package/neural-interface/public/shared/extension-update-view.js +1 -1
- package/neural-interface/public/shared/loading-diagnostic-entry.js +16 -1
- package/neural-interface/public/shared/settings/settings-ai-browser.js +23 -3
- package/neural-interface/public/shared/settings/settings-browser-extension.js +575 -197
- package/neural-interface/public/shared/settings/settings-extension-diagrams.js +116 -0
- package/neural-interface/public/shared/settings/settings-extension-guide.js +222 -0
- package/neural-interface/public/shared/settings/settings-ia.js +2 -2
- package/neural-interface/public/shared/settings/settings-shell.js +5 -0
- package/neural-interface/public/shared/skills/studio/sx-operations-view.js +5 -0
- package/neural-interface/public/shared/skills/studio/sx-plan.js +42 -3
- package/neural-interface/public/shared/skills/studio/sx-publish-view.js +20 -4
- package/neural-interface/public/shared/styles.css +196 -13
- package/neural-interface/public/shared/ui-settings.js +48 -11
- package/neural-interface/server.js +336 -253
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -1
- package/skills/skill-forge/SKILL.md +7 -3
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// Studio's sibling and behaves as it does (it carries that window's classes, so its chrome, its docking, its
|
|
7
7
|
// resizing and its narrow layouts are the same rules of styles.css): non-modal unless the owner dims the
|
|
8
8
|
// background, dockable beside the side panels, opened where it was left at the size it had, with a rail of places
|
|
9
|
-
// (
|
|
9
|
+
// (Work · Agents) and, from a place, one agent with its tabs (Edit · Revisions · Runs · Test
|
|
10
10
|
// run). One view machine (ax-views.js) and one render switch; every place listens on the one main area and ends
|
|
11
11
|
// its listeners when another is drawn.
|
|
12
12
|
//
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
import { t, tp, getLocale } from '../../i18n.js';
|
|
23
23
|
import { storage } from '../../storage.js';
|
|
24
|
-
import { emit } from '../../state.js';
|
|
24
|
+
import { emit, on } from '../../state.js';
|
|
25
25
|
import { isGuest, showGuestToast } from '../../ui-sync.js';
|
|
26
26
|
import { KEYS } from '../../constants.js';
|
|
27
27
|
import { createUnloadGuard } from '../../editor/editor-safety.js';
|
|
@@ -31,11 +31,11 @@ import { frameRect } from '../../app-frame.js';
|
|
|
31
31
|
import { initialRect, openRect } from '../../skills/studio/sx-geometry.js';
|
|
32
32
|
import { html, setHTML, ICONS, inTextField, focusableIn, trapIndex } from '../../skills/studio/sx-dom.js';
|
|
33
33
|
import { createAgentsApi } from './ax-api.js';
|
|
34
|
-
import { parseOpen, initialView, viewToSave, navigate, railModel, agentKeyText, capsFailure, PLACES } from './ax-views.js';
|
|
35
|
-
import { cleanFilters, countAgents
|
|
36
|
-
import {
|
|
34
|
+
import { parseOpen, initialView, viewToSave, navigate, railModel, runDestination, agentKeyText, capsFailure, PLACES } from './ax-views.js';
|
|
35
|
+
import { cleanFilters, countAgents } from './ax-library.js';
|
|
36
|
+
import { renderWork, newWorkState, leaveWork, stopWork, onWorkChanged, loadWork, workNeedsYou } from './ax-work-view.js';
|
|
37
37
|
import { AX_ICONS } from './ax-icons.js';
|
|
38
|
-
import { errorText, emptyHTML } from './ax-ui.js';
|
|
38
|
+
import { errorText, emptyHTML, loadingHTML, shellText } from './ax-ui.js';
|
|
39
39
|
import { renderLibrary, leaveLibrary } from './ax-library-view.js';
|
|
40
40
|
import { renderReview, leaveReview, forgetReview } from './ax-review-view.js';
|
|
41
41
|
import { renderCreate, leaveCreate, newCreateState } from './ax-create-view.js';
|
|
@@ -49,7 +49,7 @@ const RAIL_KEY = 'agents-studio-rail-collapsed';
|
|
|
49
49
|
const VIEW_KEY = 'agents-studio-view';
|
|
50
50
|
const FILTERS_KEY = 'agents-studio-filters';
|
|
51
51
|
const MAC = /Mac|iPhone|iPad/.test(globalThis.navigator?.platform || '');
|
|
52
|
-
const RAIL_ICONS = {
|
|
52
|
+
const RAIL_ICONS = { work: AX_ICONS.work, agents: AX_ICONS.mark };
|
|
53
53
|
|
|
54
54
|
// ── State ──
|
|
55
55
|
|
|
@@ -58,12 +58,13 @@ const S = {
|
|
|
58
58
|
caps: null, info: null, capsFailed: false,
|
|
59
59
|
agents: [], counts: countAgents([]), loading: null, loadError: null, loaded: false,
|
|
60
60
|
view: initialView(null), filters: cleanFilters(null),
|
|
61
|
-
ed: null, create: newCreateState(), teams: newTeamsState(),
|
|
61
|
+
ed: null, create: newCreateState(), teams: newTeamsState(), work: newWorkState(),
|
|
62
62
|
sources: newSources(),
|
|
63
63
|
docked: false, dim: false, changeTimer: 0, awaitingDraft: false, reading: null, readWanted: false,
|
|
64
64
|
};
|
|
65
65
|
let _capsPromise = null;
|
|
66
66
|
const api = createAgentsApi();
|
|
67
|
+
const runsOnlyApi = { ...api, teams: async () => ({ available: false, teams: [] }), team: async () => ({ available: false, team: null }) };
|
|
67
68
|
|
|
68
69
|
function newSources() {
|
|
69
70
|
return { models: null, modelsState: 'idle', accounts: {}, toolCatalog: null, toolsState: 'idle', profiles: [], profilesState: 'idle', skills: [], skillsState: 'idle', categories: [], categoriesState: 'idle', efforts: null };
|
|
@@ -183,6 +184,7 @@ export async function openStudio(detail = {}) {
|
|
|
183
184
|
S.view = initialView(readJson(VIEW_KEY, null));
|
|
184
185
|
S.create = newCreateState();
|
|
185
186
|
S.teams = newTeamsState();
|
|
187
|
+
S.work = newWorkState();
|
|
186
188
|
S.sources = newSources();
|
|
187
189
|
S.ed = null;
|
|
188
190
|
if (want.explicit) S.view = navigate(S.view, { type: 'open', want });
|
|
@@ -208,23 +210,25 @@ export async function openStudio(detail = {}) {
|
|
|
208
210
|
S.unload = createUnloadGuard({ target: window, isDirty: () => editorDirty(S.ed) });
|
|
209
211
|
S.unload.install();
|
|
210
212
|
const gen = S.gen;
|
|
213
|
+
const library = loadData().catch(() => {});
|
|
211
214
|
enterView();
|
|
212
215
|
render();
|
|
213
216
|
requestAnimationFrame(() => { S.backdrop?.classList.add('open'); S.panel?.classList.add('open'); });
|
|
214
217
|
panel.focus({ preventScroll: true });
|
|
215
218
|
emit('agents:window', { open: true });
|
|
216
219
|
try {
|
|
217
|
-
await
|
|
218
|
-
|
|
220
|
+
await capabilities();
|
|
221
|
+
if (gen !== S.gen || !S.panel) return;
|
|
222
|
+
enterView();
|
|
223
|
+
render({ keepFocus: true });
|
|
224
|
+
} catch { /* the shell shows the capability error */ }
|
|
225
|
+
await library;
|
|
219
226
|
if (gen !== S.gen || !S.panel) return;
|
|
220
|
-
// The editor's lists are asked for only from a server that answered: one that refused this caller, or has no
|
|
221
|
-
// Agents routes, is asked for nothing more.
|
|
222
|
-
if (S.caps) loadSources();
|
|
223
227
|
// The agent the window was left on may be gone: the Library then.
|
|
224
228
|
if (S.view.place === 'agent' && S.loaded && !S.agents.some((a) => agentKeyText(a) === agentKeyText(S.view.agent))) { dropEditor(); S.view = navigate(S.view, { type: 'place', place: 'library' }); }
|
|
225
229
|
enterView();
|
|
226
230
|
render({ keepFocus: true });
|
|
227
|
-
focusPlace();
|
|
231
|
+
if (document.activeElement === panel) focusPlace();
|
|
228
232
|
}
|
|
229
233
|
|
|
230
234
|
function placeWindow(floating = null) {
|
|
@@ -276,6 +280,7 @@ export function closeStudio() {
|
|
|
276
280
|
closeDialog();
|
|
277
281
|
leavePlaces();
|
|
278
282
|
stopTeams();
|
|
283
|
+
stopWork();
|
|
279
284
|
dropEditor();
|
|
280
285
|
forgetReview();
|
|
281
286
|
S.life?.abort();
|
|
@@ -304,7 +309,7 @@ function dropEditor() {
|
|
|
304
309
|
}
|
|
305
310
|
|
|
306
311
|
function leavePlaces() {
|
|
307
|
-
leaveLibrary(); leaveReview(); leaveCreate(); leaveTeams(); leaveAgent();
|
|
312
|
+
leaveLibrary(); leaveReview(); leaveCreate(); leaveTeams(); leaveWork(); leaveAgent();
|
|
308
313
|
}
|
|
309
314
|
|
|
310
315
|
// ── The shell ──
|
|
@@ -336,15 +341,24 @@ function wireShell() {
|
|
|
336
341
|
// The header and the rail (the places listen on the main area themselves).
|
|
337
342
|
S.panel.addEventListener('click', (e) => {
|
|
338
343
|
const el = e.target.closest?.('[data-act]');
|
|
339
|
-
if (!el || !S.panel.contains(el) || el.disabled
|
|
344
|
+
if (!el || !S.panel.contains(el) || el.disabled) return;
|
|
340
345
|
const act = el.dataset.act;
|
|
346
|
+
if (el.closest('#ax-main') && act !== 'agents-section') return;
|
|
347
|
+
if (act === 'agents-section') { go({ type: 'place', place: el.dataset.place }); return; }
|
|
341
348
|
if (act === 'close') requestCloseStudio();
|
|
342
349
|
else if (act === 'dock') toggleDock();
|
|
343
350
|
else if (act === 'dim') toggleDim();
|
|
344
351
|
else if (act === 'toggle-rail') toggleRail();
|
|
345
|
-
else if (act === 'place') go({ type: 'place', place: el.dataset.place })
|
|
346
|
-
else if (act === '
|
|
352
|
+
else if (act === 'place') go({ type: 'place', place: el.dataset.place });
|
|
353
|
+
else if (act === 'work-group') {
|
|
354
|
+
const heading = S.panel.querySelector('#ax-work-h-' + el.dataset.group);
|
|
355
|
+
if (heading) { heading.tabIndex = -1; heading.focus({ preventScroll: true }); heading.scrollIntoView({ block: 'nearest' }); }
|
|
356
|
+
}
|
|
347
357
|
}, { signal });
|
|
358
|
+
for (const name of ['dispatch', 'run-removed', 'permission-request', 'permission-resolved']) {
|
|
359
|
+
const off = on('sync:assistant:' + name, () => { if (S.caps) onWorkChanged(ctx(), S.work); });
|
|
360
|
+
signal.addEventListener('abort', off, { once: true });
|
|
361
|
+
}
|
|
348
362
|
// Keys only while the focus is in the Studio: the window is not modal, and the page beside it keeps its own.
|
|
349
363
|
document.addEventListener('keydown', onKeydown, { signal });
|
|
350
364
|
window.addEventListener('resize', () => { if (!S.docked) placeWithinViewport(); }, { signal });
|
|
@@ -433,6 +447,20 @@ function toggleRail() {
|
|
|
433
447
|
|
|
434
448
|
/** What the view needs before it is drawn (the editor's state of the agent it names). */
|
|
435
449
|
function enterView() {
|
|
450
|
+
if (S.caps) {
|
|
451
|
+
const cap = { review: 'reviews', create: 'drafts' }[S.view.place];
|
|
452
|
+
if (cap && !S.caps.has(cap)) S.view = navigate(S.view, { type: 'place', place: 'agents' });
|
|
453
|
+
if (S.view.place === 'teams' && !S.caps.has('teams')) S.view = navigate(S.view, { type: 'place', place: 'work' });
|
|
454
|
+
if (S.view.place === 'create' || S.view.place === 'agent') loadSources();
|
|
455
|
+
if (!S.work.model && !S.work.loading) {
|
|
456
|
+
const gen = S.gen;
|
|
457
|
+
loadWork(ctx(), S.work).then(() => {
|
|
458
|
+
if (gen !== S.gen || !S.panel) return;
|
|
459
|
+
if (S.view.place === 'work') render({ keepFocus: true });
|
|
460
|
+
else refreshRail();
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
}
|
|
436
464
|
const v = S.view;
|
|
437
465
|
if (v.place === 'agent' && v.agent) {
|
|
438
466
|
if (!S.ed || S.ed.mode !== 'agent' || agentKeyText(S.ed.key) !== agentKeyText(v.agent)) {
|
|
@@ -454,22 +482,41 @@ function enterView() {
|
|
|
454
482
|
*/
|
|
455
483
|
async function go(action, { force = false } = {}) {
|
|
456
484
|
if (!S.panel) return false;
|
|
485
|
+
if (action.type === 'run') {
|
|
486
|
+
if (action.agent && S.loading) {
|
|
487
|
+
const origin = S.view;
|
|
488
|
+
const opener = S.work.returnTo;
|
|
489
|
+
await S.loading.catch(() => {});
|
|
490
|
+
if (!S.panel || origin !== S.view) return false;
|
|
491
|
+
S.work.returnTo = opener;
|
|
492
|
+
}
|
|
493
|
+
action = runDestination(action, S.loaded && !S.loadError ? S.agents : null, S.caps);
|
|
494
|
+
if (action.type === 'focus-run') {
|
|
495
|
+
S.work.returnTo = null;
|
|
496
|
+
await focusRun(action.runId);
|
|
497
|
+
return false;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
457
500
|
const next = navigate(S.view, action);
|
|
458
501
|
if (next === S.view) return false;
|
|
459
502
|
const leavesEditor = S.ed && !(next.place === 'agent' && S.ed.mode === 'agent' && agentKeyText(next.agent) === agentKeyText(S.ed.key));
|
|
460
503
|
if (leavesEditor && !force && !(await mayLeaveEditor())) return false;
|
|
461
504
|
if (!S.panel) return false;
|
|
462
505
|
if (leavesEditor) dropEditor();
|
|
506
|
+
if (action.type === 'place' || action.type === 'open') S.work.returnTo = null;
|
|
507
|
+
const restoreRow = next.place === 'work' && S.work.returnTo;
|
|
463
508
|
S.view = next;
|
|
464
509
|
storage.setItem(VIEW_KEY, JSON.stringify(viewToSave(S.view)));
|
|
465
510
|
enterView();
|
|
466
511
|
render();
|
|
467
|
-
focusPlace();
|
|
512
|
+
if (!restoreRow) focusPlace();
|
|
468
513
|
return true;
|
|
469
514
|
}
|
|
470
515
|
|
|
471
516
|
function focusPlace() {
|
|
517
|
+
const view = S.view;
|
|
472
518
|
requestAnimationFrame(() => {
|
|
519
|
+
if (S.view !== view) return;
|
|
473
520
|
const target = S.panel?.querySelector('#ax-main [data-autofocus]') || S.panel?.querySelector('#ax-main h3, #ax-main h2');
|
|
474
521
|
if (!target) return;
|
|
475
522
|
if (!target.hasAttribute('tabindex') && !/^(INPUT|TEXTAREA|BUTTON)$/.test(target.tagName)) target.tabIndex = -1;
|
|
@@ -480,16 +527,23 @@ function focusPlace() {
|
|
|
480
527
|
// ── Rendering ──
|
|
481
528
|
|
|
482
529
|
function railHTML() {
|
|
483
|
-
const items = railModel(S.view, {
|
|
484
|
-
const
|
|
530
|
+
const items = railModel(S.view, { needsYou: workNeedsYou(S.work), review: S.counts.review }, S.caps);
|
|
531
|
+
const groups = S.view.place === 'work' && S.work.model?.groups;
|
|
532
|
+
const groupKeys = { 'needs-you': 'needsYou', active: 'active', 'in-review': 'inReview', finished: 'finished' };
|
|
485
533
|
return html`
|
|
486
|
-
<ul class="sx-rail-list">${items.map(
|
|
487
|
-
<span class="sx-rail-icon">${RAIL_ICONS[item.place]}</span><span class="sx-rail-label">${t
|
|
488
|
-
|
|
489
|
-
<
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
534
|
+
<ul class="sx-rail-list">${items.map(item => html`<li><button type="button" id="ax-rail-${item.place}" class="sx-rail-item" data-act="place" data-place="${item.place}"${item.current ? html` aria-current="page"` : ''} title="${shellText(t, `agentsStudio.rail.${item.place}`)}">
|
|
535
|
+
<span class="sx-rail-icon">${RAIL_ICONS[item.place]}</span><span class="sx-rail-label">${shellText(t, `agentsStudio.rail.${item.place}`)}</span>${item.count ? html`<span class="sx-rail-count${item.place === 'agents' ? ' ax-rail-count--review' : ' sx-warn-text'}">${item.count}<span class="sx-sr"> ${shellText(t, item.place === 'agents' ? 'agentsStudio.rail.waiting' : 'agentsStudio.work.needsYou')}</span></span>` : ''}</button></li>`)}</ul>
|
|
536
|
+
${groups ? html`<div class="sx-rail-groups"><p class="sx-rail-group-label" id="ax-rail-status">${shellText(t, 'agentsStudio.rail.taskStatus')}</p>
|
|
537
|
+
<ul class="sx-rail-list" aria-labelledby="ax-rail-status">${groups.map(g => html`<li><button type="button" id="ax-rail-${g.id}" class="sx-rail-view" data-act="work-group" data-group="${g.id}">
|
|
538
|
+
<span class="sx-rail-label">${t(`agentsStudio.work.${groupKeys[g.id]}`)}</span><span class="sx-rail-count">${g.tasks.length}</span></button></li>`)}</ul></div>` : ''}`;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
function refreshRail() {
|
|
542
|
+
const rail = S.panel?.querySelector('#ax-rail');
|
|
543
|
+
if (!rail) return;
|
|
544
|
+
const active = rail.contains(document.activeElement) && document.activeElement.id;
|
|
545
|
+
setHTML(rail, railHTML());
|
|
546
|
+
if (active) document.getElementById(active)?.focus({ preventScroll: true });
|
|
493
547
|
}
|
|
494
548
|
|
|
495
549
|
function headNote() {
|
|
@@ -500,6 +554,31 @@ function headNote() {
|
|
|
500
554
|
else setHTML(note, '');
|
|
501
555
|
}
|
|
502
556
|
|
|
557
|
+
function renderWorkPlace(main, c) {
|
|
558
|
+
if (!S.caps) { setHTML(main, loadingHTML(t, shellText(t, 'agentsStudio.work.loading'))); return; }
|
|
559
|
+
const st = S.work;
|
|
560
|
+
const manageId = 'ax-manage-teams';
|
|
561
|
+
const returningTo = st.returnTo;
|
|
562
|
+
renderWork(main, c, st);
|
|
563
|
+
const finished = main.querySelector('#ax-work-finished');
|
|
564
|
+
if (!finished || !st.teams?.length || st.offline) return;
|
|
565
|
+
|
|
566
|
+
// The existing management screen keeps batch cleanup and team shortcuts under Finished.
|
|
567
|
+
const button = document.createElement('button');
|
|
568
|
+
button.type = 'button';
|
|
569
|
+
button.id = manageId;
|
|
570
|
+
button.className = 'sx-btn sx-btn--sm';
|
|
571
|
+
button.textContent = shellText(t, 'agentsStudio.teams.manage');
|
|
572
|
+
button.addEventListener('click', () => {
|
|
573
|
+
st.scrollTop = finished.closest('.ax-work-scroll').scrollTop;
|
|
574
|
+
st.returnTo = manageId;
|
|
575
|
+
go({ type: 'manage-teams' });
|
|
576
|
+
});
|
|
577
|
+
finished.append(button);
|
|
578
|
+
if (returningTo) finished.closest('.ax-work-scroll').scrollTop = st.scrollTop;
|
|
579
|
+
if (returningTo === manageId) button.focus({ preventScroll: true });
|
|
580
|
+
}
|
|
581
|
+
|
|
503
582
|
/** Draw the current place (keeping where the keyboard was when asked). */
|
|
504
583
|
export function render({ keepFocus = false } = {}) {
|
|
505
584
|
if (!S.panel) return;
|
|
@@ -509,7 +588,7 @@ export function render({ keepFocus = false } = {}) {
|
|
|
509
588
|
const scroller = keepFocus ? S.panel.querySelector('#ax-main .ax-form, #ax-main .sx-place-scroll, #ax-main .sx-versions') : null;
|
|
510
589
|
const scrolled = scroller ? { selector: scroller.classList.contains('ax-form') ? '.ax-form' : scroller.classList.contains('sx-versions') ? '.sx-versions' : '.sx-place-scroll', top: scroller.scrollTop } : null;
|
|
511
590
|
const caret = activeId && typeof active.selectionStart === 'number' ? [active.selectionStart, active.selectionEnd] : null;
|
|
512
|
-
|
|
591
|
+
refreshRail();
|
|
513
592
|
headNote();
|
|
514
593
|
const main = S.panel.querySelector('#ax-main');
|
|
515
594
|
const c = ctx();
|
|
@@ -518,10 +597,12 @@ export function render({ keepFocus = false } = {}) {
|
|
|
518
597
|
leavePlaces();
|
|
519
598
|
if (S.capsFailed && !S.caps) { renderOlderServer(main); return; }
|
|
520
599
|
const v = S.view;
|
|
521
|
-
if (v.place === '
|
|
600
|
+
if (v.place === 'work') renderWorkPlace(main, c);
|
|
601
|
+
else if (v.place === 'agent' && S.ed) renderAgent(main, c, S.ed);
|
|
522
602
|
else if (v.place === 'create' && S.ed?.mode === 'new') renderAgent(main, c, S.ed);
|
|
523
603
|
else if (v.place === 'create') renderCreate(main, c, S.create);
|
|
524
604
|
else if (v.place === 'review') renderReview(main, c);
|
|
605
|
+
else if (v.place === 'teams' && !S.caps) setHTML(main, loadingHTML(t));
|
|
525
606
|
else if (v.place === 'teams') renderTeams(main, c, S.teams);
|
|
526
607
|
else renderLibrary(main, c);
|
|
527
608
|
if (scrolled) { const again = main.querySelector(scrolled.selector); if (again) again.scrollTop = scrolled.top; }
|
|
@@ -549,7 +630,7 @@ function renderOlderServer(main) {
|
|
|
549
630
|
main.dataset.failure = why;
|
|
550
631
|
setHTML(main, emptyHTML({ ...words, actions: html`<button type="button" class="sx-btn" id="ax-retry-caps">${t('agentsStudio.state.retry')}</button>` }));
|
|
551
632
|
main.querySelector('#ax-retry-caps')?.addEventListener('click', async () => {
|
|
552
|
-
try { await loadData();
|
|
633
|
+
try { await loadData(); } catch { /* still not there */ }
|
|
553
634
|
enterView();
|
|
554
635
|
render();
|
|
555
636
|
});
|
|
@@ -581,12 +662,13 @@ export function onAgentsChanged(msg = {}) {
|
|
|
581
662
|
if (gen !== S.gen || S.ed !== ed) return;
|
|
582
663
|
// What this window just wrote comes back as an event too: nothing new, nothing drawn again.
|
|
583
664
|
if (was !== `${ed.etag}|${ed.agent?.status}|${ed.agent?.draft?.status}|${ed.agent?.approvedRevision}` || ed.error) render({ keepFocus: true });
|
|
584
|
-
else
|
|
585
|
-
} else
|
|
665
|
+
else refreshRail();
|
|
666
|
+
} else refreshRail();
|
|
586
667
|
return;
|
|
587
668
|
}
|
|
588
|
-
if (S.view.place === 'create') {
|
|
589
|
-
|
|
669
|
+
if (S.view.place === 'create') { refreshRail(); if (S.create.describe.sent && !S.ed) render({ keepFocus: true }); return; }
|
|
670
|
+
if (S.view.place === 'work' || S.view.place === 'teams') refreshRail();
|
|
671
|
+
else render({ keepFocus: true });
|
|
590
672
|
}, 300);
|
|
591
673
|
}
|
|
592
674
|
|
|
@@ -607,14 +689,17 @@ function readAgain() {
|
|
|
607
689
|
S.reading = null;
|
|
608
690
|
if (gen !== S.gen || !S.panel) return;
|
|
609
691
|
if (S.view.place === 'library' || S.view.place === 'review') render({ keepFocus: true });
|
|
610
|
-
else
|
|
692
|
+
else refreshRail();
|
|
611
693
|
})();
|
|
612
694
|
}
|
|
613
695
|
|
|
614
696
|
/** A team changed (`assistant:team-changed` { teamId }). */
|
|
615
697
|
export function onTeamChanged(msg = {}) {
|
|
616
|
-
if (!S.panel) return;
|
|
617
|
-
|
|
698
|
+
if (!S.panel || !S.caps?.has('teams')) return;
|
|
699
|
+
const teamId = msg.teamId || msg.event?.teamId;
|
|
700
|
+
onWorkChanged(ctx(), S.work, { type: 'assistant:team-changed', teamId });
|
|
701
|
+
if (S.view.place === 'teams') teamChanged(ctx(), S.teams, teamId);
|
|
702
|
+
else { S.teams.rows = null; S.teams.detailFor = null; }
|
|
618
703
|
}
|
|
619
704
|
|
|
620
705
|
// ── Messages ──
|
|
@@ -652,7 +737,7 @@ async function focusRun(runId) {
|
|
|
652
737
|
function ctx() {
|
|
653
738
|
const guest = isGuest();
|
|
654
739
|
return {
|
|
655
|
-
t, tp, locale: getLocale(), mac: MAC, api, storage, emit,
|
|
740
|
+
t, tp, locale: getLocale(), mac: MAC, api: S.caps && !S.caps.has('teams') ? runsOnlyApi : api, storage, emit,
|
|
656
741
|
get caps() { return S.caps || new Set(); },
|
|
657
742
|
// Whether the server has said what it can do: until then nothing is said to be missing from it.
|
|
658
743
|
get capsKnown() { return !!S.caps; },
|
|
@@ -671,14 +756,15 @@ function ctx() {
|
|
|
671
756
|
get awaitingDraft() { return S.awaitingDraft; },
|
|
672
757
|
gen: () => S.gen,
|
|
673
758
|
alive: (gen) => gen === S.gen && !!S.panel,
|
|
674
|
-
render, go, toast, announce, ask, focusRun,
|
|
759
|
+
render, go, toast, announce, ask, focusRun, refreshWorkBadge: refreshRail,
|
|
760
|
+
refreshWork: () => onWorkChanged(ctx(), S.work, { type: 'assistant:team-changed' }),
|
|
675
761
|
saveFilters,
|
|
676
762
|
/** Read the library again; `quiet` leaves the place as it is drawn (the caller draws). */
|
|
677
763
|
reload: async ({ quiet = false } = {}) => {
|
|
678
764
|
const gen = S.gen;
|
|
679
765
|
try { await loadData(); } catch (error) { if (gen === S.gen && !quiet) toast(t('agentsStudio.toast.loadFailed', { error: errorText(t, error) }), 'error'); }
|
|
680
766
|
if (gen !== S.gen || !S.panel) return;
|
|
681
|
-
if (!quiet) render({ keepFocus: true }); else
|
|
767
|
+
if (!quiet) render({ keepFocus: true }); else refreshRail();
|
|
682
768
|
},
|
|
683
769
|
/** Something this window wrote: the list and the rail follow (the server's event arrives too). */
|
|
684
770
|
changed: () => { forgetReview(); readAgain(); },
|
|
@@ -13,7 +13,7 @@ import { html, setHTML, ICONS } from '../../skills/studio/sx-dom.js';
|
|
|
13
13
|
import { reviewQueue } from './ax-library.js';
|
|
14
14
|
import { keyOf, agentKeyText } from './ax-views.js';
|
|
15
15
|
import { AX_ICONS } from './ax-icons.js';
|
|
16
|
-
import { agentMark, scopeTag, timeTag, authorText, loadingHTML, errorHTML, emptyHTML, errorText, diffHTML, wordsOf } from './ax-ui.js';
|
|
16
|
+
import { agentMark, scopeTag, timeTag, authorText, loadingHTML, errorHTML, emptyHTML, errorText, diffHTML, wordsOf, agentSections } from './ax-ui.js';
|
|
17
17
|
import { confirmApproval } from './ax-agent-view.js';
|
|
18
18
|
|
|
19
19
|
let life = null;
|
|
@@ -88,9 +88,10 @@ export function renderReview(main, ctx) {
|
|
|
88
88
|
: html`<ul class="sx-cards ax-review-cards" aria-label="${t('agentsStudio.rail.review')}">${queue.map((agent) => cardHTML(ctx, agent))}</ul>`;
|
|
89
89
|
setHTML(main, html`<section class="sx-place ax-place" aria-labelledby="ax-review-title">
|
|
90
90
|
<header class="sx-place-head">
|
|
91
|
-
<h3 class="sx-place-title" id="ax-review-title" tabindex="-1" data-autofocus>${t('agentsStudio.rail.
|
|
91
|
+
<h3 class="sx-place-title" id="ax-review-title" tabindex="-1" data-autofocus>${t('agentsStudio.rail.agents')}</h3>
|
|
92
92
|
<p class="sx-place-sub">${queue.length ? ctx.tp('agentsStudio.review.waiting', queue.length) : t('agentsStudio.review.sub')}</p>
|
|
93
93
|
</header>
|
|
94
|
+
${agentSections(ctx)}
|
|
94
95
|
${ctx.awaitingDraft ? html`<div class="sx-place-notices"><div class="sx-notice sx-notice--info">${AX_ICONS.send}<span class="sx-notice-text">${t('agentsStudio.review.awaiting')}</span></div></div>` : ''}
|
|
95
96
|
<div class="sx-place-scroll" id="ax-review-list">${body}</div>
|
|
96
97
|
</section>`);
|