From 63ef12a1008311b5ee2f463c1e35265327c4c1e9 Mon Sep 17 00:00:00 2001 From: peppa-bot Date: Thu, 26 Nov 2026 19:09:28 +0000 Subject: [PATCH] =?UTF-8?q?PEP-303:=20=D0=BF=D0=BB=D0=B0=D1=88=D0=BA=D0=B0?= =?UTF-8?q?=20=D0=BB=D0=B8=D0=BC=D0=B8=D1=82=D0=B0=20=E2=80=94=20=D0=B4?= =?UTF-8?q?=D0=BE=20=D0=B4=D0=B2=D1=83=D1=85=20=D0=B7=D0=BD=D0=B0=D1=87?= =?UTF-8?q?=D0=BA=D0=BE=D0=B2=20CLI=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=20?= =?UTF-8?q?=D1=84=D1=80=D0=B0=D0=B7=D0=BE=D0=B9;=20=D0=B7=D0=B0=D0=B4?= =?UTF-8?q?=D0=B0=D1=87=D0=B8=20=D0=BE=D1=82=D0=BC=D0=B5=D1=87=D0=B5=D0=BD?= =?UTF-8?q?=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- .../pep-303-screen-watchers-own-lines/tasks.md | 16 ++++++++-------- packages/runner/src/limits.ts | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/openspec/changes/pep-303-screen-watchers-own-lines/tasks.md b/openspec/changes/pep-303-screen-watchers-own-lines/tasks.md index 4e1f4b4e..2fc526c1 100644 --- a/openspec/changes/pep-303-screen-watchers-own-lines/tasks.md +++ b/openspec/changes/pep-303-screen-watchers-own-lines/tasks.md @@ -1,16 +1,16 @@ ## 1. Распознавание экрана -- [ ] 1.1 `screen-lines.ts`: `isQuotedLine`, `ownLines`, `unbox` -- [ ] 1.2 Плашка лимита: `LIMIT_LINE_RE`/`isLimitLine`, `limitLines` через неё; мёртвое окно в вачдоге — через `limitLines` -- [ ] 1.3 Диалог кредитов: структура «вопрос → варианты внизу» -- [ ] 1.4 Меню модели и доверие папке Codex, `startQuestion`, `usageWarning` — только «свои» строки -- [ ] 1.5 Вачдог: нажатия и сообщение о кредитах — только на неизменившемся экране +- [x] 1.1 `screen-lines.ts`: `isQuotedLine`, `ownLines`, `unbox` +- [x] 1.2 Плашка лимита: `LIMIT_LINE_RE`/`isLimitLine`, `limitLines` через неё; мёртвое окно в вачдоге — через `limitLines` +- [x] 1.3 Диалог кредитов: структура «вопрос → варианты внизу» +- [x] 1.4 Меню модели и доверие папке Codex, `startQuestion`, `usageWarning` — только «свои» строки +- [x] 1.5 Вачдог: нажатия и сообщение о кредитах — только на неизменившемся экране ## 2. Тесты -- [ ] 2.1 Мок `credits`; тесты диалога в `lost-conversation.test.ts` — на нём -- [ ] 2.2 `screen-watchers.test.ts`: diff/grep с фразой и «1. Switch to Opus» — нет тревоги и нажатия; строка лимита в diff — нет `usage_limit`, подписка не помечена, агент не остановлен; настоящие плашки Claude/Codex на живом и мёртвом окне узнаются -- [ ] 2.3 Проверить, что новые тесты падают на старом коде; прогнать связанные тесты (limits, codex-recovery, start-hang, lost-conversation, subscription-*) +- [x] 2.1 Мок `credits`; тесты диалога в `lost-conversation.test.ts` — на нём +- [x] 2.2 `screen-watchers.test.ts`: diff/grep с фразой и «1. Switch to Opus» — нет тревоги и нажатия; строка лимита в diff — нет `usage_limit`, подписка не помечена, агент не остановлен; настоящие плашки Claude/Codex на живом и мёртвом окне узнаются +- [x] 2.3 Проверить, что новые тесты падают на старом коде; прогнать связанные тесты (limits, codex-recovery, start-hang, lost-conversation, subscription-*) ## 3. Завершение diff --git a/packages/runner/src/limits.ts b/packages/runner/src/limits.ts index c9b03f85..a7357057 100644 --- a/packages/runner/src/limits.ts +++ b/packages/runner/src/limits.ts @@ -17,13 +17,13 @@ const REPEAT_WINDOW_MS = 5 * 60_000; // PEP-205: Codex prints a typographic apostrophe — «You’ve hit your usage limit … try again at 8:47 PM». export const LIMIT_SCREEN_RE = /(usage limit reached|limit reached.{0,40}reset|you[’'`]ve hit your (usage )?limit|out of extra usage)/i; -// PEP-303: a banner is a line the CLI printed, so it *begins* with the limit phrase — after at most one -// glyph of the CLI («■ ⎿ ⏺ ● ✗ ⚠ ·»; not «+ - < > | : # * /» nor a frame) and the words it puts in front +// PEP-303: a banner is a line the CLI printed, so it *begins* with the limit phrase — after at most two +// glyphs of the CLI («■ ⎿ ⏺ ● ✗ ⚠ ·»; not «+ - < > | : # * /» nor a frame) and the words it puts in front // («API Error:», «Claude (AI)», «5-hour», «weekly»). A diff line («447 + out(`■ You’ve hit…`)»), grep // output, code or a comment that quotes the phrase is not a banner. Without a glyph the line may be // indented by two spaces at most: the continuation lines of a tool's output are indented by five. const LIMIT_LINE_RE = - /^(?:\s*[^\w\s"'`(\[{<>|:+\-#*\/─-╿]️?\s*|\s{0,2})(?:API Error:\s*)?(?:Claude(?: AI)?\s+|(?:\d+-hour|(?:opus\s+)?weekly)\s+)?(?:you[’'`]re\s+)?(?:usage limit reached|limit reached.{0,40}reset|you[’'`]ve hit your (?:usage )?limit|out of extra usage)/iu; + /^(?:(?:\s*[^\w\s"'`(\[{<>|:+\-#*\/─-╿]️?){1,2}\s*|\s{0,2})(?:API Error:\s*)?(?:Claude(?: AI)?\s+|(?:\d+-hour|(?:opus\s+)?weekly)\s+)?(?:you[’'`]re\s+)?(?:usage limit reached|limit reached.{0,40}reset|you[’'`]ve hit your (?:usage )?limit|out of extra usage)/iu; /** One screen line is the CLI's limit banner (see LIMIT_LINE_RE), not a quote of it. */ export const isLimitLine = (line: string): boolean => LIMIT_LINE_RE.test(line) && !isQuotedLine(line);