@vatio-ai/cli 0.130.0 → 0.132.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 +32 -24
- package/bin/vatio.mjs +19 -5
- package/lib/api-client.mjs +1 -5
- package/lib/commands/business.mjs +1 -1
- package/lib/commands/chat.mjs +20 -10
- package/lib/commands/deploy.mjs +64 -159
- package/lib/commands/env.mjs +1 -2
- package/lib/commands/improve.mjs +3 -3
- package/lib/commands/knowledge.mjs +36 -52
- package/lib/commands/misc.mjs +14 -6
- package/lib/commands/support-commands.mjs +6 -1
- package/lib/commands/workspace-admin.mjs +23 -37
- package/lib/config.mjs +158 -12
- package/lib/help.mjs +68 -68
- package/lib/telemetry.mjs +1 -1
- package/lib/visitor-identity.mjs +5 -3
- package/package.json +1 -1
package/lib/commands/deploy.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// push / pull / publish / rollback / status / diff.
|
|
1
|
+
// push / pull / publish (a notice now) / rollback / status / diff.
|
|
2
2
|
//
|
|
3
3
|
// Every one of them is HTTP. The workspace is parsed by the platform
|
|
4
4
|
// (POST /deploy/check), so what is left here is: read the directory, send it,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// `pull` is the exception, the one command that writes over the developer's
|
|
8
8
|
// own files. It is back because the files stopped being the only writer: from
|
|
9
9
|
// the Vatio MCP, in Claude or ChatGPT, people edit the agent itself, and each
|
|
10
|
-
// edit
|
|
10
|
+
// edit is a deployment of its own. What it writes is narrow
|
|
11
11
|
// on purpose (lib/pull.mjs): each tools/KEY.yml exactly as the platform holds
|
|
12
12
|
// it, and only the `agent:` block of the vatio.yml already on disk, key by
|
|
13
13
|
// key, because a revision keeps neither that file's comments nor `auth:` the
|
|
@@ -25,7 +25,7 @@ import { stringify as stringifyYaml } from "yaml";
|
|
|
25
25
|
|
|
26
26
|
import { buildBundle, BundleError } from "../bundle.mjs";
|
|
27
27
|
import { ApiClient, CliClient } from "../api-client.mjs";
|
|
28
|
-
import { ConflictError, NotFoundError
|
|
28
|
+
import { ConflictError, NotFoundError } from "../http.mjs";
|
|
29
29
|
import { MANIFEST_FILE } from "../workspace.mjs";
|
|
30
30
|
import { PullError, planPull } from "../pull.mjs";
|
|
31
31
|
import { deviceLogin } from "./auth.mjs";
|
|
@@ -132,9 +132,8 @@ export async function push(config, args) {
|
|
|
132
132
|
// explicitly would make a bare `vatio push` and `vatio push --env preview`
|
|
133
133
|
// two different requests that only happen to agree today.
|
|
134
134
|
const environment = takeEnv(args, { fallback: null });
|
|
135
|
-
//
|
|
136
|
-
//
|
|
137
|
-
// (preview_has_unpublished_push, preview_edited_outside).
|
|
135
|
+
// Overwrites edits made outside the files (from the MCP or the inbox),
|
|
136
|
+
// which the platform otherwise refuses (preview_edited_outside).
|
|
138
137
|
const force = takeFlag(args, "--force");
|
|
139
138
|
const workspace = config.resolveWorkspaceRequired();
|
|
140
139
|
|
|
@@ -180,27 +179,14 @@ export async function push(config, args) {
|
|
|
180
179
|
});
|
|
181
180
|
} catch (error) {
|
|
182
181
|
if (error instanceof ConflictError && error.errorKey === "preview_edited_outside") fail(editedOutsideMessage(error));
|
|
183
|
-
if (error instanceof UnprocessableError && error.errorKey === "preview_has_unpublished_push") {
|
|
184
|
-
fail(unpublishedPushMessage(error, gitBranch));
|
|
185
|
-
}
|
|
186
182
|
throw error;
|
|
187
183
|
}
|
|
188
184
|
// What the files match now, so the next push is built on it.
|
|
189
185
|
config.rememberBaseDeployment({ baseUrl, workspace, deploymentId: payload.deployment_id });
|
|
190
186
|
|
|
191
|
-
|
|
192
|
-
//
|
|
193
|
-
|
|
194
|
-
// line that has to be explained by hand afterwards.
|
|
195
|
-
const outcome = payload.outcome;
|
|
196
|
-
const landedOn = outcome && typeof outcome === "object" ? (outcome.reaches_visitors ? null : outcome.environment) : (payload.environment ?? "preview");
|
|
197
|
-
const where = landedOn ? ` to ${landedOn}` : "";
|
|
198
|
-
console.log(`Pushed deployment #${payload.deployment_id}${where} (git_sha=${JSON.stringify(payload.git_sha ?? null)})`);
|
|
199
|
-
// What it means for the people talking to the agent. The environment name
|
|
200
|
-
// answers a question nobody asked: for a draft it said "to preview" while
|
|
201
|
-
// live was following every push, which is the single thing new developers
|
|
202
|
-
// have to be told by hand.
|
|
203
|
-
for (const line of consequenceLines(payload)) console.log(line);
|
|
187
|
+
console.log(`Pushed deployment #${payload.deployment_id} (git_sha=${JSON.stringify(payload.git_sha ?? null)})`);
|
|
188
|
+
// Who has it now: everyone, or the team until its tests pass.
|
|
189
|
+
for (const line of shippingLines(payload.shipping)) console.log(line);
|
|
204
190
|
// Where to try it: the inbox's Try the agent panel for that environment.
|
|
205
191
|
if (payload.share_url) console.log(`Try it: ${payload.share_url}`);
|
|
206
192
|
// Mostly what the check already said: the platform loads the manifest again
|
|
@@ -209,7 +195,6 @@ export async function push(config, args) {
|
|
|
209
195
|
if (IGNORED_BLOCK.test(warning)) ignored.push(warning);
|
|
210
196
|
else console.log(` warning: ${warning}`);
|
|
211
197
|
}
|
|
212
|
-
if (payload.preview_url) console.log(`Preview: ${payload.preview_url}`);
|
|
213
198
|
|
|
214
199
|
const hint = payload.first_push_hint;
|
|
215
200
|
if (hint) {
|
|
@@ -221,65 +206,48 @@ export async function push(config, args) {
|
|
|
221
206
|
printIgnored(ignored);
|
|
222
207
|
}
|
|
223
208
|
|
|
224
|
-
//
|
|
225
|
-
//
|
|
226
|
-
|
|
227
|
-
// A
|
|
228
|
-
// (Vatio::Deploy::FollowPreview), so the agent is answering with this now,
|
|
229
|
-
// and saying "pushed to preview" and nothing else is how a developer comes
|
|
230
|
-
// to believe their work is not live when it is.
|
|
231
|
-
function consequenceLines(payload) {
|
|
232
|
-
const outcome = payload.outcome;
|
|
233
|
-
// A platform older than this CLI sends no outcome; its prose notices still
|
|
209
|
+
// Who has a change now, read off the platform's `shipping` (Vatio::Deploy::Ship):
|
|
210
|
+
// everyone, or the team until the tests that pass today pass on it.
|
|
211
|
+
function shippingLines(shipping) {
|
|
212
|
+
// A platform older than this CLI sends none; its prose notices still
|
|
234
213
|
// arrive and printNotices shows them.
|
|
235
|
-
if (!
|
|
236
|
-
|
|
237
|
-
if (outcome.reaches_visitors) {
|
|
238
|
-
const lines = ["→ Your agent is answering with this now."];
|
|
239
|
-
if (outcome.draft) {
|
|
240
|
-
lines.push(
|
|
241
|
-
" Every push reaches your app, WhatsApp and Instagram at once, until someone",
|
|
242
|
-
" outside your team talks to it. From their first conversation on, a push waits",
|
|
243
|
-
" for `vatio publish`."
|
|
244
|
-
);
|
|
245
|
-
}
|
|
246
|
-
return lines;
|
|
247
|
-
}
|
|
214
|
+
if (!shipping || typeof shipping !== "object") return [];
|
|
215
|
+
if (shipping.reaches_everyone || shipping.state === "live") return ["→ Everyone has it now: your app, WhatsApp and Instagram answer with it."];
|
|
248
216
|
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
return
|
|
217
|
+
const by = shipping.expected_by ? `, around ${clock(shipping.expected_by)}` : "";
|
|
218
|
+
return [
|
|
219
|
+
"→ Your team has it now (`vatio chat` talks to it). Everyone gets it once the tests",
|
|
220
|
+
` that pass today pass on it${by}. \`vatio status\` says where it stands.`
|
|
221
|
+
];
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function clock(iso) {
|
|
225
|
+
const at = new Date(iso);
|
|
226
|
+
return Number.isNaN(at.getTime()) ? iso : at.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
259
227
|
}
|
|
260
228
|
|
|
261
229
|
// Something the platform wants the developer to know about the command they
|
|
262
230
|
// just ran -- a deprecation, usually. On stderr so scripts reading stdout keep
|
|
263
231
|
// working.
|
|
264
232
|
//
|
|
265
|
-
// `
|
|
233
|
+
// `shipping.supersedes` lists the ones shippingLines already said in fewer
|
|
266
234
|
// words; printing both would say it twice.
|
|
267
235
|
function printNotices(payload) {
|
|
268
|
-
const superseded = new Set(asArray(payload.outcome?.supersedes));
|
|
236
|
+
const superseded = new Set(asArray(payload.shipping?.supersedes ?? payload.outcome?.supersedes));
|
|
269
237
|
for (const notice of asArray(payload.notices)) {
|
|
270
238
|
if (superseded.has(notice)) continue;
|
|
271
239
|
process.stderr.write(`\n${paint("yellow", `Notice: ${notice}`)}\n`);
|
|
272
240
|
}
|
|
273
241
|
}
|
|
274
242
|
|
|
275
|
-
// Refused because
|
|
243
|
+
// Refused because the agent holds edits the files have never seen: which, and
|
|
276
244
|
// the two ways forward. The platform's message says all of it in one line,
|
|
277
245
|
// for releases that print only that; with the list to go by, this one says
|
|
278
246
|
// it a line per edit instead of repeating it.
|
|
279
247
|
function editedOutsideMessage(error) {
|
|
280
248
|
const edits = asArray(error.body.edits);
|
|
281
249
|
const count = edits.length === 1 ? "a change" : `${edits.length} changes`;
|
|
282
|
-
const lines = edits.length === 0 ? [error.message] : [`
|
|
250
|
+
const lines = edits.length === 0 ? [error.message] : [`Your agent has ${count} made outside your files that this push would overwrite:`];
|
|
283
251
|
for (const edit of edits) lines.push(` ${editLine(edit)}`);
|
|
284
252
|
const them = edits.length === 1 ? "it" : "them";
|
|
285
253
|
lines.push(
|
|
@@ -290,42 +258,6 @@ function editedOutsideMessage(error) {
|
|
|
290
258
|
return lines.join("\n");
|
|
291
259
|
}
|
|
292
260
|
|
|
293
|
-
// Refused because preview holds a push from another branch nobody published:
|
|
294
|
-
// whose, so the session that hit it can tell whether that work is done
|
|
295
|
-
// without asking around. A platform older than `held` sends its own sentence.
|
|
296
|
-
function unpublishedPushMessage(error, branch) {
|
|
297
|
-
const held = error.body.held;
|
|
298
|
-
if (!held || typeof held !== "object") return error.message;
|
|
299
|
-
|
|
300
|
-
const yours = branch ? ` Yours is from branch ${branch}.` : "";
|
|
301
|
-
return [
|
|
302
|
-
"Preview holds a push from another branch that is not published:",
|
|
303
|
-
` ${heldLine(held)}`,
|
|
304
|
-
"",
|
|
305
|
-
`A push would replace it.${yours} Publish what preview holds first (\`vatio publish\`), or`,
|
|
306
|
-
"`vatio push --force` to replace it. `vatio status` shows what preview holds at any time."
|
|
307
|
-
].join("\n");
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
// `#42 from branch feat/x, a1b2c3d plus uncommitted changes, pushed by ivan on
|
|
311
|
-
// 2026-10-28T14:02:00Z`. Fields as AgentDeployment#held_payload and
|
|
312
|
-
// #status_payload name them; the id is `deployment_id` in one and `id` in the
|
|
313
|
-
// other.
|
|
314
|
-
function heldLine(deployment) {
|
|
315
|
-
const id = deployment.deployment_id ?? deployment.id;
|
|
316
|
-
const parts = [`#${id}`];
|
|
317
|
-
if (deployment.git_branch) parts[0] += ` from branch ${deployment.git_branch}`;
|
|
318
|
-
if (deployment.source === "edit") {
|
|
319
|
-
parts.push(`an edit made outside your files${deployment.change_summary ? ` (${deployment.change_summary})` : ""}`);
|
|
320
|
-
}
|
|
321
|
-
const sha = deployment.git_sha ? String(deployment.git_sha).slice(0, 7) : null;
|
|
322
|
-
if (deployment.git_dirty === true) parts.push(`${sha ?? "no commit"} plus uncommitted changes`);
|
|
323
|
-
else if (sha) parts.push(deployment.git_dirty === false ? `${sha}, committed` : sha);
|
|
324
|
-
const by = deployment.created_by ? ` by ${deployment.created_by}` : "";
|
|
325
|
-
parts.push(`${deployment.source === "edit" ? "made" : "pushed"}${by} on ${deployment.created_at}`);
|
|
326
|
-
return parts.join(", ");
|
|
327
|
-
}
|
|
328
|
-
|
|
329
261
|
// `#42 by ivan@x.cl via Claude, 2026-10-16T12:00:00Z: instructions, tool my_orders`
|
|
330
262
|
function editLine(edit) {
|
|
331
263
|
const who = edit?.created_by ? ` by ${edit.created_by}` : "";
|
|
@@ -416,57 +348,19 @@ function refuseUnkeptChanges(root) {
|
|
|
416
348
|
}
|
|
417
349
|
}
|
|
418
350
|
|
|
351
|
+
// There is nothing to publish: a push reaches everyone on its own once its
|
|
352
|
+
// tests pass. Kept so scripts and habits that still run it learn why.
|
|
419
353
|
export async function publish(config, args) {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
// Publishes even when preview fails a report that live passes.
|
|
425
|
-
const force = takeFlag(args, "--force");
|
|
426
|
-
const workspace = config.resolveWorkspaceRequired();
|
|
427
|
-
let payload;
|
|
428
|
-
try {
|
|
429
|
-
payload = await deployClient(config, workspace).publish({
|
|
430
|
-
createdBy: process.env.USER ?? null,
|
|
431
|
-
environment,
|
|
432
|
-
force
|
|
433
|
-
});
|
|
434
|
-
} catch (error) {
|
|
435
|
-
// evals_missing and evals_running already say what to run next; a
|
|
436
|
-
// regression also needs to say which reports.
|
|
437
|
-
if (error instanceof UnprocessableError && error.errorKey === "evals_regressed") fail(regressionsMessage(error));
|
|
438
|
-
throw error;
|
|
439
|
-
}
|
|
440
|
-
const from = asArray(payload.published_from);
|
|
441
|
-
const source = from.length > 0 ? ` from ${from.join(", ")}` : "";
|
|
442
|
-
console.log(`Published live deployment #${payload.deployment_id}${source} (git_sha=${JSON.stringify(payload.git_sha ?? null)})`);
|
|
443
|
-
const knowledge = asArray(payload.knowledge);
|
|
444
|
-
if (knowledge.length > 0) console.log(`Knowledge now live: ${knowledge.join(", ")}`);
|
|
445
|
-
printNotices(payload);
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
function regressionsMessage(error) {
|
|
449
|
-
const rows = asArray(error.body.regressions);
|
|
450
|
-
const lines = [error.message];
|
|
451
|
-
for (const row of rows) {
|
|
452
|
-
const untested = row.vatio_error ? " (not tested: an error on Vatio's side, not your agent)" : "";
|
|
453
|
-
lines.push(` ${row.id} — ${row.title}${untested}`);
|
|
454
|
-
}
|
|
455
|
-
const broken = rows.filter((row) => !row.vatio_error);
|
|
456
|
-
lines.push(
|
|
457
|
-
"",
|
|
458
|
-
broken.length > 0
|
|
459
|
-
? "Fix them, then `vatio push` and `vatio test --wait` again before publishing."
|
|
460
|
-
: "Run `vatio test --wait` again, then publish.",
|
|
461
|
-
"`vatio publish --force` publishes anyway: only if you know what you're doing."
|
|
462
|
-
);
|
|
463
|
-
return lines.join("\n");
|
|
354
|
+
takeEnv(args, { fallback: null });
|
|
355
|
+
takeFlag(args, "--force");
|
|
356
|
+
console.log("There is nothing to publish: every push reaches your team at once, and everyone once the tests");
|
|
357
|
+
console.log("that pass today pass on it. `vatio status` says where the newest change stands.");
|
|
464
358
|
}
|
|
465
359
|
|
|
466
360
|
export async function rollback(config) {
|
|
467
361
|
const workspace = config.resolveWorkspaceRequired();
|
|
468
362
|
const payload = await deployClient(config, workspace).rollback({ createdBy: process.env.USER ?? null });
|
|
469
|
-
console.log(`
|
|
363
|
+
console.log(`Everyone, your team included, is back on deployment #${payload.deployment_id} (from #${payload.rolled_back_from_id})`);
|
|
470
364
|
printNotices(payload);
|
|
471
365
|
}
|
|
472
366
|
|
|
@@ -476,9 +370,9 @@ export async function status(config) {
|
|
|
476
370
|
console.log(JSON.stringify(payload, null, 2));
|
|
477
371
|
printWhatsappIssue(payload.whatsapp);
|
|
478
372
|
|
|
479
|
-
//
|
|
480
|
-
//
|
|
481
|
-
|
|
373
|
+
// Where the newest change stands, without reading the JSON: everyone has it,
|
|
374
|
+
// its tests are running, or one that passes today held it back.
|
|
375
|
+
printShipping(payload.shipping);
|
|
482
376
|
|
|
483
377
|
// A base with content that no deployed agent reads is knowledge the agent
|
|
484
378
|
// cannot reach, and nothing else says so -- it just answers without it. On
|
|
@@ -489,14 +383,14 @@ export async function status(config) {
|
|
|
489
383
|
`reads it — add \`knowledge: [${base.name}]\` to vatio.yml and push.`
|
|
490
384
|
);
|
|
491
385
|
}
|
|
492
|
-
// Edits from the Vatio MCP that
|
|
386
|
+
// Edits from the Vatio MCP that the agent carries, no push has written over
|
|
493
387
|
// and these files have not pulled: the next push is refused until they are.
|
|
494
388
|
const base = config.baseDeploymentFor({ baseUrl: config.resolveBaseUrl(), workspace });
|
|
495
389
|
const edits = asArray(payload.preview_edited_outside_push).filter(
|
|
496
390
|
(edit) => base == null || Number(edit.deployment_id) > base
|
|
497
391
|
);
|
|
498
392
|
if (edits.length > 0) {
|
|
499
|
-
console.error(`
|
|
393
|
+
console.error(`Your agent has ${edits.length === 1 ? "a change" : `${edits.length} changes`} made outside your files:`);
|
|
500
394
|
for (const edit of edits) console.error(` ${editLine(edit)}`);
|
|
501
395
|
console.error(" `vatio pull` brings them into your files before your next push.");
|
|
502
396
|
}
|
|
@@ -504,17 +398,28 @@ export async function status(config) {
|
|
|
504
398
|
printImpact(payload.impact);
|
|
505
399
|
}
|
|
506
400
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
if (!
|
|
510
|
-
|
|
511
|
-
const
|
|
512
|
-
|
|
513
|
-
?
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
401
|
+
// On stderr so piping `vatio status` into jq keeps working.
|
|
402
|
+
function printShipping(shipping) {
|
|
403
|
+
if (!shipping || typeof shipping !== "object" || shipping.state === "live") return;
|
|
404
|
+
|
|
405
|
+
const who = shipping.changed_by ? ` by ${shipping.changed_by}` : "";
|
|
406
|
+
if (shipping.state === "testing") {
|
|
407
|
+
const by = shipping.testing?.expected_by ? `, around ${clock(shipping.testing.expected_by)}` : "";
|
|
408
|
+
console.error(`Your team has #${shipping.newest_version}${who}; everyone gets it once its tests pass${by}.`);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
const held = shipping.held ?? {};
|
|
412
|
+
console.error(`Held: your team has #${shipping.newest_version}${who}, and everyone else keeps #${shipping.version}.`);
|
|
413
|
+
if (held.reason === "tests_capped") console.error(" Vatio could not test it: the workspace used up today's test runs.");
|
|
414
|
+
else if (held.reason === "error") console.error(` Vatio could not put it in place: ${held.message ?? "unknown error"}`);
|
|
415
|
+
else {
|
|
416
|
+
console.error(" These tests pass on the version everyone has and failed on it in every attempt:");
|
|
417
|
+
for (const test of asArray(held.tests)) {
|
|
418
|
+
const untested = test.vatio_error ? " (not tested: an error on Vatio's side)" : "";
|
|
419
|
+
console.error(` ${test.id} — ${test.title}${untested}`);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
console.error(" Another push that fixes it moves it on, or `vatio test rm ID` for a test it made obsolete.");
|
|
518
423
|
}
|
|
519
424
|
|
|
520
425
|
// A number that looks connected while Meta refuses every send from it: first
|
|
@@ -568,7 +473,7 @@ function printImpact(impact) {
|
|
|
568
473
|
if (asked.questions > 0) parts.push(`the agent asked your team ${asked.questions} ${asked.questions === 1 ? "time" : "times"} instead of guessing`);
|
|
569
474
|
if (impact.test_replays > 0) parts.push(`Vatio replayed ${impact.test_replays} test conversations`);
|
|
570
475
|
const held = impact.regressions_held ?? {};
|
|
571
|
-
if (held.count > 0) parts.push(`the
|
|
476
|
+
if (held.count > 0) parts.push(`the tests held ${held.count} ${held.count === 1 ? "regression" : "regressions"} back from everyone`);
|
|
572
477
|
const fixed = impact.reports_fixed ?? {};
|
|
573
478
|
if (fixed.count > 0) {
|
|
574
479
|
parts.push(`${fixed.count} ${fixed.count === 1 ? "report was" : "reports were"} fixed (median ${fixed.median_hours} h)`);
|
|
@@ -616,7 +521,7 @@ export async function diff(config, args) {
|
|
|
616
521
|
const workspace = config.resolveWorkspaceRequired();
|
|
617
522
|
// The diff comes back with the check -- one call instead of "parse here,
|
|
618
523
|
// fetch there, compare with a copy of the platform's rules that may have
|
|
619
|
-
// drifted".
|
|
524
|
+
// drifted".
|
|
620
525
|
const payload = await checkWorkspace(config, workspace, { environment });
|
|
621
526
|
printDiagnostics(payload);
|
|
622
527
|
if (!payload.ok) fail(`diff aborted: the workspace does not load (${asArray(payload.errors).length} error(s))`);
|
package/lib/commands/env.mjs
CHANGED
|
@@ -45,8 +45,7 @@ async function show(client, workspace, name) {
|
|
|
45
45
|
row = await client.environment(name);
|
|
46
46
|
} catch (error) {
|
|
47
47
|
if (error?.status !== 404) throw error;
|
|
48
|
-
|
|
49
|
-
console.log(`${name} on workspace ${workspace} does not exist yet — \`${creates}\` creates it.`);
|
|
48
|
+
console.log(`${name} on workspace ${workspace} does not exist yet — \`vatio push\` creates it.`);
|
|
50
49
|
return;
|
|
51
50
|
}
|
|
52
51
|
|
package/lib/commands/improve.mjs
CHANGED
|
@@ -150,7 +150,7 @@ async function addTest(config, args) {
|
|
|
150
150
|
const judged = added.judged ?? {};
|
|
151
151
|
if (judged.verdict === "pass") {
|
|
152
152
|
console.log(` Passes now: ${judged.reason}`);
|
|
153
|
-
console.log("`vatio test` replays it on every version; once
|
|
153
|
+
console.log("`vatio test` replays it on every version; once everyone's version passes it, a change that fails it does not reach them.");
|
|
154
154
|
} else if (judged.verdict === "fail") {
|
|
155
155
|
console.log(` Fails now: ${judged.reason}`);
|
|
156
156
|
console.log("Fix the agent, `vatio push`, then `vatio test`: `vatio test list` shows it with its replay once it has run.");
|
|
@@ -253,8 +253,8 @@ async function runTests(config, args) {
|
|
|
253
253
|
"A test is what the agent should do when someone asks something:\n" +
|
|
254
254
|
' vatio test add "what a visitor would ask" "what the answer has to do"\n' +
|
|
255
255
|
"\n" +
|
|
256
|
-
"Then `vatio test` replays them all on every version, and
|
|
257
|
-
"
|
|
256
|
+
"Then `vatio test` replays them all on every version, and a change that breaks one\n" +
|
|
257
|
+
"does not reach everyone. Replies the team reports in the inbox become tests too."
|
|
258
258
|
);
|
|
259
259
|
return;
|
|
260
260
|
}
|
|
@@ -4,12 +4,10 @@
|
|
|
4
4
|
// vatio.yml is a list of *names*, and a push neither fills nor empties one.
|
|
5
5
|
// That is why this is a command and not part of the manifest.
|
|
6
6
|
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// the agent -- `vatio kb publish` takes them alone. So: write, try it on
|
|
12
|
-
// preview, publish.
|
|
7
|
+
// A write reaches your team at once and everyone once the tests that pass
|
|
8
|
+
// today pass with it, like every other change (the platform's Ship). Reads
|
|
9
|
+
// show the newest version, the team's; `--env live` reads the one everyone
|
|
10
|
+
// has, while a change is still on its way.
|
|
13
11
|
//
|
|
14
12
|
// A base holds entries, and an entry is markdown you wrote.
|
|
15
13
|
|
|
@@ -47,18 +45,13 @@ export async function kb(config, args) {
|
|
|
47
45
|
case "rollback":
|
|
48
46
|
return fail(
|
|
49
47
|
"`vatio kb rollback` was removed. Restore one entry instead: `vatio kb history BASE` lists what " +
|
|
50
|
-
"reached
|
|
51
|
-
"`vatio kb write BASE ENTRY old.md
|
|
48
|
+
"reached everyone, `vatio kb cat BASE ENTRY --version N > old.md` prints one, and " +
|
|
49
|
+
"`vatio kb write BASE ENTRY old.md` brings it back."
|
|
52
50
|
);
|
|
53
51
|
default: fail(`Unknown kb subcommand: ${sub}\n\n${usage()}`);
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
// `preview` when the platform chose, for messages.
|
|
58
|
-
function envName(env) {
|
|
59
|
-
return env ?? "preview";
|
|
60
|
-
}
|
|
61
|
-
|
|
62
55
|
function usage() {
|
|
63
56
|
return `usage:
|
|
64
57
|
vatio kb List knowledge bases
|
|
@@ -68,12 +61,11 @@ function usage() {
|
|
|
68
61
|
vatio kb write BASE ENTRY [FILE] Write an entry, from FILE or stdin
|
|
69
62
|
vatio kb cat BASE ENTRY [--version N] Print an entry's markdown, or one of its versions
|
|
70
63
|
vatio kb rm-entry BASE ENTRY Delete one entry
|
|
71
|
-
vatio kb status BASE What
|
|
72
|
-
vatio kb
|
|
73
|
-
vatio kb history BASE What reached live, newest first
|
|
64
|
+
vatio kb status BASE What your team has that everyone does not have yet
|
|
65
|
+
vatio kb history BASE What reached everyone, newest first
|
|
74
66
|
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
A write reaches your team at once and everyone once the tests that pass
|
|
68
|
+
today pass with it.`;
|
|
77
69
|
}
|
|
78
70
|
|
|
79
71
|
async function list({ client, workspace, env }) {
|
|
@@ -86,7 +78,7 @@ async function list({ client, workspace, env }) {
|
|
|
86
78
|
|
|
87
79
|
console.log(`Knowledge bases on workspace ${workspace} (${bases.length}):`);
|
|
88
80
|
for (const row of bases) {
|
|
89
|
-
const pending = row.pending_changes ? ` ${row.pending_changes}
|
|
81
|
+
const pending = row.pending_changes ? ` ${row.pending_changes} on their way to everyone` : "";
|
|
90
82
|
console.log(
|
|
91
83
|
` ${row.name} entries=${row.entries_count} ready=${row.answerable_count}` +
|
|
92
84
|
`${pending}${referenceNote(row)}`
|
|
@@ -110,7 +102,7 @@ async function show({ client, workspace, env }, name) {
|
|
|
110
102
|
`ready=${base.answerable_count}${referenceNote(base)}`
|
|
111
103
|
);
|
|
112
104
|
if (base.pending_changes) {
|
|
113
|
-
console.log(` ${base.pending_changes} change(s)
|
|
105
|
+
console.log(` ${base.pending_changes} change(s) only your team has yet — \`vatio kb status ${base.name}\``);
|
|
114
106
|
}
|
|
115
107
|
|
|
116
108
|
const entries = asArray(base.entries);
|
|
@@ -119,10 +111,10 @@ async function show({ client, workspace, env }, name) {
|
|
|
119
111
|
return;
|
|
120
112
|
}
|
|
121
113
|
|
|
122
|
-
console.log(
|
|
114
|
+
console.log("\n entries:");
|
|
123
115
|
for (const entry of entries) {
|
|
124
116
|
const version = entry.version ? ` v${entry.version}` : "";
|
|
125
|
-
const unpublished = entry.published === false ? " (
|
|
117
|
+
const unpublished = entry.published === false ? " (your team only, for now)" : "";
|
|
126
118
|
console.log(` ${entry.name}${version} ${entry.state ?? "?"}${unpublished}`);
|
|
127
119
|
}
|
|
128
120
|
}
|
|
@@ -181,14 +173,12 @@ async function write({ client, workspace, env }, args) {
|
|
|
181
173
|
fail("Nothing to write: pass a FILE, or pipe the markdown in on stdin.");
|
|
182
174
|
}
|
|
183
175
|
|
|
184
|
-
const row = await client.writeKnowledgeEntry({ base, name, content
|
|
176
|
+
const row = await client.writeKnowledgeEntry({ base, name, content });
|
|
185
177
|
const version = row.version ? ` (v${row.version})` : "";
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
console.log(`Wrote ${row.name}${version} to ${base} in ${envName(env)} on workspace ${workspace}`);
|
|
191
|
-
console.log(`${envName(env)} answers with it now; \`vatio publish\` takes it live with the agent.`);
|
|
178
|
+
console.log(`Wrote ${row.name}${version} to ${base} on workspace ${workspace}`);
|
|
179
|
+
// A platform older than this CLI sends no `shipping`.
|
|
180
|
+
if (row.shipping?.reaches_everyone) console.log("Everyone has it now.");
|
|
181
|
+
else if (row.shipping) console.log("Your team has it now; everyone gets it once the tests that pass today pass with it.");
|
|
192
182
|
}
|
|
193
183
|
|
|
194
184
|
// Prints exactly what the platform holds, so a diff against the file you
|
|
@@ -206,57 +196,51 @@ async function cat({ client, env }, args) {
|
|
|
206
196
|
async function removeEntry({ client, workspace, env }, base, name) {
|
|
207
197
|
if (!base || !name) fail("usage: vatio kb rm-entry BASE ENTRY");
|
|
208
198
|
|
|
209
|
-
await client.deleteKnowledgeEntry({ base, name
|
|
210
|
-
console.log(`Deleted entry ${name} from ${base}
|
|
199
|
+
await client.deleteKnowledgeEntry({ base, name });
|
|
200
|
+
console.log(`Deleted entry ${name} from ${base} on workspace ${workspace}`);
|
|
201
|
+
console.log("It goes out like any change: `vatio status` says where it stands.");
|
|
211
202
|
}
|
|
212
203
|
|
|
213
|
-
// What
|
|
214
|
-
//
|
|
204
|
+
// What the team has that everyone does not have yet, entry by entry: the
|
|
205
|
+
// knowledge of a change still on its way (its tests are running, or one held it).
|
|
215
206
|
async function status({ client, workspace, env }, base) {
|
|
216
207
|
if (!base) fail("usage: vatio kb status BASE");
|
|
217
208
|
|
|
218
209
|
const payload = await client.knowledgeChanges(base, { environment: env });
|
|
219
210
|
const changes = asArray(payload.data);
|
|
220
211
|
if (changes.length === 0) {
|
|
221
|
-
console.log(`${base}
|
|
212
|
+
console.log(`${base} on workspace ${workspace}: everyone has every entry your team has`);
|
|
222
213
|
return;
|
|
223
214
|
}
|
|
224
215
|
|
|
225
|
-
console.log(`${base}
|
|
216
|
+
console.log(`${base} on workspace ${workspace}: ${changes.length} change${changes.length === 1 ? "" : "s"} only your team has yet`);
|
|
226
217
|
for (const change of changes) {
|
|
227
218
|
const from = change.live_version ? `v${change.live_version}` : "—";
|
|
228
219
|
const to = change.version ?? change.draft_version;
|
|
229
|
-
|
|
230
|
-
console.log(` ${change.change.padEnd(8)} ${change.name} ${from} → v${to}${conflict}`);
|
|
231
|
-
}
|
|
232
|
-
if (changes.some((change) => change.conflict)) {
|
|
233
|
-
console.log(`\nRead each conflicting entry from live (\`vatio kb cat ${base} ENTRY --env live\`), write your change on top, and it clears.`);
|
|
234
|
-
} else {
|
|
235
|
-
console.log("\n`vatio publish` takes them live with the agent; `vatio kb publish` takes them alone.");
|
|
220
|
+
console.log(` ${change.change.padEnd(8)} ${change.name} ${from} → v${to}`);
|
|
236
221
|
}
|
|
222
|
+
console.log("\nEveryone gets them once the tests pass; `vatio status` says where that stands.");
|
|
237
223
|
}
|
|
238
224
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
console.log(`Published ${names.length} change${names.length === 1 ? "" : "s"} to ${base} from ${envName(env)} on workspace ${workspace}: ${names.join(", ")}`);
|
|
245
|
-
console.log("Live answers from them now.");
|
|
225
|
+
// There is nothing to publish: knowledge goes out with every change. Kept so
|
|
226
|
+
// habits that still run it learn why.
|
|
227
|
+
async function publish() {
|
|
228
|
+
console.log("There is nothing to publish: knowledge reaches your team when you write it, and everyone once the");
|
|
229
|
+
console.log("tests that pass today pass with it. `vatio status` says where the newest change stands.");
|
|
246
230
|
}
|
|
247
231
|
|
|
248
|
-
// Every version that reached
|
|
232
|
+
// Every version that reached everyone, newest first. Going back is writing one
|
|
249
233
|
// of them again.
|
|
250
234
|
async function history(client, workspace, base) {
|
|
251
235
|
if (!base) fail("usage: vatio kb history BASE");
|
|
252
236
|
|
|
253
237
|
const versions = asArray((await client.knowledgeHistory(base)).data);
|
|
254
238
|
if (versions.length === 0) {
|
|
255
|
-
console.log(`Nothing in ${base} on workspace ${workspace} has reached
|
|
239
|
+
console.log(`Nothing in ${base} on workspace ${workspace} has reached everyone yet`);
|
|
256
240
|
return;
|
|
257
241
|
}
|
|
258
242
|
|
|
259
|
-
console.log(`What reached
|
|
243
|
+
console.log(`What reached everyone in ${base} on workspace ${workspace}:`);
|
|
260
244
|
for (const row of versions) {
|
|
261
245
|
const who = row.author ? ` ${row.author}` : "";
|
|
262
246
|
const what = row.deleted ? " deleted" : "";
|
package/lib/commands/misc.mjs
CHANGED
|
@@ -35,7 +35,8 @@ export async function doctor(config) {
|
|
|
35
35
|
} catch (error) {
|
|
36
36
|
console.log(`Workspace: unreadable — ${error.message}`);
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
const source = config.workspaceSource();
|
|
39
|
+
if (slug) console.log(`Workspace: ${slug}${source === MANIFEST_FILE ? "" : ` (from ${source})`}`);
|
|
39
40
|
const token = config.resolveToken();
|
|
40
41
|
console.log(`Token: ${token ? "configured" : "missing — run `vatio login`"}`);
|
|
41
42
|
if (token) console.log(`Account: ${await accountLine(config)}`);
|
|
@@ -60,9 +61,15 @@ export async function whoami(config) {
|
|
|
60
61
|
slug = null;
|
|
61
62
|
}
|
|
62
63
|
if (slug && !slugs.includes(slug)) {
|
|
64
|
+
const source = config.workspaceSource();
|
|
63
65
|
console.log("");
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
if (source === MANIFEST_FILE) {
|
|
67
|
+
console.log(`This directory's workspace, ${slug}, is not one of them: it does not exist yet (\`vatio push\` ` +
|
|
68
|
+
"creates it) or belongs to another account (`vatio login` with that account's email or sign-in).");
|
|
69
|
+
} else {
|
|
70
|
+
console.log(`The workspace ${source} names, ${slug}, is not one of them: check the slug, or it belongs to ` +
|
|
71
|
+
"another account (`vatio login` with that account's email or sign-in).");
|
|
72
|
+
}
|
|
66
73
|
}
|
|
67
74
|
}
|
|
68
75
|
|
|
@@ -161,7 +168,7 @@ export async function init(config, args) {
|
|
|
161
168
|
}
|
|
162
169
|
console.log("");
|
|
163
170
|
console.log("Next:");
|
|
164
|
-
console.log(` edit ${MANIFEST_FILE}, then \`vatio push
|
|
171
|
+
console.log(` edit ${MANIFEST_FILE}, then \`vatio push\``);
|
|
165
172
|
console.log(` docs: ${DOCS_URL}`);
|
|
166
173
|
}
|
|
167
174
|
|
|
@@ -181,8 +188,9 @@ const AGENTS_NOTE = [
|
|
|
181
188
|
"",
|
|
182
189
|
"To fix what supervisors reported and the tests that fail, take them all in",
|
|
183
190
|
"one session: `vatio test list` (follow the instructions at the top of its",
|
|
184
|
-
"output), fix, `vatio push`, `vatio test` until they pass
|
|
185
|
-
"
|
|
191
|
+
"output), fix, `vatio push`, and `vatio test` until they pass: a push reaches",
|
|
192
|
+
"everyone once the tests that pass today pass on it. The `vatio-improve` skill",
|
|
193
|
+
"walks through it.",
|
|
186
194
|
"`vatio test add \"QUESTION\" \"WHAT IT SHOULD DO\"` adds a test.",
|
|
187
195
|
"`vatio tools --env live` shows how each tool's backend has been answering:",
|
|
188
196
|
"error rate, timeouts, latency and the calls that failed.",
|
|
@@ -299,7 +299,12 @@ export async function shareSession(config, args) {
|
|
|
299
299
|
if (transcript.startedAt) form.set("started_at", transcript.startedAt);
|
|
300
300
|
if (transcript.endedAt) form.set("ended_at", transcript.endedAt);
|
|
301
301
|
if (feedback) form.set("feedback", feedback);
|
|
302
|
-
|
|
302
|
+
let workspace = null;
|
|
303
|
+
try {
|
|
304
|
+
workspace = config.resolveWorkspace();
|
|
305
|
+
} catch {
|
|
306
|
+
// A VATIO_WORKSPACE or vatio.yml that names no workspace is no reason to send nothing.
|
|
307
|
+
}
|
|
303
308
|
if (workspace) form.set("workspace", workspace);
|
|
304
309
|
|
|
305
310
|
let response;
|