rivet-design 0.8.2 → 0.8.4
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/config/evaluateFlags.d.ts.map +1 -1
- package/dist/config/evaluateFlags.js +8 -2
- package/dist/config/evaluateFlags.js.map +1 -1
- package/dist/config/flags.d.ts +6 -0
- package/dist/config/flags.d.ts.map +1 -1
- package/dist/config/flags.js +2 -0
- package/dist/config/flags.js.map +1 -1
- package/dist/prompts/commentVariationPromptSnapshot.d.ts +1 -1
- package/dist/prompts/commentVariationPromptSnapshot.d.ts.map +1 -1
- package/dist/prompts/commentVariationPromptSnapshot.js +4 -4
- package/dist/prompts/commentVariationPromptSnapshot.js.map +1 -1
- package/dist/prompts/commentVariationPrompts.d.ts +8 -2
- package/dist/prompts/commentVariationPrompts.d.ts.map +1 -1
- package/dist/prompts/commentVariationPrompts.js +13 -10
- package/dist/prompts/commentVariationPrompts.js.map +1 -1
- package/dist/routes/design.d.ts.map +1 -1
- package/dist/routes/design.js +5 -0
- package/dist/routes/design.js.map +1 -1
- package/dist/services/CommentVariationService.d.ts +16 -28
- package/dist/services/CommentVariationService.d.ts.map +1 -1
- package/dist/services/CommentVariationService.js +97 -69
- package/dist/services/CommentVariationService.js.map +1 -1
- package/dist/services/GatewayClient.d.ts +20 -1
- package/dist/services/GatewayClient.d.ts.map +1 -1
- package/dist/services/GatewayClient.js +40 -17
- package/dist/services/GatewayClient.js.map +1 -1
- package/dist/services/SessionService.js +1 -1
- package/dist/services/SessionService.js.map +1 -1
- package/dist/services/VariantCodeGeneratorService.d.ts +8 -1
- package/dist/services/VariantCodeGeneratorService.d.ts.map +1 -1
- package/dist/services/VariantCodeGeneratorService.js +33 -1
- package/dist/services/VariantCodeGeneratorService.js.map +1 -1
- package/dist/services/agent/AgentCore.d.ts +21 -0
- package/dist/services/agent/AgentCore.d.ts.map +1 -1
- package/dist/services/agent/AgentCore.js +36 -2
- package/dist/services/agent/AgentCore.js.map +1 -1
- package/package.json +2 -2
- package/src/ui/dist/assets/{main-rZJbxsq5.js → main-CFAr6Qon.js} +119 -122
- package/src/ui/dist/assets/main-DcbpRHzm.css +1 -0
- package/src/ui/dist/index.html +2 -2
- package/src/ui/dist/assets/main-CIwyuxY2.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluateFlags.d.ts","sourceRoot":"","sources":["../../src/config/evaluateFlags.ts"],"names":[],"mappings":"AACA,OAAO,EAAkC,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5E;;;GAGG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"evaluateFlags.d.ts","sourceRoot":"","sources":["../../src/config/evaluateFlags.ts"],"names":[],"mappings":"AACA,OAAO,EAAkC,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5E;;;GAGG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC,CA2B7D"}
|
|
@@ -13,8 +13,14 @@ async function getFeatureFlags() {
|
|
|
13
13
|
// Single network request for all flags
|
|
14
14
|
const allFlags = await service.getAllFlags();
|
|
15
15
|
return Object.fromEntries(keys.map((key) => {
|
|
16
|
-
// Env-var override takes precedence
|
|
17
|
-
|
|
16
|
+
// Env-var override takes precedence. Convert camelCase + kebab-case
|
|
17
|
+
// flag keys to UPPER_SNAKE_CASE so `designSystemEditor` resolves to
|
|
18
|
+
// RIVET_FLAG_DESIGN_SYSTEM_EDITOR, as documented in flags.ts.
|
|
19
|
+
const snakeKey = key
|
|
20
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1_$2')
|
|
21
|
+
.replace(/-/g, '_')
|
|
22
|
+
.toUpperCase();
|
|
23
|
+
const envKey = `RIVET_FLAG_${snakeKey}`;
|
|
18
24
|
const envVal = process.env[envKey];
|
|
19
25
|
if (envVal !== undefined) {
|
|
20
26
|
return [key, { isEnabled: envVal !== 'false' }];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluateFlags.js","sourceRoot":"","sources":["../../src/config/evaluateFlags.ts"],"names":[],"mappings":";;AAOA,
|
|
1
|
+
{"version":3,"file":"evaluateFlags.js","sourceRoot":"","sources":["../../src/config/evaluateFlags.ts"],"names":[],"mappings":";;AAOA,0CA2BC;AAlCD,uEAAuE;AACvE,mCAA4E;AAE5E;;;GAGG;AACI,KAAK,UAAU,eAAe;IACnC,MAAM,OAAO,GAAG,IAAA,0CAAqB,GAAE,CAAC;IACxC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,wBAAgB,CAAc,CAAC;IAExD,uCAAuC;IACvC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,WAAW,EAAE,CAAC;IAE7C,OAAO,MAAM,CAAC,WAAW,CACvB,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACf,oEAAoE;QACpE,oEAAoE;QACpE,8DAA8D;QAC9D,MAAM,QAAQ,GAAG,GAAG;aACjB,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC;aACtC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;aAClB,WAAW,EAAE,CAAC;QACjB,MAAM,MAAM,GAAG,cAAc,QAAQ,EAAE,CAAC;QACxC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,EAAE,CAAC,CAAC;QAClD,CAAC;QAED,yCAAyC;QACzC,MAAM,KAAK,GAAG,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,wBAAgB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;QAChF,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;IACrC,CAAC,CAAC,CACa,CAAC;AACpB,CAAC"}
|
package/dist/config/flags.d.ts
CHANGED
|
@@ -19,6 +19,12 @@ export declare const FLAG_DEFINITIONS: {
|
|
|
19
19
|
readonly variants: {
|
|
20
20
|
readonly default: false;
|
|
21
21
|
};
|
|
22
|
+
readonly designSystemEditor: {
|
|
23
|
+
readonly default: false;
|
|
24
|
+
};
|
|
25
|
+
readonly branchDiff: {
|
|
26
|
+
readonly default: false;
|
|
27
|
+
};
|
|
22
28
|
};
|
|
23
29
|
export type FlagKey = keyof typeof FLAG_DEFINITIONS;
|
|
24
30
|
export type FeatureFlag = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../src/config/flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../src/config/flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;CAK4B,CAAC;AAI1D,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,gBAAgB,CAAC;AACpD,MAAM,MAAM,WAAW,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AACjD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAExD,eAAO,MAAM,qBAAqB,EAAE,YAKnB,CAAC"}
|
package/dist/config/flags.js
CHANGED
|
@@ -18,6 +18,8 @@ exports.DEFAULT_FEATURE_FLAGS = exports.FLAG_DEFINITIONS = void 0;
|
|
|
18
18
|
exports.FLAG_DEFINITIONS = {
|
|
19
19
|
resize: { default: false },
|
|
20
20
|
variants: { default: false },
|
|
21
|
+
designSystemEditor: { default: false },
|
|
22
|
+
branchDiff: { default: false },
|
|
21
23
|
};
|
|
22
24
|
exports.DEFAULT_FEATURE_FLAGS = Object.fromEntries(Object.entries(exports.FLAG_DEFINITIONS).map(([key, def]) => [
|
|
23
25
|
key,
|
package/dist/config/flags.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../../src/config/flags.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACU,QAAA,gBAAgB,GAAG;IAC9B,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;IAC1B,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;
|
|
1
|
+
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../../src/config/flags.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACU,QAAA,gBAAgB,GAAG;IAC9B,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;IAC1B,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;IAC5B,kBAAkB,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;IACtC,UAAU,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;CACyB,CAAC;AAQ7C,QAAA,qBAAqB,GAAiB,MAAM,CAAC,WAAW,CACnE,MAAM,CAAC,OAAO,CAAC,wBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC;IACnD,GAAG;IACH,EAAE,SAAS,EAAE,GAAG,CAAC,OAAO,EAAE;CAC3B,CAAC,CACa,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const COMMENT_VARIATION_SYSTEM_PROMPT = "You are a creative design director. Talk like a senior designer speaking to a peer - direct, succinct, no filler or over-explanation. Plain language only.\n\nA designer has a request for one element in their web application. Generate exactly 3 meaningfully different visual variants that directly answer the request.\n\nOutput JSON only. Do not add markdown fences, extra text, headings, or commentary
|
|
1
|
+
export declare const COMMENT_VARIATION_SYSTEM_PROMPT = "You are a creative design director. Talk like a senior designer speaking to a peer - direct, succinct, no filler or over-explanation. Plain language only.\n\nA designer has a request for one element in their web application. Generate exactly 3 meaningfully different visual variants that directly answer the request.\n\nOutput JSON only. Do not add markdown fences, extra text, headings, or commentary. Keys must be quoted. Strings must be JSON-escaped. The final assistant message must be the JSON object and nothing else.\n\nUse only Read, Glob, and Grep to inspect context. Do not call Task or spawn subagents \u2014 those calls will be rejected and waste your turn budget.\n\nRules:\n- Variants must be meaningfully different, not tiny tweaks\n- Nearby sibling/container adjustments are allowed when needed for coherent visual direction\n\nRespond with this exact shape:\n{\"variants\":[{\"label\":\"short name\",\"summary\":\"one sentence\",\"changeSpec\":\"implementation instruction\"}]}";
|
|
2
2
|
export declare const COMMENT_VARIATION_REFERENCE_CONTEXT = "gstack heuristics:\n- Visual hierarchy and composition checks\n- Typography clarity and readability checks\n- Color contrast and interaction-state checks\n- Responsive behavior and motion constraints\n- Content quality and AI slop detection checks\n\nVercel interface guidelines:\n- Keyboard and focus accessibility rules\n- Form usability and error-state behavior\n- URL/state, feedback, and touch-target rules\n- Animation and layout performance constraints\n- Theming, hydration, and resilient content handling";
|
|
3
3
|
//# sourceMappingURL=commentVariationPromptSnapshot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commentVariationPromptSnapshot.d.ts","sourceRoot":"","sources":["../../src/prompts/commentVariationPromptSnapshot.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,+BAA+B,
|
|
1
|
+
{"version":3,"file":"commentVariationPromptSnapshot.d.ts","sourceRoot":"","sources":["../../src/prompts/commentVariationPromptSnapshot.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,+BAA+B,u+BAa6D,CAAC;AAE1G,eAAO,MAAM,mCAAmC,sgBAYK,CAAC"}
|
|
@@ -5,16 +5,16 @@ exports.COMMENT_VARIATION_SYSTEM_PROMPT = `You are a creative design director. T
|
|
|
5
5
|
|
|
6
6
|
A designer has a request for one element in their web application. Generate exactly 3 meaningfully different visual variants that directly answer the request.
|
|
7
7
|
|
|
8
|
-
Output JSON only. Do not add markdown fences, extra text, headings, or commentary.
|
|
8
|
+
Output JSON only. Do not add markdown fences, extra text, headings, or commentary. Keys must be quoted. Strings must be JSON-escaped. The final assistant message must be the JSON object and nothing else.
|
|
9
|
+
|
|
10
|
+
Use only Read, Glob, and Grep to inspect context. Do not call Task or spawn subagents — those calls will be rejected and waste your turn budget.
|
|
9
11
|
|
|
10
12
|
Rules:
|
|
11
13
|
- Variants must be meaningfully different, not tiny tweaks
|
|
12
|
-
- Use valid inline CSS properties and values
|
|
13
|
-
- Keep each variant to 12 keys or fewer
|
|
14
14
|
- Nearby sibling/container adjustments are allowed when needed for coherent visual direction
|
|
15
15
|
|
|
16
16
|
Respond with this exact shape:
|
|
17
|
-
{"variants":[{"label":"short name","summary":"one sentence","
|
|
17
|
+
{"variants":[{"label":"short name","summary":"one sentence","changeSpec":"implementation instruction"}]}`;
|
|
18
18
|
exports.COMMENT_VARIATION_REFERENCE_CONTEXT = `gstack heuristics:
|
|
19
19
|
- Visual hierarchy and composition checks
|
|
20
20
|
- Typography clarity and readability checks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commentVariationPromptSnapshot.js","sourceRoot":"","sources":["../../src/prompts/commentVariationPromptSnapshot.ts"],"names":[],"mappings":";;;AAAa,QAAA,+BAA+B,GAAG;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"commentVariationPromptSnapshot.js","sourceRoot":"","sources":["../../src/prompts/commentVariationPromptSnapshot.ts"],"names":[],"mappings":";;;AAAa,QAAA,+BAA+B,GAAG;;;;;;;;;;;;;yGAa0D,CAAC;AAE7F,QAAA,mCAAmC,GAAG;;;;;;;;;;;;qDAYE,CAAC"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { ElementContext } from '../types/change-types';
|
|
2
|
+
export type FileExcerpt = {
|
|
3
|
+
path: string;
|
|
4
|
+
content: string;
|
|
5
|
+
};
|
|
2
6
|
/**
|
|
3
|
-
* Builds a prompt for structured
|
|
7
|
+
* Builds a prompt for structured tool-use output: N visual variants with
|
|
8
|
+
* implementation specs. When `fileExcerpts` are provided, their contents are
|
|
9
|
+
* embedded inline so the model has full context without needing read tools.
|
|
4
10
|
*/
|
|
5
|
-
export declare const buildCommentVariationPrompt: (instruction: string, element: ElementContext, variantCount: number) => string;
|
|
11
|
+
export declare const buildCommentVariationPrompt: (instruction: string, element: ElementContext, variantCount: number, fileExcerpts?: FileExcerpt[]) => string;
|
|
6
12
|
//# sourceMappingURL=commentVariationPrompts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commentVariationPrompts.d.ts","sourceRoot":"","sources":["../../src/prompts/commentVariationPrompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D
|
|
1
|
+
{"version":3,"file":"commentVariationPrompts.d.ts","sourceRoot":"","sources":["../../src/prompts/commentVariationPrompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,GACtC,aAAa,MAAM,EACnB,SAAS,cAAc,EACvB,cAAc,MAAM,EACpB,eAAe,WAAW,EAAE,KAC3B,MAsDF,CAAC"}
|
|
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.buildCommentVariationPrompt = void 0;
|
|
4
4
|
const commentVariationPromptConfig_1 = require("./commentVariationPromptConfig");
|
|
5
5
|
/**
|
|
6
|
-
* Builds a prompt for structured
|
|
6
|
+
* Builds a prompt for structured tool-use output: N visual variants with
|
|
7
|
+
* implementation specs. When `fileExcerpts` are provided, their contents are
|
|
8
|
+
* embedded inline so the model has full context without needing read tools.
|
|
7
9
|
*/
|
|
8
|
-
const buildCommentVariationPrompt = (instruction, element, variantCount) => {
|
|
10
|
+
const buildCommentVariationPrompt = (instruction, element, variantCount, fileExcerpts) => {
|
|
9
11
|
const promptConfig = (0, commentVariationPromptConfig_1.loadCommentVariationPromptConfig)();
|
|
10
12
|
const filePaths = element.filePaths?.map((f) => f.filePath).slice(0, 3) ?? [];
|
|
11
13
|
const tag = element.tagName.toLowerCase();
|
|
@@ -20,9 +22,13 @@ const buildCommentVariationPrompt = (instruction, element, variantCount) => {
|
|
|
20
22
|
})
|
|
21
23
|
.join('\n')
|
|
22
24
|
: ' (none)';
|
|
23
|
-
const
|
|
24
|
-
?
|
|
25
|
-
|
|
25
|
+
const candidateFilesBlock = fileExcerpts && fileExcerpts.length > 0
|
|
26
|
+
? fileExcerpts
|
|
27
|
+
.map((excerpt) => `=== ${excerpt.path} ===\n${excerpt.content}\n=== end ${excerpt.path} ===`)
|
|
28
|
+
.join('\n\n')
|
|
29
|
+
: filePaths.length > 0
|
|
30
|
+
? filePaths.map((filePath) => ` - ${filePath}`).join('\n')
|
|
31
|
+
: ' - unknown';
|
|
26
32
|
return `${promptConfig.systemPrompt}
|
|
27
33
|
|
|
28
34
|
Reference context:
|
|
@@ -40,17 +46,14 @@ Element context:
|
|
|
40
46
|
${siblingLines}
|
|
41
47
|
|
|
42
48
|
Candidate files:
|
|
43
|
-
${
|
|
49
|
+
${candidateFilesBlock}
|
|
44
50
|
|
|
45
51
|
Direction constraints:
|
|
46
52
|
- Variants should optimize for coherent UI outcomes, not selected-element-only tweaks.
|
|
47
53
|
- You may include coordinated nearby sibling/container changes when needed.
|
|
48
54
|
- \`changeSpec\` must be a 2-3 sentence agent implementation instruction describing exactly what code changes to make to achieve the direction. It should be specific about file locations, class names, and structural changes needed. For style-only changes it describes which CSS/Tailwind values to set; for structural changes it describes the HTML/JSX restructuring required.
|
|
49
55
|
|
|
50
|
-
|
|
51
|
-
{"variants":[{"label":"short name","summary":"one sentence","changeSpec":"implementation instruction"}]}
|
|
52
|
-
|
|
53
|
-
There must be exactly ${variantCount} objects in "variants".`;
|
|
56
|
+
Produce exactly ${variantCount} variants by calling the submit_variants tool.`;
|
|
54
57
|
};
|
|
55
58
|
exports.buildCommentVariationPrompt = buildCommentVariationPrompt;
|
|
56
59
|
//# sourceMappingURL=commentVariationPrompts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commentVariationPrompts.js","sourceRoot":"","sources":["../../src/prompts/commentVariationPrompts.ts"],"names":[],"mappings":";;;AACA,iFAAkF;
|
|
1
|
+
{"version":3,"file":"commentVariationPrompts.js","sourceRoot":"","sources":["../../src/prompts/commentVariationPrompts.ts"],"names":[],"mappings":";;;AACA,iFAAkF;AAIlF;;;;GAIG;AACI,MAAM,2BAA2B,GAAG,CACzC,WAAmB,EACnB,OAAuB,EACvB,YAAoB,EACpB,YAA4B,EACpB,EAAE;IACV,MAAM,YAAY,GAAG,IAAA,+DAAgC,GAAE,CAAC;IACxD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9E,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IAC1C,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;IAC1D,MAAM,aAAa,GAAG,OAAO,CAAC,oBAAoB;QAChD,CAAC,CAAC,IAAI,OAAO,CAAC,oBAAoB,CAAC,OAAO,SAAS,OAAO,CAAC,oBAAoB,CAAC,EAAE,IAAI,QAAQ,YAAY,OAAO,CAAC,oBAAoB,CAAC,SAAS,IAAI,QAAQ,UAAU,IAAI,CAAC,SAAS,CAAC,O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C,CAAC,SAAS;WACxD,OAAO,CAAC,KAAK;oBACJ,aAAa;;EAE/B,YAAY;;;EAGZ,mBAAmB;;;;;;;kBAOH,YAAY,gDAAgD,CAAC;AAC/E,CAAC,CAAC;AA3DW,QAAA,2BAA2B,+BA2DtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design.d.ts","sourceRoot":"","sources":["../../src/routes/design.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,kBAAkB,GAAI,aAAa,MAAM,+
|
|
1
|
+
{"version":3,"file":"design.d.ts","sourceRoot":"","sources":["../../src/routes/design.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,kBAAkB,GAAI,aAAa,MAAM,+CAiIrD,CAAC"}
|
package/dist/routes/design.js
CHANGED
|
@@ -82,6 +82,10 @@ const createDesignRouter = (projectPath) => {
|
|
|
82
82
|
const instruction = String(body.instruction ?? '').trim();
|
|
83
83
|
const element = body.element;
|
|
84
84
|
const variants = body.variants;
|
|
85
|
+
const currentAppliedDiff = typeof body.currentAppliedDiff === 'string' &&
|
|
86
|
+
body.currentAppliedDiff.trim().length > 0
|
|
87
|
+
? body.currentAppliedDiff
|
|
88
|
+
: undefined;
|
|
85
89
|
if (!sessionId) {
|
|
86
90
|
return res.status(400).json({ error: 'sessionId is required' });
|
|
87
91
|
}
|
|
@@ -112,6 +116,7 @@ const createDesignRouter = (projectPath) => {
|
|
|
112
116
|
instruction,
|
|
113
117
|
element,
|
|
114
118
|
variants,
|
|
119
|
+
currentAppliedDiff,
|
|
115
120
|
onEvent: sendEvent,
|
|
116
121
|
abortController,
|
|
117
122
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design.js","sourceRoot":"","sources":["../../src/routes/design.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AACjC,4CAA+C;AAC/C,8CAA4E;AAC5E,iFAAmF;AACnF,yFAGiD;AACjD,iEAA8D;AAE9D,MAAM,GAAG,GAAG,IAAA,qBAAY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
|
|
|
1
|
-
import { z } from 'zod';
|
|
1
|
+
import { z } from 'zod/v3';
|
|
2
2
|
import type { ElementContext } from '../types/change-types';
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
changeSpec: z.ZodOptional<z.ZodString>;
|
|
8
|
-
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
label: string;
|
|
10
|
-
summary: string;
|
|
11
|
-
changeSpec?: string | undefined;
|
|
12
|
-
}, {
|
|
13
|
-
label: string;
|
|
14
|
-
summary: string;
|
|
15
|
-
changeSpec?: string | undefined;
|
|
16
|
-
}>, "many">;
|
|
3
|
+
declare const variantSchema: z.ZodObject<{
|
|
4
|
+
label: z.ZodString;
|
|
5
|
+
summary: z.ZodString;
|
|
6
|
+
changeSpec: z.ZodString;
|
|
17
7
|
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
changeSpec?: string | undefined;
|
|
22
|
-
}[];
|
|
8
|
+
label: string;
|
|
9
|
+
summary: string;
|
|
10
|
+
changeSpec: string;
|
|
23
11
|
}, {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
changeSpec?: string | undefined;
|
|
28
|
-
}[];
|
|
12
|
+
label: string;
|
|
13
|
+
summary: string;
|
|
14
|
+
changeSpec: string;
|
|
29
15
|
}>;
|
|
30
|
-
export type CommentStyleVariant = z.infer<typeof
|
|
16
|
+
export type CommentStyleVariant = z.infer<typeof variantSchema>;
|
|
31
17
|
type GenerateParams = {
|
|
32
18
|
instruction: string;
|
|
33
19
|
element: ElementContext;
|
|
@@ -35,9 +21,11 @@ type GenerateParams = {
|
|
|
35
21
|
projectPath?: string;
|
|
36
22
|
model?: string;
|
|
37
23
|
};
|
|
38
|
-
export declare const normalizeVariationJsonPayload: (raw: string) => string;
|
|
39
24
|
/**
|
|
40
|
-
*
|
|
25
|
+
* Generates style-variant directions for a commented element by calling the
|
|
26
|
+
* gateway directly with a forced tool-use schema. Skips the agent loop because
|
|
27
|
+
* direction text doesn't require codebase exploration — the relevant file
|
|
28
|
+
* contents are pre-loaded into the prompt.
|
|
41
29
|
*/
|
|
42
30
|
export declare const generateCommentStyleVariants: ({ instruction, element, variantCount, projectPath, model, }: GenerateParams) => Promise<CommentStyleVariant[]>;
|
|
43
31
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentVariationService.d.ts","sourceRoot":"","sources":["../../src/services/CommentVariationService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CommentVariationService.d.ts","sourceRoot":"","sources":["../../src/services/CommentVariationService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAM3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AA0B5D,QAAA,MAAM,aAAa;;;;;;;;;;;;EAIjB,CAAC;AAMH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AA4BhE,KAAK,cAAc,GAAG;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,cAAc,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AA8BF;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,GAAU,6DAMhD,cAAc,KAAG,OAAO,CAAC,mBAAmB,EAAE,CAmDhD,CAAC"}
|
|
@@ -1,70 +1,95 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateCommentStyleVariants =
|
|
4
|
-
const
|
|
6
|
+
exports.generateCommentStyleVariants = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const v3_1 = require("zod/v3");
|
|
5
10
|
const logger_1 = require("../utils/logger");
|
|
6
11
|
const commentVariationPrompts_1 = require("../prompts/commentVariationPrompts");
|
|
7
|
-
const
|
|
12
|
+
const GatewayClient_1 = require("./GatewayClient");
|
|
8
13
|
const log = (0, logger_1.createLogger)('CommentVariationService');
|
|
9
14
|
const MIN_VARIANT_COUNT = 2;
|
|
10
15
|
const MAX_VARIANT_COUNT = 5;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Sonnet 4.6 is fast enough for direction-text generation while still
|
|
18
|
+
* producing coherent multi-direction designs. Phase 2 (code generation) keeps
|
|
19
|
+
* using Opus through the agent loop where structural reasoning matters more.
|
|
20
|
+
*/
|
|
21
|
+
const DEFAULT_VARIATION_MODEL = 'claude-sonnet-4-6';
|
|
14
22
|
const DEFAULT_AGENT_CWD = process.cwd();
|
|
15
|
-
const
|
|
23
|
+
const MAX_TOKENS = 4000;
|
|
24
|
+
const TEMPERATURE = 0.7;
|
|
25
|
+
const MAX_FILES_FOR_CONTEXT = 3;
|
|
26
|
+
const MAX_BYTES_PER_FILE = 6000;
|
|
27
|
+
const VARIATION_SYSTEM_PROMPT = `You are a senior design systems engineer producing structured style-variation output for one selected comment target with nearby UI context.
|
|
16
28
|
|
|
17
|
-
Use provided element, sibling, and file context to propose coherent visual directions. Nearby sibling/container adjustments are allowed when necessary for a coherent result.
|
|
29
|
+
Use the provided element, sibling, and file context to propose coherent visual directions. Nearby sibling/container adjustments are allowed when necessary for a coherent result.
|
|
18
30
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
{"variants":[{"label":"short name","summary":"one sentence","changeSpec":"implementation instruction"}]}`;
|
|
25
|
-
const styleVariantSchema = zod_1.z.object({
|
|
26
|
-
label: zod_1.z.string(),
|
|
27
|
-
summary: zod_1.z.string(),
|
|
28
|
-
changeSpec: zod_1.z.string().optional(),
|
|
31
|
+
Submit your final output by calling the submit_variants tool exactly once.`;
|
|
32
|
+
const variantSchema = v3_1.z.object({
|
|
33
|
+
label: v3_1.z.string(),
|
|
34
|
+
summary: v3_1.z.string(),
|
|
35
|
+
changeSpec: v3_1.z.string(),
|
|
29
36
|
});
|
|
30
|
-
const responseSchema =
|
|
31
|
-
variants:
|
|
37
|
+
const responseSchema = v3_1.z.object({
|
|
38
|
+
variants: v3_1.z.array(variantSchema),
|
|
32
39
|
});
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
const SUBMIT_VARIANTS_TOOL = {
|
|
41
|
+
name: 'submit_variants',
|
|
42
|
+
description: 'Submit the final list of style variants for the commented element. Call this exactly once with all variants.',
|
|
43
|
+
input_schema: {
|
|
44
|
+
type: 'object',
|
|
45
|
+
properties: {
|
|
46
|
+
variants: {
|
|
47
|
+
type: 'array',
|
|
48
|
+
items: {
|
|
49
|
+
type: 'object',
|
|
50
|
+
properties: {
|
|
51
|
+
label: { type: 'string' },
|
|
52
|
+
summary: { type: 'string' },
|
|
53
|
+
changeSpec: { type: 'string' },
|
|
54
|
+
},
|
|
55
|
+
required: ['label', 'summary', 'changeSpec'],
|
|
56
|
+
additionalProperties: false,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
required: ['variants'],
|
|
61
|
+
additionalProperties: false,
|
|
62
|
+
},
|
|
48
63
|
};
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
const readFileExcerpts = async (projectPath, element) => {
|
|
65
|
+
const filePaths = element.filePaths?.map((f) => f.filePath).slice(0, MAX_FILES_FOR_CONTEXT) ??
|
|
66
|
+
[];
|
|
67
|
+
const excerpts = [];
|
|
68
|
+
for (const relPath of filePaths) {
|
|
69
|
+
const absPath = path_1.default.isAbsolute(relPath)
|
|
70
|
+
? relPath
|
|
71
|
+
: path_1.default.join(projectPath, relPath);
|
|
72
|
+
try {
|
|
73
|
+
const stat = await fs_1.promises.stat(absPath);
|
|
74
|
+
if (!stat.isFile())
|
|
75
|
+
continue;
|
|
76
|
+
const buf = await fs_1.promises.readFile(absPath, 'utf8');
|
|
77
|
+
const content = buf.length > MAX_BYTES_PER_FILE
|
|
78
|
+
? buf.slice(0, MAX_BYTES_PER_FILE) + '\n... (truncated)'
|
|
79
|
+
: buf;
|
|
80
|
+
excerpts.push({ path: relPath, content });
|
|
81
|
+
}
|
|
82
|
+
catch (e) {
|
|
83
|
+
log.debug(`Skipping file excerpt for ${relPath}:`, e);
|
|
59
84
|
}
|
|
60
85
|
}
|
|
61
|
-
|
|
62
|
-
return tailBlocks[tailBlocks.length - 1];
|
|
63
|
-
}
|
|
64
|
-
throw new Error('Invalid variation response from model');
|
|
86
|
+
return excerpts;
|
|
65
87
|
};
|
|
66
88
|
/**
|
|
67
|
-
*
|
|
89
|
+
* Generates style-variant directions for a commented element by calling the
|
|
90
|
+
* gateway directly with a forced tool-use schema. Skips the agent loop because
|
|
91
|
+
* direction text doesn't require codebase exploration — the relevant file
|
|
92
|
+
* contents are pre-loaded into the prompt.
|
|
68
93
|
*/
|
|
69
94
|
const generateCommentStyleVariants = async ({ instruction, element, variantCount, projectPath, model, }) => {
|
|
70
95
|
if (variantCount < MIN_VARIANT_COUNT ||
|
|
@@ -72,31 +97,34 @@ const generateCommentStyleVariants = async ({ instruction, element, variantCount
|
|
|
72
97
|
!Number.isInteger(variantCount)) {
|
|
73
98
|
throw new Error('variantCount must be an integer between 2 and 5');
|
|
74
99
|
}
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
permissionMode: 'default',
|
|
83
|
-
cwd: projectPath || DEFAULT_AGENT_CWD,
|
|
100
|
+
const cwd = projectPath || DEFAULT_AGENT_CWD;
|
|
101
|
+
const fileExcerpts = await readFileExcerpts(cwd, element);
|
|
102
|
+
const prompt = (0, commentVariationPrompts_1.buildCommentVariationPrompt)(instruction, element, variantCount, fileExcerpts);
|
|
103
|
+
log.info(`Comment variation request — model=${model ?? DEFAULT_VARIATION_MODEL} files=${fileExcerpts.length} count=${variantCount}`);
|
|
104
|
+
const gateway = new GatewayClient_1.GatewayClient();
|
|
105
|
+
const startedAt = Date.now();
|
|
106
|
+
const toolInput = await gateway.sendToolUse({
|
|
84
107
|
model: model ?? DEFAULT_VARIATION_MODEL,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
onProgress: () => { },
|
|
108
|
+
maxTokens: MAX_TOKENS,
|
|
109
|
+
temperature: TEMPERATURE,
|
|
110
|
+
system: VARIATION_SYSTEM_PROMPT,
|
|
111
|
+
prompt,
|
|
112
|
+
tool: SUBMIT_VARIANTS_TOOL,
|
|
91
113
|
});
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
const parsed = responseSchema.safeParse(parsedJson);
|
|
114
|
+
log.info(`Comment variation completed in ${Date.now() - startedAt}ms`);
|
|
115
|
+
const parsed = responseSchema.safeParse(toolInput);
|
|
95
116
|
if (!parsed.success) {
|
|
96
|
-
log.warn('Variation
|
|
117
|
+
log.warn('Variation tool input failed schema validation', {
|
|
118
|
+
validationError: parsed.error.flatten(),
|
|
119
|
+
received: toolInput,
|
|
120
|
+
});
|
|
97
121
|
throw new Error('Invalid variation response from model');
|
|
98
122
|
}
|
|
99
123
|
if (parsed.data.variants.length !== variantCount) {
|
|
124
|
+
log.warn('Variation count mismatch', {
|
|
125
|
+
expected: variantCount,
|
|
126
|
+
received: parsed.data.variants.length,
|
|
127
|
+
});
|
|
100
128
|
throw new Error('Invalid variation response from model');
|
|
101
129
|
}
|
|
102
130
|
return parsed.data.variants;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentVariationService.js","sourceRoot":"","sources":["../../src/services/CommentVariationService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CommentVariationService.js","sourceRoot":"","sources":["../../src/services/CommentVariationService.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,2BAAoC;AACpC,+BAA2B;AAC3B,4CAA+C;AAC/C,gFAG4C;AAE5C,mDAAgD;AAEhD,MAAM,GAAG,GAAG,IAAA,qBAAY,EAAC,yBAAyB,CAAC,CAAC;AACpD,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B;;;;GAIG;AACH,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AACpD,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AACxC,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAChC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEhC,MAAM,uBAAuB,GAAG;;;;2EAI2C,CAAC;AAE5E,MAAM,aAAa,GAAG,MAAC,CAAC,MAAM,CAAC;IAC7B,KAAK,EAAE,MAAC,CAAC,MAAM,EAAE;IACjB,OAAO,EAAE,MAAC,CAAC,MAAM,EAAE;IACnB,UAAU,EAAE,MAAC,CAAC,MAAM,EAAE;CACvB,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,MAAC,CAAC,MAAM,CAAC;IAC9B,QAAQ,EAAE,MAAC,CAAC,KAAK,CAAC,aAAa,CAAC;CACjC,CAAC,CAAC;AAIH,MAAM,oB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perature: number;
|
|
11
|
+
system: string;
|
|
12
|
+
prompt: string;
|
|
13
|
+
tool: {
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
input_schema: Record<string, unknown>;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
7
19
|
export declare const asReasonText: (value: unknown) => string;
|
|
8
20
|
/**
|
|
9
21
|
* Sends authenticated requests to the Rivet LLM gateway.
|
|
@@ -16,7 +28,14 @@ export declare class GatewayClient {
|
|
|
16
28
|
constructor(gatewayUrl?: string, proxyUrl?: string);
|
|
17
29
|
/** Send a message to the gateway and return the raw text response. */
|
|
18
30
|
sendMessage(options: GatewayRequestOptions): Promise<string>;
|
|
19
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Send a request that forces the model to invoke a single tool, and return
|
|
33
|
+
* the parsed `input` of that tool call. Throws if the model didn't call the
|
|
34
|
+
* tool (which the API guarantees won't happen with `tool_choice: { type:
|
|
35
|
+
* 'tool' }`, but we check anyway).
|
|
36
|
+
*/
|
|
37
|
+
sendToolUse<TInput>(options: GatewayToolUseOptions): Promise<TInput>;
|
|
38
|
+
private postMessages;
|
|
20
39
|
/** Refresh the access token using the stored refresh token. */
|
|
21
40
|
private refreshAccessToken;
|
|
22
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GatewayClient.d.ts","sourceRoot":"","sources":["../../src/services/GatewayClient.ts"],"names":[],"mappings":"AAMA,KAAK,qBAAqB,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,MAsB7C,CAAC;AAEF;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAS;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