rivet-design 0.26.2 → 0.27.1

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 (94) hide show
  1. package/dist/agent-variants/DirectionRefReservations.d.ts +11 -0
  2. package/dist/agent-variants/DirectionRefReservations.js +47 -0
  3. package/dist/agent-variants/PreviewRuntime.js +20 -7
  4. package/dist/agent-variants/SessionStore.d.ts +10 -1
  5. package/dist/agent-variants/SessionStore.js +25 -2
  6. package/dist/agent-variants/WorkItemRequestTimes.d.ts +6 -0
  7. package/dist/agent-variants/WorkItemRequestTimes.js +21 -0
  8. package/dist/agent-variants/WorktreeOrchestrator.d.ts +2 -1
  9. package/dist/agent-variants/WorktreeOrchestrator.js +92 -78
  10. package/dist/agent-variants/contracts.d.ts +120 -116
  11. package/dist/agent-variants/existingStaticEntry.d.ts +34 -0
  12. package/dist/agent-variants/existingStaticEntry.js +136 -0
  13. package/dist/agent-variants/staticPreviewFiles.js +1 -1
  14. package/dist/agent-variants/variant-project-runtime.d.ts +2 -1
  15. package/dist/agent-variants/variantsTelemetry.d.ts +8 -0
  16. package/dist/agent-variants/variantsTelemetry.js +5 -0
  17. package/dist/agent-variants/workItemInput.d.ts +168 -146
  18. package/dist/agent-variants/workItemInput.js +12 -1
  19. package/dist/cli/commands/directionTarget.d.ts +23 -0
  20. package/dist/cli/commands/directionTarget.js +87 -0
  21. package/dist/cli/commands/mcpServe.js +1 -0
  22. package/dist/cli/commands/open.js +28 -4
  23. package/dist/cli/commands/serve.js +2 -0
  24. package/dist/cli/commands/variants.js +36 -43
  25. package/dist/cli/envelope.d.ts +1 -1
  26. package/dist/cli/envelope.js +1 -0
  27. package/dist/cli/handoff.d.ts +1 -0
  28. package/dist/cli/handoff.js +20 -4
  29. package/dist/cli/projectRuntimeUpgrade.d.ts +11 -0
  30. package/dist/cli/projectRuntimeUpgrade.js +43 -11
  31. package/dist/cli/router.js +1 -0
  32. package/dist/cli/telemetry.d.ts +10 -0
  33. package/dist/cli/telemetry.js +37 -1
  34. package/dist/config/pluginMetrics.js +38 -0
  35. package/dist/index.d.ts +19 -0
  36. package/dist/index.js +14 -5
  37. package/dist/mcp/explorationSchema.js +1 -1
  38. package/dist/mcp/getExploration.js +11 -5
  39. package/dist/proxy-middleware/proxy-config.js +7 -0
  40. package/dist/routes/agentVariants.js +4 -0
  41. package/dist/routes/cli.js +10 -1
  42. package/dist/routes/library/middleware.js +11 -5
  43. package/dist/server.js +20 -6
  44. package/dist/services/DependencyPreparationService.js +57 -19
  45. package/dist/services/GuidanceVerifierRunner.js +4 -4
  46. package/dist/services/ProjectLibrary.d.ts +4 -1
  47. package/dist/services/ProjectLibrary.js +14 -9
  48. package/dist/services/ProjectPackageManager.d.ts +5 -0
  49. package/dist/services/ProjectPackageManager.js +33 -11
  50. package/dist/services/ProjectRuntimeService.d.ts +8 -0
  51. package/dist/services/ProjectRuntimeService.js +15 -2
  52. package/dist/services/TelemetryService.d.ts +13 -2
  53. package/dist/services/TelemetryService.js +29 -0
  54. package/dist/services/VariantHistoryService.d.ts +8 -0
  55. package/dist/services/VariantHistoryService.js +40 -0
  56. package/dist/services/WorktreeManager.d.ts +1 -0
  57. package/dist/services/WorktreeManager.js +17 -0
  58. package/dist/services/createAgentVariantsOrchestrator.js +9 -2
  59. package/dist/services/directionRefs.d.ts +21 -0
  60. package/dist/services/directionRefs.js +148 -0
  61. package/dist/services/profiles/DesignProfiles.js +16 -8
  62. package/dist/services/projectDirections.d.ts +22 -0
  63. package/dist/services/projectDirections.js +38 -0
  64. package/dist/types/direction-ref.d.ts +36 -0
  65. package/dist/types/direction-ref.js +3 -0
  66. package/dist/types/guidance-verifier.d.ts +7 -5
  67. package/dist/types/guidance-verifier.js +14 -1
  68. package/dist/types/variant-history.d.ts +3 -1
  69. package/dist/utils/devServerError.d.ts +5 -0
  70. package/dist/utils/devServerError.js +4 -0
  71. package/dist/utils/failureReason.d.ts +16 -0
  72. package/dist/utils/failureReason.js +106 -0
  73. package/dist/utils/hostedLogPrivacy.d.ts +1 -0
  74. package/dist/utils/hostedLogPrivacy.js +10 -4
  75. package/dist/utils/skills/claude-skill.d.ts +1 -1
  76. package/dist/utils/skills/claude-skill.js +1 -1
  77. package/dist/utils/skills/cli-guidance.d.ts +1 -1
  78. package/dist/utils/skills/cli-guidance.js +7 -6
  79. package/dist/utils/skills/cursor-rules.d.ts +1 -1
  80. package/dist/utils/skills/cursor-rules.js +1 -1
  81. package/dist/utils/subprocessEnvironment.d.ts +1 -1
  82. package/dist/utils/subprocessEnvironment.js +0 -1
  83. package/package.json +4 -4
  84. package/src/ui/dist/assets/LibraryEntry-BZ5EdFgA.js +37 -0
  85. package/src/ui/dist/assets/main-MepMmTwb.css +1 -0
  86. package/src/ui/dist/assets/main-RriU35pI.js +497 -0
  87. package/src/ui/dist/index.html +2 -2
  88. package/dist/services/StaticPreviewServer.d.ts +0 -8
  89. package/dist/services/StaticPreviewServer.js +0 -207
  90. package/src/ui/dist/assets/LibraryEntry-92R_T-Xa.js +0 -37
  91. package/src/ui/dist/assets/main-D0UmAaUe.css +0 -1
  92. package/src/ui/dist/assets/main-DgEfJvYu.js +0 -497
  93. package/src/ui/dist/fonts/Goldman-Bold.woff2 +0 -0
  94. package/src/ui/dist/fonts/Goldman-Regular.woff2 +0 -0
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveDirectionAddress = exports.parseDirectionAddress = exports.withDirectionRefs = exports.nextDirectionRef = exports.slugifyDirectionLabel = exports.isDirectionActive = void 0;
4
+ const SLUG_MAX_LENGTH = 40;
5
+ const EMPTY_LABEL_SLUG = 'direction';
6
+ const LAST_KEYWORD = 'last';
7
+ const FIRST_COLLISION_SUFFIX = 2;
8
+ const MIN_VARIANT_ID_PREFIX_LENGTH = 4;
9
+ const MAX_UNKNOWN_CANDIDATES = 10;
10
+ const TOKEN_PATTERN = /^[A-Za-z0-9_-]+$/;
11
+ const INACTIVE_STATUSES = new Set([
12
+ 'removed',
13
+ 'cancelled',
14
+ ]);
15
+ const isDirectionActive = (status) => !INACTIVE_STATUSES.has(status);
16
+ exports.isDirectionActive = isDirectionActive;
17
+ const slugifyDirectionLabel = (label) => {
18
+ const slug = label
19
+ .normalize('NFKD')
20
+ .replace(/\p{M}/gu, '')
21
+ .toLowerCase()
22
+ .replace(/[^a-z0-9]+/g, '-')
23
+ .replace(/^-+|-+$/g, '');
24
+ if (!slug)
25
+ return EMPTY_LABEL_SLUG;
26
+ if (slug.length <= SLUG_MAX_LENGTH)
27
+ return slug;
28
+ const boundary = slug.lastIndexOf('-', SLUG_MAX_LENGTH);
29
+ return slug.slice(0, boundary > 0 ? boundary : SLUG_MAX_LENGTH);
30
+ };
31
+ exports.slugifyDirectionLabel = slugifyDirectionLabel;
32
+ const nextDirectionRef = (args) => {
33
+ const slug = (0, exports.slugifyDirectionLabel)(args.label);
34
+ const isTaken = (candidate) => candidate === LAST_KEYWORD || args.taken.has(candidate);
35
+ let candidate = slug;
36
+ for (let suffix = FIRST_COLLISION_SUFFIX; isTaken(candidate); suffix++)
37
+ candidate = `${slug}-${suffix}`;
38
+ return candidate;
39
+ };
40
+ exports.nextDirectionRef = nextDirectionRef;
41
+ const directionKey = (manifest) => `${manifest.sessionId}:${manifest.variantId}`;
42
+ const byCreation = (a, b) => a.manifest.createdAt.localeCompare(b.manifest.createdAt) ||
43
+ a.manifest.sessionId.localeCompare(b.manifest.sessionId) ||
44
+ a.manifest.variantId.localeCompare(b.manifest.variantId);
45
+ const withDirectionRefs = (entries) => {
46
+ const taken = new Set(entries.flatMap(({ manifest }) => manifest.directionRef ? [manifest.directionRef] : []));
47
+ const legacyRefs = new Map();
48
+ const legacyRefOf = (manifest) => {
49
+ const key = directionKey(manifest);
50
+ const known = legacyRefs.get(key);
51
+ if (known)
52
+ return known;
53
+ const directionRef = (0, exports.nextDirectionRef)({ label: manifest.label, taken });
54
+ taken.add(directionRef);
55
+ legacyRefs.set(key, directionRef);
56
+ return directionRef;
57
+ };
58
+ for (const { manifest } of [...entries].sort(byCreation))
59
+ if (!manifest.directionRef)
60
+ legacyRefOf(manifest);
61
+ return entries.map((entry) => ({
62
+ ...entry,
63
+ directionRef: entry.manifest.directionRef ?? legacyRefOf(entry.manifest),
64
+ }));
65
+ };
66
+ exports.withDirectionRefs = withDirectionRefs;
67
+ const parseDirectionIds = (raw) => {
68
+ const projectSeparator = raw.indexOf('/');
69
+ const projectId = projectSeparator === -1 ? undefined : raw.slice(0, projectSeparator);
70
+ const direction = projectSeparator === -1 ? raw : raw.slice(projectSeparator + 1);
71
+ if (projectSeparator !== -1 && (!projectId || direction.includes('/')))
72
+ return null;
73
+ const variantSeparator = direction.indexOf(':');
74
+ if (variantSeparator <= 0 || variantSeparator === direction.length - 1)
75
+ return null;
76
+ if (direction.indexOf(':', variantSeparator + 1) !== -1)
77
+ return null;
78
+ const sessionId = direction.slice(0, variantSeparator).trim();
79
+ const variantId = direction.slice(variantSeparator + 1).trim();
80
+ if (!sessionId || !variantId)
81
+ return null;
82
+ return {
83
+ kind: 'ids',
84
+ ...(projectId ? { projectId } : {}),
85
+ sessionId,
86
+ variantId,
87
+ };
88
+ };
89
+ const parseDirectionAddress = (raw) => {
90
+ const value = raw.trim();
91
+ if (value.toLowerCase() === LAST_KEYWORD)
92
+ return { kind: 'last' };
93
+ if (value.includes(':') || value.includes('/'))
94
+ return parseDirectionIds(value);
95
+ return TOKEN_PATTERN.test(value) ? { kind: 'token', token: value } : null;
96
+ };
97
+ exports.parseDirectionAddress = parseDirectionAddress;
98
+ const newestFirst = (a, b) => b.createdAt.localeCompare(a.createdAt);
99
+ const notFound = (args) => {
100
+ const candidates = args.newest.slice(0, MAX_UNKNOWN_CANDIDATES);
101
+ const knownRefs = candidates.map((candidate) => candidate.directionRef);
102
+ const knownRefsSentence = knownRefs.length > 0 ? ` Known refs: ${knownRefs.join(', ')}.` : '';
103
+ return {
104
+ isResolved: false,
105
+ code: 'WORK_ITEM_NOT_FOUND',
106
+ message: `No direction matches "${args.input}".${knownRefsSentence}`,
107
+ candidates,
108
+ };
109
+ };
110
+ const resolveToken = (args) => {
111
+ const needle = args.token.toLowerCase();
112
+ const exact = args.newest.filter((candidate) => candidate.directionRef.toLowerCase() === needle);
113
+ const prefixed = needle.length >= MIN_VARIANT_ID_PREFIX_LENGTH
114
+ ? args.newest.filter((candidate) => candidate.variantId.toLowerCase().startsWith(needle))
115
+ : [];
116
+ const matches = exact.length > 0 ? exact : prefixed;
117
+ if (matches.length === 1)
118
+ return { isResolved: true, direction: matches[0] };
119
+ if (matches.length === 0)
120
+ return notFound({ input: args.token, newest: args.newest });
121
+ return {
122
+ isResolved: false,
123
+ code: 'DIRECTION_AMBIGUOUS',
124
+ message: `"${args.token}" matches ${matches.length} directions: ${matches
125
+ .map((candidate) => candidate.directionRef)
126
+ .join(', ')}.`,
127
+ candidates: matches,
128
+ };
129
+ };
130
+ const resolveDirectionAddress = (args) => {
131
+ const newest = [...args.candidates].sort(newestFirst);
132
+ switch (args.address.kind) {
133
+ case 'last': {
134
+ const direction = newest.find((candidate) => (0, exports.isDirectionActive)(candidate.status));
135
+ return direction
136
+ ? { isResolved: true, direction }
137
+ : notFound({ input: LAST_KEYWORD, newest });
138
+ }
139
+ case 'token':
140
+ return resolveToken({ token: args.address.token, newest });
141
+ default: {
142
+ const unhandled = args.address;
143
+ return unhandled;
144
+ }
145
+ }
146
+ };
147
+ exports.resolveDirectionAddress = resolveDirectionAddress;
148
+ //# sourceMappingURL=directionRefs.js.map
@@ -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 ===
@@ -0,0 +1,22 @@
1
+ import type { ProjectLibrary } from './ProjectLibrary';
2
+ import type { VariantHistoryEntry, VariantHistoryService } from './VariantHistoryService';
3
+ import type { DirectionRef, DirectionResolution, DirectionSearchAddress } from '../types/direction-ref';
4
+ export type ProjectDirectionSource = {
5
+ kind: 'library';
6
+ library: ProjectLibrary;
7
+ projectId: string;
8
+ } | {
9
+ kind: 'history';
10
+ history: VariantHistoryService;
11
+ projectPath: string;
12
+ };
13
+ export type ProjectDirection = VariantHistoryEntry & {
14
+ projectPath: string;
15
+ directionRef: DirectionRef;
16
+ };
17
+ export declare const listProjectDirections: (source: ProjectDirectionSource) => Promise<ProjectDirection[]>;
18
+ export declare const resolveProjectDirection: (args: {
19
+ source: ProjectDirectionSource;
20
+ address: DirectionSearchAddress;
21
+ }) => Promise<DirectionResolution>;
22
+ //# sourceMappingURL=projectDirections.d.ts.map
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveProjectDirection = exports.listProjectDirections = void 0;
4
+ const directionRefs_1 = require("./directionRefs");
5
+ const historyRoots_1 = require("./historyRoots");
6
+ const listSourceEntries = async (source) => {
7
+ switch (source.kind) {
8
+ case 'library':
9
+ return source.library.listVariants(source.projectId, {
10
+ isRemovedIncluded: true,
11
+ });
12
+ case 'history':
13
+ return (await Promise.all([
14
+ source.projectPath,
15
+ ...(0, historyRoots_1.nestedFreshSessionWorkdirs)(source.projectPath),
16
+ ].map(async (projectPath) => (await source.history.listVariants({ projectPath })).map((entry) => ({ ...entry, projectPath }))))).flat();
17
+ default: {
18
+ const unhandled = source;
19
+ return unhandled;
20
+ }
21
+ }
22
+ };
23
+ const listProjectDirections = async (source) => (0, directionRefs_1.withDirectionRefs)(await listSourceEntries(source));
24
+ exports.listProjectDirections = listProjectDirections;
25
+ const directionCandidateOf = (direction) => ({
26
+ directionRef: direction.directionRef,
27
+ sessionId: direction.manifest.sessionId,
28
+ variantId: direction.manifest.variantId,
29
+ label: direction.manifest.label,
30
+ status: direction.manifest.status,
31
+ createdAt: direction.manifest.createdAt,
32
+ });
33
+ const resolveProjectDirection = async (args) => (0, directionRefs_1.resolveDirectionAddress)({
34
+ address: args.address,
35
+ candidates: (await (0, exports.listProjectDirections)(args.source)).map(directionCandidateOf),
36
+ });
37
+ exports.resolveProjectDirection = resolveProjectDirection;
38
+ //# sourceMappingURL=projectDirections.js.map
@@ -0,0 +1,36 @@
1
+ import type { VariantHistoryStatus } from './variant-history';
2
+ export type DirectionRef = string & {
3
+ readonly __brand: 'DirectionRef';
4
+ };
5
+ export type DirectionAddress = {
6
+ kind: 'ids';
7
+ projectId?: string;
8
+ sessionId: string;
9
+ variantId: string;
10
+ } | {
11
+ kind: 'token';
12
+ token: string;
13
+ } | {
14
+ kind: 'last';
15
+ };
16
+ export type DirectionSearchAddress = Exclude<DirectionAddress, {
17
+ kind: 'ids';
18
+ }>;
19
+ export interface DirectionCandidate {
20
+ directionRef: DirectionRef;
21
+ sessionId: string;
22
+ variantId: string;
23
+ label: string;
24
+ status: VariantHistoryStatus;
25
+ createdAt: string;
26
+ }
27
+ export type DirectionResolution = {
28
+ isResolved: true;
29
+ direction: DirectionCandidate;
30
+ } | {
31
+ isResolved: false;
32
+ code: 'WORK_ITEM_NOT_FOUND' | 'DIRECTION_AMBIGUOUS';
33
+ message: string;
34
+ candidates: DirectionCandidate[];
35
+ };
36
+ //# sourceMappingURL=direction-ref.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=direction-ref.js.map
@@ -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 { DirectionRef } from './direction-ref';
1
2
  import type { VariantReference } from './variant-reference';
