@vatio-ai/cli 0.55.0 → 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.
- package/README.md +10 -18
- package/bin/vatio.mjs +15 -23
- package/lib/api-client.mjs +17 -172
- package/lib/bundle.mjs +1 -1
- package/lib/commands/channels.mjs +10 -335
- package/lib/commands/chat.mjs +31 -84
- package/lib/commands/deploy.mjs +2 -17
- package/lib/commands/improve.mjs +1 -1
- package/lib/commands/knowledge.mjs +13 -70
- package/lib/commands/support-commands.mjs +2 -167
- package/lib/commands/workspace-admin.mjs +3 -18
- package/lib/config.mjs +1 -1
- package/lib/device-auth.mjs +3 -3
- package/lib/help.mjs +11 -22
- package/lib/update-notice.mjs +2 -3
- package/lib/workspace.mjs +1 -5
- package/package.json +1 -1
- package/lib/commands/mcp.mjs +0 -350
|
@@ -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
|
|
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
|
|
25
|
-
//
|
|
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":
|
|
44
|
-
case "unfollow":
|
|
45
|
-
case "refresh":
|
|
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
|
|
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
|
-
|
|
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 ?? "?"}
|
|
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
|
|
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,14 +1,9 @@
|
|
|
1
|
-
// docs
|
|
2
|
-
// deployment.
|
|
1
|
+
// docs — the command that is about Vatio rather than about a deployment.
|
|
3
2
|
|
|
4
|
-
import { mkdirSync,
|
|
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
|
|
2
|
-
//
|
|
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 }) {
|
package/lib/device-auth.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Device-code auth (/
|
|
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("/
|
|
23
|
+
return this.#post("/api/developer/v1/device_authorizations", body);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
poll({ deviceCode }) {
|
|
27
|
-
return this.#post("/
|
|
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,14 +39,14 @@ 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]
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
50
|
|
|
51
51
|
Improve it from what supervisors flagged:
|
|
52
52
|
flags [--save [PATH]|--json]
|
|
@@ -60,21 +60,19 @@ and the one its pull request deploys to. Elsewhere commands default as listed.
|
|
|
60
60
|
|
|
61
61
|
Knowledge:
|
|
62
62
|
kb [list] Bases, and whether a deployed agent reads each
|
|
63
|
-
kb show NAME One base
|
|
63
|
+
kb show NAME One base and its entries
|
|
64
64
|
kb create NAME | rm NAME
|
|
65
65
|
kb write BASE ENTRY [FILE] Write an entry in this environment, from FILE or stdin
|
|
66
66
|
kb cat BASE ENTRY [--version N]
|
|
67
67
|
Print an entry's markdown, or one old version
|
|
68
68
|
kb rm-entry BASE ENTRY Delete one entry in this environment
|
|
69
|
-
kb follow BASE URL Read a site into the base, nightly
|
|
70
|
-
kb unfollow BASE URL | refresh BASE [URL]
|
|
71
69
|
kb status BASE What this environment changed that live does not
|
|
72
70
|
have, and what live changed underneath
|
|
73
71
|
kb publish BASE Take this environment's changes live, alone
|
|
74
72
|
kb history BASE What reached live, newest first
|
|
75
73
|
(entry commands take --env; --env live writes live)
|
|
76
74
|
|
|
77
|
-
Credentials
|
|
75
|
+
Credentials:
|
|
78
76
|
secrets list|set KEY [VALUE]|rm KEY [--env NAME]
|
|
79
77
|
Without VALUE, set asks for it with the input hidden.
|
|
80
78
|
On a branch or with --env, the value only that
|
|
@@ -82,22 +80,13 @@ and the one its pull request deploys to. Elsewhere commands default as listed.
|
|
|
82
80
|
tokens list|create [--env NAME] [--label NAME] [--origin URL]...|revoke PREFIX
|
|
83
81
|
tokens origins PREFIX URL...
|
|
84
82
|
The origins a token is accepted from (replaces the list)
|
|
85
|
-
widget [--env NAME] What the platform enforces, and the tokens there are;
|
|
86
|
-
the look is edited in the console
|
|
87
83
|
auth --new-key Keypair that signs the JWT saying who a visitor is
|
|
88
84
|
|
|
89
|
-
Channels
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
whatsapp [status]|connect|check|activate|deactivate|disconnect
|
|
93
|
-
whatsapp numbers list|add PHONE|point PHONE|verify PHONE CODE|resend PHONE|remove PHONE
|
|
94
|
-
instagram [status]|connect|check|disconnect
|
|
95
|
-
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
|
|
96
88
|
|
|
97
89
|
Everything else:
|
|
98
|
-
issue "what should change"|list|show ID|comment ID "reply"|--template
|
|
99
|
-
Sends your workspace along; --no-source to not
|
|
100
|
-
mcp Speak MCP over stdio, for a coding agent
|
|
101
90
|
config show|get KEY|set KEY VALUE|unset KEY
|
|
102
91
|
Keys: base_url, token
|
|
103
92
|
|
package/lib/update-notice.mjs
CHANGED
|
@@ -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
|
|
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 = ["
|
|
19
|
+
const SKIPPED_COMMANDS = ["version", "--version", "-v"];
|
|
21
20
|
|
|
22
21
|
export function startUpdateCheck(command) {
|
|
23
22
|
if (!shouldCheck(command)) return null;
|
package/lib/workspace.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// small.
|
|
4
4
|
//
|
|
5
5
|
// What a `tools/*.yml` declares, which blocks `vatio.yml` accepts and whether
|
|
6
|
-
// any of it is valid are answered by POST /api/v1/:slug/
|
|
6
|
+
// any of it is valid are answered by POST /api/developer/v1/:slug/check. The one
|
|
7
7
|
// thing a client cannot ask the platform for is the address of that call: the
|
|
8
8
|
// slug is in its URL. So this reads `workspace:` and stops.
|
|
9
9
|
|
|
@@ -16,10 +16,6 @@ export const MANIFEST_FILE = "vatio.yml";
|
|
|
16
16
|
// past this is still the platform's to reject; matching here only turns a typo
|
|
17
17
|
// into a sentence instead of a 404.
|
|
18
18
|
export const SLUG_FORMAT = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
19
|
-
// The key `agent:` stores its single agent under, and the default an `entry:`
|
|
20
|
-
// table falls back to. A workspace may declare several under `agents:`.
|
|
21
|
-
export const ENTRY_AGENT = "main";
|
|
22
|
-
|
|
23
19
|
// The manifest in a directory, or null when the directory is not a workspace
|
|
24
20
|
// root. This file is the only thing that makes one.
|
|
25
21
|
export function manifestPath(dir) {
|