Class: Agent::Sessions::Adapters::Qwen

Inherits:
Base
  • Object
show all
Defined in:
lib/agent/sessions/adapters/qwen.rb

Overview

Qwen Code. PROVISIONAL: ~/.qwen does not exist on the machine this was written on (2026-08-24), so every claim here comes from tokentelemetry's working parser of the same store (resources/tokentelemetry, backend/main.py section 4) rather than from observation — the same standing the pi reader carries, and declared the same way.

Qwen is a Gemini CLI fork that kept Gemini's directory layout and adopted Anthropic's message shape, which is why its store looks like ~/.gemini's while its records read like Claude's.

Constant Summary

Constants inherited from Base

Base::FIDELITIES

Constants included from Enumeration

Enumeration::MAX_LINE_BYTES

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#base_dir, fidelity_value, homedir_config, #initialize, #locate, #retention, #retention_source, store_configs, #verify

Methods included from Enumeration

#bytes_for, #encode_project, #project_dir_name, #project_paths, #session_id_from, #sessions, #sessions_for_project, #started_at_for, #updated_at_for

Constructor Details

This class inherits a constructor from Agent::Sessions::Adapters::Base

Class Method Details

.reader_classObject



22
# File 'lib/agent/sessions/adapters/qwen.rb', line 22

def self.reader_class = Readers::Qwen

Instance Method Details

#project_path_for(path) ⇒ Object

Unlike Gemini's, the project directory is reported as a name this gem cannot decode into a path, so the recorded cwd inside the file is the only source — the same position Claude and pi are in. The predicate is mandatory: scan_jsonl_for_key stops at the first record merely CARRYING the key, so without it a record holding "cwd": null shadows a later usable one permanently.



46
47
48
# File 'lib/agent/sessions/adapters/qwen.rb', line 46

def project_path_for(path)
  scan_jsonl_for_key(path, "cwd", limit: 25) { |record| record["cwd"].is_a?(String) }&.fetch("cwd")
end

#warningsObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/agent/sessions/adapters/qwen.rb', line 29

def warnings
  list = super
  if primary_layer.exists?
    list << "Qwen's store shape is unverified — no ~/.qwen existed on the machine this " \
            "adapter was written on, so it follows tokentelemetry's parser of the same " \
            "format. If sessions or projects look wrong, please open an issue with the " \
            "first line of one chat file."
  end
  list
end