2
3
  export type { VariantReference } from './variant-reference';
3
4
  export type VariantHistoryStatus = 'completed' | 'committed' | 'rejected' | 'cancelled' | 'removed';
@@ -91,6 +92,7 @@ export interface VariantHistoryManifest {
91
92
  variantId: string;
92
93
  sessionId: string;
93
94
  requestId?: string;
95
+ directionRef?: DirectionRef;
94
96
  label: string;
95
97
  brief: string;
96
98
  references?: VariantReference[];
@@ -120,7 +122,7 @@ export interface VariantHistoryManifest {
120
122
  deployments?: VariantDeployment[];
121
123
  runtime?: import('../agent-variants/contracts').WorkerRuntimeInfo;
122
124
  }
123
- export type VariantHistoryRow = Pick<VariantHistoryManifest, 'sessionId' | 'variantId' | 'requestId' | 'label' | 'brief' | 'references' | 'previewRoutes' | 'runLabel' | 'projectKind' | 'status' | 'createdAt' | 'statusChangedAt' | 'changedFilesCount' | 'preview' | 'artifact' | 'parentVariant' | 'serve' | 'runtime'> & {
125
+ export type VariantHistoryRow = Pick<VariantHistoryManifest, 'sessionId' | 'variantId' | 'requestId' | 'directionRef' | 'label' | 'brief' | 'references' | 'previewRoutes' | 'runLabel' | 'projectKind' | 'status' | 'createdAt' | 'statusChangedAt' | 'changedFilesCount' | 'preview' | 'artifact' | 'parentVariant' | 'serve' | 'runtime'> & {
124
126
  kind: VariantHistoryKind;
125
127
  hasStaticPreview: boolean;
126
128
  hasTree: boolean;
@@ -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