{"_id":"r-assistant-gateway","_rev":"2-631fedb7021291c150332e965ad8495c","name":"r-assistant-gateway","dist-tags":{"latest":"0.3.1"},"versions":{"0.3.0":{"name":"r-assistant-gateway","version":"0.3.0","keywords":["r","data-science","ai-assistant","responses-api","oauth","gateway"],"author":{"name":"Carl Stone"},"license":"Apache-2.0","_id":"r-assistant-gateway@0.3.0","maintainers":[{"name":"carl-stone","email":"carlstone001@gmail.com"}],"homepage":"https://github.com/carl-stone/r-assistant-gateway#readme","bugs":{"url":"https://github.com/carl-stone/r-assistant-gateway/issues"},"bin":{"r-assistant-gateway":"dist/cli.js"},"dist":{"shasum":"d848691a1c6ecc48cfb978842aeadc10df3f4a46","tarball":"https://registry.npmjs.org/r-assistant-gateway/-/r-assistant-gateway-0.3.0.tgz","fileCount":25,"integrity":"sha512-4NKA719ioiEF6/2Vj/UVjaXi0V5/VQX4Q4weBhCFLKVQM/wzp9Xu8/WiYBNUS8d1vCTkCQ9+A1XSbzaJBQFTag==","signatures":[{"sig":"MEUCIQCtBeFkhpdtFQv+Wbmo9OzEFlBJM3QOdlmyJQsXq6aurgIgO6+fD2EXxCImyspfZDS1Ov0GzsZu7tAwFpn2DTIjuFc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":95289},"type":"module","engines":{"node":">=24"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"5dfe424ba30d8f4b455a10245e0e630086621f5a","scripts":{"lint":"biome check src test scripts","test":"vitest run","build":"node --eval \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.build.json","verify":"npm run typecheck && npm run lint && npm test && npm run build && npm run test:cli","prepack":"npm run verify","test:cli":"tsx scripts/test-cli-lifecycle.ts","typecheck":"tsc --noEmit","check:contract":"tsx scripts/check-contract.ts"},"_npmUser":{"name":"carl-stone","email":"carlstone001@gmail.com"},"repository":{"url":"git+https://github.com/carl-stone/r-assistant-gateway.git","type":"git"},"_npmVersion":"11.17.0","description":"Unofficial local gateway from Posit Assistant in RStudio and Positron to ChatGPT/Codex OAuth","directories":{},"_nodeVersion":"26.4.0","allowScripts":{"esbuild@0.28.2":true},"dependencies":{"openai-oauth":"npm:@carl-stone/openai-oauth@2.0.0-memory.2"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.13","vitest":"^5.0.0","typescript":"^7.0.2","@types/node":"^24.13.4","@biomejs/biome":"^2.5.13"},"_npmOperationalInternal":{"tmp":"tmp/r-assistant-gateway_0.3.0_1789252542862_0.16441172546493577","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"_id":"r-assistant-gateway@0.3.1","bin":{"r-assistant-gateway":"dist/cli.js"},"bugs":{"url":"https://github.com/carl-stone/r-assistant-gateway/issues"},"dist":{"shasum":"cee27cb3d208647dc85d7daedc2ef341d4e41778","tarball":"https://registry.npmjs.org/r-assistant-gateway/-/r-assistant-gateway-0.3.1.tgz","fileCount":3013,"integrity":"sha512-DxOp1ncr0/CPnVpf5hIRbDJ2V7LtWWIOSRsz9DnSVUwfW+Uyz1JaEbtfcJLe17d15+fAPqF+ncWWwMHkIuZ/Vg==","signatures":[{"sig":"MEUCIBXTZCM1pwoBcnE0Apodk+xFnI0ZRhEj4K7whv3jIkg0AiEAzrrByGam+98FCncyp7vZtY0fg8UhbCD06kvVbrck/eI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDFEQ3avVVUlVxTK96vbIKFbfj+OMk7nBvuuKBFTi//MAiEA9MB6XSB4opPwArAj5LvKT8ypA7wC3fx2SWgadKb/u80="}],"unpackedSize":22298249},"name":"r-assistant-gateway","type":"module","_from":"file:r-assistant-gateway-0.3.1.tgz","author":{"name":"Carl Stone"},"engines":{"node":">=24"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"license":"Apache-2.0","scripts":{"lint":"biome check src test scripts","test":"vitest run","build":"node --eval \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.build.json","verify":"npm run typecheck && npm run lint && npm test && npm run build && npm run test:cli && npm run test:package","prepack":"npm run verify","test:cli":"tsx scripts/test-cli-lifecycle.ts","typecheck":"tsc --noEmit","test:package":"tsx scripts/test-package.ts","check:contract":"tsx scripts/check-contract.ts"},"version":"0.3.1","_npmUser":{"name":"carl-stone","email":"carlstone001@gmail.com"},"homepage":"https://github.com/carl-stone/r-assistant-gateway#readme","keywords":["r","data-science","ai-assistant","responses-api","oauth","gateway"],"_resolved":"/Users/carlstone/projects/r-assistant-gateway/r-assistant-gateway-0.3.1.tgz","overrides":{"ai":{"@ai-sdk/gateway":{"@ai-sdk/provider-utils":"4.0.57"},"@ai-sdk/provider-utils":"4.0.57"},"@openai-oauth/ai-sdk":{"@ai-sdk/openai":{"@ai-sdk/provider-utils":"4.0.57"},"@ai-sdk/provider-utils":"4.0.57"}},"_integrity":"sha512-DxOp1ncr0/CPnVpf5hIRbDJ2V7LtWWIOSRsz9DnSVUwfW+Uyz1JaEbtfcJLe17d15+fAPqF+ncWWwMHkIuZ/Vg==","repository":{"url":"git+https://github.com/carl-stone/r-assistant-gateway.git","type":"git"},"_npmVersion":"11.17.0","description":"Unofficial local gateway from Posit Assistant in RStudio and Positron to ChatGPT/Codex OAuth","directories":{},"maintainers":[{"name":"carl-stone","email":"carlstone001@gmail.com"}],"_nodeVersion":"26.4.0","allowScripts":{"esbuild@0.28.2":true},"dependencies":{"zod":"4.6.5","openai-oauth":"npm:@carl-stone/openai-oauth@2.0.0-memory.2"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.15","vitest":"^5.0.3","typescript":"^7.0.2","@types/node":"^24.19.1","@biomejs/biome":"^2.5.15"},"bundleDependencies":["openai-oauth","zod"],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/r-assistant-gateway_0.3.1_1791223343742_0.8362953584110457"}}},"time":{"created":"2026-09-12T22:35:42.664Z","modified":"2026-10-05T18:02:24.170Z","0.3.0":"2026-09-12T22:35:43.027Z","0.3.1":"2026-10-05T18:02:23.950Z"},"bugs":{"url":"https://github.com/carl-stone/r-assistant-gateway/issues"},"author":{"name":"Carl Stone"},"license":"Apache-2.0","homepage":"https://github.com/carl-stone/r-assistant-gateway#readme","keywords":["r","data-science","ai-assistant","responses-api","oauth","gateway"],"repository":{"url":"git+https://github.com/carl-stone/r-assistant-gateway.git","type":"git"},"description":"Unofficial local gateway from Posit Assistant in RStudio and Positron to ChatGPT/Codex OAuth","maintainers":[{"name":"carl-stone","email":"carlstone001@gmail.com"}],"readme":"# R Assistant Gateway\n\nLove Codex models, hate API prices? ☀️ 🌍 🌙\nUse your existing ChatGPT/Codex subscription sign-in with Posit Assistant in RStudio or Positron.\n\n`r-assistant-gateway` is a small local compatibility bridge between Posit\nAssistant's OpenAI Responses client and ChatGPT/Codex. It uses\n[`@carl-stone/openai-oauth`](https://github.com/carl-stone/openai-oauth) to sign\nin with your ChatGPT account and translates Posit Assistant's requests into the\nrequest contract accepted by ChatGPT/Codex.\n\nIt is intentionally only that bridge. It is not a general OpenAI proxy or an\nAPI-key replacement for other applications.\n\n> **Unofficial community project.** This project is not affiliated with,\n> endorsed by, or supported by Posit or OpenAI.\n\n## Before you start\n\nYou need:\n\n- [Node.js 24 or newer](https://nodejs.org/en/download);\n- RStudio or Positron with Posit Assistant installed; and\n- a ChatGPT/Codex Plus or Pro subscription.\n\nPosit Assistant **1.6.0 and 1.6.1** are recognized in either IDE, alongside\n**1.3.0 and 1.3.1**. See [compatibility validation](#compatibility-validation)\nfor the distinction between live testing and synthetic regression coverage.\n\nThe gateway uses your ChatGPT/Codex sign-in. You do not need an OpenAI API key.\n\n## Quick start\n\nWith Node.js installed, run these commands in a Terminal window:\n\n```sh\nnpm install --global r-assistant-gateway\nr-assistant-gateway login\nr-assistant-gateway\n```\n\nThe last command keeps the gateway running in the foreground. Leave that\nTerminal window open while you use Posit Assistant.\n\nTo run it in the background instead, use:\n\n```sh\nr-assistant-gateway --detach\n```\n\n### Connect Posit Assistant\n\nChoose the **OpenAI** provider in either IDE:\n\n- **RStudio:** in the Posit Assistant pane, select **gear > Configure AI\n  providers > OpenAI**.\n- **Positron:** open the Command Palette, run **Authentication: Configure\n  Language Model Providers**, and select **OpenAI**. The separately named\n  **OpenAI Compatible** provider defaults to Chat Completions; this gateway\n  uses Responses.\n\nEnter the same connection settings in either IDE:\n\n| Setting | Value |\n| --- | --- |\n| Base URL | `http://127.0.0.1:10532/v1` |\n| API key | `local-gateway` |\n\n`local-gateway` is only a non-secret placeholder required by the OpenAI setup\nform. The gateway does not use it as an OpenAI API key; upstream requests use\nyour ChatGPT/Codex sign-in. A non-empty value also lets Posit Assistant discover\nthe models available through your account from the gateway. One running gateway\ncan serve both IDEs on the same computer. In Positron, open the chat with\n**View: Show Posit Assistant**. See the official\n[Positron provider instructions](https://positron.posit.co/assistant-providers.html)\nfor the provider dialog.\n\n### A model is missing from the Positron selector\n\nPosit Assistant 1.6.1 discovers GPT-6 models through the OpenAI provider,\nincluding `gpt-6-astra`; no custom-model entry is needed. Use **Reload model\nlist** in the model menu after changing provider settings. Assistant 1.6.1\nalso fixes model lists that appeared empty during slow startup credential checks.\n\nAssistant 1.3.1 only discovers IDs beginning with `gpt-5`, `gpt-4`, or `o`,\nso GPT-6 models are hidden on that older version. Upgrade Assistant, or add a\ncustom model using **Open AI Provider Settings (JSON)**. Preserve existing\nprovider settings and use current model capabilities rather than an old\ncontext-limit example. See Posit’s\n[custom model settings reference](https://assistant.posit.co/docs/reference/providers-settings/).\nCustom entries do not grant access to models unavailable to your account.\n\n## Start, check, and stop the gateway\n\nThese commands are useful when the gateway runs in the background:\n\n```sh\nr-assistant-gateway status\nr-assistant-gateway logs --follow\nr-assistant-gateway doctor\nr-assistant-gateway stop\n```\n\nRun `r-assistant-gateway` again to start it in the foreground after stopping\nit. The default port is `10532`, which matches the Posit Assistant URL above.\nYou can choose another port with, for example, `--port 10533`; if you do, change\nthe provider's base URL to match.\n\n## What the gateway translates\n\nPosit Assistant uses the OpenAI Responses wire format in both IDEs when the\nOpenAI provider is selected. For current Codex\nmodels it can send developer and user input, images and files, tool definitions,\nfunction calls, structured function outputs, encrypted reasoning, and explicit\nprompt-cache controls.\n\nChatGPT/Codex accepts most of that request directly. The gateway removes only\nknown incompatible fields:\n\n- `prompt_cache_options`;\n- `prompt_cache_breakpoint` markers on Posit's input content parts;\n- `previous_response_id` and legacy prompt-cache retention fields; and\n- any other root field outside the current Codex request contract, including\n  Posit's `max_output_tokens`.\n\nThe model, messages, images, files, reasoning, tools, function calls and\nstructured results, cache key, and streaming response remain intact. The\nadapter never mutates the request object supplied by its caller.\n\nThe OAuth runtime handles sign-in, token refresh, model discovery, upstream\ntransport, and server lifecycle. The gateway defaults its optional Responses\nhistory to process-local memory so ID-based continuations can be resolved when\nneeded. That history is discarded whenever the gateway stops.\n\n## Compatibility validation\n\nGateway 0.3.x recognizes Posit Assistant **1.3.0, 1.3.1, 1.6.0, and 1.6.1**\nusing the same version list for both IDEs. These are explicit recognized\nversions, not minimum version requirements; other releases are unvalidated,\nnot necessarily incompatible.\n\n- **Live IDE testing:** Assistant 1.3.0 in RStudio and 1.3.1 in Positron.\n  A basic live smoke test with Assistant 1.6.1 in Positron was also confirmed.\n- **Synthetic regression testing:** the 1.3 Responses request and the newer\n  1.6-shaped GPT-6 request, including `apply_patch`, structured tool results,\n  file input, encrypted reasoning, and explicit cache controls. Both fixtures\n  also run through the detached CLI against a local mock Codex endpoint.\n- **Upstream contract check:** compares the adapter's root fields with current\n  Codex source. This checks schema drift, not authenticated backend behavior.\n\nThe 1.6.1 smoke test is not exhaustive tool or model coverage. Assistant 1.6.0\nand newer RStudio Assistant installations have not been live-tested.\n\n## Troubleshooting\n\nRun the read-only diagnostic report with:\n\n```sh\nr-assistant-gateway doctor\n```\n\nIt reports the installed gateway and OAuth runtime versions, Posit Assistant\nin RStudio (`positAssistant`) and Positron (`positronAssistant`), and the active\ngateway’s health. Each Assistant entry includes its version and installation\npath. The compatibility check accepts any version in\n`supportedPositAssistantVersions` from either IDE, alongside the expected OAuth\nruntime. An unrecognized Assistant version is unvalidated, not necessarily\nincompatible. An older or missing installation in the other IDE does not\nprevent success. The command\nstill exits unsuccessfully if the gateway health check fails.\n\nPositron detection checks `~/.positron/extensions`, using the extension registry\nwhen available and ignoring removed extensions. For a custom extension directory\n(such as a `--extensions-dir` setup), set `POSITRON_EXTENSIONS_DIR`. Detection\nreports installed packages; it does not check whether an extension is enabled\nin the active Positron profile. The diagnostic report does not read conversations\nor credentials.\n\nCommon fixes:\n\n- **RStudio or Positron cannot connect:** make sure the gateway is running and the base URL\n  is exactly `http://127.0.0.1:10532/v1`.\n- **The port is busy:** stop the other process, or start with\n  `r-assistant-gateway --port <number>` and update the base URL.\n- **Sign-in fails:** run `r-assistant-gateway login` again, then restart the\n  gateway.\n- **A conversation fails after restarting the gateway:** start a new Posit\n  Assistant conversation. Temporary continuation state is cleared on restart.\n- **`doctor` does not recognize your Assistant version:** versions 1.3.0,\n  1.3.1, 1.6.0, and 1.6.1 are recognized in either IDE. A failed version check\n  does not establish that your installation cannot work.\n  For an administrator-managed or otherwise nonstandard installation, set\n  `POSIT_ASSISTANT_ROOT` to RStudio’s `pai/bin` directory, or\n  `POSITRON_EXTENSIONS_DIR` to Positron’s extension directory, before running\n  `doctor`.\n- **`doctor` reports an unexpected OAuth runtime:** reinstall the matching\n  `r-assistant-gateway` release rather than upgrading its runtime directly.\n- **The background gateway is not working:** run `status`, inspect `logs`, then\n  use `stop` before starting it again.\n\n## Privacy and network behavior\n\nBy default, the gateway listens only on your computer at `127.0.0.1`. It uses\nthe same host behavior as `openai-oauth`. An explicit non-loopback `--host` can\nmake the unauthenticated endpoint reachable by other computers; every client\nthat can reach it can use your ChatGPT/Codex subscription. Keep the default\nunless that access is deliberate and protected by your network.\n\nOAuth credentials and upstream transport are handled by the published OAuth\nruntime. Recent Responses items are held only in the running process, with\ndefault limits of 256 response-history entries and 2,000 items. They are never\npersisted by the gateway and are discarded when it stops or restarts.\n\nOn POSIX systems, gateway startup and login restrict the selected OAuth\ncredential file to its owner (`0600`).\n\nDiagnostics are off by default. If enabled with `--diagnostics`, they contain\nmetadata only: request ID, model, schema-only removed-field patterns, cache\nbreakpoint count, status, duration, and safely available token counts. Prompts,\nconversation content, tool arguments and results, credentials, headers, auth\nmaterial, and reasoning content are not logged.\n\n## Advanced CLI options\n\nThe gateway accepts the same public commands and options as its OAuth runtime,\nincluding `login`, `--host`, `--port`, `--models`, `--codex-version`,\n`--base-url`, OAuth overrides, `--no-open`, login timeout, `--detach`, `status`,\n`logs`, `stop`, `--responses-state`, `--responses-max-responses`, and\n`--responses-max-items`.\n\nThere are two intentional Posit defaults: port `10532` and process-local\nResponses memory. You can override the port. Setting `--responses-state\nstateless` disables continuation by response or item IDs, so `doctor` does not\nconsider that configuration healthy for Posit Assistant. `doctor` and\n`--diagnostics` are specific to this gateway.\n\nModel discovery automatically resolves the latest stable Codex client version\nfrom npm, caching it for one hour. Installing or updating the Codex CLI is not\nrequired. If registry discovery fails, the runtime falls back to its older\nbuilt-in version; `--codex-version <version>` overrides it when needed.\n\n### OAuth runtime limitations\n\n- Use an IPv4 host such as the default `127.0.0.1`. The pinned OAuth runtime\n  does not correctly advertise an IPv6 host.\n- Cancelling a request in the client may not stop the upstream generation. The\n  pinned runtime does not yet propagate HTTP disconnects to its upstream fetch.\n- The delegated runtime also exposes unadapted chat-completion and image routes.\n  They are outside this gateway's supported surface; this is another reason to\n  keep the listener on the default loopback address.\n\n## Development\n\n```sh\nnpm ci\nnpm run verify\nnpm run check:contract\nnpm audit\nnpm pack --dry-run\n```\n\n`npm run verify` performs typechecking, linting, unit tests, a TypeScript build,\nand detached CLI tests with synthetic Assistant 1.3 and 1.6 Responses requests.\nIt also packs the gateway, installs it in an isolated consumer project, audits\nthat installation, verifies the security-patched dependency, and reruns the\nCLI lifecycle against the installed package. No real credentials or ChatGPT\nrequests are used by these tests.\n\nThe OAuth runtime remains pinned to the memory-enabled fork. An npm override\npins `@ai-sdk/provider-utils` to patched 4.0.57 for GHSA-866g-f22w-33x8. The\nruntime and its production dependency tree, including its explicit `zod` peer,\nare bundled into the npm package because overrides alone do not apply when\nusers install a dependency. The overrides are scoped to each SDK parent to\navoid npm's resolver loop with global overrides and bundled dependencies. The\npackaged-install test guards against accidentally shipping the old dependency.\n\nCI also performs an npm package dry run. A separate scheduled/manual workflow\nchecks that every root field forwarded by the adapter remains present in\nCodex's source contract. Dependabot watches npm and GitHub Actions dependencies.\n\n## Credits and license\n\nThis project uses\n[`@carl-stone/openai-oauth`](https://github.com/carl-stone/openai-oauth), a\npublished fork of Evan Zhou's `openai-oauth`. The dependency ships its own\nApache-2.0 license and notice; this repository's required attribution is\nincluded in [NOTICE](NOTICE).\n\nThe original gateway code in this repository is copyright Carl Stone and is\nlicensed under Apache-2.0. See [LICENSE](LICENSE).\n\n## Legal\n\nR Assistant Gateway is an unofficial community project. It is not affiliated\nwith, endorsed by, or supported by Posit Software, PBC.\n\nPosit, RStudio, Positron, and Posit Assistant are trademarks of Posit Software,\nPBC, all rights reserved, and may be registered in the United States Patent and\nTrademark Office and in other countries.\n","readmeFilename":"README.md"}