@clawdreyhepburn/carapace 0.3.2 → 0.3.3
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/CHANGELOG.md +21 -0
- package/README.md +36 -1
- package/dist/cedar-engine-cedarling.d.ts +81 -0
- package/dist/cedar-engine-cedarling.js +651 -0
- package/dist/cedar-engine-cedarling.js.map +1 -0
- package/dist/cedar-engine.d.ts +77 -0
- package/dist/cedar-engine.js +374 -0
- package/dist/cedar-engine.js.map +1 -0
- package/dist/gui/html.d.ts +5 -0
- package/dist/gui/html.js +930 -0
- package/dist/gui/html.js.map +1 -0
- package/dist/gui/server.d.ts +28 -0
- package/dist/gui/server.js +159 -0
- package/dist/gui/server.js.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +584 -0
- package/dist/index.js.map +1 -0
- package/dist/llm-proxy.d.ts +75 -0
- package/dist/llm-proxy.js +565 -0
- package/dist/llm-proxy.js.map +1 -0
- package/dist/mcp-aggregator.d.ts +29 -0
- package/dist/mcp-aggregator.js +144 -0
- package/dist/mcp-aggregator.js.map +1 -0
- package/dist/policy-source.d.ts +26 -0
- package/dist/policy-source.js +28 -0
- package/dist/policy-source.js.map +1 -0
- package/dist/types.d.ts +135 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/docs/carapace_proxy_tool_filter_flow_v3.svg +96 -0
- package/docs/ungated_ai_agent_capabilities.svg +143 -0
- package/package.json +1 -1
- package/src/gui/html.ts +14 -0
- package/src/gui/server.ts +7 -1
- package/src/index.ts +12 -0
- package/src/policy-source.ts +44 -0
- package/vitest.config.ts +8 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/gui/html.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,UAAU,OAAO;IACrB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA05BD,CAAC;AACT,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Control GUI — lightweight local web server for human oversight of MCP tool access.
|
|
3
|
+
*
|
|
4
|
+
* Serves a single-page app that shows all MCP servers and tools,
|
|
5
|
+
* lets humans toggle access, and displays Cedar policy state.
|
|
6
|
+
*/
|
|
7
|
+
import type { McpAggregator } from "../mcp-aggregator.js";
|
|
8
|
+
import type { Logger, CedarEngineInterface } from "../types.js";
|
|
9
|
+
interface GuiOpts {
|
|
10
|
+
port: number;
|
|
11
|
+
aggregator: McpAggregator;
|
|
12
|
+
cedar: CedarEngineInterface;
|
|
13
|
+
logger: Logger;
|
|
14
|
+
}
|
|
15
|
+
export declare class ControlGui {
|
|
16
|
+
private port;
|
|
17
|
+
private aggregator;
|
|
18
|
+
private cedar;
|
|
19
|
+
private logger;
|
|
20
|
+
private server;
|
|
21
|
+
constructor(opts: GuiOpts);
|
|
22
|
+
start(): Promise<void>;
|
|
23
|
+
stop(): Promise<void>;
|
|
24
|
+
private handleRequest;
|
|
25
|
+
private json;
|
|
26
|
+
private readBody;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Control GUI — lightweight local web server for human oversight of MCP tool access.
|
|
3
|
+
*
|
|
4
|
+
* Serves a single-page app that shows all MCP servers and tools,
|
|
5
|
+
* lets humans toggle access, and displays Cedar policy state.
|
|
6
|
+
*/
|
|
7
|
+
import { createServer } from "node:http";
|
|
8
|
+
import { guiHtml } from "./html.js";
|
|
9
|
+
export class ControlGui {
|
|
10
|
+
port;
|
|
11
|
+
aggregator;
|
|
12
|
+
cedar;
|
|
13
|
+
logger;
|
|
14
|
+
server = null;
|
|
15
|
+
constructor(opts) {
|
|
16
|
+
this.port = opts.port;
|
|
17
|
+
this.aggregator = opts.aggregator;
|
|
18
|
+
this.cedar = opts.cedar;
|
|
19
|
+
this.logger = opts.logger;
|
|
20
|
+
}
|
|
21
|
+
async start() {
|
|
22
|
+
this.server = createServer((req, res) => this.handleRequest(req, res));
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
this.server.listen(this.port, "127.0.0.1", () => {
|
|
25
|
+
this.logger.info(`GUI listening on http://127.0.0.1:${this.port}`);
|
|
26
|
+
resolve();
|
|
27
|
+
});
|
|
28
|
+
this.server.on("error", reject);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
async stop() {
|
|
32
|
+
return new Promise((resolve) => {
|
|
33
|
+
if (this.server) {
|
|
34
|
+
this.server.close(() => resolve());
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
resolve();
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
async handleRequest(req, res) {
|
|
42
|
+
const url = new URL(req.url ?? "/", `http://127.0.0.1:${this.port}`);
|
|
43
|
+
try {
|
|
44
|
+
// --- API routes ---
|
|
45
|
+
if (url.pathname === "/api/status" && req.method === "GET") {
|
|
46
|
+
const servers = this.aggregator.getServerStatus();
|
|
47
|
+
const tools = this.aggregator.listTools();
|
|
48
|
+
this.json(res, {
|
|
49
|
+
servers,
|
|
50
|
+
tools,
|
|
51
|
+
policies: this.cedar.getPolicies(),
|
|
52
|
+
toolCount: tools.length,
|
|
53
|
+
enabledCount: tools.filter((t) => t.enabled).length,
|
|
54
|
+
defaultPolicy: this.cedar.getDefaultPolicy?.() ?? "allow-all",
|
|
55
|
+
});
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (url.pathname === "/api/tools" && req.method === "GET") {
|
|
59
|
+
const server = url.searchParams.get("server") ?? undefined;
|
|
60
|
+
this.json(res, this.aggregator.listTools(server));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (url.pathname === "/api/toggle" && req.method === "POST") {
|
|
64
|
+
const body = await this.readBody(req);
|
|
65
|
+
const { tool, enabled } = JSON.parse(body);
|
|
66
|
+
if (enabled) {
|
|
67
|
+
this.cedar.enableTool(tool);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
this.cedar.disableTool(tool);
|
|
71
|
+
}
|
|
72
|
+
this.json(res, { ok: true, tool, enabled });
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (url.pathname === "/api/verify" && req.method === "POST") {
|
|
76
|
+
const result = await this.cedar.verify();
|
|
77
|
+
this.json(res, result);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (url.pathname === "/api/policies" && req.method === "GET") {
|
|
81
|
+
this.json(res, this.cedar.getPolicies());
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (url.pathname === "/api/policy" && req.method === "POST") {
|
|
85
|
+
const body = await this.readBody(req);
|
|
86
|
+
const { id, raw } = JSON.parse(body);
|
|
87
|
+
if (!id || !raw) {
|
|
88
|
+
res.writeHead(400, { "Content-Type": "application/json" });
|
|
89
|
+
res.end(JSON.stringify({ error: "id and raw are required" }));
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
this.cedar.savePolicy(id, raw);
|
|
93
|
+
this.json(res, { ok: true, id });
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (url.pathname === "/api/policy" && req.method === "DELETE") {
|
|
97
|
+
const body = await this.readBody(req);
|
|
98
|
+
const { id } = JSON.parse(body);
|
|
99
|
+
const deleted = this.cedar.deletePolicy(id);
|
|
100
|
+
this.json(res, { ok: deleted, id });
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (url.pathname === "/api/schema" && req.method === "GET") {
|
|
104
|
+
this.json(res, this.cedar.getSchema());
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (url.pathname === "/api/schema" && req.method === "POST") {
|
|
108
|
+
const body = await this.readBody(req);
|
|
109
|
+
const { raw } = JSON.parse(body);
|
|
110
|
+
this.cedar.saveSchema(raw);
|
|
111
|
+
this.json(res, { ok: true });
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (url.pathname === "/api/agents" && req.method === "GET") {
|
|
115
|
+
// Agent hierarchy removed — see @clawdreyhepburn/ovid-me for per-agent mandates
|
|
116
|
+
this.json(res, []);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (url.pathname === "/api/policy-source" && req.method === "GET") {
|
|
120
|
+
// Return all Cedar policies (deployment-wide ceiling)
|
|
121
|
+
const policies = this.cedar.getPolicies();
|
|
122
|
+
const policyText = policies.map(p => p.raw).join("\n\n");
|
|
123
|
+
res.writeHead(200, { "Content-Type": "text/plain; charset=utf-8" });
|
|
124
|
+
res.end(policyText || "# No policies defined\n");
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
// --- GUI ---
|
|
128
|
+
if (url.pathname === "/" || url.pathname === "/index.html") {
|
|
129
|
+
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
130
|
+
res.end(guiHtml());
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
// 404
|
|
134
|
+
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
135
|
+
res.end("Not Found");
|
|
136
|
+
}
|
|
137
|
+
catch (err) {
|
|
138
|
+
this.logger.error(`GUI error: ${err.message}`);
|
|
139
|
+
res.writeHead(500, { "Content-Type": "application/json" });
|
|
140
|
+
res.end(JSON.stringify({ error: err.message }));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
json(res, data) {
|
|
144
|
+
res.writeHead(200, {
|
|
145
|
+
"Content-Type": "application/json",
|
|
146
|
+
"Access-Control-Allow-Origin": "*",
|
|
147
|
+
});
|
|
148
|
+
res.end(JSON.stringify(data));
|
|
149
|
+
}
|
|
150
|
+
readBody(req) {
|
|
151
|
+
return new Promise((resolve, reject) => {
|
|
152
|
+
const chunks = [];
|
|
153
|
+
req.on("data", (chunk) => chunks.push(chunk));
|
|
154
|
+
req.on("end", () => resolve(Buffer.concat(chunks).toString()));
|
|
155
|
+
req.on("error", reject);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/gui/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;A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AC,CAAC,CAAC;YAC/D,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Carapace — OpenClaw Plugin
|
|
3
|
+
*
|
|
4
|
+
* Aggregates upstream MCP servers, enforces Cedar policies on tool access,
|
|
5
|
+
* and serves a local GUI for human oversight.
|
|
6
|
+
*/
|
|
7
|
+
export { CarapacePolicySource } from "./policy-source.js";
|
|
8
|
+
export type { PolicySource } from "./policy-source.js";
|
|
9
|
+
export declare const id = "carapace";
|
|
10
|
+
export declare const name = "Carapace";
|
|
11
|
+
/**
|
|
12
|
+
* OpenClaw plugin API shape (matches real runtime).
|
|
13
|
+
* We define it here to avoid depending on OpenClaw types at build time.
|
|
14
|
+
*/
|
|
15
|
+
interface OpenClawPluginApi {
|
|
16
|
+
pluginConfig: any;
|
|
17
|
+
logger: {
|
|
18
|
+
info(msg: string, ...args: any[]): void;
|
|
19
|
+
warn(msg: string, ...args: any[]): void;
|
|
20
|
+
error(msg: string, ...args: any[]): void;
|
|
21
|
+
debug?(msg: string, ...args: any[]): void;
|
|
22
|
+
};
|
|
23
|
+
registerService(service: {
|
|
24
|
+
id: string;
|
|
25
|
+
start(): Promise<void> | void;
|
|
26
|
+
stop(): Promise<void> | void;
|
|
27
|
+
}): void;
|
|
28
|
+
registerTool(tool: {
|
|
29
|
+
name: string;
|
|
30
|
+
label?: string;
|
|
31
|
+
description: string;
|
|
32
|
+
parameters: Record<string, any>;
|
|
33
|
+
execute(toolCallId: string, params: any): Promise<any>;
|
|
34
|
+
}, opts?: {
|
|
35
|
+
optional?: boolean;
|
|
36
|
+
}): void;
|
|
37
|
+
registerCli?(fn: (ctx: {
|
|
38
|
+
program: any;
|
|
39
|
+
}) => void, opts?: {
|
|
40
|
+
commands: string[];
|
|
41
|
+
}): void;
|
|
42
|
+
registerGatewayMethod?(name: string, handler: (ctx: {
|
|
43
|
+
respond: (ok: boolean, data: any) => void;
|
|
44
|
+
}) => void): void;
|
|
45
|
+
}
|
|
46
|
+
export default function register(api: OpenClawPluginApi): void;
|