@tiny-fish/cli 0.45.1-next.352 → 0.45.1-next.353
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.
|
@@ -2,6 +2,8 @@ import { z } from 'zod';
|
|
|
2
2
|
import { AuthMode, type Harness, Registered } from './harness-detect.js';
|
|
3
3
|
/** Bumped whenever a consumer could misread the payload; the cookbook skill releases separately. */
|
|
4
4
|
export declare const DOCTOR_SCHEMA_VERSION = 3;
|
|
5
|
+
/** Closed: three consumers match these ids by literal. */
|
|
6
|
+
export declare const CHECK_IDS: readonly ["cli-version", "mcp-connectivity", "harness-registration", "cli-credential", "cli-auth-call", "pi-adapter", "hermes-plugin"];
|
|
5
7
|
declare const checkStatusSchema: z.ZodEnum<{
|
|
6
8
|
pass: "pass";
|
|
7
9
|
fail: "fail";
|
|
@@ -14,7 +16,15 @@ declare const checkScopeSchema: z.ZodEnum<{
|
|
|
14
16
|
info: "info";
|
|
15
17
|
}>;
|
|
16
18
|
declare const doctorCheckSchema: z.ZodObject<{
|
|
17
|
-
id: z.
|
|
19
|
+
id: z.ZodEnum<{
|
|
20
|
+
"cli-version": "cli-version";
|
|
21
|
+
"mcp-connectivity": "mcp-connectivity";
|
|
22
|
+
"harness-registration": "harness-registration";
|
|
23
|
+
"cli-credential": "cli-credential";
|
|
24
|
+
"cli-auth-call": "cli-auth-call";
|
|
25
|
+
"pi-adapter": "pi-adapter";
|
|
26
|
+
"hermes-plugin": "hermes-plugin";
|
|
27
|
+
}>;
|
|
18
28
|
title: z.ZodString;
|
|
19
29
|
status: z.ZodEnum<{
|
|
20
30
|
pass: "pass";
|
|
@@ -92,7 +102,15 @@ export declare const doctorReportSchema: z.ZodObject<{
|
|
|
92
102
|
ok_harnesses: z.ZodBoolean;
|
|
93
103
|
ok_cli: z.ZodBoolean;
|
|
94
104
|
checks: z.ZodArray<z.ZodObject<{
|
|
95
|
-
id: z.
|
|
105
|
+
id: z.ZodEnum<{
|
|
106
|
+
"cli-version": "cli-version";
|
|
107
|
+
"mcp-connectivity": "mcp-connectivity";
|
|
108
|
+
"harness-registration": "harness-registration";
|
|
109
|
+
"cli-credential": "cli-credential";
|
|
110
|
+
"cli-auth-call": "cli-auth-call";
|
|
111
|
+
"pi-adapter": "pi-adapter";
|
|
112
|
+
"hermes-plugin": "hermes-plugin";
|
|
113
|
+
}>;
|
|
96
114
|
title: z.ZodString;
|
|
97
115
|
status: z.ZodEnum<{
|
|
98
116
|
pass: "pass";
|
|
@@ -2,12 +2,22 @@ import { z } from 'zod';
|
|
|
2
2
|
import { ALL_HARNESSES, AuthMode, Registered } from './harness-detect.js';
|
|
3
3
|
/** Bumped whenever a consumer could misread the payload; the cookbook skill releases separately. */
|
|
4
4
|
export const DOCTOR_SCHEMA_VERSION = 3;
|
|
5
|
+
/** Closed: three consumers match these ids by literal. */
|
|
6
|
+
export const CHECK_IDS = [
|
|
7
|
+
'cli-version',
|
|
8
|
+
'mcp-connectivity',
|
|
9
|
+
'harness-registration',
|
|
10
|
+
'cli-credential',
|
|
11
|
+
'cli-auth-call',
|
|
12
|
+
'pi-adapter',
|
|
13
|
+
'hermes-plugin',
|
|
14
|
+
];
|
|
5
15
|
const checkStatusSchema = z.enum(['pass', 'fail', 'warn', 'skip']);
|
|
6
16
|
const harnessSchema = z.enum(ALL_HARNESSES);
|
|
7
17
|
// Not derived from `harness`: connectivity is harness-null yet harness-scoped.
|
|
8
18
|
const checkScopeSchema = z.enum(['harness', 'cli', 'info']);
|
|
9
19
|
const doctorCheckSchema = z.object({
|
|
10
|
-
id: z.
|
|
20
|
+
id: z.enum(CHECK_IDS),
|
|
11
21
|
title: z.string(),
|
|
12
22
|
status: checkStatusSchema,
|
|
13
23
|
detail: z.string(),
|
|
@@ -95,6 +95,10 @@ export async function postConnectEvent(options) {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
+
/** Route 400s a bad id, and a 4xx is never retried. */
|
|
99
|
+
function stampedAttemptId(id) {
|
|
100
|
+
return id && z.uuid().safeParse(id).success ? id : undefined;
|
|
101
|
+
}
|
|
98
102
|
const harnessResultSchema = z.object({
|
|
99
103
|
harness: z.enum(ALL_HARNESSES),
|
|
100
104
|
detected: z.boolean(),
|
|
@@ -106,8 +110,7 @@ const harnessResultSchema = z.object({
|
|
|
106
110
|
export async function sendSetupStarted(mcpUrl, attemptId, apiKey) {
|
|
107
111
|
if (telemetryDisabled())
|
|
108
112
|
return;
|
|
109
|
-
|
|
110
|
-
const stamped = attemptId && z.uuid().safeParse(attemptId).success ? attemptId : undefined;
|
|
113
|
+
const stamped = stampedAttemptId(attemptId);
|
|
111
114
|
await postConnectEvent({
|
|
112
115
|
endpoint: new URL('/api/cli/connect-event', mcpUrl).toString(),
|
|
113
116
|
body: JSON.stringify({
|
|
@@ -127,7 +130,7 @@ export async function sendSetupStarted(mcpUrl, attemptId, apiKey) {
|
|
|
127
130
|
export async function sendSetupBlocked(mcpUrl, detail, apiKey) {
|
|
128
131
|
if (telemetryDisabled())
|
|
129
132
|
return;
|
|
130
|
-
const stamped =
|
|
133
|
+
const stamped = stampedAttemptId(detail.attemptId);
|
|
131
134
|
await postConnectEvent({
|
|
132
135
|
endpoint: new URL('/api/cli/connect-event', mcpUrl).toString(),
|
|
133
136
|
body: JSON.stringify({
|
|
@@ -161,6 +164,8 @@ export const setupCompletedPayloadSchema = z.object({
|
|
|
161
164
|
});
|
|
162
165
|
/** `toVersion` is null when the run was interrupted or the installed version could not be read. */
|
|
163
166
|
export async function sendUpgradeCompleted(fromVersion, toVersion, outcome, scope, apiKey) {
|
|
167
|
+
if (telemetryDisabled())
|
|
168
|
+
return;
|
|
164
169
|
await postConnectEvent({
|
|
165
170
|
endpoint: new URL('/api/cli/connect-event', BASE_URL).toString(),
|
|
166
171
|
body: JSON.stringify({
|
|
@@ -181,6 +186,7 @@ export async function sendSetupCompleted(mcpUrl, harnesses, apiKey, mode, attemp
|
|
|
181
186
|
// Ahead of the parse so an opt-out run prints no telemetry debug.
|
|
182
187
|
if (telemetryDisabled())
|
|
183
188
|
return;
|
|
189
|
+
const stamped = stampedAttemptId(attemptId);
|
|
184
190
|
let endpoint;
|
|
185
191
|
let body;
|
|
186
192
|
try {
|
|
@@ -189,10 +195,7 @@ export async function sendSetupCompleted(mcpUrl, harnesses, apiKey, mode, attemp
|
|
|
189
195
|
harnesses,
|
|
190
196
|
cli_version: CLI_VERSION,
|
|
191
197
|
...(mode ? { mode } : {}),
|
|
192
|
-
|
|
193
|
-
...(attemptId && z.uuid().safeParse(attemptId).success
|
|
194
|
-
? { connect_attempt_id: attemptId }
|
|
195
|
-
: {}),
|
|
198
|
+
...(stamped ? { connect_attempt_id: stamped } : {}),
|
|
196
199
|
});
|
|
197
200
|
endpoint = new URL('/api/cli/connect-event', mcpUrl).toString();
|
|
198
201
|
body = JSON.stringify({
|