@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,32 @@
|
|
|
1
|
+
import { InstructionEntry } from '../models/instruction';
|
|
2
|
+
export interface IndexSnapshot {
|
|
3
|
+
entries: InstructionEntry[];
|
|
4
|
+
hash: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class FileIndexRepository {
|
|
7
|
+
private baseDir;
|
|
8
|
+
/**
|
|
9
|
+
* @param baseDir - Absolute path to the directory containing JSON instruction files
|
|
10
|
+
*/
|
|
11
|
+
constructor(baseDir: string);
|
|
12
|
+
/**
|
|
13
|
+
* List all `.json` filenames found in the base directory.
|
|
14
|
+
* @returns Array of filename strings (basename only), or an empty array if the directory is unreadable
|
|
15
|
+
*/
|
|
16
|
+
listFiles(): string[];
|
|
17
|
+
/**
|
|
18
|
+
* Load all instruction entries from disk and compute a content hash of the directory state.
|
|
19
|
+
* @returns Snapshot containing the loaded entries and a SHA-256 content hash
|
|
20
|
+
*/
|
|
21
|
+
load(): IndexSnapshot;
|
|
22
|
+
/**
|
|
23
|
+
* Atomically write an instruction entry to disk as `<id>.json`.
|
|
24
|
+
* @param entry - Instruction entry to persist
|
|
25
|
+
*/
|
|
26
|
+
save(entry: InstructionEntry): void;
|
|
27
|
+
/**
|
|
28
|
+
* Remove the JSON file for the given instruction ID, if it exists.
|
|
29
|
+
* @param id - Instruction ID whose file should be deleted
|
|
30
|
+
*/
|
|
31
|
+
remove(id: string): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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.FileIndexRepository = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
10
|
+
const atomicFs_1 = require("./atomicFs");
|
|
11
|
+
class FileIndexRepository {
|
|
12
|
+
baseDir;
|
|
13
|
+
/**
|
|
14
|
+
* @param baseDir - Absolute path to the directory containing JSON instruction files
|
|
15
|
+
*/
|
|
16
|
+
constructor(baseDir) {
|
|
17
|
+
this.baseDir = baseDir;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* List all `.json` filenames found in the base directory.
|
|
21
|
+
* @returns Array of filename strings (basename only), or an empty array if the directory is unreadable
|
|
22
|
+
*/
|
|
23
|
+
listFiles() {
|
|
24
|
+
try {
|
|
25
|
+
return fs_1.default.readdirSync(this.baseDir).filter(f => f.endsWith('.json'));
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Load all instruction entries from disk and compute a content hash of the directory state.
|
|
33
|
+
* @returns Snapshot containing the loaded entries and a SHA-256 content hash
|
|
34
|
+
*/
|
|
35
|
+
load() {
|
|
36
|
+
const files = this.listFiles();
|
|
37
|
+
const entries = [];
|
|
38
|
+
const hash = crypto_1.default.createHash('sha256');
|
|
39
|
+
for (const f of files) {
|
|
40
|
+
const fp = path_1.default.join(this.baseDir, f);
|
|
41
|
+
try {
|
|
42
|
+
const raw = JSON.parse(fs_1.default.readFileSync(fp, 'utf8'));
|
|
43
|
+
entries.push(raw);
|
|
44
|
+
hash.update(raw.id + ':' + (raw.sourceHash || ''), 'utf8');
|
|
45
|
+
}
|
|
46
|
+
catch { /* skip */ }
|
|
47
|
+
}
|
|
48
|
+
return { entries, hash: hash.digest('hex') };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Atomically write an instruction entry to disk as `<id>.json`.
|
|
52
|
+
* @param entry - Instruction entry to persist
|
|
53
|
+
*/
|
|
54
|
+
save(entry) {
|
|
55
|
+
const fp = path_1.default.join(this.baseDir, `${entry.id}.json`);
|
|
56
|
+
(0, atomicFs_1.atomicWriteJson)(fp, entry);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Remove the JSON file for the given instruction ID, if it exists.
|
|
60
|
+
* @param id - Instruction ID whose file should be deleted
|
|
61
|
+
*/
|
|
62
|
+
remove(id) {
|
|
63
|
+
const fp = path_1.default.join(this.baseDir, `${id}.json`);
|
|
64
|
+
try {
|
|
65
|
+
if (fs_1.default.existsSync(fp))
|
|
66
|
+
fs_1.default.unlinkSync(fp);
|
|
67
|
+
}
|
|
68
|
+
catch { /* ignore */ }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.FileIndexRepository = FileIndexRepository;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const registry_1 = require("../server/registry");
|
|
4
|
+
const handlers_instructions_1 = require("./handlers.instructions");
|
|
5
|
+
const errors_1 = require("./errors");
|
|
6
|
+
const tracing_1 = require("./tracing");
|
|
7
|
+
const indexContext_1 = require("./indexContext");
|
|
8
|
+
const bootstrapGating_1 = require("./bootstrapGating");
|
|
9
|
+
const runtimeConfig_1 = require("../config/runtimeConfig");
|
|
10
|
+
const handlers_search_1 = require("./handlers.search");
|
|
11
|
+
const mutationMethods = new Set([
|
|
12
|
+
'index_add', 'index_import', 'index_remove', 'index_reload', 'index_groom', 'index_repair', 'index_enrich', 'index_governanceUpdate', 'usage_flush'
|
|
13
|
+
]);
|
|
14
|
+
function isMutationEnabled() {
|
|
15
|
+
const cfg = (0, runtimeConfig_1.getRuntimeConfig)();
|
|
16
|
+
return cfg.mutation.enabled;
|
|
17
|
+
}
|
|
18
|
+
(0, registry_1.registerHandler)('index_dispatch', async (params) => {
|
|
19
|
+
const timing = (0, runtimeConfig_1.getRuntimeConfig)().mutation.dispatcherTiming;
|
|
20
|
+
const t0 = timing ? Date.now() : 0;
|
|
21
|
+
const action = (params && params.action);
|
|
22
|
+
if ((0, tracing_1.traceEnabled)(1)) {
|
|
23
|
+
try {
|
|
24
|
+
const dir = (0, indexContext_1.getInstructionsDir)();
|
|
25
|
+
// Avoid heavy work unless hash diag explicitly requested
|
|
26
|
+
let hash;
|
|
27
|
+
if ((0, runtimeConfig_1.getRuntimeConfig)().trace.has('dispatchDiag')) {
|
|
28
|
+
try {
|
|
29
|
+
const st = (0, indexContext_1.ensureLoaded)();
|
|
30
|
+
hash = st.hash;
|
|
31
|
+
}
|
|
32
|
+
catch { /* ignore */ }
|
|
33
|
+
}
|
|
34
|
+
(0, tracing_1.emitTrace)('[trace:dispatch:start]', { action, keys: Object.keys(params || {}).filter(k => k !== 'action'), pid: process.pid, dir, hash });
|
|
35
|
+
}
|
|
36
|
+
catch { /* ignore */ }
|
|
37
|
+
}
|
|
38
|
+
if (typeof action !== 'string' || !action.trim()) {
|
|
39
|
+
try {
|
|
40
|
+
if ((0, runtimeConfig_1.getRuntimeConfig)().logging.verbose)
|
|
41
|
+
process.stderr.write('[dispatcher] semantic_error code=-32602 reason=missing_action\n');
|
|
42
|
+
}
|
|
43
|
+
catch { /* ignore */ }
|
|
44
|
+
(0, errors_1.semanticError)(-32602, 'Missing action', { method: 'index_dispatch', reason: 'missing_action', hint: 'Provide an "action" parameter. Use action="capabilities" to list all valid actions.', schema: { required: ['action'], properties: { action: { type: 'string', enum: ['list', 'get', 'search', 'query', 'categories', 'diff', 'export', 'add', 'import', 'remove', 'reload', 'groom', 'repair', 'enrich', 'governanceHash', 'governanceUpdate', 'health', 'inspect', 'dir', 'capabilities', 'batch', 'manifestStatus', 'manifestRefresh', 'manifestRepair'] } } }, example: { action: 'search', q: 'build validate' } });
|
|
45
|
+
}
|
|
46
|
+
// Capability listing
|
|
47
|
+
if (action === 'capabilities') {
|
|
48
|
+
try {
|
|
49
|
+
if ((0, runtimeConfig_1.getRuntimeConfig)().logging.verbose)
|
|
50
|
+
process.stderr.write('[dispatcher] capabilities invoked\n');
|
|
51
|
+
}
|
|
52
|
+
catch { /* ignore */ }
|
|
53
|
+
return { version: process.env.npm_package_version || '0.0.0', supportedActions: Object.keys(handlers_instructions_1.instructionActions).concat(['add', 'import', 'remove', 'reload', 'groom', 'repair', 'enrich', 'governanceHash', 'governanceUpdate', 'health', 'inspect', 'dir', 'capabilities', 'batch', 'manifestStatus', 'manifestRefresh', 'manifestRepair']), mutationEnabled: isMutationEnabled() };
|
|
54
|
+
}
|
|
55
|
+
// Batch execution
|
|
56
|
+
if (action === 'batch') {
|
|
57
|
+
// Accept both 'operations' and 'ops' for flexibility / backward compatibility
|
|
58
|
+
const rawOps = params.operations || params.ops;
|
|
59
|
+
const ops = Array.isArray(rawOps) ? rawOps.filter(o => o && typeof o === 'object') : [];
|
|
60
|
+
const results = [];
|
|
61
|
+
for (const op of ops) {
|
|
62
|
+
try {
|
|
63
|
+
const rHandler = (0, registry_1.getHandler)('index_dispatch');
|
|
64
|
+
if (!rHandler)
|
|
65
|
+
throw new Error('dispatcher recursion handler missing');
|
|
66
|
+
const r = await Promise.resolve(rHandler({ ...op }));
|
|
67
|
+
results.push(r);
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
const errObj = e;
|
|
71
|
+
results.push({ error: { message: errObj?.message || String(e), code: errObj?.code } });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return { results };
|
|
75
|
+
}
|
|
76
|
+
// Map dispatcher actions to legacy mutation handlers or internal pure actions
|
|
77
|
+
// Read-only internal actions
|
|
78
|
+
const READ_ACTIONS_WITH_META = new Set(['get', 'list', 'listScoped', 'search', 'query']);
|
|
79
|
+
const autoTrack = (0, runtimeConfig_1.getRuntimeConfig)().index?.autoUsageTrack;
|
|
80
|
+
if (Object.prototype.hasOwnProperty.call(handlers_instructions_1.instructionActions, action)) {
|
|
81
|
+
const t1 = timing ? Date.now() : 0;
|
|
82
|
+
const fn = handlers_instructions_1.instructionActions[action];
|
|
83
|
+
const shouldAddMeta = READ_ACTIONS_WITH_META.has(action);
|
|
84
|
+
// Specialized reliability wrapper for 'get': automatically attempt late materialization
|
|
85
|
+
// using internal getEnhanced when initial index lookup fails but on-disk file exists.
|
|
86
|
+
if (action === 'get') {
|
|
87
|
+
const id = params.id;
|
|
88
|
+
if (typeof id === 'string' && id.trim()) {
|
|
89
|
+
const base = fn({ id });
|
|
90
|
+
if (base.notFound) {
|
|
91
|
+
try {
|
|
92
|
+
const enhanced = handlers_instructions_1.instructionActions.getEnhanced?.({ id });
|
|
93
|
+
if (enhanced && !enhanced.notFound) {
|
|
94
|
+
if (autoTrack) {
|
|
95
|
+
try {
|
|
96
|
+
(0, indexContext_1.incrementUsage)(id, { action: 'get' });
|
|
97
|
+
}
|
|
98
|
+
catch { /* fire-and-forget */ }
|
|
99
|
+
}
|
|
100
|
+
return { ...enhanced, _meta: (0, handlers_search_1.buildAfterRetrievalMeta)() }; // lateMaterialized success
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch { /* swallow fallback errors to preserve original semantics */ }
|
|
104
|
+
}
|
|
105
|
+
if (shouldAddMeta && !base.notFound) {
|
|
106
|
+
if (autoTrack) {
|
|
107
|
+
try {
|
|
108
|
+
(0, indexContext_1.incrementUsage)(id, { action: 'get' });
|
|
109
|
+
}
|
|
110
|
+
catch { /* fire-and-forget */ }
|
|
111
|
+
}
|
|
112
|
+
return { ...base, _meta: (0, handlers_search_1.buildAfterRetrievalMeta)() };
|
|
113
|
+
}
|
|
114
|
+
return base;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const r = await Promise.resolve(fn(params));
|
|
118
|
+
if ((0, tracing_1.traceEnabled)(1)) {
|
|
119
|
+
try {
|
|
120
|
+
(0, tracing_1.emitTrace)('[trace:dispatch:internal]', { action, elapsed: timing ? (Date.now() - t1) : undefined });
|
|
121
|
+
}
|
|
122
|
+
catch { /* ignore */ }
|
|
123
|
+
}
|
|
124
|
+
if (timing) {
|
|
125
|
+
try {
|
|
126
|
+
process.stderr.write(`[dispatcher:timing] action=${action} phase=internal elapsed=${Date.now() - t1}ms total=${Date.now() - t0}ms\n`);
|
|
127
|
+
}
|
|
128
|
+
catch { /* ignore */ }
|
|
129
|
+
}
|
|
130
|
+
if (shouldAddMeta && r && typeof r === 'object' && !r.notFound && !r.error)
|
|
131
|
+
return { ...r, _meta: (0, handlers_search_1.buildAfterRetrievalMeta)() };
|
|
132
|
+
return r;
|
|
133
|
+
}
|
|
134
|
+
// Manifest actions (002 Phase 2b consolidation)
|
|
135
|
+
if (action === 'manifestStatus' || action === 'manifestRefresh' || action === 'manifestRepair') {
|
|
136
|
+
if (action !== 'manifestStatus') {
|
|
137
|
+
const gated = (0, bootstrapGating_1.mutationGatedReason)();
|
|
138
|
+
if (gated)
|
|
139
|
+
return { error: 'mutation_blocked', reason: gated, target: action, bootstrap: true };
|
|
140
|
+
}
|
|
141
|
+
const mName = action === 'manifestStatus' ? 'manifest_status' : action === 'manifestRefresh' ? 'manifest_refresh' : 'manifest_repair';
|
|
142
|
+
const mHandler = (0, registry_1.getHandler)(mName);
|
|
143
|
+
if (!mHandler)
|
|
144
|
+
(0, errors_1.semanticError)(-32601, `${mName} handler not found`, { action });
|
|
145
|
+
const mResult = await Promise.resolve(mHandler({}));
|
|
146
|
+
if (action === 'manifestStatus')
|
|
147
|
+
return { present: mResult.manifestPresent, ...mResult };
|
|
148
|
+
return mResult;
|
|
149
|
+
}
|
|
150
|
+
// Map selected action tokens to existing registered methods for mutation / governance
|
|
151
|
+
const methodMap = {
|
|
152
|
+
add: 'index_add', import: 'index_import', remove: 'index_remove', reload: 'index_reload', groom: 'index_groom', repair: 'index_repair', enrich: 'index_enrich', governanceHash: 'index_governanceHash', governanceUpdate: 'index_governanceUpdate', health: 'index_health', inspect: 'index_inspect', dir: 'index_dir'
|
|
153
|
+
};
|
|
154
|
+
const target = methodMap[action];
|
|
155
|
+
if (!target) {
|
|
156
|
+
try {
|
|
157
|
+
if ((0, runtimeConfig_1.getRuntimeConfig)().logging.verbose)
|
|
158
|
+
process.stderr.write(`[dispatcher] semantic_error code=-32601 reason=unknown_action action=${action}\n`);
|
|
159
|
+
}
|
|
160
|
+
catch { /* ignore */ }
|
|
161
|
+
const validActions = ['list', 'get', 'search', 'query', 'categories', 'diff', 'export', 'add', 'import', 'remove', 'reload', 'groom', 'repair', 'enrich', 'governanceHash', 'governanceUpdate', 'health', 'inspect', 'dir', 'capabilities', 'batch', 'manifestStatus', 'manifestRefresh', 'manifestRepair'];
|
|
162
|
+
(0, errors_1.semanticError)(-32601, `Unknown action: ${action}. Call with action="capabilities" to list all valid actions.`, { action, reason: 'unknown_action', hint: 'Use action="capabilities" for full list. Common actions: list, get, search, add, query, categories.', validActions, schema: { required: ['action'], properties: { action: { type: 'string', enum: validActions } } }, examples: { list: { action: 'list' }, get: { action: 'get', id: 'instruction-id' }, search: { action: 'search', q: 'keyword' } } });
|
|
163
|
+
}
|
|
164
|
+
if (mutationMethods.has(target) && !isMutationEnabled()) {
|
|
165
|
+
// Dispatcher design intent: allow mutation-style actions even when direct mutation tools
|
|
166
|
+
// are disabled. The previous logic incorrectly blocked these calls, causing silent timeouts
|
|
167
|
+
// in tests expecting dispatcher add to succeed without INDEX_SERVER_MUTATION=1.
|
|
168
|
+
// We now log (if verbose) and proceed instead of throwing a semantic error.
|
|
169
|
+
try {
|
|
170
|
+
if ((0, runtimeConfig_1.getRuntimeConfig)().logging.verbose)
|
|
171
|
+
process.stderr.write(`[dispatcher] mutation_allowed_via_dispatcher action=${action} target=${target} (INDEX_SERVER_MUTATION not set)\n`);
|
|
172
|
+
}
|
|
173
|
+
catch { /* ignore */ }
|
|
174
|
+
}
|
|
175
|
+
const handler = (0, registry_1.getHandler)(target);
|
|
176
|
+
if (!handler) {
|
|
177
|
+
try {
|
|
178
|
+
if ((0, runtimeConfig_1.getRuntimeConfig)().logging.verbose)
|
|
179
|
+
process.stderr.write(`[dispatcher] semantic_error code=-32601 reason=unknown_handler action=${action} target=${target}\n`);
|
|
180
|
+
}
|
|
181
|
+
catch { /* ignore */ }
|
|
182
|
+
(0, errors_1.semanticError)(-32601, 'Unknown action handler', { action, target, reason: 'unknown_handler' });
|
|
183
|
+
}
|
|
184
|
+
// Strip action key for downstream handler params
|
|
185
|
+
const { action: _ignoredAction, ...rest } = params;
|
|
186
|
+
// Backward-compatible convenience: allow single 'id' for remove instead of 'ids' array
|
|
187
|
+
if (action === 'remove' && typeof rest.id === 'string' && !rest.ids) {
|
|
188
|
+
rest.ids = [rest.id];
|
|
189
|
+
delete rest.id;
|
|
190
|
+
}
|
|
191
|
+
// Flat-param assembly for 'add': agents send flat params (id, body, title, ...)
|
|
192
|
+
// because the dispatch schema cannot express nested 'entry' wrappers.
|
|
193
|
+
// When 'entry' is absent but 'id' is present, assemble the entry from flat params.
|
|
194
|
+
if (action === 'add' && !rest.entry && typeof rest.id === 'string') {
|
|
195
|
+
const entryFields = ['id', 'body', 'title', 'rationale', 'priority', 'audience', 'requirement', 'categories', 'deprecatedBy', 'riskScore', 'version', 'owner', 'status', 'priorityTier', 'classification', 'lastReviewedAt', 'nextReviewDue', 'semanticSummary', 'changeLog'];
|
|
196
|
+
const entry = {};
|
|
197
|
+
for (const k of entryFields) {
|
|
198
|
+
if (rest[k] !== undefined) {
|
|
199
|
+
entry[k] = rest[k];
|
|
200
|
+
delete rest[k];
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
rest.entry = entry;
|
|
204
|
+
}
|
|
205
|
+
void _ignoredAction; // explicitly ignore for lint
|
|
206
|
+
// Mark invocation origin so guard() can allow dispatcher-mediated mutations even if
|
|
207
|
+
// INDEX_SERVER_MUTATION is not globally enabled.
|
|
208
|
+
rest._viaDispatcher = true;
|
|
209
|
+
const hStart = timing ? Date.now() : 0;
|
|
210
|
+
// Gating: block mutation targets if bootstrap confirmation required or reference mode active.
|
|
211
|
+
if (mutationMethods.has(target)) {
|
|
212
|
+
const gated = (0, bootstrapGating_1.mutationGatedReason)();
|
|
213
|
+
if (gated) {
|
|
214
|
+
return { error: 'mutation_blocked', reason: gated, target: action, bootstrap: true };
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
const out = await Promise.resolve(handler(rest));
|
|
218
|
+
if ((0, tracing_1.traceEnabled)(1)) {
|
|
219
|
+
try {
|
|
220
|
+
(0, tracing_1.emitTrace)('[trace:dispatch:handler]', { action, elapsed: timing ? (Date.now() - hStart) : undefined, total: timing ? (Date.now() - t0) : undefined });
|
|
221
|
+
}
|
|
222
|
+
catch { /* ignore */ }
|
|
223
|
+
}
|
|
224
|
+
if (timing) {
|
|
225
|
+
try {
|
|
226
|
+
process.stderr.write(`[dispatcher:timing] action=${action} phase=targetHandler elapsedTotal=${Date.now() - t0}ms\n`);
|
|
227
|
+
}
|
|
228
|
+
catch { /* ignore */ }
|
|
229
|
+
}
|
|
230
|
+
return out;
|
|
231
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Global stderr console redirection for MCP protocol safety.
|
|
3
|
+
// Redirects console.log / console.debug / console.info to stderr so dashboard
|
|
4
|
+
// server-side code never contaminates the MCP JSON-RPC stdio protocol stream on stdout.
|
|
5
|
+
// Does NOT patch stderr.write — NDJSON log lines must pass through unmodified.
|
|
6
|
+
// Safe to import multiple times (idempotent guard).
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
if (!global.__mcpConsoleRedirected) {
|
|
10
|
+
try {
|
|
11
|
+
const stderrWrite = process.stderr.write.bind(process.stderr);
|
|
12
|
+
const redirect = (original) => {
|
|
13
|
+
return (...args) => {
|
|
14
|
+
try {
|
|
15
|
+
const msg = args.map(a => (typeof a === 'string' ? a : JSON.stringify(a))).join(' ');
|
|
16
|
+
stderrWrite(msg + '\n');
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
original(...args);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
console.log = redirect(console.log);
|
|
24
|
+
console.debug = redirect(console.debug);
|
|
25
|
+
console.info = redirect(console.info);
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
+
global.__mcpConsoleRedirected = true;
|
|
28
|
+
}
|
|
29
|
+
catch { /* ignore */ }
|
|
30
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export type LogLevel = 'TRACE' | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
|
|
2
|
+
export interface LogRecord {
|
|
3
|
+
ts: string;
|
|
4
|
+
level: LogLevel;
|
|
5
|
+
msg: string;
|
|
6
|
+
detail?: string;
|
|
7
|
+
tool?: string;
|
|
8
|
+
ms?: number;
|
|
9
|
+
pid?: number;
|
|
10
|
+
port?: string;
|
|
11
|
+
correlationId?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generate a new random correlation ID (16 hex characters).
|
|
15
|
+
* @returns Hex string suitable for tagging a single request context
|
|
16
|
+
*/
|
|
17
|
+
export declare function newCorrelationId(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Emit a structured NDJSON log record at the specified level.
|
|
20
|
+
* @param level - TRACE | DEBUG | INFO | WARN | ERROR
|
|
21
|
+
* @param msg - Message with [module] prefix for heatmap matching
|
|
22
|
+
* @param fields - Additional fields (detail, tool, ms, correlationId, etc.)
|
|
23
|
+
*/
|
|
24
|
+
export declare function log(level: LogLevel, msg: string, fields?: Partial<Omit<LogRecord, 'level' | 'ts' | 'msg'>>): void;
|
|
25
|
+
/** TRACE — function entry/exit tracing and low-level diagnostics.
|
|
26
|
+
* Use `→ Class.method` / `← Class.method` prefixes for call graph support.
|
|
27
|
+
* @param msg - Message (use → / ← prefixes for function tracing)
|
|
28
|
+
* @param detail - Optional data serialized into the detail field
|
|
29
|
+
*/
|
|
30
|
+
export declare const logTrace: (msg: string, detail?: unknown) => void;
|
|
31
|
+
/** DEBUG — diagnostic information for development.
|
|
32
|
+
* @param msg - Message with [module] prefix
|
|
33
|
+
* @param detail - Optional data serialized into the detail field
|
|
34
|
+
*/
|
|
35
|
+
export declare const logDebug: (msg: string, detail?: unknown) => void;
|
|
36
|
+
/** INFO — normal operational events.
|
|
37
|
+
* @param msg - Message with [module] prefix
|
|
38
|
+
* @param detail - Optional data serialized into the detail field
|
|
39
|
+
*/
|
|
40
|
+
export declare const logInfo: (msg: string, detail?: unknown) => void;
|
|
41
|
+
/** WARN — potential issues. Captures V8 call-site stack into detail for Error Trace Flow.
|
|
42
|
+
* Error instances use their own stack; non-Error detail is serialized with call-site stack appended.
|
|
43
|
+
* @param msg - Message with [module] prefix
|
|
44
|
+
* @param detail - Optional Error, string, or data; Error.stack or V8 call-site stack used
|
|
45
|
+
*/
|
|
46
|
+
export declare const logWarn: (msg: string, detail?: unknown) => void;
|
|
47
|
+
/** ERROR — failures. Captures V8 call-site stack into detail for Error Trace Flow.
|
|
48
|
+
* Error instances use their own stack; non-Error detail is serialized with call-site stack appended.
|
|
49
|
+
* @param msg - Message with [module] prefix
|
|
50
|
+
* @param detail - Optional Error, string, or data; Error.stack or V8 call-site stack used
|
|
51
|
+
*/
|
|
52
|
+
export declare const logError: (msg: string, detail?: unknown) => void;
|