Commit Graph

48 Commits

Author SHA1 Message Date
_Kerman
3f7760717d cleanup(session): isolate trajectory inspection 2026-07-28 11:39:53 +08:00
_Kerman
b483d8fef2 docs: sync compaction inspection contracts 2026-07-28 10:28:25 +08:00
_Kerman
ed67ad53d2 refactor(agent): return request retry action 2026-07-27 21:17:49 +08:00
_Kerman
b36a82fc98 Merge branch 'master' into xtr/agent-loop-message-machine 2026-07-24 22:48:18 +08:00
_Kerman
b73eb7663c refactor(agent-loop): simplify observable state machine 2026-07-24 21:18:48 +08:00
Tianyi Cui
a5a0cad46a Merge branch 'worktree/pr343-retarget-latest-master' into worktree/pr344-retarget-stack
# Conflicts:
#	scripts/type-equiv.manifest.json
2026-07-23 00:19:53 +08:00
Tianyi Cui
58a531ebf5 Merge refreshed docs/i18n-batch-core into docs/i18n-batch-cds-postmortem
# Conflicts:
#	.agents/notes/README.i18n.yaml
#	.agents/notes/README.zh.md
#	docs/core-data-structures/bash.md
#	docs/core-data-structures/code-runtime.md
#	docs/core-data-structures/compaction.md
#	docs/core-data-structures/scope.md
#	docs/core-data-structures/session-query.md
#	docs/core-data-structures/user-interaction.md
#	docs/core-data-structures/web.md
#	docs/rfc/README.md
#	scripts/translation-pairing.manifest.json
#	scripts/type-equiv.manifest.json
2026-07-22 22:26:24 +08:00
Yichen Jiang
32d786c439 feat(session): add cross-session references 2026-07-21 16:46:48 +08:00
Tianyi Cui
7aee299bda docs(compact): correct pruning surface contracts 2026-07-20 17:02:28 +08:00
Tianyi Cui
6b44d01bc8 Merge master into compact-tool-result-prune 2026-07-20 16:41:59 +08:00
Tianyi Cui
e8eddc7ef8 Rename RFCs to Agent Notes 2026-07-19 22:52:03 +08:00
Tianyi Cui
9c5b86051b Merge master into tool-result pruning
Retarget the pruning feature onto the merged compaction foundation.

