Skip to content

feat: integrate pi as a first-class agent / pi 作为内置 Agent 接入 - #95

Merged
chenbstack merged 1 commit into
chenbstack:mainfrom
Rladmsrl:feat/pi-agent-integration
Jul 30, 2026
Merged

feat: integrate pi as a first-class agent / pi 作为内置 Agent 接入#95
chenbstack merged 1 commit into
chenbstack:mainfrom
Rladmsrl:feat/pi-agent-integration

Conversation

@Rladmsrl

Copy link
Copy Markdown
Contributor

What

Integrate the pi CLI coding agent (@earendil-works/pi-coding-agent) as a first-class agent in Glint, alongside Claude / Codex / OMP / Grok.

Why

pi is a node-based CLI agent with its own TypeScript extension API. Like OMP/Grok, it exposes lifecycle events through extensions rather than shell hooks, so it needs the same "drop a TS extension + auto-discover" treatment as the other TS-based agents.

How

  • PiHookInstaller — drops a TS extension (glint-agent-bridge.ts) into ~/.pi/agent/extensions/ (pi's global auto-discovery dir). The extension forwards pi lifecycle events → Glint's Unix socket:
    • session_start / agent_start / agent_end / agent_settled → idle/thinking
    • tool_call / tool_result → running/thinking
    • session_before_compact → compacting
    • ask_user_question / exit_plan_mode tool calls → needsReply
    • Only fires when Glint's pane env vars are present → a pi session outside Glint is a no-op.
  • PaneAgentKind.pi — new case wired through the enum, iconKind mapping, session restore command (pi --session-id <id>, falls back to pi --continue), and agentKind(named:) matcher using exact "pi" string match (avoids false-positives on pipe / pip / copy).
  • WorkspaceStorepiHooksInstalled published state, install/uninstall methods, auto-install spec, restorePiSession toggle.
  • SettingsView — new Pi SettingsCard with install/uninstall controls + status pill.
  • Localizable.xcstrings — new UI strings localized for en + zh-Hans.

Checklist

  • PaneAgentKind.pi case added to all exhaustive switches
  • PiHookInstaller follows the same pattern as OmpHookInstaller / GrokHookInstaller
  • Exact-match process name detection (no substring contains)
  • New UI strings localized in en + zh-Hans
  • Builds clean under Xcode-beta (will verify in CI)

- Add PiHookInstaller: drops a TS extension into ~/.pi/agent/extensions/
  that forwards pi lifecycle events (session_start, agent_start, tool_call,
  tool_result, agent_end, agent_settled, session_before_compact) to Glint's
  Unix socket, mapping ask_user_question / exit_plan_mode to needsReply.
  Auto-discovered by pi on every session — no settings merge needed, and
  only fires when Glint's pane env vars are present.
- Add PaneAgentKind.pi case across the enum, iconKind, restore-command,
  and agentKind(named:) matchers (exact 'pi' string match to avoid
  false-positives on pipe/pip/copy).
- Wire WorkspaceStore: piHooksInstalled state, install/uninstall methods,
  auto-install spec entry, restorePiSession toggle (pi --session-id <id>).
- Add Pi SettingsCard in SettingsView with install/uninstall controls.
- Localize new UI strings (en + zh-Hans).
@chenbstack
chenbstack merged commit 00a47d9 into chenbstack:main Jul 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants