feat(gemini): SessionMutator stub + session-file resolver
Wires the host's mirror hook end-to-end: FindGeminiSessionFile resolves ~/.gemini/tmp/<workspace>/chats/session-<ISO>-<sid_prefix>.jsonl from the session id captured into .plexum-gemini-session, picking the most-recent match by mtime. Logs the no-op for telemetry. Real rewrite is deferred to v2: gemini-cli's tool-call id namespace doesn't match Plexum's canonical block format (and its on-disk shape is `$set`-style mutation log rather than flat append-only). When tool-call round-trip through gemini's native surface lands, the rewriter plugs into this file's path resolver.
This commit is contained in:
@@ -125,6 +125,35 @@ func (p *geminiPlugin) StreamWithAgent(ctx context.Context, modelID string, agen
|
||||
return runner.Run(ctx, p.host, agent, cliModel, p.cfg.Binary, p.cfg.ExtraArgs, req)
|
||||
}
|
||||
|
||||
// MutateSession is the session-mirror hook (decision #29x). gemini-cli
|
||||
// stores transcripts under ~/.gemini/tmp/<workspace-name>/chats/
|
||||
// session-<ISO>-<session_id_prefix>.jsonl with a `$set`-style mutation
|
||||
// log (each line either a session-meta header or `{"$set":{...}}`
|
||||
// applied in order). Tool-call records use gemini-cli's own id
|
||||
// namespace (no shape doc as of this writing) which doesn't match
|
||||
// Plexum's toolu_*-style block ids.
|
||||
//
|
||||
// v1 ships as a logged no-op: we resolve the file path so operator
|
||||
// telemetry confirms wiring, but we don't attempt to rewrite. When
|
||||
// Plexum starts routing tool-call ids through gemini's native surface
|
||||
// (preserving the round-trip), the rewriter plugs in here.
|
||||
func (p *geminiPlugin) MutateSession(ctx context.Context, req plugin.SessionMutateRequest) error {
|
||||
path, err := runner.FindGeminiSessionFile(req.Workspace)
|
||||
if err != nil {
|
||||
p.host.Log("debug", "gemini session mutate: find failed", map[string]any{
|
||||
"agent": req.AgentID, "err": err.Error(),
|
||||
})
|
||||
return nil
|
||||
}
|
||||
p.host.Log("info", "gemini session mutate (no-op v1)", map[string]any{
|
||||
"agent": req.AgentID,
|
||||
"session_path": path,
|
||||
"requested": len(req.Mutations),
|
||||
"reason": "gemini tool-call id round-trip not yet wired",
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// mapModel converts a Plexum-advertised model id into the CLI's
|
||||
// --model value. Returns "" for "gemini" (use CLI default) and
|
||||
// passes any other unrecognized id through verbatim (operator may
|
||||
|
||||
Reference in New Issue
Block a user