Compare commits
16 Commits
50f49c366a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ba8c0701f8 | |||
| d06e11197a | |||
| 64df986a5f | |||
| 3841c5418a | |||
| 9668bae220 | |||
| 19e57f4e3e | |||
| d2d9905a82 | |||
| b1ccbfef41 | |||
| 5fb9d3ce07 | |||
| f2d32a3faa | |||
| 62d2480cd4 | |||
| 0d1e25019e | |||
| fa4a7a99f8 | |||
| 412e322a69 | |||
| 507eb7584d | |||
| ca7ae930cc |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,2 +1,5 @@
|
||||
node_modules/
|
||||
secrets.json
|
||||
config.json
|
||||
mail-perms.json
|
||||
package-lock.json
|
||||
|
||||
4
.npmignore
Normal file
4
.npmignore
Normal file
@@ -0,0 +1,4 @@
|
||||
secrets.json
|
||||
filtered-secrets.json
|
||||
config.json
|
||||
mail-perms.json
|
||||
77
README.md
77
README.md
@@ -21,10 +21,17 @@ A supervised action bridge between Claude Code and the host system. Claude reque
|
||||
|
||||
---
|
||||
|
||||
## Setup
|
||||
## Install
|
||||
|
||||
```bash
|
||||
# Global install from Gitea
|
||||
npm install -g git+https://gitea.efforting.tech/mikael-lovqvists-claude-agent/claude-code-conduit.git
|
||||
|
||||
# Or clone and link locally
|
||||
git clone git@git.efforting.tech:mikael-lovqvists-claude-agent/claude-code-conduit.git
|
||||
cd claude-code-conduit
|
||||
npm install
|
||||
npm link
|
||||
```
|
||||
|
||||
### Generate secrets
|
||||
@@ -42,6 +49,28 @@ ccc-keygen --filter agent --output agent-secrets.json
|
||||
|
||||
The full `secrets.json` stays on the host. `agent-secrets.json` goes into the container.
|
||||
|
||||
### Create a config file
|
||||
|
||||
Copy [`config.example.json`](config.example.json) to `config.json` and edit it:
|
||||
|
||||
```json
|
||||
{
|
||||
"secrets": "../secrets.json",
|
||||
"mail_perms": "mail-perms.json",
|
||||
"smtp": {
|
||||
"host": "smtp.example.com",
|
||||
"port": 587,
|
||||
"secure": false,
|
||||
"auth": { "user": "relay@example.com", "pass": "<password>" },
|
||||
"from": "agent@example.com"
|
||||
},
|
||||
"bind": "127.0.0.1",
|
||||
"port": 3015
|
||||
}
|
||||
```
|
||||
|
||||
`secrets` and `mail_perms` paths are resolved relative to the config file. `smtp`, `mail_perms`, `bind`, and `port` are all optional.
|
||||
|
||||
---
|
||||
|
||||
## Running
|
||||
@@ -49,27 +78,36 @@ The full `secrets.json` stays on the host. `agent-secrets.json` goes into the co
|
||||
### Server (host)
|
||||
|
||||
```bash
|
||||
ccc-server --secrets secrets.json
|
||||
ccc-server --config config.json
|
||||
ccc-server --config config.json --dry-run
|
||||
```
|
||||
|
||||
Environment variables:
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `CONDUIT_PORT` | `3015` | Port to listen on |
|
||||
| `CONDUIT_ROOT` | `/workspace` | Workspace root for path resolution |
|
||||
Server flags:
|
||||
| Flag | Env variable | Description |
|
||||
|------|-------------|-------------|
|
||||
| `--config <path>` | `CONDUIT_CONFIG` | Path to config file (required) |
|
||||
| `--dry-run` | — | Log all action invocations but do not execute them |
|
||||
|
||||
Server environment variables (override config file values):
|
||||
| Variable | Description |
|
||||
|----------|-------------|
|
||||
| `CONDUIT_PORT` | Port to listen on |
|
||||
| `CONDUIT_BIND` | Address to bind to |
|
||||
| `CONDUIT_ROOT` | Label printed at startup (informational only — path resolution uses `VOLUME_MAPPING` in `server/helpers.mjs`) |
|
||||
|
||||
### Client (container / agent)
|
||||
|
||||
```bash
|
||||
ccc-client --secrets agent-secrets.json --user agent '{"action": "list-actions"}'
|
||||
ccc-client --secrets agent-secrets.json --user agent --url http://192.168.2.99:3015 '{"action": "list-actions"}'
|
||||
ccc-client --secrets agent-secrets.json --user agent '{"action": "edit-file", "filename": "/workspace/foo.mjs"}'
|
||||
```
|
||||
|
||||
`--secrets` and `--user` can also be set via environment variables:
|
||||
`--secrets`, `--user`, and `--url` can also be set via environment variables:
|
||||
|
||||
```bash
|
||||
export CCC_SECRETS=/path/to/agent-secrets.json
|
||||
export CCC_USER=agent
|
||||
export CONDUIT_URL=http://192.168.2.99:3015
|
||||
ccc-client '{"action": "list-actions"}'
|
||||
```
|
||||
|
||||
@@ -82,7 +120,7 @@ ccc-client '{"action": "edit-file",' '"filename": "/workspace/foo.mjs"}'
|
||||
### Queue manager (host)
|
||||
|
||||
```bash
|
||||
ccc-queue --secrets secrets.json --user user
|
||||
ccc-queue --secrets secrets.json --user user --url http://192.168.2.99:3015
|
||||
```
|
||||
|
||||
Opens an interactive TUI showing pending actions:
|
||||
@@ -101,7 +139,12 @@ Opens an interactive TUI showing pending actions:
|
||||
[y] approve [n] deny [r] refresh [q] quit
|
||||
```
|
||||
|
||||
Supports `CCC_SECRETS` and `CCC_USER` env vars the same as the client.
|
||||
Client environment variables:
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `CCC_SECRETS` | — | Path to secrets file |
|
||||
| `CCC_USER` | — | Username to authenticate as |
|
||||
| `CONDUIT_URL` | `http://localhost:3015` | Server URL |
|
||||
|
||||
---
|
||||
|
||||
@@ -120,7 +163,12 @@ Built-in actions:
|
||||
| `list-actions` | auto-accept | — |
|
||||
| `edit-file` | auto-accept | `filename` (path) |
|
||||
| `open-browser` | queue | `url` (http/https only) |
|
||||
| `open-terminal` | queue | `path` (optional) |
|
||||
| `open-terminal` | queue | `path` (optional, defaults to workspace) |
|
||||
| `send-email` | auto-accept | `to`, `subject`, `body`, `topic` |
|
||||
| `set-mail-permission` | auto-accept | `target_user`, `to`, `allow` (bool), `topic` (optional — omit to match any topic) |
|
||||
| `get-mail-permissions` | auto-accept | `target_user` (optional) |
|
||||
|
||||
`send-email` checks that the caller has a mail permission entry matching `(caller, to, topic)` before sending. Permissions are managed via `set-mail-permission`, which requires the caller to have `canApprove` over the target user — so only humans can grant/revoke permissions for agents.
|
||||
|
||||
### Adding actions
|
||||
|
||||
@@ -131,8 +179,9 @@ Edit `server/actions.mjs`. Each entry needs:
|
||||
description: 'What this does',
|
||||
params: [{ name: 'foo', required: true, type: 'string' }],
|
||||
policy: 'auto-accept', // or 'auto-deny' | 'queue'
|
||||
handler: ({ foo }) => {
|
||||
// do something
|
||||
handler: ({ foo }, ctx) => {
|
||||
// ctx = { caller, users, mail_perm_store, mailer_send }
|
||||
// ctx is optional — omit the second argument if you don't need it
|
||||
return { result: foo };
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#!/usr/bin/env node
|
||||
import blessed from 'blessed';
|
||||
import { load_client_config } from '../client/config.mjs';
|
||||
import { get_queue, resolve_queue_item } from '../client/index.mjs';
|
||||
import { create_conduit_client } from '../client/conduit.mjs';
|
||||
|
||||
const POLL_INTERVAL = 2000;
|
||||
|
||||
const { username, secret } = load_client_config(process.argv);
|
||||
const { username, secret, url } = load_client_config(process.argv);
|
||||
const client = create_conduit_client(username, secret, url);
|
||||
|
||||
const screen = blessed.screen({
|
||||
smartCSR: true,
|
||||
@@ -25,6 +26,7 @@ const list_box = blessed.list({
|
||||
keys: true,
|
||||
vi: true,
|
||||
mouse: true,
|
||||
tags: true,
|
||||
style: {
|
||||
selected: { bg: 'blue', fg: 'white', bold: true },
|
||||
border: { fg: 'cyan' },
|
||||
@@ -118,7 +120,7 @@ function render_list() {
|
||||
|
||||
async function refresh() {
|
||||
try {
|
||||
items = await get_queue(username, secret);
|
||||
items = await client.get_queue();
|
||||
render_list();
|
||||
set_status(`Last refresh: ${new Date().toLocaleTimeString()}`);
|
||||
} catch (err) {
|
||||
@@ -135,7 +137,7 @@ async function decide(decision) {
|
||||
}
|
||||
set_status(`Sending ${decision} for ${item.id.slice(0, 8)}…`);
|
||||
try {
|
||||
await resolve_queue_item(item.id, decision, username, secret);
|
||||
await client.resolve_queue_item(item.id, decision);
|
||||
await refresh();
|
||||
} catch (err) {
|
||||
set_status(`Failed: ${err.message}`, true);
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
|
||||
import { sign_request } from "./auth.mjs";
|
||||
|
||||
const BASE_URL = process.env.CONDUIT_URL || "http://localhost:3015";
|
||||
const DEFAULT_URL = 'http://localhost:3015';
|
||||
|
||||
export function create_conduit_client(username, secret) {
|
||||
export function create_conduit_client(username, secret, base_url = process.env.CONDUIT_URL || DEFAULT_URL) {
|
||||
function auth_headers(body_string) {
|
||||
return sign_request(secret, username, body_string);
|
||||
}
|
||||
|
||||
async function call_action(action, params = {}) {
|
||||
const body_string = JSON.stringify({ action, ...params });
|
||||
const res = await fetch(`${BASE_URL}/action`, {
|
||||
const res = await fetch(`${base_url}/action`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", ...auth_headers(body_string) },
|
||||
body: body_string,
|
||||
@@ -25,11 +25,19 @@ export function create_conduit_client(username, secret) {
|
||||
}
|
||||
|
||||
async function get_queue() {
|
||||
const res = await fetch(`${BASE_URL}/queue`, {
|
||||
headers: auth_headers(""),
|
||||
const res = await fetch(`${base_url}/queue`, {
|
||||
headers: auth_headers(''),
|
||||
});
|
||||
return res.json();
|
||||
}
|
||||
|
||||
return { call_action, list_actions, get_queue };
|
||||
async function resolve_queue_item(id, decision) {
|
||||
const res = await fetch(`${base_url}/queue/${id}/${decision}`, {
|
||||
method: 'POST',
|
||||
headers: auth_headers(''),
|
||||
});
|
||||
return res.json();
|
||||
}
|
||||
|
||||
return { call_action, list_actions, get_queue, resolve_queue_item };
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
// Resolve client config from CLI args or environment variables.
|
||||
// Precedence: CLI args > env vars > error
|
||||
// Precedence: CLI args > env vars > defaults
|
||||
//
|
||||
// Env vars:
|
||||
// CCC_SECRETS path to secrets file
|
||||
// CCC_USER username to authenticate as
|
||||
// CCC_SECRETS path to secrets file
|
||||
// CCC_USER username to authenticate as
|
||||
// CONDUIT_URL server URL
|
||||
|
||||
import { readFileSync } from 'fs';
|
||||
|
||||
const DEFAULT_URL = 'http://localhost:3015';
|
||||
|
||||
function get_arg(argv, flag) {
|
||||
const i = argv.indexOf(flag);
|
||||
return i !== -1 ? argv[i + 1] : null;
|
||||
@@ -15,6 +18,7 @@ function get_arg(argv, flag) {
|
||||
export function load_client_config(argv) {
|
||||
const secrets_path = get_arg(argv, '--secrets') || process.env.CCC_SECRETS;
|
||||
const username = get_arg(argv, '--user') || process.env.CCC_USER;
|
||||
const url = get_arg(argv, '--url') || process.env.CONDUIT_URL || DEFAULT_URL;
|
||||
|
||||
if (!secrets_path) {
|
||||
console.error('Secrets file required: --secrets <path> or CCC_SECRETS=<path>');
|
||||
@@ -39,14 +43,14 @@ export function load_client_config(argv) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
return { username, secret: user_entry.secret };
|
||||
return { username, secret: user_entry.secret, url };
|
||||
}
|
||||
|
||||
export function get_remaining(argv) {
|
||||
const result = [];
|
||||
let i = 2;
|
||||
while (i < argv.length) {
|
||||
if (argv[i] === '--secrets' || argv[i] === '--user') {
|
||||
if (argv[i] === '--secrets' || argv[i] === '--user' || argv[i] === '--url') {
|
||||
i += 2;
|
||||
} else {
|
||||
result.push(argv[i]);
|
||||
|
||||
@@ -7,11 +7,9 @@
|
||||
import { sign_request } from './auth.mjs';
|
||||
import { load_client_config, get_remaining } from './config.mjs';
|
||||
|
||||
const BASE_URL = process.env.CONDUIT_URL || 'http://localhost:3015';
|
||||
|
||||
export async function call_action(payload, username, secret) {
|
||||
async function call_action(payload, username, secret, url) {
|
||||
const body_string = JSON.stringify(payload);
|
||||
const res = await fetch(`${BASE_URL}/action`, {
|
||||
const res = await fetch(`${url}/action`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', ...sign_request(secret, username, body_string) },
|
||||
body: body_string,
|
||||
@@ -20,23 +18,8 @@ export async function call_action(payload, username, secret) {
|
||||
return { status: res.status, body };
|
||||
}
|
||||
|
||||
export async function get_queue(username, secret) {
|
||||
const res = await fetch(`${BASE_URL}/queue`, {
|
||||
headers: sign_request(secret, username, ''),
|
||||
});
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function resolve_queue_item(id, decision, username, secret) {
|
||||
const res = await fetch(`${BASE_URL}/queue/${id}/${decision}`, {
|
||||
method: 'POST',
|
||||
headers: sign_request(secret, username, ''),
|
||||
});
|
||||
return res.json();
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const { username, secret } = load_client_config(process.argv);
|
||||
const { username, secret, url } = load_client_config(process.argv);
|
||||
const remaining = get_remaining(process.argv);
|
||||
|
||||
if (!remaining.length) {
|
||||
@@ -52,7 +35,7 @@ async function main() {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const { status, body } = await call_action(payload, username, secret);
|
||||
const { status, body } = await call_action(payload, username, secret, url);
|
||||
console.log(JSON.stringify(body, null, 2));
|
||||
process.exit(status >= 400 ? 1 : 0);
|
||||
}
|
||||
|
||||
13
config.example.json
Normal file
13
config.example.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"secrets": "../secrets.json",
|
||||
"mail_perms": "mail-perms.json",
|
||||
"smtp": {
|
||||
"host": "smtp.example.com",
|
||||
"port": 587,
|
||||
"secure": false,
|
||||
"auth": { "user": "relay@example.com", "pass": "<password>" },
|
||||
"from": "agent@example.com"
|
||||
},
|
||||
"bind": "127.0.0.1",
|
||||
"port": 3015
|
||||
}
|
||||
826
package-lock.json
generated
826
package-lock.json
generated
@@ -1,826 +0,0 @@
|
||||
{
|
||||
"name": "claude-code-conduit",
|
||||
"version": "0.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "claude-code-conduit",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"express": "^5.2.1"
|
||||
}
|
||||
},
|
||||
"node_modules/accepts": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",
|
||||
"integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-types": "^3.0.0",
|
||||
"negotiator": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/body-parser": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz",
|
||||
"integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bytes": "^3.1.2",
|
||||
"content-type": "^1.0.5",
|
||||
"debug": "^4.4.3",
|
||||
"http-errors": "^2.0.0",
|
||||
"iconv-lite": "^0.7.0",
|
||||
"on-finished": "^2.4.1",
|
||||
"qs": "^6.14.1",
|
||||
"raw-body": "^3.0.1",
|
||||
"type-is": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/bytes": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
||||
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bind-apply-helpers": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
||||
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bound": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
|
||||
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"get-intrinsic": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/content-disposition": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz",
|
||||
"integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/content-type": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
|
||||
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie": {
|
||||
"version": "0.7.2",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
|
||||
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie-signature": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz",
|
||||
"integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.4.3",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
||||
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/depd": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
||||
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/dunder-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"gopd": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/encodeurl": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
|
||||
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/es-define-property": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-errors": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-object-atoms": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
|
||||
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/escape-html": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/etag": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
||||
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/express": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz",
|
||||
"integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"accepts": "^2.0.0",
|
||||
"body-parser": "^2.2.1",
|
||||
"content-disposition": "^1.0.0",
|
||||
"content-type": "^1.0.5",
|
||||
"cookie": "^0.7.1",
|
||||
"cookie-signature": "^1.2.1",
|
||||
"debug": "^4.4.0",
|
||||
"depd": "^2.0.0",
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"etag": "^1.8.1",
|
||||
"finalhandler": "^2.1.0",
|
||||
"fresh": "^2.0.0",
|
||||
"http-errors": "^2.0.0",
|
||||
"merge-descriptors": "^2.0.0",
|
||||
"mime-types": "^3.0.0",
|
||||
"on-finished": "^2.4.1",
|
||||
"once": "^1.4.0",
|
||||
"parseurl": "^1.3.3",
|
||||
"proxy-addr": "^2.0.7",
|
||||
"qs": "^6.14.0",
|
||||
"range-parser": "^1.2.1",
|
||||
"router": "^2.2.0",
|
||||
"send": "^1.1.0",
|
||||
"serve-static": "^2.2.0",
|
||||
"statuses": "^2.0.1",
|
||||
"type-is": "^2.0.1",
|
||||
"vary": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/finalhandler": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz",
|
||||
"integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "^4.4.0",
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"on-finished": "^2.4.1",
|
||||
"parseurl": "^1.3.3",
|
||||
"statuses": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/forwarded": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/fresh": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",
|
||||
"integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"es-define-property": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"es-object-atoms": "^1.1.1",
|
||||
"function-bind": "^1.1.2",
|
||||
"get-proto": "^1.0.1",
|
||||
"gopd": "^1.2.0",
|
||||
"has-symbols": "^1.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
"math-intrinsics": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dunder-proto": "^1.0.1",
|
||||
"es-object-atoms": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/gopd": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
||||
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/has-symbols": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
|
||||
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/hasown": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
||||
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/http-errors": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
|
||||
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"depd": "~2.0.0",
|
||||
"inherits": "~2.0.4",
|
||||
"setprototypeof": "~1.2.0",
|
||||
"statuses": "~2.0.2",
|
||||
"toidentifier": "~1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.7.2",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz",
|
||||
"integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/ipaddr.js": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
||||
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/is-promise": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
|
||||
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/math-intrinsics": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/media-typer": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",
|
||||
"integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/merge-descriptors": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz",
|
||||
"integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.54.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
|
||||
"integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz",
|
||||
"integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-db": "^1.54.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/negotiator": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",
|
||||
"integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
"version": "1.13.4",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
|
||||
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/on-finished": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
||||
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ee-first": "1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/path-to-regexp": {
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz",
|
||||
"integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/proxy-addr": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
||||
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"forwarded": "0.2.0",
|
||||
"ipaddr.js": "1.9.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.15.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.15.0.tgz",
|
||||
"integrity": "sha512-mAZTtNCeetKMH+pSjrb76NAM8V9a05I9aBZOHztWy/UqcJdQYNsf59vrRKWnojAT9Y+GbIvoTBC++CPHqpDBhQ==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"side-channel": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/range-parser": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
||||
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/raw-body": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz",
|
||||
"integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bytes": "~3.1.2",
|
||||
"http-errors": "~2.0.1",
|
||||
"iconv-lite": "~0.7.0",
|
||||
"unpipe": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/router": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
|
||||
"integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "^4.4.0",
|
||||
"depd": "^2.0.0",
|
||||
"is-promise": "^4.0.0",
|
||||
"parseurl": "^1.3.3",
|
||||
"path-to-regexp": "^8.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/send": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz",
|
||||
"integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "^4.4.3",
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"etag": "^1.8.1",
|
||||
"fresh": "^2.0.0",
|
||||
"http-errors": "^2.0.1",
|
||||
"mime-types": "^3.0.2",
|
||||
"ms": "^2.1.3",
|
||||
"on-finished": "^2.4.1",
|
||||
"range-parser": "^1.2.1",
|
||||
"statuses": "^2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/serve-static": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz",
|
||||
"integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"parseurl": "^1.3.3",
|
||||
"send": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/setprototypeof": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
||||
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/side-channel": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
|
||||
"integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.3",
|
||||
"side-channel-list": "^1.0.0",
|
||||
"side-channel-map": "^1.0.1",
|
||||
"side-channel-weakmap": "^1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-list": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",
|
||||
"integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-map": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
|
||||
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.5",
|
||||
"object-inspect": "^1.13.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-weakmap": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
|
||||
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.5",
|
||||
"object-inspect": "^1.13.3",
|
||||
"side-channel-map": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/statuses": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
|
||||
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/toidentifier": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
||||
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/type-is": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz",
|
||||
"integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"content-type": "^1.0.5",
|
||||
"media-typer": "^1.1.0",
|
||||
"mime-types": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
||||
"license": "ISC"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "claude-code-conduit",
|
||||
"version": "0.1.0",
|
||||
"version": "1.1.0",
|
||||
"description": "A supervised action bridge between Claude Code and the host system",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
@@ -10,11 +10,12 @@
|
||||
"bin": {
|
||||
"ccc-server": "bin/ccc-server.mjs",
|
||||
"ccc-client": "bin/ccc-client.mjs",
|
||||
"ccc-queue": "bin/ccc-queue.mjs",
|
||||
"ccc-queue": "bin/ccc-queue.mjs",
|
||||
"ccc-keygen": "bin/ccc-keygen.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"blessed": "^0.1.81",
|
||||
"express": "^5.2.1"
|
||||
"express": "^5.2.1",
|
||||
"nodemailer": "^8.0.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
// policy: "auto-accept" | "auto-deny" | "queue"
|
||||
|
||||
|
||||
import { resolve_path, exec } from "./helpers.mjs";
|
||||
import { resolve_path } from './helpers.mjs';
|
||||
import { check_can_approve } from './auth.mjs';
|
||||
|
||||
export const actions = {
|
||||
"list-actions": {
|
||||
@@ -23,7 +24,7 @@ export const actions = {
|
||||
description: "Open a file in the editor",
|
||||
params: [{ name: "filename", required: true, type: "path" }],
|
||||
policy: "auto-accept",
|
||||
handler: ({ filename }) => {
|
||||
handler: ({ filename }, { exec }) => {
|
||||
const resolved = resolve_path(filename);
|
||||
exec('subl3', [resolved]);
|
||||
return { opened: resolved };
|
||||
@@ -47,7 +48,7 @@ export const actions = {
|
||||
description: "Open a URL in the web browser",
|
||||
params: [{ name: "url", required: true, type: "string" }],
|
||||
policy: "queue",
|
||||
handler: ({ url }) => {
|
||||
handler: ({ url }, { exec }) => {
|
||||
const parsed = new URL(url);
|
||||
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
|
||||
throw new Error(`Disallowed protocol: ${parsed.protocol}`);
|
||||
@@ -61,10 +62,62 @@ export const actions = {
|
||||
description: "Open a terminal in a given directory",
|
||||
params: [{ name: "path", required: false, type: "path" }],
|
||||
policy: 'queue',
|
||||
handler: ({ path }) => {
|
||||
handler: ({ path }, { exec }) => {
|
||||
const resolved = resolve_path(path ?? 'workspace');
|
||||
exec('konsole', ['--workdir', resolved, '-e', 'bash']);
|
||||
return { opened: resolved };
|
||||
},
|
||||
},
|
||||
|
||||
'send-email': {
|
||||
description: 'Send an email to a permitted recipient',
|
||||
params: [
|
||||
{ name: 'to', required: true, type: 'string' },
|
||||
{ name: 'subject', required: true, type: 'string' },
|
||||
{ name: 'body', required: true, type: 'string' },
|
||||
{ name: 'topic', required: true, type: 'string' },
|
||||
],
|
||||
policy: 'auto-accept',
|
||||
handler: async ({ to, subject, body, topic }, { caller, mail_perm_store, mailer_send }) => {
|
||||
if (!mail_perm_store.check(caller, to, topic)) {
|
||||
throw new Error(`Mail permission denied: ${caller} → ${to} [${topic}]`);
|
||||
}
|
||||
await mailer_send(to, subject, body);
|
||||
return { sent: true, to, topic };
|
||||
},
|
||||
},
|
||||
|
||||
'set-mail-permission': {
|
||||
description: 'Grant or revoke permission for a user to send email to a recipient/topic',
|
||||
params: [
|
||||
{ name: 'target_user', required: true, type: 'string' },
|
||||
{ name: 'to', required: true, type: 'string' },
|
||||
{ name: 'topic', required: false, type: 'string' },
|
||||
{ name: 'allow', required: true, type: 'boolean' },
|
||||
],
|
||||
policy: 'auto-accept',
|
||||
handler: ({ target_user, to, topic = null, allow }, { caller, users, mail_perm_store }) => {
|
||||
if (!check_can_approve(users, caller, target_user)) {
|
||||
throw new Error(`Not authorized to set mail permissions for '${target_user}'`);
|
||||
}
|
||||
if (allow) {
|
||||
mail_perm_store.add(target_user, to, topic);
|
||||
} else {
|
||||
mail_perm_store.remove(target_user, to, topic);
|
||||
}
|
||||
return { target_user, to, topic, allow, permissions: mail_perm_store.list() };
|
||||
},
|
||||
},
|
||||
|
||||
'get-mail-permissions': {
|
||||
description: 'List current mail permissions, optionally filtered by user',
|
||||
params: [
|
||||
{ name: 'target_user', required: false, type: 'string' },
|
||||
],
|
||||
policy: 'auto-accept',
|
||||
handler: ({ target_user }, { mail_perm_store }) => {
|
||||
const all = mail_perm_store.list();
|
||||
return { permissions: target_user ? all.filter(e => e.user === target_user) : all };
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
56
server/config.mjs
Normal file
56
server/config.mjs
Normal file
@@ -0,0 +1,56 @@
|
||||
import { readFileSync } from 'fs';
|
||||
import { resolve } from 'path';
|
||||
|
||||
export function load_config(file_path) {
|
||||
if (!file_path) {
|
||||
throw new Error('--config <path> is required');
|
||||
}
|
||||
let raw;
|
||||
try {
|
||||
raw = readFileSync(file_path, 'utf8');
|
||||
} catch (err) {
|
||||
throw new Error(`Cannot read config file at ${file_path}: ${err.message}`);
|
||||
}
|
||||
let parsed;
|
||||
try {
|
||||
parsed = JSON.parse(raw);
|
||||
} catch (err) {
|
||||
throw new Error(`Config file is not valid JSON: ${err.message}`);
|
||||
}
|
||||
|
||||
if (!parsed.secrets) {
|
||||
throw new Error("Config file must have a 'secrets' field pointing to the secrets file");
|
||||
}
|
||||
|
||||
// Resolve secrets path relative to the config file's directory
|
||||
const config_dir = resolve(file_path, '..');
|
||||
const secrets_path = resolve(config_dir, parsed.secrets);
|
||||
|
||||
let secrets_raw;
|
||||
try {
|
||||
secrets_raw = readFileSync(secrets_path, 'utf8');
|
||||
} catch (err) {
|
||||
throw new Error(`Cannot read secrets file at ${secrets_path}: ${err.message}`);
|
||||
}
|
||||
let secrets;
|
||||
try {
|
||||
secrets = JSON.parse(secrets_raw);
|
||||
} catch (err) {
|
||||
throw new Error(`Secrets file is not valid JSON: ${err.message}`);
|
||||
}
|
||||
if (!secrets.users || typeof secrets.users !== 'object') {
|
||||
throw new Error("Secrets file must have a top-level 'users' object");
|
||||
}
|
||||
|
||||
const mail_perms_path = parsed.mail_perms
|
||||
? resolve(config_dir, parsed.mail_perms)
|
||||
: null;
|
||||
|
||||
return {
|
||||
users: secrets.users,
|
||||
smtp: parsed.smtp ?? null,
|
||||
mail_perms_path,
|
||||
bind: parsed.bind ?? null,
|
||||
port: parsed.port ?? null,
|
||||
};
|
||||
}
|
||||
140
server/index.mjs
140
server/index.mjs
@@ -1,34 +1,82 @@
|
||||
import express from "express";
|
||||
import { actions } from "./actions.mjs";
|
||||
import { enqueue, get_entry, list_pending, resolve } from "./queue.mjs";
|
||||
import { load_secrets } from "./secrets.mjs";
|
||||
import { create_auth_middleware, check_can_approve } from "./auth.mjs";
|
||||
|
||||
const PORT = process.env.CONDUIT_PORT || 3015;
|
||||
import express from 'express';
|
||||
import { actions } from './actions.mjs';
|
||||
import { enqueue, get_entry, list_pending, resolve } from './queue.mjs';
|
||||
import { load_config } from './config.mjs';
|
||||
import { create_auth_middleware, check_can_approve } from './auth.mjs';
|
||||
import { create_mailer } from './mailer.mjs';
|
||||
import { exec as real_exec } from './helpers.mjs';
|
||||
import { load_mail_perms } from './mail_perms.mjs';
|
||||
|
||||
function get_arg(argv, flag) {
|
||||
const i = argv.indexOf(flag);
|
||||
return i !== -1 ? argv[i + 1] : null;
|
||||
}
|
||||
|
||||
const secrets_path = get_arg(process.argv, "--secrets");
|
||||
let secrets;
|
||||
function ts() {
|
||||
return new Date().toLocaleTimeString();
|
||||
}
|
||||
|
||||
const VERBOSE = process.argv.includes('--verbose');
|
||||
const DRY_RUN = process.argv.includes('--dry-run');
|
||||
|
||||
const config_path = get_arg(process.argv, '--config') || process.env.CONDUIT_CONFIG;
|
||||
|
||||
let cfg;
|
||||
try {
|
||||
secrets = load_secrets(secrets_path);
|
||||
cfg = load_config(config_path);
|
||||
} catch (err) {
|
||||
console.error(`Fatal: ${err.message}`);
|
||||
process.exit(1);
|
||||
}
|
||||
const { users } = secrets;
|
||||
|
||||
const { users, smtp, mail_perms_path } = cfg;
|
||||
const PORT = process.env.CONDUIT_PORT || cfg.port || 3015;
|
||||
const BIND = process.env.CONDUIT_BIND || cfg.bind || '127.0.0.1';
|
||||
|
||||
let mail_perm_store;
|
||||
try {
|
||||
mail_perm_store = load_mail_perms(mail_perms_path);
|
||||
} catch (err) {
|
||||
console.error(`Fatal: ${err.message}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!mail_perms_path) {
|
||||
console.warn('Warning: mail_perms not set in config; mail permissions will not persist across restarts');
|
||||
}
|
||||
|
||||
const real_mailer_send = create_mailer(smtp);
|
||||
|
||||
const app = express();
|
||||
app.use(express.json({
|
||||
verify: (req, _res, buf) => {
|
||||
req.raw_body = buf.toString("utf8");
|
||||
req.raw_body = buf.toString('utf8');
|
||||
},
|
||||
}));
|
||||
app.use(create_auth_middleware(users));
|
||||
|
||||
app.use((req, _res, next) => {
|
||||
const is_debug = req.method === 'GET' && req.path === '/queue';
|
||||
if (!is_debug || VERBOSE) {
|
||||
console.log(`[${ts()}] ${req.method} ${req.path} — ${req.conduit_user}`);
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
||||
function make_ctx(caller) {
|
||||
const exec = DRY_RUN
|
||||
? (bin, args) => console.log(`[${ts()}] [DRY-RUN] exec: ${bin} ${JSON.stringify(args)}`)
|
||||
: real_exec;
|
||||
const mailer_send = DRY_RUN
|
||||
? async (to, subject) => console.log(`[${ts()}] [DRY-RUN] send-mail: to=${to} subject=${JSON.stringify(subject)}`)
|
||||
: real_mailer_send;
|
||||
return { caller, users, mail_perm_store, exec, mailer_send };
|
||||
}
|
||||
|
||||
async function run_action(def, params, ctx) {
|
||||
return def.handler(params, ctx);
|
||||
}
|
||||
|
||||
function validate_params(action_def, params) {
|
||||
const errors = [];
|
||||
for (const p of action_def.params) {
|
||||
@@ -40,7 +88,7 @@ function validate_params(action_def, params) {
|
||||
}
|
||||
|
||||
// POST /action — main entry point
|
||||
app.post("/action", async (req, res) => {
|
||||
app.post('/action', async (req, res) => {
|
||||
const { action, ...params } = req.body ?? {};
|
||||
|
||||
if (!action) {
|
||||
@@ -54,75 +102,83 @@ app.post("/action", async (req, res) => {
|
||||
|
||||
const errors = validate_params(def, params);
|
||||
if (errors.length) {
|
||||
return res.status(400).json({ error: "Invalid params", details: errors });
|
||||
return res.status(400).json({ error: 'Invalid params', details: errors });
|
||||
}
|
||||
|
||||
if (def.policy === "auto-deny") {
|
||||
return res.status(403).json({ status: "denied", reason: "Policy: auto-deny" });
|
||||
if (def.policy === 'auto-deny') {
|
||||
return res.status(403).json({ status: 'denied', reason: 'Policy: auto-deny' });
|
||||
}
|
||||
|
||||
if (def.policy === "auto-accept") {
|
||||
const ctx = make_ctx(req.conduit_user);
|
||||
|
||||
if (def.policy === 'auto-accept') {
|
||||
try {
|
||||
const result = await def.handler(params);
|
||||
return res.json({ status: "accepted", result });
|
||||
const result = await run_action(def, params, ctx);
|
||||
return res.json({ status: 'accepted', result });
|
||||
} catch (err) {
|
||||
return res.status(500).json({ status: "error", error: err.message });
|
||||
return res.status(500).json({ status: 'error', error: err.message });
|
||||
}
|
||||
}
|
||||
|
||||
if (def.policy === "queue") {
|
||||
if (def.policy === 'queue') {
|
||||
const id = enqueue(action, params, req.conduit_user);
|
||||
return res.status(202).json({ status: "queued", id });
|
||||
return res.status(202).json({ status: 'queued', id });
|
||||
}
|
||||
});
|
||||
|
||||
// GET /queue — list pending items
|
||||
app.get("/queue", (req, res) => {
|
||||
app.get('/queue', (req, res) => {
|
||||
res.json(list_pending());
|
||||
});
|
||||
|
||||
// POST /queue/:id/approve — user approves a queued action
|
||||
app.post("/queue/:id/approve", async (req, res) => {
|
||||
app.post('/queue/:id/approve', async (req, res) => {
|
||||
const entry = get_entry(req.params.id);
|
||||
if (!entry) {
|
||||
return res.status(404).json({ error: "Not found" });
|
||||
return res.status(404).json({ error: 'Not found' });
|
||||
}
|
||||
if (entry.status !== "pending") {
|
||||
return res.status(409).json({ error: "Already resolved" });
|
||||
if (entry.status !== 'pending') {
|
||||
return res.status(409).json({ error: 'Already resolved' });
|
||||
}
|
||||
if (!check_can_approve(users, req.conduit_user, entry.submitted_by)) {
|
||||
return res.status(403).json({ error: "Not authorized to approve this entry" });
|
||||
return res.status(403).json({ error: 'Not authorized to approve this entry' });
|
||||
}
|
||||
|
||||
resolve(req.params.id, "approved");
|
||||
entry.resolved_by = req.conduit_user;
|
||||
resolve(req.params.id, 'approved');
|
||||
|
||||
const ctx = make_ctx(entry.submitted_by);
|
||||
const def = actions[entry.action];
|
||||
try {
|
||||
const result = await def.handler(entry.params);
|
||||
res.json({ status: "approved", result });
|
||||
const result = await run_action(def, entry.params, ctx);
|
||||
res.json({ status: 'approved', result });
|
||||
} catch (err) {
|
||||
res.status(500).json({ status: "error", error: err.message });
|
||||
res.status(500).json({ status: 'error', error: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
// POST /queue/:id/deny — user denies a queued action
|
||||
app.post("/queue/:id/deny", (req, res) => {
|
||||
app.post('/queue/:id/deny', (req, res) => {
|
||||
const entry = get_entry(req.params.id);
|
||||
if (!entry) {
|
||||
return res.status(404).json({ error: "Not found" });
|
||||
return res.status(404).json({ error: 'Not found' });
|
||||
}
|
||||
if (entry.status !== "pending") {
|
||||
return res.status(409).json({ error: "Already resolved" });
|
||||
if (entry.status !== 'pending') {
|
||||
return res.status(409).json({ error: 'Already resolved' });
|
||||
}
|
||||
if (!check_can_approve(users, req.conduit_user, entry.submitted_by)) {
|
||||
return res.status(403).json({ error: "Not authorized to deny this entry" });
|
||||
return res.status(403).json({ error: 'Not authorized to deny this entry' });
|
||||
}
|
||||
|
||||
resolve(req.params.id, "denied");
|
||||
res.json({ status: "denied" });
|
||||
entry.resolved_by = req.conduit_user;
|
||||
resolve(req.params.id, 'denied');
|
||||
res.json({ status: 'denied' });
|
||||
});
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`claude-code-conduit server running on port ${PORT}`);
|
||||
console.log(`Workspace root: ${process.env.CONDUIT_ROOT || "/workspace"}`);
|
||||
app.listen(PORT, BIND, () => {
|
||||
console.log(`claude-code-conduit server running on ${BIND}:${PORT}`);
|
||||
console.log(`Workspace root: ${process.env.CONDUIT_ROOT || '/workspace'}`);
|
||||
if (DRY_RUN) {
|
||||
console.log('DRY-RUN mode enabled — actions will be logged but not executed');
|
||||
}
|
||||
});
|
||||
|
||||
49
server/mail_perms.mjs
Normal file
49
server/mail_perms.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
||||
|
||||
export function load_mail_perms(file_path) {
|
||||
let allowed = [];
|
||||
|
||||
if (file_path && existsSync(file_path)) {
|
||||
try {
|
||||
const parsed = JSON.parse(readFileSync(file_path, 'utf8'));
|
||||
if (!Array.isArray(parsed.allowed)) {
|
||||
throw new Error("'allowed' must be an array");
|
||||
}
|
||||
allowed = parsed.allowed;
|
||||
} catch (err) {
|
||||
throw new Error(`Cannot load mail permissions from ${file_path}: ${err.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
function write() {
|
||||
if (!file_path) {
|
||||
return;
|
||||
}
|
||||
writeFileSync(file_path, JSON.stringify({ allowed }, null, '\t') + '\n', 'utf8');
|
||||
}
|
||||
|
||||
function check(user, to, topic) {
|
||||
return allowed.some(e => e.user === user && e.to === to && (e.topic === topic || e.topic === null));
|
||||
}
|
||||
|
||||
function add(user, to, topic) {
|
||||
if (!check(user, to, topic)) {
|
||||
allowed.push({ user, to, topic });
|
||||
write();
|
||||
}
|
||||
}
|
||||
|
||||
function remove(user, to, topic) {
|
||||
const before = allowed.length;
|
||||
allowed = allowed.filter(e => !(e.user === user && e.to === to && e.topic === topic));
|
||||
if (allowed.length !== before) {
|
||||
write();
|
||||
}
|
||||
}
|
||||
|
||||
function list() {
|
||||
return [...allowed];
|
||||
}
|
||||
|
||||
return { check, add, remove, list };
|
||||
}
|
||||
18
server/mailer.mjs
Normal file
18
server/mailer.mjs
Normal file
@@ -0,0 +1,18 @@
|
||||
import nodemailer from 'nodemailer';
|
||||
|
||||
// Returns an async send(to, subject, body) function.
|
||||
// If smtp_config is absent, returns a stub that always throws.
|
||||
export function create_mailer(smtp_config) {
|
||||
if (!smtp_config) {
|
||||
return async () => {
|
||||
throw new Error('SMTP not configured');
|
||||
};
|
||||
}
|
||||
|
||||
const { from, ...transport_config } = smtp_config;
|
||||
const transporter = nodemailer.createTransport(transport_config);
|
||||
|
||||
return async function send(to, subject, body) {
|
||||
await transporter.sendMail({ from, to, subject, text: body });
|
||||
};
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
import { randomUUID } from "crypto";
|
||||
import { randomUUID } from 'crypto';
|
||||
|
||||
const pending = new Map();
|
||||
|
||||
function ts() {
|
||||
return new Date().toLocaleTimeString();
|
||||
}
|
||||
|
||||
export function enqueue(action, params, submitted_by) {
|
||||
const id = randomUUID();
|
||||
const entry = {
|
||||
@@ -9,16 +13,11 @@ export function enqueue(action, params, submitted_by) {
|
||||
action,
|
||||
params,
|
||||
submitted_by,
|
||||
status: "pending",
|
||||
status: 'pending',
|
||||
created_at: new Date().toISOString(),
|
||||
};
|
||||
pending.set(id, entry);
|
||||
console.log(`\n[QUEUE] New request #${id.slice(0, 8)}`);
|
||||
console.log(` Action: ${action}`);
|
||||
console.log(` Params: ${JSON.stringify(params)}`);
|
||||
console.log(` Submitted by: ${submitted_by}`);
|
||||
console.log(` Approve: POST /queue/${id}/approve`);
|
||||
console.log(` Deny: POST /queue/${id}/deny\n`);
|
||||
console.log(`[${ts()}] [QUEUE] ${submitted_by} requested '${action}' (${id.slice(0, 8)}) — params: ${JSON.stringify(params)}`);
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -27,7 +26,7 @@ export function get_entry(id) {
|
||||
}
|
||||
|
||||
export function list_pending() {
|
||||
return [...pending.values()].filter((e) => e.status === "pending");
|
||||
return [...pending.values()].filter((e) => e.status === 'pending');
|
||||
}
|
||||
|
||||
export function resolve(id, decision) {
|
||||
@@ -35,7 +34,8 @@ export function resolve(id, decision) {
|
||||
if (!entry) {
|
||||
return null;
|
||||
}
|
||||
entry.status = decision; // "approved" | "denied"
|
||||
entry.status = decision; // 'approved' | 'denied'
|
||||
entry.resolved_at = new Date().toISOString();
|
||||
console.log(`[${ts()}] [QUEUE] ${id.slice(0, 8)} ${decision} by ${entry.resolved_by ?? 'unknown'}`);
|
||||
return entry;
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
export function load_secrets(file_path) {
|
||||
if (!file_path) {
|
||||
throw new Error("--secrets <path> is required");
|
||||
}
|
||||
let raw;
|
||||
try {
|
||||
raw = readFileSync(file_path, "utf8");
|
||||
} catch (err) {
|
||||
throw new Error(`Cannot read secrets file at ${file_path}: ${err.message}`);
|
||||
}
|
||||
let parsed;
|
||||
try {
|
||||
parsed = JSON.parse(raw);
|
||||
} catch (err) {
|
||||
throw new Error(`Secrets file is not valid JSON: ${err.message}`);
|
||||
}
|
||||
if (!parsed.users || typeof parsed.users !== "object") {
|
||||
throw new Error("Secrets file must have a top-level 'users' object");
|
||||
}
|
||||
return parsed;
|
||||
}
|
||||
Reference in New Issue
Block a user