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

패키지
dsh-pamyat-kompakt-dsh
호환성
미검증
Harness peer 범위
>=0.2.0-rc.2
버전
3.1.4
라이선스
MIT
최근 업데이트
2026. 10. 22.

설치

검증된 bundle이 없거나 호환성 검사에 실패했습니다. 먼저 저장소 설명을 읽어 주세요. 전체 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целое ≥ 01платформаповторные заходы, если после сжатия давление выше порога
headroomTokensцелое ≥ 065536платформазапас под сжатие при расчёте порога
maxTokensцелое ≥ 1равно headroomTokensплатформапотолок вывода родной сводки
maxOverflowRetriesцелое ≥ 01платформаповторы восстановления при переполнении окна
summarizationProvider, summarizationModelстрока""платформамодель родной сводки; действуют только когда пакет отдал работу родной сводке
autoбулевоtrueплатформаfalse — платформа не подписывает автоматическое сжатие по давлению и переполнению
KeyTypeDefaultRead byMeaning
thresholdRationumber0.8platform; package — for the "nothing to select" linewindow share at which pressure counts as the threshold
retainRationumber0.16 (if retainTokens is not set)platform; package — for retention Rwindow share for the verbatim tail; the package retains at most ⌊surface × 0.5⌋
retainTokensinteger ≥ 0noneplatform; package — for retention Rexplicit retention in tokens instead of window × retainRatio; not together with retainRatio
modelPoliciesarray of policies {provider, model, …}[]platform; packagefor an exact provider/model pair with a policy the package does not change retention (native path)
compactionRetriesinteger ≥ 01platformextra passes if pressure stays above the threshold after compaction
headroomTokensinteger ≥ 065536platformcompaction headroom in the threshold computation
maxTokensinteger ≥ 1equal to headroomTokensplatformoutput cap of the native summary
maxOverflowRetriesinteger ≥ 01platformrecovery retries on context window overflow
summarizationProvider, summarizationModelstring""platformmodel of the native summary; matter only when the package has handed the work to the native summary
autobooleantrueplatformfalse — 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_AGENTmarker-step.mjsимя агента: ключ отметки, имя для реестра при аудите; должно подходить под ^[a-z][a-z0-9_-]*$
DSH_PAMYAT_KOMPAKT_DSH_CONFcontinuation-mode.mjsпуть файла настройки пакета
KOMPAKT_AGENT_ALERT, KOMPAKT_AGENT_REGISTRY, KOMPAKT_JOURNALCTL, KOMPAKT_REZHIM_FAJLcontinuation-mode.mjsто же, что ключи файла настройки, и сильнее файла
DSH_HOME, HOMEindex.mjs, marker-step.mjsкорень для меток тревог и курсора аудита ($DSH_HOME, иначе $HOME/.dsh)
INVOCATION_IDmarker-step.mjsопознаватель запуска (ставит systemd; без него — случайный UUID)
VariableWhereMeaning
KOMPAKT_AGENTmarker-step.mjsagent name: marker key, name for the registry in the audit; must match ^[a-z][a-z0-9_-]*$
DSH_PAMYAT_KOMPAKT_DSH_CONFcontinuation-mode.mjspath of the package settings file
KOMPAKT_AGENT_ALERT, KOMPAKT_AGENT_REGISTRY, KOMPAKT_JOURNALCTL, KOMPAKT_REZHIM_FAJLcontinuation-mode.mjssame as the settings file keys, and stronger than the file
DSH_HOME, HOMEindex.mjs, marker-step.mjsroot for alert marks and the audit cursor ($DSH_HOME, otherwise $HOME/.dsh)
INVOCATION_IDmarker-step.mjsrun 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 compaction service (the platform base class). The platform's static inject requires llm, tokenMeter, sessions.
  • Через ctx.get пакет берёт, если они есть: pamyat с sobytiyaSessii (ядро памяти dsh-pamyat-core, чтение журнала сессии; без него — session.events/snapshotEvents()), sessions (flush для отметки), agents (живой агент сессии).
  • Through ctx.get the package uses, when present: pamyat with sobytiyaSessii (memory core dsh-pamyat-core, session journal reading; without it — session.events/snapshotEvents()), sessions (flush for the marker), agents (the session's live agent).
  • Переопределены методы платформы summarize (наша сводка с хвостом) и compactIfNeeded (ожидание свежего usage на Codex). Добавлен compactSUderzhaniem (удержание ≤ ½ поверхности); compactRegion подменяется только на один вызов.
  • Platform methods overridden: summarize (our summary with the tail) and compactIfNeeded (waiting for fresh usage on Codex). Added: compactSUderzhaniem (retention ≤ ½ of the surface); compactRegion is replaced for a single call only.
  • Ответ summarize: summary — сводка и, если хвост подан, строка STROKA_HVOSTA («Дальше — дословный хвост журнала до сжатия (N сообщ.): …»); rawOutput — сводка без неё; provider: "dsh-pamyat-kompakt"; llmStreamCall: false; maxTokens: 0. Сигнал отмены платформы (summarize(input, agent, signal)) передаётся соседу и прерывает вызов модели сводки; отмена, как и любая ошибка, — строка журнала и родная сводка платформы.
  • summarize answer: summary — the summary plus, if the tail was supplied, the STROKA_HVOSTA line ("Дальше — дословный хвост журнала до сжатия (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 after next()), dispose, our/compaction-status (the engine pushes its this.config into the reply).

Подробно, с примерами — docs/SETTINGS.md; устройство — docs/ARCHITECTURE.md.

In detail, with examples — docs/SETTINGS.md; design — docs/ARCHITECTURE.md.