@iworkforces/tracelattice 2.0.3
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/LICENSE +24 -0
- package/README.md +260 -0
- package/dist/CliLifecycle.d.ts +31 -0
- package/dist/CliLifecycle.d.ts.map +1 -0
- package/dist/CliLifecycle.js +90 -0
- package/dist/CliLifecycle.js.map +1 -0
- package/dist/ServerConfig.d.ts +290 -0
- package/dist/ServerConfig.d.ts.map +1 -0
- package/dist/ServerConfig.js +175 -0
- package/dist/ServerConfig.js.map +1 -0
- package/dist/cache/DiscoveryCache.d.ts +269 -0
- package/dist/cache/DiscoveryCache.d.ts.map +1 -0
- package/dist/cache/DiscoveryCache.js +104 -0
- package/dist/cache/DiscoveryCache.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +5177 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/ConfigLoader.d.ts +270 -0
- package/dist/config/ConfigLoader.d.ts.map +1 -0
- package/dist/config/ConfigLoader.js +186 -0
- package/dist/config/ConfigLoader.js.map +1 -0
- package/dist/context/RequestContext.d.ts +43 -0
- package/dist/context/RequestContext.d.ts.map +1 -0
- package/dist/context/RequestContext.js +14 -0
- package/dist/context/RequestContext.js.map +1 -0
- package/dist/contracts/PersistenceBackend.d.ts +134 -0
- package/dist/contracts/PersistenceBackend.d.ts.map +1 -0
- package/dist/contracts/PersistenceBackend.js +6 -0
- package/dist/contracts/PersistenceBackend.js.map +1 -0
- package/dist/contracts/calibrator.d.ts +97 -0
- package/dist/contracts/calibrator.d.ts.map +1 -0
- package/dist/contracts/calibrator.js +1 -0
- package/dist/contracts/features.d.ts +35 -0
- package/dist/contracts/features.d.ts.map +1 -0
- package/dist/contracts/features.js +12 -0
- package/dist/contracts/features.js.map +1 -0
- package/dist/contracts/ids.d.ts +68 -0
- package/dist/contracts/ids.d.ts.map +1 -0
- package/dist/contracts/ids.js +40 -0
- package/dist/contracts/ids.js.map +1 -0
- package/dist/contracts/interfaces.d.ts +254 -0
- package/dist/contracts/interfaces.d.ts.map +1 -0
- package/dist/contracts/interfaces.js +1 -0
- package/dist/contracts/persistence-work.d.ts +96 -0
- package/dist/contracts/persistence-work.d.ts.map +1 -0
- package/dist/contracts/persistence-work.js +1 -0
- package/dist/contracts/reasoning-types.d.ts +21 -0
- package/dist/contracts/reasoning-types.d.ts.map +1 -0
- package/dist/contracts/reasoning-types.js +1 -0
- package/dist/contracts/strategy.d.ts +107 -0
- package/dist/contracts/strategy.d.ts.map +1 -0
- package/dist/contracts/strategy.js +1 -0
- package/dist/contracts/summary.d.ts +110 -0
- package/dist/contracts/summary.d.ts.map +1 -0
- package/dist/contracts/summary.js +1 -0
- package/dist/contracts/suspension.d.ts +215 -0
- package/dist/contracts/suspension.d.ts.map +1 -0
- package/dist/contracts/suspension.js +1 -0
- package/dist/contracts/transport.d.ts +26 -0
- package/dist/contracts/transport.d.ts.map +1 -0
- package/dist/contracts/transport.js +1 -0
- package/dist/core/CrossReferenceValidator.d.ts +18 -0
- package/dist/core/CrossReferenceValidator.d.ts.map +1 -0
- package/dist/core/CrossReferenceValidator.js +125 -0
- package/dist/core/CrossReferenceValidator.js.map +1 -0
- package/dist/core/HistoryManager.d.ts +215 -0
- package/dist/core/HistoryManager.d.ts.map +1 -0
- package/dist/core/HistoryManager.js +594 -0
- package/dist/core/HistoryManager.js.map +1 -0
- package/dist/core/IHistoryManager.d.ts +163 -0
- package/dist/core/IHistoryManager.d.ts.map +1 -0
- package/dist/core/IHistoryManager.js +1 -0
- package/dist/core/IThoughtFormatter.d.ts +51 -0
- package/dist/core/IThoughtFormatter.d.ts.map +1 -0
- package/dist/core/IThoughtFormatter.js +1 -0
- package/dist/core/InputNormalizer.d.ts +140 -0
- package/dist/core/InputNormalizer.d.ts.map +1 -0
- package/dist/core/InputNormalizer.js +95 -0
- package/dist/core/InputNormalizer.js.map +1 -0
- package/dist/core/PersistenceBuffer.d.ts +204 -0
- package/dist/core/PersistenceBuffer.d.ts.map +1 -0
- package/dist/core/PersistenceBuffer.js +382 -0
- package/dist/core/PersistenceBuffer.js.map +1 -0
- package/dist/core/PersistenceBufferErrors.d.ts +22 -0
- package/dist/core/PersistenceBufferErrors.d.ts.map +1 -0
- package/dist/core/PersistenceBufferErrors.js +30 -0
- package/dist/core/PersistenceBufferErrors.js.map +1 -0
- package/dist/core/PersistenceRestore.d.ts +21 -0
- package/dist/core/PersistenceRestore.d.ts.map +1 -0
- package/dist/core/PersistenceRestore.js +87 -0
- package/dist/core/PersistenceRestore.js.map +1 -0
- package/dist/core/PersistenceWorkQueue.d.ts +155 -0
- package/dist/core/PersistenceWorkQueue.d.ts.map +1 -0
- package/dist/core/PersistenceWorkQueue.js +298 -0
- package/dist/core/PersistenceWorkQueue.js.map +1 -0
- package/dist/core/PersistenceWriter.d.ts +55 -0
- package/dist/core/PersistenceWriter.d.ts.map +1 -0
- package/dist/core/PersistenceWriter.js +112 -0
- package/dist/core/PersistenceWriter.js.map +1 -0
- package/dist/core/SessionErrors.d.ts +37 -0
- package/dist/core/SessionErrors.d.ts.map +1 -0
- package/dist/core/SessionErrors.js +50 -0
- package/dist/core/SessionErrors.js.map +1 -0
- package/dist/core/SessionLifecycleCoordinator.d.ts +74 -0
- package/dist/core/SessionLifecycleCoordinator.d.ts.map +1 -0
- package/dist/core/SessionLifecycleCoordinator.js +222 -0
- package/dist/core/SessionLifecycleCoordinator.js.map +1 -0
- package/dist/core/SessionLock.d.ts +59 -0
- package/dist/core/SessionLock.d.ts.map +1 -0
- package/dist/core/SessionLock.js +39 -0
- package/dist/core/SessionLock.js.map +1 -0
- package/dist/core/SessionManager.d.ts +62 -0
- package/dist/core/SessionManager.d.ts.map +1 -0
- package/dist/core/SessionManager.js +75 -0
- package/dist/core/SessionManager.js.map +1 -0
- package/dist/core/SessionResetCoordinator.d.ts +37 -0
- package/dist/core/SessionResetCoordinator.d.ts.map +1 -0
- package/dist/core/SessionResetCoordinator.js +80 -0
- package/dist/core/SessionResetCoordinator.js.map +1 -0
- package/dist/core/ThoughtEvaluator.d.ts +48 -0
- package/dist/core/ThoughtEvaluator.d.ts.map +1 -0
- package/dist/core/ThoughtEvaluator.js +85 -0
- package/dist/core/ThoughtEvaluator.js.map +1 -0
- package/dist/core/ThoughtFormatter.d.ts +134 -0
- package/dist/core/ThoughtFormatter.d.ts.map +1 -0
- package/dist/core/ThoughtFormatter.js +118 -0
- package/dist/core/ThoughtFormatter.js.map +1 -0
- package/dist/core/ThoughtProcessor.d.ts +259 -0
- package/dist/core/ThoughtProcessor.d.ts.map +1 -0
- package/dist/core/ThoughtProcessor.js +451 -0
- package/dist/core/ThoughtProcessor.js.map +1 -0
- package/dist/core/ThoughtReferenceIndex.d.ts +23 -0
- package/dist/core/ThoughtReferenceIndex.d.ts.map +1 -0
- package/dist/core/ThoughtReferenceIndex.js +66 -0
- package/dist/core/ThoughtReferenceIndex.js.map +1 -0
- package/dist/core/VerificationOutcomeAdmission.d.ts +15 -0
- package/dist/core/VerificationOutcomeAdmission.d.ts.map +1 -0
- package/dist/core/VerificationOutcomeAdmission.js +28 -0
- package/dist/core/VerificationOutcomeAdmission.js.map +1 -0
- package/dist/core/compression/CompressionService.d.ts +76 -0
- package/dist/core/compression/CompressionService.d.ts.map +1 -0
- package/dist/core/compression/CompressionService.js +160 -0
- package/dist/core/compression/CompressionService.js.map +1 -0
- package/dist/core/compression/DehydrationPolicy.d.ts +75 -0
- package/dist/core/compression/DehydrationPolicy.d.ts.map +1 -0
- package/dist/core/compression/DehydrationPolicy.js +45 -0
- package/dist/core/compression/DehydrationPolicy.js.map +1 -0
- package/dist/core/compression/InMemorySummaryStore.d.ts +132 -0
- package/dist/core/compression/InMemorySummaryStore.d.ts.map +1 -0
- package/dist/core/compression/InMemorySummaryStore.js +69 -0
- package/dist/core/compression/InMemorySummaryStore.js.map +1 -0
- package/dist/core/compression/Summary.d.ts +74 -0
- package/dist/core/compression/Summary.d.ts.map +1 -0
- package/dist/core/compression/Summary.js +16 -0
- package/dist/core/compression/Summary.js.map +1 -0
- package/dist/core/evaluator/Aggregator.d.ts +40 -0
- package/dist/core/evaluator/Aggregator.d.ts.map +1 -0
- package/dist/core/evaluator/Aggregator.js +36 -0
- package/dist/core/evaluator/Aggregator.js.map +1 -0
- package/dist/core/evaluator/Calibrator.d.ts +52 -0
- package/dist/core/evaluator/Calibrator.d.ts.map +1 -0
- package/dist/core/evaluator/Calibrator.js +135 -0
- package/dist/core/evaluator/Calibrator.js.map +1 -0
- package/dist/core/evaluator/PatternDetector.d.ts +69 -0
- package/dist/core/evaluator/PatternDetector.d.ts.map +1 -0
- package/dist/core/evaluator/PatternDetector.js +192 -0
- package/dist/core/evaluator/PatternDetector.js.map +1 -0
- package/dist/core/evaluator/SignalComputer.d.ts +116 -0
- package/dist/core/evaluator/SignalComputer.d.ts.map +1 -0
- package/dist/core/evaluator/SignalComputer.js +110 -0
- package/dist/core/evaluator/SignalComputer.js.map +1 -0
- package/dist/core/evaluator/calibration-math.d.ts +39 -0
- package/dist/core/evaluator/calibration-math.d.ts.map +1 -0
- package/dist/core/evaluator/calibration-math.js +42 -0
- package/dist/core/evaluator/calibration-math.js.map +1 -0
- package/dist/core/evaluator/internals.d.ts +36 -0
- package/dist/core/evaluator/internals.d.ts.map +1 -0
- package/dist/core/evaluator/internals.js +43 -0
- package/dist/core/evaluator/internals.js.map +1 -0
- package/dist/core/graph/Edge.d.ts +58 -0
- package/dist/core/graph/Edge.d.ts.map +1 -0
- package/dist/core/graph/Edge.js +1 -0
- package/dist/core/graph/EdgeEmitter.d.ts +68 -0
- package/dist/core/graph/EdgeEmitter.d.ts.map +1 -0
- package/dist/core/graph/EdgeEmitter.js +118 -0
- package/dist/core/graph/EdgeEmitter.js.map +1 -0
- package/dist/core/graph/EdgeStore.d.ts +116 -0
- package/dist/core/graph/EdgeStore.d.ts.map +1 -0
- package/dist/core/graph/EdgeStore.js +107 -0
- package/dist/core/graph/EdgeStore.js.map +1 -0
- package/dist/core/graph/GraphView.d.ts +157 -0
- package/dist/core/graph/GraphView.d.ts.map +1 -0
- package/dist/core/graph/GraphView.js +149 -0
- package/dist/core/graph/GraphView.js.map +1 -0
- package/dist/core/ids.d.ts +33 -0
- package/dist/core/ids.d.ts.map +1 -0
- package/dist/core/ids.js +11 -0
- package/dist/core/ids.js.map +1 -0
- package/dist/core/reasoning/OutcomeRecorder.d.ts +88 -0
- package/dist/core/reasoning/OutcomeRecorder.d.ts.map +1 -0
- package/dist/core/reasoning/OutcomeRecorder.js +51 -0
- package/dist/core/reasoning/OutcomeRecorder.js.map +1 -0
- package/dist/core/reasoning/strategies/SequentialStrategy.d.ts +54 -0
- package/dist/core/reasoning/strategies/SequentialStrategy.d.ts.map +1 -0
- package/dist/core/reasoning/strategies/SequentialStrategy.js +22 -0
- package/dist/core/reasoning/strategies/SequentialStrategy.js.map +1 -0
- package/dist/core/reasoning/strategies/StrategyFactory.d.ts +25 -0
- package/dist/core/reasoning/strategies/StrategyFactory.d.ts.map +1 -0
- package/dist/core/reasoning/strategies/StrategyFactory.js +16 -0
- package/dist/core/reasoning/strategies/StrategyFactory.js.map +1 -0
- package/dist/core/reasoning/strategies/TreeOfThoughtStrategy.d.ts +58 -0
- package/dist/core/reasoning/strategies/TreeOfThoughtStrategy.d.ts.map +1 -0
- package/dist/core/reasoning/strategies/TreeOfThoughtStrategy.js +103 -0
- package/dist/core/reasoning/strategies/TreeOfThoughtStrategy.js.map +1 -0
- package/dist/core/reasoning/strategies/plateau.d.ts +18 -0
- package/dist/core/reasoning/strategies/plateau.d.ts.map +1 -0
- package/dist/core/reasoning/strategies/plateau.js +12 -0
- package/dist/core/reasoning/strategies/plateau.js.map +1 -0
- package/dist/core/reasoning/strategies/totScoring.d.ts +91 -0
- package/dist/core/reasoning/strategies/totScoring.d.ts.map +1 -0
- package/dist/core/reasoning/strategies/totScoring.js +88 -0
- package/dist/core/reasoning/strategies/totScoring.js.map +1 -0
- package/dist/core/reasoning.d.ts +179 -0
- package/dist/core/reasoning.d.ts.map +1 -0
- package/dist/core/reasoning.js +1 -0
- package/dist/core/step.d.ts +50 -0
- package/dist/core/step.d.ts.map +1 -0
- package/dist/core/step.js +1 -0
- package/dist/core/thought.d.ts +113 -0
- package/dist/core/thought.d.ts.map +1 -0
- package/dist/core/thought.js +1 -0
- package/dist/core/tools/InMemorySuspensionStore.d.ts +66 -0
- package/dist/core/tools/InMemorySuspensionStore.d.ts.map +1 -0
- package/dist/core/tools/InMemorySuspensionStore.js +121 -0
- package/dist/core/tools/InMemorySuspensionStore.js.map +1 -0
- package/dist/di/Container.d.ts +253 -0
- package/dist/di/Container.d.ts.map +1 -0
- package/dist/di/Container.js +111 -0
- package/dist/di/Container.js.map +1 -0
- package/dist/di/ServiceRegistry.d.ts +50 -0
- package/dist/di/ServiceRegistry.d.ts.map +1 -0
- package/dist/di/ServiceRegistry.js +1 -0
- package/dist/errors.d.ts +663 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +282 -0
- package/dist/errors.js.map +1 -0
- package/dist/health/HealthChecker.d.ts +73 -0
- package/dist/health/HealthChecker.d.ts.map +1 -0
- package/dist/health/HealthChecker.js +70 -0
- package/dist/health/HealthChecker.js.map +1 -0
- package/dist/lib.d.ts +273 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +409 -0
- package/dist/lib.js.map +1 -0
- package/dist/logger/NullLogger.d.ts +154 -0
- package/dist/logger/NullLogger.d.ts.map +1 -0
- package/dist/logger/NullLogger.js +24 -0
- package/dist/logger/NullLogger.js.map +1 -0
- package/dist/logger/StructuredLogger.d.ts +327 -0
- package/dist/logger/StructuredLogger.d.ts.map +1 -0
- package/dist/logger/StructuredLogger.js +72 -0
- package/dist/logger/StructuredLogger.js.map +1 -0
- package/dist/metrics/metrics.impl.d.ts +252 -0
- package/dist/metrics/metrics.impl.d.ts.map +1 -0
- package/dist/metrics/metrics.impl.js +197 -0
- package/dist/metrics/metrics.impl.js.map +1 -0
- package/dist/persistence/FileLegacyImport.d.ts +2 -0
- package/dist/persistence/FileLegacyImport.d.ts.map +1 -0
- package/dist/persistence/FileLegacyImport.js +183 -0
- package/dist/persistence/FileLegacyImport.js.map +1 -0
- package/dist/persistence/FilePersistence.d.ts +53 -0
- package/dist/persistence/FilePersistence.d.ts.map +1 -0
- package/dist/persistence/FilePersistence.js +312 -0
- package/dist/persistence/FilePersistence.js.map +1 -0
- package/dist/persistence/FileSnapshotTypes.d.ts +29 -0
- package/dist/persistence/FileSnapshotTypes.d.ts.map +1 -0
- package/dist/persistence/FileSnapshotTypes.js +1 -0
- package/dist/persistence/FileSnapshotV2.d.ts +377 -0
- package/dist/persistence/FileSnapshotV2.d.ts.map +1 -0
- package/dist/persistence/FileSnapshotV2.js +124 -0
- package/dist/persistence/FileSnapshotV2.js.map +1 -0
- package/dist/persistence/FileSnapshotValidation.d.ts +15 -0
- package/dist/persistence/FileSnapshotValidation.d.ts.map +1 -0
- package/dist/persistence/FileSnapshotValidation.js +64 -0
- package/dist/persistence/FileSnapshotValidation.js.map +1 -0
- package/dist/persistence/FileWriter.d.ts +30 -0
- package/dist/persistence/FileWriter.d.ts.map +1 -0
- package/dist/persistence/FileWriter.js +155 -0
- package/dist/persistence/FileWriter.js.map +1 -0
- package/dist/persistence/MemoryPersistence.d.ts +45 -0
- package/dist/persistence/MemoryPersistence.d.ts.map +1 -0
- package/dist/persistence/MemoryPersistence.js +180 -0
- package/dist/persistence/MemoryPersistence.js.map +1 -0
- package/dist/persistence/PersistenceCodec.d.ts +7 -0
- package/dist/persistence/PersistenceCodec.d.ts.map +1 -0
- package/dist/persistence/PersistenceCodec.js +97 -0
- package/dist/persistence/PersistenceCodec.js.map +1 -0
- package/dist/persistence/PersistenceErrors.d.ts +23 -0
- package/dist/persistence/PersistenceErrors.d.ts.map +1 -0
- package/dist/persistence/PersistenceErrors.js +26 -0
- package/dist/persistence/PersistenceErrors.js.map +1 -0
- package/dist/persistence/PersistenceFactory.d.ts +21 -0
- package/dist/persistence/PersistenceFactory.d.ts.map +1 -0
- package/dist/persistence/PersistenceFactory.js +28 -0
- package/dist/persistence/PersistenceFactory.js.map +1 -0
- package/dist/persistence/PersistenceScope.d.ts +42 -0
- package/dist/persistence/PersistenceScope.d.ts.map +1 -0
- package/dist/persistence/PersistenceScope.js +93 -0
- package/dist/persistence/PersistenceScope.js.map +1 -0
- package/dist/persistence/SessionScopedPersistence.d.ts +4 -0
- package/dist/persistence/SessionScopedPersistence.d.ts.map +1 -0
- package/dist/persistence/SessionScopedPersistence.js +9 -0
- package/dist/persistence/SessionScopedPersistence.js.map +1 -0
- package/dist/persistence/SqliteDriver.d.ts +22 -0
- package/dist/persistence/SqliteDriver.d.ts.map +1 -0
- package/dist/persistence/SqliteDriver.js +29 -0
- package/dist/persistence/SqliteDriver.js.map +1 -0
- package/dist/persistence/SqliteLegacyImport.d.ts +14 -0
- package/dist/persistence/SqliteLegacyImport.d.ts.map +1 -0
- package/dist/persistence/SqliteLegacyImport.js +136 -0
- package/dist/persistence/SqliteLegacyImport.js.map +1 -0
- package/dist/persistence/SqliteLegacySchema.d.ts +15 -0
- package/dist/persistence/SqliteLegacySchema.d.ts.map +1 -0
- package/dist/persistence/SqliteLegacySchema.js +72 -0
- package/dist/persistence/SqliteLegacySchema.js.map +1 -0
- package/dist/persistence/SqlitePayload.d.ts +11 -0
- package/dist/persistence/SqlitePayload.d.ts.map +1 -0
- package/dist/persistence/SqlitePayload.js +86 -0
- package/dist/persistence/SqlitePayload.js.map +1 -0
- package/dist/persistence/SqlitePersistence.d.ts +49 -0
- package/dist/persistence/SqlitePersistence.d.ts.map +1 -0
- package/dist/persistence/SqlitePersistence.js +248 -0
- package/dist/persistence/SqlitePersistence.js.map +1 -0
- package/dist/persistence/SqliteSchemaV2.d.ts +14 -0
- package/dist/persistence/SqliteSchemaV2.d.ts.map +1 -0
- package/dist/persistence/SqliteSchemaV2.js +129 -0
- package/dist/persistence/SqliteSchemaV2.js.map +1 -0
- package/dist/persistence/SqliteSnapshotWriter.d.ts +17 -0
- package/dist/persistence/SqliteSnapshotWriter.d.ts.map +1 -0
- package/dist/persistence/SqliteSnapshotWriter.js +30 -0
- package/dist/persistence/SqliteSnapshotWriter.js.map +1 -0
- package/dist/pool/ConnectionPool.d.ts +203 -0
- package/dist/pool/ConnectionPool.d.ts.map +1 -0
- package/dist/pool/ConnectionPool.js +303 -0
- package/dist/pool/ConnectionPool.js.map +1 -0
- package/dist/pool/IConnectionPool.d.ts +143 -0
- package/dist/pool/IConnectionPool.d.ts.map +1 -0
- package/dist/pool/IConnectionPool.js +1 -0
- package/dist/pool/PoolErrors.d.ts +11 -0
- package/dist/pool/PoolErrors.d.ts.map +1 -0
- package/dist/pool/PoolErrors.js +16 -0
- package/dist/pool/PoolErrors.js.map +1 -0
- package/dist/registry/BaseRegistry.d.ts +219 -0
- package/dist/registry/BaseRegistry.d.ts.map +1 -0
- package/dist/registry/BaseRegistry.js +215 -0
- package/dist/registry/BaseRegistry.js.map +1 -0
- package/dist/registry/SkillRegistry.d.ts +67 -0
- package/dist/registry/SkillRegistry.d.ts.map +1 -0
- package/dist/registry/SkillRegistry.js +87 -0
- package/dist/registry/SkillRegistry.js.map +1 -0
- package/dist/registry/ToolRegistry.d.ts +70 -0
- package/dist/registry/ToolRegistry.d.ts.map +1 -0
- package/dist/registry/ToolRegistry.js +96 -0
- package/dist/registry/ToolRegistry.js.map +1 -0
- package/dist/sanitize.d.ts +164 -0
- package/dist/sanitize.d.ts.map +1 -0
- package/dist/sanitize.js +100 -0
- package/dist/sanitize.js.map +1 -0
- package/dist/schema.d.ts +562 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +251 -0
- package/dist/schema.js.map +1 -0
- package/dist/transport/BaseTransport.d.ts +166 -0
- package/dist/transport/BaseTransport.d.ts.map +1 -0
- package/dist/transport/BaseTransport.js +199 -0
- package/dist/transport/BaseTransport.js.map +1 -0
- package/dist/transport/HttpHelpers.d.ts +53 -0
- package/dist/transport/HttpHelpers.d.ts.map +1 -0
- package/dist/transport/HttpHelpers.js +44 -0
- package/dist/transport/HttpHelpers.js.map +1 -0
- package/dist/transport/HttpRequestLifecycle.d.ts +37 -0
- package/dist/transport/HttpRequestLifecycle.d.ts.map +1 -0
- package/dist/transport/HttpRequestLifecycle.js +87 -0
- package/dist/transport/HttpRequestLifecycle.js.map +1 -0
- package/dist/transport/HttpTransport.d.ts +140 -0
- package/dist/transport/HttpTransport.d.ts.map +1 -0
- package/dist/transport/HttpTransport.js +245 -0
- package/dist/transport/HttpTransport.js.map +1 -0
- package/dist/transport/SseTransport.d.ts +149 -0
- package/dist/transport/SseTransport.d.ts.map +1 -0
- package/dist/transport/SseTransport.js +470 -0
- package/dist/transport/SseTransport.js.map +1 -0
- package/dist/transport/StreamableHttpTransport.d.ts +225 -0
- package/dist/transport/StreamableHttpTransport.d.ts.map +1 -0
- package/dist/transport/StreamableHttpTransport.js +449 -0
- package/dist/transport/StreamableHttpTransport.js.map +1 -0
- package/dist/types/disposable.d.ts +22 -0
- package/dist/types/disposable.d.ts.map +1 -0
- package/dist/types/disposable.js +1 -0
- package/dist/types/server-config.d.ts +32 -0
- package/dist/types/server-config.d.ts.map +1 -0
- package/dist/types/server-config.js +1 -0
- package/dist/types/skill.d.ts +74 -0
- package/dist/types/skill.d.ts.map +1 -0
- package/dist/types/skill.js +1 -0
- package/dist/types/tool.d.ts +78 -0
- package/dist/types/tool.d.ts.map +1 -0
- package/dist/types/tool.js +1 -0
- package/dist/utils.d.ts +27 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +6 -0
- package/dist/utils.js.map +1 -0
- package/dist/watchers/SkillWatcher.d.ts +25 -0
- package/dist/watchers/SkillWatcher.d.ts.map +1 -0
- package/dist/watchers/SkillWatcher.js +96 -0
- package/dist/watchers/SkillWatcher.js.map +1 -0
- package/dist/watchers/ToolWatcher.d.ts +24 -0
- package/dist/watchers/ToolWatcher.d.ts.map +1 -0
- package/dist/watchers/ToolWatcher.js +92 -0
- package/dist/watchers/ToolWatcher.js.map +1 -0
- package/package.json +106 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { BranchId, SessionId } from '../contracts/ids.js';
|
|
2
|
+
import type { Summary } from '../core/compression/Summary.js';
|
|
3
|
+
import type { Edge } from '../core/graph/Edge.js';
|
|
4
|
+
import type { ThoughtData } from '../core/thought.js';
|
|
5
|
+
export type ThoughtSessionV2 = {
|
|
6
|
+
readonly sessionId: SessionId;
|
|
7
|
+
readonly thoughts: readonly ThoughtData[];
|
|
8
|
+
};
|
|
9
|
+
export type BranchRecordV2 = {
|
|
10
|
+
readonly sessionId: SessionId;
|
|
11
|
+
readonly branchId: BranchId;
|
|
12
|
+
readonly thoughts: readonly ThoughtData[];
|
|
13
|
+
};
|
|
14
|
+
export type EdgeSessionV2 = {
|
|
15
|
+
readonly sessionId: SessionId;
|
|
16
|
+
readonly edges: readonly Edge[];
|
|
17
|
+
};
|
|
18
|
+
export type SummarySessionV2 = {
|
|
19
|
+
readonly sessionId: SessionId;
|
|
20
|
+
readonly summaries: readonly Summary[];
|
|
21
|
+
};
|
|
22
|
+
export type FileSnapshotV2 = {
|
|
23
|
+
readonly version: 2;
|
|
24
|
+
readonly thoughts: readonly ThoughtSessionV2[];
|
|
25
|
+
readonly branches: readonly BranchRecordV2[];
|
|
26
|
+
readonly edges: readonly EdgeSessionV2[];
|
|
27
|
+
readonly summaries: readonly SummarySessionV2[];
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=FileSnapshotTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSnapshotTypes.d.ts","sourceRoot":"","sources":["../../src/persistence/FileSnapshotTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAA;CAAE,CAAC;AAC/F,MAAM,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,SAAS,OAAO,EAAE,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC/C,QAAQ,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAC;IAC7C,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,SAAS,gBAAgB,EAAE,CAAC;CAChD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import type { SessionId } from '../contracts/ids.js';
|
|
3
|
+
import type { ThoughtData } from '../core/thought.js';
|
|
4
|
+
import type { FileSnapshotV2 } from './FileSnapshotTypes.js';
|
|
5
|
+
export declare const FileSnapshotV2Schema: v.StrictObjectSchema<{
|
|
6
|
+
readonly version: v.LiteralSchema<2, undefined>;
|
|
7
|
+
readonly thoughts: v.ArraySchema<v.StrictObjectSchema<{
|
|
8
|
+
readonly sessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
|
|
9
|
+
readonly thoughts: v.ArraySchema<v.ObjectSchema<{
|
|
10
|
+
readonly available_mcp_tools: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Array of MCP tool names available for use (e.g., [\"mcp-omnisearch\", \"mcp-turso-cloud\"])">]>, undefined>;
|
|
11
|
+
readonly available_skills: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Array of skill names available for use (e.g., [\"commit\", \"review-pr\", \"pdf\"])">]>, undefined>;
|
|
12
|
+
readonly thought: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Your current thinking step">]>;
|
|
13
|
+
readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 30, undefined>, v.DescriptionAction<string, "Unique identifier for this thought. Auto-generated if not provided.">]>, undefined>;
|
|
14
|
+
readonly next_thought_needed: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Whether another thought step is needed (defaults to true if not provided)">]>, undefined>;
|
|
15
|
+
readonly thought_number: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Current thought number">]>;
|
|
16
|
+
readonly total_thoughts: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Estimated total thoughts needed">]>;
|
|
17
|
+
readonly is_revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Whether this revises previous thinking">]>, undefined>;
|
|
18
|
+
readonly revises_thought: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Which thought is being reconsidered">]>, undefined>;
|
|
19
|
+
readonly branch_from_thought: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Branching point thought number">]>, undefined>;
|
|
20
|
+
readonly branch_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Branch ID must contain only letters, numbers, hyphens, and underscores">, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 50, undefined>, v.DescriptionAction<string, "Branch identifier (alphanumeric, hyphens, underscores only, max 50 chars)">]>, undefined>;
|
|
21
|
+
readonly needs_more_thoughts: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "If more thoughts are needed">]>, undefined>;
|
|
22
|
+
readonly current_step: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
23
|
+
readonly step_description: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "What needs to be done">]>;
|
|
24
|
+
readonly recommended_tools: v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
|
|
25
|
+
readonly tool_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the tool being recommended">]>;
|
|
26
|
+
readonly confidence: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation">]>;
|
|
27
|
+
readonly rationale: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>, v.DescriptionAction<string, "Why this tool is recommended">]>;
|
|
28
|
+
readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
|
|
29
|
+
readonly suggested_inputs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.BooleanSchema<undefined>, v.NullSchema<undefined>], undefined>, undefined>, v.DescriptionAction<{
|
|
30
|
+
[x: string]: string | number | boolean | null;
|
|
31
|
+
}, "Optional suggested parameters (flat key-value pairs only)">]>, undefined>;
|
|
32
|
+
readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative tools that could be used">]>, undefined>;
|
|
33
|
+
}, undefined>, undefined>, v.DescriptionAction<{
|
|
34
|
+
tool_name: string;
|
|
35
|
+
confidence: number;
|
|
36
|
+
rationale: string;
|
|
37
|
+
priority?: number | undefined;
|
|
38
|
+
suggested_inputs?: {
|
|
39
|
+
[x: string]: string | number | boolean | null;
|
|
40
|
+
} | undefined;
|
|
41
|
+
alternatives?: string[] | undefined;
|
|
42
|
+
}[], "Tools recommended for this step">]>;
|
|
43
|
+
readonly recommended_skills: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
|
|
44
|
+
readonly skill_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the skill being recommended">]>;
|
|
45
|
+
readonly confidence: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation (default: 0.5)">]>, undefined>;
|
|
46
|
+
readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>, v.DescriptionAction<string, "Why this skill is recommended (default: empty string)">]>, undefined>;
|
|
47
|
+
readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
|
|
48
|
+
readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative skills that could be used">]>, undefined>;
|
|
49
|
+
readonly allowed_tools: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Tools this skill is allowed to use (from skill frontmatter)">]>, undefined>;
|
|
50
|
+
readonly user_invocable: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Whether this skill can be user-invoked">]>, undefined>;
|
|
51
|
+
}, undefined>, undefined>, v.DescriptionAction<{
|
|
52
|
+
skill_name: string;
|
|
53
|
+
confidence?: number | undefined;
|
|
54
|
+
rationale?: string | undefined;
|
|
55
|
+
priority?: number | undefined;
|
|
56
|
+
alternatives?: string[] | undefined;
|
|
57
|
+
allowed_tools?: string[] | undefined;
|
|
58
|
+
user_invocable?: boolean | undefined;
|
|
59
|
+
}[], "Skills recommended for this step">]>, undefined>;
|
|
60
|
+
readonly expected_outcome: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "What to expect from this step">]>;
|
|
61
|
+
readonly next_step_conditions: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Conditions to consider for the next step">]>, undefined>;
|
|
62
|
+
}, undefined>, v.DescriptionAction<{
|
|
63
|
+
step_description: string;
|
|
64
|
+
recommended_tools: {
|
|
65
|
+
tool_name: string;
|
|
66
|
+
confidence: number;
|
|
67
|
+
rationale: string;
|
|
68
|
+
priority?: number | undefined;
|
|
69
|
+
suggested_inputs?: {
|
|
70
|
+
[x: string]: string | number | boolean | null;
|
|
71
|
+
} | undefined;
|
|
72
|
+
alternatives?: string[] | undefined;
|
|
73
|
+
}[];
|
|
74
|
+
recommended_skills?: {
|
|
75
|
+
skill_name: string;
|
|
76
|
+
confidence?: number | undefined;
|
|
77
|
+
rationale?: string | undefined;
|
|
78
|
+
priority?: number | undefined;
|
|
79
|
+
alternatives?: string[] | undefined;
|
|
80
|
+
allowed_tools?: string[] | undefined;
|
|
81
|
+
user_invocable?: boolean | undefined;
|
|
82
|
+
}[] | undefined;
|
|
83
|
+
expected_outcome: string;
|
|
84
|
+
next_step_conditions?: string[] | undefined;
|
|
85
|
+
}, "Current step recommendation">]>, undefined>;
|
|
86
|
+
readonly previous_steps: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
|
|
87
|
+
readonly step_description: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "What needs to be done">]>;
|
|
88
|
+
readonly recommended_tools: v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
|
|
89
|
+
readonly tool_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the tool being recommended">]>;
|
|
90
|
+
readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>, v.DescriptionAction<string, "Why this tool is recommended (default: empty string)">]>, undefined>;
|
|
91
|
+
readonly confidence: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation (default: 0.5)">]>, undefined>;
|
|
92
|
+
readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
|
|
93
|
+
readonly suggested_inputs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.BooleanSchema<undefined>, v.NullSchema<undefined>], undefined>, undefined>, v.DescriptionAction<{
|
|
94
|
+
[x: string]: string | number | boolean | null;
|
|
95
|
+
}, "Optional suggested parameters (flat key-value pairs only)">]>, undefined>;
|
|
96
|
+
readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative tools that could be used">]>, undefined>;
|
|
97
|
+
}, undefined>, undefined>, v.DescriptionAction<{
|
|
98
|
+
tool_name: string;
|
|
99
|
+
rationale?: string | undefined;
|
|
100
|
+
confidence?: number | undefined;
|
|
101
|
+
priority?: number | undefined;
|
|
102
|
+
suggested_inputs?: {
|
|
103
|
+
[x: string]: string | number | boolean | null;
|
|
104
|
+
} | undefined;
|
|
105
|
+
alternatives?: string[] | undefined;
|
|
106
|
+
}[], "Tools recommended for this step">]>;
|
|
107
|
+
readonly recommended_skills: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
|
|
108
|
+
readonly skill_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the skill being recommended">]>;
|
|
109
|
+
readonly confidence: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation (default: 0.5)">]>, undefined>;
|
|
110
|
+
readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>, v.DescriptionAction<string, "Why this skill is recommended (default: empty string)">]>, undefined>;
|
|
111
|
+
readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
|
|
112
|
+
readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative skills that could be used">]>, undefined>;
|
|
113
|
+
readonly allowed_tools: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Tools this skill is allowed to use (from skill frontmatter)">]>, undefined>;
|
|
114
|
+
readonly user_invocable: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Whether this skill can be user-invoked">]>, undefined>;
|
|
115
|
+
}, undefined>, undefined>, v.DescriptionAction<{
|
|
116
|
+
skill_name: string;
|
|
117
|
+
confidence?: number | undefined;
|
|
118
|
+
rationale?: string | undefined;
|
|
119
|
+
priority?: number | undefined;
|
|
120
|
+
alternatives?: string[] | undefined;
|
|
121
|
+
allowed_tools?: string[] | undefined;
|
|
122
|
+
user_invocable?: boolean | undefined;
|
|
123
|
+
}[], "Skills recommended for this step">]>, undefined>;
|
|
124
|
+
readonly expected_outcome: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "What to expect from this step (default: empty string)">]>, undefined>;
|
|
125
|
+
readonly next_step_conditions: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Conditions to consider for the next step">]>, undefined>;
|
|
126
|
+
}, undefined>, undefined>, v.DescriptionAction<{
|
|
127
|
+
step_description: string;
|
|
128
|
+
recommended_tools: {
|
|
129
|
+
tool_name: string;
|
|
130
|
+
rationale?: string | undefined;
|
|
131
|
+
confidence?: number | undefined;
|
|
132
|
+
priority?: number | undefined;
|
|
133
|
+
suggested_inputs?: {
|
|
134
|
+
[x: string]: string | number | boolean | null;
|
|
135
|
+
} | undefined;
|
|
136
|
+
alternatives?: string[] | undefined;
|
|
137
|
+
}[];
|
|
138
|
+
recommended_skills?: {
|
|
139
|
+
skill_name: string;
|
|
140
|
+
confidence?: number | undefined;
|
|
141
|
+
rationale?: string | undefined;
|
|
142
|
+
priority?: number | undefined;
|
|
143
|
+
alternatives?: string[] | undefined;
|
|
144
|
+
allowed_tools?: string[] | undefined;
|
|
145
|
+
user_invocable?: boolean | undefined;
|
|
146
|
+
}[] | undefined;
|
|
147
|
+
expected_outcome?: string | undefined;
|
|
148
|
+
next_step_conditions?: string[] | undefined;
|
|
149
|
+
}[], "Steps already recommended (lenient schema - allows partial data with defaults)">]>, undefined>;
|
|
150
|
+
readonly remaining_steps: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "High-level descriptions of upcoming steps">]>, undefined>;
|
|
151
|
+
readonly thought_type: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["regular", "hypothesis", "verification", "critique", "synthesis", "meta", "tool_call", "tool_observation", "assumption", "decomposition", "backtrack"], undefined>, v.DescriptionAction<"regular" | "hypothesis" | "verification" | "critique" | "synthesis" | "meta" | "tool_call" | "tool_observation" | "assumption" | "decomposition" | "backtrack", "Classified purpose: regular (default), hypothesis, verification, critique, synthesis, meta, tool_call (requires toolInterleave), tool_observation (requires toolInterleave), assumption (requires newThoughtTypes), decomposition (requires newThoughtTypes), backtrack (requires newThoughtTypes)">]>, undefined>;
|
|
152
|
+
readonly quality_score: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "Self-assessed quality score (0-1)">]>, undefined>;
|
|
153
|
+
readonly confidence: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "Explicit confidence in correctness (0-1)">]>, undefined>;
|
|
154
|
+
readonly hypothesis_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Hypothesis ID must contain only letters, numbers, hyphens, and underscores">, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 50, undefined>, v.DescriptionAction<string, "Identifier linking hypothesis to verification thoughts">]>, undefined>;
|
|
155
|
+
readonly verification_target: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Thought number being verified or critiqued">]>, undefined>;
|
|
156
|
+
readonly verification_result: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.LiteralSchema<0, undefined>, v.LiteralSchema<1, undefined>], undefined>, v.DescriptionAction<0 | 1, "Exact verification outcome label: 0 for incorrect, 1 for correct">]>, undefined>;
|
|
157
|
+
readonly synthesis_sources: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>, v.DescriptionAction<number[], "Thought numbers being synthesized">]>, undefined>;
|
|
158
|
+
readonly merge_from_thoughts: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>, v.DescriptionAction<number[], "Thought numbers from other branches being merged (DAG)">]>, undefined>;
|
|
159
|
+
readonly merge_branch_ids: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MaxLengthAction<string, 50, undefined>]>, undefined>, v.DescriptionAction<string[], "Branch IDs being merged into current context">]>, undefined>;
|
|
160
|
+
readonly meta_observation: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Metacognitive observation about reasoning process">]>, undefined>;
|
|
161
|
+
readonly reasoning_depth: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["shallow", "moderate", "deep"], undefined>, v.DescriptionAction<"shallow" | "moderate" | "deep", "Effort signal: how deep reasoning should go">]>, undefined>;
|
|
162
|
+
readonly session_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Session ID must contain only letters, numbers, hyphens, and underscores">, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 100, undefined>, v.DescriptionAction<string, "Optional session identifier for state isolation. When provided, thought history, branches, and statistics are scoped to this session. Omitting preserves global behavior.">]>, undefined>;
|
|
163
|
+
readonly reset_state: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "When true, clears all state for the target session before processing this thought. The thought is then processed as the first in a fresh session.">]>, undefined>;
|
|
164
|
+
readonly tool_name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string, "Name of the tool being invoked (for tool_call thoughts)">]>, undefined>;
|
|
165
|
+
readonly tool_arguments: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.DescriptionAction<{
|
|
166
|
+
[x: string]: unknown;
|
|
167
|
+
}, "Arguments passed to the tool (for tool_call thoughts)">]>, undefined>;
|
|
168
|
+
readonly tool_result: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnknownSchema, v.DescriptionAction<unknown, "Result returned by the tool (for tool_observation thoughts)">]>, undefined>;
|
|
169
|
+
readonly continuation_token: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string, "Token for resuming long-running tool invocations">]>, undefined>;
|
|
170
|
+
readonly decomposition_children: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Child thought IDs produced by decomposition">]>, undefined>;
|
|
171
|
+
readonly backtrack_target: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Thought number to backtrack to. When the parent thought has thought_type=backtrack, this thought is logically retracted: it remains in history but is excluded from quality signals and reasoning stats.">]>, undefined>;
|
|
172
|
+
readonly register_branch_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "register_branch_id must contain only letters, numbers, hyphens, and underscores">, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 50, undefined>, v.DescriptionAction<string, "Pre-declares a branch ID for this session before any thoughts reference it. Useful so that subsequent thoughts using merge_branch_ids can target a branch that has not yet received any thoughts.">]>, undefined>;
|
|
173
|
+
}, undefined>, undefined>;
|
|
174
|
+
}, undefined>, undefined>;
|
|
175
|
+
readonly branches: v.ArraySchema<v.StrictObjectSchema<{
|
|
176
|
+
readonly sessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
|
|
177
|
+
readonly branchId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
|
|
178
|
+
readonly thoughts: v.ArraySchema<v.ObjectSchema<{
|
|
179
|
+
readonly available_mcp_tools: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Array of MCP tool names available for use (e.g., [\"mcp-omnisearch\", \"mcp-turso-cloud\"])">]>, undefined>;
|
|
180
|
+
readonly available_skills: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Array of skill names available for use (e.g., [\"commit\", \"review-pr\", \"pdf\"])">]>, undefined>;
|
|
181
|
+
readonly thought: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Your current thinking step">]>;
|
|
182
|
+
readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 30, undefined>, v.DescriptionAction<string, "Unique identifier for this thought. Auto-generated if not provided.">]>, undefined>;
|
|
183
|
+
readonly next_thought_needed: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Whether another thought step is needed (defaults to true if not provided)">]>, undefined>;
|
|
184
|
+
readonly thought_number: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Current thought number">]>;
|
|
185
|
+
readonly total_thoughts: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Estimated total thoughts needed">]>;
|
|
186
|
+
readonly is_revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Whether this revises previous thinking">]>, undefined>;
|
|
187
|
+
readonly revises_thought: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Which thought is being reconsidered">]>, undefined>;
|
|
188
|
+
readonly branch_from_thought: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Branching point thought number">]>, undefined>;
|
|
189
|
+
readonly branch_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Branch ID must contain only letters, numbers, hyphens, and underscores">, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 50, undefined>, v.DescriptionAction<string, "Branch identifier (alphanumeric, hyphens, underscores only, max 50 chars)">]>, undefined>;
|
|
190
|
+
readonly needs_more_thoughts: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "If more thoughts are needed">]>, undefined>;
|
|
191
|
+
readonly current_step: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
192
|
+
readonly step_description: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "What needs to be done">]>;
|
|
193
|
+
readonly recommended_tools: v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
|
|
194
|
+
readonly tool_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the tool being recommended">]>;
|
|
195
|
+
readonly confidence: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation">]>;
|
|
196
|
+
readonly rationale: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>, v.DescriptionAction<string, "Why this tool is recommended">]>;
|
|
197
|
+
readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
|
|
198
|
+
readonly suggested_inputs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.BooleanSchema<undefined>, v.NullSchema<undefined>], undefined>, undefined>, v.DescriptionAction<{
|
|
199
|
+
[x: string]: string | number | boolean | null;
|
|
200
|
+
}, "Optional suggested parameters (flat key-value pairs only)">]>, undefined>;
|
|
201
|
+
readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative tools that could be used">]>, undefined>;
|
|
202
|
+
}, undefined>, undefined>, v.DescriptionAction<{
|
|
203
|
+
tool_name: string;
|
|
204
|
+
confidence: number;
|
|
205
|
+
rationale: string;
|
|
206
|
+
priority?: number | undefined;
|
|
207
|
+
suggested_inputs?: {
|
|
208
|
+
[x: string]: string | number | boolean | null;
|
|
209
|
+
} | undefined;
|
|
210
|
+
alternatives?: string[] | undefined;
|
|
211
|
+
}[], "Tools recommended for this step">]>;
|
|
212
|
+
readonly recommended_skills: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
|
|
213
|
+
readonly skill_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the skill being recommended">]>;
|
|
214
|
+
readonly confidence: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation (default: 0.5)">]>, undefined>;
|
|
215
|
+
readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>, v.DescriptionAction<string, "Why this skill is recommended (default: empty string)">]>, undefined>;
|
|
216
|
+
readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
|
|
217
|
+
readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative skills that could be used">]>, undefined>;
|
|
218
|
+
readonly allowed_tools: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Tools this skill is allowed to use (from skill frontmatter)">]>, undefined>;
|
|
219
|
+
readonly user_invocable: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Whether this skill can be user-invoked">]>, undefined>;
|
|
220
|
+
}, undefined>, undefined>, v.DescriptionAction<{
|
|
221
|
+
skill_name: string;
|
|
222
|
+
confidence?: number | undefined;
|
|
223
|
+
rationale?: string | undefined;
|
|
224
|
+
priority?: number | undefined;
|
|
225
|
+
alternatives?: string[] | undefined;
|
|
226
|
+
allowed_tools?: string[] | undefined;
|
|
227
|
+
user_invocable?: boolean | undefined;
|
|
228
|
+
}[], "Skills recommended for this step">]>, undefined>;
|
|
229
|
+
readonly expected_outcome: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "What to expect from this step">]>;
|
|
230
|
+
readonly next_step_conditions: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Conditions to consider for the next step">]>, undefined>;
|
|
231
|
+
}, undefined>, v.DescriptionAction<{
|
|
232
|
+
step_description: string;
|
|
233
|
+
recommended_tools: {
|
|
234
|
+
tool_name: string;
|
|
235
|
+
confidence: number;
|
|
236
|
+
rationale: string;
|
|
237
|
+
priority?: number | undefined;
|
|
238
|
+
suggested_inputs?: {
|
|
239
|
+
[x: string]: string | number | boolean | null;
|
|
240
|
+
} | undefined;
|
|
241
|
+
alternatives?: string[] | undefined;
|
|
242
|
+
}[];
|
|
243
|
+
recommended_skills?: {
|
|
244
|
+
skill_name: string;
|
|
245
|
+
confidence?: number | undefined;
|
|
246
|
+
rationale?: string | undefined;
|
|
247
|
+
priority?: number | undefined;
|
|
248
|
+
alternatives?: string[] | undefined;
|
|
249
|
+
allowed_tools?: string[] | undefined;
|
|
250
|
+
user_invocable?: boolean | undefined;
|
|
251
|
+
}[] | undefined;
|
|
252
|
+
expected_outcome: string;
|
|
253
|
+
next_step_conditions?: string[] | undefined;
|
|
254
|
+
}, "Current step recommendation">]>, undefined>;
|
|
255
|
+
readonly previous_steps: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
|
|
256
|
+
readonly step_description: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "What needs to be done">]>;
|
|
257
|
+
readonly recommended_tools: v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
|
|
258
|
+
readonly tool_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the tool being recommended">]>;
|
|
259
|
+
readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>, v.DescriptionAction<string, "Why this tool is recommended (default: empty string)">]>, undefined>;
|
|
260
|
+
readonly confidence: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation (default: 0.5)">]>, undefined>;
|
|
261
|
+
readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
|
|
262
|
+
readonly suggested_inputs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.BooleanSchema<undefined>, v.NullSchema<undefined>], undefined>, undefined>, v.DescriptionAction<{
|
|
263
|
+
[x: string]: string | number | boolean | null;
|
|
264
|
+
}, "Optional suggested parameters (flat key-value pairs only)">]>, undefined>;
|
|
265
|
+
readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative tools that could be used">]>, undefined>;
|
|
266
|
+
}, undefined>, undefined>, v.DescriptionAction<{
|
|
267
|
+
tool_name: string;
|
|
268
|
+
rationale?: string | undefined;
|
|
269
|
+
confidence?: number | undefined;
|
|
270
|
+
priority?: number | undefined;
|
|
271
|
+
suggested_inputs?: {
|
|
272
|
+
[x: string]: string | number | boolean | null;
|
|
273
|
+
} | undefined;
|
|
274
|
+
alternatives?: string[] | undefined;
|
|
275
|
+
}[], "Tools recommended for this step">]>;
|
|
276
|
+
readonly recommended_skills: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
|
|
277
|
+
readonly skill_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the skill being recommended">]>;
|
|
278
|
+
readonly confidence: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation (default: 0.5)">]>, undefined>;
|
|
279
|
+
readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>, v.DescriptionAction<string, "Why this skill is recommended (default: empty string)">]>, undefined>;
|
|
280
|
+
readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
|
|
281
|
+
readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative skills that could be used">]>, undefined>;
|
|
282
|
+
readonly allowed_tools: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Tools this skill is allowed to use (from skill frontmatter)">]>, undefined>;
|
|
283
|
+
readonly user_invocable: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Whether this skill can be user-invoked">]>, undefined>;
|
|
284
|
+
}, undefined>, undefined>, v.DescriptionAction<{
|
|
285
|
+
skill_name: string;
|
|
286
|
+
confidence?: number | undefined;
|
|
287
|
+
rationale?: string | undefined;
|
|
288
|
+
priority?: number | undefined;
|
|
289
|
+
alternatives?: string[] | undefined;
|
|
290
|
+
allowed_tools?: string[] | undefined;
|
|
291
|
+
user_invocable?: boolean | undefined;
|
|
292
|
+
}[], "Skills recommended for this step">]>, undefined>;
|
|
293
|
+
readonly expected_outcome: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "What to expect from this step (default: empty string)">]>, undefined>;
|
|
294
|
+
readonly next_step_conditions: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Conditions to consider for the next step">]>, undefined>;
|
|
295
|
+
}, undefined>, undefined>, v.DescriptionAction<{
|
|
296
|
+
step_description: string;
|
|
297
|
+
recommended_tools: {
|
|
298
|
+
tool_name: string;
|
|
299
|
+
rationale?: string | undefined;
|
|
300
|
+
confidence?: number | undefined;
|
|
301
|
+
priority?: number | undefined;
|
|
302
|
+
suggested_inputs?: {
|
|
303
|
+
[x: string]: string | number | boolean | null;
|
|
304
|
+
} | undefined;
|
|
305
|
+
alternatives?: string[] | undefined;
|
|
306
|
+
}[];
|
|
307
|
+
recommended_skills?: {
|
|
308
|
+
skill_name: string;
|
|
309
|
+
confidence?: number | undefined;
|
|
310
|
+
rationale?: string | undefined;
|
|
311
|
+
priority?: number | undefined;
|
|
312
|
+
alternatives?: string[] | undefined;
|
|
313
|
+
allowed_tools?: string[] | undefined;
|
|
314
|
+
user_invocable?: boolean | undefined;
|
|
315
|
+
}[] | undefined;
|
|
316
|
+
expected_outcome?: string | undefined;
|
|
317
|
+
next_step_conditions?: string[] | undefined;
|
|
318
|
+
}[], "Steps already recommended (lenient schema - allows partial data with defaults)">]>, undefined>;
|
|
319
|
+
readonly remaining_steps: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "High-level descriptions of upcoming steps">]>, undefined>;
|
|
320
|
+
readonly thought_type: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["regular", "hypothesis", "verification", "critique", "synthesis", "meta", "tool_call", "tool_observation", "assumption", "decomposition", "backtrack"], undefined>, v.DescriptionAction<"regular" | "hypothesis" | "verification" | "critique" | "synthesis" | "meta" | "tool_call" | "tool_observation" | "assumption" | "decomposition" | "backtrack", "Classified purpose: regular (default), hypothesis, verification, critique, synthesis, meta, tool_call (requires toolInterleave), tool_observation (requires toolInterleave), assumption (requires newThoughtTypes), decomposition (requires newThoughtTypes), backtrack (requires newThoughtTypes)">]>, undefined>;
|
|
321
|
+
readonly quality_score: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "Self-assessed quality score (0-1)">]>, undefined>;
|
|
322
|
+
readonly confidence: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "Explicit confidence in correctness (0-1)">]>, undefined>;
|
|
323
|
+
readonly hypothesis_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Hypothesis ID must contain only letters, numbers, hyphens, and underscores">, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 50, undefined>, v.DescriptionAction<string, "Identifier linking hypothesis to verification thoughts">]>, undefined>;
|
|
324
|
+
readonly verification_target: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Thought number being verified or critiqued">]>, undefined>;
|
|
325
|
+
readonly verification_result: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.LiteralSchema<0, undefined>, v.LiteralSchema<1, undefined>], undefined>, v.DescriptionAction<0 | 1, "Exact verification outcome label: 0 for incorrect, 1 for correct">]>, undefined>;
|
|
326
|
+
readonly synthesis_sources: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>, v.DescriptionAction<number[], "Thought numbers being synthesized">]>, undefined>;
|
|
327
|
+
readonly merge_from_thoughts: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>, v.DescriptionAction<number[], "Thought numbers from other branches being merged (DAG)">]>, undefined>;
|
|
328
|
+
readonly merge_branch_ids: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MaxLengthAction<string, 50, undefined>]>, undefined>, v.DescriptionAction<string[], "Branch IDs being merged into current context">]>, undefined>;
|
|
329
|
+
readonly meta_observation: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Metacognitive observation about reasoning process">]>, undefined>;
|
|
330
|
+
readonly reasoning_depth: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["shallow", "moderate", "deep"], undefined>, v.DescriptionAction<"shallow" | "moderate" | "deep", "Effort signal: how deep reasoning should go">]>, undefined>;
|
|
331
|
+
readonly session_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Session ID must contain only letters, numbers, hyphens, and underscores">, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 100, undefined>, v.DescriptionAction<string, "Optional session identifier for state isolation. When provided, thought history, branches, and statistics are scoped to this session. Omitting preserves global behavior.">]>, undefined>;
|
|
332
|
+
readonly reset_state: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "When true, clears all state for the target session before processing this thought. The thought is then processed as the first in a fresh session.">]>, undefined>;
|
|
333
|
+
readonly tool_name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string, "Name of the tool being invoked (for tool_call thoughts)">]>, undefined>;
|
|
334
|
+
readonly tool_arguments: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.DescriptionAction<{
|
|
335
|
+
[x: string]: unknown;
|
|
336
|
+
}, "Arguments passed to the tool (for tool_call thoughts)">]>, undefined>;
|
|
337
|
+
readonly tool_result: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnknownSchema, v.DescriptionAction<unknown, "Result returned by the tool (for tool_observation thoughts)">]>, undefined>;
|
|
338
|
+
readonly continuation_token: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string, "Token for resuming long-running tool invocations">]>, undefined>;
|
|
339
|
+
readonly decomposition_children: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Child thought IDs produced by decomposition">]>, undefined>;
|
|
340
|
+
readonly backtrack_target: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Thought number to backtrack to. When the parent thought has thought_type=backtrack, this thought is logically retracted: it remains in history but is excluded from quality signals and reasoning stats.">]>, undefined>;
|
|
341
|
+
readonly register_branch_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "register_branch_id must contain only letters, numbers, hyphens, and underscores">, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 50, undefined>, v.DescriptionAction<string, "Pre-declares a branch ID for this session before any thoughts reference it. Useful so that subsequent thoughts using merge_branch_ids can target a branch that has not yet received any thoughts.">]>, undefined>;
|
|
342
|
+
}, undefined>, undefined>;
|
|
343
|
+
}, undefined>, undefined>;
|
|
344
|
+
readonly edges: v.ArraySchema<v.StrictObjectSchema<{
|
|
345
|
+
readonly sessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
|
|
346
|
+
readonly edges: v.ArraySchema<v.ObjectSchema<{
|
|
347
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 30, undefined>]>;
|
|
348
|
+
readonly from: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 30, undefined>]>;
|
|
349
|
+
readonly to: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 30, undefined>]>;
|
|
350
|
+
readonly kind: v.UnionSchema<[v.LiteralSchema<"sequence", undefined>, v.LiteralSchema<"branch", undefined>, v.LiteralSchema<"merge", undefined>, v.LiteralSchema<"verifies", undefined>, v.LiteralSchema<"critiques", undefined>, v.LiteralSchema<"derives_from", undefined>, v.LiteralSchema<"tool_invocation", undefined>, v.LiteralSchema<"revises", undefined>], undefined>;
|
|
351
|
+
readonly sessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
352
|
+
readonly createdAt: v.NumberSchema<undefined>;
|
|
353
|
+
readonly metadata: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
|
|
354
|
+
}, undefined>, undefined>;
|
|
355
|
+
}, undefined>, undefined>;
|
|
356
|
+
readonly summaries: v.ArraySchema<v.StrictObjectSchema<{
|
|
357
|
+
readonly sessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
|
|
358
|
+
readonly summaries: v.ArraySchema<v.ObjectSchema<{
|
|
359
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
|
|
360
|
+
readonly sessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 100, undefined>]>;
|
|
361
|
+
readonly branchId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>, undefined>;
|
|
362
|
+
readonly rootThoughtId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
|
|
363
|
+
readonly coveredIds: v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>, undefined>;
|
|
364
|
+
readonly coveredRange: v.SchemaWithPipe<readonly [v.ArraySchema<v.NumberSchema<undefined>, undefined>, v.LengthAction<number[], 2, undefined>]>;
|
|
365
|
+
readonly topics: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
366
|
+
readonly aggregateConfidence: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
367
|
+
readonly createdAt: v.NumberSchema<undefined>;
|
|
368
|
+
readonly meta: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
|
|
369
|
+
}, undefined>, undefined>;
|
|
370
|
+
}, undefined>, undefined>;
|
|
371
|
+
}, undefined>;
|
|
372
|
+
export declare const EMPTY_FILE_SNAPSHOT_V2: FileSnapshotV2;
|
|
373
|
+
export declare function parseFileSnapshotV2(content: string, sourcePath: string): FileSnapshotV2;
|
|
374
|
+
export declare function serializeFileSnapshotV2(snapshot: FileSnapshotV2, sourcePath: string): string;
|
|
375
|
+
export declare function sessionsInSnapshot(snapshot: FileSnapshotV2): SessionId[];
|
|
376
|
+
export declare function sessionForThought(thought: ThoughtData): SessionId;
|
|
377
|
+
//# sourceMappingURL=FileSnapshotV2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSnapshotV2.d.ts","sourceRoot":"","sources":["../../src/persistence/FileSnapshotV2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AA4B7D,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAM/B,CAAC;AAEH,eAAO,MAAM,sBAAsB,EAAE,cAMpC,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,cAAc,CAmCvF;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAuB5F;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,cAAc,GAAG,SAAS,EAAE,CAWxE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,CAEjE"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { GLOBAL_SESSION_ID, asSessionId } from "../contracts/ids.js";
|
|
2
|
+
import { SummarySchema } from "../core/compression/Summary.js";
|
|
3
|
+
import { PersistenceCompatibilityError, PersistenceCorruptionError } from "../errors.js";
|
|
4
|
+
import { EdgeSchema, SequentialThinkingSchema } from "../schema.js";
|
|
5
|
+
import { parseEdge, parseSummary, parseThoughtData } from "./PersistenceCodec.js";
|
|
6
|
+
import { compareCodePoint, compareCreatedThenId, parsePersistenceBranchId } from "./PersistenceScope.js";
|
|
7
|
+
import { validateFileSnapshotV2 } from "./FileSnapshotValidation.js";
|
|
8
|
+
import * as __rspack_external_valibot from "valibot";
|
|
9
|
+
const SessionIdStringSchema = __rspack_external_valibot.pipe(__rspack_external_valibot.string(), __rspack_external_valibot.regex(/^[A-Za-z0-9_-]{1,100}$/));
|
|
10
|
+
const BranchIdStringSchema = __rspack_external_valibot.pipe(__rspack_external_valibot.string(), __rspack_external_valibot.regex(/^[A-Za-z0-9_-]{1,50}$/));
|
|
11
|
+
const ThoughtSessionV2Schema = __rspack_external_valibot.strictObject({
|
|
12
|
+
sessionId: SessionIdStringSchema,
|
|
13
|
+
thoughts: __rspack_external_valibot.array(SequentialThinkingSchema)
|
|
14
|
+
});
|
|
15
|
+
const BranchRecordV2Schema = __rspack_external_valibot.strictObject({
|
|
16
|
+
sessionId: SessionIdStringSchema,
|
|
17
|
+
branchId: BranchIdStringSchema,
|
|
18
|
+
thoughts: __rspack_external_valibot.array(SequentialThinkingSchema)
|
|
19
|
+
});
|
|
20
|
+
const EdgeSessionV2Schema = __rspack_external_valibot.strictObject({
|
|
21
|
+
sessionId: SessionIdStringSchema,
|
|
22
|
+
edges: __rspack_external_valibot.array(EdgeSchema)
|
|
23
|
+
});
|
|
24
|
+
const SummarySessionV2Schema = __rspack_external_valibot.strictObject({
|
|
25
|
+
sessionId: SessionIdStringSchema,
|
|
26
|
+
summaries: __rspack_external_valibot.array(SummarySchema)
|
|
27
|
+
});
|
|
28
|
+
const FileSnapshotV2Schema = __rspack_external_valibot.strictObject({
|
|
29
|
+
version: __rspack_external_valibot.literal(2),
|
|
30
|
+
thoughts: __rspack_external_valibot.array(ThoughtSessionV2Schema),
|
|
31
|
+
branches: __rspack_external_valibot.array(BranchRecordV2Schema),
|
|
32
|
+
edges: __rspack_external_valibot.array(EdgeSessionV2Schema),
|
|
33
|
+
summaries: __rspack_external_valibot.array(SummarySessionV2Schema)
|
|
34
|
+
});
|
|
35
|
+
const EMPTY_FILE_SNAPSHOT_V2 = {
|
|
36
|
+
version: 2,
|
|
37
|
+
thoughts: [],
|
|
38
|
+
branches: [],
|
|
39
|
+
edges: [],
|
|
40
|
+
summaries: []
|
|
41
|
+
};
|
|
42
|
+
function parseFileSnapshotV2(content, sourcePath) {
|
|
43
|
+
let raw;
|
|
44
|
+
try {
|
|
45
|
+
raw = JSON.parse(content);
|
|
46
|
+
} catch (error) {
|
|
47
|
+
throw new PersistenceCorruptionError(sourcePath, error);
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
const parsed = __rspack_external_valibot.parse(FileSnapshotV2Schema, raw);
|
|
51
|
+
const snapshot = {
|
|
52
|
+
version: 2,
|
|
53
|
+
thoughts: parsed.thoughts.map((record)=>({
|
|
54
|
+
sessionId: asSessionId(record.sessionId),
|
|
55
|
+
thoughts: record.thoughts.map((thought)=>parseThoughtData(thought, sourcePath))
|
|
56
|
+
})),
|
|
57
|
+
branches: parsed.branches.map((record)=>({
|
|
58
|
+
sessionId: asSessionId(record.sessionId),
|
|
59
|
+
branchId: parsePersistenceBranchId(record.branchId, sourcePath),
|
|
60
|
+
thoughts: record.thoughts.map((thought)=>parseThoughtData(thought, sourcePath))
|
|
61
|
+
})),
|
|
62
|
+
edges: parsed.edges.map((record)=>({
|
|
63
|
+
sessionId: asSessionId(record.sessionId),
|
|
64
|
+
edges: record.edges.map(parseEdge)
|
|
65
|
+
})),
|
|
66
|
+
summaries: parsed.summaries.map((record)=>({
|
|
67
|
+
sessionId: asSessionId(record.sessionId),
|
|
68
|
+
summaries: record.summaries.map((summary)=>parseSummary(summary, sourcePath))
|
|
69
|
+
}))
|
|
70
|
+
};
|
|
71
|
+
validateFileSnapshotV2(snapshot, sourcePath);
|
|
72
|
+
return snapshot;
|
|
73
|
+
} catch (error) {
|
|
74
|
+
if (error instanceof PersistenceCompatibilityError) throw error;
|
|
75
|
+
throw new PersistenceCompatibilityError(sourcePath, 'document does not match File v2', error);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function serializeFileSnapshotV2(snapshot, sourcePath) {
|
|
79
|
+
const canonical = {
|
|
80
|
+
version: 2,
|
|
81
|
+
thoughts: [
|
|
82
|
+
...snapshot.thoughts
|
|
83
|
+
].sort((left, right)=>compareCodePoint(left.sessionId, right.sessionId)),
|
|
84
|
+
branches: [
|
|
85
|
+
...snapshot.branches
|
|
86
|
+
].sort((left, right)=>compareCodePoint(left.sessionId, right.sessionId) || compareCodePoint(left.branchId, right.branchId)),
|
|
87
|
+
edges: [
|
|
88
|
+
...snapshot.edges
|
|
89
|
+
].sort((left, right)=>compareCodePoint(left.sessionId, right.sessionId)).map((record)=>({
|
|
90
|
+
...record,
|
|
91
|
+
edges: [
|
|
92
|
+
...record.edges
|
|
93
|
+
].sort(compareCreatedThenId)
|
|
94
|
+
})),
|
|
95
|
+
summaries: [
|
|
96
|
+
...snapshot.summaries
|
|
97
|
+
].sort((left, right)=>compareCodePoint(left.sessionId, right.sessionId)).map((record)=>({
|
|
98
|
+
...record,
|
|
99
|
+
summaries: [
|
|
100
|
+
...record.summaries
|
|
101
|
+
].sort(compareCreatedThenId)
|
|
102
|
+
}))
|
|
103
|
+
};
|
|
104
|
+
validateFileSnapshotV2(canonical, sourcePath);
|
|
105
|
+
return `${JSON.stringify(canonical, null, 2)}\n`;
|
|
106
|
+
}
|
|
107
|
+
function sessionsInSnapshot(snapshot) {
|
|
108
|
+
const sessions = new Set();
|
|
109
|
+
for (const records of [
|
|
110
|
+
snapshot.thoughts,
|
|
111
|
+
snapshot.branches,
|
|
112
|
+
snapshot.edges,
|
|
113
|
+
snapshot.summaries
|
|
114
|
+
])for (const record of records)sessions.add(record.sessionId);
|
|
115
|
+
return [
|
|
116
|
+
...sessions
|
|
117
|
+
].sort(compareCodePoint);
|
|
118
|
+
}
|
|
119
|
+
function sessionForThought(thought) {
|
|
120
|
+
return thought.session_id ?? GLOBAL_SESSION_ID;
|
|
121
|
+
}
|
|
122
|
+
export { EMPTY_FILE_SNAPSHOT_V2, FileSnapshotV2Schema, parseFileSnapshotV2, serializeFileSnapshotV2, sessionForThought, sessionsInSnapshot };
|
|
123
|
+
|
|
124
|
+
//# sourceMappingURL=FileSnapshotV2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persistence/FileSnapshotV2.js","sources":["../../src/persistence/FileSnapshotV2.ts"],"sourcesContent":["import * as v from 'valibot';\nimport type { SessionId } from '../contracts/ids.js';\nimport { asSessionId, GLOBAL_SESSION_ID } from '../contracts/ids.js';\nimport { SummarySchema } from '../core/compression/Summary.js';\nimport type { ThoughtData } from '../core/thought.js';\nimport { PersistenceCompatibilityError, PersistenceCorruptionError } from '../errors.js';\nimport { EdgeSchema, SequentialThinkingSchema } from '../schema.js';\nimport { parseEdge, parseSummary, parseThoughtData } from './PersistenceCodec.js';\nimport type { FileSnapshotV2 } from './FileSnapshotTypes.js';\nimport {\n\tcompareCodePoint,\n\tcompareCreatedThenId,\n\tparsePersistenceBranchId,\n} from './PersistenceScope.js';\nimport { validateFileSnapshotV2 } from './FileSnapshotValidation.js';\n\nconst SessionIdStringSchema = v.pipe(v.string(), v.regex(/^[A-Za-z0-9_-]{1,100}$/));\nconst BranchIdStringSchema = v.pipe(v.string(), v.regex(/^[A-Za-z0-9_-]{1,50}$/));\nconst ThoughtSessionV2Schema = v.strictObject({\n\tsessionId: SessionIdStringSchema,\n\tthoughts: v.array(SequentialThinkingSchema),\n});\nconst BranchRecordV2Schema = v.strictObject({\n\tsessionId: SessionIdStringSchema,\n\tbranchId: BranchIdStringSchema,\n\tthoughts: v.array(SequentialThinkingSchema),\n});\nconst EdgeSessionV2Schema = v.strictObject({\n\tsessionId: SessionIdStringSchema,\n\tedges: v.array(EdgeSchema),\n});\nconst SummarySessionV2Schema = v.strictObject({\n\tsessionId: SessionIdStringSchema,\n\tsummaries: v.array(SummarySchema),\n});\n\nexport const FileSnapshotV2Schema = v.strictObject({\n\tversion: v.literal(2),\n\tthoughts: v.array(ThoughtSessionV2Schema),\n\tbranches: v.array(BranchRecordV2Schema),\n\tedges: v.array(EdgeSessionV2Schema),\n\tsummaries: v.array(SummarySessionV2Schema),\n});\n\nexport const EMPTY_FILE_SNAPSHOT_V2: FileSnapshotV2 = {\n\tversion: 2,\n\tthoughts: [],\n\tbranches: [],\n\tedges: [],\n\tsummaries: [],\n};\n\nexport function parseFileSnapshotV2(content: string, sourcePath: string): FileSnapshotV2 {\n\tlet raw: unknown;\n\ttry {\n\t\traw = JSON.parse(content);\n\t} catch (error) {\n\t\tthrow new PersistenceCorruptionError(sourcePath, error);\n\t}\n\ttry {\n\t\tconst parsed = v.parse(FileSnapshotV2Schema, raw);\n\t\tconst snapshot: FileSnapshotV2 = {\n\t\t\tversion: 2,\n\t\t\tthoughts: parsed.thoughts.map((record) => ({\n\t\t\t\tsessionId: asSessionId(record.sessionId),\n\t\t\t\tthoughts: record.thoughts.map((thought) => parseThoughtData(thought, sourcePath)),\n\t\t\t})),\n\t\t\tbranches: parsed.branches.map((record) => ({\n\t\t\t\tsessionId: asSessionId(record.sessionId),\n\t\t\t\tbranchId: parsePersistenceBranchId(record.branchId, sourcePath),\n\t\t\t\tthoughts: record.thoughts.map((thought) => parseThoughtData(thought, sourcePath)),\n\t\t\t})),\n\t\t\tedges: parsed.edges.map((record) => ({\n\t\t\t\tsessionId: asSessionId(record.sessionId),\n\t\t\t\tedges: record.edges.map(parseEdge),\n\t\t\t})),\n\t\t\tsummaries: parsed.summaries.map((record) => ({\n\t\t\t\tsessionId: asSessionId(record.sessionId),\n\t\t\t\tsummaries: record.summaries.map((summary) => parseSummary(summary, sourcePath)),\n\t\t\t})),\n\t\t};\n\t\tvalidateFileSnapshotV2(snapshot, sourcePath);\n\t\treturn snapshot;\n\t} catch (error) {\n\t\tif (error instanceof PersistenceCompatibilityError) throw error;\n\t\tthrow new PersistenceCompatibilityError(sourcePath, 'document does not match File v2', error);\n\t}\n}\n\nexport function serializeFileSnapshotV2(snapshot: FileSnapshotV2, sourcePath: string): string {\n\tconst canonical: FileSnapshotV2 = {\n\t\tversion: 2,\n\t\tthoughts: [...snapshot.thoughts].sort((left, right) =>\n\t\t\tcompareCodePoint(left.sessionId, right.sessionId)\n\t\t),\n\t\tbranches: [...snapshot.branches].sort(\n\t\t\t(left, right) =>\n\t\t\t\tcompareCodePoint(left.sessionId, right.sessionId) ||\n\t\t\t\tcompareCodePoint(left.branchId, right.branchId)\n\t\t),\n\t\tedges: [...snapshot.edges]\n\t\t\t.sort((left, right) => compareCodePoint(left.sessionId, right.sessionId))\n\t\t\t.map((record) => ({ ...record, edges: [...record.edges].sort(compareCreatedThenId) })),\n\t\tsummaries: [...snapshot.summaries]\n\t\t\t.sort((left, right) => compareCodePoint(left.sessionId, right.sessionId))\n\t\t\t.map((record) => ({\n\t\t\t\t...record,\n\t\t\t\tsummaries: [...record.summaries].sort(compareCreatedThenId),\n\t\t\t})),\n\t};\n\tvalidateFileSnapshotV2(canonical, sourcePath);\n\treturn `${JSON.stringify(canonical, null, 2)}\\n`;\n}\n\nexport function sessionsInSnapshot(snapshot: FileSnapshotV2): SessionId[] {\n\tconst sessions = new Set<SessionId>();\n\tfor (const records of [\n\t\tsnapshot.thoughts,\n\t\tsnapshot.branches,\n\t\tsnapshot.edges,\n\t\tsnapshot.summaries,\n\t]) {\n\t\tfor (const record of records) sessions.add(record.sessionId);\n\t}\n\treturn [...sessions].sort(compareCodePoint);\n}\n\nexport function sessionForThought(thought: ThoughtData): SessionId {\n\treturn thought.session_id ?? GLOBAL_SESSION_ID;\n}\n"],"names":["SessionIdStringSchema","v","BranchIdStringSchema","ThoughtSessionV2Schema","SequentialThinkingSchema","BranchRecordV2Schema","EdgeSessionV2Schema","EdgeSchema","SummarySessionV2Schema","SummarySchema","FileSnapshotV2Schema","EMPTY_FILE_SNAPSHOT_V2","parseFileSnapshotV2","content","sourcePath","raw","JSON","error","PersistenceCorruptionError","parsed","snapshot","record","asSessionId","thought","parseThoughtData","parsePersistenceBranchId","parseEdge","summary","parseSummary","validateFileSnapshotV2","PersistenceCompatibilityError","serializeFileSnapshotV2","canonical","left","right","compareCodePoint","compareCreatedThenId","sessionsInSnapshot","sessions","Set","records","sessionForThought","GLOBAL_SESSION_ID"],"mappings":";;;;;;;;AAgBA,MAAMA,wBAAwBC,0BAAAA,IAAM,CAACA,0BAAAA,MAAQ,IAAIA,0BAAAA,KAAO,CAAC;AACzD,MAAMC,uBAAuBD,0BAAAA,IAAM,CAACA,0BAAAA,MAAQ,IAAIA,0BAAAA,KAAO,CAAC;AACxD,MAAME,yBAAyBF,0BAAAA,YAAc,CAAC;IAC7C,WAAWD;IACX,UAAUC,0BAAAA,KAAO,CAACG;AACnB;AACA,MAAMC,uBAAuBJ,0BAAAA,YAAc,CAAC;IAC3C,WAAWD;IACX,UAAUE;IACV,UAAUD,0BAAAA,KAAO,CAACG;AACnB;AACA,MAAME,sBAAsBL,0BAAAA,YAAc,CAAC;IAC1C,WAAWD;IACX,OAAOC,0BAAAA,KAAO,CAACM;AAChB;AACA,MAAMC,yBAAyBP,0BAAAA,YAAc,CAAC;IAC7C,WAAWD;IACX,WAAWC,0BAAAA,KAAO,CAACQ;AACpB;AAEO,MAAMC,uBAAuBT,0BAAAA,YAAc,CAAC;IAClD,SAASA,0BAAAA,OAAS,CAAC;IACnB,UAAUA,0BAAAA,KAAO,CAACE;IAClB,UAAUF,0BAAAA,KAAO,CAACI;IAClB,OAAOJ,0BAAAA,KAAO,CAACK;IACf,WAAWL,0BAAAA,KAAO,CAACO;AACpB;AAEO,MAAMG,yBAAyC;IACrD,SAAS;IACT,UAAU,EAAE;IACZ,UAAU,EAAE;IACZ,OAAO,EAAE;IACT,WAAW,EAAE;AACd;AAEO,SAASC,oBAAoBC,OAAe,EAAEC,UAAkB;IACtE,IAAIC;IACJ,IAAI;QACHA,MAAMC,KAAK,KAAK,CAACH;IAClB,EAAE,OAAOI,OAAO;QACf,MAAM,IAAIC,2BAA2BJ,YAAYG;IAClD;IACA,IAAI;QACH,MAAME,SAASlB,0BAAAA,KAAO,CAACS,sBAAsBK;QAC7C,MAAMK,WAA2B;YAChC,SAAS;YACT,UAAUD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAACE,SAAY;oBAC1C,WAAWC,YAAYD,OAAO,SAAS;oBACvC,UAAUA,OAAO,QAAQ,CAAC,GAAG,CAAC,CAACE,UAAYC,iBAAiBD,SAAST;gBACtE;YACA,UAAUK,OAAO,QAAQ,CAAC,GAAG,CAAC,CAACE,SAAY;oBAC1C,WAAWC,YAAYD,OAAO,SAAS;oBACvC,UAAUI,yBAAyBJ,OAAO,QAAQ,EAAEP;oBACpD,UAAUO,OAAO,QAAQ,CAAC,GAAG,CAAC,CAACE,UAAYC,iBAAiBD,SAAST;gBACtE;YACA,OAAOK,OAAO,KAAK,CAAC,GAAG,CAAC,CAACE,SAAY;oBACpC,WAAWC,YAAYD,OAAO,SAAS;oBACvC,OAAOA,OAAO,KAAK,CAAC,GAAG,CAACK;gBACzB;YACA,WAAWP,OAAO,SAAS,CAAC,GAAG,CAAC,CAACE,SAAY;oBAC5C,WAAWC,YAAYD,OAAO,SAAS;oBACvC,WAAWA,OAAO,SAAS,CAAC,GAAG,CAAC,CAACM,UAAYC,aAAaD,SAASb;gBACpE;QACD;QACAe,uBAAuBT,UAAUN;QACjC,OAAOM;IACR,EAAE,OAAOH,OAAO;QACf,IAAIA,iBAAiBa,+BAA+B,MAAMb;QAC1D,MAAM,IAAIa,8BAA8BhB,YAAY,mCAAmCG;IACxF;AACD;AAEO,SAASc,wBAAwBX,QAAwB,EAAEN,UAAkB;IACnF,MAAMkB,YAA4B;QACjC,SAAS;QACT,UAAU;eAAIZ,SAAS,QAAQ;SAAC,CAAC,IAAI,CAAC,CAACa,MAAMC,QAC5CC,iBAAiBF,KAAK,SAAS,EAAEC,MAAM,SAAS;QAEjD,UAAU;eAAId,SAAS,QAAQ;SAAC,CAAC,IAAI,CACpC,CAACa,MAAMC,QACNC,iBAAiBF,KAAK,SAAS,EAAEC,MAAM,SAAS,KAChDC,iBAAiBF,KAAK,QAAQ,EAAEC,MAAM,QAAQ;QAEhD,OAAO;eAAId,SAAS,KAAK;SAAC,CACxB,IAAI,CAAC,CAACa,MAAMC,QAAUC,iBAAiBF,KAAK,SAAS,EAAEC,MAAM,SAAS,GACtE,GAAG,CAAC,CAACb,SAAY;gBAAE,GAAGA,MAAM;gBAAE,OAAO;uBAAIA,OAAO,KAAK;iBAAC,CAAC,IAAI,CAACe;YAAsB;QACpF,WAAW;eAAIhB,SAAS,SAAS;SAAC,CAChC,IAAI,CAAC,CAACa,MAAMC,QAAUC,iBAAiBF,KAAK,SAAS,EAAEC,MAAM,SAAS,GACtE,GAAG,CAAC,CAACb,SAAY;gBACjB,GAAGA,MAAM;gBACT,WAAW;uBAAIA,OAAO,SAAS;iBAAC,CAAC,IAAI,CAACe;YACvC;IACF;IACAP,uBAAuBG,WAAWlB;IAClC,OAAO,GAAGE,KAAK,SAAS,CAACgB,WAAW,MAAM,GAAG,EAAE,CAAC;AACjD;AAEO,SAASK,mBAAmBjB,QAAwB;IAC1D,MAAMkB,WAAW,IAAIC;IACrB,KAAK,MAAMC,WAAW;QACrBpB,SAAS,QAAQ;QACjBA,SAAS,QAAQ;QACjBA,SAAS,KAAK;QACdA,SAAS,SAAS;KAClB,CACA,KAAK,MAAMC,UAAUmB,QAASF,SAAS,GAAG,CAACjB,OAAO,SAAS;IAE5D,OAAO;WAAIiB;KAAS,CAAC,IAAI,CAACH;AAC3B;AAEO,SAASM,kBAAkBlB,OAAoB;IACrD,OAAOA,QAAQ,UAAU,IAAImB;AAC9B"}
|