@phantomcodes/cli 1.6.3 → 1.7.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/LICENSE +1 -2
- package/README.md +139 -118
- package/bin/phantom.mjs +37 -2
- package/dist/agents/command.d.mts +8 -27
- package/dist/agents/command.mjs +323 -59
- package/dist/agents/login.d.mts +3 -0
- package/dist/agents/login.mjs +97 -0
- package/dist/agents/opencode-check.d.mts +15 -0
- package/dist/agents/opencode-check.mjs +193 -0
- package/dist/agents/phantom-key.d.mts +7 -0
- package/dist/agents/phantom-key.mjs +40 -0
- package/dist/agents/proxy.d.mts +26 -28
- package/dist/agents/proxy.mjs +225 -33
- package/dist/chatgpt/command.d.mts +2 -0
- package/dist/chatgpt/command.mjs +119 -0
- package/dist/chatgpt/session.d.mts +87 -0
- package/dist/chatgpt/session.mjs +253 -0
- package/dist/cli/accounts.d.mts +21 -0
- package/dist/cli/accounts.mjs +96 -0
- package/dist/cli/app.d.mts +4 -24
- package/dist/cli/app.mjs +224 -139
- package/dist/cli/commands.d.mts +1 -16
- package/dist/cli/commands.mjs +144 -239
- package/dist/cli/help.d.mts +0 -19
- package/dist/cli/help.mjs +30 -55
- package/dist/cli/run.mjs +35 -79
- package/dist/cli/start.d.mts +2 -31
- package/dist/cli/start.mjs +13 -116
- package/dist/core/brand.d.mts +0 -7
- package/dist/core/brand.mjs +0 -8
- package/dist/core/errors.d.mts +0 -16
- package/dist/core/errors.mjs +0 -16
- package/dist/core/helpers.d.mts +0 -46
- package/dist/core/helpers.mjs +1 -64
- package/dist/core/node-trust.d.mts +0 -5
- package/dist/core/node-trust.mjs +0 -6
- package/dist/core/pick.d.mts +7 -55
- package/dist/core/pick.mjs +49 -106
- package/dist/core/request.d.mts +0 -46
- package/dist/core/request.mjs +1 -60
- package/dist/core/secrets.d.mts +0 -4
- package/dist/core/secrets.mjs +0 -10
- package/dist/core/state.d.mts +3 -1
- package/dist/core/state.mjs +147 -4
- package/dist/core/style.d.mts +0 -27
- package/dist/core/style.mjs +0 -20
- package/dist/core/version.d.mts +1 -2
- package/dist/core/version.mjs +1 -2
- package/dist/local/accounts.d.mts +25 -0
- package/dist/local/accounts.mjs +40 -0
- package/dist/local/agent-headers.d.mts +7 -0
- package/dist/local/agent-headers.mjs +44 -0
- package/dist/local/chatgpt-plan.d.mts +147 -0
- package/dist/local/chatgpt-plan.mjs +384 -0
- package/dist/local/command.d.mts +24 -0
- package/dist/local/command.mjs +211 -0
- package/dist/local/config.d.mts +49 -0
- package/dist/local/config.mjs +168 -0
- package/dist/local/decide.d.mts +37 -0
- package/dist/local/decide.mjs +201 -0
- package/dist/local/failure-signs.d.mts +4 -0
- package/dist/local/failure-signs.mjs +99 -0
- package/dist/local/keys.d.mts +32 -0
- package/dist/local/keys.mjs +239 -0
- package/dist/local/models.d.mts +53 -0
- package/dist/local/models.mjs +117 -0
- package/dist/local/replay.d.mts +59 -0
- package/dist/local/replay.mjs +143 -0
- package/dist/local/report.d.mts +43 -0
- package/dist/local/report.mjs +153 -0
- package/dist/local/request-log.d.mts +53 -0
- package/dist/local/request-log.mjs +69 -0
- package/dist/local/retry-after.d.mts +3 -0
- package/dist/local/retry-after.mjs +28 -0
- package/dist/local/rust-router.d.mts +39 -0
- package/dist/local/rust-router.mjs +54 -0
- package/dist/local/server.d.mts +27 -0
- package/dist/local/server.mjs +449 -0
- package/dist/local/status-line.d.mts +17 -0
- package/dist/local/status-line.mjs +81 -0
- package/dist/local/tiers.d.mts +3 -0
- package/dist/local/tiers.mjs +137 -0
- package/dist/local/traces.d.mts +69 -0
- package/dist/local/traces.mjs +341 -0
- package/dist/phantom.d.mts +0 -37
- package/dist/phantom.mjs +0 -31
- package/package.json +15 -9
- package/skills/phantom-ai/SKILL.md +28 -97
- package/dist/cli/screens.d.mts +0 -177
- package/dist/cli/screens.mjs +0 -398
- package/dist/core/free.d.mts +0 -13
- package/dist/core/free.mjs +0 -14
- package/dist/core/motion.d.mts +0 -47
- package/dist/core/motion.mjs +0 -156
- package/dist/core/shapes.d.mts +0 -13
- package/dist/core/shapes.mjs +0 -1
- package/dist/keys/command.d.mts +0 -16
- package/dist/keys/command.mjs +0 -143
- package/dist/keys/saved.d.mts +0 -96
- package/dist/keys/saved.mjs +0 -169
- package/dist/models/choice.d.mts +0 -7
- package/dist/models/choice.mjs +0 -27
- package/dist/models/command.d.mts +0 -8
- package/dist/models/command.mjs +0 -66
- package/dist/models/list.d.mts +0 -39
- package/dist/models/list.mjs +0 -39
- package/dist/receipts/command.d.mts +0 -7
- package/dist/receipts/command.mjs +0 -41
- package/dist/receipts/receipts.d.mts +0 -76
- package/dist/receipts/receipts.mjs +0 -118
- package/dist/setup/agents.d.mts +0 -149
- package/dist/setup/agents.mjs +0 -886
- package/dist/setup/apply.d.mts +0 -85
- package/dist/setup/apply.mjs +0 -301
- package/dist/setup/command.d.mts +0 -12
- package/dist/setup/command.mjs +0 -307
- package/dist/setup/editors.d.mts +0 -108
- package/dist/setup/editors.mjs +0 -500
- package/dist/setup/legacy.d.mts +0 -13
- package/dist/setup/legacy.mjs +0 -36
- package/dist/setup/plan.d.mts +0 -104
- package/dist/setup/plan.mjs +0 -132
- package/dist/setup/screen.d.mts +0 -30
- package/dist/setup/screen.mjs +0 -260
- package/dist/setup/shared.d.mts +0 -141
- package/dist/setup/shared.mjs +0 -88
- package/dist/setup/was.d.mts +0 -42
- package/dist/setup/was.mjs +0 -91
- package/dist/spend/command.d.mts +0 -5
- package/dist/spend/command.mjs +0 -235
- package/dist/spend/lineup.d.mts +0 -61
- package/dist/spend/lineup.mjs +0 -39
- package/dist/spend/reason.d.mts +0 -5
- package/dist/spend/reason.mjs +0 -60
- package/dist/spend/report.d.mts +0 -105
- package/dist/spend/report.mjs +0 -68
- package/dist/spend/routing.d.mts +0 -74
- package/dist/spend/routing.mjs +0 -57
- package/dist/workspace/command.d.mts +0 -59
- package/dist/workspace/command.mjs +0 -871
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phantomcodes/cli",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.7.1",
|
|
4
|
+
"description": "Starts your coding agents (pi, Codex, Claude Code) and routes their requests to your own accounts with phantom-1: the Vercel AI Gateway, Z.ai and your ChatGPT plan.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"phantom",
|
|
7
7
|
"api-key",
|
|
@@ -17,9 +17,8 @@
|
|
|
17
17
|
"cursor",
|
|
18
18
|
"opencode",
|
|
19
19
|
"ai-agents",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"wallet"
|
|
20
|
+
"router",
|
|
21
|
+
"chatgpt"
|
|
23
22
|
],
|
|
24
23
|
"homepage": "https://phantom.codes/",
|
|
25
24
|
"repository": {
|
|
@@ -42,8 +41,7 @@
|
|
|
42
41
|
"node": ">=24"
|
|
43
42
|
},
|
|
44
43
|
"dependencies": {
|
|
45
|
-
"jsonc-parser": "^3.3.1"
|
|
46
|
-
"smol-toml": "^1.9.0"
|
|
44
|
+
"jsonc-parser": "^3.3.1"
|
|
47
45
|
},
|
|
48
46
|
"scripts": {
|
|
49
47
|
"build": "tsc -p .",
|
|
@@ -51,8 +49,10 @@
|
|
|
51
49
|
"dev": "node src/phantom.mts",
|
|
52
50
|
"prepare": "npm run build",
|
|
53
51
|
"test": "vitest run",
|
|
54
|
-
"typecheck": "tsc -p . --noEmit",
|
|
55
|
-
"version": "node scripts/sync-version.mjs && git add src/core/version.mts"
|
|
52
|
+
"typecheck": "tsc -p . --noEmit && tsc -p tsconfig.binary.json",
|
|
53
|
+
"version": "node scripts/sync-version.mjs && git add src/core/version.mts",
|
|
54
|
+
"build:binary": "node scripts/build-binary.mjs",
|
|
55
|
+
"smoke:binary": "node scripts/smoke-binary.mjs"
|
|
56
56
|
},
|
|
57
57
|
"pi": {
|
|
58
58
|
"skills": [
|
|
@@ -78,5 +78,11 @@
|
|
|
78
78
|
"types": "./dist/phantom.d.mts",
|
|
79
79
|
"import": "./dist/phantom.mjs"
|
|
80
80
|
}
|
|
81
|
+
},
|
|
82
|
+
"optionalDependencies": {
|
|
83
|
+
"@phantomcodes/cli-darwin-arm64": "1.7.1",
|
|
84
|
+
"@phantomcodes/cli-darwin-x64": "1.7.1",
|
|
85
|
+
"@phantomcodes/cli-linux-x64": "1.7.1",
|
|
86
|
+
"@phantomcodes/cli-linux-arm64": "1.7.1"
|
|
81
87
|
}
|
|
82
88
|
}
|
|
@@ -1,131 +1,62 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: phantom-ai
|
|
3
|
-
description: Run the phantom CLI to
|
|
3
|
+
description: Run the phantom CLI to start a coding agent (pi, Codex, Claude Code) routed by phantom-1, or to set which account and model each tier uses, save or point at an account's key, sign in to the ChatGPT plan, and see what routing did. Use when the user asks for Phantom, phantom-1, routing their agent's requests to their own accounts, or a tier's model.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Phantom
|
|
6
|
+
# Phantom
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
The Phantom CLI (`phantom`) starts coding agents and routes their requests to accounts the user already pays for: the Vercel AI Gateway, Z.ai's GLM Coding Plan or their ChatGPT plan. phantom-1 picks a tier for each request, Standard for most and Frontier for the hard ones, and sends it to the account and model the user set for that tier. When you run phantom, its output goes through a pipe, so commands print JSON; add `--table` for the screen a person sees. phantom refuses flags it doesn't know, so check `phantom <command> --help` for the names.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## See what is set up
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
phantom
|
|
14
|
-
phantom
|
|
15
|
-
phantom codex
|
|
16
|
-
phantom claude --key coding
|
|
17
|
-
phantom pi
|
|
13
|
+
phantom config show
|
|
14
|
+
phantom config models gateway
|
|
18
15
|
```
|
|
19
16
|
|
|
20
|
-
`
|
|
17
|
+
`config show` prints each tier's account and model (and fallback), each key account with where its key comes from and whether it is found, and the ChatGPT sign-in. It never prints a key. `config models [<account>]` lists the models an account offers.
|
|
21
18
|
|
|
22
|
-
|
|
19
|
+
## Change the tiers
|
|
23
20
|
|
|
24
21
|
```bash
|
|
25
|
-
phantom
|
|
22
|
+
phantom config --standard zai:glm-5.4 --standard-fallback gateway:deepseek/deepseek-v4.1-flash-1017
|
|
23
|
+
phantom config --frontier chatgpt:gpt-6.1-sol --frontier-fallback none
|
|
26
24
|
```
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
A tier flag names the account, then the model. A fallback takes `none` to remove it. A model the account's list doesn't have is refused, and local.json stays as it was. Each request goes to the tier phantom-1 picks.
|
|
29
27
|
|
|
30
|
-
##
|
|
31
|
-
|
|
32
|
-
Saved setup changes the agent's own settings, so the user can start it as usual and it calls Phantom AI. Ask whether they want that or a one-run connection, unless their request already says which.
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
phantom setup --dry-run --table
|
|
36
|
-
phantom setup
|
|
37
|
-
phantom setup --restore
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Show the user the dry-run changes and apply only the setup they approve. Plain `phantom setup` finds the agents on the computer and asks before it writes. Afterward the user restarts the agent or opens a new terminal. Setup keeps a copy of each file it changes, and `phantom setup --restore` puts them back.
|
|
41
|
-
|
|
42
|
-
To set up only Codex, preview that first:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
phantom setup --agent codex --provider --dry-run --table
|
|
46
|
-
phantom setup --agent codex --provider
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
`--agent <name> --provider` writes without asking, so run it only after the user approves the preview. For Cursor, setup prints steps the user follows in Cursor's settings; pi gets the skill only. Most agents read the key through `phantom key show` or the `PHANTOM_API_KEY` line setup adds to the shell startup file. Cline is the exception: setup writes the key into Cline's own settings file, which only the user can read.
|
|
50
|
-
|
|
51
|
-
If the user asked for a budget, check that the key their agent uses has that cap. Making a second key with a cap doesn't change the key the agent already uses.
|
|
52
|
-
|
|
53
|
-
## Add credit
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
phantom fund --amount 10 --card
|
|
57
|
-
phantom fund --amount 10 --coin usdc
|
|
58
|
-
phantom workspace payment --id <payment-id>
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
`--card` opens Stripe Checkout in the browser. `--coin usdc` pays in USDC on Solana and `--coin usdc-base` in USDC on Base; both return a payment link and a payment id, and the link is good for 30 minutes. Use one of `--card` and `--coin`, never both. Card payments take $5 to $10,000, USDC on Solana $0.10 to $10,000 and USDC on Base $1 to $10,000. The credit appears once Stripe confirms the payment. `phantom workspace payment --id <payment-id>` says whether it has arrived, and `phantom balance` shows the key's credit.
|
|
62
|
-
|
|
63
|
-
## Cap what keys spend
|
|
28
|
+
## Keys
|
|
64
29
|
|
|
65
30
|
```bash
|
|
66
|
-
phantom
|
|
67
|
-
phantom
|
|
68
|
-
phantom keys set --id coding --budget 20 --period 30 --rate 1
|
|
69
|
-
phantom keys revoke --id coding
|
|
70
|
-
phantom keys saved
|
|
71
|
-
phantom keys rm <name>
|
|
72
|
-
phantom balance
|
|
31
|
+
phantom config key use-keychain zai --service <service> --keychain-account <account>
|
|
32
|
+
phantom config key rm zai
|
|
73
33
|
```
|
|
74
34
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
## Set rules for `auto`
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
phantom route
|
|
81
|
-
phantom route set --models <model-a>,<model-b>
|
|
82
|
-
phantom route rule add --if has_tools=true --use first
|
|
83
|
-
phantom route test --table
|
|
84
|
-
```
|
|
35
|
+
Never ask the user to paste a key into chat, and never put one on a command line. To save a key in phantom, have the user run `phantom config key set <account>` in their own terminal: it asks with hidden typing. A script can pipe a key in with `--stdin`, from a place the user named. `use-keychain` points an account at a macOS Keychain item the user already has, without copying it.
|
|
85
36
|
|
|
86
|
-
|
|
37
|
+
To use the ChatGPT plan, the user signs in in their browser: have them run `phantom config chatgpt login` themselves.
|
|
87
38
|
|
|
88
|
-
##
|
|
39
|
+
## Start an agent
|
|
89
40
|
|
|
90
41
|
```bash
|
|
91
|
-
phantom
|
|
92
|
-
phantom
|
|
42
|
+
phantom pi -- -p "list the files in this folder"
|
|
43
|
+
phantom codex -- exec "review this repository"
|
|
44
|
+
phantom claude
|
|
93
45
|
```
|
|
94
46
|
|
|
95
|
-
|
|
47
|
+
phantom's own flags go before the agent's arguments, with `--` between them. `phantom pi` routes on this computer through phantom-1 when local.json exists. `phantom codex` and `phantom claude` go through Phantom's server for now, on the key in `PHANTOM_API_KEY`. With neither, phantom stops and says to run `phantom config`.
|
|
96
48
|
|
|
97
|
-
##
|
|
49
|
+
## See what routing did
|
|
98
50
|
|
|
99
51
|
```bash
|
|
100
|
-
phantom
|
|
101
|
-
phantom lineup set --frontier <model> --standard-fallback <model>
|
|
102
|
-
phantom lineup reset
|
|
52
|
+
phantom report --since 1d --table
|
|
103
53
|
```
|
|
104
54
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
## See what was spent
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
phantom spend --table
|
|
111
|
-
phantom spend --workspace --from 2026-09-01 --to 2026-09-30
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
`phantom spend` shows what the key spent by model and day, and an estimate of what `phantom-1` saved compared with running every call on its frontier model. `--workspace` shows every key in the workspace by name. Dates are UTC days (`YYYY-MM-DD`), and the default is this month.
|
|
115
|
-
|
|
116
|
-
## Recovery, receipts and deleting a workspace
|
|
117
|
-
|
|
118
|
-
`phantom --help --all` lists every command, including `phantom verify` for receipts, and the environment variables.
|
|
119
|
-
|
|
120
|
-
A guest workspace has no account; whoever holds its recovery file controls it. Save that file with `phantom workspace export --file <path>`, only to a private place. `phantom workspace revoke-access --id <id>` stops a browser, device or recovery file from managing the workspace; `--id` takes the first 4 or more characters of the id that `phantom workspace` lists. In a pipe, `keys revoke`, `workspace export`, `workspace import` and `workspace revoke-access` print JSON.
|
|
121
|
-
|
|
122
|
-
`phantom workspace delete` deletes an empty workspace, with its keys and saved sign-ins. It asks first (`--yes` skips the question). The server refuses while the workspace holds credit, has a request running or has a payment in progress.
|
|
55
|
+
It sums up the saved requests: by tier, by account and model with tokens and times, the reasons, fallbacks and failures. The log holds no message text and no key. phantom stores message text only when the user turns traces on (`phantom config --traces on`): then every full prompt and answer is saved on their computer in `local/traces/` beside `local.json`. Turn traces on only when the user asks; `phantom config --traces off` stops them from the next `phantom pi` (one already running keeps saving until it ends).
|
|
123
56
|
|
|
124
57
|
## Rules for running phantom
|
|
125
58
|
|
|
126
|
-
- Never print, log or repeat
|
|
127
|
-
- Change phantom's
|
|
128
|
-
- Ask before
|
|
129
|
-
-
|
|
130
|
-
- If the user wants to keep using their agent's own subscription, do that. Send their agent's calls to Phantom only when they ask for it.
|
|
131
|
-
- Exit code 2 means the server rejected the key. Report it; don't retry with the same key.
|
|
59
|
+
- Never print, log or repeat a key. No phantom command prints one; keep it that way.
|
|
60
|
+
- Change phantom's settings with `phantom config`. Don't edit its files by hand unless the user asks.
|
|
61
|
+
- Ask before changing a tier the user didn't ask to change.
|
|
62
|
+
- If the user wants to keep using their agent's own subscription, do that. Route through phantom only when they ask for it.
|
package/dist/cli/screens.d.mts
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import type { Env } from '../core/state.mts';
|
|
2
|
-
import { type Paint } from '../core/style.mts';
|
|
3
|
-
import type { BalanceResult } from '../core/shapes.mts';
|
|
4
|
-
import type { SpendResult } from '../spend/report.mts';
|
|
5
|
-
import { type ModelsView } from '../models/list.mts';
|
|
6
|
-
/** How a screen is drawn: its environment (for colors), whether to color it, and the window's width. */
|
|
7
|
-
export type ScreenStyle = {
|
|
8
|
-
env?: Env;
|
|
9
|
-
color?: boolean;
|
|
10
|
-
columns?: number;
|
|
11
|
-
};
|
|
12
|
-
/** Dollars as people read them: two decimals, or four under a cent so small spend doesn't read as $0.00. */
|
|
13
|
-
export declare function usd(n: number): string;
|
|
14
|
-
/** True while the app runs, so a screen can point at a menu item instead of a command. */
|
|
15
|
-
export declare const inApp: () => boolean;
|
|
16
|
-
/** Hides or shows every screen's "→ type this next" line, and returns what it was, to put back after. The app hides them while it runs. */
|
|
17
|
-
export declare function hideHints(hidden: boolean): boolean;
|
|
18
|
-
/** A thin bar `width` cells long at `share` of full (0 to 1), in `fill`, on a dimmed track: the site's cost bars. */
|
|
19
|
-
export declare function bar(p: Paint, share: number, width: number, fill: (s: string) => string): string;
|
|
20
|
-
/** `phantom balance`: the credit in bold, then what it spent and when the key stops working. */
|
|
21
|
-
export declare function balanceScreen(b: BalanceResult, style?: ScreenStyle): string;
|
|
22
|
-
/**
|
|
23
|
-
* `phantom spend`: the total, what phantom-1 saved, the site's two bars (what
|
|
24
|
-
* the calls cost against what the same calls cost on the frontier model), then
|
|
25
|
-
* each model and each key with a bar for its share.
|
|
26
|
-
*/
|
|
27
|
-
export declare function spendScreen(s: SpendResult, style?: ScreenStyle): string;
|
|
28
|
-
/** A key in the workspace view, as the API returns it. */
|
|
29
|
-
type WorkspaceKey = {
|
|
30
|
-
id?: string;
|
|
31
|
-
name?: string;
|
|
32
|
-
prefix?: string;
|
|
33
|
-
is_active?: boolean;
|
|
34
|
-
spent_usd?: number;
|
|
35
|
-
limit_usd?: number | null;
|
|
36
|
-
budget_usd?: number | null;
|
|
37
|
-
period_days?: number | null;
|
|
38
|
-
};
|
|
39
|
-
/** The workspace view from `GET /workspaces/{id}`, the parts these screens read. */
|
|
40
|
-
export type WorkspaceView = {
|
|
41
|
-
name?: string;
|
|
42
|
-
balance_usd: number;
|
|
43
|
-
held_usd?: number;
|
|
44
|
-
account_linked?: boolean;
|
|
45
|
-
keys: WorkspaceKey[];
|
|
46
|
-
/** The sign-ins that can manage the workspace: a browser, a device, a recovery file. */
|
|
47
|
-
access?: Array<{
|
|
48
|
-
id: string;
|
|
49
|
-
kind?: string;
|
|
50
|
-
created_at?: string;
|
|
51
|
-
expires_at?: string | null;
|
|
52
|
-
}>;
|
|
53
|
-
charges?: Array<{
|
|
54
|
-
model?: string;
|
|
55
|
-
cost_usd?: number;
|
|
56
|
-
why?: string | null;
|
|
57
|
-
}>;
|
|
58
|
-
};
|
|
59
|
-
/** `phantom workspace`: the shared balance, each key, and the last few charges. */
|
|
60
|
-
export declare function workspaceScreen(view: WorkspaceView, style?: ScreenStyle): string;
|
|
61
|
-
/** `phantom keys`: the workspace's keys alone. */
|
|
62
|
-
export declare function keysScreen(keys: WorkspaceKey[], style?: ScreenStyle): string;
|
|
63
|
-
/** After `phantom login`: signed in, where the key is kept, and the next step. */
|
|
64
|
-
export declare function signedInScreen(saved: {
|
|
65
|
-
saved_as: string;
|
|
66
|
-
storage: string;
|
|
67
|
-
}, style?: ScreenStyle): string;
|
|
68
|
-
/** `phantom login` when this computer already has a key: say so, then how to switch or add one. */
|
|
69
|
-
export declare function alreadySignedInScreen(keyIdShown: string | null, style?: ScreenStyle): string;
|
|
70
|
-
/** The parts of a route policy these screens read (the full type is in spend/routing.mts). */
|
|
71
|
-
type RouteView = {
|
|
72
|
-
route_policy: {
|
|
73
|
-
models: string[];
|
|
74
|
-
applies_to?: 'auto' | 'all';
|
|
75
|
-
on_empty?: 'stop' | 'cheapest';
|
|
76
|
-
fallback_on_error?: boolean;
|
|
77
|
-
stick_minutes?: number;
|
|
78
|
-
stick_by_prompt?: boolean;
|
|
79
|
-
rules?: Array<{
|
|
80
|
-
if: Record<string, unknown>;
|
|
81
|
-
use: string;
|
|
82
|
-
}>;
|
|
83
|
-
sort?: 'cost' | 'ttft' | 'tps';
|
|
84
|
-
zdr?: boolean;
|
|
85
|
-
no_training?: boolean;
|
|
86
|
-
} | null;
|
|
87
|
-
};
|
|
88
|
-
/** `phantom route`: which models "auto" picks from, what it does at the edges, and its rules, in sentences. */
|
|
89
|
-
export declare function routeScreen(r: RouteView, style?: ScreenStyle): string;
|
|
90
|
-
/** `phantom route test`: the model a request would run on right now, and why. */
|
|
91
|
-
export declare function routeTestScreen(t: {
|
|
92
|
-
model: string | null;
|
|
93
|
-
reason: string | null;
|
|
94
|
-
routed: boolean;
|
|
95
|
-
fallbacks?: string[];
|
|
96
|
-
}, style?: ScreenStyle): string;
|
|
97
|
-
/** The parts of a lineup these screens read (the full type is in spend/lineup.mts). */
|
|
98
|
-
export type LineupView = {
|
|
99
|
-
lineup: (Record<string, string | undefined> & {
|
|
100
|
-
fallbacks?: Record<string, string | undefined>;
|
|
101
|
-
}) | null;
|
|
102
|
-
tiers: Record<'standard' | 'frontier', {
|
|
103
|
-
model: string;
|
|
104
|
-
name: string;
|
|
105
|
-
}>;
|
|
106
|
-
choices?: Record<'standard' | 'frontier', Array<{
|
|
107
|
-
model: string;
|
|
108
|
-
name: string;
|
|
109
|
-
input_per_m: number | null;
|
|
110
|
-
output_per_m: number | null;
|
|
111
|
-
context: number | null;
|
|
112
|
-
default: boolean;
|
|
113
|
-
}>>;
|
|
114
|
-
};
|
|
115
|
-
/** What each tier is for, in a few words. */
|
|
116
|
-
export declare const TIER_ABOUT: {
|
|
117
|
-
readonly standard: "where every task starts";
|
|
118
|
-
readonly frontier: "hard steps: a failed try, a stuck agent";
|
|
119
|
-
};
|
|
120
|
-
/** `phantom lineup`: the model phantom-1 runs in each tier, whether it's the default or your pick, and its fallback. */
|
|
121
|
-
export declare function lineupScreen(l: LineupView, style?: ScreenStyle): string;
|
|
122
|
-
/** A model's price per million tokens, in and out, for a picker's hint. */
|
|
123
|
-
export declare function priceHint(c: {
|
|
124
|
-
input_per_m: number | null;
|
|
125
|
-
output_per_m: number | null;
|
|
126
|
-
context: number | null;
|
|
127
|
-
default: boolean;
|
|
128
|
-
}): string;
|
|
129
|
-
/** A link to open in the browser (Stripe Checkout, billing, a wallet), with what it's for and the next step. */
|
|
130
|
-
export declare function linkScreen(words: string, url: string, after: [string, string] | null, style?: ScreenStyle & {
|
|
131
|
-
opened?: boolean;
|
|
132
|
-
}): string;
|
|
133
|
-
/** `phantom fund`: the card checkout link, or the wallet payment link with its id to check on. */
|
|
134
|
-
export declare function fundScreen(f: {
|
|
135
|
-
payment_id?: string;
|
|
136
|
-
checkout_url?: string;
|
|
137
|
-
amount_cents?: number;
|
|
138
|
-
solana_pay_url?: string;
|
|
139
|
-
payment_url?: string;
|
|
140
|
-
coin?: string;
|
|
141
|
-
amount?: number | string;
|
|
142
|
-
expires_at?: string;
|
|
143
|
-
}, style?: ScreenStyle & {
|
|
144
|
-
opened?: boolean;
|
|
145
|
-
}): string;
|
|
146
|
-
/** `phantom workspace payment`: whether a payment has come in. */
|
|
147
|
-
export declare function paymentScreen(pay: {
|
|
148
|
-
payment_id: string;
|
|
149
|
-
status: string;
|
|
150
|
-
credit_usd?: number;
|
|
151
|
-
}, style?: ScreenStyle): string;
|
|
152
|
-
/** What a key change did: created, rotated, revoked or updated, and what to do next. */
|
|
153
|
-
export declare function keyChangeScreen(change: 'created' | 'rotated' | 'revoked' | 'updated', name: string | null, style?: ScreenStyle & {
|
|
154
|
-
storage?: string;
|
|
155
|
-
limit?: number | null;
|
|
156
|
-
}): string;
|
|
157
|
-
/** `phantom logout`: signed out on this computer, or nothing to sign out of. */
|
|
158
|
-
export declare function logoutScreen(removed: boolean, style?: ScreenStyle & {
|
|
159
|
-
kept?: string[];
|
|
160
|
-
removedNamed?: string[];
|
|
161
|
-
}): string;
|
|
162
|
-
/** `phantom keys saved`: the keys saved on this computer, by name. */
|
|
163
|
-
export declare function savedKeysScreen(keys: Array<{
|
|
164
|
-
name: string;
|
|
165
|
-
id: string;
|
|
166
|
-
active?: boolean;
|
|
167
|
-
credit_balance_usd?: number;
|
|
168
|
-
}>, style?: ScreenStyle): string;
|
|
169
|
-
/** `phantom keys save <name>`: the key is saved under its name, and how to run an agent on it. */
|
|
170
|
-
export declare function keySavedScreen(name: string, style?: ScreenStyle): string;
|
|
171
|
-
/**
|
|
172
|
-
* `phantom models`: a table of what each of Phantom's own models can do, a
|
|
173
|
-
* column per model, a ✓ per job. Under it, the model behind each job, so you
|
|
174
|
-
* can see what runs before you pick.
|
|
175
|
-
*/
|
|
176
|
-
export declare function modelsScreen(v: ModelsView, style?: ScreenStyle): string;
|
|
177
|
-
export {};
|