feat(pi-embed): @agentic-kit/pi-embed — one pi embedding for local and cloud runs - #1728
Merged
Conversation
…ith pi entries stored verbatim
A pi extension that drains pi's append-only session into an @agentic-kit/run-log store — verbatim, in order, same code locally and in the cloud (only runId and the store differ). Draining is index-based because the session is append-only; the read position is keyed to the session header id so a switch/fork re-mirrors and the store's idempotency absorbs the duplicates. A drain advances only after a successful append, and store failures are rethrown into pi's dispatch by default rather than silently dropping entries.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
Last of the six additive
@agentic-kit/*packages: the piece that makes "local run" and "cloud run" a difference in values, not code paths. It composes the four pi extensions from the earlier PRs (#1724 log, #1725 gateway metering, #1726 self-reported metering, #1727 approvals) into one session, so there is exactly one agent loop to reason about.A laptop run is the same call with
metering: { mode: 'self-report', … }and a file store.Decisions worth knowing, since they are not obvious from the code:
meteringis a discriminated union, not two flags.gatewayis authoritative (the gateway meters what it proxies);self-reportis the own-provider-key lane. Enabling both would double-count the same tokens, so the type makes it unrepresentable.runIdis threaded into every lane that records against a run."type": "module",exportswithimportonly), so a static import would make this package un-require-able from its own CJS build — and every host already imports pi dynamically (desktop does it inbootstrap(), beforePI_CODING_AGENT_DIRis resolved).PiModuleis the three-member slice actually used.ResourceLoader, notcreateAgentSession— sostartRunbuilds one (DefaultResourceLoader+ the requiredreload()) and lets a host passcreateResourceLoaderto layer the lanes onto its own (the desktop harness's loader carries skills/prompts/templates).close()flushes, disposes, then rethrows, andflush()drains the log before usage: a delivery failure never costs the transcript, never leaks the session, and is never swallowed into a clean-looking shutdown./v1, a policy that canaskwith nowhere to ask) surfaces atcomposeRun, not at the first model call or the first sensitive tool.composeRunis exported on its own for a host that already owns session creation and only wants the ordered extension list plusflush().No transport, no new server, no second agent loop. Nothing outside
agentic/pi-embed/changes except the CI package matrix and the lockfile importer. 15 tests;pnpm test,pnpm build,pnpm lintandpnpm install --frozen-lockfileall pass locally.Link to Devin session: https://app.devin.ai/sessions/450ce6d6659c47759c184ae6ec19a2a8
Requested by: @pyramation