synabun 1.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 +665 -0
- package/LICENSE +191 -0
- package/README.md +853 -0
- package/hooks/claude-code/post-plan.mjs +391 -0
- package/hooks/claude-code/post-remember.mjs +239 -0
- package/hooks/claude-code/pre-compact.mjs +241 -0
- package/hooks/claude-code/pre-websearch.mjs +90 -0
- package/hooks/claude-code/prompt-submit.mjs +861 -0
- package/hooks/claude-code/session-start.mjs +494 -0
- package/hooks/claude-code/shared.mjs +368 -0
- package/hooks/claude-code/stop.mjs +646 -0
- package/hooks/claude-code/test-user-learning.mjs +531 -0
- package/mcp-server/package.json +38 -0
- package/mcp-server/run.mjs +10 -0
- package/mcp-server/src/config.ts +70 -0
- package/mcp-server/src/http.ts +93 -0
- package/mcp-server/src/index.ts +203 -0
- package/mcp-server/src/preload-http.ts +25 -0
- package/mcp-server/src/preload.ts +29 -0
- package/mcp-server/src/scripts/migrate-qdrant-to-sqlite.ts +506 -0
- package/mcp-server/src/services/categories.ts +429 -0
- package/mcp-server/src/services/discord.ts +702 -0
- package/mcp-server/src/services/file-checksums.ts +33 -0
- package/mcp-server/src/services/local-embeddings.ts +77 -0
- package/mcp-server/src/services/neural-interface.ts +344 -0
- package/mcp-server/src/services/sqlite.ts +823 -0
- package/mcp-server/src/tools/browser-advanced.ts +123 -0
- package/mcp-server/src/tools/browser-interact.ts +255 -0
- package/mcp-server/src/tools/browser-navigate.ts +77 -0
- package/mcp-server/src/tools/browser-observe.ts +1330 -0
- package/mcp-server/src/tools/browser.ts +107 -0
- package/mcp-server/src/tools/card-tools.ts +193 -0
- package/mcp-server/src/tools/card.ts +22 -0
- package/mcp-server/src/tools/category.ts +379 -0
- package/mcp-server/src/tools/discord-channel.ts +274 -0
- package/mcp-server/src/tools/discord-guild.ts +188 -0
- package/mcp-server/src/tools/discord-member.ts +158 -0
- package/mcp-server/src/tools/discord-message.ts +231 -0
- package/mcp-server/src/tools/discord-onboarding.ts +228 -0
- package/mcp-server/src/tools/discord-role.ts +209 -0
- package/mcp-server/src/tools/discord-thread.ts +110 -0
- package/mcp-server/src/tools/discord-webhook.ts +176 -0
- package/mcp-server/src/tools/discord.ts +40 -0
- package/mcp-server/src/tools/forget.ts +38 -0
- package/mcp-server/src/tools/git-tools.ts +141 -0
- package/mcp-server/src/tools/git.ts +13 -0
- package/mcp-server/src/tools/image-tools.ts +98 -0
- package/mcp-server/src/tools/image.ts +17 -0
- package/mcp-server/src/tools/leonardo-browser-tools.ts +281 -0
- package/mcp-server/src/tools/leonardo.ts +28 -0
- package/mcp-server/src/tools/loop.ts +348 -0
- package/mcp-server/src/tools/memories.ts +118 -0
- package/mcp-server/src/tools/recall.ts +323 -0
- package/mcp-server/src/tools/reflect.ts +145 -0
- package/mcp-server/src/tools/remember.ts +115 -0
- package/mcp-server/src/tools/response.ts +26 -0
- package/mcp-server/src/tools/restore.ts +34 -0
- package/mcp-server/src/tools/sync.ts +114 -0
- package/mcp-server/src/tools/tictactoe-tools.ts +98 -0
- package/mcp-server/src/tools/tictactoe.ts +13 -0
- package/mcp-server/src/tools/utils.ts +25 -0
- package/mcp-server/src/tools/whiteboard-tools.ts +260 -0
- package/mcp-server/src/tools/whiteboard.ts +22 -0
- package/mcp-server/src/tui.ts +940 -0
- package/mcp-server/src/types.ts +85 -0
- package/mcp-server/tsconfig.json +19 -0
- package/neural-interface/package.json +27 -0
- package/neural-interface/public/apple-touch-icon.png +0 -0
- package/neural-interface/public/category-logos/claude.svg +1 -0
- package/neural-interface/public/category-logos/gemini-color.svg +1 -0
- package/neural-interface/public/category-logos/openai.svg +1 -0
- package/neural-interface/public/category-logos/synabun.png +0 -0
- package/neural-interface/public/claude-chat.css +878 -0
- package/neural-interface/public/claude-chat.html +92 -0
- package/neural-interface/public/claude-chat.js +1168 -0
- package/neural-interface/public/favicon-16x16.png +0 -0
- package/neural-interface/public/favicon-32x32.png +0 -0
- package/neural-interface/public/gallery.svg +6 -0
- package/neural-interface/public/icon-192.png +0 -0
- package/neural-interface/public/icon-512.png +0 -0
- package/neural-interface/public/index-legacy.html +14677 -0
- package/neural-interface/public/index.html +212 -0
- package/neural-interface/public/index2d-legacy.html +8193 -0
- package/neural-interface/public/index2d.html +127 -0
- package/neural-interface/public/invite.html +351 -0
- package/neural-interface/public/leonardoai.svg +1 -0
- package/neural-interface/public/logo-synabun.png +0 -0
- package/neural-interface/public/logoHD.png +0 -0
- package/neural-interface/public/manifest.json +14 -0
- package/neural-interface/public/offline.html +299 -0
- package/neural-interface/public/onboarding.html +2335 -0
- package/neural-interface/public/openclaw-logo-text.png +0 -0
- package/neural-interface/public/pin-svgrepo-com.svg +25 -0
- package/neural-interface/public/sessionicon.svg +8 -0
- package/neural-interface/public/shared/ansi-parser.js +305 -0
- package/neural-interface/public/shared/api.js +1043 -0
- package/neural-interface/public/shared/colors.js +153 -0
- package/neural-interface/public/shared/constants.js +141 -0
- package/neural-interface/public/shared/html-shell.js +777 -0
- package/neural-interface/public/shared/html-term-renderer.js +1022 -0
- package/neural-interface/public/shared/i18n.js +147 -0
- package/neural-interface/public/shared/registry.js +82 -0
- package/neural-interface/public/shared/state.js +86 -0
- package/neural-interface/public/shared/storage.js +150 -0
- package/neural-interface/public/shared/styles.css +21212 -0
- package/neural-interface/public/shared/ui-automation-studio.js +3573 -0
- package/neural-interface/public/shared/ui-bookmarks.js +231 -0
- package/neural-interface/public/shared/ui-claude-panel.js +6333 -0
- package/neural-interface/public/shared/ui-command-runner.js +534 -0
- package/neural-interface/public/shared/ui-cost-widget.js +602 -0
- package/neural-interface/public/shared/ui-detail.js +1454 -0
- package/neural-interface/public/shared/ui-explorer.js +1356 -0
- package/neural-interface/public/shared/ui-file-explorer.js +2750 -0
- package/neural-interface/public/shared/ui-games.js +411 -0
- package/neural-interface/public/shared/ui-help.js +107 -0
- package/neural-interface/public/shared/ui-image-gallery.js +461 -0
- package/neural-interface/public/shared/ui-invite.js +519 -0
- package/neural-interface/public/shared/ui-keybinds.js +452 -0
- package/neural-interface/public/shared/ui-layouts.js +297 -0
- package/neural-interface/public/shared/ui-link.js +731 -0
- package/neural-interface/public/shared/ui-loading.js +255 -0
- package/neural-interface/public/shared/ui-menubar.js +499 -0
- package/neural-interface/public/shared/ui-multiselect.js +93 -0
- package/neural-interface/public/shared/ui-navbar.js +222 -0
- package/neural-interface/public/shared/ui-notifications.js +287 -0
- package/neural-interface/public/shared/ui-panels.js +309 -0
- package/neural-interface/public/shared/ui-resume.js +653 -0
- package/neural-interface/public/shared/ui-search.js +145 -0
- package/neural-interface/public/shared/ui-sessions.js +531 -0
- package/neural-interface/public/shared/ui-settings.js +5987 -0
- package/neural-interface/public/shared/ui-sidebar.js +1905 -0
- package/neural-interface/public/shared/ui-skills.js +2805 -0
- package/neural-interface/public/shared/ui-stats.js +38 -0
- package/neural-interface/public/shared/ui-sync.js +201 -0
- package/neural-interface/public/shared/ui-terminal.js +6385 -0
- package/neural-interface/public/shared/ui-tooltip.js +123 -0
- package/neural-interface/public/shared/ui-trash.js +439 -0
- package/neural-interface/public/shared/ui-tutorial-draw.js +875 -0
- package/neural-interface/public/shared/ui-tutorial-steps.js +2276 -0
- package/neural-interface/public/shared/ui-tutorial.js +1117 -0
- package/neural-interface/public/shared/ui-update.js +244 -0
- package/neural-interface/public/shared/ui-whiteboard.js +3262 -0
- package/neural-interface/public/shared/ui-workspaces.js +722 -0
- package/neural-interface/public/shared/utils.js +360 -0
- package/neural-interface/public/shared/vterm-buffer.js +1102 -0
- package/neural-interface/public/sw.js +52 -0
- package/neural-interface/public/synabun.png +0 -0
- package/neural-interface/public/toolbar-album.svg +8 -0
- package/neural-interface/public/toolbar-question.svg +6 -0
- package/neural-interface/public/toolbar-sessions.svg +6 -0
- package/neural-interface/public/variant/2d/background.js +113 -0
- package/neural-interface/public/variant/2d/context-menu.js +133 -0
- package/neural-interface/public/variant/2d/gfx.js +45 -0
- package/neural-interface/public/variant/2d/graph.js +1635 -0
- package/neural-interface/public/variant/2d/hulls.js +207 -0
- package/neural-interface/public/variant/2d/lasso.js +135 -0
- package/neural-interface/public/variant/2d/layout.js +594 -0
- package/neural-interface/public/variant/2d/main.js +521 -0
- package/neural-interface/public/variant/2d/minimap.js +312 -0
- package/neural-interface/public/variant/2d/settings-gfx.js +98 -0
- package/neural-interface/public/variant/3d/background.js +884 -0
- package/neural-interface/public/variant/3d/camera.js +661 -0
- package/neural-interface/public/variant/3d/gfx.js +116 -0
- package/neural-interface/public/variant/3d/graph.js +2399 -0
- package/neural-interface/public/variant/3d/main.js +500 -0
- package/neural-interface/public/variant/3d/settings-gfx.js +228 -0
- package/neural-interface/scripts/rebuild-pty.js +100 -0
- package/neural-interface/server.js +15000 -0
- package/neural-interface/templates/CLAUDE-template.md +211 -0
- package/package.json +53 -0
- package/postinstall.js +135 -0
- package/setup.js +260 -0
- package/skills/leonardo/SKILL.md +159 -0
- package/skills/leonardo/icon.svg +1 -0
- package/skills/leonardo/modules/browser-guide.md +378 -0
- package/skills/leonardo/modules/image-prompter.md +277 -0
- package/skills/leonardo/modules/model-advisor.md +100 -0
- package/skills/leonardo/modules/prompt-library.md +110 -0
- package/skills/leonardo/modules/style-guide.md +186 -0
- package/skills/leonardo/modules/video-prompter.md +311 -0
- package/skills/synabun/SKILL.md +185 -0
- package/skills/synabun/icon.png +0 -0
- package/skills/synabun/modules/audit.md +374 -0
- package/skills/synabun/modules/changelog.md +194 -0
- package/skills/synabun/modules/idea.md +144 -0
- package/skills/synabun/modules/memorize.md +188 -0
- package/skills/synabun/synabunicon.png +0 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════
|
|
2
|
+
// SynaBun Neural Interface — Loading Overlay
|
|
3
|
+
// Health check, server start, server-offline retry, command copy
|
|
4
|
+
// ═══════════════════════════════════════════
|
|
5
|
+
|
|
6
|
+
import { fetchHealth, startHealth } from './api.js';
|
|
7
|
+
import { emit } from './state.js';
|
|
8
|
+
import { t } from './i18n.js';
|
|
9
|
+
|
|
10
|
+
const $ = (id) => document.getElementById(id);
|
|
11
|
+
|
|
12
|
+
// ── Internal refs (resolved once on init) ──
|
|
13
|
+
let _statusDot = null;
|
|
14
|
+
let _initCallback = null;
|
|
15
|
+
|
|
16
|
+
// ═══════════════════════════════════════════
|
|
17
|
+
// PUBLIC API
|
|
18
|
+
// ═══════════════════════════════════════════
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Show an error state on the loading overlay.
|
|
22
|
+
* @param {string} title Main heading text
|
|
23
|
+
* @param {string} sub Subtitle / description
|
|
24
|
+
* @param {boolean} canStart Whether to show the "Start" action button
|
|
25
|
+
* @param {boolean} serverOffline Whether to show the server-offline UI (mascot + command)
|
|
26
|
+
*/
|
|
27
|
+
export function showLoadingError(title, sub, canStart, serverOffline) {
|
|
28
|
+
const $overlay = $('loading-overlay');
|
|
29
|
+
if (!$overlay) return;
|
|
30
|
+
|
|
31
|
+
$overlay.classList.add('error');
|
|
32
|
+
if (serverOffline) $overlay.classList.add('server-offline');
|
|
33
|
+
else $overlay.classList.remove('server-offline');
|
|
34
|
+
|
|
35
|
+
if (_statusDot) _statusDot.classList.add('error');
|
|
36
|
+
|
|
37
|
+
const $text = $('loading-text');
|
|
38
|
+
const $sub = $('loading-sub');
|
|
39
|
+
if ($text) $text.textContent = title;
|
|
40
|
+
if ($sub) $sub.textContent = sub;
|
|
41
|
+
|
|
42
|
+
const $action = $('loading-action');
|
|
43
|
+
if (canStart) {
|
|
44
|
+
if ($action) $action.style.display = 'block';
|
|
45
|
+
const $label = $('loading-action-label');
|
|
46
|
+
if ($label) $label.textContent = t('common.start');
|
|
47
|
+
} else {
|
|
48
|
+
if ($action) $action.style.display = 'none';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const $status = $('loading-action-status');
|
|
52
|
+
if ($status) $status.textContent = '';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Hide the loading overlay with a fade-out transition.
|
|
57
|
+
* @param {number} [delay=400] Milliseconds before adding the hidden class
|
|
58
|
+
*/
|
|
59
|
+
export function hideLoading(delay = 400) {
|
|
60
|
+
const $overlay = $('loading-overlay');
|
|
61
|
+
if ($overlay) setTimeout(() => $overlay.classList.add('hidden'), delay);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Show the loading overlay (remove hidden class).
|
|
66
|
+
*/
|
|
67
|
+
export function showLoading() {
|
|
68
|
+
const $overlay = $('loading-overlay');
|
|
69
|
+
if ($overlay) $overlay.classList.remove('hidden');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Reset the loading overlay back to its initial "Connecting" state
|
|
74
|
+
* and clear any error classes.
|
|
75
|
+
*/
|
|
76
|
+
function resetLoadingToConnecting() {
|
|
77
|
+
const $overlay = $('loading-overlay');
|
|
78
|
+
if (!$overlay) return;
|
|
79
|
+
|
|
80
|
+
$overlay.classList.remove('error', 'server-offline');
|
|
81
|
+
|
|
82
|
+
const $text = $('loading-text');
|
|
83
|
+
const $sub = $('loading-sub');
|
|
84
|
+
const $action = $('loading-action');
|
|
85
|
+
const $actionStatus = $('loading-action-status');
|
|
86
|
+
|
|
87
|
+
if ($text) $text.textContent = t('loading.connecting');
|
|
88
|
+
if ($sub) $sub.textContent = t('loading.initializingNeural');
|
|
89
|
+
if ($action) $action.style.display = 'none';
|
|
90
|
+
if ($actionStatus) $actionStatus.textContent = '';
|
|
91
|
+
if (_statusDot) _statusDot.classList.remove('error');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ═══════════════════════════════════════════
|
|
95
|
+
// HEALTH CHECK (called during init)
|
|
96
|
+
// ═══════════════════════════════════════════
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Run the health check pre-flight. If the database is unhealthy,
|
|
100
|
+
* show the appropriate loading error. Returns true if healthy (or
|
|
101
|
+
* the health endpoint itself failed, in which case we proceed).
|
|
102
|
+
* Returns false if the database is known-unhealthy.
|
|
103
|
+
*/
|
|
104
|
+
export async function checkHealth() {
|
|
105
|
+
try {
|
|
106
|
+
const health = await fetchHealth();
|
|
107
|
+
// Cache projectDir for the server-offline command display
|
|
108
|
+
if (health.projectDir) {
|
|
109
|
+
localStorage.setItem('synabun-project-dir', health.projectDir);
|
|
110
|
+
updateCmdText(health.projectDir);
|
|
111
|
+
}
|
|
112
|
+
if (!health.ok) {
|
|
113
|
+
const messages = {
|
|
114
|
+
db_missing: [t('loading.health.databaseUnreachable.title'), health.detail || t('loading.health.databaseUnreachable.sub')],
|
|
115
|
+
db_error: [t('loading.health.databaseUnreachable.title'), health.detail || t('loading.health.databaseUnreachable.sub')],
|
|
116
|
+
remote_unreachable: [t('loading.health.remoteUnreachable.title'), health.detail || t('loading.health.remoteUnreachable.sub')],
|
|
117
|
+
auth_error: [t('loading.health.authError.title'), health.detail || t('loading.health.authError.sub')],
|
|
118
|
+
};
|
|
119
|
+
const [title, sub] = messages[health.reason] || [t('loading.health.connectionError.title'), health.detail || t('loading.health.connectionError.sub')];
|
|
120
|
+
showLoadingError(title, sub, !!health.canAutoStart);
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
} catch {
|
|
125
|
+
// /api/health itself failed — try to restore cached path for offline display
|
|
126
|
+
const cached = localStorage.getItem('synabun-project-dir');
|
|
127
|
+
if (cached) updateCmdText(cached);
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Update the command text element with the full path to npm start.
|
|
134
|
+
*/
|
|
135
|
+
function updateCmdText(projectDir) {
|
|
136
|
+
const cmdEl = $('loading-cmd-text');
|
|
137
|
+
if (cmdEl) cmdEl.textContent = `cd ${projectDir} && npm start`;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// ═══════════════════════════════════════════
|
|
141
|
+
// INTERNAL — Action handlers
|
|
142
|
+
// ═══════════════════════════════════════════
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Handle the "Start Server" / retry action button click.
|
|
146
|
+
* Calls /api/health/start and re-triggers init on success.
|
|
147
|
+
*/
|
|
148
|
+
async function handleStartAction() {
|
|
149
|
+
const btn = $('loading-action-btn');
|
|
150
|
+
const $status = $('loading-action-status');
|
|
151
|
+
const $label = $('loading-action-label');
|
|
152
|
+
|
|
153
|
+
if (btn) btn.disabled = true;
|
|
154
|
+
if ($label) $label.textContent = t('loading.starting');
|
|
155
|
+
if ($status) $status.textContent = t('loading.takeMoment');
|
|
156
|
+
|
|
157
|
+
try {
|
|
158
|
+
const data = await startHealth();
|
|
159
|
+
if (data.ok && data.ready) {
|
|
160
|
+
// Success — reset overlay and re-init
|
|
161
|
+
resetLoadingToConnecting();
|
|
162
|
+
emit('loading:started');
|
|
163
|
+
if (_initCallback) _initCallback();
|
|
164
|
+
} else {
|
|
165
|
+
if ($status) $status.textContent = data.error || t('loading.couldNotStart');
|
|
166
|
+
if (btn) btn.disabled = false;
|
|
167
|
+
if ($label) $label.textContent = t('common.retry');
|
|
168
|
+
}
|
|
169
|
+
} catch (err) {
|
|
170
|
+
if ($status) $status.textContent = t('loading.somethingWrong');
|
|
171
|
+
if (btn) btn.disabled = false;
|
|
172
|
+
if ($label) $label.textContent = t('common.retry');
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Handle the "Copy command to clipboard" button in the server-offline panel.
|
|
178
|
+
*/
|
|
179
|
+
function handleCopyCommand() {
|
|
180
|
+
const cmdEl = $('loading-cmd-text');
|
|
181
|
+
const btn = $('loading-cmd-copy');
|
|
182
|
+
if (!cmdEl || !btn) return;
|
|
183
|
+
|
|
184
|
+
const cmd = cmdEl.textContent;
|
|
185
|
+
navigator.clipboard.writeText(cmd).then(() => {
|
|
186
|
+
btn.innerHTML = '<svg viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>';
|
|
187
|
+
btn.style.color = 'rgba(100,255,100,0.7)';
|
|
188
|
+
setTimeout(() => {
|
|
189
|
+
btn.innerHTML = '<svg viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';
|
|
190
|
+
btn.style.color = '';
|
|
191
|
+
}, 1500);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Handle the "Retry Connection" button in the server-offline panel.
|
|
197
|
+
* Pings /api/health and re-triggers init on success.
|
|
198
|
+
*/
|
|
199
|
+
async function handleRetryConnection() {
|
|
200
|
+
const $status = $('loading-retry-status');
|
|
201
|
+
if ($status) $status.textContent = t('loading.checking');
|
|
202
|
+
|
|
203
|
+
try {
|
|
204
|
+
const health = await fetchHealth();
|
|
205
|
+
// fetchHealth uses AbortSignal.timeout(3000) internally
|
|
206
|
+
if (health && health.ok !== false) {
|
|
207
|
+
if ($status) $status.textContent = t('loading.connectedLoading');
|
|
208
|
+
resetLoadingToConnecting();
|
|
209
|
+
emit('loading:retried');
|
|
210
|
+
if (_initCallback) _initCallback();
|
|
211
|
+
} else {
|
|
212
|
+
if ($status) $status.textContent = t('loading.notReadyYet');
|
|
213
|
+
setTimeout(() => { if ($status) $status.textContent = ''; }, 3000);
|
|
214
|
+
}
|
|
215
|
+
} catch {
|
|
216
|
+
if ($status) $status.textContent = t('loading.stillOffline');
|
|
217
|
+
setTimeout(() => { if ($status) $status.textContent = ''; }, 3000);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// ═══════════════════════════════════════════
|
|
222
|
+
// INIT
|
|
223
|
+
// ═══════════════════════════════════════════
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Initialize the loading overlay. Wires up all event listeners for:
|
|
227
|
+
* - Start Server button
|
|
228
|
+
* - Copy command button
|
|
229
|
+
* - Retry connection button
|
|
230
|
+
*
|
|
231
|
+
* @param {Object} options
|
|
232
|
+
* @param {Function} options.onInit Callback to invoke when the user triggers
|
|
233
|
+
* a retry/start and it succeeds. This should
|
|
234
|
+
* be the variant's init() function.
|
|
235
|
+
*/
|
|
236
|
+
export function initLoading({ onInit } = {}) {
|
|
237
|
+
_initCallback = onInit || null;
|
|
238
|
+
_statusDot = $('status-dot');
|
|
239
|
+
|
|
240
|
+
// ── Populate command with cached path ──
|
|
241
|
+
const cached = localStorage.getItem('synabun-project-dir');
|
|
242
|
+
if (cached) updateCmdText(cached);
|
|
243
|
+
|
|
244
|
+
// ── Start Server / retry action button ──
|
|
245
|
+
const actionBtn = $('loading-action-btn');
|
|
246
|
+
if (actionBtn) actionBtn.addEventListener('click', handleStartAction);
|
|
247
|
+
|
|
248
|
+
// ── Copy command to clipboard ──
|
|
249
|
+
const copyBtn = $('loading-cmd-copy');
|
|
250
|
+
if (copyBtn) copyBtn.addEventListener('click', handleCopyCommand);
|
|
251
|
+
|
|
252
|
+
// ── Retry connection ──
|
|
253
|
+
const retryBtn = $('loading-retry-btn');
|
|
254
|
+
if (retryBtn) retryBtn.addEventListener('click', handleRetryConnection);
|
|
255
|
+
}
|