opencode-rehydar 0.14.1 → 0.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +54 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +74 -0
- package/dist/browser.js.map +1 -0
- package/dist/core/anonymizer.d.ts +309 -0
- package/dist/core/anonymizer.d.ts.map +1 -0
- package/dist/core/anonymizer.js +555 -0
- package/dist/core/anonymizer.js.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/crypto/index.d.ts +6 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/crypto/index.js +6 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/crypto/pii-map-crypto.d.ts +114 -0
- package/dist/crypto/pii-map-crypto.d.ts.map +1 -0
- package/dist/crypto/pii-map-crypto.js +228 -0
- package/dist/crypto/pii-map-crypto.js.map +1 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +72 -0
- package/dist/index.js.map +1 -0
- package/dist/ner/bio-decoder.d.ts +64 -0
- package/dist/ner/bio-decoder.d.ts.map +1 -0
- package/dist/ner/bio-decoder.js +218 -0
- package/dist/ner/bio-decoder.js.map +1 -0
- package/dist/ner/index.d.ts +12 -0
- package/dist/ner/index.d.ts.map +1 -0
- package/dist/ner/index.js +12 -0
- package/dist/ner/index.js.map +1 -0
- package/dist/ner/inference-server-client.d.ts +81 -0
- package/dist/ner/inference-server-client.d.ts.map +1 -0
- package/dist/ner/inference-server-client.js +120 -0
- package/dist/ner/inference-server-client.js.map +1 -0
- package/dist/ner/inference-server-ner-model.d.ts +43 -0
- package/dist/ner/inference-server-ner-model.d.ts.map +1 -0
- package/dist/ner/inference-server-ner-model.js +119 -0
- package/dist/ner/inference-server-ner-model.js.map +1 -0
- package/dist/ner/model-manager.d.ts +111 -0
- package/dist/ner/model-manager.d.ts.map +1 -0
- package/dist/ner/model-manager.js +334 -0
- package/dist/ner/model-manager.js.map +1 -0
- package/dist/ner/ner-model.d.ts +172 -0
- package/dist/ner/ner-model.d.ts.map +1 -0
- package/dist/ner/ner-model.js +514 -0
- package/dist/ner/ner-model.js.map +1 -0
- package/dist/ner/onnx-runtime.browser.d.ts +46 -0
- package/dist/ner/onnx-runtime.browser.d.ts.map +1 -0
- package/dist/ner/onnx-runtime.browser.js +90 -0
- package/dist/ner/onnx-runtime.browser.js.map +1 -0
- package/dist/ner/onnx-runtime.d.ts +72 -0
- package/dist/ner/onnx-runtime.d.ts.map +1 -0
- package/dist/ner/onnx-runtime.js +132 -0
- package/dist/ner/onnx-runtime.js.map +1 -0
- package/dist/ner/token-window.d.ts +19 -0
- package/dist/ner/token-window.d.ts.map +1 -0
- package/dist/ner/token-window.js +101 -0
- package/dist/ner/token-window.js.map +1 -0
- package/dist/ner/tokenizer.d.ts +142 -0
- package/dist/ner/tokenizer.d.ts.map +1 -0
- package/dist/ner/tokenizer.js +362 -0
- package/dist/ner/tokenizer.js.map +1 -0
- package/dist/opencode-plugin/git-identity.d.ts +3 -0
- package/dist/opencode-plugin/git-identity.d.ts.map +1 -0
- package/dist/opencode-plugin/git-identity.js +37 -0
- package/dist/opencode-plugin/git-identity.js.map +1 -0
- package/dist/opencode-plugin/github-username.d.ts +3 -0
- package/dist/opencode-plugin/github-username.d.ts.map +1 -0
- package/dist/opencode-plugin/github-username.js +41 -0
- package/dist/opencode-plugin/github-username.js.map +1 -0
- package/dist/opencode-plugin/identity-recognizer.d.ts +5 -0
- package/dist/opencode-plugin/identity-recognizer.d.ts.map +1 -0
- package/dist/opencode-plugin/identity-recognizer.js +21 -0
- package/dist/opencode-plugin/identity-recognizer.js.map +1 -0
- package/dist/opencode-plugin/index.d.ts +7 -0
- package/dist/opencode-plugin/index.d.ts.map +1 -0
- package/dist/opencode-plugin/index.js +6 -0
- package/dist/opencode-plugin/index.js.map +1 -0
- package/dist/opencode-plugin/plugin.d.ts +39 -0
- package/dist/opencode-plugin/plugin.d.ts.map +1 -0
- package/dist/opencode-plugin/plugin.js +294 -0
- package/dist/opencode-plugin/plugin.js.map +1 -0
- package/dist/opencode-plugin/types.d.ts +33 -0
- package/dist/opencode-plugin/types.d.ts.map +1 -0
- package/dist/opencode-plugin/types.js +5 -0
- package/dist/opencode-plugin/types.js.map +1 -0
- package/dist/opencode-plugin/v2/anon-state.d.ts +12 -0
- package/dist/opencode-plugin/v2/anon-state.d.ts.map +1 -0
- package/dist/opencode-plugin/v2/anon-state.js +14 -0
- package/dist/opencode-plugin/v2/anon-state.js.map +1 -0
- package/dist/opencode-plugin/v2/deep-rehydrate.d.ts +13 -0
- package/dist/opencode-plugin/v2/deep-rehydrate.d.ts.map +1 -0
- package/dist/opencode-plugin/v2/deep-rehydrate.js +33 -0
- package/dist/opencode-plugin/v2/deep-rehydrate.js.map +1 -0
- package/dist/opencode-plugin/v2/index.d.ts +17 -0
- package/dist/opencode-plugin/v2/index.d.ts.map +1 -0
- package/dist/opencode-plugin/v2/index.js +17 -0
- package/dist/opencode-plugin/v2/index.js.map +1 -0
- package/dist/opencode-plugin/v2/logger.d.ts +24 -0
- package/dist/opencode-plugin/v2/logger.d.ts.map +1 -0
- package/dist/opencode-plugin/v2/logger.js +73 -0
- package/dist/opencode-plugin/v2/logger.js.map +1 -0
- package/dist/opencode-plugin/v2/options.d.ts +63 -0
- package/dist/opencode-plugin/v2/options.d.ts.map +1 -0
- package/dist/opencode-plugin/v2/options.js +183 -0
- package/dist/opencode-plugin/v2/options.js.map +1 -0
- package/dist/opencode-plugin/v2/register-hooks.d.ts +43 -0
- package/dist/opencode-plugin/v2/register-hooks.d.ts.map +1 -0
- package/dist/opencode-plugin/v2/register-hooks.js +160 -0
- package/dist/opencode-plugin/v2/register-hooks.js.map +1 -0
- package/dist/opencode-plugin/v2/rehydrate-tail.d.ts +101 -0
- package/dist/opencode-plugin/v2/rehydrate-tail.d.ts.map +1 -0
- package/dist/opencode-plugin/v2/rehydrate-tail.js +147 -0
- package/dist/opencode-plugin/v2/rehydrate-tail.js.map +1 -0
- package/dist/opencode-plugin/v2/response-rehydrate.d.ts +78 -0
- package/dist/opencode-plugin/v2/response-rehydrate.d.ts.map +1 -0
- package/dist/opencode-plugin/v2/response-rehydrate.js +210 -0
- package/dist/opencode-plugin/v2/response-rehydrate.js.map +1 -0
- package/dist/opencode-plugin/v2/scrub-messages.d.ts +39 -0
- package/dist/opencode-plugin/v2/scrub-messages.d.ts.map +1 -0
- package/dist/opencode-plugin/v2/scrub-messages.js +260 -0
- package/dist/opencode-plugin/v2/scrub-messages.js.map +1 -0
- package/dist/opencode-plugin/v2/sessions.d.ts +17 -0
- package/dist/opencode-plugin/v2/sessions.d.ts.map +1 -0
- package/dist/opencode-plugin/v2/sessions.js +23 -0
- package/dist/opencode-plugin/v2/sessions.js.map +1 -0
- package/dist/opencode-plugin/v2/sse.d.ts +101 -0
- package/dist/opencode-plugin/v2/sse.d.ts.map +1 -0
- package/dist/opencode-plugin/v2/sse.js +235 -0
- package/dist/opencode-plugin/v2/sse.js.map +1 -0
- package/dist/opencode-plugin/v2/types.d.ts +188 -0
- package/dist/opencode-plugin/v2/types.d.ts.map +1 -0
- package/dist/opencode-plugin/v2/types.js +10 -0
- package/dist/opencode-plugin/v2/types.js.map +1 -0
- package/dist/opencode-plugin/vcs-command.d.ts +3 -0
- package/dist/opencode-plugin/vcs-command.d.ts.map +1 -0
- package/dist/opencode-plugin/vcs-command.js +34 -0
- package/dist/opencode-plugin/vcs-command.js.map +1 -0
- package/dist/pipeline/index.d.ts +12 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +12 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/prenormalize.d.ts +48 -0
- package/dist/pipeline/prenormalize.d.ts.map +1 -0
- package/dist/pipeline/prenormalize.js +94 -0
- package/dist/pipeline/prenormalize.js.map +1 -0
- package/dist/pipeline/resolver.d.ts +56 -0
- package/dist/pipeline/resolver.d.ts.map +1 -0
- package/dist/pipeline/resolver.js +239 -0
- package/dist/pipeline/resolver.js.map +1 -0
- package/dist/pipeline/semantic-data-loader.d.ts +171 -0
- package/dist/pipeline/semantic-data-loader.d.ts.map +1 -0
- package/dist/pipeline/semantic-data-loader.js +677 -0
- package/dist/pipeline/semantic-data-loader.js.map +1 -0
- package/dist/pipeline/semantic-enricher.d.ts +112 -0
- package/dist/pipeline/semantic-enricher.d.ts.map +1 -0
- package/dist/pipeline/semantic-enricher.js +322 -0
- package/dist/pipeline/semantic-enricher.js.map +1 -0
- package/dist/pipeline/tagger.d.ts +121 -0
- package/dist/pipeline/tagger.d.ts.map +1 -0
- package/dist/pipeline/tagger.js +545 -0
- package/dist/pipeline/tagger.js.map +1 -0
- package/dist/pipeline/title-extractor.d.ts +79 -0
- package/dist/pipeline/title-extractor.d.ts.map +1 -0
- package/dist/pipeline/title-extractor.js +801 -0
- package/dist/pipeline/title-extractor.js.map +1 -0
- package/dist/pipeline/validator.d.ts +65 -0
- package/dist/pipeline/validator.d.ts.map +1 -0
- package/dist/pipeline/validator.js +292 -0
- package/dist/pipeline/validator.js.map +1 -0
- package/dist/proxy/index.d.ts +13 -0
- package/dist/proxy/index.d.ts.map +1 -0
- package/dist/proxy/index.js +12 -0
- package/dist/proxy/index.js.map +1 -0
- package/dist/proxy/providers/anthropic.d.ts +28 -0
- package/dist/proxy/providers/anthropic.d.ts.map +1 -0
- package/dist/proxy/providers/anthropic.js +265 -0
- package/dist/proxy/providers/anthropic.js.map +1 -0
- package/dist/proxy/providers/index.d.ts +19 -0
- package/dist/proxy/providers/index.d.ts.map +1 -0
- package/dist/proxy/providers/index.js +41 -0
- package/dist/proxy/providers/index.js.map +1 -0
- package/dist/proxy/providers/openai.d.ts +27 -0
- package/dist/proxy/providers/openai.d.ts.map +1 -0
- package/dist/proxy/providers/openai.js +203 -0
- package/dist/proxy/providers/openai.js.map +1 -0
- package/dist/proxy/providers/streaming-tool-loop.d.ts +12 -0
- package/dist/proxy/providers/streaming-tool-loop.d.ts.map +1 -0
- package/dist/proxy/providers/streaming-tool-loop.js +223 -0
- package/dist/proxy/providers/streaming-tool-loop.js.map +1 -0
- package/dist/proxy/providers/types.d.ts +109 -0
- package/dist/proxy/providers/types.d.ts.map +1 -0
- package/dist/proxy/providers/types.js +2 -0
- package/dist/proxy/providers/types.js.map +1 -0
- package/dist/proxy/proxy-server.d.ts +61 -0
- package/dist/proxy/proxy-server.d.ts.map +1 -0
- package/dist/proxy/proxy-server.js +146 -0
- package/dist/proxy/proxy-server.js.map +1 -0
- package/dist/proxy/rehydra-fetch.d.ts +35 -0
- package/dist/proxy/rehydra-fetch.d.ts.map +1 -0
- package/dist/proxy/rehydra-fetch.js +631 -0
- package/dist/proxy/rehydra-fetch.js.map +1 -0
- package/dist/proxy/rehydra-proxy.d.ts +40 -0
- package/dist/proxy/rehydra-proxy.d.ts.map +1 -0
- package/dist/proxy/rehydra-proxy.js +150 -0
- package/dist/proxy/rehydra-proxy.js.map +1 -0
- package/dist/proxy/sse-parser.d.ts +59 -0
- package/dist/proxy/sse-parser.d.ts.map +1 -0
- package/dist/proxy/sse-parser.js +112 -0
- package/dist/proxy/sse-parser.js.map +1 -0
- package/dist/proxy/system-instruction.d.ts +19 -0
- package/dist/proxy/system-instruction.d.ts.map +1 -0
- package/dist/proxy/system-instruction.js +33 -0
- package/dist/proxy/system-instruction.js.map +1 -0
- package/dist/proxy/tool-loop-stream.d.ts +7 -0
- package/dist/proxy/tool-loop-stream.d.ts.map +1 -0
- package/dist/proxy/tool-loop-stream.js +65 -0
- package/dist/proxy/tool-loop-stream.js.map +1 -0
- package/dist/proxy/types.d.ts +138 -0
- package/dist/proxy/types.d.ts.map +1 -0
- package/dist/proxy/types.js +5 -0
- package/dist/proxy/types.js.map +1 -0
- package/dist/proxy/wrap-client.d.ts +47 -0
- package/dist/proxy/wrap-client.d.ts.map +1 -0
- package/dist/proxy/wrap-client.js +70 -0
- package/dist/proxy/wrap-client.js.map +1 -0
- package/dist/recognizers/address.d.ts +2 -0
- package/dist/recognizers/address.d.ts.map +1 -0
- package/dist/recognizers/address.js +23 -0
- package/dist/recognizers/address.js.map +1 -0
- package/dist/recognizers/base.d.ts +78 -0
- package/dist/recognizers/base.d.ts.map +1 -0
- package/dist/recognizers/base.js +100 -0
- package/dist/recognizers/base.js.map +1 -0
- package/dist/recognizers/bic-swift.d.ts +10 -0
- package/dist/recognizers/bic-swift.d.ts.map +1 -0
- package/dist/recognizers/bic-swift.js +107 -0
- package/dist/recognizers/bic-swift.js.map +1 -0
- package/dist/recognizers/credit-card.d.ts +32 -0
- package/dist/recognizers/credit-card.d.ts.map +1 -0
- package/dist/recognizers/credit-card.js +160 -0
- package/dist/recognizers/credit-card.js.map +1 -0
- package/dist/recognizers/custom-id.d.ts +28 -0
- package/dist/recognizers/custom-id.d.ts.map +1 -0
- package/dist/recognizers/custom-id.js +116 -0
- package/dist/recognizers/custom-id.js.map +1 -0
- package/dist/recognizers/date.d.ts +10 -0
- package/dist/recognizers/date.d.ts.map +1 -0
- package/dist/recognizers/date.js +228 -0
- package/dist/recognizers/date.js.map +1 -0
- package/dist/recognizers/email.d.ts +10 -0
- package/dist/recognizers/email.d.ts.map +1 -0
- package/dist/recognizers/email.js +75 -0
- package/dist/recognizers/email.js.map +1 -0
- package/dist/recognizers/iban.d.ts +14 -0
- package/dist/recognizers/iban.d.ts.map +1 -0
- package/dist/recognizers/iban.js +67 -0
- package/dist/recognizers/iban.js.map +1 -0
- package/dist/recognizers/index.d.ts +25 -0
- package/dist/recognizers/index.d.ts.map +1 -0
- package/dist/recognizers/index.js +53 -0
- package/dist/recognizers/index.js.map +1 -0
- package/dist/recognizers/ip-address.d.ts +14 -0
- package/dist/recognizers/ip-address.d.ts.map +1 -0
- package/dist/recognizers/ip-address.js +183 -0
- package/dist/recognizers/ip-address.js.map +1 -0
- package/dist/recognizers/phone.d.ts +10 -0
- package/dist/recognizers/phone.d.ts.map +1 -0
- package/dist/recognizers/phone.js +145 -0
- package/dist/recognizers/phone.js.map +1 -0
- package/dist/recognizers/postal-code.d.ts +16 -0
- package/dist/recognizers/postal-code.d.ts.map +1 -0
- package/dist/recognizers/postal-code.js +42 -0
- package/dist/recognizers/postal-code.js.map +1 -0
- package/dist/recognizers/registry.d.ts +59 -0
- package/dist/recognizers/registry.d.ts.map +1 -0
- package/dist/recognizers/registry.js +113 -0
- package/dist/recognizers/registry.js.map +1 -0
- package/dist/recognizers/secrets/api-key.d.ts +6 -0
- package/dist/recognizers/secrets/api-key.d.ts.map +1 -0
- package/dist/recognizers/secrets/api-key.js +40 -0
- package/dist/recognizers/secrets/api-key.js.map +1 -0
- package/dist/recognizers/secrets/aws-credentials.d.ts +7 -0
- package/dist/recognizers/secrets/aws-credentials.d.ts.map +1 -0
- package/dist/recognizers/secrets/aws-credentials.js +68 -0
- package/dist/recognizers/secrets/aws-credentials.js.map +1 -0
- package/dist/recognizers/secrets/config-secret.d.ts +8 -0
- package/dist/recognizers/secrets/config-secret.d.ts.map +1 -0
- package/dist/recognizers/secrets/config-secret.js +59 -0
- package/dist/recognizers/secrets/config-secret.js.map +1 -0
- package/dist/recognizers/secrets/connection-string.d.ts +6 -0
- package/dist/recognizers/secrets/connection-string.d.ts.map +1 -0
- package/dist/recognizers/secrets/connection-string.js +40 -0
- package/dist/recognizers/secrets/connection-string.js.map +1 -0
- package/dist/recognizers/secrets/env-var.d.ts +8 -0
- package/dist/recognizers/secrets/env-var.d.ts.map +1 -0
- package/dist/recognizers/secrets/env-var.js +54 -0
- package/dist/recognizers/secrets/env-var.js.map +1 -0
- package/dist/recognizers/secrets/index.d.ts +22 -0
- package/dist/recognizers/secrets/index.d.ts.map +1 -0
- package/dist/recognizers/secrets/index.js +41 -0
- package/dist/recognizers/secrets/index.js.map +1 -0
- package/dist/recognizers/secrets/jwt.d.ts +6 -0
- package/dist/recognizers/secrets/jwt.d.ts.map +1 -0
- package/dist/recognizers/secrets/jwt.js +47 -0
- package/dist/recognizers/secrets/jwt.js.map +1 -0
- package/dist/recognizers/secrets/key-patterns.d.ts +10 -0
- package/dist/recognizers/secrets/key-patterns.d.ts.map +1 -0
- package/dist/recognizers/secrets/key-patterns.js +15 -0
- package/dist/recognizers/secrets/key-patterns.js.map +1 -0
- package/dist/recognizers/secrets/literal-value.d.ts +10 -0
- package/dist/recognizers/secrets/literal-value.d.ts.map +1 -0
- package/dist/recognizers/secrets/literal-value.js +48 -0
- package/dist/recognizers/secrets/literal-value.js.map +1 -0
- package/dist/recognizers/secrets/private-key.d.ts +6 -0
- package/dist/recognizers/secrets/private-key.d.ts.map +1 -0
- package/dist/recognizers/secrets/private-key.js +16 -0
- package/dist/recognizers/secrets/private-key.js.map +1 -0
- package/dist/recognizers/url.d.ts +14 -0
- package/dist/recognizers/url.d.ts.map +1 -0
- package/dist/recognizers/url.js +121 -0
- package/dist/recognizers/url.js.map +1 -0
- package/dist/storage/browser.d.ts +13 -0
- package/dist/storage/browser.d.ts.map +1 -0
- package/dist/storage/browser.js +13 -0
- package/dist/storage/browser.js.map +1 -0
- package/dist/storage/in-memory.d.ts +60 -0
- package/dist/storage/in-memory.d.ts.map +1 -0
- package/dist/storage/in-memory.js +108 -0
- package/dist/storage/in-memory.js.map +1 -0
- package/dist/storage/index.d.ts +11 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +11 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/indexeddb.d.ts +69 -0
- package/dist/storage/indexeddb.d.ts.map +1 -0
- package/dist/storage/indexeddb.js +274 -0
- package/dist/storage/indexeddb.js.map +1 -0
- package/dist/storage/session-base.d.ts +34 -0
- package/dist/storage/session-base.d.ts.map +1 -0
- package/dist/storage/session-base.js +122 -0
- package/dist/storage/session-base.js.map +1 -0
- package/dist/storage/session.d.ts +19 -0
- package/dist/storage/session.d.ts.map +1 -0
- package/dist/storage/session.js +31 -0
- package/dist/storage/session.js.map +1 -0
- package/dist/storage/sqlite.d.ts +80 -0
- package/dist/storage/sqlite.d.ts.map +1 -0
- package/dist/storage/sqlite.js +255 -0
- package/dist/storage/sqlite.js.map +1 -0
- package/dist/storage/types.d.ts +208 -0
- package/dist/storage/types.d.ts.map +1 -0
- package/dist/storage/types.js +6 -0
- package/dist/storage/types.js.map +1 -0
- package/dist/streaming/anonymizer-stream.d.ts +63 -0
- package/dist/streaming/anonymizer-stream.d.ts.map +1 -0
- package/dist/streaming/anonymizer-stream.js +184 -0
- package/dist/streaming/anonymizer-stream.js.map +1 -0
- package/dist/streaming/index.d.ts +9 -0
- package/dist/streaming/index.d.ts.map +1 -0
- package/dist/streaming/index.js +8 -0
- package/dist/streaming/index.js.map +1 -0
- package/dist/streaming/sentence-buffer.d.ts +78 -0
- package/dist/streaming/sentence-buffer.d.ts.map +1 -0
- package/dist/streaming/sentence-buffer.js +239 -0
- package/dist/streaming/sentence-buffer.js.map +1 -0
- package/dist/streaming/stream-factory.d.ts +38 -0
- package/dist/streaming/stream-factory.d.ts.map +1 -0
- package/dist/streaming/stream-factory.js +69 -0
- package/dist/streaming/stream-factory.js.map +1 -0
- package/dist/streaming/types.d.ts +121 -0
- package/dist/streaming/types.d.ts.map +1 -0
- package/dist/streaming/types.js +5 -0
- package/dist/streaming/types.js.map +1 -0
- package/dist/types/index.d.ts +269 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +95 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/pii-types.d.ts +64 -0
- package/dist/types/pii-types.d.ts.map +1 -0
- package/dist/types/pii-types.js +153 -0
- package/dist/types/pii-types.js.map +1 -0
- package/dist/utils/iban-checksum.d.ts +23 -0
- package/dist/utils/iban-checksum.d.ts.map +1 -0
- package/dist/utils/iban-checksum.js +106 -0
- package/dist/utils/iban-checksum.js.map +1 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +11 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/json-walk.d.ts +21 -0
- package/dist/utils/json-walk.d.ts.map +1 -0
- package/dist/utils/json-walk.js +44 -0
- package/dist/utils/json-walk.js.map +1 -0
- package/dist/utils/luhn.d.ts +17 -0
- package/dist/utils/luhn.d.ts.map +1 -0
- package/dist/utils/luhn.js +55 -0
- package/dist/utils/luhn.js.map +1 -0
- package/dist/utils/offsets.d.ts +86 -0
- package/dist/utils/offsets.d.ts.map +1 -0
- package/dist/utils/offsets.js +124 -0
- package/dist/utils/offsets.js.map +1 -0
- package/dist/utils/path.d.ts +34 -0
- package/dist/utils/path.d.ts.map +1 -0
- package/dist/utils/path.js +96 -0
- package/dist/utils/path.js.map +1 -0
- package/dist/utils/regex.d.ts +11 -0
- package/dist/utils/regex.d.ts.map +1 -0
- package/dist/utils/regex.js +14 -0
- package/dist/utils/regex.js.map +1 -0
- package/dist/utils/storage-browser.d.ts +51 -0
- package/dist/utils/storage-browser.d.ts.map +1 -0
- package/dist/utils/storage-browser.js +381 -0
- package/dist/utils/storage-browser.js.map +1 -0
- package/dist/utils/storage-node.d.ts +51 -0
- package/dist/utils/storage-node.d.ts.map +1 -0
- package/dist/utils/storage-node.js +153 -0
- package/dist/utils/storage-node.js.map +1 -0
- package/dist/utils/storage.browser.d.ts +75 -0
- package/dist/utils/storage.browser.d.ts.map +1 -0
- package/dist/utils/storage.browser.js +69 -0
- package/dist/utils/storage.browser.js.map +1 -0
- package/dist/utils/storage.d.ts +73 -0
- package/dist/utils/storage.d.ts.map +1 -0
- package/dist/utils/storage.js +69 -0
- package/dist/utils/storage.js.map +1 -0
- package/index.js +14 -13
- package/package.json +19 -5
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rehydra Proxy Middleware
|
|
3
|
+
* Generic (Request → Response) proxy that anonymizes LLM requests
|
|
4
|
+
* and rehydrates responses. Uses standard Web APIs — no framework dependency.
|
|
5
|
+
*/
|
|
6
|
+
import type { RehydraProxyConfig } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Creates a proxy middleware function that forwards requests to an upstream
|
|
9
|
+
* LLM API, anonymizing requests and rehydrating responses.
|
|
10
|
+
*
|
|
11
|
+
* Returns a standard `(Request) => Promise<Response>` function that works
|
|
12
|
+
* with any framework supporting Web Request/Response APIs.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* // Hono
|
|
17
|
+
* import { Hono } from 'hono';
|
|
18
|
+
* const app = new Hono();
|
|
19
|
+
* const proxy = createRehydraProxy({
|
|
20
|
+
* upstream: 'https://api.openai.com',
|
|
21
|
+
* keyProvider: new ConfigKeyProvider(process.env.PII_KEY!),
|
|
22
|
+
* piiStorageProvider: new SQLitePIIStorageProvider('proxy.db'),
|
|
23
|
+
* });
|
|
24
|
+
* app.post('/v1/*', (c) => proxy(c.req.raw));
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* // Bun.serve
|
|
30
|
+
* const proxy = createRehydraProxy({ upstream: 'https://api.openai.com', ... });
|
|
31
|
+
* Bun.serve({
|
|
32
|
+
* fetch(req) {
|
|
33
|
+
* if (new URL(req.url).pathname.startsWith('/v1/')) return proxy(req);
|
|
34
|
+
* return new Response('Not Found', { status: 404 });
|
|
35
|
+
* },
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function createRehydraProxy(config: RehydraProxyConfig): (request: Request) => Promise<Response>;
|
|
40
|
+
//# sourceMappingURL=rehydra-proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rehydra-proxy.d.ts","sourceRoot":"","sources":["../../src/proxy/rehydra-proxy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAYrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,kBAAkB,GACzB,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CA0FzC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rehydra Proxy Middleware
|
|
3
|
+
* Generic (Request → Response) proxy that anonymizes LLM requests
|
|
4
|
+
* and rehydrates responses. Uses standard Web APIs — no framework dependency.
|
|
5
|
+
*/
|
|
6
|
+
import { createRehydraFetch } from "./rehydra-fetch.js";
|
|
7
|
+
const DEFAULT_FORWARD_HEADERS = [
|
|
8
|
+
"authorization",
|
|
9
|
+
"content-type",
|
|
10
|
+
"x-api-key",
|
|
11
|
+
"anthropic-version",
|
|
12
|
+
"anthropic-beta",
|
|
13
|
+
"openai-organization",
|
|
14
|
+
"openai-project",
|
|
15
|
+
];
|
|
16
|
+
/**
|
|
17
|
+
* Creates a proxy middleware function that forwards requests to an upstream
|
|
18
|
+
* LLM API, anonymizing requests and rehydrating responses.
|
|
19
|
+
*
|
|
20
|
+
* Returns a standard `(Request) => Promise<Response>` function that works
|
|
21
|
+
* with any framework supporting Web Request/Response APIs.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* // Hono
|
|
26
|
+
* import { Hono } from 'hono';
|
|
27
|
+
* const app = new Hono();
|
|
28
|
+
* const proxy = createRehydraProxy({
|
|
29
|
+
* upstream: 'https://api.openai.com',
|
|
30
|
+
* keyProvider: new ConfigKeyProvider(process.env.PII_KEY!),
|
|
31
|
+
* piiStorageProvider: new SQLitePIIStorageProvider('proxy.db'),
|
|
32
|
+
* });
|
|
33
|
+
* app.post('/v1/*', (c) => proxy(c.req.raw));
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* // Bun.serve
|
|
39
|
+
* const proxy = createRehydraProxy({ upstream: 'https://api.openai.com', ... });
|
|
40
|
+
* Bun.serve({
|
|
41
|
+
* fetch(req) {
|
|
42
|
+
* if (new URL(req.url).pathname.startsWith('/v1/')) return proxy(req);
|
|
43
|
+
* return new Response('Not Found', { status: 404 });
|
|
44
|
+
* },
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export function createRehydraProxy(config) {
|
|
49
|
+
const forwardHeaders = config.forwardHeaders ?? DEFAULT_FORWARD_HEADERS;
|
|
50
|
+
const upstream = config.upstream.replace(/\/$/, ""); // Remove trailing slash
|
|
51
|
+
// Base path of the upstream, used only for overlap detection. Invalid upstream URL will throw at fetch time
|
|
52
|
+
const upstreamPathname = tryGetPathname(upstream);
|
|
53
|
+
const upstreamPathSegments = upstreamPathname.split("/").filter(Boolean);
|
|
54
|
+
// Create the underlying Rehydra fetch wrapper
|
|
55
|
+
const rehydraFetch = createRehydraFetch(config);
|
|
56
|
+
// Skip the per-request overlap check when there is no listener or upstream path segments
|
|
57
|
+
const shouldCheckPathOverlap = config.onPathOverlapWarning !== undefined && upstreamPathSegments.length > 0;
|
|
58
|
+
return async (request) => {
|
|
59
|
+
// Build upstream URL
|
|
60
|
+
const requestUrl = new URL(request.url);
|
|
61
|
+
let pathname = requestUrl.pathname;
|
|
62
|
+
// Strip prefix if configured
|
|
63
|
+
if (config.stripPrefix !== undefined && config.stripPrefix !== "" && pathname.startsWith(config.stripPrefix)) {
|
|
64
|
+
pathname = pathname.slice(config.stripPrefix.length);
|
|
65
|
+
if (!pathname.startsWith("/")) {
|
|
66
|
+
pathname = "/" + pathname;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const upstreamUrl = upstream + pathname + requestUrl.search;
|
|
70
|
+
// Detect overlapping path and warn
|
|
71
|
+
if (shouldCheckPathOverlap) {
|
|
72
|
+
const requestPathSegments = pathname.split("/").filter(Boolean);
|
|
73
|
+
const overlappingSegments = findPathSegmentOverlap(upstreamPathSegments, requestPathSegments);
|
|
74
|
+
if (overlappingSegments.length > 0) {
|
|
75
|
+
try {
|
|
76
|
+
const result = config.onPathOverlapWarning?.({
|
|
77
|
+
upstreamBaseUrl: upstream,
|
|
78
|
+
overlappingSegments,
|
|
79
|
+
});
|
|
80
|
+
void Promise.resolve(result).catch(() => {
|
|
81
|
+
// Async callback failures must not interrupt proxying.
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// Synchronous callback failures must not interrupt proxying.
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Filter headers to forward
|
|
90
|
+
const headers = new Headers();
|
|
91
|
+
for (const name of forwardHeaders) {
|
|
92
|
+
const value = request.headers.get(name);
|
|
93
|
+
if (value !== null) {
|
|
94
|
+
headers.set(name, value);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Inject proxy-configured API key, replacing any client auth headers.
|
|
98
|
+
// This is needed when the client uses OAuth (e.g. Claude Code with Max)
|
|
99
|
+
// but the upstream only accepts API key auth.
|
|
100
|
+
if (config.apiKey !== undefined) {
|
|
101
|
+
headers.delete("authorization");
|
|
102
|
+
if (upstreamUrl.includes("anthropic")) {
|
|
103
|
+
headers.set("x-api-key", config.apiKey);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
headers.set("authorization", `Bearer ${config.apiKey}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else if (headers.has("x-api-key") && headers.has("authorization")) {
|
|
110
|
+
// When client sends both, prefer API key over OAuth token
|
|
111
|
+
headers.delete("authorization");
|
|
112
|
+
}
|
|
113
|
+
// Disable upstream compression — the proxy reads and modifies the response
|
|
114
|
+
// body, so we need it uncompressed. Without this, Node's fetch may
|
|
115
|
+
// auto-decompress but leave content-encoding headers, causing ZlibError
|
|
116
|
+
// on clients that try to decompress the already-decompressed body.
|
|
117
|
+
headers.set("accept-encoding", "identity");
|
|
118
|
+
// Forward via rehydraFetch (which handles anonymization/rehydration)
|
|
119
|
+
return rehydraFetch(upstreamUrl, {
|
|
120
|
+
method: request.method,
|
|
121
|
+
headers,
|
|
122
|
+
body: request.body,
|
|
123
|
+
// @ts-expect-error - duplex is needed for streaming request bodies
|
|
124
|
+
duplex: "half",
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
// Returns the URL's pathname, or an empty string if invalid
|
|
129
|
+
function tryGetPathname(url) {
|
|
130
|
+
try {
|
|
131
|
+
return new URL(url).pathname;
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
return "";
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// Finds the overlapping path segments between the upstream and request paths.
|
|
138
|
+
function findPathSegmentOverlap(upstreamSegments, requestSegments) {
|
|
139
|
+
const maxOverlapLength = Math.min(upstreamSegments.length, requestSegments.length);
|
|
140
|
+
for (let length = maxOverlapLength; length > 0; length--) {
|
|
141
|
+
const upstreamSuffix = upstreamSegments.slice(-length);
|
|
142
|
+
const requestPrefix = requestSegments.slice(0, length);
|
|
143
|
+
const matches = upstreamSuffix.every((segment, index) => segment === requestPrefix[index]);
|
|
144
|
+
if (matches) {
|
|
145
|
+
return upstreamSuffix;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return [];
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=rehydra-proxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rehydra-proxy.js","sourceRoot":"","sources":["../../src/proxy/rehydra-proxy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,MAAM,uBAAuB,GAAG;IAC9B,eAAe;IACf,cAAc;IACd,WAAW;IACX,mBAAmB;IACnB,gBAAgB;IAChB,qBAAqB;IACrB,gBAAgB;CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAA0B;IAE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AG,cAAc,CAAC,KAAK,CAClC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,aAAa,CAAC,KAAK,CAAC,CACrD,CAAC;QAEF,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,cAAc,CAAC;QACxB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-Sent Events (SSE) Parser
|
|
3
|
+
* Parses SSE protocol streams, handling chunk boundaries correctly.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A parsed SSE event
|
|
7
|
+
*/
|
|
8
|
+
export interface SSEEvent {
|
|
9
|
+
/** Event type (defaults to "message") */
|
|
10
|
+
event: string;
|
|
11
|
+
/** Event data (concatenated from all data: lines) */
|
|
12
|
+
data: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Parses a Server-Sent Events stream chunk by chunk.
|
|
16
|
+
*
|
|
17
|
+
* SSE protocol format:
|
|
18
|
+
* ```
|
|
19
|
+
* event: message_start
|
|
20
|
+
* data: {"type": "content"}
|
|
21
|
+
*
|
|
22
|
+
* data: {"text": "Hello"}
|
|
23
|
+
*
|
|
24
|
+
* data: [DONE]
|
|
25
|
+
*
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* Each event is one or more field lines terminated by a blank line.
|
|
29
|
+
*/
|
|
30
|
+
export declare class SSEParser {
|
|
31
|
+
private buffer;
|
|
32
|
+
/**
|
|
33
|
+
* Feed a chunk of text from the SSE stream.
|
|
34
|
+
* Returns zero or more fully parsed events.
|
|
35
|
+
*/
|
|
36
|
+
parse(chunk: string): SSEEvent[];
|
|
37
|
+
/**
|
|
38
|
+
* Flush remaining buffer content (call on stream end).
|
|
39
|
+
* Returns any remaining events.
|
|
40
|
+
*/
|
|
41
|
+
flush(): SSEEvent[];
|
|
42
|
+
/**
|
|
43
|
+
* Reset the parser state.
|
|
44
|
+
*/
|
|
45
|
+
reset(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Parse a single raw SSE event block into an SSEEvent.
|
|
48
|
+
*/
|
|
49
|
+
private parseEvent;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Check if a string is the SSE stream termination sentinel.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isSSEDone(data: string): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Serialize an SSE event back to wire format.
|
|
57
|
+
*/
|
|
58
|
+
export declare function serializeSSEEvent(event: SSEEvent): string;
|
|
59
|
+
//# sourceMappingURL=sse-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse-parser.d.ts","sourceRoot":"","sources":["../../src/proxy/sse-parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAM;IAEpB;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,EAAE;IAoBhC;;;OAGG;IACH,KAAK,IAAI,QAAQ,EAAE;IAUnB;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,OAAO,CAAC,UAAU;CAuBnB;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAWzD"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-Sent Events (SSE) Parser
|
|
3
|
+
* Parses SSE protocol streams, handling chunk boundaries correctly.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Parses a Server-Sent Events stream chunk by chunk.
|
|
7
|
+
*
|
|
8
|
+
* SSE protocol format:
|
|
9
|
+
* ```
|
|
10
|
+
* event: message_start
|
|
11
|
+
* data: {"type": "content"}
|
|
12
|
+
*
|
|
13
|
+
* data: {"text": "Hello"}
|
|
14
|
+
*
|
|
15
|
+
* data: [DONE]
|
|
16
|
+
*
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* Each event is one or more field lines terminated by a blank line.
|
|
20
|
+
*/
|
|
21
|
+
export class SSEParser {
|
|
22
|
+
buffer = "";
|
|
23
|
+
/**
|
|
24
|
+
* Feed a chunk of text from the SSE stream.
|
|
25
|
+
* Returns zero or more fully parsed events.
|
|
26
|
+
*/
|
|
27
|
+
parse(chunk) {
|
|
28
|
+
this.buffer += chunk;
|
|
29
|
+
const events = [];
|
|
30
|
+
// Split on double newline (event boundary)
|
|
31
|
+
// Handle both \n\n and \r\n\r\n
|
|
32
|
+
const parts = this.buffer.split(/\n\n|\r\n\r\n/);
|
|
33
|
+
// Last part may be incomplete — keep it in the buffer
|
|
34
|
+
this.buffer = parts.pop() ?? "";
|
|
35
|
+
for (const part of parts) {
|
|
36
|
+
if (part.trim() === "")
|
|
37
|
+
continue;
|
|
38
|
+
const event = this.parseEvent(part);
|
|
39
|
+
if (event)
|
|
40
|
+
events.push(event);
|
|
41
|
+
}
|
|
42
|
+
return events;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Flush remaining buffer content (call on stream end).
|
|
46
|
+
* Returns any remaining events.
|
|
47
|
+
*/
|
|
48
|
+
flush() {
|
|
49
|
+
if (this.buffer.trim() === "") {
|
|
50
|
+
this.buffer = "";
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
const event = this.parseEvent(this.buffer);
|
|
54
|
+
this.buffer = "";
|
|
55
|
+
return event ? [event] : [];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Reset the parser state.
|
|
59
|
+
*/
|
|
60
|
+
reset() {
|
|
61
|
+
this.buffer = "";
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Parse a single raw SSE event block into an SSEEvent.
|
|
65
|
+
*/
|
|
66
|
+
parseEvent(raw) {
|
|
67
|
+
let data = "";
|
|
68
|
+
let eventType = "message";
|
|
69
|
+
for (const line of raw.split(/\n|\r\n/)) {
|
|
70
|
+
if (line.startsWith("data: ")) {
|
|
71
|
+
// Concatenate multiple data: lines with newlines
|
|
72
|
+
data += (data ? "\n" : "") + line.slice(6);
|
|
73
|
+
}
|
|
74
|
+
else if (line === "data:") {
|
|
75
|
+
// Empty data line
|
|
76
|
+
data += (data ? "\n" : "");
|
|
77
|
+
}
|
|
78
|
+
else if (line.startsWith("event: ")) {
|
|
79
|
+
eventType = line.slice(7).trim();
|
|
80
|
+
}
|
|
81
|
+
else if (line.startsWith("event:")) {
|
|
82
|
+
eventType = line.slice(6).trim();
|
|
83
|
+
}
|
|
84
|
+
// Ignore 'id:', 'retry:', and comments (lines starting with ':')
|
|
85
|
+
}
|
|
86
|
+
if (data === "" && !raw.includes("data:"))
|
|
87
|
+
return null;
|
|
88
|
+
return { event: eventType, data };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Check if a string is the SSE stream termination sentinel.
|
|
93
|
+
*/
|
|
94
|
+
export function isSSEDone(data) {
|
|
95
|
+
return data.trim() === "[DONE]";
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Serialize an SSE event back to wire format.
|
|
99
|
+
*/
|
|
100
|
+
export function serializeSSEEvent(event) {
|
|
101
|
+
let result = "";
|
|
102
|
+
if (event.event !== "message") {
|
|
103
|
+
result += `event: ${event.event}\n`;
|
|
104
|
+
}
|
|
105
|
+
// Split data on newlines for multi-line data fields
|
|
106
|
+
for (const line of event.data.split("\n")) {
|
|
107
|
+
result += `data: ${line}\n`;
|
|
108
|
+
}
|
|
109
|
+
result += "\n";
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=sse-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse-parser.js","sourceRoot":"","sources":["../../src/proxy/sse-parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,SAAS;IACZ,MAAM,GAAG,EAAE,CAAC;IAEpB;;;OAGG;IACH,KAAK,CAAC,KAAa;QACjB,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC;QACrB,MAAM,MAAM,GAAe,EAAE,CAAC;QAE9B,2CAA2C;QAC3C,gCAAgC;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAEjD,sDAAsD;QACtD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;QAEhC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;gBAAE,SAAS;YACjC,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YACpC,IAAI,KAAK;gBAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAC9B,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;YACjB,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAA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,CAAC,IAAY;IACpC,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,QAAQ,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAe;IAC/C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC9B,MAAM,IAAI,UAAU,KAAK,CAAC,KAAK,IAAI,CAAC;IACtC,CAAC;IACD,oDAAoD;IACpD,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,SAAS,IAAI,IAAI,CAAC;IAC9B,CAAC;IACD,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default system instruction for PII placeholder handling.
|
|
3
|
+
*
|
|
4
|
+
* Injected into the system prompt when anonymization produces PII replacements,
|
|
5
|
+
* telling the model to treat PII placeholders as opaque pass-through values.
|
|
6
|
+
*
|
|
7
|
+
* Shared between the proxy layer and the OpenCode plugin.
|
|
8
|
+
*/
|
|
9
|
+
import type { TagFormat } from "../types/index.js";
|
|
10
|
+
/**
|
|
11
|
+
* Builds a system instruction string using the configured tag format.
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildPIISystemInstruction(tagFormat?: TagFormat): string;
|
|
14
|
+
/**
|
|
15
|
+
* Default system instruction using XML-style tag format.
|
|
16
|
+
* Kept for backwards compatibility.
|
|
17
|
+
*/
|
|
18
|
+
export declare const DEFAULT_PII_SYSTEM_INSTRUCTION: string;
|
|
19
|
+
//# sourceMappingURL=system-instruction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-instruction.d.ts","sourceRoot":"","sources":["../../src/proxy/system-instruction.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,GAAE,SAA8B,GACxC,MAAM,CAeR;AAED;;;GAGG;AACH,eAAO,MAAM,8BAA8B,QAA8B,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default system instruction for PII placeholder handling.
|
|
3
|
+
*
|
|
4
|
+
* Injected into the system prompt when anonymization produces PII replacements,
|
|
5
|
+
* telling the model to treat PII placeholders as opaque pass-through values.
|
|
6
|
+
*
|
|
7
|
+
* Shared between the proxy layer and the OpenCode plugin.
|
|
8
|
+
*/
|
|
9
|
+
import { DEFAULT_TAG_FORMAT } from "../types/index.js";
|
|
10
|
+
/**
|
|
11
|
+
* Builds a system instruction string using the configured tag format.
|
|
12
|
+
*/
|
|
13
|
+
export function buildPIISystemInstruction(tagFormat = DEFAULT_TAG_FORMAT) {
|
|
14
|
+
const keyword = tagFormat.keyword ?? "PII";
|
|
15
|
+
const exampleTag = `${tagFormat.open}${keyword} type="..." id="..."${tagFormat.close}`;
|
|
16
|
+
const emailTag = `${tagFormat.open}${keyword} type="EMAIL" id="1"${tagFormat.close}`;
|
|
17
|
+
return [
|
|
18
|
+
`Some values in this conversation have been replaced with PII placeholders like ${exampleTag}.`,
|
|
19
|
+
"These are real values that have been masked for privacy during transit.",
|
|
20
|
+
"They will be automatically rehydrated (replaced with the original values) before any command is executed locally.",
|
|
21
|
+
"IMPORTANT: Treat these placeholders exactly like real values.",
|
|
22
|
+
"Do NOT try to resolve, decode, remove, or work around them.",
|
|
23
|
+
"Use them as-is in commands, code, and tool calls.",
|
|
24
|
+
`For example, if a user message contains ${emailTag}, pass that exact placeholder as the email argument in any tool call.`,
|
|
25
|
+
"The rehydration layer handles the rest.",
|
|
26
|
+
].join(" ");
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Default system instruction using XML-style tag format.
|
|
30
|
+
* Kept for backwards compatibility.
|
|
31
|
+
*/
|
|
32
|
+
export const DEFAULT_PII_SYSTEM_INSTRUCTION = buildPIISystemInstruction();
|
|
33
|
+
//# sourceMappingURL=system-instruction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-instruction.js","sourceRoot":"","sources":["../../src/proxy/system-instruction.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;GAEG;AACH,MAAM,UAAU,yBAAyB,CACvC,YAAuB,kBAAkB;IAEzC,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,IAAI,KAAK,CAAC;IAC3C,MAAM,UAAU,GAAG,GAAG,SAAS,CAAC,IAAI,GAAG,OAAO,uBAAuB,SAAS,CAAC,KAAK,EAAE,CAAC;IACvF,MAAM,QAAQ,GAAG,GAAG,SAAS,CAAC,IAAI,GAAG,OAAO,uBAAuB,SAAS,CAAC,KAAK,EAAE,CAAC;IAErF,OAAO;QACL,kFAAkF,UAAU,GAAG;QAC/F,yEAAyE;QACzE,mHAAmH;QACnH,+DAA+D;QAC/D,6DAA6D;QAC7D,mDAAmD;QACnD,2CAA2C,QAAQ,uEAAuE;QAC1H,yCAAyC;KAC1C,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,yBAAyB,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { StreamingToolLoopAdapter } from './providers/streaming-tool-loop.js';
|
|
2
|
+
/** Buffer one response with a byte limit and cancellation, including incomplete SSE events. */
|
|
3
|
+
export declare function readToolResponse(response: Response, limit: number, signal: AbortSignal): Promise<string>;
|
|
4
|
+
export declare function accumulateToolStream(text: string, adapter: StreamingToolLoopAdapter): unknown;
|
|
5
|
+
/** Generate frames on demand so downstream consumption controls backpressure. */
|
|
6
|
+
export declare function toolResultStream(body: unknown, response: Response, adapter: StreamingToolLoopAdapter): Response;
|
|
7
|
+
//# sourceMappingURL=tool-loop-stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-loop-stream.d.ts","sourceRoot":"","sources":["../../src/proxy/tool-loop-stream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAEnF,+FAA+F;AAC/F,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CA2B9G;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAQ7F;AAED,iFAAiF;AACjF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,wBAAwB,GAAG,QAAQ,CAe/G"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { SSEParser, isSSEDone, serializeSSEEvent } from './sse-parser.js';
|
|
2
|
+
/** Buffer one response with a byte limit and cancellation, including incomplete SSE events. */
|
|
3
|
+
export async function readToolResponse(response, limit, signal) {
|
|
4
|
+
signal.throwIfAborted();
|
|
5
|
+
if (response.body === null)
|
|
6
|
+
return '';
|
|
7
|
+
const reader = response.body.getReader();
|
|
8
|
+
const decoder = new TextDecoder();
|
|
9
|
+
let bytes = 0;
|
|
10
|
+
let text = '';
|
|
11
|
+
const cancel = () => { void reader.cancel().catch(() => { }); };
|
|
12
|
+
signal.addEventListener('abort', cancel, { once: true });
|
|
13
|
+
try {
|
|
14
|
+
for (;;) {
|
|
15
|
+
signal.throwIfAborted();
|
|
16
|
+
const { value, done } = await reader.read();
|
|
17
|
+
signal.throwIfAborted();
|
|
18
|
+
if (done)
|
|
19
|
+
break;
|
|
20
|
+
bytes += value.byteLength;
|
|
21
|
+
if (bytes > limit)
|
|
22
|
+
throw new Error('Tool response exceeds maxToolResponseBytes');
|
|
23
|
+
text += decoder.decode(value, { stream: true });
|
|
24
|
+
}
|
|
25
|
+
return text + decoder.decode();
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
cancel();
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
signal.removeEventListener('abort', cancel);
|
|
33
|
+
reader.releaseLock();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export function accumulateToolStream(text, adapter) {
|
|
37
|
+
const parser = new SSEParser();
|
|
38
|
+
const accumulator = adapter.createAccumulator();
|
|
39
|
+
for (const event of [...parser.parse(text), ...parser.flush()]) {
|
|
40
|
+
if (isSSEDone(event.data))
|
|
41
|
+
continue;
|
|
42
|
+
accumulator.push(JSON.parse(event.data));
|
|
43
|
+
}
|
|
44
|
+
return accumulator.finish();
|
|
45
|
+
}
|
|
46
|
+
/** Generate frames on demand so downstream consumption controls backpressure. */
|
|
47
|
+
export function toolResultStream(body, response, adapter) {
|
|
48
|
+
const frames = adapter.encode(body)[Symbol.iterator]();
|
|
49
|
+
const encoder = new TextEncoder();
|
|
50
|
+
const headers = new Headers(response.headers);
|
|
51
|
+
headers.delete('content-length');
|
|
52
|
+
headers.delete('content-encoding');
|
|
53
|
+
headers.set('content-type', 'text/event-stream');
|
|
54
|
+
return new Response(new ReadableStream({
|
|
55
|
+
pull(controller) {
|
|
56
|
+
const next = frames.next();
|
|
57
|
+
if (next.done === true)
|
|
58
|
+
controller.close();
|
|
59
|
+
else
|
|
60
|
+
controller.enqueue(encoder.encode(serializeSSEEvent(next.value)));
|
|
61
|
+
},
|
|
62
|
+
cancel() { frames.return?.(); },
|
|
63
|
+
}), { status: response.status, statusText: response.statusText, headers });
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=tool-loop-stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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