mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-10 01:09:43 +02:00
fix(deepseek): reject the dsh footer's non-model words instead of requiring a digit
The digit rule from 21ae48a5 hid the official DeepSeek ids (`deepseek-chat`,
`deepseek-reasoner` carry no digit), so a session on the official route with
the model field on showed the logo alone (its bundle row pins a provider
alone, so the config had nothing either). It also still misread a folder name
with a digit when every field before it was off.
Now the captured field is rejected when it is what the field can be when it is
NOT the model, and read otherwise:
- capabilities.modelDetect.rejectWords (registry data, single tokens, compared
ignoring case; the schema bounds them and requires a screenLine). dsh lists
every effort id its adapters offer (pi-ai THINKING_LEVELS plus the DeepSeek
adapter's off/low/high/max) and the shipped mode ids, from dsh 0.1.1-rc.2 /
dsh-TUI 0.10.0-beta.1. A mode's drawn label (`plan mode`, `full access`,
CJK) can never be one captured field.
- In the shared screen reader, for every CLI: a field equal to the session's
own working-directory basename is the folder, never the model.
Fixtures: `deepseek-chat` and `deepseek-reasoner` with the model field on are
read; every effort id, `default`, `plan mode`, and the folder name first (with
and without a digit) are not; the live qwen footer still reads `qwen3.8-27b`.
Known gaps, all off by default, are named in stock.ts: a custom mode id drawn
raw, a git branch or a one-word session title first, and the non-compact
footer layout (nothing read there; the route config applies).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+10
-1
@@ -29,6 +29,7 @@
|
||||
*/
|
||||
|
||||
import { EventEmitter } from 'node:events';
|
||||
import { basename } from 'node:path';
|
||||
import { execSync, execFileSync } from 'node:child_process';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import * as pty from 'node-pty';
|
||||
@@ -580,6 +581,8 @@ export class Session extends EventEmitter {
|
||||
private _modelLineRe: RegExp | null | undefined = undefined;
|
||||
/** Resolved with the pattern above: how many rows at the foot of the screen it sees. */
|
||||
private _modelLineRows = 1;
|
||||
/** Resolved with the pattern above: the fields it shows that are never the model. */
|
||||
private _modelRejectWords: readonly string[] = [];
|
||||
private _trustDialogAccepted: boolean = false; // Stops the trust-dialog scan (answered, or given up)
|
||||
private _trustDialogAttempts = 0; // Keystrokes sent at the trust dialog
|
||||
private _lastTrustDialogScanAt = 0; // Throttle for the trust-dialog screen read
|
||||
@@ -3188,7 +3191,12 @@ export class Session extends EventEmitter {
|
||||
if (paneText === null) return;
|
||||
const pattern = this._modelLinePattern();
|
||||
if (!pattern) return;
|
||||
const model = readScreenModel(paneText, pattern, this._modelLineRows);
|
||||
const model = readScreenModel(paneText, pattern, this._modelLineRows, {
|
||||
rejectWords: this._modelRejectWords,
|
||||
// A footer field equal to the folder this session runs in is the folder, never the
|
||||
// model: the generic half of the rule, for every CLI.
|
||||
cwdBasename: basename(this.workingDir),
|
||||
});
|
||||
if (model) this.noteReportedModel('screen', model);
|
||||
}
|
||||
|
||||
@@ -3202,6 +3210,7 @@ export class Session extends EventEmitter {
|
||||
const detect = getCli(this.mode)?.capabilities.modelDetect;
|
||||
this._modelLineRe = detect?.screenLine ? compileVersionRegex(detect.screenLine) : null;
|
||||
this._modelLineRows = detect?.screenLines ?? 1;
|
||||
this._modelRejectWords = detect?.rejectWords ?? [];
|
||||
}
|
||||
return this._modelLineRe;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user