@qingqingdilaiP asked for OpenMausBot's sessions in Sessions. OpenMausBot (milind-soni/OpenMausBot, npm 0.1.155) is already an agent in magpie, but its conversations were not read. It keeps its data in $OMB_DATA_DIR, else ~/.openmausbot on every system (server/config.ts): - bots.json: bots[].tasks[], one a conversation (threadId, title, "New thread" until named, and cwd once a turn pins it); - messages.db: SQLite in WAL mode (thread_id, at ms, role user|bot, kind text|activity|..., text, json; an activity's json holds tool.name, a bot text its turnId); - usage/<YYYY-MM>.jsonl: one row a turn (driverKind, model, input with cachedInput and cacheWrite included, output). internal/sessions/openmausbot.go lists each conversation as a read-only session, like Alma's and Hermes's rows: prompts, one reply a turn (a turn says a line before a tool and again after it), tools by name, title from bots.json (else the first prompt), folder from task.cwd, times from messages and usage rows. A conversation holding only a bot's greeting is left out. Its rev joins the thread's count, last time, bytes, usage rows, title and cwd, so a write to it, or a new title, reads it again while the database file looks the same. Tokens count only for API drivers (server/agents-bridge-switch.ts's CHAT_RUNTIME_DRIVERS): a bot on Claude Code, Codex, Pi or another agent CLI runs that CLI, which keeps the turn in its own session, so its tokens are counted there and would be counted twice. Fresh input is input less cache reads and writes. bots.json and the usage files are read again only when their size or time change. Dirs() and Reads/access cover messages.db. Delete refuses it: OpenMausBot keeps the database open. Tests (testdata/openmausbot is OpenMausBot 0.1.155's own data folder, written by the real app in a sandbox on mica with an OpenAI-compatible fake model, database checkpointed): - TestOpenMausBotSessions: titles, tokens, times, greeting-only threads left out, the Sessions page (2 rows, not deletable, 4 and 2 messages), Delete refused, stats (1 prompt, 1 reply, agents_list_bots once), Dirs(), the database's bytes unchanged. - TestOpenMausBotCountsCLITurnsOnce: the sample's rows with one turn on claudeAgent and one with cache read and write, cwd pinned. - TestOpenMausBotReadAgainWhenItChanges: a new title alone, then a new row with the file's time held. - skillsCounted: openmausbot says why its skills are not counted (a bot reads a SKILL.md with its file tools, and the sample has no such turn). Broken by hand, each red: CLI rows counted (claude tokens 1202/42), no turnId dedupe (team 3 messages, 2 replies), no rev check and title ignored (new title not read), cache left in fresh input (1203), greeting threads listed (4 rows). Run: gofmt -l clean. On mote (load ~20 on 18 cores, mica busier with a GUI run): go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go test -count=1 -timeout 45m ./... at 59c5b59ea (this and the yaml.v3 commit ondf2b819c6): 100 packages ok. The first run, at13cb07fde, was red in internal/sessions' TestEveryAgentSaysItsSkills (openmausbot not in skillsCounted, added here) and the root's TestNoEagerPackageRegexps (main's yaml.v3, the next commit). On Windows (xiaomi-gpu): go test -run 'OpenMausBot|Alma|Hermes' ./internal/sessions ok. After a rebase ontoea6470cb7(01c3efc4f's library change and a GUI test): vet as above, and go test . ./internal/sessions ./internal/library ./internal/catalog ok. After another onto79a30eb9c(edit/toml.go and provider/remote_follow.go perf): go vet ./..., go test . ./internal/sessions ./internal/edit ./internal/provider ok, at the pushed tree. Not tried: a conversation on a Claude Code or Codex engine in the real app (its tokens come from that CLI's own session, by design here); the live GUI (unchanged); OpenMausBot on Windows or Linux. Not covered: magpie's own engine in OpenMausBot runs Claude Code with its config in <data>/providers/magpie, a Claude home Sessions doesn't read, so those turns show nowhere yet.
1 line
2.3 KiB
JSON
1 line
2.3 KiB
JSON
[{"id":"341eb366-2641-4378-8c71-52bd4c7292c7","threadId":"ed2913c7-5021-426b-8434-2af0df746c0d","name":"Scout","title":"","description":"","soul":"","soulHash":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","notifications":true,"color":"green","mascotBody":"cursor","unread":true,"modelSelection":{"instanceId":"openaiCompat","model":"fake-model-1"},"resumeCursors":{},"createdAt":1794638499736,"tasks":[{"threadId":"ed2913c7-5021-426b-8434-2af0df746c0d","title":"TOOL: who is on the team?","createdAt":1794638536111,"updatedAt":1794638536426,"resumeCursors":{},"approvalMode":"full","autoApprove":false,"alwaysAllow":[],"unread":true,"lastThreadOrderAt":1794638536425,"askedAt":1794638536138,"lastInstanceId":"openaiCompat","usage":{"input":2403,"output":83,"costUsd":null,"turns":1,"lastTurn":{"input":2403,"output":83,"costUsd":null},"context":{"tokens":1244}},"lastContextModel":"openaiCompat:fake-model-1"},{"threadId":"301edbda-e68f-4c9c-b9da-d2a9b6ab179c","title":"Say hi, then list three fruits","createdAt":1794638499966,"updatedAt":1794638502422,"resumeCursors":{},"approvalMode":"full","autoApprove":false,"alwaysAllow":[],"unread":true,"lastThreadOrderAt":1794638502421,"askedAt":1794638502258,"lastInstanceId":"openaiCompat","usage":{"input":2405,"output":85,"costUsd":null,"turns":2,"lastTurn":{"input":1203,"output":43,"costUsd":null},"context":{"tokens":1246}},"lastContextModel":"openaiCompat:fake-model-1"},{"threadId":"3ec55eac-63f4-44d9-bbfd-a86ee201ec5f","title":"New thread","createdAt":1794638499736,"updatedAt":1794638499761,"resumeCursors":{},"unread":false,"lastThreadOrderAt":1794638499761}],"autoApprove":false},{"id":"8362c4ea-5c35-448f-9c68-9ef9dea61659","threadId":"8e80165a-834e-402b-b640-7928e8a481ef","name":"MausBot","title":"","description":"","soul":"","soulHash":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","notifications":true,"color":"chrome","unread":false,"modelSelection":{"instanceId":"openaiCompat","model":"fake-model-1"},"resumeCursors":{},"createdAt":1794638479519,"tasks":[{"threadId":"8e80165a-834e-402b-b640-7928e8a481ef","title":"New thread","createdAt":1794638479519,"updatedAt":1794638479538,"resumeCursors":{},"unread":false,"approvalMode":"full","alwaysAllow":[]}],"chiefOfStaff":true,"hidden":false,"defaultBot":{}}] |