Adapt content-only tool-result rewrite validation to the session-owned surface manager, migrate the demo wiring to repl-agent, and refresh generated type, catalog, and website contracts while preserving pressure and overflow pruning behavior.
2026-07-19 17:54:55 +08:00
Tianyi Cui
85ae684887 docs: sync type-equivalent JSDoc 2026-07-19 12:40:56 +08:00
Tianyi Cui
86a8046c44 Merge remote-tracking branch 'origin/master' into compact-post-step-overflow-recovery 2026-07-19 12:38:44 +08:00
Tianyi Cui
5dcf6095cb docs: include JSDoc in type-equiv blocks 2026-07-19 12:25:40 +08:00
Tianyi Cui
7be78c7d4c Merge latest origin/master into compact-post-step-overflow-recovery
# Conflicts:
#	docs/agent-lifecycle.md
#	docs/architecture.md
#	docs/cookbook/extension-cookbook.i18n.yaml
#	docs/cordis-catalog/events.md
#	docs/cordis-catalog/services.md
#	docs/event-producer-consumer.md
#	docs/rfc/INDEX.md
#	docs/rfc/implemented/architecture/2026-07-05-reconstructable-requests.md
#	docs/rfc/implemented/architecture/2026-07-15-replay-token-meter-service.i18n.yaml
#	docs/rfc/implemented/architecture/2026-07-15-replay-token-meter-service.md
#	docs/rfc/implemented/architecture/2026-07-15-replay-token-meter-service.zh.md
#	docs/rfc/implemented/feature/2026-06-18-compaction-capability-seam.md
#	docs/rfc/implemented/feature/2026-07-07-session-prefix.md
#	packages/compact/compact-basic/README.md
#	packages/compact/compact-basic/src/config.ts
#	packages/compact/compact-basic/src/index.ts
#	packages/compact/compact-basic/src/summarizer.ts
#	packages/compact/compact-basic/tests/compact-basic.spec.ts
#	packages/compact/compact-basic/tests/compact-loop-repro.spec.ts
#	packages/compact/compact/README.md
#	packages/cordis/tool-cordis/src/api-catalog.ts
#	packages/core/agent-loop/src/loop.ts
#	packages/core/agent-loop/tests/cancel.spec.ts
#	packages/llm/llm-deepseek/src/adapter.ts
#	packages/llm/llm-pi-ai/README.md
#	packages/llm/llm-pi-ai/src/stream.ts
#	packages/llm/llm-pi-ai/tests/convert.spec.ts
#	packages/llm/llm/README.md
#	packages/llm/llm/src/index.ts
#	packages/llm/llm/tests/service.spec.ts
#	scripts/gen-doc-graphs.ts
2026-07-19 12:06:23 +08:00
Tianyi Cui
7c65e12a42 Merge branch 'codex/simp-trim-hook-snapshot-noise' into codex/simp-compaction-surface
# Conflicts:
#	docs/rfc/implemented/feature/2026-06-18-compaction-capability-seam.md
#	packages/compact/compact-basic/README.md
#	packages/compact/compact-basic/src/index.ts
#	packages/compact/compact-basic/tests/compact-basic.spec.ts
#	packages/compact/compact/README.md
#	packages/compact/compact/src/index.ts
2026-07-18 12:07:34 +08:00
Tianyi Cui
06ea8643ff Merge newest origin/master into token-meter-service 2026-07-17 22:49:54 +08:00
Tianyi Cui
f943bc8d4c Merge latest origin/master into token-meter-service 2026-07-17 22:38:46 +08:00
Tianyi Cui
7a2d5cd28d Merge master into codex/simp-session-log-representation 2026-07-17 22:33:42 +08:00
Tianyi Cui
b79e7a5e30 Merge master into codex/simp-session-log-representation 2026-07-17 22:20:06 +08:00
Tianyi Cui
847a1a1a5a Merge remote-tracking branch 'origin/master' into worktree/provider-routed-llm-adapters
# Conflicts:
#	docs/cordis-catalog/services.md
#	docs/event-producer-consumer.md
#	packages/core/session/README.md
#	packages/core/session/tests/tool-pairing.spec.ts
#	website/zh-CN/api/harness/sessions.md
2026-07-17 22:07:37 +08:00
Hypatia May
ba4a57c7d1 refactor(compact): align pruning contracts (round 3) 2026-07-16 18:51:26 +08:00
Hypatia May
171bae5c20 fix(compact): harden pruning integration (round 2) 2026-07-16 18:28:31 +08:00
Hypatia May
ce96104a77 feat(compact): prune tool results before summarization (round 1) 2026-07-16 18:02:15 +08:00
Hypatia May
5ff491e3a2 Merge remote-tracking branch 'origin/token-meter-service' into compact-post-step-overflow-recovery
# Conflicts:
#	docs/core-data-structures/compaction.md
#	docs/rfc/implemented/architecture/2026-07-15-replay-token-meter-service.i18n.yaml
#	docs/rfc/implemented/architecture/2026-07-15-replay-token-meter-service.md
#	docs/rfc/implemented/architecture/2026-07-15-replay-token-meter-service.zh.md
#	docs/rfc/implemented/feature/2026-06-18-compaction-capability-seam.md
#	examples/coding-agent/cordis.yml
#	packages/compact/compact-basic/README.md
#	packages/compact/compact-basic/src/automatic.ts
#	packages/compact/compact-basic/src/config.ts
#	packages/compact/compact-basic/src/index.ts
#	packages/compact/compact-basic/tests/compact-basic.spec.ts
2026-07-16 16:18:16 +08:00
Ziya
5270dcd61d docs(i18n): core-data-structures and postmortem batch — 22 bilingual pairs
core-data-structures 18 篇(core.md 因超长仍在产出、随后补)、
postmortem 3 篇与 RFC 前门 README 配对;流水线 + 二遍校验产出。
生成文件 docs/rfc/INDEX.md(gen-rfc-index 产物)列入排除。中文侧
页内锚点统一指向英文侧锚名,满足配对门禁的链接目标一致规则。
2026-07-15 23:11:25 -07:00
Hypatia May
5c243e8a8d refactor(token-meter): simplify singleton service (round 1) 2026-07-16 12:58:07 +08:00
Tianyi Cui
8eccd5416e Document restored compaction result fields 2026-07-15 17:26:28 +08:00
Hypatia May
12484104c8 feat(compact): recover context overflow (PR3 phase 2) 2026-07-15 16:50:44 +08:00
Hypatia May
f038780ff6 feat(llm): add replay token metering (PR2 round 1) 2026-07-15 14:47:29 +08:00
Hypatia May
cc546c4580 feat(compact): move pairing helpers (PR1 round 1) 2026-07-15 13:22:44 +08:00
Yichen Jiang
815365dbbe Merge remote-tracking branch 'origin/master' into worktree/provider-routed-llm-adapters
# Conflicts:
#	docs/config-catalog.md
#	docs/cordis-catalog/events.md
#	docs/cordis-catalog/services.md
#	docs/core-data-structures/core.md
#	docs/event-producer-consumer.md
#	docs/persistence-catalog.md
#	examples/acp-agent/tests/snapshots/advanced-toolchain/session.1.jsonl
#	examples/acp-agent/tests/snapshots/advanced-toolchain/session.2.jsonl
#	examples/acp-agent/tests/snapshots/advanced-toolchain/session.jsonl
#	examples/acp-agent/tests/snapshots/both-mode-turn/session.jsonl
#	examples/acp-agent/tests/snapshots/hook-cc-pretool-ask/session.jsonl
#	examples/acp-agent/tests/snapshots/skill-load/session.jsonl
#	examples/acp-agent/tests/snapshots/text-turn/session.jsonl
#	examples/sandbox-acp-agent/cordis.yml
#	examples/sandbox-acp-agent/tests/snapshots/escalation-approved/session.jsonl
#	examples/sandbox-acp-agent/tests/snapshots/escalation-rejected/session.jsonl
#	examples/sandbox-acp-agent/tests/snapshots/mode-switching/session.jsonl
#	packages/compact/compact-basic/README.md
#	packages/compact/compact-basic/src/index.ts
#	packages/compact/compact-basic/tests/compact-basic.spec.ts
#	packages/core/agent-loop/README.md
#	packages/core/agent-loop/src/loop.ts
#	packages/core/agent-loop/tests/properties.spec.ts
#	packages/core/session/README.md
#	packages/core/session/src/types.ts
#	packages/core/session/tests/derived-cache.spec.ts
#	packages/llm/llm-deepseek/src/index.ts
#	packages/llm/llm-pi-ai/README.md
#	packages/llm/llm-pi-ai/src/adapter.ts
#	packages/llm/llm-pi-ai/src/convert.ts
#	packages/llm/llm-pi-ai/tests/adapter.spec.ts
#	packages/llm/llm/README.md
#	packages/llm/llm/src/call-config.ts
#	packages/llm/llm/src/index.ts
#	packages/ui/acp-agent/src/index.ts
#	packages/ui/acp/tests/harness.ts
#	packages/ui/jsonrpc/README.md
#	packages/ui/jsonrpc/src/server.ts
#	packages/ui/stdio-agent/README.md
#	packages/ui/stdio-agent/src/index.ts
#	python/sdk/README.i18n.yaml
2026-07-14 22:17:50 +08:00
Yichen Jiang
e547980d77 feat(llm): route adapters by provider 2026-07-14 21:57:52 +08:00
Tianyi Cui
f28b1bb4bf Merge branch 'codex/simp-trim-hook-snapshot-noise' into codex/simp-compaction-surface
# Conflicts:
#	docs/cordis-catalog/services.md
#	docs/core-data-structures/compaction.md
#	packages/compact/compact/src/index.ts
2026-07-14 18:45:25 +08:00
Tianyi Cui
d7de8a8d13 refactor: narrow compaction surface 2026-07-14 01:24:20 +08:00
Tianyi Cui
148046b9c8 docs: rebalance prose cleanup and add trimming skill 2026-07-13 23:27:00 +08:00
Tianyi Cui
c45d7927cf docs: tighten prose audit after master retarget 2026-07-13 16:24:32 +08:00
Yichen Jiang
fd1071392c docs(compact): sync the compactIfNeeded prose signature with the sessionPrefix parameter
The seam gained sessionPrefix between fullSystemPrompt and signal in
18d478bc, but the compact README member table and the compaction
core-data-structures page still showed the 3-arg form and listed only
agent/system/signal as what pre-step supplies. The generated service
catalog was already correct; only these two prose homes drifted.
2026-07-08 22:40:38 +08:00
Tianyi Cui
7539231eca compact: the summary's provenance records its call envelope
compact/summary gains { model, maxTokens? } — the envelope the
summarize call actually used, reported by the backend that made the
call: summarize() now returns { summary, model, maxTokens? } instead of
bare blocks, so an overriding backend (template or remote summarizer)
reports its own envelope honestly and compactRegion logs it. 'Which
model wrote this summary' becomes answerable from the log alone, and
the one-shot summarize request — outside the loop's header-event fold
by design — is reconstructable from log + code (the reconstructability
RFC's scope statement).
2026-07-06 03:21:29 +08:00
Tianyi Cui
8510986909 compact: summarize is a direct one-shot llm/stream call, not a loop step
The summarization request no longer dispatches agent/request — that seam
shapes the loop's conversation requests; a hand-built one-shot's
interception surface is llm/stream, like every other direct call. The
model comes from summarizationModel falling back to the agent's own. The
turn/step parameters existed on the compact seam only to feed the
agent/request dispatch and leave compactIfNeeded/compactRegion.

Groundwork for making every conversation request a pure function of the
session log (reconstructability RFC, this branch): the seam split keeps
the loop's request path as the single thing the log must explain.

Ported from worktree-prompt-prefix-stability (PR #162) where it was
review-converged; catalog and producer/consumer graphs regenerated.
2026-07-06 02:16:11 +08:00
Hypatia May
1808570933 fix(compact): harden summarization convergence
Use maxTokens as the provider generation cap and remove the confusing stored-summary max config.

Strip reasoning blocks before storing compaction summaries, reject non-shrinking summaries, and retry bounded re-compaction when the surface remains over threshold.

Add config validation for numeric and type-shaped knobs plus unit and real-API e2e coverage for reasoning-capable summarization.
2026-06-29 16:56:44 +08:00
Hypatia May
1f35a4446d fix(compact): address PR 110 review findings
Honor cancellation and disposal around async pre-step setup before the loop can open a step or call the model.

Route compaction summarization through agent/request so router agents can select the model, and remove the stale model argument from agent/pre-step.

Document serial events and the approximate convergence bound, regenerate the Cordis catalog, and add regression coverage for router compaction, HMR cleanup, and assembly/pre-step interruption.
2026-06-29 16:02:27 +08:00
Hypatia May
b13586ff8e docs(compact): align seam docs with the pre-step seam and record session/invariants changes (CBR-003)
Codex round 1 CBR-003: several docs still described compaction as an
`agent/request` waterfall concern, and the implemented compaction RFC
claimed "No changes to dsh-session or dsh-invariants" while the diff
changed both.

- Package READMEs / JSDoc (agent, agent-loop, system-prompt, compact,
  compact-basic): compaction now lives on the serial `agent/pre-step`
  seam (fired after turn/start, before step/start); the structural guard
  is tool-pairing balance (`isToolPairingBalanced`), not step-alignment;
  the convergence bound is strict (`>=` rejects).
- architecture.md / core-data-structures/compaction.md: same seam +
  predicate + dispatch-mode updates; regenerated cordis catalog.
- Implemented compaction RFC, updated in place to describe shipped
  reality: the seam is `agent/pre-step` (@mode serial) fired before
  step/start; alignment is surface tool-pairing balance; the convergence
  invariant rejects `>=`; and the "no dsh-session/dsh-invariants changes"
  claim is corrected — dsh-session gains the tool-pairing predicate and
  dsh-invariants drops its `start <= end` replace assertion (a positional
  replace makes start > end normal).
2026-06-26 13:51:45 +08:00
Hypatia May
cec32faa4e refactor(compact): turn-agnostic retention + dedicated agent/pre-request seam
Reform the compaction blueprint so a runaway turn survives and the design
stops drifting across review rounds:

- Drop in-flight-turn protection ("layer 2"). Retention is a uniform tail→head
  whole-unit walk; the only structural guard is step-alignment. A single turn
  that alone exceeds the window now compacts its own early closed steps instead
  of being retained verbatim (the failure mode that motivated this).
- Move auto-compaction off the agent/request waterfall onto a new awaited
  agent/pre-request loop seam, fired before history derivation. Compaction
  mutates the surface; the loop derives once from the result — no double-derive,
  and a listener structurally cannot act on not-yet-derived messages.
- Tighten compactIfNeeded to required (session, system, model, signal).
- Enforce a single-pass convergence invariant in resolveConfig: reject configs
  where summarizationMaxTokens + retainTokens exceeds the threshold, so a
  compaction can never immediately re-trigger.
- Document the crash vs recoverable failure taxonomy; core session repair stays
  compaction-agnostic (a log-only orphaned compact/start is inert).
- Wire dsh-compact-basic into examples/coding-agent and add a with-key
  compaction e2e (compaction's first real-world exercise + runaway net).
- Rewrite the RFC to encode the blueprint and move it to implemented/.

The runaway-turn snapshot is a named deferred follow-up: dsh-llm-replay cannot
yet serve the interleaved summarization model call.
2026-06-26 08:59:33 +08:00
Hypatia May
aa9afcefc7 feat(compact-basic): baseline compaction backend (squashed from compact-basic)
Collapses the per-round review churn of the prior compact-basic branch into a
single clean baseline on top of compact-interface, so the upcoming retention
refactor lands as fresh, well-scoped commits rather than stacking on a history
of fixes that are being superseded.
2026-06-25 17:30:42 +08:00
Hypatia May
442f85469e refactor(compact): align compact/summary and CompactionResult on shadowed* naming 2026-06-23 16:51:20 +08:00
Hypatia May
58d798492a docs(compact): catalog the compaction seam in core-data-structures 2026-06-23 16:33:05 +08:00