@cavelon/cli 0.2.13 → 0.2.14
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/dist/commands/chat.js
CHANGED
|
@@ -61,11 +61,16 @@ function takesApiSource(body) {
|
|
|
61
61
|
return false;
|
|
62
62
|
return schemaErrors(body.doc, field, "api").length === 0;
|
|
63
63
|
}
|
|
64
|
-
async function
|
|
64
|
+
async function answeringSolution(ctx, harness) {
|
|
65
65
|
if (harness)
|
|
66
|
-
return harness
|
|
66
|
+
return harness;
|
|
67
67
|
const route = await readDefaultRoute(ctx).catch(() => undefined);
|
|
68
|
-
return route?.current
|
|
68
|
+
return route?.current;
|
|
69
|
+
}
|
|
70
|
+
function pendingDraftWarning(solution) {
|
|
71
|
+
const revision = typeof solution.draft_revision === "number" ? ` (revision ${solution.draft_revision})` : "";
|
|
72
|
+
const version = typeof solution.published_version === "number" ? ` ${solution.published_version}` : "";
|
|
73
|
+
return `${named(solution)} has unpublished draft changes${revision}; this answer comes from its published version${version}, as visitors get it, not from those changes. Try the draft with \`${cavelonCommand("chat", fill("message"), "--harness", solution.slug, "--draft")}\`.`;
|
|
69
74
|
}
|
|
70
75
|
async function checkDraft(ctx, fields) {
|
|
71
76
|
if (fields && !fields.preview_draft) {
|
|
@@ -243,9 +248,12 @@ export const chat = {
|
|
|
243
248
|
const chatFields = chatBody?.fields;
|
|
244
249
|
if (draft)
|
|
245
250
|
await checkDraft(ctx, chatFields);
|
|
246
|
-
const
|
|
251
|
+
const answering = draft ? undefined : await answeringSolution(ctx, harness);
|
|
252
|
+
const status = answering?.status;
|
|
247
253
|
const published = !draft && (status === undefined || status === "active");
|
|
248
254
|
const apiSource = published && takesApiSource(chatBody);
|
|
255
|
+
if (apiSource && answering?.has_draft === true)
|
|
256
|
+
ctx.warn(pendingDraftWarning(answering));
|
|
249
257
|
if (published && !apiSource && session.tokenKind !== "api_key" && (await accessFor(await ctx.client()))?.kind !== "api_key") {
|
|
250
258
|
ctx.warn("This instance does not publish source on chat, so it takes a personal access token's chat as a Playground run: an active solution answers with its pending draft where there is one. A tenant API key chats with the published version.");
|
|
251
259
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cavelon/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"description": "The cavelon binary: CLI and local MCP server for building Cavelon solutions with a coding agent.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/goodguys-gmbh/cavelon-dev-kit",
|