@cavelon/cli 0.1.13 → 0.1.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/access.js +32 -0
- package/dist/chat-reader.js +68 -0
- package/dist/commands/api.js +8 -1
- package/dist/commands/chat.js +12 -5
- package/dist/commands/db-connections.js +284 -0
- package/dist/commands/db.js +63 -26
- package/dist/commands/index.js +7 -0
- package/dist/commands/session.js +11 -0
- package/dist/commands/solution.js +119 -25
- package/dist/commands/work.js +16 -6
- package/dist/database-queries.js +30 -11
- package/dist/http.js +15 -0
- package/dist/kit-codes.js +2 -0
- package/dist/mcp.js +11 -4
- package/dist/package-check.js +6 -3
- package/dist/package-references.js +5 -1
- package/dist/principal.js +11 -1
- package/dist/skills/cavelon-authoring/SKILL.md +155 -10
- package/dist/skills/cavelon-loop/SKILL.md +63 -16
- package/dist/skills/cavelon-testing/SKILL.md +62 -8
- package/dist/workflow-queries.js +160 -0
- package/package.json +1 -1
package/dist/commands/db.js
CHANGED
|
@@ -6,10 +6,22 @@ import { clip, keyValues, moreHint, table } from "../format.js";
|
|
|
6
6
|
import { callStable } from "../invoke.js";
|
|
7
7
|
import { cavelonCommand, fill } from "../printed.js";
|
|
8
8
|
import { isUuid } from "../session.js";
|
|
9
|
+
import { accessFor, requirePersonForIdentityChoice } from "../access.js";
|
|
10
|
+
function reported(value) {
|
|
11
|
+
if (value === undefined)
|
|
12
|
+
return undefined;
|
|
13
|
+
if (value === null)
|
|
14
|
+
return "unknown";
|
|
15
|
+
if (typeof value === "boolean")
|
|
16
|
+
return value ? "yes" : "no";
|
|
17
|
+
return typeof value === "string" || typeof value === "number" ? value : undefined;
|
|
18
|
+
}
|
|
19
|
+
const WRITE_EVIDENCE = ["kind", "dry_run", "rolled_back", "affected_rows", "committed"];
|
|
20
|
+
const NO_WRITE_RETRY = "Do not retry an ambiguous write outcome. Check the database for the change before anyone repeats it.";
|
|
9
21
|
const FEATURE = "database_connector_enabled";
|
|
10
22
|
const DOCS_PAGE = "administration/database-connectors";
|
|
11
|
-
const connectorOn = (ctx) => requireFeature(ctx, FEATURE, "database_connector_disabled", "the database connector");
|
|
12
|
-
function withPermissionHint(error, hint) {
|
|
23
|
+
export const connectorOn = (ctx) => requireFeature(ctx, FEATURE, "database_connector_disabled", "the database connector");
|
|
24
|
+
export function withPermissionHint(error, hint) {
|
|
13
25
|
if (!(error instanceof CavelonError) || error.status !== 403)
|
|
14
26
|
return error;
|
|
15
27
|
return new CavelonError(error.exitCode, {
|
|
@@ -18,11 +30,12 @@ function withPermissionHint(error, hint) {
|
|
|
18
30
|
message: error.message,
|
|
19
31
|
hint: `${hint} \`${cavelonCommand("whoami")}\` shows the token's role.`,
|
|
20
32
|
docs: error.docs,
|
|
33
|
+
details: error.details,
|
|
21
34
|
});
|
|
22
35
|
}
|
|
23
36
|
const ownerOnly = (error, what) => withPermissionHint(error, `${what} needs the tenant Owner's permission (database_connectors.test), or a superadmin in the Admin; the roles that read the connections do not hold it.`);
|
|
24
|
-
const viewerOnly = (error) => withPermissionHint(error, "Reading the database connector needs database_connectors.view, which the tenant roles that see tools hold, and a superadmin in Tenant mode.");
|
|
25
|
-
async function read(ctx, path, what, query) {
|
|
37
|
+
export const viewerOnly = (error) => withPermissionHint(error, "Reading the database connector needs database_connectors.view, which the tenant roles that see tools hold, and a superadmin in Tenant mode.");
|
|
38
|
+
export async function read(ctx, path, what, query) {
|
|
26
39
|
await connectorOn(ctx);
|
|
27
40
|
try {
|
|
28
41
|
return await callStable(ctx, "GET", path, what, { query });
|
|
@@ -33,7 +46,7 @@ async function read(ctx, path, what, query) {
|
|
|
33
46
|
}
|
|
34
47
|
const listConnections = (ctx) => read(ctx, "/api/v1/database-connectors/connections", "database connections");
|
|
35
48
|
const listQueries = (ctx, connectionId) => read(ctx, "/api/v1/database-connectors/queries", "database queries", { connection_id: connectionId });
|
|
36
|
-
async function resolveConnection(ctx, ref) {
|
|
49
|
+
export async function resolveConnection(ctx, ref) {
|
|
37
50
|
const all = await listConnections(ctx);
|
|
38
51
|
const hit = all.find((c) => c.id === ref.toLowerCase()) ?? all.find((c) => c.name === ref) ?? all.find((c) => c.name.toLowerCase() === ref.toLowerCase());
|
|
39
52
|
if (hit)
|
|
@@ -41,7 +54,7 @@ async function resolveConnection(ctx, ref) {
|
|
|
41
54
|
throw new CavelonError(ExitCode.failure, {
|
|
42
55
|
code: "database_connection_not_found",
|
|
43
56
|
message: `No database connection "${ref}" in this tenant.`,
|
|
44
|
-
hint: `\`${cavelonCommand("db", "connections")}\` lists them${all.length ? ` (${all.map((c) => c.name).slice(0, 10).join(", ")})` : ";
|
|
57
|
+
hint: `\`${cavelonCommand("db", "connections")}\` lists them${all.length ? ` (${all.map((c) => c.name).slice(0, 10).join(", ")})` : "; the tenant Owner creates one with db connections create or in the Admin"}.`,
|
|
45
58
|
});
|
|
46
59
|
}
|
|
47
60
|
async function resolveQuery(ctx, ref) {
|
|
@@ -65,8 +78,8 @@ async function resolveQuery(ctx, ref) {
|
|
|
65
78
|
hint: `\`${cavelonCommand("db", "queries")}\` lists them by the slug of their tool${all.length ? ` (${all.map((q) => q.slug).slice(0, 10).join(", ")})` : ""}.`,
|
|
66
79
|
});
|
|
67
80
|
}
|
|
68
|
-
function connectionView(c) {
|
|
69
|
-
const { ca_certificate_pem: pem, ...rest } = c;
|
|
81
|
+
export function connectionView(c) {
|
|
82
|
+
const { ca_certificate_pem: pem, password: _password, ...rest } = c;
|
|
70
83
|
return { ...rest, ca_certificate_set: Boolean(pem) };
|
|
71
84
|
}
|
|
72
85
|
const DAY_MS = 86_400_000;
|
|
@@ -86,7 +99,7 @@ function expiryWarnings(connections, now) {
|
|
|
86
99
|
? `expired on ${day(cert.not_after)}`
|
|
87
100
|
: `expires on ${day(cert.not_after)} (in ${days === 0 ? "less than a day" : `${days} day${days === 1 ? "" : "s"}`})`;
|
|
88
101
|
warnings.push(`The CA certificate "${cert.subject}" of the database connection "${c.name}" ${when}: from then its TLS check fails, and with it the connection's queries. ` +
|
|
89
|
-
`
|
|
102
|
+
`The tenant Owner uploads the renewed public CA with db connections ca or in the Admin, then tests the connection again: ${cavelonCommand("db", "test", c.name)}`);
|
|
90
103
|
}
|
|
91
104
|
}
|
|
92
105
|
return warnings;
|
|
@@ -143,7 +156,7 @@ function firewallSentence(offer) {
|
|
|
143
156
|
}
|
|
144
157
|
export const dbInstance = {
|
|
145
158
|
name: "db instance",
|
|
146
|
-
summary: "What this instance offers for database connections:
|
|
159
|
+
summary: "What this instance offers for database connections: dialects, firewall addresses and write-query support where published.",
|
|
147
160
|
description: "Read it before a database connection is set up: a connection of a dialect the instance does not run can be saved, but\n" +
|
|
148
161
|
"its test and queries answer unavailable, and the customer's database must let the instance's egress addresses in. An\n" +
|
|
149
162
|
"instance older than this route says only its dialects, in its capabilities.",
|
|
@@ -175,6 +188,8 @@ export const dbInstance = {
|
|
|
175
188
|
["dialects", offer.runnable_dialects.join(", ") || "none"],
|
|
176
189
|
["egress_ips", offer.network.egress_ips.join(", ") || "none named"],
|
|
177
190
|
["connections_per_process", offer.network.connections_per_process],
|
|
191
|
+
["write_queries", reported(offer.write_queries)],
|
|
192
|
+
["max_affected_rows_limit", reported(offer.max_affected_rows_limit)],
|
|
178
193
|
]),
|
|
179
194
|
"",
|
|
180
195
|
firewall,
|
|
@@ -186,7 +201,8 @@ export const dbInstance = {
|
|
|
186
201
|
export const dbConnections = {
|
|
187
202
|
name: "db connections",
|
|
188
203
|
summary: "The tenant's database connections: dialect, target, TLS mode, CA certificates, last test and query count; never a password.",
|
|
189
|
-
description: "A
|
|
204
|
+
description: "A token holding database_connectors.manage creates and changes connections; a person sets the password in the Admin.\n" +
|
|
205
|
+
"allows_writes, when published, is read-only here: enabling writes remains a dashboard action. A package names a connection by\n" +
|
|
190
206
|
"name and dialect, so the same name serves in every tenant and environment. A query tool is ready for agents only while\n" +
|
|
191
207
|
"its connection is enabled and its last test passed; the tenant Owner runs the test with `cavelon db test <connection>`.\n" +
|
|
192
208
|
`It warns of a CA certificate that has expired or expires within ${EXPIRY_WARNING_DAYS} days.`,
|
|
@@ -209,6 +225,7 @@ export const dbConnections = {
|
|
|
209
225
|
target: `${conn.host}:${conn.port}/${conn.database_name}`,
|
|
210
226
|
tls: conn.tls_mode,
|
|
211
227
|
enabled: conn.is_enabled ? "yes" : "no",
|
|
228
|
+
...(typeof conn.allows_writes === "boolean" ? { allows_writes: conn.allows_writes ? "yes" : "no" } : {}),
|
|
212
229
|
last_test: lastTest(conn),
|
|
213
230
|
queries: conn.query_count ?? null,
|
|
214
231
|
id: conn.id,
|
|
@@ -220,8 +237,8 @@ export const dbConnections = {
|
|
|
220
237
|
const procedureRefused = connections.filter((c) => c.procedure_call_refusal?.code);
|
|
221
238
|
return {
|
|
222
239
|
data: page,
|
|
223
|
-
text: (table(rows, ["name", "dialect", "target", "tls", "enabled", "last_test", "queries", "id"]) ||
|
|
224
|
-
`No database connections.
|
|
240
|
+
text: (table(rows, ["name", "dialect", "target", "tls", "enabled", ...(rows.some(c => "allows_writes" in c) ? ["allows_writes"] : []), "last_test", "queries", "id"]) ||
|
|
241
|
+
`No database connections. The tenant Owner creates one with db connections create or in the Admin (\`${cavelonCommand("docs", "get", DOCS_PAGE)}\` says who does what).`) +
|
|
225
242
|
caLines(connections).join("\n") +
|
|
226
243
|
moreHint(page.next_cursor, cavelonCommand("db", "connections")) +
|
|
227
244
|
(untested.length ? `\n\nNot tested successfully: ${untested.join(", ")}; its queries are not ready for agents. The Owner tests one with: ${cavelonCommand("db", "test", fill("connection"))}` : "") +
|
|
@@ -236,9 +253,11 @@ export const dbConnections = {
|
|
|
236
253
|
export const dbQueries = {
|
|
237
254
|
name: "db queries",
|
|
238
255
|
summary: "The tenant's saved database queries by tool slug; with a query, its SQL, parameters and limits.",
|
|
239
|
-
description: "Each saved query is one agent tool (tool_type database_query).
|
|
240
|
-
"
|
|
241
|
-
"
|
|
256
|
+
description: "Each saved query is one agent tool (tool_type database_query). The tenant Owner or a superadmin in Tenant mode writes\n" +
|
|
257
|
+
"it with database_connectors.manage: in the Admin or through apply with a personal access token and the person's approval.\n" +
|
|
258
|
+
"`cavelon pull` writes its definition into the package's tools. A parameter filled by end_user.* comes from the signed-in visitor, never from\n" +
|
|
259
|
+
"the model. Where published, kind is read or write; write settings are max_affected_rows, requires_confirmation and max_calls.\n" +
|
|
260
|
+
"Without a query: one line per query. With one (its tool's slug or the query's id): the whole query.",
|
|
242
261
|
readOnly: true,
|
|
243
262
|
idempotent: true,
|
|
244
263
|
mcpTool: "db_queries",
|
|
@@ -254,14 +273,17 @@ export const dbQueries = {
|
|
|
254
273
|
if (ref) {
|
|
255
274
|
const q = await resolveQuery(ctx, ref);
|
|
256
275
|
const connection = (await listConnections(ctx)).find((c) => c.id === q.connection_id);
|
|
257
|
-
const procedure = isProcedureCall(q.sql_text, connection?.dialect);
|
|
276
|
+
const procedure = q.kind !== "write" && isProcedureCall(q.sql_text, connection?.dialect);
|
|
258
277
|
const refusal = procedure ? connection?.procedure_call_refusal : undefined;
|
|
259
278
|
const text = [
|
|
260
279
|
keyValues([
|
|
261
280
|
["query", `${q.slug} (${q.name})`],
|
|
262
281
|
["connection", q.connection_name],
|
|
263
282
|
["description", q.description ? clip(q.description, 300) : undefined],
|
|
264
|
-
["
|
|
283
|
+
["kind", reported(q.kind)],
|
|
284
|
+
["limits", `max_rows ${q.max_rows}, max_result_chars ${q.max_result_chars}${typeof q.max_affected_rows === "number" ? `, max_affected_rows ${q.max_affected_rows}` : ""}`],
|
|
285
|
+
["requires_confirmation", reported(q.requires_confirmation)],
|
|
286
|
+
["max_calls", reported(q.max_calls)],
|
|
265
287
|
["anonymous", q.allows_anonymous ? "visitors may call it without signing in" : "a signed-in visitor only"],
|
|
266
288
|
["enabled", q.is_enabled ? "yes" : "no"],
|
|
267
289
|
["version", q.version],
|
|
@@ -294,6 +316,7 @@ export const dbQueries = {
|
|
|
294
316
|
slug: q.slug,
|
|
295
317
|
name: q.name,
|
|
296
318
|
connection: q.connection_name,
|
|
319
|
+
kind: q.kind ?? null,
|
|
297
320
|
parameters: q.parameters.map((p) => (filledBy(p) === "model" ? p.name : `${p.name} (${filledBy(p)})`)).join(", ") || null,
|
|
298
321
|
max_rows: q.max_rows,
|
|
299
322
|
anonymous: q.allows_anonymous ? "yes" : "no",
|
|
@@ -302,7 +325,7 @@ export const dbQueries = {
|
|
|
302
325
|
}));
|
|
303
326
|
return {
|
|
304
327
|
data: page,
|
|
305
|
-
text: (table(rows, ["slug", "name", "connection", "parameters", "max_rows", "anonymous", "enabled", "version"], 60) || "No database queries.") +
|
|
328
|
+
text: (table(rows, ["slug", "name", "connection", ...(page.items.some(q => q.kind !== undefined) ? ["kind"] : []), "parameters", "max_rows", "anonymous", "enabled", "version"], 60) || "No database queries.") +
|
|
306
329
|
moreHint(page.next_cursor, cavelonCommand("db", "queries")) +
|
|
307
330
|
(rows.length ? `\n\nOne query in full: ${cavelonCommand("db", "queries", fill("slug"))}` : ""),
|
|
308
331
|
};
|
|
@@ -310,7 +333,7 @@ export const dbQueries = {
|
|
|
310
333
|
};
|
|
311
334
|
export const dbRuns = {
|
|
312
335
|
name: "db runs",
|
|
313
|
-
summary: "A saved query's runs,
|
|
336
|
+
summary: "A saved query's runs: outcome, counts and published write evidence (kind, affected_rows, committed, dry_run); never values or rows.",
|
|
314
337
|
description: "Every run leaves this evidence, an agent's call and a test run alike; the instance keeps no parameter value, row or SQL.\n" +
|
|
315
338
|
"`cavelon explain <code>` says what an error code means and how to fix it.",
|
|
316
339
|
readOnly: true,
|
|
@@ -346,12 +369,14 @@ export const dbRuns = {
|
|
|
346
369
|
rows: r.row_count ?? null,
|
|
347
370
|
truncated: r.truncated ? "yes" : null,
|
|
348
371
|
version: r.query_version,
|
|
372
|
+
...Object.fromEntries(WRITE_EVIDENCE.filter(k => k !== "rolled_back").map(k => [k, reported(r[k]) ?? null])),
|
|
349
373
|
}));
|
|
350
374
|
return {
|
|
351
375
|
data: { query: { id: q.id, slug: q.slug, version: q.version }, items, next_cursor: next },
|
|
352
|
-
text: (table(rows, ["at", "source", "outcome", "error_code", "duration_ms", "rows", "truncated", "version"]) || `No runs of ${q.slug} yet.`) +
|
|
376
|
+
text: (table(rows, ["at", "source", "outcome", "error_code", "duration_ms", "rows", ...WRITE_EVIDENCE.filter(k => k !== "rolled_back" && items.some(r => r[k] !== undefined)), "truncated", "version"]) || `No runs of ${q.slug} yet.`) +
|
|
353
377
|
moreHint(next, cavelonCommand("db", "runs", q.slug)) +
|
|
354
|
-
explainLine(items.map((r) => r.error_code))
|
|
378
|
+
explainLine(items.map((r) => r.error_code)) +
|
|
379
|
+
(items.some(r => r.error_code === "write_outcome_unknown") ? `\n\n${NO_WRITE_RETRY}` : ""),
|
|
355
380
|
};
|
|
356
381
|
},
|
|
357
382
|
};
|
|
@@ -471,14 +496,19 @@ export const dbTestRun = {
|
|
|
471
496
|
description: "Needs the tenant Owner's permission (database_connectors.test); it reads the customer's own data. Give each parameter\n" +
|
|
472
497
|
"with --value name=value, those the platform fills from the signed-in visitor (end_user.*) too: that is how an\n" +
|
|
473
498
|
"identity-scoped query is checked for one customer. The instance records the run (counts only) and audits it with your\n" +
|
|
474
|
-
"name
|
|
475
|
-
"
|
|
499
|
+
"name. Where the instance publishes the matching needs_a_person_when restriction, the kit refuses an API key on an\n" +
|
|
500
|
+
"end_user.* query before sending (exit 5): a person tests it in the Admin or with their personal access token. Ordinary queries\n" +
|
|
501
|
+
"remain usable with an API key. On an older instance that omits the restriction, the server decides.\n" +
|
|
502
|
+
"The rows come back once and are never stored. A failed run names its code; `cavelon explain <code>` says more.\n" +
|
|
503
|
+
"A write query's test is a dry run that rolls back; it still needs the connection to allow writes. The result reports\n" +
|
|
504
|
+
"kind, dry_run, rolled_back, affected_rows and committed only where published; an omitted value stays unknown. Never\n" +
|
|
505
|
+
"retry an ambiguous write outcome. A read stored-procedure query (SQL Server) shows the procedure's first result set; the instance refuses its run (exit 4)\n" +
|
|
476
506
|
"while the connection's last test found write privileges or the procedure's definition writes or cannot be read, and\n" +
|
|
477
507
|
"a run whose procedure ended the connector's transaction comes back with a notice saying so and whether the query was\n" +
|
|
478
508
|
"switched off.",
|
|
479
509
|
readOnly: false,
|
|
480
510
|
idempotent: true,
|
|
481
|
-
mcpEffect: "
|
|
511
|
+
mcpEffect: "Tests the saved query once on the instance; writes are dry runs that roll back. Leaves a run record and audit entry, and changes no setting. Never retry an ambiguous write outcome.",
|
|
482
512
|
mcpTool: "db_test_run",
|
|
483
513
|
operations: ["POST /api/v1/database-connectors/queries/{query_id}/test-run"],
|
|
484
514
|
positionals: [{ name: "query", description: "The query's tool slug or id.", required: true }],
|
|
@@ -489,6 +519,9 @@ export const dbTestRun = {
|
|
|
489
519
|
examples: ["cavelon db test-run order_status --value order_no=A-10023 --value email=ada@example.com", "cavelon db test-run stock --value sku=4711 --json"],
|
|
490
520
|
async run(ctx, input) {
|
|
491
521
|
const query = await resolveQuery(ctx, positional(input, "query"));
|
|
522
|
+
if (query.parameters.some(p => p.source?.startsWith("end_user."))) {
|
|
523
|
+
requirePersonForIdentityChoice(await accessFor(await ctx.client()), "POST /api/v1/database-connectors/queries/{query_id}/test-run", "test a query with end_user.* parameters");
|
|
524
|
+
}
|
|
492
525
|
const values = runValues(query, listOption(input, "value"));
|
|
493
526
|
const shown = intOption(input, "rows", { min: 0, max: 500, fallback: ROWS_SHOWN });
|
|
494
527
|
let result;
|
|
@@ -500,6 +533,9 @@ export const dbTestRun = {
|
|
|
500
533
|
});
|
|
501
534
|
}
|
|
502
535
|
catch (error) {
|
|
536
|
+
if (query.kind === "write" && error instanceof CavelonError && (error.code === "network_error" || error.code === "request_timeout")) {
|
|
537
|
+
throw new CavelonError(error.exitCode, { code: error.code, status: error.status, message: error.message, hint: NO_WRITE_RETRY, docs: error.docs, details: error.details });
|
|
538
|
+
}
|
|
503
539
|
throw refusedRun(ownerOnly(error, "A test run"), query);
|
|
504
540
|
}
|
|
505
541
|
const ok = result.outcome === "ok" && !result.error_code;
|
|
@@ -513,6 +549,7 @@ export const dbTestRun = {
|
|
|
513
549
|
["rows", ok ? `${result.returned_rows ?? rows.length} returned of ${result.row_count ?? "?"}${result.truncated ? ", truncated for the model" : ""}` : undefined],
|
|
514
550
|
["duration_ms", result.duration_ms],
|
|
515
551
|
["notice", result.notice || undefined],
|
|
552
|
+
...WRITE_EVIDENCE.map(k => [k, reported(result[k])]),
|
|
516
553
|
]),
|
|
517
554
|
"",
|
|
518
555
|
"What the model sees:",
|
|
@@ -522,7 +559,7 @@ export const dbTestRun = {
|
|
|
522
559
|
].join("\n");
|
|
523
560
|
return {
|
|
524
561
|
data: { query: { id: query.id, slug: query.slug, version: query.version }, ...result },
|
|
525
|
-
text: text + explainLine([result.error_code]),
|
|
562
|
+
text: text + explainLine([result.error_code]) + (result.error_code === "write_outcome_unknown" ? `\n\n${NO_WRITE_RETRY}` : ""),
|
|
526
563
|
exitCode: ok ? ExitCode.ok : ExitCode.validation,
|
|
527
564
|
};
|
|
528
565
|
},
|
package/dist/commands/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import { schema } from "./schema.js";
|
|
|
15
15
|
import { harnessClone, harnessDefault, harnessList, harnessNew, tenantCreate, tenantList } from "./tenants.js";
|
|
16
16
|
import { kbUpload, testRun, trace } from "./work.js";
|
|
17
17
|
import { dbConnections, dbInstance, dbQueries, dbRuns, dbTest, dbTestRun } from "./db.js";
|
|
18
|
+
import { dbConnectionCa, dbConnectionCreate, dbConnectionDelete, dbConnectionUpdate, dbLoginScript, dbSchema } from "./db-connections.js";
|
|
18
19
|
import { secretsDelete, secretsList, secretsSet, variablesDelete, variablesGet, variablesList, variablesSet } from "./values.js";
|
|
19
20
|
import { loopCancel, loopIterations, loopPause, loopResume, loopStart, loopWatch, triggerIdentity } from "./loops.js";
|
|
20
21
|
import { artifactsExport, sandboxActivity, sandboxCat, sandboxFiles, sandboxList, sandboxLogs, sandboxReceipt, sandboxRefresh, sandboxSeed, sandboxValidate, } from "./sandboxes.js";
|
|
@@ -105,6 +106,12 @@ export const COMMANDS = [
|
|
|
105
106
|
trace,
|
|
106
107
|
dbInstance,
|
|
107
108
|
dbConnections,
|
|
109
|
+
dbConnectionCreate,
|
|
110
|
+
dbConnectionUpdate,
|
|
111
|
+
dbConnectionDelete,
|
|
112
|
+
dbConnectionCa,
|
|
113
|
+
dbLoginScript,
|
|
114
|
+
dbSchema,
|
|
108
115
|
dbQueries,
|
|
109
116
|
dbRuns,
|
|
110
117
|
dbTest,
|
package/dist/commands/session.js
CHANGED
|
@@ -316,6 +316,7 @@ function reachText(reach) {
|
|
|
316
316
|
export const whoami = {
|
|
317
317
|
name: "whoami",
|
|
318
318
|
summary: "Show who the token acts as, in which tenant, and where the token came from.",
|
|
319
|
+
description: "Shows needs_a_person and the optional needs_a_person_when separately. Conditional identity guidance leaves ordinary requests usable; an omitted list stays unknown.",
|
|
319
320
|
readOnly: true,
|
|
320
321
|
idempotent: true,
|
|
321
322
|
mcpTool: "whoami",
|
|
@@ -393,6 +394,7 @@ export const whoami = {
|
|
|
393
394
|
scopes: principal?.api_key?.scopes ?? null,
|
|
394
395
|
permissions: access?.permissions ?? null,
|
|
395
396
|
needs_a_person: access?.complete ? access.needsAPerson : null,
|
|
397
|
+
needs_a_person_when: access?.needsAPersonWhen ?? null,
|
|
396
398
|
published: Boolean(principal),
|
|
397
399
|
},
|
|
398
400
|
owner: me
|
|
@@ -442,6 +444,7 @@ export const whoami = {
|
|
|
442
444
|
["scopes", data.credential.scopes ? data.credential.scopes.join(", ") || "none" : undefined],
|
|
443
445
|
["permissions", permissionsText(access)],
|
|
444
446
|
["needs a person", needsAPersonText(access)],
|
|
447
|
+
["needs a person when", needsAPersonWhenText(access)],
|
|
445
448
|
["platform mode", typeof principal?.token?.platform_mode_allowed === "boolean" ? platformModeText(principal.token) : undefined],
|
|
446
449
|
["reaches", reach ? reachText(reach) : undefined],
|
|
447
450
|
["version", data.instance.version ? `${data.instance.version}${versionCachedAt ? ` (cached at ${versionCachedAt})` : ""}` : undefined],
|
|
@@ -482,6 +485,13 @@ function needsAPersonText(access) {
|
|
|
482
485
|
const shown = all.slice(0, LISTED).map((o) => `\n ${o.method} ${o.path}${o.reason ? ` (${clip(o.reason, 80)})` : ""}`);
|
|
483
486
|
return `${all.length} operation${all.length === 1 ? "" : "s"} a person runs, not this credential:${shown.join("")}${all.length > LISTED ? `\n … ${all.length - LISTED} more (--json)` : ""}`;
|
|
484
487
|
}
|
|
488
|
+
function needsAPersonWhenText(access) {
|
|
489
|
+
const all = access?.needsAPersonWhen;
|
|
490
|
+
if (!all?.length)
|
|
491
|
+
return undefined;
|
|
492
|
+
const shown = all.slice(0, LISTED).map(o => `\n ${o.method} ${o.path}: ${clip(o.reason, 160)}`);
|
|
493
|
+
return `Only in these cases; ordinary requests remain usable:${shown.join("")}${all.length > LISTED ? `\n … ${all.length - LISTED} more (--json)` : ""}`;
|
|
494
|
+
}
|
|
485
495
|
function secretsText(may, inAdmin) {
|
|
486
496
|
if (may === null)
|
|
487
497
|
return undefined;
|
|
@@ -622,6 +632,7 @@ function limitsLine(state, near) {
|
|
|
622
632
|
export const status = {
|
|
623
633
|
name: "status",
|
|
624
634
|
summary: "Show the instance, tenant, solution, running operations and quotas close to full for this directory.",
|
|
635
|
+
description: "For the folder's solution, shows readiness and whether activation would take the default chat and widget route. An omitted route flag is unknown. Readiness reserves no route state; activation reports the actual effect.",
|
|
625
636
|
readOnly: true,
|
|
626
637
|
idempotent: true,
|
|
627
638
|
mcpTool: "status",
|