iia-arg/dsh-plugins--packages-dsh-pamyat-kompakt-dsh ↗★ 2
dsh-pamyat-kompakt-dsh
Наша сводка внутри родного механизма сжатия платформы DSH: переопределён объявленный крючок summarize, удержание ≤ ½ поверхности, ожидание свежего usage на маршруте Codex, отметка продолжения после сжатия · Our summary inside the native compaction of the DSH platform: the declared summarize hook overridden, retention ≤ ½ of the surface, waiting for fresh usage on the Codex route, a continuation marker after compaction
インストール
検証済み bundle がないか、互換性チェックに失敗しています。先にリポジトリの説明を読んでください。 README 全文を読む ↗
ドキュメント
README 全文を読む ↗Настройка · Configuration
Конфиг движка (config элемента compaction-basic) · Engine config (config of the compaction-basic element)
Своей схемы у пакета нет: NashaSvodka наследует static Config, static inject и разбор конфига (resolveConfig) от BasicCompactionEngine. Все ключи уходят платформе; пакет сам читает только thresholdRatio, retainRatio, retainTokens и modelPolicies из уже разобранного this.config. Умолчания — из кода платформы.
The package has no schema of its own: NashaSvodka inherits static Config, static inject and config resolution (resolveConfig) from BasicCompactionEngine. All keys go to the platform; the package itself reads only thresholdRatio, retainRatio, retainTokens and modelPolicies from the already resolved this.config. Defaults come from the platform code.
| Ключ | Тип | Умолчание | Кто читает | Смысл |
|---|---|---|---|---|
thresholdRatio | число | 0.8 | платформа; пакет — для строки «выбрать нечего» | доля окна, с которой давление считается порогом |
retainRatio | число | 0.16 (если не задан retainTokens) | платформа; пакет — для удержания R | доля окна под дословный хвост; пакет удерживает не больше ⌊поверхность × 0.5⌋ |
retainTokens | целое ≥ 0 | нет | платформа; пакет — для удержания R | явное удержание в токенах вместо окно × retainRatio; вместе с retainRatio нельзя |
modelPolicies | массив политик {provider, model, …} | [] | платформа; пакет | для точной пары provider/model с политикой пакет не меняет удержание (родной путь) |
compactionRetries | целое ≥ 0 | 1 | платформа | повторные заходы, если после сжатия давление выше порога |
headroomTokens | целое ≥ 0 | 65536 | платформа | запас под сжатие при расчёте порога |
maxTokens | целое ≥ 1 | равно headroomTokens | платформа | потолок вывода родной сводки |
maxOverflowRetries | целое ≥ 0 | 1 | платформа | повторы восстановления при переполнении окна |
summarizationProvider, summarizationModel | строка | "" | платформа | модель родной сводки; действуют только когда пакет отдал работу родной сводке |
auto | булево | true | платформа | false — платформа не подписывает автоматическое сжатие по давлению и переполнению |
| Key | Type | Default | Read by | Meaning |
|---|---|---|---|---|
thresholdRatio | number | 0.8 | platform; package — for the "nothing to select" line | window share at which pressure counts as the threshold |
retainRatio | number | 0.16 (if retainTokens is not set) | platform; package — for retention R | window share for the verbatim tail; the package retains at most ⌊surface × 0.5⌋ |
retainTokens | integer ≥ 0 | none | platform; package — for retention R | explicit retention in tokens instead of window × retainRatio; not together with retainRatio |
modelPolicies | array of policies {provider, model, …} | [] | platform; package | for an exact provider/model pair with a policy the package does not change retention (native path) |
compactionRetries | integer ≥ 0 | 1 | platform | extra passes if pressure stays above the threshold after compaction |
headroomTokens | integer ≥ 0 | 65536 | platform | compaction headroom in the threshold computation |
maxTokens | integer ≥ 1 | equal to headroomTokens | platform | output cap of the native summary |
maxOverflowRetries | integer ≥ 0 | 1 | platform | recovery retries on context window overflow |
summarizationProvider, summarizationModel | string | "" | platform | model of the native summary; matter only when the package has handed the work to the native summary |
auto | boolean | true | platform | false — the platform does not subscribe automatic pressure and overflow compaction |
Удержание: R = retainTokens ?? ⌊окно × retainRatio⌋, M = min(R, ⌊surfaceTokens × 0.5⌋) (DOLYA_POVERHNOSTI = 0.5). При M ]}, не больше 4096 байт, имена вида [a-z][a-z0-9_-]{0,31}, лишние ключи запрещены. Нет файла — Codex-маркер выключен; файл негоден — исключение, и отметка для Codex запрещается. Для маршрута Claude (claude-oauth + claude-*) отметка работает независимо от файла.
Mode file: {"version":1,"codex_marker":[]}, at most 4096 bytes, names of the form [a-z][a-z0-9_-]{0,31}, extra keys forbidden. No file — the Codex marker is off; an invalid file — an exception, and the marker is refused for Codex. On the Claude route (claude-oauth + claude-*) the marker works regardless of the file.
Переменные окружения · Environment variables
| Переменная | Где | Смысл |
|---|---|---|
KOMPAKT_AGENT | marker-step.mjs | имя агента: ключ отметки, имя для реестра при аудите; должно подходить под ^[a-z][a-z0-9_-]*$ |
DSH_PAMYAT_KOMPAKT_DSH_CONF | continuation-mode.mjs | путь файла настройки пакета |
KOMPAKT_AGENT_ALERT, KOMPAKT_AGENT_REGISTRY, KOMPAKT_JOURNALCTL, KOMPAKT_REZHIM_FAJL | continuation-mode.mjs | то же, что ключи файла настройки, и сильнее файла |
DSH_HOME, HOME | index.mjs, marker-step.mjs | корень для меток тревог и курсора аудита ($DSH_HOME, иначе $HOME/.dsh) |
INVOCATION_ID | marker-step.mjs | опознаватель запуска (ставит systemd; без него — случайный UUID) |
| Variable | Where | Meaning |
|---|---|---|
KOMPAKT_AGENT | marker-step.mjs | agent name: marker key, name for the registry in the audit; must match ^[a-z][a-z0-9_-]*$ |
DSH_PAMYAT_KOMPAKT_DSH_CONF | continuation-mode.mjs | path of the package settings file |
KOMPAKT_AGENT_ALERT, KOMPAKT_AGENT_REGISTRY, KOMPAKT_JOURNALCTL, KOMPAKT_REZHIM_FAJL | continuation-mode.mjs | same as the settings file keys, and stronger than the file |
DSH_HOME, HOME | index.mjs, marker-step.mjs | root for alert marks and the audit cursor ($DSH_HOME, otherwise $HOME/.dsh) |
INVOCATION_ID | marker-step.mjs | run id (set by systemd; otherwise a random UUID) |
Дочернему agent-alert пакет передаёт AGENT_ALERT_POPYTOK=3, AGENT_ALERT_TAJMAUT=20, AGENT_ALERT_PAUZY="5 15" (процесс ограничен 100 с), journalctl — LC_ALL=C. Переменную KOMPAKT_MODEL пакет не читает: подпись model в ответе платформе берётся из экспорта KOMPAKT_MODEL соседа.
The package passes AGENT_ALERT_POPYTOK=3, AGENT_ALERT_TAJMAUT=20, AGENT_ALERT_PAUZY="5 15" to the child agent-alert (the process is limited to 100 s), and LC_ALL=C to journalctl. The package does not read KOMPAKT_MODEL: the model label in the answer to the platform comes from the sibling's KOMPAKT_MODEL export.
Службы, события, крючки · Services, events, hooks
- Служба: движок регистрируется службой
compaction(базовый класс платформы). Черезstatic injectплатформы нужныllm,tokenMeter,sessions. - Service: the engine registers as the
compactionservice (the platform base class). The platform'sstatic injectrequiresllm,tokenMeter,sessions. - Через
ctx.getпакет берёт, если они есть:pamyatсsobytiyaSessii(ядро памятиdsh-pamyat-core, чтение журнала сессии; без него —session.events/snapshotEvents()),sessions(flushдля отметки),agents(живой агент сессии). - Through
ctx.getthe package uses, when present:pamyatwithsobytiyaSessii(memory coredsh-pamyat-core, session journal reading; without it —session.events/snapshotEvents()),sessions(flushfor the marker),agents(the session's live agent). - Переопределены методы платформы
summarize(наша сводка с хвостом) иcompactIfNeeded(ожидание свежего usage на Codex). ДобавленcompactSUderzhaniem(удержание ≤ ½ поверхности);compactRegionподменяется только на один вызов. - Platform methods overridden:
summarize(our summary with the tail) andcompactIfNeeded(waiting for fresh usage on Codex). Added:compactSUderzhaniem(retention ≤ ½ of the surface);compactRegionis replaced for a single call only. - Ответ
summarize:summary— сводка и, если хвост подан, строкаSTROKA_HVOSTA(«Дальше — дословный хвост журнала до сжатия (N сообщ.): …»);rawOutput— сводка без неё;provider: "dsh-pamyat-kompakt";llmStreamCall: false;maxTokens: 0. Сигнал отмены платформы (summarize(input, agent, signal)) передаётся соседу и прерывает вызов модели сводки; отмена, как и любая ошибка, — строка журнала и родная сводка платформы. summarizeanswer:summary— the summary plus, if the tail was supplied, theSTROKA_HVOSTAline ("Дальше — дословный хвост журнала до сжатия (N сообщ.): …", "the verbatim tail follows");rawOutput— the summary without it;provider: "dsh-pamyat-kompakt";llmStreamCall: false;maxTokens: 0. The platform cancellation signal (summarize(input, agent, signal)) is passed to the sibling and aborts the summary model call; a cancellation, like any error, gives a log line and the platform's native summary.- Подписки:
session/event(сторож usage; отметка продолжения),agent/status,agent/pre-step(вставка отметки послеnext()),dispose,our/compaction-status(движок кладёт в ответ свойthis.config). - Subscriptions:
session/event(usage watchdog; continuation marker),agent/status,agent/pre-step(marker insertion afternext()),dispose,our/compaction-status(the engine pushes itsthis.configinto the reply).
Подробно, с примерами — docs/SETTINGS.md; устройство — docs/ARCHITECTURE.md.
In detail, with examples — docs/SETTINGS.md; design — docs/ARCHITECTURE.md.