turno-cli 0.2.0 → 0.3.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/CHANGELOG.md +148 -0
- package/README.md +127 -39
- package/dist/accounts/audit.js +27 -15
- package/dist/accounts/builtin.js +35 -7
- package/dist/accounts/delegate.js +30 -7
- package/dist/accounts/policy.js +4 -2
- package/dist/accounts/registry.js +3 -1
- package/dist/agents/adapter.js +22 -0
- package/dist/agents/claude.js +54 -3
- package/dist/agents/codex.js +94 -6
- package/dist/agents/copilot.js +19 -2
- package/dist/agents/cursor.js +19 -2
- package/dist/agents/index.js +1 -1
- package/dist/agents/snippets.js +37 -10
- package/dist/cli/args.js +32 -15
- package/dist/cli/commands/accounts.js +29 -7
- package/dist/cli/commands/auto.js +50 -12
- package/dist/cli/commands/browser-identity.js +514 -0
- package/dist/cli/commands/browser-session.js +102 -0
- package/dist/cli/commands/browser-vault.js +193 -0
- package/dist/cli/commands/browser.js +159 -59
- package/dist/cli/commands/complete.js +13 -3
- package/dist/cli/commands/completion.js +4 -0
- package/dist/cli/commands/config.js +90 -13
- package/dist/cli/commands/demo.js +36 -7
- package/dist/cli/commands/doctor.js +170 -36
- package/dist/cli/commands/identity.js +99 -12
- package/dist/cli/commands/init.js +42 -10
- package/dist/cli/commands/limit.js +65 -9
- package/dist/cli/commands/mcp-call.js +240 -0
- package/dist/cli/commands/mcp-oauth.js +33 -6
- package/dist/cli/commands/mcp-observe.js +128 -23
- package/dist/cli/commands/mcp-share.js +201 -0
- package/dist/cli/commands/mcp.js +203 -42
- package/dist/cli/commands/mcpd.js +76 -12
- package/dist/cli/commands/open.js +26 -3
- package/dist/cli/commands/profile.js +212 -30
- package/dist/cli/commands/resolve.js +8 -1
- package/dist/cli/commands/run.js +24 -4
- package/dist/cli/commands/secret.js +23 -38
- package/dist/cli/commands/session.js +16 -5
- package/dist/cli/commands/sessions.js +7 -1
- package/dist/cli/commands/setup.js +83 -11
- package/dist/cli/commands/status.js +67 -15
- package/dist/cli/commands/statusline.js +7 -2
- package/dist/cli/commands/ui.js +17 -5
- package/dist/cli/commands/undo.js +39 -7
- package/dist/cli/commands/uninstall.js +24 -5
- package/dist/cli/commands/upgrade.js +113 -76
- package/dist/cli/commands/usage.js +11 -10
- package/dist/cli/commands/version.js +20 -8
- package/dist/cli/commands/which.js +5 -3
- package/dist/cli/diagnostics.js +184 -0
- package/dist/cli/exit.js +65 -0
- package/dist/cli/group.js +20 -8
- package/dist/cli/help.js +6 -1
- package/dist/cli/hints.js +30 -0
- package/dist/cli/io.js +24 -8
- package/dist/cli/launch.js +31 -2
- package/dist/cli/launchers.js +25 -10
- package/dist/cli/main.js +52 -18
- package/dist/cli/optional.js +144 -0
- package/dist/cli/output.js +123 -0
- package/dist/cli/picker.js +17 -5
- package/dist/cli/registry.js +20 -2
- package/dist/cli/safe.js +87 -0
- package/dist/cli/secret-input.js +63 -0
- package/dist/cli/security.js +31 -9
- package/dist/cli/style.js +35 -5
- package/dist/cli/topics.js +142 -0
- package/dist/core/config.js +39 -3
- package/dist/core/fsutil.js +2 -10
- package/dist/core/journal.js +19 -11
- package/dist/core/manifest.js +28 -1
- package/dist/core/paths.js +6 -112
- package/dist/core/profiles.js +28 -8
- package/dist/core/resolve.js +13 -3
- package/dist/core/secrets.js +4 -154
- package/dist/core/state-file.js +107 -0
- package/dist/core/update.js +14 -11
- package/dist/core/version.js +57 -10
- package/dist/demo/server.js +10 -2
- package/dist/mcpd/cache.js +6 -7
- package/dist/mcpd/calllog.js +10 -9
- package/dist/mcpd/client-names.js +8 -13
- package/dist/mcpd/connectors.js +42 -3
- package/dist/mcpd/daemon.js +29 -8
- package/dist/mcpd/folder-sets.js +5 -2
- package/dist/mcpd/gateway.js +57 -29
- package/dist/mcpd/health.js +69 -25
- package/dist/mcpd/importer.js +106 -9
- package/dist/mcpd/instances.js +59 -31
- package/dist/mcpd/jsonrpc.js +3 -1
- package/dist/mcpd/middleware.js +144 -0
- package/dist/mcpd/modern.js +57 -19
- package/dist/mcpd/oauth.js +71 -17
- package/dist/mcpd/peerpid.js +15 -3
- package/dist/mcpd/pressure.js +4 -1
- package/dist/mcpd/rss.js +34 -19
- package/dist/mcpd/service.js +28 -4
- package/dist/mcpd/share.js +217 -0
- package/dist/mcpd/state.js +16 -16
- package/dist/mcpd/sync.js +22 -12
- package/dist/mcpd/systemd.js +4 -1
- package/dist/mcpd/tokens.js +4 -8
- package/dist/mcpd/upstream.js +12 -5
- package/dist/statusline/cost.js +17 -4
- package/dist/statusline/input.js +15 -3
- package/dist/ui/fonts.js +1 -1
- package/dist/ui/settings.js +6 -1
- package/npm-shrinkwrap.json +12 -3
- package/package.json +7 -6
package/dist/mcpd/state.js
CHANGED
|
@@ -13,6 +13,7 @@ import { loadConfig, parseConfig } from "../core/config.js";
|
|
|
13
13
|
import { pidAlive } from "../core/fsutil.js";
|
|
14
14
|
import { atomicWrite } from "../core/journal.js";
|
|
15
15
|
import { paths } from "../core/paths.js";
|
|
16
|
+
import { hasFields, readState } from "../core/state-file.js";
|
|
16
17
|
/** Files mcpd keeps in the state folder besides `mcpd.token` and `mcpd.port`. */
|
|
17
18
|
export function daemonFiles(env = process.env) {
|
|
18
19
|
const p = paths(env);
|
|
@@ -33,7 +34,7 @@ function defaultWarn(message) {
|
|
|
33
34
|
* folder). `read` returns it or undefined; `ensure` creates it when missing; `rotate` always
|
|
34
35
|
* writes a new one. On read the file is checked with fstat: a mode wider than 600 is fixed (or
|
|
35
36
|
* reported when it cannot be), and a file owned by another user is reported. The token is
|
|
36
|
-
* never printed. Per-profile tokens derive from this one (mcpd/tokens.ts
|
|
37
|
+
* never printed. Per-profile tokens derive from this one (mcpd/tokens.ts).
|
|
37
38
|
*/
|
|
38
39
|
export function masterToken(env = process.env, mode = "ensure", warn = defaultWarn) {
|
|
39
40
|
const file = paths(env).mcpdToken;
|
|
@@ -91,14 +92,10 @@ export function readToken(env = process.env, warn) {
|
|
|
91
92
|
export function rotateToken(env = process.env) {
|
|
92
93
|
return masterToken(env, "rotate");
|
|
93
94
|
}
|
|
95
|
+
const isLockInfo = (v) => hasFields(v, { pid: "number" }) && Number.isInteger(v.pid) && v.pid > 0;
|
|
96
|
+
/** The lock file, or undefined when there is none or it is not a lock (state-file.ts). */
|
|
94
97
|
export function readLock(env = process.env) {
|
|
95
|
-
|
|
96
|
-
const v = JSON.parse(readFileSync(daemonFiles(env).lock, "utf8"));
|
|
97
|
-
return Number.isInteger(v.pid) && v.pid > 0 ? v : undefined;
|
|
98
|
-
}
|
|
99
|
-
catch {
|
|
100
|
-
return undefined;
|
|
101
|
-
}
|
|
98
|
+
return readState(daemonFiles(env).lock, isLockInfo);
|
|
102
99
|
}
|
|
103
100
|
/** Whether `pid` runs mcpd: alive and, when ps can tell, its command line is `... mcp daemon run` (or `mcpd run`). */
|
|
104
101
|
export function isMcpdProcess(pid) {
|
|
@@ -107,7 +104,11 @@ export function isMcpdProcess(pid) {
|
|
|
107
104
|
if (!pidAlive(pid))
|
|
108
105
|
return false;
|
|
109
106
|
try {
|
|
110
|
-
const cmd = execFileSync("ps", ["-o", "command=", "-p", String(pid)], {
|
|
107
|
+
const cmd = execFileSync("ps", ["-o", "command=", "-p", String(pid)], {
|
|
108
|
+
encoding: "utf8",
|
|
109
|
+
timeout: 2000,
|
|
110
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
111
|
+
});
|
|
111
112
|
return /\b(mcpd|daemon) run\b/.test(cmd);
|
|
112
113
|
}
|
|
113
114
|
catch {
|
|
@@ -157,20 +158,19 @@ export function mcpdPort(env = process.env) {
|
|
|
157
158
|
}
|
|
158
159
|
return loadConfigSafe(env).config.mcpd.port;
|
|
159
160
|
}
|
|
161
|
+
const isStartError = (v) => hasFields(v, { at: "string", message: "string" });
|
|
160
162
|
export function readStartError(env = process.env) {
|
|
161
|
-
|
|
162
|
-
return JSON.parse(readFileSync(daemonFiles(env).error, "utf8"));
|
|
163
|
-
}
|
|
164
|
-
catch {
|
|
165
|
-
return undefined;
|
|
166
|
-
}
|
|
163
|
+
return readState(daemonFiles(env).error, isStartError);
|
|
167
164
|
}
|
|
168
165
|
/** Whether our own mcpd answers /status on `port` with our token. */
|
|
169
166
|
export async function answersAsMcpd(port, token) {
|
|
170
167
|
if (!token)
|
|
171
168
|
return undefined;
|
|
172
169
|
try {
|
|
173
|
-
const res = await fetch(`http://127.0.0.1:${port}/status`, {
|
|
170
|
+
const res = await fetch(`http://127.0.0.1:${port}/status`, {
|
|
171
|
+
headers: { authorization: `Bearer ${token}` },
|
|
172
|
+
signal: AbortSignal.timeout(2000),
|
|
173
|
+
});
|
|
174
174
|
if (!res.ok)
|
|
175
175
|
return undefined;
|
|
176
176
|
const body = (await res.json());
|
package/dist/mcpd/sync.js
CHANGED
|
@@ -8,9 +8,10 @@ import { servesProfile } from "../core/manifest.js";
|
|
|
8
8
|
import { profileToken } from "./tokens.js";
|
|
9
9
|
import { isObject, parseJsonObject } from "../core/fsutil.js";
|
|
10
10
|
import { CliError } from "../cli/io.js";
|
|
11
|
+
import { isStringArray, readState, recordOf, requireState } from "../core/state-file.js";
|
|
11
12
|
/**
|
|
12
|
-
* A gateway entry in the format of each agent
|
|
13
|
-
* profile's token
|
|
13
|
+
* A gateway entry in the format of each agent. Claude Code gets the
|
|
14
|
+
* profile's token in the entry; the others read it, and the session PID, from the
|
|
14
15
|
* launcher's environment.
|
|
15
16
|
*/
|
|
16
17
|
export function gatewayEntryFor(agent, name, port, token, profile) {
|
|
@@ -20,7 +21,7 @@ export function gatewayEntryFor(agent, name, port, token, profile) {
|
|
|
20
21
|
* The MCP entries a profile should have, according to the manifest. Remote servers that do not
|
|
21
22
|
* go through the gateway are written as they are for agents that take them (Claude Code), and
|
|
22
23
|
* skipped for the others (their formats differ; `turno mcp config` prints them). `master` is the gateway's
|
|
23
|
-
* master token: entries carry the profile's own token derived from it
|
|
24
|
+
* master token: entries carry the profile's own token derived from it, never the
|
|
24
25
|
* master itself.
|
|
25
26
|
*/
|
|
26
27
|
export function profileServers(manifest, profile, port, master, agent = DEFAULT_AGENT) {
|
|
@@ -39,13 +40,17 @@ export function profileServers(manifest, profile, port, master, agent = DEFAULT_
|
|
|
39
40
|
}
|
|
40
41
|
return out;
|
|
41
42
|
}
|
|
43
|
+
const isManaged = recordOf(isStringArray);
|
|
44
|
+
/**
|
|
45
|
+
* The entries turno wrote, before it removes any: a file that exists but cannot be read is a
|
|
46
|
+
* StateError (fix or remove it), never an empty list that would leave stale entries behind.
|
|
47
|
+
*/
|
|
42
48
|
export function readManaged(file) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
+
return requireState(file, isManaged) ?? {};
|
|
50
|
+
}
|
|
51
|
+
/** The same, empty when the file cannot be used: for checks that only read (doctor, the status line). */
|
|
52
|
+
export function peekManaged(file) {
|
|
53
|
+
return readState(file, isManaged) ?? {};
|
|
49
54
|
}
|
|
50
55
|
export function writeManaged(file, state) {
|
|
51
56
|
mkdirSync(dirname(file), { recursive: true, mode: PRIVATE_DIR_MODE });
|
|
@@ -100,7 +105,7 @@ export function syncJsonServers(configFile, key, wanted, previouslyManaged, opts
|
|
|
100
105
|
return res;
|
|
101
106
|
}
|
|
102
107
|
/**
|
|
103
|
-
* Rewrite the servers of an agent config file in its store's format
|
|
108
|
+
* Rewrite the servers of an agent config file in its store's format: add or update
|
|
104
109
|
* `wanted`, remove entries turno wrote earlier that left it, keep everything else.
|
|
105
110
|
*/
|
|
106
111
|
export function syncServers(configFile, store, wanted, previouslyManaged, opts = {}) {
|
|
@@ -122,7 +127,9 @@ function tomlValue(v) {
|
|
|
122
127
|
if (Array.isArray(v))
|
|
123
128
|
return `[${v.map(tomlValue).join(", ")}]`;
|
|
124
129
|
if (v && typeof v === "object") {
|
|
125
|
-
return `{ ${Object.entries(v)
|
|
130
|
+
return `{ ${Object.entries(v)
|
|
131
|
+
.map(([k, x]) => `${tomlKey(k)} = ${tomlValue(x)}`)
|
|
132
|
+
.join(", ")} }`;
|
|
126
133
|
}
|
|
127
134
|
throw new Error(`cannot write ${String(v)} as TOML`);
|
|
128
135
|
}
|
|
@@ -159,7 +166,10 @@ function syncTomlServers(configFile, key, wanted, previouslyManaged, opts) {
|
|
|
159
166
|
const lines = text === "" ? [] : text.replace(/\n$/, "").split("\n");
|
|
160
167
|
// Drop the tables that go or change, from the bottom up so ranges stay valid.
|
|
161
168
|
const drop = [...res.removed, ...res.updated];
|
|
162
|
-
const ranges = [...serverTables(lines, key).entries()]
|
|
169
|
+
const ranges = [...serverTables(lines, key).entries()]
|
|
170
|
+
.filter(([n]) => drop.includes(n))
|
|
171
|
+
.map(([, r]) => r)
|
|
172
|
+
.sort((a, b) => b[0] - a[0]);
|
|
163
173
|
for (const [start, end] of ranges)
|
|
164
174
|
lines.splice(start, end - start);
|
|
165
175
|
for (const name of [...res.updated, ...res.added]) {
|
package/dist/mcpd/systemd.js
CHANGED
|
@@ -11,7 +11,10 @@ function quote(s) {
|
|
|
11
11
|
return `"${s.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/%/g, "%%").replace(/\$/g, "$$$$")}"`;
|
|
12
12
|
}
|
|
13
13
|
function unquote(s) {
|
|
14
|
-
return s
|
|
14
|
+
return s
|
|
15
|
+
.replace(/\$\$/g, "$")
|
|
16
|
+
.replace(/%%/g, "%")
|
|
17
|
+
.replace(/\\(["\\])/g, "$1");
|
|
15
18
|
}
|
|
16
19
|
/**
|
|
17
20
|
* `systemd --user` unit that keeps `turno mcp daemon run` alive. Restart=on-failure: a clean
|
package/dist/mcpd/tokens.js
CHANGED
|
@@ -3,8 +3,9 @@ import { readFileSync, rmSync } from "node:fs";
|
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { atomicWrite } from "../core/journal.js";
|
|
5
5
|
import { ensurePrivateDir, paths } from "../core/paths.js";
|
|
6
|
+
import { readState } from "../core/state-file.js";
|
|
6
7
|
/**
|
|
7
|
-
* Per-profile gateway tokens
|
|
8
|
+
* Per-profile gateway tokens. Each profile's agent config carries its own token,
|
|
8
9
|
* derived from the master token so mcpd needs no list of them:
|
|
9
10
|
*
|
|
10
11
|
* tp1.<profile>.<base64url(HMAC-SHA256(master, "profile:" + profile))>
|
|
@@ -63,13 +64,8 @@ function syncedListFile(env) {
|
|
|
63
64
|
return join(dirname(profileTokenFile("x", env)), "synced.json");
|
|
64
65
|
}
|
|
65
66
|
export function readSyncedTokenProfiles(env = process.env) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return Array.isArray(v) ? v.filter((x) => typeof x === "string") : [];
|
|
69
|
-
}
|
|
70
|
-
catch {
|
|
71
|
-
return [];
|
|
72
|
-
}
|
|
67
|
+
const v = readState(syncedListFile(env), (x) => Array.isArray(x));
|
|
68
|
+
return (v ?? []).filter((x) => typeof x === "string");
|
|
73
69
|
}
|
|
74
70
|
export function writeSyncedTokenProfiles(names, env = process.env) {
|
|
75
71
|
const file = syncedListFile(env);
|
package/dist/mcpd/upstream.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LATEST_PROTOCOL_VERSION } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
-
import { ErrorCode, isNotification, isRequest, isResponse, rpcError } from "./jsonrpc.js";
|
|
2
|
+
import { ErrorCode, isNotification, isRequest, isResponse, rpcError, } from "./jsonrpc.js";
|
|
3
3
|
/** Server-to-client requests and the client capability each needs. */
|
|
4
4
|
const CLIENT_CAPABILITY = {
|
|
5
5
|
"elicitation/create": "elicitation",
|
|
@@ -17,7 +17,7 @@ function sessionGone(err, hadSession) {
|
|
|
17
17
|
* One running MCP server, spoken to over a raw transport. Request ids and progress tokens
|
|
18
18
|
* are rewritten so several clients can share it without their messages crossing. Every
|
|
19
19
|
* request it relays is settled exactly once: by the server's answer, a cancellation, a
|
|
20
|
-
* timeout, the client going away, or the server stopping
|
|
20
|
+
* timeout, the client going away, or the server stopping.
|
|
21
21
|
*/
|
|
22
22
|
export class Upstream {
|
|
23
23
|
opts;
|
|
@@ -104,7 +104,12 @@ export class Upstream {
|
|
|
104
104
|
}
|
|
105
105
|
this.lastActivity = Date.now();
|
|
106
106
|
return new Promise((resolve) => {
|
|
107
|
-
const p = {
|
|
107
|
+
const p = {
|
|
108
|
+
resolve,
|
|
109
|
+
method,
|
|
110
|
+
...(origin ? { origin } : {}),
|
|
111
|
+
...(originId !== undefined ? { originId } : {}),
|
|
112
|
+
};
|
|
108
113
|
if (timeoutMs) {
|
|
109
114
|
p.timer = setTimeout(() => {
|
|
110
115
|
this.cancelUpstream(id, "timed out");
|
|
@@ -238,7 +243,7 @@ export class Upstream {
|
|
|
238
243
|
* The client a server-to-client message belongs to. Stdio carries no link between a server
|
|
239
244
|
* request and the call that caused it, so: an explicit related request id wins; else the one
|
|
240
245
|
* client with calls in flight; else the only attached client. With calls in flight from
|
|
241
|
-
* several clients the message is refused rather than sent to a guess
|
|
246
|
+
* several clients the message is refused rather than sent to a guess.
|
|
242
247
|
*/
|
|
243
248
|
route(method, params) {
|
|
244
249
|
const meta = params?._meta;
|
|
@@ -310,7 +315,9 @@ export class Upstream {
|
|
|
310
315
|
async relayRequest(m) {
|
|
311
316
|
const id = m.id;
|
|
312
317
|
const outcome = await this.answer(m.method, m.params);
|
|
313
|
-
const reply = "error" in outcome
|
|
318
|
+
const reply = "error" in outcome
|
|
319
|
+
? { jsonrpc: "2.0", id, error: outcome.error }
|
|
320
|
+
: { jsonrpc: "2.0", id, result: outcome.result };
|
|
314
321
|
await this.send(reply).catch(() => { });
|
|
315
322
|
}
|
|
316
323
|
relayNotification(m) {
|
package/dist/statusline/cost.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, openSync, readSync, readdirSync, renameSync, rmSync, statSync, writeFileSync, closeSync } from "node:fs";
|
|
1
|
+
import { existsSync, mkdirSync, openSync, readSync, readdirSync, renameSync, rmSync, statSync, writeFileSync, closeSync, } from "node:fs";
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import { PRIVATE_DIR_MODE, PRIVATE_FILE_MODE } from "../core/paths.js";
|
|
4
4
|
import { readJsonFile, realOr } from "../core/fsutil.js";
|
|
@@ -65,7 +65,7 @@ export function priceFor(model) {
|
|
|
65
65
|
const num = (v) => (typeof v === "number" && Number.isFinite(v) ? v : 0);
|
|
66
66
|
/** Tokens a usage record bills: zero for Claude Code's synthetic messages. */
|
|
67
67
|
function usageTokens(u) {
|
|
68
|
-
return num(u.input_tokens) + num(u.output_tokens) + num(u.cache_creation_input_tokens) + num(u.cache_read_input_tokens);
|
|
68
|
+
return (num(u.input_tokens) + num(u.output_tokens) + num(u.cache_creation_input_tokens) + num(u.cache_read_input_tokens));
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
* API cost in USD of one assistant usage record, or undefined when the model has no price.
|
|
@@ -84,7 +84,12 @@ export function usageCost(model, u) {
|
|
|
84
84
|
const w5m = u.cache_creation?.ephemeral_5m_input_tokens !== undefined
|
|
85
85
|
? num(u.cache_creation.ephemeral_5m_input_tokens)
|
|
86
86
|
: Math.max(0, num(u.cache_creation_input_tokens) - w1h);
|
|
87
|
-
const usd = (num(u.input_tokens) * p[0] +
|
|
87
|
+
const usd = (num(u.input_tokens) * p[0] +
|
|
88
|
+
num(u.output_tokens) * p[1] +
|
|
89
|
+
w5m * p[2] +
|
|
90
|
+
w1h * p[3] +
|
|
91
|
+
num(u.cache_read_input_tokens) * p[4]) /
|
|
92
|
+
1e6;
|
|
88
93
|
return usd * (u.speed === "fast" ? 2 : 1);
|
|
89
94
|
}
|
|
90
95
|
/** Bumped when an older state would give a wrong total (v2: unknown models are tracked). */
|
|
@@ -192,7 +197,15 @@ export function computeCost(transcript, out, now = Date.now() / 1000) {
|
|
|
192
197
|
const mainUsd = files[main]?.usd ?? 0;
|
|
193
198
|
const total = Object.values(files).reduce((a, f) => a + f.usd, 0);
|
|
194
199
|
const unknown = [...new Set(Object.values(files).flatMap((f) => f.unknown ?? []))];
|
|
195
|
-
const state = {
|
|
200
|
+
const state = {
|
|
201
|
+
v: STATE_VERSION,
|
|
202
|
+
files,
|
|
203
|
+
main: mainUsd,
|
|
204
|
+
sub: total - mainUsd,
|
|
205
|
+
total,
|
|
206
|
+
unknown,
|
|
207
|
+
updated_at: now,
|
|
208
|
+
};
|
|
196
209
|
try {
|
|
197
210
|
writeJson(out, state);
|
|
198
211
|
}
|
package/dist/statusline/input.js
CHANGED
|
@@ -46,8 +46,16 @@ export function sanitize(raw) {
|
|
|
46
46
|
}),
|
|
47
47
|
model: sub({ display_name: str }),
|
|
48
48
|
effort: sub({ level: str }),
|
|
49
|
-
cost: sub({
|
|
50
|
-
|
|
49
|
+
cost: sub({
|
|
50
|
+
total_cost_usd: num,
|
|
51
|
+
total_lines_added: num,
|
|
52
|
+
total_lines_removed: num,
|
|
53
|
+
}),
|
|
54
|
+
context_window: sub({
|
|
55
|
+
used_percentage: num,
|
|
56
|
+
total_input_tokens: num,
|
|
57
|
+
context_window_size: num,
|
|
58
|
+
}),
|
|
51
59
|
prompt_cache: sub({
|
|
52
60
|
caching_observed: bool,
|
|
53
61
|
warm: bool,
|
|
@@ -61,6 +69,10 @@ export function sanitize(raw) {
|
|
|
61
69
|
export function turns(v) {
|
|
62
70
|
if (!Array.isArray(v))
|
|
63
71
|
return [];
|
|
64
|
-
return v.filter((e) => Array.isArray(e) &&
|
|
72
|
+
return v.filter((e) => Array.isArray(e) &&
|
|
73
|
+
e.length === 3 &&
|
|
74
|
+
typeof e[0] === "string" &&
|
|
75
|
+
num(e[1]) !== undefined &&
|
|
76
|
+
(e[2] === null || num(e[2]) !== undefined));
|
|
65
77
|
}
|
|
66
78
|
//# sourceMappingURL=input.js.map
|
package/dist/ui/fonts.js
CHANGED
|
@@ -5,7 +5,7 @@ import { join } from "node:path";
|
|
|
5
5
|
import { findOnPath } from "../cli/launch.js";
|
|
6
6
|
const NF = "https://raw.githubusercontent.com/ryanoasis/nerd-fonts/v3.4.0/patched-fonts/Meslo/S/";
|
|
7
7
|
/**
|
|
8
|
-
* Same values as turno-fonts. turno-cli does not depend on that package
|
|
8
|
+
* Same values as turno-fonts. turno-cli does not depend on that package, so a normal
|
|
9
9
|
* install downloads these files and checks each one against its pinned SHA-256.
|
|
10
10
|
*/
|
|
11
11
|
export const FALLBACK = {
|
package/dist/ui/settings.js
CHANGED
|
@@ -41,7 +41,12 @@ export function statusLineLabel(s, env, max = 60) {
|
|
|
41
41
|
}
|
|
42
42
|
/** The entry to write: our command, keeping any other keys the user set (padding, ...). */
|
|
43
43
|
function wantedStatusLine(command, existing) {
|
|
44
|
-
return {
|
|
44
|
+
return {
|
|
45
|
+
...(existing ?? {}),
|
|
46
|
+
type: "command",
|
|
47
|
+
command,
|
|
48
|
+
refreshInterval: existing?.refreshInterval ?? REFRESH_SECONDS,
|
|
49
|
+
};
|
|
45
50
|
}
|
|
46
51
|
export function setStatusLine(file, command, journal) {
|
|
47
52
|
const settings = readSettings(file);
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "turno-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "turno-cli",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.3.0",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@modelcontextprotocol/sdk": "1.32.2",
|
|
13
|
-
"smol-toml": "1.9.1"
|
|
13
|
+
"smol-toml": "1.9.1",
|
|
14
|
+
"turno-core": "0.1.0"
|
|
14
15
|
},
|
|
15
16
|
"bin": {
|
|
16
17
|
"turno": "dist/cli/main.js"
|
|
@@ -1012,6 +1013,14 @@
|
|
|
1012
1013
|
"node": ">=0.6"
|
|
1013
1014
|
}
|
|
1014
1015
|
},
|
|
1016
|
+
"node_modules/turno-core": {
|
|
1017
|
+
"version": "0.1.0",
|
|
1018
|
+
"resolved": "https://registry.npmjs.org/turno-core/-/turno-core-0.1.0.tgz",
|
|
1019
|
+
"license": "Apache-2.0",
|
|
1020
|
+
"engines": {
|
|
1021
|
+
"node": ">=22.11"
|
|
1022
|
+
}
|
|
1023
|
+
},
|
|
1015
1024
|
"node_modules/type-is": {
|
|
1016
1025
|
"version": "2.1.0",
|
|
1017
1026
|
"resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "turno-cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Switch accounts in your coding agents and keep the conversation, the MCP sign-ins and the browser session.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
7
7
|
"codex",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"author": "William Frank Monroy Mamani (https://github.com/william-monroy)",
|
|
22
|
-
"homepage": "https://
|
|
22
|
+
"homepage": "https://turno.wimo.dev",
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
25
|
"url": "git+https://github.com/wimo-dev/turno.git",
|
|
@@ -46,12 +46,13 @@
|
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@modelcontextprotocol/sdk": "1.32.2",
|
|
49
|
-
"smol-toml": "1.9.1"
|
|
49
|
+
"smol-toml": "1.9.1",
|
|
50
|
+
"turno-core": "0.1.0"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@types/node": "^26.6.6",
|
|
53
|
-
"turno-browser": "0.
|
|
54
|
-
"turno-fonts": "0.1.
|
|
54
|
+
"turno-browser": "0.3.0",
|
|
55
|
+
"turno-fonts": "0.1.2",
|
|
55
56
|
"typescript": "^7.0.2",
|
|
56
57
|
"vitest": "^5.1.0"
|
|
57
58
|
},
|