@intentic/sandbox-contract 1.244.0 → 1.246.1
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 +17 -1
- package/dist/batch-runs.d.ts +32 -0
- package/dist/batch-runs.d.ts.map +1 -0
- package/dist/batch-runs.js +43 -0
- package/dist/batch-runs.js.map +1 -0
- package/dist/command-classes.d.ts +6 -3
- package/dist/command-classes.d.ts.map +1 -1
- package/dist/command-classes.js +43 -18
- package/dist/command-classes.js.map +1 -1
- package/dist/contracts/{cursor.contract.d.ts → accounts.contract.d.ts} +102 -3
- package/dist/contracts/accounts.contract.d.ts.map +1 -0
- package/dist/contracts/accounts.contract.js +61 -0
- package/dist/contracts/accounts.contract.js.map +1 -0
- package/dist/contracts/agents.contract.d.ts +121 -0
- package/dist/contracts/agents.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.js +4 -4
- package/dist/contracts/agents.contract.js.map +1 -1
- package/dist/contracts/ci.contract.d.ts +2 -0
- package/dist/contracts/ci.contract.d.ts.map +1 -1
- package/dist/contracts/host.contract.d.ts +35 -0
- package/dist/contracts/host.contract.d.ts.map +1 -1
- package/dist/contracts/host.contract.js +3 -2
- package/dist/contracts/host.contract.js.map +1 -1
- package/dist/contracts/personas.contract.d.ts +4 -2
- package/dist/contracts/personas.contract.d.ts.map +1 -1
- package/dist/contracts/runner.contract.d.ts +2 -2
- package/dist/contracts/settings.contract.d.ts +2 -51
- package/dist/contracts/settings.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.d.ts +52 -2
- package/dist/contracts/system.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.js +26 -17
- package/dist/contracts/system.contract.js.map +1 -1
- package/dist/definition.d.ts +4 -8
- package/dist/definition.d.ts.map +1 -1
- package/dist/documents.d.ts +0 -1
- package/dist/documents.d.ts.map +1 -1
- package/dist/documents.js +1 -2
- package/dist/documents.js.map +1 -1
- package/dist/embed.d.ts +23 -0
- package/dist/embed.d.ts.map +1 -0
- package/dist/embed.js +84 -0
- package/dist/embed.js.map +1 -0
- package/dist/events.d.ts +21 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +5 -2
- package/dist/events.js.map +1 -1
- package/dist/history-state.d.ts.map +1 -1
- package/dist/history-state.js +2 -0
- package/dist/history-state.js.map +1 -1
- package/dist/index.d.ts +354 -335
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -13
- package/dist/index.js.map +1 -1
- package/dist/peer-dial.d.ts +33 -0
- package/dist/peer-dial.d.ts.map +1 -0
- package/dist/peer-dial.js +79 -0
- package/dist/peer-dial.js.map +1 -0
- package/dist/peer-mcp-server.d.ts +36 -0
- package/dist/peer-mcp-server.d.ts.map +1 -0
- package/dist/peer-mcp-server.js +71 -0
- package/dist/peer-mcp-server.js.map +1 -0
- package/dist/provider-specs.d.ts +38 -20
- package/dist/provider-specs.d.ts.map +1 -1
- package/dist/provider-specs.js +39 -13
- package/dist/provider-specs.js.map +1 -1
- package/dist/quick-model.d.ts.map +1 -1
- package/dist/quick-model.js +2 -1
- package/dist/quick-model.js.map +1 -1
- package/dist/runtime-state.d.ts +1 -1
- package/dist/runtime-state.js +1 -1
- package/dist/runtime-state.js.map +1 -1
- package/dist/safety-policy.d.ts +12 -3
- package/dist/safety-policy.d.ts.map +1 -1
- package/dist/safety-policy.js +30 -5
- package/dist/safety-policy.js.map +1 -1
- package/dist/schemas/agent.d.ts +6 -6
- package/dist/schemas/agent.d.ts.map +1 -1
- package/dist/schemas/agent.js +6 -2
- package/dist/schemas/agent.js.map +1 -1
- package/dist/schemas/agents.d.ts +42 -0
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/agents.js +25 -4
- package/dist/schemas/agents.js.map +1 -1
- package/dist/schemas/automations.d.ts +11 -2
- package/dist/schemas/automations.d.ts.map +1 -1
- package/dist/schemas/automations.js +1 -1
- package/dist/schemas/automations.js.map +1 -1
- package/dist/schemas/ci.d.ts +6 -0
- package/dist/schemas/ci.d.ts.map +1 -1
- package/dist/schemas/ci.js +3 -2
- package/dist/schemas/ci.js.map +1 -1
- package/dist/schemas/context.d.ts +30 -0
- package/dist/schemas/context.d.ts.map +1 -0
- package/dist/schemas/context.js +34 -0
- package/dist/schemas/context.js.map +1 -0
- package/dist/schemas/{computers.d.ts → devices.d.ts} +155 -61
- package/dist/schemas/devices.d.ts.map +1 -0
- package/dist/schemas/devices.js +157 -0
- package/dist/schemas/devices.js.map +1 -0
- package/dist/schemas/hosts.d.ts +12 -0
- package/dist/schemas/hosts.d.ts.map +1 -1
- package/dist/schemas/hosts.js +1 -0
- package/dist/schemas/hosts.js.map +1 -1
- package/dist/schemas/issues.d.ts +0 -5
- package/dist/schemas/issues.d.ts.map +1 -1
- package/dist/schemas/issues.js +0 -1
- package/dist/schemas/issues.js.map +1 -1
- package/dist/schemas/personas.d.ts +5 -3
- package/dist/schemas/personas.d.ts.map +1 -1
- package/dist/schemas/personas.js +3 -2
- package/dist/schemas/personas.js.map +1 -1
- package/dist/schemas/provider-oauth.d.ts +48 -16
- package/dist/schemas/provider-oauth.d.ts.map +1 -1
- package/dist/schemas/provider-oauth.js +22 -20
- package/dist/schemas/provider-oauth.js.map +1 -1
- package/dist/schemas/settings.d.ts +1 -52
- package/dist/schemas/settings.d.ts.map +1 -1
- package/dist/schemas/settings.js +8 -11
- package/dist/schemas/settings.js.map +1 -1
- package/dist/schemas/terminal.js +9 -9
- package/dist/schemas/terminal.js.map +1 -1
- package/dist/schemas/usage.d.ts +0 -2
- package/dist/schemas/usage.d.ts.map +1 -1
- package/dist/schemas/usage.js +0 -2
- package/dist/schemas/usage.js.map +1 -1
- package/dist/shell-regions.d.ts +4 -0
- package/dist/shell-regions.d.ts.map +1 -0
- package/dist/shell-regions.js +156 -0
- package/dist/shell-regions.js.map +1 -0
- package/dist/workspace-state.d.ts +15 -0
- package/dist/workspace-state.d.ts.map +1 -1
- package/dist/workspace-state.js +21 -5
- package/dist/workspace-state.js.map +1 -1
- package/package.json +48 -4
- package/src/agent-catalog.ts +1 -1
- package/src/arrival.ts +3 -3
- package/src/batch-runs.test.ts +167 -0
- package/src/batch-runs.ts +181 -0
- package/src/command-classes.test.ts +195 -71
- package/src/command-classes.ts +148 -46
- package/src/contracts/accounts.contract.ts +94 -0
- package/src/contracts/agents.contract.ts +4 -3
- package/src/contracts/exit.contract.ts +2 -2
- package/src/contracts/host.contract.ts +17 -5
- package/src/contracts/settings.contract.ts +1 -1
- package/src/contracts/system.contract.ts +43 -24
- package/src/contracts/vpn.contract.ts +2 -2
- package/src/documents.test.ts +2 -1
- package/src/documents.ts +7 -11
- package/src/embed.test.ts +68 -0
- package/src/embed.ts +164 -0
- package/src/events.ts +30 -3
- package/src/history-state.ts +12 -3
- package/src/host-protocol.ts +2 -2
- package/src/index.ts +6 -14
- package/src/model-order.ts +1 -1
- package/src/peer-dial.test.ts +203 -0
- package/src/peer-dial.ts +163 -0
- package/src/peer-mcp-server.test.ts +104 -0
- package/src/peer-mcp-server.ts +144 -0
- package/src/provider-specs.test.ts +44 -17
- package/src/provider-specs.ts +147 -67
- package/src/quick-model.ts +10 -3
- package/src/routes.test.ts +6 -3
- package/src/runner-protocol.ts +1 -1
- package/src/runtime-state.ts +2 -2
- package/src/safety-policy.test.ts +88 -0
- package/src/safety-policy.ts +84 -14
- package/src/schemas/agent.ts +41 -13
- package/src/schemas/agents.ts +65 -4
- package/src/schemas/automations.ts +6 -4
- package/src/schemas/capabilities.ts +4 -4
- package/src/schemas/ci.ts +23 -6
- package/src/schemas/context.ts +87 -0
- package/src/schemas/{computers.ts → devices.ts} +201 -109
- package/src/schemas/hosts.ts +5 -1
- package/src/schemas/issues.ts +0 -4
- package/src/schemas/personas.ts +8 -3
- package/src/schemas/provider-oauth.ts +49 -52
- package/src/schemas/settings.ts +30 -54
- package/src/schemas/terminal.ts +12 -12
- package/src/schemas/usage.ts +3 -27
- package/src/schemas/version-seam.test.ts +0 -1
- package/src/shell-regions.ts +289 -0
- package/src/versions.ts +2 -2
- package/src/webext-links.ts +2 -2
- package/src/webext-protocol.ts +2 -2
- package/src/workspace-state.test.ts +55 -1
- package/src/workspace-state.ts +76 -11
- package/dist/contracts/claude.contract.d.ts +0 -91
- package/dist/contracts/claude.contract.d.ts.map +0 -1
- package/dist/contracts/claude.contract.js +0 -50
- package/dist/contracts/claude.contract.js.map +0 -1
- package/dist/contracts/cursor.contract.d.ts.map +0 -1
- package/dist/contracts/cursor.contract.js +0 -50
- package/dist/contracts/cursor.contract.js.map +0 -1
- package/dist/contracts/grok.contract.d.ts +0 -36
- package/dist/contracts/grok.contract.d.ts.map +0 -1
- package/dist/contracts/grok.contract.js +0 -31
- package/dist/contracts/grok.contract.js.map +0 -1
- package/dist/contracts/keys.contract.d.ts +0 -81
- package/dist/contracts/keys.contract.d.ts.map +0 -1
- package/dist/contracts/keys.contract.js +0 -51
- package/dist/contracts/keys.contract.js.map +0 -1
- package/dist/schemas/computers.d.ts.map +0 -1
- package/dist/schemas/computers.js +0 -134
- package/dist/schemas/computers.js.map +0 -1
- package/src/contracts/claude.contract.ts +0 -71
- package/src/contracts/cursor.contract.ts +0 -74
- package/src/contracts/grok.contract.ts +0 -41
- package/src/contracts/keys.contract.ts +0 -79
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { oc } from "@orpc/contract";
|
|
2
|
-
import {
|
|
3
|
-
AccountIdSchema,
|
|
4
|
-
AccountListQuerySchema,
|
|
5
|
-
AccountRenameSchema,
|
|
6
|
-
AuthorizeChallengeSchema,
|
|
7
|
-
OauthAccountListSchema,
|
|
8
|
-
OauthAccountSchema,
|
|
9
|
-
OauthExchangeSchema,
|
|
10
|
-
} from "../schemas/provider-oauth.js";
|
|
11
|
-
import { OkSchema } from "../schemas/shared.js";
|
|
12
|
-
|
|
13
|
-
// Claude subscription OAuth, the sandbox owns the credential. `start` hands the browser the authorize URL +
|
|
14
|
-
// PKCE material; `exchange` stores the resulting tokens as a new account and returns it; `accounts` lists the
|
|
15
|
-
// connected accounts; `rename` renames one; `disconnect` clears the one named by id. A sandbox can hold several
|
|
16
|
-
// Claude accounts.
|
|
17
|
-
//
|
|
18
|
-
// The model catalog is NOT here: it is the one thing every provider answers identically, so it lives on the
|
|
19
|
-
// shared /providers/{provider}/models route (providers.contract.ts). What is left is what is genuinely Claude's
|
|
20
|
-
//, an account handshake no other provider has.
|
|
21
|
-
export const claudeContract = {
|
|
22
|
-
start: oc
|
|
23
|
-
.route({
|
|
24
|
-
method: "POST",
|
|
25
|
-
path: "/claude/oauth/start",
|
|
26
|
-
summary: "Begin connecting a Claude account",
|
|
27
|
-
description:
|
|
28
|
-
"Hands back the address to send somebody to, and the proof this sandbox will need to finish the exchange. The sandbox holds the credential afterwards, not the browser.",
|
|
29
|
-
})
|
|
30
|
-
.output(AuthorizeChallengeSchema),
|
|
31
|
-
exchange: oc
|
|
32
|
-
.route({
|
|
33
|
-
method: "POST",
|
|
34
|
-
path: "/claude/oauth/exchange",
|
|
35
|
-
summary: "Finish connecting a Claude account",
|
|
36
|
-
description:
|
|
37
|
-
"Trades the code from the sign-in for stored tokens and answers with the account it just connected. A sandbox can hold several Claude accounts side by side.",
|
|
38
|
-
})
|
|
39
|
-
.input(OauthExchangeSchema)
|
|
40
|
-
.output(OauthAccountSchema),
|
|
41
|
-
// Each account carries its plan-limit reading. `force` re-measures before answering, see
|
|
42
|
-
// AccountListQuerySchema, and USAGE_WAIT_MS in claude.routes.ts for what an ordinary read waits.
|
|
43
|
-
accounts: oc
|
|
44
|
-
.route({
|
|
45
|
-
method: "GET",
|
|
46
|
-
path: "/claude/accounts",
|
|
47
|
-
summary: "Connected Claude accounts",
|
|
48
|
-
description:
|
|
49
|
-
"Each connected account with how full its plan limits were when last measured. Ask for a fresh measurement and it takes one before answering, which is slower.",
|
|
50
|
-
})
|
|
51
|
-
.input(AccountListQuerySchema)
|
|
52
|
-
.output(OauthAccountListSchema),
|
|
53
|
-
rename: oc
|
|
54
|
-
.route({
|
|
55
|
-
method: "POST",
|
|
56
|
-
path: "/claude/account/rename",
|
|
57
|
-
summary: "Rename a Claude account",
|
|
58
|
-
description: "Changes the label one account shows under, so several are tellable apart.",
|
|
59
|
-
})
|
|
60
|
-
.input(AccountRenameSchema)
|
|
61
|
-
.output(OauthAccountSchema),
|
|
62
|
-
disconnect: oc
|
|
63
|
-
.route({
|
|
64
|
-
method: "POST",
|
|
65
|
-
path: "/claude/account/disconnect",
|
|
66
|
-
summary: "Disconnect a Claude account",
|
|
67
|
-
description: "Clears the stored tokens for one account. The others stay connected.",
|
|
68
|
-
})
|
|
69
|
-
.input(AccountIdSchema)
|
|
70
|
-
.output(OkSchema),
|
|
71
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { oc } from "@orpc/contract";
|
|
2
|
-
import {
|
|
3
|
-
AccountIdSchema,
|
|
4
|
-
AccountListQuerySchema,
|
|
5
|
-
AccountRenameSchema,
|
|
6
|
-
CursorLoginCancelSchema,
|
|
7
|
-
CursorLoginStartSchema,
|
|
8
|
-
OauthAccountListSchema,
|
|
9
|
-
OauthAccountSchema,
|
|
10
|
-
} from "../schemas/provider-oauth.js";
|
|
11
|
-
import { OkSchema } from "../schemas/shared.js";
|
|
12
|
-
|
|
13
|
-
/* Cursor subscription sign-in, the sandbox owns the credential and the platform never sees it, the same bargain
|
|
14
|
-
* claude.contract.ts strikes. What differs is who finishes the handshake.
|
|
15
|
-
*
|
|
16
|
-
* Claude's flow is start → the browser gets a code → `exchange` hands it back. Cursor's PKCE verifier is
|
|
17
|
-
* redeemable on its own, so it never leaves the daemon: `start` begins the flow, keeps the verifier in memory,
|
|
18
|
-
* polls Cursor until the browser completes the sign-in, mints a 90-day user key and writes it as an account.
|
|
19
|
-
* The caller opens the URL and then watches `accounts`, exactly as it does for a device login, which is why
|
|
20
|
-
* there is no `exchange` route here and a `cancel` one instead.
|
|
21
|
-
*
|
|
22
|
-
* The model catalog is deliberately absent, as it is for every provider: it is the one question they all answer
|
|
23
|
-
* identically, so it lives on the shared /providers/{provider}/models route (providers.contract.ts). */
|
|
24
|
-
export const cursorContract = {
|
|
25
|
-
start: oc
|
|
26
|
-
.route({
|
|
27
|
-
method: "POST",
|
|
28
|
-
path: "/cursor/login/start",
|
|
29
|
-
summary: "Begin connecting a Cursor account",
|
|
30
|
-
description:
|
|
31
|
-
"Hands back the page to sign in on. The sandbox finishes the handshake itself and stores the credential, so nothing has to be pasted back: watch the account list instead.",
|
|
32
|
-
})
|
|
33
|
-
.output(CursorLoginStartSchema),
|
|
34
|
-
cancel: oc
|
|
35
|
-
.route({
|
|
36
|
-
method: "POST",
|
|
37
|
-
path: "/cursor/login/cancel",
|
|
38
|
-
summary: "Abandon a Cursor sign-in",
|
|
39
|
-
description: "Stops waiting on a sign-in nobody completed. An abandoned attempt also expires on its own.",
|
|
40
|
-
})
|
|
41
|
-
.input(CursorLoginCancelSchema)
|
|
42
|
-
.output(OkSchema),
|
|
43
|
-
// Shaped like Claude's, including `force`, so the two account lists render through one component. Cursor
|
|
44
|
-
// publishes no account-wide headroom today, so `usage` stays absent on these rows and they draw a dot rather
|
|
45
|
-
// than a ring, which is what an unmeasured account has always meant here.
|
|
46
|
-
accounts: oc
|
|
47
|
-
.route({
|
|
48
|
-
method: "GET",
|
|
49
|
-
path: "/cursor/accounts",
|
|
50
|
-
summary: "Connected Cursor accounts",
|
|
51
|
-
description:
|
|
52
|
-
"Each connected account, and whether its stored key is still good. Cursor publishes no plan-wide allowance, so these rows carry no usage reading.",
|
|
53
|
-
})
|
|
54
|
-
.input(AccountListQuerySchema)
|
|
55
|
-
.output(OauthAccountListSchema),
|
|
56
|
-
rename: oc
|
|
57
|
-
.route({
|
|
58
|
-
method: "POST",
|
|
59
|
-
path: "/cursor/account/rename",
|
|
60
|
-
summary: "Rename a Cursor account",
|
|
61
|
-
description: "Changes the label one account shows under, so several are tellable apart.",
|
|
62
|
-
})
|
|
63
|
-
.input(AccountRenameSchema)
|
|
64
|
-
.output(OauthAccountSchema),
|
|
65
|
-
disconnect: oc
|
|
66
|
-
.route({
|
|
67
|
-
method: "POST",
|
|
68
|
-
path: "/cursor/account/disconnect",
|
|
69
|
-
summary: "Disconnect a Cursor account",
|
|
70
|
-
description: "Clears the stored key for one account. The others stay connected.",
|
|
71
|
-
})
|
|
72
|
-
.input(AccountIdSchema)
|
|
73
|
-
.output(OkSchema),
|
|
74
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { oc } from "@orpc/contract";
|
|
2
|
-
import { AccountIdSchema, DeviceStartSchema, OauthAccountListSchema } from "../schemas/provider-oauth.js";
|
|
3
|
-
import { OkSchema } from "../schemas/shared.js";
|
|
4
|
-
|
|
5
|
-
// xAI Grok (via OpenCode) uses subscription OAuth, the sandbox owns the credential (OpenCode persists the
|
|
6
|
-
// tokens and refreshes them). `start` authorizes xAI's headless device-code method and returns the verification
|
|
7
|
-
// URL + instructions (which carry the one-time code the user enters at x.ai); OpenCode then polls to completion
|
|
8
|
-
//, there is no paste-back, and the UI polls `accounts` until connected. `disconnect` clears the tokens.
|
|
9
|
-
// ponytail: OpenCode holds one xAI auth per data dir, so `accounts` is 0 or 1, the list shape matches the
|
|
10
|
-
// other providers without paying for per-account OpenCode servers yet.
|
|
11
|
-
//
|
|
12
|
-
// Like Claude's, this contract is now the account handshake alone, the model catalog answers on the shared
|
|
13
|
-
// /providers/{provider}/models route (providers.contract.ts).
|
|
14
|
-
export const grokContract = {
|
|
15
|
-
start: oc
|
|
16
|
-
.route({
|
|
17
|
-
method: "POST",
|
|
18
|
-
path: "/grok/oauth/start",
|
|
19
|
-
summary: "Begin connecting a Grok account",
|
|
20
|
-
description:
|
|
21
|
-
"Hands back the page to open and the one-time code to type there. Nothing is pasted back afterwards: the sandbox waits for the sign-in to complete on its own, so poll the accounts call until it appears.",
|
|
22
|
-
})
|
|
23
|
-
.output(DeviceStartSchema),
|
|
24
|
-
accounts: oc
|
|
25
|
-
.route({
|
|
26
|
-
method: "GET",
|
|
27
|
-
path: "/grok/accounts",
|
|
28
|
-
summary: "Connected Grok account",
|
|
29
|
-
description: "What is signed in. A list for consistency with the other providers, though there is at most one.",
|
|
30
|
-
})
|
|
31
|
-
.output(OauthAccountListSchema),
|
|
32
|
-
disconnect: oc
|
|
33
|
-
.route({
|
|
34
|
-
method: "POST",
|
|
35
|
-
path: "/grok/account/disconnect",
|
|
36
|
-
summary: "Disconnect the Grok account",
|
|
37
|
-
description: "Clears the stored tokens.",
|
|
38
|
-
})
|
|
39
|
-
.input(AccountIdSchema)
|
|
40
|
-
.output(OkSchema),
|
|
41
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { oc } from "@orpc/contract";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { KeyProviderParamSchema } from "../schemas/agent.js";
|
|
4
|
-
import { AccountIdSchema, AccountRenameSchema, OauthAccountListSchema, OauthAccountSchema } from "../schemas/provider-oauth.js";
|
|
5
|
-
import { OkSchema } from "../schemas/shared.js";
|
|
6
|
-
|
|
7
|
-
/* THE PROVIDERS YOU CONNECT BY PASTING A KEY (Sandbox ▸ Agent), on four routes with the provider as a PARAMETER
|
|
8
|
-
* rather than four routes each.
|
|
9
|
-
*
|
|
10
|
-
* The lesson providers.contract.ts already learned about model catalogs: five identical route files differing
|
|
11
|
-
* only in a name is a shape that costs a vertical slice through the contract, the router, the service container
|
|
12
|
-
* and every test double every time a provider is added. Here the providers genuinely are identical — a keyed
|
|
13
|
-
* provider is a base URL, a catalog URL and a store — so the id is a parameter and adding one is a spec row.
|
|
14
|
-
*
|
|
15
|
-
* WHY NOT THE OAUTH ROUTES. Claude and Cursor connect through a handshake this daemon runs: a `start` that
|
|
16
|
-
* returns something to open and an `exchange`/poll that completes it. There is no handshake here at all — the
|
|
17
|
-
* user already has the credential and hands it over — so `connect` takes the key and answers with the account
|
|
18
|
-
* it became. Sharing a route family with the OAuth providers would have meant a `start` that returns nothing
|
|
19
|
-
* and an `exchange` whose "code" is really a secret, which is a worse lie than two families.
|
|
20
|
-
*
|
|
21
|
-
* WHY NOT THE TRANSLATOR ROUTES. Those address subscriptions CLIProxyAPI holds; these credentials live in this
|
|
22
|
-
* daemon's own auth tree, and a disconnect here removes a file rather than asking a proxy to forget one.
|
|
23
|
-
*
|
|
24
|
-
* THE PATHS MIRROR THE OAUTH PROVIDERS' (`<base>/accounts`, `<base>/account/rename`,
|
|
25
|
-
* `<base>/account/disconnect`) with `/keys/<provider>` as the base, so the browser's account helpers reach
|
|
26
|
-
* these rows with the same three URLs they already build for Claude, Grok and Cursor. Only `connect`
|
|
27
|
-
* differs, because only `connect` is a different act.
|
|
28
|
-
*
|
|
29
|
-
* THE KEY TRAVELS IN, NEVER OUT. `connect` takes it and every answer on this contract is an OauthAccount, whose
|
|
30
|
-
* shape has no field a credential could ride in — which is what makes "does this leak the key" a question you
|
|
31
|
-
* answer by reading the schema instead of the handler. */
|
|
32
|
-
export const keysContract = {
|
|
33
|
-
accounts: oc
|
|
34
|
-
.route({
|
|
35
|
-
method: "GET",
|
|
36
|
-
path: "/keys/{provider}/accounts",
|
|
37
|
-
summary: "Connected accounts for a key-based provider",
|
|
38
|
-
description: "Which keys are connected for this provider. The keys themselves never travel: being in this list is what connected means.",
|
|
39
|
-
})
|
|
40
|
-
.input(KeyProviderParamSchema)
|
|
41
|
-
.output(OauthAccountListSchema),
|
|
42
|
-
connect: oc
|
|
43
|
-
.route({
|
|
44
|
-
method: "POST",
|
|
45
|
-
path: "/keys/{provider}/connect",
|
|
46
|
-
summary: "Connect an API key",
|
|
47
|
-
description:
|
|
48
|
-
"Stores an API key for this provider and answers with the account it became. A sandbox can hold several keys for one provider side by side.",
|
|
49
|
-
})
|
|
50
|
-
.input(
|
|
51
|
-
KeyProviderParamSchema.extend({
|
|
52
|
-
apiKey: z.string().min(1).describe("The key, as the provider issued it. Stored in this sandbox and never sent back out."),
|
|
53
|
-
label: z
|
|
54
|
-
.string()
|
|
55
|
-
.max(80)
|
|
56
|
-
.optional()
|
|
57
|
-
.describe("What to call it. Blank falls back to the provider's own name, which is all a pasted key can say about itself."),
|
|
58
|
-
}),
|
|
59
|
-
)
|
|
60
|
-
.output(OauthAccountSchema),
|
|
61
|
-
rename: oc
|
|
62
|
-
.route({
|
|
63
|
-
method: "POST",
|
|
64
|
-
path: "/keys/{provider}/account/rename",
|
|
65
|
-
summary: "Rename one connected key",
|
|
66
|
-
description: "Nothing in a pasted key says whose it is, so naming it is the only way to tell two of them apart.",
|
|
67
|
-
})
|
|
68
|
-
.input(KeyProviderParamSchema.extend(AccountRenameSchema.shape))
|
|
69
|
-
.output(OkSchema),
|
|
70
|
-
disconnect: oc
|
|
71
|
-
.route({
|
|
72
|
-
method: "POST",
|
|
73
|
-
path: "/keys/{provider}/account/disconnect",
|
|
74
|
-
summary: "Disconnect one key",
|
|
75
|
-
description: "Removes a single stored key. Any others under the same provider stay connected.",
|
|
76
|
-
})
|
|
77
|
-
.input(KeyProviderParamSchema.extend(AccountIdSchema.shape))
|
|
78
|
-
.output(OkSchema),
|
|
79
|
-
};
|