@acid-cat/cli 0.19.0 → 0.21.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 +32 -2
- package/conformance/fixture.acidcat.json +96 -0
- package/dist/conform-LH9KgQ9-.js +5045 -0
- package/dist/index.d.ts +164 -4
- package/dist/index.js +96 -4
- package/dist/main.d.ts +1 -2
- package/dist/main.js +1090 -7
- package/package.json +4 -3
- package/dist/catalog.d.ts +0 -12
- package/dist/catalog.js +0 -149
- package/dist/conform/check.d.ts +0 -47
- package/dist/conform/check.js +0 -178
- package/dist/conform/cli.d.ts +0 -5
- package/dist/conform/cli.js +0 -721
- package/dist/conform/http.d.ts +0 -6
- package/dist/conform/http.js +0 -297
- package/dist/conform/index.d.ts +0 -69
- package/dist/conform/index.js +0 -80
- package/dist/conform/mcp-stdio.d.ts +0 -7
- package/dist/conform/mcp-stdio.js +0 -291
- package/dist/conform/mcp.d.ts +0 -47
- package/dist/conform/mcp.js +0 -754
- package/dist/conform/poll.d.ts +0 -13
- package/dist/conform/poll.js +0 -295
- package/dist/conform/properties.d.ts +0 -12
- package/dist/conform/properties.js +0 -151
- package/dist/conform/serve.d.ts +0 -12
- package/dist/conform/serve.js +0 -96
- package/dist/conform/server-card.d.ts +0 -5
- package/dist/conform/server-card.js +0 -142
- package/dist/conform/sse.d.ts +0 -9
- package/dist/conform/sse.js +0 -53
- package/dist/conform/webhook.d.ts +0 -30
- package/dist/conform/webhook.js +0 -481
- package/dist/conform/webmcp.d.ts +0 -53
- package/dist/conform/webmcp.js +0 -232
- package/dist/json/catalog.schema.json.js +0 -170
- package/dist/json/fixture.acidcat.json.js +0 -396
- package/dist/json/package.json.js +0 -3
- package/dist/json/server-card.schema.json.js +0 -281
- package/dist/json.d.ts +0 -11
- package/dist/json.js +0 -13
package/dist/conform/http.d.ts
DELETED
package/dist/conform/http.js
DELETED
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
import { isArrayOf, isObject, isStringArray, memberOf, parseJson, readJson } from "../json.js";
|
|
2
|
-
import { Checks, FORBIDDEN_ORIGIN, eventIdsOf, expect, expectEqual, expectOccurrence, idsOf, sorted, until } from "./check.js";
|
|
3
|
-
import { sseReader } from "./sse.js";
|
|
4
|
-
import { randomUUID } from "node:crypto";
|
|
5
|
-
// src/conform/http.ts
|
|
6
|
-
const RULE = "spec/surfaces/http.md";
|
|
7
|
-
const isEntry = (value) => isObject(value) && typeof value.id === "string";
|
|
8
|
-
async function entriesOf(response) {
|
|
9
|
-
const list = await readJson(response);
|
|
10
|
-
if (!isArrayOf(list, isEntry)) throw new Error(`GET /capabilities must give a list of objects with an id, got ${JSON.stringify(list)}`);
|
|
11
|
-
return list;
|
|
12
|
-
}
|
|
13
|
-
async function checkHttp(base, options) {
|
|
14
|
-
const checks = new Checks("http", options.deadline, options.signal);
|
|
15
|
-
const post = (signal, id, body, headers = {}) => fetch(`${base}/capabilities/${id}`, {
|
|
16
|
-
method: "POST",
|
|
17
|
-
headers: {
|
|
18
|
-
"Content-Type": "application/json",
|
|
19
|
-
...headers
|
|
20
|
-
},
|
|
21
|
-
body: typeof body === "string" ? body : body instanceof Uint8Array ? new Blob([new Uint8Array(body)]) : JSON.stringify(body),
|
|
22
|
-
signal
|
|
23
|
-
});
|
|
24
|
-
const kindOf = async (response) => memberOf(await readJson(response), "kind");
|
|
25
|
-
await checks.run("GET /capabilities lists the capabilities of the target with their availability", `${RULE}#requests`, async (signal) => {
|
|
26
|
-
const list = await entriesOf(await fetch(`${base}/capabilities`, { signal }));
|
|
27
|
-
expectEqual(sorted(list.map((entry) => entry.id)), idsOf("api"), "ids");
|
|
28
|
-
expect(list.every((entry) => typeof entry.available === "boolean"), "each entry must have available");
|
|
29
|
-
});
|
|
30
|
-
await checks.run("a value has the status 200", `${RULE}#requests`, async (signal) => {
|
|
31
|
-
const response = await post(signal, "fixture.echo", { text: "hello" });
|
|
32
|
-
expectEqual(response.status, 200, "status");
|
|
33
|
-
expectEqual(await readJson(response), {
|
|
34
|
-
ok: true,
|
|
35
|
-
value: { text: "hello" }
|
|
36
|
-
}, "body");
|
|
37
|
-
});
|
|
38
|
-
await checks.run("a failure has the status 200 and ok: false", `${RULE}#requests`, async (signal) => {
|
|
39
|
-
const response = await post(signal, "fixture.refuse", {});
|
|
40
|
-
const body = await readJson(response);
|
|
41
|
-
expectEqual(response.status, 200, "status");
|
|
42
|
-
expect(memberOf(body, "ok") === false && memberOf(memberOf(body, "error"), "_tag") === "Refused", `got ${JSON.stringify(body)}`);
|
|
43
|
-
});
|
|
44
|
-
for (const [name, id, input, status, kind] of [
|
|
45
|
-
[
|
|
46
|
-
"invalid input has the status 422",
|
|
47
|
-
"fixture.echo",
|
|
48
|
-
{ text: 1 },
|
|
49
|
-
422,
|
|
50
|
-
"invalid-input"
|
|
51
|
-
],
|
|
52
|
-
[
|
|
53
|
-
"a capability outside the target has the status 404",
|
|
54
|
-
"fixture.hidden",
|
|
55
|
-
{},
|
|
56
|
-
404,
|
|
57
|
-
"unknown-capability"
|
|
58
|
-
],
|
|
59
|
-
[
|
|
60
|
-
"a defect has the status 500",
|
|
61
|
-
"fixture.crash",
|
|
62
|
-
{},
|
|
63
|
-
500,
|
|
64
|
-
"internal"
|
|
65
|
-
]
|
|
66
|
-
]) await checks.run(name, `${RULE}#requests`, async (signal) => {
|
|
67
|
-
const response = await post(signal, id, input);
|
|
68
|
-
expectEqual(response.status, status, "status");
|
|
69
|
-
expectEqual(await kindOf(response), kind, "kind");
|
|
70
|
-
});
|
|
71
|
-
await checks.run("an unavailable capability has the status 503", `${RULE}#requests`, async (signal) => {
|
|
72
|
-
await post(signal, "fixture.switch.set", { on: false });
|
|
73
|
-
try {
|
|
74
|
-
const toggle = (await entriesOf(await fetch(`${base}/capabilities`, { signal }))).find((entry) => entry.id === "fixture.toggle");
|
|
75
|
-
expect(toggle?.available === false && typeof toggle.reason === "string", "fixture.toggle must be unavailable, with a reason");
|
|
76
|
-
const response = await post(signal, "fixture.toggle", {});
|
|
77
|
-
expectEqual(response.status, 503, "status");
|
|
78
|
-
expectEqual(await kindOf(response), "unavailable", "kind");
|
|
79
|
-
} finally {
|
|
80
|
-
await post(AbortSignal.timeout(options.deadline), "fixture.switch.set", { on: true });
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
const status = async (response, expected) => expectEqual(response.status, expected, "status");
|
|
84
|
-
await checks.run("a method that is not accepted is rejected with 405", `${RULE}#requests`, async (signal) => {
|
|
85
|
-
await status(await fetch(`${base}/capabilities`, {
|
|
86
|
-
method: "PUT",
|
|
87
|
-
signal
|
|
88
|
-
}), 405);
|
|
89
|
-
});
|
|
90
|
-
await checks.run("an origin that is not allowed is rejected with 403", `${RULE}#requests`, async (signal) => {
|
|
91
|
-
await status(await post(signal, "fixture.echo", { text: "x" }, { Origin: FORBIDDEN_ORIGIN }), 403);
|
|
92
|
-
});
|
|
93
|
-
await checks.run("a media type other than JSON is rejected with 415", `${RULE}#requests`, async (signal) => {
|
|
94
|
-
await status(await post(signal, "fixture.echo", { text: "x" }, { "Content-Type": "text/plain" }), 415);
|
|
95
|
-
});
|
|
96
|
-
await checks.run("a body over the limit is rejected with 413", `${RULE}#requests`, async (signal) => {
|
|
97
|
-
await status(await post(signal, "fixture.echo", " ".repeat(options.maximumBytes + 1)), 413);
|
|
98
|
-
});
|
|
99
|
-
await checks.run("a body that is not UTF-8 is rejected with 400", `${RULE}#requests`, async (signal) => {
|
|
100
|
-
await status(await post(signal, "fixture.echo", new Uint8Array([
|
|
101
|
-
123,
|
|
102
|
-
255,
|
|
103
|
-
125
|
|
104
|
-
])), 400);
|
|
105
|
-
});
|
|
106
|
-
await checkEvents(checks, base);
|
|
107
|
-
return checks;
|
|
108
|
-
}
|
|
109
|
-
const EVENTS = `${RULE}#events`;
|
|
110
|
-
async function checkEvents(checks, base) {
|
|
111
|
-
const subscribe = (signal, id, input, headers = {}) => fetch(`${base}/events/${id}`, {
|
|
112
|
-
method: "POST",
|
|
113
|
-
headers: {
|
|
114
|
-
"Content-Type": "application/json",
|
|
115
|
-
...headers
|
|
116
|
-
},
|
|
117
|
-
body: JSON.stringify(input),
|
|
118
|
-
signal
|
|
119
|
-
});
|
|
120
|
-
const open = async (signal, id, input, headers = {}) => {
|
|
121
|
-
const controller = new AbortController();
|
|
122
|
-
const response = await subscribe(AbortSignal.any([signal, controller.signal]), id, input, headers);
|
|
123
|
-
if (response.status !== 200) {
|
|
124
|
-
controller.abort();
|
|
125
|
-
throw new Error(`POST /events/${id} must start a stream with the status 200, got ${response.status}`);
|
|
126
|
-
}
|
|
127
|
-
expect(response.headers.get("Content-Type")?.startsWith("text/event-stream") === true, `the media type must be text/event-stream, got ${response.headers.get("Content-Type")}`);
|
|
128
|
-
expectEqual(response.headers.get("Cache-Control"), "no-store", "Cache-Control");
|
|
129
|
-
return {
|
|
130
|
-
response,
|
|
131
|
-
reader: sseReader(response),
|
|
132
|
-
close: () => controller.abort()
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
const nextOccurrence = async (stream, id) => {
|
|
136
|
-
const message = await stream.reader.next();
|
|
137
|
-
expect(message?.event === "next", `expected event: next, got ${JSON.stringify(message)}`);
|
|
138
|
-
const occurrence = expectOccurrence(parseJson(message.data), id);
|
|
139
|
-
expectEqual(message.id, occurrence.cursor, "the SSE id of the message, which is the cursor of the occurrence");
|
|
140
|
-
return occurrence;
|
|
141
|
-
};
|
|
142
|
-
const expectComplete = async (stream) => {
|
|
143
|
-
const message = await stream.reader.next();
|
|
144
|
-
expect(message?.event === "complete", `expected event: complete, got ${JSON.stringify(message)}`);
|
|
145
|
-
expectEqual(message.data, "", "the data of event: complete");
|
|
146
|
-
expectEqual(await stream.reader.next(), void 0, "the stream after event: complete");
|
|
147
|
-
};
|
|
148
|
-
const watching = async (signal) => {
|
|
149
|
-
const response = await fetch(`${base}/capabilities/fixture.watching`, {
|
|
150
|
-
method: "POST",
|
|
151
|
-
headers: { "Content-Type": "application/json" },
|
|
152
|
-
body: "{}",
|
|
153
|
-
signal
|
|
154
|
-
});
|
|
155
|
-
const keys = memberOf(memberOf(await readJson(response), "value"), "keys");
|
|
156
|
-
expect(isStringArray(keys), `fixture.watching must give a list of keys, got ${JSON.stringify(keys)}`);
|
|
157
|
-
return keys;
|
|
158
|
-
};
|
|
159
|
-
const count = (keys, key) => keys.filter((each) => each === key).length;
|
|
160
|
-
const signalKey = async (signal, key, value) => {
|
|
161
|
-
const response = await fetch(`${base}/capabilities/fixture.signal`, {
|
|
162
|
-
method: "POST",
|
|
163
|
-
headers: { "Content-Type": "application/json" },
|
|
164
|
-
body: JSON.stringify({
|
|
165
|
-
key,
|
|
166
|
-
value
|
|
167
|
-
}),
|
|
168
|
-
signal
|
|
169
|
-
});
|
|
170
|
-
const delivered = memberOf(memberOf(await readJson(response), "value"), "delivered");
|
|
171
|
-
expect(typeof delivered === "number", `fixture.signal must give the number of subscriptions, got ${JSON.stringify(delivered)}`);
|
|
172
|
-
return delivered;
|
|
173
|
-
};
|
|
174
|
-
await checks.run("GET /events lists the events of the target", `${RULE}#requests`, async (signal) => {
|
|
175
|
-
const list = await readJson(await fetch(`${base}/events`, { signal }));
|
|
176
|
-
if (!isArrayOf(list, isEntry)) throw new Error(`GET /events must give a list of objects with an id, got ${JSON.stringify(list)}`);
|
|
177
|
-
expectEqual(sorted(list.map((entry) => entry.id)), eventIdsOf("api"), "ids");
|
|
178
|
-
});
|
|
179
|
-
for (const [name, id, input, status, kind] of [
|
|
180
|
-
[
|
|
181
|
-
"a subscription to an event outside the target has the status 404",
|
|
182
|
-
"fixture.secret",
|
|
183
|
-
{},
|
|
184
|
-
404,
|
|
185
|
-
"unknown-capability"
|
|
186
|
-
],
|
|
187
|
-
[
|
|
188
|
-
"a subscription to the id of a capability has the status 404",
|
|
189
|
-
"fixture.echo",
|
|
190
|
-
{ text: "x" },
|
|
191
|
-
404,
|
|
192
|
-
"unknown-capability"
|
|
193
|
-
],
|
|
194
|
-
[
|
|
195
|
-
"a subscription with invalid input has the status 422",
|
|
196
|
-
"fixture.ticks",
|
|
197
|
-
{ count: 101 },
|
|
198
|
-
422,
|
|
199
|
-
"invalid-input"
|
|
200
|
-
]
|
|
201
|
-
]) await checks.run(name, EVENTS, async (signal) => {
|
|
202
|
-
const response = await subscribe(signal, id, input);
|
|
203
|
-
expectEqual(response.status, status, "status");
|
|
204
|
-
const body = await readJson(response);
|
|
205
|
-
expectEqual(memberOf(body, "kind"), kind, "kind");
|
|
206
|
-
expect(typeof memberOf(body, "message") === "string", `the call failure must have a message, got ${JSON.stringify(body)}`);
|
|
207
|
-
});
|
|
208
|
-
await checks.run("a subscription gives each occurrence as event: next, in order, then event: complete", EVENTS, async (signal) => {
|
|
209
|
-
const stream = await open(signal, "fixture.ticks", { count: 3 });
|
|
210
|
-
try {
|
|
211
|
-
for (const n of [
|
|
212
|
-
1,
|
|
213
|
-
2,
|
|
214
|
-
3
|
|
215
|
-
]) {
|
|
216
|
-
const occurrence = await nextOccurrence(stream, "fixture.ticks");
|
|
217
|
-
expectEqual(occurrence.data, { n }, "data");
|
|
218
|
-
expectEqual([occurrence.eventId, occurrence.cursor], [String(n), String(n)], "the eventId and the cursor");
|
|
219
|
-
}
|
|
220
|
-
await expectComplete(stream);
|
|
221
|
-
} finally {
|
|
222
|
-
stream.close();
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
await checks.run("an occurrence after a gap has truncated: true, and the other occurrences have no truncated", EVENTS, async (signal) => {
|
|
226
|
-
const stream = await open(signal, "fixture.ticks", {
|
|
227
|
-
count: 3,
|
|
228
|
-
gap: 2
|
|
229
|
-
});
|
|
230
|
-
try {
|
|
231
|
-
for (const n of [
|
|
232
|
-
1,
|
|
233
|
-
2,
|
|
234
|
-
3
|
|
235
|
-
]) {
|
|
236
|
-
const occurrence = await nextOccurrence(stream, "fixture.ticks");
|
|
237
|
-
expectEqual([occurrence.data, occurrence.truncated], [{ n }, n === 2 ? true : void 0], "the data and truncated");
|
|
238
|
-
}
|
|
239
|
-
await expectComplete(stream);
|
|
240
|
-
} finally {
|
|
241
|
-
stream.close();
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
await checks.run("Last-Event-ID gives the cursor, and the subscription starts after it", EVENTS, async (signal) => {
|
|
245
|
-
const stream = await open(signal, "fixture.ticks", { count: 3 }, { "Last-Event-ID": "1" });
|
|
246
|
-
try {
|
|
247
|
-
for (const n of [2, 3]) expectEqual((await nextOccurrence(stream, "fixture.ticks")).data, { n }, "data");
|
|
248
|
-
await expectComplete(stream);
|
|
249
|
-
} finally {
|
|
250
|
-
stream.close();
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
await checks.run("a defect after an occurrence ends the stream with event: error and internal", EVENTS, async (signal) => {
|
|
254
|
-
const stream = await open(signal, "fixture.broken", {});
|
|
255
|
-
try {
|
|
256
|
-
expectEqual((await nextOccurrence(stream, "fixture.broken")).data, { n: 1 }, "data");
|
|
257
|
-
const message = await stream.reader.next();
|
|
258
|
-
expect(message?.event === "error", `expected event: error, got ${JSON.stringify(message)}`);
|
|
259
|
-
const failure = parseJson(message.data);
|
|
260
|
-
expect(memberOf(failure, "kind") === "internal" && typeof memberOf(failure, "message") === "string", `expected { kind: "internal", message }, got ${message.data}`);
|
|
261
|
-
expect(!/\n\s+at /.test(String(memberOf(failure, "message"))), "the message must not contain a stack trace");
|
|
262
|
-
expectEqual(await stream.reader.next(), void 0, "the stream after event: error");
|
|
263
|
-
} finally {
|
|
264
|
-
stream.close();
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
await checks.run("each subscription gets the things that happen, and closing one stream cancels only its subscription", EVENTS, async (signal) => {
|
|
268
|
-
const key = randomUUID();
|
|
269
|
-
const first = open(signal, "fixture.watch", { key });
|
|
270
|
-
const second = open(signal, "fixture.watch", { key });
|
|
271
|
-
first.catch(() => void 0);
|
|
272
|
-
second.catch(() => void 0);
|
|
273
|
-
try {
|
|
274
|
-
await until("fixture.watching gives the key of both subscriptions", () => watching(signal), (keys) => count(keys, key) === 2, signal);
|
|
275
|
-
const [cancelled, kept] = [await first, await second];
|
|
276
|
-
expectEqual(await signalKey(signal, key, "both"), 2, "the subscriptions that fixture.signal reached");
|
|
277
|
-
expectEqual((await nextOccurrence(cancelled, "fixture.watch")).data, {
|
|
278
|
-
key,
|
|
279
|
-
value: "both"
|
|
280
|
-
}, "data of the first subscription");
|
|
281
|
-
expectEqual((await nextOccurrence(kept, "fixture.watch")).data, {
|
|
282
|
-
key,
|
|
283
|
-
value: "both"
|
|
284
|
-
}, "data of the second subscription");
|
|
285
|
-
cancelled.close();
|
|
286
|
-
await until("the cancelled subscription leaves fixture.watching", () => watching(signal), (keys) => count(keys, key) === 1, signal);
|
|
287
|
-
expectEqual(await signalKey(signal, key, "after"), 1, "the subscriptions that fixture.signal reached");
|
|
288
|
-
expectEqual((await nextOccurrence(kept, "fixture.watch")).data, {
|
|
289
|
-
key,
|
|
290
|
-
value: "after"
|
|
291
|
-
}, "data");
|
|
292
|
-
} finally {
|
|
293
|
-
for (const stream of [first, second]) stream.then((opened) => opened.close(), () => void 0);
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
export { checkHttp };
|
package/dist/conform/index.d.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { Check } from "./check.js";
|
|
2
|
-
import type { WebMcpInstall } from "./webmcp.js";
|
|
3
|
-
import type { PollSettings } from "./poll.js";
|
|
4
|
-
import type { WebhookSettings } from "./webhook.js";
|
|
5
|
-
export type { Check } from "./check.js";
|
|
6
|
-
export { DEADLINE, fixture } from "./check.js";
|
|
7
|
-
export { serve } from "./serve.js";
|
|
8
|
-
export type { Routes, Served, WebHandler } from "./serve.js";
|
|
9
|
-
export { createTestHost } from "./webmcp.js";
|
|
10
|
-
export type { TestHost, WebMcpInstall } from "./webmcp.js";
|
|
11
|
-
export type { PollSettings } from "./poll.js";
|
|
12
|
-
export type { WebhookSettings } from "./webhook.js";
|
|
13
|
-
export interface ConformOptions {
|
|
14
|
-
/** The URL of the MCP server, for example `http://localhost:8787/mcp`. */
|
|
15
|
-
readonly mcp?: string | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Check the `initialize` handshake of revision 2025-11-25 through the MCP server too
|
|
18
|
-
* (spec/surfaces/mcp.md#earlier-revisions-through-http). The default is `false`.
|
|
19
|
-
*/
|
|
20
|
-
readonly mcpHandshake?: boolean | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* The command that starts the MCP server through standard input and standard output, for example
|
|
23
|
-
* `["node", "fixture-mcp-stdio.ts"]`. Each check starts its own process.
|
|
24
|
-
*/
|
|
25
|
-
readonly mcpStdio?: readonly string[] | undefined;
|
|
26
|
-
/** The base URL of the HTTP API, before `/capabilities`. */
|
|
27
|
-
readonly http?: string | undefined;
|
|
28
|
-
/** The command that starts the command line, for example `["node", "fixture-cli.ts"]`. */
|
|
29
|
-
readonly cli?: readonly string[] | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* The WebMCP surface: the URL of a page that serves the `app` target, or a function that installs the implementation
|
|
32
|
-
* on a host in the same process. A page runs in Chromium, through Playwright.
|
|
33
|
-
*/
|
|
34
|
-
readonly webmcp?: string | WebMcpInstall | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* The poll settings of the deployment, for MCP through HTTP and through stdio. With `bufferLimit`, conform tests a
|
|
37
|
-
* cursor older than the buffer. The lease time of the deployment must be longer than the deadline.
|
|
38
|
-
*/
|
|
39
|
-
readonly poll?: PollSettings | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* An MCP server through HTTP whose lease time is `leaseMs`, shorter than the deadline. conform tests there that a lease
|
|
42
|
-
* with no poll ends.
|
|
43
|
-
*/
|
|
44
|
-
readonly pollLease?: {
|
|
45
|
-
readonly mcp: string;
|
|
46
|
-
readonly leaseMs: number;
|
|
47
|
-
} | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* Test webhook delivery through `mcp`. conform runs an HTTPS receiver on 127.0.0.1 with this certificate and key. The
|
|
50
|
-
* deployment trusts the certificate, allows deliveries to 127.0.0.1, and gives the principal to each request with the
|
|
51
|
-
* header `Authorization: Bearer <principal>`.
|
|
52
|
-
*/
|
|
53
|
-
readonly webhook?: WebhookSettings | undefined;
|
|
54
|
-
/** The body limit of the remote surfaces, in bytes. The default is 1 MiB. */
|
|
55
|
-
readonly maximumBytes?: number | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* The time, in milliseconds, that each check has to settle. A check that does not settle in this time fails. The
|
|
58
|
-
* default is `DEADLINE`, 30 seconds.
|
|
59
|
-
*/
|
|
60
|
-
readonly deadline?: number | undefined;
|
|
61
|
-
/**
|
|
62
|
-
* When it aborts, conform stops: each check that runs stops as at its deadline and cleans up, no other check and no
|
|
63
|
-
* other surface starts, and the promise rejects with the reason of the signal. A test gives its own signal, so that
|
|
64
|
-
* conform ends with the test.
|
|
65
|
-
*/
|
|
66
|
-
readonly signal?: AbortSignal | undefined;
|
|
67
|
-
}
|
|
68
|
-
/** Run all checks for the surfaces that the options give. */
|
|
69
|
-
export declare function conform(options: ConformOptions): Promise<readonly Check[]>;
|
package/dist/conform/index.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { Checks, DEADLINE, fixture, orStop } from "./check.js";
|
|
2
|
-
import { checkCli } from "./cli.js";
|
|
3
|
-
import { checkHttp } from "./http.js";
|
|
4
|
-
import { checkMcp, httpChannel } from "./mcp.js";
|
|
5
|
-
import { checkMcpStdio } from "./mcp-stdio.js";
|
|
6
|
-
import { checkProperties, httpInvoke, mcpInvoke } from "./properties.js";
|
|
7
|
-
import { browserDriver, checkWebMcp, processDriver } from "./webmcp.js";
|
|
8
|
-
import { checkPollLease } from "./poll.js";
|
|
9
|
-
import { serve } from "./serve.js";
|
|
10
|
-
// src/conform/index.ts
|
|
11
|
-
/** Run all checks for the surfaces that the options give. */
|
|
12
|
-
async function conform(options) {
|
|
13
|
-
const maximumBytes = options.maximumBytes ?? 1048576;
|
|
14
|
-
const deadline = options.deadline ?? 3e4;
|
|
15
|
-
const poll = options.poll ?? {};
|
|
16
|
-
const { signal } = options;
|
|
17
|
-
const results = [];
|
|
18
|
-
signal?.throwIfAborted();
|
|
19
|
-
if (options.mcp !== void 0) {
|
|
20
|
-
results.push(...(await checkMcp(options.mcp, {
|
|
21
|
-
maximumBytes,
|
|
22
|
-
deadline,
|
|
23
|
-
signal,
|
|
24
|
-
handshake: options.mcpHandshake === true,
|
|
25
|
-
poll,
|
|
26
|
-
webhook: options.webhook
|
|
27
|
-
})).results);
|
|
28
|
-
signal?.throwIfAborted();
|
|
29
|
-
const mcp = await mcpInvoke(options.mcp, orStop(AbortSignal.timeout(deadline), signal)).catch(() => void 0);
|
|
30
|
-
if (mcp !== void 0) {
|
|
31
|
-
results.push(...(await checkProperties("mcp", mcp.invoke, deadline, signal)).results);
|
|
32
|
-
await mcp.close();
|
|
33
|
-
}
|
|
34
|
-
signal?.throwIfAborted();
|
|
35
|
-
}
|
|
36
|
-
if (options.pollLease !== void 0) {
|
|
37
|
-
const checks = new Checks("mcp", deadline, signal);
|
|
38
|
-
await checkPollLease(checks, httpChannel(options.pollLease.mcp), options.pollLease.leaseMs);
|
|
39
|
-
results.push(...checks.results);
|
|
40
|
-
signal?.throwIfAborted();
|
|
41
|
-
}
|
|
42
|
-
if (options.mcpStdio !== void 0) {
|
|
43
|
-
for (const checks of await checkMcpStdio(options.mcpStdio, {
|
|
44
|
-
deadline,
|
|
45
|
-
signal,
|
|
46
|
-
poll
|
|
47
|
-
})) results.push(...checks.results);
|
|
48
|
-
signal?.throwIfAborted();
|
|
49
|
-
}
|
|
50
|
-
if (options.http !== void 0) {
|
|
51
|
-
results.push(...(await checkHttp(options.http, {
|
|
52
|
-
maximumBytes,
|
|
53
|
-
deadline,
|
|
54
|
-
signal
|
|
55
|
-
})).results);
|
|
56
|
-
results.push(...(await checkProperties("http", httpInvoke(options.http), deadline, signal)).results);
|
|
57
|
-
signal?.throwIfAborted();
|
|
58
|
-
}
|
|
59
|
-
if (options.cli !== void 0) {
|
|
60
|
-
results.push(...(await checkCli(options.cli, {
|
|
61
|
-
deadline,
|
|
62
|
-
signal
|
|
63
|
-
})).results);
|
|
64
|
-
signal?.throwIfAborted();
|
|
65
|
-
}
|
|
66
|
-
if (options.webmcp !== void 0) {
|
|
67
|
-
const driver = typeof options.webmcp === "string" ? await browserDriver(options.webmcp) : await processDriver(options.webmcp);
|
|
68
|
-
try {
|
|
69
|
-
results.push(...(await checkWebMcp(driver, {
|
|
70
|
-
deadline,
|
|
71
|
-
signal
|
|
72
|
-
})).results);
|
|
73
|
-
} finally {
|
|
74
|
-
await driver.close();
|
|
75
|
-
}
|
|
76
|
-
signal?.throwIfAborted();
|
|
77
|
-
}
|
|
78
|
-
return results;
|
|
79
|
-
}
|
|
80
|
-
export { DEADLINE, conform, fixture, serve };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Checks } from "./check.js";
|
|
2
|
-
import type { PollSettings } from "./poll.js";
|
|
3
|
-
export declare function checkMcpStdio(command: readonly string[], options: {
|
|
4
|
-
readonly deadline: number;
|
|
5
|
-
readonly signal?: AbortSignal | undefined;
|
|
6
|
-
readonly poll: PollSettings;
|
|
7
|
-
}): Promise<readonly Checks[]>;
|