passcontrol 1.1.0 → 1.2.0
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 +16 -20
- package/bin/passcontrol.mjs +34 -21
- package/cli/config.mjs +2 -2
- package/cli/integration-defaults.d.mts +2 -1
- package/cli/integration-defaults.mjs +7 -0
- package/cli/local-stack.mjs +55 -0
- package/cli/presets.mjs +55 -1
- package/cli/proxy-policy.mjs +9 -0
- package/package.json +1 -1
- package/sdk/README.md +1 -1
- package/sdk/passcontrol.d.ts +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ stop control without copying provider secrets into every tool. Bring your own pr
|
|
|
10
10
|
|
|
11
11
|
| Start here | Choose it when | You operate |
|
|
12
12
|
|---|---|---|
|
|
13
|
-
| [Cloud](#cloud) — free
|
|
13
|
+
| [Cloud](#cloud) — free beta, open sign-up | You want a managed gateway without running a database or Docker | Your agents and provider account |
|
|
14
14
|
| [Self-host](#self-host) — full working core | You want the gateway and provider credentials on infrastructure you control | Gateway, dashboard, Supabase Auth + Vault + database, and Redis |
|
|
15
15
|
|
|
16
16
|
A **Passport** is an Ed25519 signing key used to obtain a short-lived visa. A **Direct
|
|
@@ -23,11 +23,11 @@ independently audited**. Start with a non-critical provider key. Source-availabl
|
|
|
23
23
|
|
|
24
24
|
## Cloud
|
|
25
25
|
|
|
26
|
-
[
|
|
26
|
+
[Create a free account](https://passcontrol.vertias.eu/signup). To look around first, try
|
|
27
27
|
[the keyless browser demo](https://passcontrol.vertias.eu): it synthesizes output and
|
|
28
28
|
does not call a billed provider.
|
|
29
29
|
|
|
30
|
-
Once you have
|
|
30
|
+
Once you have an account, install the CLI with Node/npm and sign in:
|
|
31
31
|
|
|
32
32
|
```sh
|
|
33
33
|
npm install -g passcontrol
|
|
@@ -161,7 +161,7 @@ API key. Treat access to that local listener as access to the configured agent.
|
|
|
161
161
|
not a sandbox against other processes running as you. Its provider CONNECT requests are
|
|
162
162
|
refused; use base URLs rather than TLS interception.
|
|
163
163
|
|
|
164
|
-
Presets (from `cli/presets.mjs`): `generic`, `openhands`, `litellm`, `aider`, `hermes`, `cline`, `continue`, `chatbox`, `jan`, `msty`, `cherry-studio`, `open-webui`, `librechat`; service presets: `github`, `telegram`; MCP presets: `claude-desktop`, `cursor`, `claude-code`. Compatibility still depends on the client using
|
|
164
|
+
Presets (from `cli/presets.mjs`): `generic`, `openhands`, `litellm`, `aider`, `hermes`, `cline`, `continue`, `chatbox`, `jan`, `msty`, `cherry-studio`, `open-webui`, `librechat`; service presets: `github`, `telegram`, `brave`, `notion`, `discord`; MCP presets: `claude-desktop`, `cursor`, `claude-code`. Compatibility still depends on the client using
|
|
165
165
|
supported paths. [Hermes configuration](https://github.com/Vertias3u/PassControl/blob/main/docs/integrations/hermes.md).
|
|
166
166
|
|
|
167
167
|
## CLI configuration and key storage
|
|
@@ -258,6 +258,8 @@ are separate from signature verification.
|
|
|
258
258
|
shadow evaluation records candidate decisions without enforcing them.
|
|
259
259
|
- Token and cost admission limits through atomic reservations and settlement.
|
|
260
260
|
- Platform/tenant kill switches and per-agent suspension/revocation.
|
|
261
|
+
- "Ask me first" on service calls: a rule can hold the exact request until the owner
|
|
262
|
+
approves it once, from the dashboard or with Telegram buttons.
|
|
261
263
|
- Provider failover within supported request families and each attempt's authorization
|
|
262
264
|
and budget checks; it is not arbitrary API translation. Embeddings never fail over.
|
|
263
265
|
- The injected provider key is removed from what comes back: if an upstream echoes it in
|
|
@@ -300,7 +302,8 @@ Prices are an in-code estimate table, one row per model, read from each provider
|
|
|
300
302
|
page. Under a dollar limit, a model with no row is refused `402 unpriced_model`; without one it
|
|
301
303
|
is estimated at the provider's highest listed rate. **Custom endpoints are unpriced**, even when the model name
|
|
302
304
|
matches: logs mark cost unknown, receipts carry `unp`, and token accounting continues.
|
|
303
|
-
|
|
305
|
+
They add nothing to an agent's cost budget, and an agent with a dollar limit is refused them
|
|
306
|
+
(`402 unpriced_endpoint`): limit those agents by tokens.
|
|
304
307
|
Known/table-priced cost, conservative enforced spend, and open holds are different figures.
|
|
305
308
|
The dashboard therefore labels the all-time counter **Settled budget charges** and shows its
|
|
306
309
|
durable call-attributed charges, separate operator adjustments, any visible difference, and
|
|
@@ -323,6 +326,7 @@ All paths below are relative to `/api/v1/<provider>`. SDK base URLs and aliases
|
|
|
323
326
|
| `gemini` | Google's **OpenAI-compatible** Chat Completions | Models list/detail |
|
|
324
327
|
| `xai` | **POST Responses** only (legacy Chat Completions refused) | Models list/detail |
|
|
325
328
|
| `azure` | Azure OpenAI v1: Chat Completions, **POST Responses** and **POST Embeddings**, at the resource address stored with the key | Models list |
|
|
329
|
+
| `local` | A model server you run (Ollama, LM Studio, vLLM): Chat Completions at the address stored with the credential, self-host only | Models list |
|
|
326
330
|
|
|
327
331
|
Gemini's native `generateContent` API is not supported. Responses is served for OpenAI,
|
|
328
332
|
xAI and Azure; embeddings for OpenAI, Mistral and Azure, and an embeddings call never fails over, because
|
|
@@ -335,7 +339,9 @@ Custom provider base URLs support compatible deployments such as Ollama, vLLM, o
|
|
|
335
339
|
LiteLLM without adding provider IDs. They require operator opt-in:
|
|
336
340
|
`PROVIDER_ENDPOINT_MODE=selfhost` permits HTTP, private addresses, and custom ports;
|
|
337
341
|
a comma-separated hostname list permits only listed HTTPS hosts on port 443. Unset/off
|
|
338
|
-
refuses custom endpoints.
|
|
342
|
+
refuses custom endpoints. The local stack (`npm run dev:docker`, `passcontrol start`) runs
|
|
343
|
+
with `selfhost` unless you set `off`: it is one developer's own gateway, so the person who
|
|
344
|
+
sets an endpoint is the person who owns it. A hosted deployment's default stays off. Shape validation is **not full SSRF prevention**: it does not
|
|
339
345
|
resolve or pin DNS. Operators must control egress and trust the destination receiving
|
|
340
346
|
the provider credential. Upstream redirects are refused, never followed.
|
|
341
347
|
|
|
@@ -364,11 +370,6 @@ check needs the relevant earlier statements or a trusted checkpoint. The public
|
|
|
364
370
|
tree ships the format and verification code/page, **not statement production, scheduling,
|
|
365
371
|
or statement/proof-serving routes**. See [statement format and limits](https://github.com/Vertias3u/PassControl/blob/main/docs/statement-format.md).
|
|
366
372
|
|
|
367
|
-
Owner binding is per workspace. A typed owner is a declaration; GitHub verification
|
|
368
|
-
checks publication of a token in a particular account's repository, and domain
|
|
369
|
-
verification checks a well-known HTTPS token. Neither proves a person's legal identity
|
|
370
|
-
or trustworthiness. Company registry evidence is also distinct from authority to represent
|
|
371
|
-
that company. Only published bindings are attached to public evidence.
|
|
372
373
|
|
|
373
374
|

|
|
374
375
|
|
|
@@ -380,7 +381,7 @@ of an already-dispatched stream.
|
|
|
380
381
|
## Self-host operations reference
|
|
381
382
|
|
|
382
383
|
<details>
|
|
383
|
-
<summary>Source setup, lifecycle, credential switching
|
|
384
|
+
<summary>Source setup, lifecycle, credential switching and portability</summary>
|
|
384
385
|
|
|
385
386
|
The CLI package declares Node ≥18, but the full stack needs Node 22+: locked Supabase
|
|
386
387
|
dependencies need ≥20 and Wrangler needs ≥22. Use `passcontrol setup --no-open` to
|
|
@@ -414,14 +415,9 @@ Shell or project-file gateway overrides are refused and named before services st
|
|
|
414
415
|
global write could not override them safely. Clean up any still-active remote identity at its
|
|
415
416
|
original gateway.
|
|
416
417
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
and build/run the app. Supported paths are Next.js on Vercel, `npm run build` then
|
|
421
|
-
`npm start` on a Node host behind a trusted reverse proxy, and the
|
|
422
|
-
[Cloudflare/OpenNext build](https://github.com/Vertias3u/PassControl/blob/main/docs/deployment/cloudflare.md). Configure Auth/SMTP,
|
|
423
|
-
secrets, backups, Redis persistence/no-eviction, and periodic authenticated
|
|
424
|
-
`GET /api/cron/reconcile`. A local successful boot does not validate production operations.
|
|
418
|
+
Self-host is built for one developer on their own machine; this repository does not ship
|
|
419
|
+
a production deployment path. To let agents running elsewhere reach PassControl, or to give
|
|
420
|
+
passports a verify page anyone can open, use [Cloud](#cloud).
|
|
425
421
|
|
|
426
422
|
| Boundary | Cloud | Public self-host tree |
|
|
427
423
|
|---|---|---|
|
package/bin/passcontrol.mjs
CHANGED
|
@@ -68,6 +68,7 @@ import {
|
|
|
68
68
|
isGuiPreset,
|
|
69
69
|
isIntegration,
|
|
70
70
|
isServicePreset,
|
|
71
|
+
SERVICE_ENV,
|
|
71
72
|
supportsWrite,
|
|
72
73
|
} from "../cli/presets.mjs";
|
|
73
74
|
import { importCompletionMessage, noAgentCreateMessage } from "../cli/workspace-import-report.mjs";
|
|
@@ -85,7 +86,7 @@ import {
|
|
|
85
86
|
writeMarker,
|
|
86
87
|
} from "../cli/update.mjs";
|
|
87
88
|
import { isLocalGatewayOrigin, probeGatewayVersion, probeTimeoutMs } from "../cli/gateway-probe.mjs";
|
|
88
|
-
import { dashboardOriginForOffset } from "../cli/local-stack.mjs";
|
|
89
|
+
import { dashboardOriginForOffset, portHolders, stackPortConflictMessage } from "../cli/local-stack.mjs";
|
|
89
90
|
import { startSidecar } from "../cli/sidecar.mjs";
|
|
90
91
|
import { waitForGateway as awaitGateway } from "../cli/gateway-wait.mjs";
|
|
91
92
|
import { loginCommand } from "../cli/login.mjs";
|
|
@@ -1214,16 +1215,24 @@ function ownSupabaseDatabaseIsRunning(offset = 0) {
|
|
|
1214
1215
|
}
|
|
1215
1216
|
}
|
|
1216
1217
|
|
|
1217
|
-
|
|
1218
|
+
/** Which containers hold `ports`, so a refusal can name the stack to stop. Empty when Docker cannot say. */
|
|
1219
|
+
function dockerPortHolders(ports) {
|
|
1220
|
+
try {
|
|
1221
|
+
const listing = execFileSync("docker", ["ps", "--format", "{{.Names}}\t{{.Ports}}"], { encoding: "utf8", timeout: DOCKER_TIMEOUT_MS });
|
|
1222
|
+
return portHolders(listing, ports);
|
|
1223
|
+
} catch {
|
|
1224
|
+
return [];
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
async function assertLocalStackPortsAvailable(offset = 0, { rerun = cliCommand("setup") } = {}) {
|
|
1218
1229
|
if (ownSupabaseDatabaseIsRunning(offset)) return;
|
|
1219
1230
|
const busy = [];
|
|
1220
1231
|
for (const port of LOCAL_STACK_PORTS.map((port) => port + offset)) {
|
|
1221
1232
|
if (await portIsListening(port)) busy.push(port);
|
|
1222
1233
|
}
|
|
1223
1234
|
if (busy.length) {
|
|
1224
|
-
throw new Error(
|
|
1225
|
-
`Local stack ports ${busy.join(", ")} are in use by another project. Stop that project first (for example, \`supabase stop --project-id <project>\`), then rerun \`passcontrol setup\`.`
|
|
1226
|
-
);
|
|
1235
|
+
throw new Error(stackPortConflictMessage({ busy, holders: dockerPortHolders(busy), rerun }));
|
|
1227
1236
|
}
|
|
1228
1237
|
}
|
|
1229
1238
|
|
|
@@ -1727,6 +1736,18 @@ async function applyAppUpdate(app) {
|
|
|
1727
1736
|
`Port ${dashboard.port} is served by something this CLI did not start (a dashboard run by hand?). Stop it, then rerun \`${cliCommand("update")}\`. Nothing was changed.`
|
|
1728
1737
|
);
|
|
1729
1738
|
}
|
|
1739
|
+
// The stack's own ports, before anything changes. Another stack on them
|
|
1740
|
+
// (a second checkout at the same offset) only showed up when Supabase failed
|
|
1741
|
+
// to start, after the fast-forward and \`npm ci\`, as "npm exited with code 1".
|
|
1742
|
+
// A running dashboard of THIS install means its own stack holds them, which
|
|
1743
|
+
// assertLocalStackPortsAvailable already allows.
|
|
1744
|
+
try {
|
|
1745
|
+
await assertLocalStackPortsAvailable(app.offset, { rerun: cliCommand(app.resume ? "update --app-only" : "update") });
|
|
1746
|
+
} catch (error) {
|
|
1747
|
+
throw new Error(
|
|
1748
|
+
`${error.message} ${app.resume ? "The earlier update is still unfinished; nothing more was changed." : "Nothing was changed."}`
|
|
1749
|
+
);
|
|
1750
|
+
}
|
|
1730
1751
|
const restart = app.resume?.wasRunning ?? Boolean(managed);
|
|
1731
1752
|
const from = app.resume?.from ?? app.head;
|
|
1732
1753
|
writeMarker({ appRoot: app.root, from, to: app.target, wasRunning: restart, startedAt: new Date().toISOString() });
|
|
@@ -2487,22 +2508,11 @@ function printServicePreset(service, opts = {}) {
|
|
|
2487
2508
|
? cliCommand(`sidecar --port ${port}`)
|
|
2488
2509
|
: cliCommand("sidecar");
|
|
2489
2510
|
console.log(`# Start the bridge first: ${sidecarStart}`);
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
console.log("# Octokit: new Octokit({ baseUrl: process.env.GITHUB_API_URL }) — and no auth option.");
|
|
2496
|
-
break;
|
|
2497
|
-
case "telegram":
|
|
2498
|
-
console.log("# Telegram Bot API through PassControl. What this agent may do is set on its page in the");
|
|
2499
|
-
console.log("# dashboard, under Telegram access; the bot token stays in PassControl.");
|
|
2500
|
-
printExports([["TELEGRAM_API_URL", `http://${host}:${port}/api/v1/svc/telegram`]]);
|
|
2501
|
-
console.log('# Call a method by name, with no token in the URL: curl "$TELEGRAM_API_URL/getMe"');
|
|
2502
|
-
break;
|
|
2503
|
-
default:
|
|
2504
|
-
throw new Error(`Usage: passcontrol env <${integrationChoices()}>`);
|
|
2505
|
-
}
|
|
2511
|
+
const entry = Object.hasOwn(SERVICE_ENV, service) ? SERVICE_ENV[service] : null;
|
|
2512
|
+
if (!entry) throw new Error(`Usage: passcontrol env <${integrationChoices()}>`);
|
|
2513
|
+
for (const line of entry.about) console.log(line);
|
|
2514
|
+
printExports([[entry.envVar, `http://${host}:${port}/api/v1/svc/${service}`]]);
|
|
2515
|
+
console.log(entry.usage);
|
|
2506
2516
|
}
|
|
2507
2517
|
|
|
2508
2518
|
function aiderConfig(opts = {}) {
|
|
@@ -3258,6 +3268,9 @@ const IMPORT_REASONS = {
|
|
|
3258
3268
|
policy_malformed: "its policy could not be parsed, and creating it without one would leave it unrestricted.",
|
|
3259
3269
|
policy_shadow_malformed: "its shadow policy could not be parsed.",
|
|
3260
3270
|
unknown_status: "it records a status this version does not recognise.",
|
|
3271
|
+
account_limit_reached:
|
|
3272
|
+
"this account has reached its agent limit. Nothing was created for it. Revoke agents you no longer use, " +
|
|
3273
|
+
"or ask the operator for a higher limit, then import again: agents already created are skipped.",
|
|
3261
3274
|
};
|
|
3262
3275
|
|
|
3263
3276
|
async function exportCommand(opts = {}) {
|
package/cli/config.mjs
CHANGED
|
@@ -28,8 +28,8 @@ export const PACKAGE_VERSION = (() => {
|
|
|
28
28
|
// second numeric copy that can drift from system-health capability reporting.
|
|
29
29
|
export const WORKSPACE_IMPORT_MAX_VERSION = WORKSPACE_EXPORT_PROTOCOL.maximum;
|
|
30
30
|
|
|
31
|
-
export const PROVIDERS = ["openai", "anthropic", "groq", "mistral", "together", "deepseek", "gemini", "xai", "azure"];
|
|
32
|
-
export const OPENAI_SHAPE_PROVIDERS = new Set(["openai", "groq", "mistral", "together", "deepseek", "gemini", "azure"]);
|
|
31
|
+
export const PROVIDERS = ["openai", "anthropic", "groq", "mistral", "together", "deepseek", "gemini", "xai", "azure", "local"];
|
|
32
|
+
export const OPENAI_SHAPE_PROVIDERS = new Set(["openai", "groq", "mistral", "together", "deepseek", "gemini", "azure", "local"]);
|
|
33
33
|
|
|
34
34
|
const DEFAULT_GATEWAY = "http://localhost:3000";
|
|
35
35
|
|
|
@@ -7,7 +7,8 @@ export type IntegrationProvider =
|
|
|
7
7
|
| "deepseek"
|
|
8
8
|
| "gemini"
|
|
9
9
|
| "xai"
|
|
10
|
-
| "azure"
|
|
10
|
+
| "azure"
|
|
11
|
+
| "local";
|
|
11
12
|
|
|
12
13
|
export const DEFAULT_ALLOWED_MODELS: Readonly<Record<IntegrationProvider, string>>;
|
|
13
14
|
export const DEFAULT_CLIENT_MODELS: Readonly<Record<IntegrationProvider, string>>;
|
|
@@ -18,6 +18,10 @@ export const DEFAULT_ALLOWED_MODELS = Object.freeze({
|
|
|
18
18
|
// `*` would widen an allowlist to whatever a resource ever deploys. An operator
|
|
19
19
|
// whose deployments are named otherwise edits the scope.
|
|
20
20
|
azure: "gpt-*",
|
|
21
|
+
// A model on the developer's own server: free to them, and whatever they pulled.
|
|
22
|
+
// The admin API (pull, delete) is outside the endpoint allowlist, so `*` widens
|
|
23
|
+
// which local model an agent may run, never what it may do to the server.
|
|
24
|
+
local: "*",
|
|
21
25
|
});
|
|
22
26
|
|
|
23
27
|
export const DEFAULT_CLIENT_MODELS = Object.freeze({
|
|
@@ -33,6 +37,9 @@ export const DEFAULT_CLIENT_MODELS = Object.freeze({
|
|
|
33
37
|
xai: "grok-4.20-0309-non-reasoning",
|
|
34
38
|
// A deployment name, so only a guess until the operator names theirs.
|
|
35
39
|
azure: "gpt-4.1-mini",
|
|
40
|
+
// Ollama's most-pulled small model. Only a guess: the dashboard offers the
|
|
41
|
+
// models the server actually has.
|
|
42
|
+
local: "llama3.2",
|
|
36
43
|
});
|
|
37
44
|
|
|
38
45
|
export function defaultAllowedModelForProvider(provider) {
|
package/cli/local-stack.mjs
CHANGED
|
@@ -18,3 +18,58 @@ export function dashboardOriginForOffset(offset) {
|
|
|
18
18
|
assertOffset(offset);
|
|
19
19
|
return `http://localhost:${LOCAL_DASHBOARD_PORT + offset}`;
|
|
20
20
|
}
|
|
21
|
+
|
|
22
|
+
// Supabase names each container supabase_<service>_<project>. Services with an
|
|
23
|
+
// underscore come first, so "supabase_edge_runtime_x" is not read as project
|
|
24
|
+
// "runtime_x".
|
|
25
|
+
const SUPABASE_SERVICES = [
|
|
26
|
+
"edge_runtime", "pg_meta", "db", "kong", "inbucket", "mailpit", "analytics",
|
|
27
|
+
"studio", "rest", "auth", "realtime", "storage", "imgproxy", "vector", "pooler",
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
/** The Supabase project a container belongs to, or null when it is not a Supabase service. */
|
|
31
|
+
export function stackProjectFromContainer(name) {
|
|
32
|
+
for (const service of SUPABASE_SERVICES) {
|
|
33
|
+
const prefix = `supabase_${service}_`;
|
|
34
|
+
if (name.startsWith(prefix) && name.length > prefix.length) return name.slice(prefix.length);
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Which running containers publish which of `ports`, from
|
|
41
|
+
* `docker ps --format '{{.Names}}\t{{.Ports}}'`. A port held by something that
|
|
42
|
+
* is not a container (a database installed natively, say) is simply absent.
|
|
43
|
+
*/
|
|
44
|
+
export function portHolders(psOutput, ports) {
|
|
45
|
+
const holders = [];
|
|
46
|
+
for (const line of String(psOutput).split("\n")) {
|
|
47
|
+
const [rawName, published = ""] = line.split("\t");
|
|
48
|
+
const container = rawName?.trim();
|
|
49
|
+
if (!container) continue;
|
|
50
|
+
const held = ports.filter((port) => new RegExp(`:${port}->`, "u").test(published));
|
|
51
|
+
if (held.length) holders.push({ container, project: stackProjectFromContainer(container), ports: held });
|
|
52
|
+
}
|
|
53
|
+
return holders;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** The refusal for busy stack ports: who holds them, and the exact command that frees them. */
|
|
57
|
+
export function stackPortConflictMessage({ busy, holders = [], rerun }) {
|
|
58
|
+
const projects = [...new Set(holders.map((holder) => holder.project).filter(Boolean))];
|
|
59
|
+
const containers = holders.filter((holder) => !holder.project).map((holder) => holder.container);
|
|
60
|
+
const owners = [];
|
|
61
|
+
if (projects.length) {
|
|
62
|
+
owners.push(`another local Supabase stack (project ${projects.map((project) => `"${project}"`).join(", ")})`);
|
|
63
|
+
}
|
|
64
|
+
if (containers.length) owners.push(`container ${containers.join(", ")}`);
|
|
65
|
+
const ports = `Local stack ports ${busy.join(", ")} are in use by ${owners.length ? owners.join(" and ") : "another program or project"}.`;
|
|
66
|
+
// `docker stop` keeps a container and its volume, like `supabase stop`.
|
|
67
|
+
const commands = [
|
|
68
|
+
...projects.map((project) => `\`supabase stop --project-id ${project}\``),
|
|
69
|
+
...containers.map((container) => `\`docker stop ${container}\``),
|
|
70
|
+
];
|
|
71
|
+
const fix = commands.length
|
|
72
|
+
? `Stop ${commands.length > 1 ? "them" : "it"} first (data is kept): ${commands.join(" and ")}`
|
|
73
|
+
: "Stop that project first (for example, `supabase stop --project-id <project>`)";
|
|
74
|
+
return `${ports} ${fix}, then rerun \`${rerun}\`.`;
|
|
75
|
+
}
|
package/cli/presets.mjs
CHANGED
|
@@ -35,7 +35,61 @@ export function isGuiPreset(name) {
|
|
|
35
35
|
* preset prints the governed base URL for that service; what the agent may call
|
|
36
36
|
* there is set per agent in the dashboard.
|
|
37
37
|
*/
|
|
38
|
-
export const SERVICE_PRESETS = ["github", "telegram"];
|
|
38
|
+
export const SERVICE_PRESETS = ["github", "telegram", "brave", "notion", "discord"];
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* What `passcontrol env <service>` prints for each: the variable (the same one
|
|
42
|
+
* the dashboard's Setup names, lib/services/display.ts), two lines on where the
|
|
43
|
+
* agent's access is set, and one usage hint. Pinned to the catalog by
|
|
44
|
+
* tests/cli-service-presets.test.ts.
|
|
45
|
+
*/
|
|
46
|
+
export const SERVICE_ENV = {
|
|
47
|
+
github: {
|
|
48
|
+
label: "GitHub",
|
|
49
|
+
envVar: "GITHUB_API_URL",
|
|
50
|
+
about: [
|
|
51
|
+
"# GitHub REST through PassControl. What this agent may do is set on its page in the",
|
|
52
|
+
"# dashboard, under GitHub access; the workspace's GitHub token stays in PassControl.",
|
|
53
|
+
],
|
|
54
|
+
usage: "# Octokit: new Octokit({ baseUrl: process.env.GITHUB_API_URL }) — and no auth option.",
|
|
55
|
+
},
|
|
56
|
+
telegram: {
|
|
57
|
+
label: "Telegram",
|
|
58
|
+
envVar: "TELEGRAM_API_URL",
|
|
59
|
+
about: [
|
|
60
|
+
"# Telegram Bot API through PassControl. What this agent may do is set on its page in the",
|
|
61
|
+
"# dashboard, under Telegram access; the bot token stays in PassControl.",
|
|
62
|
+
],
|
|
63
|
+
usage: '# Call a method by name, with no token in the URL: curl "$TELEGRAM_API_URL/getMe"',
|
|
64
|
+
},
|
|
65
|
+
brave: {
|
|
66
|
+
label: "Brave Search",
|
|
67
|
+
envVar: "BRAVE_SEARCH_API_URL",
|
|
68
|
+
about: [
|
|
69
|
+
"# Brave Search through PassControl. What this agent may search is set on its page in the",
|
|
70
|
+
"# dashboard, under Brave Search access; the API key stays in PassControl. Brave bills per search.",
|
|
71
|
+
],
|
|
72
|
+
usage: '# Search with no key header: curl "$BRAVE_SEARCH_API_URL/web/search?q=passcontrol"',
|
|
73
|
+
},
|
|
74
|
+
notion: {
|
|
75
|
+
label: "Notion",
|
|
76
|
+
envVar: "NOTION_API_URL",
|
|
77
|
+
about: [
|
|
78
|
+
"# Notion through PassControl. What this agent may do is set on its page in the dashboard,",
|
|
79
|
+
"# under Notion access; the integration token stays in PassControl.",
|
|
80
|
+
],
|
|
81
|
+
usage: "# @notionhq/client: new Client({ baseUrl: process.env.NOTION_API_URL }) — and no auth option.",
|
|
82
|
+
},
|
|
83
|
+
discord: {
|
|
84
|
+
label: "Discord",
|
|
85
|
+
envVar: "DISCORD_API_URL",
|
|
86
|
+
about: [
|
|
87
|
+
"# Discord's bot API through PassControl. What this agent may do is set on its page in the",
|
|
88
|
+
"# dashboard, under Discord access; the bot token stays in PassControl.",
|
|
89
|
+
],
|
|
90
|
+
usage: '# discord.js: new REST({ api: process.env.DISCORD_API_URL, version: "10" }).setToken("sidecar") — any token; the sidecar replaces it.',
|
|
91
|
+
},
|
|
92
|
+
};
|
|
39
93
|
|
|
40
94
|
export function isServicePreset(name) {
|
|
41
95
|
return SERVICE_PRESETS.includes(String(name ?? "").toLowerCase());
|
package/cli/proxy-policy.mjs
CHANGED
|
@@ -60,6 +60,15 @@ export const SERVICE_UPSTREAMS = {
|
|
|
60
60
|
// Telegram's token is in its URL path, so a tunnel to it would carry the bot
|
|
61
61
|
// token past every control: refused for CONNECT, like every host here.
|
|
62
62
|
telegram: { hostname: "api.telegram.org", basePath: "" },
|
|
63
|
+
// Its key goes in a header; a tunnel would send searches billed to the
|
|
64
|
+
// workspace past the agent's rules and cap.
|
|
65
|
+
// basePath: the prefix the gateway adds itself (the catalog's upstreamUrl),
|
|
66
|
+
// stripped here so a routed request does not carry it twice.
|
|
67
|
+
brave: { hostname: "api.search.brave.com", basePath: "/res/v1" },
|
|
68
|
+
notion: { hostname: "api.notion.com", basePath: "" },
|
|
69
|
+
// discord.com is also Discord's website: an agent's browser-like traffic to it
|
|
70
|
+
// is refused through the sidecar, as every governed service host is.
|
|
71
|
+
discord: { hostname: "discord.com", basePath: "/api" },
|
|
63
72
|
};
|
|
64
73
|
|
|
65
74
|
// `route` is the path segment after /api/v1/ that governs the host.
|
package/package.json
CHANGED
package/sdk/README.md
CHANGED
|
@@ -158,7 +158,7 @@ The full reference lives in [the public OpenAPI document](https://github.com/Ver
|
|
|
158
158
|
## Compatibility and assurance
|
|
159
159
|
|
|
160
160
|
`clientOptions` accepts `openai`, `anthropic`, `groq`, `mistral`, `together`, `deepseek`,
|
|
161
|
-
`gemini`, `xai` and `
|
|
161
|
+
`gemini`, `xai`, `azure` and `local` (a model server you run, such as Ollama; self-host only). OpenAI POST Responses works through `pc.fetch`/the OpenAI SDK as well as
|
|
162
162
|
Chat Completions. xAI is served through its Responses API only (`client.responses.create`);
|
|
163
163
|
its legacy Chat Completions endpoint is refused. Gemini uses Google's OpenAI-compatible endpoint; native
|
|
164
164
|
`generateContent` is not supported. Azure OpenAI takes the plain OpenAI client (not
|
package/sdk/passcontrol.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ProviderId = "openai" | "anthropic" | "groq" | "mistral" | "together" | "deepseek" | "gemini" | "xai" | "azure";
|
|
1
|
+
export type ProviderId = "openai" | "anthropic" | "groq" | "mistral" | "together" | "deepseek" | "gemini" | "xai" | "azure" | "local";
|
|
2
2
|
export interface PassControlOptions {
|
|
3
3
|
/**
|
|
4
4
|
* Gateway origin, e.g. https://passcontrol.example.com — scheme, host and
|