@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.
- package/CHANGELOG.md +1218 -0
- package/CODE_OF_CONDUCT.md +49 -0
- package/CONTRIBUTING.md +75 -0
- package/LICENSE +21 -0
- package/README.md +523 -0
- package/SECURITY.md +50 -0
- package/dist/config/configUtils.d.ts +11 -0
- package/dist/config/configUtils.js +87 -0
- package/dist/config/dashboardConfig.d.ts +45 -0
- package/dist/config/dashboardConfig.js +63 -0
- package/dist/config/defaultValues.d.ts +61 -0
- package/dist/config/defaultValues.js +70 -0
- package/dist/config/dirConstants.d.ts +17 -0
- package/dist/config/dirConstants.js +28 -0
- package/dist/config/featureConfig.d.ts +61 -0
- package/dist/config/featureConfig.js +121 -0
- package/dist/config/runtimeConfig.d.ts +145 -0
- package/dist/config/runtimeConfig.js +334 -0
- package/dist/config/serverConfig.d.ts +90 -0
- package/dist/config/serverConfig.js +164 -0
- package/dist/dashboard/analytics/AnalyticsEngine.d.ts +142 -0
- package/dist/dashboard/analytics/AnalyticsEngine.js +373 -0
- package/dist/dashboard/analytics/BusinessIntelligence.d.ts +187 -0
- package/dist/dashboard/analytics/BusinessIntelligence.js +594 -0
- package/dist/dashboard/client/admin.html +2150 -0
- package/dist/dashboard/client/chunks/mermaid-layout-elk.esm.min/chunk-SP2CHFBE.mjs +1 -0
- package/dist/dashboard/client/chunks/mermaid-layout-elk.esm.min/render-T6MDALS3.mjs +27 -0
- package/dist/dashboard/client/css/admin.css +1466 -0
- package/dist/dashboard/client/js/admin.boot.js +359 -0
- package/dist/dashboard/client/js/admin.config.js +196 -0
- package/dist/dashboard/client/js/admin.embeddings.js +425 -0
- package/dist/dashboard/client/js/admin.graph.js +583 -0
- package/dist/dashboard/client/js/admin.instances.js +120 -0
- package/dist/dashboard/client/js/admin.instructions.js +552 -0
- package/dist/dashboard/client/js/admin.logs.js +113 -0
- package/dist/dashboard/client/js/admin.maintenance.js +354 -0
- package/dist/dashboard/client/js/admin.messaging.js +635 -0
- package/dist/dashboard/client/js/admin.monitor.js +181 -0
- package/dist/dashboard/client/js/admin.overview.js +221 -0
- package/dist/dashboard/client/js/admin.performance.js +61 -0
- package/dist/dashboard/client/js/admin.sessions.js +293 -0
- package/dist/dashboard/client/js/admin.sqlite.js +366 -0
- package/dist/dashboard/client/js/admin.utils.js +49 -0
- package/dist/dashboard/client/js/chart.umd.js +14 -0
- package/dist/dashboard/client/js/elk.bundled.js +6696 -0
- package/dist/dashboard/client/js/marked.umd.js +74 -0
- package/dist/dashboard/client/js/mermaid.min.js +3022 -0
- package/dist/dashboard/client/mermaid-layout-elk.esm.min.mjs +1 -0
- package/dist/dashboard/export/DataExporter.d.ts +169 -0
- package/dist/dashboard/export/DataExporter.js +737 -0
- package/dist/dashboard/export/exporters/csvExporter.d.ts +11 -0
- package/dist/dashboard/export/exporters/csvExporter.js +46 -0
- package/dist/dashboard/export/exporters/exportTypes.d.ts +89 -0
- package/dist/dashboard/export/exporters/exportTypes.js +5 -0
- package/dist/dashboard/export/exporters/jsonExporter.d.ts +7 -0
- package/dist/dashboard/export/exporters/jsonExporter.js +22 -0
- package/dist/dashboard/export/exporters/xmlExporter.d.ts +17 -0
- package/dist/dashboard/export/exporters/xmlExporter.js +175 -0
- package/dist/dashboard/integration/APIIntegration.d.ts +41 -0
- package/dist/dashboard/integration/APIIntegration.js +95 -0
- package/dist/dashboard/security/SecurityMonitor.d.ts +167 -0
- package/dist/dashboard/security/SecurityMonitor.js +559 -0
- package/dist/dashboard/server/AdminPanel.d.ts +183 -0
- package/dist/dashboard/server/AdminPanel.js +792 -0
- package/dist/dashboard/server/AdminPanelConfig.d.ts +42 -0
- package/dist/dashboard/server/AdminPanelConfig.js +80 -0
- package/dist/dashboard/server/AdminPanelState.d.ts +47 -0
- package/dist/dashboard/server/AdminPanelState.js +214 -0
- package/dist/dashboard/server/ApiRoutes.d.ts +17 -0
- package/dist/dashboard/server/ApiRoutes.js +149 -0
- package/dist/dashboard/server/DashboardServer.d.ts +49 -0
- package/dist/dashboard/server/DashboardServer.js +159 -0
- package/dist/dashboard/server/FileMetricsStorage.d.ts +49 -0
- package/dist/dashboard/server/FileMetricsStorage.js +195 -0
- package/dist/dashboard/server/HttpTransport.d.ts +23 -0
- package/dist/dashboard/server/HttpTransport.js +116 -0
- package/dist/dashboard/server/InstanceManager.d.ts +53 -0
- package/dist/dashboard/server/InstanceManager.js +284 -0
- package/dist/dashboard/server/KnowledgeStore.d.ts +35 -0
- package/dist/dashboard/server/KnowledgeStore.js +105 -0
- package/dist/dashboard/server/LeaderElection.d.ts +81 -0
- package/dist/dashboard/server/LeaderElection.js +268 -0
- package/dist/dashboard/server/MetricsCollector.d.ts +200 -0
- package/dist/dashboard/server/MetricsCollector.js +803 -0
- package/dist/dashboard/server/SessionPersistenceManager.d.ts +88 -0
- package/dist/dashboard/server/SessionPersistenceManager.js +457 -0
- package/dist/dashboard/server/ThinClient.d.ts +64 -0
- package/dist/dashboard/server/ThinClient.js +237 -0
- package/dist/dashboard/server/WebSocketManager.d.ts +161 -0
- package/dist/dashboard/server/WebSocketManager.js +463 -0
- package/dist/dashboard/server/httpLifecycle.d.ts +17 -0
- package/dist/dashboard/server/httpLifecycle.js +35 -0
- package/dist/dashboard/server/legacyDashboardHtml.d.ts +9 -0
- package/dist/dashboard/server/legacyDashboardHtml.js +618 -0
- package/dist/dashboard/server/legacyDashboardStyles.d.ts +5 -0
- package/dist/dashboard/server/legacyDashboardStyles.js +490 -0
- package/dist/dashboard/server/metricsAggregation.d.ts +252 -0
- package/dist/dashboard/server/metricsAggregation.js +206 -0
- package/dist/dashboard/server/metricsSerializer.d.ts +25 -0
- package/dist/dashboard/server/metricsSerializer.js +195 -0
- package/dist/dashboard/server/routes/admin.routes.d.ts +16 -0
- package/dist/dashboard/server/routes/admin.routes.js +596 -0
- package/dist/dashboard/server/routes/alerts.routes.d.ts +7 -0
- package/dist/dashboard/server/routes/alerts.routes.js +93 -0
- package/dist/dashboard/server/routes/api.feedback.routes.d.ts +73 -0
- package/dist/dashboard/server/routes/api.feedback.routes.js +171 -0
- package/dist/dashboard/server/routes/api.instructions.routes.d.ts +101 -0
- package/dist/dashboard/server/routes/api.instructions.routes.js +213 -0
- package/dist/dashboard/server/routes/api.usage.routes.d.ts +57 -0
- package/dist/dashboard/server/routes/api.usage.routes.js +374 -0
- package/dist/dashboard/server/routes/embeddings.routes.d.ts +6 -0
- package/dist/dashboard/server/routes/embeddings.routes.js +246 -0
- package/dist/dashboard/server/routes/graph.routes.d.ts +6 -0
- package/dist/dashboard/server/routes/graph.routes.js +280 -0
- package/dist/dashboard/server/routes/index.d.ts +38 -0
- package/dist/dashboard/server/routes/index.js +194 -0
- package/dist/dashboard/server/routes/instances.routes.d.ts +6 -0
- package/dist/dashboard/server/routes/instances.routes.js +35 -0
- package/dist/dashboard/server/routes/instructions.routes.d.ts +8 -0
- package/dist/dashboard/server/routes/instructions.routes.js +336 -0
- package/dist/dashboard/server/routes/knowledge.routes.d.ts +6 -0
- package/dist/dashboard/server/routes/knowledge.routes.js +82 -0
- package/dist/dashboard/server/routes/logs.routes.d.ts +6 -0
- package/dist/dashboard/server/routes/logs.routes.js +164 -0
- package/dist/dashboard/server/routes/messaging.routes.d.ts +16 -0
- package/dist/dashboard/server/routes/messaging.routes.js +293 -0
- package/dist/dashboard/server/routes/metrics.routes.d.ts +10 -0
- package/dist/dashboard/server/routes/metrics.routes.js +346 -0
- package/dist/dashboard/server/routes/scripts.routes.d.ts +9 -0
- package/dist/dashboard/server/routes/scripts.routes.js +84 -0
- package/dist/dashboard/server/routes/sqlite.routes.d.ts +9 -0
- package/dist/dashboard/server/routes/sqlite.routes.js +569 -0
- package/dist/dashboard/server/routes/status.routes.d.ts +7 -0
- package/dist/dashboard/server/routes/status.routes.js +183 -0
- package/dist/dashboard/server/routes/synthetic.routes.d.ts +7 -0
- package/dist/dashboard/server/routes/synthetic.routes.js +195 -0
- package/dist/dashboard/server/routes/tools.routes.d.ts +6 -0
- package/dist/dashboard/server/routes/tools.routes.js +46 -0
- package/dist/dashboard/server/routes/usage.routes.d.ts +6 -0
- package/dist/dashboard/server/routes/usage.routes.js +25 -0
- package/dist/dashboard/server/wsInit.d.ts +16 -0
- package/dist/dashboard/server/wsInit.js +35 -0
- package/dist/externalClientLib.d.ts +1 -0
- package/dist/externalClientLib.js +2 -0
- package/dist/minimal/index.d.ts +1 -0
- package/dist/minimal/index.js +140 -0
- package/dist/models/SessionPersistence.d.ts +115 -0
- package/dist/models/SessionPersistence.js +66 -0
- package/dist/models/instruction.d.ts +45 -0
- package/dist/models/instruction.js +2 -0
- package/dist/perf/benchmark.d.ts +1 -0
- package/dist/perf/benchmark.js +50 -0
- package/dist/portableClientWrapper.d.ts +1 -0
- package/dist/portableClientWrapper.js +2 -0
- package/dist/schemas/index.d.ts +128 -0
- package/dist/schemas/index.js +371 -0
- package/dist/scripts/runPerformanceBaseline.d.ts +1 -0
- package/dist/scripts/runPerformanceBaseline.js +17 -0
- package/dist/server/handshakeManager.d.ts +25 -0
- package/dist/server/handshakeManager.js +472 -0
- package/dist/server/index-server.d.ts +56 -0
- package/dist/server/index-server.js +822 -0
- package/dist/server/registry.d.ts +44 -0
- package/dist/server/registry.js +236 -0
- package/dist/server/sdkServer.d.ts +8 -0
- package/dist/server/sdkServer.js +299 -0
- package/dist/server/shutdownGuard.d.ts +41 -0
- package/dist/server/shutdownGuard.js +52 -0
- package/dist/server/thin-client.d.ts +22 -0
- package/dist/server/thin-client.js +111 -0
- package/dist/server/transport.d.ts +41 -0
- package/dist/server/transport.js +312 -0
- package/dist/server/transportFactory.d.ts +21 -0
- package/dist/server/transportFactory.js +429 -0
- package/dist/services/atomicFs.d.ts +22 -0
- package/dist/services/atomicFs.js +103 -0
- package/dist/services/auditLog.d.ts +38 -0
- package/dist/services/auditLog.js +142 -0
- package/dist/services/autoBackup.d.ts +14 -0
- package/dist/services/autoBackup.js +171 -0
- package/dist/services/autoSplit.d.ts +32 -0
- package/dist/services/autoSplit.js +113 -0
- package/dist/services/backupZip.d.ts +25 -0
- package/dist/services/backupZip.js +110 -0
- package/dist/services/bootstrapGating.d.ts +123 -0
- package/dist/services/bootstrapGating.js +221 -0
- package/dist/services/canonical.d.ts +23 -0
- package/dist/services/canonical.js +65 -0
- package/dist/services/categoryRules.d.ts +7 -0
- package/dist/services/categoryRules.js +37 -0
- package/dist/services/classificationService.d.ts +42 -0
- package/dist/services/classificationService.js +168 -0
- package/dist/services/embeddingService.d.ts +62 -0
- package/dist/services/embeddingService.js +259 -0
- package/dist/services/errors.d.ts +22 -0
- package/dist/services/errors.js +31 -0
- package/dist/services/featureFlags.d.ts +25 -0
- package/dist/services/featureFlags.js +89 -0
- package/dist/services/features.d.ts +13 -0
- package/dist/services/features.js +35 -0
- package/dist/services/handlers/instructions.add.d.ts +1 -0
- package/dist/services/handlers/instructions.add.js +496 -0
- package/dist/services/handlers/instructions.groom.d.ts +1 -0
- package/dist/services/handlers/instructions.groom.js +523 -0
- package/dist/services/handlers/instructions.import.d.ts +1 -0
- package/dist/services/handlers/instructions.import.js +173 -0
- package/dist/services/handlers/instructions.patch.d.ts +1 -0
- package/dist/services/handlers/instructions.patch.js +167 -0
- package/dist/services/handlers/instructions.query.d.ts +163 -0
- package/dist/services/handlers/instructions.query.js +522 -0
- package/dist/services/handlers/instructions.reload.d.ts +1 -0
- package/dist/services/handlers/instructions.reload.js +13 -0
- package/dist/services/handlers/instructions.remove.d.ts +1 -0
- package/dist/services/handlers/instructions.remove.js +118 -0
- package/dist/services/handlers/instructions.shared.d.ts +31 -0
- package/dist/services/handlers/instructions.shared.js +124 -0
- package/dist/services/handlers.activation.d.ts +1 -0
- package/dist/services/handlers.activation.js +203 -0
- package/dist/services/handlers.bootstrap.d.ts +1 -0
- package/dist/services/handlers.bootstrap.js +38 -0
- package/dist/services/handlers.dashboardConfig.d.ts +34 -0
- package/dist/services/handlers.dashboardConfig.js +108 -0
- package/dist/services/handlers.diagnostics.d.ts +1 -0
- package/dist/services/handlers.diagnostics.js +64 -0
- package/dist/services/handlers.feedback.d.ts +15 -0
- package/dist/services/handlers.feedback.js +378 -0
- package/dist/services/handlers.gates.d.ts +1 -0
- package/dist/services/handlers.gates.js +46 -0
- package/dist/services/handlers.graph.d.ts +53 -0
- package/dist/services/handlers.graph.js +231 -0
- package/dist/services/handlers.help.d.ts +1 -0
- package/dist/services/handlers.help.js +119 -0
- package/dist/services/handlers.instructionSchema.d.ts +1 -0
- package/dist/services/handlers.instructionSchema.js +227 -0
- package/dist/services/handlers.instructions.d.ts +8 -0
- package/dist/services/handlers.instructions.js +14 -0
- package/dist/services/handlers.instructionsDiagnostics.d.ts +1 -0
- package/dist/services/handlers.instructionsDiagnostics.js +14 -0
- package/dist/services/handlers.integrity.d.ts +1 -0
- package/dist/services/handlers.integrity.js +35 -0
- package/dist/services/handlers.manifest.d.ts +1 -0
- package/dist/services/handlers.manifest.js +24 -0
- package/dist/services/handlers.messaging.d.ts +12 -0
- package/dist/services/handlers.messaging.js +203 -0
- package/dist/services/handlers.metrics.d.ts +1 -0
- package/dist/services/handlers.metrics.js +43 -0
- package/dist/services/handlers.promote.d.ts +1 -0
- package/dist/services/handlers.promote.js +306 -0
- package/dist/services/handlers.prompt.d.ts +1 -0
- package/dist/services/handlers.prompt.js +7 -0
- package/dist/services/handlers.search.d.ts +69 -0
- package/dist/services/handlers.search.js +645 -0
- package/dist/services/handlers.testPrimitive.d.ts +1 -0
- package/dist/services/handlers.testPrimitive.js +5 -0
- package/dist/services/handlers.trace.d.ts +1 -0
- package/dist/services/handlers.trace.js +31 -0
- package/dist/services/handlers.usage.d.ts +1 -0
- package/dist/services/handlers.usage.js +11 -0
- package/dist/services/hotScore.d.ts +137 -0
- package/dist/services/hotScore.js +244 -0
- package/dist/services/indexContext.d.ts +117 -0
- package/dist/services/indexContext.js +968 -0
- package/dist/services/indexLoader.d.ts +44 -0
- package/dist/services/indexLoader.js +921 -0
- package/dist/services/indexRepository.d.ts +32 -0
- package/dist/services/indexRepository.js +71 -0
- package/dist/services/indexingService.d.ts +1 -0
- package/dist/services/indexingService.js +2 -0
- package/dist/services/instructions.dispatcher.d.ts +1 -0
- package/dist/services/instructions.dispatcher.js +231 -0
- package/dist/services/logPrefix.d.ts +1 -0
- package/dist/services/logPrefix.js +30 -0
- package/dist/services/logger.d.ts +52 -0
- package/dist/services/logger.js +268 -0
- package/dist/services/manifestManager.d.ts +82 -0
- package/dist/services/manifestManager.js +200 -0
- package/dist/services/messaging/agentMailbox.d.ts +60 -0
- package/dist/services/messaging/agentMailbox.js +353 -0
- package/dist/services/messaging/messagingPersistence.d.ts +20 -0
- package/dist/services/messaging/messagingPersistence.js +111 -0
- package/dist/services/messaging/messagingTypes.d.ts +150 -0
- package/dist/services/messaging/messagingTypes.js +66 -0
- package/dist/services/ownershipService.d.ts +1 -0
- package/dist/services/ownershipService.js +38 -0
- package/dist/services/performanceBaseline.d.ts +19 -0
- package/dist/services/performanceBaseline.js +210 -0
- package/dist/services/preflight.d.ts +12 -0
- package/dist/services/preflight.js +79 -0
- package/dist/services/promptReviewService.d.ts +44 -0
- package/dist/services/promptReviewService.js +101 -0
- package/dist/services/responseEnvelope.d.ts +6 -0
- package/dist/services/responseEnvelope.js +25 -0
- package/dist/services/seedBootstrap.d.ts +34 -0
- package/dist/services/seedBootstrap.js +427 -0
- package/dist/services/storage/factory.d.ts +17 -0
- package/dist/services/storage/factory.js +35 -0
- package/dist/services/storage/hashUtils.d.ts +11 -0
- package/dist/services/storage/hashUtils.js +35 -0
- package/dist/services/storage/index.d.ts +12 -0
- package/dist/services/storage/index.js +18 -0
- package/dist/services/storage/jsonFileStore.d.ts +32 -0
- package/dist/services/storage/jsonFileStore.js +241 -0
- package/dist/services/storage/migrationEngine.d.ts +35 -0
- package/dist/services/storage/migrationEngine.js +93 -0
- package/dist/services/storage/sqliteMessageStore.d.ts +53 -0
- package/dist/services/storage/sqliteMessageStore.js +146 -0
- package/dist/services/storage/sqliteSchema.d.ts +12 -0
- package/dist/services/storage/sqliteSchema.js +122 -0
- package/dist/services/storage/sqliteStore.d.ts +41 -0
- package/dist/services/storage/sqliteStore.js +339 -0
- package/dist/services/storage/sqliteUsageStore.d.ts +35 -0
- package/dist/services/storage/sqliteUsageStore.js +94 -0
- package/dist/services/storage/types.d.ts +171 -0
- package/dist/services/storage/types.js +12 -0
- package/dist/services/toolHandlers.d.ts +23 -0
- package/dist/services/toolHandlers.js +50 -0
- package/dist/services/toolRegistry.d.ts +20 -0
- package/dist/services/toolRegistry.js +490 -0
- package/dist/services/toolRegistry.zod.d.ts +10 -0
- package/dist/services/toolRegistry.zod.js +323 -0
- package/dist/services/tracing.d.ts +26 -0
- package/dist/services/tracing.js +260 -0
- package/dist/services/usageBuckets.d.ts +161 -0
- package/dist/services/usageBuckets.js +364 -0
- package/dist/services/validationService.d.ts +38 -0
- package/dist/services/validationService.js +125 -0
- package/dist/utils/BufferRing.d.ts +203 -0
- package/dist/utils/BufferRing.js +551 -0
- package/dist/utils/BufferRingExamples.d.ts +55 -0
- package/dist/utils/BufferRingExamples.js +188 -0
- package/dist/utils/envUtils.d.ts +42 -0
- package/dist/utils/envUtils.js +80 -0
- package/dist/utils/memoryMonitor.d.ts +83 -0
- package/dist/utils/memoryMonitor.js +275 -0
- package/dist/versioning/schemaVersion.d.ts +6 -0
- package/dist/versioning/schemaVersion.js +93 -0
- package/package.json +134 -0
- package/schemas/README.md +13 -0
- package/schemas/feedback-entry.schema.json +27 -0
- package/schemas/graph-export-v2.schema.json +60 -0
- package/schemas/index-server.code-schema.json +38477 -0
- package/schemas/instruction.schema.json +262 -0
- package/schemas/json-schema/SessionPersistence-persisted-admin-session.schema.json +54 -0
- package/schemas/json-schema/SessionPersistence-persisted-session-history-entry.schema.json +51 -0
- package/schemas/json-schema/SessionPersistence-persisted-web-socket-connection.schema.json +54 -0
- package/schemas/json-schema/SessionPersistence-session-persistence-config.schema.json +110 -0
- package/schemas/json-schema/SessionPersistence-session-persistence-data.schema.json +229 -0
- package/schemas/json-schema/SessionPersistence-session-persistence-manifest.schema.json +109 -0
- package/schemas/json-schema/SessionPersistence-session-persistence-metadata.schema.json +55 -0
- package/schemas/json-schema/instruction-audience-scope.schema.json +14 -0
- package/schemas/json-schema/instruction-content-type.schema.json +17 -0
- package/schemas/json-schema/instruction-instruction-entry.schema.json +206 -0
- package/schemas/json-schema/instruction-requirement-level.schema.json +16 -0
- package/schemas/manifest.json +78 -0
- package/schemas/manifest.schema.json +33 -0
- package/schemas/usage-batch.schema.json +16 -0
- package/schemas/usage-buckets.schema.json +30 -0
- package/schemas/usage-event.schema.json +17 -0
- package/scripts/copy-dashboard-assets.mjs +170 -0
- package/scripts/setup-hooks.cjs +28 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { InstructionEntry } from '../../models/instruction';
|
|
2
|
+
export declare function isMutationEnabled(): boolean;
|
|
3
|
+
export declare function isCI(): boolean;
|
|
4
|
+
export declare function limitResponseSize<T extends Record<string, unknown>>(response: T): T;
|
|
5
|
+
export interface ImportEntry {
|
|
6
|
+
id: string;
|
|
7
|
+
title: string;
|
|
8
|
+
body: string;
|
|
9
|
+
rationale?: string;
|
|
10
|
+
priority: number;
|
|
11
|
+
audience: InstructionEntry['audience'];
|
|
12
|
+
requirement: InstructionEntry['requirement'];
|
|
13
|
+
categories?: unknown[];
|
|
14
|
+
deprecatedBy?: string;
|
|
15
|
+
riskScore?: number;
|
|
16
|
+
version?: string;
|
|
17
|
+
owner?: string;
|
|
18
|
+
status?: InstructionEntry['status'];
|
|
19
|
+
priorityTier?: InstructionEntry['priorityTier'];
|
|
20
|
+
classification?: InstructionEntry['classification'];
|
|
21
|
+
lastReviewedAt?: string;
|
|
22
|
+
nextReviewDue?: string;
|
|
23
|
+
changeLog?: InstructionEntry['changeLog'];
|
|
24
|
+
semanticSummary?: string;
|
|
25
|
+
contentType?: InstructionEntry['contentType'];
|
|
26
|
+
}
|
|
27
|
+
export declare function guard<TParams, TResult>(name: string, fn: (p: TParams) => TResult): (p: TParams) => TResult;
|
|
28
|
+
export declare function traceVisibility(): boolean;
|
|
29
|
+
export declare function traceInstructionVisibility(id: string, phase: string, extra?: Record<string, unknown>): void;
|
|
30
|
+
export declare function traceEnvSnapshot(phase: string, extra?: Record<string, unknown>): void;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isMutationEnabled = isMutationEnabled;
|
|
7
|
+
exports.isCI = isCI;
|
|
8
|
+
exports.limitResponseSize = limitResponseSize;
|
|
9
|
+
exports.guard = guard;
|
|
10
|
+
exports.traceVisibility = traceVisibility;
|
|
11
|
+
exports.traceInstructionVisibility = traceInstructionVisibility;
|
|
12
|
+
exports.traceEnvSnapshot = traceEnvSnapshot;
|
|
13
|
+
// Shared utilities used across instruction handler submodules.
|
|
14
|
+
const fs_1 = __importDefault(require("fs"));
|
|
15
|
+
const path_1 = __importDefault(require("path"));
|
|
16
|
+
const indexContext_1 = require("../indexContext");
|
|
17
|
+
const runtimeConfig_1 = require("../../config/runtimeConfig");
|
|
18
|
+
const tracing_1 = require("../tracing");
|
|
19
|
+
function isMutationEnabled() {
|
|
20
|
+
return (0, runtimeConfig_1.getRuntimeConfig)().mutation.enabled;
|
|
21
|
+
}
|
|
22
|
+
function isCI() {
|
|
23
|
+
const ctx = (0, runtimeConfig_1.getRuntimeConfig)().instructions.ciContext;
|
|
24
|
+
return ctx.inCI || ctx.githubActions || ctx.tfBuild;
|
|
25
|
+
}
|
|
26
|
+
function limitResponseSize(response) {
|
|
27
|
+
if (!isCI())
|
|
28
|
+
return response;
|
|
29
|
+
const responseStr = JSON.stringify(response);
|
|
30
|
+
if (responseStr.length <= 60000)
|
|
31
|
+
return response;
|
|
32
|
+
if ('items' in response && Array.isArray(response.items) && response.items.length > 3) {
|
|
33
|
+
return {
|
|
34
|
+
...response,
|
|
35
|
+
items: response.items.slice(0, 3),
|
|
36
|
+
ciLimited: true,
|
|
37
|
+
originalCount: response.items.length,
|
|
38
|
+
message: 'Response limited in CI environment to prevent truncation'
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return response;
|
|
42
|
+
}
|
|
43
|
+
function guard(name, fn) {
|
|
44
|
+
return (p) => {
|
|
45
|
+
const viaDispatcher = !!(p && typeof p === 'object' && p._viaDispatcher);
|
|
46
|
+
if (!isMutationEnabled() && !viaDispatcher) {
|
|
47
|
+
throw { code: -32601, message: `Mutation disabled. Use index_dispatch with action parameter instead of direct ${name} calls. Set INDEX_SERVER_MUTATION=1 to enable direct calls.`, data: { method: name, alternative: 'index_dispatch', reason: 'mutation_disabled' } };
|
|
48
|
+
}
|
|
49
|
+
return fn(p);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function traceVisibility() { return (0, tracing_1.traceEnabled)(1); }
|
|
53
|
+
function traceInstructionVisibility(id, phase, extra) {
|
|
54
|
+
if (!traceVisibility())
|
|
55
|
+
return;
|
|
56
|
+
try {
|
|
57
|
+
const dir = (0, indexContext_1.getInstructionsDir)();
|
|
58
|
+
const file = path_1.default.join(dir, `${id}.json`);
|
|
59
|
+
const st = (0, indexContext_1.ensureLoaded)();
|
|
60
|
+
const indexItem = st.byId.get(id);
|
|
61
|
+
let fileExists = false;
|
|
62
|
+
let fileSize;
|
|
63
|
+
let mtime;
|
|
64
|
+
let diskHash;
|
|
65
|
+
if (fs_1.default.existsSync(file)) {
|
|
66
|
+
fileExists = true;
|
|
67
|
+
const stat = fs_1.default.statSync(file);
|
|
68
|
+
fileSize = stat.size;
|
|
69
|
+
mtime = stat.mtime.toISOString();
|
|
70
|
+
try {
|
|
71
|
+
const rawTxt = fs_1.default.readFileSync(file, 'utf8');
|
|
72
|
+
try {
|
|
73
|
+
const rawJson = JSON.parse(rawTxt);
|
|
74
|
+
if (typeof rawJson.sourceHash === 'string')
|
|
75
|
+
diskHash = rawJson.sourceHash;
|
|
76
|
+
}
|
|
77
|
+
catch { /* ignore parse */ }
|
|
78
|
+
}
|
|
79
|
+
catch { /* ignore read */ }
|
|
80
|
+
}
|
|
81
|
+
(0, tracing_1.emitTrace)('[trace:visibility]', {
|
|
82
|
+
phase,
|
|
83
|
+
id,
|
|
84
|
+
dir,
|
|
85
|
+
now: new Date().toISOString(),
|
|
86
|
+
fileExists,
|
|
87
|
+
fileSize,
|
|
88
|
+
mtime,
|
|
89
|
+
diskHash,
|
|
90
|
+
indexHas: !!indexItem,
|
|
91
|
+
indexSourceHash: indexItem?.sourceHash,
|
|
92
|
+
indexUpdatedAt: indexItem?.updatedAt,
|
|
93
|
+
serverHash: st.hash,
|
|
94
|
+
listCount: st.list.length,
|
|
95
|
+
sampleIds: st.list.slice(0, 3).map(e => e.id),
|
|
96
|
+
...extra
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
catch { /* swallow tracing issues */ }
|
|
100
|
+
}
|
|
101
|
+
function traceEnvSnapshot(phase, extra) {
|
|
102
|
+
if (!traceVisibility())
|
|
103
|
+
return;
|
|
104
|
+
try {
|
|
105
|
+
const cfg = (0, runtimeConfig_1.getRuntimeConfig)();
|
|
106
|
+
const instructionsCfg = cfg.instructions;
|
|
107
|
+
const indexCfg = cfg.index;
|
|
108
|
+
(0, tracing_1.emitTrace)('[trace:env]', {
|
|
109
|
+
phase,
|
|
110
|
+
pid: process.pid,
|
|
111
|
+
flags: {
|
|
112
|
+
mutationEnabled: cfg.mutation.enabled,
|
|
113
|
+
strictCreate: instructionsCfg.strictCreate,
|
|
114
|
+
canonicalDisable: instructionsCfg.canonicalDisable,
|
|
115
|
+
readRetries: indexCfg.readRetries.attempts,
|
|
116
|
+
readBackoffMs: indexCfg.readRetries.backoffMs,
|
|
117
|
+
requireCategory: instructionsCfg.requireCategory,
|
|
118
|
+
instructionsDir: indexCfg.baseDir
|
|
119
|
+
},
|
|
120
|
+
...extra
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
catch { /* ignore env tracing errors */ }
|
|
124
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* VS Code Activation Guide Handler
|
|
5
|
+
*
|
|
6
|
+
* Provides a stable read-only tool 'meta_activation_guide' that returns comprehensive
|
|
7
|
+
* guidance for activating Index Server tools in VSCode. Addresses the common pain
|
|
8
|
+
* point where tools show as "disabled by the user" despite correct settings.json configuration.
|
|
9
|
+
*
|
|
10
|
+
* Key insight: settings.json configuration is necessary but NOT sufficient - activation
|
|
11
|
+
* functions must be called to actually enable tools in VSCode.
|
|
12
|
+
*
|
|
13
|
+
* Created: 2026-02-01 (in response to repeated multi-session activation pain)
|
|
14
|
+
*/
|
|
15
|
+
const registry_1 = require("../server/registry");
|
|
16
|
+
const ACTIVATION_GUIDE_VERSION = '1.0.0';
|
|
17
|
+
(0, registry_1.registerHandler)('meta_activation_guide', () => {
|
|
18
|
+
return {
|
|
19
|
+
version: ACTIVATION_GUIDE_VERSION,
|
|
20
|
+
generatedAt: new Date().toISOString(),
|
|
21
|
+
problem: 'Index Server tools show as "disabled by the user" in VSCode even when properly configured in settings.json (chat.mcp.tools)',
|
|
22
|
+
rootCause: 'Settings.json configuration provides permission framework but does NOT trigger actual tool enablement. Activation functions must be called explicitly.',
|
|
23
|
+
solution: 'Call VSCode activation functions to enable tool categories. These functions are VSCode client-side features that must be invoked before using MCP tools.',
|
|
24
|
+
categories: {
|
|
25
|
+
instructionManagement: {
|
|
26
|
+
function: 'activate_instruction_management_and_operations_tools()',
|
|
27
|
+
description: 'Core instruction index operations: add, search, dispatch, remove, repair, import, normalize, reload',
|
|
28
|
+
tools: [
|
|
29
|
+
'index_add',
|
|
30
|
+
'index_dispatch',
|
|
31
|
+
'index_search',
|
|
32
|
+
'index_remove',
|
|
33
|
+
'index_repair',
|
|
34
|
+
'index_import',
|
|
35
|
+
'index_health',
|
|
36
|
+
'index_normalize',
|
|
37
|
+
'index_reload',
|
|
38
|
+
'usage_track',
|
|
39
|
+
'usage_hotset',
|
|
40
|
+
'manifest_refresh'
|
|
41
|
+
],
|
|
42
|
+
toolCount: 12
|
|
43
|
+
},
|
|
44
|
+
graphAndSchema: {
|
|
45
|
+
function: 'activate_instruction_graph_and_schema_tools()',
|
|
46
|
+
description: 'Instruction graph export and JSON schema retrieval',
|
|
47
|
+
tools: ['graph_export', 'index_schema'],
|
|
48
|
+
toolCount: 2
|
|
49
|
+
},
|
|
50
|
+
governance: {
|
|
51
|
+
function: 'activate_governance_management_tools()',
|
|
52
|
+
description: 'Governance operations: enrich placeholder fields, compute/update governance hash',
|
|
53
|
+
tools: [
|
|
54
|
+
'index_enrich',
|
|
55
|
+
'index_governanceHash',
|
|
56
|
+
'index_governanceUpdate'
|
|
57
|
+
],
|
|
58
|
+
toolCount: 3
|
|
59
|
+
},
|
|
60
|
+
manifest: {
|
|
61
|
+
function: 'activate_manifest_management_tools()',
|
|
62
|
+
description: 'index manifest repair and status checks',
|
|
63
|
+
tools: ['manifest_repair', 'manifest_status'],
|
|
64
|
+
toolCount: 2
|
|
65
|
+
},
|
|
66
|
+
bootstrap: {
|
|
67
|
+
function: 'activate_bootstrap_management_tools()',
|
|
68
|
+
description: 'Bootstrap confirmation and finalization for guarded mutations',
|
|
69
|
+
tools: [
|
|
70
|
+
'bootstrap_request',
|
|
71
|
+
'bootstrap_confirmFinalize',
|
|
72
|
+
'bootstrap_status'
|
|
73
|
+
],
|
|
74
|
+
toolCount: 3
|
|
75
|
+
},
|
|
76
|
+
diagnostics: {
|
|
77
|
+
function: 'activate_diagnostic_stress_testing_tools()',
|
|
78
|
+
description: 'CPU/memory/microtask stress testing for performance analysis',
|
|
79
|
+
tools: [
|
|
80
|
+
'diagnostics_block',
|
|
81
|
+
'diagnostics_memoryPressure',
|
|
82
|
+
'diagnostics_microtaskFlood'
|
|
83
|
+
],
|
|
84
|
+
toolCount: 3
|
|
85
|
+
},
|
|
86
|
+
health: {
|
|
87
|
+
function: 'activate_feedback_and_health_monitoring_tools()',
|
|
88
|
+
description: 'Feedback submission and system health monitoring',
|
|
89
|
+
tools: [
|
|
90
|
+
'feedback_submit',
|
|
91
|
+
'feedback_list',
|
|
92
|
+
'feedback_health',
|
|
93
|
+
'feedback_stats',
|
|
94
|
+
'health_check'
|
|
95
|
+
],
|
|
96
|
+
toolCount: 5
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
quickStart: {
|
|
100
|
+
step1: 'Identify which tool you need (e.g., index_search)',
|
|
101
|
+
step2: 'Find matching category in activation categories above (e.g., instructionManagement)',
|
|
102
|
+
step3: 'Call the activation function with NO parameters: activate_instruction_management_and_operations_tools()',
|
|
103
|
+
step4: 'Retry your tool call - it should now work'
|
|
104
|
+
},
|
|
105
|
+
example: {
|
|
106
|
+
problem: 'Error: Tool "mcp_mcp-index-ser_index_search" is disabled by the user',
|
|
107
|
+
solution: 'Call: activate_instruction_management_and_operations_tools()',
|
|
108
|
+
verification: 'Retry index_search - should now execute successfully'
|
|
109
|
+
},
|
|
110
|
+
commonMistake: 'Assuming settings.json configuration (chat.mcp.tools) alone enables tools. Configuration provides permission framework but activation functions actually enable the tools.',
|
|
111
|
+
troubleshooting: [
|
|
112
|
+
{
|
|
113
|
+
symptom: 'All tools show as disabled despite settings.json configuration',
|
|
114
|
+
diagnosis: 'Activation functions not called',
|
|
115
|
+
fix: 'Call all activation functions listed in categories section above'
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
symptom: 'Some tool categories work, others disabled',
|
|
119
|
+
diagnosis: 'Only some activation functions called',
|
|
120
|
+
fix: 'Identify missing categories and call their activation functions'
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
symptom: 'Tools were working, now disabled after VSCode restart',
|
|
124
|
+
diagnosis: 'Activation state not persisted across sessions',
|
|
125
|
+
fix: 'Re-call activation functions after VSCode restart'
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
symptom: 'Cannot find activation function for a tool',
|
|
129
|
+
diagnosis: 'Tool may not require activation OR wrong MCP server',
|
|
130
|
+
fix: 'Verify tool belongs to index via meta_tools, check tool name mapping in categories above'
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
relatedResources: {
|
|
134
|
+
instruction: 'mcp-tool-activation-critical-p0 (P0 instruction in Index Server index)',
|
|
135
|
+
documentation: 'See INDEX_SERVER_TOOL_ACTIVATION_IMPROVEMENT_PLAN.md in repository for detailed analysis'
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
(0, registry_1.registerHandler)('meta_check_activation', (params) => {
|
|
140
|
+
const toolName = params?.toolName;
|
|
141
|
+
if (!toolName) {
|
|
142
|
+
return {
|
|
143
|
+
found: false,
|
|
144
|
+
message: 'Parameter "toolName" is required (e.g., {"toolName": "index_search"})'
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
// Map tool names to activation categories
|
|
148
|
+
const toolMapping = {
|
|
149
|
+
'index_add': { category: 'instructionManagement', function: 'activate_instruction_management_and_operations_tools' },
|
|
150
|
+
'index_dispatch': { category: 'instructionManagement', function: 'activate_instruction_management_and_operations_tools' },
|
|
151
|
+
'index_search': { category: 'instructionManagement', function: 'activate_instruction_management_and_operations_tools' },
|
|
152
|
+
'index_remove': { category: 'instructionManagement', function: 'activate_instruction_management_and_operations_tools' },
|
|
153
|
+
'index_repair': { category: 'instructionManagement', function: 'activate_instruction_management_and_operations_tools' },
|
|
154
|
+
'index_import': { category: 'instructionManagement', function: 'activate_instruction_management_and_operations_tools' },
|
|
155
|
+
'index_health': { category: 'instructionManagement', function: 'activate_instruction_management_and_operations_tools' },
|
|
156
|
+
'index_normalize': { category: 'instructionManagement', function: 'activate_instruction_management_and_operations_tools' },
|
|
157
|
+
'index_reload': { category: 'instructionManagement', function: 'activate_instruction_management_and_operations_tools' },
|
|
158
|
+
'usage_track': { category: 'instructionManagement', function: 'activate_instruction_management_and_operations_tools' },
|
|
159
|
+
'usage_hotset': { category: 'instructionManagement', function: 'activate_instruction_management_and_operations_tools' },
|
|
160
|
+
'manifest_refresh': { category: 'instructionManagement', function: 'activate_instruction_management_and_operations_tools' },
|
|
161
|
+
'graph_export': { category: 'graphAndSchema', function: 'activate_instruction_graph_and_schema_tools' },
|
|
162
|
+
'index_schema': { category: 'graphAndSchema', function: 'activate_instruction_graph_and_schema_tools' },
|
|
163
|
+
'index_enrich': { category: 'governance', function: 'activate_governance_management_tools' },
|
|
164
|
+
'index_governanceHash': { category: 'governance', function: 'activate_governance_management_tools' },
|
|
165
|
+
'index_governanceUpdate': { category: 'governance', function: 'activate_governance_management_tools' },
|
|
166
|
+
'manifest_repair': { category: 'manifest', function: 'activate_manifest_management_tools' },
|
|
167
|
+
'manifest_status': { category: 'manifest', function: 'activate_manifest_management_tools' },
|
|
168
|
+
'bootstrap_request': { category: 'bootstrap', function: 'activate_bootstrap_management_tools' },
|
|
169
|
+
'bootstrap_confirmFinalize': { category: 'bootstrap', function: 'activate_bootstrap_management_tools' },
|
|
170
|
+
'bootstrap_status': { category: 'bootstrap', function: 'activate_bootstrap_management_tools' },
|
|
171
|
+
'diagnostics_block': { category: 'diagnostics', function: 'activate_diagnostic_stress_testing_tools' },
|
|
172
|
+
'diagnostics_memoryPressure': { category: 'diagnostics', function: 'activate_diagnostic_stress_testing_tools' },
|
|
173
|
+
'diagnostics_microtaskFlood': { category: 'diagnostics', function: 'activate_diagnostic_stress_testing_tools' },
|
|
174
|
+
'feedback_submit': { category: 'health', function: 'activate_feedback_and_health_monitoring_tools' },
|
|
175
|
+
'feedback_list': { category: 'health', function: 'activate_feedback_and_health_monitoring_tools' },
|
|
176
|
+
'feedback_health': { category: 'health', function: 'activate_feedback_and_health_monitoring_tools' },
|
|
177
|
+
'feedback_stats': { category: 'health', function: 'activate_feedback_and_health_monitoring_tools' },
|
|
178
|
+
'health_check': { category: 'health', function: 'activate_feedback_and_health_monitoring_tools' }
|
|
179
|
+
};
|
|
180
|
+
const mapping = toolMapping[toolName];
|
|
181
|
+
if (!mapping) {
|
|
182
|
+
return {
|
|
183
|
+
found: true,
|
|
184
|
+
tool: toolName,
|
|
185
|
+
activationRequired: false,
|
|
186
|
+
message: `Tool '${toolName}' not found in activation mapping. May not require activation, or tool name is incorrect.`
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
found: true,
|
|
191
|
+
tool: toolName,
|
|
192
|
+
activationRequired: true,
|
|
193
|
+
activationFunction: mapping.function,
|
|
194
|
+
activationCategory: mapping.category,
|
|
195
|
+
instructions: `To use '${toolName}' in VSCode:
|
|
196
|
+
1. Call: ${mapping.function}()
|
|
197
|
+
2. Retry tool call: ${toolName}
|
|
198
|
+
3. Tool should now execute successfully
|
|
199
|
+
|
|
200
|
+
Common issue: Settings.json configuration alone does NOT enable tools.`,
|
|
201
|
+
settingsJsonNote: 'Ensure tool is enabled in settings.json (chat.mcp.tools.index["' + toolName + '"]: true) but this configuration alone is insufficient for activation.'
|
|
202
|
+
};
|
|
203
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const registry_1 = require("../server/registry");
|
|
4
|
+
const bootstrapGating_1 = require("./bootstrapGating");
|
|
5
|
+
(0, registry_1.registerHandler)('bootstrap_request', (p) => {
|
|
6
|
+
const reason = (0, bootstrapGating_1.mutationGatedReason)();
|
|
7
|
+
return { status: (0, bootstrapGating_1.getBootstrapStatus)(), gatedReason: reason, ...(0, bootstrapGating_1.requestBootstrapToken)(p?.rationale) };
|
|
8
|
+
});
|
|
9
|
+
(0, registry_1.registerHandler)('bootstrap_confirmFinalize', (p) => {
|
|
10
|
+
if (!p || typeof p.token !== 'string' || !p.token.trim())
|
|
11
|
+
return { error: 'missing_token' };
|
|
12
|
+
const result = (0, bootstrapGating_1.finalizeBootstrapToken)(p.token.trim());
|
|
13
|
+
return { result, status: (0, bootstrapGating_1.getBootstrapStatus)() };
|
|
14
|
+
});
|
|
15
|
+
(0, registry_1.registerHandler)('bootstrap_status', () => {
|
|
16
|
+
return { status: (0, bootstrapGating_1.getBootstrapStatus)(), gatedReason: (0, bootstrapGating_1.mutationGatedReason)() };
|
|
17
|
+
});
|
|
18
|
+
// Unified bootstrap handler (002 Phase 2c)
|
|
19
|
+
(0, registry_1.registerHandler)('bootstrap', (params) => {
|
|
20
|
+
const { action, ...rest } = params || {};
|
|
21
|
+
if (!action)
|
|
22
|
+
throw new Error('Missing required parameter: action');
|
|
23
|
+
if (action === 'status') {
|
|
24
|
+
return (0, bootstrapGating_1.getBootstrapStatus)();
|
|
25
|
+
}
|
|
26
|
+
if (action === 'request') {
|
|
27
|
+
const reason = (0, bootstrapGating_1.mutationGatedReason)();
|
|
28
|
+
return { status: (0, bootstrapGating_1.getBootstrapStatus)(), gatedReason: reason, ...(0, bootstrapGating_1.requestBootstrapToken)(rest.rationale) };
|
|
29
|
+
}
|
|
30
|
+
if (action === 'confirm') {
|
|
31
|
+
const token = rest.token;
|
|
32
|
+
if (!token || typeof token !== 'string' || !token.trim())
|
|
33
|
+
return { error: 'missing_token' };
|
|
34
|
+
const result = (0, bootstrapGating_1.finalizeBootstrapToken)(token.trim());
|
|
35
|
+
return { result, status: (0, bootstrapGating_1.getBootstrapStatus)() };
|
|
36
|
+
}
|
|
37
|
+
throw new Error(`Unknown bootstrap action: ${action}. Valid: request, confirm, status`);
|
|
38
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dashboard_config
|
|
3
|
+
* Returns a deterministic snapshot of all recognized environment / feature flags regardless of current value.
|
|
4
|
+
* This consolidates scattered documentation, enabling the dashboard (and tests) to surface:
|
|
5
|
+
* - Current value (raw)
|
|
6
|
+
* - Parsed boolean (when applicable)
|
|
7
|
+
* - Default semantics
|
|
8
|
+
* - Category (core | dashboard | instructions | manifest | tracing | diagnostics | stress | usage | validation | auth | metrics | experimental)
|
|
9
|
+
* - Description
|
|
10
|
+
* - Stability (stable | diagnostic | experimental | deprecated | reserved)
|
|
11
|
+
* - Since (version first introduced when known – best effort)
|
|
12
|
+
*
|
|
13
|
+
* The list is curated (not discovered dynamically) to ensure ordering stability and to include flags
|
|
14
|
+
* that might not appear in code paths when disabled. Additions should append (not reorder) to maintain
|
|
15
|
+
* predictable client diffing.
|
|
16
|
+
*/
|
|
17
|
+
export interface FlagMeta {
|
|
18
|
+
name: string;
|
|
19
|
+
category: string;
|
|
20
|
+
description: string;
|
|
21
|
+
stability: 'stable' | 'diagnostic' | 'experimental' | 'deprecated' | 'reserved';
|
|
22
|
+
since?: string;
|
|
23
|
+
default?: string;
|
|
24
|
+
type?: 'boolean' | 'string' | 'number';
|
|
25
|
+
}
|
|
26
|
+
export interface FlagRuntime extends FlagMeta {
|
|
27
|
+
value?: string;
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
parsed?: unknown;
|
|
30
|
+
docAnchor?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const FLAG_REGISTRY: FlagMeta[];
|
|
33
|
+
export declare function getFlagRegistrySnapshot(): FlagRuntime[];
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FLAG_REGISTRY = void 0;
|
|
4
|
+
exports.getFlagRegistrySnapshot = getFlagRegistrySnapshot;
|
|
5
|
+
const registry_1 = require("../server/registry");
|
|
6
|
+
const envUtils_1 = require("../utils/envUtils");
|
|
7
|
+
// Curated registry. Order is intentional for grouping high-value operational flags first.
|
|
8
|
+
exports.FLAG_REGISTRY = [
|
|
9
|
+
// Core operation & dashboard
|
|
10
|
+
{ name: 'INDEX_SERVER_MUTATION', category: 'core', description: 'Enable mutation tools (add/import/remove/enrich/governance updates).', stability: 'stable', default: 'off', type: 'boolean', since: '1.0.0' },
|
|
11
|
+
{ name: 'INDEX_SERVER_VERBOSE_LOGGING', category: 'core', description: 'Verbose logging (handshake, dispatch timings).', stability: 'stable', default: 'off', type: 'boolean', since: '1.0.0' },
|
|
12
|
+
{ name: 'INDEX_SERVER_LOG_DIAG', category: 'diagnostics', description: 'Diagnostic logging (lower-level/internal).', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.0.0' },
|
|
13
|
+
{ name: 'INDEX_SERVER_DASHBOARD', category: 'dashboard', description: 'Enable admin dashboard HTTP server.', stability: 'stable', default: 'off', type: 'boolean', since: '1.0.0' },
|
|
14
|
+
{ name: 'INDEX_SERVER_DASHBOARD_PORT', category: 'dashboard', description: 'Dashboard port.', stability: 'stable', default: '8787', type: 'number', since: '1.0.0' },
|
|
15
|
+
{ name: 'INDEX_SERVER_DASHBOARD_HOST', category: 'dashboard', description: 'Dashboard bind host.', stability: 'stable', default: '127.0.0.1', type: 'string', since: '1.0.0' },
|
|
16
|
+
{ name: 'INDEX_SERVER_DASHBOARD_TRIES', category: 'dashboard', description: 'Dashboard port retry attempts.', stability: 'stable', default: '10', type: 'number', since: '1.0.0' },
|
|
17
|
+
// Manifest & index
|
|
18
|
+
{ name: 'INDEX_SERVER_MANIFEST_WRITE', category: 'manifest', description: 'Allow writing index manifest (set 0 to disable).', stability: 'stable', default: 'on', type: 'boolean', since: '1.1.0' },
|
|
19
|
+
{ name: 'INDEX_SERVER_MANIFEST_FASTLOAD', category: 'manifest', description: 'Preview fastload path (currently reserved).', stability: 'reserved', default: 'off', type: 'boolean', since: '1.1.0' },
|
|
20
|
+
{ name: 'INDEX_SERVER_ENABLE_INDEX_SERVER_POLLER', category: 'manifest', description: 'Enable background version marker poller (cross-process propagation).', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.1' },
|
|
21
|
+
{ name: 'INDEX_SERVER_POLL_MS', category: 'manifest', description: 'Index poll interval ms when poller enabled.', stability: 'diagnostic', default: '10000', type: 'number', since: '1.1.1' },
|
|
22
|
+
{ name: 'INDEX_SERVER_POLL_PROACTIVE', category: 'manifest', description: 'Proactive reload on poll interval even if version unchanged.', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.1' },
|
|
23
|
+
// Instructions strictness / visibility / creation controls
|
|
24
|
+
{ name: 'INDEX_SERVER_STRICT_CREATE', category: 'index', description: 'After add, perform strict visibility verification chain.', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.1' },
|
|
25
|
+
{ name: 'INDEX_SERVER_STRICT_REMOVE', category: 'index', description: 'After remove, enforce strict verification of absence.', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.1' },
|
|
26
|
+
{ name: 'INDEX_SERVER_TEST_STRICT_VISIBILITY', category: 'instructions', description: 'Test-only strict fallback path for immediate get/query discoverability.', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.1' },
|
|
27
|
+
{ name: 'INDEX_SERVER_REQUIRE_CATEGORY', category: 'instructions', description: 'Reject instructions missing category unless lax override set.', stability: 'stable', default: 'off', type: 'boolean', since: '1.0.0' },
|
|
28
|
+
{ name: 'INDEX_SERVER_CANONICAL_DISABLE', category: 'instructions', description: 'Disable canonical sourceHash persistence (forces runtime recompute).', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.1' },
|
|
29
|
+
{ name: 'INDEX_SERVER_READ_RETRIES', category: 'instructions', description: 'Retries for post-add disk visibility checks.', stability: 'diagnostic', default: '5', type: 'number', since: '1.1.1' },
|
|
30
|
+
{ name: 'INDEX_SERVER_READ_BACKOFF_MS', category: 'instructions', description: 'Backoff ms between read retries.', stability: 'diagnostic', default: '10', type: 'number', since: '1.1.1' },
|
|
31
|
+
// Tracing & logging advanced
|
|
32
|
+
{ name: 'INDEX_SERVER_TRACE_LEVEL', category: 'tracing', description: 'Explicit trace level (off|core|perf|files|verbose).', stability: 'stable', default: 'off', type: 'string', since: '1.1.2' },
|
|
33
|
+
{ name: 'INDEX_SERVER_TRACE_ALL', category: 'tracing', description: 'Force maximum trace verbosity.', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.2' },
|
|
34
|
+
{ name: 'INDEX_SERVER_TRACE_PERSIST', category: 'tracing', description: 'Enable persistent JSONL trace output (auto file).', stability: 'stable', default: 'off', type: 'boolean', since: '1.1.2' },
|
|
35
|
+
{ name: 'INDEX_SERVER_TRACE_FILE', category: 'tracing', description: 'Explicit trace output file path.', stability: 'stable', default: '(unset)', type: 'string', since: '1.1.2' },
|
|
36
|
+
{ name: 'INDEX_SERVER_TRACE_DIR', category: 'tracing', description: 'Directory for auto trace files.', stability: 'stable', default: './logs/trace', type: 'string', since: '1.1.2' },
|
|
37
|
+
{ name: 'INDEX_SERVER_TRACE_MAX_FILE_SIZE', category: 'tracing', description: 'Rotate trace file after exceeding N bytes (0=off).', stability: 'stable', default: '0', type: 'number', since: '1.1.2' },
|
|
38
|
+
{ name: 'INDEX_SERVER_TRACE_CATEGORIES', category: 'tracing', description: 'Comma/space list of allowed trace categories (filter).', stability: 'stable', default: '(all)', type: 'string', since: '1.1.2' },
|
|
39
|
+
{ name: 'INDEX_SERVER_TRACE_SESSION', category: 'tracing', description: 'Explicit trace session id.', stability: 'stable', default: '(random)', type: 'string', since: '1.1.2' },
|
|
40
|
+
{ name: 'INDEX_SERVER_TRACE_CALLSITE', category: 'tracing', description: 'Include emitting function callsite (verbose or explicit).', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.2' },
|
|
41
|
+
{ name: 'INDEX_SERVER_TRACE_FSYNC', category: 'tracing', description: 'fsync after each trace write (heavy, diagnostics only).', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.2' },
|
|
42
|
+
{ name: 'INDEX_SERVER_TRACE_BUFFER_SIZE', category: 'tracing', description: 'Enable in-memory ring buffer of last N trace frames.', stability: 'experimental', default: '0', type: 'number', since: '1.1.2' },
|
|
43
|
+
{ name: 'INDEX_SERVER_TRACE_BUFFER_FILE', category: 'tracing', description: 'Explicit file path for buffer dump.', stability: 'experimental', default: './logs/trace/trace-buffer.json', type: 'string', since: '1.1.2' },
|
|
44
|
+
{ name: 'INDEX_SERVER_TRACE_BUFFER_DUMP_ON_EXIT', category: 'tracing', description: 'Dump ring buffer automatically on process exit.', stability: 'experimental', default: 'off', type: 'boolean', since: '1.1.2' },
|
|
45
|
+
{ name: 'INDEX_SERVER_VISIBILITY_DIAG', category: 'tracing', description: 'Force core trace level for visibility diagnostics.', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.1' },
|
|
46
|
+
{ name: 'INDEX_SERVER_FILE_TRACE', category: 'tracing', description: 'Promote index file events to trace level (files).', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.1' },
|
|
47
|
+
// Usage & metrics
|
|
48
|
+
{ name: 'INDEX_SERVER_DISABLE_USAGE_RATE_LIMIT', category: 'usage', description: 'Disable internal usage sampling rate limit.', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.1' },
|
|
49
|
+
{ name: 'INDEX_SERVER_DISABLE_USAGE_CLAMP', category: 'usage', description: 'Disable initial usage count clamp logic.', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.1' },
|
|
50
|
+
{ name: 'INDEX_SERVER_USAGE_FLUSH_MS', category: 'usage', description: 'Override usage flush debounce interval.', stability: 'diagnostic', default: '75', type: 'number', since: '1.1.1' },
|
|
51
|
+
// Validation / schema
|
|
52
|
+
{ name: 'INDEX_SERVER_VALIDATION_MODE', category: 'validation', description: 'Schema validation engine selection (ajv|zod|auto).', stability: 'stable', default: 'zod', type: 'string', since: '1.1.2' },
|
|
53
|
+
// Handshake / transport / performance diagnostics
|
|
54
|
+
{ name: 'INDEX_SERVER_DISABLE_EARLY_STDIN_BUFFER', category: 'diagnostics', description: 'Disable early stdin buffering (compare fragmentation behavior).', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.1' },
|
|
55
|
+
{ name: 'INDEX_SERVER_FATAL_EXIT_DELAY_MS', category: 'diagnostics', description: 'Delay before forced fatal exit (ms).', stability: 'diagnostic', default: '15', type: 'number', since: '1.1.1' },
|
|
56
|
+
{ name: 'INDEX_SERVER_IDLE_KEEPALIVE_MS', category: 'diagnostics', description: 'Keepalive interval for idle transports.', stability: 'stable', default: '30000', type: 'number', since: '1.0.0' },
|
|
57
|
+
{ name: 'INDEX_SERVER_ADD_TIMING', category: 'diagnostics', description: 'Embed per-tool timing phase marks in response envelope.', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.1' },
|
|
58
|
+
{ name: 'INDEX_SERVER_TRACE_DISPATCH_DIAG', category: 'diagnostics', description: 'Extra dispatcher timing/phase logs (use INDEX_SERVER_TRACE=dispatchDiag).', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.1' },
|
|
59
|
+
// Stress / adversarial
|
|
60
|
+
{ name: 'INDEX_SERVER_STRESS_DIAG', category: 'stress', description: 'Enable stress suite & escalated diagnostic loops.', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.0' },
|
|
61
|
+
// Auth / security (placeholders for future expansion)
|
|
62
|
+
{ name: 'INDEX_SERVER_REQUIRE_AUTH_ALL', category: 'auth', description: 'Require auth for all tool calls (future integration).', stability: 'experimental', default: 'off', type: 'boolean', since: '1.1.2' },
|
|
63
|
+
{ name: 'INDEX_SERVER_AUTH_KEY', category: 'auth', description: 'Static auth key / token (development only).', stability: 'experimental', default: '(unset)', type: 'string', since: '1.1.2' },
|
|
64
|
+
// Metrics collection (file-based)
|
|
65
|
+
{ name: 'INDEX_SERVER_METRICS_FILE_STORAGE', category: 'metrics', description: 'Persist metrics snapshots to files for dashboard aggregation.', stability: 'experimental', default: 'off', type: 'boolean', since: '1.1.2' },
|
|
66
|
+
{ name: 'INDEX_SERVER_METRICS_DIR', category: 'metrics', description: 'Directory for metrics file storage.', stability: 'experimental', default: './metrics', type: 'string', since: '1.1.2' },
|
|
67
|
+
{ name: 'INDEX_SERVER_METRICS_MAX_FILES', category: 'metrics', description: 'Max metrics files to retain (rotation).', stability: 'experimental', default: '720', type: 'number', since: '1.1.2' },
|
|
68
|
+
// Debug / developer ergonomics
|
|
69
|
+
{ name: 'INDEX_SERVER_DEBUG', category: 'diagnostics', description: 'Enable developer diagnostics bundle (memory, internals).', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.0' },
|
|
70
|
+
{ name: 'INDEX_SERVER_MEMORY_MONITOR', category: 'diagnostics', description: 'Enable periodic memory usage sampling/logging.', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.0' },
|
|
71
|
+
{ name: 'INDEX_SERVER_LOG_MUTATION', category: 'diagnostics', description: 'Emit mutation-specific verbose logs.', stability: 'diagnostic', default: 'off', type: 'boolean', since: '1.1.0' },
|
|
72
|
+
// Legacy / removed (for awareness; not parsed at runtime)
|
|
73
|
+
{ name: 'INDEX_SERVER_SHORTCIRCUIT', category: 'deprecated', description: 'Removed legacy short-circuit handshake path.', stability: 'deprecated', default: '(removed)', since: '<1.1.0' },
|
|
74
|
+
// Multi-instance / leader-follower
|
|
75
|
+
{ name: 'INDEX_SERVER_MODE', category: 'multi-instance', description: 'Instance mode: standalone (default), leader, follower, auto.', stability: 'experimental', default: 'standalone', type: 'string', since: '1.8.5' },
|
|
76
|
+
{ name: 'INDEX_SERVER_LEADER_PORT', category: 'multi-instance', description: 'HTTP port for leader MCP transport (thin clients connect here).', stability: 'experimental', default: '9090', type: 'number', since: '1.8.5' },
|
|
77
|
+
{ name: 'INDEX_SERVER_HEARTBEAT_MS', category: 'multi-instance', description: 'Leader heartbeat interval (ms).', stability: 'experimental', default: '5000', type: 'number', since: '1.8.5' },
|
|
78
|
+
{ name: 'INDEX_SERVER_STALE_THRESHOLD_MS', category: 'multi-instance', description: 'Stale leader threshold (ms) before follower promotes.', stability: 'experimental', default: '15000', type: 'number', since: '1.8.5' },
|
|
79
|
+
];
|
|
80
|
+
function parseValue(meta) {
|
|
81
|
+
const raw = process.env[meta.name];
|
|
82
|
+
if (raw === undefined)
|
|
83
|
+
return {};
|
|
84
|
+
if (meta.type === 'boolean') {
|
|
85
|
+
const enabled = (0, envUtils_1.getBooleanEnv)(meta.name);
|
|
86
|
+
return { value: raw, enabled, parsed: enabled };
|
|
87
|
+
}
|
|
88
|
+
if (meta.type === 'number') {
|
|
89
|
+
const n = parseInt(raw, 10);
|
|
90
|
+
return { value: raw, parsed: Number.isFinite(n) ? n : undefined };
|
|
91
|
+
}
|
|
92
|
+
return { value: raw, parsed: raw };
|
|
93
|
+
}
|
|
94
|
+
function getFlagRegistrySnapshot() {
|
|
95
|
+
return exports.FLAG_REGISTRY
|
|
96
|
+
.slice()
|
|
97
|
+
.sort((a, b) => a.category.localeCompare(b.category) || a.name.localeCompare(b.name))
|
|
98
|
+
.map(m => ({ ...m, ...parseValue(m), docAnchor: m.name.toLowerCase().replace(/_/g, '-') }));
|
|
99
|
+
}
|
|
100
|
+
(0, registry_1.registerHandler)('dashboard_config', () => {
|
|
101
|
+
const flags = getFlagRegistrySnapshot();
|
|
102
|
+
return {
|
|
103
|
+
generatedAt: new Date().toISOString(),
|
|
104
|
+
lastRefreshed: Date.now(),
|
|
105
|
+
total: flags.length,
|
|
106
|
+
flags,
|
|
107
|
+
};
|
|
108
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const registry_1 = require("../server/registry");
|
|
4
|
+
/**
|
|
5
|
+
* diagnostics_block: Intentionally CPU blocks the event loop for a specified number of milliseconds.
|
|
6
|
+
* Purpose: Reproduce / probe health_check hang or starvation behavior under synchronous handler saturation.
|
|
7
|
+
* NOTE: This is test/instrumentation oriented and not part of stable tool surface.
|
|
8
|
+
*/
|
|
9
|
+
(0, registry_1.registerHandler)('diagnostics_block', (p) => {
|
|
10
|
+
const ms = typeof p.ms === 'number' ? Math.min(Math.max(p.ms, 0), 10_000) : 250; // cap at 10s
|
|
11
|
+
const start = Date.now();
|
|
12
|
+
// Busy-loop (intentional) to simulate CPU starvation in a single-threaded event loop
|
|
13
|
+
// eslint-disable-next-line no-empty
|
|
14
|
+
while (Date.now() - start < ms) { /* block */ }
|
|
15
|
+
return { blockedMs: ms, startedAt: new Date(start).toISOString(), endedAt: new Date().toISOString() };
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* diagnostics_microtaskFlood: Schedules a large number of microtasks (Promise.resolve chains)
|
|
19
|
+
* to create event loop turn pressure without pure synchronous blocking.
|
|
20
|
+
* Useful to probe starvation scenarios distinct from a tight busy loop.
|
|
21
|
+
*/
|
|
22
|
+
(0, registry_1.registerHandler)('diagnostics_microtaskFlood', async (p) => {
|
|
23
|
+
const count = typeof p.count === 'number' ? Math.min(Math.max(p.count, 0), 200_000) : 25_000;
|
|
24
|
+
let ops = 0;
|
|
25
|
+
// Chain microtasks in batches to avoid blowing the call stack while still flooding.
|
|
26
|
+
function batch(n) {
|
|
27
|
+
if (n <= 0)
|
|
28
|
+
return Promise.resolve();
|
|
29
|
+
return Promise.resolve().then(() => { ops++; }).then(() => batch(n - 1));
|
|
30
|
+
}
|
|
31
|
+
const start = Date.now();
|
|
32
|
+
await batch(count);
|
|
33
|
+
return { scheduled: count, executed: ops, ms: Date.now() - start };
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* diagnostics_memoryPressure: Allocates transient buffers to induce GC / memory pressure.
|
|
37
|
+
* Allocation is bounded & immediately released (locally scoped) before returning.
|
|
38
|
+
*/
|
|
39
|
+
(0, registry_1.registerHandler)('diagnostics_memoryPressure', (p) => {
|
|
40
|
+
const mb = typeof p.mb === 'number' ? Math.min(Math.max(p.mb, 1), 512) : 64; // cap to 512MB
|
|
41
|
+
const start = Date.now();
|
|
42
|
+
const blocks = [];
|
|
43
|
+
const PER = 4 * 1024 * 1024; // 4MB per block
|
|
44
|
+
const needed = Math.ceil((mb * 1024 * 1024) / PER);
|
|
45
|
+
for (let i = 0; i < needed; i++) {
|
|
46
|
+
const b = Buffer.allocUnsafe(PER);
|
|
47
|
+
// touch a few bytes to ensure physical commit
|
|
48
|
+
b[0] = 1;
|
|
49
|
+
b[PER - 1] = 1;
|
|
50
|
+
blocks.push(b);
|
|
51
|
+
}
|
|
52
|
+
const allocMs = Date.now() - start;
|
|
53
|
+
// Release references so GC can reclaim
|
|
54
|
+
return { requestedMB: mb, blocks: blocks.length, perBlockBytes: PER, allocMs };
|
|
55
|
+
});
|
|
56
|
+
// Augment global type locally (non-invasive)
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
58
|
+
const gRef = global;
|
|
59
|
+
(0, registry_1.registerHandler)('diagnostics_handshake', () => {
|
|
60
|
+
const buf = gRef.HANDSHAKE_EVENTS_REF;
|
|
61
|
+
if (Array.isArray(buf))
|
|
62
|
+
return { events: buf.slice(-50) };
|
|
63
|
+
return { events: [], warning: 'handshake instrumentation unavailable in this build' };
|
|
64
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feedback/Emit System for Index Server
|
|
3
|
+
*
|
|
4
|
+
* Provides MCP protocol-compliant tools for clients to submit structured feedback,
|
|
5
|
+
* status reports, security issues, feature requests, and other communications
|
|
6
|
+
* to server administrators or monitoring systems.
|
|
7
|
+
*
|
|
8
|
+
* This system follows MCP best practices:
|
|
9
|
+
* - Tools are discoverable via tools/list
|
|
10
|
+
* - Input validation via JSON schemas
|
|
11
|
+
* - Structured responses for programmatic consumption
|
|
12
|
+
* - Proper error handling and logging
|
|
13
|
+
* - Audit trail for security and compliance
|
|
14
|
+
*/
|
|
15
|
+
export {};
|