@vatio-ai/cli 0.54.1 → 0.56.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.
@@ -0,0 +1,112 @@
1
+ // flags / eval -- what supervisors flagged, and proving a fix for it.
2
+ //
3
+ // Both print markdown, because the reader is usually a coding agent: `vatio
4
+ // flags` is the document it fixes the agent from, and `vatio eval` is the
5
+ // evidence that the fix worked on a branch before anyone merges it.
6
+
7
+ import { mkdirSync, writeFileSync } from "node:fs";
8
+ import { dirname, resolve } from "node:path";
9
+
10
+ import { HttpClient } from "../http.mjs";
11
+ import { fail, sleep, takeEnv, takeFlag, takeValue } from "../support.mjs";
12
+
13
+ const POLL_MS = 3_000;
14
+ const DEFAULT_TIMEOUT_S = 900;
15
+
16
+ function workspaceBase(config) {
17
+ const base = config.resolveBaseUrl();
18
+ const token = config.resolveToken();
19
+ if (!token) fail(`Run \`vatio login\` first (no token in ${config.configPath})`);
20
+ return { url: `${base}/api/developer/v1/${config.resolveWorkspaceRequired()}`, token };
21
+ }
22
+
23
+ async function fetchMarkdown(config, path, what) {
24
+ const { url, token } = workspaceBase(config);
25
+ const response = await fetch(`${url}${path}`, {
26
+ headers: { Accept: "text/markdown, text/plain", Authorization: `Bearer ${token}` },
27
+ signal: AbortSignal.timeout(30_000)
28
+ });
29
+ if (!response.ok) fail(`Could not read ${what} (HTTP ${response.status})`);
30
+ return await response.text();
31
+ }
32
+
33
+ // The open flags as one document: each flagged reply with the conversation
34
+ // before it, every tool call of that turn with what your backend answered,
35
+ // and what the supervisor says it should have said.
36
+ export async function flags(config, args) {
37
+ const json = takeFlag(args, "--json");
38
+ const save = takeFlag(args, "--save");
39
+ const savePath = save ? args.shift() ?? null : null;
40
+
41
+ if (json) {
42
+ const { url, token } = workspaceBase(config);
43
+ const body = await new HttpClient({ baseUrl: url, token }).get("/flags");
44
+ process.stdout.write(`${JSON.stringify(body, null, 2)}\n`);
45
+ return;
46
+ }
47
+
48
+ const markdown = await fetchMarkdown(config, "/flags.md", "the flags");
49
+ if (!save) {
50
+ process.stdout.write(markdown);
51
+ return;
52
+ }
53
+
54
+ const target = resolve(savePath ?? "vatio-flags.md");
55
+ mkdirSync(dirname(target), { recursive: true });
56
+ writeFileSync(target, markdown);
57
+ console.log(`Wrote ${target}. Hand it to your coding agent; re-run \`vatio flags --save\` to refresh.`);
58
+ }
59
+
60
+ // Replays every eval case -- each flag is one -- against an environment and
61
+ // waits for the judge. Exits 1 when a case fails, so it can gate CI.
62
+ export async function evalCommand(config, args) {
63
+ const show = takeValue(args, "--show");
64
+ if (show) return await evalShow(config, show);
65
+
66
+ const environment = takeEnv(args, { fallback: "preview", cwd: config.workspaceRoot });
67
+ const agent = takeValue(args, "--agent");
68
+ const noWait = takeFlag(args, "--no-wait");
69
+ const timeoutS = Number(takeValue(args, "--timeout") ?? DEFAULT_TIMEOUT_S);
70
+
71
+ const { url, token } = workspaceBase(config);
72
+ const client = new HttpClient({ baseUrl: url, token });
73
+ const started = await client.post("/evals/runs", { environment, agent: agent ?? undefined });
74
+
75
+ for (const slug of started.missing_agents ?? []) {
76
+ console.error(`vatio: no agent \`${slug}\` on ${environment}; its cases were skipped`);
77
+ }
78
+ const runs = started.runs ?? [];
79
+ if (runs.length === 0) {
80
+ console.log("No eval cases to run. Flag a reply in the inbox, or add a case in the console.");
81
+ return;
82
+ }
83
+
84
+ const total = runs.reduce((sum, run) => sum + run.cases, 0);
85
+ console.error(`vatio: replaying ${total} case${total === 1 ? "" : "s"} on ${environment}…`);
86
+ if (noWait) {
87
+ for (const run of runs) console.log(`Run ${run.id} (${run.agent}): vatio eval --show ${run.id}`);
88
+ return;
89
+ }
90
+
91
+ const deadline = Date.now() + timeoutS * 1000;
92
+ const finished = [];
93
+ for (const run of runs) {
94
+ let row = run;
95
+ while (!row.finished) {
96
+ if (Date.now() > deadline) fail(`Timed out after ${timeoutS}s; the run keeps going. See it with: vatio eval --show ${run.id}`);
97
+ await sleep(POLL_MS);
98
+ row = await client.get(`/evals/runs/${run.id}`);
99
+ }
100
+ finished.push(row);
101
+ }
102
+
103
+ for (const run of finished) {
104
+ process.stdout.write(await fetchMarkdown(config, `/evals/runs/${run.id}.md`, `eval run ${run.id}`));
105
+ }
106
+ if (finished.some((run) => run.failed > 0)) process.exitCode = 1;
107
+ }
108
+
109
+ export async function evalShow(config, id) {
110
+ if (!id) fail("Usage: vatio eval --show RUN_ID");
111
+ process.stdout.write(await fetchMarkdown(config, `/evals/runs/${encodeURIComponent(id)}.md`, `eval run ${id}`));
112
+ }
@@ -12,17 +12,15 @@
12
12
  // takes the changes live with the agent -- `vatio kb publish` takes them alone.
