@tiny-fish/cli 0.32.0 → 0.32.1-next.275
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import spawn from 'cross-spawn';
|
|
3
3
|
import { CONNECT_ATTEMPT_ENV, isAttemptId, resolvedApiKey, takePendingConnectAttempt, } from './auth.js';
|
|
4
|
-
import { CLI_VERSION } from './constants.js';
|
|
4
|
+
import { CLI_INVOCATION_ID, CLI_VERSION } from './constants.js';
|
|
5
5
|
import { detectHarness, detectHumanInitiated } from './harness.js';
|
|
6
6
|
import { errLine, sanitizeLine } from './output.js';
|
|
7
7
|
import { postConnectEvent, telemetryDisabled } from './setup-telemetry.js';
|
|
@@ -289,6 +289,7 @@ export function createConnectTelemetry(mcpUrl, client, opts) {
|
|
|
289
289
|
is_human_initiated: detectHumanInitiated(),
|
|
290
290
|
// "none", not absent — absent has to keep meaning "CLI too old".
|
|
291
291
|
calling_harness: detectHarness() ?? 'none',
|
|
292
|
+
cli_invocation_id: CLI_INVOCATION_ID,
|
|
292
293
|
})).catch((error) => {
|
|
293
294
|
// postConnectEvent is total, so this only fires if something inside deliver starts
|
|
294
295
|
// throwing. Same channel postConnectEvent uses for its own failures.
|
package/dist/lib/constants.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const CLI_VERSION: string;
|
|
2
|
+
/** One id per CLI process; joins events across commands (PF-3779). */
|
|
3
|
+
export declare const CLI_INVOCATION_ID: string;
|
|
2
4
|
/** Unversioned: the install site appends `@latest`, the version read must not. */
|
|
3
5
|
export declare const TINYFISH_CLI_PACKAGE = "@tiny-fish/cli";
|
|
4
6
|
export declare const CLI_AGENT_IDENTITY = "tinyfish-cli";
|
package/dist/lib/constants.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
1
2
|
import { createRequire } from 'module';
|
|
2
3
|
const _require = createRequire(import.meta.url);
|
|
3
4
|
const _pkg = _require('../../package.json');
|
|
4
5
|
export const CLI_VERSION = _pkg.version;
|
|
6
|
+
/** One id per CLI process; joins events across commands (PF-3779). */
|
|
7
|
+
export const CLI_INVOCATION_ID = randomUUID();
|
|
5
8
|
/** Unversioned: the install site appends `@latest`, the version read must not. */
|
|
6
9
|
export const TINYFISH_CLI_PACKAGE = '@tiny-fish/cli';
|
|
7
10
|
// How we identify ourselves to other tools; `skills` echoes it back.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { validateKeyFormat } from './auth.js';
|
|
4
|
-
import { BASE_URL, CLI_VERSION } from './constants.js';
|
|
4
|
+
import { BASE_URL, CLI_INVOCATION_ID, CLI_VERSION } from './constants.js';
|
|
5
5
|
import { ALL_HARNESSES } from './harness-detect.js';
|
|
6
|
+
import { detectHarness } from './harness.js';
|
|
6
7
|
import { captureNotice } from './notice.js';
|
|
7
8
|
import { errLine } from './output.js';
|
|
8
9
|
const CONNECT_EVENT_TIMEOUT_MS = 2_000;
|
|
@@ -114,6 +115,7 @@ export async function sendSetupStarted(mcpUrl, attemptId, apiKey) {
|
|
|
114
115
|
cli_version: CLI_VERSION,
|
|
115
116
|
runtime_platform: process.platform,
|
|
116
117
|
...(stamped ? { connect_attempt_id: stamped } : {}),
|
|
118
|
+
cli_invocation_id: CLI_INVOCATION_ID,
|
|
117
119
|
}),
|
|
118
120
|
attempts: 1,
|
|
119
121
|
label: 'setup',
|
|
@@ -142,6 +144,7 @@ export async function sendUpgradeCompleted(fromVersion, toVersion, outcome, scop
|
|
|
142
144
|
to_version: toVersion,
|
|
143
145
|
outcome,
|
|
144
146
|
scope,
|
|
147
|
+
cli_invocation_id: CLI_INVOCATION_ID,
|
|
145
148
|
}),
|
|
146
149
|
attempts: 1,
|
|
147
150
|
label: 'upgrade',
|
|
@@ -166,7 +169,11 @@ export async function sendSetupCompleted(mcpUrl, harnesses, apiKey, mode, attemp
|
|
|
166
169
|
: {}),
|
|
167
170
|
});
|
|
168
171
|
endpoint = new URL('/api/cli/connect-event', mcpUrl).toString();
|
|
169
|
-
body = JSON.stringify({
|
|
172
|
+
body = JSON.stringify({
|
|
173
|
+
event: 'setup_completed',
|
|
174
|
+
...payload,
|
|
175
|
+
cli_invocation_id: CLI_INVOCATION_ID,
|
|
176
|
+
});
|
|
170
177
|
}
|
|
171
178
|
catch (e) {
|
|
172
179
|
if (process.env['TINYFISH_DEBUG']) {
|
|
@@ -209,7 +216,15 @@ export async function sendDoctorCompleted(mcpUrl, payload, apiKey) {
|
|
|
209
216
|
// Parse inside try — a schema violation must not fail a diagnosis that already ran.
|
|
210
217
|
const parsed = doctorCompletedPayloadSchema.parse(payload);
|
|
211
218
|
endpoint = new URL('/api/cli/connect-event', mcpUrl).toString();
|
|
212
|
-
|
|
219
|
+
// Stamped after the parse: process-derived and bounded, cannot trip route caps.
|
|
220
|
+
body = JSON.stringify({
|
|
221
|
+
event: 'doctor_completed',
|
|
222
|
+
...parsed,
|
|
223
|
+
runtime_platform: process.platform,
|
|
224
|
+
node_version: process.version,
|
|
225
|
+
calling_harness: detectHarness() ?? 'none',
|
|
226
|
+
cli_invocation_id: CLI_INVOCATION_ID,
|
|
227
|
+
});
|
|
213
228
|
}
|
|
214
229
|
catch (e) {
|
|
215
230
|
if (process.env['TINYFISH_DEBUG']) {
|