@cavelon/cli 0.1.11 → 0.1.13
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 +12 -6
- package/dist/change-confirmation.js +93 -0
- package/dist/commands/api.js +41 -13
- package/dist/commands/chat.js +6 -3
- package/dist/commands/db.js +181 -19
- package/dist/commands/index.js +2 -1
- package/dist/commands/limits-set.js +7 -3
- package/dist/commands/loops.js +20 -12
- package/dist/commands/models.js +10 -5
- package/dist/commands/session.js +5 -3
- package/dist/commands/setup.js +4 -3
- package/dist/commands/solution.js +73 -28
- package/dist/commands/tenants.js +18 -11
- package/dist/commands/values.js +59 -19
- package/dist/confirm-token.js +80 -5
- package/dist/context.js +2 -0
- package/dist/database-queries.js +168 -0
- package/dist/http.js +34 -2
- package/dist/install.js +30 -0
- package/dist/invoke.js +8 -2
- package/dist/kit-codes.js +4 -2
- package/dist/mcp.js +40 -12
- package/dist/openapi.js +7 -0
- package/dist/printed.js +5 -0
- package/dist/run-program.js +2 -1
- package/dist/secret-access.js +14 -5
- package/dist/setup-agents.js +63 -17
- package/dist/skills/cavelon-authoring/SKILL.md +29 -11
- package/dist/skills/cavelon-long-running/SKILL.md +16 -12
- package/dist/skills/cavelon-loop/SKILL.md +74 -41
- package/dist/skills/cavelon-testing/SKILL.md +13 -4
- package/dist/update-check.js +17 -4
- package/package.json +1 -1
package/dist/install.js
CHANGED
|
@@ -6,11 +6,16 @@ export const REPOSITORY = "goodguys-gmbh/cavelon-dev-kit";
|
|
|
6
6
|
export const NPM_PACKAGE = "@cavelon/cli";
|
|
7
7
|
const WINGET_ID = "goodguys.Cavelon";
|
|
8
8
|
const RELEASES = `https://github.com/${REPOSITORY}/releases/latest`;
|
|
9
|
+
export const PYPI_MARKER = ["share", "cavelon", "pypi"];
|
|
9
10
|
const LABELS = {
|
|
10
11
|
script: "the install script",
|
|
11
12
|
executable: "a downloaded executable",
|
|
12
13
|
homebrew: "Homebrew",
|
|
13
14
|
winget: "winget",
|
|
15
|
+
"uv-tool": "uv tool install",
|
|
16
|
+
pipx: "pipx",
|
|
17
|
+
uvx: "uvx",
|
|
18
|
+
pip: "pip",
|
|
14
19
|
npm: "npm i -g",
|
|
15
20
|
npx: "npx",
|
|
16
21
|
package: "a package manager",
|
|
@@ -32,6 +37,9 @@ export function detectInstall(facts) {
|
|
|
32
37
|
if (platform === "win32" && packages > 0 && lower[packages - 1] === "winget" && lower[packages + 1]?.startsWith(`${WINGET_ID.toLowerCase()}_`)) {
|
|
33
38
|
return { method: "winget", path: file, update: `winget upgrade ${WINGET_ID}`, source: "github" };
|
|
34
39
|
}
|
|
40
|
+
const pypi = pypiInstall(facts, p, lower);
|
|
41
|
+
if (pypi)
|
|
42
|
+
return pypi;
|
|
35
43
|
const name = p.basename(file).toLowerCase();
|
|
36
44
|
if (name !== (platform === "win32" ? "cavelon.exe" : "cavelon")) {
|
|
37
45
|
return { method: "executable", path: file, advice: `Download the new one from ${RELEASES}.`, source: "github" };
|
|
@@ -54,6 +62,28 @@ export function detectInstall(facts) {
|
|
|
54
62
|
return { method: "npm", path: file, update: `npm i -g ${NPM_PACKAGE}`, source: "npm" };
|
|
55
63
|
return { method: "package", path: file, advice: `Update ${NPM_PACKAGE} with the package manager that installed it.`, source: "npm" };
|
|
56
64
|
}
|
|
65
|
+
function pypiInstall(facts, p, lower) {
|
|
66
|
+
const prefix = p.dirname(p.dirname(facts.file));
|
|
67
|
+
const roots = facts.platform === "win32" ? [prefix, p.dirname(prefix)] : [prefix];
|
|
68
|
+
if (!roots.some((root) => facts.exists(p.join(root, ...PYPI_MARKER))))
|
|
69
|
+
return undefined;
|
|
70
|
+
const file = facts.file;
|
|
71
|
+
const follows = (a, b) => lower.some((s, i) => s === a && lower[i + 1] === b);
|
|
72
|
+
const under = (dir) => {
|
|
73
|
+
if (!dir)
|
|
74
|
+
return false;
|
|
75
|
+
const fold = (v) => (facts.platform === "win32" ? v.toLowerCase() : v);
|
|
76
|
+
return fold(file).startsWith(fold(p.join(dir, p.sep)));
|
|
77
|
+
};
|
|
78
|
+
if (follows("uv", "tools") || under(facts.env.UV_TOOL_DIR))
|
|
79
|
+
return { method: "uv-tool", path: file, update: "uv tool upgrade cavelon", source: "github" };
|
|
80
|
+
if (follows("pipx", "venvs") || under(facts.env.PIPX_HOME))
|
|
81
|
+
return { method: "pipx", path: file, update: "pipx upgrade cavelon", source: "github" };
|
|
82
|
+
if ((lower.includes("uv") || under(facts.env.UV_CACHE_DIR)) && lower.some((s) => s.startsWith("archive-v"))) {
|
|
83
|
+
return { method: "uvx", path: file, advice: "uvx reuses the release it cached; `uvx cavelon@latest` runs the newest.", source: "github" };
|
|
84
|
+
}
|
|
85
|
+
return { method: "pip", path: file, update: "pip install --upgrade cavelon", source: "github" };
|
|
86
|
+
}
|
|
57
87
|
function scriptUpdate(facts, dir) {
|
|
58
88
|
const { env } = facts;
|
|
59
89
|
if (facts.platform === "win32") {
|
package/dist/invoke.js
CHANGED
|
@@ -3,6 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import { CavelonError, ExitCode, validationError } from "./errors.js";
|
|
4
4
|
import { bodyBytes, isPlatformRoute } from "./http.js";
|
|
5
5
|
import { coerceParameter, isArrayParameter, operationAt, validateBody } from "./openapi.js";
|
|
6
|
+
import { confirmationRefused } from "./change-confirmation.js";
|
|
6
7
|
import { cavelonCommand } from "./printed.js";
|
|
7
8
|
export async function openapiOrWarn(ctx) {
|
|
8
9
|
try {
|
|
@@ -92,8 +93,9 @@ export async function callOperation(ctx, client, doc, op, args) {
|
|
|
92
93
|
validateBody(doc, op, args.body);
|
|
93
94
|
json = args.body;
|
|
94
95
|
}
|
|
96
|
+
const { change, confirmed } = await client.confirmationBefore(op.method, target, { query, json, form, confirmation: args.confirmation });
|
|
95
97
|
const signal = AbortSignal.timeout(args.timeoutMs ?? (Number(ctx.io.env.CAVELON_HTTP_TIMEOUT_MS) || 30_000));
|
|
96
|
-
const response = await client.fetchRaw(op.method, target, { query, headers, json, form, sendTenant: args.sendTenant, signal });
|
|
98
|
+
const response = await client.fetchRaw(op.method, target, { query, headers: { ...headers, ...confirmed }, json, form, sendTenant: args.sendTenant, signal });
|
|
97
99
|
const contentType = response.headers.get("content-type") ?? "";
|
|
98
100
|
const bytes = await bodyBytes(response, client.resolve(target), signal);
|
|
99
101
|
const isText = /json|text|xml|yaml|markdown|event-stream/.test(contentType) || bytes.length === 0;
|
|
@@ -110,12 +112,16 @@ export async function callOperation(ctx, client, doc, op, args) {
|
|
|
110
112
|
if (!response.ok) {
|
|
111
113
|
if (await client.tenantMoved(op.method, target, response.status, { sendTenant: args.sendTenant }))
|
|
112
114
|
return callOperation(ctx, client, doc, op, args);
|
|
115
|
+
const late = await client.confirmationAsked(response.status, data, change, confirmed);
|
|
116
|
+
if (late)
|
|
117
|
+
return callOperation(ctx, client, doc, op, { ...args, headers: { ...args.headers, ...late }, confirmation: false });
|
|
113
118
|
const pathname = new URL(client.resolve(target)).pathname;
|
|
114
|
-
|
|
119
|
+
const error = await client.refusal(response.status, data, `${op.method} ${pathname}`, response.headers, {
|
|
115
120
|
platform: args.sendTenant === false || isPlatformRoute(pathname),
|
|
116
121
|
method: op.method,
|
|
117
122
|
path: pathname,
|
|
118
123
|
});
|
|
124
|
+
throw confirmationRefused(error, Boolean(confirmed) || args.confirmation === false);
|
|
119
125
|
}
|
|
120
126
|
return { status: response.status, contentType, data: isText ? (text ? data : null) : undefined, bytes: isText ? undefined : bytes };
|
|
121
127
|
}
|
package/dist/kit-codes.js
CHANGED
|
@@ -15,7 +15,7 @@ export const KIT_ERROR_CODES = [
|
|
|
15
15
|
{ code: "platform_role_required", area: "cli", message: "The change is an operator's: it needs a personal access token in Platform mode of a platform role; nothing was sent.", hint: "Ask the instance's operator, or run it with an operator's token." },
|
|
16
16
|
{ code: "forbidden", area: "cli", message: "The credential may not make this change; nothing was sent.", hint: "The message names the permission; a person with it makes the change, or in the Admin." },
|
|
17
17
|
{ code: "token_activation_refused", area: "cli", message: "The personal access token was not created with \"may activate\", so it cannot activate solutions.", hint: "A person activates the solution in the Admin, or creates a token with \"may activate\"." },
|
|
18
|
-
{ code: "secret_needs_a_person", area: "cli", message: "
|
|
18
|
+
{ code: "secret_needs_a_person", area: "cli", message: "This credential cannot set or delete a secret here; nothing was sent. A tenant API key never can, and an instance that lets only a person signed in to the Admin do it refuses every token.", hint: "A person sets it in the Admin under Settings › Secrets; on an instance that still takes a personal access token there, also with `cavelon secrets set <name>` in their own terminal." },
|
|
19
19
|
{ code: "foreign_url", area: "cli", message: "cavelon refused to send the token to a URL outside the instance.", hint: "Check the instance URL; the token goes only to the instance it was stored for." },
|
|
20
20
|
{ code: "network_error", area: "cli", message: "The instance could not be reached.", hint: "Check the instance URL and the network (VPN, proxy, allowlist)." },
|
|
21
21
|
{ code: "request_timeout", area: "cli", message: "The instance did not answer in time.", hint: "Retry; CAVELON_HTTP_TIMEOUT_MS raises the limit per request." },
|
|
@@ -31,7 +31,7 @@ export const KIT_ERROR_CODES = [
|
|
|
31
31
|
{ code: "operation_ambiguous", area: "cli", message: "The short name matches several operations.", hint: "Use the full operationId the message lists." },
|
|
32
32
|
{ code: "operation_for_a_person", area: "cli", message: "The operation stays with a person (the instance marks it, or it changes a secret, a credential or an approval), so an agent does not send it.", hint: "A person runs it in their own terminal, or in the Admin." },
|
|
33
33
|
{ code: "secret_field_for_a_person", area: "cli", message: "The request sets a field the instance marks as a secret value, so an agent does not send it.", hint: "Leave the field out; a person enters the value with `cavelon secrets set <name>` or in the Admin." },
|
|
34
|
-
{ code: "
|
|
34
|
+
{ code: "yes_required", area: "cli", message: "setup changes something and there is no terminal to ask.", hint: "Read the plan it printed, then run it again with --yes." },
|
|
35
35
|
{ code: "operations_unavailable", area: "cli", message: "The instance does not offer the operations API.", hint: "Its operator turns it on with OPERATIONS_API_ENABLED." },
|
|
36
36
|
{ code: "not_an_operation_id", area: "cli", message: "That is not an operation id; they start with op_.", hint: "Commands that start work print the operation id; `cavelon status` lists running ones." },
|
|
37
37
|
{ code: "operation_gone", area: "cli", message: "The operation no longer exists on the instance.", hint: "Start the work again; `cavelon status` lists the running operations." },
|
|
@@ -62,6 +62,8 @@ export const KIT_ERROR_CODES = [
|
|
|
62
62
|
{ code: "preview_discarded", area: "cli", message: "The preview was discarded (apply --discard); nothing was imported.", hint: "Run `cavelon apply` for a new preview, show it, and confirm its id." },
|
|
63
63
|
{ code: "preview_expired", area: "cli", message: "The preview is older than the kit keeps previews; nothing was imported.", hint: "Run `cavelon apply` for a new preview, show it, and confirm its id." },
|
|
64
64
|
{ code: "confirm_token_required", area: "cli", message: "Over MCP, or run by a coding agent in its shell, a changing command confirms only with the token its preview returned, never with true or a bare --confirm.", hint: "Call the tool (or run the command) without confirm, show the person the preview, then call it again with the same arguments and confirm set to its confirm_token (--confirm <token> in a shell)." },
|
|
65
|
+
{ code: "confirm_needs_person", area: "cli", message: "A coding agent cannot confirm this change, even with its preview's token: it reaches live traffic or the whole tenant, or cannot be taken back, and the agent's MCP client cannot ask the person (or the agent runs cavelon in its shell). Nothing was changed.", hint: "Show the person the preview; they run the command the refusal names in their own terminal, outside the agent." },
|
|
66
|
+
{ code: "confirm_declined", area: "cli", message: "The MCP client asked the person to approve the change, and they declined or did not answer in time. Nothing was changed.", hint: "Ask the person whether they want the change; with their yes, confirm again with the same token, or they run the command in their own terminal." },
|
|
65
67
|
{ code: "token_mismatch", area: "cli", message: "The confirm token is not the one for this change: it belongs to another preview, or the change differs from what its preview showed; nothing was changed (exit code 4).", hint: "Show the person the new preview this answer carries, and confirm only with its confirm_token after their yes; a token confirms exactly the change its preview showed." },
|
|
66
68
|
{ code: "unknown_argument", area: "cli", message: "An MCP tool was called with an argument its schema does not list; nothing was done.", hint: "Call it again with the argument the error names (the tool's schema lists them all), spelled in snake_case." },
|
|
67
69
|
{ code: "solution_not_active", area: "cli", message: "Only an active solution can be the tenant's default route; this one is not (a draft, or inactive after a deactivate), so nothing was changed.", hint: "Activate it through the readiness gate and preview the default route in one step: `cavelon activate --harness <slug> --make-default`." },
|
package/dist/mcp.js
CHANGED
|
@@ -3,6 +3,7 @@ import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprot
|
|
|
3
3
|
import { accessFor, allOf, credentialWords, operationAccess, whoInstead } from "./access.js";
|
|
4
4
|
import { formerlyWarning, ownsTenant, propertyName } from "./command.js";
|
|
5
5
|
import { MCP_MAX_WAIT_MS } from "./commands/async.js";
|
|
6
|
+
import { PERSON_WAIT_MS } from "./confirm-token.js";
|
|
6
7
|
import { createContext, withWarnings } from "./context.js";
|
|
7
8
|
import { asCavelonError, CavelonError, ExitCode, usageError } from "./errors.js";
|
|
8
9
|
import { closest } from "./package-references.js";
|
|
@@ -19,13 +20,19 @@ const INSTRUCTIONS = "Tools for one Cavelon instance, acting with the token a pe
|
|
|
19
20
|
"and api for an operation that is not read-only, " +
|
|
20
21
|
"return what they would do and a confirm_token, and change nothing until called again with the same arguments and " +
|
|
21
22
|
"confirm set to that token: show the person the preview first. The token confirms exactly the change the preview showed; " +
|
|
22
|
-
"a different change needs a new preview, and confirm: true is refused.
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
23
|
+
"a different change needs a new preview, and confirm: true is refused. A change that reaches live traffic or the whole tenant, " +
|
|
24
|
+
"or that cannot be taken back, is the person's to confirm, and the token alone does not make it: its preview says " +
|
|
25
|
+
"needs_person. With needs_person \"client\", call again with the token and the client asks the person to approve exactly that " +
|
|
26
|
+
"change; their no, or no answer, changes nothing (confirm_declined). Only after their yes does cavelon ask the instance for " +
|
|
27
|
+
"the confirmation it checks itself; confirmation_required or confirmation_invalid changed nothing: preview again, never retry " +
|
|
28
|
+
"on your own. With needs_person \"terminal\" this client cannot ask " +
|
|
29
|
+
"them: give the person the preview's confirm command, which they run in their own terminal, never in yours. These are " +
|
|
30
|
+
"harness_default and activate (the default route and a solution something reaches: live traffic), deactivate, tenant_create, " +
|
|
31
|
+
"variables_set replacing a value (every solution of the tenant reads it), limits_set, models_set_limit, trigger_identity, " +
|
|
32
|
+
"api for an operation that is not read-only, loop_start unless the trigger's solution is a draft (a run acts as the person " +
|
|
33
|
+
"and spends budget), and apply where its preview says show_to_person (tenant-wide sections, an active solution, deletions, " +
|
|
34
|
+
"env/prod). A draft's apply, a draft's loop_start, loop_cancel, sandbox_seed and kb_upload's replace you confirm with the " +
|
|
35
|
+
"token once the person saw the preview. " +
|
|
29
36
|
"chat sends one message to a solution and returns its answer: the way to try one that is not the default route. " +
|
|
30
37
|
"kb_upload names files that match an active document of the knowledge base; with replace it replaces them, and where the " +
|
|
31
38
|
"instance's upload cannot, it returns what it would deactivate and uploads nothing without its confirm_token. " +
|
|
@@ -51,8 +58,9 @@ const INSTRUCTIONS = "Tools for one Cavelon instance, acting with the token a pe
|
|
|
51
58
|
"variables_list/variables_get/variables_set handle plain-text {{var:…}} values; setting one needs a role that may manage " +
|
|
52
59
|
"the tenant's settings, as a secret does (a Builder's may not): where whoami says the credential may not, tell the person " +
|
|
53
60
|
"who sets it instead of calling variables_set. secrets_list shows which {{secret:…}} " +
|
|
54
|
-
"values are set, never a value: a person sets a secret, so tell them the
|
|
55
|
-
"to run in their terminal,
|
|
61
|
+
"values are set, never a value: a person sets a secret, so tell them how, as the answers name it: the exact " +
|
|
62
|
+
"`cavelon secrets set <name>` command to run in their terminal, or, where the instance lets no token set one, the Admin " +
|
|
63
|
+
"under Settings › Secrets. Never ask for, read or pass a secret value. Never approve or decide an approval; " +
|
|
56
64
|
"that stays with a person. Use docs_search before guessing, " +
|
|
57
65
|
"and api_list/api_describe/api for anything without its own tool. " +
|
|
58
66
|
"use_tenant chooses the tenant for this MCP session only and never changes the tenant stored for the person; every preview " +
|
|
@@ -199,6 +207,24 @@ function missingRequired(spec, args) {
|
|
|
199
207
|
.filter((p) => p.required && (args[p.name] === undefined || args[p.name] === ""))
|
|
200
208
|
.map((p) => p.name);
|
|
201
209
|
}
|
|
210
|
+
const APPROVAL_SCHEMA = {
|
|
211
|
+
type: "object",
|
|
212
|
+
properties: { approve: { type: "boolean", title: "Make this change", description: "Yes makes exactly the change shown; no changes nothing." } },
|
|
213
|
+
required: ["approve"],
|
|
214
|
+
};
|
|
215
|
+
function clientAsks(server) {
|
|
216
|
+
const elicitation = server.getClientCapabilities()?.elicitation;
|
|
217
|
+
return Boolean(elicitation && (elicitation.form || Object.keys(elicitation).length === 0));
|
|
218
|
+
}
|
|
219
|
+
async function askThroughClient(server, message, relatedRequestId) {
|
|
220
|
+
try {
|
|
221
|
+
const result = await server.elicitInput({ mode: "form", message, requestedSchema: APPROVAL_SCHEMA }, { timeout: PERSON_WAIT_MS, relatedRequestId });
|
|
222
|
+
return result.action === "accept" && result.content?.approve === true ? "approved" : "declined";
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
return "unanswered";
|
|
226
|
+
}
|
|
227
|
+
}
|
|
202
228
|
function mcpIo(io) {
|
|
203
229
|
return { ...io, stdout: { write: () => true, isTTY: false } };
|
|
204
230
|
}
|
|
@@ -232,7 +258,7 @@ export function createMcpServer(io, commands, updates = {}) {
|
|
|
232
258
|
const access = await credentialAccess();
|
|
233
259
|
return { tools: tools.map((t) => toolFor(t, commands, access)) };
|
|
234
260
|
});
|
|
235
|
-
async function call(name, given) {
|
|
261
|
+
async function call(name, given, requestId) {
|
|
236
262
|
const spec = byName.get(name);
|
|
237
263
|
const fail = (error) => ({ isError: true, body: { error: asCavelonError(error).toJSON() } });
|
|
238
264
|
if (!spec)
|
|
@@ -252,6 +278,8 @@ export function createMcpServer(io, commands, updates = {}) {
|
|
|
252
278
|
const tenant = !ownsTenant(spec) && typeof args.tenant === "string" ? args.tenant : undefined;
|
|
253
279
|
const solutionEnv = spec.options?.env && typeof args.env === "string" ? args.env : undefined;
|
|
254
280
|
const ctx = createContext(mcpIo(io), { json: true, tenant, solutionEnv, sessionTenants }, "mcp");
|
|
281
|
+
if (clientAsks(server))
|
|
282
|
+
ctx.askPerson = (message) => askThroughClient(server, message, requestId);
|
|
255
283
|
for (const message of renamed)
|
|
256
284
|
ctx.warn(message);
|
|
257
285
|
try {
|
|
@@ -277,9 +305,9 @@ export function createMcpServer(io, commands, updates = {}) {
|
|
|
277
305
|
return fail(error);
|
|
278
306
|
}
|
|
279
307
|
}
|
|
280
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
308
|
+
server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
281
309
|
const warning = notice.forCall(() => server.getClientVersion()?.name);
|
|
282
|
-
const { body, isError } = await call(request.params.name, (request.params.arguments ?? {}));
|
|
310
|
+
const { body, isError } = await call(request.params.name, (request.params.arguments ?? {}), extra.requestId);
|
|
283
311
|
if (!isError && TENANT_CHOOSERS.has(request.params.name))
|
|
284
312
|
void server.sendToolListChanged().catch(() => undefined);
|
|
285
313
|
let out = body;
|
package/dist/openapi.js
CHANGED
|
@@ -40,6 +40,7 @@ export function operations(doc) {
|
|
|
40
40
|
responses: raw.responses ?? {},
|
|
41
41
|
readOnly: method === "get" || method === "head" || method === "options",
|
|
42
42
|
personOnly: personOnlyOf(raw),
|
|
43
|
+
...confirmationOf(raw),
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
46
|
}
|
|
@@ -55,6 +56,12 @@ function personOnlyOf(raw) {
|
|
|
55
56
|
...(typeof reason === "string" && reason.trim() ? { reason: reason.trim() } : {}),
|
|
56
57
|
};
|
|
57
58
|
}
|
|
59
|
+
function confirmationOf(raw) {
|
|
60
|
+
if (raw["x-cavelon-confirmation"] !== "required")
|
|
61
|
+
return {};
|
|
62
|
+
const when = raw["x-cavelon-confirmation-when"];
|
|
63
|
+
return { confirmation: true, ...(typeof when === "string" && when.trim() ? { confirmationWhen: when.trim() } : {}) };
|
|
64
|
+
}
|
|
58
65
|
export function deref(doc, value) {
|
|
59
66
|
let current = value;
|
|
60
67
|
for (let i = 0; i < 10 && current && typeof current === "object" && typeof current.$ref === "string"; i++) {
|
package/dist/printed.js
CHANGED
|
@@ -34,6 +34,11 @@ export function printedCommand(words, override = {}) {
|
|
|
34
34
|
}
|
|
35
35
|
return commandLine(words);
|
|
36
36
|
}
|
|
37
|
+
export function personCommand(...words) {
|
|
38
|
+
const target = current.getStore();
|
|
39
|
+
const spec = target ? commandOf(target.commands, words) : undefined;
|
|
40
|
+
return commandLine(target && spec ? withTarget(spec, words, target) : words);
|
|
41
|
+
}
|
|
37
42
|
function withTokenPlaceholder(words) {
|
|
38
43
|
const at = words.indexOf("--confirm");
|
|
39
44
|
if (at < 0)
|
package/dist/run-program.js
CHANGED
|
@@ -11,7 +11,7 @@ export function invocation(file, args, env = process.env, platform = process.pla
|
|
|
11
11
|
export function runProgram(file, args, options) {
|
|
12
12
|
const how = invocation(file, args, options.env);
|
|
13
13
|
return new Promise((resolve) => {
|
|
14
|
-
execFile(how.file, how.args, {
|
|
14
|
+
const child = execFile(how.file, how.args, {
|
|
15
15
|
env: options.env,
|
|
16
16
|
cwd: options.cwd,
|
|
17
17
|
timeout: options.timeoutMs,
|
|
@@ -29,6 +29,7 @@ export function runProgram(file, args, options) {
|
|
|
29
29
|
return resolve({ code: err.code, stdout, stderr });
|
|
30
30
|
resolve({ code: null, stdout, stderr, error: err.message });
|
|
31
31
|
});
|
|
32
|
+
child.stdin?.end();
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
35
|
export function probeMcpServer(command, args, options) {
|
package/dist/secret-access.js
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
import { pathMatches } from "./access.js";
|
|
1
2
|
import { CavelonError, ExitCode } from "./errors.js";
|
|
2
3
|
import { cavelonCommand, fill } from "./printed.js";
|
|
3
4
|
export const SECRETS_PERMISSIONS = ["settings.secrets.manage", "settings.manage"];
|
|
4
5
|
export const SECRET_SETTER = "A tenant Owner (or another role allowed to manage secrets) sets it, in the Admin under Settings › Secrets or with their own token";
|
|
6
|
+
export const SECRET_SETTER_IN_ADMIN = "A tenant Owner (or another role allowed to manage secrets) sets it, signed in to the Admin under Settings › Secrets";
|
|
7
|
+
export const SECRETS_IN_ADMIN = "in the Admin under Settings › Secrets";
|
|
8
|
+
const SECRET_ROUTE = "/api/v1/secrets/{name}";
|
|
9
|
+
export function secretsInAdminOnly(principal, method = "PUT") {
|
|
10
|
+
if (!principal || !Array.isArray(principal.needs_a_person))
|
|
11
|
+
return null;
|
|
12
|
+
return principal.needs_a_person.some((o) => o.method === method && pathMatches(o.path, SECRET_ROUTE));
|
|
13
|
+
}
|
|
5
14
|
export function maySetSecrets(principal) {
|
|
6
15
|
if (!principal)
|
|
7
16
|
return null;
|
|
8
|
-
if (principal.kind === "api_key")
|
|
17
|
+
if (principal.kind === "api_key" || secretsInAdminOnly(principal))
|
|
9
18
|
return false;
|
|
10
19
|
if (!principal.permissions || principal.mode !== "tenant")
|
|
11
20
|
return null;
|
|
@@ -27,16 +36,16 @@ export function variablesPermissionMissing(verb, name, permissions, value) {
|
|
|
27
36
|
details: { name, permissions, sent: true },
|
|
28
37
|
});
|
|
29
38
|
}
|
|
30
|
-
export function secretSetterHint(name) {
|
|
31
|
-
return `${SECRET_SETTER}: \`${cavelonCommand("secrets", "set", name)}\`.`;
|
|
39
|
+
export function secretSetterHint(name, inAdmin = false) {
|
|
40
|
+
return inAdmin ? `${SECRET_SETTER_IN_ADMIN}.` : `${SECRET_SETTER}: \`${cavelonCommand("secrets", "set", name)}\`.`;
|
|
32
41
|
}
|
|
33
|
-
export function secretsPermissionMissing(verb, name, permissions) {
|
|
42
|
+
export function secretsPermissionMissing(verb, name, permissions, inAdmin = false) {
|
|
34
43
|
const needs = permissions.length ? permissions.join(" or ") : "a permission to manage secrets";
|
|
35
44
|
return new CavelonError(ExitCode.unauthorized, {
|
|
36
45
|
code: "permission_missing",
|
|
37
46
|
status: 403,
|
|
38
47
|
message: `This token's role may not ${verb} secrets: the instance refused it, as that needs ${needs}. Secret ${name} is unchanged.`,
|
|
39
|
-
hint: secretSetterHint(name),
|
|
48
|
+
hint: secretSetterHint(name, inAdmin),
|
|
40
49
|
details: { name, permissions, sent: true },
|
|
41
50
|
});
|
|
42
51
|
}
|
package/dist/setup-agents.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { promises as fs } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { bundledSkills, generatedCopy, INSTALLED_MCP_COMMAND, mcpCommand } from "./agents.js";
|
|
4
|
-
import { readTextFile, writeFileAtomic } from "./fsutil.js";
|
|
4
|
+
import { readJsonFile, readTextFile, writeFileAtomic } from "./fsutil.js";
|
|
5
5
|
import { findProgram } from "./git.js";
|
|
6
6
|
import { isGenerated, removeBlock, removeJsonEntry, upsertBlock, upsertJsonEntry } from "./markers.js";
|
|
7
|
-
import { homeDir } from "./paths.js";
|
|
7
|
+
import { cacheDir, homeDir } from "./paths.js";
|
|
8
8
|
import { runProgram } from "./run-program.js";
|
|
9
|
+
import { KIT_VERSION } from "./version.js";
|
|
9
10
|
export const MARKETPLACE_SOURCE = "goodguys-gmbh/cavelon-dev-kit";
|
|
10
11
|
export const MARKETPLACE = "cavelon-dev-kit";
|
|
11
12
|
export const PLUGIN_ID = "cavelon@cavelon-dev-kit";
|
|
13
|
+
export const GEMINI_EXTENSION = "cavelon";
|
|
14
|
+
export const GEMINI_SOURCE = `https://github.com/${MARKETPLACE_SOURCE}`;
|
|
12
15
|
function vscodeUserDir(env, platform) {
|
|
13
16
|
const home = homeDir(env);
|
|
14
17
|
if (platform === "win32")
|
|
@@ -18,11 +21,14 @@ function vscodeUserDir(env, platform) {
|
|
|
18
21
|
return path.join(env.XDG_CONFIG_HOME || path.join(home, ".config"), "Code", "User");
|
|
19
22
|
}
|
|
20
23
|
const json = (file, key = "mcpServers", extra = {}) => ({ file, format: "json", keys: [key, "cavelon"], extra });
|
|
24
|
+
function geminiHome(env) {
|
|
25
|
+
return path.join(env.GEMINI_CLI_HOME || homeDir(env), ".gemini");
|
|
26
|
+
}
|
|
21
27
|
export function setupAgents(env, platform = process.platform) {
|
|
22
28
|
const home = homeDir(env);
|
|
23
29
|
const claudeDir = env.CLAUDE_CONFIG_DIR || path.join(home, ".claude");
|
|
24
30
|
const codexDir = env.CODEX_HOME || path.join(home, ".codex");
|
|
25
|
-
const geminiDir =
|
|
31
|
+
const geminiDir = geminiHome(env);
|
|
26
32
|
const vscode = vscodeUserDir(env, platform);
|
|
27
33
|
return [
|
|
28
34
|
{
|
|
@@ -64,6 +70,7 @@ export function setupAgents(env, platform = process.platform) {
|
|
|
64
70
|
label: "Gemini CLI",
|
|
65
71
|
commands: ["gemini"],
|
|
66
72
|
folders: [geminiDir],
|
|
73
|
+
plugin: "gemini",
|
|
67
74
|
mcp: json(path.join(geminiDir, "settings.json")),
|
|
68
75
|
skills: path.join(geminiDir, "skills"),
|
|
69
76
|
},
|
|
@@ -146,6 +153,10 @@ async function pluginState(kind, program, env) {
|
|
|
146
153
|
return { error: `\`${display(program, args)}\` did not answer in JSON` };
|
|
147
154
|
}
|
|
148
155
|
};
|
|
156
|
+
if (kind === "gemini") {
|
|
157
|
+
const manifest = await readJsonFile(path.join(geminiHome(env), "extensions", GEMINI_EXTENSION, "gemini-extension.json"));
|
|
158
|
+
return { marketplace: true, installed: manifest?.name === GEMINI_EXTENSION, enabled: true };
|
|
159
|
+
}
|
|
149
160
|
const plugins = await read(["plugin", "list", "--json"]);
|
|
150
161
|
if ("error" in plugins)
|
|
151
162
|
return { error: plugins.error };
|
|
@@ -165,7 +176,25 @@ async function pluginState(kind, program, env) {
|
|
|
165
176
|
function firstLine(text) {
|
|
166
177
|
return (text.split(/\r?\n/).find((l) => l.trim()) ?? "").trim().slice(0, 300);
|
|
167
178
|
}
|
|
179
|
+
function lastLine(text) {
|
|
180
|
+
return (text.split(/\r?\n/).findLast((l) => l.trim()) ?? "").trim().slice(0, 300);
|
|
181
|
+
}
|
|
182
|
+
async function geminiFolder(kind, env) {
|
|
183
|
+
if (kind !== "gemini")
|
|
184
|
+
return undefined;
|
|
185
|
+
const dir = path.join(cacheDir(env), "gemini");
|
|
186
|
+
await fs.mkdir(dir, { recursive: true, mode: 0o700 });
|
|
187
|
+
return dir;
|
|
188
|
+
}
|
|
168
189
|
function pluginCommands(kind) {
|
|
190
|
+
if (kind === "gemini") {
|
|
191
|
+
return {
|
|
192
|
+
marketplaceAdd: [],
|
|
193
|
+
marketplaceRemove: [],
|
|
194
|
+
install: ["extensions", "install", GEMINI_SOURCE, "--ref", `v${KIT_VERSION}`, "--consent"],
|
|
195
|
+
uninstall: ["extensions", "uninstall", GEMINI_EXTENSION],
|
|
196
|
+
};
|
|
197
|
+
}
|
|
169
198
|
return {
|
|
170
199
|
marketplaceAdd: ["plugin", "marketplace", "add", MARKETPLACE_SOURCE],
|
|
171
200
|
marketplaceRemove: ["plugin", "marketplace", "remove", MARKETPLACE],
|
|
@@ -175,23 +204,23 @@ function pluginCommands(kind) {
|
|
|
175
204
|
}
|
|
176
205
|
export async function planAgent(agent, found, env, command, skills, platform = process.platform) {
|
|
177
206
|
const usePlugin = Boolean(agent.plugin && found.program);
|
|
207
|
+
const state = usePlugin ? await pluginState(agent.plugin, found.program, env) : undefined;
|
|
178
208
|
const plan = { agent, found, method: usePlugin ? "plugin" : "files", changes: [] };
|
|
179
|
-
if (usePlugin) {
|
|
209
|
+
if (usePlugin && state) {
|
|
180
210
|
const kind = agent.plugin;
|
|
181
211
|
const program = found.program;
|
|
182
212
|
const commands = pluginCommands(kind);
|
|
183
|
-
const state = await pluginState(kind, program, env);
|
|
184
213
|
if ("error" in state) {
|
|
185
214
|
plan.changes.push({ kind: "plugin", summary: "install the Cavelon plugin", target: display(program, commands.install), outcome: "failed", reason: state.error });
|
|
186
215
|
return plan;
|
|
187
216
|
}
|
|
188
217
|
plan.plugin = state;
|
|
189
|
-
if (!state.marketplace) {
|
|
218
|
+
if (!state.marketplace && commands.marketplaceAdd.length) {
|
|
190
219
|
plan.changes.push({ kind: "marketplace", summary: "add the Cavelon plugin marketplace", target: display(program, commands.marketplaceAdd), outcome: "planned" });
|
|
191
220
|
}
|
|
192
221
|
plan.changes.push({
|
|
193
222
|
kind: "plugin",
|
|
194
|
-
summary: "install the Cavelon plugin (skills and tools)",
|
|
223
|
+
summary: kind === "gemini" ? "install the Cavelon extension (skills and tools)" : "install the Cavelon plugin (skills and tools)",
|
|
195
224
|
target: display(program, commands.install),
|
|
196
225
|
outcome: state.installed ? "unchanged" : "planned",
|
|
197
226
|
...(state.installed && !state.enabled ? { reason: `it is installed but turned off; turn it on in ${agent.label}` } : {}),
|
|
@@ -306,11 +335,19 @@ export async function applyPlan(plan, env, command, skills, record) {
|
|
|
306
335
|
}
|
|
307
336
|
try {
|
|
308
337
|
if (change.kind === "marketplace" || change.kind === "plugin") {
|
|
309
|
-
const
|
|
338
|
+
const kind = plan.agent.plugin;
|
|
339
|
+
const commands = pluginCommands(kind);
|
|
310
340
|
const args = change.kind === "marketplace" ? commands.marketplaceAdd : commands.install;
|
|
311
|
-
const result = await runProgram(plan.found.program, args, { env, timeoutMs: RUN_TIMEOUT_MS });
|
|
341
|
+
const result = await runProgram(plan.found.program, args, { env, timeoutMs: RUN_TIMEOUT_MS, cwd: await geminiFolder(kind, env) });
|
|
312
342
|
if (result.code !== 0) {
|
|
313
|
-
|
|
343
|
+
if (kind === "gemini") {
|
|
344
|
+
const reason = result.error ?? (lastLine(`${result.stdout}\n${result.stderr}`) || `exit ${result.code}`);
|
|
345
|
+
done.push({ ...change, outcome: "skipped", reason: `${reason}; the tools server and skills go into Gemini CLI's files instead` });
|
|
346
|
+
done.push(await mcpChange(plan.agent.mcp, command, true, record));
|
|
347
|
+
done.push(await skillsChange(plan.agent.skills, skills, true, record));
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
350
|
+
done.push({ ...change, outcome: "failed", reason: result.error ?? (firstLine(result.stderr || result.stdout) || `exit ${result.code}`) });
|
|
314
351
|
break;
|
|
315
352
|
}
|
|
316
353
|
if (change.kind === "marketplace")
|
|
@@ -318,6 +355,8 @@ export async function applyPlan(plan, env, command, skills, record) {
|
|
|
318
355
|
else
|
|
319
356
|
record.plugin_installed = true;
|
|
320
357
|
done.push({ ...change, outcome: "done" });
|
|
358
|
+
if (kind === "gemini" && change.kind === "plugin")
|
|
359
|
+
done.push(...(await removeFiles(plan.agent, record, skills, new Set())));
|
|
321
360
|
}
|
|
322
361
|
else if (change.kind === "mcp") {
|
|
323
362
|
done.push(await mcpChange(plan.agent.mcp, command, true, record));
|
|
@@ -340,7 +379,7 @@ export async function removeAgent(agent, record, env, skills, sharedSkillDirs) {
|
|
|
340
379
|
const commands = pluginCommands(agent.plugin);
|
|
341
380
|
const steps = [];
|
|
342
381
|
if (record.plugin_installed)
|
|
343
|
-
steps.push(["plugin", commands.uninstall,
|
|
382
|
+
steps.push(["plugin", commands.uninstall, `uninstall the Cavelon ${agent.plugin === "gemini" ? "extension" : "plugin"}`, "plugin_installed"]);
|
|
344
383
|
if (record.marketplace_added)
|
|
345
384
|
steps.push(["marketplace", commands.marketplaceRemove, "remove the Cavelon plugin marketplace", "marketplace_added"]);
|
|
346
385
|
for (const [kind, args, summary, key] of steps) {
|
|
@@ -348,7 +387,7 @@ export async function removeAgent(agent, record, env, skills, sharedSkillDirs) {
|
|
|
348
387
|
changes.push({ kind, summary, target: [agent.commands[0], ...args].join(" "), outcome: "failed", reason: `${agent.commands[0]} is not on the PATH; run it yourself` });
|
|
349
388
|
continue;
|
|
350
389
|
}
|
|
351
|
-
const result = await runProgram(found.program, args, { env, timeoutMs: RUN_TIMEOUT_MS });
|
|
390
|
+
const result = await runProgram(found.program, args, { env, timeoutMs: RUN_TIMEOUT_MS, cwd: await geminiFolder(agent.plugin, env) });
|
|
352
391
|
if (result.code === 0) {
|
|
353
392
|
delete record[key];
|
|
354
393
|
changes.push({ kind, summary, target: display(found.program, args), outcome: "removed" });
|
|
@@ -358,6 +397,11 @@ export async function removeAgent(agent, record, env, skills, sharedSkillDirs) {
|
|
|
358
397
|
}
|
|
359
398
|
}
|
|
360
399
|
}
|
|
400
|
+
changes.push(...(await removeFiles(agent, record, skills, sharedSkillDirs)));
|
|
401
|
+
return changes;
|
|
402
|
+
}
|
|
403
|
+
async function removeFiles(agent, record, skills, sharedSkillDirs) {
|
|
404
|
+
const changes = [];
|
|
361
405
|
if (record.mcp) {
|
|
362
406
|
const change = await removeMcp(agent.mcp, record.mcp);
|
|
363
407
|
if (change.outcome !== "failed" && change.outcome !== "skipped")
|
|
@@ -444,23 +488,25 @@ async function topmostMissing(dir) {
|
|
|
444
488
|
export async function checkAgent(agent, env, record, platform = process.platform) {
|
|
445
489
|
const found = await findAgent(agent, env, platform);
|
|
446
490
|
const check = { name: agent.name, label: agent.label, found: Boolean(found.program || found.folder), method: null, ok: true, details: [], servers: [] };
|
|
447
|
-
|
|
491
|
+
const state = agent.plugin && found.program ? await pluginState(agent.plugin, found.program, env) : undefined;
|
|
492
|
+
const viaFiles = !state || (agent.plugin === "gemini" && ("error" in state || !state.installed));
|
|
493
|
+
const what = agent.plugin === "gemini" ? "extension" : "plugin";
|
|
494
|
+
if (state && !viaFiles) {
|
|
448
495
|
check.method = "plugin";
|
|
449
|
-
const state = await pluginState(agent.plugin, found.program, env);
|
|
450
496
|
if ("error" in state) {
|
|
451
497
|
check.ok = false;
|
|
452
498
|
check.details.push(`could not ask ${agent.label} about its plugins: ${state.error}`);
|
|
453
499
|
}
|
|
454
500
|
else if (!state.installed) {
|
|
455
501
|
check.ok = false;
|
|
456
|
-
check.details.push(
|
|
502
|
+
check.details.push(`the Cavelon ${what} is not installed`);
|
|
457
503
|
}
|
|
458
504
|
else if (!state.enabled) {
|
|
459
505
|
check.ok = false;
|
|
460
|
-
check.details.push(`the Cavelon
|
|
506
|
+
check.details.push(`the Cavelon ${what} is installed but turned off; turn it on in ${agent.label}`);
|
|
461
507
|
}
|
|
462
508
|
else {
|
|
463
|
-
check.details.push(
|
|
509
|
+
check.details.push(`the Cavelon ${what} is installed`);
|
|
464
510
|
if (platform !== "win32")
|
|
465
511
|
check.servers.push(await serverCommand(env, platform));
|
|
466
512
|
}
|
|
@@ -51,11 +51,12 @@ for a public widget), **propose the change; the person decides.**
|
|
|
51
51
|
without `confirm`). It changes nothing and shows the old and the new value,
|
|
52
52
|
the operation it would send and the permissions it needs. Show that to the
|
|
53
53
|
person with your reason (what fails or waits now), and wait for their answer.
|
|
54
|
-
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
- The confirm is the person's. Over MCP, call `limits_set` again with the
|
|
55
|
+
same arguments and `confirm` set to the preview's `confirm_token`: the
|
|
56
|
+
client then asks the person, and nothing changes without their yes. From
|
|
57
|
+
your shell, the preview's `confirm` is the command the person runs in their
|
|
58
|
+
own terminal: give it to them as it stands (it keeps the `--env` and
|
|
59
|
+
`--tenant` of the preview). Never raise a limit on
|
|
59
60
|
your own, never pick a value higher than the need you named, and never change
|
|
60
61
|
one without telling them.
|
|
61
62
|
- The same goes for the tenant's monthly inference budget
|
|
@@ -109,8 +110,9 @@ endpoint.
|
|
|
109
110
|
- On rows that already exist, `cavelon models list` shows each row's endpoint
|
|
110
111
|
and `max_concurrent_requests` (never a key). `cavelon models set-limit
|
|
111
112
|
<model_id> <n|none>` shows the old and the new value and changes nothing;
|
|
112
|
-
the confirm
|
|
113
|
-
|
|
113
|
+
the confirm changes the row, with the person's yes (over MCP the client asks
|
|
114
|
+
them; from your shell they run the confirm command in their own terminal).
|
|
115
|
+
It refuses a row without a `base_url`.
|
|
114
116
|
Where this instance's package format does not carry the field, `validate`
|
|
115
117
|
warns that the import ignores it; set it this way instead.
|
|
116
118
|
- `model_registry` is tenant-wide: in a solution's folder, `cavelon apply`
|
|
@@ -303,8 +305,9 @@ schema has them: `cavelon validate` reports an unknown section):
|
|
|
303
305
|
token. `cavelon variables list` shows them. A variable
|
|
304
306
|
is tenant-wide: replacing a value previews the old and the new one and
|
|
305
307
|
changes nothing without `--confirm` (the `confirm_token` over MCP); every
|
|
306
|
-
solution of the tenant reads it, active ones too, so
|
|
307
|
-
|
|
308
|
+
solution of the tenant reads it, active ones too, so the confirm needs the
|
|
309
|
+
person's yes: over MCP the client asks them, and from your shell they run
|
|
310
|
+
the confirm command in their own terminal. A new variable is set at once.
|
|
308
311
|
- **Secrets are set by a person, never by you.** Tell the person the exact
|
|
309
312
|
command `apply` printed, `cavelon secrets set <name>` (with the `--env` and
|
|
310
313
|
`--tenant` it printed), to run in their own terminal; it asks for the value
|
|
@@ -316,7 +319,10 @@ schema has them: `cavelon validate` reports an unknown section):
|
|
|
316
319
|
says "may set secrets: no", and `secrets set`, `activate` and `status` then
|
|
317
320
|
name who does instead. Tell the person that a tenant Owner sets it, in the
|
|
318
321
|
Admin under Settings › Secrets or with their own token; do not suggest the
|
|
319
|
-
command to someone whose role cannot run it.
|
|
322
|
+
command to someone whose role cannot run it. Where the instance lets no
|
|
323
|
+
token set a secret (`secret_needs_a_person`; the preview names the Admin
|
|
324
|
+
instead of the command), the person sets it signed in to the Admin under
|
|
325
|
+
Settings › Secrets.
|
|
320
326
|
|
|
321
327
|
## Database query tools
|
|
322
328
|
|
|
@@ -334,7 +340,7 @@ says who does what on the instance.
|
|
|
334
340
|
tool_type: database_query
|
|
335
341
|
scope: tenant_local
|
|
336
342
|
database_query:
|
|
337
|
-
connection: { name: shop-db, dialect: postgresql } # by name only: never a host, user or password
|
|
343
|
+
connection: { name: shop-db, dialect: postgresql } # by name only: never a host, user or password; postgresql, mysql or mssql
|
|
338
344
|
sql_text: SELECT number, status, shipped_at FROM orders WHERE number = :order_no AND email = :email LIMIT 5
|
|
339
345
|
parameters:
|
|
340
346
|
- name: order_no
|
|
@@ -382,6 +388,18 @@ says who does what on the instance.
|
|
|
382
388
|
postal code) rather than one guessable key. Each `:name` in the SQL needs
|
|
383
389
|
exactly one parameter of that name (a literal colon is `\:`); validate checks
|
|
384
390
|
this (`bind_mismatch`) and each parameter's type and constraints.
|
|
391
|
+
- **Stored procedures (SQL Server only).** On an `mssql` connection the SQL
|
|
392
|
+
may instead be exactly one call, `EXEC [schema].[procedure] @p1 = :p1, @p2 =
|
|
393
|
+
:p2`: every argument a placeholder with a declared parameter, no literal,
|
|
394
|
+
`OUTPUT`, option or dynamic SQL (`procedure_call_form`; on another dialect
|
|
395
|
+
`not_select`). `cavelon validate` warns of both. Put fixed values inside the
|
|
396
|
+
procedure. The model gets the first result set. The instance saves, enables
|
|
397
|
+
and runs such a query only while the connection's last test found no write
|
|
398
|
+
privileges, acknowledged or not (`write_privileges_block_procedure`), and
|
|
399
|
+
only for a procedure whose definition the login may read and that only
|
|
400
|
+
reads (`procedure_definition_unreadable`, `procedure_definition_writes`):
|
|
401
|
+
ask the person for a read-only login with `EXECUTE` and `VIEW DEFINITION`
|
|
402
|
+
on procedures that read. Where a procedure is not needed, write a `SELECT`.
|
|
385
403
|
- `cavelon explain <code>` explains every code the connector uses: what
|
|
386
404
|
`validate` and the preview name, the codes of a failed call (`timeout`,
|
|
387
405
|
`identity_required`, …) and of a connection test.
|