rivet-design 0.14.11 → 0.14.12
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/dist/agent-variants/SessionStore.d.ts.map +1 -1
- package/dist/agent-variants/SessionStore.js +3 -0
- package/dist/agent-variants/SessionStore.js.map +1 -1
- package/dist/agent-variants/WorktreeOrchestrator.d.ts +2 -0
- package/dist/agent-variants/WorktreeOrchestrator.d.ts.map +1 -1
- package/dist/agent-variants/WorktreeOrchestrator.js +48 -30
- package/dist/agent-variants/WorktreeOrchestrator.js.map +1 -1
- package/dist/agent-variants/contextAssets.d.ts +23 -0
- package/dist/agent-variants/contextAssets.d.ts.map +1 -0
- package/dist/agent-variants/contextAssets.js +199 -0
- package/dist/agent-variants/contextAssets.js.map +1 -0
- package/dist/agent-variants/contracts.d.ts +730 -180
- package/dist/agent-variants/contracts.d.ts.map +1 -1
- package/dist/agent-variants/contracts.js +33 -2
- package/dist/agent-variants/contracts.js.map +1 -1
- package/dist/agent-variants/variantContext.d.ts +2 -1
- package/dist/agent-variants/variantContext.d.ts.map +1 -1
- package/dist/agent-variants/variantContext.js +9 -0
- package/dist/agent-variants/variantContext.js.map +1 -1
- package/dist/agent-variants/workItemBriefing.d.ts.map +1 -1
- package/dist/agent-variants/workItemBriefing.js +12 -0
- package/dist/agent-variants/workItemBriefing.js.map +1 -1
- package/dist/cli/commands/mcpServe.d.ts +3 -1
- package/dist/cli/commands/mcpServe.d.ts.map +1 -1
- package/dist/cli/commands/mcpServe.js +164 -24
- package/dist/cli/commands/mcpServe.js.map +1 -1
- package/dist/cli/commands/reference.d.ts.map +1 -1
- package/dist/cli/commands/reference.js +10 -4
- package/dist/cli/commands/reference.js.map +1 -1
- package/dist/cli/commands/serve.d.ts.map +1 -1
- package/dist/cli/commands/serve.js +36 -7
- package/dist/cli/commands/serve.js.map +1 -1
- package/dist/cli/commands/variants.d.ts.map +1 -1
- package/dist/cli/commands/variants.js +69 -1
- package/dist/cli/commands/variants.js.map +1 -1
- package/dist/cli/commands/wait.d.ts +38 -0
- package/dist/cli/commands/wait.d.ts.map +1 -1
- package/dist/cli/commands/wait.js +16 -2
- package/dist/cli/commands/wait.js.map +1 -1
- package/dist/cli/router.d.ts.map +1 -1
- package/dist/cli/router.js +3 -0
- package/dist/cli/router.js.map +1 -1
- package/dist/cli/telemetry.d.ts +14 -0
- package/dist/cli/telemetry.d.ts.map +1 -0
- package/dist/cli/telemetry.js +71 -0
- package/dist/cli/telemetry.js.map +1 -0
- package/dist/config/telemetryContract.d.ts +3 -0
- package/dist/config/telemetryContract.d.ts.map +1 -0
- package/dist/config/telemetryContract.js +6 -0
- package/dist/config/telemetryContract.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +95 -6
- package/dist/index.js.map +1 -1
- package/dist/routes/agentVariants.d.ts.map +1 -1
- package/dist/routes/agentVariants.js +5 -0
- package/dist/routes/agentVariants.js.map +1 -1
- package/dist/services/TelemetryService.d.ts +47 -10
- package/dist/services/TelemetryService.d.ts.map +1 -1
- package/dist/services/TelemetryService.js +66 -13
- package/dist/services/TelemetryService.js.map +1 -1
- package/dist/services/VariantGenerationService.d.ts.map +1 -1
- package/dist/services/VariantGenerationService.js +10 -4
- package/dist/services/VariantGenerationService.js.map +1 -1
- package/dist/types/change-request-types.d.ts +3 -0
- package/dist/types/change-request-types.d.ts.map +1 -1
- package/dist/types/change-request-types.js +0 -5
- package/dist/types/change-request-types.js.map +1 -1
- package/package.json +1 -1
- package/src/ui/dist/assets/main-CgF_gMPR.js +422 -0
- package/src/ui/dist/index.html +1 -1
- package/src/ui/dist/assets/main-EGX1lAi3.js +0 -422
|
@@ -29,6 +29,7 @@ const VariantWorkspaceManager_1 = require("./VariantWorkspaceManager");
|
|
|
29
29
|
const diffQa_1 = require("./diffQa");
|
|
30
30
|
const VariantHistoryService_1 = require("../services/VariantHistoryService");
|
|
31
31
|
const variantContext_1 = require("./variantContext");
|
|
32
|
+
const contextAssets_1 = require("./contextAssets");
|
|
32
33
|
const log = (0, logger_1.createLogger)('AgentVariantsOrchestrator');
|
|
33
34
|
const FRESH_DEV_SERVER_HOST = '127.0.0.1';
|
|
34
35
|
const BRIEF_LABEL_MAX_LENGTH = 48;
|
|
@@ -142,28 +143,16 @@ function withProvisionTimeout(work, timeoutMs) {
|
|
|
142
143
|
return Promise.race([work, timeout]).finally(() => clearTimeout(timer));
|
|
143
144
|
}
|
|
144
145
|
/**
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* configs. The check is defense-in-depth alongside the path / symlink
|
|
149
|
-
* filters in `copyAssetIntoWorktree`; without it, a prompt-injected
|
|
150
|
-
* source plan could copy readable host files such as SSH keys or
|
|
151
|
-
* project secrets into the generated app.
|
|
152
|
-
*
|
|
153
|
-
* Intentionally excludes `.json`, `.txt`, `.md`, `.csv`: these are
|
|
154
|
-
* common carriers for credentials (`credentials.json`, `.aws/config`,
|
|
155
|
-
* shell history `.txt`, README-shaped secrets) and have no legitimate
|
|
156
|
-
* use as binary preview assets. If a future flow needs structured data
|
|
157
|
-
* it should ship it through the manifest instead of file copy.
|
|
146
|
+
* File types an agent-authored asset plan may copy into a generated preview.
|
|
147
|
+
* This allowlist protects an agent-controlled path; caller-selected context
|
|
148
|
+
* assets use the separate, type-neutral delivery path.
|
|
158
149
|
*/
|
|
159
|
-
const
|
|
160
|
-
// 3D / models
|
|
150
|
+
const ALLOWED_INERT_ASSET_EXTENSIONS = new Set([
|
|
161
151
|
'.glb',
|
|
162
152
|
'.gltf',
|
|
163
153
|
'.obj',
|
|
164
154
|
'.fbx',
|
|
165
155
|
'.usdz',
|
|
166
|
-
// images
|
|
167
156
|
'.png',
|
|
168
157
|
'.jpg',
|
|
169
158
|
'.jpeg',
|
|
@@ -173,22 +162,18 @@ const ALLOWED_ASSET_EXTENSIONS = new Set([
|
|
|
173
162
|
'.avif',
|
|
174
163
|
'.bmp',
|
|
175
164
|
'.ico',
|
|
176
|
-
// video
|
|
177
165
|
'.mp4',
|
|
178
166
|
'.webm',
|
|
179
167
|
'.mov',
|
|
180
|
-
// audio
|
|
181
168
|
'.mp3',
|
|
182
169
|
'.wav',
|
|
183
170
|
'.ogg',
|
|
184
171
|
'.m4a',
|
|
185
|
-
// fonts
|
|
186
172
|
'.woff',
|
|
187
173
|
'.woff2',
|
|
188
174
|
'.ttf',
|
|
189
175
|
'.otf',
|
|
190
176
|
'.eot',
|
|
191
|
-
// PDFs
|
|
192
177
|
'.pdf',
|
|
193
178
|
]);
|
|
194
179
|
/**
|
|
@@ -267,7 +252,7 @@ function copyAssetIntoWorktree(worktreePath, entry, assetSourceRoot) {
|
|
|
267
252
|
? entry.source
|
|
268
253
|
: path_1.default.resolve(assetSourceRoot, entry.source);
|
|
269
254
|
const ext = path_1.default.extname(absoluteSource).toLowerCase();
|
|
270
|
-
if (!
|
|
255
|
+
if (!ALLOWED_INERT_ASSET_EXTENSIONS.has(ext)) {
|
|
271
256
|
throw new errors_1.AgentVariantsError('RUNTIME_VALIDATION_FAILED', `assetPlan.source extension '${ext || '(none)'}' is not on the allowlist (got '${entry.source}'). Only inert media/font/document assets may be copied.`);
|
|
272
257
|
}
|
|
273
258
|
// lstat first: a symlink whose target lies outside the source path
|
|
@@ -331,7 +316,7 @@ function copyAssetIntoWorktree(worktreePath, entry, assetSourceRoot) {
|
|
|
331
316
|
throw new errors_1.AgentVariantsError('RUNTIME_VALIDATION_FAILED', `assetPlan.source traverses a sensitive directory and is refused: ${entry.source}`);
|
|
332
317
|
}
|
|
333
318
|
const resolvedExt = path_1.default.extname(resolvedSource).toLowerCase();
|
|
334
|
-
if (!
|
|
319
|
+
if (!ALLOWED_INERT_ASSET_EXTENSIONS.has(resolvedExt)) {
|
|
335
320
|
throw new errors_1.AgentVariantsError('RUNTIME_VALIDATION_FAILED', `assetPlan.source resolved extension '${resolvedExt || '(none)'}' is not on the allowlist (resolved from '${entry.source}').`);
|
|
336
321
|
}
|
|
337
322
|
const normalizedDest = path_1.default.normalize(entry.destination);
|
|
@@ -559,6 +544,7 @@ class AgentVariantsOrchestrator {
|
|
|
559
544
|
requestedCount: args.count ?? contracts_1.DEFAULT_VARIANT_COUNT,
|
|
560
545
|
});
|
|
561
546
|
}
|
|
547
|
+
const designContextCount = projectContext.designContext?.length ?? 0;
|
|
562
548
|
this.telemetry.track('agent_variants.session_started', {
|
|
563
549
|
source: 'mcp',
|
|
564
550
|
sessionId: result.sessionId,
|
|
@@ -566,6 +552,8 @@ class AgentVariantsOrchestrator {
|
|
|
566
552
|
hasTarget: Boolean(args.target),
|
|
567
553
|
targetType: args.target?.type ?? null,
|
|
568
554
|
projectContextKind: args.projectContext?.kind ?? 'existing',
|
|
555
|
+
design_context_count: designContextCount,
|
|
556
|
+
design_context_kinds: designContextCount > 0 ? ['design_system'] : [],
|
|
569
557
|
});
|
|
570
558
|
this.emitChange();
|
|
571
559
|
return result;
|
|
@@ -697,7 +685,7 @@ class AgentVariantsOrchestrator {
|
|
|
697
685
|
.filter((source) => source.transport === 'file')
|
|
698
686
|
.map((source) => ({
|
|
699
687
|
path: source.path,
|
|
700
|
-
...(source.label ?? source.originalFilename
|
|
688
|
+
...((source.label ?? source.originalFilename)
|
|
701
689
|
? { label: source.label ?? source.originalFilename }
|
|
702
690
|
: {}),
|
|
703
691
|
}));
|
|
@@ -719,6 +707,9 @@ class AgentVariantsOrchestrator {
|
|
|
719
707
|
workItemId: item.workId,
|
|
720
708
|
kind,
|
|
721
709
|
});
|
|
710
|
+
const contextAssets = this.resources
|
|
711
|
+
.get(sessionId)
|
|
712
|
+
?.contextAssets.get(item.workId);
|
|
722
713
|
const mode = input.sourceVariantId
|
|
723
714
|
? 'vary'
|
|
724
715
|
: DEFAULT_EXECUTION_MODE_BY_KIND[kind];
|
|
@@ -756,6 +747,7 @@ class AgentVariantsOrchestrator {
|
|
|
756
747
|
? { contextBundlePath: input.context.contextBundlePath }
|
|
757
748
|
: {}),
|
|
758
749
|
...(AgentVariantsOrchestrator.contextFilesOf(input.context) ?? {}),
|
|
750
|
+
...(contextAssets?.length ? { contextAssets } : {}),
|
|
759
751
|
completion: kind === 'code_gen'
|
|
760
752
|
? { kind: 'worktree_diff' }
|
|
761
753
|
: { kind: 'static_artifact' },
|
|
@@ -1074,12 +1066,12 @@ class AgentVariantsOrchestrator {
|
|
|
1074
1066
|
const result = this.store.requestWork(args);
|
|
1075
1067
|
try {
|
|
1076
1068
|
this.ensureStaticWorkspaces(args.sessionId, result.leasedWorkItems);
|
|
1069
|
+
this.materializeContextAssets(args.sessionId, result.leasedWorkItems);
|
|
1077
1070
|
}
|
|
1078
1071
|
catch (error) {
|
|
1079
1072
|
for (const item of result.leasedWorkItems) {
|
|
1080
|
-
if (item.kind
|
|
1073
|
+
if (!isImplementationWorkItemKind(item.kind))
|
|
1081
1074
|
continue;
|
|
1082
|
-
}
|
|
1083
1075
|
try {
|
|
1084
1076
|
this.store.reportComplete({
|
|
1085
1077
|
sessionId: args.sessionId,
|
|
@@ -1091,7 +1083,7 @@ class AgentVariantsOrchestrator {
|
|
|
1091
1083
|
code: 'RUNTIME_VALIDATION_FAILED',
|
|
1092
1084
|
message: error instanceof Error
|
|
1093
1085
|
? error.message
|
|
1094
|
-
: 'Failed to
|
|
1086
|
+
: 'Failed to prepare variant workspace',
|
|
1095
1087
|
},
|
|
1096
1088
|
});
|
|
1097
1089
|
}
|
|
@@ -1133,6 +1125,24 @@ class AgentVariantsOrchestrator {
|
|
|
1133
1125
|
this.emitChange();
|
|
1134
1126
|
return decorated;
|
|
1135
1127
|
}
|
|
1128
|
+
/** @effect Copies caller-supplied context assets into each leased workspace. */
|
|
1129
|
+
materializeContextAssets(sessionId, items) {
|
|
1130
|
+
const resources = this.ensureResources(sessionId);
|
|
1131
|
+
for (const item of items) {
|
|
1132
|
+
if (!isImplementationWorkItemKind(item.kind))
|
|
1133
|
+
continue;
|
|
1134
|
+
const input = (item.input ?? {});
|
|
1135
|
+
const assets = input.context?.contextAssets ?? [];
|
|
1136
|
+
if (assets.length === 0)
|
|
1137
|
+
continue;
|
|
1138
|
+
const workspace = this.getAssignedWorkspace({
|
|
1139
|
+
sessionId,
|
|
1140
|
+
workItemId: item.id,
|
|
1141
|
+
kind: item.kind,
|
|
1142
|
+
});
|
|
1143
|
+
resources.contextAssets.set(item.id, (0, contextAssets_1.materializeContextAssets)({ assets, workspace }));
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1136
1146
|
/**
|
|
1137
1147
|
* @effect Writes each leased implementation item's server-authored briefing
|
|
1138
1148
|
* BESIDE its workspace so the coordinating host dispatches workers with a
|
|
@@ -1934,6 +1944,7 @@ class AgentVariantsOrchestrator {
|
|
|
1934
1944
|
const projectContext = args.projectContext ?? {
|
|
1935
1945
|
kind: 'existing',
|
|
1936
1946
|
};
|
|
1947
|
+
const designContextCount = projectContext.designContext?.length ?? 0;
|
|
1937
1948
|
// Fresh source-grounded sessions (a captured context bundle on a fresh
|
|
1938
1949
|
// project) must run through `propose` so the source-research/source_plan
|
|
1939
1950
|
// flow gates generation; start_variants routes them there before reaching
|
|
@@ -2056,6 +2067,8 @@ class AgentVariantsOrchestrator {
|
|
|
2056
2067
|
hasTarget: Boolean(args.target),
|
|
2057
2068
|
targetType: args.target?.type ?? null,
|
|
2058
2069
|
projectContextKind: projectContext.kind,
|
|
2070
|
+
design_context_count: designContextCount,
|
|
2071
|
+
design_context_kinds: designContextCount > 0 ? ['design_system'] : [],
|
|
2059
2072
|
});
|
|
2060
2073
|
sessionId = proposeResult.sessionId;
|
|
2061
2074
|
scaffoldBaseWorkItemId = approveResult.scaffoldBaseWorkItemId ?? null;
|
|
@@ -2245,7 +2258,11 @@ class AgentVariantsOrchestrator {
|
|
|
2245
2258
|
async provisionAppendedExistingWorktrees(sessionId, workItemIds) {
|
|
2246
2259
|
if (workItemIds.length === 0)
|
|
2247
2260
|
return;
|
|
2248
|
-
await this.withProvisioningTelemetry({
|
|
2261
|
+
await this.withProvisioningTelemetry({
|
|
2262
|
+
sessionId,
|
|
2263
|
+
kind: 'appended_existing',
|
|
2264
|
+
variantCount: workItemIds.length,
|
|
2265
|
+
}, async () => {
|
|
2249
2266
|
const resources = this.ensureResources(sessionId);
|
|
2250
2267
|
const instanceKeyPrefix = `a${(0, crypto_1.randomUUID)().slice(0, 8)}-`;
|
|
2251
2268
|
const paths = await withProvisionTimeout(this.worktrees.createWorktrees(sessionId, workItemIds.length, instanceKeyPrefix), this.provisionTimeoutMs);
|
|
@@ -4238,7 +4255,7 @@ class AgentVariantsOrchestrator {
|
|
|
4238
4255
|
label: input.briefLabel,
|
|
4239
4256
|
brief: input.briefBody,
|
|
4240
4257
|
sessionPrompt,
|
|
4241
|
-
runLabel: this.store.getRunLabel(args.sessionId),
|
|
4258
|
+
runLabel: input.runLabel ?? this.store.getRunLabel(args.sessionId),
|
|
4242
4259
|
kind: 'diff',
|
|
4243
4260
|
diff: args.diff,
|
|
4244
4261
|
sourceDir,
|
|
@@ -4483,7 +4500,7 @@ class AgentVariantsOrchestrator {
|
|
|
4483
4500
|
label: input.briefLabel,
|
|
4484
4501
|
brief: input.briefBody,
|
|
4485
4502
|
sessionPrompt,
|
|
4486
|
-
runLabel: this.store.getRunLabel(args.sessionId),
|
|
4503
|
+
runLabel: input.runLabel ?? this.store.getRunLabel(args.sessionId),
|
|
4487
4504
|
kind: 'project-created',
|
|
4488
4505
|
sourceDir,
|
|
4489
4506
|
preview,
|
|
@@ -5297,6 +5314,7 @@ class AgentVariantsOrchestrator {
|
|
|
5297
5314
|
worktrees: new Map(),
|
|
5298
5315
|
staticPreviews: new Map(),
|
|
5299
5316
|
workspaceManager: new VariantWorkspaceManager_1.VariantWorkspaceManager(),
|
|
5317
|
+
contextAssets: new Map(),
|
|
5300
5318
|
cleanupStarted: false,
|
|
5301
5319
|
committedVariantIds: new Set(),
|
|
5302
5320
|
startedAt: Date.now(),
|
|
@@ -6191,7 +6209,7 @@ const STATIC_PREVIEW_HISTORY_EXCLUDE = new Set([
|
|
|
6191
6209
|
'.rivet',
|
|
6192
6210
|
]);
|
|
6193
6211
|
const STATIC_PREVIEW_HISTORY_FILE_EXTENSIONS = new Set([
|
|
6194
|
-
...
|
|
6212
|
+
...ALLOWED_INERT_ASSET_EXTENSIONS,
|
|
6195
6213
|
'.css',
|
|
6196
6214
|
'.htm',
|
|
6197
6215
|
'.html',
|