rivet-design 0.26.2 → 0.27.0

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.
Files changed (44) hide show
  1. package/dist/agent-variants/PreviewRuntime.js +20 -7
  2. package/dist/agent-variants/contracts.d.ts +116 -116
  3. package/dist/agent-variants/variantsTelemetry.d.ts +4 -0
  4. package/dist/agent-variants/variantsTelemetry.js +3 -0
  5. package/dist/agent-variants/workItemInput.d.ts +146 -146
  6. package/dist/cli/commands/mcpServe.js +1 -0
  7. package/dist/cli/commands/serve.js +2 -0
  8. package/dist/cli/handoff.d.ts +1 -0
  9. package/dist/cli/handoff.js +20 -4
  10. package/dist/cli/router.js +1 -0
  11. package/dist/cli/telemetry.d.ts +10 -0
  12. package/dist/cli/telemetry.js +37 -1
  13. package/dist/config/pluginMetrics.js +36 -0
  14. package/dist/index.d.ts +19 -0
  15. package/dist/index.js +14 -5
  16. package/dist/routes/library/middleware.js +11 -5
  17. package/dist/server.js +8 -0
  18. package/dist/services/DependencyPreparationService.js +57 -19
  19. package/dist/services/GuidanceVerifierRunner.js +4 -4
  20. package/dist/services/ProjectPackageManager.d.ts +5 -0
  21. package/dist/services/ProjectPackageManager.js +33 -11
  22. package/dist/services/TelemetryService.d.ts +8 -2
  23. package/dist/services/TelemetryService.js +10 -0
  24. package/dist/services/WorktreeManager.js +5 -0
  25. package/dist/services/profiles/DesignProfiles.js +16 -8
  26. package/dist/types/guidance-verifier.d.ts +7 -5
  27. package/dist/types/guidance-verifier.js +14 -1
  28. package/dist/utils/devServerError.d.ts +5 -0
  29. package/dist/utils/devServerError.js +4 -0
  30. package/dist/utils/failureReason.d.ts +16 -0
  31. package/dist/utils/failureReason.js +106 -0
  32. package/dist/utils/hostedLogPrivacy.d.ts +1 -0
  33. package/dist/utils/hostedLogPrivacy.js +10 -4
  34. package/dist/utils/skills/claude-skill.d.ts +1 -1
  35. package/dist/utils/skills/claude-skill.js +1 -1
  36. package/dist/utils/skills/cli-guidance.d.ts +1 -1
  37. package/dist/utils/skills/cli-guidance.js +3 -3
  38. package/dist/utils/skills/cursor-rules.d.ts +1 -1
  39. package/dist/utils/skills/cursor-rules.js +1 -1
  40. package/package.json +3 -3
  41. package/src/ui/dist/assets/{LibraryEntry-92R_T-Xa.js → LibraryEntry-RI9Lc7P3.js} +9 -9
  42. package/src/ui/dist/assets/main-DgrLzS5j.js +497 -0
  43. package/src/ui/dist/index.html +1 -1
  44. package/src/ui/dist/assets/main-DgEfJvYu.js +0 -497
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.resolveProjectPackageManager = exports.readProjectFile = exports.isInstallOutputPath = exports.forEveryPackageManager = exports.INSTALL_CONTENT_GLOBS = exports.INSTALL_ARTIFACTS = exports.INSTALL_CONFIG_FILES = exports.LOCKFILES = void 0;
6
+ exports.resolveProjectPackageManager = exports.readProjectFile = exports.isInstallOutputPath = exports.forEveryPackageManager = exports.INSTALL_CONTENT_GLOBS = exports.INSTALL_ARTIFACTS = exports.INSTALL_CONFIG_FILES = exports.LOCKFILES = exports.PackageManagerError = void 0;
7
7
  const promises_1 = __importDefault(require("fs/promises"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const glob_1 = require("glob");
@@ -11,6 +11,15 @@ const js_yaml_1 = require("js-yaml");
11
11
  const package_manager_detector_1 = require("package-manager-detector");
12
12
  const errnoCode_1 = require("../utils/errnoCode");
13
13
  const pathContainment_1 = require("../utils/pathContainment");
14
+ class PackageManagerError extends Error {
15
+ reasonCode;
16
+ constructor(reasonCode, message) {
17
+ super(message);
18
+ this.reasonCode = reasonCode;
19
+ this.name = 'PackageManagerError';
20
+ }
21
+ }
22
+ exports.PackageManagerError = PackageManagerError;
14
23
  exports.LOCKFILES = {
15
24
  npm: ['package-lock.json', 'npm-shrinkwrap.json'],
16
25
  yarn: ['yarn.lock'],
@@ -79,13 +88,26 @@ const readProjectFile = async (file) => {
79
88
  exports.readProjectFile = readProjectFile;
80
89
  const readManifest = async (root) => {
81
90
  const source = await (0, exports.readProjectFile)(path_1.default.join(root, 'package.json'));
82
- return source === null ? null : JSON.parse(source);
91
+ if (source === null)
92
+ return null;
93
+ try {
94
+ return JSON.parse(source);
95
+ }
96
+ catch {
97
+ throw new PackageManagerError('invalid_manifest', 'package.json is not valid JSON');
98
+ }
99
+ };
100
+ const readPnpmWorkspace = (source) => {
101
+ try {
102
+ return (0, js_yaml_1.load)(source, { schema: js_yaml_1.JSON_SCHEMA });
103
+ }
104
+ catch {
105
+ throw new PackageManagerError('invalid_workspace', 'pnpm-workspace.yaml is not valid YAML');
106
+ }
83
107
  };
84
108
  const packagePathsFor = async (root, manifest) => {
85
109
  const pnpmSource = await (0, exports.readProjectFile)(path_1.default.join(root, 'pnpm-workspace.yaml'));
86
- const pnpmConfig = pnpmSource === null
87
- ? null
88
- : (0, js_yaml_1.load)(pnpmSource, { schema: js_yaml_1.JSON_SCHEMA });
110
+ const pnpmConfig = pnpmSource === null ? null : readPnpmWorkspace(pnpmSource);
89
111
  const patterns = pnpmConfig?.packages ??
90
112
  (Array.isArray(manifest.workspaces)
91
113
  ? manifest.workspaces
@@ -93,7 +115,7 @@ const packagePathsFor = async (root, manifest) => {
93
115
  [];
94
116
  if (!Array.isArray(patterns) ||
95
117
  patterns.some((pattern) => typeof pattern !== 'string')) {
96
- throw new Error('Workspace packages must be an array of directory patterns');
118
+ throw new PackageManagerError('invalid_workspace', 'Workspace packages must be an array of directory patterns');
97
119
  }
98
120
  const included = patterns.filter((pattern) => !pattern.startsWith('!'));
99
121
  const excluded = patterns
@@ -107,7 +129,7 @@ const packagePathsFor = async (root, manifest) => {
107
129
  });
108
130
  const members = await Promise.all(files.map((file) => promises_1.default.realpath(path_1.default.dirname(file))));
109
131
  if (members.some((member) => !(0, pathContainment_1.isPathWithinRoot)(root, member))) {
110
- throw new Error('A workspace package resolves outside the preview workspace');
132
+ throw new PackageManagerError('path_outside_workspace', 'A workspace package resolves outside the preview workspace');
111
133
  }
112
134
  return [...new Set([root, ...members.sort()])];
113
135
  };
@@ -115,7 +137,7 @@ const resolveProjectPackageManager = async (options) => {
115
137
  const cwd = await promises_1.default.realpath(options.cwd);
116
138
  const boundary = await promises_1.default.realpath(options.workspaceRoot);
117
139
  if (!(0, pathContainment_1.isPathWithinRoot)(boundary, cwd)) {
118
- throw new Error('Dependency preparation directory is outside the preview workspace');
140
+ throw new PackageManagerError('path_outside_workspace', 'Dependency preparation directory is outside the preview workspace');
119
141
  }
120
142
  let rootPath = cwd;
121
143
  let manifest = await readManifest(cwd);
@@ -139,7 +161,7 @@ const resolveProjectPackageManager = async (options) => {
139
161
  const declared = manifest.packageManager;
140
162
  const declaration = declared ? parsePackageManagerDeclaration(declared) : null;
141
163
  if (declared && !declaration) {
142
- throw new Error(`Unsupported packageManager declaration: ${declared}. Preview preparation supports pinned npm, Yarn, and pnpm versions.`);
164
+ throw new PackageManagerError('invalid_package_manager_field', `Unsupported packageManager declaration: ${declared}. Preview preparation supports pinned npm, Yarn, and pnpm versions.`);
143
165
  }
144
166
  const managersWithLockfiles = [];
145
167
  for (const name of Object.keys(exports.LOCKFILES)) {
@@ -164,7 +186,7 @@ const resolveProjectPackageManager = async (options) => {
164
186
  !manifest.devEngines?.packageManager &&
165
187
  managersWithLockfiles.length > 1 &&
166
188
  !selectedManager) {
167
- throw new Error('Multiple package manager lockfiles found. Set package.json packageManager to select the project tool.');
189
+ throw new PackageManagerError('multiple_lockfiles', 'Multiple package manager lockfiles found. Set package.json packageManager to select the project tool.');
168
190
  }
169
191
  const detected = selectedManager
170
192
  ? null
@@ -175,7 +197,7 @@ const resolveProjectPackageManager = async (options) => {
175
197
  });
176
198
  const name = selectedManager ?? detected?.name ?? 'npm';
177
199
  if (name !== 'npm' && name !== 'yarn' && name !== 'pnpm') {
178
- throw new Error(`Preview dependency preparation does not support ${name}`);
200
+ throw new PackageManagerError('unsupported_package_manager', `Preview dependency preparation does not support ${name}`);
179
201
  }
180
202
  let agent = selectedManager ?? detected?.agent ?? name;
181
203
  if (name === 'yarn' &&
@@ -1,5 +1,5 @@
1
1
  import { type AccountIdentity } from './ConfigManager';
2
- import type { BrowserMetadata, DesignContextKind, ServerUnavailableReason, VariantContextMetadata } from '../cli/telemetry';
2
+ import type { BrowserMetadata, DesignContextKind, ServerUnavailableReason, VariantContextMetadata, VerificationMetadata } from '../cli/telemetry';
3
3
  import type { GuidanceErrorCode, GuidanceSelection } from '../types/guidance';
4
4
  import type { MCPAuthMethod, MCPAuthState, MCPOnboardingCorrelation, MCPOAuthCallbackResult } from './MCPOnboardingTelemetry';
5
5
  import { type MCPVariantsTelemetryMetadata } from './MCPVariantsTelemetry';
@@ -17,6 +17,7 @@ export interface LibraryOperation {
17
17
  operation: 'project_open' | 'project_rename' | 'project_remove' | 'project_pin' | 'project_unpin' | 'folder_select' | 'workspace_open' | 'preview_open' | 'thumbnail_capture' | 'direction_update' | 'navigation';
18
18
  outcome: 'completed' | 'failed';
19
19
  durationMs: number;
20
+ error?: unknown;
20
21
  }
21
22
  export interface ProfileOperation {
22
23
  stage: 'action' | 'import' | 'preparation' | 'maintenance';
@@ -25,6 +26,7 @@ export interface ProfileOperation {
25
26
  durationMs: number;
26
27
  referenceCount?: number;
27
28
  status?: 'selected' | 'empty' | 'off' | 'unavailable' | 'timeout';
29
+ error?: unknown;
28
30
  }
29
31
  export interface GuidanceOperation {
30
32
  operation: 'add' | 'update' | 'remove' | 'resolve' | 'delivery' | 'verifier';
@@ -70,9 +72,10 @@ export declare class TelemetryService {
70
72
  callerAgent?: string;
71
73
  callerModel?: string;
72
74
  callerAgentSource?: 'handoff' | 'env';
75
+ callerRunId?: string;
73
76
  designContextKind?: DesignContextKind;
74
77
  source?: 'cli' | 'mcp';
75
- } & VariantContextMetadata & BrowserMetadata): void;
78
+ } & VariantContextMetadata & BrowserMetadata & VerificationMetadata): void;
76
79
  trackAuthStarted(data: {
77
80
  surface: AuthTelemetrySurface;
78
81
  authAttemptId: string;
@@ -128,6 +131,7 @@ export declare class TelemetryService {
128
131
  stage: 'resolve_dev_server' | 'start_editor_server' | 'port_exhausted';
129
132
  failureReason: 'operation_failed' | 'port_unavailable';
130
133
  durationMs: number;
134
+ error?: unknown;
131
135
  }): void;
132
136
  trackServerStarted(data: {
133
137
  mode: 'attached' | 'static';
@@ -265,6 +269,7 @@ export declare class TelemetryService {
265
269
  exitCode?: number | null;
266
270
  signal?: string | null;
267
271
  missingDeps?: boolean;
272
+ error?: unknown;
268
273
  }): void;
269
274
  trackAgentVariantsPreviewStarted(data: {
270
275
  sessionId: string;
@@ -293,6 +298,7 @@ export declare class TelemetryService {
293
298
  exitCode?: number | null;
294
299
  signal?: string | null;
295
300
  missingDeps?: boolean;
301
+ error?: unknown;
296
302
  }): void;
297
303
  trackAgentVariantsPreviewSwitchStarted(data: {
298
304
  sessionId: string;
@@ -10,6 +10,7 @@ const telemetry_1 = require("../config/telemetry");
10
10
  const telemetryPolicy_1 = require("../config/telemetryPolicy");
11
11
  const pluginMetrics_1 = require("../config/pluginMetrics");
12
12
  const telemetryContract_1 = require("../config/telemetryContract");
13
+ const failureReason_1 = require("../utils/failureReason");
13
14
  const proxy_1 = require("../config/proxy");
14
15
  const MCPVariantsTelemetry_1 = require("./MCPVariantsTelemetry");
15
16
  const errorMessage_1 = require("../utils/errorMessage");
@@ -53,11 +54,13 @@ class TelemetryService {
53
54
  ? { reference_count: data.referenceCount }
54
55
  : {}),
55
56
  ...(data.status ? { status: data.status } : {}),
57
+ ...(0, failureReason_1.failureReasonCodeProperties)(data.error),
56
58
  });
57
59
  }
58
60
  trackLibraryOperation(data) {
59
61
  this.track(`library_${data.operation}_${data.outcome}`, {
60
62
  duration_ms: data.durationMs,
63
+ ...(0, failureReason_1.failureReasonCodeProperties)(data.error),
61
64
  });
62
65
  }
63
66
  hashTelemetryValue(value) {
@@ -290,6 +293,10 @@ class TelemetryService {
290
293
  caller_agent: data.callerAgent,
291
294
  caller_model: data.callerModel,
292
295
  caller_agent_source: data.callerAgentSource,
296
+ caller_run_id: data.callerRunId,
297
+ verification_outcome: data.verificationOutcome,
298
+ verification_check_count: data.verificationCheckCount,
299
+ verification_duration_ms: data.verificationDurationMs,
293
300
  design_context_kind: data.designContextKind,
294
301
  design_context_kinds: data.contextKinds,
295
302
  context_image_count: data.contextImageCount,
@@ -372,6 +379,7 @@ class TelemetryService {
372
379
  stage: data.stage,
373
380
  failure_reason: data.failureReason,
374
381
  duration_ms: data.durationMs,
382
+ ...(0, failureReason_1.failureReasonCodeProperties)(data.error),
375
383
  });
376
384
  }
377
385
  trackServerStarted(data) {
@@ -652,6 +660,7 @@ class TelemetryService {
652
660
  exit_code: data.exitCode,
653
661
  term_signal: data.signal,
654
662
  missing_deps: data.missingDeps,
663
+ ...(0, failureReason_1.failureReasonProperties)(data.error),
655
664
  source: 'mcp',
656
665
  });
657
666
  }
@@ -689,6 +698,7 @@ class TelemetryService {
689
698
  exit_code: data.exitCode,
690
699
  term_signal: data.signal,
691
700
  missing_deps: data.missingDeps,
701
+ ...(0, failureReason_1.failureReasonProperties)(data.error),
692
702
  source: 'mcp',
693
703
  });
694
704
  }
@@ -22,6 +22,7 @@ const ProjectPackageManager_1 = require("./ProjectPackageManager");
22
22
  const OperatingSystemServices_1 = require("./OperatingSystemServices");
23
23
  const errnoCode_1 = require("../utils/errnoCode");
24
24
  const errorMessage_1 = require("../utils/errorMessage");
25
+ const failureReason_1 = require("../utils/failureReason");
25
26
  const log = (0, logger_1.createLogger)('WorktreeManager');
26
27
  const DEV_SERVER_READY_INACTIVITY_MS = 30_000;
27
28
  const DEV_SERVER_READY_MAX_MS = 120_000;
@@ -403,6 +404,10 @@ class WorktreeManager {
403
404
  detail,
404
405
  exitCode: term.exited?.code ?? null,
405
406
  signal: term.exited?.signal ?? null,
407
+ reasonCode: term.spawnError
408
+ ? (0, failureReason_1.failureReasonCode)(term.spawnError)
409
+ : undefined,
410
+ summary: term.spawnError ? message : undefined,
406
411
  });
407
412
  };
408
413
  const hardDeadline = Date.now() + DEV_SERVER_READY_MAX_MS;
@@ -417,18 +417,25 @@ class DesignProfiles {
417
417
  instructions: `The source changed after this verifier was saved. ${VERIFICATION_TARGET_INSTRUCTIONS} Revise and execute a temporary recipe against the supplied source before offering to replace the saved verifier.`,
418
418
  },
419
419
  };
420
+ if (!verifier.package) {
421
+ return {
422
+ ...resolved,
423
+ verifier,
424
+ verifierState: 'ready',
425
+ nextAction: {
426
+ action: 'execute_context_recipe',
427
+ instructions: `This saved verifier is a Markdown recipe without an executable package, so \`rivet context verify\` cannot run it. Follow the recipe once with the host's own tools against this source and the user-selected target. ${VERIFICATION_TARGET_INSTRUCTIONS} Report pass, fail, or unable to verify with evidence. Retrieval has not executed any checks.`,
428
+ },
429
+ };
430
+ }
420
431
  return {
421
432
  ...resolved,
422
433
  verifier,
423
434
  verifierState: 'ready',
424
- ...(verifier.package
425
- ? {
426
- packageDirectory: await (0, retainedTextFiles_1.materializeTextFiles)({
427
- files: verifier.package.files,
428
- directory: path_1.default.join(records.directory, 'guidance-verifiers'),
429
- }),
430
- }
431
- : {}),
435
+ packageDirectory: await (0, retainedTextFiles_1.materializeTextFiles)({
436
+ files: verifier.package.files,
437
+ directory: path_1.default.join(records.directory, 'guidance-verifiers'),
438
+ }),
432
439
  nextAction: {
433
440
  action: 'run_context_verifier',
434
441
  instructions: `Execute the saved verifier against this source and the user-selected target. ${VERIFICATION_TARGET_INSTRUCTIONS} Report pass, fail, or unable to verify with evidence. Retrieval has not executed any checks.`,
@@ -1388,6 +1395,7 @@ class DesignProfiles {
1388
1395
  operation: 'import',
1389
1396
  outcome: 'failed',
1390
1397
  durationMs: Date.now() - started,
1398
+ error,
1391
1399
  });
1392
1400
  if (!context.abort.signal.aborted &&
1393
1401
  context.records.jobs().find((item) => item.id === id)?.state ===
@@ -23,8 +23,8 @@ export declare const GuidanceVerifierResultSchema: z.ZodObject<{
23
23
  mediaType: z.ZodString;
24
24
  label: z.ZodString;
25
25
  role: z.ZodEnum<{
26
- reference: "reference";
27
26
  observed: "observed";
27
+ reference: "reference";
28
28
  }>;
29
29
  }, z.core.$strict>>;
30
30
  comparison: z.ZodOptional<z.ZodObject<{
@@ -49,8 +49,8 @@ export declare const GuidanceVerifierResultSchema: z.ZodObject<{
49
49
  mediaType: z.ZodString;
50
50
  label: z.ZodString;
51
51
  role: z.ZodEnum<{
52
- reference: "reference";
53
52
  observed: "observed";
53
+ reference: "reference";
54
54
  }>;
55
55
  }, z.core.$strict>>;
56
56
  comparison: z.ZodOptional<z.ZodObject<{
@@ -75,8 +75,8 @@ export declare const GuidanceVerifierResultSchema: z.ZodObject<{
75
75
  mediaType: z.ZodString;
76
76
  label: z.ZodString;
77
77
  role: z.ZodEnum<{
78
- reference: "reference";
79
78
  observed: "observed";
79
+ reference: "reference";
80
80
  }>;
81
81
  }, z.core.$strict>>;
82
82
  comparison: z.ZodOptional<z.ZodObject<{
@@ -90,6 +90,8 @@ export declare const GuidanceVerifierResultSchema: z.ZodObject<{
90
90
  }, z.core.$strict>], "status">>;
91
91
  }, z.core.$strict>;
92
92
  export type GuidanceVerifierResult = z.infer<typeof GuidanceVerifierResultSchema>;
93
+ export declare const GUIDANCE_VERIFIER_ERROR_REASONS: readonly ["package_required", "verifier_missing", "verifier_stale", "cancelled", "timeout", "output_limit", "process_failed", "invalid_result", "invalid_evidence", "cleanup_failed", "setup_failed"];
94
+ export type GuidanceVerifierErrorReason = (typeof GUIDANCE_VERIFIER_ERROR_REASONS)[number];
93
95
  export type GuidanceVerifierRun = {
94
96
  schemaVersion: 1;
95
97
  verifier: {
@@ -105,7 +107,7 @@ export type GuidanceVerifierRun = {
105
107
  checks: GuidanceVerifierResult['checks'];
106
108
  } | {
107
109
  execution: 'error';
108
- reason: 'package_required' | 'verifier_missing' | 'verifier_stale' | 'cancelled' | 'timeout' | 'output_limit' | 'process_failed' | 'invalid_result' | 'invalid_evidence' | 'cleanup_failed' | 'setup_failed';
110
+ reason: GuidanceVerifierErrorReason;
109
111
  });
110
112
  export interface GuidanceVerifierInput {
111
113
  source: GuidanceDocument;
@@ -156,7 +158,7 @@ export type GuidanceVerification = GuidanceVerificationSource & ({
156
158
  verifierState: 'ready';
157
159
  verifier: GuidanceVerifier;
158
160
  nextAction: {
159
- action: 'run_context_verifier';
161
+ action: 'run_context_verifier' | 'execute_context_recipe';
160
162
  instructions: string;
161
163
  };
162
164
  });
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isSeparateVerifierUpdate = exports.GuidanceVerifierSummarySchema = exports.GuidanceVerifierSchema = exports.GuidanceVerifierResultSchema = exports.GuidanceVerifierPackageSchema = void 0;
3
+ exports.isSeparateVerifierUpdate = exports.GuidanceVerifierSummarySchema = exports.GuidanceVerifierSchema = exports.GUIDANCE_VERIFIER_ERROR_REASONS = exports.GuidanceVerifierResultSchema = exports.GuidanceVerifierPackageSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const guidance_references_1 = require("./guidance-references");
6
6
  exports.GuidanceVerifierPackageSchema = zod_1.z
@@ -72,6 +72,19 @@ exports.GuidanceVerifierResultSchema = zod_1.z
72
72
  .strict()
73
73
  .refine((value) => new Set(value.checks.map((check) => check.id)).size ===
74
74
  value.checks.length, 'Check IDs must be unique');
75
+ exports.GUIDANCE_VERIFIER_ERROR_REASONS = [
76
+ 'package_required',
77
+ 'verifier_missing',
78
+ 'verifier_stale',
79
+ 'cancelled',
80
+ 'timeout',
81
+ 'output_limit',
82
+ 'process_failed',
83
+ 'invalid_result',
84
+ 'invalid_evidence',
85
+ 'cleanup_failed',
86
+ 'setup_failed',
87
+ ];
75
88
  exports.GuidanceVerifierSchema = zod_1.z
76
89
  .object({
77
90
  markdown: zod_1.z
@@ -1,3 +1,4 @@
1
+ import type { FailureReasonCode } from './failureReason';
1
2
  export type DevServerFailureReason = 'spawn_error' | 'exited' | 'timeout' | 'missing_dev_script' | 'compile_error' | 'dependency_install_failed';
2
3
  export declare const isCompilationFailureOutput: (output: string) => boolean;
3
4
  export declare function isPortInUseOutput(output: string): boolean;
@@ -8,6 +9,8 @@ export declare class DevServerStartError extends Error {
8
9
  readonly detail: string;
9
10
  readonly exitCode: number | null;
10
11
  readonly signal: NodeJS.Signals | null;
12
+ readonly reasonCode?: FailureReasonCode;
13
+ readonly summary?: string;
11
14
  constructor(opts: {
12
15
  message: string;
13
16
  reason: DevServerFailureReason;
@@ -15,6 +18,8 @@ export declare class DevServerStartError extends Error {
15
18
  detail: string;
16
19
  exitCode?: number | null;
17
20
  signal?: NodeJS.Signals | null;
21
+ reasonCode?: FailureReasonCode;
22
+ summary?: string;
18
23
  });
19
24
  }
20
25
  export declare function isDevServerStartError(err: unknown): err is DevServerStartError;
@@ -21,6 +21,8 @@ class DevServerStartError extends Error {
21
21
  detail;
22
22
  exitCode;
23
23
  signal;
24
+ reasonCode;
25
+ summary;
24
26
  constructor(opts) {
25
27
  super(opts.message);
26
28
  this.name = 'DevServerStartError';
@@ -29,6 +31,8 @@ class DevServerStartError extends Error {
29
31
  this.detail = opts.detail;
30
32
  this.exitCode = opts.exitCode ?? null;
31
33
  this.signal = opts.signal ?? null;
34
+ this.reasonCode = opts.reasonCode;
35
+ this.summary = opts.summary;
32
36
  }
33
37
  }
34
38
  exports.DevServerStartError = DevServerStartError;
@@ -0,0 +1,16 @@
1
+ export declare const FAILURE_REASON_CODES: readonly ["multiple_lockfiles", "unsupported_package_manager", "invalid_package_manager_field", "invalid_manifest", "invalid_workspace", "path_outside_workspace", "dangling_symlink", "version_unreadable", "version_mismatch", "no_install_command", "install_failed", "installer_unstoppable", "inputs_changed", "ENOENT", "EACCES", "EPERM", "EEXIST", "ENOTDIR", "EISDIR", "ELOOP", "ENOSPC", "EMFILE", "EADDRINUSE", "ECONNREFUSED", "ECONNRESET", "ETIMEDOUT", "EBUSY", "ENOTSUP", "EINVAL", "ENOTEMPTY", "EROFS", "EAI_AGAIN", "timeout", "aborted", "unknown"];
2
+ export type FailureReasonCode = (typeof FAILURE_REASON_CODES)[number];
3
+ export interface FailureReason {
4
+ reasonCode: FailureReasonCode;
5
+ reasonDetail?: string;
6
+ }
7
+ export declare const failureReasonCode: (error: unknown) => FailureReasonCode;
8
+ export declare const failureReason: (error: unknown) => FailureReason;
9
+ export declare const failureReasonProperties: (error: unknown) => {
10
+ reason_code?: FailureReasonCode;
11
+ reason_detail?: string;
12
+ };
13
+ export declare const failureReasonCodeProperties: (error: unknown) => {
14
+ reason_code?: FailureReasonCode;
15
+ };
16
+ //# sourceMappingURL=failureReason.d.ts.map
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.failureReasonCodeProperties = exports.failureReasonProperties = exports.failureReason = exports.failureReasonCode = exports.FAILURE_REASON_CODES = void 0;
4
+ const errnoCode_1 = require("./errnoCode");
5
+ const errorMessage_1 = require("./errorMessage");
6
+ const devServerError_1 = require("./devServerError");
7
+ const hostedLogPrivacy_1 = require("./hostedLogPrivacy");
8
+ const DEPENDENCY_REASON_CODES = [
9
+ 'multiple_lockfiles',
10
+ 'unsupported_package_manager',
11
+ 'invalid_package_manager_field',
12
+ 'invalid_manifest',
13
+ 'invalid_workspace',
14
+ 'path_outside_workspace',
15
+ 'dangling_symlink',
16
+ 'version_unreadable',
17
+ 'version_mismatch',
18
+ 'no_install_command',
19
+ 'install_failed',
20
+ 'installer_unstoppable',
21
+ 'inputs_changed',
22
+ ];
23
+ const ERRNO_REASON_CODES = [
24
+ 'ENOENT',
25
+ 'EACCES',
26
+ 'EPERM',
27
+ 'EEXIST',
28
+ 'ENOTDIR',
29
+ 'EISDIR',
30
+ 'ELOOP',
31
+ 'ENOSPC',
32
+ 'EMFILE',
33
+ 'EADDRINUSE',
34
+ 'ECONNREFUSED',
35
+ 'ECONNRESET',
36
+ 'ETIMEDOUT',
37
+ 'EBUSY',
38
+ 'ENOTSUP',
39
+ 'EINVAL',
40
+ 'ENOTEMPTY',
41
+ 'EROFS',
42
+ 'EAI_AGAIN',
43
+ ];
44
+ const GENERAL_REASON_CODES = ['timeout', 'aborted', 'unknown'];
45
+ exports.FAILURE_REASON_CODES = [
46
+ ...DEPENDENCY_REASON_CODES,
47
+ ...ERRNO_REASON_CODES,
48
+ ...GENERAL_REASON_CODES,
49
+ ];
50
+ const REASON_DETAIL_LIMIT = 400;
51
+ const REDACTION_INPUT_LIMIT = 4_000;
52
+ const ABSOLUTE_PATH = /(?<![\w.:/\\])\/(?:[\w.@+~-]+\/)+[\w.@+~-]*/g;
53
+ const REASON_CODES = new Set(exports.FAILURE_REASON_CODES);
54
+ const ERRNO_CODES = new Set(ERRNO_REASON_CODES);
55
+ const ERROR_NAME_REASON_CODES = new Map([
56
+ ['AbortError', 'aborted'],
57
+ ['TimeoutError', 'timeout'],
58
+ ]);
59
+ const propertyOf = (error, key) => typeof error === 'object' && error !== null
60
+ ? Reflect.get(error, key)
61
+ : undefined;
62
+ const isFailureReasonCode = (value) => typeof value === 'string' && REASON_CODES.has(value);
63
+ const isErrnoReasonCode = (value) => value !== undefined && ERRNO_CODES.has(value);
64
+ const failureReasonCode = (error) => {
65
+ const declared = propertyOf(error, 'reasonCode');
66
+ if (isFailureReasonCode(declared))
67
+ return declared;
68
+ const code = (0, errnoCode_1.errnoCode)(error);
69
+ if (isErrnoReasonCode(code))
70
+ return code;
71
+ return (ERROR_NAME_REASON_CODES.get(String(propertyOf(error, 'name'))) ?? 'unknown');
72
+ };
73
+ exports.failureReasonCode = failureReasonCode;
74
+ const failureText = (error) => {
75
+ if (!(0, devServerError_1.isDevServerStartError)(error))
76
+ return (0, errorMessage_1.errorMessage)(error);
77
+ return error.summary ?? '';
78
+ };
79
+ const failureDetail = (error) => (0, hostedLogPrivacy_1.redactSensitiveText)(failureText(error)
80
+ .slice(-REDACTION_INPUT_LIMIT)
81
+ .replace(/\s+/g, ' ')
82
+ .trim())
83
+ .replace(ABSOLUTE_PATH, '[redacted]')
84
+ .slice(-REASON_DETAIL_LIMIT)
85
+ .trim() || undefined;
86
+ const failureReason = (error) => {
87
+ const reasonDetail = failureDetail(error);
88
+ return {
89
+ reasonCode: (0, exports.failureReasonCode)(error),
90
+ ...(reasonDetail ? { reasonDetail } : {}),
91
+ };
92
+ };
93
+ exports.failureReason = failureReason;
94
+ const failureReasonProperties = (error) => {
95
+ if (error === undefined)
96
+ return {};
97
+ const { reasonCode, reasonDetail } = (0, exports.failureReason)(error);
98
+ return {
99
+ reason_code: reasonCode,
100
+ ...(reasonDetail ? { reason_detail: reasonDetail } : {}),
101
+ };
102
+ };
103
+ exports.failureReasonProperties = failureReasonProperties;
104
+ const failureReasonCodeProperties = (error) => error === undefined ? {} : { reason_code: (0, exports.failureReasonCode)(error) };
105
+ exports.failureReasonCodeProperties = failureReasonCodeProperties;
106
+ //# sourceMappingURL=failureReason.js.map
@@ -1,2 +1,3 @@
1
+ export declare const redactSensitiveText: (text: string) => string;
1
2
  export declare const hostedLogValues: (message: unknown, values: unknown[]) => unknown[];
2
3
  //# sourceMappingURL=hostedLogPrivacy.d.ts.map
@@ -1,19 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hostedLogValues = void 0;
3
+ exports.hostedLogValues = exports.redactSensitiveText = void 0;
4
4
  const DETAILS_OMITTED = '[details omitted]';
5
5
  const MAX_LABEL_LENGTH = 2_048;
6
6
  const HOSTED_LABEL_REDACTIONS = [
7
7
  /(?:https?|wss?):\/\/[^\s"'<>]+/gi,
8
8
  /\bBearer\s+[^\s,;"']+/gi,
9
9
  /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,
10
- /(?:[A-Z]:[\\/]|\/)(?:Users|home|private|tmp|var|opt|workspace)[\\/][^\s"'<>]+/gi,
11
- /\b(?:sk-|sb_secret_|phx_|ghp_|gho_)[A-Za-z0-9_-]+/g,
10
+ /(?:[A-Z]:[\\/]|\/)(?:Users|home|private|tmp|var|opt|workspace|Volumes|root|mnt|srv)[\\/][^\s"'<>]+/gi,
11
+ /\b[A-Z]:[\\/][^\s"'<>]+/gi,
12
+ /\b[\w.-]{0,32}(?:token|secret|password|passwd|api[_-]?key)[\w.-]{0,32}["']?\s{0,3}[=:]\s{0,3}["']?[^\s,;"'<>]{1,256}/gi,
13
+ /\b(?:sk-|sk_live_|sk_test_|rk_live_|rk_test_|sb_secret_|phx_|ghp_|gho_|ghs_|ghu_|github_pat_|glpat-|xox[abprs]-)[A-Za-z0-9_-]+/g,
14
+ /\bnpm_[A-Za-z0-9]{36}\b/g,
15
+ /\bAKIA[0-9A-Z]{16}\b/g,
12
16
  /\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,
13
17
  ];
18
+ const redactSensitiveText = (text) => HOSTED_LABEL_REDACTIONS.reduce((current, pattern) => current.replace(pattern, '[redacted]'), text);
19
+ exports.redactSensitiveText = redactSensitiveText;
14
20
  const hostedLogValues = (message, values) => {
15
21
  const label = typeof message === 'string' ? message : DETAILS_OMITTED;
16
- const redacted = HOSTED_LABEL_REDACTIONS.reduce((current, pattern) => current.replace(pattern, '[redacted]'), label).slice(0, MAX_LABEL_LENGTH);
22
+ const redacted = (0, exports.redactSensitiveText)(label).slice(0, MAX_LABEL_LENGTH);
17
23
  return [
18
24
  redacted,
19
25
  ...values.map((value) => {
@@ -1,4 +1,4 @@
1
- export declare const CLAUDE_SKILL_VERSION = 61;
1
+ export declare const CLAUDE_SKILL_VERSION = 62;
2
2
  export declare const CLAUDE_SKILL_DIR = "rivet";
3
3
  export declare const CLAUDE_SKILL_FILENAME = "SKILL.md";
4
4
  export declare const CLAUDE_SKILL_CONTENT: string;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CLAUDE_SKILL_CONTENT = exports.CLAUDE_SKILL_FILENAME = exports.CLAUDE_SKILL_DIR = exports.CLAUDE_SKILL_VERSION = void 0;
4
4
  const cli_guidance_1 = require("./cli-guidance");
5
- exports.CLAUDE_SKILL_VERSION = 61;
5
+ exports.CLAUDE_SKILL_VERSION = 62;
6
6
  const CLAUDE_SKILL_VERSION_MARKER = `[//]: # (rivet-skill-version: ${exports.CLAUDE_SKILL_VERSION})`;
7
7
  exports.CLAUDE_SKILL_DIR = 'rivet';
8
8
  exports.CLAUDE_SKILL_FILENAME = 'SKILL.md';
@@ -1,4 +1,4 @@
1
- export declare const CLI_GUIDANCE_VERSION = 57;
1
+ export declare const CLI_GUIDANCE_VERSION = 58;
2
2
  export declare const CLI_GUIDANCE_BODY: string;
3
3
  export declare const CLI_GUIDANCE_DESCRIPTION = "Rivet \u2014 open the visual editor or explore design directions for a web app.";
4
4
  //# sourceMappingURL=cli-guidance.d.ts.map
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CLI_GUIDANCE_DESCRIPTION = exports.CLI_GUIDANCE_BODY = exports.CLI_GUIDANCE_VERSION = void 0;
4
4
  const displayLocale_1 = require("../displayLocale");
5
- exports.CLI_GUIDANCE_VERSION = 57;
5
+ exports.CLI_GUIDANCE_VERSION = 58;
6
6
  const DISPLAY_LOCALE = (0, displayLocale_1.resolveDisplayLocale)();
7
7
  exports.CLI_GUIDANCE_BODY = `Rivet helps you **explore multiple design directions** for a web app. You drive it by running \`rivet\` CLI commands. Every command prints exactly one JSON envelope on stdout (\`{ schemaVersion, ok, command, data | error }\`), routes progress to stderr, and never prompts for input.
8
8
 
@@ -75,9 +75,9 @@ Translate "ignore my motion principles for this run" into \`--exclude-guidance '
75
75
 
76
76
  Every generation resolves current saved instructions once and supplies the same text to its planner and workers. Editing defaults affects the next generation; retries retain their original text. For "what instructions did this run receive?", use \`rivet context inspect <workId> --project <path>\` or \`rivet_get_exploration\` with \`workId\` and \`project\`. Use the retained text rather than resolving today's defaults. If \`isRecorded\` is false, historical evidence is unavailable. Delivery is evidence of supplied context; it does not establish that the generated design followed every principle.
77
77
 
78
- **Custom verification on demand.** When asked to check a property such as "verify this used my motion principles," locate its existing context document with \`context list\`/\`show\`. Save missing user-provided principles or pointers through \`context add\` when the user wants them in context; do not invent principles or ingest source snapshots. Retrieve only the selected document with \`rivet context verifier <id>\` (MCP: \`rivet_get_design_context\` with \`instructionIds: ["<id>"]\` and \`includeChecks: true\`). Its \`sourceDigest\` binds the saved text and reference metadata; URL and directory contents remain live and are not frozen by this digest. Inspect the actual relevant references without copying them into persistent context. The CLI packet has \`execution: "host_required"\`. The MCP read returns the saved checking recipe and metadata. Neither read has checked the output.
78
+ **Custom verification on demand.** First bind the user-selected page, screen, or components and the requested rules or properties to the target from the user's app or \`variants get\`. When asked to check a property such as "verify this used my motion principles," locate its existing context document with \`context list\`/\`show\`. Save missing user-provided principles or pointers through \`context add\` when the user wants them in context; do not invent principles or ingest source snapshots. Retrieve only the selected document with \`rivet context verifier <id>\` (MCP: \`rivet_get_design_context\` with \`instructionIds: ["<id>"]\` and \`includeChecks: true\`). Its \`sourceDigest\` binds the saved text and reference metadata; URL and directory contents remain live and are not frozen by this digest. Inspect only source files and actual references directly needed for those bound assertions, without copying them into persistent context. Expand inspection only to resolve a concrete unresolved assertion. Do not scan the whole project or unrelated routes unless the user explicitly requests broader verification. The CLI packet has \`execution: "host_required"\`. The MCP read returns the saved checking recipe and metadata. Neither read has checked the output.
79
79
 
80
- Identify the target from the user's app or \`variants get\`. Choose verification tools for the actual browser, simulator, or other target. Do not assume a URL, DOM, CSS, or Playwright. Use the host's available tools for that target; unavailable tools or inaccessible targets mean unable to verify. Keep reusable assertions separate from target-specific bindings and execution steps, and record applicability when a rule requires a particular platform. For an earlier generation, read \`context inspect <workId>\` before claiming the source was delivered. Disclose missing receipts, changed principles, and live-source limitations. A current-source assessment does not establish historical compliance. For CLI packets follow \`nextAction\`. For MCP use the returned source digest and saved recipe to determine whether to create or revise a recipe. Execute a recipe only when the user requests verification and authorizes its required privileges. Keep recipes short and specific about applicability, actions, observable assertions, and evidence. Use code inspection for source-level rules and real interaction for behavioral rules; a screenshot alone cannot verify motion timing or reduced-motion behavior. Execute the recipe once and write a uniquely named local report containing target identity, context ID/digest, each check, evidence locations, and pass/fail/unable-to-verify outcomes. Missing evidence is unable to verify, not a pass. Report failures without silently repairing the app.
80
+ Choose verification tools for the actual browser, simulator, or other target. Do not assume a URL, DOM, CSS, or Playwright. Use the host's available tools for that target; unavailable tools or inaccessible targets mean unable to verify. Keep reusable assertions separate from target-specific bindings and execution steps, and record applicability when a rule requires a particular platform. For an earlier generation, read \`context inspect <workId>\` before claiming the source was delivered. Disclose missing receipts, changed principles, and live-source limitations. A current-source assessment does not establish historical compliance. For CLI packets follow \`nextAction\`. For a Markdown-only recipe, use the host's tools directly; never call \`context verify\` or \`rivet_run_design_check\`. Do not automatically author, prove, or save an executable package for a one-off check. For MCP use the returned source digest and saved recipe to determine whether to create or revise a recipe. Execute a recipe only when the user requests verification and authorizes its required privileges. Keep recipes short and specific about applicability, actions, observable assertions, and evidence. Use code inspection for source-level rules and real interaction for behavioral rules; a screenshot alone cannot verify motion timing or reduced-motion behavior. Execute the recipe once and write a uniquely named local report containing target identity, context ID/digest, each check, evidence locations, and pass/fail/unable-to-verify outcomes. Missing evidence is unable to verify, not a pass. Report failures without silently repairing the app. If a tool or runtime fails, stop and report the actual error, including its normalized reason when available. Do not retry an unchanged check or automatically regenerate its recipe or package.
81
81
 
82
82
  After showing the actual result, offer to save a reusable recipe unless the user already requested reuse. With that agreement, run \`rivet context update <id> --verifier <Markdown path> --source-digest <packet digest>\` (MCP: \`rivet_save_design_check\` with \`contextId\`, \`recipeFile\`, and \`sourceDigest\`). A source-change conflict requires retrieving the source and revising the recipe before saving. Source edits and verifier saves are separate updates. Remove just the recipe with \`context update <id> --remove-verifier\` (MCP: \`rivet_remove_design_check\` with \`contextId\`). Saved verifiers run only when requested; saving does not schedule checks or enable automatic reruns. The source retains its existing generation defaults, while recipe text stays out of planning and worker context.
83
83
 
@@ -1,4 +1,4 @@
1
- export declare const CURSOR_RULES_VERSION = 57;
1
+ export declare const CURSOR_RULES_VERSION = 58;
2
2
  export declare const CURSOR_RULES_FILENAME = "rivet.mdc";
3
3
  export declare const CURSOR_RULES_CONTENT: string;
4
4
  //# sourceMappingURL=cursor-rules.d.ts.map
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CURSOR_RULES_CONTENT = exports.CURSOR_RULES_FILENAME = exports.CURSOR_RULES_VERSION = void 0;
4
4
  const cli_guidance_1 = require("./cli-guidance");
5
- exports.CURSOR_RULES_VERSION = 57;
5
+ exports.CURSOR_RULES_VERSION = 58;
6
6
  exports.CURSOR_RULES_FILENAME = 'rivet.mdc';
7
7
  const CURSOR_RULES_VERSION_MARKER = `rivet-rules-version: ${exports.CURSOR_RULES_VERSION}`;
8
8
  exports.CURSOR_RULES_CONTENT = `---