@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
@@ -0,0 +1,49 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ - Demonstrating empathy and kindness toward other people
14
+ - Being respectful of differing opinions, viewpoints, and experiences
15
+ - Giving and gracefully accepting constructive feedback
16
+ - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ - Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ - The use of sexualized language or imagery, and sexual attention or advances of any kind
22
+ - Trolling, insulting or derogatory comments, and personal or political attacks
23
+ - Public or private harassment
24
+ - Publishing others' private information, such as a physical or email address, without their explicit permission
25
+ - Other conduct which could reasonably be considered inappropriate in a professional setting
26
+
27
+ ## Scope
28
+
29
+ This Code of Conduct applies within all community spaces, including GitHub repositories, issue trackers, pull requests, discussions, and any other communication channels associated with this project. It also applies when an individual is officially representing the community in public spaces.
30
+
31
+ ## Enforcement
32
+
33
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainer via [GitHub Issues](https://github.com/jagilber-org/index-server/issues) or by contacting the maintainer directly.
34
+
35
+ All complaints will be reviewed and investigated promptly and fairly. The project maintainer is obligated to respect the privacy and security of the reporter of any incident.
36
+
37
+ ### Enforcement Guidelines
38
+
39
+ **1. Correction** — A private, written warning providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
40
+
41
+ **2. Warning** — A warning with consequences for continued behavior. No interaction with the people involved for a specified period of time. Violating these terms may lead to a temporary or permanent ban.
42
+
43
+ **3. Temporary Ban** — A temporary ban from any sort of interaction or public communication with the community for a specified period of time.
44
+
45
+ **4. Permanent Ban** — A permanent ban from any sort of public interaction within the community.
46
+
47
+ ## Attribution
48
+
49
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
@@ -0,0 +1,75 @@
1
+ # Contributing
2
+
3
+ Thanks for your interest in contributing.
4
+
5
+ ## Dual-Repo Model
6
+
7
+ This project follows the **dual-repo publishing** pattern:
8
+
9
+ - **`index-server-dev`** (private) — All development happens here. Submit PRs to this repo.
10
+ - **`index-server`** (public) — Read-only publication mirror. **Do not push directly.**
11
+
12
+ The public repo is updated exclusively via `scripts/publish.cjs` from the dev repo, aligned to release tags. If you found this project via the public repo, please contact the maintainers for access to the dev repo to submit contributions.
13
+
14
+ ## Development Setup
15
+
16
+ 1. Node 20+
17
+ 2. `npm install`
18
+ 3. `npm test`
19
+ 4. `npm run build`
20
+
21
+ ## Branching
22
+
23
+ Use feature branches. Submit PRs to `main`.
24
+
25
+ ## Commit Messages
26
+
27
+ Use conventional style where practical (feat:, fix:, docs:, chore:).
28
+
29
+ ## Tests
30
+
31
+ Include unit tests for new logic. Run `npm test` and ensure coverage not reduced.
32
+
33
+ ### Configuration & Environment Variables
34
+
35
+ Do NOT introduce new top-level `process.env.*` usages scattered across the codebase.
36
+
37
+ All runtime and test tunables must flow through `src/config/runtimeConfig.ts`:
38
+
39
+ 1. If you need a new timing / wait value, extend `INDEX_SERVER_TIMING_JSON` key usage (e.g. `{"featureX.startupWait":5000}`) instead of adding `FEATUREX_STARTUP_WAIT_MS`.
40
+ 2. For logging verbosity, use `INDEX_SERVER_LOG_LEVEL` (levels: silent,error,warn,info,debug,trace) or add a trace token to `INDEX_SERVER_TRACE` (comma-separated) rather than a new boolean flag.
41
+ 3. For mutation gating, rely on `INDEX_SERVER_MUTATION` (legacy `INDEX_SERVER_MUTATION` is auto-mapped; do not reintroduce it).
42
+ 4. Fast coverage paths use `INDEX_SERVER_TEST_MODE=coverage-fast`; legacy `FAST_COVERAGE` accepted but should not appear in new code.
43
+
44
+ If an absolutely new capability requires configuration:
45
+
46
+ - Add parsing inside `runtimeConfig.ts` (with JSDoc + deprecation mapping if replacing legacy flags)
47
+ - Update `docs/CONFIGURATION.md` and README consolidation section
48
+ - Add a one-time warning for any temporary legacy alias
49
+
50
+ PRs adding raw `process.env.X` reads outside the config module will be requested to refactor before merge.
51
+
52
+ ### Automated Enforcement
53
+
54
+ An automated guard (`npm run guard:env`) executes during `build:verify` and CI to block newly introduced direct `process.env.*` reads. If your change legitimately needs a bootstrap-time read (rare), either:
55
+
56
+ 1. Route through `runtimeConfig.ts` (preferred), or
57
+ 2. Add a narrowly scoped allowlist pattern with justification in `scripts/enforce-config-usage.ts` (include a comment referencing the follow-up issue to migrate/remove it).
58
+
59
+ Do not silence the guard by broadening allowlists—refactor instead. Enforcement failures list file:line with a remediation suggestion.
60
+
61
+ ## Security
62
+
63
+ Do not include secrets in commits. Report vulnerabilities per `SECURITY.md`.
64
+
65
+ ## Code Style
66
+
67
+ Respect existing formatting. Run any lint scripts if present.
68
+
69
+ ## Constitution
70
+
71
+ This project is governed by a machine-readable constitution (`constitution.json` / `.specify/memory/constitution.md`). All contributions must align with its principles — review it before submitting significant changes.
72
+
73
+ ## Questions
74
+
75
+ Open a discussion or issue.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 jagilber
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,523 @@
1
+ # Index Server
2
+
3
+ **Model Context Protocol server providing governed, classified, and auditable instruction catalogs with analytics and optional admin dashboard.**
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
+ [![npm version](https://img.shields.io/github/v/tag/jagilber-org/index-server?label=GitHub%20Packages)](https://github.com/jagilber-org/index-server/packages)
7
+ [![Node.js Version](https://img.shields.io/badge/node-%3E%3D22%20LTS-brightgreen)](package.json)
8
+ [![codecov](https://codecov.io/gh/jagilber-org/index-server/graph/badge.svg)](https://codecov.io/gh/jagilber-org/index-server)
9
+ [![VS Code Marketplace](https://img.shields.io/visual-studio-marketplace/v/jagilber-org.index-server?label=VS%20Code%20Marketplace)](https://marketplace.visualstudio.com/items?itemName=jagilber-org.index-server)
10
+ [![Open VSX](https://img.shields.io/open-vsx/v/jagilber-org/index-server?label=Open%20VSX)](https://open-vsx.org/extension/jagilber-org/index-server)
11
+
12
+ ---
13
+
14
+ ## Overview
15
+
16
+ Index Server is an implementation of the [Model Context Protocol (MCP)](https://modelcontextprotocol.io) that enables AI agents to access governed instruction catalogs. It provides governance, usage analytics, security controls, and an optional admin dashboard for monitoring and maintenance.
17
+
18
+ **Key Capabilities:**
19
+ - **MCP Protocol Compliance** - Full JSON-RPC 2.0 over stdio transport with schema validation
20
+ - **Instruction Governance** - Lifecycle management with ownership, versioning, and approval workflows
21
+ - **Usage Analytics** - Track instruction usage with persistent storage and hotset analysis
22
+ - **Security Controls** - Bootstrap confirmation, mutation gating, audit logging, and pre-commit hooks
23
+ - **Admin Dashboard** - Optional HTTP(S) interface with visual drift detection and monitoring
24
+ - **Performance** - Optimized for sub-50ms response times with comprehensive caching
25
+
26
+ ---
27
+
28
+ ## Quick Start
29
+
30
+ ### Prerequisites
31
+
32
+ - Node.js >= 22 LTS
33
+ - npm (included with Node.js)
34
+ - An MCP-compatible client (VS Code, Claude Desktop, or similar)
35
+
36
+ ### Installation
37
+
38
+ **From npm:**
39
+
40
+ ```bash
41
+ npm install @jagilber-org/index-server
42
+ ```
43
+
44
+ **From source:**
45
+
46
+ ```bash
47
+ git clone https://github.com/jagilber-org/index-server.git
48
+ cd index-server
49
+ npm install
50
+ npm run build
51
+ ```
52
+
53
+ ### Configuration
54
+
55
+ Add to your MCP client configuration (e.g., VS Code `mcp.json` or Claude Desktop config):
56
+
57
+ ```jsonc
58
+ {
59
+ "mcpServers": {
60
+ "catalog": {
61
+ "command": "node",
62
+ "args": [
63
+ "C:/path/to/index-server/dist/server/index-server.js",
64
+ "--dashboard",
65
+ "--dashboard-port=3210"
66
+ ],
67
+ "env": {
68
+ "INDEX_SERVER_LOG_LEVEL": "info",
69
+ "INDEX_SERVER_MUTATION": "enabled",
70
+ "INDEX_SERVER_DIR": "C:/path/to/index-server/instructions"
71
+ }
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
77
+ - Use absolute paths or set `cwd` to enable relative paths
78
+ - Dashboard arguments (`--dashboard`, `--dashboard-port`) are optional
79
+ - Restart your MCP client after configuration changes
80
+ - See [Configuration Guide](docs/mcp_configuration.md) for advanced patterns
81
+
82
+ ### Verification
83
+
84
+ 1. Server should appear in your MCP client's server list
85
+ 2. Dashboard (if enabled) accessible at `http://localhost:8787`
86
+ 3. Test with: `tools/list` to see available tools
87
+
88
+ ---
89
+
90
+ ## Dashboard
91
+
92
+ The optional admin dashboard provides a Grafana-dark themed interface for server monitoring and catalog management:
93
+
94
+ ![Overview](docs/screenshots/panel-overview.png)
95
+
96
+ | Panel | Description |
97
+ |-------|-------------|
98
+ | **Overview** | Server health, uptime, and system status |
99
+ | **Configuration** | Environment flags and runtime settings |
100
+ | **Sessions** | Connected clients and activity |
101
+ | **Maintenance** | Backup, repair, and catalog operations |
102
+ | **Monitoring** | Performance metrics and error rates |
103
+ | **Instructions** | Catalog browser with usage counts, signal badges, and governance status |
104
+ | **Graph** | Mermaid dependency graph of instructions |
105
+
106
+ See [dashboard.md](docs/dashboard.md) for full details.
107
+
108
+ ### REST Client Scripts (No MCP Required)
109
+
110
+ For subagents or CI pipelines that cannot load MCP tools, two REST client scripts provide full CRUD access via the dashboard HTTP bridge:
111
+
112
+ ```powershell
113
+ # PowerShell (irm)
114
+ .\scripts\index-server-client.ps1 -Action search -Keywords deploy -Mode semantic
115
+ .\scripts\index-server-client.ps1 -Action get -Id my-instruction
116
+ .\scripts\index-server-client.ps1 -Action track -Id my-instruction -Signal helpful
117
+ ```
118
+
119
+ ```bash
120
+ # Bash (curl)
121
+ ./scripts/index-server-client.sh search "deploy" semantic 10
122
+ ./scripts/index-server-client.sh get my-instruction
123
+ ./scripts/index-server-client.sh track my-instruction helpful
124
+ ```
125
+
126
+ Both scripts support HTTP/HTTPS, self-signed cert bypass, and return structured JSON. See [tools.md - REST Client Scripts](docs/tools.md#rest-client-scripts-agent-access-without-mcp) for full reference.
127
+
128
+ ---
129
+
130
+ ## Tools
131
+
132
+ ### Tool Tier Architecture
133
+
134
+ ```mermaid
135
+ ---
136
+ config:
137
+ layout: elk
138
+ ---
139
+ graph TD
140
+ subgraph Core Tier
141
+ bootstrap["bootstrap"]
142
+ feedback_dispatch["feedback_dispatch"]
143
+ health_check["health_check"]
144
+ help_overview["help_overview"]
145
+ index_dispatch["index_dispatch"]
146
+ index_search["index_search"]
147
+ prompt_review["prompt_review"]
148
+ end
149
+
150
+ subgraph Extended Tier
151
+ gates_evaluate["gates_evaluate"]
152
+ graph_export["graph_export"]
153
+ index_add["index_add"]
154
+ index_import["index_import"]
155
+ index_remove["index_remove"]
156
+ integrity_verify["integrity_verify"]
157
+ metrics_snapshot["metrics_snapshot"]
158
+ promote_from_repo["promote_from_repo"]
159
+ usage_track["usage_track"]
160
+ usage_hotset["usage_hotset"]
161
+ end
162
+
163
+ subgraph Admin Tier
164
+ bootstrap_sub["bootstrap_*"]
165
+ diagnostics["diagnostics_*"]
166
+ feedback_sub["feedback_*"]
167
+ manifest["manifest_*"]
168
+ meta_tools["meta_*"]
169
+ index_adv["index_adv_*"]
170
+ end
171
+
172
+ Client["MCP Client"] --> Core
173
+ Client -.->|"INDEX_SERVER_FLAG_TOOLS_EXTENDED=1"| Extended
174
+ Client -.->|"INDEX_SERVER_FLAG_TOOLS_ADMIN=1"| Admin
175
+
176
+ style Core fill:#4caf50,stroke:#2e7d32,stroke-width:2px,color:#fff
177
+ style Extended fill:#2196f3,stroke:#0d47a1,stroke-width:2px,color:#fff
178
+ style Admin fill:#ff9800,stroke:#e65100,stroke-width:2px,color:#fff
179
+ style Client fill:#607d8b,stroke:#37474f,stroke-width:2px,color:#fff
180
+ ```
181
+
182
+ ### Request Flow
183
+
184
+ ```mermaid
185
+ ---
186
+ config:
187
+ layout: elk
188
+ ---
189
+ graph LR
190
+ Request["Client Request"] --> Transport["stdio Transport"]
191
+ Transport --> Router["JSON-RPC Router"]
192
+ Router --> Dispatch["Action Dispatcher"]
193
+
194
+ Dispatch --> Read["Read Path"]
195
+ Dispatch --> Write["Write Path"]
196
+
197
+ Read --> Search["index_search"]
198
+ Read --> Get["index_dispatch"]
199
+ Read --> Health["health_check"]
200
+ Read --> Metrics["metrics_snapshot"]
201
+
202
+ Write --> Mutation{"INDEX_SERVER_MUTATION?"}
203
+ Mutation -->|Yes| Add["index_add"]
204
+ Mutation -->|Yes| Import["index_import"]
205
+ Mutation -->|Yes| Remove["index_remove"]
206
+ Mutation -->|No| Denied["403 Mutation Disabled"]
207
+
208
+ Search --> Catalog["CatalogContext"]
209
+ Get --> Catalog
210
+ Add --> Catalog
211
+ Import --> Catalog
212
+ Remove --> Catalog
213
+ Catalog --> Files[("instructions/*.json")]
214
+
215
+ style Transport fill:#607d8b,stroke:#37474f,stroke-width:2px,color:#fff
216
+ style Catalog fill:#ff9800,stroke:#e65100,stroke-width:2px,color:#fff
217
+ style Files fill:#4caf50,stroke:#2e7d32,stroke-width:2px,color:#fff
218
+ style Mutation fill:#f44336,stroke:#c62828,stroke-width:2px,color:#fff
219
+ style Denied fill:#f44336,stroke:#c62828,stroke-width:2px,color:#fff
220
+ ```
221
+
222
+ ### Tool Reference
223
+
224
+ **Instruction Management:**
225
+ - `index_dispatch` - Unified dispatcher for catalog operations (list, get, search, add, export, diff)
226
+ - `index_search` - Keyword search with relevance scoring
227
+ - `index_add` - Create new instructions with validation
228
+ - `index_import` - Batch import from external sources
229
+ - `index_remove` - Delete instructions with confirmation
230
+
231
+ **Governance & Quality:**
232
+ - `index_governanceUpdate` - Patch ownership, status, review dates
233
+ - `index_governanceHash` - Generate deterministic governance fingerprints
234
+ - `integrity_verify` - Validate catalog integrity
235
+ - `gates_evaluate` - Check gating criteria compliance
236
+ - `prompt_review` - Static analysis of prompts
237
+
238
+ **Analytics & Monitoring:**
239
+ - `usage_track` - Record instruction usage events
240
+ - `usage_hotset` - Retrieve frequently-used instructions
241
+ - `health_check` - Server health and configuration status
242
+ - `metrics_snapshot` - Performance and operational metrics
243
+
244
+ **Feedback System:**
245
+ - `feedback_dispatch` - Submit issues, feature requests, security reports; query, update, and monitor feedback
246
+
247
+ See [API Reference (tools.md)](docs/tools.md) for complete tool documentation.
248
+
249
+ ---
250
+
251
+ ## Agent Bootstrapping
252
+
253
+ On first run, the server creates `instructions/000-bootstrapper.json` -- a P0 instruction that teaches AI agents how to use the index, create local instructions, and contribute validated patterns back to the shared catalog.
254
+
255
+ Agents query it automatically:
256
+ ```json
257
+ {"method": "index_dispatch", "params": {"action": "get", "id": "000-bootstrapper"}}
258
+ ```
259
+
260
+ ### Knowledge Flywheel
261
+
262
+ ```mermaid
263
+ ---
264
+ config:
265
+ layout: elk
266
+ ---
267
+ graph LR
268
+ A[Agent encounters problem] --> B[Creates local .instructions/]
269
+ B --> C[Tests & validates solution]
270
+ C --> D{Valuable to others?}
271
+ D -->|Yes| E[Promote to shared index]
272
+ D -->|No| F[Keep local only]
273
+ E --> G[Other agents benefit]
274
+ G --> H[They contribute patterns]
275
+ H --> A
276
+ style E fill:#238636,stroke:#196c2e,stroke-width:2px,color:#fff
277
+ style G fill:#1f6feb,stroke:#1158c7,stroke-width:2px,color:#fff
278
+ ```
279
+
280
+ Instructions start local in `.instructions/`, get validated over multiple sessions, then proven patterns are promoted to the shared index via `promote_from_repo`.
281
+
282
+ ### Bootstrap Security
283
+
284
+ Fresh installations block mutations until human confirmation:
285
+
286
+ 1. **Reference Mode** (`INDEX_SERVER_REFERENCE_MODE=1`) - Read-only catalog access
287
+ 2. **Fresh Installation** - Mutations blocked until confirmed via `bootstrap` tool
288
+ 3. **Confirmed** - Full mutation access (subject to `INDEX_SERVER_MUTATION` setting)
289
+
290
+ See [Configuration Guide](docs/configuration.md) for bootstrap workflow details.
291
+
292
+ ---
293
+
294
+ ## Configuration
295
+
296
+ ### Environment Variables
297
+
298
+ **Core:**
299
+
300
+ | Variable | Default | Description |
301
+ |----------|---------|-------------|
302
+ | `INDEX_SERVER_LOG_LEVEL` | `info` | Logging level: `silent`, `error`, `warn`, `info`, `debug`, `trace` |
303
+ | `INDEX_SERVER_MUTATION` | `disabled` | Enable mutations: `enabled` or `disabled` |
304
+ | `INDEX_SERVER_DIR` | `./instructions` | Absolute path to instruction catalog directory |
305
+ | `INDEX_SERVER_REFERENCE_MODE` | `0` | Read-only mode: `1` or `0` |
306
+ | `INDEX_SERVER_AUTO_SEED` | `1` | Auto-create bootstrap seeds: `1` or `0` |
307
+
308
+ **Advanced:**
309
+
310
+ | Variable | Default | Description |
311
+ |----------|---------|-------------|
312
+ | `INDEX_SERVER_TIMING_JSON` | `{}` | JSON timing overrides (e.g., `{"manifest.waitDisabled":15000}`) |
313
+ | `INDEX_SERVER_TEST_MODE` | - | Test mode: `coverage-fast` for accelerated coverage runs |
314
+ | `INDEX_SERVER_TRACE` | - | Trace tokens: comma-separated (e.g., `manifest,bootstrap`) |
315
+ | `INDEX_SERVER_MANIFEST_WRITE` | `1` | Enable manifest writes: `1` or `0` |
316
+ | `INDEX_SERVER_BODY_MAX_LENGTH` | `20000` | Max body length for instructions (1000-1000000) |
317
+
318
+ **Semantic Search:**
319
+
320
+ | Variable | Default | Description |
321
+ |----------|---------|-------------|
322
+ | `INDEX_SERVER_SEMANTIC_ENABLED` | `0` | Enable semantic search: `1` or `0` |
323
+ | `INDEX_SERVER_SEMANTIC_MODEL` | `Xenova/all-MiniLM-L6-v2` | HuggingFace model for embeddings |
324
+ | `INDEX_SERVER_SEMANTIC_CACHE_DIR` | `./data/models` | Local model cache directory |
325
+ | `INDEX_SERVER_EMBEDDING_PATH` | `./data/embeddings.json` | Cached embedding vectors path |
326
+ | `INDEX_SERVER_SEMANTIC_DEVICE` | `cpu` | Compute device: `cpu`, `cuda`, or `dml` |
327
+ | `INDEX_SERVER_SEMANTIC_LOCAL_ONLY` | `1` | Block remote model downloads: `1` or `0` |
328
+
329
+ > **Note:** Semantic search requires a one-time model download (~90MB). Set `INDEX_SERVER_SEMANTIC_LOCAL_ONLY=0` and `INDEX_SERVER_SEMANTIC_ENABLED=1` to download, then revert to `INDEX_SERVER_SEMANTIC_LOCAL_ONLY=1`.
330
+
331
+ **Dashboard:**
332
+
333
+ | Variable / CLI Argument | Default | Description |
334
+ |-------------------------|---------|-------------|
335
+ | `INDEX_SERVER_DASHBOARD` / `--dashboard` | `0` | Enable HTTP(S) dashboard |
336
+ | `INDEX_SERVER_DASHBOARD_PORT` / `--dashboard-port=<port>` | `8787` | Dashboard port |
337
+ | `INDEX_SERVER_DASHBOARD_GRAPH` | `0` | Enable Graph tab (loads ~4.5MB mermaid + elkjs) |
338
+
339
+ **TLS / HTTPS:**
340
+
341
+ | Variable / CLI Argument | Default | Description |
342
+ |-------------------------|---------|-------------|
343
+ | `INDEX_SERVER_DASHBOARD_TLS` / `--dashboard-tls` | `0` | Enable HTTPS for the dashboard |
344
+ | `INDEX_SERVER_DASHBOARD_TLS_CERT` / `--dashboard-tls-cert=<path>` | - | Path to TLS certificate file (PEM) |
345
+ | `INDEX_SERVER_DASHBOARD_TLS_KEY` / `--dashboard-tls-key=<path>` | - | Path to TLS private key file (PEM) |
346
+ | `INDEX_SERVER_DASHBOARD_TLS_CA` / `--dashboard-tls-ca=<path>` | - | Path to CA certificate for client verification (PEM) |
347
+
348
+ When TLS is enabled, the dashboard serves over HTTPS. All three files (cert, key, and optionally CA) must be PEM-encoded. Example:
349
+
350
+ ```jsonc
351
+ {
352
+ "env": {
353
+ "INDEX_SERVER_DASHBOARD": "1",
354
+ "INDEX_SERVER_DASHBOARD_TLS": "1",
355
+ "INDEX_SERVER_DASHBOARD_TLS_CERT": "/etc/certs/server.crt",
356
+ "INDEX_SERVER_DASHBOARD_TLS_KEY": "/etc/certs/server.key"
357
+ }
358
+ }
359
+ ```
360
+
361
+ Or via CLI arguments:
362
+
363
+ ```bash
364
+ node dist/server/index-server.js --dashboard --dashboard-tls \
365
+ --dashboard-tls-cert=/etc/certs/server.crt \
366
+ --dashboard-tls-key=/etc/certs/server.key
367
+ ```
368
+
369
+ For complete configuration details, see [Configuration Guide](docs/configuration.md).
370
+
371
+ ---
372
+
373
+ ## Usage Patterns
374
+
375
+ ### Search-First Workflow
376
+
377
+ ```json
378
+ {
379
+ "method": "tools/call",
380
+ "params": {
381
+ "name": "index_search",
382
+ "arguments": { "keywords": ["javascript", "arrays"], "limit": 10 }
383
+ }
384
+ }
385
+ ```
386
+
387
+ Then retrieve full content:
388
+ ```json
389
+ {
390
+ "method": "tools/call",
391
+ "params": {
392
+ "name": "index_dispatch",
393
+ "arguments": { "action": "get", "id": "instruction-id-from-search" }
394
+ }
395
+ }
396
+ ```
397
+
398
+ ### Simplified Authoring
399
+
400
+ Minimal required fields -- governance fields are auto-derived:
401
+
402
+ ```jsonc
403
+ {
404
+ "id": "example-instruction-123",
405
+ "title": "Example Instruction",
406
+ "body": "Instruction content here...",
407
+ "priority": 50,
408
+ "audience": "all",
409
+ "requirement": "optional",
410
+ "categories": ["example"]
411
+ }
412
+ ```
413
+
414
+ ---
415
+
416
+ ## Documentation
417
+
418
+ | Document | Purpose |
419
+ |----------|---------|
420
+ | [Product Requirements](docs/project_prd.md) | Authoritative requirements and governance |
421
+ | [API Reference](docs/tools.md) | Complete MCP tool documentation |
422
+ | [MCP Configuration](docs/mcp_configuration.md) | Setup patterns for all environments |
423
+ | [Server Configuration](docs/configuration.md) | Environment variables and CLI options |
424
+ | [Architecture](docs/architecture.md) | System design and component overview |
425
+ | [Admin Dashboard](docs/dashboard.md) | UI features, drift monitoring, maintenance |
426
+ | [Content Guidance](docs/content_guidance.md) | Local vs. central instruction guidance |
427
+ | [Network Privacy](docs/network-privacy.md) | Network transparency and offline deployment |
428
+ | [Documentation Index](docs/docs_index.md) | Full documentation map |
429
+
430
+ ---
431
+
432
+ ## Development
433
+
434
+ ```bash
435
+ npm install # Install dependencies
436
+ npm run build # Build TypeScript
437
+ npm test # Run test suite (350+ tests)
438
+ npm run test:contracts # Contract tests only
439
+ npm run typecheck # Type checking
440
+ npm run lint # Linting
441
+ ```
442
+
443
+ ### Pre-commit Hooks
444
+
445
+ Automated checks run before every commit: typecheck, lint, test suite, and security scan. Configuration in [.husky](.husky).
446
+
447
+ ### Testing Standards
448
+
449
+ - All tests must pass before merge
450
+ - Coverage levels maintained
451
+ - Contract tests validate protocol compliance
452
+ - Property-based tests validate idempotence and determinism
453
+
454
+ ---
455
+
456
+ ## Security
457
+
458
+ - **Pre-commit Hooks** - Prevents accidental commit of credentials and PII
459
+ - **Input Validation** - Comprehensive validation and sanitization
460
+ - **Audit Logging** - Security-relevant events logged with timestamps
461
+ - **Mutation Gating** - Write operations require explicit enablement
462
+
463
+ ### Network Transparency
464
+
465
+ Index Server makes **zero telemetry calls** and sends **no data to external services** during normal operation.
466
+
467
+ | Connection | Destination | When | How to Disable |
468
+ |------------|-------------|------|----------------|
469
+ | Semantic search model | `huggingface.co` | First semantic search only (one-time ~90 MB) | `INDEX_SERVER_SEMANTIC_ENABLED=0` (default) |
470
+ | Leader/follower RPC | `127.0.0.1` | Multi-instance mode only | `INDEX_SERVER_MODE=standalone` (default) |
471
+ | Instance health ping | `127.0.0.1` | Dashboard clustering only | `INDEX_SERVER_DASHBOARD=0` (default) |
472
+
473
+ Default configuration makes zero outbound network connections. See [Network Privacy Guide](docs/network-privacy.md) for verification and offline deployment.
474
+
475
+ ### Reporting Security Issues
476
+
477
+ See [SECURITY.md](SECURITY.md) for vulnerability reporting and security policy.
478
+
479
+ ---
480
+
481
+ ## Contributing
482
+
483
+ All contributions go through the development repository. See [CONTRIBUTING.md](CONTRIBUTING.md) for the full workflow, environment variable conventions, and code standards.
484
+
485
+ **Requirements:**
486
+ - Open an issue before making changes
487
+ - Add tests for new features and bug fixes
488
+ - Maintain strict TypeScript compliance
489
+ - Follow MCP specifications
490
+ - Review [SECURITY.md](SECURITY.md)
491
+
492
+ ---
493
+
494
+ ## Repository Structure
495
+
496
+ ```
497
+ index-server/
498
+ +-- .github/ # GitHub workflows and templates
499
+ +-- docs/ # Project documentation
500
+ +-- schemas/ # JSON schemas for validation
501
+ +-- scripts/ # Build and maintenance scripts
502
+ +-- src/ # TypeScript source code
503
+ | +-- server/ # MCP server implementation
504
+ | +-- services/ # Core business logic
505
+ | +-- types/ # Type definitions
506
+ +-- tests/ # Test suites
507
+ +-- dist/ # Build output (gitignored)
508
+ +-- coverage/ # Coverage reports (gitignored)
509
+ +-- data/ # Performance baselines and analytics
510
+ +-- feedback/ # User feedback storage
511
+ +-- governance/ # Governance policies
512
+ +-- snapshots/ # Index snapshots for drift detection
513
+ ```
514
+
515
+ ---
516
+
517
+ ## License
518
+
519
+ MIT License - see [LICENSE](LICENSE) file for details.
520
+
521
+ ---
522
+
523
+ Built with [Model Context Protocol (MCP)](https://modelcontextprotocol.io), TypeScript, Node.js, Vitest, and AJV.