@jagilber-org/index-server 1.19.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 (360) hide show
  1. package/CHANGELOG.md +1218 -0
  2. package/CODE_OF_CONDUCT.md +49 -0
  3. package/CONTRIBUTING.md +75 -0
  4. package/LICENSE +21 -0
  5. package/README.md +523 -0
  6. package/SECURITY.md +50 -0
  7. package/dist/config/configUtils.d.ts +11 -0
  8. package/dist/config/configUtils.js +87 -0
  9. package/dist/config/dashboardConfig.d.ts +45 -0
  10. package/dist/config/dashboardConfig.js +63 -0
  11. package/dist/config/defaultValues.d.ts +61 -0
  12. package/dist/config/defaultValues.js +70 -0
  13. package/dist/config/dirConstants.d.ts +17 -0
  14. package/dist/config/dirConstants.js +28 -0
  15. package/dist/config/featureConfig.d.ts +61 -0
  16. package/dist/config/featureConfig.js +121 -0
  17. package/dist/config/runtimeConfig.d.ts +145 -0
  18. package/dist/config/runtimeConfig.js +334 -0
  19. package/dist/config/serverConfig.d.ts +90 -0
  20. package/dist/config/serverConfig.js +164 -0
  21. package/dist/dashboard/analytics/AnalyticsEngine.d.ts +142 -0
  22. package/dist/dashboard/analytics/AnalyticsEngine.js +373 -0
  23. package/dist/dashboard/analytics/BusinessIntelligence.d.ts +187 -0
  24. package/dist/dashboard/analytics/BusinessIntelligence.js +594 -0
  25. package/dist/dashboard/client/admin.html +2150 -0
  26. package/dist/dashboard/client/chunks/mermaid-layout-elk.esm.min/chunk-SP2CHFBE.mjs +1 -0
  27. package/dist/dashboard/client/chunks/mermaid-layout-elk.esm.min/render-T6MDALS3.mjs +27 -0
  28. package/dist/dashboard/client/css/admin.css +1466 -0
  29. package/dist/dashboard/client/js/admin.boot.js +359 -0
  30. package/dist/dashboard/client/js/admin.config.js +196 -0
  31. package/dist/dashboard/client/js/admin.embeddings.js +425 -0
  32. package/dist/dashboard/client/js/admin.graph.js +583 -0
  33. package/dist/dashboard/client/js/admin.instances.js +120 -0
  34. package/dist/dashboard/client/js/admin.instructions.js +552 -0
  35. package/dist/dashboard/client/js/admin.logs.js +113 -0
  36. package/dist/dashboard/client/js/admin.maintenance.js +354 -0
  37. package/dist/dashboard/client/js/admin.messaging.js +635 -0
  38. package/dist/dashboard/client/js/admin.monitor.js +181 -0
  39. package/dist/dashboard/client/js/admin.overview.js +221 -0
  40. package/dist/dashboard/client/js/admin.performance.js +61 -0
  41. package/dist/dashboard/client/js/admin.sessions.js +293 -0
  42. package/dist/dashboard/client/js/admin.sqlite.js +366 -0
  43. package/dist/dashboard/client/js/admin.utils.js +49 -0
  44. package/dist/dashboard/client/js/chart.umd.js +14 -0
  45. package/dist/dashboard/client/js/elk.bundled.js +6696 -0
  46. package/dist/dashboard/client/js/marked.umd.js +74 -0
  47. package/dist/dashboard/client/js/mermaid.min.js +3022 -0
  48. package/dist/dashboard/client/mermaid-layout-elk.esm.min.mjs +1 -0
  49. package/dist/dashboard/export/DataExporter.d.ts +169 -0
  50. package/dist/dashboard/export/DataExporter.js +737 -0
  51. package/dist/dashboard/export/exporters/csvExporter.d.ts +11 -0
  52. package/dist/dashboard/export/exporters/csvExporter.js +46 -0
  53. package/dist/dashboard/export/exporters/exportTypes.d.ts +89 -0
  54. package/dist/dashboard/export/exporters/exportTypes.js +5 -0
  55. package/dist/dashboard/export/exporters/jsonExporter.d.ts +7 -0
  56. package/dist/dashboard/export/exporters/jsonExporter.js +22 -0
  57. package/dist/dashboard/export/exporters/xmlExporter.d.ts +17 -0
  58. package/dist/dashboard/export/exporters/xmlExporter.js +175 -0
  59. package/dist/dashboard/integration/APIIntegration.d.ts +41 -0
  60. package/dist/dashboard/integration/APIIntegration.js +95 -0
  61. package/dist/dashboard/security/SecurityMonitor.d.ts +167 -0
  62. package/dist/dashboard/security/SecurityMonitor.js +559 -0
  63. package/dist/dashboard/server/AdminPanel.d.ts +183 -0
  64. package/dist/dashboard/server/AdminPanel.js +792 -0
  65. package/dist/dashboard/server/AdminPanelConfig.d.ts +42 -0
  66. package/dist/dashboard/server/AdminPanelConfig.js +80 -0
  67. package/dist/dashboard/server/AdminPanelState.d.ts +47 -0
  68. package/dist/dashboard/server/AdminPanelState.js +214 -0
  69. package/dist/dashboard/server/ApiRoutes.d.ts +17 -0
  70. package/dist/dashboard/server/ApiRoutes.js +149 -0
  71. package/dist/dashboard/server/DashboardServer.d.ts +49 -0
  72. package/dist/dashboard/server/DashboardServer.js +159 -0
  73. package/dist/dashboard/server/FileMetricsStorage.d.ts +49 -0
  74. package/dist/dashboard/server/FileMetricsStorage.js +195 -0
  75. package/dist/dashboard/server/HttpTransport.d.ts +23 -0
  76. package/dist/dashboard/server/HttpTransport.js +116 -0
  77. package/dist/dashboard/server/InstanceManager.d.ts +53 -0
  78. package/dist/dashboard/server/InstanceManager.js +284 -0
  79. package/dist/dashboard/server/KnowledgeStore.d.ts +35 -0
  80. package/dist/dashboard/server/KnowledgeStore.js +105 -0
  81. package/dist/dashboard/server/LeaderElection.d.ts +81 -0
  82. package/dist/dashboard/server/LeaderElection.js +268 -0
  83. package/dist/dashboard/server/MetricsCollector.d.ts +200 -0
  84. package/dist/dashboard/server/MetricsCollector.js +803 -0
  85. package/dist/dashboard/server/SessionPersistenceManager.d.ts +88 -0
  86. package/dist/dashboard/server/SessionPersistenceManager.js +457 -0
  87. package/dist/dashboard/server/ThinClient.d.ts +64 -0
  88. package/dist/dashboard/server/ThinClient.js +237 -0
  89. package/dist/dashboard/server/WebSocketManager.d.ts +161 -0
  90. package/dist/dashboard/server/WebSocketManager.js +463 -0
  91. package/dist/dashboard/server/httpLifecycle.d.ts +17 -0
  92. package/dist/dashboard/server/httpLifecycle.js +35 -0
  93. package/dist/dashboard/server/legacyDashboardHtml.d.ts +9 -0
  94. package/dist/dashboard/server/legacyDashboardHtml.js +618 -0
  95. package/dist/dashboard/server/legacyDashboardStyles.d.ts +5 -0
  96. package/dist/dashboard/server/legacyDashboardStyles.js +490 -0
  97. package/dist/dashboard/server/metricsAggregation.d.ts +252 -0
  98. package/dist/dashboard/server/metricsAggregation.js +206 -0
  99. package/dist/dashboard/server/metricsSerializer.d.ts +25 -0
  100. package/dist/dashboard/server/metricsSerializer.js +195 -0
  101. package/dist/dashboard/server/routes/admin.routes.d.ts +16 -0
  102. package/dist/dashboard/server/routes/admin.routes.js +596 -0
  103. package/dist/dashboard/server/routes/alerts.routes.d.ts +7 -0
  104. package/dist/dashboard/server/routes/alerts.routes.js +93 -0
  105. package/dist/dashboard/server/routes/api.feedback.routes.d.ts +73 -0
  106. package/dist/dashboard/server/routes/api.feedback.routes.js +171 -0
  107. package/dist/dashboard/server/routes/api.instructions.routes.d.ts +101 -0
  108. package/dist/dashboard/server/routes/api.instructions.routes.js +213 -0
  109. package/dist/dashboard/server/routes/api.usage.routes.d.ts +57 -0
  110. package/dist/dashboard/server/routes/api.usage.routes.js +374 -0
  111. package/dist/dashboard/server/routes/embeddings.routes.d.ts +6 -0
  112. package/dist/dashboard/server/routes/embeddings.routes.js +246 -0
  113. package/dist/dashboard/server/routes/graph.routes.d.ts +6 -0
  114. package/dist/dashboard/server/routes/graph.routes.js +280 -0
  115. package/dist/dashboard/server/routes/index.d.ts +38 -0
  116. package/dist/dashboard/server/routes/index.js +194 -0
  117. package/dist/dashboard/server/routes/instances.routes.d.ts +6 -0
  118. package/dist/dashboard/server/routes/instances.routes.js +35 -0
  119. package/dist/dashboard/server/routes/instructions.routes.d.ts +8 -0
  120. package/dist/dashboard/server/routes/instructions.routes.js +336 -0
  121. package/dist/dashboard/server/routes/knowledge.routes.d.ts +6 -0
  122. package/dist/dashboard/server/routes/knowledge.routes.js +82 -0
  123. package/dist/dashboard/server/routes/logs.routes.d.ts +6 -0
  124. package/dist/dashboard/server/routes/logs.routes.js +164 -0
  125. package/dist/dashboard/server/routes/messaging.routes.d.ts +16 -0
  126. package/dist/dashboard/server/routes/messaging.routes.js +293 -0
  127. package/dist/dashboard/server/routes/metrics.routes.d.ts +10 -0
  128. package/dist/dashboard/server/routes/metrics.routes.js +346 -0
  129. package/dist/dashboard/server/routes/scripts.routes.d.ts +9 -0
  130. package/dist/dashboard/server/routes/scripts.routes.js +84 -0
  131. package/dist/dashboard/server/routes/sqlite.routes.d.ts +9 -0
  132. package/dist/dashboard/server/routes/sqlite.routes.js +569 -0
  133. package/dist/dashboard/server/routes/status.routes.d.ts +7 -0
  134. package/dist/dashboard/server/routes/status.routes.js +183 -0
  135. package/dist/dashboard/server/routes/synthetic.routes.d.ts +7 -0
  136. package/dist/dashboard/server/routes/synthetic.routes.js +195 -0
  137. package/dist/dashboard/server/routes/tools.routes.d.ts +6 -0
  138. package/dist/dashboard/server/routes/tools.routes.js +46 -0
  139. package/dist/dashboard/server/routes/usage.routes.d.ts +6 -0
  140. package/dist/dashboard/server/routes/usage.routes.js +25 -0
  141. package/dist/dashboard/server/wsInit.d.ts +16 -0
  142. package/dist/dashboard/server/wsInit.js +35 -0
  143. package/dist/externalClientLib.d.ts +1 -0
  144. package/dist/externalClientLib.js +2 -0
  145. package/dist/minimal/index.d.ts +1 -0
  146. package/dist/minimal/index.js +140 -0
  147. package/dist/models/SessionPersistence.d.ts +115 -0
  148. package/dist/models/SessionPersistence.js +66 -0
  149. package/dist/models/instruction.d.ts +45 -0
  150. package/dist/models/instruction.js +2 -0
  151. package/dist/perf/benchmark.d.ts +1 -0
  152. package/dist/perf/benchmark.js +50 -0
  153. package/dist/portableClientWrapper.d.ts +1 -0
  154. package/dist/portableClientWrapper.js +2 -0
  155. package/dist/schemas/index.d.ts +128 -0
  156. package/dist/schemas/index.js +371 -0
  157. package/dist/scripts/runPerformanceBaseline.d.ts +1 -0
  158. package/dist/scripts/runPerformanceBaseline.js +17 -0
  159. package/dist/server/handshakeManager.d.ts +25 -0
  160. package/dist/server/handshakeManager.js +472 -0
  161. package/dist/server/index-server.d.ts +56 -0
  162. package/dist/server/index-server.js +822 -0
  163. package/dist/server/registry.d.ts +44 -0
  164. package/dist/server/registry.js +236 -0
  165. package/dist/server/sdkServer.d.ts +8 -0
  166. package/dist/server/sdkServer.js +299 -0
  167. package/dist/server/shutdownGuard.d.ts +41 -0
  168. package/dist/server/shutdownGuard.js +52 -0
  169. package/dist/server/thin-client.d.ts +22 -0
  170. package/dist/server/thin-client.js +111 -0
  171. package/dist/server/transport.d.ts +41 -0
  172. package/dist/server/transport.js +312 -0
  173. package/dist/server/transportFactory.d.ts +21 -0
  174. package/dist/server/transportFactory.js +429 -0
  175. package/dist/services/atomicFs.d.ts +22 -0
  176. package/dist/services/atomicFs.js +103 -0
  177. package/dist/services/auditLog.d.ts +38 -0
  178. package/dist/services/auditLog.js +142 -0
  179. package/dist/services/autoBackup.d.ts +14 -0
  180. package/dist/services/autoBackup.js +171 -0
  181. package/dist/services/autoSplit.d.ts +32 -0
  182. package/dist/services/autoSplit.js +113 -0
  183. package/dist/services/backupZip.d.ts +25 -0
  184. package/dist/services/backupZip.js +110 -0
  185. package/dist/services/bootstrapGating.d.ts +123 -0
  186. package/dist/services/bootstrapGating.js +221 -0
  187. package/dist/services/canonical.d.ts +23 -0
  188. package/dist/services/canonical.js +65 -0
  189. package/dist/services/categoryRules.d.ts +7 -0
  190. package/dist/services/categoryRules.js +37 -0
  191. package/dist/services/classificationService.d.ts +42 -0
  192. package/dist/services/classificationService.js +168 -0
  193. package/dist/services/embeddingService.d.ts +62 -0
  194. package/dist/services/embeddingService.js +259 -0
  195. package/dist/services/errors.d.ts +22 -0
  196. package/dist/services/errors.js +31 -0
  197. package/dist/services/featureFlags.d.ts +25 -0
  198. package/dist/services/featureFlags.js +89 -0
  199. package/dist/services/features.d.ts +13 -0
  200. package/dist/services/features.js +35 -0
  201. package/dist/services/handlers/instructions.add.d.ts +1 -0
  202. package/dist/services/handlers/instructions.add.js +496 -0
  203. package/dist/services/handlers/instructions.groom.d.ts +1 -0
  204. package/dist/services/handlers/instructions.groom.js +523 -0
  205. package/dist/services/handlers/instructions.import.d.ts +1 -0
  206. package/dist/services/handlers/instructions.import.js +173 -0
  207. package/dist/services/handlers/instructions.patch.d.ts +1 -0
  208. package/dist/services/handlers/instructions.patch.js +167 -0
  209. package/dist/services/handlers/instructions.query.d.ts +163 -0
  210. package/dist/services/handlers/instructions.query.js +522 -0
  211. package/dist/services/handlers/instructions.reload.d.ts +1 -0
  212. package/dist/services/handlers/instructions.reload.js +13 -0
  213. package/dist/services/handlers/instructions.remove.d.ts +1 -0
  214. package/dist/services/handlers/instructions.remove.js +118 -0
  215. package/dist/services/handlers/instructions.shared.d.ts +31 -0
  216. package/dist/services/handlers/instructions.shared.js +124 -0
  217. package/dist/services/handlers.activation.d.ts +1 -0
  218. package/dist/services/handlers.activation.js +203 -0
  219. package/dist/services/handlers.bootstrap.d.ts +1 -0
  220. package/dist/services/handlers.bootstrap.js +38 -0
  221. package/dist/services/handlers.dashboardConfig.d.ts +34 -0
  222. package/dist/services/handlers.dashboardConfig.js +108 -0
  223. package/dist/services/handlers.diagnostics.d.ts +1 -0
  224. package/dist/services/handlers.diagnostics.js +64 -0
  225. package/dist/services/handlers.feedback.d.ts +15 -0
  226. package/dist/services/handlers.feedback.js +378 -0
  227. package/dist/services/handlers.gates.d.ts +1 -0
  228. package/dist/services/handlers.gates.js +46 -0
  229. package/dist/services/handlers.graph.d.ts +53 -0
  230. package/dist/services/handlers.graph.js +231 -0
  231. package/dist/services/handlers.help.d.ts +1 -0
  232. package/dist/services/handlers.help.js +119 -0
  233. package/dist/services/handlers.instructionSchema.d.ts +1 -0
  234. package/dist/services/handlers.instructionSchema.js +227 -0
  235. package/dist/services/handlers.instructions.d.ts +8 -0
  236. package/dist/services/handlers.instructions.js +14 -0
  237. package/dist/services/handlers.instructionsDiagnostics.d.ts +1 -0
  238. package/dist/services/handlers.instructionsDiagnostics.js +14 -0
  239. package/dist/services/handlers.integrity.d.ts +1 -0
  240. package/dist/services/handlers.integrity.js +35 -0
  241. package/dist/services/handlers.manifest.d.ts +1 -0
  242. package/dist/services/handlers.manifest.js +24 -0
  243. package/dist/services/handlers.messaging.d.ts +12 -0
  244. package/dist/services/handlers.messaging.js +203 -0
  245. package/dist/services/handlers.metrics.d.ts +1 -0
  246. package/dist/services/handlers.metrics.js +43 -0
  247. package/dist/services/handlers.promote.d.ts +1 -0
  248. package/dist/services/handlers.promote.js +306 -0
  249. package/dist/services/handlers.prompt.d.ts +1 -0
  250. package/dist/services/handlers.prompt.js +7 -0
  251. package/dist/services/handlers.search.d.ts +69 -0
  252. package/dist/services/handlers.search.js +645 -0
  253. package/dist/services/handlers.testPrimitive.d.ts +1 -0
  254. package/dist/services/handlers.testPrimitive.js +5 -0
  255. package/dist/services/handlers.trace.d.ts +1 -0
  256. package/dist/services/handlers.trace.js +31 -0
  257. package/dist/services/handlers.usage.d.ts +1 -0
  258. package/dist/services/handlers.usage.js +11 -0
  259. package/dist/services/hotScore.d.ts +137 -0
  260. package/dist/services/hotScore.js +244 -0
  261. package/dist/services/indexContext.d.ts +117 -0
  262. package/dist/services/indexContext.js +968 -0
  263. package/dist/services/indexLoader.d.ts +44 -0
  264. package/dist/services/indexLoader.js +921 -0
  265. package/dist/services/indexRepository.d.ts +32 -0
  266. package/dist/services/indexRepository.js +71 -0
  267. package/dist/services/indexingService.d.ts +1 -0
  268. package/dist/services/indexingService.js +2 -0
  269. package/dist/services/instructions.dispatcher.d.ts +1 -0
  270. package/dist/services/instructions.dispatcher.js +231 -0
  271. package/dist/services/logPrefix.d.ts +1 -0
  272. package/dist/services/logPrefix.js +30 -0
  273. package/dist/services/logger.d.ts +52 -0
  274. package/dist/services/logger.js +268 -0
  275. package/dist/services/manifestManager.d.ts +82 -0
  276. package/dist/services/manifestManager.js +200 -0
  277. package/dist/services/messaging/agentMailbox.d.ts +60 -0
  278. package/dist/services/messaging/agentMailbox.js +353 -0
  279. package/dist/services/messaging/messagingPersistence.d.ts +20 -0
  280. package/dist/services/messaging/messagingPersistence.js +111 -0
  281. package/dist/services/messaging/messagingTypes.d.ts +150 -0
  282. package/dist/services/messaging/messagingTypes.js +66 -0
  283. package/dist/services/ownershipService.d.ts +1 -0
  284. package/dist/services/ownershipService.js +38 -0
  285. package/dist/services/performanceBaseline.d.ts +19 -0
  286. package/dist/services/performanceBaseline.js +210 -0
  287. package/dist/services/preflight.d.ts +12 -0
  288. package/dist/services/preflight.js +79 -0
  289. package/dist/services/promptReviewService.d.ts +44 -0
  290. package/dist/services/promptReviewService.js +101 -0
  291. package/dist/services/responseEnvelope.d.ts +6 -0
  292. package/dist/services/responseEnvelope.js +25 -0
  293. package/dist/services/seedBootstrap.d.ts +34 -0
  294. package/dist/services/seedBootstrap.js +427 -0
  295. package/dist/services/storage/factory.d.ts +17 -0
  296. package/dist/services/storage/factory.js +35 -0
  297. package/dist/services/storage/hashUtils.d.ts +11 -0
  298. package/dist/services/storage/hashUtils.js +35 -0
  299. package/dist/services/storage/index.d.ts +12 -0
  300. package/dist/services/storage/index.js +18 -0
  301. package/dist/services/storage/jsonFileStore.d.ts +32 -0
  302. package/dist/services/storage/jsonFileStore.js +241 -0
  303. package/dist/services/storage/migrationEngine.d.ts +35 -0
  304. package/dist/services/storage/migrationEngine.js +93 -0
  305. package/dist/services/storage/sqliteMessageStore.d.ts +53 -0
  306. package/dist/services/storage/sqliteMessageStore.js +146 -0
  307. package/dist/services/storage/sqliteSchema.d.ts +12 -0
  308. package/dist/services/storage/sqliteSchema.js +122 -0
  309. package/dist/services/storage/sqliteStore.d.ts +41 -0
  310. package/dist/services/storage/sqliteStore.js +339 -0
  311. package/dist/services/storage/sqliteUsageStore.d.ts +35 -0
  312. package/dist/services/storage/sqliteUsageStore.js +94 -0
  313. package/dist/services/storage/types.d.ts +171 -0
  314. package/dist/services/storage/types.js +12 -0
  315. package/dist/services/toolHandlers.d.ts +23 -0
  316. package/dist/services/toolHandlers.js +50 -0
  317. package/dist/services/toolRegistry.d.ts +20 -0
  318. package/dist/services/toolRegistry.js +490 -0
  319. package/dist/services/toolRegistry.zod.d.ts +10 -0
  320. package/dist/services/toolRegistry.zod.js +323 -0
  321. package/dist/services/tracing.d.ts +26 -0
  322. package/dist/services/tracing.js +260 -0
  323. package/dist/services/usageBuckets.d.ts +161 -0
  324. package/dist/services/usageBuckets.js +364 -0
  325. package/dist/services/validationService.d.ts +38 -0
  326. package/dist/services/validationService.js +125 -0
  327. package/dist/utils/BufferRing.d.ts +203 -0
  328. package/dist/utils/BufferRing.js +551 -0
  329. package/dist/utils/BufferRingExamples.d.ts +55 -0
  330. package/dist/utils/BufferRingExamples.js +188 -0
  331. package/dist/utils/envUtils.d.ts +42 -0
  332. package/dist/utils/envUtils.js +80 -0
  333. package/dist/utils/memoryMonitor.d.ts +83 -0
  334. package/dist/utils/memoryMonitor.js +275 -0
  335. package/dist/versioning/schemaVersion.d.ts +6 -0
  336. package/dist/versioning/schemaVersion.js +93 -0
  337. package/package.json +134 -0
  338. package/schemas/README.md +13 -0
  339. package/schemas/feedback-entry.schema.json +27 -0
  340. package/schemas/graph-export-v2.schema.json +60 -0
  341. package/schemas/index-server.code-schema.json +38477 -0
  342. package/schemas/instruction.schema.json +262 -0
  343. package/schemas/json-schema/SessionPersistence-persisted-admin-session.schema.json +54 -0
  344. package/schemas/json-schema/SessionPersistence-persisted-session-history-entry.schema.json +51 -0
  345. package/schemas/json-schema/SessionPersistence-persisted-web-socket-connection.schema.json +54 -0
  346. package/schemas/json-schema/SessionPersistence-session-persistence-config.schema.json +110 -0
  347. package/schemas/json-schema/SessionPersistence-session-persistence-data.schema.json +229 -0
  348. package/schemas/json-schema/SessionPersistence-session-persistence-manifest.schema.json +109 -0
  349. package/schemas/json-schema/SessionPersistence-session-persistence-metadata.schema.json +55 -0
  350. package/schemas/json-schema/instruction-audience-scope.schema.json +14 -0
  351. package/schemas/json-schema/instruction-content-type.schema.json +17 -0
  352. package/schemas/json-schema/instruction-instruction-entry.schema.json +206 -0
  353. package/schemas/json-schema/instruction-requirement-level.schema.json +16 -0
  354. package/schemas/manifest.json +78 -0
  355. package/schemas/manifest.schema.json +33 -0
  356. package/schemas/usage-batch.schema.json +16 -0
  357. package/schemas/usage-buckets.schema.json +30 -0
  358. package/schemas/usage-event.schema.json +17 -0
  359. package/scripts/copy-dashboard-assets.mjs +170 -0
  360. package/scripts/setup-hooks.cjs +28 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,1218 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
