Support omp (oh-my-pi) sessions: history import and host detection

Aperta
#166 3 commenti 3 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #175 di @talbananaz — chiusa senza merge

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

Read trace/pi.py and plugin/hosts.py, then inspect the existing Pi host history and detection paths. The issue names omp's session directory and log differences, but host detection still needs a discriminator from omp's hook environment. A linked pull request is already open; completion would include importing converted sessions with source mtimes and tests for title-prefixed logs and ignored non-message entries.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem. Running under omp (it loads Claude Code plugins and sets CLAUDE_PLUGIN_ROOT), the plugin reports host claude and te history import finds nothing: ClaudeCode.history() only reads ~/.claude/projects, while omp keeps sessions in ~/.omp/agent/sessions/<cwd-folder>/<timestamp>_<id>.jsonl.

The omp log is Pi-style (tree of id/parentId entries, toolCall/toolResult, same usage fields), with two differences:

  • the first line is {"type":"title",...}, so pi_session_header (which only checks entry 0) returns {};
  • extra entry types (custom, custom_message, developer, credential_pin, model_change, ...) that must be ignored.

Proposal.

  1. trace/pi.py: make pi_session_header scan the first few entries for type == "session"; have pi_session_to_claude write timestamp and cwd on user lines (needed by claude_log_head / history import).
  2. plugin/hosts.py: add Omp(Pi) with keeps_history = True and a history() that lists omp's session dir, converting each log with pi_session_to_claude into a cache under state_root() (keep the source mtime so the "recent"/"too_old" filters work). Register in HOSTS; add omp to --host.
  3. Host detection: pick omp rather than claude when running under omp (needs a discriminator from omp's hook env; I haven't confirmed which var).
  4. Tests: fixture omp log starting with a title line; assert history lists it and pi_prompt_count ignores non-message entries.

Verified locally with a minimal patch of 1 + a history() hook on ClaudeCode: te history import --dry-run went from nothing to "2 earlier session(s) would be read", and te status showed +2 from earlier history, 44 prompts. Happy to send a PR for 1, 2, 4 if the approach is acceptable; 3 needs maintainer input.

Lingua principale
Python
Stelle
5.6k
Fork
344
Merge medio
14h 41m
PR unite (30g)
54

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/TokenEconomizer

Tutte le issue di microsoft/TokenEconomizer

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.