Skip to content

chore: add Pi extension config#1261

Open
dipree wants to merge 1 commit into
mainfrom
chore/add-pi-extension
Open

chore: add Pi extension config#1261
dipree wants to merge 1 commit into
mainfrom
chore/add-pi-extension

Conversation

@dipree
Copy link
Copy Markdown
Contributor

@dipree dipree commented May 25, 2026

https://entire.io/gh/entireio/cli/trails/424

Summary\n- Add Pi extension config for Entire hook integration\n\n## Tests\n- Not run (configuration-only change)


Note

Low Risk
Configuration-only agent hooks with best-effort subprocess calls; no changes to core Entire runtime beyond enabling Pi session capture.

Overview
Adds Pi integration so session and turn lifecycle events invoke entire hooks pi … for checkpoints and transcripts.

The checked-in extension at .pi/extensions/entire/index.ts matches what entire enable --agent pi installs: it forwards session_start, before_agent_start, agent_end, and session_shutdown with JSON on stdin (cwd, session_file, prompt), runs hooks via execFile with swallowed errors, and prepends GIT_TERMINAL_PROMPT=0 to bash tool commands so agent-driven git does not block on prompts.

A second file, .pi/extensions/entire.ts, implements a different contract (kebab-case subcommands like session-start / turn-start, session_id / session_ref, model_select, session_compact, and pi.exec with a 30s timeout). Only the entire/index.ts path is documented and used by the Entire installer; the sibling .ts file may be redundant unless Pi loads both.

Reviewed by Cursor Bugbot for commit 279ed82. Configure here.

Entire-Checkpoint: fc68295fe7ae
Copilot AI review requested due to automatic review settings May 25, 2026 12:23
@dipree dipree requested a review from a team as a code owner May 25, 2026 12:23
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 4 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 279ed82. Configure here.

Comment thread .pi/extensions/entire.ts
await callHook("session-end", {
session_id,
session_ref: sessionRef(ctx),
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenCode hooks on Pi CLI

High Severity

The new .pi/extensions/entire.ts invokes entire hooks pi with kebab-case names such as session-start, turn-start, and session-end, but the Pi agent only registers snake_case subcommands (session_start, before_agent_start, agent_end, session_shutdown). Unknown hooks return no lifecycle event, so this extension does not drive checkpoints or transcripts when it is the active handler.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 279ed82. Configure here.

Comment thread .pi/extensions/entire.ts
session_id,
session_ref: sessionRef(ctx),
});
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two Entire extensions auto-load

Medium Severity

Pi discovers both a top-level .pi/extensions/entire.ts and .pi/extensions/entire/index.ts as separate extensions, so both register the same lifecycle handlers. The incorrect root file still runs pi.exec on every event (up to 30s), duplicating work and risking slower or racy teardown alongside the correct index.ts hooks.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 279ed82. Configure here.

Comment thread .pi/extensions/entire.ts
await callHook("session-end", {
session_id,
session_ref: sessionRef(ctx),
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invalid Pi hook subcommands

High Severity

The new .pi/extensions/entire.ts extension invokes entire hooks pi with kebab-case verbs like session-start and turn-start, and sends session_ref instead of session_file. The in-tree Pi agent only registers snake_case hooks and reads session_file in ParseHookEvent, so these invocations never produce lifecycle events.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 279ed82. Configure here.

Comment thread .pi/extensions/entire.ts

import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";

export default function (pi: ExtensionAPI) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orphan extension outside installer

Medium Severity

Adding .pi/extensions/entire.ts alongside .pi/extensions/entire/index.ts introduces a second Pi extension that entire enable --agent pi never writes and UninstallHooks never removes (it only deletes the entire/ directory). Pi can auto-load both, and after uninstall only the broken top-level file may remain while AreHooksInstalled is false.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 279ed82. Configure here.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Pi agent hook configuration files under .pi/extensions/ to enable Entire’s lifecycle integration via a Pi TypeScript extension.

Changes:

  • Add Pi extension at .pi/extensions/entire/index.ts that forwards Pi lifecycle events to entire hooks pi <event>.
  • Add an additional Pi extension file .pi/extensions/entire.ts (appears to be an alternate/duplicate implementation).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.pi/extensions/entire/index.ts Pi extension that forwards Pi lifecycle events to the CLI’s entire hooks pi … handlers.
.pi/extensions/entire.ts Additional Pi extension file that dispatches different (hyphenated) hook names; likely conflicts with the CLI’s expected Pi hook verbs.

Comment thread .pi/extensions/entire.ts
Comment on lines +8 to +13
// Events forwarded:
// - session_start → entire hooks pi session-start
// - before_agent_start (first turn of a prompt) → entire hooks pi turn-start
// - agent_end → entire hooks pi turn-end
// - session_compact → entire hooks pi compaction
// - session_shutdown → entire hooks pi session-end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants