feat: enhance Argus integration with proxy support and error handling…#2
Merged
Conversation
… improvements - Added support for HTTP and HTTPS proxy agents in the package. - Introduced new `configure()` function to set up proxy settings after loading environment variables. - Expanded error handling with additional Argus error classes for better diagnostics. - Updated README with new usage instructions for proxy configuration. - Modified `loadEnv` to manage proxy state and handle bucket credentials more effectively. - Updated dependencies in package.json and package-lock.json to include new proxy-related packages.
- Moved internal modules to a new directory structure for better organization. - Implemented a new IPC client for fetching environment variables from Argus. - Added error handling and response parsing for IPC communication. - Updated README to reflect changes in package layout and usage instructions. - Introduced new proxy configuration and state management modules.
- Revised README to clarify the usage of factory methods for HTTP client configuration after loading environment variables. - Deprecated the `configure()` and `loadProxies()` functions in favor of explicit factory helpers. - Enhanced proxy configuration logic to improve clarity and usability. - Updated type exports in `index.ts` to reflect new proxy factory methods. - Removed deprecated code and improved documentation for proxy usage.
- Enhanced the README to improve the formatting of tables related to factory methods and error handling. - Clarified usage instructions for HTTP library factories and Argus error classes. - Ensured consistency in documentation style for better readability.
- Updated package version to 0.2.0 to reflect new functionality. - Enhanced README to include support for Argus Proxy factories, detailing usage modes for both enabled and disabled proxy scenarios. - Clarified instructions for integrating with HTTP clients using the new fetchOptions method.
…e patterns - Removed deprecated `configure()` and proxy factory methods in favor of explicit wiring with new helpers. - Updated README to reflect changes in proxy usage, emphasizing the use of `createArgusUndiciDispatcher` and related methods. - Streamlined package.json dependencies by removing unused proxy-related packages. - Clarified instructions for integrating HTTP clients with the new proxy helpers.
- Improved table formatting for better readability in the error handling section. - Clarified descriptions of error types and their corresponding Argus IPC codes. - Ensured consistent styling throughout the documentation to enhance user experience.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… improvements
What
loadEnvinsrc/load-env.ts) from proxy/TLS (configureinsrc/configure.ts)src/proxy-state.ts) set byloadEnv, consumed byconfigureconfigure()setsHTTP(S)_PROXY, Argus CA bundle (NODE_EXTRA_CA_CERTS), http/https global agents, undici globalProxyAgent; optional per-client setup (axios, undiciClient/Pool, fetch options)src/ipc-errors.ts,src/errors.ts) with stable code values and user-facing messages from ArgusloadProxies/applyUndiciGlobalProxyretained as compatibility helpers; README documentsloadEnv→configureflowWhy
Callers should be able to load env vars without forcing global proxy side effects (e.g. scripts that only need secrets). Proxy setup should be explicit, repeatable, and work with Node fetch/undici as well as axios/https. Typed IPC errors improve DX when Argus returns approval, bucket, or token errors.
Security impact
loadEnv; proxy placeholders injected from bucket IPC; real keys rewritten only by Argus proxy when traffic uses the configured proxy; typed errors surface misconfiguration clearlyconfigure(client)where needed. Host allowlisting is enforced in Argus Rust, not in this package.How to test
cd node-argus && pnpm install && pnpm test && pnpm run buildcd test-node-argus && pnpm install && pnpm run env— verify placeholders afterloadEnv, proxy URLs afterconfigurepnpm run test:fetch(uses undici/fetch + proxy);pnpm run test:langchain— confirm Argus proxy logs show rewrite + upstreamapi.anthropic.comanthropic.comfrom all proxy mappings;test:fetchshould fail at proxy; SDK-only paths may differChecklist
pnpm exec tsc --noEmitandpnpm lintlocally (or CI is green)~/.argusdatabase files