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,720 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
3
|
+
* SYMBOL EXTRACTOR
|
|
4
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
5
|
+
*
|
|
6
|
+
* Uses Claude API to extract entities and generate PromptSpeak symbols from
|
|
7
|
+
* document content. Implements the 5W+H framework for structured extraction.
|
|
8
|
+
*
|
|
9
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
10
|
+
*/
|
|
11
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
12
|
+
import { getDocumentParser } from './parser.js';
|
|
13
|
+
import { createLogger } from '../core/logging/index.js';
|
|
14
|
+
const logger = createLogger('SymbolExtractor');
|
|
15
|
+
const DEFAULT_RATE_CONFIG = {
|
|
16
|
+
maxRequestsPerMinute: 30,
|
|
17
|
+
maxTokensPerSession: 500_000,
|
|
18
|
+
maxConcurrentRequests: 3,
|
|
19
|
+
requestTimeoutMs: 60_000,
|
|
20
|
+
maxRetries: 3,
|
|
21
|
+
retryBaseDelayMs: 1000,
|
|
22
|
+
trackCosts: true,
|
|
23
|
+
logEvents: true,
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Rate limit error thrown when limits are exceeded.
|
|
27
|
+
*/
|
|
28
|
+
export class RateLimitError extends Error {
|
|
29
|
+
limitType;
|
|
30
|
+
currentValue;
|
|
31
|
+
maxValue;
|
|
32
|
+
retryAfterMs;
|
|
33
|
+
constructor(message, limitType, currentValue, maxValue, retryAfterMs) {
|
|
34
|
+
super(message);
|
|
35
|
+
this.limitType = limitType;
|
|
36
|
+
this.currentValue = currentValue;
|
|
37
|
+
this.maxValue = maxValue;
|
|
38
|
+
this.retryAfterMs = retryAfterMs;
|
|
39
|
+
this.name = 'RateLimitError';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Token bucket rate limiter for controlling API request rate.
|
|
44
|
+
*/
|
|
45
|
+
export class APIRateLimiter {
|
|
46
|
+
config;
|
|
47
|
+
// Token bucket state
|
|
48
|
+
requestTimestamps = [];
|
|
49
|
+
// Session tracking
|
|
50
|
+
sessionTokensUsed = 0;
|
|
51
|
+
sessionStartTime = Date.now();
|
|
52
|
+
sessionRequestCount = 0;
|
|
53
|
+
// Concurrent request tracking
|
|
54
|
+
activeRequests = 0;
|
|
55
|
+
requestQueue = [];
|
|
56
|
+
// Statistics
|
|
57
|
+
stats = {
|
|
58
|
+
totalRequests: 0,
|
|
59
|
+
totalTokens: 0,
|
|
60
|
+
rateLimitHits: 0,
|
|
61
|
+
retries: 0,
|
|
62
|
+
failures: 0,
|
|
63
|
+
averageLatencyMs: 0,
|
|
64
|
+
};
|
|
65
|
+
constructor(config) {
|
|
66
|
+
this.config = { ...DEFAULT_RATE_CONFIG, ...config };
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Update rate limiter configuration.
|
|
70
|
+
*/
|
|
71
|
+
setConfig(config) {
|
|
72
|
+
this.config = { ...this.config, ...config };
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get current configuration.
|
|
76
|
+
*/
|
|
77
|
+
getConfig() {
|
|
78
|
+
return { ...this.config };
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get rate limiter statistics.
|
|
82
|
+
*/
|
|
83
|
+
getStats() {
|
|
84
|
+
return {
|
|
85
|
+
...this.stats,
|
|
86
|
+
sessionTokensUsed: this.sessionTokensUsed,
|
|
87
|
+
sessionDurationMs: Date.now() - this.sessionStartTime,
|
|
88
|
+
activeRequests: this.activeRequests,
|
|
89
|
+
queuedRequests: this.requestQueue.length,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Reset session counters.
|
|
94
|
+
*/
|
|
95
|
+
resetSession() {
|
|
96
|
+
this.sessionTokensUsed = 0;
|
|
97
|
+
this.sessionStartTime = Date.now();
|
|
98
|
+
this.sessionRequestCount = 0;
|
|
99
|
+
if (this.config.logEvents) {
|
|
100
|
+
logger.info('Session reset');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Check if a request can proceed immediately.
|
|
105
|
+
*/
|
|
106
|
+
canProceed() {
|
|
107
|
+
// Check concurrent limit
|
|
108
|
+
if (this.activeRequests >= this.config.maxConcurrentRequests) {
|
|
109
|
+
return {
|
|
110
|
+
allowed: false,
|
|
111
|
+
reason: `Max concurrent requests (${this.config.maxConcurrentRequests}) reached`,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
// Check token limit
|
|
115
|
+
if (this.sessionTokensUsed >= this.config.maxTokensPerSession) {
|
|
116
|
+
return {
|
|
117
|
+
allowed: false,
|
|
118
|
+
reason: `Session token limit (${this.config.maxTokensPerSession}) exceeded`,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
// Check rate limit (sliding window)
|
|
122
|
+
const now = Date.now();
|
|
123
|
+
const windowStart = now - 60_000; // 1 minute window
|
|
124
|
+
// Clean old timestamps
|
|
125
|
+
this.requestTimestamps = this.requestTimestamps.filter(t => t > windowStart);
|
|
126
|
+
if (this.requestTimestamps.length >= this.config.maxRequestsPerMinute) {
|
|
127
|
+
const oldestInWindow = this.requestTimestamps[0];
|
|
128
|
+
const retryAfterMs = oldestInWindow + 60_000 - now;
|
|
129
|
+
return {
|
|
130
|
+
allowed: false,
|
|
131
|
+
retryAfterMs,
|
|
132
|
+
reason: `Rate limit (${this.config.maxRequestsPerMinute}/min) exceeded`,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
return { allowed: true };
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Acquire a slot for making a request. Blocks if rate limited.
|
|
139
|
+
*/
|
|
140
|
+
async acquire() {
|
|
141
|
+
const check = this.canProceed();
|
|
142
|
+
if (!check.allowed) {
|
|
143
|
+
this.stats.rateLimitHits++;
|
|
144
|
+
// If concurrent limit reached, wait in queue
|
|
145
|
+
if (this.activeRequests >= this.config.maxConcurrentRequests) {
|
|
146
|
+
if (this.config.logEvents) {
|
|
147
|
+
logger.info('Queuing request (concurrent limit)');
|
|
148
|
+
}
|
|
149
|
+
await new Promise((resolve, reject) => {
|
|
150
|
+
this.requestQueue.push({ resolve, reject });
|
|
151
|
+
});
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
// If rate limited, wait and retry
|
|
155
|
+
if (check.retryAfterMs) {
|
|
156
|
+
if (this.config.logEvents) {
|
|
157
|
+
logger.info(`Rate limited, waiting ${check.retryAfterMs}ms`);
|
|
158
|
+
}
|
|
159
|
+
await this.sleep(check.retryAfterMs);
|
|
160
|
+
return this.acquire();
|
|
161
|
+
}
|
|
162
|
+
// Token limit exceeded - throw error
|
|
163
|
+
throw new RateLimitError(check.reason || 'Rate limit exceeded', 'tokens', this.sessionTokensUsed, this.config.maxTokensPerSession);
|
|
164
|
+
}
|
|
165
|
+
// Record request
|
|
166
|
+
this.requestTimestamps.push(Date.now());
|
|
167
|
+
this.activeRequests++;
|
|
168
|
+
this.sessionRequestCount++;
|
|
169
|
+
this.stats.totalRequests++;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Release a slot after completing a request.
|
|
173
|
+
*/
|
|
174
|
+
release(tokensUsed = 0) {
|
|
175
|
+
this.activeRequests = Math.max(0, this.activeRequests - 1);
|
|
176
|
+
this.sessionTokensUsed += tokensUsed;
|
|
177
|
+
this.stats.totalTokens += tokensUsed;
|
|
178
|
+
// Process queue
|
|
179
|
+
if (this.requestQueue.length > 0 && this.activeRequests < this.config.maxConcurrentRequests) {
|
|
180
|
+
const next = this.requestQueue.shift();
|
|
181
|
+
if (next) {
|
|
182
|
+
next.resolve();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Execute a function with rate limiting and retry logic.
|
|
188
|
+
*/
|
|
189
|
+
async execute(fn, options) {
|
|
190
|
+
// Pre-check token budget
|
|
191
|
+
if (options?.estimatedTokens) {
|
|
192
|
+
const remaining = this.config.maxTokensPerSession - this.sessionTokensUsed;
|
|
193
|
+
if (options.estimatedTokens > remaining) {
|
|
194
|
+
throw new RateLimitError(`Estimated tokens (${options.estimatedTokens}) exceeds remaining budget (${remaining})`, 'tokens', this.sessionTokensUsed, this.config.maxTokensPerSession);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
let lastError = null;
|
|
198
|
+
let retries = 0;
|
|
199
|
+
for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {
|
|
200
|
+
try {
|
|
201
|
+
await this.acquire();
|
|
202
|
+
const startTime = Date.now();
|
|
203
|
+
// Execute with timeout
|
|
204
|
+
const result = await this.withTimeout(fn(), this.config.requestTimeoutMs);
|
|
205
|
+
const latencyMs = Date.now() - startTime;
|
|
206
|
+
// Update average latency
|
|
207
|
+
this.stats.averageLatencyMs =
|
|
208
|
+
(this.stats.averageLatencyMs * (this.stats.totalRequests - 1) + latencyMs) /
|
|
209
|
+
this.stats.totalRequests;
|
|
210
|
+
// Extract token count if available
|
|
211
|
+
let tokensUsed = 0;
|
|
212
|
+
if (result && typeof result === 'object' && 'usage' in result) {
|
|
213
|
+
const usage = result.usage;
|
|
214
|
+
tokensUsed = (usage?.input_tokens || 0) + (usage?.output_tokens || 0);
|
|
215
|
+
}
|
|
216
|
+
this.release(tokensUsed);
|
|
217
|
+
return { result, tokensUsed, retries, latencyMs };
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
this.release(0);
|
|
221
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
222
|
+
// Don't retry on rate limit errors (non-retryable)
|
|
223
|
+
if (error instanceof RateLimitError) {
|
|
224
|
+
throw error;
|
|
225
|
+
}
|
|
226
|
+
// Check if retryable
|
|
227
|
+
if (attempt < this.config.maxRetries) {
|
|
228
|
+
retries++;
|
|
229
|
+
this.stats.retries++;
|
|
230
|
+
const delay = this.config.retryBaseDelayMs * Math.pow(2, attempt);
|
|
231
|
+
if (this.config.logEvents) {
|
|
232
|
+
logger.info(`Retry ${attempt + 1}/${this.config.maxRetries} after ${delay}ms: ${lastError.message}`);
|
|
233
|
+
}
|
|
234
|
+
await this.sleep(delay);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
this.stats.failures++;
|
|
239
|
+
throw lastError || new Error('Request failed after retries');
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Wrap a promise with a timeout.
|
|
243
|
+
*/
|
|
244
|
+
withTimeout(promise, timeoutMs) {
|
|
245
|
+
return Promise.race([
|
|
246
|
+
promise,
|
|
247
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error(`Request timeout after ${timeoutMs}ms`)), timeoutMs)),
|
|
248
|
+
]);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Sleep for a specified duration.
|
|
252
|
+
*/
|
|
253
|
+
sleep(ms) {
|
|
254
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
// Global rate limiter instance
|
|
258
|
+
let globalRateLimiter = null;
|
|
259
|
+
export function getRateLimiter(config) {
|
|
260
|
+
if (!globalRateLimiter) {
|
|
261
|
+
globalRateLimiter = new APIRateLimiter(config);
|
|
262
|
+
}
|
|
263
|
+
return globalRateLimiter;
|
|
264
|
+
}
|
|
265
|
+
export function resetRateLimiter() {
|
|
266
|
+
globalRateLimiter = null;
|
|
267
|
+
}
|
|
268
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
269
|
+
// CONSTANTS
|
|
270
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
271
|
+
const DEFAULT_MODEL = 'claude-sonnet-4-20250514';
|
|
272
|
+
const MAX_TOKENS = 4096;
|
|
273
|
+
// Symbol type to category mapping
|
|
274
|
+
const SYMBOL_TYPE_CATEGORY = {
|
|
275
|
+
profile: 'COMPANY',
|
|
276
|
+
event: 'EVENT',
|
|
277
|
+
financial: 'COMPANY',
|
|
278
|
+
risk: 'COMPANY',
|
|
279
|
+
competitive: 'SECTOR',
|
|
280
|
+
};
|
|
281
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
282
|
+
// EXTRACTION PROMPTS
|
|
283
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
284
|
+
const ENTITY_EXTRACTION_PROMPT = `You are an expert entity extraction system for financial documents. Extract key entities from the provided document text.
|
|
285
|
+
|
|
286
|
+
<document_context>
|
|
287
|
+
Company: {{COMPANY_NAME}} ({{COMPANY_TICKER}})
|
|
288
|
+
Document Type: {{DOCUMENT_CONTEXT}}
|
|
289
|
+
Fiscal Period: {{FISCAL_PERIOD}}
|
|
290
|
+
</document_context>
|
|
291
|
+
|
|
292
|
+
<extraction_types>
|
|
293
|
+
{{EXTRACTION_TYPES}}
|
|
294
|
+
</extraction_types>
|
|
295
|
+
|
|
296
|
+
<document_text>
|
|
297
|
+
{{DOCUMENT_TEXT}}
|
|
298
|
+
</document_text>
|
|
299
|
+
|
|
300
|
+
Extract entities and return a JSON object with this structure:
|
|
301
|
+
{
|
|
302
|
+
"entities": [
|
|
303
|
+
{
|
|
304
|
+
"type": "person|company|product|event|metric|risk|opportunity",
|
|
305
|
+
"name": "Entity name",
|
|
306
|
+
"description": "Brief description of the entity",
|
|
307
|
+
"confidence": 0.0-1.0,
|
|
308
|
+
"sourceText": "Exact quote from document mentioning this entity",
|
|
309
|
+
"attributes": {
|
|
310
|
+
// Key-value pairs relevant to the entity type
|
|
311
|
+
// For metrics: {"value": "...", "period": "...", "change": "..."}
|
|
312
|
+
// For people: {"title": "...", "role": "..."}
|
|
313
|
+
// For events: {"date": "...", "impact": "..."}
|
|
314
|
+
},
|
|
315
|
+
"relatedEntities": ["names of related entities"]
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
"documentSummary": "Brief summary of the document section"
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
Focus on extracting:
|
|
322
|
+
1. Key executives and their roles
|
|
323
|
+
2. Products, services, and business segments
|
|
324
|
+
3. Financial metrics with specific values
|
|
325
|
+
4. Risk factors and their potential impact
|
|
326
|
+
5. Competitive dynamics and market position
|
|
327
|
+
6. Significant events (acquisitions, launches, partnerships)
|
|
328
|
+
7. Forward-looking statements and guidance
|
|
329
|
+
|
|
330
|
+
Be precise and cite specific source text. Assign confidence based on clarity and specificity of the source.`;
|
|
331
|
+
const SYMBOL_GENERATION_PROMPT = `You are an expert at creating PromptSpeak directive symbols. Convert the extracted entities into structured symbols using the 5W+H framework.
|
|
332
|
+
|
|
333
|
+
<company_context>
|
|
334
|
+
Company: {{COMPANY_NAME}} ({{COMPANY_TICKER}})
|
|
335
|
+
Document Type: {{DOCUMENT_CONTEXT}}
|
|
336
|
+
Fiscal Period: {{FISCAL_PERIOD}}
|
|
337
|
+
</company_context>
|
|
338
|
+
|
|
339
|
+
<extracted_entities>
|
|
340
|
+
{{ENTITIES_JSON}}
|
|
341
|
+
</extracted_entities>
|
|
342
|
+
|
|
343
|
+
<symbol_types_to_create>
|
|
344
|
+
{{SYMBOL_TYPES}}
|
|
345
|
+
</symbol_types_to_create>
|
|
346
|
+
|
|
347
|
+
Generate PromptSpeak symbols for each relevant entity group. Return a JSON array of symbols:
|
|
348
|
+
|
|
349
|
+
{
|
|
350
|
+
"symbols": [
|
|
351
|
+
{
|
|
352
|
+
"suggestedSymbolId": "Ξ.{{TICKER}}.SYMBOL_NAME",
|
|
353
|
+
"category": "COMPANY|PERSON|EVENT|SECTOR|TASK|KNOWLEDGE|QUERY",
|
|
354
|
+
"subcategory": "optional subcategory",
|
|
355
|
+
"who": "Who needs this information / who is the audience",
|
|
356
|
+
"what": "What is being analyzed or described",
|
|
357
|
+
"why": "Why this matters / the purpose",
|
|
358
|
+
"where": "Scope: company, market, geography",
|
|
359
|
+
"when": "Time context (e.g., Q3FY25, 2024)",
|
|
360
|
+
"how": {
|
|
361
|
+
"focus": ["key areas to emphasize"],
|
|
362
|
+
"constraints": ["restrictions and guardrails"],
|
|
363
|
+
"output_format": "expected output style"
|
|
364
|
+
},
|
|
365
|
+
"commanders_intent": "One sentence ultimate goal - the north star",
|
|
366
|
+
"requirements": ["MUST include these elements"],
|
|
367
|
+
"anti_requirements": ["MUST NOT include these elements"],
|
|
368
|
+
"key_terms": ["terms that must appear in output for validation"],
|
|
369
|
+
"tags": ["filtering tags"],
|
|
370
|
+
"confidence": 0.0-1.0,
|
|
371
|
+
"reasoning": "Why this symbol was created and what it captures",
|
|
372
|
+
"sourceEntityIndices": [0, 1, 2]
|
|
373
|
+
}
|
|
374
|
+
]
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
Guidelines for symbol creation:
|
|
378
|
+
1. **Profile symbols** (category: COMPANY): Capture company overview, business model, key products
|
|
379
|
+
- Symbol ID: Ξ.{TICKER}.PROFILE or Ξ.{TICKER}.PROFILE.{ASPECT}
|
|
380
|
+
|
|
381
|
+
2. **Event symbols** (category: EVENT): Capture significant events like earnings, launches, acquisitions
|
|
382
|
+
- Symbol ID: Ξ.E.{EVENT_TYPE}.{TICKER}.{DATE_OR_ID}
|
|
383
|
+
|
|
384
|
+
3. **Financial symbols** (category: COMPANY): Capture key metrics, guidance, financial performance
|
|
385
|
+
- Symbol ID: Ξ.{TICKER}.FINANCIALS.{PERIOD} or Ξ.{TICKER}.METRICS.{PERIOD}
|
|
386
|
+
|
|
387
|
+
4. **Risk symbols** (category: COMPANY): Capture risk factors and their potential impact
|
|
388
|
+
- Symbol ID: Ξ.{TICKER}.RISKS.{PERIOD} or Ξ.{TICKER}.RISK.{RISK_TYPE}
|
|
389
|
+
|
|
390
|
+
5. **Competitive symbols** (category: SECTOR): Capture competitive landscape and market position
|
|
391
|
+
- Symbol ID: Ξ.S.{SECTOR}.{TICKER}.COMPETITIVE
|
|
392
|
+
|
|
393
|
+
For each symbol:
|
|
394
|
+
- commanders_intent should be a single, clear sentence
|
|
395
|
+
- requirements should be specific and verifiable
|
|
396
|
+
- key_terms should be unique identifiers that validate the symbol
|
|
397
|
+
- Assign higher confidence to symbols with more source evidence`;
|
|
398
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
399
|
+
// SYMBOL EXTRACTOR CLASS
|
|
400
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
401
|
+
export class SymbolExtractor {
|
|
402
|
+
client;
|
|
403
|
+
model;
|
|
404
|
+
rateLimiter;
|
|
405
|
+
constructor(apiKey, model, rateLimiterConfig) {
|
|
406
|
+
// Validate API key
|
|
407
|
+
const key = apiKey || process.env.ANTHROPIC_API_KEY;
|
|
408
|
+
if (!key) {
|
|
409
|
+
logger.warn('No API key provided. API calls will fail.');
|
|
410
|
+
}
|
|
411
|
+
this.client = new Anthropic({
|
|
412
|
+
apiKey: key,
|
|
413
|
+
});
|
|
414
|
+
this.model = model || DEFAULT_MODEL;
|
|
415
|
+
this.rateLimiter = getRateLimiter(rateLimiterConfig);
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Get rate limiter statistics.
|
|
419
|
+
*/
|
|
420
|
+
getRateLimiterStats() {
|
|
421
|
+
return this.rateLimiter.getStats();
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Reset the rate limiter session.
|
|
425
|
+
*/
|
|
426
|
+
resetRateLimiterSession() {
|
|
427
|
+
this.rateLimiter.resetSession();
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Update rate limiter configuration.
|
|
431
|
+
*/
|
|
432
|
+
setRateLimiterConfig(config) {
|
|
433
|
+
this.rateLimiter.setConfig(config);
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Extract symbols from a parsed document
|
|
437
|
+
*/
|
|
438
|
+
async extract(document, config) {
|
|
439
|
+
const startTime = Date.now();
|
|
440
|
+
const parser = getDocumentParser();
|
|
441
|
+
// Chunk document for processing
|
|
442
|
+
const chunks = parser.chunkDocument(document);
|
|
443
|
+
// Extract entities from each chunk
|
|
444
|
+
const allEntities = [];
|
|
445
|
+
const warnings = [];
|
|
446
|
+
const errors = [];
|
|
447
|
+
let totalTokens = 0;
|
|
448
|
+
for (const chunk of chunks) {
|
|
449
|
+
try {
|
|
450
|
+
const result = await this.extractEntitiesFromChunk(chunk.text, config, chunk.section);
|
|
451
|
+
allEntities.push(...result.entities);
|
|
452
|
+
totalTokens += result.tokensUsed || 0;
|
|
453
|
+
}
|
|
454
|
+
catch (error) {
|
|
455
|
+
warnings.push(`Failed to extract from chunk ${chunk.chunkIndex}: ${error}`);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
// Deduplicate entities
|
|
459
|
+
const deduplicatedEntities = this.deduplicateEntities(allEntities);
|
|
460
|
+
// Generate symbols from entities
|
|
461
|
+
let symbols = [];
|
|
462
|
+
try {
|
|
463
|
+
symbols = await this.generateSymbols(deduplicatedEntities, config);
|
|
464
|
+
}
|
|
465
|
+
catch (error) {
|
|
466
|
+
errors.push(`Failed to generate symbols: ${error}`);
|
|
467
|
+
}
|
|
468
|
+
const endTime = Date.now();
|
|
469
|
+
return {
|
|
470
|
+
symbols,
|
|
471
|
+
entities: deduplicatedEntities,
|
|
472
|
+
metadata: {
|
|
473
|
+
documentSource: document.source.path || document.source.url || 'content',
|
|
474
|
+
extractedAt: new Date().toISOString(),
|
|
475
|
+
processingTimeMs: endTime - startTime,
|
|
476
|
+
tokensUsed: totalTokens,
|
|
477
|
+
},
|
|
478
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
479
|
+
errors: errors.length > 0 ? errors : undefined,
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Extract entities from a single chunk of text
|
|
484
|
+
*/
|
|
485
|
+
async extractEntitiesFromChunk(text, config, section) {
|
|
486
|
+
// Build extraction types description
|
|
487
|
+
const extractionTypes = config.symbolTypes
|
|
488
|
+
.map((type) => {
|
|
489
|
+
switch (type) {
|
|
490
|
+
case 'profile':
|
|
491
|
+
return '- PROFILE: Company overview, business model, key products/services';
|
|
492
|
+
case 'event':
|
|
493
|
+
return '- EVENT: Significant events, earnings, launches, acquisitions';
|
|
494
|
+
case 'financial':
|
|
495
|
+
return '- FINANCIAL: Key metrics, revenue, margins, guidance';
|
|
496
|
+
case 'risk':
|
|
497
|
+
return '- RISK: Risk factors, challenges, uncertainties';
|
|
498
|
+
case 'competitive':
|
|
499
|
+
return '- COMPETITIVE: Market position, competitors, competitive advantages';
|
|
500
|
+
default:
|
|
501
|
+
return '';
|
|
502
|
+
}
|
|
503
|
+
})
|
|
504
|
+
.filter(Boolean)
|
|
505
|
+
.join('\n');
|
|
506
|
+
const prompt = ENTITY_EXTRACTION_PROMPT
|
|
507
|
+
.replace('{{COMPANY_NAME}}', config.companyName || config.companyTicker)
|
|
508
|
+
.replace('{{COMPANY_TICKER}}', config.companyTicker)
|
|
509
|
+
.replace('{{DOCUMENT_CONTEXT}}', config.documentContext || 'unknown')
|
|
510
|
+
.replace('{{FISCAL_PERIOD}}', config.fiscalPeriod || 'current')
|
|
511
|
+
.replace('{{EXTRACTION_TYPES}}', extractionTypes)
|
|
512
|
+
.replace('{{DOCUMENT_TEXT}}', text);
|
|
513
|
+
// Estimate tokens: ~4 chars per token for input, MAX_TOKENS for output
|
|
514
|
+
const estimatedInputTokens = Math.ceil(prompt.length / 4);
|
|
515
|
+
const estimatedTokens = estimatedInputTokens + MAX_TOKENS;
|
|
516
|
+
// Execute with rate limiting, timeout, and retry
|
|
517
|
+
const { result: response } = await this.rateLimiter.execute(() => this.client.messages.create({
|
|
518
|
+
model: this.model,
|
|
519
|
+
max_tokens: MAX_TOKENS,
|
|
520
|
+
messages: [
|
|
521
|
+
{
|
|
522
|
+
role: 'user',
|
|
523
|
+
content: prompt,
|
|
524
|
+
},
|
|
525
|
+
],
|
|
526
|
+
}), { estimatedTokens });
|
|
527
|
+
// Parse response
|
|
528
|
+
const content = response.content[0];
|
|
529
|
+
if (content.type !== 'text') {
|
|
530
|
+
throw new Error('Unexpected response type from Claude');
|
|
531
|
+
}
|
|
532
|
+
try {
|
|
533
|
+
// Extract JSON from response
|
|
534
|
+
const jsonMatch = content.text.match(/\{[\s\S]*\}/);
|
|
535
|
+
if (!jsonMatch) {
|
|
536
|
+
throw new Error('No JSON found in response');
|
|
537
|
+
}
|
|
538
|
+
const result = JSON.parse(jsonMatch[0]);
|
|
539
|
+
// Add section context to entities
|
|
540
|
+
const entities = result.entities.map((entity) => ({
|
|
541
|
+
...entity,
|
|
542
|
+
position: entity.position || {
|
|
543
|
+
section,
|
|
544
|
+
startIndex: 0,
|
|
545
|
+
endIndex: text.length,
|
|
546
|
+
},
|
|
547
|
+
}));
|
|
548
|
+
return {
|
|
549
|
+
entities,
|
|
550
|
+
tokensUsed: response.usage?.input_tokens + response.usage?.output_tokens,
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
catch (error) {
|
|
554
|
+
throw new Error(`Failed to parse entity extraction response: ${error}`);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Generate symbols from extracted entities
|
|
559
|
+
*/
|
|
560
|
+
async generateSymbols(entities, config) {
|
|
561
|
+
if (entities.length === 0) {
|
|
562
|
+
return [];
|
|
563
|
+
}
|
|
564
|
+
// Build symbol types description
|
|
565
|
+
const symbolTypes = config.symbolTypes
|
|
566
|
+
.map((type) => {
|
|
567
|
+
const category = SYMBOL_TYPE_CATEGORY[type] || 'COMPANY';
|
|
568
|
+
return `- ${type.toUpperCase()} (category: ${category})`;
|
|
569
|
+
})
|
|
570
|
+
.join('\n');
|
|
571
|
+
const prompt = SYMBOL_GENERATION_PROMPT
|
|
572
|
+
.replace(/\{\{COMPANY_NAME\}\}/g, config.companyName || config.companyTicker)
|
|
573
|
+
.replace(/\{\{COMPANY_TICKER\}\}/g, config.companyTicker)
|
|
574
|
+
.replace(/\{\{TICKER\}\}/g, config.companyTicker)
|
|
575
|
+
.replace('{{DOCUMENT_CONTEXT}}', config.documentContext || 'unknown')
|
|
576
|
+
.replace('{{FISCAL_PERIOD}}', config.fiscalPeriod || 'current')
|
|
577
|
+
.replace('{{ENTITIES_JSON}}', JSON.stringify(entities, null, 2))
|
|
578
|
+
.replace('{{SYMBOL_TYPES}}', symbolTypes);
|
|
579
|
+
// Estimate tokens: ~4 chars per token for input, MAX_TOKENS for output
|
|
580
|
+
const estimatedInputTokens = Math.ceil(prompt.length / 4);
|
|
581
|
+
const estimatedTokens = estimatedInputTokens + MAX_TOKENS;
|
|
582
|
+
// Execute with rate limiting, timeout, and retry
|
|
583
|
+
const { result: response } = await this.rateLimiter.execute(() => this.client.messages.create({
|
|
584
|
+
model: this.model,
|
|
585
|
+
max_tokens: MAX_TOKENS,
|
|
586
|
+
messages: [
|
|
587
|
+
{
|
|
588
|
+
role: 'user',
|
|
589
|
+
content: prompt,
|
|
590
|
+
},
|
|
591
|
+
],
|
|
592
|
+
}), { estimatedTokens });
|
|
593
|
+
// Parse response
|
|
594
|
+
const content = response.content[0];
|
|
595
|
+
if (content.type !== 'text') {
|
|
596
|
+
throw new Error('Unexpected response type from Claude');
|
|
597
|
+
}
|
|
598
|
+
try {
|
|
599
|
+
// Extract JSON from response
|
|
600
|
+
const jsonMatch = content.text.match(/\{[\s\S]*\}/);
|
|
601
|
+
if (!jsonMatch) {
|
|
602
|
+
throw new Error('No JSON found in response');
|
|
603
|
+
}
|
|
604
|
+
const result = JSON.parse(jsonMatch[0]);
|
|
605
|
+
// Link source entities to symbols
|
|
606
|
+
const symbols = result.symbols.map((symbol) => {
|
|
607
|
+
const sourceEntities = (symbol.sourceEntityIndices || [])
|
|
608
|
+
.map((i) => entities[i])
|
|
609
|
+
.filter(Boolean);
|
|
610
|
+
return {
|
|
611
|
+
...symbol,
|
|
612
|
+
sourceEntities,
|
|
613
|
+
};
|
|
614
|
+
});
|
|
615
|
+
// Apply max symbols per type limit
|
|
616
|
+
if (config.maxSymbolsPerType) {
|
|
617
|
+
const symbolsByType = {};
|
|
618
|
+
for (const symbol of symbols) {
|
|
619
|
+
const type = symbol.category;
|
|
620
|
+
if (!symbolsByType[type]) {
|
|
621
|
+
symbolsByType[type] = [];
|
|
622
|
+
}
|
|
623
|
+
if (symbolsByType[type].length < config.maxSymbolsPerType) {
|
|
624
|
+
symbolsByType[type].push(symbol);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
return Object.values(symbolsByType).flat();
|
|
628
|
+
}
|
|
629
|
+
return symbols;
|
|
630
|
+
}
|
|
631
|
+
catch (error) {
|
|
632
|
+
throw new Error(`Failed to parse symbol generation response: ${error}`);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Deduplicate entities based on name and type
|
|
637
|
+
*/
|
|
638
|
+
deduplicateEntities(entities) {
|
|
639
|
+
const seen = new Map();
|
|
640
|
+
for (const entity of entities) {
|
|
641
|
+
const key = `${entity.type}:${entity.name.toLowerCase()}`;
|
|
642
|
+
if (seen.has(key)) {
|
|
643
|
+
// Keep the one with higher confidence
|
|
644
|
+
const existing = seen.get(key);
|
|
645
|
+
if (entity.confidence > existing.confidence) {
|
|
646
|
+
// Merge related entities
|
|
647
|
+
const mergedRelated = [
|
|
648
|
+
...(existing.relatedEntities || []),
|
|
649
|
+
...(entity.relatedEntities || []),
|
|
650
|
+
];
|
|
651
|
+
entity.relatedEntities = [...new Set(mergedRelated)];
|
|
652
|
+
seen.set(key, entity);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
else {
|
|
656
|
+
seen.set(key, entity);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
return Array.from(seen.values());
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Validate extracted symbols against the schema
|
|
663
|
+
*/
|
|
664
|
+
validateSymbol(symbol) {
|
|
665
|
+
const errors = [];
|
|
666
|
+
// Check required fields
|
|
667
|
+
if (!symbol.suggestedSymbolId)
|
|
668
|
+
errors.push('Missing suggestedSymbolId');
|
|
669
|
+
if (!symbol.category)
|
|
670
|
+
errors.push('Missing category');
|
|
671
|
+
if (!symbol.who)
|
|
672
|
+
errors.push('Missing who');
|
|
673
|
+
if (!symbol.what)
|
|
674
|
+
errors.push('Missing what');
|
|
675
|
+
if (!symbol.why)
|
|
676
|
+
errors.push('Missing why');
|
|
677
|
+
if (!symbol.where)
|
|
678
|
+
errors.push('Missing where');
|
|
679
|
+
if (!symbol.when)
|
|
680
|
+
errors.push('Missing when');
|
|
681
|
+
if (!symbol.how)
|
|
682
|
+
errors.push('Missing how');
|
|
683
|
+
if (!symbol.commanders_intent)
|
|
684
|
+
errors.push('Missing commanders_intent');
|
|
685
|
+
if (!symbol.requirements || symbol.requirements.length === 0) {
|
|
686
|
+
errors.push('Missing requirements');
|
|
687
|
+
}
|
|
688
|
+
// Validate symbol ID format
|
|
689
|
+
if (symbol.suggestedSymbolId && !symbol.suggestedSymbolId.startsWith('Ξ.')) {
|
|
690
|
+
errors.push('Symbol ID must start with Ξ.');
|
|
691
|
+
}
|
|
692
|
+
// Validate how structure
|
|
693
|
+
if (symbol.how) {
|
|
694
|
+
if (!symbol.how.focus || !Array.isArray(symbol.how.focus)) {
|
|
695
|
+
errors.push('how.focus must be an array');
|
|
696
|
+
}
|
|
697
|
+
if (!symbol.how.constraints || !Array.isArray(symbol.how.constraints)) {
|
|
698
|
+
errors.push('how.constraints must be an array');
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
return {
|
|
702
|
+
valid: errors.length === 0,
|
|
703
|
+
errors,
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
708
|
+
// SINGLETON INSTANCE
|
|
709
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
710
|
+
let symbolExtractor = null;
|
|
711
|
+
export function getSymbolExtractor(apiKey, model) {
|
|
712
|
+
if (!symbolExtractor) {
|
|
713
|
+
symbolExtractor = new SymbolExtractor(apiKey, model);
|
|
714
|
+
}
|
|
715
|
+
return symbolExtractor;
|
|
716
|
+
}
|
|
717
|
+
export function resetSymbolExtractor() {
|
|
718
|
+
symbolExtractor = null;
|
|
719
|
+
}
|
|
720
|
+
//# sourceMappingURL=extractor.js.map
|