@agent-change-requests/client 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +122 -2
- package/dist/acceptance.d.ts +12 -0
- package/dist/acceptance.js +55 -0
- package/dist/acceptance.js.map +1 -0
- package/dist/changes.d.ts +96 -0
- package/dist/changes.js +192 -0
- package/dist/changes.js.map +1 -0
- package/dist/client.d.ts +205 -0
- package/dist/client.js +521 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/ledger.d.ts +39 -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 +127 -0
- package/dist/redact.js.map +1 -0
- package/dist/types.d.ts +126 -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,123 @@
|
|
|
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
|
+
### Hosts that show the model structured content
|
|
56
|
+
|
|
57
|
+
Some hosts show the model a tool's `structuredContent` in place of its text, which drops the server's update notice line. SEP section 7 makes carrying the notice the client's job in that case. Show the model `modelContent` instead of building the text yourself:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
const { modelContent } = await changeRequests.inspect(raw);
|
|
61
|
+
// [{ type: "text", text: "<structuredContent as JSON>" },
|
|
62
|
+
// { type: "text", text: "Note from Invoices: 1 of your change requests has an update. Call change_requests_list to see them." }]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`modelContent(result)` and `noticeLine(result)` do the same without reading the inbox. The line is the server's own when the text carries one. Otherwise the client builds the same fixed line from the `_meta` count, naming `inboxToolName` if you set it, or the server's `change_requests_list` if the server lists it, and no line at all when the model has no inbox tool to call. The line never carries request titles or other request content. Without consent, or in an ephemeral session, there is no line (SEP section 9).
|
|
66
|
+
|
|
67
|
+
The changes line from SEP section 12 ("N changes may affect your use of this server. Call whats_new to see them.") is carried the same way, after the update line: the server's own line, or one built from `_meta.changes` naming `whatsNewToolName` or the server's `whats_new`. `changesNoticeLine(result)` returns it alone, and `inspect()` returns it as `changesNotice` with the count as `changes`.
|
|
68
|
+
|
|
69
|
+
After a request ships:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
await changeRequests.retestAndConfirm(requestId); // re-runs its tests, confirms pass or fail
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## What's new: the changes feed
|
|
76
|
+
|
|
77
|
+
When the server advertises `changes: true`, `ChangesFeed` reads `changeRequests/changes` from the version the client last saw:
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
import { ChangesFeed, FileChangesLedger } from "@agent-change-requests/client";
|
|
81
|
+
|
|
82
|
+
const feed = new ChangesFeed(client, {
|
|
83
|
+
extensionId: "com.example/change-requests",
|
|
84
|
+
ledger: new FileChangesLedger(".agent/invoices-changes.json"),
|
|
85
|
+
targets: ["list_invoices"], // only surface entries about tools you use
|
|
86
|
+
onChange: (entry) => tellTheUser(entry), // breaking and deprecated entries, once each
|
|
87
|
+
});
|
|
88
|
+
await feed.inspect(toolResult); // checks when a result announces unread changes
|
|
89
|
+
const { notable } = await feed.check(); // or check yourself
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Additions and fixes never reach `onChange`, so they don't interrupt. `feed.notices()` lists what was recorded for a later session, and `feed.tool()` / `feed.callTool()` give the model one `whats_new` tool. Reading the feed sends nothing about the user, so it works without submission consent; the extension is advertised on the call only with consent.
|
|
93
|
+
|
|
94
|
+
## Anonymous requests
|
|
95
|
+
|
|
96
|
+
Against a server with `anonymous: true` and no signed-in principal, `submit()` gets a ticket back and keeps it in the ledger. `get()` passes it, so the duplicate check works, and `checkTickets()` reads each open anonymous request by its ticket, since there is no inbox and no notice. Shipped requests go to `onShipped` as usual. The ticket is a credential: it stays in the ledger and is never shown to the model.
|
|
97
|
+
|
|
98
|
+
## The ledger
|
|
99
|
+
|
|
100
|
+
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.
|
|
101
|
+
|
|
102
|
+
## Redaction
|
|
103
|
+
|
|
104
|
+
`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.
|
|
105
|
+
|
|
106
|
+
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).
|
|
107
|
+
|
|
108
|
+
## Not in this version
|
|
109
|
+
|
|
110
|
+
- Events subscriptions. The inbox covers the return path; push delivery comes with an Events client.
|
|
111
|
+
- 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.
|
|
112
|
+
|
|
113
|
+
## Releasing (maintainers)
|
|
114
|
+
|
|
115
|
+
1. Update `version` in `packages/client/package.json` and add a CHANGELOG entry.
|
|
116
|
+
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.
|
|
117
|
+
3. The release workflow runs the tests, builds, and publishes to npm with provenance.
|
|
118
|
+
|
|
119
|
+
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`. The workflow passes no npm token: if one is set, npm publishes with it instead of trusted publishing, and npm refuses it once the package requires two-factor authentication.
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
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,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Query } from "./types.js";
|
|
3
|
+
/** The changes line servers add while breaking or deprecated entries are unread. */
|
|
4
|
+
export declare const CHANGES_NOTICE_LINE: RegExp;
|
|
5
|
+
export interface ChangesLedgerData {
|
|
6
|
+
/** currentVersion at the last check. The next check asks for what came after it. */
|
|
7
|
+
lastVersion?: string;
|
|
8
|
+
/** Breaking and deprecated entries seen so far, newest first. */
|
|
9
|
+
notices: ChangeEntry[];
|
|
10
|
+
}
|
|
11
|
+
export interface ChangesLedger {
|
|
12
|
+
load(): ChangesLedgerData;
|
|
13
|
+
save(data: ChangesLedgerData): void;
|
|
14
|
+
}
|
|
15
|
+
export declare class MemoryChangesLedger implements ChangesLedger {
|
|
16
|
+
private data;
|
|
17
|
+
load(): ChangesLedgerData;
|
|
18
|
+
save(data: ChangesLedgerData): void;
|
|
19
|
+
}
|
|
20
|
+
/** One JSON file per server, kept next to the request ledger. */
|
|
21
|
+
export declare class FileChangesLedger implements ChangesLedger {
|
|
22
|
+
private readonly path;
|
|
23
|
+
constructor(path: string);
|
|
24
|
+
load(): ChangesLedgerData;
|
|
25
|
+
save(data: ChangesLedgerData): void;
|
|
26
|
+
}
|
|
27
|
+
export interface ChangesFeedOptions {
|
|
28
|
+
/** The identifier the server advertises, e.g. "com.example/change-requests". */
|
|
29
|
+
extensionId: string;
|
|
30
|
+
/** Whether the user or operator enabled the extension for this server. Only decides whether the call advertises it. */
|
|
31
|
+
consent?: boolean | (() => boolean);
|
|
32
|
+
ephemeral?: boolean;
|
|
33
|
+
serverName?: string;
|
|
34
|
+
ledger?: ChangesLedger;
|
|
35
|
+
/**
|
|
36
|
+
* The tools, resources, or prompts this client uses. When given, only breaking and
|
|
37
|
+
* deprecated entries that name one of them (or name no target) are surfaced.
|
|
38
|
+
*/
|
|
39
|
+
targets?: string[] | (() => string[]);
|
|
40
|
+
/** Called once per newly seen breaking or deprecated entry. Tell the user here. */
|
|
41
|
+
onChange?: (entry: ChangeEntry) => void | Promise<void>;
|
|
42
|
+
/** Name of the model-facing tool. Default whats_new. */
|
|
43
|
+
toolName?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ChangesCheck {
|
|
46
|
+
currentVersion: string;
|
|
47
|
+
/** Everything after the last version this client saw. */
|
|
48
|
+
changes: ChangeEntry[];
|
|
49
|
+
/** Of those, the breaking and deprecated entries that affect this client's targets. */
|
|
50
|
+
notable: ChangeEntry[];
|
|
51
|
+
}
|
|
52
|
+
/** Whether an entry is one a client should surface to the user. */
|
|
53
|
+
export declare function isNotable(entry: ChangeEntry): boolean;
|
|
54
|
+
/** The unread changes count a result carries, in _meta or in the text line. 0 when none. */
|
|
55
|
+
export declare function changesCount(result: {
|
|
56
|
+
content?: unknown[];
|
|
57
|
+
_meta?: Record<string, unknown>;
|
|
58
|
+
}, extensionId: string): number;
|
|
59
|
+
export declare class ChangesFeed {
|
|
60
|
+
private readonly client;
|
|
61
|
+
private readonly options;
|
|
62
|
+
private readonly ledger;
|
|
63
|
+
constructor(client: Client, options: ChangesFeedOptions);
|
|
64
|
+
/** True when the server advertises the extension with changes: true. */
|
|
65
|
+
available(): boolean;
|
|
66
|
+
/** One page of changeRequests/changes. */
|
|
67
|
+
read(query?: ChangesQuery): Promise<ChangesPage>;
|
|
68
|
+
/**
|
|
69
|
+
* Reads everything after the last version this client saw, records the notable
|
|
70
|
+
* entries in the ledger, calls onChange for each, and moves lastVersion forward.
|
|
71
|
+
*/
|
|
72
|
+
check(): Promise<ChangesCheck>;
|
|
73
|
+
/** Breaking and deprecated entries recorded so far, for the user or a later session. */
|
|
74
|
+
notices(): ChangeEntry[];
|
|
75
|
+
/** Looks at any result; when it announces unread changes, runs check(). */
|
|
76
|
+
inspect(result: {
|
|
77
|
+
content?: unknown[];
|
|
78
|
+
_meta?: Record<string, unknown>;
|
|
79
|
+
}): Promise<ChangesCheck | null>;
|
|
80
|
+
/** The one tool to show the model. Its description is the client's. */
|
|
81
|
+
tool(): {
|
|
82
|
+
name: string;
|
|
83
|
+
description: string;
|
|
84
|
+
inputSchema: Record<string, unknown>;
|
|
85
|
+
};
|
|
86
|
+
/** Runs the tool for the model. Server text is passed through as data. */
|
|
87
|
+
callTool(args: Record<string, unknown>): Promise<{
|
|
88
|
+
content: {
|
|
89
|
+
type: "text";
|
|
90
|
+
text: string;
|
|
91
|
+
}[];
|
|
92
|
+
isError?: boolean;
|
|
93
|
+
}>;
|
|
94
|
+
private advertise;
|
|
95
|
+
private targets;
|
|
96
|
+
}
|
package/dist/changes.js
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client support for the changes feed (SEP section 12).
|
|
3
|
+
*
|
|
4
|
+
* - Reads changeRequests/changes from the version this client last saw.
|
|
5
|
+
* - Records breaking and deprecated entries where a later session will find them, and
|
|
6
|
+
* hands them to onChange so the client can tell the user. Additions and fixes are kept
|
|
7
|
+
* out of that path, so they never interrupt.
|
|
8
|
+
* - Gives the model one whats_new tool whose input matches the method's parameters.
|
|
9
|
+
*
|
|
10
|
+
* Reading the feed sends nothing about the user, so it does not need submission consent.
|
|
11
|
+
* The extension is advertised on the call only when consent allows it.
|
|
12
|
+
*/
|
|
13
|
+
import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
14
|
+
import { dirname } from "node:path";
|
|
15
|
+
import { ResultSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
16
|
+
const CLIENT_CAPABILITIES_META_KEY = "io.modelcontextprotocol/clientCapabilities";
|
|
17
|
+
/** The changes line servers add while breaking or deprecated entries are unread. */
|
|
18
|
+
export const CHANGES_NOTICE_LINE = /\b(\d+) changes? may affect your use of this server\b/;
|
|
19
|
+
export class MemoryChangesLedger {
|
|
20
|
+
data = { notices: [] };
|
|
21
|
+
load() {
|
|
22
|
+
return structuredClone(this.data);
|
|
23
|
+
}
|
|
24
|
+
save(data) {
|
|
25
|
+
this.data = structuredClone(data);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** One JSON file per server, kept next to the request ledger. */
|
|
29
|
+
export class FileChangesLedger {
|
|
30
|
+
path;
|
|
31
|
+
constructor(path) {
|
|
32
|
+
this.path = path;
|
|
33
|
+
}
|
|
34
|
+
load() {
|
|
35
|
+
try {
|
|
36
|
+
const parsed = JSON.parse(readFileSync(this.path, "utf8"));
|
|
37
|
+
const data = { notices: parsed.notices ?? [] };
|
|
38
|
+
if (parsed.lastVersion)
|
|
39
|
+
data.lastVersion = parsed.lastVersion;
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return { notices: [] };
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
save(data) {
|
|
47
|
+
mkdirSync(dirname(this.path), { recursive: true });
|
|
48
|
+
const tmp = `${this.path}.tmp`;
|
|
49
|
+
writeFileSync(tmp, `${JSON.stringify(data, null, 2)}\n`);
|
|
50
|
+
renameSync(tmp, this.path);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** Whether an entry is one a client should surface to the user. */
|
|
54
|
+
export function isNotable(entry) {
|
|
55
|
+
return entry.breaking || entry.type === "deprecated" || entry.type === "removed";
|
|
56
|
+
}
|
|
57
|
+
/** The unread changes count a result carries, in _meta or in the text line. 0 when none. */
|
|
58
|
+
export function changesCount(result, extensionId) {
|
|
59
|
+
const fromMeta = result._meta?.[extensionId]?.changes;
|
|
60
|
+
if (typeof fromMeta === "number")
|
|
61
|
+
return fromMeta;
|
|
62
|
+
for (const c of result.content ?? []) {
|
|
63
|
+
const text = c.text;
|
|
64
|
+
if (c.type !== "text" || typeof text !== "string")
|
|
65
|
+
continue;
|
|
66
|
+
const match = CHANGES_NOTICE_LINE.exec(text);
|
|
67
|
+
if (match)
|
|
68
|
+
return Number(match[1]);
|
|
69
|
+
}
|
|
70
|
+
return 0;
|
|
71
|
+
}
|
|
72
|
+
export class ChangesFeed {
|
|
73
|
+
client;
|
|
74
|
+
options;
|
|
75
|
+
ledger;
|
|
76
|
+
constructor(client, options) {
|
|
77
|
+
this.client = client;
|
|
78
|
+
this.options = options;
|
|
79
|
+
this.ledger = options.ledger ?? new MemoryChangesLedger();
|
|
80
|
+
}
|
|
81
|
+
/** True when the server advertises the extension with changes: true. */
|
|
82
|
+
available() {
|
|
83
|
+
const extensions = this.client.getServerCapabilities()?.extensions;
|
|
84
|
+
const settings = extensions?.[this.options.extensionId];
|
|
85
|
+
return Boolean(settings && Array.isArray(settings.kinds) && settings.changes === true);
|
|
86
|
+
}
|
|
87
|
+
/** One page of changeRequests/changes. */
|
|
88
|
+
async read(query = {}) {
|
|
89
|
+
if (!this.available())
|
|
90
|
+
throw new Error("This server does not offer the changes feed.");
|
|
91
|
+
const params = { ...query };
|
|
92
|
+
if (this.advertise()) {
|
|
93
|
+
params._meta = { [CLIENT_CAPABILITIES_META_KEY]: { extensions: { [this.options.extensionId]: {} } } };
|
|
94
|
+
}
|
|
95
|
+
return (await this.client.request({ method: "changeRequests/changes", params }, ResultSchema));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Reads everything after the last version this client saw, records the notable
|
|
99
|
+
* entries in the ledger, calls onChange for each, and moves lastVersion forward.
|
|
100
|
+
*/
|
|
101
|
+
async check() {
|
|
102
|
+
const before = this.ledger.load();
|
|
103
|
+
const changes = [];
|
|
104
|
+
let currentVersion = before.lastVersion ?? "";
|
|
105
|
+
let cursor;
|
|
106
|
+
do {
|
|
107
|
+
const query = before.lastVersion ? { sinceVersion: before.lastVersion } : {};
|
|
108
|
+
if (cursor)
|
|
109
|
+
query.cursor = cursor;
|
|
110
|
+
const page = await this.read(query);
|
|
111
|
+
changes.push(...page.changes);
|
|
112
|
+
currentVersion = page.currentVersion;
|
|
113
|
+
cursor = page.nextCursor;
|
|
114
|
+
} while (cursor);
|
|
115
|
+
const watched = this.targets();
|
|
116
|
+
const affects = (e) => !watched || !e.changed?.length || e.changed.some((t) => t.type === "server" || (t.name !== undefined && watched.includes(t.name)));
|
|
117
|
+
const key = (e) => `${e.version}|${e.type}|${e.summary}`;
|
|
118
|
+
const known = new Set(before.notices.map(key));
|
|
119
|
+
const notable = changes.filter((e) => isNotable(e) && affects(e) && !known.has(key(e)));
|
|
120
|
+
const after = this.ledger.load();
|
|
121
|
+
after.notices = [...notable, ...after.notices];
|
|
122
|
+
if (currentVersion)
|
|
123
|
+
after.lastVersion = currentVersion;
|
|
124
|
+
this.ledger.save(after);
|
|
125
|
+
for (const entry of notable)
|
|
126
|
+
await this.options.onChange?.(entry);
|
|
127
|
+
return { currentVersion, changes, notable };
|
|
128
|
+
}
|
|
129
|
+
/** Breaking and deprecated entries recorded so far, for the user or a later session. */
|
|
130
|
+
notices() {
|
|
131
|
+
return this.ledger.load().notices;
|
|
132
|
+
}
|
|
133
|
+
/** Looks at any result; when it announces unread changes, runs check(). */
|
|
134
|
+
async inspect(result) {
|
|
135
|
+
if (!this.available() || changesCount(result, this.options.extensionId) === 0)
|
|
136
|
+
return null;
|
|
137
|
+
return this.check();
|
|
138
|
+
}
|
|
139
|
+
/** The one tool to show the model. Its description is the client's. */
|
|
140
|
+
tool() {
|
|
141
|
+
const server = this.options.serverName ?? "this server";
|
|
142
|
+
return {
|
|
143
|
+
name: this.options.toolName ?? "whats_new",
|
|
144
|
+
description: `What ${server} has shipped since a version or time: additions, changed behavior, deprecations, and removals, newest first. Entries marked breaking can make a call that worked before fail.`,
|
|
145
|
+
inputSchema: {
|
|
146
|
+
type: "object",
|
|
147
|
+
properties: {
|
|
148
|
+
sinceVersion: { type: "string", description: "Only changes after this version." },
|
|
149
|
+
since: { type: "string", description: "Only changes after this ISO 8601 time." },
|
|
150
|
+
cursor: { type: "string", description: "nextCursor from the previous page." },
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/** Runs the tool for the model. Server text is passed through as data. */
|
|
156
|
+
async callTool(args) {
|
|
157
|
+
try {
|
|
158
|
+
const query = {};
|
|
159
|
+
if (typeof args.sinceVersion === "string")
|
|
160
|
+
query.sinceVersion = args.sinceVersion;
|
|
161
|
+
if (typeof args.since === "string")
|
|
162
|
+
query.since = args.since;
|
|
163
|
+
if (typeof args.cursor === "string")
|
|
164
|
+
query.cursor = args.cursor;
|
|
165
|
+
const page = await this.read(query);
|
|
166
|
+
const lines = [`Current version: ${page.currentVersion}.`];
|
|
167
|
+
for (const c of page.changes) {
|
|
168
|
+
const flags = [c.breaking ? "breaking" : "", c.removeAfter ? `removal after ${c.removeAfter}` : ""].filter(Boolean).join(", ");
|
|
169
|
+
lines.push(`- ${c.version} ${c.type}${flags ? ` (${flags})` : ""}: ${c.summary}`);
|
|
170
|
+
}
|
|
171
|
+
if (page.changes.length === 0)
|
|
172
|
+
lines.push("No changes listed.");
|
|
173
|
+
if (page.nextCursor)
|
|
174
|
+
lines.push(`More after cursor ${page.nextCursor}.`);
|
|
175
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
return { content: [{ type: "text", text: `Could not read the changes: ${error instanceof Error ? error.message : "unknown error"}` }], isError: true };
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
advertise() {
|
|
182
|
+
if (this.options.ephemeral)
|
|
183
|
+
return false;
|
|
184
|
+
const c = this.options.consent;
|
|
185
|
+
return typeof c === "function" ? c() === true : c === true;
|
|
186
|
+
}
|
|
187
|
+
targets() {
|
|
188
|
+
const t = this.options.targets;
|
|
189
|
+
return typeof t === "function" ? t() : t;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=changes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changes.js","sourceRoot":"","sources":["../src/changes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAA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