rivet-design 0.9.2 → 0.9.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/mcp/agent-variants/SessionStore.d.ts +78 -2
- package/dist/mcp/agent-variants/SessionStore.d.ts.map +1 -1
- package/dist/mcp/agent-variants/SessionStore.js +464 -62
- package/dist/mcp/agent-variants/SessionStore.js.map +1 -1
- package/dist/mcp/agent-variants/WorktreeOrchestrator.d.ts +331 -9
- package/dist/mcp/agent-variants/WorktreeOrchestrator.d.ts.map +1 -1
- package/dist/mcp/agent-variants/WorktreeOrchestrator.js +1985 -61
- package/dist/mcp/agent-variants/WorktreeOrchestrator.js.map +1 -1
- package/dist/mcp/agent-variants/WorktreeOrchestrator.testHelpers.d.ts +65 -0
- package/dist/mcp/agent-variants/WorktreeOrchestrator.testHelpers.d.ts.map +1 -0
- package/dist/mcp/agent-variants/WorktreeOrchestrator.testHelpers.js +162 -0
- package/dist/mcp/agent-variants/WorktreeOrchestrator.testHelpers.js.map +1 -0
- package/dist/mcp/agent-variants/contracts.d.ts +2508 -10
- package/dist/mcp/agent-variants/contracts.d.ts.map +1 -1
- package/dist/mcp/agent-variants/contracts.js +295 -5
- package/dist/mcp/agent-variants/contracts.js.map +1 -1
- package/dist/mcp/agent-variants/createProjectArtifacts.d.ts +78 -0
- package/dist/mcp/agent-variants/createProjectArtifacts.d.ts.map +1 -0
- package/dist/mcp/agent-variants/createProjectArtifacts.js +123 -0
- package/dist/mcp/agent-variants/createProjectArtifacts.js.map +1 -0
- package/dist/mcp/agent-variants/createZeroToOneTool.d.ts +241 -0
- package/dist/mcp/agent-variants/createZeroToOneTool.d.ts.map +1 -0
- package/dist/mcp/agent-variants/createZeroToOneTool.js +213 -0
- package/dist/mcp/agent-variants/createZeroToOneTool.js.map +1 -0
- package/dist/mcp/agent-variants/designContextStore.d.ts +160 -0
- package/dist/mcp/agent-variants/designContextStore.d.ts.map +1 -0
- package/dist/mcp/agent-variants/designContextStore.js +295 -0
- package/dist/mcp/agent-variants/designContextStore.js.map +1 -0
- package/dist/mcp/agent-variants/elementRefToTarget.d.ts +21 -0
- package/dist/mcp/agent-variants/elementRefToTarget.d.ts.map +1 -0
- package/dist/mcp/agent-variants/elementRefToTarget.js +47 -0
- package/dist/mcp/agent-variants/elementRefToTarget.js.map +1 -0
- package/dist/mcp/agent-variants/errors.d.ts +1 -1
- package/dist/mcp/agent-variants/errors.d.ts.map +1 -1
- package/dist/mcp/agent-variants/errors.js +7 -0
- package/dist/mcp/agent-variants/errors.js.map +1 -1
- package/dist/mcp/agent-variants/index.d.ts +4 -2
- package/dist/mcp/agent-variants/index.d.ts.map +1 -1
- package/dist/mcp/agent-variants/index.js +7 -1
- package/dist/mcp/agent-variants/index.js.map +1 -1
- package/dist/mcp/agent-variants/inspirationDesignContext.d.ts +440 -0
- package/dist/mcp/agent-variants/inspirationDesignContext.d.ts.map +1 -0
- package/dist/mcp/agent-variants/inspirationDesignContext.js +2467 -0
- package/dist/mcp/agent-variants/inspirationDesignContext.js.map +1 -0
- package/dist/mcp/agent-variants/pendingChangesAdapter.d.ts.map +1 -1
- package/dist/mcp/agent-variants/pendingChangesAdapter.js +21 -7
- package/dist/mcp/agent-variants/pendingChangesAdapter.js.map +1 -1
- package/dist/mcp/agent-variants/previewQa.d.ts +61 -0
- package/dist/mcp/agent-variants/previewQa.d.ts.map +1 -0
- package/dist/mcp/agent-variants/previewQa.js +374 -0
- package/dist/mcp/agent-variants/previewQa.js.map +1 -0
- package/dist/mcp/agent-variants/sourceContext.d.ts +8 -0
- package/dist/mcp/agent-variants/sourceContext.d.ts.map +1 -0
- package/dist/mcp/agent-variants/sourceContext.js +183 -0
- package/dist/mcp/agent-variants/sourceContext.js.map +1 -0
- package/dist/mcp/agent-variants/tools.d.ts +36 -0
- package/dist/mcp/agent-variants/tools.d.ts.map +1 -1
- package/dist/mcp/agent-variants/tools.js +451 -19
- package/dist/mcp/agent-variants/tools.js.map +1 -1
- package/dist/mcp/changeBatchClassification.d.ts +30 -0
- package/dist/mcp/changeBatchClassification.d.ts.map +1 -0
- package/dist/mcp/changeBatchClassification.js +65 -0
- package/dist/mcp/changeBatchClassification.js.map +1 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +258 -41
- package/dist/mcp/server.js.map +1 -1
- package/dist/prompts/agentModPrompts.js +4 -4
- package/dist/prompts/agentModPrompts.js.map +1 -1
- package/dist/proxy-middleware/proxy-config.d.ts.map +1 -1
- package/dist/proxy-middleware/proxy-config.js +1 -15
- package/dist/proxy-middleware/proxy-config.js.map +1 -1
- package/dist/routes/agentVariants.d.ts +3 -1
- package/dist/routes/agentVariants.d.ts.map +1 -1
- package/dist/routes/agentVariants.js +138 -13
- package/dist/routes/agentVariants.js.map +1 -1
- package/dist/routes/mcp.d.ts +7 -1
- package/dist/routes/mcp.d.ts.map +1 -1
- package/dist/routes/mcp.js +139 -16
- package/dist/routes/mcp.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +23 -5
- package/dist/server.js.map +1 -1
- package/dist/services/ProjectDetectionService.d.ts.map +1 -1
- package/dist/services/ProjectDetectionService.js +9 -0
- package/dist/services/ProjectDetectionService.js.map +1 -1
- package/dist/services/SessionBridgeService.d.ts +22 -0
- package/dist/services/SessionBridgeService.d.ts.map +1 -1
- package/dist/services/SessionBridgeService.js +61 -0
- package/dist/services/SessionBridgeService.js.map +1 -1
- package/dist/services/TelemetryService.d.ts +121 -0
- package/dist/services/TelemetryService.d.ts.map +1 -1
- package/dist/services/TelemetryService.js +155 -0
- package/dist/services/TelemetryService.js.map +1 -1
- package/dist/services/WorktreeManager.d.ts +116 -6
- package/dist/services/WorktreeManager.d.ts.map +1 -1
- package/dist/services/WorktreeManager.js +394 -19
- package/dist/services/WorktreeManager.js.map +1 -1
- package/dist/services/agent/AgentModService.js +6 -6
- package/dist/services/agent/AgentModService.js.map +1 -1
- package/dist/services/templates/designCatalog.d.ts +27 -0
- package/dist/services/templates/designCatalog.d.ts.map +1 -0
- package/dist/services/templates/designCatalog.js +141 -0
- package/dist/services/templates/designCatalog.js.map +1 -0
- package/dist/services/templates/designmd/airbnb.md +545 -0
- package/dist/services/templates/designmd/airtable.md +554 -0
- package/dist/services/templates/designmd/apple.md +562 -0
- package/dist/services/templates/designmd/binance.md +634 -0
- package/dist/services/templates/designmd/bmw-m.md +503 -0
- package/dist/services/templates/designmd/bmw.md +544 -0
- package/dist/services/templates/designmd/bugatti.md +454 -0
- package/dist/services/templates/designmd/cal.md +542 -0
- package/dist/services/templates/designmd/claude.md +589 -0
- package/dist/services/templates/designmd/clay.md +541 -0
- package/dist/services/templates/designmd/cohere.md +451 -0
- package/dist/services/templates/designmd/cursor.md +537 -0
- package/dist/services/templates/designmd/expo.md +526 -0
- package/dist/services/templates/designmd/figma.md +578 -0
- package/dist/services/templates/designmd/framer.md +544 -0
- package/dist/services/templates/designmd/hp.md +670 -0
- package/dist/services/templates/designmd/linear.app.md +548 -0
- package/dist/services/templates/designmd/mintlify.md +852 -0
- package/dist/services/templates/designmd/miro.md +825 -0
- package/dist/services/templates/designmd/notion.md +821 -0
- package/dist/services/templates/designmd/raycast.md +669 -0
- package/dist/services/templates/designmd/resend.md +585 -0
- package/dist/services/templates/designmd/sentry.md +262 -0
- package/dist/services/templates/designmd/shopify.md +350 -0
- package/dist/services/templates/designmd/spotify.md +246 -0
- package/dist/services/templates/designmd/stripe.md +322 -0
- package/dist/services/templates/designmd/supabase.md +255 -0
- package/dist/services/templates/designmd/superhuman.md +252 -0
- package/dist/services/templates/designmd/uber.md +295 -0
- package/dist/services/templates/designmd/vercel.md +310 -0
- package/dist/services/templates/viteReactTs.d.ts +48 -0
- package/dist/services/templates/viteReactTs.d.ts.map +1 -0
- package/dist/services/templates/viteReactTs.js +274 -0
- package/dist/services/templates/viteReactTs.js.map +1 -0
- package/dist/types/change-request-types.d.ts +29 -3
- package/dist/types/change-request-types.d.ts.map +1 -1
- package/dist/utils/skills/claude-skill.d.ts +2 -2
- package/dist/utils/skills/claude-skill.d.ts.map +1 -1
- package/dist/utils/skills/claude-skill.js +19 -98
- package/dist/utils/skills/claude-skill.js.map +1 -1
- package/dist/utils/skills/cursor-rules.d.ts +2 -2
- package/dist/utils/skills/cursor-rules.d.ts.map +1 -1
- package/dist/utils/skills/cursor-rules.js +15 -80
- package/dist/utils/skills/cursor-rules.js.map +1 -1
- package/dist/utils/skills/shared-variants-protocol.d.ts +23 -0
- package/dist/utils/skills/shared-variants-protocol.d.ts.map +1 -0
- package/dist/utils/skills/shared-variants-protocol.js +130 -0
- package/dist/utils/skills/shared-variants-protocol.js.map +1 -0
- package/package.json +6 -6
- package/src/ui/dist/assets/main-CpX7fB64.js +382 -0
- package/src/ui/dist/assets/main-Qqe2_oMT.css +1 -0
- package/src/ui/dist/index.html +2 -2
- package/src/ui/dist/assets/main-AsPCtLsx.js +0 -382
- package/src/ui/dist/assets/main-BzmseUDd.css +0 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import type { InspirationDesignSignals } from './inspirationDesignContext';
|
|
2
|
+
/**
|
|
3
|
+
* Runtime user cache for inspiration-link design context. Persists generated
|
|
4
|
+
* designmd markdown plus safe metadata so future MCP
|
|
5
|
+
* `create_zero_to_one_project` requests with the same web link can reuse
|
|
6
|
+
* prior extraction by default. Treated as runtime user data — never mutates
|
|
7
|
+
* the bundled `src/services/templates/designmd` catalog.
|
|
8
|
+
*
|
|
9
|
+
* Path layout (local filesystem implementation):
|
|
10
|
+
* <directory>/<sha256(normalizedUrl)>.json
|
|
11
|
+
*
|
|
12
|
+
* The default <directory> is `~/.rivet/design-context-cache/`. The store
|
|
13
|
+
* abstraction is interface-first so future hosted/server deployments can
|
|
14
|
+
* provide a durable backend (HTTPS, KV, SQL) without changing the
|
|
15
|
+
* extraction or MCP orchestration logic.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Output/extractor schema version. Bump when the cache entry shape or the
|
|
19
|
+
* generated markdown structure changes incompatibly. Cached entries with a
|
|
20
|
+
* different schema version are not silently reused — they regenerate.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DESIGN_CONTEXT_SCHEMA_VERSION = "2";
|
|
23
|
+
/**
|
|
24
|
+
* Default freshness window for a cached entry. Entries older than this are
|
|
25
|
+
* marked `stale` and trigger regeneration by default. Tunable per call so
|
|
26
|
+
* tests can exercise the stale branch without sleeping.
|
|
27
|
+
*/
|
|
28
|
+
export declare const DEFAULT_FRESHNESS_MS: number;
|
|
29
|
+
/**
|
|
30
|
+
* Default confidence threshold below which cached entries are considered
|
|
31
|
+
* low-confidence and trigger regeneration. Mirrors the in-extractor
|
|
32
|
+
* `LOW_SIGNAL_THRESHOLD` so cached and live signals stay aligned.
|
|
33
|
+
*/
|
|
34
|
+
export declare const DEFAULT_CONFIDENCE_THRESHOLD = 18;
|
|
35
|
+
export type FreshnessState = 'fresh' | 'stale';
|
|
36
|
+
export interface DesignContextCacheMetadata {
|
|
37
|
+
/** Stable cache key (sha256 hex of normalized URL). */
|
|
38
|
+
cacheKey: string;
|
|
39
|
+
/** Extractor/output schema version used to produce this entry. */
|
|
40
|
+
schemaVersion: string;
|
|
41
|
+
/** Wall-clock creation time (ms since epoch). */
|
|
42
|
+
createdAtMs: number;
|
|
43
|
+
/** Wall-clock last-used time (ms since epoch). */
|
|
44
|
+
lastUsedAtMs: number;
|
|
45
|
+
/** Signal density / confidence score (0-100). */
|
|
46
|
+
confidence: number;
|
|
47
|
+
/**
|
|
48
|
+
* Safe outcome metadata only — short non-sensitive warning codes such as
|
|
49
|
+
* `low_signal` or `partial_meta`. MUST NOT include fetched page content,
|
|
50
|
+
* full URLs, or extracted text snippets.
|
|
51
|
+
*/
|
|
52
|
+
warningCodes: string[];
|
|
53
|
+
}
|
|
54
|
+
export interface DesignContextCacheEntry {
|
|
55
|
+
metadata: DesignContextCacheMetadata;
|
|
56
|
+
/** Generated single-source designmd markdown (separate-flavor). */
|
|
57
|
+
markdown: string;
|
|
58
|
+
/** Short user-visible label (already truncated to fit downstream cap). */
|
|
59
|
+
label: string;
|
|
60
|
+
/**
|
|
61
|
+
* Structured design signals for the source URL. Storing the same derived
|
|
62
|
+
* design observations the markdown already encodes (palette, families,
|
|
63
|
+
* sections, components) so merge-strategy callers can re-summarise across
|
|
64
|
+
* multiple cached entries without re-fetching. Raw HTML, screenshots,
|
|
65
|
+
* DOM dumps, and full source text MUST NOT be persisted here.
|
|
66
|
+
*/
|
|
67
|
+
signals: InspirationDesignSignals;
|
|
68
|
+
}
|
|
69
|
+
export interface DesignContextStore {
|
|
70
|
+
get(cacheKey: string): Promise<DesignContextCacheEntry | undefined>;
|
|
71
|
+
put(entry: DesignContextCacheEntry): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Normalize an HTTP/HTTPS URL for cache keying. Lowercases scheme and host,
|
|
75
|
+
* strips default ports and fragments, and preserves meaningful path/query
|
|
76
|
+
* so two pages with the same host but different paths or query strings
|
|
77
|
+
* keep separate cache entries. Returns `undefined` for inputs that are not
|
|
78
|
+
* parseable HTTP/HTTPS URLs.
|
|
79
|
+
*/
|
|
80
|
+
export declare const normalizeCacheUrl: (rawUrl: string) => string | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Compute a stable cache key from a normalized URL. SHA-256 hashed to hex
|
|
83
|
+
* so the resulting key is filesystem-safe and does not embed proprietary
|
|
84
|
+
* URL content in the filename layer.
|
|
85
|
+
*/
|
|
86
|
+
export declare const cacheKeyForUrl: (rawUrl: string) => string | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Coarse age bucket for safe telemetry. Maps a wall-clock age in
|
|
89
|
+
* milliseconds onto a small fixed bucket name so analytics never receive
|
|
90
|
+
* exact timestamps.
|
|
91
|
+
*/
|
|
92
|
+
export declare const ageBucketFor: (ageMs: number) => "lt_1h" | "1h_24h" | "1d_7d" | "7d_30d" | "gt_30d";
|
|
93
|
+
/**
|
|
94
|
+
* Coarse confidence bucket for safe telemetry. Three buckets keyed off the
|
|
95
|
+
* extractor signal density score so reuse outcomes can be aggregated
|
|
96
|
+
* without leaking specific confidence values.
|
|
97
|
+
*/
|
|
98
|
+
export declare const confidenceBucketFor: (confidence: number) => "low" | "medium" | "high";
|
|
99
|
+
/**
|
|
100
|
+
* Return true when the user prompt explicitly asks for fresh/latest/
|
|
101
|
+
* current design context. Used by the MCP flow to bypass cache reuse even
|
|
102
|
+
* when a compatible entry exists.
|
|
103
|
+
*/
|
|
104
|
+
export declare const promptRequestsFreshExtraction: (prompt: string) => boolean;
|
|
105
|
+
export type CacheReuseDecision = {
|
|
106
|
+
reuse: true;
|
|
107
|
+
freshness: FreshnessState;
|
|
108
|
+
ageMs: number;
|
|
109
|
+
} | {
|
|
110
|
+
reuse: false;
|
|
111
|
+
reason: 'version_mismatch' | 'stale' | 'low_confidence' | 'forced_refresh' | 'corrupt';
|
|
112
|
+
freshness: FreshnessState;
|
|
113
|
+
ageMs: number;
|
|
114
|
+
};
|
|
115
|
+
interface CanReuseOptions {
|
|
116
|
+
forceRefresh: boolean;
|
|
117
|
+
schemaVersion?: string;
|
|
118
|
+
confidenceThreshold?: number;
|
|
119
|
+
freshnessMs?: number;
|
|
120
|
+
now?: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Decide whether a cached entry is reusable for a request, factoring in
|
|
124
|
+
* extractor/schema version, freshness window, confidence threshold, and
|
|
125
|
+
* any explicit user request for fresh extraction. Callers MUST honour the
|
|
126
|
+
* decision — the store itself never silently reuses incompatible entries.
|
|
127
|
+
*/
|
|
128
|
+
export declare const canReuseCacheEntry: (entry: DesignContextCacheEntry, options: CanReuseOptions) => CacheReuseDecision;
|
|
129
|
+
interface FileDesignContextStoreOptions {
|
|
130
|
+
/**
|
|
131
|
+
* Override the cache directory. Defaults to `~/.rivet/design-context-cache`
|
|
132
|
+
* via `os.homedir()`. Tests use a tmpdir override so the suite never
|
|
133
|
+
* touches the real user cache.
|
|
134
|
+
*/
|
|
135
|
+
directory?: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Filesystem-backed `DesignContextStore`. One JSON file per cache key under
|
|
139
|
+
* a per-user cache directory. Safe to delete the entire directory without
|
|
140
|
+
* affecting bundled catalog data or compiled application code.
|
|
141
|
+
*
|
|
142
|
+
* Read/write failures degrade gracefully — get returns undefined on any
|
|
143
|
+
* parse/IO error so the MCP flow falls through to a fresh extraction
|
|
144
|
+
* instead of crashing the user request.
|
|
145
|
+
*/
|
|
146
|
+
export declare class FileDesignContextStore implements DesignContextStore {
|
|
147
|
+
private readonly directory;
|
|
148
|
+
private dirReady;
|
|
149
|
+
constructor(options?: FileDesignContextStoreOptions);
|
|
150
|
+
/**
|
|
151
|
+
* Resolve a cache key to its on-disk file path. Rejects keys that do not
|
|
152
|
+
* match the expected sha256 hex shape so a malformed key cannot escape
|
|
153
|
+
* the cache directory.
|
|
154
|
+
*/
|
|
155
|
+
resolvePath(cacheKey: string): string | undefined;
|
|
156
|
+
get(cacheKey: string): Promise<DesignContextCacheEntry | undefined>;
|
|
157
|
+
put(entry: DesignContextCacheEntry): Promise<void>;
|
|
158
|
+
}
|
|
159
|
+
export {};
|
|
160
|
+
//# sourceMappingURL=designContextStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"designContextStore.d.ts","sourceRoot":"","sources":["../../../src/mcp/agent-variants/designContextStore.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAI3E;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,QAA2B,CAAC;AAE7D;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,KAAK,CAAC;AA8B/C,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,OAAO,CAAC;AAE/C,MAAM,WAAW,0BAA0B;IACzC,uDAAu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S,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACzD;IACE,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EACF,kBAAkB,GAClB,OAAO,GACP,gBAAgB,GAChB,gBAAgB,GAChB,SAAS,CAAC;IACd,SAAS,EAAE,cAAc,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEN,UAAU,eAAe;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,uBAAuB,EAC9B,SAAS,eAAe,KACvB,kBAsBF,CAAC;AAEF,UAAU,6BAA6B;IACrC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID;;;;;;;;GAQG;AACH,qBAAa,sBAAuB,YAAW,kBAAkB;IAC/D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAS;gBAEb,OAAO,GAAE,6BAAkC;IAKvD;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAK3C,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC;IAyBnE,GAAG,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;CA6BzD"}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FileDesignContextStore = exports.canReuseCacheEntry = exports.promptRequestsFreshExtraction = exports.confidenceBucketFor = exports.ageBucketFor = exports.cacheKeyForUrl = exports.normalizeCacheUrl = exports.DEFAULT_CONFIDENCE_THRESHOLD = exports.DEFAULT_FRESHNESS_MS = exports.DESIGN_CONTEXT_SCHEMA_VERSION = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const os_1 = __importDefault(require("os"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const logger_1 = require("../../utils/logger");
|
|
12
|
+
const log = (0, logger_1.createLogger)('DesignContextStore');
|
|
13
|
+
/**
|
|
14
|
+
* Runtime user cache for inspiration-link design context. Persists generated
|
|
15
|
+
* designmd markdown plus safe metadata so future MCP
|
|
16
|
+
* `create_zero_to_one_project` requests with the same web link can reuse
|
|
17
|
+
* prior extraction by default. Treated as runtime user data — never mutates
|
|
18
|
+
* the bundled `src/services/templates/designmd` catalog.
|
|
19
|
+
*
|
|
20
|
+
* Path layout (local filesystem implementation):
|
|
21
|
+
* <directory>/<sha256(normalizedUrl)>.json
|
|
22
|
+
*
|
|
23
|
+
* The default <directory> is `~/.rivet/design-context-cache/`. The store
|
|
24
|
+
* abstraction is interface-first so future hosted/server deployments can
|
|
25
|
+
* provide a durable backend (HTTPS, KV, SQL) without changing the
|
|
26
|
+
* extraction or MCP orchestration logic.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Output/extractor schema version. Bump when the cache entry shape or the
|
|
30
|
+
* generated markdown structure changes incompatibly. Cached entries with a
|
|
31
|
+
* different schema version are not silently reused — they regenerate.
|
|
32
|
+
*/
|
|
33
|
+
exports.DESIGN_CONTEXT_SCHEMA_VERSION = '2';
|
|
34
|
+
/**
|
|
35
|
+
* Default freshness window for a cached entry. Entries older than this are
|
|
36
|
+
* marked `stale` and trigger regeneration by default. Tunable per call so
|
|
37
|
+
* tests can exercise the stale branch without sleeping.
|
|
38
|
+
*/
|
|
39
|
+
exports.DEFAULT_FRESHNESS_MS = 14 * 24 * 60 * 60 * 1000;
|
|
40
|
+
/**
|
|
41
|
+
* Default confidence threshold below which cached entries are considered
|
|
42
|
+
* low-confidence and trigger regeneration. Mirrors the in-extractor
|
|
43
|
+
* `LOW_SIGNAL_THRESHOLD` so cached and live signals stay aligned.
|
|
44
|
+
*/
|
|
45
|
+
exports.DEFAULT_CONFIDENCE_THRESHOLD = 18;
|
|
46
|
+
/**
|
|
47
|
+
* Match prompts that explicitly request fresh/latest/current/regenerated
|
|
48
|
+
* design context for an inspiration link. Matches are evaluated against the
|
|
49
|
+
* raw user prompt — callers MUST keep the prompt out of telemetry payloads.
|
|
50
|
+
*
|
|
51
|
+
* The bare adjectives `fresh`/`latest`/`current` are intentionally NOT
|
|
52
|
+
* matched on their own because they collide with common project-description
|
|
53
|
+
* phrasing (e.g. "build a fresh landing page", "use the latest design
|
|
54
|
+
* patterns", "based on the current site") that does not actually request a
|
|
55
|
+
* cache bypass. They only match when paired with a cache- or
|
|
56
|
+
* extraction-bearing noun. Verbs like `re-extract`, `refresh`, and
|
|
57
|
+
* `bypass cache` are unambiguous on their own.
|
|
58
|
+
*/
|
|
59
|
+
const CACHE_BYPASS_NOUNS = 'extract(?:ion)?|fetch|context|data|copy|signals?|markdown|version|run|pull|scrape|grab|snapshot|content|html|cache|design\\s+context';
|
|
60
|
+
const FRESH_INTENT_PATTERNS = [
|
|
61
|
+
new RegExp(`\\bfresh(?:est)?\\s+(?:${CACHE_BYPASS_NOUNS})\\b`, 'i'),
|
|
62
|
+
new RegExp(`\\blatest\\s+(?:${CACHE_BYPASS_NOUNS})\\b`, 'i'),
|
|
63
|
+
new RegExp(`\\bcurrent\\s+(?:${CACHE_BYPASS_NOUNS})\\b`, 'i'),
|
|
64
|
+
/\bup[-\s]?to[-\s]?date\s+(?:extract(?:ion)?|fetch|context|data|copy|signals?|markdown|version|cache|design\s+context)\b/i,
|
|
65
|
+
/\bre[-\s]?extract\b/i,
|
|
66
|
+
/\bre[-\s]?fetch\b/i,
|
|
67
|
+
/\bre[-\s]?generate\b/i,
|
|
68
|
+
/\brefresh\b/i,
|
|
69
|
+
/\bbypass\s+cache\b/i,
|
|
70
|
+
/\bno[-\s]?cache\b/i,
|
|
71
|
+
];
|
|
72
|
+
/**
|
|
73
|
+
* Normalize an HTTP/HTTPS URL for cache keying. Lowercases scheme and host,
|
|
74
|
+
* strips default ports and fragments, and preserves meaningful path/query
|
|
75
|
+
* so two pages with the same host but different paths or query strings
|
|
76
|
+
* keep separate cache entries. Returns `undefined` for inputs that are not
|
|
77
|
+
* parseable HTTP/HTTPS URLs.
|
|
78
|
+
*/
|
|
79
|
+
const normalizeCacheUrl = (rawUrl) => {
|
|
80
|
+
const trimmed = rawUrl.trim();
|
|
81
|
+
if (!trimmed)
|
|
82
|
+
return undefined;
|
|
83
|
+
let parsed;
|
|
84
|
+
try {
|
|
85
|
+
parsed = new URL(trimmed);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
parsed.hostname = parsed.hostname.toLowerCase();
|
|
94
|
+
if ((parsed.protocol === 'http:' && parsed.port === '80') ||
|
|
95
|
+
(parsed.protocol === 'https:' && parsed.port === '443')) {
|
|
96
|
+
parsed.port = '';
|
|
97
|
+
}
|
|
98
|
+
parsed.hash = '';
|
|
99
|
+
return parsed.toString();
|
|
100
|
+
};
|
|
101
|
+
exports.normalizeCacheUrl = normalizeCacheUrl;
|
|
102
|
+
/**
|
|
103
|
+
* Compute a stable cache key from a normalized URL. SHA-256 hashed to hex
|
|
104
|
+
* so the resulting key is filesystem-safe and does not embed proprietary
|
|
105
|
+
* URL content in the filename layer.
|
|
106
|
+
*/
|
|
107
|
+
const cacheKeyForUrl = (rawUrl) => {
|
|
108
|
+
const normalized = (0, exports.normalizeCacheUrl)(rawUrl);
|
|
109
|
+
if (!normalized)
|
|
110
|
+
return undefined;
|
|
111
|
+
return crypto_1.default.createHash('sha256').update(normalized).digest('hex');
|
|
112
|
+
};
|
|
113
|
+
exports.cacheKeyForUrl = cacheKeyForUrl;
|
|
114
|
+
/**
|
|
115
|
+
* Coarse age bucket for safe telemetry. Maps a wall-clock age in
|
|
116
|
+
* milliseconds onto a small fixed bucket name so analytics never receive
|
|
117
|
+
* exact timestamps.
|
|
118
|
+
*/
|
|
119
|
+
const ageBucketFor = (ageMs) => {
|
|
120
|
+
if (ageMs < 60 * 60 * 1000)
|
|
121
|
+
return 'lt_1h';
|
|
122
|
+
if (ageMs < 24 * 60 * 60 * 1000)
|
|
123
|
+
return '1h_24h';
|
|
124
|
+
if (ageMs < 7 * 24 * 60 * 60 * 1000)
|
|
125
|
+
return '1d_7d';
|
|
126
|
+
if (ageMs < 30 * 24 * 60 * 60 * 1000)
|
|
127
|
+
return '7d_30d';
|
|
128
|
+
return 'gt_30d';
|
|
129
|
+
};
|
|
130
|
+
exports.ageBucketFor = ageBucketFor;
|
|
131
|
+
/**
|
|
132
|
+
* Coarse confidence bucket for safe telemetry. Three buckets keyed off the
|
|
133
|
+
* extractor signal density score so reuse outcomes can be aggregated
|
|
134
|
+
* without leaking specific confidence values.
|
|
135
|
+
*/
|
|
136
|
+
const confidenceBucketFor = (confidence) => {
|
|
137
|
+
if (confidence < exports.DEFAULT_CONFIDENCE_THRESHOLD)
|
|
138
|
+
return 'low';
|
|
139
|
+
if (confidence < 60)
|
|
140
|
+
return 'medium';
|
|
141
|
+
return 'high';
|
|
142
|
+
};
|
|
143
|
+
exports.confidenceBucketFor = confidenceBucketFor;
|
|
144
|
+
/**
|
|
145
|
+
* Return true when the user prompt explicitly asks for fresh/latest/
|
|
146
|
+
* current design context. Used by the MCP flow to bypass cache reuse even
|
|
147
|
+
* when a compatible entry exists.
|
|
148
|
+
*/
|
|
149
|
+
const promptRequestsFreshExtraction = (prompt) => FRESH_INTENT_PATTERNS.some((pattern) => pattern.test(prompt));
|
|
150
|
+
exports.promptRequestsFreshExtraction = promptRequestsFreshExtraction;
|
|
151
|
+
/**
|
|
152
|
+
* Decide whether a cached entry is reusable for a request, factoring in
|
|
153
|
+
* extractor/schema version, freshness window, confidence threshold, and
|
|
154
|
+
* any explicit user request for fresh extraction. Callers MUST honour the
|
|
155
|
+
* decision — the store itself never silently reuses incompatible entries.
|
|
156
|
+
*/
|
|
157
|
+
const canReuseCacheEntry = (entry, options) => {
|
|
158
|
+
const now = options.now ?? Date.now();
|
|
159
|
+
const freshnessMs = options.freshnessMs ?? exports.DEFAULT_FRESHNESS_MS;
|
|
160
|
+
const schemaVersion = options.schemaVersion ?? exports.DESIGN_CONTEXT_SCHEMA_VERSION;
|
|
161
|
+
const confidenceThreshold = options.confidenceThreshold ?? exports.DEFAULT_CONFIDENCE_THRESHOLD;
|
|
162
|
+
const ageMs = Math.max(0, now - entry.metadata.createdAtMs);
|
|
163
|
+
const freshness = ageMs <= freshnessMs ? 'fresh' : 'stale';
|
|
164
|
+
if (options.forceRefresh) {
|
|
165
|
+
return { reuse: false, reason: 'forced_refresh', freshness, ageMs };
|
|
166
|
+
}
|
|
167
|
+
if (entry.metadata.schemaVersion !== schemaVersion) {
|
|
168
|
+
return { reuse: false, reason: 'version_mismatch', freshness, ageMs };
|
|
169
|
+
}
|
|
170
|
+
if (freshness === 'stale') {
|
|
171
|
+
return { reuse: false, reason: 'stale', freshness, ageMs };
|
|
172
|
+
}
|
|
173
|
+
if (entry.metadata.confidence < confidenceThreshold) {
|
|
174
|
+
return { reuse: false, reason: 'low_confidence', freshness, ageMs };
|
|
175
|
+
}
|
|
176
|
+
return { reuse: true, freshness, ageMs };
|
|
177
|
+
};
|
|
178
|
+
exports.canReuseCacheEntry = canReuseCacheEntry;
|
|
179
|
+
const ALLOWED_KEY_PATTERN = /^[a-f0-9]{64}$/;
|
|
180
|
+
/**
|
|
181
|
+
* Filesystem-backed `DesignContextStore`. One JSON file per cache key under
|
|
182
|
+
* a per-user cache directory. Safe to delete the entire directory without
|
|
183
|
+
* affecting bundled catalog data or compiled application code.
|
|
184
|
+
*
|
|
185
|
+
* Read/write failures degrade gracefully — get returns undefined on any
|
|
186
|
+
* parse/IO error so the MCP flow falls through to a fresh extraction
|
|
187
|
+
* instead of crashing the user request.
|
|
188
|
+
*/
|
|
189
|
+
class FileDesignContextStore {
|
|
190
|
+
directory;
|
|
191
|
+
dirReady = false;
|
|
192
|
+
constructor(options = {}) {
|
|
193
|
+
this.directory =
|
|
194
|
+
options.directory ?? path_1.default.join(os_1.default.homedir(), '.rivet', 'design-context-cache');
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Resolve a cache key to its on-disk file path. Rejects keys that do not
|
|
198
|
+
* match the expected sha256 hex shape so a malformed key cannot escape
|
|
199
|
+
* the cache directory.
|
|
200
|
+
*/
|
|
201
|
+
resolvePath(cacheKey) {
|
|
202
|
+
if (!ALLOWED_KEY_PATTERN.test(cacheKey))
|
|
203
|
+
return undefined;
|
|
204
|
+
return path_1.default.join(this.directory, `${cacheKey}.json`);
|
|
205
|
+
}
|
|
206
|
+
async get(cacheKey) {
|
|
207
|
+
const target = this.resolvePath(cacheKey);
|
|
208
|
+
if (!target)
|
|
209
|
+
return undefined;
|
|
210
|
+
try {
|
|
211
|
+
const raw = await fs_1.default.promises.readFile(target, 'utf8');
|
|
212
|
+
const parsed = JSON.parse(raw);
|
|
213
|
+
if (!isCacheEntry(parsed)) {
|
|
214
|
+
log.debug(`Discarding malformed cache entry at ${cacheKey}.`);
|
|
215
|
+
return undefined;
|
|
216
|
+
}
|
|
217
|
+
return parsed;
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
if (error &&
|
|
221
|
+
typeof error === 'object' &&
|
|
222
|
+
'code' in error &&
|
|
223
|
+
error.code === 'ENOENT') {
|
|
224
|
+
return undefined;
|
|
225
|
+
}
|
|
226
|
+
log.debug(`Failed to read cache entry ${cacheKey}: ${String(error)}`);
|
|
227
|
+
return undefined;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
async put(entry) {
|
|
231
|
+
const target = this.resolvePath(entry.metadata.cacheKey);
|
|
232
|
+
if (!target) {
|
|
233
|
+
log.warn('Refusing to write cache entry with invalid cache key shape.');
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
const tmp = `${target}.${crypto_1.default.randomBytes(4).toString('hex')}.tmp`;
|
|
237
|
+
try {
|
|
238
|
+
if (!this.dirReady) {
|
|
239
|
+
await fs_1.default.promises.mkdir(this.directory, {
|
|
240
|
+
recursive: true,
|
|
241
|
+
mode: 0o700,
|
|
242
|
+
});
|
|
243
|
+
this.dirReady = true;
|
|
244
|
+
}
|
|
245
|
+
await fs_1.default.promises.writeFile(tmp, JSON.stringify(entry), {
|
|
246
|
+
encoding: 'utf8',
|
|
247
|
+
mode: 0o600,
|
|
248
|
+
});
|
|
249
|
+
await fs_1.default.promises.rename(tmp, target);
|
|
250
|
+
}
|
|
251
|
+
catch (error) {
|
|
252
|
+
log.debug(`Failed to write cache entry: ${String(error)}`);
|
|
253
|
+
try {
|
|
254
|
+
await fs_1.default.promises.unlink(tmp);
|
|
255
|
+
}
|
|
256
|
+
catch {
|
|
257
|
+
// best-effort cleanup
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
exports.FileDesignContextStore = FileDesignContextStore;
|
|
263
|
+
/**
|
|
264
|
+
* Runtime guard so corrupted or third-party-tampered cache files cannot
|
|
265
|
+
* inject arbitrary fields into the MCP flow.
|
|
266
|
+
*/
|
|
267
|
+
const isCacheEntry = (value) => {
|
|
268
|
+
if (!value || typeof value !== 'object')
|
|
269
|
+
return false;
|
|
270
|
+
const record = value;
|
|
271
|
+
const metadata = record.metadata;
|
|
272
|
+
if (!metadata || typeof metadata !== 'object')
|
|
273
|
+
return false;
|
|
274
|
+
if (typeof metadata.cacheKey !== 'string')
|
|
275
|
+
return false;
|
|
276
|
+
if (typeof metadata.schemaVersion !== 'string')
|
|
277
|
+
return false;
|
|
278
|
+
if (typeof metadata.createdAtMs !== 'number')
|
|
279
|
+
return false;
|
|
280
|
+
if (typeof metadata.lastUsedAtMs !== 'number')
|
|
281
|
+
return false;
|
|
282
|
+
if (typeof metadata.confidence !== 'number')
|
|
283
|
+
return false;
|
|
284
|
+
if (!Array.isArray(metadata.warningCodes))
|
|
285
|
+
return false;
|
|
286
|
+
if (typeof record.markdown !== 'string')
|
|
287
|
+
return false;
|
|
288
|
+
if (typeof record.label !== 'string')
|
|
289
|
+
return false;
|
|
290
|
+
const signals = record.signals;
|
|
291
|
+
if (!signals || typeof signals !== 'object')
|
|
292
|
+
return false;
|
|
293
|
+
return true;
|
|
294
|
+
};
|
|
295
|
+
//# sourceMappingURL=designContextStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"designContextStore.js","sourceRoot":"","sources":["../../../src/mcp/agent-variants/designContextStore.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,4CAAoB;AACpB,4CAAoB;AACpB,gDAAwB;AACxB,+CAAkD;AAGlD,MAAM,GAAG,GAAG,IAAA,qBAAY,EAAC,oBAAoB,CAAC,CAAC;AAE/C;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AACU,QAAA,6BAA6B,GAAG,GAAG,CAAC;AAEjD;;;;GAIG;AACU,QAAA,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE7D;;;;GAIG;AACU,QAAA,4BAA4B,GAAG,EAAE,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,MAAM,kBAAkB,GACtB,sIAAsI,CAAC;AACzI,MAAM,qBAAqB,GAAa;IACtC,IAAI,MAAM,CAAC,0BAA0B,kBAAkB,MAAM,EAAE,GAAG,CAAC;IACnE,IAAI,MAAM,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AK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC1D,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ElementRef } from '../../types/change-request-types';
|
|
2
|
+
import type { Target } from './contracts';
|
|
3
|
+
/**
|
|
4
|
+
* Map a comment's ElementRef to a single `propose_variants` target.
|
|
5
|
+
*
|
|
6
|
+
* Rules (first non-empty wins, no concatenation):
|
|
7
|
+
* 1. `rivetId` → `{ type: 'element', ref: '[data-rivet-id="<id>"]' }`
|
|
8
|
+
* 2. `id` (no whitespace) → `{ type: 'element', ref: '#<id>' }`
|
|
9
|
+
* 3. `xpath` → `{ type: 'element', ref: '<xpath>' }`
|
|
10
|
+
* 4. `className` (single dominant token) → `{ type: 'element', ref: '.<token>' }`
|
|
11
|
+
*
|
|
12
|
+
* If `element.filePaths.length === 1`, prefer `{ type: 'file', ref: filePaths[0] }`
|
|
13
|
+
* for refinement scope. The original ElementRef selector should still appear
|
|
14
|
+
* verbatim in the LLM brief prompt — callers are responsible for that.
|
|
15
|
+
*
|
|
16
|
+
* Returns null when none of the four rules produce a usable ref. Callers should
|
|
17
|
+
* surface a structured error to the user rather than calling propose_variants
|
|
18
|
+
* with a fabricated target.
|
|
19
|
+
*/
|
|
20
|
+
export declare const elementRefToTarget: (ref: ElementRef) => Target | null;
|
|
21
|
+
//# sourceMappingURL=elementRefToTarget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elementRefToTarget.d.ts","sourceRoot":"","sources":["../../../src/mcp/agent-variants/elementRefToTarget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,kBAAkB,GAAI,KAAK,UAAU,KAAG,MAAM,GAAG,IA6B7D,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.elementRefToTarget = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Map a comment's ElementRef to a single `propose_variants` target.
|
|
6
|
+
*
|
|
7
|
+
* Rules (first non-empty wins, no concatenation):
|
|
8
|
+
* 1. `rivetId` → `{ type: 'element', ref: '[data-rivet-id="<id>"]' }`
|
|
9
|
+
* 2. `id` (no whitespace) → `{ type: 'element', ref: '#<id>' }`
|
|
10
|
+
* 3. `xpath` → `{ type: 'element', ref: '<xpath>' }`
|
|
11
|
+
* 4. `className` (single dominant token) → `{ type: 'element', ref: '.<token>' }`
|
|
12
|
+
*
|
|
13
|
+
* If `element.filePaths.length === 1`, prefer `{ type: 'file', ref: filePaths[0] }`
|
|
14
|
+
* for refinement scope. The original ElementRef selector should still appear
|
|
15
|
+
* verbatim in the LLM brief prompt — callers are responsible for that.
|
|
16
|
+
*
|
|
17
|
+
* Returns null when none of the four rules produce a usable ref. Callers should
|
|
18
|
+
* surface a structured error to the user rather than calling propose_variants
|
|
19
|
+
* with a fabricated target.
|
|
20
|
+
*/
|
|
21
|
+
const elementRefToTarget = (ref) => {
|
|
22
|
+
if (ref.filePaths.length === 1 && ref.filePaths[0]) {
|
|
23
|
+
return { type: 'file', ref: ref.filePaths[0] };
|
|
24
|
+
}
|
|
25
|
+
const rivetId = ref.rivetId?.trim();
|
|
26
|
+
if (rivetId) {
|
|
27
|
+
return { type: 'element', ref: `[data-rivet-id="${rivetId}"]` };
|
|
28
|
+
}
|
|
29
|
+
const id = ref.id?.trim();
|
|
30
|
+
if (id && !/\s/.test(id)) {
|
|
31
|
+
return { type: 'element', ref: `#${id}` };
|
|
32
|
+
}
|
|
33
|
+
const xpath = ref.xpath?.trim();
|
|
34
|
+
if (xpath) {
|
|
35
|
+
return { type: 'element', ref: xpath };
|
|
36
|
+
}
|
|
37
|
+
const className = ref.className?.trim();
|
|
38
|
+
if (className) {
|
|
39
|
+
const tokens = className.split(/\s+/).filter(Boolean);
|
|
40
|
+
if (tokens.length === 1) {
|
|
41
|
+
return { type: 'element', ref: `.${tokens[0]}` };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
};
|
|
46
|
+
exports.elementRefToTarget = elementRefToTarget;
|
|
47
|
+
//# sourceMappingURL=elementRefToTarget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elementRefToTarget.js","sourceRoot":"","sources":["../../../src/mcp/agent-variants/elementRefToTarget.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;;GAgBG;AACI,MAAM,kBAAkB,GAAG,CAAC,GAAe,EAAiB,EAAE;IACnE,IAAI,GAAG,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;QACnD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IACjD,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC;IACpC,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,mBAAmB,OAAO,IAAI,EAAE,CAAC;IAClE,CAAC;IAED,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC;IAC1B,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IAC5C,CAAC;IAED,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC;IAChC,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IACzC,CAAC;IAED,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC;IACxC,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACtD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACnD,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AA7BW,QAAA,kBAAkB,sBA6B7B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const ERROR_CODES: readonly ["INVALID_STAGE_ACTION", "INVALID_TRANSITION", "MISSING_REQUIRED_INPUT", "STALE_LEASE", "LEASE_EXPIRED", "LEASE_MISMATCH", "PENDING_CHANGE_CONFLICT", "SCHEMA_VALIDATION_FAILED", "RUNTIME_VALIDATION_FAILED", "CLEANUP_TIMEOUT", "DEPENDENCY_FAILED", "SESSION_NOT_FOUND", "WORK_ITEM_NOT_FOUND"];
|
|
1
|
+
export declare const ERROR_CODES: readonly ["INVALID_STAGE_ACTION", "INVALID_TRANSITION", "MISSING_REQUIRED_INPUT", "STALE_LEASE", "LEASE_EXPIRED", "LEASE_MISMATCH", "PENDING_CHANGE_CONFLICT", "SCHEMA_VALIDATION_FAILED", "RUNTIME_VALIDATION_FAILED", "CLEANUP_TIMEOUT", "DEPENDENCY_FAILED", "SESSION_NOT_FOUND", "WORK_ITEM_NOT_FOUND", "UNSUPPORTED_FRAMEWORK", "UNKNOWN_DESIGN_SYSTEM", "DESTINATION_NOT_EMPTY", "SCAFFOLD_FAILED", "SOURCE_CONTEXT_INVALID", "SOURCE_CONTEXT_TOO_LARGE", "VARIANT_QA_FAILED"];
|
|
2
2
|
export type ErrorCode = (typeof ERROR_CODES)[number];
|
|
3
3
|
export declare class AgentVariantsError extends Error {
|
|
4
4
|
readonly code: ErrorCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/mcp/agent-variants/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/mcp/agent-variants/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,sdAqBd,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM;CAM7C"}
|
|
@@ -15,6 +15,13 @@ exports.ERROR_CODES = [
|
|
|
15
15
|
'DEPENDENCY_FAILED',
|
|
16
16
|
'SESSION_NOT_FOUND',
|
|
17
17
|
'WORK_ITEM_NOT_FOUND',
|
|
18
|
+
'UNSUPPORTED_FRAMEWORK',
|
|
19
|
+
'UNKNOWN_DESIGN_SYSTEM',
|
|
20
|
+
'DESTINATION_NOT_EMPTY',
|
|
21
|
+
'SCAFFOLD_FAILED',
|
|
22
|
+
'SOURCE_CONTEXT_INVALID',
|
|
23
|
+
'SOURCE_CONTEXT_TOO_LARGE',
|
|
24
|
+
'VARIANT_QA_FAILED',
|
|
18
25
|
];
|
|
19
26
|
class AgentVariantsError extends Error {
|
|
20
27
|
code;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/mcp/agent-variants/errors.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IACzB,sBAAsB;IACtB,oBAAoB;IACpB,wBAAwB;IACxB,aAAa;IACb,eAAe;IACf,gBAAgB;IAChB,yBAAyB;IACzB,0BAA0B;IAC1B,2BAA2B;IAC3B,iBAAiB;IACjB,mBAAmB;IACnB,mBAAmB;IACnB,qBAAqB;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/mcp/agent-variants/errors.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IACzB,sBAAsB;IACtB,oBAAoB;IACpB,wBAAwB;IACxB,aAAa;IACb,eAAe;IACf,gBAAgB;IAChB,yBAAyB;IACzB,0BAA0B;IAC1B,2BAA2B;IAC3B,iBAAiB;IACjB,mBAAmB;IACnB,mBAAmB;IACnB,qBAAqB;IACrB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,iBAAiB;IACjB,wBAAwB;IACxB,0BAA0B;IAC1B,mBAAmB;CACX,CAAC;AAIX,MAAa,kBAAmB,SAAQ,KAAK;IAClC,IAAI,CAAY;IAChB,MAAM,CAAS;IAExB,YAAY,IAAe,EAAE,OAAe;QAC1C,KAAK,CAAC,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAVD,gDAUC"}
|
|
@@ -4,8 +4,10 @@ export { PendingChangesAdapter } from './pendingChangesAdapter';
|
|
|
4
4
|
export type { AdapterTelemetry, BridgeChangeIntent, BridgeQueue, } from './pendingChangesAdapter';
|
|
5
5
|
export { AgentVariantsOrchestrator } from './WorktreeOrchestrator';
|
|
6
6
|
export type { OrchestratorDeps, ProjectEnvironment, WorktreeManagerLike, } from './WorktreeOrchestrator';
|
|
7
|
-
export { registerAgentVariantsTools } from './tools';
|
|
7
|
+
export { registerAgentVariantsTools, slugifyPrompt } from './tools';
|
|
8
|
+
export { registerCreateZeroToOneTool } from './createZeroToOneTool';
|
|
8
9
|
export type { ToolDeps } from './tools';
|
|
9
10
|
export { AgentVariantsError, ERROR_CODES, type ErrorCode } from './errors';
|
|
10
|
-
export
|
|
11
|
+
export { VARIANT_COUNT_MIN, VARIANT_COUNT_MAX } from './contracts';
|
|
12
|
+
export type { Brief, CancelVariantsInput, CancelVariantsOutput, ContinueVariantsInput, ContinueVariantsOutput, ExtractInspirationContextInput, ExtractInspirationContextOutput, LeaseRecord, LeasedWorkItemDescriptor, ProjectContext, ProposeVariantsInput, ProposeVariantsOutput, ReportVariantBriefsInput, ReportVariantBriefsOutput, ReportSourcePlanInput, ReportSourcePlanOutput, ReportVariantCompleteInput, ReportVariantCompleteOutput, SourceContextArtifact, SourceContextInput, SourcePlanArtifact, SourcePlanWorkItemDescriptor, Stage, Target, TerminalSummary, VariantPickEnvelope, VariantPickPayload, VisualEditorAttachment, WorkItem, WorkItemKind, WorkItemStatus, } from './contracts';
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mcp/agent-variants/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EACV,sBAAsB,EACtB,aAAa,EACb,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,GACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mcp/agent-variants/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EACV,sBAAsB,EACtB,aAAa,EACb,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,GACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACnE,YAAY,EACV,KAAK,EACL,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,8BAA8B,EAC9B,+BAA+B,EAC/B,WAAW,EACX,wBAAwB,EACxB,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,KAAK,EACL,MAAM,EACN,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,QAAQ,EACR,YAAY,EACZ,cAAc,GACf,MAAM,aAAa,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ERROR_CODES = exports.AgentVariantsError = exports.registerAgentVariantsTools = exports.AgentVariantsOrchestrator = exports.PendingChangesAdapter = exports.SessionStore = void 0;
|
|
3
|
+
exports.VARIANT_COUNT_MAX = exports.VARIANT_COUNT_MIN = exports.ERROR_CODES = exports.AgentVariantsError = exports.registerCreateZeroToOneTool = exports.slugifyPrompt = exports.registerAgentVariantsTools = exports.AgentVariantsOrchestrator = exports.PendingChangesAdapter = exports.SessionStore = void 0;
|
|
4
4
|
var SessionStore_1 = require("./SessionStore");
|
|
5
5
|
Object.defineProperty(exports, "SessionStore", { enumerable: true, get: function () { return SessionStore_1.SessionStore; } });
|
|
6
6
|
var pendingChangesAdapter_1 = require("./pendingChangesAdapter");
|
|
@@ -9,7 +9,13 @@ var WorktreeOrchestrator_1 = require("./WorktreeOrchestrator");
|
|
|
9
9
|
Object.defineProperty(exports, "AgentVariantsOrchestrator", { enumerable: true, get: function () { return WorktreeOrchestrator_1.AgentVariantsOrchestrator; } });
|
|
10
10
|
var tools_1 = require("./tools");
|
|
11
11
|
Object.defineProperty(exports, "registerAgentVariantsTools", { enumerable: true, get: function () { return tools_1.registerAgentVariantsTools; } });
|
|
12
|
+
Object.defineProperty(exports, "slugifyPrompt", { enumerable: true, get: function () { return tools_1.slugifyPrompt; } });
|
|
13
|
+
var createZeroToOneTool_1 = require("./createZeroToOneTool");
|
|
14
|
+
Object.defineProperty(exports, "registerCreateZeroToOneTool", { enumerable: true, get: function () { return createZeroToOneTool_1.registerCreateZeroToOneTool; } });
|
|
12
15
|
var errors_1 = require("./errors");
|
|
13
16
|
Object.defineProperty(exports, "AgentVariantsError", { enumerable: true, get: function () { return errors_1.AgentVariantsError; } });
|
|
14
17
|
Object.defineProperty(exports, "ERROR_CODES", { enumerable: true, get: function () { return errors_1.ERROR_CODES; } });
|
|
18
|
+
var contracts_1 = require("./contracts");
|
|
19
|
+
Object.defineProperty(exports, "VARIANT_COUNT_MIN", { enumerable: true, get: function () { return contracts_1.VARIANT_COUNT_MIN; } });
|
|
20
|
+
Object.defineProperty(exports, "VARIANT_COUNT_MAX", { enumerable: true, get: function () { return contracts_1.VARIANT_COUNT_MAX; } });
|
|
15
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mcp/agent-variants/index.ts"],"names":[],"mappings":";;;AAAA,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAUrB,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAM9B,+DAAmE;AAA1D,iIAAA,yBAAyB,OAAA;AAMlC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mcp/agent-variants/index.ts"],"names":[],"mappings":";;;AAAA,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAUrB,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAM9B,+DAAmE;AAA1D,iIAAA,yBAAyB,OAAA;AAMlC,iCAAoE;AAA3D,mHAAA,0BAA0B,OAAA;AAAE,sGAAA,aAAa,OAAA;AAClD,6DAAoE;AAA3D,kIAAA,2BAA2B,OAAA;AAEpC,mCAA2E;AAAlE,4GAAA,kBAAkB,OAAA;AAAE,qGAAA,WAAW,OAAA;AACxC,yCAAmE;AAA1D,8GAAA,iBAAiB,OAAA;AAAE,8GAAA,iBAAiB,OAAA"}
|