@cavelon/cli 0.1.16 → 0.1.17

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 CHANGED
@@ -21,11 +21,12 @@ in Windows PowerShell. With Python, `uvx cavelon` runs the same executable from
21
21
  PyPI, and `uv tool install cavelon` or `pipx install cavelon` installs it. Then
22
22
  `cavelon setup` sets up your coding agents and logs you in.
23
23
 
24
- Version 0.1.16 adds OpenCode and Pi with bundled native approval dialogs and
25
- Qwen Code CLI with native settings, skills and person-terminal confirmation:
24
+ Version 0.1.17 adds Cline, Kilo, Goose and OMP to the OpenCode, Pi and Qwen
25
+ Code integrations. Each has native settings and four skills; guarded changes
26
+ use the qualified client dialog or the person’s own terminal:
26
27
 
27
28
  ```bash
28
- cavelon setup --agents opencode,pi,qwen
29
+ cavelon setup --agents opencode,pi,qwen,cline,kilo,goose,omp
29
30
  ```
30
31
 
31
32
  See the [client install pages](https://github.com/goodguys-gmbh/cavelon-dev-kit/blob/main/docs/install/README.md)
@@ -122,7 +123,7 @@ Every command takes `--json` (one JSON document on stdout, errors included),
122
123
 
123
124
  | Command | Marked | What it does |
124
125
  |---|---|---|
125
- | `setup [--agents] [--yes] [--check] [--remove]` | changing (destructive) | Set up the coding agents on this computer (the plugin for Claude Code and Codex; the MCP server and skills in the user settings of Cursor, VS Code with GitHub Copilot, Gemini CLI and Kiro) and log in. `--check` reports what works, `--remove` undoes it. A person runs this; not an MCP tool. |
126
+ | `setup [--agents] [--yes] [--check] [--remove]` | changing (destructive) | Set up supported coding agents with their plugin or native MCP configuration and all four skills, then log in. `--check` reports what works, `--remove` undoes it. A person runs this; not an MCP tool. |
126
127
  | `login [--token-stdin]` | changing | Store a token for an instance. A person runs this. |
127
128
  | `logout [--all]` | changing | Delete the stored token. |
128
129
  | `whoami` | read-only | Owner or key, tenant (name, slug and id), role, where the credential came from, whether it may enter Platform mode and which tenants it reaches. |
@@ -204,6 +205,14 @@ release.
204
205
 
205
206
  ### Limits
206
207
 
208
+ `cavelon db instance` and `cavelon limits` show published database connection
209
+ and query caps, current counts, their source and platform defaults. Missing
210
+ counts on older instances are left out. An operator with `limits.manage`
211
+ uses a Platform-mode personal access token to preview an override with
212
+ `cavelon limits set database_queries_per_tenant 250 --tenant acme` and sends
213
+ it after the person's confirmation. `none` resets the override. Tenant Owners
214
+ cannot raise these caps. See [Database limits](https://github.com/goodguys-gmbh/cavelon-dev-kit/blob/main/docs/limits.md#database-connections-and-queries).
215
+
207
216
  `cavelon limits` shows what the instance allows this tenant, from the `limits`
208
217
  it publishes in `/api/v1/meta/capabilities`: upload size and file types, agent
209
218
  turns and tool calls, timeouts, rate limits, the licence's cap on solutions.
@@ -824,3 +833,25 @@ which copy of the package schema it used.
824
833
  In the working directory, only `init`, `pull` and `apply` write, as described
825
834
  in "Solution as code", and `artifacts export`, which writes the tar it
826
835
  downloads to a new file.
836
+
837
+ Version 0.1.17: `cavelon setup --agents cline` writes shared native user settings
838
+ and skills; `cavelon init --agents cline` copies project skills only. Guarded
839
+ changes use the person’s own terminal. See [Cline](../docs/install/cline.md)
840
+ for guarded launch, custom CLI paths and separate editor qualification.
841
+
842
+ Version 0.1.17: `cavelon setup --agents kilo` installs Kilo-native settings, skills
843
+ and bundled server/TUI plugins. CLI TUI changes ask a fresh native dialog;
844
+ editor/headless changes use the person’s terminal. See [Kilo](../docs/install/kilo.md)
845
+ for preserved configuration precedence, guarded launch and lifecycle.
846
+
847
+ Version 0.1.17: `cavelon setup --agents goose` writes Goose's native user YAML
848
+ extension and skills; project init copies shared skills only. The interactive
849
+ CLI uses its built-in person form. Headless runs cancel that form without a
850
+ change. System/additional config bindings and personal YAML are preserved.
851
+ See [Goose](../docs/install/goose.md) for paths, lifecycle and approval limits.
852
+
853
+ Version 0.1.17: `cavelon setup --agents omp` installs OMP's own native profile,
854
+ MCP entry, skills and bundled autoload extension. It preserves personal YAML
855
+ and supports fresh TUI approval; print/RPC calls use the person's terminal.
856
+ Use matching profile selection and a guarded launch. See
857
+ [OMP](../docs/install/omp.md) for lifecycle and qualification limits.
package/dist/agent-env.js CHANGED
@@ -14,6 +14,7 @@ export const AGENT_VARIABLES = [
14
14
  { variable: "TERM_PROGRAM", value: "kiro", agent: "Kiro" },
15
15
  { variable: "OPENCODE", agent: "OpenCode" },
16
16
  { variable: "PI_SESSION_ID", agent: "Pi" },
17
+ { variable: "AGENT_SESSION_ID", agent: "Goose or another agent exposing its session" },
17
18
  { variable: "GROK_AGENT", agent: "Grok Build" },
18
19
  { variable: "AI_AGENT", agent: "an agent that follows the AI_AGENT convention" },
19
20
  ];
package/dist/agents.js CHANGED
@@ -47,6 +47,8 @@ export const AGENTS = [
47
47
  agent("kiro", "Kiro", () => jsonServer(".kiro/settings/mcp.json")),
48
48
  ...NATIVE_CLIENTS.map(client => agent(client.name, client.label, () => {
49
49
  const config = client.project();
50
+ if (!config)
51
+ return undefined;
50
52
  return { ...config, entry: encodeMcpEntry(mcpCommand(), config.entryFormat, config.extra),
51
53
  others: [...otherPlatforms().map(p => encodeMcpEntry(mcpCommand(p), config.entryFormat, config.extra)), encodeMcpEntry(INSTALLED_MCP_COMMAND, config.entryFormat, config.extra)] };
52
54
  })),
@@ -7,6 +7,7 @@ import { callStable } from "../invoke.js";
7
7
  import { cavelonCommand, fill } from "../printed.js";
8
8
  import { isUuid } from "../session.js";
9
9
  import { accessFor, requirePersonForIdentityChoice } from "../access.js";
10
+ import { databaseLimitRows, databaseLimitsText } from "../database-limits.js";
10
11
  function reported(value) {
11
12
  if (value === undefined)
12
13
  return undefined;
@@ -156,10 +157,11 @@ function firewallSentence(offer) {
156
157
  }
157
158
  export const dbInstance = {
158
159
  name: "db instance",
159
- summary: "What this instance offers for database connections: dialects, firewall addresses and write-query support where published.",
160
+ summary: "Database dialects, firewall addresses, write-query support and the tenant's caps and counts where published.",
160
161
  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" +
161
162
  "its test and queries answer unavailable, and the customer's database must let the instance's egress addresses in. An\n" +
162
- "instance older than this route says only its dialects, in its capabilities.",
163
+ "instance older than this route says only its dialects, in its capabilities.\n" +
164
+ "Published limits show current connection/query counts, effective caps, their source and the platform default; missing counts stay missing.",
163
165
  readOnly: true,
164
166
  idempotent: true,
165
167
  mcpTool: "db_instance",
@@ -181,6 +183,7 @@ export const dbInstance = {
181
183
  };
182
184
  }
183
185
  const firewall = firewallSentence(offer);
186
+ const counts = databaseLimitRows(offer.limits);
184
187
  return {
185
188
  data: { published: true, ...offer, firewall },
186
189
  text: [
@@ -193,6 +196,7 @@ export const dbInstance = {
193
196
  ]),
194
197
  "",
195
198
  firewall,
199
+ ...(counts.length ? ["", databaseLimitsText(counts)] : []),
196
200
  ...(offer.runnable_dialects.length ? [] : ["", "This instance runs no database dialect: a connection can be saved, but its test and queries answer unavailable."]),
197
201
  ].join("\n"),
198
202
  };
@@ -83,6 +83,14 @@ function findTarget(published, key, explicitTenant) {
83
83
  return limitTarget(key, limit, limit.tenant_change);
84
84
  if (limit.change)
85
85
  return limitTarget(key, limit, limit.change);
86
+ if (limit.tenant_change) {
87
+ throw new CavelonError(ExitCode.usage, {
88
+ code: "tenant_required",
89
+ message: `${key} changes one tenant's override. Nothing was sent.`,
90
+ hint: "Pass --tenant <id|slug> and use a personal access token in Platform mode of the role the published change names.",
91
+ details: { key, sent: false },
92
+ });
93
+ }
86
94
  if (limit.changeable_by !== "tenant_admin")
87
95
  throw operatorRefusal(limit, switchFor(published, key));
88
96
  throw notPublished(`This instance does not publish how to change ${key}, so nothing was sent.`, `It runs an older Cavelon version. A tenant admin changes ${limit.setting} in the Admin's settings. ` +
@@ -262,6 +270,8 @@ function anyOf(names, none = "a permission the instance does not name") {
262
270
  function adminPage(target) {
263
271
  if (target.flag)
264
272
  return FEATURE_FLAGS_PAGE;
273
+ if (target.change.field.startsWith("max_database_"))
274
+ return "the tenant's Limits section (Database connections and Database queries)";
265
275
  return target.scope === "one_tenant" ? TENANT_LIMITS_PAGE : RUN_CAPS_PAGE;
266
276
  }
267
277
  function permissionRefusal(principal, target) {
@@ -469,7 +479,7 @@ export const limitsSet = {
469
479
  "before sending. Without --confirm, shows the old and new value, the operation and who may run it, and changes nothing.\n" +
470
480
  "Also changes the tenant quotas in tenant_quotas.changes (the inference budget, the monthly Processing Step cap).\n" +
471
481
  "An operator's change (a run cap) is sent only with a personal access token in Platform mode of a role it names, without\n" +
472
- "X-Tenant-Id; --tenant <id|slug> then sets one tenant's own run cap. An environment or licence limit, a value out of bounds,\n" +
482
+ "X-Tenant-Id; --tenant <id|slug> then sets one tenant's override, including database connection/query caps. An environment or licence limit, a value out of bounds,\n" +
473
483
  "an instance that does not publish how to change the limit, and a credential without the permission or the role are refused\n" +
474
484
  "before anything is sent. Propose the change to the person; never raise a limit on your own.\n" +
475
485
  PERSON_CONFIRMS_HELP,
@@ -5,6 +5,7 @@ import { table } from "../format.js";
5
5
  import { branchConcurrency, branchConcurrencyText } from "../branches.js";
6
6
  import { bindsNow, bindsWhenText, changedBy, docsPage, formatQuota, formatQuotaValue, formatValue, isOperatorChange, readLimits, readQuotas, } from "../limits.js";
7
7
  import { cavelonCommand, fill } from "../printed.js";
8
+ import { databaseLimitsText, readDatabaseLimits } from "../database-limits.js";
8
9
  const SOURCE_ORDER = ["tenant", "platform", "licence"];
9
10
  const SOURCE_TITLE = {
10
11
  tenant: "Set by this tenant (its own settings)",
@@ -41,6 +42,7 @@ export const limits = {
41
42
  "A limit that binds only while another is on says so (the archive caps apply while archive uploads are on).\n" +
42
43
  "Branch concurrency: the width per node, the ceiling per process, and whether branches run concurrently (and which switch is off).\n" +
43
44
  "The tenant quotas include the monthly Processing Step cap with this billing month's use, where the instance publishes it.\n" +
45
+ "Database connection/query limits include current counts from the connector where published, including counts above a lowered cap.\n" +
44
46
  "A limit the instance does not list does not bind there. An instance older than the published limits lists none.",
45
47
  readOnly: true,
46
48
  idempotent: true,
@@ -74,6 +76,7 @@ export const limits = {
74
76
  if (unknown.length)
75
77
  ctx.warn(`This instance lists no limit ${unknown.join(", ")}; it does not bind here.`);
76
78
  const groups = groupBySource(values);
79
+ const databaseLimits = await readDatabaseLimits(ctx, values.map(value => value.key));
77
80
  const quotas = keys.length || source ? undefined : await readQuotas(ctx, published);
78
81
  const quotaValues = keys.length || source ? [] : (published.tenantQuotas?.values ?? []);
79
82
  const near = [
@@ -109,6 +112,8 @@ export const limits = {
109
112
  text += `\n\nBranch concurrency (fan-outs and Map loops):\n${branchConcurrencyText(branches)}`;
110
113
  if (!groups.length)
111
114
  text = keys.length || source ? "No published limit matches." : "This instance publishes no binding limit.";
115
+ if (databaseLimits.length)
116
+ text += `\n\n${databaseLimitsText(databaseLimits)}`;
112
117
  if (quotas || quotaValues.length) {
113
118
  const rows = [
114
119
  ...(quotas?.items ?? []).map((q) => ({ quota: q.key, use: quotaUse(q), state: typeof q.details.state === "string" ? q.details.state : "", close: q.near ? "close to the quota" : "" })),
@@ -132,7 +137,7 @@ export const limits = {
132
137
  text += `; ${owner.join(", ")} only a Tenant Owner (settings.manage)`;
133
138
  }
134
139
  if (operatorChangeable.length) {
135
- text += `\n\nAn operator changes ${operatorChangeable.join(", ")} with the same command and a personal access token in Platform mode of the role the change names; --tenant <id|slug> sets the tenant (one tenant's own run cap, its flag).`;
140
+ text += `\n\nAn operator changes ${operatorChangeable.join(", ")} with the same command and a personal access token in Platform mode of the role the change names; --tenant <id|slug> selects one tenant's override or flag.`;
136
141
  }
137
142
  const pages = [...new Set(values.map((v) => docsPage(v.docs)).filter(Boolean))];
138
143
  if (pages.length)
@@ -150,6 +155,7 @@ export const limits = {
150
155
  quota_values: quotaValues.map(({ near: isNear, ratio, ...q }) => ({ ...q, ratio, near: isNear })),
151
156
  near: near.map(({ text: _text, ...q }) => q),
152
157
  branch_concurrency: branches ?? null,
158
+ ...(databaseLimits.length ? { database_limits: databaseLimits } : {}),
153
159
  },
154
160
  text,
155
161
  };
@@ -239,7 +239,7 @@ async function runSetup(ctx, input) {
239
239
  next.push(`Or start a solution yourself in an empty folder: ${cavelonCommand("init")}`);
240
240
  }
241
241
  else if (!chosen.length) {
242
- next.push("No coding agent was found. Install one (Claude Code, Codex, Cursor, VS Code with GitHub Copilot, Gemini CLI or Kiro) and run cavelon setup again,", ` or name yours: ${cavelonCommand("setup", "--agents", "cursor")}`);
242
+ next.push(`No coding agent was found. Install one (${setupAgents(env).map(agent => agent.label).join(", ")}) and run cavelon setup again,`, ` or name yours: ${cavelonCommand("setup", "--agents", "cursor")}`);
243
243
  }
244
244
  }
245
245
  const lines = [];
@@ -413,7 +413,7 @@ export const setup = {
413
413
  storesTarget: true,
414
414
  tenantless: true,
415
415
  summary: "Set up your coding agents for Cavelon and log in, in one guided step.",
416
- description: "Finds Claude Code, Codex, Cursor, VS Code with GitHub Copilot, Gemini CLI, Kiro, OpenCode and Pi, shows what it will change for each, asks once\n" +
416
+ description: "Finds Claude Code, Codex, Cursor, VS Code with GitHub Copilot, Gemini CLI, Kiro, OpenCode, Pi, Qwen, Cline, Kilo, Goose and OMP, shows what it will change for each, asks once\n" +
417
417
  "and does it: Claude Code and Codex get the Cavelon plugin through their own plugin command, Gemini CLI the extension of this\n" +
418
418
  "release (or the files, when the release has none); the others get the `cavelon` MCP server in their user MCP configuration\n" +
419
419
  "and the skills in their user skills folder. It touches nothing else in those files and\n" +
@@ -431,7 +431,7 @@ export const setup = {
431
431
  type: "string",
432
432
  value: "<list>",
433
433
  multiple: true,
434
- description: "Only these agents: claude, codex, cursor, copilot, gemini, kiro, opencode, pi, qwen, or all (comma-separated). Default: every agent found.",
434
+ description: "Only these agents: claude, codex, cursor, copilot, gemini, kiro, opencode, pi, qwen, cline, kilo, or all (comma-separated). Default: every agent found.",
435
435
  },
436
436
  yes: { type: "boolean", short: "y", description: "Make the changes without asking." },
437
437
  check: { type: "boolean", description: "Report what is set up and working; change nothing." },
@@ -0,0 +1,46 @@
1
+ import { CavelonError } from "./errors.js";
2
+ import { table } from "./format.js";
3
+ const KEYS = {
4
+ connections: "database_connections_per_tenant",
5
+ queries: "database_queries_per_tenant",
6
+ };
7
+ function validLimit(value) {
8
+ if (!value || typeof value !== "object")
9
+ return false;
10
+ const item = value;
11
+ return Number.isInteger(item.limit) && item.limit >= 1 &&
12
+ Number.isInteger(item.current) && item.current >= 0 &&
13
+ Number.isInteger(item.platform_limit) && item.platform_limit >= 1 &&
14
+ (item.source === "platform" || item.source === "tenant");
15
+ }
16
+ export function databaseLimitRows(limits, keys) {
17
+ if (!limits || typeof limits !== "object")
18
+ return [];
19
+ const published = limits;
20
+ return Object.keys(KEYS).flatMap(name => {
21
+ const value = published[name];
22
+ const key = KEYS[name];
23
+ return validLimit(value) && (!keys || keys.includes(key)) ? [{ key, ...value }] : [];
24
+ });
25
+ }
26
+ export function databaseLimitsText(rows) {
27
+ return `Database limits and current counts:\n${table(rows.map(row => ({ ...row })), ["key", "current", "limit", "source", "platform_limit"])}`;
28
+ }
29
+ export async function readDatabaseLimits(ctx, keys) {
30
+ if (!keys.some(key => Object.values(KEYS).includes(key)))
31
+ return [];
32
+ try {
33
+ const response = await (await ctx.client()).get("/api/v1/database-connectors/instance", { allow: [403, 404] });
34
+ if (response.status !== 200) {
35
+ ctx.warn(`Database counts are unavailable (${response.status}); the published limits still stand.`);
36
+ return [];
37
+ }
38
+ return databaseLimitRows(response.data?.limits, keys);
39
+ }
40
+ catch (error) {
41
+ if (!(error instanceof CavelonError))
42
+ throw error;
43
+ ctx.warn("Database counts could not be read; the published limits still stand.");
44
+ return [];
45
+ }
46
+ }
package/dist/mcp-entry.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { isDeepStrictEqual } from "node:util";
2
2
  import { INSTALLED_MCP_COMMAND, mcpCommand } from "./mcp-command.js";
3
3
  export function encodeMcpEntry(command, format, extra = {}) {
4
- return format === "command-array" ? { ...extra, command: [command.command, ...command.args] } : { ...extra, command: command.command, args: command.args };
4
+ return format === "command-array" ? { ...extra, command: [command.command, ...command.args] } : { ...extra, [format === "goose-stdio" ? "cmd" : "command"]: command.command, args: command.args };
5
5
  }
6
6
  export function decodeMcpEntry(value, format) {
7
7
  if (!value || typeof value !== "object" || Array.isArray(value))
8
8
  return undefined;
9
9
  const entry = value;
10
- const words = format === "command-array" ? entry.command : [entry.command, ...(Array.isArray(entry.args) ? entry.args : [])];
11
- if (format === "command-args" && !Array.isArray(entry.args))
10
+ const words = format === "command-array" ? entry.command : [entry[format === "goose-stdio" ? "cmd" : "command"], ...(Array.isArray(entry.args) ? entry.args : [])];
11
+ if (format !== "command-array" && !Array.isArray(entry.args))
12
12
  return undefined;
13
13
  if (!Array.isArray(words) || !words.length || !words.every(word => typeof word === "string") || !words[0])
14
14
  return undefined;
@@ -0,0 +1,33 @@
1
+ import { fileURLToPath } from "node:url";
2
+ import { startOpenCodeServer } from "./opencode-server.js";
3
+ import { loadNativeRuntime, nativeEntryHash } from "./profile.js";
4
+ export async function startKiloServer(input, options) {
5
+ const server = await startOpenCodeServer(input, options, "kilo");
6
+ let effective;
7
+ return {
8
+ ...server,
9
+ async config(config) { effective = config; },
10
+ tool: Object.fromEntries(Object.entries(server.tool).map(([name, tool]) => [name, {
11
+ ...tool,
12
+ async execute(...args) {
13
+ const entry = effective?.mcp?.cavelon;
14
+ if (options.entryHash && (!entry || nativeEntryHash(entry) !== options.entryHash)) {
15
+ throw new Error("Kilo's effective Cavelon configuration differs from the owned entry; review its project, environment and managed policies before using the tools.");
16
+ }
17
+ return tool.execute(...args);
18
+ },
19
+ }])),
20
+ async "shell.env"(_input, output) {
21
+ output.env.CAVELON_AGENT = "1";
22
+ },
23
+ };
24
+ }
25
+ export default {
26
+ id: "cavelon.native-approval.kilo",
27
+ async server(input, options) {
28
+ const profile = options?.profile === undefined ? fileURLToPath(new URL("./profile.json", import.meta.url)) : options.profile;
29
+ if (typeof profile !== "string")
30
+ throw new Error("Cavelon native approval needs its setup profile.");
31
+ return startKiloServer(input, await loadNativeRuntime(profile, "kilo"));
32
+ },
33
+ };
@@ -0,0 +1,13 @@
1
+ import { fileURLToPath } from "node:url";
2
+ import { startOpenCodeTui } from "./opencode-tui.js";
3
+ import { loadNativeRuntime } from "./profile.js";
4
+ export const startKiloTui = (api, options) => startOpenCodeTui(api, options, "kilo");
5
+ export default {
6
+ id: "cavelon.native-approval.kilo",
7
+ async tui(api, options) {
8
+ const profile = options?.profile === undefined ? fileURLToPath(new URL("./profile.json", import.meta.url)) : options.profile;
9
+ if (typeof profile !== "string")
10
+ throw new Error("Cavelon native approval needs its setup profile.");
11
+ await startKiloTui(api, await loadNativeRuntime(profile, "kilo"));
12
+ },
13
+ };
@@ -0,0 +1,8 @@
1
+ import { fileURLToPath } from "node:url";
2
+ import { installPiExtension } from "./pi-extension.js";
3
+ import { loadNativeRuntime } from "./profile.js";
4
+ export default async function cavelon(omp) {
5
+ const runtime = await loadNativeRuntime(fileURLToPath(new URL("./profile.json", import.meta.url)), "omp");
6
+ process.env.CAVELON_AGENT = "1";
7
+ installPiExtension(omp, runtime, "omp");
8
+ }
@@ -10,9 +10,9 @@ function toolArguments(input) {
10
10
  throw new Error("A Cavelon tool must declare an object input schema.");
11
11
  return schema.shape;
12
12
  }
13
- export async function startOpenCodeServer(input, options) {
13
+ export async function startOpenCodeServer(input, options, client = "opencode") {
14
14
  await assertNativeWorkspace(options, input.directory);
15
- if (await hasNativeProjectOwner(options, "opencode", input.directory))
15
+ if (await hasNativeProjectOwner(options, client, input.directory))
16
16
  return { dispose: async () => undefined, tool: {} };
17
17
  const command = { ...options.command, cwd: input.directory };
18
18
  const discovery = await nativeStdioClient(command, false, options.version);
@@ -3,9 +3,9 @@ import { fileURLToPath } from "node:url";
3
3
  import { startUiSocket } from "./ipc.js";
4
4
  import { assertNativeWorkspace, hasNativeProjectOwner, loadNativeRuntime } from "./profile.js";
5
5
  import { previewPages } from "./preview-pages.js";
6
- export async function startOpenCodeTui(api, options) {
6
+ export async function startOpenCodeTui(api, options, client = "opencode") {
7
7
  await assertNativeWorkspace(options, api.state.path.directory);
8
- if (await hasNativeProjectOwner(options, "opencode", api.state.path.directory))
8
+ if (await hasNativeProjectOwner(options, client, api.state.path.directory))
9
9
  return;
10
10
  const clients = new Map();
11
11
  const pending = new Set();
@@ -3,7 +3,7 @@ import { fileURLToPath } from "node:url";
3
3
  import { nativeStdioClient } from "./client.js";
4
4
  import { assertNativeWorkspace, hasNativeProjectOwner, loadNativeRuntime } from "./profile.js";
5
5
  import { previewPages } from "./preview-pages.js";
6
- export function installPiExtension(pi, options) {
6
+ export function installPiExtension(pi, options, clientName = "pi") {
7
7
  let opening;
8
8
  let current;
9
9
  let generation = 0;
@@ -33,7 +33,7 @@ export function installPiExtension(pi, options) {
33
33
  };
34
34
  pi.on("session_start", async (_event, ctx) => {
35
35
  await close();
36
- if (ctx.isProjectTrusted() && await hasNativeProjectOwner(options, "pi", ctx.cwd))
36
+ if (ctx.isProjectTrusted() && await hasNativeProjectOwner(options, clientName, ctx.cwd))
37
37
  return;
38
38
  current = ctx;
39
39
  const epoch = generation;
@@ -52,6 +52,7 @@ export function installPiExtension(pi, options) {
52
52
  pi.registerTool({
53
53
  name, label: tool.annotations?.title ?? tool.name, description: tool.description ?? tool.name,
54
54
  parameters: Type.Unsafe(tool.inputSchema), annotations: tool.annotations, executionMode: "sequential",
55
+ ...(clientName === "omp" ? { loadMode: "essential", mcpServerName: "cavelon", mcpToolName: tool.name } : {}),
55
56
  async execute(_id, params, signal, _update, ctx) {
56
57
  if (!current)
57
58
  throw new Error("The Cavelon native session has ended.");
@@ -72,7 +73,8 @@ export function installPiExtension(pi, options) {
72
73
  return ctx.ui.confirm("Cavelon: approve this exact change", pages.length === 1 ? message : `Approve the exact change shown in all ${pages.length} preview pages?`, { signal: dialogSignal, timeout });
73
74
  } : undefined,
74
75
  });
75
- return { content: result.content, details: { isError: result.isError === true } };
76
+ return { content: result.content, details: { isError: result.isError === true },
77
+ ...(clientName === "omp" ? { isError: result.isError === true } : {}) };
76
78
  },
77
79
  });
78
80
  }
@@ -1,3 +1,4 @@
1
+ import { ompRuntimePolicy } from "../omp-config.js";
1
2
  import { createHash } from "node:crypto";
2
3
  import { promises as fs } from "node:fs";
3
4
  import os from "node:os";
@@ -32,7 +33,7 @@ export async function assertNativeWorkspace(runtime, directory) {
32
33
  export async function hasNativeProjectOwner(runtime, client, directory) {
33
34
  if (runtime.scope !== "user")
34
35
  return false;
35
- const file = path.join(directory, client === "pi" ? ".pi" : ".opencode", "cavelon", "profile.json");
36
+ const file = path.join(directory, `.${client}`, "cavelon", "profile.json");
36
37
  const present = await fs.stat(file).then(() => true, error => { if (error.code === "ENOENT")
37
38
  return false; throw error; });
38
39
  if (!present)
@@ -81,33 +82,39 @@ export async function loadNativeRuntime(profileFile, client) {
81
82
  if (profile.format === 2 && !inside(projectRoot, realConfig))
82
83
  throw new Error("Cavelon native configuration is outside its project.");
83
84
  const text = await fs.readFile(realConfig, "utf8");
84
- if (client === "pi") {
85
+ const commandArgs = client === "pi" || client === "omp";
86
+ if (commandArgs) {
85
87
  try {
86
88
  JSON.parse(text);
87
89
  }
88
90
  catch {
89
- throw new Error("The Pi MCP configuration requires plain JSON; review it before native startup.");
91
+ throw new Error(`The ${client === "pi" ? "Pi" : "OMP"} MCP configuration requires plain JSON; review it before native startup.`);
90
92
  }
91
93
  }
92
- const selected = readJsoncEntry(text, [client === "opencode" ? "mcp" : "mcpServers", "cavelon"]);
94
+ if (client === "omp") {
95
+ const policy = await ompRuntimePolicy(configFile, process.env);
96
+ if (policy)
97
+ throw new Error(policy);
98
+ }
99
+ const selected = readJsoncEntry(text, [commandArgs ? "mcpServers" : "mcp", "cavelon"]);
93
100
  if ("error" in selected || !selected.value || nativeEntryHash(selected.value) !== profile.entryHash) {
94
101
  throw new Error("The Cavelon MCP entry changed; review it and repeat setup before using native approval.");
95
102
  }
96
103
  const entry = selected.value;
97
- if (entry.enabled !== false || (client === "opencode" && entry.type !== "local")) {
104
+ if (entry.enabled !== false || (!commandArgs && entry.type !== "local")) {
98
105
  throw new Error("Native approval must own only Cavelon; disable its duplicate built-in MCP entry.");
99
106
  }
100
- const words = client === "opencode" ? entry.command : [entry.command, ...(Array.isArray(entry.args) ? entry.args : [])];
107
+ const words = !commandArgs ? entry.command : [entry.command, ...(Array.isArray(entry.args) ? entry.args : [])];
101
108
  if (!Array.isArray(words) || !words.length || !words.every(word => typeof word === "string") || !words[0]
102
- || (client === "pi" && !Array.isArray(entry.args)))
109
+ || (commandArgs && !Array.isArray(entry.args)))
103
110
  throw new Error("Invalid Cavelon MCP process command.");
104
- const overrides = entry[client === "opencode" ? "environment" : "env"];
111
+ const overrides = entry[!commandArgs ? "environment" : "env"];
105
112
  if (overrides !== undefined && (!overrides || typeof overrides !== "object" || Array.isArray(overrides)
106
113
  || Object.values(overrides).some(value => typeof value !== "string")))
107
114
  throw new Error("Invalid Cavelon MCP environment.");
108
115
  const env = Object.fromEntries(Object.entries({ ...process.env, ...overrides }).filter((entry) => typeof entry[1] === "string"));
109
116
  return {
110
- version: profile.version, scope: profile.scope, ...(projectRoot ? { projectRoot } : {}),
117
+ version: profile.version, scope: profile.scope, entryHash: profile.entryHash, ...(projectRoot ? { projectRoot } : {}),
111
118
  runtimeDir: nativeRuntimeDirectory(profileFile), command: { command: words[0], args: words.slice(1), env },
112
119
  };
113
120
  }
@@ -322,6 +322,24 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
322
322
  IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
323
323
 
324
324
 
325
+ ---
326
+
327
+ yaml 2.9.1
328
+ Copyright Eemeli Aro <eemeli@gmail.com>
329
+
330
+ Permission to use, copy, modify, and/or distribute this software for any purpose
331
+ with or without fee is hereby granted, provided that the above copyright notice
332
+ and this permission notice appear in all copies.
333
+
334
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
335
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
336
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
337
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
338
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
339
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
340
+ THIS SOFTWARE.
341
+
342
+
325
343
  ---
326
344
 
327
345
  zod 4.6.5