@vatio-ai/cli 0.89.0 → 0.91.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -105,7 +105,7 @@ function jsonlIn(dir) {
105
105
  .map((name) => {
106
106
  const path = join(dir, name);
107
107
  const stat = statSync(path);
108
- return { id: name.slice(0, -".jsonl".length), path, bytes: stat.size, modifiedAt: stat.mtimeMs };
108
+ return { agent: "claude-code", id: name.slice(0, -".jsonl".length), path, bytes: stat.size, modifiedAt: stat.mtimeMs };
109
109
  })
110
110
  .sort((a, b) => b.modifiedAt - a.modifiedAt);
111
111
  }
@@ -207,7 +207,8 @@ function scrub(value, counts) {
207
207
 
208
208
  const HOME = homedir();
209
209
 
210
- function redact(text, counts) {
210
+ // Also what codex-session.mjs cleans a Codex session's text with.
211
+ export function redact(text, counts) {
211
212
  let result = text;
212
213
  for (const [pattern, replacement] of SECRET_PATTERNS) {
213
214
  result = result.replace(pattern, (...match) => {
@@ -0,0 +1,223 @@
1
+ // The coding agent's own session, as Codex keeps it on this machine: one JSONL
2
+ // file per thread under $CODEX_HOME/sessions/YYYY/MM/DD/, named
3
+ // rollout-<time>-<thread id>.jsonl, with $CODEX_HOME at ~/.codex unless it is
4
+ // set. Codex gives every command it runs the thread's id in CODEX_THREAD_ID.
5
+ // Each line is {timestamp, type, payload}; the first is the session_meta, with
6
+ // the directory the session was started in.
7
+ //
8
+ // The format is Codex's and changes between its releases, so nothing here
9
+ // depends on more of it than it has to: a line is kept or dropped by its
10
+ // `type`, and everything a kept line carries is passed through as it is.
11
+
12
+ import { closeSync, openSync, readdirSync, readFileSync, readSync, statSync } from "node:fs";
13
+ import { homedir } from "node:os";
14
+ import { dirname, join, resolve } from "node:path";
15
+
16
+ import { redact } from "./claude-session.mjs";
17
+
18
+ // What the agent and the developer said and did, and where. Everything else is
19
+ // Codex's bookkeeping: events that repeat the items, token counts, turn
20
+ // settings, compaction summaries of items the file still holds.
21
+ const KEPT_TYPES = new Set(["session_meta", "response_item"]);
22
+
23
+ // Codex's own system prompt and tool list, as long as a conversation, and the
24
+ // opaque encrypted copies of reasoning and arguments.
25
+ const DROPPED_META_KEYS = ["base_instructions", "dynamic_tools"];
26
+ const DROPPED_KEYS = new Set(["encrypted_content", "encrypted_function_args"]);
27
+
28
+ // Reading every session's first line to find the ones for a directory is the
29
+ // slow part; the newest are the ones anyone sends.
30
+ const SCANNED = 200;
31
+
32
+ const THREAD_ID = /^rollout-.+-([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:_[0-9a-f-]+)?\.jsonl$/i;
33
+
34
+ export function codexHome() {
35
+ return process.env.CODEX_HOME || join(homedir(), ".codex");
36
+ }
37
+
38
+ // The sessions Codex kept for this directory, or for the nearest parent it was
39
+ // started in, newest first.
40
+ export function sessionsFor(startDir) {
41
+ const byDir = new Map();
42
+ for (const session of rollouts().slice(0, SCANNED)) {
43
+ const cwd = metaOf(session.path)?.cwd;
44
+ if (typeof cwd !== "string") continue;
45
+ const key = dirKey(cwd);
46
+ byDir.set(key, [...(byDir.get(key) ?? []), session]);
47
+ }
48
+
49
+ let dir = resolve(startDir);
50
+ for (;;) {
51
+ const sessions = byDir.get(dirKey(dir));
52
+ if (sessions) return sessions;
53
+ const parent = dirname(dir);
54
+ if (parent === dir) return [];
55
+ dir = parent;
56
+ }
57
+ }
58
+
59
+ export function sessionById(id) {
60
+ return rollouts().find((session) => session.id.startsWith(id)) ?? null;
61
+ }
62
+
63
+ // What a session is about, without cleaning it: for --list, and for picking
64
+ // the newest session that has a conversation in it.
65
+ export function describe(session) {
66
+ let firstPrompt = null;
67
+ let messages = 0;
68
+ let cwd = null;
69
+ for (const line of lines(session.path)) {
70
+ if (line.type === "session_meta") cwd ??= line.payload?.cwd ?? null;
71
+ const item = line.type === "response_item" ? line.payload : null;
72
+ if (item?.type !== "message" || !["user", "assistant"].includes(item.role)) continue;
73
+ messages += 1;
74
+ if (item.role === "user") firstPrompt ??= promptText(item.content);
75
+ }
76
+ return { ...session, title: firstPrompt, messages, cwd };
77
+ }
78
+
79
+ // The session as it is sent: only what was said and done, without images,
80
+ // with anything that looks like a secret, an email or a phone replaced and the
81
+ // home directory as ~.
82
+ export function clean(session) {
83
+ const kept = [];
84
+ const counts = { messages: 0, images: 0, redactions: 0, personal: 0 };
85
+ let startedAt = null;
86
+ let endedAt = null;
87
+ let gitBranch = null;
88
+ let cwd = null;
89
+
90
+ for (const line of lines(session.path)) {
91
+ if (!KEPT_TYPES.has(line.type)) continue;
92
+ if (line.type === "session_meta" && line.payload && typeof line.payload === "object") {
93
+ for (const key of DROPPED_META_KEYS) delete line.payload[key];
94
+ gitBranch = line.payload.git?.branch ?? gitBranch;
95
+ }
96
+
97
+ const scrubbed = scrub(line, counts);
98
+ const item = line.payload;
99
+ if (line.type === "response_item" && item?.type === "message" && ["user", "assistant"].includes(item.role)) {
100
+ counts.messages += 1;
101
+ }
102
+ if (line.timestamp) {
103
+ startedAt ??= line.timestamp;
104
+ endedAt = line.timestamp;
105
+ }
106
+ if (line.type === "session_meta") cwd ??= scrubbed.payload?.cwd ?? null;
107
+ kept.push(JSON.stringify(scrubbed));
108
+ }
109
+
110
+ return {
111
+ jsonl: kept.length > 0 ? `${kept.join("\n")}\n` : "",
112
+ ...counts,
113
+ startedAt,
114
+ endedAt,
115
+ gitBranch,
116
+ cwd
117
+ };
118
+ }
119
+
120
+ // Every session file, newest first. Compressed ones (.jsonl.zst) are old ones
121
+ // Codex packed away, and are left out.
122
+ function rollouts() {
123
+ const root = join(codexHome(), "sessions");
124
+ const files = [];
125
+ for (const year of listDir(root)) {
126
+ for (const month of listDir(join(root, year))) {
127
+ for (const day of listDir(join(root, year, month))) {
128
+ const dir = join(root, year, month, day);
129
+ for (const name of listDir(dir)) {
130
+ const match = THREAD_ID.exec(name);
131
+ if (!match) continue;
132
+ const path = join(dir, name);
133
+ const stat = statSync(path);
134
+ files.push({ agent: "codex", id: match[1].toLowerCase(), path, bytes: stat.size, modifiedAt: stat.mtimeMs });
135
+ }
136
+ }
137
+ }
138
+ }
139
+ return files.sort((a, b) => b.modifiedAt - a.modifiedAt);
140
+ }
141
+
142
+ // The first line alone, which carries the system prompt and can be long, but
143
+ // never the whole file, which can be many megabytes.
144
+ function metaOf(path) {
145
+ let fd;
146
+ try {
147
+ fd = openSync(path, "r");
148
+ const chunk = Buffer.alloc(64 * 1024);
149
+ const parts = [];
150
+ for (let total = 0; total < 4 * 1024 * 1024; ) {
151
+ const read = readSync(fd, chunk, 0, chunk.length, total);
152
+ if (read === 0) break;
153
+ const newline = chunk.subarray(0, read).indexOf(10);
154
+ parts.push(Buffer.from(chunk.subarray(0, newline === -1 ? read : newline)));
155
+ if (newline !== -1) break;
156
+ total += read;
157
+ }
158
+ const line = JSON.parse(Buffer.concat(parts).toString("utf8"));
159
+ return line?.type === "session_meta" ? line.payload : null;
160
+ } catch {
161
+ return null;
162
+ } finally {
163
+ if (fd !== undefined) closeSync(fd);
164
+ }
165
+ }
166
+
167
+ function* lines(path) {
168
+ for (const text of readFileSync(path, "utf8").split("\n")) {
169
+ if (text.trim() === "") continue;
170
+ try {
171
+ const line = JSON.parse(text);
172
+ if (line && typeof line === "object") yield line;
173
+ } catch {
174
+ // A line cut off while Codex was writing it: the session this command
175
+ // runs in is still being written.
176
+ }
177
+ }
178
+ }
179
+
180
+ function scrub(value, counts) {
181
+ if (typeof value === "string") return redact(value, counts);
182
+ if (Array.isArray(value)) return value.map((item) => scrub(item, counts));
183
+ if (!value || typeof value !== "object") return value;
184
+
185
+ // Pictures, base64 inline in a data: URL: screenshots of whatever was on
186
+ // screen.
187
+ if (value.type === "input_image") {
188
+ counts.images += 1;
189
+ return { type: value.type, omitted: true };
190
+ }
191
+
192
+ return Object.fromEntries(
193
+ Object.entries(value)
194
+ .filter(([key]) => !DROPPED_KEYS.has(key))
195
+ .map(([key, item]) => [key, scrub(item, counts)])
196
+ );
197
+ }
198
+
199
+ // Codex puts its own context in user messages too: the environment as a tag,
200
+ // and AGENTS.md under a heading of its own.
201
+ function promptText(content) {
202
+ const text = Array.isArray(content)
203
+ ? content.find((block) => block?.type === "input_text")?.text
204
+ : typeof content === "string" ? content : null;
205
+ if (!text) return null;
206
+ const trimmed = text.trimStart();
207
+ if (trimmed.startsWith("<") || trimmed.startsWith("# AGENTS.md")) return null;
208
+ return text.replace(/\s+/g, " ").trim();
209
+ }
210
+
211
+ // Windows paths compare without case, as Windows does.
212
+ function dirKey(path) {
213
+ const resolved = resolve(path);
214
+ return process.platform === "win32" ? resolved.toLowerCase() : resolved;
215
+ }
216
+
217
+ function listDir(dir) {
218
+ try {
219
+ return readdirSync(dir).sort().reverse();
220
+ } catch {
221
+ return [];
222
+ }
223
+ }
@@ -76,6 +76,7 @@ your inbox.
76
76
  \`show\` prints the chat you are in, with every tool call the agent made. Give
77
77
  it an id to read any chat in the workspace -- one a visitor had on the web,
78
78
  WhatsApp or Instagram -- with the environment and deployment that answered it.
79
+ Each message carries its id (#4821), the one \`vatio flags add --message\` takes.
79
80
  A [your backend] line under a tool call is how your backend answered it.
80
81
  A [safeguard] line says which of Vatio's checks discarded or rewrote a draft,
81
82
  and a [vatio] line marks a reply Vatio wrote because the agent's turn produced
@@ -175,6 +176,11 @@ function chatsFor(config, apiUrl) {
175
176
  return state.chats && typeof state.chats === "object" ? state.chats : {};
176
177
  }
177
178
 
179
+ // The chat `vatio chat` is in on this environment, for `vatio flags add`.
180
+ export function rememberedChatId(config, environment) {
181
+ return chatsFor(config, config.resolveApiUrl())[environment] ?? null;
182
+ }
183
+
178
184
  function rememberChat(config, { apiUrl, environment, chatId }) {
179
185
  const chats = { ...chatsFor(config, apiUrl), [environment]: chatId };
180
186
  writeFileSync(statePath(config), `${JSON.stringify({ api_url: apiUrl, chats }, null, 2)}\n`);
@@ -310,7 +316,7 @@ async function showChat(config, options, args) {
310
316
  ? ` (discarded by the ${safeguard.policy} safeguard)`
311
317
  : " (discarded)"
312
318
  : "";
313
- if (content !== "" || flags) console.log(`[${message.role}]${flags} ${content}`);
319
+ if (content !== "" || flags) console.log(`[${message.role} #${message.id}]${flags} ${content}`);
314
320
  for (const call of Array.isArray(message.tool_calls) ? message.tool_calls : []) {
315
321
  console.log(` -> ${call.name}(${truncate(JSON.stringify(call.arguments ?? {}), 400)})`);
316
322
  if (call.backend) console.log(` [your backend] ${backendLine(call.backend)}`);
@@ -11,6 +11,7 @@ import { mkdirSync, writeFileSync } from "node:fs";
11
11
  import { dirname, resolve } from "node:path";
12
12
 
13
13
  import { HttpClient, NotFoundError, throwIfOutdated } from "../http.mjs";
14
+ import { rememberedChatId } from "./chat.mjs";
14
15
  import { clientHeaders } from "../telemetry.mjs";
15
16
  import { fail, sleep, takeEnv, takeFlag, takeValue } from "../support.mjs";
16
17
  import { printSkillsHint } from "../skills-hint.mjs";
@@ -44,6 +45,7 @@ async function fetchMarkdown(config, path, what) {
44
45
  // before it, every tool call of that turn with what your backend answered,
45
46
  // and what the supervisor says should have happened.
46
47
  export async function flags(config, args) {
48
+ if (args[0] === "add") return await addFlag(config, args.slice(1));
47
49
  if (["rm", "remove", "delete"].includes(args[0])) return await removeFlags(config, args.slice(1));
48
50
 
49
51
  const json = takeFlag(args, "--json");
@@ -71,6 +73,54 @@ export async function flags(config, args) {
71
73
  await printSkillsHint();
72
74
  }
73
75
 
76
+ const ADD_USAGE = 'vatio flags add "WHAT IT SHOULD DO" [--passes] [--chat ID | --message ID] [--env NAME]';
77
+
78
+ // What the inbox's Reportar does, from the terminal: the agent's last reply in
79
+ // the chat `vatio chat` is in (or --chat's, or --message), and what it should
80
+ // have done. The note makes it a test case, so a set of `vatio chat --new` +
81
+ // `vatio flags add` is a test suite `vatio test` replays on every version.
82
+ // --passes is for a reply that is already right: the case keeps it so, filed
83
+ // resolved, with nothing for Vatio to triage or fix.
84
+ async function addFlag(config, args) {
85
+ const environment = takeEnv(args, { fallback: "preview" });
86
+ const chatId = takeValue(args, "--chat");
87
+ const messageId = takeValue(args, "--message");
88
+ const passing = takeFlag(args, "--passes");
89
+ const note = args.join(" ").trim();
90
+ if (note === "" || args.some((arg) => arg.startsWith("--"))) fail(`Usage: ${ADD_USAGE}`);
91
+ if (chatId && messageId) fail(`--chat or --message, not both. Usage: ${ADD_USAGE}`);
92
+
93
+ const target = messageId ? { message_id: messageId } : { chat_id: chatId ?? rememberedChatId(config, environment) };
94
+ if (!target.message_id && !target.chat_id) {
95
+ fail(`No ${environment} chat yet: run \`vatio chat "hello"\` first, or pass --chat ID or --message ID.`);
96
+ }
97
+
98
+ const { url, token } = workspaceBase(config);
99
+ let flag;
100
+ try {
101
+ flag = await new HttpClient({ baseUrl: url, token }).post("/flags", { ...target, note, passing });
102
+ } catch (error) {
103
+ // The platform's own words name the chat or message and where to find the right one.
104
+ if (error instanceof NotFoundError) fail(error.message);
105
+ throw error;
106
+ }
107
+
108
+ const reply = String(flag.reply ?? "").trim().replace(/\s+/g, " ");
109
+ const verb = flag.passing ? "Kept as right" : flag.rewritten ? "Rewrote" : "Reported";
110
+ console.log(`${verb} ${flag.public_id}, chat ${flag.chat_id} on ${flag.environment}:`);
111
+ console.log(` [agent #${flag.message_id}] ${reply.length > 200 ? `${reply.slice(0, 200)}…` : reply}`);
112
+ if (flag.test_case && flag.passing) {
113
+ console.log(
114
+ `It is a test case, resolved${flag.resolved_in ? ` in ${flag.resolved_in}` : ""}: nothing for Vatio to fix, nothing pending\n` +
115
+ "in the inbox. `vatio test` replays it; once live passes it, `vatio publish` refuses a version that fails it."
116
+ );
117
+ } else if (flag.test_case) {
118
+ console.log("It is a test case now: `vatio test` replays it, `vatio flags` lists it, `vatio flags rm` removes it.");
119
+ } else {
120
+ console.log("No visitor message comes before that reply, so there is nothing to replay: it is not a test case.");
121
+ }
122
+ }
123
+
74
124
  // What the inbox's Quitar does, by the ids `vatio flags` prints: the flag and
75
125
  // its test case go, for everyone in the workspace. The developer's call, not
76
126
  // the coding agent's: the vatio-improve skill says to run it only when asked.
@@ -149,7 +199,10 @@ async function runTests(config, args, { name, waitByDefault }) {
149
199
  }
150
200
  const runs = started.runs ?? [];
151
201
  if (runs.length === 0) {
152
- console.log("No reports to test yet. Report a reply in the inbox and write what it should have said.");
202
+ console.log(
203
+ "No reports to test yet. Report a reply in the inbox, or after a `vatio chat` with\n" +
204
+ '`vatio flags add "what it should have done"`.'
205
+ );
153
206
  return;
154
207
  }
155
208
 
@@ -6,7 +6,8 @@ import { homedir } from "node:os";
6
6
  import { dirname, join, resolve } from "node:path";
7
7
  import { gzipSync } from "node:zlib";
8
8
 
9
- import { clean, describe, sessionById, sessionsFor } from "../claude-session.mjs";
9
+ import * as claudeSessions from "../claude-session.mjs";
10
+ import * as codexSessions from "../codex-session.mjs";
10
11
  import { configHome } from "../config.mjs";
11
12
  import { ask, fail, takeFlag, takeValue } from "../support.mjs";
12
13
  import { chosenHeaders, clientHeaders, sendFeedback, telemetryEnabled } from "../telemetry.mjs";
@@ -86,17 +87,18 @@ export async function shareSession(config, args) {
86
87
  if (never) return stopOffering();
87
88
 
88
89
  const session = findSession(id);
89
- const transcript = clean(session);
90
+ const { label, reader } = AGENTS[session.agent];
91
+ const transcript = reader.clean(session);
90
92
  if (transcript.messages === 0) fail(`Session ${short(session.id)} has no messages yet.`);
91
93
  const gzipped = gzipSync(transcript.jsonl);
92
94
 
93
- const { title } = describe(session);
94
- console.log(`Claude Code session ${short(session.id)}${title ? ` — ${truncate(title, 70)}` : ""}`);
95
+ const { title } = reader.describe(session);
96
+ console.log(`${label} session ${short(session.id)}${title ? ` — ${truncate(title, 70)}` : ""}`);
95
97
  console.log(` ${tilde(transcript.cwd ?? process.cwd())}${transcript.gitBranch ? ` (${transcript.gitBranch})` : ""}`);
96
98
  console.log(` ${transcript.messages} messages, ${when(transcript.startedAt)} → ${when(transcript.endedAt)}`);
97
99
  console.log(` ${size(Buffer.byteLength(transcript.jsonl))}, ${size(gzipped.length)} compressed`);
98
100
  console.log(
99
- ` Left out: ${transcript.images > 0 ? `${transcript.images} image(s) and ` : ""}Claude Code's own bookkeeping.` +
101
+ ` Left out: ${transcript.images > 0 ? `${transcript.images} image(s) and ` : ""}${label}'s own bookkeeping.` +
100
102
  (transcript.redactions > 0 ? ` ${transcript.redactions} thing(s) that looked like a key, token or password are [REDACTED].` : "") +
101
103
  (transcript.personal > 0 ? ` ${transcript.personal} email address(es) and phone number(s) are [EMAIL] and [PHONE].` : "")
102
104
  );
@@ -133,7 +135,7 @@ export async function shareSession(config, args) {
133
135
 
134
136
  const form = new FormData();
135
137
  form.set("transcript", new Blob([gzipped], { type: "application/gzip" }), `${session.id}.jsonl.gz`);
136
- form.set("source", "claude-code");
138
+ form.set("source", session.agent);
137
139
  form.set("source_session_id", session.id);
138
140
  form.set("messages", String(transcript.messages));
139
141
  if (transcript.startedAt) form.set("started_at", transcript.startedAt);
@@ -173,7 +175,7 @@ function answerShouldAsk() {
173
175
  console.log(`no — ${reason}`);
174
176
  return;
175
177
  }
176
- rememberOffer(process.env.CLAUDE_CODE_SESSION_ID);
178
+ rememberOffer(currentSession()?.id);
177
179
  console.log(
178
180
  "yes — ask the person you work for whether to send this session to the Vatio team: send it, " +
179
181
  "not now, or don't ask again (`vatio share-session --never`)."
@@ -185,9 +187,9 @@ function reasonNotToOffer() {
185
187
  if (!telemetryEnabled()) return "telemetry is off, so they would rather send nothing";
186
188
  const state = readOfferState();
187
189
  if (state.never) return "they said not to ask again";
188
- const current = process.env.CLAUDE_CODE_SESSION_ID;
189
- if (!current || !sessionById(current)) return "only a Claude Code session can be sent, from inside it";
190
- if (state.session === current) return "already offered in this session";
190
+ const current = currentSession();
191
+ if (!current) return "only a Claude Code or Codex session can be sent, from inside it";
192
+ if (state.session === current.id) return "already offered in this session";
191
193
  if (Date.now() - Date.parse(state.offered_at ?? "") < OFFER_EVERY_MS) return "already offered this week";
192
194
  return null;
193
195
  }
@@ -245,36 +247,68 @@ function writeOfferState(state) {
245
247
  writeFileSync(path, `${JSON.stringify(state)}\n`);
246
248
  }
247
249
 
248
- // The one this coding agent is running in, when it is Claude Code; otherwise
249
- // the newest one with a conversation in it, started here or above.
250
+ // The coding agents whose sessions can be sent, by the source the upload is
251
+ // tagged with, and how each says which session a command runs in.
252
+ const AGENTS = {
253
+ "claude-code": { label: "Claude Code", reader: claudeSessions, currentId: () => process.env.CLAUDE_CODE_SESSION_ID },
254
+ codex: { label: "Codex", reader: codexSessions, currentId: () => process.env.CODEX_THREAD_ID }
255
+ };
256
+
257
+ // The session this command runs in, when a coding agent we read runs it.
258
+ function currentSession() {
259
+ for (const { reader, currentId } of Object.values(AGENTS)) {
260
+ const id = currentId();
261
+ const session = id ? reader.sessionById(id) : null;
262
+ if (session) return session;
263
+ }
264
+ return null;
265
+ }
266
+
267
+ function sessionById(id) {
268
+ const matches = Object.values(AGENTS).map(({ reader }) => reader.sessionById(id)).filter(Boolean);
269
+ return matches.sort((a, b) => b.modifiedAt - a.modifiedAt)[0] ?? null;
270
+ }
271
+
272
+ // Every agent's sessions for this directory or the nearest parent, newest
273
+ // first, with what each is about.
274
+ function sessionsHere(limit = Infinity) {
275
+ return Object.values(AGENTS)
276
+ .flatMap(({ reader }) => reader.sessionsFor(process.cwd()).slice(0, limit).map(reader.describe))
277
+ .sort((a, b) => b.modifiedAt - a.modifiedAt);
278
+ }
279
+
280
+ // The one this coding agent is running in, when it is Claude Code or Codex;
281
+ // otherwise the newest one with a conversation in it, started here or above.
250
282
  function findSession(id) {
251
- const current = process.env.CLAUDE_CODE_SESSION_ID;
252
- if (id || current) {
253
- const session = sessionById(id ?? current);
283
+ if (id) {
284
+ const session = sessionById(id);
254
285
  if (session) return session;
255
- if (id) fail(`No Claude Code session ${id} on this machine. \`vatio share-session --list\` shows them.`);
286
+ fail(`No Claude Code or Codex session ${id} on this machine. \`vatio share-session --list\` shows them.`);
256
287
  }
288
+ const current = currentSession();
289
+ if (current) return current;
257
290
 
258
- const session = sessionsFor(process.cwd()).map(describe).find((candidate) => candidate.messages > 0);
291
+ const session = sessionsHere().find((candidate) => candidate.messages > 0);
259
292
  if (session) return session;
260
293
  fail(
261
- "No Claude Code session found for this directory. Run this from the project Claude Code was working in.\n" +
262
- 'Only Claude Code sessions for now: from another coding agent, tell us with `vatio feedback "…"`.'
294
+ "No Claude Code or Codex session found for this directory. Run this from the project your coding agent was\n" +
295
+ 'working in. From another coding agent, tell us with `vatio feedback "…"`.'
263
296
  );
264
297
  }
265
298
 
266
299
  function listSessions() {
267
- const sessions = sessionsFor(process.cwd()).slice(0, 20).map(describe).filter((session) => session.messages > 0).slice(0, 10);
268
- if (sessions.length === 0) fail("No Claude Code sessions for this directory.");
300
+ const sessions = sessionsHere(20).filter((session) => session.messages > 0).slice(0, 10);
301
+ if (sessions.length === 0) fail("No Claude Code or Codex sessions for this directory.");
269
302
 
270
- const current = process.env.CLAUDE_CODE_SESSION_ID;
303
+ const current = currentSession()?.id;
271
304
  const sent = sentSessions();
272
305
  for (const session of sessions) {
273
306
  const mark = session.id === current ? "*" : " ";
274
307
  const title = session.title ? truncate(session.title, 60) : "";
275
308
  const modified = when(new Date(session.modifiedAt).toISOString());
276
309
  const shared = sent[session.id] ? ` (sent #${sent[session.id].id}, ${when(sent[session.id].at)})` : "";
277
- console.log(`${mark} ${short(session.id)} ${modified} ${String(session.messages).padStart(5)} msgs ${title}${shared}`);
310
+ const agent = AGENTS[session.agent].label.padEnd(11);
311
+ console.log(`${mark} ${short(session.id)} ${modified} ${agent} ${String(session.messages).padStart(5)} msgs ${title}${shared}`);
278
312
  }
279
313
  console.log("\nSend one with `vatio share-session --id ID`.");
280
314
  }
package/lib/help.mjs CHANGED
@@ -27,8 +27,8 @@ Commands default as listed.
27
27
  version What this CLI is
28
28
  docs [--save [PATH]] The whole developer contract, live from Vatio
29
29
  feedback "TEXT" Tell the Vatio team what got in the way
30
- share-session ["FEEDBACK"] Send this Claude Code session to the Vatio team,
31
- after showing what goes; feedback optional
30
+ share-session ["FEEDBACK"] Send this Claude Code or Codex session to the
31
+ Vatio team, after showing what goes; feedback optional
32
32
  (--save FILE, --list, --id ID; --yes from a
33
33
  coding agent)
34
34
  share-session --should-ask Whether a coding agent should offer to send it
@@ -78,6 +78,11 @@ Commands default as listed.
78
78
  flags [--save [PATH]|--json]
79
79
  Every open report: the conversation, what each tool
80
80
  answered, and what should have happened
81
+ flags add "NOTE" [--passes] [--chat ID|--message ID] [--env NAME]
82
+ Report a reply and what should have happened:
83
+ the agent's last one in the chat \`vatio chat\`
84
+ is in (default: preview). It is a test case now.
85
+ --passes: the reply is right; the case keeps it so
81
86
  flags rm ID [ID...] Remove a report and its test case, open or
82
87
  resolved, as the inbox's Remove does
83
88
  tools [--env NAME] [--period 1h|1d|7d|30d] [--json]
package/lib/telemetry.mjs CHANGED
@@ -57,7 +57,10 @@ export function codingAgent() {
57
57
  if (env.VATIO_AGENT) return String(env.VATIO_AGENT).slice(0, 64);
58
58
  if (env.CLAUDECODE) return "claude-code";
59
59
  if (env.CURSOR_AGENT || env.CURSOR_TRACE_ID) return "cursor";
60
- if (env.CODEX_SANDBOX || env.CODEX_MANAGED_BY_NPM) return "codex";
60
+ // CODEX_THREAD_ID and CODEX_SESSION_ID are on every command Codex runs, on
61
+ // every platform; the other two are not on Windows, where a whole session
62
+ // of Codex's once reported as "unknown".
63
+ if (env.CODEX_THREAD_ID || env.CODEX_SESSION_ID || env.CODEX_SANDBOX || env.CODEX_MANAGED_BY_NPM) return "codex";
61
64
  if (env.GEMINI_CLI) return "gemini-cli";
62
65
  if (env.CI) return "ci";
63
66
  return process.stdout.isTTY ? "human" : "unknown";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vatio-ai/cli",
3
- "version": "0.89.0",
3
+ "version": "0.91.0",
4
4
  "description": "Vatio CLI — deploy and manage Vatio agent workspaces",
5
5
  "keywords": [
6
6
  "vatio",