Repository navigation
feat(agents): portable harness extensions (agents/harness/extensions) - #2511
Draft
mattzcarey wants to merge 2 commits into
Draft
mattzcarey wants to merge 2 commits into
mattzcarey wants to merge 2 commits into
Conversation
…s of the top five pi packages
🦋 Changeset detectedLatest commit: 9c69f79 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
🔴 agents import sizes: 1 entry point over threshold
Changed exports (19)
How this worksEach runtime export is bundled on its own, minified, and gzipped. Changes smaller than 100 B, or smaller than 1% and 1 KiB, are ignored. Growth over 10% or 5 KiB is marked 🔴. This report is informational and does not fail CI. The workflow artifact contains every measurement. Compared |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
…mmands, events, storage, native tools and metadata
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.
Adds
agents/harness/extensions(experimental): one extension format for PiHarness, OpenCodeHarness, ThinkHarness and the container harness. An extension is a function of its context, and a harness takes an array of them. The names follow OpenCode 2's plugins (OpenCode Reloaded). PiHarness runs them today.RFC with the per-harness mapping, what can't be ported, and known limits:
design/rfc-portable-harness-extensions.md.flowchart LR ext["extensions: (ctx) => …"] -->|transform| domains[("tool · instructions · skill · command<br/>rebuilt from base, every transform once")] ext -->|hook / event.on| hooks["execute.before · execute.after · events"] natives["native pi extensions"] -->|base of the tool draft| domains domains -->|snapshot| view["registry view: one 'agents.extensions'<br/>+ one pi extension per deferred tool"] view --> pi["pi-durable"] pi -->|"ToolTask / GenerationTask hooks"| hooks hooks -->|"ask"| req[("requests() / reply()")]What an extension can do:
ctx.tool.add,tool.transformdeferredtools are offered once a session activates them (activateon a result, orsession(id).tools.activate)tool.hookexecute.before(edit,block,ask) andexecute.after(replace result), on native tools tooinstructions.set,skill.add,command.addagents/skillssources, slash commandsevent.onsession.created,message.end,tool.end,turn.endstorage(ns).session(id)scopedsession(id)submit,note,tools.activate / deactivate / offeredcall.ask,call.updatehost.test.tsreproduces each of the post's bugs.call.askkeys its request on a memo of the pi tool task. After a crash, pi reruns the safe tool andaskreturns the stored answer. A tool that asks must bereplay: "safe".{ prompt }result becomes an ordinary durable submission.ctx.supports().The five most downloaded pi packages, ported in
ported-extensions.tsand run on PiHarness inextensions.test.ts:mcp_enable, one transform over the catalog (nounregisterTool),/mcpweb_enableactivates deferred search/fetch tools per session; pages in session storagesubagentruns a child session; skills; prompt template as a commandcall.ask({ kind: "select" }), answered withreply(), across a crashKnown limits (in the RFC): a parked
askkeeps the object awake through the wake heartbeat.activateis read from the tool's own result, not from after-hooks.session.createdonly covers sessions created through the harness API.