@wyattjoh/rfc 0.5.1 → 0.6.1
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 +4 -2
- package/package.json +6 -6
- package/src/credentials.ts +29 -1
- package/src/main.ts +9 -3
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ The model-facing tools are:
|
|
|
23
23
|
|
|
24
24
|
Each successful tool call returns concise text plus the complete version-three result as validated structured content. Operational failures are MCP tool errors containing the same safe version-three error envelope as the CLI. A question that was not found and every citation verdict remain successful domain results. `rfc_source_cache_remove` requires `confirm: true` and is marked destructive and idempotent.
|
|
25
25
|
|
|
26
|
-
Provider credentials are intentionally outside the model-facing mutation surface. The MCP can inspect safe credential status but can never accept, reveal, add, or remove a key. Configure the credential through `rfc auth login` before
|
|
26
|
+
Provider credentials are intentionally outside the model-facing mutation surface. The MCP can inspect safe credential status but can never accept, reveal, add, or remove a key. Configure the credential through `rfc auth login`, or have the launcher set `RFC_TYPESAFE_API_KEY`, before starting the server. The stored key is resolved separately for every semantic tool call.
|
|
27
27
|
|
|
28
28
|
Trusted operators may select the same deterministic test or self-hosted boundaries at process startup:
|
|
29
29
|
|
|
@@ -117,8 +117,10 @@ Bare `auth` reports only whether a key is configured and the service/name identi
|
|
|
117
117
|
|
|
118
118
|
Bun maps the store to the host credential service: macOS Keychain, Linux Secret Service (libsecret, such as GNOME Keyring or KWallet), or Windows Credential Manager. Linux requires a running and unlocked Secret Service daemon; macOS requires Keychain access; Windows requires Credential Manager. This repository pins Bun `1.4.2` in `package.json` and tests against that version because `Bun.secrets` is experimental and may change.
|
|
119
119
|
|
|
120
|
+
A trusted launcher can instead supply the key through the `RFC_TYPESAFE_API_KEY` process environment variable. A non-empty value takes precedence over the stored key for research, citation verification, and `auth` status; blank values fall back to the credential store. The Claude Code plugin uses this to pass the key it collects as sensitive user configuration to the MCP server. `auth login` and `auth remove` still act only on the stored key, so `auth remove` reports `configured: true` while the environment variable remains set. Set this variable only from a launcher or secret manager, never from a committed file: `bunfig.toml` keeps `.env` files out of the process.
|
|
121
|
+
|
|
120
122
|
To migrate an existing setup, run `rfc auth login`, verify with `rfc auth`, then delete the obsolete plaintext, `.env`, Varlock, dotenv, or 1Password-backed TypeSafe API-key configuration. Research and citation verification both resolve this same credential lazily before constructing the provider.
|
|
121
123
|
|
|
122
124
|
## Configuration
|
|
123
125
|
|
|
124
|
-
Non-secret model, cache, and output settings use typed defaults in the CLI composition root. They are not loaded from Varlock, dotenv, `.env` files, or ordinary environment variables. `bunfig.toml` disables Bun dotenv loading. Use explicit CLI flags for command-specific values such as cache and provider URLs; the
|
|
126
|
+
Non-secret model, cache, and output settings use typed defaults in the CLI composition root. They are not loaded from Varlock, dotenv, `.env` files, or ordinary environment variables. `bunfig.toml` disables Bun dotenv loading. Use explicit CLI flags for command-specific values such as cache and provider URLs; the TypeSafe API key comes only from `RFC_TYPESAFE_API_KEY` or the credential store.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wyattjoh/rfc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Agent-facing CLI and MCP server for evidence-grounded IETF RFC research.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@effect/platform-node": "4.0.
|
|
42
|
-
"@modelcontextprotocol/server": "2.1
|
|
43
|
-
"@wyattjoh/rfc-core": "0.3.
|
|
44
|
-
"effect": "4.0.
|
|
41
|
+
"@effect/platform-node": "4.0.1",
|
|
42
|
+
"@modelcontextprotocol/server": "2.3.1",
|
|
43
|
+
"@wyattjoh/rfc-core": "0.3.1",
|
|
44
|
+
"effect": "4.0.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@modelcontextprotocol/client": "2.
|
|
47
|
+
"@modelcontextprotocol/client": "2.2.0",
|
|
48
48
|
"@types/bun": "1.4.2",
|
|
49
49
|
"typescript": "7.0.2"
|
|
50
50
|
},
|
package/src/credentials.ts
CHANGED
|
@@ -221,6 +221,33 @@ export const makeCredentialStore = (secrets: BunSecretsApi = Bun.secrets): Crede
|
|
|
221
221
|
*/
|
|
222
222
|
export const makeDefaultCredentialStore = (): CredentialStore => makeCredentialStore();
|
|
223
223
|
|
|
224
|
+
/**
|
|
225
|
+
* Environment variable through which a trusted launcher, such as the Claude
|
|
226
|
+
* Code plugin's sensitive user configuration, supplies the TypeSafe API key.
|
|
227
|
+
*/
|
|
228
|
+
export const credentialEnvironmentVariable = "RFC_TYPESAFE_API_KEY" as const;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Layer a launcher-supplied TypeSafe API key over a credential store.
|
|
232
|
+
*
|
|
233
|
+
* A non-empty value takes precedence for reads, so status and provider
|
|
234
|
+
* construction never touch the OS credential manager. Writes and deletes still
|
|
235
|
+
* target the underlying store, which keeps `auth login` and `auth logout`
|
|
236
|
+
* meaningful for the keychain fallback.
|
|
237
|
+
*
|
|
238
|
+
* @param store Underlying credential boundary.
|
|
239
|
+
* @param value Raw environment value, or undefined when unset.
|
|
240
|
+
* @returns The original store when the value is blank, otherwise an overlay.
|
|
241
|
+
*/
|
|
242
|
+
export const withEnvironmentCredential = (
|
|
243
|
+
store: CredentialStore,
|
|
244
|
+
value: string | undefined,
|
|
245
|
+
): CredentialStore => {
|
|
246
|
+
const supplied = value?.trim();
|
|
247
|
+
if (supplied === undefined || supplied.length === 0) return store;
|
|
248
|
+
return { ...store, get: async () => supplied };
|
|
249
|
+
};
|
|
250
|
+
|
|
224
251
|
/**
|
|
225
252
|
* Validate and normalize a credential received from an explicit input source.
|
|
226
253
|
*
|
|
@@ -315,7 +342,8 @@ export const removeStoredCredential = async (store: CredentialStore): Promise<Au
|
|
|
315
342
|
schemaVersion: authSchemaVersion,
|
|
316
343
|
kind: "auth_remove",
|
|
317
344
|
removed,
|
|
318
|
-
|
|
345
|
+
// A launcher-supplied key survives removal of the stored one.
|
|
346
|
+
configured: await hasStoredCredential(store),
|
|
319
347
|
service: credentialStoreService,
|
|
320
348
|
name: credentialStoreName,
|
|
321
349
|
});
|
package/src/main.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "@wyattjoh/rfc-core";
|
|
9
9
|
import { NodeServices } from "@effect/platform-node";
|
|
10
10
|
import { Console, Effect, Option } from "effect";
|
|
11
|
-
import { Argument, CliError, Command, Flag } from "effect/
|
|
11
|
+
import { Argument, CliError, Command, Flag } from "effect/cli";
|
|
12
12
|
import packageMetadata from "../package.json" with { type: "json" };
|
|
13
13
|
import { runRfcMcpServer } from "./mcp";
|
|
14
14
|
import {
|
|
@@ -39,8 +39,10 @@ import {
|
|
|
39
39
|
import {
|
|
40
40
|
CredentialInputError,
|
|
41
41
|
addStoredCredential,
|
|
42
|
+
credentialEnvironmentVariable,
|
|
42
43
|
makeDefaultCredentialStore,
|
|
43
44
|
removeStoredCredential,
|
|
45
|
+
withEnvironmentCredential,
|
|
44
46
|
type CredentialStore,
|
|
45
47
|
} from "./credentials";
|
|
46
48
|
|
|
@@ -284,10 +286,14 @@ const readMaskedCredential = async (): Promise<string> => {
|
|
|
284
286
|
/**
|
|
285
287
|
* Construct the production CLI side-effect boundary.
|
|
286
288
|
*
|
|
287
|
-
* @returns Dependencies backed by process streams and Bun's native credential
|
|
289
|
+
* @returns Dependencies backed by process streams and Bun's native credential
|
|
290
|
+
* manager, overlaid by a launcher-supplied `RFC_TYPESAFE_API_KEY`.
|
|
288
291
|
*/
|
|
289
292
|
export const makeDefaultCliDependencies = (): RfcCliDependencies => ({
|
|
290
|
-
credentialStore:
|
|
293
|
+
credentialStore: withEnvironmentCredential(
|
|
294
|
+
makeDefaultCredentialStore(),
|
|
295
|
+
process.env[credentialEnvironmentVariable],
|
|
296
|
+
),
|
|
291
297
|
readStandardInput: readProcessStandardInput,
|
|
292
298
|
promptCredential: readMaskedCredential,
|
|
293
299
|
writeStdout: (value) => process.stdout.write(value),
|