@cavelon/cli 0.2.13 → 0.2.15

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.
@@ -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 answeringStatus(ctx, harness) {
64
+ async function answeringSolution(ctx, harness) {
65
65
  if (harness)
66
- return harness.status;
66
+ return harness;
67
67
  const route = await readDefaultRoute(ctx).catch(() => undefined);
68
- return route?.current?.status;
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 status = draft ? undefined : await answeringStatus(ctx, harness);
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
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "format": 1,
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "entries": {
5
5
  "omp": [
6
6
  "omp-extension.mjs"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cavelon/cli",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
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",