@cavelon/cli 0.1.10 → 0.1.12
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 +34 -15
- package/dist/access.js +194 -0
- package/dist/acting.js +123 -0
- package/dist/agent-env.js +20 -2
- package/dist/change-confirmation.js +93 -0
- package/dist/commands/api.js +77 -30
- package/dist/commands/chat.js +16 -8
- package/dist/commands/db.js +474 -0
- package/dist/commands/docs.js +83 -7
- package/dist/commands/index.js +7 -0
- package/dist/commands/limits-set.js +11 -5
- package/dist/commands/loops.js +72 -9
- package/dist/commands/models.js +12 -6
- package/dist/commands/sandboxes.js +7 -2
- package/dist/commands/session.js +111 -24
- package/dist/commands/setup.js +1 -1
- package/dist/commands/solution.js +211 -54
- package/dist/commands/tenants.js +55 -12
- package/dist/commands/values.js +104 -23
- package/dist/commands/work.js +13 -5
- package/dist/confirm-token.js +90 -7
- package/dist/context.js +5 -1
- package/dist/contracts.js +37 -12
- package/dist/database-queries.js +301 -0
- package/dist/fsutil.js +14 -0
- package/dist/http.js +69 -3
- package/dist/install.js +30 -0
- package/dist/invoke.js +12 -2
- package/dist/kit-codes.js +9 -2
- package/dist/mcp.js +106 -19
- package/dist/openapi.js +7 -0
- package/dist/package-check.js +19 -0
- package/dist/preview-report.js +2 -2
- package/dist/principal.js +24 -2
- package/dist/printed.js +5 -0
- package/dist/secret-access.js +30 -9
- package/dist/session.js +36 -8
- package/dist/skills/cavelon-authoring/SKILL.md +93 -10
- package/dist/skills/cavelon-long-running/SKILL.md +18 -8
- package/dist/skills/cavelon-loop/SKILL.md +126 -41
- package/dist/skills/cavelon-testing/SKILL.md +32 -3
- package/dist/trace-view.js +10 -0
- package/dist/update-check.js +2 -2
- package/dist/user-config.js +24 -0
- package/package.json +1 -1
|
@@ -133,6 +133,30 @@ no verdict; `cavelon explain <status>` says what it means and what to do next:
|
|
|
133
133
|
The case's own reason (which knowledge base, which value) is in the output of
|
|
134
134
|
`test run --wait`, `wait` and `cavelon trace <run>`.
|
|
135
135
|
|
|
136
|
+
## Database query tools
|
|
137
|
+
|
|
138
|
+
Test a solution with database query tools against a test database, never the
|
|
139
|
+
customer's live one: the test tenant (`--env test`) has a connection of the
|
|
140
|
+
same name pointing at a test database with known rows, set up by a person in
|
|
141
|
+
the Admin. Then:
|
|
142
|
+
|
|
143
|
+
- A step can assert the agent calls the query (`tool_called` with the tool's
|
|
144
|
+
slug), and the judge checks the answer against the known rows.
|
|
145
|
+
- A test run has no signed-in visitor. A query with an identity parameter
|
|
146
|
+
(`end_user.*`), or one without `allows_anonymous`, answers
|
|
147
|
+
`identity_required` there and runs nothing: such a step checks that the
|
|
148
|
+
agent asks the visitor to sign in, not the rows. The instance does not yet
|
|
149
|
+
let a suite name a test Chat User whose identity its queries use (a suite's
|
|
150
|
+
`as_chat_user` reader reads knowledge as that person, nothing more).
|
|
151
|
+
- To check what an identity-scoped query returns for one customer, the tenant
|
|
152
|
+
Owner runs it once with `cavelon db test-run <query> --value <name>=<value>`,
|
|
153
|
+
identity parameters included; it shows what the model would see. Never put
|
|
154
|
+
a real customer's data into a test file.
|
|
155
|
+
- `cavelon db runs <query>` lists each run's outcome and error code (never a
|
|
156
|
+
value or a row), and `cavelon trace` shows the code a failed call answered
|
|
157
|
+
the model with on the tool's span (`error_code`); `cavelon explain <code>`
|
|
158
|
+
says how to fix it.
|
|
159
|
+
|
|
136
160
|
## Reading what happened
|
|
137
161
|
|
|
138
162
|
```bash
|
|
@@ -225,7 +249,12 @@ which the tenant's chat and widget never answer with; a draft answers only a
|
|
|
225
249
|
person's token, as a Playground run. `cavelon api chat` with `harness_id` in
|
|
226
250
|
the body does the same, but needs the id and a confirm. `cavelon deactivate
|
|
227
251
|
--harness <solution>` takes an active solution out of live traffic again; it
|
|
228
|
-
previews first and is the person's decision
|
|
229
|
-
|
|
252
|
+
previews first and is the person's decision: show the preview; over MCP the
|
|
253
|
+
client asks them when you confirm with its token, and from your shell they run
|
|
254
|
+
the confirm command in their own terminal. When every suite passes,
|
|
230
255
|
`cavelon activate --harness <name or slug>` goes through the readiness gate; if the
|
|
231
|
-
token may not activate, a person activates in the Admin.
|
|
256
|
+
token may not activate, a person activates in the Admin. A solution that a
|
|
257
|
+
channel or an active trigger reaches goes live for them at once, so its
|
|
258
|
+
activation previews first and needs the person's yes: show it; over MCP the
|
|
259
|
+
client asks them when you confirm with its token, and from your shell they run
|
|
260
|
+
the confirm command in their own terminal.
|
package/dist/trace-view.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { QUERY_TOOL_TYPE } from "./database-queries.js";
|
|
1
2
|
import { clip } from "./format.js";
|
|
2
3
|
const REASONING_CHARS = 300;
|
|
3
4
|
const VALUE_CHARS = 120;
|
|
@@ -121,6 +122,15 @@ export function retrievalRows(view) {
|
|
|
121
122
|
document_id: h.document_id,
|
|
122
123
|
}));
|
|
123
124
|
}
|
|
125
|
+
export function queryErrorCode(s) {
|
|
126
|
+
if (s.tool_type !== QUERY_TOOL_TYPE)
|
|
127
|
+
return null;
|
|
128
|
+
const output = spanAttributes(s.output_json);
|
|
129
|
+
const preview = typeof output?.output_preview === "string" ? output.output_preview : typeof s.output_json === "string" ? s.output_json : undefined;
|
|
130
|
+
const answer = (preview !== undefined ? spanAttributes(preview) : undefined) ?? output;
|
|
131
|
+
const code = answer?.error;
|
|
132
|
+
return typeof code === "string" && /^[a-z][a-z0-9_]{0,63}$/.test(code) ? code : null;
|
|
133
|
+
}
|
|
124
134
|
export function suggestedSpan(spans) {
|
|
125
135
|
const inOrder = spans.slice().sort((a, b) => (a.sequence ?? 0) - (b.sequence ?? 0));
|
|
126
136
|
const last = (pick) => inOrder.filter(pick).pop();
|
package/dist/update-check.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from "node:fs/promises";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { SKILL_ROOTS } from "./agents.js";
|
|
4
4
|
import { currentInstall, NPM_PACKAGE, REPOSITORY } from "./install.js";
|
|
5
|
-
import { readJsonFile, readTextFile,
|
|
5
|
+
import { readJsonFile, readTextFile, writePrivateFile } from "./fsutil.js";
|
|
6
6
|
import { isGenerated } from "./markers.js";
|
|
7
7
|
import { cacheDir } from "./paths.js";
|
|
8
8
|
import { findProject } from "./project.js";
|
|
@@ -71,7 +71,7 @@ async function withState(io, source, version, fetchImpl, use) {
|
|
|
71
71
|
}
|
|
72
72
|
const result = use(state, now);
|
|
73
73
|
if (JSON.stringify(state) !== before)
|
|
74
|
-
await
|
|
74
|
+
await writePrivateFile(cacheDir(io.env), file, `${JSON.stringify(state, null, 2)}\n`);
|
|
75
75
|
return result;
|
|
76
76
|
}
|
|
77
77
|
function within(stamp, now) {
|
package/dist/user-config.js
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import { configDir } from "./paths.js";
|
|
3
4
|
import { readJsonFile, writeFileAtomic } from "./fsutil.js";
|
|
5
|
+
export const TENANT_REF_TTL_MS = 24 * 60 * 60 * 1000;
|
|
6
|
+
export function credentialFingerprint(token) {
|
|
7
|
+
return createHash("sha256").update(token).digest("hex").slice(0, 16);
|
|
8
|
+
}
|
|
9
|
+
export function cachedTenantRef(settings, ref, token, now) {
|
|
10
|
+
const entry = settings.tenant_refs?.[ref];
|
|
11
|
+
if (!entry || !token || entry.credential !== credentialFingerprint(token))
|
|
12
|
+
return undefined;
|
|
13
|
+
const age = now.getTime() - new Date(entry.resolved_at).getTime();
|
|
14
|
+
return age >= 0 && age < TENANT_REF_TTL_MS ? entry.id : undefined;
|
|
15
|
+
}
|
|
16
|
+
export function withTenantRefs(settings, refs, id, token, now) {
|
|
17
|
+
const credential = credentialFingerprint(token);
|
|
18
|
+
const kept = Object.entries(settings.tenant_refs ?? {}).filter(([, e]) => now.getTime() - new Date(e.resolved_at).getTime() < TENANT_REF_TTL_MS);
|
|
19
|
+
const added = refs.filter((r) => Boolean(r) && !isUuidLike(r)).map((r) => [r, { id, credential, resolved_at: now.toISOString() }]);
|
|
20
|
+
const { tenant_ids: _old, ...rest } = settings;
|
|
21
|
+
return { ...rest, tenant_refs: Object.fromEntries([...kept, ...added]) };
|
|
22
|
+
}
|
|
23
|
+
export function withoutTenantRef(settings, ref) {
|
|
24
|
+
const { [ref]: _gone, ...others } = settings.tenant_refs ?? {};
|
|
25
|
+
return { ...settings, tenant_refs: others };
|
|
26
|
+
}
|
|
27
|
+
const isUuidLike = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
|
4
28
|
export function userConfigPath(env) {
|
|
5
29
|
return path.join(configDir(env), "config.json");
|
|
6
30
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cavelon/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
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",
|