Repository navigation
Sync fork with upstream earendil-works/pi (73 commits), preserve replaceTranscript - #6
Merged
Merged
Conversation
Make SessionManager projections authoritative for provider requests, add append-only context edits and actionable turn boundaries, and preserve existing queue scheduling during continuation and recovery.
…earendil-works#9846) Since 0.86 the prompt and tool declarations live in transcript system messages, so a context handler that filters or slices messages could drop them. After extension-driven compaction this sent requests without built-in tools and made Codex emit raw tool-call text. context handlers now see the conversation only. An unchanged list keeps the transcript as is; a changed list gets the replayed prompt sections and tool declarations as one leading system message. Handler-added system messages are kept after it. Add context_with_system, which runs after every context handler on the full transcript and sends its result verbatim, for extensions that need to edit system messages per request. Dropping the leading system message is reported as an extension error. closes earendil-works#9789, closes earendil-works#9822
earendil-works#9842) - center the label independently of scrollbar visibility - clip drawing and click bounds before the scrollbar - fixes earendil-works#9136
Prevent OpenAI-compatible providers from rejecting image-only prompts. Fixes earendil-works#9797
Replace persisted inputs with strict input and passive-write submissions. Add atomic document bases, deltas, historical reads, reincarnation, reclamation, and indexed memory queries.
* docs(coding-agent): improve getting started documentation * docs(coding-agent): correct getting started details * docs(coding-agent): clarify SDK entry point * docs(coding-agent): restructure guides and references * docs(coding-agent): improve getting started guides * docs(coding-agent): refresh integration guides * docs(coding-agent): improve terminal and CLI guides * docs(coding-agent): refresh customisation guides * docs(coding-agent): clarify project trust terminology * docs(coding-agent): simplify customisation guidance * docs(coding-agent): improve runtime and reference guidance * Fix settings reference * feat(coding-agent): add Crowdin documentation sync * docs(coding-agent): separate CLI and slash command references * docs(coding-agent): correct compaction reference * docs(coding-agent): streamline package documentation * docs(coding-agent): split RPC reference documentation * Update configuration docs * Shorten config docs * docs(coding-agent): refine configuration references * docs(coding-agent): streamline settings reference * docs(coding-agent): clarify configuration reference * docs(coding-agent): clarify project trust exception * docs(coding-agent): simplify keybindings reference * docs(coding-agent): remove Crowdin integration * docs(coding-agent): turn themes reference into guide * docs(coding-agent): consolidate model and authentication docs * docs(tui): require Component.invalidate() (fixes earendil-works#9358) * docs(coding-agent): document offline catalog behavior (fixes earendil-works#8684) * docs(coding-agent): preserve established documentation routes * docs(coding-agent): reorganize documentation navigation * docs(coding-agent): correct audited behavior Clarify provider, session, local-model, Termux, TUI, SDK, debug, and extension behavior. Simplify the documentation audit to report only clear user-visible contradictions. * docs(coding-agent): fix broken documentation links
…works#9908) Separate conversation content from instructions and replace prefix/suffix wording with continuation-oriented summarization guidance. Hopefully this avoids the refusals. Fixes earendil-works#9652
Add the portable SQLite storage core, Node adapter, versioned migrations, conformance coverage, and storage benchmarks.
…works#8398) Expose theme colors as values and add theme.style() for combined styling. - @earendil-works/pi-tui gains a Color type (palette index, sRGB, OKLCH) with parseColor(), mixColors(), colorToHex(), colorToRgb(), styleText() and related helpers. - Theme JSON accepts #rgb and oklch(...) values and an optional appearance ("dark" or "light"), detected from the theme colors when omitted. - theme.style() combines tokens or concrete colors with text attributes; theme.colors exposes concrete colors, including the terminal's reported default colors (OSC 10/11) for tokens set to "". - Terminals with TERM=*-direct are detected as truecolor.
Replace the alternate tracker implementations with the optimized immutable overlay, validate draft placements as strict JSON, and document the ownership contract. Consolidate tracker tests and benchmarks around the canonical implementation.
Add typed document definitions, atomic Session transactions, complete commit publication, task/document lifecycle handling, and paginated Tx scans. Share Chord's strict JSON copier across draft placements and durable ownership boundaries.
… extensions Temporary git extensions (-e git:...@ref) were cached in a folder keyed only by host and repo path. After changing the pinned ref, pi reused the old checkout without refreshing it and kept loading the first downloaded commit. Include the ref in the temporary folder hash so each ref gets its own checkout. Unpinned sources keep their existing folder. closes earendil-works#9982
… offset/limit Strict tool schemas make models send null for omitted optional fields. The read renderer only treated undefined as missing, so full-file reads rendered as "path:1". fixes earendil-works#9996
Replace the tsgo native preview with typescript@7.0.2 and port the check scripts to the TS 7 API. Target ES2024, drop useDefineForClassFields: false and unused decorator options, and enable verbatimModuleSyntax. Replace tsx with node plus the source resolver hook, passed to --import as a file URL. closes earendil-works#9965
Closing the last overlay hid the terminal cursor. If an extension closed an overlay during session shutdown, this ran after stop() had restored the cursor, leaving the shell with an invisible cursor. closes earendil-works#10026
Successful RPC prompt, steer, and follow_up responses include
data.disposition ("handled", "queued", or "started" for prompt), so clients
know whether to wait for agent_settled.
fixes earendil-works#9098
Model-level samplingParams were only merged by streamSimple(). Direct stream()/complete() calls, such as extensions using modelRegistry.complete(), dropped them. The OpenAI-compatible adapters now merge model defaults with request keys, and request keys take precedence. closes earendil-works#9506
GLM models on Mistral send empty content deltas at the start of a response, alongside tool call fragments, and sometimes mid-thinking. Each one opened an empty text block, and a mid-thinking one split thinking into two blocks, which Mistral rejects on replay with "Expected at most one leading ThinkChunk". closes earendil-works#9674
A new session was only written to disk once the first assistant message existed. If pi exited during the first turn (Ctrl+C twice while streaming, or the process was killed), the user's prompt was lost and the session never appeared in /resume. The file is now created as soon as the session has a user or assistant message. A session with only setup entries (model, thinking level) still stays in memory, so starting pi and quitting without chatting leaves no file. Forking uses the same rule through a shared helper, so the two paths cannot drift apart and write the header twice (earendil-works#1672). closes earendil-works#10000
* fix(ai): upgrade openai SDK to 7.19.0
Adds the "fast" service tier to the SDK types, needed to price
GPT-6 Fast mode requests correctly. Drops the local
prompt_cache_options type, which the SDK now defines.
* fix(coding-agent): check Cloudflare compat request via fetch instead of SDK mock
pi-ai now resolves its own nested openai 7.x while evals keeps 6.x at the
root, so vi.mock("openai") in coding-agent no longer reached pi-ai's client.
Capture the outgoing request with a fake fetch and assert the URL and headers.
* fix(ai): drop any casts for stream_options and max_tokens in openai-completions
stream_options is typed by the SDK, so assign it directly. max_tokens is
deprecated by OpenAI but still needed for OpenAI-compatible providers
that reject max_completion_tokens; use a narrow cast instead of any to
avoid the deprecation warning.
GPT-6 models return service_tier "fast" for Fast mode requests (the new name for priority processing), which fell through to the 1x default. closes earendil-works#10034
# Conflicts: # .github/workflows/publish-model-catalog.yml # packages/ai/src/api/simple-options.ts # packages/coding-agent/docs/extensions.md # packages/coding-agent/src/core/agent-session.ts # packages/coding-agent/src/core/compaction/compaction.ts # packages/coding-agent/src/core/session-manager.ts
The canonical session projection introduced upstream already reflects any replaceTranscript() boundary by the time prepareNextTurnWithContext rebuilds context.messages, so _transcriptReplacedDuringRun became write-only dead state during the upstream sync merge. biome's noUnusedPrivateClassMembers caught it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…enRouter anthropic/claude-3-haiku has been delisted from OpenRouter's catalog, so it no longer type-checks against the freshly generated model-literal union, failing tsc in CI. Swap to anthropic/claude-haiku-4.5, currently listed with the same anthropic-messages api/provider shape the test needs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Merges
earendil-works/pi@main(73 commits ahead, including upstream's new"canonical session context boundaries" feature) into this fork via a real
git merge(no rebase/squash), preserving all of this fork's own commits —most importantly
pi.replaceTranscript, the extension API this fork existsto provide.
replaceTranscriptneeded one internal (non-behavioral) change, no contractchange. The signature, options (
reason,source,details,deliverAs),and delivery semantics (
"steer"at end of current turn,"followUp"oncesettled,
"nextTurn"with the next prompt) are unchanged and still workend-to-end, confirmed by the existing dedicated test
(
packages/coding-agent/test/transcript-replacement-delivery.test.ts,including the test that drives a real tool call and asserts the next
provider request contains only the replacement, not the discarded history).
Why no contract change was needed: upstream's new architecture makes
SessionManager.buildSessionProjection()the single authoritative source forwhat the model sees on every request, replacing the old pattern of trusting
whatever
context.messagesa caller passed in.replaceTranscriptalreadypersisted its effect as a session entry (
appendTranscript()writing a"transcript"boundary entry) rather than only mutating in-memory context, andthe shared boundary-scanning logic that treats
"transcript"as an end-of-contextboundary (alongside
"compaction") already existed at the merge base. So onceagent-session.ts'sprepareNextTurnWithContextwas updated (per upstream) toalways rebuild
context.messagesfrombuildSessionProjection(), it picked upan applied transcript replacement automatically — no transcript-specific logic
needed to change.
One internal cleanup fell out of this:
AgentSession's private_takeTranscriptReplacementForNextTurn()used to manually splice the replacedmessages into the next-turn context. That splice is now redundant (the
projection rebuild does it), so the method was simplified away and the
now-write-only
_transcriptReplacedDuringRunflag was deleted (caught bybiome's
noUnusedPrivateClassMembers). No externally visible behavior change.Notable merge decisions
packages/coding-agent/src/core/session-manager.ts: fork'sTranscriptEntrytype (backs
replaceTranscript) and upstream's newContextEditEntrytype(backs upstream's
context_edit/actionable turn-boundary events) areindependent additions — kept both.
packages/coding-agent/src/core/compaction/compaction.ts: adopted upstream'sprojection-based rewrite of
prepareCompaction()wholesale. It alreadyhandles the
"transcript"boundary correctly for free, becausebuildContextEntries()treats"transcript"and"compaction"as the samekind of boundary and truncates the projection at whichever is most recent.
packages/ai/src/api/simple-options.ts: kept fork'slogprobs/topLogprobsfields (from the logprobs-capture feature); took upstream's relocation of
samplingParamsmodel-default merging into each OpenAI-compatible adapter'sbuildParams()(fixes those defaults being dropped on directstream()/complete()calls that bypassstreamSimple()). Verified noother adapter (Anthropic, Google, Bedrock, Mistral) reads
samplingParams,so nothing regresses.
packages/coding-agent/docs/extensions.md: upstream split this doc intoseveral smaller files and rewrote the remainder in a terser style; took
upstream's version and added a concise
pi.replaceTranscript()section inthe new "Context and session changes" section, in the same terse style,
linking to the existing
skill-state.tsexample..github/workflows/publish-model-catalog.yml: kept deleted (this forkdeliberately stopped publishing to the upstream model catalog in
571f18f;upstream's further edits to that workflow don't apply here).
Testing
packages/coding-agent/test/transcript-replacement-delivery.test.ts,skill-state-extension.test.ts,extensions-runner.test.ts,extensions-discovery.test.ts,suite/agent-session-boundaries.test.ts,suite/agent-session-compaction.test.ts,compaction-summary-reasoning.test.ts,session-context-edit.test.ts, and thesession-manager/suite all pass(191+ tests) after conflict resolution and after the dead-flag cleanup.
npm run checkpasses clean (biome, pinned-deps, runtime-deps, ts-imports,entry-graphs, shrinkwrap, install-lock, tsc, browser-smoke).
packages/coding-agent,packages/ai,packages/agent,packages/chord,packages/client, plus./test.shforthe rest): 2465+ passed in
coding-agentalone, ~5900 total across packages.The handful of remaining failures were individually root-caused and are all
pre-existing environment gaps, not merge regressions — confirmed by checking
that the affected source/config lines are byte-identical between this fork's
pre-merge tip and
upstream/main(i.e. the same failure would occur runningeither branch's tests in this sandbox):
session-backends/sqlite-node,agent,client) failon
Cannot find package '.../dist/...'for cross-package subpath imports(e.g.
@earendil-works/pi-ai/utils/uuid,@earendil-works/chord) thattheir
vitest.config.tsdoesn't alias to source — those packages need aprior
npm run build, which wasn't run here per this repo's "never runnpm run buildunless requested" rule.findtool tests fail because this sandbox's installedfdis v8.6.0,which predates the
--no-require-gitflag the tool passes.packages/aitest (anthropic-sse-parsing.test.ts) fails because thelive models.dev/OpenRouter catalog (fetched fresh into the gitignored
packages/ai/src/providers/data/*.json) no longer listsanthropic/claude-3-haikuon OpenRouter — the same live-catalog-driftclass of issue this fork's own logprobs commit (
d478246) alreadydocumented as pre-existing and reproducible with zero diff.
packages/chordfuzz test (state-fuzz.test.ts) timed out at thedefault 5000ms running 100 randomized seeds; looks like sandbox CPU
headroom, not a correctness issue.
🤖 Generated with Claude Code