@tiny-fish/cli 0.25.2-next.220 → 0.25.2-next.221
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 +19 -0
- package/dist/commands/connect.js +19 -2
- package/dist/lib/connect-all.d.ts +2 -0
- package/dist/lib/connect-all.js +40 -16
- package/dist/lib/connect-picker.d.ts +16 -0
- package/dist/lib/connect-picker.js +136 -0
- package/dist/lib/harness-detect.d.ts +1 -0
- package/dist/lib/harness-detect.js +9 -0
- package/dist/lib/setup-telemetry.d.ts +7 -1
- package/dist/lib/setup-telemetry.js +8 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,25 @@ npm install -g @tiny-fish/cli
|
|
|
10
10
|
|
|
11
11
|
Requires Node.js 24+.
|
|
12
12
|
|
|
13
|
+
### Connect your agents
|
|
14
|
+
|
|
15
|
+
The recommended way in: run `connect` with no arguments.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx -y @tiny-fish/cli@latest connect
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
It detects the agent configs on your machine (Claude Code, Codex, Cursor, Grok, Hermes,
|
|
22
|
+
OpenClaw, OpenCode) and opens a checklist with everything pre-selected. Press enter to connect
|
|
23
|
+
them all, or use the arrow keys and space to narrow the set first; `q` cancels without touching
|
|
24
|
+
anything. Terminals without raw-key support get a numbered prompt instead.
|
|
25
|
+
|
|
26
|
+
Without a terminal (agents, CI), bare `connect` behaves exactly like `tinyfish connect --all`
|
|
27
|
+
and says so on its first line: every detected harness that can authenticate headlessly (via
|
|
28
|
+
`TINYFISH_API_KEY` or `--api-key`) is connected, the rest are skipped with a fix command.
|
|
29
|
+
`tinyfish connect --all` itself is unchanged and skips the picker; `--dry-run`, `--uninstall`
|
|
30
|
+
and `--skip-launch` still require it.
|
|
31
|
+
|
|
13
32
|
### Connect Claude Code
|
|
14
33
|
|
|
15
34
|
Add TinyFish MCP and the global `use-tinyfish` web skill, authenticate the CLI, and start the
|
package/dist/commands/connect.js
CHANGED
|
@@ -417,7 +417,7 @@ export function registerConnect(program) {
|
|
|
417
417
|
program
|
|
418
418
|
.command("connect")
|
|
419
419
|
.description("Connect TinyFish to an AI agent")
|
|
420
|
-
.argument("[client]", "Agent client to connect (claude-code, codex, cursor, grok, hermes, openclaw, or opencode)")
|
|
420
|
+
.argument("[client]", "Agent client to connect (claude-code, codex, cursor, grok, hermes, openclaw, or opencode); omit to pick from the agents detected on this machine")
|
|
421
421
|
.option("--all", "Detect and connect every supported harness found on this machine")
|
|
422
422
|
.option("--dry-run", "Print planned writes per harness without touching anything (--all only)")
|
|
423
423
|
.option("--uninstall", "Remove TinyFish entries written by connect --all")
|
|
@@ -476,7 +476,24 @@ export function registerConnect(program) {
|
|
|
476
476
|
throw new Error("--dry-run, --uninstall and --skip-launch are only supported with --all.");
|
|
477
477
|
}
|
|
478
478
|
if (!client) {
|
|
479
|
-
|
|
479
|
+
if (options.launch) {
|
|
480
|
+
throw new Error("--launch is not supported with --all. Connect a single client to launch it.");
|
|
481
|
+
}
|
|
482
|
+
const humanInitiated = detectHumanInitiated();
|
|
483
|
+
if (!humanInitiated) {
|
|
484
|
+
errLine("No terminal detected: connecting every detected harness (same as tinyfish connect --all).");
|
|
485
|
+
}
|
|
486
|
+
const exitCode = await runConnectAll({
|
|
487
|
+
apiKey: options.apiKey,
|
|
488
|
+
mcpUrl,
|
|
489
|
+
dryRun: false,
|
|
490
|
+
uninstall: false,
|
|
491
|
+
pick: humanInitiated,
|
|
492
|
+
});
|
|
493
|
+
// Preserve the 130 runGuarded set on Ctrl+C.
|
|
494
|
+
if (!process.exitCode)
|
|
495
|
+
process.exitCode = exitCode;
|
|
496
|
+
return;
|
|
480
497
|
}
|
|
481
498
|
const connectOptions = {
|
|
482
499
|
apiKey: options.apiKey,
|
|
@@ -5,5 +5,7 @@ export interface ConnectAllOptions {
|
|
|
5
5
|
uninstall: boolean;
|
|
6
6
|
/** Skip the end-of-install agent launch (finale still prints the ask). */
|
|
7
7
|
noLaunch?: boolean;
|
|
8
|
+
/** Bare connect: offer the checkbox picker over the detected harnesses. */
|
|
9
|
+
pick?: boolean;
|
|
8
10
|
}
|
|
9
11
|
export declare function runConnectAll(opts: ConnectAllOptions): Promise<number>;
|
package/dist/lib/connect-all.js
CHANGED
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
import * as readline from "node:readline/promises";
|
|
2
2
|
import spawn from "cross-spawn";
|
|
3
3
|
import { connectClaudeCode, connectCodex, connectCursor, connectGrok, connectHermes, connectOpenClaw, connectOpencode, } from "../commands/connect.js";
|
|
4
|
-
import { validatedApiKey } from "./auth.js";
|
|
4
|
+
import { loadConfig, validatedApiKey } from "./auth.js";
|
|
5
5
|
import { installTinyFishCli, } from "./cli-install.js";
|
|
6
6
|
import { NATIVE_MCP_CLIENTS } from "./connect-clients.js";
|
|
7
7
|
import { ensureCliAuthenticated, TINYFISH_CLI_NOT_FOUND_MESSAGE } from "./connect-auth.js";
|
|
8
8
|
import { commandNotFound, ConnectInterruptedError, ConnectStepError, finishSetupCommand, throwIfInterrupted, } from "./connect-runtime.js";
|
|
9
|
-
import {
|
|
9
|
+
import { pickHarnesses } from "./connect-picker.js";
|
|
10
|
+
import { commandOnPath, detectInstalledHarnesses, HARNESS_COMMANDS, HARNESS_DISPLAY_NAMES as DISPLAY_NAMES, ALL_HARNESSES, } from "./harness-detect.js";
|
|
10
11
|
import { detectHumanInitiated } from "./harness.js";
|
|
11
12
|
import { emitNotice } from "./notice.js";
|
|
12
13
|
import { removeCursorMcpServer, planCursorWrite } from "./cursor-config.js";
|
|
13
14
|
import { errLine, outLine } from "./output.js";
|
|
14
15
|
import { sendSetupCompleted } from "./setup-telemetry.js";
|
|
15
16
|
import { verifyMcpAuth, verifyMcpHealth } from "./verify.js";
|
|
16
|
-
const DISPLAY_NAMES = {
|
|
17
|
-
"claude-code": "Claude Code",
|
|
18
|
-
codex: "Codex",
|
|
19
|
-
cursor: "Cursor",
|
|
20
|
-
grok: "Grok",
|
|
21
|
-
hermes: "Hermes",
|
|
22
|
-
openclaw: "OpenClaw",
|
|
23
|
-
opencode: "OpenCode",
|
|
24
|
-
};
|
|
25
17
|
// `codex mcp add` succeeds unauthenticated; OAuth lands at first tool use.
|
|
26
18
|
// TODO(PF-3580): connect now probes Codex sign-in, so this over-warns a signed-in install.
|
|
27
19
|
const AUTH_DEFERRED_AT_INSTALL = new Set(["codex"]);
|
|
@@ -241,6 +233,9 @@ function summaryLine(result, uninstall) {
|
|
|
241
233
|
: "no stored credentials and no terminal to sign in";
|
|
242
234
|
return `… ${name} — skipped, ${why}. Fix: ${result.fixCommand}`;
|
|
243
235
|
}
|
|
236
|
+
if (result.outcome === "deselected") {
|
|
237
|
+
return `… ${name} — skipped, not selected. Fix: ${result.fixCommand}`;
|
|
238
|
+
}
|
|
244
239
|
if (result.outcome === "uninstall_pointer") {
|
|
245
240
|
return `… ${name} — not removed automatically (config is owned by ${name}). Run: ${result.fixCommand}`;
|
|
246
241
|
}
|
|
@@ -384,9 +379,26 @@ export async function runConnectAll(opts) {
|
|
|
384
379
|
}
|
|
385
380
|
: undefined;
|
|
386
381
|
const detections = detectInstalledHarnesses();
|
|
382
|
+
let deselected = new Set();
|
|
383
|
+
let mode = "all";
|
|
384
|
+
// Before willAttempt/cliNeeded: a cursor-only pick must not hoist the CLI.
|
|
385
|
+
// A stale config dir has no binary to connect, so never offer it as a choice.
|
|
386
|
+
const offerable = detections.filter((d) => d.detected && !isStaleConfig(d));
|
|
387
|
+
if (opts.pick && offerable.length > 0) {
|
|
388
|
+
const connected = new Set(Object.keys(loadConfig().connect ?? {}));
|
|
389
|
+
const pick = await pickHarnesses(offerable, connected, { prompt });
|
|
390
|
+
mode = pick.mode;
|
|
391
|
+
if (pick.selection === "cancel") {
|
|
392
|
+
// Before summary and telemetry: an explicit nothing is not a setup.
|
|
393
|
+
outLine("Nothing installed. Run: tinyfish connect --all or tinyfish connect <client>");
|
|
394
|
+
return 0;
|
|
395
|
+
}
|
|
396
|
+
const chosen = new Set(pick.selection);
|
|
397
|
+
deselected = new Set(offerable.filter((d) => !chosen.has(d.harness)).map((d) => d.harness));
|
|
398
|
+
}
|
|
387
399
|
const gateKey = validatedApiKey(opts.apiKey);
|
|
388
400
|
// Mirrors processHarness's skip gate: a skipped harness installs nothing today.
|
|
389
|
-
const willAttempt = (harness) => isTTY || (!!gateKey && KEY_AUTH_CAPABLE.has(harness));
|
|
401
|
+
const willAttempt = (harness) => !deselected.has(harness) && (isTTY || (!!gateKey && KEY_AUTH_CAPABLE.has(harness)));
|
|
390
402
|
// Machine-global, so once per invocation; cursor's connect never installs it.
|
|
391
403
|
const cliNeeded = !opts.dryRun &&
|
|
392
404
|
!opts.uninstall &&
|
|
@@ -408,9 +420,21 @@ export async function runConnectAll(opts) {
|
|
|
408
420
|
};
|
|
409
421
|
}
|
|
410
422
|
const results = [];
|
|
411
|
-
|
|
423
|
+
const stepTotal = detections.length - deselected.size;
|
|
424
|
+
let step = 0;
|
|
425
|
+
for (const detection of detections) {
|
|
412
426
|
const { harness } = detection;
|
|
413
|
-
|
|
427
|
+
if (deselected.has(harness)) {
|
|
428
|
+
results.push({
|
|
429
|
+
...detection,
|
|
430
|
+
installed: false,
|
|
431
|
+
outcome: "deselected",
|
|
432
|
+
fixCommand: `tinyfish connect ${harness}`,
|
|
433
|
+
});
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
step += 1;
|
|
437
|
+
errLine(`step ${step} of ${stepTotal} — ${DISPLAY_NAMES[harness]}`);
|
|
414
438
|
let result;
|
|
415
439
|
try {
|
|
416
440
|
result = await processHarness(detection, opts, prompt, takeHoistedCli);
|
|
@@ -432,7 +456,7 @@ export async function runConnectAll(opts) {
|
|
|
432
456
|
if (result.outcome === "interrupted")
|
|
433
457
|
break;
|
|
434
458
|
}
|
|
435
|
-
// The interrupt break truncates `results`; pad so the
|
|
459
|
+
// The interrupt break truncates `results`; pad so the one-row-per-harness schema still parses.
|
|
436
460
|
for (const detection of detections) {
|
|
437
461
|
if (results.some((r) => r.harness === detection.harness))
|
|
438
462
|
continue;
|
|
@@ -483,7 +507,7 @@ export async function runConnectAll(opts) {
|
|
|
483
507
|
verify_depth: r.verifyDepth ?? null,
|
|
484
508
|
verify_ok: r.verifyOk ?? null,
|
|
485
509
|
}));
|
|
486
|
-
await sendSetupCompleted(opts.mcpUrl, harnessTelemetry, validatedApiKey(opts.apiKey));
|
|
510
|
+
await sendSetupCompleted(opts.mcpUrl, harnessTelemetry, validatedApiKey(opts.apiKey), mode);
|
|
487
511
|
// After the summary and before the launch, which is where the user is reading.
|
|
488
512
|
emitNotice();
|
|
489
513
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Readable } from "node:stream";
|
|
2
|
+
import { type Harness, type HarnessDetection } from "./harness-detect.js";
|
|
3
|
+
export type PickSelection = Harness[] | "cancel";
|
|
4
|
+
export interface PickResult {
|
|
5
|
+
selection: PickSelection;
|
|
6
|
+
mode: "pick" | "pick_numeric";
|
|
7
|
+
}
|
|
8
|
+
export type PickerStdin = Readable & {
|
|
9
|
+
setRawMode?: (raw: boolean) => unknown;
|
|
10
|
+
};
|
|
11
|
+
export interface PickerIo {
|
|
12
|
+
stdin?: PickerStdin;
|
|
13
|
+
write?: (text: string) => void;
|
|
14
|
+
prompt?: (question: string) => Promise<string>;
|
|
15
|
+
}
|
|
16
|
+
export declare function pickHarnesses(detections: HarnessDetection[], connectedBefore: ReadonlySet<string>, io?: PickerIo): Promise<PickResult>;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import * as readline from "node:readline";
|
|
2
|
+
import { HARNESS_DISPLAY_NAMES } from "./harness-detect.js";
|
|
3
|
+
const KEY_HELP = " ↑↓ move space toggle one a none/all q cancel";
|
|
4
|
+
function header(count) {
|
|
5
|
+
return `Found ${count} agent config${count === 1 ? "" : "s"} on this machine.\n\n`;
|
|
6
|
+
}
|
|
7
|
+
function connectedNote(item) {
|
|
8
|
+
return item.connectedBefore ? " (previously connected)" : "";
|
|
9
|
+
}
|
|
10
|
+
function enterHint(checkedCount, total) {
|
|
11
|
+
if (checkedCount === 0)
|
|
12
|
+
return "press enter to cancel";
|
|
13
|
+
if (checkedCount === total)
|
|
14
|
+
return `press enter to connect all ${total}`;
|
|
15
|
+
return `press enter to connect ${checkedCount} of ${total}`;
|
|
16
|
+
}
|
|
17
|
+
function frame(items, checked, cursor) {
|
|
18
|
+
const rows = items.map((item, i) => ` ${i === cursor ? ">" : " "} [${checked[i] ? "x" : " "}] ${item.name}${connectedNote(item)}`);
|
|
19
|
+
const count = checked.filter(Boolean).length;
|
|
20
|
+
return [...rows, "", ` ${enterHint(count, items.length)}`, KEY_HELP, ""].join("\n");
|
|
21
|
+
}
|
|
22
|
+
async function pickWithKeys(items, stdin, write) {
|
|
23
|
+
const checked = items.map(() => true);
|
|
24
|
+
let cursor = 0;
|
|
25
|
+
let painted = 0;
|
|
26
|
+
const paint = () => {
|
|
27
|
+
const text = frame(items, checked, cursor);
|
|
28
|
+
write((painted > 0 ? `\u001b[${painted}A\u001b[0J` : "") + text);
|
|
29
|
+
painted = items.length + 3;
|
|
30
|
+
};
|
|
31
|
+
readline.emitKeypressEvents(stdin);
|
|
32
|
+
stdin.setRawMode(true);
|
|
33
|
+
stdin.resume();
|
|
34
|
+
let onKeypress;
|
|
35
|
+
try {
|
|
36
|
+
write(header(items.length));
|
|
37
|
+
paint();
|
|
38
|
+
return await new Promise((resolve, reject) => {
|
|
39
|
+
onKeypress = (_chunk, key = {}) => {
|
|
40
|
+
try {
|
|
41
|
+
const name = key.name ?? "";
|
|
42
|
+
// Raw mode eats terminal SIGINT, so Ctrl+C arrives only here.
|
|
43
|
+
if ((key.ctrl && (name === "c" || name === "d")) || name === "q" || name === "escape") {
|
|
44
|
+
resolve("cancel");
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (name === "return" || name === "enter") {
|
|
48
|
+
const picked = items.filter((_, i) => checked[i]).map((item) => item.harness);
|
|
49
|
+
resolve(picked.length > 0 ? picked : "cancel");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (name === "up" || name === "k")
|
|
53
|
+
cursor = (cursor + items.length - 1) % items.length;
|
|
54
|
+
else if (name === "down" || name === "j")
|
|
55
|
+
cursor = (cursor + 1) % items.length;
|
|
56
|
+
else if (name === "space")
|
|
57
|
+
checked[cursor] = !checked[cursor];
|
|
58
|
+
else if (name === "a")
|
|
59
|
+
checked.fill(!checked.every(Boolean));
|
|
60
|
+
paint();
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
reject(error instanceof Error ? error : new Error(String(error)));
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
stdin.on("keypress", onKeypress);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
// Restore before any child spawn can inherit raw stdin (PF-3635).
|
|
71
|
+
if (onKeypress)
|
|
72
|
+
stdin.removeListener("keypress", onKeypress);
|
|
73
|
+
stdin.setRawMode(false);
|
|
74
|
+
stdin.pause();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function numberedRows(items) {
|
|
78
|
+
return (items.map((item, i) => ` [${i + 1}] ${item.name}${connectedNote(item)}`).join("\n") + "\n");
|
|
79
|
+
}
|
|
80
|
+
function parseSubset(answer, items) {
|
|
81
|
+
const tokens = answer.split(/[\s,]+/).filter(Boolean);
|
|
82
|
+
if (tokens.length === 0)
|
|
83
|
+
return undefined;
|
|
84
|
+
const picked = new Set();
|
|
85
|
+
for (const token of tokens) {
|
|
86
|
+
if (!/^\d+$/.test(token))
|
|
87
|
+
return undefined;
|
|
88
|
+
const index = Number.parseInt(token, 10);
|
|
89
|
+
if (index < 1 || index > items.length)
|
|
90
|
+
return undefined;
|
|
91
|
+
picked.add(index - 1);
|
|
92
|
+
}
|
|
93
|
+
return items.filter((_, i) => picked.has(i)).map((item) => item.harness);
|
|
94
|
+
}
|
|
95
|
+
async function pickWithNumbers(items, prompt, write) {
|
|
96
|
+
write(header(items.length) + numberedRows(items));
|
|
97
|
+
const question = `Press enter to connect all ${items.length}, numbers for a subset (e.g. 1,3), or n to cancel: `;
|
|
98
|
+
// One re-prompt on garbage, then cancel; never a loop.
|
|
99
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
100
|
+
let answer;
|
|
101
|
+
try {
|
|
102
|
+
answer = (await prompt(question)).trim();
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
// Closed stdin: every later question would throw too.
|
|
106
|
+
return "cancel";
|
|
107
|
+
}
|
|
108
|
+
if (answer === "")
|
|
109
|
+
return items.map((item) => item.harness);
|
|
110
|
+
if (/^[nq]$/i.test(answer))
|
|
111
|
+
return "cancel";
|
|
112
|
+
const subset = parseSubset(answer, items);
|
|
113
|
+
if (subset)
|
|
114
|
+
return subset;
|
|
115
|
+
}
|
|
116
|
+
return "cancel";
|
|
117
|
+
}
|
|
118
|
+
export async function pickHarnesses(detections, connectedBefore, io = {}) {
|
|
119
|
+
const items = detections
|
|
120
|
+
.filter((detection) => detection.detected)
|
|
121
|
+
.map((detection) => ({
|
|
122
|
+
harness: detection.harness,
|
|
123
|
+
name: HARNESS_DISPLAY_NAMES[detection.harness],
|
|
124
|
+
connectedBefore: connectedBefore.has(detection.harness),
|
|
125
|
+
}));
|
|
126
|
+
const stdin = io.stdin ?? process.stdin;
|
|
127
|
+
const write = io.write ?? ((text) => void process.stderr.write(text));
|
|
128
|
+
if (typeof stdin.setRawMode !== "function") {
|
|
129
|
+
// No prompt means nothing to ask; keep --all semantics.
|
|
130
|
+
const selection = io.prompt
|
|
131
|
+
? await pickWithNumbers(items, io.prompt, write)
|
|
132
|
+
: items.map((item) => item.harness);
|
|
133
|
+
return { selection, mode: "pick_numeric" };
|
|
134
|
+
}
|
|
135
|
+
return { selection: await pickWithKeys(items, stdin, write), mode: "pick" };
|
|
136
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const ALL_HARNESSES: readonly ["claude-code", "codex", "cursor", "grok", "hermes", "openclaw", "opencode"];
|
|
2
2
|
export type Harness = (typeof ALL_HARNESSES)[number];
|
|
3
|
+
export declare const HARNESS_DISPLAY_NAMES: Record<Harness, string>;
|
|
3
4
|
export declare enum Registered {
|
|
4
5
|
Yes = "yes",
|
|
5
6
|
No = "no",
|
|
@@ -11,6 +11,15 @@ export const ALL_HARNESSES = [
|
|
|
11
11
|
"openclaw",
|
|
12
12
|
"opencode",
|
|
13
13
|
];
|
|
14
|
+
export const HARNESS_DISPLAY_NAMES = {
|
|
15
|
+
"claude-code": "Claude Code",
|
|
16
|
+
codex: "Codex",
|
|
17
|
+
cursor: "Cursor",
|
|
18
|
+
grok: "Grok",
|
|
19
|
+
hermes: "Hermes",
|
|
20
|
+
openclaw: "OpenClaw",
|
|
21
|
+
opencode: "OpenCode",
|
|
22
|
+
};
|
|
14
23
|
// Values are the wire contract; the report schema derives from these.
|
|
15
24
|
export var Registered;
|
|
16
25
|
(function (Registered) {
|
|
@@ -60,13 +60,19 @@ export declare const setupCompletedPayloadSchema: z.ZodObject<{
|
|
|
60
60
|
verify_ok: z.ZodNullable<z.ZodBoolean>;
|
|
61
61
|
}, z.core.$strip>>;
|
|
62
62
|
cli_version: z.ZodString;
|
|
63
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
64
|
+
all: "all";
|
|
65
|
+
pick: "pick";
|
|
66
|
+
pick_numeric: "pick_numeric";
|
|
67
|
+
}>>;
|
|
63
68
|
}, z.core.$strip>;
|
|
64
69
|
export type SetupCompletedPayload = z.infer<typeof setupCompletedPayloadSchema>;
|
|
65
70
|
export type HarnessResult = z.infer<typeof harnessResultSchema>;
|
|
71
|
+
export type SetupMode = NonNullable<SetupCompletedPayload["mode"]>;
|
|
66
72
|
export type UpgradeOutcome = "updated" | "failed" | "interrupted";
|
|
67
73
|
/** Step selection; "updated" means every selected step ran. */
|
|
68
74
|
export type UpgradeScope = "both" | "cli" | "skill";
|
|
69
75
|
/** `toVersion` is null when the run was interrupted or the installed version could not be read. */
|
|
70
76
|
export declare function sendUpgradeCompleted(fromVersion: string, toVersion: string | null, outcome: UpgradeOutcome, scope: UpgradeScope, apiKey?: string): Promise<void>;
|
|
71
|
-
export declare function sendSetupCompleted(mcpUrl: string, harnesses: HarnessResult[], apiKey?: string): Promise<void>;
|
|
77
|
+
export declare function sendSetupCompleted(mcpUrl: string, harnesses: HarnessResult[], apiKey?: string, mode?: SetupMode): Promise<void>;
|
|
72
78
|
export {};
|
|
@@ -109,6 +109,8 @@ export const setupCompletedPayloadSchema = z.object({
|
|
|
109
109
|
message: "expected one result per harness",
|
|
110
110
|
}),
|
|
111
111
|
cli_version: z.string(),
|
|
112
|
+
// Segments picker runs from --all runs; the server field shipped first.
|
|
113
|
+
mode: z.enum(["all", "pick", "pick_numeric"]).optional(),
|
|
112
114
|
});
|
|
113
115
|
/** `toVersion` is null when the run was interrupted or the installed version could not be read. */
|
|
114
116
|
export async function sendUpgradeCompleted(fromVersion, toVersion, outcome, scope, apiKey) {
|
|
@@ -126,7 +128,7 @@ export async function sendUpgradeCompleted(fromVersion, toVersion, outcome, scop
|
|
|
126
128
|
apiKey,
|
|
127
129
|
});
|
|
128
130
|
}
|
|
129
|
-
export async function sendSetupCompleted(mcpUrl, harnesses, apiKey) {
|
|
131
|
+
export async function sendSetupCompleted(mcpUrl, harnesses, apiKey, mode) {
|
|
130
132
|
// Ahead of the parse so an opt-out run prints no telemetry debug.
|
|
131
133
|
if (telemetryDisabled())
|
|
132
134
|
return;
|
|
@@ -134,7 +136,11 @@ export async function sendSetupCompleted(mcpUrl, harnesses, apiKey) {
|
|
|
134
136
|
let body;
|
|
135
137
|
try {
|
|
136
138
|
// Parse inside try — schema violation must not crash finished setup.
|
|
137
|
-
const payload = setupCompletedPayloadSchema.parse({
|
|
139
|
+
const payload = setupCompletedPayloadSchema.parse({
|
|
140
|
+
harnesses,
|
|
141
|
+
cli_version: CLI_VERSION,
|
|
142
|
+
...(mode ? { mode } : {}),
|
|
143
|
+
});
|
|
138
144
|
endpoint = new URL("/api/cli/connect-event", mcpUrl).toString();
|
|
139
145
|
body = JSON.stringify({ event: "setup_completed", ...payload });
|
|
140
146
|
}
|