promptspeak-mcp-server 0.1.0
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/README.md +98 -0
- package/dist/agents/database.d.ts +174 -0
- package/dist/agents/database.d.ts.map +1 -0
- package/dist/agents/database.js +1029 -0
- package/dist/agents/database.js.map +1 -0
- package/dist/agents/index.d.ts +13 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +20 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/integration.d.ts +75 -0
- package/dist/agents/integration.d.ts.map +1 -0
- package/dist/agents/integration.js +166 -0
- package/dist/agents/integration.js.map +1 -0
- package/dist/agents/proposal-manager.d.ts +137 -0
- package/dist/agents/proposal-manager.d.ts.map +1 -0
- package/dist/agents/proposal-manager.js +782 -0
- package/dist/agents/proposal-manager.js.map +1 -0
- package/dist/agents/registry.d.ts +168 -0
- package/dist/agents/registry.d.ts.map +1 -0
- package/dist/agents/registry.js +716 -0
- package/dist/agents/registry.js.map +1 -0
- package/dist/agents/templates/index.d.ts +50 -0
- package/dist/agents/templates/index.d.ts.map +1 -0
- package/dist/agents/templates/index.js +415 -0
- package/dist/agents/templates/index.js.map +1 -0
- package/dist/agents/tools.d.ts +156 -0
- package/dist/agents/tools.d.ts.map +1 -0
- package/dist/agents/tools.js +590 -0
- package/dist/agents/tools.js.map +1 -0
- package/dist/agents/types.d.ts +513 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +20 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/auth/api-key.d.ts +37 -0
- package/dist/auth/api-key.d.ts.map +1 -0
- package/dist/auth/api-key.js +202 -0
- package/dist/auth/api-key.js.map +1 -0
- package/dist/auth/index.d.ts +8 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +8 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/oauth.d.ts +125 -0
- package/dist/auth/oauth.d.ts.map +1 -0
- package/dist/auth/oauth.js +225 -0
- package/dist/auth/oauth.js.map +1 -0
- package/dist/boot-camp/boot-camp-controller.d.ts +185 -0
- package/dist/boot-camp/boot-camp-controller.d.ts.map +1 -0
- package/dist/boot-camp/boot-camp-controller.js +696 -0
- package/dist/boot-camp/boot-camp-controller.js.map +1 -0
- package/dist/boot-camp/database.d.ts +79 -0
- package/dist/boot-camp/database.d.ts.map +1 -0
- package/dist/boot-camp/database.js +594 -0
- package/dist/boot-camp/database.js.map +1 -0
- package/dist/boot-camp/index.d.ts +104 -0
- package/dist/boot-camp/index.d.ts.map +1 -0
- package/dist/boot-camp/index.js +140 -0
- package/dist/boot-camp/index.js.map +1 -0
- package/dist/boot-camp/phases/base-phase.d.ts +98 -0
- package/dist/boot-camp/phases/base-phase.d.ts.map +1 -0
- package/dist/boot-camp/phases/base-phase.js +170 -0
- package/dist/boot-camp/phases/base-phase.js.map +1 -0
- package/dist/boot-camp/phases/combat.d.ts +52 -0
- package/dist/boot-camp/phases/combat.d.ts.map +1 -0
- package/dist/boot-camp/phases/combat.js +413 -0
- package/dist/boot-camp/phases/combat.js.map +1 -0
- package/dist/boot-camp/phases/conditioning.d.ts +53 -0
- package/dist/boot-camp/phases/conditioning.d.ts.map +1 -0
- package/dist/boot-camp/phases/conditioning.js +354 -0
- package/dist/boot-camp/phases/conditioning.js.map +1 -0
- package/dist/boot-camp/phases/crucible.d.ts +52 -0
- package/dist/boot-camp/phases/crucible.d.ts.map +1 -0
- package/dist/boot-camp/phases/crucible.js +442 -0
- package/dist/boot-camp/phases/crucible.js.map +1 -0
- package/dist/boot-camp/phases/graduation.d.ts +52 -0
- package/dist/boot-camp/phases/graduation.d.ts.map +1 -0
- package/dist/boot-camp/phases/graduation.js +422 -0
- package/dist/boot-camp/phases/graduation.js.map +1 -0
- package/dist/boot-camp/phases/index.d.ts +14 -0
- package/dist/boot-camp/phases/index.d.ts.map +1 -0
- package/dist/boot-camp/phases/index.js +14 -0
- package/dist/boot-camp/phases/index.js.map +1 -0
- package/dist/boot-camp/phases/marksmanship.d.ts +50 -0
- package/dist/boot-camp/phases/marksmanship.d.ts.map +1 -0
- package/dist/boot-camp/phases/marksmanship.js +373 -0
- package/dist/boot-camp/phases/marksmanship.js.map +1 -0
- package/dist/boot-camp/phases/phase-factory.d.ts +24 -0
- package/dist/boot-camp/phases/phase-factory.d.ts.map +1 -0
- package/dist/boot-camp/phases/phase-factory.js +74 -0
- package/dist/boot-camp/phases/phase-factory.js.map +1 -0
- package/dist/boot-camp/phases/receiving.d.ts +49 -0
- package/dist/boot-camp/phases/receiving.d.ts.map +1 -0
- package/dist/boot-camp/phases/receiving.js +168 -0
- package/dist/boot-camp/phases/receiving.js.map +1 -0
- package/dist/boot-camp/swarm-integration.d.ts +164 -0
- package/dist/boot-camp/swarm-integration.d.ts.map +1 -0
- package/dist/boot-camp/swarm-integration.js +405 -0
- package/dist/boot-camp/swarm-integration.js.map +1 -0
- package/dist/boot-camp/tools.d.ts +718 -0
- package/dist/boot-camp/tools.d.ts.map +1 -0
- package/dist/boot-camp/tools.js +592 -0
- package/dist/boot-camp/tools.js.map +1 -0
- package/dist/boot-camp/types.d.ts +342 -0
- package/dist/boot-camp/types.d.ts.map +1 -0
- package/dist/boot-camp/types.js +179 -0
- package/dist/boot-camp/types.js.map +1 -0
- package/dist/core/config/env.d.ts +146 -0
- package/dist/core/config/env.d.ts.map +1 -0
- package/dist/core/config/env.js +230 -0
- package/dist/core/config/env.js.map +1 -0
- package/dist/core/config/index.d.ts +23 -0
- package/dist/core/config/index.d.ts.map +1 -0
- package/dist/core/config/index.js +31 -0
- package/dist/core/config/index.js.map +1 -0
- package/dist/core/errors/base.d.ts +168 -0
- package/dist/core/errors/base.d.ts.map +1 -0
- package/dist/core/errors/base.js +195 -0
- package/dist/core/errors/base.js.map +1 -0
- package/dist/core/errors/codes.d.ts +170 -0
- package/dist/core/errors/codes.d.ts.map +1 -0
- package/dist/core/errors/codes.js +460 -0
- package/dist/core/errors/codes.js.map +1 -0
- package/dist/core/errors/index.d.ts +40 -0
- package/dist/core/errors/index.d.ts.map +1 -0
- package/dist/core/errors/index.js +79 -0
- package/dist/core/errors/index.js.map +1 -0
- package/dist/core/errors/types.d.ts +708 -0
- package/dist/core/errors/types.d.ts.map +1 -0
- package/dist/core/errors/types.js +791 -0
- package/dist/core/errors/types.js.map +1 -0
- package/dist/core/http/http-client.d.ts +140 -0
- package/dist/core/http/http-client.d.ts.map +1 -0
- package/dist/core/http/http-client.js +278 -0
- package/dist/core/http/http-client.js.map +1 -0
- package/dist/core/http/index.d.ts +37 -0
- package/dist/core/http/index.d.ts.map +1 -0
- package/dist/core/http/index.js +41 -0
- package/dist/core/http/index.js.map +1 -0
- package/dist/core/http/retry-policy.d.ts +99 -0
- package/dist/core/http/retry-policy.d.ts.map +1 -0
- package/dist/core/http/retry-policy.js +152 -0
- package/dist/core/http/retry-policy.js.map +1 -0
- package/dist/core/logging/context.d.ts +84 -0
- package/dist/core/logging/context.d.ts.map +1 -0
- package/dist/core/logging/context.js +124 -0
- package/dist/core/logging/context.js.map +1 -0
- package/dist/core/logging/formatters.d.ts +48 -0
- package/dist/core/logging/formatters.d.ts.map +1 -0
- package/dist/core/logging/formatters.js +186 -0
- package/dist/core/logging/formatters.js.map +1 -0
- package/dist/core/logging/index.d.ts +49 -0
- package/dist/core/logging/index.d.ts.map +1 -0
- package/dist/core/logging/index.js +52 -0
- package/dist/core/logging/index.js.map +1 -0
- package/dist/core/logging/logger.d.ts +120 -0
- package/dist/core/logging/logger.d.ts.map +1 -0
- package/dist/core/logging/logger.js +213 -0
- package/dist/core/logging/logger.js.map +1 -0
- package/dist/core/logging/types.d.ts +64 -0
- package/dist/core/logging/types.d.ts.map +1 -0
- package/dist/core/logging/types.js +29 -0
- package/dist/core/logging/types.js.map +1 -0
- package/dist/core/patterns/index.d.ts +11 -0
- package/dist/core/patterns/index.d.ts.map +1 -0
- package/dist/core/patterns/index.js +11 -0
- package/dist/core/patterns/index.js.map +1 -0
- package/dist/core/patterns/singleton.d.ts +69 -0
- package/dist/core/patterns/singleton.d.ts.map +1 -0
- package/dist/core/patterns/singleton.js +115 -0
- package/dist/core/patterns/singleton.js.map +1 -0
- package/dist/core/result/batch.d.ts +190 -0
- package/dist/core/result/batch.d.ts.map +1 -0
- package/dist/core/result/batch.js +391 -0
- package/dist/core/result/batch.js.map +1 -0
- package/dist/core/result/builders.d.ts +310 -0
- package/dist/core/result/builders.d.ts.map +1 -0
- package/dist/core/result/builders.js +454 -0
- package/dist/core/result/builders.js.map +1 -0
- package/dist/core/result/index.d.ts +51 -0
- package/dist/core/result/index.d.ts.map +1 -0
- package/dist/core/result/index.js +83 -0
- package/dist/core/result/index.js.map +1 -0
- package/dist/core/result/mcp-adapter.d.ts +192 -0
- package/dist/core/result/mcp-adapter.d.ts.map +1 -0
- package/dist/core/result/mcp-adapter.js +255 -0
- package/dist/core/result/mcp-adapter.js.map +1 -0
- package/dist/core/result/types.d.ts +170 -0
- package/dist/core/result/types.d.ts.map +1 -0
- package/dist/core/result/types.js +21 -0
- package/dist/core/result/types.js.map +1 -0
- package/dist/core/security/index.d.ts +41 -0
- package/dist/core/security/index.d.ts.map +1 -0
- package/dist/core/security/index.js +43 -0
- package/dist/core/security/index.js.map +1 -0
- package/dist/core/security/redaction.d.ts +138 -0
- package/dist/core/security/redaction.d.ts.map +1 -0
- package/dist/core/security/redaction.js +295 -0
- package/dist/core/security/redaction.js.map +1 -0
- package/dist/core/security/secure-logging.d.ts +189 -0
- package/dist/core/security/secure-logging.d.ts.map +1 -0
- package/dist/core/security/secure-logging.js +253 -0
- package/dist/core/security/secure-logging.js.map +1 -0
- package/dist/core/types/http-types.d.ts +94 -0
- package/dist/core/types/http-types.d.ts.map +1 -0
- package/dist/core/types/http-types.js +36 -0
- package/dist/core/types/http-types.js.map +1 -0
- package/dist/core/types/id-generators.d.ts +69 -0
- package/dist/core/types/id-generators.d.ts.map +1 -0
- package/dist/core/types/id-generators.js +96 -0
- package/dist/core/types/id-generators.js.map +1 -0
- package/dist/core/types/index.d.ts +13 -0
- package/dist/core/types/index.d.ts.map +1 -0
- package/dist/core/types/index.js +14 -0
- package/dist/core/types/index.js.map +1 -0
- package/dist/document/agent.d.ts +63 -0
- package/dist/document/agent.d.ts.map +1 -0
- package/dist/document/agent.js +245 -0
- package/dist/document/agent.js.map +1 -0
- package/dist/document/extractor.d.ts +158 -0
- package/dist/document/extractor.d.ts.map +1 -0
- package/dist/document/extractor.js +720 -0
- package/dist/document/extractor.js.map +1 -0
- package/dist/document/index.d.ts +16 -0
- package/dist/document/index.d.ts.map +1 -0
- package/dist/document/index.js +22 -0
- package/dist/document/index.js.map +1 -0
- package/dist/document/merger.d.ts +59 -0
- package/dist/document/merger.d.ts.map +1 -0
- package/dist/document/merger.js +593 -0
- package/dist/document/merger.js.map +1 -0
- package/dist/document/parser.d.ts +67 -0
- package/dist/document/parser.d.ts.map +1 -0
- package/dist/document/parser.js +359 -0
- package/dist/document/parser.js.map +1 -0
- package/dist/document/tools.d.ts +14 -0
- package/dist/document/tools.d.ts.map +1 -0
- package/dist/document/tools.js +279 -0
- package/dist/document/tools.js.map +1 -0
- package/dist/document/types.d.ts +290 -0
- package/dist/document/types.d.ts.map +1 -0
- package/dist/document/types.js +12 -0
- package/dist/document/types.js.map +1 -0
- package/dist/drift/baseline.d.ts +65 -0
- package/dist/drift/baseline.d.ts.map +1 -0
- package/dist/drift/baseline.js +179 -0
- package/dist/drift/baseline.js.map +1 -0
- package/dist/drift/circuit-breaker.d.ts +91 -0
- package/dist/drift/circuit-breaker.d.ts.map +1 -0
- package/dist/drift/circuit-breaker.js +237 -0
- package/dist/drift/circuit-breaker.js.map +1 -0
- package/dist/drift/index.d.ts +161 -0
- package/dist/drift/index.d.ts.map +1 -0
- package/dist/drift/index.js +247 -0
- package/dist/drift/index.js.map +1 -0
- package/dist/drift/monitor.d.ts +115 -0
- package/dist/drift/monitor.d.ts.map +1 -0
- package/dist/drift/monitor.js +367 -0
- package/dist/drift/monitor.js.map +1 -0
- package/dist/drift/tripwire.d.ts +81 -0
- package/dist/drift/tripwire.d.ts.map +1 -0
- package/dist/drift/tripwire.js +196 -0
- package/dist/drift/tripwire.js.map +1 -0
- package/dist/fidelity/index.d.ts +12 -0
- package/dist/fidelity/index.d.ts.map +1 -0
- package/dist/fidelity/index.js +12 -0
- package/dist/fidelity/index.js.map +1 -0
- package/dist/fidelity/refresh-hooks.d.ts +75 -0
- package/dist/fidelity/refresh-hooks.d.ts.map +1 -0
- package/dist/fidelity/refresh-hooks.js +151 -0
- package/dist/fidelity/refresh-hooks.js.map +1 -0
- package/dist/gatekeeper/checklist-generator.d.ts +45 -0
- package/dist/gatekeeper/checklist-generator.d.ts.map +1 -0
- package/dist/gatekeeper/checklist-generator.js +336 -0
- package/dist/gatekeeper/checklist-generator.js.map +1 -0
- package/dist/gatekeeper/coverage.d.ts +28 -0
- package/dist/gatekeeper/coverage.d.ts.map +1 -0
- package/dist/gatekeeper/coverage.js +234 -0
- package/dist/gatekeeper/coverage.js.map +1 -0
- package/dist/gatekeeper/hold-manager.d.ts +174 -0
- package/dist/gatekeeper/hold-manager.d.ts.map +1 -0
- package/dist/gatekeeper/hold-manager.js +723 -0
- package/dist/gatekeeper/hold-manager.js.map +1 -0
- package/dist/gatekeeper/index.d.ts +244 -0
- package/dist/gatekeeper/index.d.ts.map +1 -0
- package/dist/gatekeeper/index.js +854 -0
- package/dist/gatekeeper/index.js.map +1 -0
- package/dist/gatekeeper/interceptor.d.ts +54 -0
- package/dist/gatekeeper/interceptor.d.ts.map +1 -0
- package/dist/gatekeeper/interceptor.js +217 -0
- package/dist/gatekeeper/interceptor.js.map +1 -0
- package/dist/gatekeeper/resolver.d.ts +53 -0
- package/dist/gatekeeper/resolver.d.ts.map +1 -0
- package/dist/gatekeeper/resolver.js +314 -0
- package/dist/gatekeeper/resolver.js.map +1 -0
- package/dist/gatekeeper/validator.d.ts +26 -0
- package/dist/gatekeeper/validator.d.ts.map +1 -0
- package/dist/gatekeeper/validator.js +686 -0
- package/dist/gatekeeper/validator.js.map +1 -0
- package/dist/government/adapters/base-adapter.d.ts +366 -0
- package/dist/government/adapters/base-adapter.d.ts.map +1 -0
- package/dist/government/adapters/base-adapter.js +598 -0
- package/dist/government/adapters/base-adapter.js.map +1 -0
- package/dist/government/adapters/federal-register-adapter.d.ts +327 -0
- package/dist/government/adapters/federal-register-adapter.d.ts.map +1 -0
- package/dist/government/adapters/federal-register-adapter.js +595 -0
- package/dist/government/adapters/federal-register-adapter.js.map +1 -0
- package/dist/government/adapters/regulations-adapter.d.ts +432 -0
- package/dist/government/adapters/regulations-adapter.d.ts.map +1 -0
- package/dist/government/adapters/regulations-adapter.js +727 -0
- package/dist/government/adapters/regulations-adapter.js.map +1 -0
- package/dist/government/adapters/sam-entity-adapter.d.ts +354 -0
- package/dist/government/adapters/sam-entity-adapter.d.ts.map +1 -0
- package/dist/government/adapters/sam-entity-adapter.js +599 -0
- package/dist/government/adapters/sam-entity-adapter.js.map +1 -0
- package/dist/government/adapters/sam-opportunities-adapter.d.ts +221 -0
- package/dist/government/adapters/sam-opportunities-adapter.d.ts.map +1 -0
- package/dist/government/adapters/sam-opportunities-adapter.js +538 -0
- package/dist/government/adapters/sam-opportunities-adapter.js.map +1 -0
- package/dist/government/adapters/usaspending-adapter.d.ts +390 -0
- package/dist/government/adapters/usaspending-adapter.d.ts.map +1 -0
- package/dist/government/adapters/usaspending-adapter.js +455 -0
- package/dist/government/adapters/usaspending-adapter.js.map +1 -0
- package/dist/government/index.d.ts +128 -0
- package/dist/government/index.d.ts.map +1 -0
- package/dist/government/index.js +183 -0
- package/dist/government/index.js.map +1 -0
- package/dist/government/mappers/symbol-mapper.d.ts +87 -0
- package/dist/government/mappers/symbol-mapper.d.ts.map +1 -0
- package/dist/government/mappers/symbol-mapper.js +647 -0
- package/dist/government/mappers/symbol-mapper.js.map +1 -0
- package/dist/handlers/index.d.ts +10 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +11 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/recon-tools.d.ts +364 -0
- package/dist/handlers/recon-tools.d.ts.map +1 -0
- package/dist/handlers/recon-tools.js +678 -0
- package/dist/handlers/recon-tools.js.map +1 -0
- package/dist/handlers/tool-dispatcher.d.ts +71 -0
- package/dist/handlers/tool-dispatcher.d.ts.map +1 -0
- package/dist/handlers/tool-dispatcher.js +114 -0
- package/dist/handlers/tool-dispatcher.js.map +1 -0
- package/dist/handlers/tool-registry.d.ts +76 -0
- package/dist/handlers/tool-registry.d.ts.map +1 -0
- package/dist/handlers/tool-registry.js +636 -0
- package/dist/handlers/tool-registry.js.map +1 -0
- package/dist/http/app.d.ts +24 -0
- package/dist/http/app.d.ts.map +1 -0
- package/dist/http/app.js +35 -0
- package/dist/http/app.js.map +1 -0
- package/dist/http/config.d.ts +42 -0
- package/dist/http/config.d.ts.map +1 -0
- package/dist/http/config.js +62 -0
- package/dist/http/config.js.map +1 -0
- package/dist/http/database/index.d.ts +49 -0
- package/dist/http/database/index.d.ts.map +1 -0
- package/dist/http/database/index.js +115 -0
- package/dist/http/database/index.js.map +1 -0
- package/dist/http/middleware/auth.d.ts +28 -0
- package/dist/http/middleware/auth.d.ts.map +1 -0
- package/dist/http/middleware/auth.js +157 -0
- package/dist/http/middleware/auth.js.map +1 -0
- package/dist/http/middleware/error-handler.d.ts +47 -0
- package/dist/http/middleware/error-handler.d.ts.map +1 -0
- package/dist/http/middleware/error-handler.js +213 -0
- package/dist/http/middleware/error-handler.js.map +1 -0
- package/dist/http/middleware/index.d.ts +38 -0
- package/dist/http/middleware/index.d.ts.map +1 -0
- package/dist/http/middleware/index.js +124 -0
- package/dist/http/middleware/index.js.map +1 -0
- package/dist/http/middleware/request-logger.d.ts +8 -0
- package/dist/http/middleware/request-logger.d.ts.map +1 -0
- package/dist/http/middleware/request-logger.js +58 -0
- package/dist/http/middleware/request-logger.js.map +1 -0
- package/dist/http/routes/agent-runtime.d.ts +9 -0
- package/dist/http/routes/agent-runtime.d.ts.map +1 -0
- package/dist/http/routes/agent-runtime.js +415 -0
- package/dist/http/routes/agent-runtime.js.map +1 -0
- package/dist/http/routes/agents.d.ts +9 -0
- package/dist/http/routes/agents.d.ts.map +1 -0
- package/dist/http/routes/agents.js +503 -0
- package/dist/http/routes/agents.js.map +1 -0
- package/dist/http/routes/broadcasts.d.ts +9 -0
- package/dist/http/routes/broadcasts.d.ts.map +1 -0
- package/dist/http/routes/broadcasts.js +223 -0
- package/dist/http/routes/broadcasts.js.map +1 -0
- package/dist/http/routes/dashboard.d.ts +9 -0
- package/dist/http/routes/dashboard.d.ts.map +1 -0
- package/dist/http/routes/dashboard.js +169 -0
- package/dist/http/routes/dashboard.js.map +1 -0
- package/dist/http/routes/ebay.d.ts +15 -0
- package/dist/http/routes/ebay.d.ts.map +1 -0
- package/dist/http/routes/ebay.js +242 -0
- package/dist/http/routes/ebay.js.map +1 -0
- package/dist/http/routes/health.d.ts +8 -0
- package/dist/http/routes/health.d.ts.map +1 -0
- package/dist/http/routes/health.js +66 -0
- package/dist/http/routes/health.js.map +1 -0
- package/dist/http/routes/index.d.ts +39 -0
- package/dist/http/routes/index.d.ts.map +1 -0
- package/dist/http/routes/index.js +89 -0
- package/dist/http/routes/index.js.map +1 -0
- package/dist/http/routes/missions.d.ts +9 -0
- package/dist/http/routes/missions.d.ts.map +1 -0
- package/dist/http/routes/missions.js +587 -0
- package/dist/http/routes/missions.js.map +1 -0
- package/dist/http/routes/openapi.d.ts +8 -0
- package/dist/http/routes/openapi.d.ts.map +1 -0
- package/dist/http/routes/openapi.js +76 -0
- package/dist/http/routes/openapi.js.map +1 -0
- package/dist/http/routes/symbols.d.ts +19 -0
- package/dist/http/routes/symbols.d.ts.map +1 -0
- package/dist/http/routes/symbols.js +219 -0
- package/dist/http/routes/symbols.js.map +1 -0
- package/dist/http/server-init.d.ts +69 -0
- package/dist/http/server-init.d.ts.map +1 -0
- package/dist/http/server-init.js +270 -0
- package/dist/http/server-init.js.map +1 -0
- package/dist/http/server.d.ts +14 -0
- package/dist/http/server.d.ts.map +1 -0
- package/dist/http/server.js +114 -0
- package/dist/http/server.js.map +1 -0
- package/dist/http/services/agent-runtime.d.ts +211 -0
- package/dist/http/services/agent-runtime.d.ts.map +1 -0
- package/dist/http/services/agent-runtime.js +603 -0
- package/dist/http/services/agent-runtime.js.map +1 -0
- package/dist/http/services/broadcasts.d.ts +142 -0
- package/dist/http/services/broadcasts.d.ts.map +1 -0
- package/dist/http/services/broadcasts.js +335 -0
- package/dist/http/services/broadcasts.js.map +1 -0
- package/dist/http/services/index.d.ts +10 -0
- package/dist/http/services/index.d.ts.map +1 -0
- package/dist/http/services/index.js +14 -0
- package/dist/http/services/index.js.map +1 -0
- package/dist/http/services/metrics.d.ts +144 -0
- package/dist/http/services/metrics.d.ts.map +1 -0
- package/dist/http/services/metrics.js +351 -0
- package/dist/http/services/metrics.js.map +1 -0
- package/dist/http/services/missions.d.ts +224 -0
- package/dist/http/services/missions.d.ts.map +1 -0
- package/dist/http/services/missions.js +701 -0
- package/dist/http/services/missions.js.map +1 -0
- package/dist/http/services/symbol.service.d.ts +62 -0
- package/dist/http/services/symbol.service.d.ts.map +1 -0
- package/dist/http/services/symbol.service.js +222 -0
- package/dist/http/services/symbol.service.js.map +1 -0
- package/dist/http/websocket/index.d.ts +50 -0
- package/dist/http/websocket/index.d.ts.map +1 -0
- package/dist/http/websocket/index.js +293 -0
- package/dist/http/websocket/index.js.map +1 -0
- package/dist/legal/__tests__/calendar-integration.test.d.ts +7 -0
- package/dist/legal/__tests__/calendar-integration.test.d.ts.map +1 -0
- package/dist/legal/__tests__/calendar-integration.test.js +643 -0
- package/dist/legal/__tests__/calendar-integration.test.js.map +1 -0
- package/dist/legal/batch-parser.d.ts +185 -0
- package/dist/legal/batch-parser.d.ts.map +1 -0
- package/dist/legal/batch-parser.js +348 -0
- package/dist/legal/batch-parser.js.map +1 -0
- package/dist/legal/calendar-integration.d.ts +209 -0
- package/dist/legal/calendar-integration.d.ts.map +1 -0
- package/dist/legal/calendar-integration.js +341 -0
- package/dist/legal/calendar-integration.js.map +1 -0
- package/dist/legal/calendar-tools.d.ts +39 -0
- package/dist/legal/calendar-tools.d.ts.map +1 -0
- package/dist/legal/calendar-tools.js +606 -0
- package/dist/legal/calendar-tools.js.map +1 -0
- package/dist/legal/calendar-types.d.ts +152 -0
- package/dist/legal/calendar-types.d.ts.map +1 -0
- package/dist/legal/calendar-types.js +88 -0
- package/dist/legal/calendar-types.js.map +1 -0
- package/dist/legal/citation-validator.d.ts +97 -0
- package/dist/legal/citation-validator.d.ts.map +1 -0
- package/dist/legal/citation-validator.js +1487 -0
- package/dist/legal/citation-validator.js.map +1 -0
- package/dist/legal/courtlistener-adapter.d.ts +156 -0
- package/dist/legal/courtlistener-adapter.d.ts.map +1 -0
- package/dist/legal/courtlistener-adapter.js +684 -0
- package/dist/legal/courtlistener-adapter.js.map +1 -0
- package/dist/legal/deadline-extractor.d.ts +71 -0
- package/dist/legal/deadline-extractor.d.ts.map +1 -0
- package/dist/legal/deadline-extractor.js +557 -0
- package/dist/legal/deadline-extractor.js.map +1 -0
- package/dist/legal/ical-generator.d.ts +83 -0
- package/dist/legal/ical-generator.d.ts.map +1 -0
- package/dist/legal/ical-generator.js +322 -0
- package/dist/legal/ical-generator.js.map +1 -0
- package/dist/legal/index.d.ts +17 -0
- package/dist/legal/index.d.ts.map +1 -0
- package/dist/legal/index.js +32 -0
- package/dist/legal/index.js.map +1 -0
- package/dist/legal/legal-preflight.d.ts +86 -0
- package/dist/legal/legal-preflight.d.ts.map +1 -0
- package/dist/legal/legal-preflight.js +442 -0
- package/dist/legal/legal-preflight.js.map +1 -0
- package/dist/legal/types.d.ts +303 -0
- package/dist/legal/types.d.ts.map +1 -0
- package/dist/legal/types.js +38 -0
- package/dist/legal/types.js.map +1 -0
- package/dist/multi_agent/__tests__/intent-tools.test.d.ts +7 -0
- package/dist/multi_agent/__tests__/intent-tools.test.d.ts.map +1 -0
- package/dist/multi_agent/__tests__/intent-tools.test.js +604 -0
- package/dist/multi_agent/__tests__/intent-tools.test.js.map +1 -0
- package/dist/multi_agent/agent-registry.d.ts +132 -0
- package/dist/multi_agent/agent-registry.d.ts.map +1 -0
- package/dist/multi_agent/agent-registry.js +311 -0
- package/dist/multi_agent/agent-registry.js.map +1 -0
- package/dist/multi_agent/boot-camp.d.ts +159 -0
- package/dist/multi_agent/boot-camp.d.ts.map +1 -0
- package/dist/multi_agent/boot-camp.js +463 -0
- package/dist/multi_agent/boot-camp.js.map +1 -0
- package/dist/multi_agent/container.d.ts +87 -0
- package/dist/multi_agent/container.d.ts.map +1 -0
- package/dist/multi_agent/container.js +99 -0
- package/dist/multi_agent/container.js.map +1 -0
- package/dist/multi_agent/index.d.ts +32 -0
- package/dist/multi_agent/index.d.ts.map +1 -0
- package/dist/multi_agent/index.js +67 -0
- package/dist/multi_agent/index.js.map +1 -0
- package/dist/multi_agent/intent-manager.d.ts +119 -0
- package/dist/multi_agent/intent-manager.d.ts.map +1 -0
- package/dist/multi_agent/intent-manager.js +571 -0
- package/dist/multi_agent/intent-manager.js.map +1 -0
- package/dist/multi_agent/intent-tools.d.ts +370 -0
- package/dist/multi_agent/intent-tools.d.ts.map +1 -0
- package/dist/multi_agent/intent-tools.js +661 -0
- package/dist/multi_agent/intent-tools.js.map +1 -0
- package/dist/multi_agent/intent-types.d.ts +435 -0
- package/dist/multi_agent/intent-types.d.ts.map +1 -0
- package/dist/multi_agent/intent-types.js +17 -0
- package/dist/multi_agent/intent-types.js.map +1 -0
- package/dist/multi_agent/lru-cache.d.ts +140 -0
- package/dist/multi_agent/lru-cache.d.ts.map +1 -0
- package/dist/multi_agent/lru-cache.js +310 -0
- package/dist/multi_agent/lru-cache.js.map +1 -0
- package/dist/multi_agent/mission.d.ts +151 -0
- package/dist/multi_agent/mission.d.ts.map +1 -0
- package/dist/multi_agent/mission.js +439 -0
- package/dist/multi_agent/mission.js.map +1 -0
- package/dist/multi_agent/tool-dispatcher.d.ts +325 -0
- package/dist/multi_agent/tool-dispatcher.d.ts.map +1 -0
- package/dist/multi_agent/tool-dispatcher.js +108 -0
- package/dist/multi_agent/tool-dispatcher.js.map +1 -0
- package/dist/multi_agent/tools.d.ts +543 -0
- package/dist/multi_agent/tools.d.ts.map +1 -0
- package/dist/multi_agent/tools.js +1081 -0
- package/dist/multi_agent/tools.js.map +1 -0
- package/dist/notifications/webhook-dispatcher.d.ts +98 -0
- package/dist/notifications/webhook-dispatcher.d.ts.map +1 -0
- package/dist/notifications/webhook-dispatcher.js +548 -0
- package/dist/notifications/webhook-dispatcher.js.map +1 -0
- package/dist/operator/config.d.ts +128 -0
- package/dist/operator/config.d.ts.map +1 -0
- package/dist/operator/config.js +309 -0
- package/dist/operator/config.js.map +1 -0
- package/dist/operator/index.d.ts +116 -0
- package/dist/operator/index.d.ts.map +1 -0
- package/dist/operator/index.js +207 -0
- package/dist/operator/index.js.map +1 -0
- package/dist/policies/loader.d.ts +120 -0
- package/dist/policies/loader.d.ts.map +1 -0
- package/dist/policies/loader.js +193 -0
- package/dist/policies/loader.js.map +1 -0
- package/dist/recon/agent/analyst.d.ts +159 -0
- package/dist/recon/agent/analyst.d.ts.map +1 -0
- package/dist/recon/agent/analyst.js +689 -0
- package/dist/recon/agent/analyst.js.map +1 -0
- package/dist/recon/agent/performer.d.ts +175 -0
- package/dist/recon/agent/performer.d.ts.map +1 -0
- package/dist/recon/agent/performer.js +367 -0
- package/dist/recon/agent/performer.js.map +1 -0
- package/dist/recon/agent/runtime.d.ts +184 -0
- package/dist/recon/agent/runtime.d.ts.map +1 -0
- package/dist/recon/agent/runtime.js +474 -0
- package/dist/recon/agent/runtime.js.map +1 -0
- package/dist/recon/agent/veto-gate.d.ts +167 -0
- package/dist/recon/agent/veto-gate.d.ts.map +1 -0
- package/dist/recon/agent/veto-gate.js +393 -0
- package/dist/recon/agent/veto-gate.js.map +1 -0
- package/dist/recon/chat/web-chat-adapter.d.ts +190 -0
- package/dist/recon/chat/web-chat-adapter.d.ts.map +1 -0
- package/dist/recon/chat/web-chat-adapter.js +368 -0
- package/dist/recon/chat/web-chat-adapter.js.map +1 -0
- package/dist/recon/delivery/base-channel.d.ts +130 -0
- package/dist/recon/delivery/base-channel.d.ts.map +1 -0
- package/dist/recon/delivery/base-channel.js +260 -0
- package/dist/recon/delivery/base-channel.js.map +1 -0
- package/dist/recon/delivery/callback-channel.d.ts +156 -0
- package/dist/recon/delivery/callback-channel.d.ts.map +1 -0
- package/dist/recon/delivery/callback-channel.js +321 -0
- package/dist/recon/delivery/callback-channel.js.map +1 -0
- package/dist/recon/delivery/console-channel.d.ts +109 -0
- package/dist/recon/delivery/console-channel.d.ts.map +1 -0
- package/dist/recon/delivery/console-channel.js +311 -0
- package/dist/recon/delivery/console-channel.js.map +1 -0
- package/dist/recon/delivery/delivery-manager.d.ts +129 -0
- package/dist/recon/delivery/delivery-manager.d.ts.map +1 -0
- package/dist/recon/delivery/delivery-manager.js +450 -0
- package/dist/recon/delivery/delivery-manager.js.map +1 -0
- package/dist/recon/delivery/index.d.ts +52 -0
- package/dist/recon/delivery/index.d.ts.map +1 -0
- package/dist/recon/delivery/index.js +83 -0
- package/dist/recon/delivery/index.js.map +1 -0
- package/dist/recon/delivery/types.d.ts +191 -0
- package/dist/recon/delivery/types.d.ts.map +1 -0
- package/dist/recon/delivery/types.js +37 -0
- package/dist/recon/delivery/types.js.map +1 -0
- package/dist/recon/index.d.ts +86 -0
- package/dist/recon/index.d.ts.map +1 -0
- package/dist/recon/index.js +189 -0
- package/dist/recon/index.js.map +1 -0
- package/dist/recon/persistence/index.d.ts +103 -0
- package/dist/recon/persistence/index.d.ts.map +1 -0
- package/dist/recon/persistence/index.js +118 -0
- package/dist/recon/persistence/index.js.map +1 -0
- package/dist/recon/persistence/storage.d.ts +166 -0
- package/dist/recon/persistence/storage.d.ts.map +1 -0
- package/dist/recon/persistence/storage.js +793 -0
- package/dist/recon/persistence/storage.js.map +1 -0
- package/dist/recon/persistence/types.d.ts +254 -0
- package/dist/recon/persistence/types.d.ts.map +1 -0
- package/dist/recon/persistence/types.js +130 -0
- package/dist/recon/persistence/types.js.map +1 -0
- package/dist/recon/ralph-loop/executor.d.ts +122 -0
- package/dist/recon/ralph-loop/executor.d.ts.map +1 -0
- package/dist/recon/ralph-loop/executor.js +426 -0
- package/dist/recon/ralph-loop/executor.js.map +1 -0
- package/dist/recon/ralph-loop/scheduler.d.ts +145 -0
- package/dist/recon/ralph-loop/scheduler.d.ts.map +1 -0
- package/dist/recon/ralph-loop/scheduler.js +244 -0
- package/dist/recon/ralph-loop/scheduler.js.map +1 -0
- package/dist/recon/reports/formatters/index.d.ts +13 -0
- package/dist/recon/reports/formatters/index.d.ts.map +1 -0
- package/dist/recon/reports/formatters/index.js +13 -0
- package/dist/recon/reports/formatters/index.js.map +1 -0
- package/dist/recon/reports/formatters/json-formatter.d.ts +39 -0
- package/dist/recon/reports/formatters/json-formatter.d.ts.map +1 -0
- package/dist/recon/reports/formatters/json-formatter.js +260 -0
- package/dist/recon/reports/formatters/json-formatter.js.map +1 -0
- package/dist/recon/reports/formatters/markdown-formatter.d.ts +16 -0
- package/dist/recon/reports/formatters/markdown-formatter.d.ts.map +1 -0
- package/dist/recon/reports/formatters/markdown-formatter.js +332 -0
- package/dist/recon/reports/formatters/markdown-formatter.js.map +1 -0
- package/dist/recon/reports/formatters/text-formatter.d.ts +29 -0
- package/dist/recon/reports/formatters/text-formatter.d.ts.map +1 -0
- package/dist/recon/reports/formatters/text-formatter.js +360 -0
- package/dist/recon/reports/formatters/text-formatter.js.map +1 -0
- package/dist/recon/reports/index.d.ts +31 -0
- package/dist/recon/reports/index.d.ts.map +1 -0
- package/dist/recon/reports/index.js +33 -0
- package/dist/recon/reports/index.js.map +1 -0
- package/dist/recon/reports/report-generator.d.ts +147 -0
- package/dist/recon/reports/report-generator.d.ts.map +1 -0
- package/dist/recon/reports/report-generator.js +434 -0
- package/dist/recon/reports/report-generator.js.map +1 -0
- package/dist/recon/reports/sections/constraint-violations.d.ts +22 -0
- package/dist/recon/reports/sections/constraint-violations.d.ts.map +1 -0
- package/dist/recon/reports/sections/constraint-violations.js +383 -0
- package/dist/recon/reports/sections/constraint-violations.js.map +1 -0
- package/dist/recon/reports/sections/drift-analysis.d.ts +22 -0
- package/dist/recon/reports/sections/drift-analysis.d.ts.map +1 -0
- package/dist/recon/reports/sections/drift-analysis.js +270 -0
- package/dist/recon/reports/sections/drift-analysis.js.map +1 -0
- package/dist/recon/reports/sections/index.d.ts +23 -0
- package/dist/recon/reports/sections/index.d.ts.map +1 -0
- package/dist/recon/reports/sections/index.js +18 -0
- package/dist/recon/reports/sections/index.js.map +1 -0
- package/dist/recon/reports/sections/intelligence-gathered.d.ts +22 -0
- package/dist/recon/reports/sections/intelligence-gathered.d.ts.map +1 -0
- package/dist/recon/reports/sections/intelligence-gathered.js +373 -0
- package/dist/recon/reports/sections/intelligence-gathered.js.map +1 -0
- package/dist/recon/reports/sections/mission-overview.d.ts +22 -0
- package/dist/recon/reports/sections/mission-overview.d.ts.map +1 -0
- package/dist/recon/reports/sections/mission-overview.js +256 -0
- package/dist/recon/reports/sections/mission-overview.js.map +1 -0
- package/dist/recon/reports/sections/opposing-agent-profile.d.ts +22 -0
- package/dist/recon/reports/sections/opposing-agent-profile.d.ts.map +1 -0
- package/dist/recon/reports/sections/opposing-agent-profile.js +253 -0
- package/dist/recon/reports/sections/opposing-agent-profile.js.map +1 -0
- package/dist/recon/reports/sections/recommendations.d.ts +22 -0
- package/dist/recon/reports/sections/recommendations.d.ts.map +1 -0
- package/dist/recon/reports/sections/recommendations.js +341 -0
- package/dist/recon/reports/sections/recommendations.js.map +1 -0
- package/dist/recon/reports/sections/tactics-observed.d.ts +30 -0
- package/dist/recon/reports/sections/tactics-observed.d.ts.map +1 -0
- package/dist/recon/reports/sections/tactics-observed.js +275 -0
- package/dist/recon/reports/sections/tactics-observed.js.map +1 -0
- package/dist/recon/reports/types.d.ts +320 -0
- package/dist/recon/reports/types.d.ts.map +1 -0
- package/dist/recon/reports/types.js +13 -0
- package/dist/recon/reports/types.js.map +1 -0
- package/dist/recon/stealth/timing-calculator.d.ts +128 -0
- package/dist/recon/stealth/timing-calculator.d.ts.map +1 -0
- package/dist/recon/stealth/timing-calculator.js +288 -0
- package/dist/recon/stealth/timing-calculator.js.map +1 -0
- package/dist/recon/stealth/typing-simulator.d.ts +107 -0
- package/dist/recon/stealth/typing-simulator.d.ts.map +1 -0
- package/dist/recon/stealth/typing-simulator.js +376 -0
- package/dist/recon/stealth/typing-simulator.js.map +1 -0
- package/dist/recon/stealth/typo-generator.d.ts +95 -0
- package/dist/recon/stealth/typo-generator.d.ts.map +1 -0
- package/dist/recon/stealth/typo-generator.js +354 -0
- package/dist/recon/stealth/typo-generator.js.map +1 -0
- package/dist/recon/symbol/schema.d.ts +124 -0
- package/dist/recon/symbol/schema.d.ts.map +1 -0
- package/dist/recon/symbol/schema.js +441 -0
- package/dist/recon/symbol/schema.js.map +1 -0
- package/dist/recon/symbol/validator.d.ts +130 -0
- package/dist/recon/symbol/validator.d.ts.map +1 -0
- package/dist/recon/symbol/validator.js +619 -0
- package/dist/recon/symbol/validator.js.map +1 -0
- package/dist/recon/templates/customer-service/account-issue.d.ts +59 -0
- package/dist/recon/templates/customer-service/account-issue.d.ts.map +1 -0
- package/dist/recon/templates/customer-service/account-issue.js +170 -0
- package/dist/recon/templates/customer-service/account-issue.js.map +1 -0
- package/dist/recon/templates/customer-service/complaint.d.ts +60 -0
- package/dist/recon/templates/customer-service/complaint.d.ts.map +1 -0
- package/dist/recon/templates/customer-service/complaint.js +171 -0
- package/dist/recon/templates/customer-service/complaint.js.map +1 -0
- package/dist/recon/templates/customer-service/index.d.ts +21 -0
- package/dist/recon/templates/customer-service/index.d.ts.map +1 -0
- package/dist/recon/templates/customer-service/index.js +29 -0
- package/dist/recon/templates/customer-service/index.js.map +1 -0
- package/dist/recon/templates/customer-service/refund-request.d.ts +58 -0
- package/dist/recon/templates/customer-service/refund-request.d.ts.map +1 -0
- package/dist/recon/templates/customer-service/refund-request.js +161 -0
- package/dist/recon/templates/customer-service/refund-request.js.map +1 -0
- package/dist/recon/templates/index.d.ts +186 -0
- package/dist/recon/templates/index.d.ts.map +1 -0
- package/dist/recon/templates/index.js +316 -0
- package/dist/recon/templates/index.js.map +1 -0
- package/dist/recon/templates/sales/index.d.ts +20 -0
- package/dist/recon/templates/sales/index.d.ts.map +1 -0
- package/dist/recon/templates/sales/index.js +26 -0
- package/dist/recon/templates/sales/index.js.map +1 -0
- package/dist/recon/templates/sales/price-negotiation.d.ts +60 -0
- package/dist/recon/templates/sales/price-negotiation.d.ts.map +1 -0
- package/dist/recon/templates/sales/price-negotiation.js +167 -0
- package/dist/recon/templates/sales/price-negotiation.js.map +1 -0
- package/dist/recon/templates/sales/product-inquiry.d.ts +60 -0
- package/dist/recon/templates/sales/product-inquiry.d.ts.map +1 -0
- package/dist/recon/templates/sales/product-inquiry.js +167 -0
- package/dist/recon/templates/sales/product-inquiry.js.map +1 -0
- package/dist/recon/templates/support/feature-request.d.ts +60 -0
- package/dist/recon/templates/support/feature-request.d.ts.map +1 -0
- package/dist/recon/templates/support/feature-request.js +167 -0
- package/dist/recon/templates/support/feature-request.js.map +1 -0
- package/dist/recon/templates/support/index.d.ts +20 -0
- package/dist/recon/templates/support/index.d.ts.map +1 -0
- package/dist/recon/templates/support/index.js +26 -0
- package/dist/recon/templates/support/index.js.map +1 -0
- package/dist/recon/templates/support/troubleshooting.d.ts +60 -0
- package/dist/recon/templates/support/troubleshooting.d.ts.map +1 -0
- package/dist/recon/templates/support/troubleshooting.js +173 -0
- package/dist/recon/templates/support/troubleshooting.js.map +1 -0
- package/dist/recon/templates/types.d.ts +144 -0
- package/dist/recon/templates/types.d.ts.map +1 -0
- package/dist/recon/templates/types.js +40 -0
- package/dist/recon/templates/types.js.map +1 -0
- package/dist/recon/testing/index.d.ts +43 -0
- package/dist/recon/testing/index.d.ts.map +1 -0
- package/dist/recon/testing/index.js +55 -0
- package/dist/recon/testing/index.js.map +1 -0
- package/dist/recon/testing/metrics-collector.d.ts +185 -0
- package/dist/recon/testing/metrics-collector.d.ts.map +1 -0
- package/dist/recon/testing/metrics-collector.js +397 -0
- package/dist/recon/testing/metrics-collector.js.map +1 -0
- package/dist/recon/testing/mock-chatbot.d.ts +147 -0
- package/dist/recon/testing/mock-chatbot.d.ts.map +1 -0
- package/dist/recon/testing/mock-chatbot.js +500 -0
- package/dist/recon/testing/mock-chatbot.js.map +1 -0
- package/dist/recon/testing/scenario-runner.d.ts +154 -0
- package/dist/recon/testing/scenario-runner.d.ts.map +1 -0
- package/dist/recon/testing/scenario-runner.js +242 -0
- package/dist/recon/testing/scenario-runner.js.map +1 -0
- package/dist/recon/testing/test-scenarios.d.ts +135 -0
- package/dist/recon/testing/test-scenarios.d.ts.map +1 -0
- package/dist/recon/testing/test-scenarios.js +358 -0
- package/dist/recon/testing/test-scenarios.js.map +1 -0
- package/dist/recon/types.d.ts +821 -0
- package/dist/recon/types.d.ts.map +1 -0
- package/dist/recon/types.js +167 -0
- package/dist/recon/types.js.map +1 -0
- package/dist/scheduler/naics-monitor.d.ts +82 -0
- package/dist/scheduler/naics-monitor.d.ts.map +1 -0
- package/dist/scheduler/naics-monitor.js +534 -0
- package/dist/scheduler/naics-monitor.js.map +1 -0
- package/dist/server-init.d.ts +89 -0
- package/dist/server-init.d.ts.map +1 -0
- package/dist/server-init.js +242 -0
- package/dist/server-init.js.map +1 -0
- package/dist/server.d.ts +14 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +99 -0
- package/dist/server.js.map +1 -0
- package/dist/swarm/alerts/alert-engine.d.ts +64 -0
- package/dist/swarm/alerts/alert-engine.d.ts.map +1 -0
- package/dist/swarm/alerts/alert-engine.js +343 -0
- package/dist/swarm/alerts/alert-engine.js.map +1 -0
- package/dist/swarm/alerts/index.d.ts +7 -0
- package/dist/swarm/alerts/index.d.ts.map +1 -0
- package/dist/swarm/alerts/index.js +7 -0
- package/dist/swarm/alerts/index.js.map +1 -0
- package/dist/swarm/budget-allocator.d.ts +153 -0
- package/dist/swarm/budget-allocator.d.ts.map +1 -0
- package/dist/swarm/budget-allocator.js +402 -0
- package/dist/swarm/budget-allocator.js.map +1 -0
- package/dist/swarm/database.d.ts +202 -0
- package/dist/swarm/database.d.ts.map +1 -0
- package/dist/swarm/database.js +1389 -0
- package/dist/swarm/database.js.map +1 -0
- package/dist/swarm/demo/fixtures/index.d.ts +7 -0
- package/dist/swarm/demo/fixtures/index.d.ts.map +1 -0
- package/dist/swarm/demo/fixtures/index.js +7 -0
- package/dist/swarm/demo/fixtures/index.js.map +1 -0
- package/dist/swarm/demo/fixtures/sample-listings.d.ts +38 -0
- package/dist/swarm/demo/fixtures/sample-listings.d.ts.map +1 -0
- package/dist/swarm/demo/fixtures/sample-listings.js +390 -0
- package/dist/swarm/demo/fixtures/sample-listings.js.map +1 -0
- package/dist/swarm/demo/index.d.ts +9 -0
- package/dist/swarm/demo/index.d.ts.map +1 -0
- package/dist/swarm/demo/index.js +12 -0
- package/dist/swarm/demo/index.js.map +1 -0
- package/dist/swarm/demo/swarm-demo.d.ts +110 -0
- package/dist/swarm/demo/swarm-demo.d.ts.map +1 -0
- package/dist/swarm/demo/swarm-demo.js +423 -0
- package/dist/swarm/demo/swarm-demo.js.map +1 -0
- package/dist/swarm/ebay/auth.d.ts +98 -0
- package/dist/swarm/ebay/auth.d.ts.map +1 -0
- package/dist/swarm/ebay/auth.js +268 -0
- package/dist/swarm/ebay/auth.js.map +1 -0
- package/dist/swarm/ebay/client.d.ts +111 -0
- package/dist/swarm/ebay/client.d.ts.map +1 -0
- package/dist/swarm/ebay/client.js +433 -0
- package/dist/swarm/ebay/client.js.map +1 -0
- package/dist/swarm/ebay/index.d.ts +11 -0
- package/dist/swarm/ebay/index.d.ts.map +1 -0
- package/dist/swarm/ebay/index.js +11 -0
- package/dist/swarm/ebay/index.js.map +1 -0
- package/dist/swarm/ebay/rate-limiter.d.ts +115 -0
- package/dist/swarm/ebay/rate-limiter.d.ts.map +1 -0
- package/dist/swarm/ebay/rate-limiter.js +264 -0
- package/dist/swarm/ebay/rate-limiter.js.map +1 -0
- package/dist/swarm/ebay/sandbox-config.d.ts +280 -0
- package/dist/swarm/ebay/sandbox-config.d.ts.map +1 -0
- package/dist/swarm/ebay/sandbox-config.js +353 -0
- package/dist/swarm/ebay/sandbox-config.js.map +1 -0
- package/dist/swarm/ebay/types.d.ts +532 -0
- package/dist/swarm/ebay/types.d.ts.map +1 -0
- package/dist/swarm/ebay/types.js +64 -0
- package/dist/swarm/ebay/types.js.map +1 -0
- package/dist/swarm/hooks/alert-hook.d.ts +18 -0
- package/dist/swarm/hooks/alert-hook.d.ts.map +1 -0
- package/dist/swarm/hooks/alert-hook.js +44 -0
- package/dist/swarm/hooks/alert-hook.js.map +1 -0
- package/dist/swarm/hooks/database-sync-hook.d.ts +19 -0
- package/dist/swarm/hooks/database-sync-hook.d.ts.map +1 -0
- package/dist/swarm/hooks/database-sync-hook.js +121 -0
- package/dist/swarm/hooks/database-sync-hook.js.map +1 -0
- package/dist/swarm/hooks/index.d.ts +61 -0
- package/dist/swarm/hooks/index.d.ts.map +1 -0
- package/dist/swarm/hooks/index.js +103 -0
- package/dist/swarm/hooks/index.js.map +1 -0
- package/dist/swarm/hooks/observation-hooks.d.ts +178 -0
- package/dist/swarm/hooks/observation-hooks.d.ts.map +1 -0
- package/dist/swarm/hooks/observation-hooks.js +319 -0
- package/dist/swarm/hooks/observation-hooks.js.map +1 -0
- package/dist/swarm/hooks/pinecone-sync-hook.d.ts +58 -0
- package/dist/swarm/hooks/pinecone-sync-hook.d.ts.map +1 -0
- package/dist/swarm/hooks/pinecone-sync-hook.js +193 -0
- package/dist/swarm/hooks/pinecone-sync-hook.js.map +1 -0
- package/dist/swarm/hooks/webhook-alert-hook.d.ts +35 -0
- package/dist/swarm/hooks/webhook-alert-hook.d.ts.map +1 -0
- package/dist/swarm/hooks/webhook-alert-hook.js +251 -0
- package/dist/swarm/hooks/webhook-alert-hook.js.map +1 -0
- package/dist/swarm/index.d.ts +33 -0
- package/dist/swarm/index.d.ts.map +1 -0
- package/dist/swarm/index.js +59 -0
- package/dist/swarm/index.js.map +1 -0
- package/dist/swarm/registry/event-emitter.d.ts +116 -0
- package/dist/swarm/registry/event-emitter.d.ts.map +1 -0
- package/dist/swarm/registry/event-emitter.js +188 -0
- package/dist/swarm/registry/event-emitter.js.map +1 -0
- package/dist/swarm/registry/index.d.ts +9 -0
- package/dist/swarm/registry/index.d.ts.map +1 -0
- package/dist/swarm/registry/index.js +9 -0
- package/dist/swarm/registry/index.js.map +1 -0
- package/dist/swarm/registry/insight-computer.d.ts +114 -0
- package/dist/swarm/registry/insight-computer.d.ts.map +1 -0
- package/dist/swarm/registry/insight-computer.js +387 -0
- package/dist/swarm/registry/insight-computer.js.map +1 -0
- package/dist/swarm/registry/symbol-mapper.d.ts +115 -0
- package/dist/swarm/registry/symbol-mapper.d.ts.map +1 -0
- package/dist/swarm/registry/symbol-mapper.js +229 -0
- package/dist/swarm/registry/symbol-mapper.js.map +1 -0
- package/dist/swarm/resources/index.d.ts +7 -0
- package/dist/swarm/resources/index.d.ts.map +1 -0
- package/dist/swarm/resources/index.js +7 -0
- package/dist/swarm/resources/index.js.map +1 -0
- package/dist/swarm/resources/intelligence-resources.d.ts +64 -0
- package/dist/swarm/resources/intelligence-resources.d.ts.map +1 -0
- package/dist/swarm/resources/intelligence-resources.js +309 -0
- package/dist/swarm/resources/intelligence-resources.js.map +1 -0
- package/dist/swarm/strategies/early-aggressive.d.ts +59 -0
- package/dist/swarm/strategies/early-aggressive.d.ts.map +1 -0
- package/dist/swarm/strategies/early-aggressive.js +283 -0
- package/dist/swarm/strategies/early-aggressive.js.map +1 -0
- package/dist/swarm/strategies/hybrid.d.ts +58 -0
- package/dist/swarm/strategies/hybrid.d.ts.map +1 -0
- package/dist/swarm/strategies/hybrid.js +336 -0
- package/dist/swarm/strategies/hybrid.js.map +1 -0
- package/dist/swarm/strategies/index.d.ts +35 -0
- package/dist/swarm/strategies/index.d.ts.map +1 -0
- package/dist/swarm/strategies/index.js +94 -0
- package/dist/swarm/strategies/index.js.map +1 -0
- package/dist/swarm/strategies/negotiator.d.ts +66 -0
- package/dist/swarm/strategies/negotiator.d.ts.map +1 -0
- package/dist/swarm/strategies/negotiator.js +326 -0
- package/dist/swarm/strategies/negotiator.js.map +1 -0
- package/dist/swarm/strategies/passive.d.ts +56 -0
- package/dist/swarm/strategies/passive.d.ts.map +1 -0
- package/dist/swarm/strategies/passive.js +247 -0
- package/dist/swarm/strategies/passive.js.map +1 -0
- package/dist/swarm/strategies/sniper.d.ts +43 -0
- package/dist/swarm/strategies/sniper.d.ts.map +1 -0
- package/dist/swarm/strategies/sniper.js +176 -0
- package/dist/swarm/strategies/sniper.js.map +1 -0
- package/dist/swarm/strategies/types.d.ts +256 -0
- package/dist/swarm/strategies/types.d.ts.map +1 -0
- package/dist/swarm/strategies/types.js +251 -0
- package/dist/swarm/strategies/types.js.map +1 -0
- package/dist/swarm/swarm-controller.d.ts +197 -0
- package/dist/swarm/swarm-controller.d.ts.map +1 -0
- package/dist/swarm/swarm-controller.js +812 -0
- package/dist/swarm/swarm-controller.js.map +1 -0
- package/dist/swarm/tools/index.d.ts +7 -0
- package/dist/swarm/tools/index.d.ts.map +1 -0
- package/dist/swarm/tools/index.js +7 -0
- package/dist/swarm/tools/index.js.map +1 -0
- package/dist/swarm/tools/intelligence-tools.d.ts +36 -0
- package/dist/swarm/tools/intelligence-tools.d.ts.map +1 -0
- package/dist/swarm/tools/intelligence-tools.js +508 -0
- package/dist/swarm/tools/intelligence-tools.js.map +1 -0
- package/dist/swarm/tools.d.ts +451 -0
- package/dist/swarm/tools.d.ts.map +1 -0
- package/dist/swarm/tools.js +465 -0
- package/dist/swarm/tools.js.map +1 -0
- package/dist/swarm/types.d.ts +744 -0
- package/dist/swarm/types.d.ts.map +1 -0
- package/dist/swarm/types.js +109 -0
- package/dist/swarm/types.js.map +1 -0
- package/dist/swarm/vectors/index.d.ts +8 -0
- package/dist/swarm/vectors/index.d.ts.map +1 -0
- package/dist/swarm/vectors/index.js +15 -0
- package/dist/swarm/vectors/index.js.map +1 -0
- package/dist/swarm/vectors/pinecone-client.d.ts +234 -0
- package/dist/swarm/vectors/pinecone-client.d.ts.map +1 -0
- package/dist/swarm/vectors/pinecone-client.js +290 -0
- package/dist/swarm/vectors/pinecone-client.js.map +1 -0
- package/dist/swarm/vectors/swarm-vectors.d.ts +119 -0
- package/dist/swarm/vectors/swarm-vectors.d.ts.map +1 -0
- package/dist/swarm/vectors/swarm-vectors.js +217 -0
- package/dist/swarm/vectors/swarm-vectors.js.map +1 -0
- package/dist/symbols/audit.d.ts +100 -0
- package/dist/symbols/audit.d.ts.map +1 -0
- package/dist/symbols/audit.js +391 -0
- package/dist/symbols/audit.js.map +1 -0
- package/dist/symbols/claim-validator.d.ts +113 -0
- package/dist/symbols/claim-validator.d.ts.map +1 -0
- package/dist/symbols/claim-validator.js +386 -0
- package/dist/symbols/claim-validator.js.map +1 -0
- package/dist/symbols/database.d.ts +285 -0
- package/dist/symbols/database.d.ts.map +1 -0
- package/dist/symbols/database.js +932 -0
- package/dist/symbols/database.js.map +1 -0
- package/dist/symbols/epistemic-types.d.ts +71 -0
- package/dist/symbols/epistemic-types.d.ts.map +1 -0
- package/dist/symbols/epistemic-types.js +101 -0
- package/dist/symbols/epistemic-types.js.map +1 -0
- package/dist/symbols/graph-manager.d.ts +117 -0
- package/dist/symbols/graph-manager.d.ts.map +1 -0
- package/dist/symbols/graph-manager.js +616 -0
- package/dist/symbols/graph-manager.js.map +1 -0
- package/dist/symbols/graph-tools.d.ts +15 -0
- package/dist/symbols/graph-tools.d.ts.map +1 -0
- package/dist/symbols/graph-tools.js +467 -0
- package/dist/symbols/graph-tools.js.map +1 -0
- package/dist/symbols/graph-types.d.ts +291 -0
- package/dist/symbols/graph-types.d.ts.map +1 -0
- package/dist/symbols/graph-types.js +93 -0
- package/dist/symbols/graph-types.js.map +1 -0
- package/dist/symbols/index.d.ts +18 -0
- package/dist/symbols/index.d.ts.map +1 -0
- package/dist/symbols/index.js +26 -0
- package/dist/symbols/index.js.map +1 -0
- package/dist/symbols/manager.d.ts +114 -0
- package/dist/symbols/manager.d.ts.map +1 -0
- package/dist/symbols/manager.js +1000 -0
- package/dist/symbols/manager.js.map +1 -0
- package/dist/symbols/sanitizer.d.ts +142 -0
- package/dist/symbols/sanitizer.d.ts.map +1 -0
- package/dist/symbols/sanitizer.js +582 -0
- package/dist/symbols/sanitizer.js.map +1 -0
- package/dist/symbols/simple-retrieval.d.ts +65 -0
- package/dist/symbols/simple-retrieval.d.ts.map +1 -0
- package/dist/symbols/simple-retrieval.js +110 -0
- package/dist/symbols/simple-retrieval.js.map +1 -0
- package/dist/symbols/test-epistemic-vendor59655.d.ts +28 -0
- package/dist/symbols/test-epistemic-vendor59655.d.ts.map +1 -0
- package/dist/symbols/test-epistemic-vendor59655.js +129 -0
- package/dist/symbols/test-epistemic-vendor59655.js.map +1 -0
- package/dist/symbols/tools.d.ts +19 -0
- package/dist/symbols/tools.d.ts.map +1 -0
- package/dist/symbols/tools.js +697 -0
- package/dist/symbols/tools.js.map +1 -0
- package/dist/symbols/types.d.ts +626 -0
- package/dist/symbols/types.d.ts.map +1 -0
- package/dist/symbols/types.js +100 -0
- package/dist/symbols/types.js.map +1 -0
- package/dist/symbols/validation-pipeline.d.ts +116 -0
- package/dist/symbols/validation-pipeline.d.ts.map +1 -0
- package/dist/symbols/validation-pipeline.js +119 -0
- package/dist/symbols/validation-pipeline.js.map +1 -0
- package/dist/tools/index.d.ts +15 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +24 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/ps_calendar.d.ts +68 -0
- package/dist/tools/ps_calendar.d.ts.map +1 -0
- package/dist/tools/ps_calendar.js +377 -0
- package/dist/tools/ps_calendar.js.map +1 -0
- package/dist/tools/ps_delegate.d.ts +83 -0
- package/dist/tools/ps_delegate.d.ts.map +1 -0
- package/dist/tools/ps_delegate.js +307 -0
- package/dist/tools/ps_delegate.js.map +1 -0
- package/dist/tools/ps_execute.d.ts +84 -0
- package/dist/tools/ps_execute.d.ts.map +1 -0
- package/dist/tools/ps_execute.js +211 -0
- package/dist/tools/ps_execute.js.map +1 -0
- package/dist/tools/ps_hold.d.ts +50 -0
- package/dist/tools/ps_hold.d.ts.map +1 -0
- package/dist/tools/ps_hold.js +227 -0
- package/dist/tools/ps_hold.js.map +1 -0
- package/dist/tools/ps_legal.d.ts +111 -0
- package/dist/tools/ps_legal.d.ts.map +1 -0
- package/dist/tools/ps_legal.js +456 -0
- package/dist/tools/ps_legal.js.map +1 -0
- package/dist/tools/ps_state.d.ts +146 -0
- package/dist/tools/ps_state.d.ts.map +1 -0
- package/dist/tools/ps_state.js +286 -0
- package/dist/tools/ps_state.js.map +1 -0
- package/dist/tools/ps_validate.d.ts +51 -0
- package/dist/tools/ps_validate.d.ts.map +1 -0
- package/dist/tools/ps_validate.js +191 -0
- package/dist/tools/ps_validate.js.map +1 -0
- package/dist/tools/registry.d.ts +52 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +456 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/translation/compiler.d.ts +37 -0
- package/dist/translation/compiler.d.ts.map +1 -0
- package/dist/translation/compiler.js +281 -0
- package/dist/translation/compiler.js.map +1 -0
- package/dist/translation/decompiler.d.ts +29 -0
- package/dist/translation/decompiler.d.ts.map +1 -0
- package/dist/translation/decompiler.js +454 -0
- package/dist/translation/decompiler.js.map +1 -0
- package/dist/translation/frame-translator.d.ts +75 -0
- package/dist/translation/frame-translator.d.ts.map +1 -0
- package/dist/translation/frame-translator.js +347 -0
- package/dist/translation/frame-translator.js.map +1 -0
- package/dist/translation/index.d.ts +349 -0
- package/dist/translation/index.d.ts.map +1 -0
- package/dist/translation/index.js +397 -0
- package/dist/translation/index.js.map +1 -0
- package/dist/translation/llm-extractor.d.ts +56 -0
- package/dist/translation/llm-extractor.d.ts.map +1 -0
- package/dist/translation/llm-extractor.js +345 -0
- package/dist/translation/llm-extractor.js.map +1 -0
- package/dist/translation/mappings.d.ts +91 -0
- package/dist/translation/mappings.d.ts.map +1 -0
- package/dist/translation/mappings.js +558 -0
- package/dist/translation/mappings.js.map +1 -0
- package/dist/translation/opacity-layer.d.ts +93 -0
- package/dist/translation/opacity-layer.d.ts.map +1 -0
- package/dist/translation/opacity-layer.js +404 -0
- package/dist/translation/opacity-layer.js.map +1 -0
- package/dist/translation/types.d.ts +307 -0
- package/dist/translation/types.d.ts.map +1 -0
- package/dist/translation/types.js +8 -0
- package/dist/translation/types.js.map +1 -0
- package/dist/types/index.d.ts +700 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/embeddings.d.ts +20 -0
- package/dist/utils/embeddings.d.ts.map +1 -0
- package/dist/utils/embeddings.js +110 -0
- package/dist/utils/embeddings.js.map +1 -0
- package/dist/utils/hash.d.ts +34 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/utils/hash.js +72 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/verification/cross-llm.d.ts +116 -0
- package/dist/verification/cross-llm.d.ts.map +1 -0
- package/dist/verification/cross-llm.js +438 -0
- package/dist/verification/cross-llm.js.map +1 -0
- package/dist/verification/dashboard.d.ts +127 -0
- package/dist/verification/dashboard.d.ts.map +1 -0
- package/dist/verification/dashboard.js +630 -0
- package/dist/verification/dashboard.js.map +1 -0
- package/dist/verification/index.d.ts +11 -0
- package/dist/verification/index.d.ts.map +1 -0
- package/dist/verification/index.js +11 -0
- package/dist/verification/index.js.map +1 -0
- package/dist/verification/tools.d.ts +105 -0
- package/dist/verification/tools.d.ts.map +1 -0
- package/dist/verification/tools.js +162 -0
- package/dist/verification/tools.js.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,932 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
3
|
+
* PROMPTSPEAK SQLITE DATABASE
|
|
4
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
5
|
+
*
|
|
6
|
+
* SQLite backend for PromptSpeak symbol storage.
|
|
7
|
+
* Provides ACID transactions, concurrent safety, and efficient queries.
|
|
8
|
+
*
|
|
9
|
+
* Benefits over JSON files:
|
|
10
|
+
* - Atomic commits (no partial writes)
|
|
11
|
+
* - WAL mode for concurrent read/write
|
|
12
|
+
* - Indexed queries (O(log n) vs O(n))
|
|
13
|
+
* - Built-in integrity constraints
|
|
14
|
+
* - Transaction support for multi-operation safety
|
|
15
|
+
*
|
|
16
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
17
|
+
*/
|
|
18
|
+
import Database from 'better-sqlite3';
|
|
19
|
+
import * as fs from 'fs';
|
|
20
|
+
import * as path from 'path';
|
|
21
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
22
|
+
// SCHEMA
|
|
23
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
24
|
+
const SCHEMA_SQL = `
|
|
25
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
26
|
+
-- SYMBOLS TABLE
|
|
27
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
28
|
+
CREATE TABLE IF NOT EXISTS symbols (
|
|
29
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
30
|
+
symbol_id TEXT UNIQUE NOT NULL,
|
|
31
|
+
category TEXT NOT NULL CHECK (category IN ('COMPANY','PERSON','EVENT','SECTOR','TASK','KNOWLEDGE','QUERY')),
|
|
32
|
+
subcategory TEXT,
|
|
33
|
+
version INTEGER NOT NULL DEFAULT 1,
|
|
34
|
+
content_hash TEXT NOT NULL,
|
|
35
|
+
commanders_intent TEXT NOT NULL,
|
|
36
|
+
data TEXT NOT NULL, -- Full symbol as JSON blob
|
|
37
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
38
|
+
updated_at TEXT,
|
|
39
|
+
created_by TEXT,
|
|
40
|
+
tags TEXT, -- JSON array
|
|
41
|
+
parent_symbol TEXT,
|
|
42
|
+
|
|
43
|
+
-- Constraints
|
|
44
|
+
CONSTRAINT valid_symbol_id CHECK (symbol_id LIKE 'Ξ.%'),
|
|
45
|
+
CONSTRAINT valid_hash CHECK (length(content_hash) = 16),
|
|
46
|
+
CONSTRAINT positive_version CHECK (version > 0)
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
50
|
+
-- AUDIT LOG TABLE
|
|
51
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
52
|
+
CREATE TABLE IF NOT EXISTS audit_log (
|
|
53
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
54
|
+
timestamp TEXT NOT NULL DEFAULT (datetime('now')),
|
|
55
|
+
event_type TEXT NOT NULL,
|
|
56
|
+
symbol_id TEXT,
|
|
57
|
+
risk_score INTEGER CHECK (risk_score IS NULL OR (risk_score >= 0 AND risk_score <= 100)),
|
|
58
|
+
details TEXT, -- JSON
|
|
59
|
+
violations TEXT, -- JSON
|
|
60
|
+
|
|
61
|
+
CONSTRAINT valid_event CHECK (event_type IN (
|
|
62
|
+
'SYMBOL_CREATE', 'SYMBOL_CREATE_BLOCKED',
|
|
63
|
+
'SYMBOL_UPDATE', 'SYMBOL_UPDATE_BLOCKED',
|
|
64
|
+
'SYMBOL_DELETE', 'SYMBOL_ACCESS', 'SYMBOL_FORMAT',
|
|
65
|
+
'VALIDATION_WARNING', 'INJECTION_ATTEMPT', 'SECURITY_ALERT',
|
|
66
|
+
'EPISTEMIC_FLAG', 'SYMBOL_VERIFIED', 'SYMBOL_DISPUTED'
|
|
67
|
+
))
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
71
|
+
-- INDEXES FOR PERFORMANCE
|
|
72
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
73
|
+
|
|
74
|
+
-- Symbol lookups
|
|
75
|
+
CREATE INDEX IF NOT EXISTS idx_symbols_category ON symbols(category);
|
|
76
|
+
CREATE INDEX IF NOT EXISTS idx_symbols_created_at ON symbols(created_at DESC);
|
|
77
|
+
CREATE INDEX IF NOT EXISTS idx_symbols_hash ON symbols(content_hash);
|
|
78
|
+
CREATE INDEX IF NOT EXISTS idx_symbols_parent ON symbols(parent_symbol);
|
|
79
|
+
|
|
80
|
+
-- Audit lookups
|
|
81
|
+
CREATE INDEX IF NOT EXISTS idx_audit_event ON audit_log(event_type);
|
|
82
|
+
CREATE INDEX IF NOT EXISTS idx_audit_symbol ON audit_log(symbol_id);
|
|
83
|
+
CREATE INDEX IF NOT EXISTS idx_audit_timestamp ON audit_log(timestamp DESC);
|
|
84
|
+
CREATE INDEX IF NOT EXISTS idx_audit_risk ON audit_log(risk_score) WHERE risk_score >= 60;
|
|
85
|
+
|
|
86
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
87
|
+
-- FULL-TEXT SEARCH (for symbol content)
|
|
88
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
89
|
+
|
|
90
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS symbols_fts USING fts5(
|
|
91
|
+
symbol_id,
|
|
92
|
+
commanders_intent,
|
|
93
|
+
content=symbols,
|
|
94
|
+
content_rowid=id
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
-- Triggers to keep FTS in sync
|
|
98
|
+
CREATE TRIGGER IF NOT EXISTS symbols_ai AFTER INSERT ON symbols BEGIN
|
|
99
|
+
INSERT INTO symbols_fts(rowid, symbol_id, commanders_intent)
|
|
100
|
+
VALUES (new.id, new.symbol_id, new.commanders_intent);
|
|
101
|
+
END;
|
|
102
|
+
|
|
103
|
+
CREATE TRIGGER IF NOT EXISTS symbols_ad AFTER DELETE ON symbols BEGIN
|
|
104
|
+
INSERT INTO symbols_fts(symbols_fts, rowid, symbol_id, commanders_intent)
|
|
105
|
+
VALUES ('delete', old.id, old.symbol_id, old.commanders_intent);
|
|
106
|
+
END;
|
|
107
|
+
|
|
108
|
+
CREATE TRIGGER IF NOT EXISTS symbols_au AFTER UPDATE ON symbols BEGIN
|
|
109
|
+
INSERT INTO symbols_fts(symbols_fts, rowid, symbol_id, commanders_intent)
|
|
110
|
+
VALUES ('delete', old.id, old.symbol_id, old.commanders_intent);
|
|
111
|
+
INSERT INTO symbols_fts(rowid, symbol_id, commanders_intent)
|
|
112
|
+
VALUES (new.id, new.symbol_id, new.commanders_intent);
|
|
113
|
+
END;
|
|
114
|
+
|
|
115
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
116
|
+
-- SYMBOL RELATIONSHIPS TABLE (Graph Edges)
|
|
117
|
+
-- Based on GraphRAG research and Neo4j patterns
|
|
118
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
119
|
+
|
|
120
|
+
CREATE TABLE IF NOT EXISTS symbol_relationships (
|
|
121
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
122
|
+
from_symbol_id TEXT NOT NULL,
|
|
123
|
+
to_symbol_id TEXT NOT NULL,
|
|
124
|
+
relationship_type TEXT NOT NULL,
|
|
125
|
+
category TEXT NOT NULL,
|
|
126
|
+
weight REAL NOT NULL DEFAULT 1.0 CHECK (weight >= 0.0 AND weight <= 1.0),
|
|
127
|
+
confidence REAL NOT NULL DEFAULT 1.0 CHECK (confidence >= 0.0 AND confidence <= 1.0),
|
|
128
|
+
properties TEXT, -- JSON for additional attributes
|
|
129
|
+
evidence TEXT, -- Source/evidence for this relationship
|
|
130
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
131
|
+
created_by TEXT,
|
|
132
|
+
|
|
133
|
+
-- Foreign keys with cascade delete
|
|
134
|
+
FOREIGN KEY (from_symbol_id) REFERENCES symbols(symbol_id) ON DELETE CASCADE,
|
|
135
|
+
FOREIGN KEY (to_symbol_id) REFERENCES symbols(symbol_id) ON DELETE CASCADE,
|
|
136
|
+
|
|
137
|
+
-- Constraints
|
|
138
|
+
CONSTRAINT no_self_reference CHECK (from_symbol_id != to_symbol_id),
|
|
139
|
+
CONSTRAINT unique_typed_relationship UNIQUE (from_symbol_id, to_symbol_id, relationship_type),
|
|
140
|
+
CONSTRAINT valid_relationship_type CHECK (relationship_type IN (
|
|
141
|
+
'CAUSES', 'TRIGGERS', 'LEADS_TO', 'RESULTS_IN', 'ENABLES', 'PREVENTS',
|
|
142
|
+
'PRECEDES', 'FOLLOWS', 'CONCURRENT_WITH', 'SUPERSEDES', 'SUPERSEDED_BY',
|
|
143
|
+
'PARENT_OF', 'CHILD_OF', 'CONTAINS', 'PART_OF', 'ELABORATES', 'SUMMARIZES',
|
|
144
|
+
'RELATED_TO', 'REFERENCES', 'SIMILAR_TO', 'CONTRASTS_WITH', 'COMPLEMENTS',
|
|
145
|
+
'COMPETES_WITH', 'OUTPERFORMS', 'UNDERPERFORMS', 'DISRUPTS', 'CHALLENGES',
|
|
146
|
+
'DEPENDS_ON', 'REQUIRES', 'SUPPORTS', 'BLOCKS', 'EXPOSED_TO',
|
|
147
|
+
'OWNS', 'CONTROLS', 'SUBSIDIARY_OF', 'ACQUIRED_BY', 'MERGED_WITH', 'PARTNERS_WITH',
|
|
148
|
+
'REGULATED_BY', 'COMPLIANT_WITH', 'SUBJECT_TO', 'FILED_WITH', 'AUDITED_BY'
|
|
149
|
+
)),
|
|
150
|
+
CONSTRAINT valid_category CHECK (category IN (
|
|
151
|
+
'CAUSAL', 'TEMPORAL', 'HIERARCHICAL', 'ASSOCIATIVE',
|
|
152
|
+
'COMPETITIVE', 'DEPENDENCY', 'OWNERSHIP', 'REGULATORY'
|
|
153
|
+
))
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
157
|
+
-- RELATIONSHIP INDEXES (Critical for graph traversal performance)
|
|
158
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
159
|
+
|
|
160
|
+
-- Primary traversal indexes
|
|
161
|
+
CREATE INDEX IF NOT EXISTS idx_rel_from_symbol ON symbol_relationships(from_symbol_id);
|
|
162
|
+
CREATE INDEX IF NOT EXISTS idx_rel_to_symbol ON symbol_relationships(to_symbol_id);
|
|
163
|
+
|
|
164
|
+
-- Type and category filtering
|
|
165
|
+
CREATE INDEX IF NOT EXISTS idx_rel_type ON symbol_relationships(relationship_type);
|
|
166
|
+
CREATE INDEX IF NOT EXISTS idx_rel_category ON symbol_relationships(category);
|
|
167
|
+
|
|
168
|
+
-- Composite indexes for common query patterns
|
|
169
|
+
CREATE INDEX IF NOT EXISTS idx_rel_from_type ON symbol_relationships(from_symbol_id, relationship_type);
|
|
170
|
+
CREATE INDEX IF NOT EXISTS idx_rel_to_type ON symbol_relationships(to_symbol_id, relationship_type);
|
|
171
|
+
|
|
172
|
+
-- Covering index for traversal (includes all columns needed for path queries)
|
|
173
|
+
CREATE INDEX IF NOT EXISTS idx_rel_traversal
|
|
174
|
+
ON symbol_relationships(from_symbol_id, to_symbol_id, relationship_type, weight, confidence);
|
|
175
|
+
|
|
176
|
+
-- Weight-filtered traversal (for high-confidence paths)
|
|
177
|
+
CREATE INDEX IF NOT EXISTS idx_rel_high_weight
|
|
178
|
+
ON symbol_relationships(from_symbol_id, to_symbol_id)
|
|
179
|
+
WHERE weight >= 0.5;
|
|
180
|
+
|
|
181
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
182
|
+
-- OPAQUE MAPPINGS TABLE (For Opacity Layer)
|
|
183
|
+
-- Stores encrypted content tokens for security/privacy
|
|
184
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
185
|
+
|
|
186
|
+
CREATE TABLE IF NOT EXISTS opaque_mappings (
|
|
187
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
188
|
+
token TEXT UNIQUE NOT NULL, -- "::10001"
|
|
189
|
+
plaintext TEXT NOT NULL, -- The actual value (encrypted at rest)
|
|
190
|
+
symbol_id TEXT, -- Which symbol this belongs to (optional)
|
|
191
|
+
field_name TEXT, -- "who", "requirements[0]", etc.
|
|
192
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
193
|
+
expires_at TEXT, -- Optional TTL for temporary tokens
|
|
194
|
+
access_count INTEGER NOT NULL DEFAULT 0, -- Track resolution frequency
|
|
195
|
+
last_accessed TEXT, -- Last time this token was resolved
|
|
196
|
+
|
|
197
|
+
-- Constraints
|
|
198
|
+
CONSTRAINT valid_token CHECK (token LIKE '::%'),
|
|
199
|
+
CONSTRAINT valid_plaintext CHECK (length(plaintext) > 0),
|
|
200
|
+
|
|
201
|
+
-- Foreign key (optional - token can exist without symbol)
|
|
202
|
+
FOREIGN KEY (symbol_id) REFERENCES symbols(symbol_id) ON DELETE SET NULL
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
206
|
+
-- OPAQUE MAPPINGS INDEXES
|
|
207
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
208
|
+
|
|
209
|
+
-- Primary lookup by token
|
|
210
|
+
CREATE INDEX IF NOT EXISTS idx_opaque_token ON opaque_mappings(token);
|
|
211
|
+
|
|
212
|
+
-- Lookup by symbol (for cleanup when symbol deleted)
|
|
213
|
+
CREATE INDEX IF NOT EXISTS idx_opaque_symbol ON opaque_mappings(symbol_id);
|
|
214
|
+
|
|
215
|
+
-- Expired token cleanup
|
|
216
|
+
CREATE INDEX IF NOT EXISTS idx_opaque_expires ON opaque_mappings(expires_at)
|
|
217
|
+
WHERE expires_at IS NOT NULL;
|
|
218
|
+
|
|
219
|
+
-- Frequently accessed tokens (for caching optimization)
|
|
220
|
+
CREATE INDEX IF NOT EXISTS idx_opaque_access ON opaque_mappings(access_count DESC);
|
|
221
|
+
|
|
222
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
223
|
+
-- VERIFICATION EVENTS TABLE (v2.1 - Epistemic Tracking)
|
|
224
|
+
-- Tracks the verification history of symbol claims
|
|
225
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
226
|
+
|
|
227
|
+
CREATE TABLE IF NOT EXISTS verification_events (
|
|
228
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
229
|
+
symbol_id TEXT NOT NULL,
|
|
230
|
+
timestamp TEXT NOT NULL DEFAULT (datetime('now')),
|
|
231
|
+
event_type TEXT NOT NULL, -- 'CREATED', 'AUTO_FLAGGED', 'HUMAN_REVIEWED', 'VERIFIED', 'DISPUTED', etc.
|
|
232
|
+
old_status TEXT, -- Previous epistemic status
|
|
233
|
+
new_status TEXT, -- New epistemic status
|
|
234
|
+
old_confidence REAL, -- Previous confidence level
|
|
235
|
+
new_confidence REAL, -- New confidence level
|
|
236
|
+
reviewer TEXT, -- Human or system identifier
|
|
237
|
+
evidence_added TEXT, -- JSON array of new evidence
|
|
238
|
+
notes TEXT, -- Review notes
|
|
239
|
+
|
|
240
|
+
-- Foreign key
|
|
241
|
+
FOREIGN KEY (symbol_id) REFERENCES symbols(symbol_id) ON DELETE CASCADE,
|
|
242
|
+
|
|
243
|
+
-- Constraints
|
|
244
|
+
CONSTRAINT valid_verification_event CHECK (event_type IN (
|
|
245
|
+
'CREATED', 'AUTO_FLAGGED', 'HUMAN_REVIEWED', 'VERIFIED',
|
|
246
|
+
'DISPUTED', 'CORROBORATED', 'EVIDENCE_ADDED', 'ALTERNATIVE_ADDED',
|
|
247
|
+
'CONFIDENCE_UPDATED'
|
|
248
|
+
)),
|
|
249
|
+
CONSTRAINT valid_confidence CHECK (
|
|
250
|
+
(old_confidence IS NULL OR (old_confidence >= 0.0 AND old_confidence <= 1.0)) AND
|
|
251
|
+
(new_confidence IS NULL OR (new_confidence >= 0.0 AND new_confidence <= 1.0))
|
|
252
|
+
)
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
256
|
+
-- VERIFICATION EVENTS INDEXES
|
|
257
|
+
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
258
|
+
|
|
259
|
+
-- Lookup verification history by symbol
|
|
260
|
+
CREATE INDEX IF NOT EXISTS idx_verification_symbol ON verification_events(symbol_id);
|
|
261
|
+
|
|
262
|
+
-- Timeline queries
|
|
263
|
+
CREATE INDEX IF NOT EXISTS idx_verification_timestamp ON verification_events(timestamp DESC);
|
|
264
|
+
|
|
265
|
+
-- Find events by type (e.g., all DISPUTED claims)
|
|
266
|
+
CREATE INDEX IF NOT EXISTS idx_verification_type ON verification_events(event_type);
|
|
267
|
+
|
|
268
|
+
-- Find verifications by reviewer
|
|
269
|
+
CREATE INDEX IF NOT EXISTS idx_verification_reviewer ON verification_events(reviewer);
|
|
270
|
+
`;
|
|
271
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
272
|
+
// DATABASE CLASS
|
|
273
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
274
|
+
export class SymbolDatabase {
|
|
275
|
+
db;
|
|
276
|
+
dbPath;
|
|
277
|
+
// Prepared statements (cached for performance)
|
|
278
|
+
stmtInsertSymbol;
|
|
279
|
+
stmtGetSymbol;
|
|
280
|
+
stmtUpdateSymbol;
|
|
281
|
+
stmtDeleteSymbol;
|
|
282
|
+
stmtListSymbols;
|
|
283
|
+
stmtCountByCategory;
|
|
284
|
+
stmtInsertAudit;
|
|
285
|
+
stmtSearchSymbols;
|
|
286
|
+
// Opacity layer statements
|
|
287
|
+
stmtInsertOpaque;
|
|
288
|
+
stmtGetOpaque;
|
|
289
|
+
stmtGetOpaqueMultiple;
|
|
290
|
+
stmtUpdateOpaqueAccess;
|
|
291
|
+
stmtDeleteExpiredOpaque;
|
|
292
|
+
stmtGetMaxOpaqueId;
|
|
293
|
+
constructor(dbPath) {
|
|
294
|
+
this.dbPath = dbPath;
|
|
295
|
+
// Ensure directory exists
|
|
296
|
+
const dir = path.dirname(dbPath);
|
|
297
|
+
if (!fs.existsSync(dir)) {
|
|
298
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
299
|
+
}
|
|
300
|
+
// Open database with WAL mode for better concurrency
|
|
301
|
+
this.db = new Database(dbPath);
|
|
302
|
+
// Enable WAL mode and other optimizations
|
|
303
|
+
this.db.pragma('journal_mode = WAL');
|
|
304
|
+
this.db.pragma('synchronous = NORMAL');
|
|
305
|
+
this.db.pragma('cache_size = -64000'); // 64MB cache
|
|
306
|
+
this.db.pragma('temp_store = MEMORY');
|
|
307
|
+
this.db.pragma('mmap_size = 268435456'); // 256MB memory-mapped I/O
|
|
308
|
+
// Initialize schema
|
|
309
|
+
this.db.exec(SCHEMA_SQL);
|
|
310
|
+
// Prepare statements
|
|
311
|
+
this.prepareStatements();
|
|
312
|
+
}
|
|
313
|
+
prepareStatements() {
|
|
314
|
+
// Insert symbol
|
|
315
|
+
this.stmtInsertSymbol = this.db.prepare(`
|
|
316
|
+
INSERT INTO symbols (
|
|
317
|
+
symbol_id, category, subcategory, version, content_hash,
|
|
318
|
+
commanders_intent, data, created_at, created_by, tags, parent_symbol
|
|
319
|
+
) VALUES (
|
|
320
|
+
@symbol_id, @category, @subcategory, @version, @content_hash,
|
|
321
|
+
@commanders_intent, @data, @created_at, @created_by, @tags, @parent_symbol
|
|
322
|
+
)
|
|
323
|
+
`);
|
|
324
|
+
// Get symbol by ID
|
|
325
|
+
this.stmtGetSymbol = this.db.prepare(`
|
|
326
|
+
SELECT * FROM symbols WHERE symbol_id = ?
|
|
327
|
+
`);
|
|
328
|
+
// Update symbol
|
|
329
|
+
this.stmtUpdateSymbol = this.db.prepare(`
|
|
330
|
+
UPDATE symbols SET
|
|
331
|
+
version = @version,
|
|
332
|
+
content_hash = @content_hash,
|
|
333
|
+
commanders_intent = @commanders_intent,
|
|
334
|
+
data = @data,
|
|
335
|
+
updated_at = @updated_at,
|
|
336
|
+
tags = @tags
|
|
337
|
+
WHERE symbol_id = @symbol_id
|
|
338
|
+
`);
|
|
339
|
+
// Delete symbol
|
|
340
|
+
this.stmtDeleteSymbol = this.db.prepare(`
|
|
341
|
+
DELETE FROM symbols WHERE symbol_id = ?
|
|
342
|
+
`);
|
|
343
|
+
// List symbols (base query - filtering done in method)
|
|
344
|
+
this.stmtListSymbols = this.db.prepare(`
|
|
345
|
+
SELECT symbol_id, category, version, content_hash, commanders_intent,
|
|
346
|
+
created_at, updated_at
|
|
347
|
+
FROM symbols
|
|
348
|
+
ORDER BY created_at DESC
|
|
349
|
+
LIMIT ? OFFSET ?
|
|
350
|
+
`);
|
|
351
|
+
// Count by category
|
|
352
|
+
this.stmtCountByCategory = this.db.prepare(`
|
|
353
|
+
SELECT category, COUNT(*) as count FROM symbols GROUP BY category
|
|
354
|
+
`);
|
|
355
|
+
// Insert audit entry
|
|
356
|
+
this.stmtInsertAudit = this.db.prepare(`
|
|
357
|
+
INSERT INTO audit_log (timestamp, event_type, symbol_id, risk_score, details, violations)
|
|
358
|
+
VALUES (@timestamp, @event_type, @symbol_id, @risk_score, @details, @violations)
|
|
359
|
+
`);
|
|
360
|
+
// Full-text search
|
|
361
|
+
this.stmtSearchSymbols = this.db.prepare(`
|
|
362
|
+
SELECT s.symbol_id, s.category, s.version, s.content_hash,
|
|
363
|
+
s.commanders_intent, s.created_at, s.updated_at
|
|
364
|
+
FROM symbols s
|
|
365
|
+
JOIN symbols_fts fts ON s.id = fts.rowid
|
|
366
|
+
WHERE symbols_fts MATCH ?
|
|
367
|
+
ORDER BY rank
|
|
368
|
+
LIMIT ? OFFSET ?
|
|
369
|
+
`);
|
|
370
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
371
|
+
// OPACITY LAYER STATEMENTS
|
|
372
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
373
|
+
// Insert opaque token
|
|
374
|
+
this.stmtInsertOpaque = this.db.prepare(`
|
|
375
|
+
INSERT INTO opaque_mappings (token, plaintext, symbol_id, field_name, created_at, expires_at)
|
|
376
|
+
VALUES (@token, @plaintext, @symbol_id, @field_name, @created_at, @expires_at)
|
|
377
|
+
`);
|
|
378
|
+
// Get single opaque token
|
|
379
|
+
this.stmtGetOpaque = this.db.prepare(`
|
|
380
|
+
SELECT * FROM opaque_mappings WHERE token = ?
|
|
381
|
+
`);
|
|
382
|
+
// Update access count and timestamp
|
|
383
|
+
this.stmtUpdateOpaqueAccess = this.db.prepare(`
|
|
384
|
+
UPDATE opaque_mappings
|
|
385
|
+
SET access_count = access_count + 1, last_accessed = datetime('now')
|
|
386
|
+
WHERE token = ?
|
|
387
|
+
`);
|
|
388
|
+
// Delete expired tokens
|
|
389
|
+
this.stmtDeleteExpiredOpaque = this.db.prepare(`
|
|
390
|
+
DELETE FROM opaque_mappings
|
|
391
|
+
WHERE expires_at IS NOT NULL AND expires_at < datetime('now')
|
|
392
|
+
`);
|
|
393
|
+
// Get max token ID for counter initialization
|
|
394
|
+
this.stmtGetMaxOpaqueId = this.db.prepare(`
|
|
395
|
+
SELECT MAX(CAST(SUBSTR(token, 3) AS INTEGER)) as max_id FROM opaque_mappings
|
|
396
|
+
`);
|
|
397
|
+
}
|
|
398
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
399
|
+
// SYMBOL OPERATIONS
|
|
400
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
401
|
+
/**
|
|
402
|
+
* Insert a new symbol
|
|
403
|
+
*/
|
|
404
|
+
insertSymbol(symbol) {
|
|
405
|
+
try {
|
|
406
|
+
this.stmtInsertSymbol.run({
|
|
407
|
+
symbol_id: symbol.symbolId,
|
|
408
|
+
category: symbol.category,
|
|
409
|
+
subcategory: symbol.subcategory || null,
|
|
410
|
+
version: symbol.version,
|
|
411
|
+
content_hash: symbol.hash,
|
|
412
|
+
commanders_intent: symbol.commanders_intent,
|
|
413
|
+
data: JSON.stringify(symbol),
|
|
414
|
+
created_at: symbol.created_at,
|
|
415
|
+
created_by: symbol.created_by || null,
|
|
416
|
+
tags: symbol.tags ? JSON.stringify(symbol.tags) : null,
|
|
417
|
+
parent_symbol: symbol.parent_symbol || null,
|
|
418
|
+
});
|
|
419
|
+
return { success: true };
|
|
420
|
+
}
|
|
421
|
+
catch (error) {
|
|
422
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
423
|
+
if (msg.includes('UNIQUE constraint failed')) {
|
|
424
|
+
return { success: false, error: `Symbol ${symbol.symbolId} already exists` };
|
|
425
|
+
}
|
|
426
|
+
return { success: false, error: msg };
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Get a symbol by ID
|
|
431
|
+
*/
|
|
432
|
+
getSymbol(symbolId) {
|
|
433
|
+
const row = this.stmtGetSymbol.get(symbolId);
|
|
434
|
+
if (!row)
|
|
435
|
+
return null;
|
|
436
|
+
return JSON.parse(row.data);
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Update an existing symbol
|
|
440
|
+
*/
|
|
441
|
+
updateSymbol(symbol) {
|
|
442
|
+
try {
|
|
443
|
+
const result = this.stmtUpdateSymbol.run({
|
|
444
|
+
symbol_id: symbol.symbolId,
|
|
445
|
+
version: symbol.version,
|
|
446
|
+
content_hash: symbol.hash,
|
|
447
|
+
commanders_intent: symbol.commanders_intent,
|
|
448
|
+
data: JSON.stringify(symbol),
|
|
449
|
+
updated_at: symbol.updated_at || new Date().toISOString(),
|
|
450
|
+
tags: symbol.tags ? JSON.stringify(symbol.tags) : null,
|
|
451
|
+
});
|
|
452
|
+
if (result.changes === 0) {
|
|
453
|
+
return { success: false, error: `Symbol ${symbol.symbolId} not found` };
|
|
454
|
+
}
|
|
455
|
+
return { success: true };
|
|
456
|
+
}
|
|
457
|
+
catch (error) {
|
|
458
|
+
return { success: false, error: error instanceof Error ? error.message : String(error) };
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Delete a symbol
|
|
463
|
+
*/
|
|
464
|
+
deleteSymbol(symbolId) {
|
|
465
|
+
const result = this.stmtDeleteSymbol.run(symbolId);
|
|
466
|
+
return { success: true, deleted: result.changes > 0 };
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Check if a symbol exists
|
|
470
|
+
*/
|
|
471
|
+
symbolExists(symbolId) {
|
|
472
|
+
const row = this.db.prepare('SELECT 1 FROM symbols WHERE symbol_id = ?').get(symbolId);
|
|
473
|
+
return row !== undefined;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* List symbols with filtering
|
|
477
|
+
*/
|
|
478
|
+
listSymbols(options) {
|
|
479
|
+
const limit = options.limit || 50;
|
|
480
|
+
const offset = options.offset || 0;
|
|
481
|
+
// Build dynamic query based on filters
|
|
482
|
+
const conditions = [];
|
|
483
|
+
const params = [];
|
|
484
|
+
if (options.category) {
|
|
485
|
+
conditions.push('category = ?');
|
|
486
|
+
params.push(options.category);
|
|
487
|
+
}
|
|
488
|
+
if (options.createdAfter) {
|
|
489
|
+
conditions.push('created_at >= ?');
|
|
490
|
+
params.push(options.createdAfter);
|
|
491
|
+
}
|
|
492
|
+
if (options.createdBefore) {
|
|
493
|
+
conditions.push('created_at <= ?');
|
|
494
|
+
params.push(options.createdBefore);
|
|
495
|
+
}
|
|
496
|
+
const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(' AND ')}` : '';
|
|
497
|
+
// Use FTS for search if provided
|
|
498
|
+
if (options.search) {
|
|
499
|
+
const searchResults = this.stmtSearchSymbols.all(options.search, limit, offset);
|
|
500
|
+
const countStmt = this.db.prepare(`
|
|
501
|
+
SELECT COUNT(*) as count FROM symbols_fts WHERE symbols_fts MATCH ?
|
|
502
|
+
`);
|
|
503
|
+
const countResult = countStmt.get(options.search);
|
|
504
|
+
return {
|
|
505
|
+
symbols: searchResults.map(row => ({
|
|
506
|
+
symbolId: row.symbol_id,
|
|
507
|
+
path: '', // Not used in SQLite mode
|
|
508
|
+
category: row.category,
|
|
509
|
+
version: row.version,
|
|
510
|
+
hash: row.content_hash,
|
|
511
|
+
created_at: row.created_at,
|
|
512
|
+
updated_at: row.updated_at || undefined,
|
|
513
|
+
commanders_intent_preview: row.commanders_intent.substring(0, 100),
|
|
514
|
+
})),
|
|
515
|
+
total: countResult.count,
|
|
516
|
+
hasMore: offset + searchResults.length < countResult.count,
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
// Regular filtered query
|
|
520
|
+
const query = `
|
|
521
|
+
SELECT symbol_id, category, version, content_hash, commanders_intent,
|
|
522
|
+
created_at, updated_at
|
|
523
|
+
FROM symbols
|
|
524
|
+
${whereClause}
|
|
525
|
+
ORDER BY created_at DESC
|
|
526
|
+
LIMIT ? OFFSET ?
|
|
527
|
+
`;
|
|
528
|
+
const countQuery = `SELECT COUNT(*) as count FROM symbols ${whereClause}`;
|
|
529
|
+
const rows = this.db.prepare(query).all(...params, limit, offset);
|
|
530
|
+
const countResult = this.db.prepare(countQuery).get(...params);
|
|
531
|
+
return {
|
|
532
|
+
symbols: rows.map(row => ({
|
|
533
|
+
symbolId: row.symbol_id,
|
|
534
|
+
path: '',
|
|
535
|
+
category: row.category,
|
|
536
|
+
version: row.version,
|
|
537
|
+
hash: row.content_hash,
|
|
538
|
+
created_at: row.created_at,
|
|
539
|
+
updated_at: row.updated_at || undefined,
|
|
540
|
+
commanders_intent_preview: row.commanders_intent.substring(0, 100),
|
|
541
|
+
})),
|
|
542
|
+
total: countResult.count,
|
|
543
|
+
hasMore: offset + rows.length < countResult.count,
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Get all symbols (for export)
|
|
548
|
+
*/
|
|
549
|
+
getAllSymbols() {
|
|
550
|
+
const rows = this.db.prepare('SELECT data FROM symbols ORDER BY created_at').all();
|
|
551
|
+
return rows.map(row => JSON.parse(row.data));
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Search symbols using full-text search
|
|
555
|
+
* Uses the symbols_fts FTS5 table to find symbols matching the query
|
|
556
|
+
*/
|
|
557
|
+
search(query) {
|
|
558
|
+
const stmt = this.db.prepare(`
|
|
559
|
+
SELECT s.*
|
|
560
|
+
FROM symbols s
|
|
561
|
+
JOIN symbols_fts fts ON s.id = fts.rowid
|
|
562
|
+
WHERE symbols_fts MATCH ?
|
|
563
|
+
ORDER BY rank
|
|
564
|
+
`);
|
|
565
|
+
return stmt.all(query);
|
|
566
|
+
}
|
|
567
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
568
|
+
// AUDIT OPERATIONS
|
|
569
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
570
|
+
/**
|
|
571
|
+
* Insert an audit entry
|
|
572
|
+
*/
|
|
573
|
+
insertAuditEntry(entry) {
|
|
574
|
+
this.stmtInsertAudit.run({
|
|
575
|
+
timestamp: new Date().toISOString(),
|
|
576
|
+
event_type: entry.eventType,
|
|
577
|
+
symbol_id: entry.symbolId || null,
|
|
578
|
+
risk_score: entry.riskScore ?? null,
|
|
579
|
+
details: entry.details ? JSON.stringify(entry.details) : null,
|
|
580
|
+
violations: entry.violations ? JSON.stringify(entry.violations) : null,
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Get recent audit entries
|
|
585
|
+
*/
|
|
586
|
+
getRecentAuditEntries(limit = 100) {
|
|
587
|
+
return this.db.prepare(`
|
|
588
|
+
SELECT * FROM audit_log ORDER BY timestamp DESC LIMIT ?
|
|
589
|
+
`).all(limit);
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Get injection attempts
|
|
593
|
+
*/
|
|
594
|
+
getInjectionAttempts() {
|
|
595
|
+
return this.db.prepare(`
|
|
596
|
+
SELECT * FROM audit_log
|
|
597
|
+
WHERE event_type IN ('INJECTION_ATTEMPT', 'SYMBOL_CREATE_BLOCKED', 'SYMBOL_UPDATE_BLOCKED')
|
|
598
|
+
ORDER BY timestamp DESC
|
|
599
|
+
`).all();
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Get audit entries for a symbol
|
|
603
|
+
*/
|
|
604
|
+
getAuditForSymbol(symbolId) {
|
|
605
|
+
return this.db.prepare(`
|
|
606
|
+
SELECT * FROM audit_log WHERE symbol_id = ? ORDER BY timestamp DESC
|
|
607
|
+
`).all(symbolId);
|
|
608
|
+
}
|
|
609
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
610
|
+
// OPACITY LAYER OPERATIONS
|
|
611
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
612
|
+
/**
|
|
613
|
+
* Get the current maximum token ID (for counter initialization)
|
|
614
|
+
*/
|
|
615
|
+
getMaxOpaqueId() {
|
|
616
|
+
const result = this.stmtGetMaxOpaqueId.get();
|
|
617
|
+
return result?.max_id ?? 10000;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Insert a new opaque token mapping
|
|
621
|
+
*/
|
|
622
|
+
insertOpaqueToken(params) {
|
|
623
|
+
try {
|
|
624
|
+
this.stmtInsertOpaque.run({
|
|
625
|
+
token: params.token,
|
|
626
|
+
plaintext: params.plaintext,
|
|
627
|
+
symbol_id: params.symbolId || null,
|
|
628
|
+
field_name: params.fieldName || null,
|
|
629
|
+
created_at: new Date().toISOString(),
|
|
630
|
+
expires_at: params.expiresAt || null,
|
|
631
|
+
});
|
|
632
|
+
return { success: true };
|
|
633
|
+
}
|
|
634
|
+
catch (error) {
|
|
635
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
636
|
+
if (msg.includes('UNIQUE constraint failed')) {
|
|
637
|
+
return { success: false, error: `Token ${params.token} already exists` };
|
|
638
|
+
}
|
|
639
|
+
return { success: false, error: msg };
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Get a single opaque token mapping
|
|
644
|
+
*/
|
|
645
|
+
getOpaqueToken(token, updateAccess = true) {
|
|
646
|
+
const row = this.stmtGetOpaque.get(token);
|
|
647
|
+
if (!row)
|
|
648
|
+
return null;
|
|
649
|
+
// Update access tracking
|
|
650
|
+
if (updateAccess) {
|
|
651
|
+
this.stmtUpdateOpaqueAccess.run(token);
|
|
652
|
+
}
|
|
653
|
+
return row;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Resolve multiple opaque tokens at once
|
|
657
|
+
*/
|
|
658
|
+
resolveOpaqueTokens(tokens, updateAccess = true) {
|
|
659
|
+
const resolved = {};
|
|
660
|
+
// Use a transaction for efficiency
|
|
661
|
+
this.transaction(() => {
|
|
662
|
+
for (const token of tokens) {
|
|
663
|
+
const row = this.getOpaqueToken(token, updateAccess);
|
|
664
|
+
if (row) {
|
|
665
|
+
resolved[token] = row.plaintext;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
return resolved;
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Get all opaque tokens for a symbol
|
|
673
|
+
*/
|
|
674
|
+
getOpaqueTokensForSymbol(symbolId) {
|
|
675
|
+
return this.db.prepare(`
|
|
676
|
+
SELECT * FROM opaque_mappings WHERE symbol_id = ? ORDER BY created_at
|
|
677
|
+
`).all(symbolId);
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Delete expired opaque tokens
|
|
681
|
+
*/
|
|
682
|
+
cleanupExpiredOpaqueTokens() {
|
|
683
|
+
const result = this.stmtDeleteExpiredOpaque.run();
|
|
684
|
+
return result.changes;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Delete all opaque tokens for a symbol
|
|
688
|
+
*/
|
|
689
|
+
deleteOpaqueTokensForSymbol(symbolId) {
|
|
690
|
+
const result = this.db.prepare(`
|
|
691
|
+
DELETE FROM opaque_mappings WHERE symbol_id = ?
|
|
692
|
+
`).run(symbolId);
|
|
693
|
+
return result.changes;
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Get opacity statistics
|
|
697
|
+
*/
|
|
698
|
+
getOpaqueStats() {
|
|
699
|
+
const stats = this.db.prepare(`
|
|
700
|
+
SELECT
|
|
701
|
+
COUNT(*) as total_tokens,
|
|
702
|
+
SUM(access_count) as total_accesses,
|
|
703
|
+
SUM(CASE WHEN symbol_id IS NOT NULL THEN 1 ELSE 0 END) as tokens_with_symbol,
|
|
704
|
+
SUM(CASE WHEN expires_at IS NOT NULL AND expires_at < datetime('now') THEN 1 ELSE 0 END) as expired_tokens
|
|
705
|
+
FROM opaque_mappings
|
|
706
|
+
`).get();
|
|
707
|
+
return {
|
|
708
|
+
totalTokens: stats.total_tokens || 0,
|
|
709
|
+
totalAccesses: stats.total_accesses || 0,
|
|
710
|
+
tokensWithSymbol: stats.tokens_with_symbol || 0,
|
|
711
|
+
expiredTokens: stats.expired_tokens || 0,
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
715
|
+
// VERIFICATION EVENT OPERATIONS (v2.1 - Epistemic Tracking)
|
|
716
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
717
|
+
/**
|
|
718
|
+
* Insert a verification event for a symbol
|
|
719
|
+
*/
|
|
720
|
+
insertVerificationEvent(params) {
|
|
721
|
+
try {
|
|
722
|
+
this.db.prepare(`
|
|
723
|
+
INSERT INTO verification_events (
|
|
724
|
+
symbol_id, event_type, old_status, new_status,
|
|
725
|
+
old_confidence, new_confidence, reviewer, evidence_added, notes
|
|
726
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
727
|
+
`).run(params.symbolId, params.eventType, params.oldStatus || null, params.newStatus || null, params.oldConfidence ?? null, params.newConfidence ?? null, params.reviewer, params.evidenceAdded ? JSON.stringify(params.evidenceAdded) : null, params.notes || null);
|
|
728
|
+
return { success: true };
|
|
729
|
+
}
|
|
730
|
+
catch (error) {
|
|
731
|
+
return {
|
|
732
|
+
success: false,
|
|
733
|
+
error: error instanceof Error ? error.message : String(error),
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Get verification history for a symbol
|
|
739
|
+
*/
|
|
740
|
+
getVerificationHistory(symbolId) {
|
|
741
|
+
const rows = this.db.prepare(`
|
|
742
|
+
SELECT * FROM verification_events
|
|
743
|
+
WHERE symbol_id = ?
|
|
744
|
+
ORDER BY timestamp DESC
|
|
745
|
+
`).all(symbolId);
|
|
746
|
+
return rows.map(row => ({
|
|
747
|
+
id: row.id,
|
|
748
|
+
symbolId: row.symbol_id,
|
|
749
|
+
timestamp: row.timestamp,
|
|
750
|
+
eventType: row.event_type,
|
|
751
|
+
oldStatus: row.old_status,
|
|
752
|
+
newStatus: row.new_status,
|
|
753
|
+
oldConfidence: row.old_confidence,
|
|
754
|
+
newConfidence: row.new_confidence,
|
|
755
|
+
reviewer: row.reviewer,
|
|
756
|
+
evidenceAdded: row.evidence_added ? JSON.parse(row.evidence_added) : null,
|
|
757
|
+
notes: row.notes,
|
|
758
|
+
}));
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* List symbols that require human review based on their epistemic metadata.
|
|
762
|
+
* Joins symbols table with their JSON data to filter by epistemic fields.
|
|
763
|
+
*/
|
|
764
|
+
listSymbolsNeedingReview(options) {
|
|
765
|
+
const conditions = [];
|
|
766
|
+
const params = [];
|
|
767
|
+
// Filter symbols where epistemic.requires_human_review = true
|
|
768
|
+
// SQLite JSON1 extension allows querying JSON fields
|
|
769
|
+
conditions.push("json_extract(data, '$.epistemic.requires_human_review') = 1");
|
|
770
|
+
if (options.claimType) {
|
|
771
|
+
conditions.push("json_extract(data, '$.epistemic.claim_type') = ?");
|
|
772
|
+
params.push(options.claimType);
|
|
773
|
+
}
|
|
774
|
+
if (options.minConfidence !== undefined) {
|
|
775
|
+
conditions.push("json_extract(data, '$.epistemic.confidence') >= ?");
|
|
776
|
+
params.push(options.minConfidence);
|
|
777
|
+
}
|
|
778
|
+
if (options.maxConfidence !== undefined) {
|
|
779
|
+
conditions.push("json_extract(data, '$.epistemic.confidence') <= ?");
|
|
780
|
+
params.push(options.maxConfidence);
|
|
781
|
+
}
|
|
782
|
+
const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(' AND ')}` : '';
|
|
783
|
+
const limit = options.limit || 50;
|
|
784
|
+
const offset = options.offset || 0;
|
|
785
|
+
const query = `
|
|
786
|
+
SELECT * FROM symbols
|
|
787
|
+
${whereClause}
|
|
788
|
+
ORDER BY json_extract(data, '$.epistemic.confidence') ASC,
|
|
789
|
+
created_at DESC
|
|
790
|
+
LIMIT ? OFFSET ?
|
|
791
|
+
`;
|
|
792
|
+
const countQuery = `SELECT COUNT(*) as count FROM symbols ${whereClause}`;
|
|
793
|
+
const rows = this.db.prepare(query).all(...params, limit, offset);
|
|
794
|
+
const countResult = this.db.prepare(countQuery).get(...params);
|
|
795
|
+
return {
|
|
796
|
+
symbols: rows,
|
|
797
|
+
total: countResult.count,
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
801
|
+
// STATISTICS
|
|
802
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
803
|
+
/**
|
|
804
|
+
* Get database statistics
|
|
805
|
+
*/
|
|
806
|
+
getStats() {
|
|
807
|
+
const categoryRows = this.stmtCountByCategory.all();
|
|
808
|
+
const byCategory = {
|
|
809
|
+
// AGENT family
|
|
810
|
+
COMPANY: 0,
|
|
811
|
+
PERSON: 0,
|
|
812
|
+
SYSTEM: 0,
|
|
813
|
+
// RESOURCE family
|
|
814
|
+
DOCUMENT: 0,
|
|
815
|
+
KNOWLEDGE: 0,
|
|
816
|
+
ASSET: 0,
|
|
817
|
+
// EVENT family
|
|
818
|
+
EVENT: 0,
|
|
819
|
+
MILESTONE: 0,
|
|
820
|
+
REGULATORY_EVENT: 0,
|
|
821
|
+
// FLOW family
|
|
822
|
+
TASK: 0,
|
|
823
|
+
WORKFLOW: 0,
|
|
824
|
+
TRANSACTION: 0,
|
|
825
|
+
// RULE family
|
|
826
|
+
REGULATORY: 0,
|
|
827
|
+
POLICY: 0,
|
|
828
|
+
CONSTRAINT: 0,
|
|
829
|
+
// UNIT family
|
|
830
|
+
METRIC: 0,
|
|
831
|
+
GEOGRAPHY: 0,
|
|
832
|
+
SECTOR: 0,
|
|
833
|
+
// QUERY family
|
|
834
|
+
QUERY: 0,
|
|
835
|
+
};
|
|
836
|
+
let totalSymbols = 0;
|
|
837
|
+
for (const row of categoryRows) {
|
|
838
|
+
byCategory[row.category] = row.count;
|
|
839
|
+
totalSymbols += row.count;
|
|
840
|
+
}
|
|
841
|
+
const auditCount = this.db.prepare('SELECT COUNT(*) as count FROM audit_log').get();
|
|
842
|
+
// Get database file size
|
|
843
|
+
let databaseSizeBytes = 0;
|
|
844
|
+
try {
|
|
845
|
+
const stats = fs.statSync(this.dbPath);
|
|
846
|
+
databaseSizeBytes = stats.size;
|
|
847
|
+
}
|
|
848
|
+
catch {
|
|
849
|
+
// File might not exist yet
|
|
850
|
+
}
|
|
851
|
+
return {
|
|
852
|
+
totalSymbols,
|
|
853
|
+
byCategory,
|
|
854
|
+
totalAuditEvents: auditCount.count,
|
|
855
|
+
databaseSizeBytes,
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
859
|
+
// TRANSACTIONS
|
|
860
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
861
|
+
/**
|
|
862
|
+
* Run multiple operations in a transaction
|
|
863
|
+
*/
|
|
864
|
+
transaction(fn) {
|
|
865
|
+
return this.db.transaction(fn)();
|
|
866
|
+
}
|
|
867
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
868
|
+
// MAINTENANCE
|
|
869
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
870
|
+
/**
|
|
871
|
+
* Optimize the database (run periodically)
|
|
872
|
+
*/
|
|
873
|
+
optimize() {
|
|
874
|
+
this.db.pragma('optimize');
|
|
875
|
+
this.db.exec('VACUUM');
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* Close the database connection
|
|
879
|
+
*/
|
|
880
|
+
close() {
|
|
881
|
+
this.db.close();
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Check database integrity
|
|
885
|
+
*/
|
|
886
|
+
checkIntegrity() {
|
|
887
|
+
const result = this.db.pragma('integrity_check');
|
|
888
|
+
const errors = result
|
|
889
|
+
.map(r => r.integrity_check)
|
|
890
|
+
.filter(msg => msg !== 'ok');
|
|
891
|
+
return { ok: errors.length === 0, errors };
|
|
892
|
+
}
|
|
893
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
894
|
+
// RAW SQL ACCESS (for extension modules like API keys)
|
|
895
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
896
|
+
/**
|
|
897
|
+
* Execute raw SQL (for DDL statements, migrations, etc.)
|
|
898
|
+
*/
|
|
899
|
+
exec(sql) {
|
|
900
|
+
this.db.exec(sql);
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Prepare a statement for execution
|
|
904
|
+
*/
|
|
905
|
+
prepare(sql) {
|
|
906
|
+
return this.db.prepare(sql);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
910
|
+
// SINGLETON INSTANCE
|
|
911
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
912
|
+
let symbolDatabase = null;
|
|
913
|
+
export function initializeDatabase(dbPath) {
|
|
914
|
+
if (symbolDatabase) {
|
|
915
|
+
symbolDatabase.close();
|
|
916
|
+
}
|
|
917
|
+
symbolDatabase = new SymbolDatabase(dbPath);
|
|
918
|
+
return symbolDatabase;
|
|
919
|
+
}
|
|
920
|
+
export function getDatabase() {
|
|
921
|
+
if (!symbolDatabase) {
|
|
922
|
+
throw new Error('Database not initialized. Call initializeDatabase first.');
|
|
923
|
+
}
|
|
924
|
+
return symbolDatabase;
|
|
925
|
+
}
|
|
926
|
+
export function closeDatabase() {
|
|
927
|
+
if (symbolDatabase) {
|
|
928
|
+
symbolDatabase.close();
|
|
929
|
+
symbolDatabase = null;
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
//# sourceMappingURL=database.js.map
|