zames_pro 2.25.0 → 2.26.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/browser.js +36 -0
- package/dist/index.js +3 -0
- package/dist/input.js +43 -1
- package/dist/theme.js +2 -0
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -280,6 +280,10 @@ export class DeepSeekBrowser {
|
|
|
280
280
|
// completion stream and from /api/v0/chat/history_messages. Null until the
|
|
281
281
|
// first answer (or history fetch) delivers it. Shown by /cost and /status.
|
|
282
282
|
_lastTokenUsage;
|
|
283
|
+
// Last known DeepSeek toggle states (deep thinking / web search), kept in
|
|
284
|
+
// sync by _applyToggles()/getToggleStates(). Exposed synchronously so the
|
|
285
|
+
// editor can draw the toggle icons on every render without awaiting.
|
|
286
|
+
_toggles;
|
|
283
287
|
// Authorization / PoW headers sniffed from DeepSeek's own API requests, so
|
|
284
288
|
// fetchChatMessages can replay them (a bare fetch does not get them).
|
|
285
289
|
_apiAuth;
|
|
@@ -332,6 +336,7 @@ export class DeepSeekBrowser {
|
|
|
332
336
|
this._netCaptureAt = 0;
|
|
333
337
|
this._netChatId = null;
|
|
334
338
|
this._lastTokenUsage = null;
|
|
339
|
+
this._toggles = { deepThinking, webSearch };
|
|
335
340
|
this._apiAuth = '';
|
|
336
341
|
this._apiPow = '';
|
|
337
342
|
this._lastHistoryError = '';
|
|
@@ -1039,6 +1044,37 @@ export class DeepSeekBrowser {
|
|
|
1039
1044
|
async _applyToggles() {
|
|
1040
1045
|
await this._setToggle(/глубок|deep\s*think/i, this.deepThinking);
|
|
1041
1046
|
await this._setToggle(/поиск|search/i, this.webSearch);
|
|
1047
|
+
this._toggles = await this.getToggleStates();
|
|
1048
|
+
}
|
|
1049
|
+
// Synchronous snapshot of the last known toggle states, for the editor's
|
|
1050
|
+
// status icons (called on every render, must not await).
|
|
1051
|
+
getToggleStatesSync() {
|
|
1052
|
+
return this._toggles;
|
|
1053
|
+
}
|
|
1054
|
+
// The CURRENT state of the two DeepSeek toggles, read from the DOM
|
|
1055
|
+
// (aria-pressed) so the status line reflects what is actually on, not what
|
|
1056
|
+
// the config asked for. Falls back to the configured values when the buttons
|
|
1057
|
+
// are not found.
|
|
1058
|
+
async getToggleStates() {
|
|
1059
|
+
const read = async (labelRe, fallback) => {
|
|
1060
|
+
try {
|
|
1061
|
+
const btns = this.page.locator('.ds-toggle-button');
|
|
1062
|
+
const count = await btns.count().catch(() => 0);
|
|
1063
|
+
for (let i = 0; i < count; i++) {
|
|
1064
|
+
const b = btns.nth(i);
|
|
1065
|
+
const txt = ((await b.textContent().catch(() => '')) || '').trim();
|
|
1066
|
+
if (!labelRe.test(txt))
|
|
1067
|
+
continue;
|
|
1068
|
+
return ((await b.getAttribute('aria-pressed').catch(() => null)) === 'true');
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
catch { }
|
|
1072
|
+
return fallback;
|
|
1073
|
+
};
|
|
1074
|
+
return {
|
|
1075
|
+
deepThinking: await read(/глубок|deep\s*think/i, this.deepThinking),
|
|
1076
|
+
webSearch: await read(/поиск|search/i, this.webSearch),
|
|
1077
|
+
};
|
|
1042
1078
|
}
|
|
1043
1079
|
async stopGeneration() {
|
|
1044
1080
|
this._abort = true;
|
package/dist/index.js
CHANGED
|
@@ -1219,6 +1219,9 @@ async function main() {
|
|
|
1219
1219
|
// The editor pulls the number on every render, so it follows the live
|
|
1220
1220
|
// DeepSeek counter (accumulated_token_usage) without a polling timer.
|
|
1221
1221
|
ed.onContextQuery = () => browser.getLastTokenUsage();
|
|
1222
|
+
// Toggle icons (🧠 deep thinking, 🌐 web search) before the context
|
|
1223
|
+
// counter. The editor pulls the live state on every render.
|
|
1224
|
+
ed.onToggleQuery = () => browser.getToggleStatesSync();
|
|
1222
1225
|
ed.onAttach = async (raw) => {
|
|
1223
1226
|
// Case 1: the paste is the image data itself (data URL / base64 blob).
|
|
1224
1227
|
const image = parseImagePaste(raw);
|
package/dist/input.js
CHANGED
|
@@ -289,6 +289,14 @@ export class LineEditor {
|
|
|
289
289
|
contextStatus;
|
|
290
290
|
// The raw token count behind contextStatus (for the color level).
|
|
291
291
|
contextTokens;
|
|
292
|
+
// Whether the DeepSeek "Deep thinking" / "Smart search" toggles are ON.
|
|
293
|
+
// Shown as two colored icons before the context counter: a dim gray icon
|
|
294
|
+
// means off, a teal-green icon means on.
|
|
295
|
+
thinkingEnabled;
|
|
296
|
+
searchEnabled;
|
|
297
|
+
// A callback the editor calls to fetch the CURRENT toggle states before
|
|
298
|
+
// every render, so the icons follow the live chat state.
|
|
299
|
+
onToggleQuery;
|
|
292
300
|
// A callback the editor calls to fetch the CURRENT token count before every
|
|
293
301
|
// status render, so the status line stays fresh without the caller polling.
|
|
294
302
|
onContextQuery;
|
|
@@ -328,8 +336,27 @@ export class LineEditor {
|
|
|
328
336
|
this.locked = false;
|
|
329
337
|
this.contextStatus = null;
|
|
330
338
|
this.contextTokens = null;
|
|
339
|
+
this.thinkingEnabled = false;
|
|
340
|
+
this.searchEnabled = false;
|
|
341
|
+
this.onToggleQuery = null;
|
|
331
342
|
this.onContextQuery = null;
|
|
332
343
|
}
|
|
344
|
+
// Refresh the toggle icon states from onToggleQuery (if wired) before a
|
|
345
|
+
// render. A broken callback must never break the render.
|
|
346
|
+
_refreshToggles() {
|
|
347
|
+
if (!this.onToggleQuery)
|
|
348
|
+
return;
|
|
349
|
+
try {
|
|
350
|
+
const s = this.onToggleQuery();
|
|
351
|
+
if (s) {
|
|
352
|
+
this.thinkingEnabled = !!s.deepThinking;
|
|
353
|
+
this.searchEnabled = !!s.webSearch;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
catch {
|
|
357
|
+
// ignore
|
|
358
|
+
}
|
|
359
|
+
}
|
|
333
360
|
// The token status for the CURRENT render: refreshed from onContextQuery
|
|
334
361
|
// when wired, otherwise the last value passed to setContextStatus().
|
|
335
362
|
_contextForRender() {
|
|
@@ -359,6 +386,16 @@ export class LineEditor {
|
|
|
359
386
|
return theme.warn(ctx);
|
|
360
387
|
return theme.success(ctx);
|
|
361
388
|
}
|
|
389
|
+
// Two colored icons for the DeepSeek toggles: 🧠 "Deep thinking" and 🌐 "Smart
|
|
390
|
+
// search". A dim gray icon = off, a teal-green icon = on. Placed just before
|
|
391
|
+
// the context counter, so the operator sees the live chat state at a glance.
|
|
392
|
+
_toggleIcons() {
|
|
393
|
+
const on = (s) => theme.toggleOn(s);
|
|
394
|
+
const off = (s) => theme.toggleOff(s);
|
|
395
|
+
const brain = this.thinkingEnabled ? on('🧠') : off('🧠');
|
|
396
|
+
const globe = this.searchEnabled ? on('🌐') : off('🌐');
|
|
397
|
+
return brain + ' ' + globe + ' ';
|
|
398
|
+
}
|
|
362
399
|
// Read the OS clipboard for an image and insert its marker. Used when the
|
|
363
400
|
// terminal sends no usable paste data (Ctrl+V / right-click / empty paste).
|
|
364
401
|
async _tryClipboard() {
|
|
@@ -545,7 +582,12 @@ export class LineEditor {
|
|
|
545
582
|
// though it PRINTS `status + ' '.repeat(space) + ctxText` with a DIFFERENT
|
|
546
583
|
// total width, so at certain widths `top` disagreed with the printed rows.
|
|
547
584
|
// Both branches below now derive `top` from the exact string they print.
|
|
548
|
-
|
|
585
|
+
// Toggle icons (always shown) + the context counter (when known). The
|
|
586
|
+
// icons reflect the live DeepSeek toggles; a fresh chat has no token count
|
|
587
|
+
// but the icons are still meaningful.
|
|
588
|
+
const ctxRaw = this._contextText();
|
|
589
|
+
this._refreshToggles();
|
|
590
|
+
const ctxText = this._toggleIcons() + ctxRaw;
|
|
549
591
|
let statusOut = '';
|
|
550
592
|
let top = 0;
|
|
551
593
|
// Never fill a row to the FULL terminal width: on terminals with
|
package/dist/theme.js
CHANGED
|
@@ -27,6 +27,8 @@ export const theme = {
|
|
|
27
27
|
error: chalk.hex('#c98a80'), // muted terracotta
|
|
28
28
|
success: chalk.hex('#a9c08c'), // soft sage
|
|
29
29
|
brown: chalk.hex('#a1723f'), // brown (status/spinner)
|
|
30
|
+
toggleOn: chalk.hex('#6fd0b0'), // teal-green — a toggle is ON
|
|
31
|
+
toggleOff: chalk.hex('#4a4f5a'), // dim gray — a toggle is OFF
|
|
30
32
|
bold: chalk.bold,
|
|
31
33
|
};
|
|
32
34
|
export default theme;
|