@agent-change-requests/client 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +86 -2
- package/dist/acceptance.d.ts +12 -0
- package/dist/acceptance.js +55 -0
- package/dist/acceptance.js.map +1 -0
- package/dist/client.d.ts +134 -0
- package/dist/client.js +358 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/ledger.d.ts +37 -0
- package/dist/ledger.js +43 -0
- package/dist/ledger.js.map +1 -0
- package/dist/redact.d.ts +47 -0
- package/dist/redact.js +124 -0
- package/dist/redact.js.map +1 -0
- package/dist/types.d.ts +96 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +46 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mike Lingle
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,87 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @agent-change-requests/client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Client side of the [Agent Change Requests extension](../../SEP-0000-agent-change-requests.md), for `Client` from `@modelcontextprotocol/sdk`. It covers what SEP section 9 makes the client's job:
|
|
4
|
+
|
|
5
|
+
- **Advertising, with consent.** The extension is advertised only when the user or operator turned it on for this server, and never from an ephemeral or incognito session.
|
|
6
|
+
- **One submission tool for the model.** Its input matches `changeRequests/submit`, and the client writes its description, not the server.
|
|
7
|
+
- **Redaction.** Every model-written field and every argument value goes through a redaction pass before it is sent, and a review hook lets the user see the cleaned request.
|
|
8
|
+
- **Client-side controls.** A daily cap per server, no second request for a gap already open, and acceptance tests only when the server takes them.
|
|
9
|
+
- **The inbox.** When any response carries an update count, the client reads its inbox, records what shipped, and tells you which workarounds are obsolete. Without consent, it removes the notice line instead.
|
|
10
|
+
- **Confirmation.** The client re-runs the acceptance tests it sent, under its own authorization, and confirms the result.
|
|
11
|
+
|
|
12
|
+
## Quick start
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
16
|
+
import { ChangeRequestsClient, FileLedger, changeRequestsCapabilities } from "@agent-change-requests/client";
|
|
17
|
+
|
|
18
|
+
const extensionId = "com.example/change-requests";
|
|
19
|
+
const consent = { consent: settings.changeRequestsEnabledFor("invoices"), ephemeral: session.incognito };
|
|
20
|
+
|
|
21
|
+
const client = new Client({ name: "my-agent", version: "1.0.0" }, {
|
|
22
|
+
capabilities: changeRequestsCapabilities(extensionId, consent),
|
|
23
|
+
});
|
|
24
|
+
await client.connect(transport);
|
|
25
|
+
|
|
26
|
+
const changeRequests = new ChangeRequestsClient(client, {
|
|
27
|
+
extensionId,
|
|
28
|
+
...consent,
|
|
29
|
+
serverName: "Invoices",
|
|
30
|
+
ledger: new FileLedger(".agent/change-requests/invoices.json"),
|
|
31
|
+
redaction: { sensitiveValues: [user.name, workspace.name], foreignNames: otherServersToolNames },
|
|
32
|
+
review: (draft, findings) => askUser(draft, findings), // optional
|
|
33
|
+
onShipped: (status, entry) => notes.add(`${entry.title} shipped in ${status.version}; drop: ${entry.workaround}`),
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Show the model the submission tool next to the server's own tools, and route calls to it:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
const tools = [...(await client.listTools()).tools];
|
|
41
|
+
if (changeRequests.enabled()) tools.push(changeRequests.submissionTool());
|
|
42
|
+
|
|
43
|
+
// when the model calls it
|
|
44
|
+
const result = await changeRequests.callSubmissionTool(args);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Pass every result from the server through `inspect`:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
const raw = await client.callTool({ name, arguments: args });
|
|
51
|
+
const { result, inbox } = await changeRequests.inspect(raw);
|
|
52
|
+
// inbox?.shipped lists requests that shipped with workaroundObsolete: true
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
After a request ships:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
await changeRequests.retestAndConfirm(requestId); // re-runs its tests, confirms pass or fail
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## The ledger
|
|
62
|
+
|
|
63
|
+
The server's status object does not return the acceptance tests or the target, and a session does not outlive its task. The ledger keeps what the client needs between sessions: each request's target, tests, workaround, last status, and the daily count behind the cap. `FileLedger` keeps one JSON file per server; `MemoryLedger` is for tests. Nothing in the ledger is sent anywhere.
|
|
64
|
+
|
|
65
|
+
## Redaction
|
|
66
|
+
|
|
67
|
+
`redactSubmission` replaces credentials (API keys, bearer tokens, JWTs, private keys, `password=` assignments, credentials in URLs), email addresses, phone numbers, IP addresses, file paths, and long opaque tokens with placeholders such as `<email>` and `<path>`. It also replaces the values only your app knows are sensitive (`sensitiveValues`) and the names of other servers' tools (`foreignNames`). The findings it returns name the field and the rule, never the removed value.
|
|
68
|
+
|
|
69
|
+
It is a safety net, not a guarantee. When the client cannot verify that a request is clean, give it a `review` hook (and `reviewAll: true` to review every request).
|
|
70
|
+
|
|
71
|
+
## Not in this version
|
|
72
|
+
|
|
73
|
+
- Anonymous tickets. Servers built on the matching server package do not accept anonymous requests.
|
|
74
|
+
- The changes feed (`changeRequests/changes`) and Events subscriptions. The inbox covers the return path; push delivery comes with an Events client.
|
|
75
|
+
- Per-request `_meta` advertisement on calls the app makes itself. The client advertises at `initialize`, which is what SDK 1.x servers read, and adds the per-request form on its own `changeRequests/*` calls.
|
|
76
|
+
|
|
77
|
+
## Releasing (maintainers)
|
|
78
|
+
|
|
79
|
+
1. Update `version` in `packages/client/package.json` and add a CHANGELOG entry.
|
|
80
|
+
2. Merge to `main`, then create the tag `client-v` plus the version, for example `client-v0.1.0`. Either push it, or draft a GitHub Release on `main` with that new tag and publish it.
|
|
81
|
+
3. The release workflow runs the tests, builds, and publishes to npm with provenance.
|
|
82
|
+
|
|
83
|
+
The workflow publishes through npm trusted publishing, so no npm token is stored. Set it up on npmjs.com under the package's **Settings**, **Trusted publishing**, **GitHub Actions**, with this repository and the workflow file `release-client.yml`. For the very first release, before the package exists on npm, add a short-lived granular access token as the repository secret `NPM_TOKEN`, then delete it once trusted publishing is set up.
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
MIT.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-runs an acceptance test against the server, under the client's own
|
|
3
|
+
* authorization (SEP section 11), and checks the expected result.
|
|
4
|
+
*/
|
|
5
|
+
import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
6
|
+
import type { AcceptanceTest } from "./types.js";
|
|
7
|
+
export interface TestRun {
|
|
8
|
+
outcome: "pass" | "fail";
|
|
9
|
+
/** Why a test failed, for the confirmation note. Never includes result content. */
|
|
10
|
+
reasons: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare function runAcceptanceTest(client: Client, test: AcceptanceTest): Promise<TestRun>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { AjvJsonSchemaValidator } from "@modelcontextprotocol/sdk/validation/ajv";
|
|
2
|
+
function textOf(items) {
|
|
3
|
+
return (items ?? [])
|
|
4
|
+
.map((c) => c.text ?? c.resource?.text ?? c.content?.text ?? "")
|
|
5
|
+
.filter(Boolean)
|
|
6
|
+
.join("\n");
|
|
7
|
+
}
|
|
8
|
+
const validator = new AjvJsonSchemaValidator();
|
|
9
|
+
export async function runAcceptanceTest(client, test) {
|
|
10
|
+
const reasons = [];
|
|
11
|
+
let isError = false;
|
|
12
|
+
let text = "";
|
|
13
|
+
let structured;
|
|
14
|
+
try {
|
|
15
|
+
const params = (test.call.params ?? {});
|
|
16
|
+
if (test.call.method === "tools/call") {
|
|
17
|
+
const result = (await client.callTool(params));
|
|
18
|
+
isError = result.isError === true;
|
|
19
|
+
text = textOf(result.content);
|
|
20
|
+
structured = result.structuredContent;
|
|
21
|
+
}
|
|
22
|
+
else if (test.call.method === "resources/read") {
|
|
23
|
+
const result = await client.readResource(params);
|
|
24
|
+
text = textOf(result.contents);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const result = await client.getPrompt(params);
|
|
28
|
+
text = textOf(result.messages.map((m) => m.content));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// A protocol error counts as an error result.
|
|
33
|
+
isError = true;
|
|
34
|
+
}
|
|
35
|
+
const expect = test.expect ?? {};
|
|
36
|
+
const wantError = expect.isError ?? false;
|
|
37
|
+
if (isError !== wantError)
|
|
38
|
+
reasons.push(wantError ? "expected an error, got a result" : "the call returned an error");
|
|
39
|
+
for (const needle of expect.textContains ?? []) {
|
|
40
|
+
if (!text.includes(needle))
|
|
41
|
+
reasons.push("the text did not contain an expected string");
|
|
42
|
+
}
|
|
43
|
+
if (expect.structuredContentSchema) {
|
|
44
|
+
if (structured === undefined) {
|
|
45
|
+
reasons.push("no structured result");
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const check = validator.getValidator(expect.structuredContentSchema)(structured);
|
|
49
|
+
if (!check.valid)
|
|
50
|
+
reasons.push("the structured result did not match the expected schema");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return { outcome: reasons.length === 0 ? "pass" : "fail", reasons };
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=acceptance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acceptance.js","sourceRoot":"","sources":["../src/acceptance.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAgBlF,SAAS,MAAM,CAAC,KAAgC;IAC9C,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;SACjB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC;SAC/D,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,MAAM,SAAS,GAAG,IAAI,sBAAsB,EAAE,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAAc,EAAE,IAAoB;IAC1E,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,UAAmB,CAAC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AM,IAAI,MAAM,CAAC,YAAY,IAAI,EAAE,EAAE,CAAC;QAC/C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;IAC1F,CAAC;IACD,IAAI,MAAM,CAAC,uBAAuB,EAAE,CAAC;QACnC,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,GAAG,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,uBAAgC,CAAC,CAAC,UAAU,CAAC,CAAC;YAC1F,IAAI,CAAC,KAAK,CAAC,KAAK;gBAAE,OAAO,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;AACtE,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
2
|
+
import type { ClientCapabilities } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import { type Ledger, type LedgerEntry } from "./ledger.js";
|
|
4
|
+
import { type RedactOptions, type RedactionFinding } from "./redact.js";
|
|
5
|
+
import { type ConfirmParams, type ServerSettings, type Status, type StatusObject, type SubmitParams, type SubmitResult } from "./types.js";
|
|
6
|
+
export declare const CLIENT_CAPABILITIES_META_KEY = "io.modelcontextprotocol/clientCapabilities";
|
|
7
|
+
export interface ConsentOptions {
|
|
8
|
+
/** True only when the user or operator turned the extension on for this server. */
|
|
9
|
+
consent: boolean | (() => boolean);
|
|
10
|
+
/** An ephemeral or incognito session. Nothing overrides it: no advertising, no submissions. */
|
|
11
|
+
ephemeral?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface ChangeRequestsClientOptions extends ConsentOptions {
|
|
14
|
+
/** The identifier the server advertises, e.g. "com.example/change-requests". */
|
|
15
|
+
extensionId: string;
|
|
16
|
+
/** A name for the server in the tool description the model sees. */
|
|
17
|
+
serverName?: string;
|
|
18
|
+
/** Most submissions to this server per UTC day. Default 5. */
|
|
19
|
+
dailyCap?: number;
|
|
20
|
+
redaction?: RedactOptions;
|
|
21
|
+
/**
|
|
22
|
+
* Called before each submission with the redacted request and where redaction fired.
|
|
23
|
+
* Return false to cancel, or a revised request. Use it to let the user review.
|
|
24
|
+
* Called on every submission when reviewAll is true, otherwise only when a rule fired.
|
|
25
|
+
*/
|
|
26
|
+
review?: (draft: SubmitParams, findings: RedactionFinding[]) => boolean | SubmitParams | Promise<boolean | SubmitParams>;
|
|
27
|
+
reviewAll?: boolean;
|
|
28
|
+
/** Where requests are remembered between sessions. Default: in memory. */
|
|
29
|
+
ledger?: Ledger;
|
|
30
|
+
/** Called once per newly shipped request whose workaround is now obsolete. */
|
|
31
|
+
onShipped?: (status: StatusObject, entry: LedgerEntry) => void | Promise<void>;
|
|
32
|
+
/** Name of the model-facing submission tool. Default file_change_request. */
|
|
33
|
+
toolName?: string;
|
|
34
|
+
now?: () => Date;
|
|
35
|
+
}
|
|
36
|
+
export type SubmitOutcome = {
|
|
37
|
+
submitted: true;
|
|
38
|
+
result: SubmitResult;
|
|
39
|
+
findings: RedactionFinding[];
|
|
40
|
+
} | {
|
|
41
|
+
submitted: false;
|
|
42
|
+
reason: "already_filed";
|
|
43
|
+
requestId: string;
|
|
44
|
+
status: Status;
|
|
45
|
+
} | {
|
|
46
|
+
submitted: false;
|
|
47
|
+
reason: "cancelled" | "daily_cap" | "not_enabled" | "kind_unsupported";
|
|
48
|
+
};
|
|
49
|
+
export interface InboxCheck {
|
|
50
|
+
/** Requests whose status changed since the last check. */
|
|
51
|
+
updated: StatusObject[];
|
|
52
|
+
/** Of those, the ones that shipped with workaroundObsolete true. */
|
|
53
|
+
shipped: StatusObject[];
|
|
54
|
+
}
|
|
55
|
+
export interface Inspection<R> {
|
|
56
|
+
/** The update count the server announced, 0 when none. */
|
|
57
|
+
updates: number;
|
|
58
|
+
/** The result, with the notice line removed when this client must not act on it. */
|
|
59
|
+
result: R;
|
|
60
|
+
/** Present when the client read its inbox because of the notice. */
|
|
61
|
+
inbox?: InboxCheck;
|
|
62
|
+
}
|
|
63
|
+
/** The capabilities to pass to new Client(): the extension is advertised only when allowed. */
|
|
64
|
+
export declare function changeRequestsCapabilities(extensionId: string, consent: ConsentOptions, base?: ClientCapabilities): ClientCapabilities;
|
|
65
|
+
export declare class ChangeRequestsClient {
|
|
66
|
+
readonly extensionId: string;
|
|
67
|
+
private readonly client;
|
|
68
|
+
private readonly options;
|
|
69
|
+
private readonly ledger;
|
|
70
|
+
private readonly now;
|
|
71
|
+
constructor(client: Client, options: ChangeRequestsClientOptions);
|
|
72
|
+
/** The server's settings for the extension, or null when it does not advertise it. */
|
|
73
|
+
settings(): ServerSettings | null;
|
|
74
|
+
/** Consent given, not ephemeral, and the server supports the extension. */
|
|
75
|
+
enabled(): boolean;
|
|
76
|
+
/** The one submission tool to show the model. Its description is the client's, not the server's. */
|
|
77
|
+
submissionTool(): {
|
|
78
|
+
name: string;
|
|
79
|
+
description: string;
|
|
80
|
+
inputSchema: Record<string, unknown>;
|
|
81
|
+
};
|
|
82
|
+
/** Runs the submission tool for the model and returns a tool result for it. */
|
|
83
|
+
callSubmissionTool(args: Record<string, unknown>): Promise<{
|
|
84
|
+
content: {
|
|
85
|
+
type: "text";
|
|
86
|
+
text: string;
|
|
87
|
+
}[];
|
|
88
|
+
isError?: boolean;
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* Submits a request after the client-side checks: consent, kind, daily cap,
|
|
92
|
+
* not already filed for the same target, redaction, and review.
|
|
93
|
+
*/
|
|
94
|
+
submit(input: SubmitParams): Promise<SubmitOutcome>;
|
|
95
|
+
get(requestId: string): Promise<StatusObject>;
|
|
96
|
+
list(query?: {
|
|
97
|
+
status?: Status[];
|
|
98
|
+
updatedSince?: string;
|
|
99
|
+
cursor?: string;
|
|
100
|
+
}): Promise<{
|
|
101
|
+
requests: StatusObject[];
|
|
102
|
+
nextCursor?: string;
|
|
103
|
+
}>;
|
|
104
|
+
withdraw(requestId: string): Promise<StatusObject>;
|
|
105
|
+
confirm(params: ConfirmParams): Promise<StatusObject>;
|
|
106
|
+
/**
|
|
107
|
+
* Looks at any result from this server. When it announces updates and the client may
|
|
108
|
+
* act on them, reads the inbox. When the client must not act (no consent, ephemeral),
|
|
109
|
+
* removes the notice line so the model never sees it (SEP section 9).
|
|
110
|
+
*/
|
|
111
|
+
inspect<R extends {
|
|
112
|
+
content?: unknown[];
|
|
113
|
+
_meta?: Record<string, unknown>;
|
|
114
|
+
}>(result: R): Promise<Inspection<R>>;
|
|
115
|
+
/**
|
|
116
|
+
* Reads the inbox and returns what changed since the client last looked. Shipped
|
|
117
|
+
* requests with an obsolete workaround are marked in the ledger and passed to onShipped.
|
|
118
|
+
*/
|
|
119
|
+
checkInbox(): Promise<InboxCheck>;
|
|
120
|
+
/**
|
|
121
|
+
* Re-runs the acceptance tests this client sent with a shipped request, under its own
|
|
122
|
+
* authorization, and confirms with the per-test outcomes.
|
|
123
|
+
*/
|
|
124
|
+
retestAndConfirm(requestId: string, note?: string): Promise<{
|
|
125
|
+
outcome: "pass" | "fail";
|
|
126
|
+
status: StatusObject;
|
|
127
|
+
}>;
|
|
128
|
+
/** What the ledger knows, for showing the user or a later session. */
|
|
129
|
+
entries(): LedgerEntry[];
|
|
130
|
+
private call;
|
|
131
|
+
/** An open request of this client's for the same target, checked against the server. */
|
|
132
|
+
private findOpen;
|
|
133
|
+
private remember;
|
|
134
|
+
}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client support for the Agent Change Requests extension, on top of Client from
|
|
3
|
+
* @modelcontextprotocol/sdk.
|
|
4
|
+
*
|
|
5
|
+
* - Advertises the extension, only with consent and never from an ephemeral session.
|
|
6
|
+
* - Gives the model one submission tool whose description the client writes.
|
|
7
|
+
* - Redacts every model-written field, applies a daily cap, and skips gaps it already filed.
|
|
8
|
+
* - Reads the inbox when a response carries an update count, and records what shipped.
|
|
9
|
+
* - Re-runs its own acceptance tests and confirms the result.
|
|
10
|
+
*/
|
|
11
|
+
import { randomUUID } from "node:crypto";
|
|
12
|
+
import { ResultSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
13
|
+
import { runAcceptanceTest } from "./acceptance.js";
|
|
14
|
+
import { MemoryLedger } from "./ledger.js";
|
|
15
|
+
import { redactSubmission } from "./redact.js";
|
|
16
|
+
import { TERMINAL_STATUSES, } from "./types.js";
|
|
17
|
+
export const CLIENT_CAPABILITIES_META_KEY = "io.modelcontextprotocol/clientCapabilities";
|
|
18
|
+
/** The text line servers add while updates wait. Matches any wording that carries the count. */
|
|
19
|
+
const NOTICE_LINE = /\b(\d+) of your change requests (?:has|have) an update\b/;
|
|
20
|
+
/** The capabilities to pass to new Client(): the extension is advertised only when allowed. */
|
|
21
|
+
export function changeRequestsCapabilities(extensionId, consent, base = {}) {
|
|
22
|
+
if (!allowed(consent))
|
|
23
|
+
return base;
|
|
24
|
+
const extensions = { ...(base.extensions ?? {}), [extensionId]: {} };
|
|
25
|
+
return { ...base, extensions };
|
|
26
|
+
}
|
|
27
|
+
function allowed(consent) {
|
|
28
|
+
if (consent.ephemeral)
|
|
29
|
+
return false;
|
|
30
|
+
return typeof consent.consent === "function" ? consent.consent() === true : consent.consent === true;
|
|
31
|
+
}
|
|
32
|
+
function utcDay(date) {
|
|
33
|
+
return date.toISOString().slice(0, 10);
|
|
34
|
+
}
|
|
35
|
+
function sameTarget(a, b) {
|
|
36
|
+
if (!a || !b)
|
|
37
|
+
return false;
|
|
38
|
+
return a.type === b.type && (a.name ?? "") === (b.name ?? "");
|
|
39
|
+
}
|
|
40
|
+
export class ChangeRequestsClient {
|
|
41
|
+
extensionId;
|
|
42
|
+
client;
|
|
43
|
+
options;
|
|
44
|
+
ledger;
|
|
45
|
+
now;
|
|
46
|
+
constructor(client, options) {
|
|
47
|
+
this.client = client;
|
|
48
|
+
this.options = options;
|
|
49
|
+
this.extensionId = options.extensionId;
|
|
50
|
+
this.ledger = options.ledger ?? new MemoryLedger();
|
|
51
|
+
this.now = options.now ?? (() => new Date());
|
|
52
|
+
}
|
|
53
|
+
/** The server's settings for the extension, or null when it does not advertise it. */
|
|
54
|
+
settings() {
|
|
55
|
+
const extensions = this.client.getServerCapabilities()?.extensions;
|
|
56
|
+
const settings = extensions?.[this.extensionId];
|
|
57
|
+
return settings && Array.isArray(settings.kinds) ? settings : null;
|
|
58
|
+
}
|
|
59
|
+
/** Consent given, not ephemeral, and the server supports the extension. */
|
|
60
|
+
enabled() {
|
|
61
|
+
return allowed(this.options) && this.settings() !== null;
|
|
62
|
+
}
|
|
63
|
+
// ---- The model-facing tool ----------------------------------------------
|
|
64
|
+
/** The one submission tool to show the model. Its description is the client's, not the server's. */
|
|
65
|
+
submissionTool() {
|
|
66
|
+
const settings = this.settings();
|
|
67
|
+
const server = this.options.serverName ?? "this server";
|
|
68
|
+
const kinds = settings?.kinds ?? ["bug", "friction", "missing_capability", "feature_request"];
|
|
69
|
+
const properties = {
|
|
70
|
+
kind: { type: "string", enum: kinds, description: "bug: it is broken. friction: it works but costs extra work. missing_capability: it cannot be done. feature_request: a new idea." },
|
|
71
|
+
title: { type: "string", maxLength: 120, description: "One line." },
|
|
72
|
+
description: { type: "string", maxLength: 4000, description: "What is broken or missing and what would have helped. Plain text." },
|
|
73
|
+
target: {
|
|
74
|
+
type: "object",
|
|
75
|
+
properties: { type: { type: "string", enum: ["tool", "resource", "prompt", "server"] }, name: { type: "string" } },
|
|
76
|
+
required: ["type"],
|
|
77
|
+
description: `Which of ${server}'s tools, resources, or prompts this is about.`,
|
|
78
|
+
},
|
|
79
|
+
context: {
|
|
80
|
+
type: "object",
|
|
81
|
+
properties: {
|
|
82
|
+
goal: { type: "string", description: "What you were trying to get done, in general terms." },
|
|
83
|
+
workaround: { type: "string", description: "What you did instead." },
|
|
84
|
+
cause: { type: "string", maxLength: 500, description: "Your guess at why the gap exists. It is read as a guess." },
|
|
85
|
+
attempts: { type: "array", maxItems: 5, items: { type: "object" }, description: "Up to 5 calls you tried and what happened. Made-up example values only." },
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
failureMode: { type: "string", description: "capability_missing, interface_cost, data_gap, discoverability, scope_not_honored, or silent_failure." },
|
|
89
|
+
impact: {
|
|
90
|
+
type: "object",
|
|
91
|
+
properties: {
|
|
92
|
+
blocked: { type: "boolean" },
|
|
93
|
+
frequency: { type: "string", enum: ["once", "recurring"] },
|
|
94
|
+
severity: { type: "string", enum: ["low", "medium", "high"] },
|
|
95
|
+
detectability: { type: "string", enum: ["immediate", "eventual", "hidden"] },
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
if (settings?.acceptanceTests) {
|
|
100
|
+
properties.acceptanceTests = {
|
|
101
|
+
type: "array",
|
|
102
|
+
maxItems: 10,
|
|
103
|
+
description: "The exact call you wanted and the result you expected. Made-up example values only.",
|
|
104
|
+
items: {
|
|
105
|
+
type: "object",
|
|
106
|
+
properties: {
|
|
107
|
+
description: { type: "string" },
|
|
108
|
+
call: {
|
|
109
|
+
type: "object",
|
|
110
|
+
properties: { method: { type: "string", enum: ["tools/call", "resources/read", "prompts/get"] }, params: { type: "object" } },
|
|
111
|
+
required: ["method"],
|
|
112
|
+
},
|
|
113
|
+
expect: {
|
|
114
|
+
type: "object",
|
|
115
|
+
properties: {
|
|
116
|
+
isError: { type: "boolean" },
|
|
117
|
+
structuredContentSchema: { type: "object" },
|
|
118
|
+
textContains: { type: "array", items: { type: "string" }, maxItems: 5 },
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
required: ["call"],
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
name: this.options.toolName ?? "file_change_request",
|
|
128
|
+
description: [
|
|
129
|
+
`Tell ${server}'s maintainers about a gap you hit in its tools, and get an answer when it is fixed.`,
|
|
130
|
+
"Use it only when the gap blocked your task, has come up more than once, or the user asked. Do not file one-off edge cases you worked around cheaply.",
|
|
131
|
+
settings?.acceptanceTests ? "Include an acceptance test: the call you wanted and the result you expected." : "",
|
|
132
|
+
"Write in general terms. Never include credentials, personal data, the user's words, file contents, file paths, or anything about other servers. Use made-up example values.",
|
|
133
|
+
]
|
|
134
|
+
.filter(Boolean)
|
|
135
|
+
.join(" "),
|
|
136
|
+
inputSchema: { type: "object", properties, required: ["kind", "title", "description"] },
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/** Runs the submission tool for the model and returns a tool result for it. */
|
|
140
|
+
async callSubmissionTool(args) {
|
|
141
|
+
const text = (t, isError = false) => ({ content: [{ type: "text", text: t }], ...(isError ? { isError } : {}) });
|
|
142
|
+
try {
|
|
143
|
+
const outcome = await this.submit(args);
|
|
144
|
+
if (outcome.submitted) {
|
|
145
|
+
return text(`Filed as ${outcome.result.requestId} (${outcome.result.status}). You will hear back through the inbox when it changes.`);
|
|
146
|
+
}
|
|
147
|
+
switch (outcome.reason) {
|
|
148
|
+
case "already_filed":
|
|
149
|
+
return text(`You already filed this gap as ${outcome.requestId}, which is ${outcome.status}. Keep your workaround for now.`);
|
|
150
|
+
case "daily_cap":
|
|
151
|
+
return text("The daily limit for change requests to this server is reached. Tell the user instead.", true);
|
|
152
|
+
case "cancelled":
|
|
153
|
+
return text("The user did not send this request.", true);
|
|
154
|
+
case "kind_unsupported":
|
|
155
|
+
return text("This server does not accept that kind of request.", true);
|
|
156
|
+
default:
|
|
157
|
+
return text("Change requests are not turned on for this server.", true);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
return text(`The server refused the request: ${error instanceof Error ? error.message : "unknown error"}`, true);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
// ---- Protocol methods ---------------------------------------------------
|
|
165
|
+
/**
|
|
166
|
+
* Submits a request after the client-side checks: consent, kind, daily cap,
|
|
167
|
+
* not already filed for the same target, redaction, and review.
|
|
168
|
+
*/
|
|
169
|
+
async submit(input) {
|
|
170
|
+
if (!this.enabled())
|
|
171
|
+
return { submitted: false, reason: "not_enabled" };
|
|
172
|
+
const settings = this.settings();
|
|
173
|
+
if (!settings.kinds.includes(input.kind))
|
|
174
|
+
return { submitted: false, reason: "kind_unsupported" };
|
|
175
|
+
const data = this.ledger.load();
|
|
176
|
+
const day = utcDay(this.now());
|
|
177
|
+
const cap = this.options.dailyCap ?? 5;
|
|
178
|
+
if (cap > 0 && (data.submissions[day] ?? 0) >= cap)
|
|
179
|
+
return { submitted: false, reason: "daily_cap" };
|
|
180
|
+
if (input.target) {
|
|
181
|
+
const open = await this.findOpen(input.target, data);
|
|
182
|
+
if (open)
|
|
183
|
+
return { submitted: false, reason: "already_filed", requestId: open.requestId, status: open.status };
|
|
184
|
+
}
|
|
185
|
+
const { acceptanceTests, idempotencyKey, ...rest } = input;
|
|
186
|
+
const draft = { ...rest };
|
|
187
|
+
if (acceptanceTests && settings.acceptanceTests)
|
|
188
|
+
draft.acceptanceTests = acceptanceTests;
|
|
189
|
+
let { params, findings } = redactSubmission(draft, this.options.redaction);
|
|
190
|
+
if (this.options.review && (this.options.reviewAll || findings.length > 0)) {
|
|
191
|
+
const verdict = await this.options.review(params, findings);
|
|
192
|
+
if (verdict === false)
|
|
193
|
+
return { submitted: false, reason: "cancelled" };
|
|
194
|
+
if (verdict !== true)
|
|
195
|
+
({ params, findings } = redactSubmission(verdict, this.options.redaction));
|
|
196
|
+
}
|
|
197
|
+
params.idempotencyKey = idempotencyKey ?? randomUUID();
|
|
198
|
+
const result = (await this.call("changeRequests/submit", params));
|
|
199
|
+
const at = this.now().toISOString();
|
|
200
|
+
const fresh = this.ledger.load();
|
|
201
|
+
fresh.submissions[day] = (fresh.submissions[day] ?? 0) + 1;
|
|
202
|
+
const entry = { requestId: result.requestId, title: params.title, status: result.status, submittedAt: at, updatedAt: at };
|
|
203
|
+
if (params.target)
|
|
204
|
+
entry.target = params.target;
|
|
205
|
+
// Keep the tests as sent, so the client re-runs exactly what the server stored.
|
|
206
|
+
if (params.acceptanceTests)
|
|
207
|
+
entry.acceptanceTests = params.acceptanceTests;
|
|
208
|
+
if (input.context?.workaround)
|
|
209
|
+
entry.workaround = input.context.workaround;
|
|
210
|
+
fresh.requests[result.requestId] = entry;
|
|
211
|
+
this.ledger.save(fresh);
|
|
212
|
+
return { submitted: true, result, findings };
|
|
213
|
+
}
|
|
214
|
+
async get(requestId) {
|
|
215
|
+
const status = (await this.call("changeRequests/get", { requestId }));
|
|
216
|
+
this.remember([status]);
|
|
217
|
+
return status;
|
|
218
|
+
}
|
|
219
|
+
async list(query = {}) {
|
|
220
|
+
const page = (await this.call("changeRequests/list", query));
|
|
221
|
+
this.remember(page.requests);
|
|
222
|
+
return page;
|
|
223
|
+
}
|
|
224
|
+
async withdraw(requestId) {
|
|
225
|
+
const status = (await this.call("changeRequests/withdraw", { requestId }));
|
|
226
|
+
this.remember([status]);
|
|
227
|
+
return status;
|
|
228
|
+
}
|
|
229
|
+
async confirm(params) {
|
|
230
|
+
const status = (await this.call("changeRequests/confirm", params));
|
|
231
|
+
const data = this.ledger.load();
|
|
232
|
+
const entry = data.requests[params.requestId];
|
|
233
|
+
if (entry) {
|
|
234
|
+
entry.confirmed = params.outcome;
|
|
235
|
+
this.ledger.save(data);
|
|
236
|
+
}
|
|
237
|
+
return status;
|
|
238
|
+
}
|
|
239
|
+
// ---- Inbox and confirmation ----------------------------------------------
|
|
240
|
+
/**
|
|
241
|
+
* Looks at any result from this server. When it announces updates and the client may
|
|
242
|
+
* act on them, reads the inbox. When the client must not act (no consent, ephemeral),
|
|
243
|
+
* removes the notice line so the model never sees it (SEP section 9).
|
|
244
|
+
*/
|
|
245
|
+
async inspect(result) {
|
|
246
|
+
const fromMeta = result._meta?.[this.extensionId]?.updates;
|
|
247
|
+
let updates = typeof fromMeta === "number" ? fromMeta : 0;
|
|
248
|
+
const content = Array.isArray(result.content) ? result.content : [];
|
|
249
|
+
const isNotice = (c) => {
|
|
250
|
+
const text = c.text;
|
|
251
|
+
return c.type === "text" && typeof text === "string" && NOTICE_LINE.test(text);
|
|
252
|
+
};
|
|
253
|
+
if (updates === 0) {
|
|
254
|
+
const line = content.find(isNotice);
|
|
255
|
+
const match = line ? NOTICE_LINE.exec(line.text) : null;
|
|
256
|
+
if (match)
|
|
257
|
+
updates = Number(match[1]);
|
|
258
|
+
}
|
|
259
|
+
if (!allowed(this.options)) {
|
|
260
|
+
return { updates: 0, result: { ...result, content: content.filter((c) => !isNotice(c)) } };
|
|
261
|
+
}
|
|
262
|
+
if (updates > 0 && this.enabled()) {
|
|
263
|
+
return { updates, result, inbox: await this.checkInbox() };
|
|
264
|
+
}
|
|
265
|
+
return { updates, result };
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Reads the inbox and returns what changed since the client last looked. Shipped
|
|
269
|
+
* requests with an obsolete workaround are marked in the ledger and passed to onShipped.
|
|
270
|
+
*/
|
|
271
|
+
async checkInbox() {
|
|
272
|
+
const before = this.ledger.load();
|
|
273
|
+
const updated = [];
|
|
274
|
+
let cursor;
|
|
275
|
+
do {
|
|
276
|
+
const page = await this.list(cursor ? { cursor } : {});
|
|
277
|
+
for (const status of page.requests) {
|
|
278
|
+
const known = before.requests[status.requestId];
|
|
279
|
+
if (!known || known.status !== status.status || known.updatedAt !== status.updatedAt)
|
|
280
|
+
updated.push(status);
|
|
281
|
+
}
|
|
282
|
+
cursor = page.nextCursor;
|
|
283
|
+
} while (cursor);
|
|
284
|
+
const shipped = updated.filter((s) => s.status === "shipped" && s.resolution?.workaroundObsolete === true);
|
|
285
|
+
const after = this.ledger.load();
|
|
286
|
+
for (const status of shipped) {
|
|
287
|
+
const entry = after.requests[status.requestId];
|
|
288
|
+
if (!entry || before.requests[status.requestId]?.workaroundObsolete)
|
|
289
|
+
continue;
|
|
290
|
+
await this.options.onShipped?.(status, entry);
|
|
291
|
+
}
|
|
292
|
+
return { updated, shipped };
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Re-runs the acceptance tests this client sent with a shipped request, under its own
|
|
296
|
+
* authorization, and confirms with the per-test outcomes.
|
|
297
|
+
*/
|
|
298
|
+
async retestAndConfirm(requestId, note) {
|
|
299
|
+
const entry = this.ledger.load().requests[requestId];
|
|
300
|
+
const tests = entry?.acceptanceTests ?? [];
|
|
301
|
+
if (tests.length === 0)
|
|
302
|
+
throw new Error("No acceptance tests recorded for this request. Call confirm() with your own outcome.");
|
|
303
|
+
const runs = [];
|
|
304
|
+
for (const test of tests)
|
|
305
|
+
runs.push(await runAcceptanceTest(this.client, test));
|
|
306
|
+
const outcome = runs.every((r) => r.outcome === "pass") ? "pass" : "fail";
|
|
307
|
+
const reasons = runs.flatMap((r, i) => r.reasons.map((reason) => `test ${i}: ${reason}`));
|
|
308
|
+
const params = { requestId, outcome, tests: runs.map((r, index) => ({ index, outcome: r.outcome })) };
|
|
309
|
+
const text = note ?? (reasons.length ? reasons.join("; ") : undefined);
|
|
310
|
+
if (text)
|
|
311
|
+
params.note = text.slice(0, 1000);
|
|
312
|
+
return { outcome, status: await this.confirm(params) };
|
|
313
|
+
}
|
|
314
|
+
/** What the ledger knows, for showing the user or a later session. */
|
|
315
|
+
entries() {
|
|
316
|
+
return Object.values(this.ledger.load().requests);
|
|
317
|
+
}
|
|
318
|
+
// ---- Helpers --------------------------------------------------------------
|
|
319
|
+
async call(method, params) {
|
|
320
|
+
if (!this.enabled())
|
|
321
|
+
throw new Error("Change requests are not enabled for this server.");
|
|
322
|
+
const withMeta = { ...params, _meta: { [CLIENT_CAPABILITIES_META_KEY]: { extensions: { [this.extensionId]: {} } } } };
|
|
323
|
+
return (await this.client.request({ method, params: withMeta }, ResultSchema));
|
|
324
|
+
}
|
|
325
|
+
/** An open request of this client's for the same target, checked against the server. */
|
|
326
|
+
async findOpen(target, data) {
|
|
327
|
+
const isOpen = (s) => !TERMINAL_STATUSES.includes(s);
|
|
328
|
+
const candidates = Object.values(data.requests).filter((e) => sameTarget(target, e.target) && isOpen(e.status));
|
|
329
|
+
for (const candidate of candidates) {
|
|
330
|
+
try {
|
|
331
|
+
const status = await this.get(candidate.requestId);
|
|
332
|
+
if (isOpen(status.status))
|
|
333
|
+
return status;
|
|
334
|
+
}
|
|
335
|
+
catch {
|
|
336
|
+
// Gone from the server: not a reason to skip filing.
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
remember(statuses) {
|
|
342
|
+
const data = this.ledger.load();
|
|
343
|
+
let changed = false;
|
|
344
|
+
for (const status of statuses) {
|
|
345
|
+
const entry = data.requests[status.requestId];
|
|
346
|
+
if (!entry)
|
|
347
|
+
continue;
|
|
348
|
+
entry.status = status.status;
|
|
349
|
+
entry.updatedAt = status.updatedAt;
|
|
350
|
+
if (status.status === "shipped" && status.resolution?.workaroundObsolete)
|
|
351
|
+
entry.workaroundObsolete = true;
|
|
352
|
+
changed = true;
|
|
353
|
+
}
|
|
354
|
+
if (changed)
|
|
355
|
+
this.ledger.save(data);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAkD,MAAM,aAAa,CAAC;AAC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AAC;QACjB,CAAC;QACD,IAAI,OAAO;YAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export { ChangeRequestsClient, changeRequestsCapabilities, CLIENT_CAPABILITIES_META_KEY, type ChangeRequestsClientOptions, type ConsentOptions, type InboxCheck, type Inspection, type SubmitOutcome, } from "./client.js";
|
|
3
|
+
export { runAcceptanceTest, type TestRun } from "./acceptance.js";
|
|
4
|
+
export { DEFAULT_RULES, Redactor, redactSubmission, type RedactOptions, type RedactionFinding, type RedactionRule } from "./redact.js";
|
|
5
|
+
export { FileLedger, MemoryLedger, type Ledger, type LedgerData, type LedgerEntry } from "./ledger.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export { ChangeRequestsClient, changeRequestsCapabilities, CLIENT_CAPABILITIES_META_KEY, } from "./client.js";
|
|
3
|
+
export { runAcceptanceTest } from "./acceptance.js";
|
|
4
|
+
export { DEFAULT_RULES, Redactor, redactSubmission } from "./redact.js";
|
|
5
|
+
export { FileLedger, MemoryLedger } from "./ledger.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,GAM7B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAgB,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAiE,MAAM,aAAa,CAAC;AACvI,OAAO,EAAE,UAAU,EAAE,YAAY,EAAkD,MAAM,aAAa,CAAC"}
|
package/dist/ledger.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AcceptanceTest, Status, Target } from "./types.js";
|
|
2
|
+
export interface LedgerEntry {
|
|
3
|
+
requestId: string;
|
|
4
|
+
title: string;
|
|
5
|
+
target?: Target;
|
|
6
|
+
acceptanceTests?: AcceptanceTest[];
|
|
7
|
+
/** The workaround this client uses until the request ships. */
|
|
8
|
+
workaround?: string;
|
|
9
|
+
status: Status;
|
|
10
|
+
submittedAt: string;
|
|
11
|
+
updatedAt: string;
|
|
12
|
+
/** Set when the server says the change shipped and the workaround is no longer needed. */
|
|
13
|
+
workaroundObsolete?: boolean;
|
|
14
|
+
/** The client's own verdict, once it has re-run its tests. */
|
|
15
|
+
confirmed?: "pass" | "fail";
|
|
16
|
+
}
|
|
17
|
+
export interface LedgerData {
|
|
18
|
+
requests: Record<string, LedgerEntry>;
|
|
19
|
+
/** Submissions per UTC day, for the client-side cap. */
|
|
20
|
+
submissions: Record<string, number>;
|
|
21
|
+
}
|
|
22
|
+
export interface Ledger {
|
|
23
|
+
load(): LedgerData;
|
|
24
|
+
save(data: LedgerData): void;
|
|
25
|
+
}
|
|
26
|
+
export declare class MemoryLedger implements Ledger {
|
|
27
|
+
private data;
|
|
28
|
+
load(): LedgerData;
|
|
29
|
+
save(data: LedgerData): void;
|
|
30
|
+
}
|
|
31
|
+
/** A ledger in one JSON file per server, for clients whose sessions come and go. */
|
|
32
|
+
export declare class FileLedger implements Ledger {
|
|
33
|
+
private readonly path;
|
|
34
|
+
constructor(path: string);
|
|
35
|
+
load(): LedgerData;
|
|
36
|
+
save(data: LedgerData): void;
|
|
37
|
+
}
|
package/dist/ledger.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the client remembers about its own requests, so a later session can find
|
|
3
|
+
* them (SEP sections 7 and 11): the acceptance tests it sent (the server never returns
|
|
4
|
+
* them), the workaround it is relying on, the last status it saw, and the daily count
|
|
5
|
+
* behind the submission cap. Nothing in it is sent to the server.
|
|
6
|
+
*/
|
|
7
|
+
import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
8
|
+
import { dirname } from "node:path";
|
|
9
|
+
function empty() {
|
|
10
|
+
return { requests: {}, submissions: {} };
|
|
11
|
+
}
|
|
12
|
+
export class MemoryLedger {
|
|
13
|
+
data = empty();
|
|
14
|
+
load() {
|
|
15
|
+
return structuredClone(this.data);
|
|
16
|
+
}
|
|
17
|
+
save(data) {
|
|
18
|
+
this.data = structuredClone(data);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** A ledger in one JSON file per server, for clients whose sessions come and go. */
|
|
22
|
+
export class FileLedger {
|
|
23
|
+
path;
|
|
24
|
+
constructor(path) {
|
|
25
|
+
this.path = path;
|
|
26
|
+
}
|
|
27
|
+
load() {
|
|
28
|
+
try {
|
|
29
|
+
const parsed = JSON.parse(readFileSync(this.path, "utf8"));
|
|
30
|
+
return { requests: parsed.requests ?? {}, submissions: parsed.submissions ?? {} };
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return empty();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
save(data) {
|
|
37
|
+
mkdirSync(dirname(this.path), { recursive: true });
|
|
38
|
+
const tmp = `${this.path}.tmp`;
|
|
39
|
+
writeFileSync(tmp, `${JSON.stringify(data, null, 2)}\n`);
|
|
40
|
+
renameSync(tmp, this.path);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=ledger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger.js","sourceRoot":"","sources":["../src/ledger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8BpC,SAAS,KAAK;IACZ,OAAO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ass (SEP section 9). A request carries text a model wrote,
|
|
3
|
+
* so before it leaves the user's environment every free-text field and every
|
|
4
|
+
* argument value goes through these rules.
|
|
5
|
+
*
|
|
6
|
+
* Redaction is a safety net, not a guarantee: patterns catch common secrets, contact
|
|
7
|
+
* details, and paths, and the app adds what only it knows (the user's name, workspace
|
|
8
|
+
* and database names, other servers' tool names). When a rule fires, a review hook
|
|
9
|
+
* can show the user the cleaned request before it is sent.
|
|
10
|
+
*/
|
|
11
|
+
export interface RedactionRule {
|
|
12
|
+
name: string;
|
|
13
|
+
pattern: RegExp;
|
|
14
|
+
replacement: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const DEFAULT_RULES: readonly RedactionRule[];
|
|
17
|
+
export interface RedactOptions {
|
|
18
|
+
/** Values only the app knows are sensitive: the user's name, workspace, project, or database names. */
|
|
19
|
+
sensitiveValues?: readonly string[];
|
|
20
|
+
/** Tool, resource, and prompt names of the other servers connected to this client (section 9). */
|
|
21
|
+
foreignNames?: readonly string[];
|
|
22
|
+
/** Replace the default rules. */
|
|
23
|
+
rules?: readonly RedactionRule[];
|
|
24
|
+
/** Rules added after the defaults. */
|
|
25
|
+
extraRules?: readonly RedactionRule[];
|
|
26
|
+
}
|
|
27
|
+
/** Where a rule fired. It never includes the value that was removed. */
|
|
28
|
+
export interface RedactionFinding {
|
|
29
|
+
path: string;
|
|
30
|
+
rule: string;
|
|
31
|
+
}
|
|
32
|
+
export declare class Redactor {
|
|
33
|
+
private readonly rules;
|
|
34
|
+
constructor(options?: RedactOptions);
|
|
35
|
+
/** Redacts one string and reports which rules fired. */
|
|
36
|
+
text(value: string, path?: string, findings?: RedactionFinding[]): string;
|
|
37
|
+
/** Redacts every string inside a JSON value, keys included. */
|
|
38
|
+
value(value: unknown, path: string, findings: RedactionFinding[]): unknown;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Redacts a changeRequests/submit params object. Fixed fields pass through, target.name
|
|
42
|
+
* is checked only against foreign names, and every other string is redacted.
|
|
43
|
+
*/
|
|
44
|
+
export declare function redactSubmission<T extends Record<string, unknown>>(params: T, options?: RedactOptions): {
|
|
45
|
+
params: T;
|
|
46
|
+
findings: RedactionFinding[];
|
|
47
|
+
};
|
package/dist/redact.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The client's redaction pass (SEP section 9). A request carries text a model wrote,
|
|
3
|
+
* so before it leaves the user's environment every free-text field and every
|
|
4
|
+
* argument value goes through these rules.
|
|
5
|
+
*
|
|
6
|
+
* Redaction is a safety net, not a guarantee: patterns catch common secrets, contact
|
|
7
|
+
* details, and paths, and the app adds what only it knows (the user's name, workspace
|
|
8
|
+
* and database names, other servers' tool names). When a rule fires, a review hook
|
|
9
|
+
* can show the user the cleaned request before it is sent.
|
|
10
|
+
*/
|
|
11
|
+
export const DEFAULT_RULES = [
|
|
12
|
+
{ name: "private_key", pattern: /-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g, replacement: "<private-key>" },
|
|
13
|
+
{ name: "jwt", pattern: /\beyJ[\w-]{8,}\.[\w-]{8,}\.[\w-]{8,}\b/g, replacement: "<token>" },
|
|
14
|
+
{ name: "bearer", pattern: /\bBearer\s+[\w.~+/=-]{8,}/gi, replacement: "Bearer <token>" },
|
|
15
|
+
{
|
|
16
|
+
name: "api_key",
|
|
17
|
+
pattern: /\b(?:sk|pk|rk)[-_](?:live[-_]|test[-_])?[A-Za-z0-9_-]{16,}\b|\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}\b|\bgithub_pat_[A-Za-z0-9_]{20,}\b|\bAKIA[0-9A-Z]{16}\b|\bxox[abprs]-[A-Za-z0-9-]{10,}\b|\bAIza[0-9A-Za-z_-]{30,}\b/g,
|
|
18
|
+
replacement: "<secret>",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "assigned_secret",
|
|
22
|
+
pattern: /\b(api[_-]?key|access[_-]?token|auth[_-]?token|secret|password|passwd|pwd)(\s*[:=]\s*)("[^"]*"|'[^']*'|\S+)/gi,
|
|
23
|
+
replacement: "$1$2<secret>",
|
|
24
|
+
},
|
|
25
|
+
{ name: "url_credentials", pattern: /\b([a-z][a-z0-9+.-]*:\/\/)[^\s/@:]+:[^\s/@]+@/gi, replacement: "$1<credentials>@" },
|
|
26
|
+
{ name: "email", pattern: /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g, replacement: "<email>" },
|
|
27
|
+
{ name: "phone", pattern: /(?<![\w-])(?:\+\d{1,3}[\s.-]?)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}(?![\w-])/g, replacement: "<phone>" },
|
|
28
|
+
{ name: "ip_address", pattern: /\b(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)\b/g, replacement: "<ip>" },
|
|
29
|
+
{ name: "windows_path", pattern: /\b[A-Za-z]:\\(?:[^\\\s:*?"<>|]+\\)*[^\\\s:*?"<>|]*/g, replacement: "<path>" },
|
|
30
|
+
{ name: "file_path", pattern: /(?<![\w.:/-])(?:~|\.{1,2})?\/(?:[\w.@-]+\/)+[\w.@-]*/g, replacement: "<path>" },
|
|
31
|
+
{ name: "long_token", pattern: /\b(?=[A-Za-z0-9_-]*\d)(?=[A-Za-z0-9_-]*[A-Za-z])[A-Za-z0-9_-]{40,}\b/g, replacement: "<token>" },
|
|
32
|
+
];
|
|
33
|
+
function escapeRegExp(value) {
|
|
34
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
35
|
+
}
|
|
36
|
+
export class Redactor {
|
|
37
|
+
rules;
|
|
38
|
+
constructor(options = {}) {
|
|
39
|
+
this.rules = [...(options.rules ?? DEFAULT_RULES), ...(options.extraRules ?? [])];
|
|
40
|
+
const literal = (values, name, replacement) => {
|
|
41
|
+
const usable = (values ?? []).filter((v) => v.trim().length >= 2).sort((a, b) => b.length - a.length);
|
|
42
|
+
if (usable.length === 0)
|
|
43
|
+
return;
|
|
44
|
+
this.rules.unshift({
|
|
45
|
+
name,
|
|
46
|
+
pattern: new RegExp(`(?<![\\w])(?:${usable.map(escapeRegExp).join("|")})(?![\\w])`, "gi"),
|
|
47
|
+
replacement,
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
literal(options.foreignNames, "other_server", "<other-server>");
|
|
51
|
+
literal(options.sensitiveValues, "sensitive_value", "<redacted>");
|
|
52
|
+
}
|
|
53
|
+
/** Redacts one string and reports which rules fired. */
|
|
54
|
+
text(value, path = "", findings = []) {
|
|
55
|
+
let out = value;
|
|
56
|
+
for (const rule of this.rules) {
|
|
57
|
+
rule.pattern.lastIndex = 0;
|
|
58
|
+
if (!rule.pattern.test(out))
|
|
59
|
+
continue;
|
|
60
|
+
rule.pattern.lastIndex = 0;
|
|
61
|
+
out = out.replace(rule.pattern, rule.replacement);
|
|
62
|
+
findings.push({ path, rule: rule.name });
|
|
63
|
+
}
|
|
64
|
+
return out;
|
|
65
|
+
}
|
|
66
|
+
/** Redacts every string inside a JSON value, keys included. */
|
|
67
|
+
value(value, path, findings) {
|
|
68
|
+
if (typeof value === "string")
|
|
69
|
+
return this.text(value, path, findings);
|
|
70
|
+
if (Array.isArray(value))
|
|
71
|
+
return value.map((item, i) => this.value(item, `${path}[${i}]`, findings));
|
|
72
|
+
if (value && typeof value === "object") {
|
|
73
|
+
const out = {};
|
|
74
|
+
for (const [key, inner] of Object.entries(value)) {
|
|
75
|
+
out[this.text(key, `${path}{key}`, findings)] = this.value(inner, path ? `${path}.${key}` : key, findings);
|
|
76
|
+
}
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** Fields that hold fixed vocabulary, never model-written text. */
|
|
83
|
+
const FIXED_FIELDS = new Set(["kind", "idempotencyKey", "failureMode", "impact", "origin", "about"]);
|
|
84
|
+
/**
|
|
85
|
+
* Redacts a changeRequests/submit params object. Fixed fields pass through, target.name
|
|
86
|
+
* is checked only against foreign names, and every other string is redacted.
|
|
87
|
+
*/
|
|
88
|
+
export function redactSubmission(params, options = {}) {
|
|
89
|
+
const redactor = new Redactor(options);
|
|
90
|
+
const findings = [];
|
|
91
|
+
const out = {};
|
|
92
|
+
for (const [key, value] of Object.entries(params)) {
|
|
93
|
+
if (FIXED_FIELDS.has(key)) {
|
|
94
|
+
out[key] = value;
|
|
95
|
+
}
|
|
96
|
+
else if (key === "target" && value && typeof value === "object") {
|
|
97
|
+
const target = { ...value };
|
|
98
|
+
if (typeof target.name === "string") {
|
|
99
|
+
target.name = new Redactor({ ...options, rules: [], extraRules: [] }).text(target.name, "target.name", findings);
|
|
100
|
+
}
|
|
101
|
+
out[key] = target;
|
|
102
|
+
}
|
|
103
|
+
else if (key === "acceptanceTests" && Array.isArray(value)) {
|
|
104
|
+
out[key] = value.map((test, i) => {
|
|
105
|
+
const { call, ...rest } = test;
|
|
106
|
+
const cleaned = redactor.value(rest, `acceptanceTests[${i}]`, findings);
|
|
107
|
+
if (call) {
|
|
108
|
+
cleaned.call = {
|
|
109
|
+
method: call.method,
|
|
110
|
+
...(call.params !== undefined
|
|
111
|
+
? { params: redactor.value(call.params, `acceptanceTests[${i}].call.params`, findings) }
|
|
112
|
+
: {}),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return cleaned;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
out[key] = redactor.value(value, key, findings);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return { params: out, findings };
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=redact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../src/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,MAAM,CAAC,MAAM,aAAa,GAA6B;IACrD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,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;gBAC/B,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,IAAyD,CAAC;gBACpF,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,mBAAmB,CAAC,GAAG,EAAE,QAAQ,CAA4B,CAAC;gBACnG,IAAI,IAAI,EAAE,CAAC;oBACT,OAAO,CAAC,IAAI,GAAG;wBACb,MAAM,EAAE,IAAI,CAAC,MAAM;wBACnB,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS;4BAC3B,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,mBAAmB,CAAC,eAAe,EAAE,QAAQ,CAAC,EAAE;4BACxF,CAAC,CAAC,EAAE,CAAC;qBACR,CAAC;gBACJ,CAAC;gBACD,OAAO,OAAO,CAAC;YACjB,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,GAAQ,EAAE,QAAQ,EAAE,CAAC;AACxC,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/** Wire types from SEP-0000, as a client sees them. */
|
|
2
|
+
export type Kind = "bug" | "friction" | "missing_capability" | "feature_request";
|
|
3
|
+
export type Status = "received" | "needs_info" | "triaged" | "planned" | "building" | "shipped" | "declined" | "duplicate" | "withdrawn";
|
|
4
|
+
export declare const TERMINAL_STATUSES: readonly Status[];
|
|
5
|
+
export interface Target {
|
|
6
|
+
type: "tool" | "resource" | "prompt" | "server";
|
|
7
|
+
name?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface AcceptanceTest {
|
|
10
|
+
description?: string;
|
|
11
|
+
call: {
|
|
12
|
+
method: "tools/call" | "resources/read" | "prompts/get";
|
|
13
|
+
params?: Record<string, unknown>;
|
|
14
|
+
};
|
|
15
|
+
expect?: {
|
|
16
|
+
isError?: boolean;
|
|
17
|
+
structuredContentSchema?: Record<string, unknown>;
|
|
18
|
+
textContains?: string[];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/** changeRequests/submit params. idempotencyKey is optional here: the client makes one. */
|
|
22
|
+
export interface SubmitParams {
|
|
23
|
+
kind: Kind;
|
|
24
|
+
title: string;
|
|
25
|
+
description: string;
|
|
26
|
+
target?: Target;
|
|
27
|
+
context?: {
|
|
28
|
+
goal?: string;
|
|
29
|
+
workaround?: string;
|
|
30
|
+
cause?: string;
|
|
31
|
+
attempts?: Record<string, unknown>[];
|
|
32
|
+
};
|
|
33
|
+
failureMode?: string;
|
|
34
|
+
impact?: {
|
|
35
|
+
blocked?: boolean;
|
|
36
|
+
frequency?: "once" | "recurring";
|
|
37
|
+
severity?: "low" | "medium" | "high";
|
|
38
|
+
detectability?: "immediate" | "eventual" | "hidden";
|
|
39
|
+
};
|
|
40
|
+
acceptanceTests?: AcceptanceTest[];
|
|
41
|
+
idempotencyKey?: string;
|
|
42
|
+
[key: string]: unknown;
|
|
43
|
+
}
|
|
44
|
+
export interface SubmitResult {
|
|
45
|
+
requestId: string;
|
|
46
|
+
status: Status;
|
|
47
|
+
duplicateOf: string | null;
|
|
48
|
+
demand: number;
|
|
49
|
+
ticket?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface Resolution {
|
|
52
|
+
availability: "requester" | "all";
|
|
53
|
+
changed?: Target[];
|
|
54
|
+
changelogUri?: string;
|
|
55
|
+
workaroundObsolete?: boolean;
|
|
56
|
+
tests?: {
|
|
57
|
+
index: number;
|
|
58
|
+
outcome: "pass" | "fail" | "not_evaluated";
|
|
59
|
+
}[];
|
|
60
|
+
}
|
|
61
|
+
export interface StatusObject {
|
|
62
|
+
requestId: string;
|
|
63
|
+
status: Status;
|
|
64
|
+
updatedAt: string;
|
|
65
|
+
demand: number;
|
|
66
|
+
title?: string;
|
|
67
|
+
message?: string;
|
|
68
|
+
resolution?: Resolution;
|
|
69
|
+
duplicateOf?: string;
|
|
70
|
+
version?: string;
|
|
71
|
+
confirmation?: {
|
|
72
|
+
outcome: "pass" | "fail";
|
|
73
|
+
confirmedAt: string;
|
|
74
|
+
};
|
|
75
|
+
[key: string]: unknown;
|
|
76
|
+
}
|
|
77
|
+
/** The server settings object from SEP section 1. */
|
|
78
|
+
export interface ServerSettings {
|
|
79
|
+
kinds: Kind[];
|
|
80
|
+
acceptanceTests?: boolean;
|
|
81
|
+
events?: boolean;
|
|
82
|
+
anonymous?: boolean;
|
|
83
|
+
policyUri?: string;
|
|
84
|
+
changelogUri?: string;
|
|
85
|
+
changes?: boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface ConfirmParams {
|
|
88
|
+
requestId: string;
|
|
89
|
+
outcome: "pass" | "fail";
|
|
90
|
+
tests?: {
|
|
91
|
+
index: number;
|
|
92
|
+
outcome: "pass" | "fail";
|
|
93
|
+
}[];
|
|
94
|
+
note?: string;
|
|
95
|
+
[key: string]: unknown;
|
|
96
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAevD,MAAM,CAAC,MAAM,iBAAiB,GAAsB,CAAC,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-change-requests/client",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Client side of the Agent Change Requests extension for @modelcontextprotocol/sdk: consent, a model-facing submission tool, redaction, the inbox, and requester confirmation.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/MiamiMike-1/agent-change-requests.git",
|
|
9
|
+
"directory": "packages/client"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/MiamiMike-1/agent-change-requests/tree/main/packages/client",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc -p tsconfig.build.json",
|
|
28
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
29
|
+
"test": "vitest run"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@modelcontextprotocol/sdk": "^1.20.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@agent-change-requests/server": "*",
|
|
36
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
37
|
+
"@types/node": "^22.0.0",
|
|
38
|
+
"typescript": "^5.6.0",
|
|
39
|
+
"vitest": "^3.2.0",
|
|
40
|
+
"zod": "^4.0.0"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=20"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
}
|
|
48
|
+
}
|