Changeset 0.28.3.2 (#189)

This commit is contained in:
2026-03-14 16:46:16 +00:00
parent 205a770c74
commit fa6b04434a
66 changed files with 304 additions and 320 deletions

View File

@@ -8,6 +8,7 @@ const vm = require('vm');
*/
function loadExtensions(overrides = {}) {
const sandbox = createBrowserContext(overrides);
loadSource(sandbox, 'sb.js');
loadSource(sandbox, 'events.js');
loadSource(sandbox, 'extensions.js');
const ctx = vm.createContext(sandbox);

View File

@@ -11,6 +11,7 @@ const vm = require('vm');
*/
function loadExtensions(overrides = {}) {
const sandbox = createBrowserContext(overrides);
loadSource(sandbox, 'sb.js');
loadSource(sandbox, 'events.js');
loadSource(sandbox, 'extensions.js');
// Extract const globals from the vm context

View File

@@ -116,6 +116,7 @@ function loadSource(sandbox, filename) {
*/
function loadAppModules(overrides = {}) {
const sandbox = createBrowserContext(overrides);
loadSource(sandbox, 'sb.js');
loadSource(sandbox, 'app-state.js');
loadSource(sandbox, 'api.js');
loadSource(sandbox, 'app.js');

View File

@@ -4,8 +4,6 @@
// Admin actions: user management, roles, model visibility,
// personas, team management, global providers.
(function() {
'use strict';
// ── Admin Actions ────────────────────────────
@@ -918,4 +916,3 @@ sb.register('toggleUserRole', toggleUserRole);
sb.register('updateTeamMember', updateTeamMember);
sb.register('_closeExtEditForm', _closeExtEditForm);
sb.register('saveAdminExtension', saveAdminExtension);
})();

View File

@@ -5,8 +5,6 @@
// and calls the appropriate ADMIN_LOADERS[section]() from ui-admin.js.
// Loaded only on the admin surface (/admin/:section).
(function() {
'use strict';
// Each admin section loader (ui-admin.js) expects specific container
// elements. SCAFFOLDING maps section name -> HTML to inject before
@@ -386,4 +384,3 @@
ADMIN_LOADERS[section]();
}
});
})();

View File

@@ -6,8 +6,6 @@
//
// Exports: window._loadAdminSurfaces
(function() {
'use strict';
async function _loadAdminSurfaces() {
const container = document.getElementById('adminSurfacesContent');
@@ -199,4 +197,3 @@ async function _loadSurfaceList() {
// ── Exports ─────────────────────────────────
sb.register('_loadAdminSurfaces', _loadAdminSurfaces);
})();

View File

@@ -11,8 +11,6 @@
// Exports: window.API
// ==========================================
(function() {
'use strict';
const BASE = window.__BASE__ || '';
const _storageKey = BASE ? `sb_auth_${BASE.replace(/\//g, '')}` : 'sb_auth';
@@ -994,4 +992,3 @@ const API = {
};
sb.ns('API', API);
})();

View File

@@ -8,8 +8,6 @@
// Exports: window.App, window.fetchModels
// ==========================================
(function() {
'use strict';
const App = {
chats: [],
@@ -139,4 +137,3 @@ async function fetchModels() {
sb.ns('App', App);
sb.register('fetchModels', fetchModels);
})();

View File

@@ -10,8 +10,6 @@
// Exports: handleLogin, handleRegister, handleLogout, switchAuthTab,
// startApp, initBanners
(function() {
'use strict';
async function init() {
console.log('🔀 Chat Switchboard initializing...');
@@ -588,4 +586,3 @@ sb.register('handleLogout', handleLogout);
sb.register('switchAuthTab', switchAuthTab);
sb.register('startApp', startApp);
sb.register('initBanners', initBanners);
})();

View File

@@ -9,8 +9,6 @@
//
// Exports: window.ChannelModels
(function() {
'use strict';
const ChannelModels = {
@@ -437,4 +435,3 @@ function _shortName(fullName) {
// ── Exports ─────────────────────────────────
sb.ns('ChannelModels', ChannelModels);
})();

View File

@@ -7,8 +7,6 @@
//
// Exports: window.ChatPane
(function() {
'use strict';
const ChatPane = {
...createComponentRegistry('ChatPane'),
@@ -153,4 +151,3 @@ const ChatPane = {
// ── Exports ─────────────────────────────────
sb.ns('ChatPane', ChatPane);
})();

View File

@@ -11,8 +11,6 @@
// rejectWorkflowStage, _initChatListeners,
// summarizeAndContinue, toggleChannelAutoCompact
(function() {
'use strict';
// ── Chat Input Abstraction ──────────────────
// Wraps CM6 editor (when available) or fallback textarea.
@@ -1279,4 +1277,3 @@ sb.register('rejectWorkflowStage', rejectWorkflowStage);
sb.register('_initChatListeners', _initChatListeners);
sb.register('summarizeAndContinue', summarizeAndContinue);
sb.register('toggleChannelAutoCompact', toggleChannelAutoCompact);
})();

View File

@@ -20,8 +20,6 @@
//
// Exports: window.CodeEditor
(function() {
'use strict';
const CodeEditor = {
...createComponentRegistry('CodeEditor'),
@@ -332,4 +330,3 @@ function _ceDetectLanguage(path) {
// ── Exports ─────────────────────────────────
sb.ns('CodeEditor', CodeEditor);
})();

View File

@@ -10,8 +10,6 @@
//
// Exports: window.DebugLog,window.openDebugModal,window.switchDebugTab,window.clearDebugLog,window.copyDebugLog,window.exportDebugLog,window.runDebugDiagnostics,window.purgeCache
(function() {
'use strict';
const DebugLog = {
entries: [],
@@ -676,4 +674,3 @@ sb.register('copyDebugLog', copyDebugLog);
sb.register('exportDebugLog', exportDebugLog);
sb.register('runDebugDiagnostics', runDebugDiagnostics);
sb.register('purgeCache', purgeCache);
})();

View File

@@ -21,8 +21,6 @@
//
// Exports: window.initDragResize
(function() {
'use strict';
/**
* Attach drag-resize behavior to a handle element.
@@ -100,4 +98,3 @@ function _clientPos(e, isHoriz) {
// ── Exports ─────────────────────────────────
sb.register('initDragResize', initDragResize);
})();

View File

@@ -7,8 +7,6 @@
// (hidden) — this JS moves them into the right pane slots.
// ==========================================
(function() {
'use strict';
document.addEventListener('DOMContentLoaded', () => {
if (window.__SURFACE__ !== 'editor') return;
@@ -641,4 +639,3 @@
}
}
})();

View File

@@ -13,8 +13,6 @@
// Exports: window.Events
// ==========================================
(function() {
'use strict';
const Events = {
@@ -332,4 +330,3 @@ const Events = {
};
sb.ns('Events', Events);
})();

View File

@@ -17,8 +17,6 @@
//
// Exports: window.Extensions
(function() {
'use strict';
const Extensions = {
@@ -489,4 +487,3 @@ const Extensions = {
// ── Exports ─────────────────────────────────
sb.ns('Extensions', Extensions);
})();

View File

@@ -19,8 +19,6 @@
//
// Exports: window.FileTree
(function() {
'use strict';
const FileTree = {
...createComponentRegistry('FileTree'),
@@ -269,4 +267,3 @@ function _ftFileIcon(name) {
// ── Exports ─────────────────────────────────
sb.ns('FileTree', FileTree);
})();

View File

@@ -9,8 +9,6 @@
// Consumed by: chat.js (send flow), ui-core.js (message rendering),
// ui-admin.js (storage tab)
(function() {
'use strict';
// ── Constants ───────────────────────────────
@@ -857,4 +855,3 @@ sb.register('renderMessageFiles', renderMessageFiles);
sb.register('unstageFile', unstageFile);
sb.register('openLightbox', openLightbox);
sb.register('downloadFile', downloadFile);
})();

View File

@@ -10,7 +10,6 @@
//
// Depends on: API (api.js), App (app.js)
'use strict';
const KnowledgeUI = (() => {
console.debug('[KnowledgeUI] module loaded');
@@ -553,3 +552,5 @@ const KnowledgeUI = (() => {
openChannelPopup,
};
})();
sb.ns('KnowledgeUI', KnowledgeUI);

View File

@@ -7,8 +7,6 @@
//
// Exports: window.MemoryUI
(function() {
'use strict';
const MemoryUI = {
@@ -370,4 +368,3 @@ function _debounce(fn, ms) {
// ── Exports ─────────────────────────────────
sb.ns('MemoryUI', MemoryUI);
})();

View File

@@ -14,8 +14,6 @@
//
// Exports: window.ModelSelector
(function() {
'use strict';
const ModelSelector = {
...createComponentRegistry('ModelSelector'),
@@ -175,4 +173,3 @@ const ModelSelector = {
// ── Exports ─────────────────────────────────
sb.ns('ModelSelector', ModelSelector);
})();

View File

@@ -21,8 +21,6 @@
//
// Exports: window.NoteEditor
(function() {
'use strict';
const NoteEditor = {
...createComponentRegistry('NoteEditor'),
@@ -441,4 +439,3 @@ const NoteEditor = {
// ── Exports ─────────────────────────────────
sb.ns('NoteEditor', NoteEditor);
})();

View File

@@ -8,8 +8,6 @@
//
// Exports: window.openNoteGraph,window.closeNoteGraph,window._render,window._graphResetZoom,window._graphToggleOrphans,window.invalidateNoteGraph
(function() {
'use strict';
var _graphData = null; // cached { nodes, edges, unresolved }
var _graphState = null; // { panX, panY, zoom, animId, canvas, ctx }
@@ -501,4 +499,3 @@ sb.register('_render', _render);
sb.register('_graphResetZoom', _graphResetZoom);
sb.register('_graphToggleOrphans', _graphToggleOrphans);
sb.register('invalidateNoteGraph', invalidateNoteGraph);
})();

View File

@@ -3,8 +3,6 @@
// ==========================================
// Notes panel: editor, multi-select, folders, CRUD.
(function() {
'use strict';
var _editingNoteId = null;
var _notesSelectMode = false;
@@ -973,4 +971,3 @@ sb.register('_navigateToLinkedNote', _navigateToLinkedNote);
sb.register('toggleBacklinks', toggleBacklinks);
sb.register('_toggleNoteSelectCb', _toggleNoteSelectCb);
sb.register('_noteItemClick', _noteItemClick);
})();

View File

@@ -7,8 +7,6 @@
//
// Exports: window.NotifPrefs
(function() {
'use strict';
const NotifPrefs = {
_loaded: false,
_prefs: [],
@@ -169,4 +167,3 @@ NotifPrefs._getAdminSmtp = function() {
// ── Exports ─────────────────────────────────
sb.ns('NotifPrefs', NotifPrefs);
})();

View File

@@ -9,8 +9,6 @@
//
// Exports: window.Notifications
(function() {
'use strict';
const Notifications = {
@@ -431,4 +429,3 @@ function _timeAgo(isoStr) {
// ── Exports ─────────────────────────────────
sb.ns('Notifications', Notifications);
})();

View File

@@ -3,8 +3,6 @@
// ==========================================
// v0.22.7: Splash init, login, register, animated grid.
(function() {
'use strict';
var base = window.__BASE__ || '';
Pages.initSplash = function() {
@@ -186,4 +184,3 @@
function _val(id) { var el = document.getElementById(id); return el ? el.value.trim() : ''; }
function _showErr(el, msg) { if (!el) return; el.textContent = msg; el.style.display = ''; }
})();

View File

@@ -13,8 +13,6 @@
// Exports: window.Pages, window._val (used by pages-splash.js)
// ==========================================
(function() {
'use strict';
const Pages = {
@@ -349,4 +347,3 @@ async function _api(method, path, body) {
// ── Exports ─────────────────────────────────
sb.ns('Pages', Pages);
sb.register('_val', _val); // used by pages-splash.js
})();

View File

@@ -21,8 +21,6 @@
//
// Exports: window.PaneContainer
(function() {
'use strict';
const PaneContainer = {
_presets: {},
@@ -589,4 +587,3 @@ PaneContainer.registerPreset('split', {
// ── Exports ─────────────────────────────────
sb.ns('PaneContainer', PaneContainer);
})();

View File

@@ -17,8 +17,6 @@
//
// Exports: window.PanelRegistry,window.toggleSidePanelFullscreen,window._initWorkspaceResize,window._initPanelSwipe,window._initPanelResponsive,window._initPanelOverlay
(function() {
'use strict';
// ── Panel Registry ──────────────────────────
@@ -454,4 +452,3 @@ sb.register('_initWorkspaceResize', _initWorkspaceResize);
sb.register('_initPanelSwipe', _initPanelSwipe);
sb.register('_initPanelResponsive', _initPanelResponsive);
sb.register('_initPanelOverlay', _initPanelOverlay);
})();

View File

@@ -6,10 +6,6 @@
//
// Exports: window.renderPersonaKBPicker,window.loadPersonaKBs,window.savePersonaKBs
(function() {
'use strict';
'use strict';
// ── Persona-KB Picker ───────────────────────────
@@ -185,4 +181,3 @@ async function savePersonaKBs(personaId, kbPicker, apiPrefix) {
sb.register('renderPersonaKBPicker', renderPersonaKBPicker);
sb.register('loadPersonaKBs', loadPersonaKBs);
sb.register('savePersonaKBs', savePersonaKBs);
})();

View File

@@ -6,8 +6,6 @@
// and drag-and-drop.
// ==========================================
(function() {
'use strict';
async function loadProjects() {
try {
@@ -1871,9 +1869,9 @@ async function deleteFolder(folderId) {
const INTERVAL = 30000; // 30s
let timer = null;
async function beat() {
if (!API.isAuthed) return;
if (!window.API || !window.API.isAuthed) return;
try {
await API.presenceHeartbeat();
await window.API.presenceHeartbeat();
} catch (_) { /* non-critical */ }
}
function start() {
@@ -2090,4 +2088,3 @@ sb.register('renameFolder', renameFolder);
sb.register('_showAddParticipantSearch', _showAddParticipantSearch);
sb.register('_addParticipant', _addParticipant);
sb.register('_removeParticipant', _removeParticipant);
})();

View File

@@ -18,8 +18,6 @@
//
// Exports: window.REPL
(function() {
'use strict';
const REPL = {
@@ -557,4 +555,3 @@ const REPL = {
// ── Exports ─────────────────────────────────
sb.ns('REPL', REPL);
})();

View File

@@ -34,8 +34,9 @@ const sb = {
/**
* Register a standalone action function.
* Also sets window[name] for backward compatibility with cross-file
* direct calls. This side-effect is removed when files convert to
* ES module imports (Phase 4).
* direct calls. Template onclick handlers are fully migrated to sb.call()
* (Phase 3b). This side-effect is removed in Phase 4 when files convert
* to ES module imports.
*/
register(name, fn) {
if (typeof fn !== 'function') {
@@ -49,7 +50,8 @@ const sb = {
/**
* Register a namespace object (API, UI, App, etc.).
* Methods are accessible via dot notation: sb.resolve('UI.toast').
* Also sets window[name] for backward compatibility.
* Also sets window[name] for backward compatibility with cross-file
* direct calls (e.g. API.listProjects()). Removed in Phase 4.
*/
ns(name, obj) {
if (obj == null || typeof obj !== 'object') {

View File

@@ -4,8 +4,6 @@
// Settings save, provider CRUD, avatar, command palette,
// user model roles.
(function() {
'use strict';
// ── Settings ─────────────────────────────────
@@ -908,4 +906,3 @@ sb.register('toggleCmdPalette', toggleCmdPalette);
sb.register('closeCmdPalette', closeCmdPalette);
sb.register('_initSettingsListeners', _initSettingsListeners);
sb.register('_initAdminSettingsToggles', _initAdminSettingsToggles);
})();

View File

@@ -4,8 +4,6 @@
// Admin section for managing scheduled tasks, run history, and global
// task configuration. Registered as ADMIN_LOADERS.tasks in ui-admin.js.
(function() {
'use strict';
var SCAFFOLD_HTML =
'<div id="taskAdminTabs" style="display:flex;gap:8px;margin-bottom:16px">' +
@@ -252,4 +250,3 @@
await loadTasks();
});
})();

View File

@@ -5,8 +5,6 @@
// persona/model picker, budget config, and starter templates.
// Loaded on the settings surface.
(function() {
'use strict';
const PRESETS = [
{ label: 'Every morning (6am)', cron: '0 6 * * *' },
@@ -278,4 +276,3 @@
sb.register('_loadSettingsTasks', function() {
loadTaskList();
});
})();

View File

@@ -4,8 +4,6 @@
// Sidebar section showing user's scheduled tasks with status indicators.
// Click opens the task's output channel. Same pattern as WorkflowQueue.
(function() {
'use strict';
const TaskSidebar = {
@@ -141,4 +139,3 @@
}
}, 2200); // After WorkflowQueue (2000ms)
});
})();

View File

@@ -5,8 +5,6 @@
//
// Exports: window.Tokens,window.updateInputTokens,window.updateContextWarning
(function() {
'use strict';
// ── Token Estimation + Context Tracking ─────
@@ -167,4 +165,3 @@ function dismissContextWarning() {
sb.ns('Tokens', Tokens);
sb.register('updateInputTokens', updateInputTokens);
sb.register('updateContextWarning', updateContextWarning);
})();

View File

@@ -3,7 +3,6 @@
// Categories expand to show individual tool toggles.
// State persisted in localStorage, sent as disabled_tools[] in completion requests.
'use strict';
const ToolsToggle = (() => {
const STORAGE_KEY = 'cs-disabled-tools';
@@ -242,3 +241,5 @@ const ToolsToggle = (() => {
return { init, getDisabledTools, refresh };
})();
sb.ns('ToolsToggle', ToolsToggle);

View File

@@ -4,8 +4,6 @@
// Fullscreen admin panel with category + section navigation.
// All loadAdmin*() functions unchanged — same endpoints, same DOM IDs.
(function() {
'use strict';
// ── Category → Section mapping ────────────
const ADMIN_SECTIONS = {
@@ -1573,4 +1571,3 @@ Object.assign(UI, {
sb.ns('ADMIN_SECTIONS', ADMIN_SECTIONS);
sb.ns('ADMIN_LABELS', ADMIN_LABELS);
sb.ns('ADMIN_LOADERS', ADMIN_LOADERS);
})();

View File

@@ -10,8 +10,6 @@
// window.toggleSummarizedHistory (onclick handler)
// ==========================================
(function() {
'use strict';
// ── Delegated Action Dispatcher ────────────────────
// Buttons use data-action="fnName" data-args='[...]' instead of onclick.
@@ -1651,4 +1649,3 @@ sb.register('_uiDispatch', _uiDispatch);
sb.register('_toggleArchivedProjects', _toggleArchivedProjects);
sb.register('_submitEditFromDOM', _submitEditFromDOM);
sb.register('toggleSummarizedHistory', toggleSummarizedHistory);
})();

View File

@@ -11,8 +11,6 @@
// popOutExtBlock (onclick handlers)
// ==========================================
(function() {
'use strict';
// ── Message Formatting ──────────────────────
@@ -610,4 +608,3 @@ sb.register('downloadCode', downloadCode);
sb.register('popOutExtBlock', popOutExtBlock);
sb.register('_copyCodeBlock', _copyCodeBlock);
sb.register('_openNoteFromTool', _openNoteFromTool);
})();

View File

@@ -11,8 +11,6 @@
// openModal, closeModal, checkTabsOverflow, Theme, mountAvatarUpload
// ─────────────────────────────────────────────────────────────────────────────
(function() {
'use strict';
// ══════════════════════════════════════════════════════════════════════════════
// §0 CORE UTILITIES
@@ -1133,4 +1131,3 @@ sb.register('closeModal', closeModal);
sb.register('checkTabsOverflow', checkTabsOverflow);
sb.ns('Theme', Theme);
sb.register('mountAvatarUpload', mountAvatarUpload);
})();

View File

@@ -6,8 +6,6 @@
//
// Exports: none (extends window.UI via Object.assign)
(function() {
'use strict';
Object.assign(UI, {
// ── General Settings (Settings Surface) ──
@@ -867,4 +865,3 @@ Object.assign(UI, {
});
})();

View File

@@ -13,8 +13,6 @@
//
// Exports: window.UserMenu
(function() {
'use strict';
const UserMenu = {
...createComponentRegistry('UserMenu'),
@@ -139,4 +137,3 @@ const UserMenu = {
// ── Exports ─────────────────────────────────
sb.ns('UserMenu', UserMenu);
})();

View File

@@ -4,8 +4,6 @@
// Admin panel for managing workflow definitions, stages, and publishing.
// Registered as ADMIN_LOADERS.workflows in ui-admin.js.
(function() {
'use strict';
// ── Scaffold HTML ────────────────────────
// Injected directly into adminDynamic by the loader since SCAFFOLDING
@@ -470,4 +468,3 @@
}
});
})();

View File

@@ -5,10 +5,6 @@
// publishing, instance lifecycle, and assignment queue operations.
// Loaded after api.js on the chat and admin surfaces.
(function() {
'use strict';
if (typeof API === 'undefined') return;
// ── Workflow Definitions ────────────────
API.listWorkflows = function(teamId) {
@@ -99,4 +95,3 @@
API.completeAssignment = function(id) {
return this._post(`/api/v1/workflow-assignments/${id}/complete`, {});
};
})();

View File

@@ -6,8 +6,6 @@
// 2. Claimed assignments from team queues
// Loaded on the chat surface after workflow-api.js.
(function() {
'use strict';
const WorkflowQueue = {
@@ -198,4 +196,3 @@
}, 2000);
});
})();