replay-ci 1.0.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 (256) hide show
  1. package/README.md +5 -0
  2. package/artifacts/schema/run.schema.json +445 -0
  3. package/bin/replayci.mjs +8 -0
  4. package/package.json +70 -0
  5. package/packs/starter/contracts/tool_call.yaml +23 -0
  6. package/packs/starter/golden/negative/tool_call.not_invoked.json +41 -0
  7. package/packs/starter/golden/tool_call.success.json +54 -0
  8. package/packs/starter/nr-allowlist.json +5 -0
  9. package/packs/starter/pack.yaml +19 -0
  10. package/src/alerting/DEPRECATED.md +7 -0
  11. package/src/alerting/config.ts +119 -0
  12. package/src/alerting/decisionEngine.ts +339 -0
  13. package/src/alerting/heartbeatDetector.ts +384 -0
  14. package/src/alerting/sender.ts +142 -0
  15. package/src/alerting/templates/renderEmailTemplate.ts +114 -0
  16. package/src/alerting/templates/renderSlackTemplate.ts +127 -0
  17. package/src/alerting/templates/types.ts +147 -0
  18. package/src/alerting/windowBucket.ts +13 -0
  19. package/src/app/api/auth/forgot-password/route.ts +103 -0
  20. package/src/app/api/auth/login/route.ts +98 -0
  21. package/src/app/api/auth/logout/route.ts +49 -0
  22. package/src/app/api/auth/refresh/route.ts +72 -0
  23. package/src/app/api/auth/reset-password/route.ts +150 -0
  24. package/src/app/api/auth/signup/route.ts +244 -0
  25. package/src/app/api/auth/verify-email/route.ts +114 -0
  26. package/src/app/api/dashboard/alerts/[fingerprint]/quarantine/route.ts +110 -0
  27. package/src/app/api/dashboard/alerts/[fingerprint]/route.ts +81 -0
  28. package/src/app/api/dashboard/alerts/quarantines/route.ts +30 -0
  29. package/src/app/api/dashboard/alerts/route.ts +46 -0
  30. package/src/app/api/dashboard/alerts/sample/route.ts +22 -0
  31. package/src/app/api/dashboard/api-keys/[id]/route.ts +86 -0
  32. package/src/app/api/dashboard/api-keys/route.ts +140 -0
  33. package/src/app/api/dashboard/baselines/route.ts +16 -0
  34. package/src/app/api/dashboard/heartbeats/route.ts +65 -0
  35. package/src/app/api/dashboard/integrations/route.ts +16 -0
  36. package/src/app/api/dashboard/models/route.ts +29 -0
  37. package/src/app/api/dashboard/resend-verification/route.ts +118 -0
  38. package/src/app/api/dashboard/runs/[run_id]/artifacts/[hash]/route.ts +148 -0
  39. package/src/app/api/dashboard/runs/[run_id]/route.ts +27 -0
  40. package/src/app/api/dashboard/runs/route.ts +21 -0
  41. package/src/app/api/dashboard/shadow/[runId]/route.ts +30 -0
  42. package/src/app/api/dashboard/shadow/route.ts +29 -0
  43. package/src/app/api/dashboard/tools/[tool]/route.ts +22 -0
  44. package/src/app/api/health/route.ts +59 -0
  45. package/src/app/api/v1/runs/route.ts +223 -0
  46. package/src/app/dashboard/actions/labelAlertInstance.ts +30 -0
  47. package/src/app/dashboard/actions/setQuarantine.ts +40 -0
  48. package/src/app/dashboard/alerts/[fingerprint]/label/route.ts +58 -0
  49. package/src/app/dashboard/alerts/[fingerprint]/page.tsx +330 -0
  50. package/src/app/dashboard/alerts/[fingerprint]/quarantine/route.ts +59 -0
  51. package/src/app/dashboard/alerts/page.tsx +295 -0
  52. package/src/app/dashboard/baselines/page.tsx +160 -0
  53. package/src/app/dashboard/components/ErrorState.tsx +17 -0
  54. package/src/app/dashboard/components/ResendVerificationButton.tsx +47 -0
  55. package/src/app/dashboard/components/Sidebar.tsx +98 -0
  56. package/src/app/dashboard/components/VerificationBanner.tsx +31 -0
  57. package/src/app/dashboard/components/badges.tsx +72 -0
  58. package/src/app/dashboard/integrations/page.tsx +173 -0
  59. package/src/app/dashboard/layout.tsx +22 -0
  60. package/src/app/dashboard/models/page.tsx +354 -0
  61. package/src/app/dashboard/page.tsx +270 -0
  62. package/src/app/dashboard/runs/[run_id]/page.tsx +364 -0
  63. package/src/app/dashboard/runs/page.tsx +178 -0
  64. package/src/app/dashboard/settings/SettingsContent.tsx +269 -0
  65. package/src/app/dashboard/settings/page.tsx +78 -0
  66. package/src/app/dashboard/shadow/[runId]/page.tsx +121 -0
  67. package/src/app/dashboard/shadow/components/ComparisonTable.tsx +114 -0
  68. package/src/app/dashboard/shadow/components/ConfidenceBadge.tsx +27 -0
  69. package/src/app/dashboard/shadow/components/IncomparableBreakdown.tsx +89 -0
  70. package/src/app/dashboard/shadow/components/SummaryCard.tsx +118 -0
  71. package/src/app/dashboard/shadow/page.tsx +162 -0
  72. package/src/app/dashboard/tools/[tool]/page.tsx +86 -0
  73. package/src/app/forgot-password/page.tsx +118 -0
  74. package/src/app/globals.css +95 -0
  75. package/src/app/layout.tsx +11 -0
  76. package/src/app/login/page.tsx +123 -0
  77. package/src/app/onboarding/page.tsx +135 -0
  78. package/src/app/page.tsx +5 -0
  79. package/src/app/reset-password/page.tsx +164 -0
  80. package/src/app/signup/page.tsx +149 -0
  81. package/src/app/verify-email/page.tsx +103 -0
  82. package/src/artifacts/canonicalJson.ts +57 -0
  83. package/src/artifacts/paths.ts +24 -0
  84. package/src/artifacts/validateRun.ts +48 -0
  85. package/src/artifacts/writeRun.ts +21 -0
  86. package/src/artifacts/writeSecurityReports.ts +32 -0
  87. package/src/audit/emitAuditEvent.ts +122 -0
  88. package/src/auth/apiKey.ts +41 -0
  89. package/src/auth/cleanupRefreshTokens.ts +94 -0
  90. package/src/auth/email.ts +123 -0
  91. package/src/auth/password.ts +60 -0
  92. package/src/auth/requireRole.ts +149 -0
  93. package/src/auth/sessionToken.ts +169 -0
  94. package/src/baselines/index.ts +24 -0
  95. package/src/baselines/key.ts +86 -0
  96. package/src/baselines/service.ts +660 -0
  97. package/src/ci/evidence/baseline-seed-log.ts +124 -0
  98. package/src/ci/evidence/budget-report.ts +237 -0
  99. package/src/ci/evidence/confidence-summary.ts +74 -0
  100. package/src/ci/evidence/corpus-admission.ts +208 -0
  101. package/src/ci/evidence/corpus-coverage.ts +173 -0
  102. package/src/ci/evidence/model-change-diff.ts +98 -0
  103. package/src/ci/gate.ts +1158 -0
  104. package/src/ci/integrity.ts +240 -0
  105. package/src/ci/quarantine.ts +262 -0
  106. package/src/ci/quarantine.types.ts +109 -0
  107. package/src/ci/recorded-corpus.ts +290 -0
  108. package/src/ci/security-scan.ts +178 -0
  109. package/src/ci/time-budget.ts +21 -0
  110. package/src/ci/types.ts +706 -0
  111. package/src/classifier/enforcement.ts +86 -0
  112. package/src/classifier/fingerprint.ts +42 -0
  113. package/src/classifier/index.ts +92 -0
  114. package/src/classifier/proposalBundle.ts +137 -0
  115. package/src/classifier/reclassificationView.ts +86 -0
  116. package/src/classifier/taxonomyVersion.ts +16 -0
  117. package/src/cli/config.ts +76 -0
  118. package/src/cli/exportBundle.ts +240 -0
  119. package/src/cli/exportProposal.ts +71 -0
  120. package/src/cli/formatters.ts +223 -0
  121. package/src/cli/help.ts +64 -0
  122. package/src/cli/init.ts +93 -0
  123. package/src/cli/main.ts +584 -0
  124. package/src/cli/push.ts +83 -0
  125. package/src/cli/replayBundle.ts +154 -0
  126. package/src/cli/replayBundleEntrypoint.ts +19 -0
  127. package/src/cli/unknownRateGate.ts +78 -0
  128. package/src/dashboard/server/auth.ts +68 -0
  129. package/src/dashboard/server/baselineQueries.ts +368 -0
  130. package/src/dashboard/server/baselineQueries.types.ts +139 -0
  131. package/src/dashboard/server/decisionGuidance.ts +59 -0
  132. package/src/dashboard/server/grouping.ts +19 -0
  133. package/src/dashboard/server/queries.ts +1102 -0
  134. package/src/dashboard/server/queries.types.ts +260 -0
  135. package/src/dashboard/server/shadowQueries.ts +170 -0
  136. package/src/dashboard/server/tenant.ts +28 -0
  137. package/src/db/adminClient.ts +23 -0
  138. package/src/db/prisma.ts +70 -0
  139. package/src/db/tenantClient.ts +37 -0
  140. package/src/db/tenantEnforceMiddleware.ts +133 -0
  141. package/src/deletion/index.ts +5 -0
  142. package/src/deletion/service.ts +125 -0
  143. package/src/drift/alertThresholds.ts +134 -0
  144. package/src/drift/baselineIntegration.ts +280 -0
  145. package/src/drift/behaviorDrift.ts +249 -0
  146. package/src/drift/diffHints.ts +98 -0
  147. package/src/drift/modelVersionDrift.ts +265 -0
  148. package/src/drift/policyDrift.ts +65 -0
  149. package/src/drift/runtimeCli.ts +692 -0
  150. package/src/drift/runtimeDrift.ts +139 -0
  151. package/src/drift/runtimeReportModel.ts +334 -0
  152. package/src/drift/severity.ts +154 -0
  153. package/src/drift/stableStringify.ts +14 -0
  154. package/src/drift/summaryMd.ts +37 -0
  155. package/src/drift/types.ts +37 -0
  156. package/src/generated/prisma/browser.ts +179 -0
  157. package/src/generated/prisma/client.ts +201 -0
  158. package/src/generated/prisma/commonInputTypes.ts +1071 -0
  159. package/src/generated/prisma/enums.ts +140 -0
  160. package/src/generated/prisma/internal/class.ts +500 -0
  161. package/src/generated/prisma/internal/prismaNamespace.ts +3859 -0
  162. package/src/generated/prisma/internal/prismaNamespaceBrowser.ts +621 -0
  163. package/src/generated/prisma/models/AlertGroup.ts +1318 -0
  164. package/src/generated/prisma/models/AlertIncidentState.ts +1200 -0
  165. package/src/generated/prisma/models/AlertInstance.ts +1920 -0
  166. package/src/generated/prisma/models/AlertQuarantineState.ts +1294 -0
  167. package/src/generated/prisma/models/AlertSuppressionState.ts +1210 -0
  168. package/src/generated/prisma/models/ApiKey.ts +1480 -0
  169. package/src/generated/prisma/models/Artifact.ts +1402 -0
  170. package/src/generated/prisma/models/Attempt.ts +1365 -0
  171. package/src/generated/prisma/models/AuditEvent.ts +1594 -0
  172. package/src/generated/prisma/models/Baseline.ts +1779 -0
  173. package/src/generated/prisma/models/ClassifierCursor.ts +1144 -0
  174. package/src/generated/prisma/models/ContractVersion.ts +1122 -0
  175. package/src/generated/prisma/models/DriftReport.ts +1283 -0
  176. package/src/generated/prisma/models/EmailVerificationToken.ts +1401 -0
  177. package/src/generated/prisma/models/GateDecision.ts +1385 -0
  178. package/src/generated/prisma/models/HeartbeatInstance.ts +1395 -0
  179. package/src/generated/prisma/models/Pack.ts +1151 -0
  180. package/src/generated/prisma/models/PasswordResetToken.ts +1401 -0
  181. package/src/generated/prisma/models/RefreshToken.ts +1401 -0
  182. package/src/generated/prisma/models/RetentionPolicy.ts +1380 -0
  183. package/src/generated/prisma/models/Run.ts +3266 -0
  184. package/src/generated/prisma/models/RunArtifactRef.ts +1338 -0
  185. package/src/generated/prisma/models/SchedulerEvent.ts +1226 -0
  186. package/src/generated/prisma/models/SchedulerLease.ts +1206 -0
  187. package/src/generated/prisma/models/ShadowComparison.ts +1786 -0
  188. package/src/generated/prisma/models/ShadowRun.ts +1988 -0
  189. package/src/generated/prisma/models/Step.ts +1473 -0
  190. package/src/generated/prisma/models/Tenant.ts +2484 -0
  191. package/src/generated/prisma/models/TenantPolicy.ts +1442 -0
  192. package/src/generated/prisma/models/User.ts +1972 -0
  193. package/src/generated/prisma/models/UserWorkspace.ts +1338 -0
  194. package/src/generated/prisma/models/Workspace.ts +1444 -0
  195. package/src/generated/prisma/models.ts +43 -0
  196. package/src/lib/inputBounds.ts +63 -0
  197. package/src/lib/logger.ts +70 -0
  198. package/src/lib/rateLimiter.ts +177 -0
  199. package/src/middleware.ts +239 -0
  200. package/src/persist/faults.ts +25 -0
  201. package/src/persist/persistRun.ts +429 -0
  202. package/src/policy/tenantPolicy.ts +99 -0
  203. package/src/providers/anthropic.ts +379 -0
  204. package/src/providers/factory.ts +61 -0
  205. package/src/providers/openai.ts +329 -0
  206. package/src/providers/recorded.ts +555 -0
  207. package/src/providers/types.ts +220 -0
  208. package/src/replay/bundle.ts +411 -0
  209. package/src/replay/container.ts +180 -0
  210. package/src/replay/replayer.ts +169 -0
  211. package/src/replay/types.ts +135 -0
  212. package/src/retention/auditRetention.ts +283 -0
  213. package/src/retention/deleteTenantData.ts +201 -0
  214. package/src/retention/retentionCleanup.ts +289 -0
  215. package/src/retention/retentionPolicy.ts +17 -0
  216. package/src/runner/contracts.ts +164 -0
  217. package/src/runner/determinism.ts +79 -0
  218. package/src/runner/discover.ts +72 -0
  219. package/src/runner/execute.ts +1097 -0
  220. package/src/runner/failureClassifier.ts +288 -0
  221. package/src/runner/fingerprint.ts +52 -0
  222. package/src/runner/index.ts +9 -0
  223. package/src/runner/jsonPath.ts +32 -0
  224. package/src/runner/nonRepro.ts +64 -0
  225. package/src/runner/nrAllowlist.ts +161 -0
  226. package/src/runner/persist.ts +211 -0
  227. package/src/runner/retryMetrics.ts +46 -0
  228. package/src/runner/runId.ts +5 -0
  229. package/src/runner/runModel.ts +248 -0
  230. package/src/runner/runPolicy.ts +85 -0
  231. package/src/runner/sideEffects.ts +43 -0
  232. package/src/runner/slackClient.ts +177 -0
  233. package/src/runner/traceability.ts +112 -0
  234. package/src/scheduler/caps.ts +30 -0
  235. package/src/scheduler/lease.ts +106 -0
  236. package/src/scheduler/stall.ts +69 -0
  237. package/src/securitygate/index.ts +2 -0
  238. package/src/securitygate/integrityGate.ts +359 -0
  239. package/src/securitygate/securityGate.ts +140 -0
  240. package/src/shadow/canonicalize.ts +198 -0
  241. package/src/shadow/capture.ts +412 -0
  242. package/src/shadow/comparability.ts +195 -0
  243. package/src/shadow/compare.ts +352 -0
  244. package/src/shadow/config.ts +162 -0
  245. package/src/shadow/executor.ts +565 -0
  246. package/src/shadow/persistence.ts +338 -0
  247. package/src/shadow/pipeline.ts +235 -0
  248. package/src/shadow/types.ts +306 -0
  249. package/src/storage/artifactStore.ts +558 -0
  250. package/src/storage/artifactsRoot.ts +18 -0
  251. package/src/storage/encryption.ts +226 -0
  252. package/src/storage/keyManager.ts +46 -0
  253. package/src/storage/orphanReconciler.ts +122 -0
  254. package/src/storage/ttl.ts +48 -0
  255. package/tsconfig.container.json +23 -0
  256. package/tsconfig.json +15 -0
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # ReplayCI
2
+
3
+ Milestone work lives in:
4
+ - packs/slack-v0.1 (contracts + golden inputs)
5
+ - evidence/Q1-M1 (proof artifacts)
@@ -0,0 +1,445 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "PacketDesk Run Artifact v0.2",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": [
7
+ "schema_version",
8
+ "traceability",
9
+ "run_policy",
10
+ "state",
11
+ "steps"
12
+ ],
13
+ "properties": {
14
+ "schema_version": {
15
+ "type": "string",
16
+ "enum": [
17
+ "0.2"
18
+ ]
19
+ },
20
+ "traceability": {
21
+ "type": "object",
22
+ "additionalProperties": false,
23
+ "required": [
24
+ "contract_hash",
25
+ "policy_hash",
26
+ "pack_version",
27
+ "runner_version",
28
+ "env_hash",
29
+ "run_mode",
30
+ "schema_version",
31
+ "tenant_id"
32
+ ],
33
+ "properties": {
34
+ "contract_hash": {
35
+ "type": "string"
36
+ },
37
+ "policy_hash": {
38
+ "type": "string"
39
+ },
40
+ "pack_version": {
41
+ "type": "string"
42
+ },
43
+ "runner_version": {
44
+ "type": "string"
45
+ },
46
+ "env_hash": {
47
+ "type": "string"
48
+ },
49
+ "run_mode": {
50
+ "type": "string",
51
+ "enum": [
52
+ "manual",
53
+ "scheduled",
54
+ "ci"
55
+ ]
56
+ },
57
+ "schema_version": {
58
+ "type": "string",
59
+ "enum": [
60
+ "0.2"
61
+ ]
62
+ },
63
+ "tenant_id": {
64
+ "type": "string"
65
+ },
66
+ "provider": {
67
+ "type": "string",
68
+ "description": "Provider used for this run (openai|anthropic|recorded). Optional at envelope level; set per-step by adapters."
69
+ },
70
+ "model_id": {
71
+ "type": "string",
72
+ "description": "Model identifier used for this run. Optional at envelope level; set per-step by adapters."
73
+ },
74
+ "model_version": {
75
+ "type": "string",
76
+ "description": "Best-effort model version string returned by provider. Optional."
77
+ },
78
+ "normalization_profile": {
79
+ "type": "string",
80
+ "enum": ["strict_hash", "evidence_diff"],
81
+ "description": "Default normalization profile for this run."
82
+ },
83
+ "corpus_manifest_hash": {
84
+ "type": "string",
85
+ "pattern": "^[a-f0-9]{64}$",
86
+ "description": "Phase 2 (GR-05): SHA-256 hash of the deterministic corpus. Merge gate runs against pinned manifest only."
87
+ }
88
+ }
89
+ },
90
+ "run_policy": {
91
+ "type": "object",
92
+ "additionalProperties": false,
93
+ "required": [
94
+ "run_mode",
95
+ "timeout_ms",
96
+ "retry_cap",
97
+ "max_contracts"
98
+ ],
99
+ "properties": {
100
+ "run_mode": {
101
+ "type": "string",
102
+ "enum": [
103
+ "manual",
104
+ "scheduled",
105
+ "ci"
106
+ ]
107
+ },
108
+ "timeout_ms": {
109
+ "type": "integer",
110
+ "minimum": 1000,
111
+ "maximum": 120000
112
+ },
113
+ "retry_cap": {
114
+ "type": "integer",
115
+ "minimum": 0,
116
+ "maximum": 5
117
+ },
118
+ "max_contracts": {
119
+ "type": "integer",
120
+ "minimum": 0,
121
+ "maximum": 50
122
+ },
123
+ "only_contracts": {
124
+ "type": "array",
125
+ "items": {
126
+ "type": "string"
127
+ }
128
+ },
129
+ "side_effect_mode": {
130
+ "type": "string",
131
+ "enum": [
132
+ "read_only",
133
+ "allow_all"
134
+ ]
135
+ }
136
+ }
137
+ },
138
+ "state": {
139
+ "type": "string",
140
+ "enum": [
141
+ "Pass",
142
+ "Fail",
143
+ "NonReproducible",
144
+ "RunAborted"
145
+ ]
146
+ },
147
+ "abort_reason": {
148
+ "oneOf": [
149
+ {
150
+ "type": "null"
151
+ },
152
+ {
153
+ "type": "object",
154
+ "additionalProperties": false,
155
+ "required": [
156
+ "code"
157
+ ],
158
+ "properties": {
159
+ "code": {
160
+ "type": "string",
161
+ "enum": [
162
+ "timeout",
163
+ "budget_exceeded",
164
+ "manual_cancel"
165
+ ]
166
+ },
167
+ "detail": {
168
+ "type": "string"
169
+ }
170
+ }
171
+ }
172
+ ]
173
+ },
174
+ "steps": {
175
+ "type": "array",
176
+ "items": {
177
+ "type": "object",
178
+ "additionalProperties": false,
179
+ "$comment": "normalization_profile strict_hash evidence_diff raw_redacted normalized derived_metrics",
180
+ "required": [
181
+ "index",
182
+ "contract_path",
183
+ "status",
184
+ "nonrepro_reason",
185
+ "raw_redacted",
186
+ "normalized",
187
+ "derived_metrics",
188
+ "fingerprint"
189
+ ],
190
+ "properties": {
191
+ "index": {
192
+ "type": "integer",
193
+ "minimum": 0
194
+ },
195
+ "contract_path": {
196
+ "type": "string"
197
+ },
198
+ "status": {
199
+ "type": "string",
200
+ "enum": [
201
+ "Pass",
202
+ "Fail",
203
+ "NonReproducible",
204
+ "RunAborted"
205
+ ]
206
+ },
207
+ "raw_redacted": {},
208
+ "normalized": {},
209
+ "derived_metrics": {
210
+ "type": "object",
211
+ "additionalProperties": true,
212
+ "properties": {
213
+ "retry": {
214
+ "type": "object",
215
+ "additionalProperties": false,
216
+ "required": [
217
+ "retry_amplification",
218
+ "attempts",
219
+ "stop_reason"
220
+ ],
221
+ "properties": {
222
+ "retry_amplification": {
223
+ "type": "integer",
224
+ "minimum": 0
225
+ },
226
+ "stop_reason": {
227
+ "type": "string"
228
+ },
229
+ "retry_after_header": {
230
+ "type": [
231
+ "string",
232
+ "null"
233
+ ]
234
+ },
235
+ "retry_after_seconds": {
236
+ "type": [
237
+ "integer",
238
+ "null"
239
+ ],
240
+ "minimum": 0
241
+ },
242
+ "attempts": {
243
+ "type": "array",
244
+ "items": {
245
+ "type": "object",
246
+ "additionalProperties": false,
247
+ "required": [
248
+ "attempt",
249
+ "decision",
250
+ "reason"
251
+ ],
252
+ "properties": {
253
+ "attempt": {
254
+ "type": "integer",
255
+ "minimum": 1
256
+ },
257
+ "http_status": {
258
+ "type": [
259
+ "integer",
260
+ "null"
261
+ ]
262
+ },
263
+ "decision": {
264
+ "type": "string",
265
+ "enum": [
266
+ "retry",
267
+ "wait",
268
+ "stop"
269
+ ]
270
+ },
271
+ "reason": {
272
+ "type": "string"
273
+ },
274
+ "retry_after_header": {
275
+ "type": [
276
+ "string",
277
+ "null"
278
+ ]
279
+ },
280
+ "retry_after_seconds": {
281
+ "type": [
282
+ "integer",
283
+ "null"
284
+ ],
285
+ "minimum": 0
286
+ },
287
+ "wait_ms": {
288
+ "type": [
289
+ "integer",
290
+ "null"
291
+ ],
292
+ "minimum": 0
293
+ }
294
+ }
295
+ }
296
+ }
297
+ }
298
+ }
299
+ }
300
+ },
301
+ "normalization_profile": {
302
+ "type": "string",
303
+ "enum": [
304
+ "strict_hash",
305
+ "evidence_diff"
306
+ ],
307
+ "description": "normalization_profile selects the normalization semantics profile: strict_hash or evidence_diff."
308
+ },
309
+ "strict_hash": {
310
+ "type": "string",
311
+ "pattern": "^[A-Fa-f0-9]{64}$",
312
+ "description": "strict_hash is sha256(canonical_json(normalized)); legacy fingerprint remains supported as an alias/legacy field."
313
+ },
314
+ "fingerprint": {
315
+ "type": "string",
316
+ "pattern": "^[a-f0-9]{64}$"
317
+ },
318
+ "evidence_diff": {
319
+ "description": "Redacted evidence payload for human-readable drift analysis. Derived from raw_redacted."
320
+ },
321
+ "baseline_key": {
322
+ "type": "string",
323
+ "pattern": "^[a-f0-9]{64}$",
324
+ "description": "Phase 2 (GR-20): SHA-256 of (contract_path:normalization_profile). Incompatible baselines cannot mix."
325
+ },
326
+ "nr_allowlisted": {
327
+ "type": "boolean",
328
+ "description": "GR-07: Whether this NR step is explicitly allowlisted. Only set when status is NonReproducible."
329
+ },
330
+ "nonrepro_reason": {
331
+ "oneOf": [
332
+ {
333
+ "type": "null"
334
+ },
335
+ {
336
+ "type": "object",
337
+ "additionalProperties": false,
338
+ "required": [
339
+ "code"
340
+ ],
341
+ "properties": {
342
+ "code": {
343
+ "type": "string",
344
+ "enum": [
345
+ "model_nondeterminism",
346
+ "context_variance",
347
+ "transient_error",
348
+ "MISSING_PREREQUISITES",
349
+ "NON_DETERMINISTIC_INPUT",
350
+ "SCHEMA_DRIFT",
351
+ "UNKNOWN",
352
+ "UPSTREAM_RATE_LIMIT",
353
+ "UPSTREAM_TIMEOUT",
354
+ "UPSTREAM_TRANSIENT_ERROR"
355
+ ]
356
+ },
357
+ "detail": {
358
+ "type": "string"
359
+ }
360
+ }
361
+ }
362
+ ]
363
+ },
364
+ "failure_classifier": {
365
+ "type": "object",
366
+ "additionalProperties": false,
367
+ "required": [
368
+ "category",
369
+ "stable_signature",
370
+ "confidence",
371
+ "is_non_reproducible",
372
+ "fingerprint",
373
+ "schema_version"
374
+ ],
375
+ "properties": {
376
+ "category": {
377
+ "type": "string",
378
+ "enum": [
379
+ "auth",
380
+ "rate_limit",
381
+ "upstream",
382
+ "schema_payload",
383
+ "deprecation",
384
+ "unknown",
385
+ "non_reproducible"
386
+ ]
387
+ },
388
+ "stable_signature": {
389
+ "type": "string"
390
+ },
391
+ "confidence": {
392
+ "type": "number"
393
+ },
394
+ "is_non_reproducible": {
395
+ "type": "boolean"
396
+ },
397
+ "non_reproducible_reason": {
398
+ "type": "string",
399
+ "enum": [
400
+ "upstream_jitter",
401
+ "environment_mismatch",
402
+ "missing_prerequisites",
403
+ "timeout"
404
+ ]
405
+ },
406
+ "fingerprint": {
407
+ "type": "string"
408
+ },
409
+ "schema_version": {
410
+ "type": "string"
411
+ },
412
+ "taxonomy_version": {
413
+ "type": "string"
414
+ },
415
+ "global_key": {
416
+ "type": "string"
417
+ }
418
+ }
419
+ }
420
+ }
421
+ }
422
+ }
423
+ },
424
+ "allOf": [
425
+ {
426
+ "if": {
427
+ "properties": {
428
+ "state": {
429
+ "const": "RunAborted"
430
+ }
431
+ }
432
+ },
433
+ "then": {
434
+ "required": [
435
+ "abort_reason"
436
+ ],
437
+ "properties": {
438
+ "abort_reason": {
439
+ "type": "object"
440
+ }
441
+ }
442
+ }
443
+ }
444
+ ]
445
+ }
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ // Thin shim: registers tsx for TypeScript support, then runs the CLI.
3
+ // Enables `npx replayci` without `npm run replayci --`.
4
+ import { register } from "node:module";
5
+ import { pathToFileURL } from "node:url";
6
+
7
+ register("tsx/esm", pathToFileURL("./"));
8
+ await import("../src/cli/main.ts");
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "replay-ci",
3
+ "version": "1.0.0",
4
+ "description": "LLM function calling reliability platform. Validate, monitor, and gate tool-call behavior.",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "replayci": "./bin/replayci.mjs"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "src/",
12
+ "packs/starter/",
13
+ "tsconfig.json",
14
+ "tsconfig.container.json",
15
+ "artifacts/schema/"
16
+ ],
17
+ "directories": {
18
+ "doc": "docs"
19
+ },
20
+ "scripts": {
21
+ "test": "vitest run",
22
+ "lint": "tsc -p tsconfig.lint.json --noEmit",
23
+ "replayci": "tsx src/cli/main.ts",
24
+ "dashboard:dev": "next dev -p 3001 --webpack",
25
+ "dashboard:build": "next build --webpack",
26
+ "dashboard:start": "next start -p 3001"
27
+ },
28
+ "keywords": [
29
+ "llm",
30
+ "testing",
31
+ "tool-calling",
32
+ "function-calling",
33
+ "openai",
34
+ "anthropic",
35
+ "ci",
36
+ "contracts"
37
+ ],
38
+ "author": "ReplayCI",
39
+ "license": "ISC",
40
+ "type": "module",
41
+ "homepage": "https://replayci.com",
42
+ "devDependencies": {
43
+ "@types/node": "^25.0.3",
44
+ "@types/nodemailer": "^7.0.11",
45
+ "@types/pg": "^8.16.0",
46
+ "@types/pino": "^7.0.4",
47
+ "@types/react": "^19.2.7",
48
+ "@types/react-dom": "^19.2.3",
49
+ "pino-pretty": "^13.1.3",
50
+ "playwright": "^1.57.0",
51
+ "prisma": "^7.2.0",
52
+ "typescript": "^5.9.3",
53
+ "vitest": "^4.0.16"
54
+ },
55
+ "dependencies": {
56
+ "@prisma/adapter-pg": "^7.2.0",
57
+ "@prisma/client": "^7.2.0",
58
+ "@tailwindcss/postcss": "^4.2.1",
59
+ "ajv": "^8.17.1",
60
+ "next": "^16.1.1",
61
+ "nodemailer": "^8.0.1",
62
+ "pg": "^8.16.3",
63
+ "pino": "^10.3.1",
64
+ "react": "^19.2.3",
65
+ "react-dom": "^19.2.3",
66
+ "tailwindcss": "^4.2.1",
67
+ "tsx": "^4.21.0",
68
+ "yaml": "^2.8.2"
69
+ }
70
+ }
@@ -0,0 +1,23 @@
1
+ # Does my AI call the right tool?
2
+ # This contract validates that the model invokes the expected tool
3
+ # with valid arguments when given a tool-calling prompt.
4
+
5
+ tool: "get_weather"
6
+
7
+ assertions:
8
+ output_invariants:
9
+ - path: "$.tool_calls[0].name"
10
+ equals: "get_weather"
11
+ - path: "$.tool_calls[0].arguments"
12
+ exists: true
13
+
14
+ golden_cases:
15
+ - id: "tool_call_success"
16
+ input_ref: "tool_call.success.json"
17
+ expect_ok: true
18
+
19
+ - id: "tool_not_invoked"
20
+ input_ref: "negative/tool_call.not_invoked.json"
21
+ expect_ok: false
22
+ expected_error: "tool_not_invoked"
23
+ provider_modes: ["recorded"]
@@ -0,0 +1,41 @@
1
+ {
2
+ "boundary": {
3
+ "model": "gpt-4o-mini",
4
+ "tool_schema_hash": "starter_tool_neg001",
5
+ "message_hash": "starter_msg_neg001",
6
+ "system_hash": "starter_sys_neg001"
7
+ },
8
+ "request": {
9
+ "model": "gpt-4o-mini",
10
+ "messages": [
11
+ {
12
+ "role": "user",
13
+ "content": "What is the weather in Tokyo?"
14
+ }
15
+ ],
16
+ "tools": [
17
+ {
18
+ "type": "function",
19
+ "function": {
20
+ "name": "get_weather",
21
+ "description": "Get the current weather for a location",
22
+ "parameters": {
23
+ "type": "object",
24
+ "properties": {
25
+ "location": {
26
+ "type": "string"
27
+ }
28
+ },
29
+ "required": ["location"]
30
+ }
31
+ }
32
+ }
33
+ ]
34
+ },
35
+ "response": {
36
+ "success": false,
37
+ "tool_calls": [],
38
+ "content": "I don't have access to real-time weather data.",
39
+ "error_code": "tool_not_invoked"
40
+ }
41
+ }
@@ -0,0 +1,54 @@
1
+ {
2
+ "boundary": {
3
+ "model": "gpt-4o-mini",
4
+ "tool_schema_hash": "starter_tool_001",
5
+ "message_hash": "starter_msg_001",
6
+ "system_hash": "starter_sys_001"
7
+ },
8
+ "request": {
9
+ "model": "gpt-4o-mini",
10
+ "messages": [
11
+ {
12
+ "role": "system",
13
+ "content": "You are a helpful assistant with access to tools."
14
+ },
15
+ {
16
+ "role": "user",
17
+ "content": "What is the weather in San Francisco?"
18
+ }
19
+ ],
20
+ "tools": [
21
+ {
22
+ "type": "function",
23
+ "function": {
24
+ "name": "get_weather",
25
+ "description": "Get the current weather for a location",
26
+ "parameters": {
27
+ "type": "object",
28
+ "properties": {
29
+ "location": {
30
+ "type": "string",
31
+ "description": "City and state, e.g. San Francisco, CA"
32
+ }
33
+ },
34
+ "required": ["location"]
35
+ }
36
+ }
37
+ }
38
+ ]
39
+ },
40
+ "response": {
41
+ "success": true,
42
+ "tool_calls": [
43
+ {
44
+ "id": "call_starter_001",
45
+ "type": "function",
46
+ "function": {
47
+ "name": "get_weather",
48
+ "arguments": "{\"location\": \"San Francisco, CA\"}"
49
+ }
50
+ }
51
+ ],
52
+ "content": null
53
+ }
54
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "description": "Starter pack NR allowlist. Empty — no exceptions needed for starter contracts.",
3
+ "version": "1.0",
4
+ "entries": []
5
+ }
@@ -0,0 +1,19 @@
1
+ # ReplayCI Starter Pack
2
+ # Minimal contract pack for getting started with tool-call validation.
3
+ # Customize contracts and golden fixtures for your own tools.
4
+
5
+ pack_id: "starter"
6
+ name: "starter-tool-calling"
7
+ version: "0.1.0"
8
+ schema_version: "v0.1"
9
+
10
+ provider: "openai"
11
+ default_model: "gpt-4o-mini"
12
+
13
+ paths:
14
+ contracts_dir: "packs/starter/contracts"
15
+ golden_dir: "packs/starter/golden"
16
+ negative_golden_dir: "packs/starter/golden/negative"
17
+
18
+ contracts:
19
+ - tool_call.yaml
@@ -0,0 +1,7 @@
1
+ # DEPRECATED
2
+
3
+ This directory contains the legacy Slack alerting system from ReplayCI's pre-pivot plan (MCP/Slack reliability tool). It is no longer part of the active product.
4
+
5
+ **Do not use or extend this code.** It remains in the repository for reference only.
6
+
7
+ The current product is an LLM Function Calling Reliability Platform. See `CLAUDE.md` for the current architecture.