Repository navigation
refactor(runtime): register pi as a stub runtime #6466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a793653
refactor(runtime): register pi as a stub runtime
waynesun09 2aefca1
Merge remote-tracking branch 'origin/main' into pi-runtime-stub
waynesun09 c40f528
fix(runtime): harden pi stub per review-squad findings
waynesun09 6d3e6fe
fix(runtime): address fullsend-ai-review LOW findings on pi stub
waynesun09 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| package runtime | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "io" | ||
| "time" | ||
|
|
||
| "github.com/fullsend-ai/fullsend/internal/sandbox" | ||
| "github.com/fullsend-ai/fullsend/internal/ui" | ||
| ) | ||
|
|
||
| // PiRuntime is a stub implementation of the Runtime and TranscriptHandler | ||
| // interfaces for the pi agent runtime (earendil-works/pi, CLI `pi`). All | ||
| // methods are no-ops or return not-implemented errors. Subsequent PRs will | ||
| // fill in stream parsing (`pi --mode json`, per docs/json.md — confirm at | ||
| // implementation time whether `--print` is required alongside it), bootstrap, | ||
| // run execution, and transcript extraction. Tracked in #6464. | ||
| type PiRuntime struct{} | ||
|
|
||
| func (PiRuntime) Name() string { return "pi" } | ||
|
|
||
| // System returns the OTEL GenAI gen_ai.system value. Like OpenCode, pi is | ||
| // multi-provider (Anthropic, OpenAI, Google, ...), so the system is the | ||
| // runtime itself rather than a single model vendor (same precedent as | ||
| // OpenCodeRuntime; the per-message `provider` field in pi's event stream may | ||
| // allow capturing the actual vendor in a future PR). | ||
| func (PiRuntime) System() string { return "pi" } | ||
|
|
||
| // ConfigDir returns the pi config directory inside the sandbox. It is | ||
| // exported to the agent process as PI_CODING_AGENT_DIR (see EnvExports) and | ||
| // lives outside the agent-writable workspace so the target repo cannot | ||
| // rewrite the runtime's settings, extensions, or skills. | ||
| func (PiRuntime) ConfigDir() string { return sandbox.SandboxPiConfig } | ||
|
|
||
| func (PiRuntime) WorkspaceDir() string { return sandbox.SandboxWorkspace } | ||
|
|
||
| // EnvExports pins pi's config and session locations to runner-owned paths | ||
| // and disables all startup network traffic (update checks, package update | ||
| // checks, telemetry). PI_OFFLINE does not affect the inference call itself. | ||
| // Var names/semantics per earendil-works/pi docs/environment-variables.md | ||
| // (PI_CODING_AGENT_DIR, PI_CODING_AGENT_SESSION_DIR, PI_OFFLINE, | ||
| // PI_SKIP_VERSION_CHECK) — re-verify against that doc when PI_VERSION moves. | ||
| func (PiRuntime) EnvExports() []string { | ||
| return []string{ | ||
|
waynesun09 marked this conversation as resolved.
|
||
| "export PI_CODING_AGENT_DIR=" + sandbox.SandboxPiConfig, | ||
| "export PI_CODING_AGENT_SESSION_DIR=" + sandbox.SandboxPiConfig + "/sessions", | ||
| "export PI_OFFLINE=1", | ||
| "export PI_SKIP_VERSION_CHECK=1", | ||
| } | ||
| } | ||
|
|
||
| func (PiRuntime) Bootstrap(_ BootstrapInput) error { | ||
| return fmt.Errorf("pi runtime is not yet implemented") | ||
| } | ||
|
|
||
| func (PiRuntime) Run(_ context.Context, _ RunParams, _ *ui.Printer, _ time.Time, _ *RunMetrics) (int, error) { | ||
| return -1, fmt.Errorf("pi runtime is not yet implemented") | ||
| } | ||
|
|
||
| func (PiRuntime) ClearIterationArtifacts(_ string) error { return nil } | ||
|
|
||
| // TranscriptHandler stub methods — return not-implemented errors for extract | ||
| // methods (to avoid silent success claims in CI logs) and no-ops for parse | ||
| // methods (which correctly indicate "nothing found"). pi writes JSONL session | ||
| // files under PI_CODING_AGENT_SESSION_DIR, so extraction will follow the | ||
| // Claude find-and-download shape rather than OpenCode's export path (#6464). | ||
|
|
||
| func (PiRuntime) ExtractTranscripts(_, _, _ string) error { | ||
| return fmt.Errorf("pi transcript extraction not implemented (see #6464)") | ||
| } | ||
|
|
||
| func (PiRuntime) ExtractDebugLog(_, _, _ string) error { | ||
| return fmt.Errorf("pi debug log extraction not implemented (see #6464)") | ||
| } | ||
|
|
||
| func (PiRuntime) ParseTranscriptErrors(_ string) []TranscriptError { return nil } | ||
|
|
||
| func (PiRuntime) ParseTranscriptFile(_ string) (TranscriptError, bool) { | ||
| return TranscriptError{}, false | ||
| } | ||
|
|
||
| func (PiRuntime) EmitTranscriptErrors(w io.Writer, summaries []TranscriptError) { | ||
| emitTranscriptErrors(w, summaries) | ||
| } | ||
|
|
||
| // Compile-time interface assertions. | ||
| var ( | ||
| _ Runtime = PiRuntime{} | ||
| _ TranscriptHandler = PiRuntime{} | ||
| ) | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.