turno-browser 0.4.0 → 0.6.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 +45 -0
- package/README.md +92 -149
- package/dist/act-model.js +4 -3
- package/dist/act.js +2 -1
- package/dist/api.d.ts +63 -2
- package/dist/api.js +14 -4
- package/dist/background-state.d.ts +54 -0
- package/dist/background-state.js +97 -0
- package/dist/background.d.ts +69 -0
- package/dist/background.js +458 -0
- package/dist/bin/mcp.js +48 -8
- package/dist/captcha.js +3 -2
- package/dist/cli/background.d.ts +11 -0
- package/dist/cli/background.js +132 -0
- package/dist/cli/commands.d.ts +16 -0
- package/dist/cli/commands.js +515 -0
- package/dist/cli/completion.d.ts +11 -0
- package/dist/cli/completion.js +107 -0
- package/dist/cli/context.d.ts +75 -0
- package/dist/cli/context.js +44 -0
- package/dist/cli/do-background.d.ts +27 -0
- package/dist/cli/do-background.js +212 -0
- package/dist/cli/do.d.ts +85 -0
- package/dist/cli/do.js +558 -0
- package/dist/cli/flows.d.ts +28 -0
- package/dist/cli/flows.js +303 -0
- package/dist/cli/identity.d.ts +37 -0
- package/dist/cli/identity.js +906 -0
- package/dist/cli/live.d.ts +7 -0
- package/dist/cli/live.js +99 -0
- package/dist/cli/main.d.ts +16 -0
- package/dist/cli/main.js +194 -0
- package/dist/cli/secret.d.ts +4 -0
- package/dist/cli/secret.js +151 -0
- package/dist/cli/session.d.ts +6 -0
- package/dist/cli/session.js +106 -0
- package/dist/cli/setup.d.ts +13 -0
- package/dist/cli/setup.js +180 -0
- package/dist/cli/vault.d.ts +5 -0
- package/dist/cli/vault.js +192 -0
- package/dist/client.d.ts +82 -0
- package/dist/client.js +303 -0
- package/dist/doctor.js +34 -1
- package/dist/engine-camoufox.js +5 -4
- package/dist/engine-lightpanda.js +3 -2
- package/dist/engine.js +2 -1
- package/dist/health.js +2 -1
- package/dist/host.d.ts +21 -0
- package/dist/host.js +75 -15
- package/dist/human-input.js +7 -2
- package/dist/identities.js +2 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +2 -0
- package/dist/lifecycle.d.ts +2 -0
- package/dist/lifecycle.js +2 -1
- package/dist/live-client.js +8 -6
- package/dist/live-page.d.ts +0 -7
- package/dist/live-page.js +3 -2
- package/dist/live-server.js +6 -3
- package/dist/live.js +2 -1
- package/dist/login-tool.js +3 -2
- package/dist/login.js +2 -1
- package/dist/names.d.ts +28 -0
- package/dist/names.js +25 -0
- package/dist/network.d.ts +1 -1
- package/dist/network.js +4 -3
- package/dist/opt-in-settings.js +3 -2
- package/dist/replay.js +4 -3
- package/dist/runtime-lock.js +3 -2
- package/dist/vault.js +5 -4
- package/npm-shrinkwrap.json +6 -5
- package/package.json +13 -7
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { DRY_RUN, Exit, JSON_FLAG, bool, emit, fail, jsonOutput, needsAnswer, noInputReason, parseFlags, str, style, } from "turno-core/cli";
|
|
2
|
+
import { tildify } from "turno-core/paths";
|
|
3
|
+
import { describeRecord } from "./identity.js";
|
|
4
|
+
import { terminalInput } from "./vault.js";
|
|
5
|
+
/**
|
|
6
|
+
* `flows|replay|traces|record`: the saved flows of an identity, running one
|
|
7
|
+
* outside an agent, its recordings (traces and screenshots), and what it records. The flows and
|
|
8
|
+
* recordings themselves are turno-browser's (`flows.ts`, `recordings.ts`); this file only shows
|
|
9
|
+
* and drives them.
|
|
10
|
+
*/
|
|
11
|
+
/** `flows <id> --json`: one element per flow. */
|
|
12
|
+
export const FLOWS_JSON = jsonOutput(["name", "description", "steps", "params", "start", "auto", "updated", "file"]);
|
|
13
|
+
/** `replay --json`. */
|
|
14
|
+
export const REPLAY_JSON = jsonOutput(["identity", "flow", "ok", "report"]);
|
|
15
|
+
/** `traces <id> --json`: one element per recording. */
|
|
16
|
+
export const TRACES_JSON = jsonOutput([
|
|
17
|
+
"name",
|
|
18
|
+
"dir",
|
|
19
|
+
"title",
|
|
20
|
+
"started",
|
|
21
|
+
"ended",
|
|
22
|
+
"steps",
|
|
23
|
+
"screenshots",
|
|
24
|
+
"traces",
|
|
25
|
+
"bytes",
|
|
26
|
+
"notes",
|
|
27
|
+
]);
|
|
28
|
+
/** `record <id> --json`. */
|
|
29
|
+
export const RECORD_JSON = jsonOutput(["id", "dryRun", "record", "flowsDir", "recordingsDir"]);
|
|
30
|
+
/** The identity a subcommand names, which must exist. */
|
|
31
|
+
export function needIdentity(c, id, sub, io) {
|
|
32
|
+
const n = c.names;
|
|
33
|
+
if (!id)
|
|
34
|
+
return fail(`${n.subject}${sub} needs an identity id (for example: ${n.browser} ${sub} school)`);
|
|
35
|
+
c.api.assertIdentityId(id);
|
|
36
|
+
if (!c.api.identityExists(id, io.env))
|
|
37
|
+
return fail(`identity "${id}" does not exist (${n.identity("add", id)})`);
|
|
38
|
+
return id;
|
|
39
|
+
}
|
|
40
|
+
function size(bytes) {
|
|
41
|
+
if (bytes < 1024)
|
|
42
|
+
return `${bytes} B`;
|
|
43
|
+
if (bytes < 1024 ** 2)
|
|
44
|
+
return `${(bytes / 1024).toFixed(0)} KB`;
|
|
45
|
+
return `${(bytes / 1024 ** 2).toFixed(1)} MB`;
|
|
46
|
+
}
|
|
47
|
+
const FLOWS_FLAGS = { remove: { type: "boolean" }, ...DRY_RUN, ...JSON_FLAG };
|
|
48
|
+
/** A flow's steps in a few words each (the package's own wording is in the tool; this mirrors it). */
|
|
49
|
+
function stepLine(step) {
|
|
50
|
+
const t = step.targets?.target ?? step.targets?.startTarget;
|
|
51
|
+
const a = step.args;
|
|
52
|
+
if (step.tool === "browser_login")
|
|
53
|
+
return `browser_login site "${String(a.site)}"`;
|
|
54
|
+
if (step.tool === "browser_replay")
|
|
55
|
+
return `browser_replay flow "${String(a.flow)}"`;
|
|
56
|
+
const what = t ? (t.description ?? t.locators[0]?.selector) : (a.url ?? a.key ?? a.action ?? a.time);
|
|
57
|
+
const text = a.text;
|
|
58
|
+
return `${step.tool}${what === undefined ? "" : ` ${String(what)}`}${text?.$param ? ` with {${text.$param}}` : ""}`;
|
|
59
|
+
}
|
|
60
|
+
export function flows(c, args, io) {
|
|
61
|
+
const mod = c.api;
|
|
62
|
+
const p = parseFlags(args, FLOWS_FLAGS, 2);
|
|
63
|
+
const id = needIdentity(c, p.positionals[0], "flows", io);
|
|
64
|
+
const name = p.positionals[1];
|
|
65
|
+
if (bool(p, "remove")) {
|
|
66
|
+
if (!name)
|
|
67
|
+
return fail(`--remove needs a flow name: ${c.names.browser} flows <id> <flow> --remove`);
|
|
68
|
+
mod.readFlow(id, name, io.env);
|
|
69
|
+
if (bool(p, "dry-run")) {
|
|
70
|
+
io.out(`(dry run) would delete flow "${name}" of "${id}"`);
|
|
71
|
+
return Exit.ok;
|
|
72
|
+
}
|
|
73
|
+
mod.removeFlow(id, name, io.env);
|
|
74
|
+
io.out(`deleted flow "${name}" of "${id}"`);
|
|
75
|
+
return Exit.ok;
|
|
76
|
+
}
|
|
77
|
+
const s = style(io);
|
|
78
|
+
if (name) {
|
|
79
|
+
const flow = mod.readFlow(id, name, io.env);
|
|
80
|
+
if (bool(p, "json")) {
|
|
81
|
+
io.out(JSON.stringify({ schemaVersion: 1, ...flow }, null, 2));
|
|
82
|
+
return Exit.ok;
|
|
83
|
+
}
|
|
84
|
+
io.out(s.bold(`${flow.name}`) + (flow.description ? ` ${s.muted(flow.description)}` : ""));
|
|
85
|
+
for (const [i, step] of flow.steps.entries())
|
|
86
|
+
io.out(` ${String(i + 1).padStart(2)}. ${stepLine(step)}`);
|
|
87
|
+
if (flow.params.length) {
|
|
88
|
+
io.out("");
|
|
89
|
+
io.out(s.header("Parameters"));
|
|
90
|
+
for (const param of flow.params)
|
|
91
|
+
io.out(` ${param.name} ${s.muted(param.sensitive ? "sensitive: give it at replay (keychain:<item>)" : param.default !== undefined ? "has a default" : "required")}`);
|
|
92
|
+
}
|
|
93
|
+
return Exit.ok;
|
|
94
|
+
}
|
|
95
|
+
const list = mod.listFlows(id, io.env);
|
|
96
|
+
if (bool(p, "json")) {
|
|
97
|
+
emit(io, p, FLOWS_JSON, list.map((f) => ({ ...f, file: tildify(f.file, io.env) })));
|
|
98
|
+
return Exit.ok;
|
|
99
|
+
}
|
|
100
|
+
if (!list.length) {
|
|
101
|
+
io.out(`No saved flows for "${id}". An agent records one with the browser_record tool.`);
|
|
102
|
+
return Exit.ok;
|
|
103
|
+
}
|
|
104
|
+
const head = ["flow", "steps", "params", "updated"].map((h) => s.muted(h));
|
|
105
|
+
const rows = list.map((f) => [
|
|
106
|
+
f.auto ? s.muted(f.name) : f.name,
|
|
107
|
+
String(f.steps),
|
|
108
|
+
f.params.map((x) => `${x.name}${x.sensitive ? "*" : ""}`).join(", ") || "-",
|
|
109
|
+
f.updated.slice(0, 16).replace("T", " "),
|
|
110
|
+
]);
|
|
111
|
+
for (const l of s.table([head, ...rows], { columns: [{}, { align: "right" }, {}, { drop: 1 }] }))
|
|
112
|
+
io.out(l);
|
|
113
|
+
if (list.some((f) => f.params.some((x) => x.sensitive)))
|
|
114
|
+
io.out(s.muted("* sensitive: no value is saved"));
|
|
115
|
+
return Exit.ok;
|
|
116
|
+
}
|
|
117
|
+
const REPLAY_FLAGS = {
|
|
118
|
+
param: { type: "string", multiple: true },
|
|
119
|
+
from: { type: "string" },
|
|
120
|
+
headless: { type: "boolean" },
|
|
121
|
+
...JSON_FLAG,
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Runs a saved flow through turno-browser-mcp on the identity. A sensitive parameter on the
|
|
125
|
+
* command line must be a `keychain:<item>` reference (a value would sit in the shell history and
|
|
126
|
+
* the process list); on a terminal a missing one is asked for, hidden.
|
|
127
|
+
*/
|
|
128
|
+
export async function replay(c, args, io) {
|
|
129
|
+
const mod = c.api;
|
|
130
|
+
const input = c.deps.input ?? terminalInput;
|
|
131
|
+
const p = parseFlags(args, REPLAY_FLAGS, 2);
|
|
132
|
+
const id = needIdentity(c, p.positionals[0], "replay", io);
|
|
133
|
+
const name = p.positionals[1];
|
|
134
|
+
if (!name)
|
|
135
|
+
return fail(`usage: ${c.names.browser} replay <id> <flow> [--param name=value]... [--from <step>] [--headless]`);
|
|
136
|
+
const flow = mod.readFlow(id, name, io.env);
|
|
137
|
+
const params = {};
|
|
138
|
+
for (const pair of p.values.param ?? []) {
|
|
139
|
+
const eq = pair.indexOf("=");
|
|
140
|
+
if (eq <= 0)
|
|
141
|
+
return fail(`--param takes name=value, not "${pair}"`);
|
|
142
|
+
params[pair.slice(0, eq)] = pair.slice(eq + 1);
|
|
143
|
+
}
|
|
144
|
+
for (const param of flow.params) {
|
|
145
|
+
const given = params[param.name];
|
|
146
|
+
if (param.sensitive && given !== undefined && !given.startsWith("keychain:"))
|
|
147
|
+
return fail(`"${param.name}" is sensitive: pass it as --param ${param.name}=keychain:<item> (${c.names.secretSet("<item>")}), not as a value on the command line`);
|
|
148
|
+
if (param.sensitive && given === undefined) {
|
|
149
|
+
if (!input.isTty() || noInputReason(io.env))
|
|
150
|
+
needsAnswer(`browser replay (parameter ${param.name})`, `--param ${param.name}=keychain:<item>`);
|
|
151
|
+
params[param.name] = await input.hidden(`${param.name} (input hidden): `);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const from = str(p, "from");
|
|
155
|
+
if (from !== undefined && !/^\d+$/.test(from))
|
|
156
|
+
return fail(`--from takes a step number, not "${from}"`);
|
|
157
|
+
const holder = mod.inUseBy(id, io.env);
|
|
158
|
+
if (holder)
|
|
159
|
+
return fail(holder);
|
|
160
|
+
const result = await mod.replayFlow(id, name, {
|
|
161
|
+
params,
|
|
162
|
+
...(from ? { from: Number(from) } : {}),
|
|
163
|
+
headless: bool(p, "headless"),
|
|
164
|
+
env: io.env,
|
|
165
|
+
});
|
|
166
|
+
if (bool(p, "json")) {
|
|
167
|
+
emit(io, p, REPLAY_JSON, { identity: `browser:${id}`, flow: name, ok: result.ok, report: result.text });
|
|
168
|
+
return result.ok ? Exit.ok : Exit.failure;
|
|
169
|
+
}
|
|
170
|
+
const text = result.text.replace(/^### /gm, "");
|
|
171
|
+
if (result.ok)
|
|
172
|
+
io.out(text);
|
|
173
|
+
else
|
|
174
|
+
io.err(text);
|
|
175
|
+
return result.ok ? Exit.ok : Exit.failure;
|
|
176
|
+
}
|
|
177
|
+
const TRACES_FLAGS = { open: { type: "boolean" }, segment: { type: "string" }, ...JSON_FLAG };
|
|
178
|
+
export async function traces(c, args, io) {
|
|
179
|
+
const mod = c.api;
|
|
180
|
+
const p = parseFlags(args, TRACES_FLAGS, 2);
|
|
181
|
+
const id = needIdentity(c, p.positionals[0], "traces", io);
|
|
182
|
+
const wanted = p.positionals[1];
|
|
183
|
+
const list = mod.listRecordings(id, io.env);
|
|
184
|
+
const s = style(io);
|
|
185
|
+
if (bool(p, "open")) {
|
|
186
|
+
const rec = wanted ? list.find((r) => r.name === wanted) : list.find((r) => r.traces.length);
|
|
187
|
+
if (!rec)
|
|
188
|
+
return fail(wanted ? `identity "${id}" has no recording "${wanted}"` : `identity "${id}" has no traces yet`);
|
|
189
|
+
if (!rec.traces.length)
|
|
190
|
+
return fail(`recording "${rec.name}" has no trace (screenshots are in ${tildify(rec.dir, io.env)})`);
|
|
191
|
+
const segment = str(p, "segment");
|
|
192
|
+
const n = segment === undefined ? rec.traces.length : Number(segment);
|
|
193
|
+
const trace = rec.traces[n - 1];
|
|
194
|
+
if (!trace || !Number.isInteger(n))
|
|
195
|
+
return fail(`--segment takes 1 to ${rec.traces.length} for recording "${rec.name}"`);
|
|
196
|
+
const { command, args: viewer } = mod.traceViewerCommand(trace.file);
|
|
197
|
+
io.err(s.muted(`opening ${tildify(trace.file, io.env)} in the trace viewer; press Ctrl-C to stop it`));
|
|
198
|
+
io.err(s.muted(`(the same by hand: ${[command, ...viewer].map((a) => (/\s/.test(a) ? `"${a}"` : a)).join(" ")})`));
|
|
199
|
+
return (await mod.openTraceViewer(trace.file, io.env)) === 0 ? Exit.ok : Exit.failure;
|
|
200
|
+
}
|
|
201
|
+
const shown = wanted ? list.filter((r) => r.name === wanted) : list;
|
|
202
|
+
if (wanted && !shown.length)
|
|
203
|
+
return fail(`identity "${id}" has no recording "${wanted}"`);
|
|
204
|
+
if (bool(p, "json")) {
|
|
205
|
+
emit(io, p, TRACES_JSON, shown.map((r) => ({
|
|
206
|
+
...r,
|
|
207
|
+
dir: tildify(r.dir, io.env),
|
|
208
|
+
ended: r.ended ?? null,
|
|
209
|
+
traces: r.traces.map((t) => ({ ...t, file: tildify(t.file, io.env) })),
|
|
210
|
+
})));
|
|
211
|
+
return Exit.ok;
|
|
212
|
+
}
|
|
213
|
+
if (!shown.length) {
|
|
214
|
+
io.out(`No recordings for "${id}". Turn them on with: ${c.names.browser} record ${id} --traces --screenshots (they start with the next Chrome)`);
|
|
215
|
+
return Exit.ok;
|
|
216
|
+
}
|
|
217
|
+
for (const [i, r] of shown.entries()) {
|
|
218
|
+
if (i)
|
|
219
|
+
io.out("");
|
|
220
|
+
io.out(`${s.bold(r.name)} ${s.muted(`${r.title}, ${r.started.slice(0, 19).replace("T", " ")}${r.ended ? "" : " (open or cut short)"}`)}`);
|
|
221
|
+
io.out(` ${r.steps} step${r.steps === 1 ? "" : "s"}, ${r.screenshots} screenshot${r.screenshots === 1 ? "" : "s"}, ${r.traces.length} trace${r.traces.length === 1 ? "" : "s"}, ${size(r.bytes)} ${s.muted(tildify(r.dir, io.env))}`);
|
|
222
|
+
for (const [n, t] of r.traces.entries())
|
|
223
|
+
io.out(` ${s.muted(`trace ${n + 1}:`)} ${tildify(t.file, io.env)} ${s.muted(`(steps ${t.from}-${t.to}, ${size(t.bytes)})`)}`);
|
|
224
|
+
for (const note of r.notes)
|
|
225
|
+
io.out(s.note("info", note, 2));
|
|
226
|
+
}
|
|
227
|
+
io.out("");
|
|
228
|
+
io.out(s.muted(`Open a trace: ${c.names.browser} traces ${id} [<recording>] --open [--segment <n>]`));
|
|
229
|
+
return Exit.ok;
|
|
230
|
+
}
|
|
231
|
+
const RECORD_FLAGS = {
|
|
232
|
+
flows: { type: "boolean" },
|
|
233
|
+
traces: { type: "boolean" },
|
|
234
|
+
screenshots: { type: "boolean" },
|
|
235
|
+
"max-size": { type: "string" },
|
|
236
|
+
off: { type: "boolean" },
|
|
237
|
+
...DRY_RUN,
|
|
238
|
+
...JSON_FLAG,
|
|
239
|
+
};
|
|
240
|
+
/** `record <id>`: what the identity records, and turning it on or off. */
|
|
241
|
+
export function record(c, args, io) {
|
|
242
|
+
const mod = c.api;
|
|
243
|
+
const p = parseFlags(args, RECORD_FLAGS, 1);
|
|
244
|
+
const id = needIdentity(c, p.positionals[0], "record", io);
|
|
245
|
+
const current = mod.checkIdentitySettings(id, io.env).settings?.record;
|
|
246
|
+
const on = ["flows", "traces", "screenshots"].filter((k) => bool(p, k));
|
|
247
|
+
const maxSize = str(p, "max-size");
|
|
248
|
+
const off = bool(p, "off");
|
|
249
|
+
if (off && (on.length || maxSize !== undefined))
|
|
250
|
+
return fail("--off does not go with --flows, --traces, --screenshots or --max-size");
|
|
251
|
+
const dryRun = bool(p, "dry-run");
|
|
252
|
+
let next = current;
|
|
253
|
+
if (off || on.length || maxSize !== undefined) {
|
|
254
|
+
const patch = off
|
|
255
|
+
? { record: null }
|
|
256
|
+
: {
|
|
257
|
+
record: {
|
|
258
|
+
...current,
|
|
259
|
+
...Object.fromEntries(on.map((k) => [k, true])),
|
|
260
|
+
...(maxSize !== undefined ? { maxSize } : {}),
|
|
261
|
+
},
|
|
262
|
+
};
|
|
263
|
+
if (!dryRun) {
|
|
264
|
+
try {
|
|
265
|
+
next = mod.writeIdentitySettings(id, patch, io.env).record;
|
|
266
|
+
}
|
|
267
|
+
catch (err) {
|
|
268
|
+
if (err.name === "IdentityError")
|
|
269
|
+
return fail(err.message.replace(/^identity "[^"]*": /, "").replace(/record\.maxSize/, "--max-size"));
|
|
270
|
+
throw err;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
else
|
|
274
|
+
next = patch.record ?? undefined;
|
|
275
|
+
}
|
|
276
|
+
const flowsDir = mod.flowsDir(id, io.env);
|
|
277
|
+
const recordingsDir = mod.recordingsDir(id, io.env);
|
|
278
|
+
if (bool(p, "json")) {
|
|
279
|
+
emit(io, p, RECORD_JSON, {
|
|
280
|
+
id: `browser:${id}`,
|
|
281
|
+
dryRun,
|
|
282
|
+
record: next ?? null,
|
|
283
|
+
flowsDir: tildify(flowsDir, io.env),
|
|
284
|
+
recordingsDir: tildify(recordingsDir, io.env),
|
|
285
|
+
});
|
|
286
|
+
return Exit.ok;
|
|
287
|
+
}
|
|
288
|
+
const s = style(io);
|
|
289
|
+
if (dryRun)
|
|
290
|
+
io.out(`(dry run) would set record of "${id}" to ${JSON.stringify(next ?? null)}`);
|
|
291
|
+
else if (off || on.length || maxSize !== undefined)
|
|
292
|
+
io.out(`updated identity.json of "${id}"; the next Chrome start of browser-${id} uses it`);
|
|
293
|
+
const rows = [
|
|
294
|
+
["records", describeRecord(next) ?? s.muted("nothing (the agent can still record a flow with browser_record)")],
|
|
295
|
+
["flows", tildify(flowsDir, io.env)],
|
|
296
|
+
["recordings", tildify(recordingsDir, io.env)],
|
|
297
|
+
];
|
|
298
|
+
const width = Math.max(...rows.map(([k]) => k.length));
|
|
299
|
+
for (const [k, v] of rows)
|
|
300
|
+
io.out(s.kv(k, v, width));
|
|
301
|
+
return Exit.ok;
|
|
302
|
+
}
|
|
303
|
+
//# sourceMappingURL=flows.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type FlagSpec, type Io, type Parsed } from "turno-core/cli";
|
|
2
|
+
import type { BrowserFunctions } from "../api.js";
|
|
3
|
+
import type { CliNames, Ctx } from "./context.js";
|
|
4
|
+
/** `show --json` (`turno identity show browser:<id> --json` in turno). */
|
|
5
|
+
export declare const SHOW_JSON: import("turno-core/cli").JsonOutput;
|
|
6
|
+
/** `set --json`: what changed, or would. */
|
|
7
|
+
export declare const SET_JSON: import("turno-core/cli").JsonOutput;
|
|
8
|
+
/** `doctor --json`: the shape of `turno doctor --json`. */
|
|
9
|
+
export declare const DOCTOR_JSON: import("turno-core/cli").JsonOutput;
|
|
10
|
+
/** `reputation --json`: one element per identity. */
|
|
11
|
+
export declare const REPUTATION_JSON: import("turno-core/cli").JsonOutput;
|
|
12
|
+
/**
|
|
13
|
+
* identity.json in the CLI (`show`, `set`, the settings flags of `add`), `doctor` and
|
|
14
|
+
* `reputation`. The functions come through `Ctx.api`, so tests can pass fakes.
|
|
15
|
+
*/
|
|
16
|
+
type IdentitySettings = NonNullable<ReturnType<BrowserFunctions["checkIdentitySettings"]>["settings"]>;
|
|
17
|
+
type RecordSettings = NonNullable<IdentitySettings["record"]>;
|
|
18
|
+
type SettingsPatch = Parameters<BrowserFunctions["writeIdentitySettings"]>[1];
|
|
19
|
+
/** Flags that write identity.json, shared by `add` and `set`. An empty value removes the key. */
|
|
20
|
+
export declare const SETTINGS_FLAGS: FlagSpec;
|
|
21
|
+
export declare const SETTINGS_FLAG_NAMES: string[];
|
|
22
|
+
/** The identity.json change the flags ask for; `current` fills the parts of health not given. */
|
|
23
|
+
export declare function settingsPatch(p: Parsed, current?: IdentitySettings): SettingsPatch;
|
|
24
|
+
/** What an identity records, in a few words: "flows, traces (up to 200MB)". */
|
|
25
|
+
export declare function describeRecord(r: RecordSettings | undefined): string | undefined;
|
|
26
|
+
export declare function hasSettings(patch: SettingsPatch): boolean;
|
|
27
|
+
export declare function show(c: Ctx, id: string, args: string[], io: Io): number;
|
|
28
|
+
/** The arguments of `set` after the identity, for the usage line. */
|
|
29
|
+
export declare const SET_SYNOPSIS: string;
|
|
30
|
+
/** More help for `set`: what each tuning flag writes to identity.json, with the host's command names. */
|
|
31
|
+
export declare function setDetails(n: CliNames): string;
|
|
32
|
+
/** The flags of `set`, for completion. */
|
|
33
|
+
export declare const SET_FLAG_NAMES: string[];
|
|
34
|
+
export declare function set(c: Ctx, id: string, args: string[], io: Io): number;
|
|
35
|
+
export declare function doctor(c: Ctx, args: string[], io: Io): Promise<number>;
|
|
36
|
+
export declare function reputation(c: Ctx, args: string[], io: Io, checkId: (id: string) => string): number;
|
|
37
|
+
export {};
|