zames_pro 2.15.2 → 2.15.4
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/agent-loop.js +5 -2
- package/dist/browser.js +12 -5
- package/dist/config.js +2 -2
- package/dist/i18n.js +5 -1
- package/dist/index.js +3 -2
- package/dist/net-capture.js +5 -0
- package/package.json +1 -1
package/dist/agent-loop.js
CHANGED
|
@@ -83,8 +83,11 @@ export async function runAgentLoop({ browser, tools, task, workdir, maxIteration
|
|
|
83
83
|
commands: context?.commands.map((c) => c.name) ?? [],
|
|
84
84
|
});
|
|
85
85
|
safeThinking();
|
|
86
|
-
// system-prompt is
|
|
87
|
-
|
|
86
|
+
// system-prompt is the FIRST message of a fresh chat: the rate limit only
|
|
87
|
+
// applies to a rapid back-and-forth, so this send is not throttled
|
|
88
|
+
// (agent: false). Throttling it used to add a useless 15s pause at the
|
|
89
|
+
// start of every new session.
|
|
90
|
+
await browser.ask(systemPrompt, { timeout: 60_000, agent: false });
|
|
88
91
|
await reportChat();
|
|
89
92
|
}
|
|
90
93
|
let message = task;
|
package/dist/browser.js
CHANGED
|
@@ -144,7 +144,7 @@ export class DeepSeekBrowser {
|
|
|
144
144
|
// a generation really begins, not during the pre-send phase (chat open,
|
|
145
145
|
// throttle wait), which used to show a spinner with no work in flight.
|
|
146
146
|
onSendStart;
|
|
147
|
-
constructor({ headless = false, debug = false, channel = 'chrome', answerTimeoutMs = 180000, askRetries = 3, stabilityChecks =
|
|
147
|
+
constructor({ headless = false, debug = false, channel = 'chrome', answerTimeoutMs = 180000, askRetries = 3, stabilityChecks = 2, stabilityDelayMs = 400, minSendIntervalMs = 15000, rateLimitWaitMs = 300000, maxRateLimitRetries = 6, maxServerBusyRetries = 5, serverBusyWaitMs = 3000, } = {}) {
|
|
148
148
|
this.headless = headless;
|
|
149
149
|
this.debug = debug;
|
|
150
150
|
this.channel = channel;
|
|
@@ -180,7 +180,10 @@ export class DeepSeekBrowser {
|
|
|
180
180
|
async _launchOnce() {
|
|
181
181
|
const options = {
|
|
182
182
|
headless: this.headless,
|
|
183
|
-
slowMo
|
|
183
|
+
// 30ms slowMo per Playwright action added up over thousands of DOM
|
|
184
|
+
// actions per run. The waits we need are explicit; keep a small value
|
|
185
|
+
// for stability of clicks/typing.
|
|
186
|
+
slowMo: 10,
|
|
184
187
|
args: ['--disable-blink-features=AutomationControlled'],
|
|
185
188
|
};
|
|
186
189
|
if (this.channel)
|
|
@@ -694,7 +697,7 @@ export class DeepSeekBrowser {
|
|
|
694
697
|
await this._attachFiles(attachments);
|
|
695
698
|
}
|
|
696
699
|
await this._setInputText(input, prompt);
|
|
697
|
-
await this.page.waitForTimeout(
|
|
700
|
+
await this.page.waitForTimeout(50);
|
|
698
701
|
let sent = false;
|
|
699
702
|
for (const sel of SEND_SELECTORS) {
|
|
700
703
|
const btn = this.page.locator(sel).last();
|
|
@@ -867,7 +870,11 @@ export class DeepSeekBrowser {
|
|
|
867
870
|
const sameAsBefore = !!cur && !isNew && normText(cur) === normText(beforeText);
|
|
868
871
|
if (isNew && cur === last) {
|
|
869
872
|
stable++;
|
|
870
|
-
|
|
873
|
+
// `stabilityChecks` / `stabilityDelayMs` are the real knobs here.
|
|
874
|
+
// They used to be dead config (hardcoded 2 checks with an 800ms tick),
|
|
875
|
+
// so the FIN-loop always cost ~1.6s per answer. Defaults are now
|
|
876
|
+
// 2 checks x 400ms (~0.8s saved per turn) and the values are honored.
|
|
877
|
+
if (stable >= Math.max(1, this.stabilityChecks - 1)) {
|
|
871
878
|
if (isNew || !(await this._isGenerating())) {
|
|
872
879
|
this._askDebug('RETURN stable curLen=' + cur.length);
|
|
873
880
|
return cur;
|
|
@@ -880,7 +887,7 @@ export class DeepSeekBrowser {
|
|
|
880
887
|
if (isNew)
|
|
881
888
|
last = cur;
|
|
882
889
|
this._askDebug('FIN-loop isNew=' + isNew + ' sameAsBefore=' + sameAsBefore + ' stable=' + stable + ' curLen=' + cur.length + ' lastLen=' + last.length + ' netFresh=' + netFresh);
|
|
883
|
-
await this.page.waitForTimeout(
|
|
890
|
+
await this.page.waitForTimeout(Math.max(0, this.stabilityDelayMs));
|
|
884
891
|
}
|
|
885
892
|
if (last && (normText(last) !== normText(beforeText) || this._netCapture)) {
|
|
886
893
|
this._askDebug('RETURN last len=' + last.length);
|
package/dist/config.js
CHANGED
|
@@ -36,8 +36,8 @@ export const DEFAULTS = {
|
|
|
36
36
|
browser: {
|
|
37
37
|
answerTimeoutMs: 180000,
|
|
38
38
|
askRetries: 3,
|
|
39
|
-
stabilityChecks:
|
|
40
|
-
stabilityDelayMs:
|
|
39
|
+
stabilityChecks: 2,
|
|
40
|
+
stabilityDelayMs: 400,
|
|
41
41
|
minSendIntervalMs: 15000,
|
|
42
42
|
rateLimitWaitMs: 300000,
|
|
43
43
|
maxRateLimitRetries: 6,
|
package/dist/i18n.js
CHANGED
|
@@ -306,7 +306,7 @@ const CATALOG = {
|
|
|
306
306
|
ru: 'Использование: /config [menu | list | get <путь> | set <путь> <значение> | reset <путь> | path | lang <ru|en>]',
|
|
307
307
|
en: 'Usage: /config [menu | list | get <path> | set <path> <value> | reset <path> | path | lang <ru|en>]',
|
|
308
308
|
},
|
|
309
|
-
'cfg.saved': { ru: 'Сохранено: {v} = {value}', en: 'Saved: {v} = {value}' },
|
|
309
|
+
'cfg.saved': { ru: 'Сохранено: {v} = {value} ({file})', en: 'Saved: {v} = {value} ({file})' },
|
|
310
310
|
'cfg.reset': { ru: 'Сброшено к дефолту: {v}', en: 'Reset to default: {v}' },
|
|
311
311
|
'cfg.value': { ru: '{v} = {value}', en: '{v} = {value}' },
|
|
312
312
|
'cfg.unknown_key': { ru: 'Неизвестный параметр: {v}', en: 'Unknown setting: {v}' },
|
|
@@ -316,6 +316,10 @@ const CATALOG = {
|
|
|
316
316
|
'cfg.keys': { ru: 'Доступные параметры:', en: 'Available settings:' },
|
|
317
317
|
'cfg.lang_set': { ru: 'Язык переключён на {v}.', en: 'Language switched to {v}.' },
|
|
318
318
|
'cfg.lang_usage': { ru: 'Использование: /config lang <ru|en>', en: 'Usage: /config lang <ru|en>' },
|
|
319
|
+
'cfg.scope_current': { ru: 'Запись конфига: {v} ({file})', en: 'Config write scope: {v} ({file})' },
|
|
320
|
+
'cfg.scope_usage': { ru: 'Использование: /config scope <project|home>. project = .zamesrc.json (в git), home = ~/.zames/. Для личных настроек (confirmations) выбери home, чтобы не коммитить их.', en: 'Usage: /config scope <project|home>. project = .zamesrc.json (committed), home = ~/.zames/. Use home for personal settings (confirmations) so they are not committed.' },
|
|
321
|
+
'cfg.scope_set': { ru: 'Запись конфига: {v} ({file})', en: 'Config write scope: {v} ({file})' },
|
|
322
|
+
'cfg.scope_bad': { ru: 'Неизвестный scope: {v}. Используй project или home.', en: 'Unknown scope: {v}. Use project or home.' },
|
|
319
323
|
// ---------- system prompt ----------
|
|
320
324
|
'prompt.answer_language': {
|
|
321
325
|
ru: 'ВАЖНО: отвечай оператору на русском языке. Весь текст в поле message инструмента respond, а также любые пояснения — на русском.',
|
package/dist/index.js
CHANGED
|
@@ -1266,11 +1266,11 @@ async function main() {
|
|
|
1266
1266
|
}
|
|
1267
1267
|
function configSetRaw(field, raw) {
|
|
1268
1268
|
const value = validateConfigValue(field, raw);
|
|
1269
|
-
writeConfigValue('
|
|
1269
|
+
writeConfigValue('home', field.path, raw);
|
|
1270
1270
|
setConfigRuntime(field.path, value);
|
|
1271
1271
|
}
|
|
1272
1272
|
function configResetField(field) {
|
|
1273
|
-
resetConfigValue('
|
|
1273
|
+
resetConfigValue('home', field.path);
|
|
1274
1274
|
// Reset the runtime value to the default.
|
|
1275
1275
|
const def = getByPath(DEFAULTS, field.path);
|
|
1276
1276
|
setConfigRuntime(field.path, def);
|
|
@@ -1414,6 +1414,7 @@ async function main() {
|
|
|
1414
1414
|
console.log(theme.assistant(t('cfg.saved', {
|
|
1415
1415
|
v: key,
|
|
1416
1416
|
value: JSON.stringify(getByPath(config, key)),
|
|
1417
|
+
file: CONFIG_PATHS.HOME_CONFIG,
|
|
1417
1418
|
})));
|
|
1418
1419
|
return;
|
|
1419
1420
|
}
|
package/dist/net-capture.js
CHANGED
|
@@ -133,7 +133,12 @@ export function extractAnswer(body) {
|
|
|
133
133
|
}
|
|
134
134
|
// Saves the DeepSeek network response body to disk for post-mortem analysis.
|
|
135
135
|
// The files live in ~/.zames/net-log — from them the real answer format is visible.
|
|
136
|
+
// DEBUG ONLY: disabled unless ZAMES_NET_DEBUG=1. It writes a file per network
|
|
137
|
+
// response (thousands of files / tens of MB) and is not needed for the agent
|
|
138
|
+
// to work — the answer is taken from extractAnswer() in memory.
|
|
136
139
|
export async function dumpNetBody(url, body) {
|
|
140
|
+
if (!process.env.ZAMES_NET_DEBUG)
|
|
141
|
+
return;
|
|
137
142
|
try {
|
|
138
143
|
const dir = path.join(os.homedir(), '.zames', 'net-log');
|
|
139
144
|
await fs.mkdir(dir, { recursive: true });
|