13
13
  // So: write, try it on the branch's preview, publish.
14
14
  //
15
- // A base holds entries, and an entry is markdown. Either you wrote it, or a
16
- // site wrote it from a page it read — and a site is one URL or one pattern,
17
- // re-read every night. Everything below is one of those two nouns.
15
+ // A base holds entries, and an entry is markdown you wrote.
18
16
 
19
17
  import { readFileSync, statSync } from "node:fs";
20
18
 
21
19
  import { deployClient } from "./deploy.mjs";
22
20
  import { fail, takeEnv, takeValue } from "../support.mjs";
23
21
 
24
- // Only what reads or writes entries takes an environment; bases and sites
25
- // belong to the workspace.
22
+ // Only what reads or writes entries takes an environment; bases belong to the
23
+ // workspace.
26
24
  const ENVIRONMENT_SCOPED = new Set(["list", "show", "write", "cat", "rm-entry", "status", "publish"]);
27
25
 
28
26
  export async function kb(config, args) {
@@ -40,9 +38,10 @@ export async function kb(config, args) {
40
38
  case "write": return await write(ctx, args);
41
39
  case "cat": return await cat(ctx, args);
42
40
  case "rm-entry": return await removeEntry(ctx, args.shift(), args.shift());
43
- case "follow": return await follow(client, workspace, args.shift(), args.shift());
44
- case "unfollow": return await unfollow(client, workspace, args.shift(), args.shift());
45
- case "refresh": return await refresh(client, workspace, args.shift(), args.shift());
41
+ case "follow":
42
+ case "unfollow":
43
+ case "refresh":
44
+ return fail(`\`vatio kb ${sub}\` was removed: knowledge is the entries you write with \`vatio kb write\`.`);
46
45
  case "status": return await status(ctx, args.shift());
47
46
  case "publish": return await publish(ctx, args.shift());
48
47
  case "history": return await history(client, workspace, args.shift());
@@ -64,15 +63,12 @@ function envName(env) {
64
63
  function usage() {
65
64
  return `usage:
66
65
  vatio kb List knowledge bases
67
- vatio kb show NAME One base: its sites and its entries
66
+ vatio kb show NAME One base and its entries
68
67
  vatio kb create NAME [NAME...] Create one base, or several
69
68
  vatio kb rm NAME Delete a base (must be unreferenced)
70
69
  vatio kb write BASE ENTRY [FILE] Write an entry, from FILE or stdin
71
70
  vatio kb cat BASE ENTRY [--version N] Print an entry's markdown, or one of its versions
72
71
  vatio kb rm-entry BASE ENTRY Delete one entry
73
- vatio kb follow BASE URL Read a site into the base, nightly
74
- vatio kb unfollow BASE URL Stop reading it, and drop its entries
75
- vatio kb refresh BASE [URL] Read the sites again now
76
72
  vatio kb status BASE What this environment changed that live does not have
77
73
  vatio kb publish BASE Take this environment's changes live, without the agent
78
74
  vatio kb history BASE What reached live, newest first
@@ -93,8 +89,8 @@ async function list({ client, workspace, env }) {
93
89
  for (const row of bases) {
94
90
  const pending = row.pending_changes ? ` ${row.pending_changes} unpublished in ${envName(env)}` : "";
95
91
  console.log(
96
- ` ${row.name} entries=${row.entries_count} ready=${row.answerable_count} ` +
97
- `sites=${row.sites_count}${pending}${referenceNote(row)}`
92
+ ` ${row.name} entries=${row.entries_count} ready=${row.answerable_count}` +
93
+ `${pending}${referenceNote(row)}`
98
94
  );
99
95
  }
100
96
  }
@@ -118,34 +114,17 @@ async function show({ client, workspace, env }, name) {
118
114
  console.log(` ${base.pending_changes} change(s) in ${envName(env)} that live does not have — \`vatio kb status ${base.name}\``);
119
115
  }
120
116
 
121
- const sites = asArray(base.sites);
122
- if (sites.length > 0) {
123
- console.log("\n sites:");
124
- for (const site of sites) {
125
- const when = site.last_run_at ?? "never";
126
- console.log(
127
- ` ${site.url} ${site.status} pages=${site.pages_found_count} ` +
128
- `entries=${site.entries_written_count} last_read=${when}`
129
- );
130
- if (site.last_error) console.log(` error: ${site.last_error}`);
131
- }
132
- }
133
-
134
117
  const entries = asArray(base.entries);
135
118
  if (entries.length === 0) {
136
- console.log(
137
- `\n no entries yet — write one with \`vatio kb write ${name} ENTRY FILE\`, ` +
138
- `or read a site with \`vatio kb follow ${name} acme.com/help/**\``
139
- );
119
+ console.log(`\n no entries yet — write one with \`vatio kb write ${name} ENTRY FILE\``);
140
120
  return;
141
121
  }
142
122
 
143
123
  console.log(`\n entries, as ${envName(env)} sees them:`);
144
124
  for (const entry of entries) {
145
- const origin = entry.written ? "written here" : entry.url;
146
125
  const version = entry.version ? ` v${entry.version}` : "";
147
126
  const unpublished = entry.published === false ? " (not live yet)" : "";
148
- console.log(` ${entry.name}${version} ${entry.state ?? "?"} ${origin}${unpublished}`);
127
+ console.log(` ${entry.name}${version} ${entry.state ?? "?"}${unpublished}`);
149
128
  }
150
129
  }
151
130
 
@@ -171,7 +150,7 @@ async function create(client, workspace, names) {
171
150
  console.log(created.length === 1
172
151
  ? "It is empty and nothing reads it yet."
173
152
  : "They are empty and nothing reads them yet.");
174
- console.log("Fill with `vatio kb write` or `vatio kb follow`, then add");
153
+ console.log("Fill with `vatio kb write`, then add");
175
154
  console.log(`\`knowledge: [${created.join(", ")}]\` to the agent in vatio.yml and push.`);
176
155
  }
177
156
 
@@ -232,42 +211,6 @@ async function removeEntry({ client, workspace, env }, base, name) {
232
211
  console.log(`Deleted entry ${name} from ${base} in ${envName(env)} on workspace ${workspace}`);
233
212
  }
234
213
 
235
- // One URL, and the shape of it is the whole configuration. A URL is that URL;
236
- // a pattern is every page that matches it:
237
- //
238
- // acme.com the home page, and only it
239
- // acme.com/help that page
240
- // acme.com/** every page of the site
241
- // acme.com/help/** that section, however deep
242
- async function follow(client, workspace, base, url) {
243
- if (!base || !url) fail("usage: vatio kb follow BASE URL");
244
-
245
- const site = await client.followKnowledgeSite({ base, url });
246
- console.log(`Reading ${site.url} into ${base} on workspace ${workspace}`);
247
- console.log(`It runs in the background, and again every night — check it with \`vatio kb show ${base}\``);
248
- }
249
-
250
- async function unfollow(client, workspace, base, url) {
251
- if (!base || !url) fail("usage: vatio kb unfollow BASE URL");
252
-
253
- await client.unfollowKnowledgeSite({ base, url });
254
- console.log(`Stopped reading ${url} into ${base} on workspace ${workspace}`);
255
- console.log("Its entries went with it: nothing was left that nothing would refresh.");
256
- }
257
-
258
- async function refresh(client, workspace, base, url) {
259
- if (!base) fail("usage: vatio kb refresh BASE [URL]");
260
-
261
- if (url) {
262
- const site = await client.refreshKnowledgeSite({ base, url });
263
- console.log(`Reading ${site.url} again in ${base} on workspace ${workspace}`);
264
- } else {
265
- const row = await client.refreshKnowledgeBase(base);
266
- console.log(`Reading every site in ${base} again on workspace ${workspace} (${asArray(row.sites).length} of them)`);
267
- }
268
- console.log(`Runs in the background — check progress with \`vatio kb show ${base}\``);
269
- }
270
-
271
214
  // What this environment changed against live, entry by entry -- what
272
215
  // publishing it would do, and which entries live changed underneath.
273
216
  async function status({ client, workspace, env }, base) {
@@ -1,6 +1,6 @@
1
1
  // version / doctor / config / init.
2
2
 
3
- import { existsSync, writeFileSync } from "node:fs";
3
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
5
 
6
6
  import { KEYS, SLUG_FORMAT } from "../config.mjs";
@@ -112,6 +112,8 @@ export async function init(config, args) {
112
112
  writeFileSync(manifest, starterManifest(slug));
113
113
 
114
114
  console.log(`Wrote ${manifest}`);
115
+ const agentsNote = writeAgentsNote(target);
116
+ if (agentsNote) console.log(agentsNote);
115
117
  if (!authorized) console.log(`Local only for now — \`vatio push\` is what creates ${slug} on the platform.`);
116
118
  if (!authorized && String(name ?? "").trim() !== "") {
117
119
  console.log("The display name is set in the console (the workspace's Brand page) once it exists.");
@@ -122,6 +124,39 @@ export async function init(config, args) {
122
124
  console.log(` docs: ${DOCS_URL}`);
123
125
  }
124
126
 
127
+ // A pointer, not a copy of the docs: whatever coding agent works in this
128
+ // directory reads AGENTS.md, and these lines are how it learns that `vatio
129
+ // docs` is the contract and `vatio flags` is where fixing the agent starts.
130
+ // The instructions themselves come from the platform at run time, so nothing
131
+ // written here goes stale. An AGENTS.md that already mentions Vatio is left
132
+ // alone; any other gets the section appended.
133
+ const AGENTS_NOTE = [
134
+ "## Vatio",
135
+ "",
136
+ "This directory is a Vatio workspace (`vatio.yml`). `vatio docs` prints the",
137
+ "contract for the manifest, tools, knowledge and the CLI; read it before",
138
+ "changing anything here.",
139
+ "",
140
+ "To improve the agent from what supervisors flagged in the inbox, run",
141
+ "`vatio flags` and follow the instructions at the top of its output. Prove",
142
+ "each fix with `vatio eval` on a branch before opening a pull request.",
143
+ ""
144
+ ].join("\n");
145
+
146
+ function writeAgentsNote(target) {
147
+ const path = join(target, "AGENTS.md");
148
+ if (!existsSync(path)) {
149
+ writeFileSync(path, `# Agents\n\n${AGENTS_NOTE}`);
150
+ return `Wrote ${path}`;
151
+ }
152
+
153
+ const current = readFileSync(path, "utf8");
154
+ if (/vatio/i.test(current)) return null;
155
+
156
+ writeFileSync(path, `${current.replace(/\n*$/, "\n\n")}${AGENTS_NOTE}`);
157
+ return `Added a Vatio section to ${path}`;
158
+ }
159
+
125
160
  // The smallest file that deploys: which workspace, and what the agent does.
126
161
  // The slug is already validated as a slug, so it needs no quoting. The display
127
162
  // name is not here: it is a workspace setting, edited in the console.
@@ -1,14 +1,9 @@
1
- // docs / issue — the two commands that are about Vatio rather than about a
2
- // deployment.
1
+ // docs — the command that is about Vatio rather than about a deployment.
3
2
 
4
- import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
+ import { mkdirSync, writeFileSync } from "node:fs";
5
4
  import { dirname, resolve } from "node:path";
6
5
 
7
- import { buildBundle } from "../bundle.mjs";
8
- import { HttpClient } from "../http.mjs";
9
- import { VERSION } from "../version.mjs";
10
6
  import { fail, takeFlag, takeValue } from "../support.mjs";
11
- import { findWorkspaceRoot } from "../workspace.mjs";
12
7
  import { DOCS_URL } from "./misc.mjs";
13
8
 
14
9
  // The whole developer contract as markdown, live from the platform. Fetched
@@ -42,163 +37,3 @@ export async function docs(config, args) {
42
37
  console.log(`Wrote ${target} (${markdown.split("\n").length} lines, from ${baseUrl})`);
43
38
  console.log("Point your coding agent at it, and re-run `vatio docs --save` to refresh.");
44
39
  }
45
-
46
- function issuesClient(config) {
47
- const token = config.resolveToken();
48
- if (!token) fail(`Run \`vatio login\` first (no token in ${config.configPath})`);
49
- return new HttpClient({ baseUrl: config.resolveBaseUrl(), token });
50
- }
51
-
52
- // `vatio issue` is a change worth making, written against a template the
53
- // platform also validates against. It is not an issue tracker: there are no
54
- // states, labels, assignees or backlog, and that is on purpose.
55
- //
56
- // Sent from a workspace, it carries the workspace -- see workspaceSource
57
- // below, and `--no-source` to send the sentence alone.
58
- export async function issue(config, args) {
59
- const sub = args[0];
60
- if (sub === "list") return await issueList(config);
61
- if (sub === "show") return await issueShow(config, args[1]);
62
- if (sub === "comment") return await issueComment(config, args[1], args.slice(2));
63
-
64
- if (takeFlag(args, "--template")) return await issueTemplate(config);
65
-
66
- const withoutSource = takeFlag(args, "--no-source");
67
- const file = takeValue(args, "--file");
68
- const workspace = takeValue(args, "--workspace") ?? safeWorkspace(config);
69
-
70
- // Before anything is composed: nothing is more annoying than writing one of
71
- // these and only then being told to log in.
72
- const client = issuesClient(config);
73
-
74
- const body = { cli_version: VERSION };
75
- if (workspace) body.workspace = workspace;
76
-
77
- const source = withoutSource ? null : workspaceSource();
78
- if (source?.files) {
79
- body.files = source.files;
80
- console.log(`Attaching ${source.root} — ${source.files.length} files, the same ones \`vatio push\` sends.`);
81
- } else if (source?.error) {
82
- console.log(`Not attaching your workspace: ${source.error}`);
83
- }
84
- if (file) {
85
- body.markdown = readFileSync(file, "utf8");
86
- } else {
87
- const message = args.join(" ").trim();
88
- if (message === "") {
89
- fail(
90
- "Usage: vatio issue \"what should change\"\n" +
91
- " vatio issue --file ISSUE.md\n" +
92
- " vatio issue --template # the shape it is read against\n" +
93
- " vatio issue --no-source # without your workspace attached"
94
- );
95
- }
96
- body.message = message;
97
- }
98
-
99
- const payload = await client.post("/cli/issues", body);
100
- console.log(`Sent issue ${payload.id}.`);
101
- if (payload.url) console.log(` ${payload.url}`);
102
- console.log("A person reads it and answers by email; `vatio issue list` shows the thread.");
103
- }
104
-
105
- async function issueTemplate(config) {
106
- const response = await fetch(`${config.resolveBaseUrl()}/cli/issue_template`, {
107
- headers: { Accept: "text/markdown, text/plain" },
108
- signal: AbortSignal.timeout(30_000)
109
- });
110
- if (!response.ok) fail(`Could not fetch the template (HTTP ${response.status})`);
111
- process.stdout.write(await response.text());
112
- }
113
-
114
- // Where a report stands, in the words the developer is actually asking in:
115
- // has anyone looked at it, and is the ball with them or with us. There is no
116
- // `status` field to print -- an issue has no states -- so this reads the few
117
- // facts the platform does publish about the thread.
118
- function issueStatus(row) {
119
- if (row.resolved) return "closed";
120
- // The developer wrote last and nothing has gone back yet.
121
- if (row.awaiting_us) return "with us";
122
- if (row.answered) return "answered";
123
- if (row.answers > 0) return "in progress";
124
- return "sent";
125
- }
126
-
127
- async function issueList(config) {
128
- // `data`, the same envelope every other read in this CLI unwraps. Reading
129
- // `issues` here is how `list` spent its whole life reporting that a
130
- // developer had sent nothing while `show` returned those same issues by id.
131
- const payload = await issuesClient(config).get("/cli/issues");
132
- const issues = Array.isArray(payload.data) ? payload.data : [];
133
- if (issues.length === 0) {
134
- console.log("You have not sent any issues yet.");
135
- console.log(' Send one: vatio issue "what should change"');
136
- return;
137
- }
138
- console.log(`Your issues (${issues.length}):`);
139
- const idWidth = Math.max(...issues.map((row) => String(row.id).length));
140
- const statusWidth = Math.max(...issues.map((row) => issueStatus(row).length));
141
- // The pull request goes under the title it belongs to, so the id and status
142
- // columns stay readable as columns.
143
- const indent = " ".repeat(2 + idWidth + 3 + statusWidth + 2);
144
- for (const row of issues) {
145
- const id = `[${String(row.id).padStart(idWidth)}]`;
146
- console.log(` ${id} ${issueStatus(row).padEnd(statusWidth)} ${row.title ?? ""}`.trimEnd());
147
- if (row.pull_request_url) console.log(`${indent}${row.pull_request_url}`);
148
- }
149
- console.log("Read one, conversation included: vatio issue show ID");
150
- }
151
-
152
- // The markdown view, which is the same document Vatio's own triage agent
153
- // reads -- the whole conversation included, so a coding agent can pick the
154
- // thread up where a person left it.
155
- async function issueShow(config, id) {
156
- if (!id) fail("Usage: vatio issue show ID");
157
-
158
- const response = await fetch(`${config.resolveBaseUrl()}/cli/issues/${encodeURIComponent(id)}.md`, {
159
- headers: {
160
- Accept: "text/markdown, text/plain",
161
- Authorization: `Bearer ${config.resolveToken() ?? ""}`
162
- },
163
- signal: AbortSignal.timeout(30_000)
164
- });
165
- if (!response.ok) fail(`Could not read issue ${id} (HTTP ${response.status})`);
166
- process.stdout.write(await response.text());
167
- }
168
-
169
- async function issueComment(config, id, rest) {
170
- if (!id) fail("Usage: vatio issue comment ID \"your reply\"");
171
- const body = rest.join(" ").trim();
172
- if (body === "") fail("Usage: vatio issue comment ID \"your reply\"");
173
-
174
- await issuesClient(config).post(`/cli/issues/${encodeURIComponent(id)}/comments`, { body });
175
- console.log(`Replied on issue ${id}.`);
176
- }
177
-
178
- // The directory the issue was typed in, sent whole -- the same bundle `check`
179
- // and `push` send, because which files matter is the platform's contract and
180
- // this client does not get a second answer to it.
181
- //
182
- // Nothing here can stop an issue from being sent: a directory that is not a
183
- // workspace, or one too large to bundle, travels without its source. The call
184
- // site says so out loud, since a developer is entitled to know what left their
185
- // machine, and `--no-source` declines in advance.
186
- function workspaceSource() {
187
- try {
188
- const root = findWorkspaceRoot(process.cwd());
189
- if (!root) return null;
190
- return { root, files: buildBundle(root) };
191
- } catch (error) {
192
- return { error: error.message };
193
- }
194
- }
195
-
196
- // A workspace is useful context on an issue but never required: `vatio issue`
197
- // has to work from anywhere, including a directory that is not a workspace.
198
- function safeWorkspace(config) {
199
- try {
200
- return config.resolveWorkspace();
201
- } catch {
202
- return null;
203
- }
204
- }
@@ -1,9 +1,6 @@
1
- // secrets / tokens / widget — the three things a workspace has that its
2
- // manifest deliberately does not carry.
3
- //
4
- // A secret is a credential, a publishable token is a credential (with the
5
- // origins it accepts), and the widget screen is a read of what the platform
6
- // will actually enforce, edited in the console. None of them are in vatio.yml.
1
+ // secrets / tokens — the two things a workspace has that its manifest
2
+ // deliberately does not carry. A secret is a credential, and so is a
3
+ // publishable token (with the origins it accepts); neither is in vatio.yml.
7
4
 
8
5
  import { deployClient } from "./deploy.mjs";
9
6
  import { askSecret, branchDefault, fail, paint, takeValue } from "../support.mjs";
@@ -146,18 +143,6 @@ function originsLine(origins) {
146
143
  return list.length > 0 ? list.join(", ") : "none (add one with `vatio tokens origins PREFIX URL`)";
147
144
  }
148
145
 
149
- export async function widget(config, args) {
150
- const environment = environmentOption(args, "live", config.workspaceRoot);
151
- const workspace = config.resolveWorkspaceRequired();
152
- const payload = await deployClient(config, workspace).widget();
153
-
154
- console.log(JSON.stringify(payload, null, 2));
155
- console.log("");
156
- console.log(`The widget's look is edited in the console: ${payload.brand_url ?? "the workspace's Brand page"}`);
157
- console.log(`Each token's allowed origins: ${payload.tokens_url ?? "the workspace's Tokens page"}`);
158
- console.log(`A token for this environment: vatio tokens create --env ${environment} --origin https://your-site.com`);
159
- }
160
-
161
146
  function asArray(value) {
162
147
  return Array.isArray(value) ? value : [];
163
148
  }
package/lib/config.mjs CHANGED
@@ -140,7 +140,7 @@ export class Config {
140
140
  const base = this.resolveBaseUrl();
141
141
  const workspace = this.resolveWorkspace();
142
142
  if (!base || !workspace) return null;
143
- return `${base}/api/v1/${workspace}`;
143
+ return `${base}/api/developer/v1/${workspace}`;
144
144
  }
145
145
 
146
146
  writeAuth({ baseUrl, token }) {
@@ -1,4 +1,4 @@
1
- // Device-code auth (/cli/device_authorizations): the CLI asks for a code, the
1
+ // Device-code auth (/api/developer/v1/device_authorizations): the CLI asks for a code, the
2
2
  // developer approves it in a browser, the CLI polls until a token comes back.
3
3
  // The port of cli/lib/device_auth_client.rb.
4
4
  //
@@ -20,11 +20,11 @@ export class DeviceAuthClient {
20
20
  start({ email } = {}) {
21
21
  const body = {};
22
22
  if (String(email ?? "").trim() !== "") body.email = String(email).trim();
23
- return this.#post("/cli/device_authorizations", body);
23
+ return this.#post("/api/developer/v1/device_authorizations", body);
24
24
  }
25
25
 
26
26
  poll({ deviceCode }) {
27
- return this.#post("/cli/device_authorizations/token", { device_code: deviceCode });
27
+ return this.#post("/api/developer/v1/device_authorizations/token", { device_code: deviceCode });
28
28
  }
29
29
 
30
30
  async #post(path, body) {
package/lib/help.mjs CHANGED
@@ -39,32 +39,40 @@ and the one its pull request deploys to. Elsewhere commands default as listed.
39
39
  diff [--env NAME] What this directory would change (default: preview)
40
40
  --env live answers "what would publishing change?"
41
41
  diff --stat|--name-only|--format json|--full
42
- tools check Validate the workspace against Vatio's contracts
43
42
 
44
43
  Talk to your agent (as yourself — the token is the identity):
45
- chat "message" [--env NAME] preview by default; --env live is real
46
- chat transcript|debug|reset [--last N]
47
- chat show CHAT_ID [--json] Any chat in the workspace (web, WhatsApp, ...) with
48
- its channel, environment, deployment and tool calls
49
- chat destroy CHAT_ID
44
+ chat "message" [--env NAME] [--new]
45
+ preview by default; --env live is real; --new
46
+ starts over as a visitor the agent never met
47
+ chat show [CHAT_ID] [--json] [--last N]
48
+ The chat you are in, or any chat in the workspace
49
+ (web, WhatsApp, ...): messages, tool calls, channel
50
+
51
+ Improve it from what supervisors flagged:
52
+ flags [--save [PATH]|--json]
53
+ Every open flag: the conversation, what each tool
54
+ answered, and what the reply should have been
55
+ eval [--env NAME] [--agent SLUG] [--no-wait]
56
+ Replay every eval case (each flag is one) and
57
+ judge it; exits 1 if one fails. Default: the
58
+ branch's environment, else preview
59
+ eval --show RUN_ID One run's report
50
60
 
51
61
  Knowledge:
52
62
  kb [list] Bases, and whether a deployed agent reads each
53
- kb show NAME One base: its sites and its entries
63
+ kb show NAME One base and its entries
54
64
  kb create NAME | rm NAME
55
65
  kb write BASE ENTRY [FILE] Write an entry in this environment, from FILE or stdin
56
66
  kb cat BASE ENTRY [--version N]
57
67
  Print an entry's markdown, or one old version
58
68
  kb rm-entry BASE ENTRY Delete one entry in this environment
59
- kb follow BASE URL Read a site into the base, nightly
60
- kb unfollow BASE URL | refresh BASE [URL]
61
69
  kb status BASE What this environment changed that live does not
62
70
  have, and what live changed underneath
63
71
  kb publish BASE Take this environment's changes live, alone
64
72
  kb history BASE What reached live, newest first
65
73
  (entry commands take --env; --env live writes live)
66
74
 
67
- Credentials and the widget:
75
+ Credentials:
68
76
  secrets list|set KEY [VALUE]|rm KEY [--env NAME]
69
77
  Without VALUE, set asks for it with the input hidden.
70
78
  On a branch or with --env, the value only that
@@ -72,22 +80,13 @@ and the one its pull request deploys to. Elsewhere commands default as listed.
72
80
  tokens list|create [--env NAME] [--label NAME] [--origin URL]...|revoke PREFIX
73
81
  tokens origins PREFIX URL...
74
82
  The origins a token is accepted from (replaces the list)
75
- widget [--env NAME] What the platform enforces, and the tokens there are;
76
- the look is edited in the console
77
83
  auth --new-key Keypair that signs the JWT saying who a visitor is
78
84
 
79
- Channels (your own account serves live; each test phone or account on the shared
80
- preview reaches the environment it points at -- add and point take --env, and
81
- default to the branch you are on):
82
- whatsapp [status]|connect|check|activate|deactivate|disconnect
83
- whatsapp numbers list|add PHONE|point PHONE|verify PHONE CODE|resend PHONE|remove PHONE
84
- instagram [status]|connect|check|disconnect
85
- instagram accounts list|add @HANDLE|point ID|verify CODE|resend ID|remove ID
85
+ Channels:
86
+ whatsapp Set up in the console; prints the link
87
+ instagram Set up in the console; prints the link
86
88
 
87
89
  Everything else:
88
- issue "what should change"|list|show ID|comment ID "reply"|--template
89
- Sends your workspace along; --no-source to not
90
- mcp Speak MCP over stdio, for a coding agent
91
90
  config show|get KEY|set KEY VALUE|unset KEY
92
91
  Keys: base_url, token
93
92
 
@@ -3,8 +3,7 @@
3
3
  // The registry is asked at most once a day and the answer is kept in
4
4
  // ~/.vatio/update-check.json, so only the run that refreshes it makes a
5
5
  // request -- and that request runs alongside the command, not before it.
6
- // Nothing prints unless stderr is a terminal: a pipe, CI, or `vatio mcp`
7
- // (whose children write to a pipe) never sees it.
6
+ // Nothing prints unless stderr is a terminal: a pipe or CI never sees it.
8
7
 
9
8
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
10
9
  import { dirname, join } from "node:path";
@@ -17,7 +16,7 @@ const PACKAGE = "@vatio-ai/cli";
17
16
  const LATEST_URL = `https://registry.npmjs.org/${PACKAGE}/latest`;
18
17
  const CHECK_EVERY_MS = 24 * 60 * 60 * 1000;
19
18
  const FETCH_TIMEOUT_MS = 1_500;
20
- const SKIPPED_COMMANDS = ["mcp", "version", "--version", "-v"];
19
+ const SKIPPED_COMMANDS = ["version", "--version", "-v"];
21
20
 
22
21
  export function startUpdateCheck(command) {
23
22
  if (!shouldCheck(command)) return null;