@anmol-srv/sigil 0.14.0 → 0.16.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/dist/cli.js +465 -348
- package/dist/daemon.js +210 -138
- package/dist/hooks/post-tool-use.js +26 -26
- package/dist/hooks/session-end.js +71 -71
- package/dist/hooks/stop.js +98 -94
- package/dist/hooks/user-prompt-submit.js +46 -46
- package/dist/server.js +51 -46
- package/package.json +4 -3
- package/src/db/drivers/index.js +41 -0
- package/src/db/drivers/local-postgres.js +23 -0
- package/src/db/drivers/url.js +155 -0
- package/src/db/drivers/url.test.js +94 -0
- package/src/db/migrations/20260601000006_add-entity-name-trigram-index.cjs +25 -0
- package/src/gui/web/app.css +160 -18
- package/src/gui/web/app.js +36 -8
- package/src/gui/web/design/colors_and_type.css +2 -2
- package/src/gui/web/index.html +27 -4
- package/src/gui/web/setup.js +2 -2
package/src/gui/web/app.js
CHANGED
|
@@ -136,7 +136,7 @@ async function refreshKb() {
|
|
|
136
136
|
]);
|
|
137
137
|
const hot = data.hotFacts || [];
|
|
138
138
|
$('#hot-facts').innerHTML = hot.length
|
|
139
|
-
? hot.map((f) => `<li>${escape(f.content.slice(0, 140))}<span class="muted" style="margin-left:
|
|
139
|
+
? hot.map((f) => `<li>${escape(f.content.slice(0, 140))}<span class="muted" style="margin-left:var(--s-2);">${f.accessCount}×</span></li>`).join('')
|
|
140
140
|
: '<li class="muted">no hot facts yet</li>';
|
|
141
141
|
} catch (err) {
|
|
142
142
|
$('#kb-pane').innerHTML = `<div class="row"><div class="k">error</div><div class="v">${escape(err.message)}</div></div>`;
|
|
@@ -250,7 +250,7 @@ async function openSwitcher(kind) {
|
|
|
250
250
|
$('#cfg-switch-cards').innerHTML = cfgSwitch.providers.map((p) => `
|
|
251
251
|
<label class="provider-card" data-cfg-id="${escape(p.id)}">
|
|
252
252
|
<span class="check"></span>
|
|
253
|
-
<span class="name">${escape(p.label)}${p.recommended ? ' <span class="badge info" style="margin-left:
|
|
253
|
+
<span class="name">${escape(p.label)}${p.recommended ? ' <span class="badge info" style="margin-left:var(--s-2);">RECOMMENDED</span>' : ''}</span>
|
|
254
254
|
<span class="hint">${escape(p.hint)}</span>
|
|
255
255
|
</label>`).join('');
|
|
256
256
|
} catch (err) {
|
|
@@ -313,6 +313,33 @@ $('#cfg-switch-apply')?.addEventListener('click', async () => {
|
|
|
313
313
|
}
|
|
314
314
|
});
|
|
315
315
|
|
|
316
|
+
// ── Settings: danger zone — factory reset ────────────────────────────
|
|
317
|
+
$('#cfg-reset')?.addEventListener('click', () => {
|
|
318
|
+
const host = $('#reset-confirm');
|
|
319
|
+
if (!host) return;
|
|
320
|
+
const wipeMemory = $('#reset-wipe-memory')?.checked !== false;
|
|
321
|
+
host.innerHTML = `
|
|
322
|
+
<div class="result err" style="margin:0;">
|
|
323
|
+
<strong>Reset Sigil?</strong>
|
|
324
|
+
<div class="muted" style="margin:6px 0;">Disconnects every agent${wipeMemory ? ', wipes all stored memory,' : ''} and clears your config. You'll go back to setup. (The database itself is kept — use <code>sigil reset</code> in a terminal for a full DB teardown.)</div>
|
|
325
|
+
<div class="flex-row" style="margin-top:8px;">
|
|
326
|
+
<button type="button" class="btn danger" data-reset-go>Yes, reset</button>
|
|
327
|
+
<button type="button" class="btn" data-reset-cancel>Cancel</button>
|
|
328
|
+
</div>
|
|
329
|
+
</div>`;
|
|
330
|
+
host.querySelector('[data-reset-cancel]').addEventListener('click', () => { host.innerHTML = ''; });
|
|
331
|
+
host.querySelector('[data-reset-go]').addEventListener('click', async (e) => {
|
|
332
|
+
e.target.disabled = true; e.target.textContent = 'Resetting…';
|
|
333
|
+
try {
|
|
334
|
+
const r = await rpc('setup.factoryReset', { wipeMemory });
|
|
335
|
+
toast({ variant: 'success', message: `Reset complete — disconnected ${r.disconnected?.length || 0} agent(s)${wipeMemory ? `, wiped ${r.tablesWiped || 0} tables` : ''}.` });
|
|
336
|
+
setTimeout(() => window.location.reload(), 800);
|
|
337
|
+
} catch (err) {
|
|
338
|
+
host.innerHTML = `<div class="result err" style="margin:0;">✗ ${escape(err.message)}</div>`;
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
|
|
316
343
|
async function restartAndClose(out) {
|
|
317
344
|
out.textContent += '\nApplying — restarting daemon…';
|
|
318
345
|
try { await rpc('restartDaemon', {}); } catch { /* expected: connection drops on exit */ }
|
|
@@ -716,16 +743,16 @@ document.addEventListener('click', (e) => {
|
|
|
716
743
|
return;
|
|
717
744
|
}
|
|
718
745
|
const a = e.target.closest('[data-activate]');
|
|
719
|
-
if (a) rpc('device.activate', { id: Number(a.dataset.activate) }).then(refreshDevices).catch((err) =>
|
|
746
|
+
if (a) rpc('device.activate', { id: Number(a.dataset.activate) }).then(refreshDevices).catch((err) => toast({ variant: 'error', message: err.message }));
|
|
720
747
|
const cb = e.target.closest('[data-revoke-code]');
|
|
721
|
-
if (cb) rpc('pair.revoke', { id: Number(cb.dataset.revokeCode) }).then(refreshDevices).catch((err) =>
|
|
748
|
+
if (cb) rpc('pair.revoke', { id: Number(cb.dataset.revokeCode) }).then(refreshDevices).catch((err) => toast({ variant: 'error', message: err.message }));
|
|
722
749
|
});
|
|
723
750
|
|
|
724
751
|
$('#revoke-confirm')?.addEventListener('click', async () => {
|
|
725
752
|
if (revokeTargetId == null) return;
|
|
726
753
|
const reason = $('input[name="revoke-reason"]:checked').value;
|
|
727
754
|
try { await rpc('device.revoke', { id: revokeTargetId, reason }); closeModal('revoke-modal'); refreshDevices(); }
|
|
728
|
-
catch (err) {
|
|
755
|
+
catch (err) { toast({ variant: 'error', message: err.message }); }
|
|
729
756
|
});
|
|
730
757
|
|
|
731
758
|
// Highlight selected radio card in revoke modal
|
|
@@ -752,7 +779,7 @@ new MutationObserver(() => { if ($('#dev-modal').hidden) { setTimeout(resetDevMo
|
|
|
752
779
|
.observe($('#dev-modal'), { attributes: true, attributeFilter: ['hidden'] });
|
|
753
780
|
|
|
754
781
|
$('#dev-create')?.addEventListener('click', async () => {
|
|
755
|
-
const name = $('#dev-name').value.trim(); if (!name)
|
|
782
|
+
const name = $('#dev-name').value.trim(); if (!name) { toast({ variant: 'error', message: 'Device name is required.' }); return; }
|
|
756
783
|
const role = $('#dev-role').value;
|
|
757
784
|
const ttl = Number($('#dev-ttl').value) || 600;
|
|
758
785
|
const ns = $('#dev-ns').value.trim();
|
|
@@ -769,7 +796,7 @@ $('#dev-create')?.addEventListener('click', async () => {
|
|
|
769
796
|
$('#dev-result-master').firstChild.textContent = (data.masterNodeId || '(iroh not running)') + ' ';
|
|
770
797
|
$('#dev-result-cmd').textContent = cmd;
|
|
771
798
|
$('#dev-result-expiry').textContent = data.expiresAt;
|
|
772
|
-
} catch (err) {
|
|
799
|
+
} catch (err) { toast({ variant: 'error', message: err.message || 'Create pairing code failed.' }); }
|
|
773
800
|
});
|
|
774
801
|
|
|
775
802
|
// ════════════════════════════════════════════════════════════════════
|
|
@@ -794,4 +821,5 @@ async function runLanding() {
|
|
|
794
821
|
const initial = (window.location.hash || '#health').slice(1);
|
|
795
822
|
setRoute(validRoutes.includes(initial) ? initial : 'health');
|
|
796
823
|
runLanding();
|
|
797
|
-
setInterval(refreshHealth, 5000);
|
|
824
|
+
setInterval(() => { if (!document.hidden) refreshHealth(); }, 5000);
|
|
825
|
+
document.addEventListener('visibilitychange', () => { if (!document.hidden) refreshHealth(); });
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
restrained status color. Import this file to inherit all tokens.
|
|
5
5
|
============================================================ */
|
|
6
6
|
|
|
7
|
-
/*
|
|
8
|
-
@import
|
|
7
|
+
/* Webfonts are loaded via <link> tags in index.html for parallel fetch.
|
|
8
|
+
@import here would block parsing until this file is fully loaded first. */
|
|
9
9
|
|
|
10
10
|
:root {
|
|
11
11
|
/* ========================================================
|
package/src/gui/web/index.html
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
|
6
6
|
<title>Sigil</title>
|
|
7
7
|
<link rel="icon" type="image/svg+xml" href="/static/design/sigil-mark.svg">
|
|
8
|
+
<!-- Geist fonts: preconnect + parallel fetch (no blocking @import in CSS) -->
|
|
9
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
10
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
11
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap">
|
|
8
12
|
<!-- Sigil design system tokens (color, type, spacing, geometry) — loaded
|
|
9
13
|
BEFORE app.css so the dashboard re-skins onto the brand. -->
|
|
10
14
|
<link rel="stylesheet" href="/static/design/colors_and_type.css">
|
|
@@ -263,10 +267,10 @@
|
|
|
263
267
|
<pre id="cfg-switch-result" class="result" style="display:none"></pre>
|
|
264
268
|
</div>
|
|
265
269
|
|
|
266
|
-
<!--
|
|
270
|
+
<!-- Config snapshot (advanced, collapsed) -->
|
|
267
271
|
<details class="panel" style="padding: var(--s-5);">
|
|
268
|
-
<summary style="cursor:pointer;">Advanced —
|
|
269
|
-
<p class="muted text-sm">
|
|
272
|
+
<summary style="cursor:pointer;">Advanced — configuration (<code>~/.sigil/config.json</code>)</summary>
|
|
273
|
+
<p class="muted text-sm">Secrets are shown as "configured", never the value.</p>
|
|
270
274
|
<div class="table-wrap">
|
|
271
275
|
<table id="env-table">
|
|
272
276
|
<thead><tr><th>Key</th><th>Value</th></tr></thead>
|
|
@@ -274,6 +278,25 @@
|
|
|
274
278
|
</table>
|
|
275
279
|
</div>
|
|
276
280
|
</details>
|
|
281
|
+
|
|
282
|
+
<!-- ── Danger zone ──────────────────────────────────────────── -->
|
|
283
|
+
<div class="section-head" style="margin-top: var(--s-6);">
|
|
284
|
+
<div class="title-block">
|
|
285
|
+
<h2>Danger zone</h2>
|
|
286
|
+
<p>Reset Sigil — disconnect every agent, optionally wipe stored memory, and start setup over.</p>
|
|
287
|
+
</div>
|
|
288
|
+
</div>
|
|
289
|
+
<div class="panel" style="padding: var(--s-5);">
|
|
290
|
+
<label class="field" style="flex-direction:row; align-items:center; gap: var(--s-2);">
|
|
291
|
+
<input type="checkbox" id="reset-wipe-memory" checked>
|
|
292
|
+
<span class="label" style="text-transform:none; letter-spacing:0;">Also wipe stored memory (all facts & embeddings)</span>
|
|
293
|
+
</label>
|
|
294
|
+
<div id="reset-result" class="result" style="display:none; margin-top: var(--s-3);"></div>
|
|
295
|
+
<div class="flex-row" style="margin-top: var(--s-3);">
|
|
296
|
+
<div id="reset-confirm"></div>
|
|
297
|
+
<button type="button" class="btn danger" id="cfg-reset">Reset Sigil…</button>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
277
300
|
</section>
|
|
278
301
|
|
|
279
302
|
<!-- ── RPC ──────────────────────────────────────────────────── -->
|
package/src/gui/web/setup.js
CHANGED
|
@@ -216,7 +216,7 @@ function confirmExternal(url) {
|
|
|
216
216
|
return new Promise((resolve) => {
|
|
217
217
|
const host = (() => { try { return new URL(url).host; } catch { return 'that server'; } })();
|
|
218
218
|
const el = $('#setup-confirm');
|
|
219
|
-
el.innerHTML = `<div class="result
|
|
219
|
+
el.innerHTML = `<div class="result">
|
|
220
220
|
<strong>Create database & run migrations on ${esc(host)}?</strong>
|
|
221
221
|
<div class="muted" style="margin:6px 0;">Sigil will create the database if missing, enable pgvector, and apply its schema.</div>
|
|
222
222
|
<div class="flex-row" style="margin-top:8px;">
|
|
@@ -240,7 +240,7 @@ async function renderProviderStep(stepId) {
|
|
|
240
240
|
$('#setup-run').addEventListener('click', () => runProviderStep(stepId));
|
|
241
241
|
const det = await rpc('setup.detect', { step: stepId }, { quiet: true }).catch(() => ({ providers: [] }));
|
|
242
242
|
providers = det.providers || [];
|
|
243
|
-
$('#setup-providers').innerHTML = providers.map((p) => card('prov', p.id, `${esc(p.label)}${p.recommended ? ' <span class="badge info" style="margin-left:
|
|
243
|
+
$('#setup-providers').innerHTML = providers.map((p) => card('prov', p.id, `${esc(p.label)}${p.recommended ? ' <span class="badge info" style="margin-left:var(--s-2);">RECOMMENDED</span>' : ''}`, p.hint)).join('');
|
|
244
244
|
$$all('#setup-providers [data-prov]').forEach((c) => c.addEventListener('click', () => selectProvider(stepId, c.dataset.prov)));
|
|
245
245
|
const rec = providers.find((p) => p.recommended) || providers[0];
|
|
246
246
|
if (rec) selectProvider(stepId, rec.id);
|