@wyattjoh/rfc 0.2.0 → 0.3.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 +7 -7
- package/package.json +1 -1
- package/src/agent-surface.ts +1 -1
- package/src/credentials.ts +2 -2
- package/src/main.ts +19 -20
- package/src/mcp.ts +2 -2
- package/src/operations.ts +1 -1
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-two result as validated structured content. Operational failures are MCP tool errors containing the same safe version-two error envelope as the CLI. Valid fail-closed research statuses and citation verdicts 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
|
|
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 launching 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
|
|
|
@@ -98,23 +98,23 @@ The TypeSafe API key is stored by Bun's experimental `Bun.secrets` API under thi
|
|
|
98
98
|
- service: `com.wyattjoh.rfc`
|
|
99
99
|
- name: `typesafe-api-key`
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
Store it interactively with a masked login prompt:
|
|
102
102
|
|
|
103
103
|
```sh
|
|
104
|
-
rfc auth
|
|
104
|
+
rfc auth login
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
For automation, explicitly pipe the key through standard input. It is never accepted as an argv value:
|
|
108
108
|
|
|
109
109
|
```sh
|
|
110
|
-
cat /path/to/a-protected-key-input | rfc auth
|
|
110
|
+
cat /path/to/a-protected-key-input | rfc auth login --stdin
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
`auth
|
|
113
|
+
Bare `auth` reports only whether a key is configured and the service/name identity. `auth remove` is deterministic: its versioned JSON result reports `removed: true` when a key existed and `removed: false` when it was already absent. Human output is the default for auth commands; add `--format json` for the versioned process result. The key is not included in command output, diagnostics, snapshots, or error envelopes.
|
|
114
114
|
|
|
115
115
|
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.
|
|
116
116
|
|
|
117
|
-
To migrate an existing setup, run `rfc auth
|
|
117
|
+
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, citation verification, and live evaluation all resolve this same credential lazily before constructing the provider.
|
|
118
118
|
|
|
119
119
|
## Precision calibration
|
|
120
120
|
|
|
@@ -123,7 +123,7 @@ Automatic answering is off. `answered` requires a locally present calibration re
|
|
|
123
123
|
Run a calibration against the live provider only through the explicit evaluator, after storing a credential. It costs money and reaches the network:
|
|
124
124
|
|
|
125
125
|
```sh
|
|
126
|
-
rfc auth
|
|
126
|
+
rfc auth
|
|
127
127
|
bun run evaluate:live
|
|
128
128
|
```
|
|
129
129
|
|
package/package.json
CHANGED
package/src/agent-surface.ts
CHANGED
|
@@ -18,7 +18,7 @@ Preserve research status exactly: answered, partial, unsupported, needs_review,
|
|
|
18
18
|
|
|
19
19
|
Exact reproduction of accepted evidence needs no citation call. Verify at most two paraphrased claims once each with rfc_verify_citation, using the exact returned quote and its UTF-8 byte offset. If a direct verification verdict is fabricated, use at most one research call to locate current wording and one verification call for that replacement. Never guess wording or offsets. Unsupported, contradicted, or fabricated verdicts cannot support an unqualified claim.
|
|
20
20
|
|
|
21
|
-
Operational tool errors are not research statuses. Preserve their typed error code and stop rather than substituting stale text, another provider, or memory. If a tool error reports a missing credential, ask the human operator to run rfc auth
|
|
21
|
+
Operational tool errors are not research statuses. Preserve their typed error code and stop rather than substituting stale text, another provider, or memory. If a tool error reports a missing credential, ask the human operator to run rfc auth login; never request or accept the secret through MCP. A usage-accounting warning follows a successful paid operation and must not trigger a retry.
|
|
22
22
|
|
|
23
23
|
Do not read the agent-workflow resource for ordinary research. Read ${rfcMcpAgentReferenceUri} only when handling a non-answer status, operational failure, citation-repair workflow, or a provenance, privacy, cost, or cache question.`;
|
|
24
24
|
|
package/src/credentials.ts
CHANGED
|
@@ -128,7 +128,7 @@ export interface CredentialStore {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
|
-
* The public identity of the credential used by auth
|
|
131
|
+
* The public identity of the credential used by auth inspection and mutation
|
|
132
132
|
* results. It contains no credential value or derivative.
|
|
133
133
|
*/
|
|
134
134
|
export interface CredentialStoreIdentity {
|
|
@@ -339,7 +339,7 @@ export const AuthAddResultSchema = Schema.Struct({
|
|
|
339
339
|
export type AuthAddResult = Schema.Schema.Type<typeof AuthAddResultSchema>;
|
|
340
340
|
|
|
341
341
|
/**
|
|
342
|
-
* Versioned result emitted by auth
|
|
342
|
+
* Versioned result emitted by the bare auth command.
|
|
343
343
|
*/
|
|
344
344
|
export const AuthStatusSchema = Schema.Struct({
|
|
345
345
|
schemaVersion: Schema.Literal(authSchemaVersion),
|
package/src/main.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import { NodeServices } from "@effect/platform-node";
|
|
10
10
|
import { Console, Effect, Option } from "effect";
|
|
11
11
|
import { Argument, CliError, Command, Flag } from "effect/unstable/cli";
|
|
12
|
+
import packageMetadata from "../package.json" with { type: "json" };
|
|
12
13
|
import { runRfcMcpServer } from "./mcp";
|
|
13
14
|
import {
|
|
14
15
|
executeAuthStatus,
|
|
@@ -628,8 +629,8 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
628
629
|
]),
|
|
629
630
|
);
|
|
630
631
|
|
|
631
|
-
const
|
|
632
|
-
"
|
|
632
|
+
const authLoginCommand = Command.make(
|
|
633
|
+
"login",
|
|
633
634
|
{
|
|
634
635
|
format,
|
|
635
636
|
stdin: credentialFromStdin,
|
|
@@ -660,20 +661,6 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
660
661
|
}),
|
|
661
662
|
).pipe(Command.withDescription("Store or replace the TypeSafe API key"));
|
|
662
663
|
|
|
663
|
-
const authStatusCommand = Command.make(
|
|
664
|
-
"status",
|
|
665
|
-
{ format },
|
|
666
|
-
Effect.fn(function* ({ format }) {
|
|
667
|
-
const result = yield* Effect.tryPromise({
|
|
668
|
-
try: () => executeAuthStatus(dependencies),
|
|
669
|
-
catch: (error) => error,
|
|
670
|
-
});
|
|
671
|
-
yield* writeStdout(
|
|
672
|
-
resolveOutputFormat(format) === "human" ? renderAuthStatus(result) : JSON.stringify(result),
|
|
673
|
-
);
|
|
674
|
-
}),
|
|
675
|
-
).pipe(Command.withDescription("Inspect TypeSafe credential configuration without revealing it"));
|
|
676
|
-
|
|
677
664
|
const authRemoveCommand = Command.make(
|
|
678
665
|
"remove",
|
|
679
666
|
{ format },
|
|
@@ -696,9 +683,21 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
696
683
|
}),
|
|
697
684
|
).pipe(Command.withDescription("Remove the stored TypeSafe API key"));
|
|
698
685
|
|
|
699
|
-
const authCommand = Command.make(
|
|
700
|
-
|
|
701
|
-
|
|
686
|
+
const authCommand = Command.make(
|
|
687
|
+
"auth",
|
|
688
|
+
{ format },
|
|
689
|
+
Effect.fn(function* ({ format }) {
|
|
690
|
+
const result = yield* Effect.tryPromise({
|
|
691
|
+
try: () => executeAuthStatus(dependencies),
|
|
692
|
+
catch: (error) => error,
|
|
693
|
+
});
|
|
694
|
+
yield* writeStdout(
|
|
695
|
+
resolveOutputFormat(format) === "human" ? renderAuthStatus(result) : JSON.stringify(result),
|
|
696
|
+
);
|
|
697
|
+
}),
|
|
698
|
+
).pipe(
|
|
699
|
+
Command.withDescription("Inspect or manage the TypeSafe API key in the OS credential manager"),
|
|
700
|
+
Command.withSubcommands([authLoginCommand, authRemoveCommand]),
|
|
702
701
|
);
|
|
703
702
|
|
|
704
703
|
const costsCommand = Command.make(
|
|
@@ -839,7 +838,7 @@ export const run = async (
|
|
|
839
838
|
|
|
840
839
|
try {
|
|
841
840
|
const program = Command.runWith(makeApplication(dependencies), {
|
|
842
|
-
version:
|
|
841
|
+
version: packageMetadata.version,
|
|
843
842
|
renderErrors: false,
|
|
844
843
|
})(argv);
|
|
845
844
|
|
package/src/mcp.ts
CHANGED
|
@@ -78,7 +78,7 @@ Remove one named RFC source-cache entry without network access. This destructive
|
|
|
78
78
|
|
|
79
79
|
### rfc_auth_status
|
|
80
80
|
|
|
81
|
-
Report only whether the stable TypeSafe credential identity is configured. The MCP never accepts, returns, adds, or removes credentials. If missing, ask the human operator to run \`rfc auth
|
|
81
|
+
Report only whether the stable TypeSafe credential identity is configured. The MCP never accepts, returns, adds, or removes credentials. If missing, ask the human operator to run \`rfc auth login\` outside MCP.
|
|
82
82
|
|
|
83
83
|
## Research statuses
|
|
84
84
|
|
|
@@ -108,7 +108,7 @@ Preserve exact quotes, RFC identifiers, requested/current context roles, relatio
|
|
|
108
108
|
Operational failures are returned as MCP tool errors containing the safe version-two RFC error envelope. Report the code and stop. In particular:
|
|
109
109
|
|
|
110
110
|
- \`invalid_input\`: correct the bounded tool input.
|
|
111
|
-
- \`credential_missing\`: ask the human to run \`rfc auth
|
|
111
|
+
- \`credential_missing\`: ask the human to run \`rfc auth login\`.
|
|
112
112
|
- \`credential_store_unavailable\` or \`credential_access_denied\`: ask the human to unlock or authorize the OS credential store; never use plaintext fallback.
|
|
113
113
|
- \`discovery_failed\`: report the Datatracker failure; do not invent or use stale metadata.
|
|
114
114
|
- \`source_cache_failed\`, \`source_fetch_failed\`, or \`source_revalidation_failed\`: report the authoritative source failure; never serve stale text or substitute another representation.
|
package/src/operations.ts
CHANGED
|
@@ -124,7 +124,7 @@ const credentialErrorEnvelope = (error: unknown): ErrorEnvelope | undefined => {
|
|
|
124
124
|
kind: "error",
|
|
125
125
|
error: {
|
|
126
126
|
code: "credential_missing",
|
|
127
|
-
message: "No TypeSafe API key is configured; run `rfc auth
|
|
127
|
+
message: "No TypeSafe API key is configured; run `rfc auth login`",
|
|
128
128
|
},
|
|
129
129
|
};
|
|
130
130
|
}
|