6
+
7
+ ## [1.19.0] - 2026-04-10
8
+
9
+ ### Changed
10
+
11
+ - **Environment variable consolidation** — All direct `process.env` reads in runtime source files have been migrated to the centralized `getRuntimeConfig()` config layer. 12 files consolidated: `handlers.feedback.ts`, `autoBackup.ts`, `instructions.dispatcher.ts`, `sqlite.routes.ts`, `admin.routes.ts`, `seedBootstrap.ts`, `sdkServer.ts`, `BufferRing.ts`, `SessionPersistenceManager.ts`, `manifestManager.ts`, `registry.ts`, `transportFactory.ts`.
12
+ - **Standardized env var prefixes** — Unprefixed environment variables have been replaced with `INDEX_SERVER_*` equivalents. Old unprefixed names are no longer supported.
13
+
14
+ ### Environment Variables
15
+
16
+ - `INDEX_SERVER_BUFFER_RING_APPEND` — replaces `BUFFER_RING_APPEND` (default: `1`)
17
+ - `INDEX_SERVER_BUFFER_RING_PRELOAD` — replaces `BUFFER_RING_APPEND_PRELOAD` (default: `0`)
18
+ - `INDEX_SERVER_GRAPH_INCLUDE_PRIMARY_EDGES` — replaces `GRAPH_INCLUDE_PRIMARY_EDGES` (default: `1`)
19
+ - `INDEX_SERVER_GRAPH_LARGE_CATEGORY_CAP` — replaces `GRAPH_LARGE_CATEGORY_CAP` (default: `150`)
20
+ - `INDEX_SERVER_AUDIT_LOG` — replaces `INSTRUCTIONS_AUDIT_LOG` (default: enabled, `logs/audit/`)
21
+ - `INDEX_SERVER_COVERAGE_FAST` — replaces `FAST_COVERAGE` (default: `0`)
22
+ - `INDEX_SERVER_COVERAGE_HARD_MIN` — replaces `COVERAGE_HARD_MIN`
23
+ - `INDEX_SERVER_COVERAGE_TARGET` — replaces `COVERAGE_TARGET`
24
+ - `INDEX_SERVER_COVERAGE_STRICT` — replaces `COVERAGE_STRICT` (default: `0`)
25
+
26
+ ### Fixed
27
+
28
+ - Pre-commit hooks and publish scripts hardened against env-var leaks (SHA-256 token validation)
29
+ - `.gitignore` negation pattern (`!instructions/*.json`) removed to prevent instruction file leakage
30
+
31
+ ## [1.18.0] - 2026-04-06
32
+
33
+ ### Added
34
+
35
+ - **SQLite storage backend** (⚠️ EXPERIMENTAL — limited testing performed): `INDEX_SERVER_STORAGE_BACKEND=sqlite` enables SQLite-backed instruction storage using Node.js built-in `node:sqlite` (zero third-party dependencies). Not recommended for production use.
36
+ - `IInstructionStore` interface — storage abstraction layer for backend-agnostic instruction persistence
37
+ - `JsonFileStore` — existing JSON-file-per-instruction behavior wrapped in the interface
38
+ - `SqliteStore` — full SQLite implementation with WAL mode, indexes, and FTS5 full-text search
39
+ - `SqliteMessageStore` — message persistence in SQLite with channel/sender/thread queries
40
+ - `SqliteUsageStore` — usage tracking in SQLite with atomic increment
41
+ - Migration engine — bidirectional JSON ↔ SQLite migration (lossless round-trip)
42
+ - FTS5 search with BM25 ranking (title 10x, body 5x weight)
43
+ - SQLite backup support in autoBackup (copies .db + WAL/SHM files)
44
+ - Factory pattern with feature flag: `createStore()` selects backend from config
45
+ - 115+ storage-specific tests (contract, migration, FTS5, messaging, usage)
46
+ - Governance hash identical across both backends
47
+ - **NDJSON structured logging**: All server log output now uses strict NDJSON (newline-delimited JSON) format. Each log line is a JSON object with `ts`, `level`, `msg`, and optional `detail`, `tool`, `ms`, `pid`, `port`, `correlationId` fields. V8 `Error.captureStackTrace` auto-populates stack traces on WARN/ERROR. Module-prefixed messages (`[module]`) support source-file heatmap matching.
48
+ - **Markdown preview in instruction editor**: Dashboard instruction editor includes a 📖 Preview button that renders the instruction `body` as GitHub Flavored Markdown (via `marked`). Preview auto-updates as you type.
49
+ - **Zip-based backups**: All backup operations (auto-backup, bulk-delete, admin panel) now produce `.zip` archives via `adm-zip`. SQLite backend backups include WAL/SHM files for full state preservation. Retention pruning removes oldest snapshots beyond `INDEX_SERVER_AUTO_BACKUP_MAX_COUNT`.
50
+ - **Offset/limit pagination** for `index_dispatch` list action.
51
+
52
+ ### Changed
53
+
54
+ - **Pre-push slow test gate removed** — slow tests now run exclusively in CI workflows.
55
+ - Security headers added to dashboard script routes.
56
+ - Large modules split into focused single-responsibility files (CQ-1 compliance).
57
+ - 66 ESLint unused-variable warnings resolved.
58
+
59
+ ### Environment Variables (⚠️ SQLite options are experimental)
60
+
61
+ - `INDEX_SERVER_STORAGE_BACKEND` — `json` (default) or `sqlite` (experimental — not recommended for production)
62
+ - `INDEX_SERVER_SQLITE_PATH` — SQLite database path (default: `data/index.db`)
63
+ - `INDEX_SERVER_SQLITE_WAL` — Enable WAL mode (default: `true`)
64
+ - `INDEX_SERVER_SQLITE_MIGRATE_ON_START` — Auto-migrate JSON → SQLite on first start (default: `true`)
65
+
66
+ ## [1.16.1] - 2026-04-01
67
+
68
+ ### Fixed
69
+
70
+ - **VSIX extension**: Renamed all "Catalog" references to "Index"/"Index Server" in extension UI (commands, walkthrough, settings, README, icon).
71
+
72
+ ### Added
73
+
74
+ - **Azure DevOps pipeline**: `azure-pipelines.yml` for private VSIX publishing via ADO.
75
+
76
+ ## [1.16.0] - 2026-04-01
77
+
78
+ ### Added
79
+
80
+ - **Signal feedback loop**: `index_groom` reads usage signals from `usage_track` and mutates instructions: `outdated` -> deprecated, `not-relevant` -> priority -10, `helpful` -> priority +5, `applied` -> priority +2.
81
+ - **Dashboard signal visibility**: Instructions panel shows USES/SIGNAL chips per instruction with sort options. Overview panel shows usage signal summary card. Maintenance panel has signal groom controls.
82
+ - **REST client scripts**: `scripts/index-server-client.ps1` (PowerShell) and `scripts/index-server-client.sh` (bash) for subagents without MCP tool access. Full CRUD via dashboard REST bridge.
83
+ - **Incremental embedding cache**: Semantic search recomputes only changed entries instead of full catalog on any modification.
84
+ - **Embedding concurrency lock**: Concurrent cache-miss searches share one in-flight computation instead of tripling work.
85
+ - **HSTS header**: `Strict-Transport-Security` added when TLS is enabled.
86
+ - **Usage snapshot API**: `GET /api/usage/snapshot` dashboard route for per-instruction signal data.
87
+ - **`usage_hotset` signals**: Items now include `lastSignal` and `lastComment` from usage snapshot.
88
+
89
+ ### Changed
90
+
91
+ - **BREAKING: `index_groom` output schema**: `usagePruned` replaced by `signalApplied`. Added `migrated` and `remappedCategories` fields.
92
+ - **`loadUsageSnapshot` exported**: Now available for import from `catalogContext.ts`.
93
+ - **Usage snapshot path configurable**: `INDEX_SERVER_USAGE_SNAPSHOT_PATH` env var for test isolation.
94
+
95
+ ## [1.15.2] - 2026-04-01
96
+
97
+ ### Fixed
98
+
99
+ - **Codecov workflow**: Corrected CI workflow configuration for Codecov coverage uploads.
100
+ - **Dashboard inline scripts**: `safeExecInlineCode` now passes original arguments instead of Event object.
101
+
102
+ ### Changed
103
+
104
+ - **README**: Replaced with trimmed, focused version.
105
+
106
+ ## [1.14.0] - 2026-03-29
107
+
108
+ ### Changed
109
+
110
+ - **BREAKING: Tool names renamed** from `instructions_*` to `index_*` across the entire codebase. Affected tools: `index_dispatch`, `index_search`, `index_add`, `index_import`, `index_remove`, `index_reload`, `index_repair`, `index_groom`, `index_enrich`, `index_normalize`, `index_governanceHash`, `index_governanceUpdate`, `index_schema`, `index_health`, `index_inspect`, `index_diagnostics`, `index_debugCatalog`.
111
+ - **BREAKING: Environment variables renamed** from `MCP_*` prefix to `INDEX_SERVER_*`. Key renames: `MCP_INSTRUCTIONS_DIR` -> `INDEX_SERVER_DIR`, `MCP_ENABLE_MUTATION` -> `INDEX_SERVER_MUTATION`, `MCP_LOG_VERBOSE` -> `INDEX_SERVER_VERBOSE_LOGGING`, `MCP_LOG_LEVEL` -> `INDEX_SERVER_LOG_LEVEL`, `MCP_DATA_DIR` -> `INDEX_SERVER_DATA_DIR`, `MCP_DASHBOARD_PORT` -> `INDEX_SERVER_DASHBOARD_PORT`, `MCP_DASHBOARD_TLS` -> `INDEX_SERVER_DASHBOARD_TLS`, `MCP_SECRET_KEY` -> `INDEX_SERVER_SECRET_KEY`, `MCP_AUTH_KEY` -> `INDEX_SERVER_AUTH_KEY`, plus 8 more.
112
+ - **Removed all legacy/fallback env var support**: No backward-compatible dual-read aliases. `warnOnce()` deprecation helper and `deprecationNotices` set removed from runtimeConfig.ts.
113
+ - **100% Zod coverage**: All 45+ tools have complete Zod schemas in `toolRegistry.zod.ts` with strict validation.
114
+ - **Instruction catalog content updated**: Renamed `mcp-index-server` -> `index-server` and all tool/env var references across 585+ production instruction files and 22 local instruction files via reusable `scripts/rename-server-in-instructions.ps1`.
115
+
116
+ ### Added
117
+
118
+ - **Reusable rename script**: `scripts/rename-server-in-instructions.ps1` with mapping file support, WhatIf, backup/DR zip, JSON validation, manifest updates, and verification scan.
119
+ - **Mapping files**: `scripts/mappings/index-server-rename.json` (35 replacement pairs), `scripts/mappings/server-env-tools.json` (auto-generated env var + tool name inventory).
120
+
121
+ ## [1.13.2] - 2026-03-29
122
+
123
+ ### Changed
124
+
125
+ - **Renamed server entry point**: `dist/server/index.js` -> `dist/server/index-server.js` for clarity. Source file renamed from `src/server/index.ts` to `src/server/index-server.ts`. All scripts, CI workflows, configs, tests, and documentation updated (92+ files).
126
+ - **Deploy script**: `scripts/deploy-local.ps1` updated -- generated `start.ps1`, `start.cmd`, and runtime `package.json` all reference the new entry point name.
127
+ - **Shim scripts**: `ci-build.js`, `ci-build.mjs`, `pretest-build-or-skip.mjs/.ps1`, and `distReady.ts` updated to create/locate `index-server.js` instead of `index.js`.
128
+
129
+ ## [1.12.0] - 2026-03-16
130
+
131
+ ### Added
132
+
133
+ - **Embeddings visualization panel**: New dashboard tab displaying embedding vectors, cosine similarity heatmaps, and cluster analysis for instruction catalog entries.
134
+ - **Graph tab toggle** (`INDEX_SERVER_DASHBOARD_GRAPH`): Opt-in env var to enable the Graph visualization tab. When disabled (default), the server strips the graph nav button, section HTML, and `admin.graph.js` script tag from the dashboard -- avoiding ~4.5MB of mermaid + elkjs JS downloads.
135
+ - **PPID watchdog**: Belt-and-suspenders orphan detection that checks every 30s if the parent process is still alive via `process.kill(ppid, 0)`. Exits gracefully if parent is gone, covering Windows edge cases where stdin EOF is unreliable.
136
+ - **Bundled dashboard assets**: Chart.js 4.4.0, mermaid 11.11.0, and elkjs 0.9.3 are now served locally from `/js/` -- no external CDN calls in production.
137
+ - **System font stack**: Replaced Google Fonts (Inter) with `system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif`.
138
+
139
+ ### Changed
140
+
141
+ - **Semantic search defaults**: `INDEX_SERVER_SEMANTIC_LOCAL_ONLY` now defaults to `true` (blocks remote HuggingFace downloads). `INDEX_SERVER_SEMANTIC_ENABLED` defaults to `false`.
142
+ - **CSP tightened**: Content-Security-Policy is now `'self'` only -- removed cdn.jsdelivr.net, unpkg.com, fonts.googleapis.com, fonts.gstatic.com.
143
+ - **CDN versions pinned**: mermaid pinned to 11.11.0, ELK ESM to 0.2.0, elkjs to 0.9.3, diagram-viewer mermaid to 10.9.3.
144
+
145
+ ### Fixed
146
+
147
+ - **Orphaned server processes**: Added stdin `end`/`close` handler that calls `shutdownGuard.initiateShutdown('stdin-closed')` + `process.exit()` when the parent (VS Code) disconnects. Prevents the Express dashboard HTTP server from keeping orphaned processes alive indefinitely.
148
+ - **Embeddings panel Load button**: Fixed boot.js CSP sanitizer blocking `window.fn && window.fn()` inline onclick patterns.
149
+ - **Mermaid graph CSP**: Relaxed then eliminated CSP CDN allowances by bundling all graph assets locally.
150
+ - **ELK ESM chunks**: `copy-dashboard-assets.mjs` now copies the `chunks/` subdirectory required by the ELK ESM entry point.
151
+
152
+ ## [1.11.2] - 2026-03-12
153
+
154
+ ### Security
155
+
156
+ - **CORS hardening**: Replaced permissive `Access-Control-Allow-Origin: *` with localhost-only origin validation in DashboardServer, ApiRoutes, and SSE log streaming.
157
+ - **Security headers**: Added CSP, X-Frame-Options (DENY), X-Content-Type-Options, X-XSS-Protection, and Referrer-Policy to all dashboard HTTP responses.
158
+ - **Admin authentication**: Added API key middleware (`INDEX_SERVER_ADMIN_API_KEY` env var) to all `/api/admin/*` routes with localhost-fallback for backward compatibility.
159
+ - **Code injection fix**: Replaced `new Function()` usage in APIIntegration.ts with safe dot-path transform methods and type coercion allowlist.
160
+ - **Inline handler fix**: Replaced `new Function()` in admin.boot.js with safe named-function dispatch via window object traversal.
161
+ - **TOCTOU fix**: Replaced `existsSync()` + `readFileSync()` pattern in index_inspect with direct read + ENOENT error code check.
162
+
163
+ ### Fixed
164
+
165
+ - **Shutdown race condition**: Consolidated multiple competing `process.exit()` calls (SIGINT, SIGTERM, uncaughtException across index.ts, transport.ts, catalogContext.ts) into single `ShutdownGuard` with re-entrance protection.
166
+ - **Silent error swallowing**: Added structured error logging to critical catch blocks in autoBackup.ts (interval, initial run, pruning).
167
+
168
+ ### Added
169
+
170
+ - **ShutdownGuard module** (`src/server/shutdownGuard.ts`): Singleton factory with named cleanup handler registry, re-entrance guard, and exit code mapping. 7 unit tests.
171
+ - **Coverage thresholds**: Added branch (70%), function (70%), line (75%), statement (75%) thresholds to vitest.config.ts.
172
+ - **Dependabot config**: Created `.github/dependabot.yml` for weekly npm and GitHub Actions dependency updates.
173
+ - **CodeQL weekly scans**: Enabled Monday 3am UTC scheduled scan in `.github/workflows/codeql.yml`.
174
+ - **CODEOWNERS expansion**: Added dashboard, server, workflows, and config paths to `.github/CODEOWNERS`.
175
+
176
+ ## [1.11.1] - 2026-03-04
177
+
178
+ ### Added
179
+
180
+ - **Usage test coverage**: Replaced 4 placeholder usage test files with 11 real functional tests covering feature gating (`hasFeature`/`INDEX_SERVER_FEATURES`), usage tracking (`incrementUsage`), `firstSeenTs`/`lastUsedAt` timestamps, and rate-limit clearing.
181
+ - **Dev MCP config**: Added `INDEX_SERVER_FLAG_TOOLS_EXTENDED=1` to workspace dev server config.
182
+
183
+ ### Changed
184
+
185
+ - **Documentation**: Updated `INDEX_SERVER_FEATURES` env var description in `docs/tools.md` to list all valid feature flags (`usage,window,hotness,drift,risk`).
186
+
187
+ ## [1.11.0] - 2026-03-03
188
+
189
+ ### Added
190
+
191
+ - **Dashboard configuration panel redesign**: Category-grouped flags with collapsible sections, live search/filter, documentation links (📖 icons), 15-second auto-refresh, stability color coding, and full-height layout replacing the constrained 480px scroll area.
192
+ - **Constitution rule A-7**: Canonical seeds in `seedBootstrap.ts` must contain only generalized, public-safe content — no environment-specific or org-specific data.
193
+
194
+ ### Changed
195
+
196
+ - **Auto-backup default**: `autoBackupEnabled` now defaults to `false` (was `true`). Set `INDEX_SERVER_AUTO_BACKUP=1` to re-enable.
197
+ - **Flag registry sorting**: `/api/admin/config` flags are now sorted by category → name for consistent ordering.
198
+ - **Flag metadata**: Each flag now includes a `docAnchor` slug and the response includes `lastRefreshed` timestamp.
199
+
200
+ ## [1.10.0] - 2026-03-02
201
+
202
+ ### Added
203
+
204
+ - **Auto usage tracking**: Get and search operations now automatically track usage for retrieved instructions via fire-and-forget `incrementUsage` calls. Controlled by `INDEX_SERVER_AUTO_USAGE_TRACK` env var (default: `true`). Search tracks top 10 results; get tracks each successful retrieval.
205
+ - **Embedding cache model awareness**: Embedding cache now stores `modelName` alongside `catalogHash`, automatically invalidating cached embeddings when the semantic model is changed (e.g., switching from `all-MiniLM-L6-v2` to `bge-base-en-v1.5`). Prevents dimension mismatch errors.
206
+ - **Zod schema for `index_search`**: Added `zInstructionsSearch` to `toolRegistry.zod.ts` with all parameters (`keywords`, `mode`, `limit`, `includeCategories`, `caseSensitive`, `contentType`) matching the JSON Schema definition.
207
+ - **Documentation**: Added docs index, MCP configuration guide, project PRD, prompt optimization guide, search benchmark results, credential centralization runbook.
208
+ - **Benchmark script**: `scripts/benchmark-search.ps1` — stress-tests keyword/regex/semantic search modes and generates markdown + Mermaid report.
209
+ - **Tools REST routes**: `src/dashboard/server/routes/tools.routes.ts` — REST bridge for MCP tool handlers.
210
+
211
+ ### Fixed
212
+
213
+ - **Semantic test crash**: `autoTrackSearchResults()` and dispatcher auto-tracking now use optional chaining (`catalog?.autoUsageTrack`) to avoid `TypeError` when `catalog` config is undefined in test context.
214
+
215
+ ### Changed
216
+
217
+ - **Upgraded recommended model**: Documentation and prod config updated for `Xenova/bge-base-en-v1.5` (768-dim, ~90MB) over default `Xenova/all-MiniLM-L6-v2` (384-dim), providing ~30% quality improvement for semantic search.
218
+
219
+ ## [1.9.0] - 2026-03-01
220
+
221
+ ### Added
222
+
223
+ - **Search modes**: `index_search` now supports `mode` parameter with three values:
224
+ - `keyword` (default) — substring matching with auto-tokenization
225
+ - `regex` — pattern matching (e.g., `"deploy|release"`, `"Type[Ss]cript"`) with ReDoS protection (200-char limit)
226
+ - `semantic` — embedding-based cosine similarity search with lazy-loaded HuggingFace model, disk-cached embeddings, and graceful degradation to keyword mode on failure. Requires `INDEX_SERVER_SEMANTIC_ENABLED=1`.
227
+ - **Embedding service**: New `embeddingService.ts` with cosine similarity, disk cache, staleness detection, and lazy model loading (zero startup impact).
228
+ - **Semantic configuration**: New env vars `INDEX_SERVER_SEMANTIC_ENABLED`, `INDEX_SERVER_SEMANTIC_MODEL`, `INDEX_SERVER_SEMANTIC_CACHE_DIR`, `INDEX_SERVER_EMBEDDING_PATH`, `INDEX_SERVER_SEMANTIC_DEVICE`, `INDEX_SERVER_SEMANTIC_LOCAL_ONLY` via `SemanticConfig` in `runtimeConfig.ts`.
229
+ - `INDEX_SERVER_SEMANTIC_DEVICE` — Run embeddings on GPU: `cuda` (NVIDIA) or `dml` (DirectML/Windows). Default: `cpu`.
230
+ - `INDEX_SERVER_SEMANTIC_LOCAL_ONLY` — Block remote model downloads when set to `1`. Model must already be cached.
231
+ - **Search highlighting**: Match highlighting in both global search results and local instruction list filter using `<mark>` tags with gold background.
232
+ - **Backup file export/import**: "Backup to File" and "Restore from File" buttons in Maintenance tab with file dialog support.
233
+ - **Server export/import endpoints**: `GET /api/admin/maintenance/backup/:id/export` and `POST /api/admin/maintenance/backup/import` for backup bundle transfer.
234
+ - **Regex search toggle**: Checkbox to enable regex mode for instruction name filter and global search.
235
+
236
+ ### Fixed
237
+
238
+ - **Global search URL mismatch**: Client was calling `/api/instructions/search` but server route is `/api/index_search` — global search always returned "Not found".
239
+ - **Cache-busting**: Now hashes all JS + CSS + HTML files (was CSS-only), ensuring JS changes are picked up by browsers.
240
+ - **Instance badge**: Shows green when count > 0 (was > 1).
241
+ - **Instance dropdown positioning**: Aligned left instead of centered.
242
+ - **Create instruction template**: Now populates with full v4 schema template instead of minimal stub.
243
+
244
+ ## [1.8.4] - 2026-02-27
245
+
246
+ ### Changed
247
+
248
+ - **Dashboard Grafana-dark theme**: Complete CSS redesign with enterprise dark theme, vertical edge alignment, and graph loading skeleton fix.
249
+ - **Dashboard documentation**: Added panel screenshots gallery to DASHBOARD.md and README.md covering all 7 tabs (Overview, Configuration, Sessions, Maintenance, Monitoring, Instructions, Graph).
250
+ - **Default route**: Root `/` now redirects to `/admin` dashboard; legacy v1 available at `/legacy`.
251
+
252
+ ### Added
253
+
254
+ - **Screenshot capture script**: `scripts/capture-screenshots.mjs` using Playwright for repeatable dashboard screenshot generation.
255
+
256
+ ## [1.8.3] - 2026-02-26
257
+
258
+ ### Added
259
+
260
+ - **Automatic periodic backup**: New `autoBackup` service backs up the instruction catalog on a configurable interval (default 1 hour). Enabled by default (`INDEX_SERVER_AUTO_BACKUP=1`). Old snapshots are pruned to `INDEX_SERVER_AUTO_BACKUP_MAX_COUNT` (default 10). Startup is async and non-blocking via `setImmediate` with a 5-second first-run delay.
261
+
262
+ ### Fixed
263
+
264
+ - **Version 0.0.0 in `createSdkServer`**: Server now resolves `package.json` from multiple candidate paths (`__dirname` fallbacks) instead of relying solely on `process.cwd()`, which VS Code sets to an unrelated directory.
265
+ - **7 tools instead of 50**: Extended and admin tool tiers now activate correctly when `INDEX_SERVER_FLAG_TOOLS_EXTENDED=1` and `INDEX_SERVER_FLAG_TOOLS_ADMIN=1` are set in the MCP client configuration.
266
+
267
+ ## [1.8.2] - 2026-02-26
268
+
269
+ ### Added
270
+
271
+ - **Bulk deletion safeguards**: `index_remove` now enforces a configurable threshold (`INDEX_SERVER_MAX_BULK_DELETE`, default 5). Requests exceeding the threshold are blocked unless `force: true` is passed.
272
+ - **Pre-mutation auto-backup**: When a forced bulk delete exceeds the threshold and `INDEX_SERVER_BACKUP_BEFORE_BULK_DELETE` is enabled (default), all instruction files are snapshotted to `backups/instructions-{timestamp}/` before deletion proceeds. Backup failure aborts the entire operation.
273
+ - **Dry-run mode**: `index_remove` accepts `dryRun: true` to preview which IDs would be deleted without modifying disk.
274
+ - **New env vars**: `INDEX_SERVER_MAX_BULK_DELETE` (number, default 5), `INDEX_SERVER_BACKUP_BEFORE_BULK_DELETE` (boolean, default true).
275
+ - **Tests**: `bulkDeleteGuard.spec.ts` — 6 unit tests covering threshold enforcement, force override, dry-run, and auto-backup behavior.
276
+
277
+ ### Security
278
+
279
+ - Mitigates accidental or automated mass instruction deletion — the incident that wiped production catalog is no longer possible without explicit `force` acknowledgement and automatic backup.
280
+
281
+ ## [1.8.1] - 2026-02-24
282
+
283
+ ### Fixed
284
+
285
+ - **Dispatcher flat-param assembly**: `index_dispatch` action=add now accepts flat params (`id`, `body`, `title` as top-level) in addition to the nested `entry` wrapper. Agents no longer need to pre-wrap instruction fields. Resolves feedback #0d4d73a6.
286
+ - **Schema completeness**: Dispatch `INPUT_SCHEMA` now exposes all mutation-action params: `entry`, `overwrite`, `lax` (add), `entries`, `mode` (import/groom), `owner`, `status`, `bump`, `lastReviewedAt`, `nextReviewDue` (governanceUpdate), `missingOk` (remove).
287
+ - **Build fix**: TS18046 in `feedbackDispatch.red.spec.ts` resolved (release v1.8.0 build failure).
288
+
289
+ ### Added
290
+
291
+ - **Constitution Q-7**: Schema-contract tests required for dispatcher action additions.
292
+ - **Constitution Q-8**: Agent-perspective tests required for mutation dispatch actions.
293
+ - **Test file**: `dispatcherAddFlatParams.spec.ts` — 11 contract + agent-perspective tests covering all dispatch mutation actions.
294
+
295
+ ## [1.8.0] - 2026-02-24
296
+
297
+ ### Changed
298
+
299
+ - **BREAKING: Tool surface reduced from 44 to 7 core tools**. Extended/admin tools available via `INDEX_SERVER_FLAG_TOOLS_EXTENDED` / `INDEX_SERVER_FLAG_TOOLS_ADMIN` feature flags.
300
+ - **ToolTier system**: `core` / `extended` / `admin` tiers with `getToolRegistry(filter?)` tier-based filtering.
301
+ - **Action-based dispatchers**:
302
+ - `feedback_dispatch`: consolidates 6 feedback tools into `submit`/`list`/`get`/`update`/`stats`/`health` actions
303
+ - `bootstrap`: consolidates 3 bootstrap tools into `request`/`status`/`confirm` actions
304
+ - `index_dispatch`: added `manifestStatus`/`manifestRefresh`/`manifestRepair` actions
305
+
306
+ ## [1.7.0] - 2026-02-17
307
+
308
+ ### Removed
309
+
310
+ - **Portable MCP test client removed**: Deleted `portable/` and `portable-mcp-client/` directories, `portableClientShim.ts`, all portable type declarations, and 13 portable-specific test files. The vendored client was back-ported to its origin repo (`jagilber/mcp-client`) before removal.
311
+ - **Portable environment variables**: Removed `PORTABLE_HANDSHAKE_TRACE`, `PORTABLE_CONNECT_TRACE`, `PORTABLE_WAIT_ID_TIMEOUT_MS` legacy env vars from runtime config and test utilities.
312
+ - **Parked tests**: Removed `src/tests._park/` directory containing obsoleted portable comparison/baseline specs.
313
+
314
+ ### Added
315
+
316
+ - **SDK-based test client** (`src/tests/helpers/mcpTestClient.ts`): Lightweight replacement using `@modelcontextprotocol/sdk` directly. Provides `spawnServer()` (low-level MCP connect) and `createTestClient()` (high-level CRUD + `importBulk` + `governanceUpdate`).
317
+ - **Copilot CLI E2E script** (`scripts/copilot-e2e.ps1`): E2E smoke test using GitHub Copilot CLI programmatic mode as the recommended interactive MCP client.
318
+
319
+ ### Changed
320
+
321
+ - **Integration tests refactored**: All integration tests now use `mcpTestClient` instead of `portable-mcp-client`. Affected: `instructionsCreateAtomicVisibility`, `instructionsRemoveAtomicVisibility`, `instructionsPersistenceDivergence`, `instructionsPersistenceIsolated`, `instructionsExternalReload`, `instructionSchema`, `feedbackReproduction.crudConsistency`, `feedbackReproduction.multiClient`, `contractSchemas`, `governanceHashIntegrity`, `governanceHashHardening`, `importDuplicateAddVisibility`.
322
+ - **Performance baseline** (`scripts/perf-baseline.mjs`): Rewritten to connect via `@modelcontextprotocol/sdk` instead of portable client.
323
+ - **Guard declarations** (`scripts/guard-declarations.mjs`): Simplified allow-list to only `sdk-shim.d.ts`.
324
+ - **Config cleanup**: Removed portable references from `.eslintignore`, `.eslintrc.json`, `tsconfig.eslint.json`, `tsconfig.eslint.vendored.json`, `vitest.config.ts`, `.secrets.baseline`.
325
+
326
+ ## [1.6.8] - 2026-02-16
327
+
328
+ ### Changed
329
+
330
+ - **Schema version bumped to v4**: Instruction schema now accepts `sourceWorkspace` and `createdByAgent` as optional root-level properties. These fields are set by `promote_from_repo` to track provenance of promoted entries. Previously, entries with these fields were rejected by `additionalProperties: false` validation (caused 10 skipped entries in production catalogs).
331
+ - **Migration v3→v4**: Automatic no-op migration — fields are optional so no data transforms needed; schemaVersion stamp is updated on load.
332
+
333
+ ## [1.6.7] - 2026-02-16
334
+
335
+ ### Added
336
+
337
+ - **SpecKit bootstrap**: Full spec-driven development scaffolding for the repo.
338
+ - `constitution.json` — Machine-checkable quality gates (quality, security, architecture, governance articles)
339
+ - `.specify/` folder — `memory/constitution.md`, `templates/` (spec, plan, tasks), `config/promotion-map.json`, `commands/`
340
+ - `.github/copilot-instructions.md` — Canonical repo instructions with MCP integration section
341
+ - `.github/agents/` — 5 SpecKit agent slash commands (constitution, specify, plan, tasks, implement)
342
+ - `.github/prompts/` — 5 matching reusable prompt files
343
+ - `sync-constitution.cjs` — Generates derived constitution.md from constitution.json (supports `--check` mode)
344
+ - `promotion-map.json` — Maps existing docs (ARCHITECTURE, PRD, TOOLS, CONTRIBUTING, specs) for catalog promotion
345
+
346
+ ## [1.6.6] - 2026-02-16
347
+
348
+ ### Added
349
+
350
+ - **`promote_from_repo` tool**: New mutation tool that scans a local Git repository and promotes its knowledge content (constitutions, docs, instructions, specs) into the instruction catalog. Supports `.specify/config/promotion-map.json` for explicit source→instruction mappings and automatic `instructions/*.json` discovery. Features SHA-256 content hash dedup, scope filtering, dry-run mode, force re-promote, and custom repoId override. Replaces per-repo promotion logic with a centralized server-side tool.
351
+ - **15 unit tests** for `promote_from_repo` covering promotion-map, instruction file scanning, scope filtering, content hash dedup, force flag, dry-run, repoId override, error handling, and malformed file resilience.
352
+ - **TOOLS.md** documentation for `promote_from_repo` tool.
353
+
354
+ ## [1.6.5] - 2026-02-13
355
+
356
+ ### Changed
357
+
358
+ - **Tool name separator**: Renamed all 44 MCP tool names from slash (`/`) to underscore (`_`) format (e.g., `health/check` → `health_check`, `instructions/dispatch` → `index_dispatch`). Underscore naming improves compatibility across MCP clients and avoids path-separator ambiguity.
359
+ - **Dispatch schema**: Added `listScoped` and `getEnhanced` to the `index_dispatch` action enum so these actions are no longer blocked by schema validation.
360
+
361
+ ### Fixed
362
+
363
+ - **`feedback_get` / `feedback_update` not-found handling**: Changed from throwing MCP error -32603 to returning a graceful `{ notFound: true, id, hint }` response, consistent with `index_dispatch get` behavior.
364
+
365
+ ### Documentation
366
+
367
+ - Updated README.md, TOOLS.md, and MIGRATION.md to reflect underscore tool naming convention.
368
+
369
+ ## [Unreleased]
370
+
371
+ ### Changed (Catalog Configuration)
372
+
373
+ - **Configurable body max length**: Added `INDEX_SERVER_BODY_MAX_LENGTH` environment variable (default: 20000, range: 1000–1000000) to control the maximum body character length for instruction entries. The JSON schema ceiling is 1MB; the runtime config controls effective enforcement.
374
+ - **Enhanced salvage for missing fields**: Missing `audience` now defaults to `all` (salvage counter: `audienceMissing`), missing `requirement` defaults to `recommended` (counter: `requirementMissing`). Previously, entries without these fields were hard-rejected.
375
+ - **Body truncation always applies**: Removed the 24K ceiling on body truncation salvage. Bodies exceeding the configured limit are always truncated, regardless of how far over they are.
376
+ - **Near-limit warning is relative**: The `body:near-limit` soft warning now triggers at 90% of the configured body max length instead of a hardcoded 18K threshold.
377
+ - **Rejection logging**: Schema and classification rejections are now logged to stderr at info level (`[catalog:skip] filename: reason`) for operational visibility without requiring trace mode.
378
+ - **Schema body maxLength bumped to 1MB**: The JSON schema `instruction.schema.json` body `maxLength` raised from 20000 to 1000000 to serve as a permissive ceiling; the runtime `INDEX_SERVER_BODY_MAX_LENGTH` config controls the effective limit.
379
+
380
+ ### Changed (Schema & Migration)
381
+
382
+ - **contentType now required**: Added `contentType` to required properties in instruction.schema.json (Schema v3)
383
+ - Updated `migrateInstructionRecord()` to add `contentType='instruction'` default for backward compatibility
384
+ - Enhanced groom handler to apply migration logic during catalog operations
385
+ - Updated normalize handler to ensure contentType is added to all instructions
386
+ - Production migration: All 138 production instructions updated with contentType field
387
+ - Migration scripts: Added `scripts/add-contenttype-prod.ps1` for bulk updates
388
+ - Reference: Schema version 3, commit 598f90d
389
+
390
+ ### Fixed (MCP Protocol Compliance)
391
+
392
+ - **CRITICAL:** Eliminated stdout contamination violating MCP stdio transport specification. Server was writing diagnostic messages to stdout, contaminating the JSON-RPC message stream and causing PowerShell MCP client connection failures.
393
+ - Changed `MetricsCollector.ts`: 4 instances of `console.log()` → `console.error()` (storage mode, clear messages)
394
+ - Changed `memoryMonitor.ts`: 9 instances of `console.log()` → `console.error()` (monitoring lifecycle, snapshots, utilities)
395
+ - Fixed `sdkServer.ts`: Corrected literal `\n` escape sequences that broke TypeScript compilation
396
+ - Impact: stdout now contains ONLY JSON-RPC messages (MCP spec compliant), stderr contains all diagnostic/debug logging
397
+ - Fixes: PowerShell MCP client timeout issue caused by non-JSON lines in stdout stream
398
+ - Reference: https://modelcontextprotocol.io/docs/concepts/transports
399
+
400
+ ### Enhanced (Handshake Diagnostics)
401
+
402
+ - Added comprehensive handshake diagnostic logging when `INDEX_SERVER_LOG_DIAG=1`:
403
+ - Early stdin buffer: Shows captured chunk preview, Content-Length detection, hasInitialize detection
404
+ - Replay diagnostics: Detailed chunk replay with preview of first chunk content
405
+ - Transport initialization: stdin listener count tracking, readable state monitoring
406
+ - Enhanced visibility for debugging client connection issues
407
+ - Improved error handling for handshake buffer replay with structured error messages
408
+
409
+ ### Added (Testing Infrastructure)
410
+
411
+ - Created `test-stdin-race.js`: Node.js test client simulating PowerShell behavior (immediate initialize)
412
+ - Created `test-powershell-client.ps1`: PowerShell test harness for real client connection testing
413
+ - Created `STDOUT-CONTAMINATION-FIX.md`: Comprehensive documentation of stdout contamination issue and fix
414
+ - Created `POWERSHELL-CLIENT-ANALYSIS.txt`: Detailed analysis of PowerShell client timeout issue (13968 lines)
415
+
416
+ ### Changed (Previous)
417
+
418
+ - Dashboard: Added performance (CPU + Memory) card visual baseline snapshot (`performance-card-*`).
419
+ - UI: Refactored drilldown controls into horizontal grouped layout with standardized checkbox styling.
420
+ - Tests: Promoted performance card snapshot to mandatory Playwright baseline; removed legacy optional skips via deterministic seeding.
421
+ - Logging: Introduced dual-format (structured JSON vs concise plain) logging for WebSocket connect/disconnect/error and memory deltas using existing `INDEX_SERVER_DEBUG` / `INDEX_SERVER_VERBOSE_LOGGING` flags (no new env vars added). Multi-line memory change logs replaced with single-line structured or concise output to eliminate downstream JSON parse warnings.
422
+
423
+ ## [1.6.2] - 2025-09-20
424
+
425
+ ### Changed (configuration & mutation gating)
426
+
427
+ - Unified mutation enable flag under consolidated `INDEX_SERVER_MUTATION`; legacy `INDEX_SERVER_ENABLE_MUTATION` still accepted with one-time deprecation warning via `runtimeConfig.parseMutation()`.
428
+ - Server transport, instruction handlers, and dashboard admin panel now all query `getRuntimeConfig().mutationEnabled` ensuring consistent behavior in tests and production.
429
+ - Updated gating error message to reference `INDEX_SERVER_MUTATION=1` (retains legacy mention for transition).
430
+
431
+ ### Added (test infrastructure)
432
+
433
+ - Introduced shared dashboard readiness helper `waitForDashboard.ts` eliminating ad‑hoc polling loops across graph-related tests.
434
+
435
+ ### Fixed (flaky tests)
436
+
437
+ - Stabilized `graphFiltering.spec.ts`, `graphFilteringStyles.spec.ts`, and `graphThemeVariables.spec.ts` by awaiting deterministic dashboard startup (previous 15s timeouts reduced to reliable ~15s execution within extended 20s cap).
438
+
439
+ ### Internal (refactor / hygiene)
440
+
441
+ - Removed direct `process.env.INDEX_SERVER_ENABLE_MUTATION` hot path checks in favor of runtime configuration accessor (dynamic reload when only legacy flag present preserves prior semantics).
442
+ - Minor import cleanup after consolidation (removed unused `getBooleanEnv` references where replaced by runtime config).
443
+
444
+ ### Upgrade Guidance (1.6.2)
445
+
446
+ - Prefer setting `INDEX_SERVER_MUTATION=1` going forward. Existing automation using `INDEX_SERVER_ENABLE_MUTATION=1` continues to work (deprecation window). Plan future release to drop legacy flag once downstream usage metrics indicate adoption.
447
+ - No schema or tool contract changes; safe patch update.
448
+
449
+ ### Future (1.6.2 follow-up)
450
+
451
+ - Schedule removal of legacy mutation flag references in help text and admin dashboard after confirming negligible usage (target ≥90% replacement) and possibly introduce `INDEX_SERVER_CONFIG_STRICT` to enforce consolidated variable set.
452
+
453
+ ### Configuration Consolidation (Phases 1–4)
454
+
455
+ - Added unified runtime configuration loader `src/config/runtimeConfig.ts` centralizing parsing & normalization of environment variables.
456
+ - Introduced consolidated variables: `INDEX_SERVER_TIMING_JSON`, `INDEX_SERVER_TEST_MODE`, `INDEX_SERVER_LOG_LEVEL`, `INDEX_SERVER_MUTATION`, `INDEX_SERVER_TRACE` (token set), with future placeholders (`INDEX_SERVER_BUFFER_RING`).
457
+ - Backward compatibility: legacy flags (`FAST_COVERAGE`, `MANIFEST_TEST_WAIT_DISABLED_MS`, `MANIFEST_TEST_WAIT_REPAIR_MS`, `INDEX_SERVER_ENABLE_MUTATION`, verbose/diag log flags) auto-mapped with one-time deprecation warnings.
458
+ - Pilot migration: `manifestEdgeCases.spec.ts` refactored to consume timing via `cfg.timing()` accessor; remaining high-churn tests scheduled for follow-up phases.
459
+ - Documentation updates: README consolidation section, deployment matrix extended with migration notes, contributing guidelines prohibit new ad-hoc env vars, configuration guide cross-referenced.
460
+ - Coverage gating integrated with loader (`runtimeConfig.coverage`) maintaining dual-threshold (`COVERAGE_HARD_MIN`, `COVERAGE_TARGET`).
461
+ - Established future Phase 5 plan: optional strict mode (`INDEX_SERVER_CONFIG_STRICT=1`) to reject unmapped legacy flags once adoption threshold met (target ≥70% migrated usages).
462
+
463
+
464
+ ### Added (dispatcher capabilities & batch)
465
+
466
+ ### Documentation (overhaul 1.4.2)
467
+
468
+ - Added `docs/MANIFEST.md` detailing catalog manifest lifecycle, invariants, drift categories, opportunistic materialization, and fastload roadmap.
469
+ - Updated `README.md` with Manifest & Opportunistic Materialization section; added MANIFEST doc links in primary doc suite lists.
470
+ - Updated `PROJECT_PRD.md` to version 1.4.2 including formal Manifest & Materialization requirements (MF1–MF7) and ratified schema‑aided failure contract.
471
+ - Updated `ARCHITECTURE.md` (version banner 1.4.1 → context now aligned with opportunistic materialization & manifest helper) – cross-linked manifest semantics.
472
+ - Updated `DOCS-INDEX.md` adding Manifest category; refreshed recent updates section for 1.4.x runtime changes.
473
+ - Removed deprecated PRD stub files (`docs/PRD.md`, `docs/PROJECT-PRD.md`) to eliminate duplication; canonical remains `docs/PROJECT_PRD.md`.
474
+ - Ensured CHANGELOG references preserved and future fastload placeholder documented (no runtime effect yet).
475
+
476
+ ### Changed (readability & consistency)
477
+
478
+ - Standardized terminology: "Opportunistic Materialization" (replaces ambiguous "late materialization" phrasing) across updated docs.
479
+ - Clarified disable flag guidance for `INDEX_SERVER_MANIFEST_WRITE=0` (diagnostic/read-only only).
480
+
481
+
482
+ ### Fixed (persistence phantom write false positive)
483
+
484
+ - Reclassified `instructionsPersistenceDivergence.red.spec.ts` to GREEN (`instructionsPersistenceDivergence.spec.ts`).
485
+ - Root cause: baseline drift (IDs under test already existed) causing stable count/hash and perceived phantom writes.
486
+ - Added adaptive assertions: if IDs are new, count/hash must change; pure overwrite path allows stable hash but guarantees visibility.
487
+ - Removed heavy multi-flag RED gating for this scenario (now validated by normal suite).
488
+
489
+ ### Governance (baseline noise suppression)
490
+
491
+ - Updated `scripts/guard-baseline.mjs` allow-list (noise suppression only) to include:
492
+ - `httpMetrics.spec.ts` (HTTP instrumentation coverage)
493
+ - `instructionsPersistenceDivergence.spec.ts` (adaptive GREEN replacement test)
494
+ - `dashboardPhase1.spec.ts` (dashboard infra wiring)
495
+ - `dashboardRpmStability.spec.ts` (RPM metrics stability)
496
+ (No minimal invariant expansion; internal baseline policy unchanged.)
497
+
498
+ ## [1.4.0] - 2025-09-13
499
+
500
+ ### Added (manifest observability & helper)
501
+
502
+ - Centralized manifest update helper `attemptManifestUpdate()` consolidates all post‑mutation catalog manifest writes (future hook point for batching/debounce without changing call sites).
503
+ - Structured manifest write log lines: `[manifest] wrote catalog-manifest.json count=<entryCount> ms=<duration>` emitted only on successful writes.
504
+ - New counters:
505
+ - `manifest:write` – incremented on each successful manifest write
506
+ - `manifest:writeFailed` – incremented when an exception occurs during write
507
+ - `manifest:hookError` – incremented when update hook invocation throws
508
+ - Environment flag `INDEX_SERVER_MANIFEST_WRITE=0` disables manifest persistence (read-only / diagnostic mode) while allowing normal runtime behavior.
509
+
510
+ ### Fixed (visibility flake)
511
+
512
+ - Stabilized intermittent add → immediate list/get visibility timing by refining late materialization path and adding targeted retry logic in `addVisibilityInvariant.spec.ts` (single bounded retry, preserves genuine failure signal).
513
+
514
+ ### Tests (edge coverage)
515
+
516
+ - New `manifestEdgeCases.spec.ts` validating:
517
+ - Disabled write mode respects `INDEX_SERVER_MANIFEST_WRITE=0` (no file created/modified)
518
+ - Corrupted on-disk manifest auto‑repair after subsequent catalog mutation
519
+ - Visibility invariant test enhanced with diagnostic trace & retry instrumentation (now consistently green).
520
+
521
+ ### Documentation
522
+
523
+ - README: Added Manifest Observability section, documented new counters & `INDEX_SERVER_MANIFEST_WRITE` flag plus reserved `INDEX_SERVER_MANIFEST_FASTLOAD` (planned fast load optimization – inactive placeholder).
524
+ - CONFIGURATION guide: Added Manifest Configuration section & environment variable table entries.
525
+ - CHANGELOG: This entry formalizes helper + observability release.
526
+
527
+ ### Internal (refactor & safety)
528
+
529
+ - Removed scattered try/catch blocks around manifest writes in instruction mutation handlers; all now route through helper ensuring unified error handling & metrics.
530
+ - Preserved existing manifest drift detection & repair logic (no behavioral change when flag unset).
531
+
532
+ ### Compatibility (1.4.0)
533
+
534
+ - No instruction schema or tool interface changes.
535
+ - Purely additive logging & metrics; safe transparent upgrade for all clients.
536
+ - When `INDEX_SERVER_MANIFEST_WRITE=0`, runtime skips writes silently (counter increments suppressed) – intended only for diagnostics / perf profiling.
537
+
538
+ ### Upgrade Guidance (1.4.0)
539
+
540
+ - Pull & rebuild – no client changes required.
541
+ - To disable manifest file writes for diagnostics: set `INDEX_SERVER_MANIFEST_WRITE=0` (do not use in production if you rely on external manifest consumers).
542
+ - Monitoring systems may now scrape manifest counters alongside existing metrics buckets.
543
+
544
+ ### Future (not included – 1.4.0 roadmap)
545
+
546
+ - Planned `INDEX_SERVER_MANIFEST_FASTLOAD` optimization mode (hash/mtime short‑circuit) reserved; currently no effect (documented as placeholder only).
547
+
548
+ ## [1.4.1] - 2025-09-14
549
+
550
+ ### Fixed (dashboard health accuracy)
551
+
552
+ - Resolved persistent false positive "Statistics unavailable" issue: local `statsAvailable` shadowed global flag so health card always injected the warning despite successful stats fetches. Now uses `window.statsAvailable` consistently.
553
+ - Restored memory utilization health check (`mem: ok` / fail at ≥90% heap usage) alongside CPU derived check when backend omits explicit entries.
554
+
555
+ ### Changed (UI consistency)
556
+
557
+ - Unified overview card styling with Real‑time Monitoring card via new shared `.stat-row` styles (consistent spacing, typography, separators).
558
+ - Added stronger label/value contrast and tabular numeric alignment across System Statistics, System Health, and Performance cards.
559
+
560
+ ### Internal (refactor / cleanup)
561
+
562
+ - Removed accidentally injected diagnostic block from `applyInstructionTemplate` (caused earlier syntax noise during patch).
563
+ - Hardened health rendering defensive normalization & comments clarifying derived check thresholds (CPU <85% ok, Memory <90% ok).
564
+
565
+ ### Notes (1.4.1)
566
+
567
+ - Pure UI + client-side logic update; no API or schema changes.
568
+ - Safe patch upgrade; no restart flags required beyond standard rebuild/deploy.
569
+
570
+ ### Upgrade Guidance (1.4.1)
571
+
572
+ - Pull, rebuild, redeploy. Dashboard automatically reflects new styling; no configuration changes.
573
+
574
+
575
+ ## [1.2.1] - 2025-09-05
576
+
577
+ ## [1.3.0] - 2025-09-10
578
+
579
+ ## [1.3.1] - 2025-09-11
580
+
581
+ ### Fixed (governance overwrite semantics)
582
+
583
+ - Added safe metadata-only overwrite hydration: when `overwrite:true` and body omitted, handler now hydrates existing body/title before validation allowing pure governance updates (e.g., priority + version bump) without resending full content.
584
+ - Corrected `overwritten` flag reporting for metadata-only higher version updates (previously returned `overwritten:false`).
585
+ - Enforced strict semantic version validation on create path (previously only validated updates) returning `invalid_semver` for malformed versions.
586
+
587
+ ### Internal (test reliability)
588
+
589
+ - Targeted governance versioning tests now all green: auto bump, non-semver rejection, body change bump requirements, metadata-only version increment.
590
+ - Added hydration logic with type-safe mutation (no `any` casts) to satisfy linting.
591
+
592
+ ### Notes (1.3.1 governance follow-up)
593
+
594
+ - No changes to on-disk schema; patch release focused on correctness & ergonomics.
595
+ - Recommended for users performing frequent governance-only edits to reduce payload size and maintain accurate overwrite telemetry.
596
+
597
+ ### Added (schema v3 & governance)
598
+
599
+ - Introduced on-disk instruction schemaVersion `3` with new `primaryCategory` field enforcing a single canonical category reference.
600
+ - Automatic migration path (v1→v2→v3) updates existing instruction JSON files in-place; adds `primaryCategory` from first existing category and normalizes category list to include it.
601
+ - Added governance justification file `governance/ALLOW_HASH_CHANGE` documenting approved hash shift from structural canonicalization.
602
+
603
+ ### Changed (migration & normalization)
604
+
605
+ - `migrateInstructionRecord` now injects `primaryCategory` for v2 records and ensures `schemaVersion` bump with descriptive notes.
606
+ - Runtime handlers enforce invariant: `primaryCategory ∈ categories[]`; fallback category `uncategorized` only when INDEX_SERVER_REQUIRE_CATEGORY unset.
607
+ - All committed instructions canonicalized (hash drift resolved) to provide stable CI governance baseline.
608
+
609
+ ### Integrity & Tooling
610
+
611
+ - Full test suites (fast + slow) green post-migration; quarantined flaky tests unchanged.
612
+ - Governance hash workflow unblocked via explicit justification artifact.
613
+ - Production deployment updated to version `1.3.0` (no behavior regressions detected).
614
+
615
+ ### Compatibility
616
+
617
+ - Migration is additive; older clients reading instructions ignore unknown `primaryCategory`.
618
+ - Direct downgrade not supported; rollback requires restoring pre-migration backups.
619
+
620
+ ### Documentation (navigation & migration)
621
+
622
+ - Updated MIGRATION guidance (v2→v3 path) and added docs index + instruction usage plan for navigation.
623
+
624
+
625
+ ### Changed (test stability)
626
+
627
+ - Deprecated legacy RED test `instructionsPersistenceDivergence.red.spec.ts` -> converted to inert placeholder (historical context only).
628
+ - Added adaptive GREEN test `instructionsPersistenceDivergence.spec.ts` (creation vs overwrite aware, synthetic hash conditional logic).
629
+ - Eliminated 60s timeout risk from mis-gated RED reproduction path.
630
+
631
+ ### Added (diagnostics)
632
+
633
+ - New `docs/RUNTIME-DIAGNOSTICS.md` detailing runtime triage (handshake timing, persistence verification, metrics inspection).
634
+
635
+ ### Integrity
636
+
637
+ - Suite now green without special gating; persistence divergence scenario validated deterministically (no false positives from baseline drift).
638
+
639
+ ### Governance
640
+
641
+ - Formal change control required (see baseline plan section 14) for any test expansion.
642
+
643
+ ### Handshake Hardening
644
+
645
+ - Implemented early stdin buffering to prevent loss of initial `initialize` frame when clients send immediately on spawn.
646
+ - Removed temporary extended readiness polling loops from CRUD smoke & batch/parameterized tests (now redundant).
647
+ - Added regression test `handshakeTimingRegression.spec.ts` asserting timely initialize response (<15s hard cap, soft warn >5s).
648
+ - Locked handshake path (short-circuit mode removed, version negotiation via spec date retained).
649
+
650
+
651
+ ## [0.1.0] - 2025-08-24
652
+
653
+ ### Added (initial)
654
+
655
+ - Initial project skeleton (models, classification, transport, instruction tools, prompt governance, documentation scaffolding).
656
+
657
+ ## [0.2.0] - 2025-08-25
658
+
659
+ ### Added (metrics & governance)
660
+
661
+ - metrics, gates, usage tracking, incremental diff, integrity tools
662
+
663
+ ## [0.3.0] - 2025-08-25
664
+
665
+ ### Added (dashboard & persistence)
666
+
667
+ - Add response schemas, contract tests, docs update
668
+
669
+ ## [0.4.0] - 2025-08-25
670
+
671
+ ### Added (SDK migration & enhancements)
672
+
673
+ - dashboard + CLI flags; import/export/repair/reload; meta_tools; usage persistence; schema extensions
674
+
675
+ ## [0.5.0] - 2025-08-25
676
+
677
+ ### Changed (supporting artifacts)
678
+
679
+ - Migrated to official @modelcontextprotocol/sdk (removed legacy custom transport)
680
+ - Standardized initialize handshake requiring clientInfo + capabilities.tools
681
+ - Structured JSON-RPC error codes/data (-32602 params, -32601 method, -32603 internal)
682
+
683
+ ### Added (tests & tooling)
684
+
685
+ - server/ready notification via SDK oninitialized hook
686
+ - initialize result now includes human-readable instructions field
687
+ - ping request handler for lightweight health/latency
688
+ - Enhanced unknown tool & mutation gating error data (message, method/tool)
689
+
690
+ ## [0.5.1] - 2025-08-25
691
+
692
+ ### Added (removal capability)
693
+
694
+ - New mutation tool `index_remove` to delete one or more instruction entries by id (requires INDEX_SERVER_ENABLE_MUTATION=1)
695
+
696
+ ### Changed (registry)
697
+
698
+ - Tool registry & schemas updated to expose remove capability
699
+
700
+ ## [0.5.2] - 2025-08-25
701
+
702
+ ### Added (single add capability)
703
+
704
+ - New mutation tool `index_add` (single entry, lax mode default filling, optional overwrite)
705
+
706
+ ### Changed (result shape & docs)
707
+
708
+ - Aligned result shape for skip path (always includes created/overwritten booleans)
709
+ - Updated docs and schemas to reflect new tool
710
+
711
+ ## [0.5.3] - 2025-08-25
712
+
713
+ ### Added (catalog grooming)
714
+
715
+ - New mutation tool `index_groom` for normalization, duplicate merging, hash repair, deprecated cleanup (supports dryRun mode)
716
+
717
+ ### Changed (registry & docs)
718
+
719
+ - Added schema, registry entry, tests, and documentation for grooming
720
+
721
+ ## [0.6.0] - 2025-08-25
722
+
723
+ ### Added (structured scoping)
724
+
725
+ - Introduced structured scope fields on instructions: workspaceId, userId, teamIds
726
+ - Classification now derives these from legacy category prefixes (scope:workspace:*, scope:user:*, scope:team:*) and strips them from categories
727
+ - New read-only tool `instructions/listScoped` selects best matching scope (user > workspace > team > all)
728
+ - JSON Schemas, registry version, and package version bumped
729
+
730
+ ### Changed (groom enhancement)
731
+
732
+ - Groom tool now supports `purgeLegacyScopes` mode flag removing legacy scope:* category tokens and reports `purgedScopes` metric
733
+
734
+ ### Notes (1.0.3)
735
+
736
+ - Backward compatibility: existing category-based scope prefixes still recognized; groom tool can later remove them
737
+
738
+ ## [0.7.0] - 2025-08-25
739
+
740
+ ### Changed (Tier 1 schema simplification)
741
+
742
+ - Relaxed instruction JSON schema: only authoring essentials now required (`id,title,body,priority,audience,requirement,categories`)
743
+ - `additionalProperties` enabled to allow forward-compatible governance extensions without breaking authors
744
+ - Loader & enrichment narrowed: removed automatic placeholder injection for most governance fields (now derived in-memory)
745
+
746
+ ### Added (dispatcher)
747
+
748
+ - Minimal author path test (`minimalAuthor.spec.ts`) ensuring derivation of version, priorityTier, semanticSummary, review cycle
749
+ - Multi-add persistence test clarifying intentional ignoring of user-supplied governance overrides in `index_add`
750
+
751
+ ### Removed / Simplified
752
+
753
+ - Excess placeholder governance fields from test fixtures and baseline instruction JSON files
754
+ - Enrichment tool now only persists missing `sourceHash`, `owner` (if auto-resolved), `priorityTier`, `semanticSummary`
755
+
756
+ ## [0.8.0] - 2025-08-25
757
+
758
+ ### Added (governance patching)
759
+
760
+ - New mutation tool `index_governanceUpdate` enabling controlled patch of `owner`, `status`, review timestamps, and optional semantic version bump (`patch|minor|major`)
761
+ - README documentation for simplified schema + governance patch workflow
762
+
763
+ ### Changed (schemas & docs)
764
+
765
+ - Tool registry updated (schema + mutation set) and description added
766
+ - Registry version implicitly advanced; package version bumped
767
+
768
+ ### Rationale (consolidation)
769
+
770
+ - Decouples routine content edits from governance curation; reduces author friction while maintaining an auditable lifecycle
771
+
772
+ ## [0.9.0] - 2025-08-27
773
+
774
+ ### Breaking (dispatcher consolidation)
775
+
776
+ - Removed legacy read-only instruction tools: `instructions/list`, `instructions/listScoped`, `instructions/get`, `index_search`, `instructions/diff`, `instructions/export`
777
+ - Added unified dispatcher tool `index_dispatch` supporting actions: `list`, `listScoped`, `get`, `search`, `diff`, `export`, `query`, `categories`, `dir`, plus mutation/governance actions: `add`, `import`, `remove`, `reload`, `groom`, `repair`, `enrich`, `governanceHash`, `governanceUpdate`, `health`, `inspect`, `dir`, `capabilities`, `batch`
778
+ - Tests and internal registry updated to only surface `index_dispatch` (reduces tool surface for clients, simplifies capability negotiation)
779
+
780
+ ### Added
781
+
782
+ - Dispatcher batch execution (`action: "batch"`) to perform multiple sub-actions in one round trip
783
+ - Capabilities action returning: `{ version, supportedActions, mutationEnabled }`
784
+ - Negative schema drift test migrated to dispatcher schema
785
+ - Regenerated `docs/TOOLS-GENERATED.md` to reflect dispatcher (single tool surface + flexible schema)
786
+ - Added dispatcher capabilities & batch test suites (`dispatcherCapabilities.spec.ts`, `dispatcherBatch.spec.ts`)
787
+
788
+ ### Changed
789
+
790
+ - Schemas: removed per-method instruction response schemas; introduced flexible dispatcher response schema (loose anyOf) for rapid iteration
791
+ - Documentation (TOOLS, PRD) pending full rewrite to reflect dispatcher (will land immediately post-merge)
792
+
793
+ ### Migration Guide (1.0.0)
794
+
795
+ | Old | New (dispatcher) |
796
+ |-----|------------------|
797
+ | instructions/list | index_dispatch { action:"list", ... } |
798
+ | instructions/listScoped | index_dispatch { action:"listScoped", ... } |
799
+ | instructions/get | index_dispatch { action:"get", id } |
800
+ | index_search | index_dispatch { action:"search", q } |
801
+ | instructions/diff | index_dispatch { action:"diff", clientHash?, known? } |
802
+ | instructions/export | index_dispatch { action:"export", ids?, metaOnly? } |
803
+
804
+ ### Rationale (1.0.0)
805
+
806
+ Unifying read-only catalog operations behind a single tool reduces handshake/tool enumeration overhead, enables richer batching, and provides a single stability / gating surface. Future specialized actions (advanced query planner) can ship without expanding the top-level tool set.
807
+
808
+ ## [0.9.1] - 2025-08-27
809
+
810
+ ### Changed (test suite & reliability)
811
+
812
+ - Eliminated all skipped tests; expanded suite to 125 assertions across 69 files (dispatcher, governance hash stability, enrichment, error paths, property-based grooming, usage gating).
813
+ - Strengthened dispatcher, transport core, governance update, and error-path coverage (malformed JSON-RPC, unknown methods) with deterministic waits & diagnostics.
814
+ - Seeded property-based groom idempotence test for reproducibility.
815
+ - Added explicit feature flag enable/disable coverage (usage gating & feature_status reporting).
816
+
817
+ ### Added (documentation)
818
+
819
+ - Updated README test section (current counts, no skips) and clarified dispatcher-only surface & mutation gating.
820
+ - Clarified architecture doc to reflect 0.9.x dispatcher consolidation (previous note referenced 0.8.x only).
821
+ - Refreshed tools registry generated notes for stabilization pass.
822
+
823
+ ### Internal (1.0.0)
824
+
825
+ - No API surface changes vs 0.9.0 (patch release). Dispatcher contract & tool schemas unchanged.
826
+ - Pure documentation + test reliability improvements; safe for consumers.
827
+
828
+ ### Upgrade Guidance
829
+
830
+ No action required for clients already on 0.9.0. Optional: pull to benefit from fuller test coverage and clarified documentation.
831
+
832
+ ## [1.0.0] - 2025-08-27
833
+
834
+ ### Breaking Changes
835
+
836
+ - Removed all legacy direct JSON-RPC per-tool method handlers (e.g. calling `health_check` directly). Clients MUST use `tools/call` with `{ name:"<tool>" }`.
837
+ - Removed underscore alias methods (e.g. `health_check`, `metrics_snapshot`, `usage_track`, etc.). Canonical slash-form tool names only.
838
+ - Removed fallback minimal stdio transport path (SDK transport now required; process exits fast if unavailable).
839
+ - Removed Ajv validation layer for direct handlers (tool argument validation remains schema-based internally where needed or enforced by tool logic).
840
+
841
+ ### Added / Changed
842
+
843
+ - Simplified handshake: deterministic ordering `initialize` response -> single `server/ready` -> optional `tools/list_changed` (idempotent ready emitter with trace logging via `INDEX_SERVER_HANDSHAKE_TRACE=1`).
844
+
845
+ ## [1.0.3] - 2025-08-28
846
+
847
+ ### Fixed (handshake determinism & flake elimination)
848
+
849
+ - Resolved intermittent minimal handshake test flake where `initialize` result line was occasionally not captured before `server/ready` notification. Root cause: race between stdout write callback scheduling and line buffering in tight spawn harness.
850
+ - Emit minimal server initialize response synchronously via `fs.writeSync(1, ...)` ensuring flush ordering; schedule `server/ready` via `setImmediate` for strict sequencing.
851
+ - Hardened `minimalHandshake.spec.ts` with diagnostic dump and stricter pattern.
852
+
853
+ ### Added (minimal reference server)
854
+
855
+ - Introduced `src/minimal/` lightweight reference implementation exercising only `initialize`, `server/ready`, `tools/list_changed`, `ping/health` pathways for rapid protocol regression detection.
856
+
857
+ ### Deployment
858
+
859
+ - Deployment script now succeeds with added minimal server artifacts; production bundle verified post-change. Addressed earlier invalid script key by using dash form `start-minimal` (avoid colon which is invalid in npm script names on some environments).
860
+
861
+ ### Notes (feedback introduction)
862
+
863
+ - All core handshake, latency, governance, and dispatcher suites pass consistently post-fix (multiple consecutive full runs, zero handshake ordering failures after synchronous emission patch).
864
+ - Added structured handshake trace events (`initialize_received`, `ready_emitted`, watchdog diagnostics) for observability.
865
+ - Hardened tool list change ordering: prevents premature `tools/list_changed` before `server/ready`.
866
+ - Updated tests to exclusively exercise `tools/call` path (`transport.spec.ts`, `responseEnvelope.spec.ts`, latency & coverage suites).
867
+
868
+ ### Migration Guide
869
+
870
+ | Legacy Pattern | 1.0+ Replacement |
871
+ |----------------|------------------|
872
+ | `{ method:"health_check" }` | `{ method:"tools/call", params:{ name:"health_check", arguments:{} } }` |
873
+ | `{ method:"health_check" }` | (unsupported) use canonical above |
874
+ | `{ method:"metrics_snapshot" }` | `{ method:"tools/call", params:{ name:"metrics_snapshot" } }` |
875
+ | Direct instruction tool names (dispatcher unaffected) | Use dispatcher or existing canonical tool via tools/call |
876
+
877
+ ### Rationale
878
+
879
+ Removing back-compat surfaces reduces ambiguity in clients, eliminates duplicate execution pathways, and tightens protocol compliance (single ready emission, no early notifications). Observability via trace events aids debugging without impacting normal stderr noise (opt-in flag).
880
+
881
+ ### Upgrade Notes
882
+
883
+ - Update any bespoke clients or scripts invoking legacy underscore methods to the canonical names via `tools/call`.
884
+ - Ensure environment expects a single `server/ready` notification; multi-ready tolerant clients remain unaffected.
885
+ - If you previously relied on the fallback transport, adopt the standard MCP SDK JSON-RPC stdio framing; no additional configuration needed for normal usage.
886
+
887
+ ### Internal (refinement)
888
+
889
+ - Removed ~300 lines of legacy compatibility code; reduced handshake race conditions and watchdog complexity.
890
+ - Test suite adjusted; alias test removed.
891
+
892
+ ### Future
893
+
894
+ - Potential addition: explicit protocolVersion negotiation matrix & structured `capabilities.handshake` section once MCP spec advances.
895
+
896
+ ## [1.0.1] - 2025-08-27
897
+
898
+ ### Changed (semantic error guarantees)
899
+
900
+ - Hardened JSON-RPC semantic error preservation: dispatcher validation/gating codes (-32601 / -32602) are now deterministically retained end-to-end (previous rare fallbacks to -32603 eliminated).
901
+ - Added deep semantic recovery & diagnostic logging (`[rpc] deep_recover_semantic`) in `sdkServer` request override for visibility when nested wrappers obscure codes.
902
+ - Tightened tests: removed transitional allowances for -32603 in dispatcher validation & mutation gating specs; assertions now require exact expected semantic codes.
903
+
904
+ ### Added (stress coverage)
905
+
906
+ - New `dispatcherStress.spec.ts` high-churn test exercising rapid invalid + valid dispatcher calls to detect any semantic code downgrades.
907
+ - Supplementary logging gated by `INDEX_SERVER_LOG_VERBOSE=1` to trace pass-through vs wrapped error paths.
908
+
909
+ ### Internal (maintenance)
910
+
911
+ - Updated `.gitignore` to exclude transient fuzz/concurrency instruction artifacts, build locks, and temp minimal-author scratch directories.
912
+ - Incremented package version to 1.0.1 (patch: reliability & test hardening only; no API changes).
913
+
914
+ ### Upgrade Guidance (1.0.1)
915
+
916
+ No action required. Clients benefit from stricter and more predictable error codes; behavior of successful tool results unchanged.
917
+
918
+ ## [1.0.2] - 2025-08-27
919
+
920
+ ### Changed (test gating & stability)
921
+
922
+ - Segregated nondeterministic / adversarial fuzz & stress specs behind `INDEX_SERVER_STRESS_DIAG=1` (handshake flake, mixed workload health starvation repro, multi‑process health stress, dispatcher stress/flake, concurrency fuzz).
923
+ - Baseline test run (without flag) now deterministic: all core + compliance + governance suites green; stress specs appear as skipped (documented) eliminating prior intermittent CI noise.
924
+ - Added skip pattern helper (`maybeIt`) in gated specs for clear opt‑in semantics.
925
+
926
+ ### Added (tooling & scripts)
927
+
928
+ - New npm scripts: `test:stress` (full suite with stress enabled) and `test:stress:focus` (runs only gated stress specs) for quicker iterative diagnosis.
929
+ - Added README section "Stress / Adversarial Test Suite" enumerating gated spec files and usage examples.
930
+
931
+ ### Diagnostics / Observability
932
+
933
+ - Retained synthetic initialize fallback path but fully gated by `INDEX_SERVER_INIT_FALLBACK_ALLOW` (off by default) with compliance test (`healthMixedNoFallback.spec.ts`) ensuring no synthetic initialize in normal operation.
934
+ - Expanded handshake trace logging clarifying fallback gating decisions (`init_unconditional_fallback_skip gating_off`).
935
+
936
+ ### CI / Reliability
937
+
938
+ - Prepared nightly stress workflow (scheduled) to exercise stress suite with `INDEX_SERVER_STRESS_DIAG=1` without impacting mainline CI signal (separate job, non-blocking).
939
+
940
+ ### Internal (catalog & runtime)
941
+
942
+ - Version bumped to `1.0.2` (patch: reliability & test ergonomics only; no API surface changes).
943
+
944
+ ### Upgrade Guidance (1.0.2)
945
+
946
+ No client changes required. Consumers may optionally run the stress suite locally when diagnosing latency / starvation conditions:
947
+
948
+ ```bash
949
+ INDEX_SERVER_STRESS_DIAG=1 npm test # run full suite including stress
950
+ INDEX_SERVER_STRESS_DIAG=1 npm run test:stress # equivalent convenience script
951
+ ```
952
+
953
+ For routine CI or local verification omit the flag for deterministic results.
954
+
955
+ ## [1.0.4] - 2025-08-28
956
+
957
+ ### Added (feedback / emit system)
958
+
959
+ - New MCP-compliant feedback tool suite:
960
+ - `feedback_submit`
961
+ - `feedback_list`
962
+ - `feedback_get`
963
+ - `feedback_update`
964
+ - `feedback_stats`
965
+ - `feedback_health`
966
+ - Persistent JSON storage (`feedback/feedback-entries.json`) with max entry cap (`INDEX_SERVER_FEEDBACK_MAX_ENTRIES`, default 1000) and trimming.
967
+ - Structured feedback model (type, severity, status workflow, tags, metadata, context) with audit logging.
968
+ - Security & critical feedback entries mirrored to stderr for immediate visibility.
969
+ - Health endpoint reporting storage accessibility, writability, configured directory.
970
+ - Statistics endpoint aggregating totals by type/severity/status plus recent activity windows (24h/7d/30d).
971
+ - Environment configurables: `INDEX_SERVER_FEEDBACK_DIR`, `INDEX_SERVER_FEEDBACK_MAX_ENTRIES`.
972
+ - Documentation: README & TOOLS.md sections describing usage, schemas, and examples.
973
+
974
+ ### Changed (infrastructure)
975
+
976
+ - `.gitignore` updated to exclude persisted feedback storage artifacts.
977
+ - Tool registry extended with feedback tools (stable read-only vs mutation semantics maintained where applicable).
978
+
979
+ ### Notes (cleanup hygiene)
980
+
981
+ - Feature addition only; no breaking changes to existing instruction dispatcher or governance tools.
982
+ - Version bump to 1.0.4 reflects new externally visible tool surface.
983
+
984
+ ## [1.0.5] - 2025-08-28
985
+
986
+ ### Changed (test stability & isolation)
987
+
988
+ - Refactored feedback test suite:
989
+ - Introduced `feedbackCore.spec.ts` (comprehensive) & `feedbackSimple.spec.ts` (smoke) with per‑test isolated `INDEX_SERVER_FEEDBACK_DIR` directories.
990
+ - Converted brittle absolute "empty list" assertions to delta-based assertions; legacy expectations gated with `it.skip(... // SKIP_OK)` for documentation without flakiness.
991
+ - Added deterministic persistence wait loop for filesystem write visibility.
992
+ - Replaced dynamic requires with explicit static imports (avoids MODULE_NOT_FOUND under variant names).
993
+ - Added legacy placeholder `feedback.spec.ts` (kept minimal) to preserve historical references.
994
+
995
+ ### Fixed (rate limiting correctness)
996
+
997
+ - Reordered rate limiting logic in catalog usage tracking so entry creation/load occurs before limit evaluation preventing cross-id phantom rate limits.
998
+ - Added invariants ensuring usageCount reflected accurately in rate-limited responses.
999
+
1000
+ ### Added (governance & content guidance)
1001
+
1002
+ - New `CONTENT-GUIDANCE.md` clarifying instruction classification, promotion workflow, and MCP protocol separation of concerns.
1003
+ - Explicit MCP compliance guidance: do NOT embed tool catalogs/schemas inside instruction content (dynamic discovery via protocol only).
1004
+
1005
+ ### Documentation (1.1.1)
1006
+
1007
+ - Expanded TOOLS.md & README with Feedback System Features section.
1008
+ - Clarified short-circuit / minimal handshake modes and environment flags (previous sections consolidated).
1009
+
1010
+ ### Internal / Quality
1011
+
1012
+ - Guarded optional `since` parameter access in feedback list & stats handlers (eliminates TS18048 risk under strict mode).
1013
+ - Added commit helper tasks for structured documentation and feature commits.
1014
+ - All core + contract tests passing (168 passed / 14 skipped – skips limited to explicitly gated stress & legacy expectations).
1015
+
1016
+ ### Notes (stabilization)
1017
+
1018
+ - Patch release (1.0.5) focuses on stabilization & correctness refinements immediately following new feedback feature introduction.
1019
+ - No further tool surface changes beyond feedback system introduced in 1.0.4.
1020
+
1021
+ ### Upgrade Guidance (1.0.5)
1022
+
1023
+ - Consumers upgrading from 1.0.4 gain improved determinism in feedback operations & safer usage rate limiting without client changes.
1024
+
1025
+ ## [1.2.0] - 2025-09-05
1026
+
1027
+ ### Added (observability & admin UX)
1028
+
1029
+ - Unified runtime diagnostics guard (`[diag] [ISO] [category]`) capturing uncaught exceptions, unhandled rejections, process warnings, and termination signals with optional exit delay (`INDEX_SERVER_FATAL_EXIT_DELAY_MS`).
1030
+ - Real backup system with millisecond precision IDs (`backup_YYYYMMDDTHHMMSS_mmm`), manifest generation (instructionCount, schemaVersion) and safety pre-restore snapshot.
1031
+ - Admin dashboard backup listing & one‑click restore UI (auto refresh + schemaVersion display).
1032
+ - WebSocket enhancements: client UUID assignment, connect/disconnect broadcast events, immediate metrics snapshot push, active connection metrics integration.
1033
+ - Live synthetic activity per-call trace streaming over WebSocket (`synthetic_trace` messages) with runId, sequence, duration, error, and skipped markers.
1034
+ - Synthetic harness expansion to exercise instruction dispatcher CRUD pathways (`add/get/list/query/update/remove`) plus usage tracking; active in‑flight request counter + status endpoint.
1035
+ - Instruction editor enrichment: diff view, formatting button, diagnostics panel (validity, size, hash, missing fields), template injection, change detection.
1036
+ - HTTP metrics instrumentation aggregating all REST requests into pseudo tool bucket `http/request` (opt-out with `INDEX_SERVER_HTTP_METRICS=0`).
1037
+ - Performance detailed endpoint `/api/performance/detailed` (requestThroughput, avg, p95 approximation, errorRate, concurrentConnections, activeSyntheticRequests).
1038
+
1039
+ ### Changed (tests & reliability)
1040
+
1041
+ - Added `httpMetrics.spec.ts` validating HTTP aggregation bucket increments.
1042
+ - Hardened PowerShell isolation handshake test with BOM stripping, retry initialize, soft-pass degraded mode and extended deadlines to eliminate flakes.
1043
+ - Adaptive sampling + concurrency & duration guard in multi-client feedback reproduction test (dynamic ~0.8% sample, clamped 5–8, 7s hard wallclock) reducing runtime while preserving coverage rotation.
1044
+ - Fast test script (`scripts/test-fast.mjs`) leak guard ensuring slow specs never bleed into fast subset.
1045
+ - Pre-push hook (`scripts/pre-push.ps1`) running slow test suite gating pushes.
1046
+
1047
+ ### Internal
1048
+
1049
+ - Catalog stats now cache aggregated schemaVersion (scans bounded sample) for dashboard display & backup manifest inclusion.
1050
+ - Synthetic run summary & active request counter cached for UI polling; safety resets protect against leaked counters on errors.
1051
+ - Added cache-control headers to `/api/status` to prevent stale build/version metadata.
1052
+
1053
+ ### Notes (release rationale)
1054
+
1055
+ - Minor version bump due to additive public capabilities (diagnostics semantics, backup/restore endpoints/UI, streaming synthetic traces, HTTP metrics exposure, instruction editor UX). No breaking tool schema changes.
1056
+ - Future roadmap items (not yet implemented): diagnostics metrics counters, JSONL sink with rotation, dashboard diagnostics endpoint, health degradation heuristics.
1057
+
1058
+ ### Upgrade Guidance (1.2.0)
1059
+
1060
+ - No client changes required; new diagnostics lines appear only on stderr.
1061
+ - To enable HTTP metrics aggregation ensure dashboard mode is active (set `INDEX_SERVER_DASHBOARD=1`).
1062
+ - For live synthetic traces pass `?trace=1&stream=1` when invoking synthetic activity via dashboard UI (already wired in client script).
1063
+
1064
+ ## [1.0.6] - 2025-08-28
1065
+
1066
+ ### Changed (cleanup)
1067
+
1068
+ - Removed obsolete legacy feedback test variant files (`feedback.spec.ts.new/.minimal/.disabled/.clean`) to avoid accidental resurrection and duplicate coverage.
1069
+ - Consolidated around `feedbackCore.spec.ts` (comprehensive), `feedbackSimple.spec.ts` (smoke), and minimal legacy placeholder `feedback.spec.ts` file.
1070
+ - Version bump reflects repository hygiene update post-stabilization (no functional surface changes).
1071
+
1072
+ ### Notes
1073
+
1074
+ - Patch solely for test/developer experience cleanliness; no runtime code modifications.
1075
+
1076
+ ## [1.1.0] - 2025-08-30
1077
+
1078
+ ### Added (documented add response contract)
1079
+
1080
+ - Finalized and documented enriched `index_add` response fields (`verified`, `feedbackHint`, `reproEntry`) in README.
1081
+ - Treats previously experimental creation verification semantics as stable API (minor bump per VERSIONING policy: additive response fields after 1.0).
1082
+ - No schema version change (response shape additive only; instruction JSON schema unchanged at `schemaVersion: 2`).
1083
+
1084
+ ### Upgrade Guidance (1.1.0)
1085
+
1086
+ - No client changes required if ignoring unknown fields; clients wanting richer UX can surface `feedbackHint` and attach `reproEntry` when auto-filing feedback.
1087
+ - Optional: update any strict type definitions to include the new optional keys.
1088
+
1089
+ ## [1.1.1] - 2025-08-31
1090
+
1091
+ ### Changed (handshake & test harness reliability)
1092
+
1093
+ - Removed legacy short-circuit handshake mode (`INDEX_SERVER_SHORTCIRCUIT`); only canonical SDK-driven initialize path is supported.
1094
+ - Added shared handshake helper (`src/tests/util/handshakeHelper.ts`) consolidating spawn + sentinel wait + initialize send + one-time resend fallback (idempotent initialize id=1).
1095
+ - Added timing regression guard (`handshakeTimingRegression.spec.ts`) enforcing initialize response under 15s hard cap (warn >5s) post early stdin buffering.
1096
+ - Standardized resend logic (single resend after 4s inactivity) eliminating ad-hoc polling loops that caused sporadic timeouts under suite contention.
1097
+ - Clarified diagnostic flag usage: production must keep `INDEX_SERVER_INIT_FALLBACK_ALLOW`, `INDEX_SERVER_DISABLE_INIT_SNIFF`, `INDEX_SERVER_HANDSHAKE_TRACE` unset unless actively debugging.
1098
+
1099
+ ### Fixed (intermittent test timeouts)
1100
+
1101
+ - Resolved sporadic initialize wait timeouts in `createReadSmoke` & portable CRUD specs when run amidst heavy reproduction suites; root cause was duplicated bespoke timing logic racing process startup.
1102
+ - Direct protocol compliance test (`handshakeDirect.spec.ts`) remained stable confirming server-side sequencing correctness.
1103
+
1104
+ ### Documentation (migration & governance)
1105
+
1106
+ - Changelog now records deprecation & removal of short-circuit path; README environment flag table implicitly authoritative (no short-circuit flag documented).
1107
+ - Next minor (1.2.0) PRD addendum will ratify handshake helper as mandatory pattern for new spawn-based specs.
1108
+
1109
+ ### Internal (1.1.1)
1110
+
1111
+ - Patch bump only; no schema or tool surface modifications.
1112
+
1113
+ ### Upgrade Guidance (1.1.1)
1114
+
1115
+ No action required. Remove any legacy use of `INDEX_SERVER_SHORTCIRCUIT`; standard initialize sequence already compatible.
1116
+
1117
+ ## [1.1.2] - 2025-08-31
1118
+
1119
+ ### Changed (catalog performance & visibility race elimination)
1120
+
1121
+ - Implemented late materialization on add/get paths eliminating rare duplicate add -> immediate get notFound race under high concurrency.
1122
+ - Added per-file lifecycle tracing (`begin`, `progress`, `end`) at normal trace level for catalog loads.
1123
+ - Introduced memoized catalog caching (mtime/size heuristic + optional SHA-256 hash path) gated by `INDEX_SERVER_MEMOIZE` / `INDEX_SERVER_MEMOIZE_HASH` while preserving `INDEX_SERVER_ALWAYS_RELOAD` semantics.
1124
+ - Emitted cache summary trace (`catalog:cache-summary`) for observability (hit/miss, strategy, counts).
1125
+
1126
+ ### Fixed (multi-client visibility anomalies)
1127
+
1128
+ - Resolved cross-client immediate visibility lag after duplicate add with overwrite=false by deferring reconstruction until atomic write + canonical readback complete.
1129
+ - Eliminated list/get sampling phantom mismatches (analyzer now reports 0 anomalies across large trace corpus).
1130
+
1131
+ ### Added (tracing & analysis tooling)
1132
+
1133
+ - Standardized trace persistence format to bracketed label + JSON for analyzer compatibility.
1134
+ - Added trace analysis scripts (`scripts/analyze-traces.*`) and reproduction harness (`scripts/run-feedback-repro-with-trace.ps1`).
1135
+ - Minimal instruction assembly script (`scripts/prepare-minimal-instructions.mjs`) for performance-focused runs without altering tests.
1136
+
1137
+ ### Notes (release scope)
1138
+
1139
+ - Patch release (1.1.2) is internal reliability + performance; no external tool / schema surface change.
1140
+ - All previously RED reproduction tests now GREEN; two legacy RED specs still intentionally failing due to unsupported bulk import pathway (guarded by test expectations).
1141
+
1142
+ ### Upgrade Guidance (1.1.2)
1143
+
1144
+ No client changes required. Enable `INDEX_SERVER_MEMOIZE=1` (and optionally `INDEX_SERVER_MEMOIZE_HASH=1`) to reduce reload overhead in high-churn scenarios without sacrificing correctness.
1145
+
1146
+ ## [1.0.7] - 2025-08-30
1147
+
1148
+ ### Added (creation verification & failure contract)
1149
+
1150
+ - Hardened `index_add` success semantics: `created:true` now only emitted after atomic write, catalog visibility, and final readability (title/body non-empty) verification; response includes `verified:true` when these checks pass.
1151
+ - Unified failure response contract via internal `fail()` helper returning `{ created:false, error, feedbackHint, reproEntry }` across all add failure paths (missing entry/id/required fields, governance violations, write errors, atomic readback failure, invalid shape).
1152
+ - Added enriched guidance encouraging clients to submit structured feedback with embedded `reproEntry` for rapid defect triage.
1153
+ - New tests: `instructionsAddCreatedFlag.spec.ts` verifying created/verified gating and feedback guidance on failure conditions (governance + required field omissions).
1154
+ - Portable client CRUD harness stabilized (dynamic ESM import shim) with deterministic atomic visibility assertions.
1155
+
1156
+ ### Documentation (lifecycle)
1157
+
1158
+ - Added `FEEDBACK-DEFECT-LIFECYCLE.md` formalizing feedback → red test → fix → coverage workflow.
1159
+ - Pending README & TOOLS doc updates for enriched add response (will be completed in 1.1.0 minor bump).
1160
+
1161
+ ### Internal (stability)
1162
+
1163
+ - Introduced ambient module declaration for portable client to resolve TS7016 without expanding `tsconfig` include surface.
1164
+ - Eliminated intermittent “No test suite found” flake in portable CRUD atomic spec via stabilization of file export timing.
1165
+
1166
+ ### Versioning Notes (next minor)
1167
+
1168
+ - Patch release retained (1.0.7) while evaluating whether enriched add response should be treated as a documented stable contract.
1169
+ - Next release should bump MINOR to 1.1.0 once documentation references are finalized (optional field additions per policy).
1170
+
1171
+
1172
+ ## [1.5.0] - 2025-09-14
1173
+
1174
+ ### Added (bootstrap gating & safety)
1175
+
1176
+ - Bootstrap confirmation gating flow (`requestBootstrapToken` → `finalizeBootstrapToken`) requiring explicit human confirmation artifact before enabling broad mutation operations.
1177
+ - Minimal allow‑listed seed instruction IDs (000 / 001) excluded from recursion and leakage risk metrics to guarantee a safe tool discovery baseline.
1178
+ - Human confirmation persistence (`bootstrap.confirmed.json`) with token TTL enforcement and rejection reasons (`mutation_blocked`, `token_invalid`, `token_expired`).
1179
+
1180
+ ### Added (governance & risk instrumentation)
1181
+
1182
+ - Recursion/leakage risk metrics capturing self‑referential or cyclic instruction body/category link detection; aggregated risk summary surfaced via governance hash pathways.
1183
+ - Performance baseline tooling (`perf-baseline.mjs`, compare, trend, summary scripts) now integrated with release workflow enabling drift detection on CPU time & RSS.
1184
+ - Baseline auto-confirm test helper (`forceBootstrapConfirmForTests`) gated by `INDEX_SERVER_BOOTSTRAP_AUTOCONFIRM` for legacy suite compatibility without weakening production gating semantics.
1185
+
1186
+ ### Changed (test infrastructure)
1187
+
1188
+ - Global test setup (`setupDistReady.ts`) defaults `INDEX_SERVER_BOOTSTRAP_AUTOCONFIRM=1` unless explicitly disabled, restoring green for historical mutation suites while preserving a dedicated authentic gating spec.
1189
+ - `bootstrapGating.spec.ts` isolated via per‑test temporary `INDEX_SERVER_DIR` ensuring real token lifecycle coverage (block → issue token → finalize → unblocked).
1190
+ - Dispatcher P1 unit test adapted to force confirmation post dynamic import keeping focus on catalog ordering semantics.
1191
+
1192
+ ### Governance (baseline change control)
1193
+
1194
+ - Added §14.5 BASELINE-CR (noise‑suppression allow‑list) to `INTERNAL-BASELINE.md` covering bootstrap gating, manifest lifecycle & schema validation, governance recursion guard, search/versioning, graph export enriched/mermaid variants, onboarding helper, and visibility invariant spec (early warning only).
1195
+ - Updated baseline sentinel and guard allow-list (noise suppression only; minimal invariant suite unchanged per §6 baseline plan).
1196
+
1197
+ ### Notes (1.5.0)
1198
+
1199
+ - Minor release justified by additive safety gating mechanism and new performance & risk instrumentation surfaces; no breaking tool schema changes.
1200
+ - Production deployments must perform a one‑time bootstrap confirmation; tests emulate confirmation automatically unless deliberately disabled.
1201
+ - Future hardening roadmap: elevate selected noise‑suppression specs (manifest fastload, recursion guard) to minimal invariant status via separate BASELINE-CR once semantics fully stabilized.
1202
+
1203
+ ### Upgrade Guidance (1.5.0)
1204
+
1205
+ 1. Pull & rebuild (`npm ci && npm run build`).
1206
+ 2. Start server; obtain bootstrap token via governance tool / log prompt; finalize to enable general mutation.
1207
+ 3. For CI deterministic runs ensure `INDEX_SERVER_BOOTSTRAP_AUTOCONFIRM=1` (unless explicitly validating gating flow) and keep `BASELINE_ENFORCE=1` for guard execution.
1208
+ 4. Monitor performance baseline summaries for drift (`npm run perf:drift`).
1209
+
1210
+ ## [1.13.0] - 2026-03-27
1211
+
1212
+ ## [1.15.0] - 2026-03-31
1213
+
1214
+ ### Added
1215
+
1216
+ - Rename catalog_* MCP tools to index_*, add dashboard panel help docs, fix restore script zip support
1217
+
1218
+ ## [1.16.2] - 2026-04-02