Initial commit

Supervised action bridge between Claude Code and the host system.
Server accepts structured action requests, applies per-action policies
(auto-accept/auto-deny/queue), and executes approved actions via typed
handlers. Client provides CLI and module interfaces for calling the API.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 20:01:54 +00:00
commit 5a557a642a
9 changed files with 1208 additions and 0 deletions

61
server/actions.js Normal file
View File

@@ -0,0 +1,61 @@
// Action registry — defines all available actions, their parameters, and policies.
// policy: "auto-accept" | "auto-deny" | "queue"
export const actions = {
"list-actions": {
description: "List all available actions and their definitions",
params: [],
policy: "auto-accept",
handler: async () => {
return Object.entries(actions).map(([name, def]) => ({
action: name,
description: def.description,
params: def.params,
policy: def.policy,
}));
},
},
"edit-file": {
description: "Open a file in the editor",
params: [{ name: "filename", required: true, type: "path" }],
policy: "auto-accept",
handler: async ({ filename }, { resolvePath, exec }) => {
const resolved = resolvePath(filename);
await exec("xdg-open", [resolved]);
return { opened: resolved };
},
},
"open-directory": {
description: "Open a directory in the file manager",
params: [{ name: "path", required: true, type: "path" }],
policy: "auto-accept",
handler: async ({ path }, { resolvePath, exec }) => {
const resolved = resolvePath(path);
await exec("xdg-open", [resolved]);
return { opened: resolved };
},
},
"open-browser": {
description: "Open a URL in the web browser",
params: [{ name: "url", required: true, type: "string" }],
policy: "queue",
handler: async ({ url }, { exec }) => {
await exec("xdg-open", [url]);
return { opened: url };
},
},
"open-terminal": {
description: "Open a terminal in a given directory",
params: [{ name: "path", required: false, type: "path" }],
policy: "queue",
handler: async ({ path }, { resolvePath, exec }) => {
const resolved = path ? resolvePath(path) : process.env.HOME;
await exec("xdg-open", [resolved]);
return { opened: resolved };
},
},
};