@cavelon/cli 0.1.16 → 0.1.18

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.
Files changed (34) hide show
  1. package/README.md +35 -4
  2. package/dist/agent-env.js +1 -0
  3. package/dist/agents.js +2 -0
  4. package/dist/commands/db.js +45 -9
  5. package/dist/commands/limits-set.js +11 -1
  6. package/dist/commands/limits.js +7 -1
  7. package/dist/commands/setup.js +3 -3
  8. package/dist/database-limits.js +46 -0
  9. package/dist/database-queries.js +101 -8
  10. package/dist/mcp-entry.js +3 -3
  11. package/dist/native-approval/kilo-server.js +33 -0
  12. package/dist/native-approval/kilo-tui.js +13 -0
  13. package/dist/native-approval/omp-extension.js +8 -0
  14. package/dist/native-approval/opencode-server.js +2 -2
  15. package/dist/native-approval/opencode-tui.js +2 -2
  16. package/dist/native-approval/pi-extension.js +5 -3
  17. package/dist/native-approval/profile.js +16 -9
  18. package/dist/native-assets/THIRD-PARTY-NOTICES +18 -0
  19. package/dist/native-assets/kilo-server.mjs +39719 -0
  20. package/dist/native-assets/kilo-tui.mjs +26477 -0
  21. package/dist/native-assets/manifest.json +31 -9
  22. package/dist/native-assets/omp-extension.mjs +30729 -0
  23. package/dist/native-assets/opencode-server.mjs +7541 -122
  24. package/dist/native-assets/opencode-tui.mjs +7531 -112
  25. package/dist/native-assets/pi-extension.mjs +7552 -128
  26. package/dist/native-clients.js +217 -1
  27. package/dist/native-install.js +41 -16
  28. package/dist/omp-config.js +85 -0
  29. package/dist/setup-agents.js +15 -6
  30. package/dist/skills/cavelon-authoring/SKILL.md +12 -1
  31. package/dist/skills/cavelon-testing/SKILL.md +2 -1
  32. package/dist/workflow-queries.js +23 -1
  33. package/dist/yaml-config.js +215 -0
  34. package/package.json +1 -1
@@ -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