clementine-agent 1.18.96 → 1.18.97
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/dashboard.js +76 -0
- package/package.json +1 -1
package/dist/cli/dashboard.js
CHANGED
|
@@ -26853,10 +26853,14 @@ async function openPromptHistory() {
|
|
|
26853
26853
|
html += '<span style="font-size:11px;color:var(--text-muted)">· by ' + esc(who) + '</span>';
|
|
26854
26854
|
html += '<span style="flex:1"></span>';
|
|
26855
26855
|
html += '<button class="btn-sm" onclick="document.getElementById(\\x27' + rowId + '\\x27).style.display=document.getElementById(\\x27' + rowId + '\\x27).style.display===\\x27none\\x27?\\x27block\\x27:\\x27none\\x27" style="font-size:11px;padding:3px 8px">Show full</button>';
|
|
26856
|
+
// PRD §13 Phase 5.0c / 1.18.97: line-level diff vs editor draft.
|
|
26857
|
+
html += '<button class="btn-sm" onclick="togglePromptDiff(\\x27' + rowId + '-diff\\x27,\\x27' + promptB64 + '\\x27)" style="font-size:11px;padding:3px 8px">Show diff</button>';
|
|
26856
26858
|
html += '<button class="btn-sm btn-primary" onclick="restorePromptVersion(\\x27' + promptB64 + '\\x27)" style="font-size:11px;padding:3px 10px">Restore</button>';
|
|
26857
26859
|
html += '</div>';
|
|
26858
26860
|
html += '<div style="font-size:12px;color:var(--text-secondary);line-height:1.5;font-family:\\x27JetBrains Mono\\x27,monospace">' + esc(preview) + (prompt.length > 200 ? '…' : '') + '</div>';
|
|
26859
26861
|
html += '<pre id="' + rowId + '" style="display:none;margin-top:10px;font-size:11px;font-family:\\x27JetBrains Mono\\x27,monospace;background:var(--bg-tertiary);border:1px solid var(--border);padding:10px;border-radius:6px;white-space:pre-wrap;word-break:break-word;max-height:280px;overflow-y:auto">' + esc(prompt) + '</pre>';
|
|
26862
|
+
// PRD §13 Phase 5.0c / 1.18.97: diff placeholder filled by togglePromptDiff.
|
|
26863
|
+
html += '<div id="' + rowId + '-diff" style="display:none;margin-top:10px;font-size:11px;font-family:\\x27JetBrains Mono\\x27,monospace;background:var(--bg-tertiary);border:1px solid var(--border);padding:10px;border-radius:6px;max-height:320px;overflow-y:auto"></div>';
|
|
26860
26864
|
html += '</div>';
|
|
26861
26865
|
}
|
|
26862
26866
|
list.innerHTML = html;
|
|
@@ -26870,6 +26874,78 @@ function closePromptHistory() {
|
|
|
26870
26874
|
if (modal) modal.classList.remove('show');
|
|
26871
26875
|
}
|
|
26872
26876
|
|
|
26877
|
+
// PRD §13 Phase 5.0c / 1.18.97: line-level diff between this version and
|
|
26878
|
+
// the editor current prompt text. Uses LCS-based diff. Toggles on click.
|
|
26879
|
+
function togglePromptDiff(elemId, promptB64) {
|
|
26880
|
+
var el = document.getElementById(elemId);
|
|
26881
|
+
if (!el) return;
|
|
26882
|
+
if (el.style.display !== 'none') { el.style.display = 'none'; return; }
|
|
26883
|
+
var oldPrompt;
|
|
26884
|
+
try { oldPrompt = decodeURIComponent(escape(atob(promptB64))); }
|
|
26885
|
+
catch (e) { el.innerHTML = '<span style="color:var(--red)">Failed to decode old prompt: ' + esc(String(e)) + '</span>'; el.style.display = 'block'; return; }
|
|
26886
|
+
var ta = document.getElementById('cron-prompt');
|
|
26887
|
+
var newPrompt = ta ? ta.value : '';
|
|
26888
|
+
el.innerHTML = renderPromptDiff(oldPrompt, newPrompt);
|
|
26889
|
+
el.style.display = 'block';
|
|
26890
|
+
}
|
|
26891
|
+
|
|
26892
|
+
function renderPromptDiff(oldText, newText) {
|
|
26893
|
+
var oldLines = (oldText || '').split('\\n');
|
|
26894
|
+
var newLines = (newText || '').split('\\n');
|
|
26895
|
+
if (oldText === newText) {
|
|
26896
|
+
return '<div style="color:var(--text-muted);font-style:italic">Identical to the current prompt — no changes between this version and now.</div>';
|
|
26897
|
+
}
|
|
26898
|
+
var n = oldLines.length, m = newLines.length;
|
|
26899
|
+
if (n > 1000 || m > 1000) {
|
|
26900
|
+
return '<div style="color:var(--text-muted);font-style:italic">Diff too large to render inline (' + n + ' x ' + m + ' lines). Use Show full to view the old prompt and copy/paste into your favorite diff tool.</div>';
|
|
26901
|
+
}
|
|
26902
|
+
// Build LCS table.
|
|
26903
|
+
var dp = [];
|
|
26904
|
+
for (var i = 0; i <= n; i++) dp.push(new Array(m + 1).fill(0));
|
|
26905
|
+
for (var ii = 1; ii <= n; ii++) {
|
|
26906
|
+
for (var jj = 1; jj <= m; jj++) {
|
|
26907
|
+
if (oldLines[ii - 1] === newLines[jj - 1]) dp[ii][jj] = dp[ii - 1][jj - 1] + 1;
|
|
26908
|
+
else dp[ii][jj] = Math.max(dp[ii - 1][jj], dp[ii][jj - 1]);
|
|
26909
|
+
}
|
|
26910
|
+
}
|
|
26911
|
+
// Walk back to produce ops in reverse.
|
|
26912
|
+
var ops = [];
|
|
26913
|
+
var ri = n, rj = m;
|
|
26914
|
+
while (ri > 0 || rj > 0) {
|
|
26915
|
+
if (ri > 0 && rj > 0 && oldLines[ri - 1] === newLines[rj - 1]) {
|
|
26916
|
+
ops.push({ kind: 'equal', text: oldLines[ri - 1] });
|
|
26917
|
+
ri--; rj--;
|
|
26918
|
+
} else if (rj > 0 && (ri === 0 || dp[ri][rj - 1] >= dp[ri - 1][rj])) {
|
|
26919
|
+
ops.push({ kind: 'add', text: newLines[rj - 1] });
|
|
26920
|
+
rj--;
|
|
26921
|
+
} else {
|
|
26922
|
+
ops.push({ kind: 'remove', text: oldLines[ri - 1] });
|
|
26923
|
+
ri--;
|
|
26924
|
+
}
|
|
26925
|
+
}
|
|
26926
|
+
ops.reverse();
|
|
26927
|
+
var added = 0, removed = 0;
|
|
26928
|
+
for (var oi = 0; oi < ops.length; oi++) {
|
|
26929
|
+
if (ops[oi].kind === 'add') added++;
|
|
26930
|
+
else if (ops[oi].kind === 'remove') removed++;
|
|
26931
|
+
}
|
|
26932
|
+
var html = '<div style="font-size:11px;color:var(--text-muted);margin-bottom:8px">'
|
|
26933
|
+
+ '<span style="color:var(--green)">+' + added + '</span> · '
|
|
26934
|
+
+ '<span style="color:var(--red)">-' + removed + '</span> · '
|
|
26935
|
+
+ 'comparing version above ↔ current editor draft</div>';
|
|
26936
|
+
html += '<div style="white-space:pre-wrap;word-break:break-word;line-height:1.5">';
|
|
26937
|
+
for (var k = 0; k < ops.length; k++) {
|
|
26938
|
+
var op = ops[k];
|
|
26939
|
+
var prefix, color, bg;
|
|
26940
|
+
if (op.kind === 'add') { prefix = '+ '; color = 'var(--green)'; bg = 'rgba(16,185,129,0.08)'; }
|
|
26941
|
+
else if (op.kind === 'remove') { prefix = '- '; color = 'var(--red)'; bg = 'rgba(239,68,68,0.08)'; }
|
|
26942
|
+
else { prefix = ' '; color = 'var(--text-muted)'; bg = 'transparent'; }
|
|
26943
|
+
html += '<div style="color:' + color + ';background:' + bg + ';padding:1px 4px">' + esc(prefix) + esc(op.text || ' ') + '</div>';
|
|
26944
|
+
}
|
|
26945
|
+
html += '</div>';
|
|
26946
|
+
return html;
|
|
26947
|
+
}
|
|
26948
|
+
|
|
26873
26949
|
// Restore copies the old prompt back into the editor's textarea. Doesn't
|
|
26874
26950
|
// auto-save — the user must click Save Changes to commit, which keeps the
|
|
26875
26951
|
// dirty-guard semantics intact and gives them a chance to back out.
|