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,1487 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// LEGAL CITATION VALIDATOR
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// Three-tier validation for legal citations: Structural, Semantic, Chain.
|
|
5
|
+
//
|
|
6
|
+
// =============================================================================
|
|
7
|
+
// CRITICAL LIMITATIONS - READ BEFORE USE
|
|
8
|
+
// =============================================================================
|
|
9
|
+
//
|
|
10
|
+
// THIS VALIDATOR CANNOT:
|
|
11
|
+
// - Verify that a cited case actually exists
|
|
12
|
+
// - Confirm that quoted holdings are accurate
|
|
13
|
+
// - Guarantee that a case has not been overruled
|
|
14
|
+
// - Validate that the legal proposition matches the citation
|
|
15
|
+
// - Replace human legal research or Westlaw/Lexis verification
|
|
16
|
+
//
|
|
17
|
+
// THIS VALIDATOR CAN:
|
|
18
|
+
// - Check if citation FORMAT matches known patterns (Bluebook, etc.)
|
|
19
|
+
// - Flag obviously malformed citations
|
|
20
|
+
// - Check citations against a LOCAL database of known cases
|
|
21
|
+
// - Detect implausible date/court combinations
|
|
22
|
+
// - Flag citations that require human verification
|
|
23
|
+
//
|
|
24
|
+
// A PASSING SCORE DOES NOT MEAN THE CASE IS REAL.
|
|
25
|
+
// A FAILING SCORE DOES NOT MEAN THE CASE IS FAKE.
|
|
26
|
+
//
|
|
27
|
+
// ALWAYS verify citations through Westlaw, Lexis, or official court records.
|
|
28
|
+
// =============================================================================
|
|
29
|
+
import { NO_FABRICATION_SYMBOLS, LEGAL_DOMAIN_SYMBOL, } from './types.js';
|
|
30
|
+
// =============================================================================
|
|
31
|
+
// CONSTANTS
|
|
32
|
+
// =============================================================================
|
|
33
|
+
/**
|
|
34
|
+
* Maximum confidence score. Capped because we CANNOT fully verify citations.
|
|
35
|
+
*/
|
|
36
|
+
const MAX_CONFIDENCE_SCORE = 0.85;
|
|
37
|
+
/**
|
|
38
|
+
* Known reporter abbreviations for structural validation.
|
|
39
|
+
*/
|
|
40
|
+
const KNOWN_REPORTERS = [
|
|
41
|
+
// U.S. Supreme Court
|
|
42
|
+
'U.S.', 'S.Ct.', 'S. Ct.', 'L.Ed.', 'L.Ed.2d', 'L. Ed.', 'L. Ed. 2d',
|
|
43
|
+
// Federal Reporter (Circuit Courts)
|
|
44
|
+
'F.', 'F.2d', 'F.3d', 'F.4th',
|
|
45
|
+
// Federal Supplement (District Courts)
|
|
46
|
+
'F.Supp.', 'F.Supp.2d', 'F.Supp.3d', 'F. Supp.', 'F. Supp. 2d', 'F. Supp. 3d',
|
|
47
|
+
// Federal Appendix (Unpublished)
|
|
48
|
+
'Fed.Appx.', 'Fed. Appx.',
|
|
49
|
+
// Bankruptcy Reporter
|
|
50
|
+
'B.R.',
|
|
51
|
+
// Federal Claims
|
|
52
|
+
'Fed.Cl.', 'Fed. Cl.', 'Cl.Ct.', 'Ct.Cl.',
|
|
53
|
+
// California
|
|
54
|
+
'Cal.', 'Cal.2d', 'Cal.3d', 'Cal.4th', 'Cal.5th',
|
|
55
|
+
'Cal.App.', 'Cal.App.2d', 'Cal.App.3d', 'Cal.App.4th', 'Cal.App.5th',
|
|
56
|
+
'Cal.Rptr.', 'Cal.Rptr.2d', 'Cal.Rptr.3d',
|
|
57
|
+
// New York
|
|
58
|
+
'N.Y.', 'N.Y.2d', 'N.Y.3d',
|
|
59
|
+
'A.D.', 'A.D.2d', 'A.D.3d',
|
|
60
|
+
'N.Y.S.', 'N.Y.S.2d', 'N.Y.S.3d',
|
|
61
|
+
'Misc.', 'Misc.2d', 'Misc.3d',
|
|
62
|
+
// Regional Reporters
|
|
63
|
+
'N.E.', 'N.E.2d', 'N.E.3d',
|
|
64
|
+
'A.', 'A.2d', 'A.3d',
|
|
65
|
+
'So.', 'So.2d', 'So.3d',
|
|
66
|
+
'S.E.', 'S.E.2d',
|
|
67
|
+
'S.W.', 'S.W.2d', 'S.W.3d',
|
|
68
|
+
'N.W.', 'N.W.2d',
|
|
69
|
+
'P.', 'P.2d', 'P.3d',
|
|
70
|
+
// Other Federal
|
|
71
|
+
'M.J.', // Military Justice
|
|
72
|
+
'Vet.App.', // Veterans Appeals
|
|
73
|
+
'T.C.', 'T.C.M.', // Tax Court
|
|
74
|
+
];
|
|
75
|
+
/**
|
|
76
|
+
* Court patterns for structural validation.
|
|
77
|
+
*/
|
|
78
|
+
const COURT_PATTERNS = [
|
|
79
|
+
/^\d{1,2}(?:st|nd|rd|th)\s+Cir\.?$/i, // "9th Cir."
|
|
80
|
+
/^[A-Z]\.[A-Z]\.$/, // "D.C."
|
|
81
|
+
/^[A-Z]{2}$/, // State abbreviations "CA", "NY"
|
|
82
|
+
/^(?:N|S|E|W|C|M)\.?D\.?\s*[A-Z][a-z]+\.?$/i, // "N.D. Cal.", "S.D.N.Y."
|
|
83
|
+
/^[A-Z][a-z]+\.?\s*(?:Ct\.?\s*)?App\.?$/i, // "Cal. Ct. App."
|
|
84
|
+
/^[A-Z][a-z]+\.?$/i, // "Cal.", "Tex."
|
|
85
|
+
/^Fed\.?\s*Cl\.?$/i, // "Fed. Cl."
|
|
86
|
+
/^Fed\.?\s*Cir\.?$/i, // "Fed. Cir."
|
|
87
|
+
/^T\.?C\.?$/i, // "T.C." Tax Court
|
|
88
|
+
/^C\.?C\.?P\.?A\.?$/i, // "C.C.P.A."
|
|
89
|
+
/^Bankr\.?\s*[A-Z]\.?[A-Z]?\.?\s*[A-Z][a-z]*\.?$/i, // Bankruptcy courts
|
|
90
|
+
/^[A-Z][a-z]+\.?\s+Super\.?\s*(?:Ct\.?)?$/i, // "Cal. Super. Ct."
|
|
91
|
+
/^Sup\.?\s*Ct\.?$/i, // "Sup. Ct."
|
|
92
|
+
];
|
|
93
|
+
/**
|
|
94
|
+
* Reporter series with year ranges for semantic validation.
|
|
95
|
+
*/
|
|
96
|
+
const REPORTER_YEAR_RANGES = {
|
|
97
|
+
'F.': [1880, 1924],
|
|
98
|
+
'F.2d': [1924, 1993],
|
|
99
|
+
'F.3d': [1993, 2021],
|
|
100
|
+
'F.4th': [2021, 2100],
|
|
101
|
+
'F.Supp.': [1932, 1998],
|
|
102
|
+
'F.Supp.2d': [1998, 2014],
|
|
103
|
+
'F.Supp.3d': [2014, 2100],
|
|
104
|
+
'Fed.Appx.': [2001, 2100],
|
|
105
|
+
'U.S.': [1790, 2100],
|
|
106
|
+
'S.Ct.': [1882, 2100],
|
|
107
|
+
'L.Ed.': [1790, 1956],
|
|
108
|
+
'L.Ed.2d': [1956, 2100],
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Approximate maximum volumes for known reporters (for plausibility).
|
|
112
|
+
*/
|
|
113
|
+
const REPORTER_MAX_VOLUMES = {
|
|
114
|
+
'U.S.': 600,
|
|
115
|
+
'S.Ct.': 145,
|
|
116
|
+
'L.Ed.': 100,
|
|
117
|
+
'L.Ed.2d': 180,
|
|
118
|
+
'F.': 300,
|
|
119
|
+
'F.2d': 999,
|
|
120
|
+
'F.3d': 999,
|
|
121
|
+
'F.4th': 150,
|
|
122
|
+
'F.Supp.': 999,
|
|
123
|
+
'F.Supp.2d': 999,
|
|
124
|
+
'F.Supp.3d': 750,
|
|
125
|
+
'Fed.Appx.': 999,
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Static limitation notice to include in all reports.
|
|
129
|
+
*/
|
|
130
|
+
const LIMITATION_NOTICE = `
|
|
131
|
+
CITATION VALIDATION LIMITATIONS
|
|
132
|
+
===============================
|
|
133
|
+
This validator CANNOT verify that a cited case actually exists.
|
|
134
|
+
It can only:
|
|
135
|
+
- Check if the citation FORMAT matches known patterns
|
|
136
|
+
- Detect obviously implausible date/court combinations
|
|
137
|
+
- Check against a LOCAL database of known cases (incomplete)
|
|
138
|
+
- Flag citations for human review
|
|
139
|
+
|
|
140
|
+
A PASSING score does NOT mean the case is real.
|
|
141
|
+
A FAILING score does NOT mean the case is fake.
|
|
142
|
+
|
|
143
|
+
ALWAYS verify citations through Westlaw, Lexis, or official court records.
|
|
144
|
+
`.trim();
|
|
145
|
+
// =============================================================================
|
|
146
|
+
// STRUCTURAL VALIDATION RULES (Tier 1)
|
|
147
|
+
// =============================================================================
|
|
148
|
+
// These rules check if the citation LOOKS RIGHT syntactically.
|
|
149
|
+
// =============================================================================
|
|
150
|
+
const STRUCTURAL_RULES = [
|
|
151
|
+
{
|
|
152
|
+
id: 'CR-SR-001',
|
|
153
|
+
name: 'CASE_NAME_PRESENT',
|
|
154
|
+
tier: 'structural',
|
|
155
|
+
check: (citation) => {
|
|
156
|
+
const hasName = citation.caseName !== null &&
|
|
157
|
+
citation.caseName.length > 0 &&
|
|
158
|
+
/\S+\s+v\.?\s+\S+/i.test(citation.caseName);
|
|
159
|
+
return {
|
|
160
|
+
ruleId: 'CR-SR-001',
|
|
161
|
+
ruleName: 'CASE_NAME_PRESENT',
|
|
162
|
+
tier: 'structural',
|
|
163
|
+
passed: hasName,
|
|
164
|
+
severity: hasName ? 'pass' : 'error',
|
|
165
|
+
message: hasName
|
|
166
|
+
? 'Case name identified'
|
|
167
|
+
: 'Could not identify case name (expected "Party v. Party" format)',
|
|
168
|
+
details: hasName ? `Case: ${citation.caseName}` : undefined,
|
|
169
|
+
humanAction: 'none',
|
|
170
|
+
};
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
id: 'CR-SR-002',
|
|
175
|
+
name: 'VOLUME_REPORTER_PAGE_FORMAT',
|
|
176
|
+
tier: 'structural',
|
|
177
|
+
check: (citation) => {
|
|
178
|
+
const hasVRP = citation.volume !== null &&
|
|
179
|
+
citation.reporter !== null &&
|
|
180
|
+
citation.page !== null;
|
|
181
|
+
return {
|
|
182
|
+
ruleId: 'CR-SR-002',
|
|
183
|
+
ruleName: 'VOLUME_REPORTER_PAGE_FORMAT',
|
|
184
|
+
tier: 'structural',
|
|
185
|
+
passed: hasVRP,
|
|
186
|
+
severity: hasVRP ? 'pass' : 'error',
|
|
187
|
+
message: hasVRP
|
|
188
|
+
? 'Volume/Reporter/Page format valid'
|
|
189
|
+
: 'Missing or malformed volume/reporter/page components',
|
|
190
|
+
details: hasVRP
|
|
191
|
+
? `${citation.volume} ${citation.reporter} ${citation.page}`
|
|
192
|
+
: 'Expected format: [volume] [reporter] [page]',
|
|
193
|
+
humanAction: hasVRP ? 'none' : 'verify',
|
|
194
|
+
};
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
id: 'CR-SR-003',
|
|
199
|
+
name: 'REPORTER_RECOGNIZED',
|
|
200
|
+
tier: 'structural',
|
|
201
|
+
check: (citation) => {
|
|
202
|
+
if (!citation.reporter) {
|
|
203
|
+
return {
|
|
204
|
+
ruleId: 'CR-SR-003',
|
|
205
|
+
ruleName: 'REPORTER_RECOGNIZED',
|
|
206
|
+
tier: 'structural',
|
|
207
|
+
passed: false,
|
|
208
|
+
severity: 'error',
|
|
209
|
+
message: 'No reporter found in citation',
|
|
210
|
+
humanAction: 'verify',
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
const normalized = citation.reporter.replace(/\s+/g, '').toLowerCase();
|
|
214
|
+
const isKnown = KNOWN_REPORTERS.some(r => r.replace(/\s+/g, '').toLowerCase() === normalized);
|
|
215
|
+
return {
|
|
216
|
+
ruleId: 'CR-SR-003',
|
|
217
|
+
ruleName: 'REPORTER_RECOGNIZED',
|
|
218
|
+
tier: 'structural',
|
|
219
|
+
passed: isKnown,
|
|
220
|
+
severity: isKnown ? 'pass' : 'warning',
|
|
221
|
+
message: isKnown
|
|
222
|
+
? `Recognized reporter: ${citation.reporter}`
|
|
223
|
+
: `Unrecognized reporter: "${citation.reporter}" - may be valid but not in database`,
|
|
224
|
+
humanAction: isKnown ? 'none' : 'verify',
|
|
225
|
+
};
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
id: 'CR-SR-004',
|
|
230
|
+
name: 'COURT_IDENTIFIER_FORMAT',
|
|
231
|
+
tier: 'structural',
|
|
232
|
+
check: (citation) => {
|
|
233
|
+
if (!citation.court) {
|
|
234
|
+
return {
|
|
235
|
+
ruleId: 'CR-SR-004',
|
|
236
|
+
ruleName: 'COURT_IDENTIFIER_FORMAT',
|
|
237
|
+
tier: 'structural',
|
|
238
|
+
passed: false,
|
|
239
|
+
severity: 'warning',
|
|
240
|
+
message: 'No court identifier found in parenthetical',
|
|
241
|
+
humanAction: 'verify',
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
const matchesPattern = COURT_PATTERNS.some(p => p.test(citation.court));
|
|
245
|
+
return {
|
|
246
|
+
ruleId: 'CR-SR-004',
|
|
247
|
+
ruleName: 'COURT_IDENTIFIER_FORMAT',
|
|
248
|
+
tier: 'structural',
|
|
249
|
+
passed: matchesPattern,
|
|
250
|
+
severity: matchesPattern ? 'pass' : 'warning',
|
|
251
|
+
message: matchesPattern
|
|
252
|
+
? `Valid court identifier format: ${citation.court}`
|
|
253
|
+
: `Unusual court format: "${citation.court}"`,
|
|
254
|
+
humanAction: matchesPattern ? 'none' : 'verify',
|
|
255
|
+
};
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
id: 'CR-SR-005',
|
|
260
|
+
name: 'YEAR_FORMAT_VALID',
|
|
261
|
+
tier: 'structural',
|
|
262
|
+
check: (citation) => {
|
|
263
|
+
const year = citation.year;
|
|
264
|
+
const currentYear = new Date().getFullYear();
|
|
265
|
+
const validFormat = year !== null && year >= 1700 && year <= currentYear;
|
|
266
|
+
return {
|
|
267
|
+
ruleId: 'CR-SR-005',
|
|
268
|
+
ruleName: 'YEAR_FORMAT_VALID',
|
|
269
|
+
tier: 'structural',
|
|
270
|
+
passed: validFormat,
|
|
271
|
+
severity: validFormat ? 'pass' : 'error',
|
|
272
|
+
message: validFormat
|
|
273
|
+
? `Valid year: ${year}`
|
|
274
|
+
: year === null
|
|
275
|
+
? 'No year found in citation'
|
|
276
|
+
: year > currentYear
|
|
277
|
+
? `FUTURE DATE: Year ${year} is in the future`
|
|
278
|
+
: `Invalid year: ${year}`,
|
|
279
|
+
humanAction: 'none',
|
|
280
|
+
};
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
id: 'CR-SR-006',
|
|
285
|
+
name: 'VOLUME_PAGE_POSITIVE',
|
|
286
|
+
tier: 'structural',
|
|
287
|
+
check: (citation) => {
|
|
288
|
+
const validVolume = citation.volume === null || citation.volume > 0;
|
|
289
|
+
const validPage = citation.page === null || citation.page > 0;
|
|
290
|
+
const passed = validVolume && validPage;
|
|
291
|
+
return {
|
|
292
|
+
ruleId: 'CR-SR-006',
|
|
293
|
+
ruleName: 'VOLUME_PAGE_POSITIVE',
|
|
294
|
+
tier: 'structural',
|
|
295
|
+
passed,
|
|
296
|
+
severity: passed ? 'pass' : 'error',
|
|
297
|
+
message: passed
|
|
298
|
+
? 'Volume and page numbers are positive'
|
|
299
|
+
: `Invalid numbers: volume=${citation.volume}, page=${citation.page}`,
|
|
300
|
+
humanAction: 'none',
|
|
301
|
+
};
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
id: 'CR-SR-007',
|
|
306
|
+
name: 'PINPOINT_AFTER_PAGE',
|
|
307
|
+
tier: 'structural',
|
|
308
|
+
check: (citation) => {
|
|
309
|
+
if (citation.pinpoint === null) {
|
|
310
|
+
return {
|
|
311
|
+
ruleId: 'CR-SR-007',
|
|
312
|
+
ruleName: 'PINPOINT_AFTER_PAGE',
|
|
313
|
+
tier: 'structural',
|
|
314
|
+
passed: true,
|
|
315
|
+
severity: 'pass',
|
|
316
|
+
message: 'No pinpoint citation (acceptable)',
|
|
317
|
+
humanAction: 'none',
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
const validPinpoint = citation.page !== null &&
|
|
321
|
+
citation.pinpoint >= citation.page;
|
|
322
|
+
return {
|
|
323
|
+
ruleId: 'CR-SR-007',
|
|
324
|
+
ruleName: 'PINPOINT_AFTER_PAGE',
|
|
325
|
+
tier: 'structural',
|
|
326
|
+
passed: validPinpoint,
|
|
327
|
+
severity: validPinpoint ? 'pass' : 'warning',
|
|
328
|
+
message: validPinpoint
|
|
329
|
+
? `Valid pinpoint: ${citation.page}, ${citation.pinpoint}`
|
|
330
|
+
: `Pinpoint (${citation.pinpoint}) before starting page (${citation.page})`,
|
|
331
|
+
humanAction: validPinpoint ? 'none' : 'verify',
|
|
332
|
+
};
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
];
|
|
336
|
+
// =============================================================================
|
|
337
|
+
// SEMANTIC VALIDATION RULES (Tier 2)
|
|
338
|
+
// =============================================================================
|
|
339
|
+
// These rules check if the citation MAKES SENSE given what we know.
|
|
340
|
+
// =============================================================================
|
|
341
|
+
const SEMANTIC_RULES = [
|
|
342
|
+
{
|
|
343
|
+
id: 'CR-SM-001',
|
|
344
|
+
name: 'DATE_NOT_FUTURE',
|
|
345
|
+
tier: 'semantic',
|
|
346
|
+
check: (citation) => {
|
|
347
|
+
const currentYear = new Date().getFullYear();
|
|
348
|
+
const isFuture = citation.year !== null && citation.year > currentYear;
|
|
349
|
+
return {
|
|
350
|
+
ruleId: 'CR-SM-001',
|
|
351
|
+
ruleName: 'DATE_NOT_FUTURE',
|
|
352
|
+
tier: 'semantic',
|
|
353
|
+
passed: !isFuture,
|
|
354
|
+
severity: isFuture ? 'error' : 'pass',
|
|
355
|
+
message: isFuture
|
|
356
|
+
? `FABRICATION INDICATOR: Citation year ${citation.year} is in the future`
|
|
357
|
+
: 'Citation date is not in the future',
|
|
358
|
+
humanAction: isFuture ? 'verify' : 'none',
|
|
359
|
+
};
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
id: 'CR-SM-002',
|
|
364
|
+
name: 'REPORTER_SERIES_MATCHES_YEAR',
|
|
365
|
+
tier: 'semantic',
|
|
366
|
+
check: (citation) => {
|
|
367
|
+
if (!citation.reporter || !citation.year) {
|
|
368
|
+
return {
|
|
369
|
+
ruleId: 'CR-SM-002',
|
|
370
|
+
ruleName: 'REPORTER_SERIES_MATCHES_YEAR',
|
|
371
|
+
tier: 'semantic',
|
|
372
|
+
passed: true,
|
|
373
|
+
severity: 'info',
|
|
374
|
+
message: 'Cannot verify reporter-year match (missing data)',
|
|
375
|
+
humanAction: 'none',
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
const normalizedReporter = citation.reporter.replace(/\s+/g, '');
|
|
379
|
+
const range = REPORTER_YEAR_RANGES[normalizedReporter];
|
|
380
|
+
if (!range) {
|
|
381
|
+
return {
|
|
382
|
+
ruleId: 'CR-SM-002',
|
|
383
|
+
ruleName: 'REPORTER_SERIES_MATCHES_YEAR',
|
|
384
|
+
tier: 'semantic',
|
|
385
|
+
passed: true,
|
|
386
|
+
severity: 'info',
|
|
387
|
+
message: `Year range not tracked for ${citation.reporter}`,
|
|
388
|
+
humanAction: 'none',
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
const inRange = citation.year >= range[0] && citation.year <= range[1];
|
|
392
|
+
return {
|
|
393
|
+
ruleId: 'CR-SM-002',
|
|
394
|
+
ruleName: 'REPORTER_SERIES_MATCHES_YEAR',
|
|
395
|
+
tier: 'semantic',
|
|
396
|
+
passed: inRange,
|
|
397
|
+
severity: inRange ? 'pass' : 'error',
|
|
398
|
+
message: inRange
|
|
399
|
+
? `Year ${citation.year} appropriate for ${citation.reporter}`
|
|
400
|
+
: `IMPLAUSIBLE: ${citation.reporter} published ${range[0]}-${range[1]}, not ${citation.year}`,
|
|
401
|
+
details: inRange ? undefined : `Expected year range: ${range[0]}-${range[1]}`,
|
|
402
|
+
humanAction: inRange ? 'none' : 'verify',
|
|
403
|
+
};
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
id: 'CR-SM-003',
|
|
408
|
+
name: 'VOLUME_RANGE_PLAUSIBLE',
|
|
409
|
+
tier: 'semantic',
|
|
410
|
+
check: (citation) => {
|
|
411
|
+
if (!citation.reporter || !citation.volume) {
|
|
412
|
+
return {
|
|
413
|
+
ruleId: 'CR-SM-003',
|
|
414
|
+
ruleName: 'VOLUME_RANGE_PLAUSIBLE',
|
|
415
|
+
tier: 'semantic',
|
|
416
|
+
passed: true,
|
|
417
|
+
severity: 'info',
|
|
418
|
+
message: 'Cannot verify volume range (missing data)',
|
|
419
|
+
humanAction: 'none',
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
const normalizedReporter = citation.reporter.replace(/\s+/g, '');
|
|
423
|
+
const maxVol = REPORTER_MAX_VOLUMES[normalizedReporter];
|
|
424
|
+
if (!maxVol) {
|
|
425
|
+
return {
|
|
426
|
+
ruleId: 'CR-SM-003',
|
|
427
|
+
ruleName: 'VOLUME_RANGE_PLAUSIBLE',
|
|
428
|
+
tier: 'semantic',
|
|
429
|
+
passed: true,
|
|
430
|
+
severity: 'info',
|
|
431
|
+
message: `Volume range not tracked for ${citation.reporter}`,
|
|
432
|
+
humanAction: 'none',
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
const plausible = citation.volume <= maxVol;
|
|
436
|
+
return {
|
|
437
|
+
ruleId: 'CR-SM-003',
|
|
438
|
+
ruleName: 'VOLUME_RANGE_PLAUSIBLE',
|
|
439
|
+
tier: 'semantic',
|
|
440
|
+
passed: plausible,
|
|
441
|
+
severity: plausible ? 'pass' : 'error',
|
|
442
|
+
message: plausible
|
|
443
|
+
? `Volume ${citation.volume} within expected range for ${citation.reporter}`
|
|
444
|
+
: `IMPLAUSIBLE: Volume ${citation.volume} exceeds known range (~${maxVol}) for ${citation.reporter}`,
|
|
445
|
+
humanAction: plausible ? 'none' : 'verify',
|
|
446
|
+
};
|
|
447
|
+
},
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
id: 'CR-SM-004',
|
|
451
|
+
name: 'COURT_EXISTS_FOR_DATE',
|
|
452
|
+
tier: 'semantic',
|
|
453
|
+
check: (citation, context) => {
|
|
454
|
+
if (!citation.court || !citation.year) {
|
|
455
|
+
return {
|
|
456
|
+
ruleId: 'CR-SM-004',
|
|
457
|
+
ruleName: 'COURT_EXISTS_FOR_DATE',
|
|
458
|
+
tier: 'semantic',
|
|
459
|
+
passed: true,
|
|
460
|
+
severity: 'info',
|
|
461
|
+
message: 'Cannot verify court existence (missing court or year)',
|
|
462
|
+
humanAction: 'none',
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
const courtDb = context?.courtDb;
|
|
466
|
+
if (!courtDb) {
|
|
467
|
+
return {
|
|
468
|
+
ruleId: 'CR-SM-004',
|
|
469
|
+
ruleName: 'COURT_EXISTS_FOR_DATE',
|
|
470
|
+
tier: 'semantic',
|
|
471
|
+
passed: true,
|
|
472
|
+
severity: 'info',
|
|
473
|
+
message: 'No court database available for verification',
|
|
474
|
+
humanAction: 'none',
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
const courtInfo = courtDb.lookupCourt(citation.court);
|
|
478
|
+
if (!courtInfo) {
|
|
479
|
+
return {
|
|
480
|
+
ruleId: 'CR-SM-004',
|
|
481
|
+
ruleName: 'COURT_EXISTS_FOR_DATE',
|
|
482
|
+
tier: 'semantic',
|
|
483
|
+
passed: true,
|
|
484
|
+
severity: 'warning',
|
|
485
|
+
message: `Court "${citation.court}" not in database - cannot verify existence`,
|
|
486
|
+
humanAction: 'verify',
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
const courtExisted = citation.year >= courtInfo.establishedYear;
|
|
490
|
+
return {
|
|
491
|
+
ruleId: 'CR-SM-004',
|
|
492
|
+
ruleName: 'COURT_EXISTS_FOR_DATE',
|
|
493
|
+
tier: 'semantic',
|
|
494
|
+
passed: courtExisted,
|
|
495
|
+
severity: courtExisted ? 'pass' : 'error',
|
|
496
|
+
message: courtExisted
|
|
497
|
+
? `Court existed in ${citation.year}`
|
|
498
|
+
: `IMPLAUSIBLE: ${courtInfo.fullName} established ${courtInfo.establishedYear}, not ${citation.year}`,
|
|
499
|
+
humanAction: courtExisted ? 'none' : 'verify',
|
|
500
|
+
};
|
|
501
|
+
},
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
id: 'CR-SM-005',
|
|
505
|
+
name: 'REPORTER_MATCHES_COURT',
|
|
506
|
+
tier: 'semantic',
|
|
507
|
+
check: (citation, context) => {
|
|
508
|
+
if (!citation.reporter || !citation.court) {
|
|
509
|
+
return {
|
|
510
|
+
ruleId: 'CR-SM-005',
|
|
511
|
+
ruleName: 'REPORTER_MATCHES_COURT',
|
|
512
|
+
tier: 'semantic',
|
|
513
|
+
passed: true,
|
|
514
|
+
severity: 'info',
|
|
515
|
+
message: 'Cannot verify reporter-court match (missing data)',
|
|
516
|
+
humanAction: 'none',
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
const courtDb = context?.courtDb;
|
|
520
|
+
if (!courtDb) {
|
|
521
|
+
// Basic heuristic checks without database
|
|
522
|
+
return performBasicReporterCourtCheck(citation);
|
|
523
|
+
}
|
|
524
|
+
const courtInfo = courtDb.lookupCourt(citation.court);
|
|
525
|
+
if (!courtInfo) {
|
|
526
|
+
return {
|
|
527
|
+
ruleId: 'CR-SM-005',
|
|
528
|
+
ruleName: 'REPORTER_MATCHES_COURT',
|
|
529
|
+
tier: 'semantic',
|
|
530
|
+
passed: true,
|
|
531
|
+
severity: 'info',
|
|
532
|
+
message: 'Court not in database - cannot verify reporter match',
|
|
533
|
+
humanAction: 'none',
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
const reporterMatch = courtDb.isReporterValidForCourt(citation.reporter, citation.court);
|
|
537
|
+
return {
|
|
538
|
+
ruleId: 'CR-SM-005',
|
|
539
|
+
ruleName: 'REPORTER_MATCHES_COURT',
|
|
540
|
+
tier: 'semantic',
|
|
541
|
+
passed: reporterMatch,
|
|
542
|
+
severity: reporterMatch ? 'pass' : 'warning',
|
|
543
|
+
message: reporterMatch
|
|
544
|
+
? `Reporter ${citation.reporter} valid for ${citation.court}`
|
|
545
|
+
: `UNUSUAL: Reporter ${citation.reporter} not typical for ${citation.court}`,
|
|
546
|
+
details: reporterMatch ? undefined : `Expected: ${courtInfo.reporterPrefixes.join(', ')}`,
|
|
547
|
+
humanAction: reporterMatch ? 'none' : 'check_westlaw',
|
|
548
|
+
};
|
|
549
|
+
},
|
|
550
|
+
},
|
|
551
|
+
];
|
|
552
|
+
/**
|
|
553
|
+
* Basic reporter-court compatibility check without database.
|
|
554
|
+
*/
|
|
555
|
+
function performBasicReporterCourtCheck(citation) {
|
|
556
|
+
const reporter = citation.reporter.replace(/\s+/g, '');
|
|
557
|
+
const court = citation.court;
|
|
558
|
+
// Federal circuit courts should use F., F.2d, F.3d, F.4th
|
|
559
|
+
const isCircuitCourt = /Cir\.?$/i.test(court);
|
|
560
|
+
const isFederalReporter = /^F\.(2d|3d|4th)?$/.test(reporter);
|
|
561
|
+
// Federal district courts should use F.Supp
|
|
562
|
+
const isDistrictCourt = /^[NSEWCM]\.?D\.?/i.test(court);
|
|
563
|
+
const isSupplementReporter = /^F\.Supp/.test(reporter);
|
|
564
|
+
// Supreme Court should use U.S., S.Ct., or L.Ed.
|
|
565
|
+
const isSupremeCourt = court === 'U.S.' || /Sup\.?\s*Ct\.?/i.test(court);
|
|
566
|
+
const isSupremeReporter = /^(U\.S\.|S\.Ct\.|L\.Ed)/.test(reporter);
|
|
567
|
+
let passed = true;
|
|
568
|
+
let message = 'Reporter-court combination appears reasonable';
|
|
569
|
+
if (isCircuitCourt && !isFederalReporter) {
|
|
570
|
+
passed = false;
|
|
571
|
+
message = `Circuit courts typically use F./F.2d/F.3d/F.4th, not ${citation.reporter}`;
|
|
572
|
+
}
|
|
573
|
+
else if (isDistrictCourt && !isSupplementReporter && !isFederalReporter) {
|
|
574
|
+
passed = false;
|
|
575
|
+
message = `District courts typically use F.Supp. series, not ${citation.reporter}`;
|
|
576
|
+
}
|
|
577
|
+
else if (isSupremeCourt && !isSupremeReporter) {
|
|
578
|
+
passed = false;
|
|
579
|
+
message = `Supreme Court uses U.S./S.Ct./L.Ed., not ${citation.reporter}`;
|
|
580
|
+
}
|
|
581
|
+
return {
|
|
582
|
+
ruleId: 'CR-SM-005',
|
|
583
|
+
ruleName: 'REPORTER_MATCHES_COURT',
|
|
584
|
+
tier: 'semantic',
|
|
585
|
+
passed,
|
|
586
|
+
severity: passed ? 'pass' : 'warning',
|
|
587
|
+
message,
|
|
588
|
+
humanAction: passed ? 'none' : 'check_westlaw',
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
// =============================================================================
|
|
592
|
+
// CHAIN VALIDATION RULES (Tier 3)
|
|
593
|
+
// =============================================================================
|
|
594
|
+
// These rules apply when there is a parent frame context.
|
|
595
|
+
// Critical for no_fabrication constraints from legal instruments (¶, †).
|
|
596
|
+
// =============================================================================
|
|
597
|
+
const CHAIN_RULES = [
|
|
598
|
+
{
|
|
599
|
+
id: 'CR-CH-001',
|
|
600
|
+
name: 'CITATION_IN_LOCAL_DATABASE',
|
|
601
|
+
tier: 'chain',
|
|
602
|
+
check: (citation, context) => {
|
|
603
|
+
const caseDb = context?.caseDb;
|
|
604
|
+
const noFabricationActive = context?.noFabricationActive ?? false;
|
|
605
|
+
if (!caseDb) {
|
|
606
|
+
// No database available
|
|
607
|
+
if (noFabricationActive) {
|
|
608
|
+
return {
|
|
609
|
+
ruleId: 'CR-CH-001',
|
|
610
|
+
ruleName: 'CITATION_IN_LOCAL_DATABASE',
|
|
611
|
+
tier: 'chain',
|
|
612
|
+
passed: false,
|
|
613
|
+
severity: 'hold',
|
|
614
|
+
message: 'NO_FABRICATION ACTIVE: No case database available for verification',
|
|
615
|
+
details: 'Parent frame has ¶ or † symbol - all citations MUST be verified by human',
|
|
616
|
+
humanAction: 'check_westlaw',
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
return {
|
|
620
|
+
ruleId: 'CR-CH-001',
|
|
621
|
+
ruleName: 'CITATION_IN_LOCAL_DATABASE',
|
|
622
|
+
tier: 'chain',
|
|
623
|
+
passed: true,
|
|
624
|
+
severity: 'info',
|
|
625
|
+
message: 'No case database available',
|
|
626
|
+
humanAction: 'none',
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
const inDatabase = caseDb.lookupCase(citation.caseName, citation.volume, citation.reporter, citation.page);
|
|
630
|
+
if (noFabricationActive && !inDatabase) {
|
|
631
|
+
return {
|
|
632
|
+
ruleId: 'CR-CH-001',
|
|
633
|
+
ruleName: 'CITATION_IN_LOCAL_DATABASE',
|
|
634
|
+
tier: 'chain',
|
|
635
|
+
passed: false,
|
|
636
|
+
severity: 'hold',
|
|
637
|
+
message: 'NO_FABRICATION CONSTRAINT: Citation not found in verified database',
|
|
638
|
+
details: 'Parent frame has ¶ or † symbol - all citations MUST be verified by human',
|
|
639
|
+
humanAction: 'check_westlaw',
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
return {
|
|
643
|
+
ruleId: 'CR-CH-001',
|
|
644
|
+
ruleName: 'CITATION_IN_LOCAL_DATABASE',
|
|
645
|
+
tier: 'chain',
|
|
646
|
+
passed: inDatabase !== null,
|
|
647
|
+
severity: inDatabase ? 'pass' : 'unverifiable',
|
|
648
|
+
message: inDatabase
|
|
649
|
+
? `Citation found in local database (source: ${inDatabase.source})`
|
|
650
|
+
: 'Citation NOT in local database - CANNOT verify existence',
|
|
651
|
+
details: inDatabase
|
|
652
|
+
? undefined
|
|
653
|
+
: 'This does NOT mean the case is fabricated - only that it is not in our verified list',
|
|
654
|
+
humanAction: inDatabase ? 'none' : 'check_westlaw',
|
|
655
|
+
};
|
|
656
|
+
},
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
id: 'CR-CH-002',
|
|
660
|
+
name: 'CASE_NOT_OVERRULED',
|
|
661
|
+
tier: 'chain',
|
|
662
|
+
check: (citation, context) => {
|
|
663
|
+
const caseDb = context?.caseDb;
|
|
664
|
+
if (!caseDb) {
|
|
665
|
+
return {
|
|
666
|
+
ruleId: 'CR-CH-002',
|
|
667
|
+
ruleName: 'CASE_NOT_OVERRULED',
|
|
668
|
+
tier: 'chain',
|
|
669
|
+
passed: true,
|
|
670
|
+
severity: 'info',
|
|
671
|
+
message: 'No case database available - cannot check overruling status',
|
|
672
|
+
humanAction: 'check_westlaw',
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
const caseRecord = caseDb.lookupCase(citation.caseName, citation.volume, citation.reporter, citation.page);
|
|
676
|
+
if (!caseRecord) {
|
|
677
|
+
return {
|
|
678
|
+
ruleId: 'CR-CH-002',
|
|
679
|
+
ruleName: 'CASE_NOT_OVERRULED',
|
|
680
|
+
tier: 'chain',
|
|
681
|
+
passed: true,
|
|
682
|
+
severity: 'info',
|
|
683
|
+
message: 'Case not in database - cannot check overruling status',
|
|
684
|
+
humanAction: 'check_overruled',
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
if (caseRecord.overruled) {
|
|
688
|
+
return {
|
|
689
|
+
ruleId: 'CR-CH-002',
|
|
690
|
+
ruleName: 'CASE_NOT_OVERRULED',
|
|
691
|
+
tier: 'chain',
|
|
692
|
+
passed: false,
|
|
693
|
+
severity: 'warning',
|
|
694
|
+
message: 'WARNING: This case has been overruled',
|
|
695
|
+
details: caseRecord.overruledBy
|
|
696
|
+
? `Overruled by: ${caseRecord.overruledBy}`
|
|
697
|
+
: 'Overruling case not recorded in database',
|
|
698
|
+
humanAction: 'review_holding',
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
return {
|
|
702
|
+
ruleId: 'CR-CH-002',
|
|
703
|
+
ruleName: 'CASE_NOT_OVERRULED',
|
|
704
|
+
tier: 'chain',
|
|
705
|
+
passed: true,
|
|
706
|
+
severity: 'pass',
|
|
707
|
+
message: 'Case not marked as overruled in local database',
|
|
708
|
+
details: 'Note: Local database may be incomplete',
|
|
709
|
+
humanAction: 'none',
|
|
710
|
+
};
|
|
711
|
+
},
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
id: 'CR-CH-003',
|
|
715
|
+
name: 'LEGAL_DOMAIN_CONTEXT',
|
|
716
|
+
tier: 'chain',
|
|
717
|
+
check: (citation, context) => {
|
|
718
|
+
const parentFrame = context?.parentFrame;
|
|
719
|
+
if (!parentFrame) {
|
|
720
|
+
return {
|
|
721
|
+
ruleId: 'CR-CH-003',
|
|
722
|
+
ruleName: 'LEGAL_DOMAIN_CONTEXT',
|
|
723
|
+
tier: 'chain',
|
|
724
|
+
passed: true,
|
|
725
|
+
severity: 'info',
|
|
726
|
+
message: 'No parent frame - cannot check domain context',
|
|
727
|
+
humanAction: 'none',
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
const legalDomainActive = parentFrame.domain === LEGAL_DOMAIN_SYMBOL;
|
|
731
|
+
return {
|
|
732
|
+
ruleId: 'CR-CH-003',
|
|
733
|
+
ruleName: 'LEGAL_DOMAIN_CONTEXT',
|
|
734
|
+
tier: 'chain',
|
|
735
|
+
passed: true,
|
|
736
|
+
severity: legalDomainActive ? 'pass' : 'info',
|
|
737
|
+
message: legalDomainActive
|
|
738
|
+
? `Legal domain (${LEGAL_DOMAIN_SYMBOL}) active - citation validation applies`
|
|
739
|
+
: `Domain is ${parentFrame.domain || 'unset'} - citation may be for reference only`,
|
|
740
|
+
humanAction: 'none',
|
|
741
|
+
};
|
|
742
|
+
},
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
id: 'CR-CH-004',
|
|
746
|
+
name: 'NO_FABRICATION_CONSTRAINT',
|
|
747
|
+
tier: 'chain',
|
|
748
|
+
check: (citation, context) => {
|
|
749
|
+
const parentFrame = context?.parentFrame;
|
|
750
|
+
if (!parentFrame) {
|
|
751
|
+
return {
|
|
752
|
+
ruleId: 'CR-CH-004',
|
|
753
|
+
ruleName: 'NO_FABRICATION_CONSTRAINT',
|
|
754
|
+
tier: 'chain',
|
|
755
|
+
passed: true,
|
|
756
|
+
severity: 'info',
|
|
757
|
+
message: 'No parent frame - cannot check fabrication constraints',
|
|
758
|
+
humanAction: 'none',
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
// Check for legal instrument symbols with no_fabrication constraint
|
|
762
|
+
const hasNoFabricationSymbol = parentFrame.symbols.some(s => NO_FABRICATION_SYMBOLS.includes(s.symbol));
|
|
763
|
+
// Also check if ⛔ (forbidden) is present in constraints
|
|
764
|
+
const hasForbidden = parentFrame.constraints.includes('⛔');
|
|
765
|
+
const noFabricationActive = hasNoFabricationSymbol || hasForbidden;
|
|
766
|
+
if (noFabricationActive) {
|
|
767
|
+
return {
|
|
768
|
+
ruleId: 'CR-CH-004',
|
|
769
|
+
ruleName: 'NO_FABRICATION_CONSTRAINT',
|
|
770
|
+
tier: 'chain',
|
|
771
|
+
passed: true,
|
|
772
|
+
severity: 'hold',
|
|
773
|
+
message: 'NO_FABRICATION constraint active - all citations require verification',
|
|
774
|
+
details: hasNoFabricationSymbol
|
|
775
|
+
? `Legal instrument symbol (${NO_FABRICATION_SYMBOLS.join(' or ')}) present`
|
|
776
|
+
: 'Forbidden constraint (⛔) present in parent frame',
|
|
777
|
+
humanAction: 'check_westlaw',
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
return {
|
|
781
|
+
ruleId: 'CR-CH-004',
|
|
782
|
+
ruleName: 'NO_FABRICATION_CONSTRAINT',
|
|
783
|
+
tier: 'chain',
|
|
784
|
+
passed: true,
|
|
785
|
+
severity: 'pass',
|
|
786
|
+
message: 'No fabrication constraints active',
|
|
787
|
+
humanAction: 'none',
|
|
788
|
+
};
|
|
789
|
+
},
|
|
790
|
+
},
|
|
791
|
+
];
|
|
792
|
+
// =============================================================================
|
|
793
|
+
// CITATION PARSER
|
|
794
|
+
// =============================================================================
|
|
795
|
+
/**
|
|
796
|
+
* Parse a citation string into structured components.
|
|
797
|
+
*/
|
|
798
|
+
function parseCitation(raw) {
|
|
799
|
+
const trimmed = raw.trim();
|
|
800
|
+
// Main case citation pattern:
|
|
801
|
+
// [Case Name], [Volume] [Reporter] [Page](, [Pinpoint])? ([Court] [Year])
|
|
802
|
+
const CASE_CITATION_PATTERN = /^(.+?)\s*,?\s*(\d+)\s+([A-Za-z.\s]+\d*[a-z]*\.?)\s+(\d+)(?:\s*,\s*(\d+))?\s*\(([^)]+?)\s+(\d{4})\)\.?$/;
|
|
803
|
+
// Simpler pattern without court parenthetical
|
|
804
|
+
const SIMPLE_CITATION_PATTERN = /^(.+?)\s*,?\s*(\d+)\s+([A-Za-z.\s]+\d*[a-z]*\.?)\s+(\d+)(?:\s*,\s*(\d+))?\s*\((\d{4})\)\.?$/;
|
|
805
|
+
let match = trimmed.match(CASE_CITATION_PATTERN);
|
|
806
|
+
if (match) {
|
|
807
|
+
return {
|
|
808
|
+
raw,
|
|
809
|
+
normalized: trimmed,
|
|
810
|
+
caseName: match[1].trim(),
|
|
811
|
+
volume: parseInt(match[2], 10),
|
|
812
|
+
reporter: match[3].trim(),
|
|
813
|
+
page: parseInt(match[4], 10),
|
|
814
|
+
pinpoint: match[5] ? parseInt(match[5], 10) : null,
|
|
815
|
+
court: match[6].trim(),
|
|
816
|
+
year: parseInt(match[7], 10),
|
|
817
|
+
citationType: 'case',
|
|
818
|
+
formatStyle: 'bluebook',
|
|
819
|
+
parseConfidence: 0.9,
|
|
820
|
+
unparsedSegments: [],
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
// Try simpler pattern (year only in parenthetical)
|
|
824
|
+
match = trimmed.match(SIMPLE_CITATION_PATTERN);
|
|
825
|
+
if (match) {
|
|
826
|
+
return {
|
|
827
|
+
raw,
|
|
828
|
+
normalized: trimmed,
|
|
829
|
+
caseName: match[1].trim(),
|
|
830
|
+
volume: parseInt(match[2], 10),
|
|
831
|
+
reporter: match[3].trim(),
|
|
832
|
+
page: parseInt(match[4], 10),
|
|
833
|
+
pinpoint: match[5] ? parseInt(match[5], 10) : null,
|
|
834
|
+
court: null,
|
|
835
|
+
year: parseInt(match[6], 10),
|
|
836
|
+
citationType: 'case',
|
|
837
|
+
formatStyle: 'informal',
|
|
838
|
+
parseConfidence: 0.7,
|
|
839
|
+
unparsedSegments: [],
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
// Try to extract what we can
|
|
843
|
+
const partialResult = attemptPartialParse(trimmed);
|
|
844
|
+
if (partialResult) {
|
|
845
|
+
return partialResult;
|
|
846
|
+
}
|
|
847
|
+
// Complete parse failure
|
|
848
|
+
return {
|
|
849
|
+
raw,
|
|
850
|
+
normalized: trimmed,
|
|
851
|
+
caseName: null,
|
|
852
|
+
volume: null,
|
|
853
|
+
reporter: null,
|
|
854
|
+
page: null,
|
|
855
|
+
pinpoint: null,
|
|
856
|
+
court: null,
|
|
857
|
+
year: null,
|
|
858
|
+
citationType: 'unknown',
|
|
859
|
+
formatStyle: 'malformed',
|
|
860
|
+
parseConfidence: 0.1,
|
|
861
|
+
unparsedSegments: [trimmed],
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Attempt to extract partial citation components when full parse fails.
|
|
866
|
+
*/
|
|
867
|
+
function attemptPartialParse(text) {
|
|
868
|
+
let caseName = null;
|
|
869
|
+
let volume = null;
|
|
870
|
+
let reporter = null;
|
|
871
|
+
let page = null;
|
|
872
|
+
let court = null;
|
|
873
|
+
let year = null;
|
|
874
|
+
// Try to find case name (X v. Y pattern)
|
|
875
|
+
const nameMatch = text.match(/^(.+?\s+v\.?\s+.+?)(?:\s*,|\s+\d)/i);
|
|
876
|
+
if (nameMatch) {
|
|
877
|
+
caseName = nameMatch[1].trim();
|
|
878
|
+
}
|
|
879
|
+
// Try to find volume/reporter/page pattern
|
|
880
|
+
const vrpMatch = text.match(/(\d+)\s+([A-Za-z.\s]+\d*[a-z]*\.?)\s+(\d+)/);
|
|
881
|
+
if (vrpMatch) {
|
|
882
|
+
volume = parseInt(vrpMatch[1], 10);
|
|
883
|
+
reporter = vrpMatch[2].trim();
|
|
884
|
+
page = parseInt(vrpMatch[3], 10);
|
|
885
|
+
}
|
|
886
|
+
// Try to find year in parenthetical
|
|
887
|
+
const yearMatch = text.match(/\(.*?(\d{4})\)/);
|
|
888
|
+
if (yearMatch) {
|
|
889
|
+
year = parseInt(yearMatch[1], 10);
|
|
890
|
+
}
|
|
891
|
+
// Try to find court in parenthetical
|
|
892
|
+
const courtMatch = text.match(/\(([^)]*?)\s+\d{4}\)/);
|
|
893
|
+
if (courtMatch && courtMatch[1].trim()) {
|
|
894
|
+
court = courtMatch[1].trim();
|
|
895
|
+
}
|
|
896
|
+
// If we got at least volume/reporter/page, consider it a partial success
|
|
897
|
+
if (volume && reporter && page) {
|
|
898
|
+
return {
|
|
899
|
+
raw: text,
|
|
900
|
+
normalized: text,
|
|
901
|
+
caseName,
|
|
902
|
+
volume,
|
|
903
|
+
reporter,
|
|
904
|
+
page,
|
|
905
|
+
pinpoint: null,
|
|
906
|
+
court,
|
|
907
|
+
year,
|
|
908
|
+
citationType: 'case',
|
|
909
|
+
formatStyle: 'informal',
|
|
910
|
+
parseConfidence: 0.5,
|
|
911
|
+
unparsedSegments: [],
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
return null;
|
|
915
|
+
}
|
|
916
|
+
// =============================================================================
|
|
917
|
+
// CONFIDENCE SCORING
|
|
918
|
+
// =============================================================================
|
|
919
|
+
/**
|
|
920
|
+
* Calculate confidence score based on validation results.
|
|
921
|
+
* CAPPED at MAX_CONFIDENCE_SCORE (0.85) because we cannot fully verify.
|
|
922
|
+
*/
|
|
923
|
+
function calculateConfidenceScore(parsed, structural, semantic, chain) {
|
|
924
|
+
const structuralPassed = structural.filter(r => r.passed).length;
|
|
925
|
+
const structuralTotal = structural.length;
|
|
926
|
+
const semanticPassed = semantic.filter(r => r.passed).length;
|
|
927
|
+
const semanticTotal = semantic.length;
|
|
928
|
+
const chainPassed = chain.filter(r => r.passed).length;
|
|
929
|
+
const chainTotal = Math.max(chain.length, 1);
|
|
930
|
+
const databaseMatch = chain.some(r => r.ruleId === 'CR-CH-001' && r.passed && r.severity === 'pass');
|
|
931
|
+
const knownReporter = parsed.reporter !== null &&
|
|
932
|
+
parsed.formatStyle !== 'malformed';
|
|
933
|
+
const noSemanticErrors = !semantic.some(r => r.severity === 'error');
|
|
934
|
+
const factors = {
|
|
935
|
+
parseConfidence: parsed.parseConfidence,
|
|
936
|
+
structuralScore: structuralTotal > 0 ? structuralPassed / structuralTotal : 0,
|
|
937
|
+
semanticScore: semanticTotal > 0 ? semanticPassed / semanticTotal : 0,
|
|
938
|
+
chainScore: chainPassed / chainTotal,
|
|
939
|
+
databaseMatch,
|
|
940
|
+
knownReporter,
|
|
941
|
+
plausibleDateCourt: noSemanticErrors,
|
|
942
|
+
};
|
|
943
|
+
// Weight factors
|
|
944
|
+
const weights = {
|
|
945
|
+
parseConfidence: 0.20,
|
|
946
|
+
structuralScore: 0.25,
|
|
947
|
+
semanticScore: 0.20,
|
|
948
|
+
chainScore: 0.10,
|
|
949
|
+
databaseMatch: 0.15,
|
|
950
|
+
knownReporter: 0.05,
|
|
951
|
+
plausibleDateCourt: 0.05,
|
|
952
|
+
};
|
|
953
|
+
let score = factors.parseConfidence * weights.parseConfidence +
|
|
954
|
+
factors.structuralScore * weights.structuralScore +
|
|
955
|
+
factors.semanticScore * weights.semanticScore +
|
|
956
|
+
factors.chainScore * weights.chainScore +
|
|
957
|
+
(factors.databaseMatch ? 1 : 0) * weights.databaseMatch +
|
|
958
|
+
(factors.knownReporter ? 1 : 0) * weights.knownReporter +
|
|
959
|
+
(factors.plausibleDateCourt ? 1 : 0) * weights.plausibleDateCourt;
|
|
960
|
+
// Cap at maximum - we CANNOT fully verify
|
|
961
|
+
return Math.min(score, MAX_CONFIDENCE_SCORE);
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* Determine whether a citation should be held for human review.
|
|
965
|
+
*/
|
|
966
|
+
function decideHoldAction(report, context) {
|
|
967
|
+
const parentFrame = context?.parentFrame;
|
|
968
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
969
|
+
// HOLD TRIGGERS (must stop for human review)
|
|
970
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
971
|
+
// 1. No-fabrication constraint active AND citation not in database
|
|
972
|
+
const noFabricationActive = context?.noFabricationActive ?? false;
|
|
973
|
+
const notInDb = report.chain.some(r => r.ruleId === 'CR-CH-001' && !r.passed);
|
|
974
|
+
if (noFabricationActive && notInDb) {
|
|
975
|
+
return {
|
|
976
|
+
action: 'hold',
|
|
977
|
+
reason: 'fabrication_constraint_active',
|
|
978
|
+
humanAction: 'Verify citation exists in Westlaw/Lexis before proceeding',
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
// 2. Future date detected (impossible citation)
|
|
982
|
+
const futureDateError = report.semantic.some(r => r.ruleId === 'CR-SM-001' && !r.passed);
|
|
983
|
+
if (futureDateError) {
|
|
984
|
+
return {
|
|
985
|
+
action: 'hold',
|
|
986
|
+
reason: 'implausible_date_court',
|
|
987
|
+
humanAction: 'Citation date is in the future - verify source',
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
// 3. Reporter series incompatible with year
|
|
991
|
+
const reporterYearError = report.semantic.some(r => r.ruleId === 'CR-SM-002' && r.severity === 'error');
|
|
992
|
+
if (reporterYearError) {
|
|
993
|
+
return {
|
|
994
|
+
action: 'hold',
|
|
995
|
+
reason: 'implausible_date_court',
|
|
996
|
+
humanAction: 'Reporter series did not exist at cited year - verify source',
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
// 4. Volume exceeds known range
|
|
1000
|
+
const volumeError = report.semantic.some(r => r.ruleId === 'CR-SM-003' && r.severity === 'error');
|
|
1001
|
+
if (volumeError) {
|
|
1002
|
+
return {
|
|
1003
|
+
action: 'hold',
|
|
1004
|
+
reason: 'implausible_date_court',
|
|
1005
|
+
humanAction: 'Volume number exceeds known range - verify source',
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
// 5. Court did not exist for date
|
|
1009
|
+
const courtDateError = report.semantic.some(r => r.ruleId === 'CR-SM-004' && r.severity === 'error');
|
|
1010
|
+
if (courtDateError) {
|
|
1011
|
+
return {
|
|
1012
|
+
action: 'hold',
|
|
1013
|
+
reason: 'implausible_date_court',
|
|
1014
|
+
humanAction: 'Court did not exist at cited date - verify source',
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
// 6. Multiple structural errors
|
|
1018
|
+
const structuralErrors = report.structural.filter(r => r.severity === 'error').length;
|
|
1019
|
+
if (structuralErrors >= 2) {
|
|
1020
|
+
return {
|
|
1021
|
+
action: 'hold',
|
|
1022
|
+
reason: 'multiple_issues_detected',
|
|
1023
|
+
humanAction: 'Multiple format errors detected - verify citation source',
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
// 7. Very low confidence score
|
|
1027
|
+
if (report.confidenceScore < 0.30) {
|
|
1028
|
+
return {
|
|
1029
|
+
action: 'hold',
|
|
1030
|
+
reason: 'format_unrecognized',
|
|
1031
|
+
humanAction: 'Low confidence in citation validity - manual review required',
|
|
1032
|
+
};
|
|
1033
|
+
}
|
|
1034
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
1035
|
+
// WARNING TRIGGERS (flag but allow with notice)
|
|
1036
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
1037
|
+
// Semantic warnings
|
|
1038
|
+
const semanticWarnings = report.semantic.filter(r => r.severity === 'warning').length;
|
|
1039
|
+
// Not in database (but format OK and no fabrication constraint)
|
|
1040
|
+
const unverifiable = report.chain.some(r => r.ruleId === 'CR-CH-001' && r.severity === 'unverifiable');
|
|
1041
|
+
// Case marked as overruled
|
|
1042
|
+
const isOverruled = report.chain.some(r => r.ruleId === 'CR-CH-002' && !r.passed);
|
|
1043
|
+
if (semanticWarnings > 0 || unverifiable || isOverruled) {
|
|
1044
|
+
return {
|
|
1045
|
+
action: 'warn',
|
|
1046
|
+
reason: isOverruled ? 'case_overruled' : null,
|
|
1047
|
+
humanAction: null,
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
1051
|
+
// ALLOW (appears valid, but always with caveat)
|
|
1052
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
1053
|
+
return {
|
|
1054
|
+
action: 'allow',
|
|
1055
|
+
reason: null,
|
|
1056
|
+
humanAction: null,
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
// =============================================================================
|
|
1060
|
+
// CITATION VALIDATOR CLASS
|
|
1061
|
+
// =============================================================================
|
|
1062
|
+
/**
|
|
1063
|
+
* Three-tier citation validator.
|
|
1064
|
+
*
|
|
1065
|
+
* CRITICAL: This validator CANNOT verify that cases actually exist.
|
|
1066
|
+
* It can only check formats and local database matches.
|
|
1067
|
+
*/
|
|
1068
|
+
export class CitationValidator {
|
|
1069
|
+
courtDb;
|
|
1070
|
+
caseDb;
|
|
1071
|
+
constructor(courtDb, caseDb) {
|
|
1072
|
+
this.courtDb = courtDb ?? null;
|
|
1073
|
+
this.caseDb = caseDb ?? null;
|
|
1074
|
+
}
|
|
1075
|
+
/**
|
|
1076
|
+
* Parse a citation string into components.
|
|
1077
|
+
*/
|
|
1078
|
+
parse(raw) {
|
|
1079
|
+
return parseCitation(raw);
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* Validate a citation through all three tiers.
|
|
1083
|
+
*/
|
|
1084
|
+
validate(citation, parentFrame) {
|
|
1085
|
+
const parsed = parseCitation(citation);
|
|
1086
|
+
// Determine if no_fabrication is active
|
|
1087
|
+
const noFabricationActive = parentFrame
|
|
1088
|
+
? parentFrame.symbols.some(s => NO_FABRICATION_SYMBOLS.includes(s.symbol)) || parentFrame.constraints.includes('⛔')
|
|
1089
|
+
: false;
|
|
1090
|
+
// Build context for rules
|
|
1091
|
+
const context = {
|
|
1092
|
+
parentFrame,
|
|
1093
|
+
courtDb: this.courtDb ?? undefined,
|
|
1094
|
+
caseDb: this.caseDb ?? undefined,
|
|
1095
|
+
noFabricationActive,
|
|
1096
|
+
};
|
|
1097
|
+
// Run all three tiers
|
|
1098
|
+
const structural = STRUCTURAL_RULES.map(rule => rule.check(parsed, context));
|
|
1099
|
+
const semantic = SEMANTIC_RULES.map(rule => rule.check(parsed, context));
|
|
1100
|
+
const chain = CHAIN_RULES.map(rule => rule.check(parsed, context));
|
|
1101
|
+
// Calculate confidence
|
|
1102
|
+
const confidenceScore = calculateConfidenceScore(parsed, structural, semantic, chain);
|
|
1103
|
+
// Check for errors
|
|
1104
|
+
const allResults = [...structural, ...semantic, ...chain];
|
|
1105
|
+
const hasErrors = allResults.some(r => r.severity === 'error' && !r.passed);
|
|
1106
|
+
const hasHolds = allResults.some(r => r.severity === 'hold');
|
|
1107
|
+
// Build preliminary report for hold decision
|
|
1108
|
+
const prelimReport = {
|
|
1109
|
+
citation,
|
|
1110
|
+
parsedCitation: parsed,
|
|
1111
|
+
valid: !hasErrors,
|
|
1112
|
+
verified: false, // ALWAYS false
|
|
1113
|
+
requiresHumanReview: false, // Will be set by hold decision
|
|
1114
|
+
structural,
|
|
1115
|
+
semantic,
|
|
1116
|
+
chain,
|
|
1117
|
+
confidenceScore,
|
|
1118
|
+
limitationNotice: LIMITATION_NOTICE,
|
|
1119
|
+
timestamp: Date.now(),
|
|
1120
|
+
};
|
|
1121
|
+
// Determine hold action
|
|
1122
|
+
const holdDecision = decideHoldAction(prelimReport, context);
|
|
1123
|
+
return {
|
|
1124
|
+
...prelimReport,
|
|
1125
|
+
requiresHumanReview: holdDecision.action !== 'allow',
|
|
1126
|
+
holdReason: holdDecision.reason ?? undefined,
|
|
1127
|
+
};
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* Validate structural rules only.
|
|
1131
|
+
*/
|
|
1132
|
+
validateStructural(citation) {
|
|
1133
|
+
const parsed = parseCitation(citation);
|
|
1134
|
+
const structural = STRUCTURAL_RULES.map(rule => rule.check(parsed));
|
|
1135
|
+
const confidenceScore = calculateConfidenceScore(parsed, structural, [], []);
|
|
1136
|
+
const hasErrors = structural.some(r => r.severity === 'error' && !r.passed);
|
|
1137
|
+
return {
|
|
1138
|
+
citation,
|
|
1139
|
+
parsedCitation: parsed,
|
|
1140
|
+
valid: !hasErrors,
|
|
1141
|
+
verified: false,
|
|
1142
|
+
requiresHumanReview: confidenceScore < 0.50,
|
|
1143
|
+
structural,
|
|
1144
|
+
semantic: [],
|
|
1145
|
+
chain: [],
|
|
1146
|
+
confidenceScore,
|
|
1147
|
+
limitationNotice: LIMITATION_NOTICE,
|
|
1148
|
+
timestamp: Date.now(),
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* Validate semantic rules only.
|
|
1153
|
+
*/
|
|
1154
|
+
validateSemantic(citation) {
|
|
1155
|
+
const parsed = parseCitation(citation);
|
|
1156
|
+
const context = {
|
|
1157
|
+
courtDb: this.courtDb ?? undefined,
|
|
1158
|
+
};
|
|
1159
|
+
const semantic = SEMANTIC_RULES.map(rule => rule.check(parsed, context));
|
|
1160
|
+
const confidenceScore = calculateConfidenceScore(parsed, [], semantic, []);
|
|
1161
|
+
const hasErrors = semantic.some(r => r.severity === 'error' && !r.passed);
|
|
1162
|
+
return {
|
|
1163
|
+
citation,
|
|
1164
|
+
parsedCitation: parsed,
|
|
1165
|
+
valid: !hasErrors,
|
|
1166
|
+
verified: false,
|
|
1167
|
+
requiresHumanReview: hasErrors,
|
|
1168
|
+
structural: [],
|
|
1169
|
+
semantic,
|
|
1170
|
+
chain: [],
|
|
1171
|
+
confidenceScore,
|
|
1172
|
+
limitationNotice: LIMITATION_NOTICE,
|
|
1173
|
+
timestamp: Date.now(),
|
|
1174
|
+
};
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* Validate chain rules only (requires parent frame).
|
|
1178
|
+
*/
|
|
1179
|
+
validateChain(citation, parentFrame) {
|
|
1180
|
+
const parsed = parseCitation(citation);
|
|
1181
|
+
const noFabricationActive = parentFrame
|
|
1182
|
+
? parentFrame.symbols.some(s => NO_FABRICATION_SYMBOLS.includes(s.symbol))
|
|
1183
|
+
: false;
|
|
1184
|
+
const context = {
|
|
1185
|
+
parentFrame,
|
|
1186
|
+
caseDb: this.caseDb ?? undefined,
|
|
1187
|
+
noFabricationActive,
|
|
1188
|
+
};
|
|
1189
|
+
const chain = CHAIN_RULES.map(rule => rule.check(parsed, context));
|
|
1190
|
+
const confidenceScore = calculateConfidenceScore(parsed, [], [], chain);
|
|
1191
|
+
const hasErrors = chain.some(r => r.severity === 'error' && !r.passed);
|
|
1192
|
+
const hasHolds = chain.some(r => r.severity === 'hold');
|
|
1193
|
+
return {
|
|
1194
|
+
citation,
|
|
1195
|
+
parsedCitation: parsed,
|
|
1196
|
+
valid: !hasErrors,
|
|
1197
|
+
verified: false,
|
|
1198
|
+
requiresHumanReview: hasHolds || noFabricationActive,
|
|
1199
|
+
holdReason: noFabricationActive ? 'fabrication_constraint_active' : undefined,
|
|
1200
|
+
structural: [],
|
|
1201
|
+
semantic: [],
|
|
1202
|
+
chain,
|
|
1203
|
+
confidenceScore,
|
|
1204
|
+
limitationNotice: LIMITATION_NOTICE,
|
|
1205
|
+
timestamp: Date.now(),
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Batch validate multiple citations.
|
|
1210
|
+
*/
|
|
1211
|
+
validateBatch(citations, parentFrame) {
|
|
1212
|
+
const results = citations.map(c => this.validate(c, parentFrame));
|
|
1213
|
+
const validCount = results.filter(r => r.valid).length;
|
|
1214
|
+
const reviewCount = results.filter(r => r.requiresHumanReview).length;
|
|
1215
|
+
const avgConfidence = results.reduce((sum, r) => sum + r.confidenceScore, 0) / results.length;
|
|
1216
|
+
return {
|
|
1217
|
+
results,
|
|
1218
|
+
summary: {
|
|
1219
|
+
total: results.length,
|
|
1220
|
+
valid: validCount,
|
|
1221
|
+
requiresReview: reviewCount,
|
|
1222
|
+
averageConfidence: avgConfidence,
|
|
1223
|
+
},
|
|
1224
|
+
};
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* Get the limitation notice that should be displayed to users.
|
|
1228
|
+
*/
|
|
1229
|
+
getLimitationNotice() {
|
|
1230
|
+
return LIMITATION_NOTICE;
|
|
1231
|
+
}
|
|
1232
|
+
// ===========================================================================
|
|
1233
|
+
// CONVENIENCE ALIAS METHODS
|
|
1234
|
+
// ===========================================================================
|
|
1235
|
+
/**
|
|
1236
|
+
* Alias for validateStructural().
|
|
1237
|
+
* Validates citation format/structure without semantic or chain checks.
|
|
1238
|
+
*/
|
|
1239
|
+
validateFormat(citation) {
|
|
1240
|
+
return this.validateStructural(citation);
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Extract all citations from a text block.
|
|
1244
|
+
* Returns an array of parsed citations found in the text.
|
|
1245
|
+
*/
|
|
1246
|
+
extractCitations(text) {
|
|
1247
|
+
const citations = [];
|
|
1248
|
+
// Pattern to find potential case citations in text
|
|
1249
|
+
// Matches: [Case Name], [Volume] [Reporter] [Page] ([Court/Year])
|
|
1250
|
+
const citationPattern = /[A-Z][A-Za-z'.\-]+(?:\s+[A-Z][A-Za-z'.\-]+)*\s+v\.?\s+[A-Z][A-Za-z'.\-]+(?:\s+[A-Za-z'.\-]+)*\s*,?\s*\d+\s+[A-Za-z.\s]+\d*[a-z]*\.?\s+\d+(?:\s*,\s*\d+)?\s*\([^)]+\d{4}\)/g;
|
|
1251
|
+
const matches = text.match(citationPattern);
|
|
1252
|
+
if (matches) {
|
|
1253
|
+
for (const match of matches) {
|
|
1254
|
+
const parsed = this.parse(match.trim());
|
|
1255
|
+
// Only include if we got meaningful parse results
|
|
1256
|
+
if (parsed.parseConfidence > 0.1) {
|
|
1257
|
+
citations.push(parsed);
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
return citations;
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
// =============================================================================
|
|
1265
|
+
// IN-MEMORY IMPLEMENTATIONS (for testing/development)
|
|
1266
|
+
// =============================================================================
|
|
1267
|
+
/**
|
|
1268
|
+
* Simple in-memory court database with common courts.
|
|
1269
|
+
*/
|
|
1270
|
+
export class InMemoryCourtDatabase {
|
|
1271
|
+
courts = new Map();
|
|
1272
|
+
constructor() {
|
|
1273
|
+
this.initializeDefaultCourts();
|
|
1274
|
+
}
|
|
1275
|
+
initializeDefaultCourts() {
|
|
1276
|
+
const defaultCourts = [
|
|
1277
|
+
{
|
|
1278
|
+
abbreviation: 'U.S.',
|
|
1279
|
+
fullName: 'Supreme Court of the United States',
|
|
1280
|
+
jurisdiction: 'federal',
|
|
1281
|
+
level: 'supreme',
|
|
1282
|
+
establishedYear: 1789,
|
|
1283
|
+
reporterPrefixes: ['U.S.', 'S.Ct.', 'S. Ct.', 'L.Ed.', 'L. Ed.'],
|
|
1284
|
+
},
|
|
1285
|
+
{
|
|
1286
|
+
abbreviation: '1st Cir.',
|
|
1287
|
+
fullName: 'United States Court of Appeals for the First Circuit',
|
|
1288
|
+
jurisdiction: 'federal',
|
|
1289
|
+
level: 'appellate',
|
|
1290
|
+
establishedYear: 1891,
|
|
1291
|
+
reporterPrefixes: ['F.', 'F.2d', 'F.3d', 'F.4th'],
|
|
1292
|
+
},
|
|
1293
|
+
{
|
|
1294
|
+
abbreviation: '2d Cir.',
|
|
1295
|
+
fullName: 'United States Court of Appeals for the Second Circuit',
|
|
1296
|
+
jurisdiction: 'federal',
|
|
1297
|
+
level: 'appellate',
|
|
1298
|
+
establishedYear: 1891,
|
|
1299
|
+
reporterPrefixes: ['F.', 'F.2d', 'F.3d', 'F.4th'],
|
|
1300
|
+
},
|
|
1301
|
+
{
|
|
1302
|
+
abbreviation: '9th Cir.',
|
|
1303
|
+
fullName: 'United States Court of Appeals for the Ninth Circuit',
|
|
1304
|
+
jurisdiction: 'federal',
|
|
1305
|
+
level: 'appellate',
|
|
1306
|
+
establishedYear: 1891,
|
|
1307
|
+
reporterPrefixes: ['F.', 'F.2d', 'F.3d', 'F.4th'],
|
|
1308
|
+
},
|
|
1309
|
+
{
|
|
1310
|
+
abbreviation: 'N.D. Cal.',
|
|
1311
|
+
fullName: 'United States District Court for the Northern District of California',
|
|
1312
|
+
jurisdiction: 'federal',
|
|
1313
|
+
level: 'district',
|
|
1314
|
+
establishedYear: 1850,
|
|
1315
|
+
reporterPrefixes: ['F.Supp.', 'F.Supp.2d', 'F.Supp.3d', 'F. Supp.'],
|
|
1316
|
+
},
|
|
1317
|
+
{
|
|
1318
|
+
abbreviation: 'S.D.N.Y.',
|
|
1319
|
+
fullName: 'United States District Court for the Southern District of New York',
|
|
1320
|
+
jurisdiction: 'federal',
|
|
1321
|
+
level: 'district',
|
|
1322
|
+
establishedYear: 1789,
|
|
1323
|
+
reporterPrefixes: ['F.Supp.', 'F.Supp.2d', 'F.Supp.3d', 'F. Supp.'],
|
|
1324
|
+
},
|
|
1325
|
+
{
|
|
1326
|
+
abbreviation: 'Cal.',
|
|
1327
|
+
fullName: 'Supreme Court of California',
|
|
1328
|
+
jurisdiction: 'state',
|
|
1329
|
+
level: 'supreme',
|
|
1330
|
+
establishedYear: 1850,
|
|
1331
|
+
reporterPrefixes: ['Cal.', 'Cal.2d', 'Cal.3d', 'Cal.4th', 'Cal.5th', 'P.', 'P.2d', 'P.3d'],
|
|
1332
|
+
state: 'California',
|
|
1333
|
+
},
|
|
1334
|
+
{
|
|
1335
|
+
abbreviation: 'N.Y.',
|
|
1336
|
+
fullName: 'New York Court of Appeals',
|
|
1337
|
+
jurisdiction: 'state',
|
|
1338
|
+
level: 'supreme',
|
|
1339
|
+
establishedYear: 1847,
|
|
1340
|
+
reporterPrefixes: ['N.Y.', 'N.Y.2d', 'N.Y.3d', 'N.E.', 'N.E.2d', 'N.E.3d'],
|
|
1341
|
+
state: 'New York',
|
|
1342
|
+
},
|
|
1343
|
+
];
|
|
1344
|
+
for (const court of defaultCourts) {
|
|
1345
|
+
this.courts.set(court.abbreviation.toLowerCase(), court);
|
|
1346
|
+
// Also add normalized version
|
|
1347
|
+
this.courts.set(court.abbreviation.replace(/\s+/g, '').toLowerCase(), court);
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
lookupCourt(abbreviation) {
|
|
1351
|
+
const normalized = abbreviation.replace(/\s+/g, '').toLowerCase();
|
|
1352
|
+
return this.courts.get(normalized) ?? null;
|
|
1353
|
+
}
|
|
1354
|
+
getAllCourts() {
|
|
1355
|
+
const seen = new Set();
|
|
1356
|
+
return Array.from(this.courts.values()).filter(c => {
|
|
1357
|
+
if (seen.has(c.fullName))
|
|
1358
|
+
return false;
|
|
1359
|
+
seen.add(c.fullName);
|
|
1360
|
+
return true;
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
isReporterValidForCourt(reporter, court) {
|
|
1364
|
+
const courtInfo = this.lookupCourt(court);
|
|
1365
|
+
if (!courtInfo)
|
|
1366
|
+
return true; // Unknown court, assume valid
|
|
1367
|
+
const normalizedReporter = reporter.replace(/\s+/g, '');
|
|
1368
|
+
return courtInfo.reporterPrefixes.some(p => normalizedReporter.startsWith(p.replace(/\s+/g, '')));
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
/**
|
|
1372
|
+
* Simple in-memory case database for testing.
|
|
1373
|
+
*/
|
|
1374
|
+
export class InMemoryCaseDatabase {
|
|
1375
|
+
cases = new Map();
|
|
1376
|
+
makeKey(volume, reporter, page) {
|
|
1377
|
+
return `${volume ?? ''}-${(reporter ?? '').replace(/\s+/g, '')}-${page ?? ''}`;
|
|
1378
|
+
}
|
|
1379
|
+
lookupCase(caseName, volume, reporter, page) {
|
|
1380
|
+
if (!volume || !reporter || !page)
|
|
1381
|
+
return null;
|
|
1382
|
+
const key = this.makeKey(volume, reporter, page);
|
|
1383
|
+
return this.cases.get(key) ?? null;
|
|
1384
|
+
}
|
|
1385
|
+
addVerifiedCase(record) {
|
|
1386
|
+
const key = this.makeKey(record.volume, record.reporter, record.page);
|
|
1387
|
+
this.cases.set(key, {
|
|
1388
|
+
...record,
|
|
1389
|
+
addedAt: Date.now(),
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1392
|
+
markOverruled(volume, reporter, page, overruledBy) {
|
|
1393
|
+
const key = this.makeKey(volume, reporter, page);
|
|
1394
|
+
const record = this.cases.get(key);
|
|
1395
|
+
if (!record)
|
|
1396
|
+
return false;
|
|
1397
|
+
this.cases.set(key, {
|
|
1398
|
+
...record,
|
|
1399
|
+
overruled: true,
|
|
1400
|
+
overruledBy,
|
|
1401
|
+
});
|
|
1402
|
+
return true;
|
|
1403
|
+
}
|
|
1404
|
+
getStats() {
|
|
1405
|
+
const all = Array.from(this.cases.values());
|
|
1406
|
+
return {
|
|
1407
|
+
totalCases: all.length,
|
|
1408
|
+
overruledCases: all.filter(c => c.overruled).length,
|
|
1409
|
+
};
|
|
1410
|
+
}
|
|
1411
|
+
/**
|
|
1412
|
+
* Seed with some well-known cases for testing.
|
|
1413
|
+
*/
|
|
1414
|
+
seedTestData() {
|
|
1415
|
+
const testCases = [
|
|
1416
|
+
{
|
|
1417
|
+
caseName: 'Brown v. Board of Education',
|
|
1418
|
+
normalizedName: 'brown v board of education',
|
|
1419
|
+
volume: 347,
|
|
1420
|
+
reporter: 'U.S.',
|
|
1421
|
+
page: 483,
|
|
1422
|
+
court: 'U.S.',
|
|
1423
|
+
year: 1954,
|
|
1424
|
+
jurisdiction: 'federal',
|
|
1425
|
+
overruled: false,
|
|
1426
|
+
source: 'seed_data',
|
|
1427
|
+
},
|
|
1428
|
+
{
|
|
1429
|
+
caseName: 'Marbury v. Madison',
|
|
1430
|
+
normalizedName: 'marbury v madison',
|
|
1431
|
+
volume: 5,
|
|
1432
|
+
reporter: 'U.S.',
|
|
1433
|
+
page: 137,
|
|
1434
|
+
court: 'U.S.',
|
|
1435
|
+
year: 1803,
|
|
1436
|
+
jurisdiction: 'federal',
|
|
1437
|
+
overruled: false,
|
|
1438
|
+
source: 'seed_data',
|
|
1439
|
+
},
|
|
1440
|
+
{
|
|
1441
|
+
caseName: 'Miranda v. Arizona',
|
|
1442
|
+
normalizedName: 'miranda v arizona',
|
|
1443
|
+
volume: 384,
|
|
1444
|
+
reporter: 'U.S.',
|
|
1445
|
+
page: 436,
|
|
1446
|
+
court: 'U.S.',
|
|
1447
|
+
year: 1966,
|
|
1448
|
+
jurisdiction: 'federal',
|
|
1449
|
+
overruled: false,
|
|
1450
|
+
source: 'seed_data',
|
|
1451
|
+
},
|
|
1452
|
+
{
|
|
1453
|
+
caseName: 'Plessy v. Ferguson',
|
|
1454
|
+
normalizedName: 'plessy v ferguson',
|
|
1455
|
+
volume: 163,
|
|
1456
|
+
reporter: 'U.S.',
|
|
1457
|
+
page: 537,
|
|
1458
|
+
court: 'U.S.',
|
|
1459
|
+
year: 1896,
|
|
1460
|
+
jurisdiction: 'federal',
|
|
1461
|
+
overruled: true,
|
|
1462
|
+
overruledBy: 'Brown v. Board of Education, 347 U.S. 483 (1954)',
|
|
1463
|
+
source: 'seed_data',
|
|
1464
|
+
},
|
|
1465
|
+
];
|
|
1466
|
+
for (const c of testCases) {
|
|
1467
|
+
this.addVerifiedCase(c);
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
// =============================================================================
|
|
1472
|
+
// FACTORY AND SINGLETON
|
|
1473
|
+
// =============================================================================
|
|
1474
|
+
/**
|
|
1475
|
+
* Create a citation validator with default in-memory databases.
|
|
1476
|
+
*/
|
|
1477
|
+
export function createCitationValidator() {
|
|
1478
|
+
const courtDb = new InMemoryCourtDatabase();
|
|
1479
|
+
const caseDb = new InMemoryCaseDatabase();
|
|
1480
|
+
caseDb.seedTestData();
|
|
1481
|
+
return new CitationValidator(courtDb, caseDb);
|
|
1482
|
+
}
|
|
1483
|
+
/**
|
|
1484
|
+
* Default singleton instance.
|
|
1485
|
+
*/
|
|
1486
|
+
export const citationValidator = createCitationValidator();
|
|
1487
|
+
//# sourceMappingURL=citation-validator.js.map
|