/** * pi-tickets — exposes the tickets daemon (GitHub/GitLab/Jira issue tracking) * two ways: real per-operation Pi tools (issue_list, focus_set, * discover_fields, ...) projected from the daemon's own VehicleRegistry * (see vehicle-client.ts and @danypops/tickets' src/agent-tools/tickets-vehicle.ts), * and a `/tickets` interactive TUI for the human (see tui.ts) — a browsable * list of pooled issues across every backend, with a persistent above-editor * widget showing the current focus. Neither ever talks to a backend or opens the * daemon's SQLite ledger directly — both go through the same authenticated * client the CLI uses. * * OAuth login (`tickets auth login`) and daemon lifecycle control (`tickets * daemon stop/restart`) are deliberately NOT exposed as a tool or a TUI * command: login requires a human to open a browser link and approve * access, and stopping the daemon out from under other callers is an * operational decision that belongs to a human at a terminal, not something * an agent or a casual keypress should trigger. */ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent"; import { registerTicketsSecretsCommand } from "./secrets.js"; import { registerTicketsTui } from "./tui.js"; import { registerTicketsVehicle } from "./vehicle-client.js"; export interface PiTicketsDeps { /** Overridden in tests instead of exercising the real (daemon-talking) registerTicketsVehicle. */ registerVehicle?: typeof registerTicketsVehicle; } export default function (pi: ExtensionAPI, deps: PiTicketsDeps = {}) { registerTicketsTui(pi); registerTicketsSecretsCommand(pi); const registerVehicle = deps.registerVehicle ?? registerTicketsVehicle; // registerTicketsVehicle defers the actual registerVehicleTools() call to // session_start internally (via registerVehicleToolsWhenReady), since Pi's // extension runtime only finishes initializing (pi.getAllTools()/etc. // becoming callable) after every extension's top-level factory has // resolved. Calling it here, at factory time, is therefore safe -- and // deliberately not awaited, so a slow-starting daemon's bounded retries // never block this synchronous factory or session_start itself. void registerVehicle(pi); }