rivet-design 0.26.0 → 0.26.2
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/bin/rivet.js +13 -0
- package/dist/agent-variants/WorkerExecutorService.d.ts +0 -2
- package/dist/agent-variants/WorkerExecutorService.js +0 -18
- package/dist/agent-variants/WorktreeOrchestrator.testHelpers.js +0 -8
- package/dist/agent-variants/contracts.d.ts +1099 -4966
- package/dist/agent-variants/contracts.js +1 -121
- package/dist/agent-variants/index.d.ts +1 -1
- package/dist/agent-variants/variantsTelemetry.d.ts +0 -8
- package/dist/agent-variants/workItemInput.d.ts +464 -464
- package/dist/cli/commands/contextRequest.js +1 -1
- package/dist/cli/commands/guidanceReferences.d.ts +2 -2
- package/dist/cli/commands/guidanceVerifierPackage.d.ts +2 -2
- package/dist/cli/editorSession.d.ts +1 -13
- package/dist/cli/runtimeInterruption.d.ts +2 -16
- package/dist/config/pluginMetrics.js +0 -1
- package/dist/hosts/workerDefaults.d.ts +0 -11
- package/dist/hosts/workerDefaults.js +1 -30
- package/dist/index-core.d.ts +0 -1
- package/dist/index.js +1 -1
- package/dist/install/automaticCliUpdate.d.ts +1 -0
- package/dist/install/automaticCliUpdate.js +32 -22
- package/dist/install/channelCli.d.ts +1 -1
- package/dist/install/channelCli.js +11 -6
- package/dist/install/channelManager.d.ts +5 -2
- package/dist/install/globalBootstrap.d.ts +5 -3
- package/dist/install/globalBootstrap.js +21 -9
- package/dist/install/npmCommand.d.ts +15 -0
- package/dist/install/npmCommand.js +59 -0
- package/dist/routes/agentVariants.js +3 -14
- package/dist/routes/library/browserAccess.js +6 -2
- package/dist/routes/library/guidance.js +3 -1
- package/dist/routes/library/middleware.js +4 -4
- package/dist/routes/library/navigation.js +3 -1
- package/dist/routes/library/profiles.js +5 -5
- package/dist/routes/library/projects.js +17 -7
- package/dist/routes/library/referenceOnboarding.js +4 -2
- package/dist/routes/library/schemas.d.ts +2 -15
- package/dist/routes/telemetry.js +1 -1
- package/dist/routes/variantRequestSchema.d.ts +8 -8
- package/dist/routes/variantRequestSchema.js +7 -2
- package/dist/services/AuthService.d.ts +3 -56
- package/dist/services/AuthService.js +0 -28
- package/dist/services/ConfigManager.d.ts +0 -2
- package/dist/services/ConfigManager.js +0 -14
- package/dist/services/GuidanceVerifierRunner.js +13 -2
- package/dist/services/HubDiscovery.d.ts +1 -9
- package/dist/services/IntegrationsClient.d.ts +16 -16
- package/dist/services/MCPOnboardingTelemetry.d.ts +0 -14
- package/dist/services/MCPOnboardingTelemetry.js +0 -62
- package/dist/services/ProjectRegistry.d.ts +5 -24
- package/dist/services/TelemetryService.d.ts +1 -62
- package/dist/services/TelemetryService.js +0 -113
- package/dist/services/TreeStore.d.ts +0 -2
- package/dist/services/TreeStore.js +0 -24
- package/dist/services/profiles/DesignProfiles.d.ts +180 -125
- package/dist/services/profiles/ProfilePlanning.d.ts +38 -38
- package/dist/services/profiles/ReferenceReader.d.ts +14 -14
- package/dist/services/profiles/modelContract.js +4 -4
- package/dist/storage/library/ProjectPreviewCache.d.ts +1 -13
- package/dist/storage/profiles/ProfilePlans.d.ts +137 -137
- package/dist/storage/profiles/ProfileRecords.d.ts +62 -37
- package/dist/storage/profiles/planSchema.d.ts +40 -40
- package/dist/storage/profiles/schema.d.ts +16 -16
- package/dist/types/api-responses.d.ts +174 -0
- package/dist/types/api-responses.js +108 -0
- package/dist/types/cosmos-profile.d.ts +17 -105
- package/dist/types/cosmos.d.ts +48 -266
- package/dist/types/design-library.d.ts +230 -61
- package/dist/types/design-library.js +38 -1
- package/dist/types/design-profile.d.ts +220 -529
- package/dist/types/design-profile.js +5 -1
- package/dist/types/guidance-references.d.ts +68 -316
- package/dist/types/guidance-verifier.d.ts +103 -197
- package/dist/types/guidance-verifier.js +36 -13
- package/dist/types/guidance.d.ts +182 -1643
- package/dist/types/guidance.js +4 -1
- package/dist/types/project-library.d.ts +60 -30
- package/dist/types/project-library.js +32 -1
- package/dist/types/reference-connectors.d.ts +38 -162
- package/dist/types/reference-onboarding.d.ts +144 -878
- package/dist/types/reference-pages.d.ts +27 -139
- package/dist/types/x-bookmarks.d.ts +40 -296
- package/dist/utils/displayLocale.d.ts +0 -1
- package/dist/utils/displayLocale.js +1 -3
- package/dist/utils/skills/cli-guidance.d.ts +1 -1
- package/dist/utils/skills/cli-guidance.js +2 -2
- package/package.json +4 -4
- package/src/ui/dist/assets/LibraryEntry-92R_T-Xa.js +37 -0
- package/src/ui/dist/assets/main-D0UmAaUe.css +1 -0
- package/src/ui/dist/assets/main-DgEfJvYu.js +497 -0
- package/src/ui/dist/index.html +2 -2
- package/dist/types/change-types.d.ts +0 -66
- package/dist/types/change-types.js +0 -3
- package/src/ui/dist/assets/LibraryEntry-CFkd6v_O.js +0 -37
- package/src/ui/dist/assets/main-B_jie9r3.js +0 -439
- package/src/ui/dist/assets/main-W3oTuTTl.css +0 -1
|
@@ -37,9 +37,7 @@ const authenticateLibrary = (token, sessions) => (req, res, next) => {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
catch {
|
|
40
|
-
res
|
|
41
|
-
.status(503)
|
|
42
|
-
.json({
|
|
40
|
+
res.status(503).json({
|
|
43
41
|
error: 'Browser authorization is unavailable. Please retry or sign in again.',
|
|
44
42
|
});
|
|
45
43
|
return;
|
|
@@ -77,7 +75,9 @@ const libraryErrorStatus = (code) => {
|
|
|
77
75
|
const handleLibraryError = (error, _req, res, _next) => {
|
|
78
76
|
const message = (0, errorMessage_1.errorMessage)(error);
|
|
79
77
|
if (error instanceof libraryErrors_1.LibraryError) {
|
|
80
|
-
res
|
|
78
|
+
res
|
|
79
|
+
.status(libraryErrorStatus(error.code))
|
|
80
|
+
.json({ error: message });
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
if (error instanceof zod_1.z.ZodError) {
|
|
@@ -22,7 +22,9 @@ const createNavigationRoutes = ({ library, navigation, track, }) => {
|
|
|
22
22
|
router.put('/views/:viewId', (req, res) => {
|
|
23
23
|
const body = zod_1.z.object({ isFocused: zod_1.z.boolean() }).parse(req.body);
|
|
24
24
|
navigation.connect({ viewId: req.params.viewId, ...body });
|
|
25
|
-
res.json({
|
|
25
|
+
res.json({
|
|
26
|
+
navigations: navigation.pending(req.params.viewId),
|
|
27
|
+
});
|
|
26
28
|
});
|
|
27
29
|
router.post('/views/:viewId/acknowledgements', (req, res) => {
|
|
28
30
|
const { sequence } = zod_1.z
|
|
@@ -65,7 +65,7 @@ const createProfileRoutes = (profiles, telemetry) => {
|
|
|
65
65
|
next();
|
|
66
66
|
});
|
|
67
67
|
router.get('/profile', async (_req, res) => {
|
|
68
|
-
res.json(await profiles.status());
|
|
68
|
+
res.json((await profiles.status()));
|
|
69
69
|
});
|
|
70
70
|
router.get('/profile/diagnostics', async (_req, res) => {
|
|
71
71
|
res.json(await profiles.diagnostics());
|
|
@@ -127,11 +127,11 @@ const createProfileRoutes = (profiles, telemetry) => {
|
|
|
127
127
|
if (input.isEnabled) {
|
|
128
128
|
res
|
|
129
129
|
.status(202)
|
|
130
|
-
.json(await profiles.enable(design_profile_1.ProfileRuntimeSchema.parse(input.runtime)));
|
|
130
|
+
.json((await profiles.enable(design_profile_1.ProfileRuntimeSchema.parse(input.runtime))));
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
133
|
await profiles.disable();
|
|
134
|
-
res.json(await profiles.status());
|
|
134
|
+
res.json((await profiles.status()));
|
|
135
135
|
});
|
|
136
136
|
router.get('/profile/references', async (req, res) => {
|
|
137
137
|
res.json({
|
|
@@ -140,11 +140,11 @@ const createProfileRoutes = (profiles, telemetry) => {
|
|
|
140
140
|
});
|
|
141
141
|
router.get('/profile/library', async (_req, res) => {
|
|
142
142
|
res.setHeader('Cache-Control', 'private, no-store');
|
|
143
|
-
res.json(await profiles.library());
|
|
143
|
+
res.json((await profiles.library()));
|
|
144
144
|
});
|
|
145
145
|
router.post('/profile/search', async (req, res) => {
|
|
146
146
|
res.setHeader('Cache-Control', 'private, no-store');
|
|
147
|
-
res.json(await profiles.search(design_library_1.DesignReferenceSearchRequestSchema.parse(req.body)));
|
|
147
|
+
res.json((await profiles.search(design_library_1.DesignReferenceSearchRequestSchema.parse(req.body))));
|
|
148
148
|
});
|
|
149
149
|
router.post('/profile/reference-contexts', async (req, res) => {
|
|
150
150
|
res.setHeader('Cache-Control', 'private, no-store');
|
|
@@ -10,12 +10,16 @@ const WorkspaceSchema = zod_1.z.object({ projectPath: zod_1.z.string().min(1) })
|
|
|
10
10
|
const ProjectUpdateSchema = zod_1.z.object({ name: ProjectRegistry_1.ProjectNameSchema }).strict();
|
|
11
11
|
const createProjectRoutes = ({ library, runtime, cardPreviews, folderPicker = new ProjectFolderPicker_1.ProjectFolderPicker(), track, }) => {
|
|
12
12
|
const router = (0, express_1.Router)();
|
|
13
|
-
router.get('/', async (_req, res) => res.json(await library.snapshot()));
|
|
14
|
-
router.get('/projects', (_req, res) => res.json({
|
|
13
|
+
router.get('/', async (_req, res) => res.json((await library.snapshot())));
|
|
14
|
+
router.get('/projects', (_req, res) => res.json({
|
|
15
|
+
projects: library.listProjects(),
|
|
16
|
+
}));
|
|
15
17
|
router.patch('/projects/:projectId', track('project_rename'), (req, res) => {
|
|
16
18
|
const { projectId } = schemas_1.ProjectParamsSchema.parse(req.params);
|
|
17
19
|
const { name } = ProjectUpdateSchema.parse(req.body);
|
|
18
|
-
res.json({
|
|
20
|
+
res.json({
|
|
21
|
+
project: library.registry.rename({ projectId, name }),
|
|
22
|
+
});
|
|
19
23
|
});
|
|
20
24
|
router.put('/projects/:projectId/pin', track('project_pin'), (req, res) => {
|
|
21
25
|
const { projectId } = schemas_1.ProjectParamsSchema.parse(req.params);
|
|
@@ -38,14 +42,20 @@ const createProjectRoutes = ({ library, runtime, cardPreviews, folderPicker = ne
|
|
|
38
42
|
const { projectId } = schemas_1.ProjectParamsSchema.parse(req.params);
|
|
39
43
|
library.registry.get(projectId);
|
|
40
44
|
res.setHeader('Cache-Control', 'no-store');
|
|
41
|
-
res.json({
|
|
45
|
+
res.json({
|
|
46
|
+
preview: (await cardPreviews?.get(projectId)) ?? null,
|
|
47
|
+
});
|
|
42
48
|
});
|
|
43
49
|
router.post('/folder-selections', track('folder_select'), async (_req, res) => {
|
|
44
|
-
res.json({
|
|
50
|
+
res.json({
|
|
51
|
+
projectPath: await folderPicker.pick(),
|
|
52
|
+
});
|
|
45
53
|
});
|
|
46
54
|
router.post('/projects', track('project_open'), async (req, res) => {
|
|
47
55
|
const body = WorkspaceSchema.parse(req.body);
|
|
48
|
-
res
|
|
56
|
+
res
|
|
57
|
+
.status(201)
|
|
58
|
+
.json((await library.prepare(body.projectPath)));
|
|
49
59
|
});
|
|
50
60
|
router.patch('/projects/:projectId/workspace', track('project_open'), async (req, res) => {
|
|
51
61
|
const body = WorkspaceSchema.parse(req.body);
|
|
@@ -57,7 +67,7 @@ const createProjectRoutes = ({ library, runtime, cardPreviews, folderPicker = ne
|
|
|
57
67
|
});
|
|
58
68
|
});
|
|
59
69
|
router.post('/projects/:projectId/runtime', track('workspace_open'), async (req, res) => {
|
|
60
|
-
res.json(await runtime.activate(schemas_1.ProjectParamsSchema.parse(req.params).projectId));
|
|
70
|
+
res.json((await runtime.activate(schemas_1.ProjectParamsSchema.parse(req.params).projectId)));
|
|
61
71
|
});
|
|
62
72
|
return router;
|
|
63
73
|
};
|
|
@@ -48,7 +48,7 @@ const createReferenceOnboardingRoutes = (profiles, telemetry) => {
|
|
|
48
48
|
});
|
|
49
49
|
res
|
|
50
50
|
.status(201)
|
|
51
|
-
.json(await profiles.planReferences(input, controller.signal));
|
|
51
|
+
.json((await profiles.planReferences(input, controller.signal)));
|
|
52
52
|
});
|
|
53
53
|
router.get('/profile/import-plans/:id', async (req, res) => {
|
|
54
54
|
res.json(await profiles.referencePlan(zod_1.z.string().uuid().parse(req.params.id)));
|
|
@@ -58,7 +58,9 @@ const createReferenceOnboardingRoutes = (profiles, telemetry) => {
|
|
|
58
58
|
...req.body,
|
|
59
59
|
id: req.params.id,
|
|
60
60
|
});
|
|
61
|
-
res
|
|
61
|
+
res
|
|
62
|
+
.status(202)
|
|
63
|
+
.json((await profiles.importReferences(input)));
|
|
62
64
|
});
|
|
63
65
|
router.get('/profile/onboarding', async (req, res) => {
|
|
64
66
|
const { provider } = zod_1.z
|
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const ProjectParamsSchema: z.ZodObject<{
|
|
3
3
|
projectId: z.ZodString;
|
|
4
|
-
},
|
|
5
|
-
projectId: string;
|
|
6
|
-
}, {
|
|
7
|
-
projectId: string;
|
|
8
|
-
}>;
|
|
4
|
+
}, z.core.$strip>;
|
|
9
5
|
export declare const VariantParamsSchema: z.ZodObject<{
|
|
10
6
|
projectId: z.ZodString;
|
|
11
|
-
} & {
|
|
12
7
|
sessionId: z.ZodString;
|
|
13
8
|
variantId: z.ZodString;
|
|
14
|
-
},
|
|
15
|
-
projectId: string;
|
|
16
|
-
sessionId: string;
|
|
17
|
-
variantId: string;
|
|
18
|
-
}, {
|
|
19
|
-
projectId: string;
|
|
20
|
-
sessionId: string;
|
|
21
|
-
variantId: string;
|
|
22
|
-
}>;
|
|
9
|
+
}, z.core.$strip>;
|
|
23
10
|
//# sourceMappingURL=schemas.d.ts.map
|
package/dist/routes/telemetry.js
CHANGED
|
@@ -9,7 +9,7 @@ const telemetryPolicy_1 = require("../config/telemetryPolicy");
|
|
|
9
9
|
const ConfigManager_1 = require("../services/ConfigManager");
|
|
10
10
|
const metricBody = zod_1.z.object({
|
|
11
11
|
event: zod_1.z.string(),
|
|
12
|
-
properties: zod_1.z.record(zod_1.z.unknown()),
|
|
12
|
+
properties: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
13
13
|
});
|
|
14
14
|
const createTelemetryRouter = (telemetry) => {
|
|
15
15
|
const router = (0, express_1.Router)();
|
|
@@ -98,13 +98,13 @@ export declare const inlineVariantRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
98
98
|
}, "strip", z.ZodTypeAny, {
|
|
99
99
|
count: number;
|
|
100
100
|
mode?: "zero_to_one" | "existing" | undefined;
|
|
101
|
+
profile?: "off" | "auto" | undefined;
|
|
101
102
|
contextAssets?: {
|
|
102
103
|
path: string;
|
|
103
104
|
label?: string | undefined;
|
|
104
105
|
}[] | undefined;
|
|
105
106
|
runLabel?: string | undefined;
|
|
106
|
-
fidelity?: "
|
|
107
|
-
profile?: "off" | "auto" | undefined;
|
|
107
|
+
fidelity?: "high" | "medium" | "low" | undefined;
|
|
108
108
|
briefs?: {
|
|
109
109
|
label: string;
|
|
110
110
|
body: string;
|
|
@@ -126,13 +126,13 @@ export declare const inlineVariantRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
126
126
|
}, {
|
|
127
127
|
count: number;
|
|
128
128
|
mode?: "zero_to_one" | "existing" | undefined;
|
|
129
|
+
profile?: "off" | "auto" | undefined;
|
|
129
130
|
contextAssets?: {
|
|
130
131
|
path: string;
|
|
131
132
|
label?: string | undefined;
|
|
132
133
|
}[] | undefined;
|
|
133
134
|
runLabel?: string | undefined;
|
|
134
|
-
fidelity?: "
|
|
135
|
-
profile?: "off" | "auto" | undefined;
|
|
135
|
+
fidelity?: "high" | "medium" | "low" | undefined;
|
|
136
136
|
briefs?: {
|
|
137
137
|
label: string;
|
|
138
138
|
body: string;
|
|
@@ -151,13 +151,13 @@ export declare const inlineVariantRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
151
151
|
}>, {
|
|
152
152
|
count: number;
|
|
153
153
|
mode?: "zero_to_one" | "existing" | undefined;
|
|
154
|
+
profile?: "off" | "auto" | undefined;
|
|
154
155
|
contextAssets?: {
|
|
155
156
|
path: string;
|
|
156
157
|
label?: string | undefined;
|
|
157
158
|
}[] | undefined;
|
|
158
159
|
runLabel?: string | undefined;
|
|
159
|
-
fidelity?: "
|
|
160
|
-
profile?: "off" | "auto" | undefined;
|
|
160
|
+
fidelity?: "high" | "medium" | "low" | undefined;
|
|
161
161
|
briefs?: {
|
|
162
162
|
label: string;
|
|
163
163
|
body: string;
|
|
@@ -179,13 +179,13 @@ export declare const inlineVariantRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
179
179
|
}, {
|
|
180
180
|
count: number;
|
|
181
181
|
mode?: "zero_to_one" | "existing" | undefined;
|
|
182
|
+
profile?: "off" | "auto" | undefined;
|
|
182
183
|
contextAssets?: {
|
|
183
184
|
path: string;
|
|
184
185
|
label?: string | undefined;
|
|
185
186
|
}[] | undefined;
|
|
186
187
|
runLabel?: string | undefined;
|
|
187
|
-
fidelity?: "
|
|
188
|
-
profile?: "off" | "auto" | undefined;
|
|
188
|
+
fidelity?: "high" | "medium" | "low" | undefined;
|
|
189
189
|
briefs?: {
|
|
190
190
|
label: string;
|
|
191
191
|
body: string;
|
|
@@ -42,8 +42,13 @@ const guidanceSelectionSchema = v3_1.z
|
|
|
42
42
|
const parsed = guidance_1.GuidanceSelectionSchema.safeParse(value);
|
|
43
43
|
if (parsed.success)
|
|
44
44
|
return parsed.data;
|
|
45
|
-
for (const
|
|
46
|
-
context.addIssue(
|
|
45
|
+
for (const { message, path } of parsed.error.issues) {
|
|
46
|
+
context.addIssue({
|
|
47
|
+
code: v3_1.z.ZodIssueCode.custom,
|
|
48
|
+
message,
|
|
49
|
+
path: path.filter((key) => typeof key !== 'symbol'),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
47
52
|
return v3_1.z.NEVER;
|
|
48
53
|
});
|
|
49
54
|
exports.inlineVariantRequestSchema = v3_1.z
|
|
@@ -18,68 +18,16 @@ declare const LoginResponseSchema: z.ZodObject<{
|
|
|
18
18
|
id: z.ZodString;
|
|
19
19
|
email: z.ZodString;
|
|
20
20
|
displayName: z.ZodOptional<z.ZodString>;
|
|
21
|
-
},
|
|
22
|
-
email: string;
|
|
23
|
-
id: string;
|
|
24
|
-
displayName?: string | undefined;
|
|
25
|
-
}, {
|
|
26
|
-
email: string;
|
|
27
|
-
id: string;
|
|
28
|
-
displayName?: string | undefined;
|
|
29
|
-
}>>;
|
|
21
|
+
}, z.core.$strip>>;
|
|
30
22
|
profile: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
31
23
|
remaining_spend_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
32
24
|
monthly_limit_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
33
25
|
current_month_spend_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
34
26
|
total_spend_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
35
|
-
},
|
|
36
|
-
remaining_spend_usd?: number | null | undefined;
|
|
37
|
-
monthly_limit_usd?: number | null | undefined;
|
|
38
|
-
current_month_spend_usd?: number | null | undefined;
|
|
39
|
-
total_spend_usd?: number | null | undefined;
|
|
40
|
-
}, {
|
|
41
|
-
remaining_spend_usd?: number | null | undefined;
|
|
42
|
-
monthly_limit_usd?: number | null | undefined;
|
|
43
|
-
current_month_spend_usd?: number | null | undefined;
|
|
44
|
-
total_spend_usd?: number | null | undefined;
|
|
45
|
-
}>>>;
|
|
27
|
+
}, z.core.$strip>>>;
|
|
46
28
|
error: z.ZodOptional<z.ZodString>;
|
|
47
29
|
message: z.ZodOptional<z.ZodString>;
|
|
48
|
-
},
|
|
49
|
-
success: boolean;
|
|
50
|
-
error?: string | undefined;
|
|
51
|
-
token?: string | undefined;
|
|
52
|
-
message?: string | undefined;
|
|
53
|
-
refreshToken?: string | undefined;
|
|
54
|
-
user?: {
|
|
55
|
-
email: string;
|
|
56
|
-
id: string;
|
|
57
|
-
displayName?: string | undefined;
|
|
58
|
-
} | undefined;
|
|
59
|
-
profile?: {
|
|
60
|
-
remaining_spend_usd?: number | null | undefined;
|
|
61
|
-
monthly_limit_usd?: number | null | undefined;
|
|
62
|
-
current_month_spend_usd?: number | null | undefined;
|
|
63
|
-
total_spend_usd?: number | null | undefined;
|
|
64
|
-
} | null | undefined;
|
|
65
|
-
}, {
|
|
66
|
-
success: boolean;
|
|
67
|
-
error?: string | undefined;
|
|
68
|
-
token?: string | undefined;
|
|
69
|
-
message?: string | undefined;
|
|
70
|
-
refreshToken?: string | undefined;
|
|
71
|
-
user?: {
|
|
72
|
-
email: string;
|
|
73
|
-
id: string;
|
|
74
|
-
displayName?: string | undefined;
|
|
75
|
-
} | undefined;
|
|
76
|
-
profile?: {
|
|
77
|
-
remaining_spend_usd?: number | null | undefined;
|
|
78
|
-
monthly_limit_usd?: number | null | undefined;
|
|
79
|
-
current_month_spend_usd?: number | null | undefined;
|
|
80
|
-
total_spend_usd?: number | null | undefined;
|
|
81
|
-
} | null | undefined;
|
|
82
|
-
}>;
|
|
30
|
+
}, z.core.$strip>;
|
|
83
31
|
type LoginResponse = z.infer<typeof LoginResponseSchema>;
|
|
84
32
|
type UserProfile = {
|
|
85
33
|
user: {
|
|
@@ -123,7 +71,6 @@ export declare class AuthService {
|
|
|
123
71
|
resumePendingLogin(maxAttempts?: number): Promise<LoginResponse | null>;
|
|
124
72
|
private pollForToken;
|
|
125
73
|
logout(options?: LogoutOptions): Promise<void>;
|
|
126
|
-
getProfile(): Promise<UserProfile | null>;
|
|
127
74
|
ensureAuthenticated(): Promise<boolean>;
|
|
128
75
|
getValidatedProfile(): Promise<UserProfile | null>;
|
|
129
76
|
isAuthenticated(): boolean;
|
|
@@ -600,34 +600,6 @@ class AuthService {
|
|
|
600
600
|
}
|
|
601
601
|
log.info('Logged out successfully');
|
|
602
602
|
}
|
|
603
|
-
async getProfile() {
|
|
604
|
-
const token = this.configManager.getAuthToken();
|
|
605
|
-
if (!token) {
|
|
606
|
-
log.warn('No authentication token found');
|
|
607
|
-
return null;
|
|
608
|
-
}
|
|
609
|
-
try {
|
|
610
|
-
const response = await fetch(`${this.proxyUrl}/api/user/profile`, {
|
|
611
|
-
method: 'GET',
|
|
612
|
-
headers: {
|
|
613
|
-
'Content-Type': 'application/json',
|
|
614
|
-
Authorization: `Bearer ${token}`,
|
|
615
|
-
},
|
|
616
|
-
signal: AbortSignal.timeout(PROFILE_FETCH_TIMEOUT_MS),
|
|
617
|
-
});
|
|
618
|
-
if (!response.ok) {
|
|
619
|
-
const error = await response.json().catch(() => ({}));
|
|
620
|
-
log.warn('Failed to fetch profile:', error);
|
|
621
|
-
return null;
|
|
622
|
-
}
|
|
623
|
-
const result = await response.json();
|
|
624
|
-
return result.success ? result : null;
|
|
625
|
-
}
|
|
626
|
-
catch (error) {
|
|
627
|
-
log.warn('Profile fetch error:', error);
|
|
628
|
-
return null;
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
603
|
async ensureAuthenticated() {
|
|
632
604
|
const profile = await this.getValidatedProfile();
|
|
633
605
|
return profile !== null;
|
|
@@ -76,8 +76,6 @@ export declare class ConfigManager {
|
|
|
76
76
|
setTelemetryIdentifiedEmail(email: string): void;
|
|
77
77
|
getTelemetryIdentifiedUserId(): string | undefined;
|
|
78
78
|
setTelemetryIdentifiedUserId(userId: string): void;
|
|
79
|
-
hasCompletedFirstVariantsRun(): boolean;
|
|
80
|
-
markFirstVariantsRun(): void;
|
|
81
79
|
claimMcpRemovedTelemetryWindow(now?: Date): boolean;
|
|
82
80
|
getInstallRef(): string | undefined;
|
|
83
81
|
setInstallRef(installRef: string, downloadType?: string): void;
|
|
@@ -276,20 +276,6 @@ class ConfigManager {
|
|
|
276
276
|
this.config.telemetryIdentifiedUserId = userId;
|
|
277
277
|
this.saveConfig();
|
|
278
278
|
}
|
|
279
|
-
hasCompletedFirstVariantsRun() {
|
|
280
|
-
this.reloadConfigFromDisk();
|
|
281
|
-
return Boolean(this.config.firstVariantsRunAt);
|
|
282
|
-
}
|
|
283
|
-
markFirstVariantsRun() {
|
|
284
|
-
if (this.config.firstVariantsRunAt)
|
|
285
|
-
return;
|
|
286
|
-
this.reloadConfigFromDisk();
|
|
287
|
-
if (this.config.firstVariantsRunAt)
|
|
288
|
-
return;
|
|
289
|
-
this.config.firstVariantsRunAt = new Date().toISOString();
|
|
290
|
-
this.saveConfig();
|
|
291
|
-
log.debug('Recorded first variants run for onboarding gate');
|
|
292
|
-
}
|
|
293
279
|
claimMcpRemovedTelemetryWindow(now = new Date()) {
|
|
294
280
|
const day = now.toISOString().slice(0, 10);
|
|
295
281
|
this.reloadConfigFromDisk();
|
|
@@ -239,7 +239,15 @@ const validateEvidence = async (directory, names) => {
|
|
|
239
239
|
const executeGuidanceVerifier = async (args) => {
|
|
240
240
|
const started = Date.now();
|
|
241
241
|
let runDirectory = args.runsDirectory;
|
|
242
|
+
let projectPath = args.projectPath;
|
|
243
|
+
const verifier = {
|
|
244
|
+
contextId: args.packet.source.id,
|
|
245
|
+
sourceDigest: args.packet.sourceDigest,
|
|
246
|
+
};
|
|
242
247
|
const failed = (reason) => ({
|
|
248
|
+
schemaVersion: 1,
|
|
249
|
+
verifier,
|
|
250
|
+
projectPath,
|
|
243
251
|
execution: 'error',
|
|
244
252
|
reason,
|
|
245
253
|
runDirectory,
|
|
@@ -261,7 +269,7 @@ const executeGuidanceVerifier = async (args) => {
|
|
|
261
269
|
files: executable.files,
|
|
262
270
|
directory: path_1.default.join(runDirectory, 'package'),
|
|
263
271
|
});
|
|
264
|
-
|
|
272
|
+
projectPath = await promises_1.default.realpath(args.projectPath);
|
|
265
273
|
if (!(await promises_1.default.stat(projectPath)).isDirectory())
|
|
266
274
|
return failed('setup_failed');
|
|
267
275
|
const evidenceDirectory = path_1.default.join(runDirectory, 'evidence');
|
|
@@ -324,7 +332,7 @@ const executeGuidanceVerifier = async (args) => {
|
|
|
324
332
|
return failed('invalid_result');
|
|
325
333
|
}
|
|
326
334
|
try {
|
|
327
|
-
await validateEvidence(evidenceDirectory, result.checks.flatMap((check) => check.evidence
|
|
335
|
+
await validateEvidence(evidenceDirectory, result.checks.flatMap((check) => check.evidence.map((artifact) => artifact.path)));
|
|
328
336
|
}
|
|
329
337
|
catch {
|
|
330
338
|
return failed('invalid_evidence');
|
|
@@ -335,6 +343,9 @@ const executeGuidanceVerifier = async (args) => {
|
|
|
335
343
|
else if (result.checks.some((check) => check.status === 'blocked'))
|
|
336
344
|
status = 'blocked';
|
|
337
345
|
return {
|
|
346
|
+
schemaVersion: 1,
|
|
347
|
+
verifier,
|
|
348
|
+
projectPath,
|
|
338
349
|
execution: 'completed',
|
|
339
350
|
status,
|
|
340
351
|
checks: result.checks,
|
|
@@ -3,15 +3,7 @@ declare const HubRecordSchema: z.ZodObject<{
|
|
|
3
3
|
pid: z.ZodNumber;
|
|
4
4
|
token: z.ZodString;
|
|
5
5
|
port: z.ZodNullable<z.ZodNumber>;
|
|
6
|
-
},
|
|
7
|
-
port: number | null;
|
|
8
|
-
token: string;
|
|
9
|
-
pid: number;
|
|
10
|
-
}, {
|
|
11
|
-
port: number | null;
|
|
12
|
-
token: string;
|
|
13
|
-
pid: number;
|
|
14
|
-
}>;
|
|
6
|
+
}, z.core.$strip>;
|
|
15
7
|
export type HubRecord = z.infer<typeof HubRecordSchema>;
|
|
16
8
|
type ClaimResult = {
|
|
17
9
|
status: 'owned';
|
|
@@ -139,22 +139,22 @@ export declare class IntegrationsClient {
|
|
|
139
139
|
cursor?: string;
|
|
140
140
|
signal?: AbortSignal;
|
|
141
141
|
}): Promise<{
|
|
142
|
-
total: number | null;
|
|
143
|
-
nextCursor: string | null;
|
|
144
142
|
collections: {
|
|
143
|
+
id: string;
|
|
144
|
+
title: string;
|
|
145
145
|
description: string | null;
|
|
146
146
|
url: string | null;
|
|
147
|
-
title: string;
|
|
148
|
-
id: string;
|
|
149
|
-
children: string[];
|
|
150
147
|
total: number | null;
|
|
151
148
|
parentId: string | null;
|
|
149
|
+
children: string[];
|
|
152
150
|
}[];
|
|
151
|
+
total: number | null;
|
|
152
|
+
nextCursor: string | null;
|
|
153
153
|
profile: {
|
|
154
|
-
url: string;
|
|
155
|
-
title: string;
|
|
156
154
|
id: string;
|
|
157
155
|
username: string;
|
|
156
|
+
title: string;
|
|
157
|
+
url: string;
|
|
158
158
|
};
|
|
159
159
|
}>;
|
|
160
160
|
readReferenceCollection(input: {
|
|
@@ -165,11 +165,11 @@ export declare class IntegrationsClient {
|
|
|
165
165
|
signal?: AbortSignal;
|
|
166
166
|
}): Promise<{
|
|
167
167
|
accountId: string;
|
|
168
|
+
collectionId: string;
|
|
168
169
|
references: {
|
|
170
|
+
remoteId: string;
|
|
169
171
|
title: string;
|
|
170
172
|
text: string;
|
|
171
|
-
provider: "pinterest" | "arena" | "cosmos" | "x";
|
|
172
|
-
remoteId: string;
|
|
173
173
|
media: {
|
|
174
174
|
hash: string;
|
|
175
175
|
mimeType: "image/png" | "image/jpeg" | "image/webp" | "image/gif";
|
|
@@ -177,21 +177,21 @@ export declare class IntegrationsClient {
|
|
|
177
177
|
representation: "variant" | "image" | "video-cover" | "page";
|
|
178
178
|
page?: number | undefined;
|
|
179
179
|
}[];
|
|
180
|
+
provider: "pinterest" | "arena" | "cosmos" | "x";
|
|
181
|
+
url?: string | undefined;
|
|
182
|
+
remoteImages?: string[] | undefined;
|
|
183
|
+
remoteImageRepresentations?: ("image" | "video-cover")[] | undefined;
|
|
184
|
+
unsupportedReason?: string | undefined;
|
|
180
185
|
variant?: {
|
|
181
186
|
projectId: string;
|
|
182
187
|
sessionId: string;
|
|
183
188
|
variantId: string;
|
|
184
189
|
treeSha?: string | undefined;
|
|
185
190
|
} | undefined;
|
|
186
|
-
url?: string | undefined;
|
|
187
191
|
note?: string | undefined;
|
|
188
|
-
remoteImages?: string[] | undefined;
|
|
189
|
-
remoteImageRepresentations?: ("image" | "video-cover")[] | undefined;
|
|
190
|
-
unsupportedReason?: string | undefined;
|
|
191
192
|
}[];
|
|
192
193
|
total: number | null;
|
|
193
194
|
nextCursor: string | null;
|
|
194
|
-
collectionId: string;
|
|
195
195
|
isCollectionComplete: boolean;
|
|
196
196
|
}>;
|
|
197
197
|
referenceAccount(input: {
|
|
@@ -199,10 +199,10 @@ export declare class IntegrationsClient {
|
|
|
199
199
|
expectedAccountId: string;
|
|
200
200
|
signal?: AbortSignal;
|
|
201
201
|
}): Promise<{
|
|
202
|
-
url: string;
|
|
203
|
-
title: string;
|
|
204
202
|
id: string;
|
|
205
203
|
username: string;
|
|
204
|
+
title: string;
|
|
205
|
+
url: string;
|
|
206
206
|
}>;
|
|
207
207
|
discoverCosmos({ url, cursor, signal, }: CosmosDiscoveryInput): Promise<CosmosProfilePage>;
|
|
208
208
|
fetchCosmos({ url, collectionId, cursor, signal, }: CosmosFetchInput): Promise<CosmosResult>;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import type { ChangeRequest } from '../types/change-request-types';
|
|
2
1
|
export type MCPSource = 'mcp' | 'ui' | 'core';
|
|
3
2
|
export type MCPAuthState = 'authenticated' | 'unauthenticated' | 'unknown';
|
|
4
3
|
export type MCPAuthMethod = 'google' | 'existing_session' | 'hosted_oauth';
|
|
5
|
-
export type MCPTargetKind = 'app' | 'variant' | 'static_preview' | 'unknown';
|
|
6
|
-
export type MCPHandoffPathCategory = 'landing' | 'local_rivet' | 'mcp_client_connect' | 'oauth_callback' | 'unknown';
|
|
7
4
|
export type MCPOAuthCallbackResult = 'accepted' | 'missing_state' | 'missing_code' | 'state_mismatch' | 'exchange_failed' | 'credential_store_failed' | 'unknown';
|
|
8
5
|
export type MCPOnboardingCorrelation = {
|
|
9
6
|
onboardingAttemptId?: string;
|
|
@@ -16,15 +13,4 @@ export type MCPOnboardingCorrelation = {
|
|
|
16
13
|
mcpEditor?: string;
|
|
17
14
|
source?: MCPSource;
|
|
18
15
|
};
|
|
19
|
-
export type MCPConversationTurnMetadata = MCPOnboardingCorrelation & {
|
|
20
|
-
round: number;
|
|
21
|
-
messageCount: number;
|
|
22
|
-
instructionLengthTotal: number;
|
|
23
|
-
maxInstructionLength: number;
|
|
24
|
-
imageCount: number;
|
|
25
|
-
elementCount: number;
|
|
26
|
-
sourceFileCount: number;
|
|
27
|
-
targetKind: MCPTargetKind;
|
|
28
|
-
};
|
|
29
|
-
export declare const summarizeMCPConversationTurn: (request: ChangeRequest, round: number, sessionId: string) => MCPConversationTurnMetadata;
|
|
30
16
|
//# sourceMappingURL=MCPOnboardingTelemetry.d.ts.map
|
|
@@ -1,65 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.summarizeMCPConversationTurn = void 0;
|
|
4
|
-
const commentElements = (item) => [
|
|
5
|
-
item.element,
|
|
6
|
-
...(item.elements ?? []),
|
|
7
|
-
];
|
|
8
|
-
const getTargetKind = (isStaticPreviewTarget, isVariantTarget) => {
|
|
9
|
-
if (isStaticPreviewTarget) {
|
|
10
|
-
return 'static_preview';
|
|
11
|
-
}
|
|
12
|
-
if (isVariantTarget) {
|
|
13
|
-
return 'variant';
|
|
14
|
-
}
|
|
15
|
-
return 'app';
|
|
16
|
-
};
|
|
17
|
-
const summarizeMCPConversationTurn = (request, round, sessionId) => {
|
|
18
|
-
let messageCount = 0;
|
|
19
|
-
let instructionLengthTotal = 0;
|
|
20
|
-
let maxInstructionLength = 0;
|
|
21
|
-
let imageCount = 0;
|
|
22
|
-
let elementCount = 0;
|
|
23
|
-
let isVariantTarget = Boolean(request.target);
|
|
24
|
-
let isStaticPreviewTarget = Boolean(request.staticPreviewTarget);
|
|
25
|
-
for (const item of request.changes) {
|
|
26
|
-
if (item.kind === 'comment') {
|
|
27
|
-
messageCount++;
|
|
28
|
-
instructionLengthTotal += item.instruction.length;
|
|
29
|
-
maxInstructionLength = Math.max(maxInstructionLength, item.instruction.length);
|
|
30
|
-
imageCount += item.images?.length ?? 0;
|
|
31
|
-
elementCount += commentElements(item).length;
|
|
32
|
-
isVariantTarget = isVariantTarget || Boolean(item.target);
|
|
33
|
-
isStaticPreviewTarget =
|
|
34
|
-
isStaticPreviewTarget || Boolean(item.staticPreviewTarget);
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
if (item.kind === 'chat') {
|
|
38
|
-
messageCount++;
|
|
39
|
-
instructionLengthTotal += item.instruction.length;
|
|
40
|
-
maxInstructionLength = Math.max(maxInstructionLength, item.instruction.length);
|
|
41
|
-
imageCount += item.images?.length ?? 0;
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
if ('element' in item) {
|
|
45
|
-
elementCount++;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
sessionId,
|
|
50
|
-
round,
|
|
51
|
-
messageCount,
|
|
52
|
-
instructionLengthTotal,
|
|
53
|
-
maxInstructionLength,
|
|
54
|
-
imageCount,
|
|
55
|
-
elementCount,
|
|
56
|
-
sourceFileCount: new Set(request.sourceFiles ?? []).size,
|
|
57
|
-
targetKind: getTargetKind(isStaticPreviewTarget, isVariantTarget),
|
|
58
|
-
traceId: request.traceId,
|
|
59
|
-
agentRunId: request.agentRunId,
|
|
60
|
-
browserSessionId: request.telemetryContext?.browserSessionId,
|
|
61
|
-
browserDistinctId: request.telemetryContext?.browserDistinctId,
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
exports.summarizeMCPConversationTurn = summarizeMCPConversationTurn;
|
|
65
3
|
//# sourceMappingURL=MCPOnboardingTelemetry.js.map
|