@opencode/browse 0.0.11-dev.74 → 0.0.11-dev.75
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/dist/{cli-a7k2dxdn.mjs → cli-5980z4hc.mjs} +10 -10
- package/dist/cli.mjs +9 -9
- package/dist/{helpers-84e9b406.mjs → helpers-h1mvscyw.mjs} +2 -2
- package/dist/{main-7dpg0mjz.mjs → main-5vffh0gd.mjs} +3 -3
- package/dist/{main-qdrd6jck.mjs → main-d1hydckg.mjs} +2 -2
- package/dist/{main-43zcz56n.mjs → main-j38051kb.mjs} +96 -15
- package/dist/{main-2bb5sfft.mjs → main-jkq3ey3t.mjs} +3 -3
- package/dist/{main-2d1fteqw.mjs → main-nhr7bg32.mjs} +1 -1
- package/dist/{main-fp9pzxmb.mjs → main-s5mqta5j.mjs} +2 -2
- package/dist/{main-q5y16xa8.mjs → main-tcae6pr3.mjs} +4 -4
- package/dist/main-wpbmhp3v.mjs +4 -0
- package/dist/{mcp-v0nqt3b0.mjs → mcp-x1vq2n6t.mjs} +214 -249
- package/dist/{relay-pbt8dmpa.mjs → relay-94r2w21z.mjs} +8 -8
- package/dist/{runtime-update-nhpkbvt2.mjs → runtime-update-g516gc7h.mjs} +4 -4
- package/dist/{setup-gt8mrdn6.mjs → setup-q1sfzdr9.mjs} +5 -5
- package/dist/{skill-text-q5tkbz98.mjs → skill-text-x7sccp6h.mjs} +6 -4
- package/dist/{supervisor-w0t2qaej.mjs → supervisor-e2w15458.mjs} +3 -3
- package/dist/{update-0ssj6chm.mjs → update-c8xwkt5v.mjs} +3 -3
- package/dist/{version-1mzgjxcn.mjs → version-0jtmhnzb.mjs} +1 -1
- package/package.json +1 -1
- package/skills/browse/SKILL.md +6 -4
- package/dist/main-7zgqqv4q.mjs +0 -4
|
@@ -129,7 +129,6 @@ import {
|
|
|
129
129
|
sandbox,
|
|
130
130
|
ignore,
|
|
131
131
|
ignoreCause,
|
|
132
|
-
orElseSucceed,
|
|
133
132
|
timeout,
|
|
134
133
|
race,
|
|
135
134
|
when,
|
|
@@ -154,7 +153,6 @@ import {
|
|
|
154
153
|
uninterruptible,
|
|
155
154
|
uninterruptibleMask2,
|
|
156
155
|
forever,
|
|
157
|
-
repeat,
|
|
158
156
|
makeSpanScoped,
|
|
159
157
|
useSpan,
|
|
160
158
|
withSpan,
|
|
@@ -258,11 +256,11 @@ import {
|
|
|
258
256
|
} from "./main-gevbt7h7.mjs";
|
|
259
257
|
import {
|
|
260
258
|
opencodeBrowserVersion2
|
|
261
|
-
} from "./main-
|
|
259
|
+
} from "./main-wpbmhp3v.mjs";
|
|
262
260
|
import {
|
|
263
261
|
cliCommand,
|
|
264
262
|
autoUpdateStatus
|
|
265
|
-
} from "./main-
|
|
263
|
+
} from "./main-jkq3ey3t.mjs";
|
|
266
264
|
import"./main-mrew6jy8.mjs";
|
|
267
265
|
import {
|
|
268
266
|
option,
|
|
@@ -273,16 +271,8 @@ import {
|
|
|
273
271
|
SessionAdoptResponse,
|
|
274
272
|
AuthProfileSummary,
|
|
275
273
|
NetworkStopResponse,
|
|
276
|
-
NetworkCancelResponse,
|
|
277
274
|
AuthRunResponse,
|
|
278
|
-
RecordingStartResponse,
|
|
279
|
-
RecordingStopResponse,
|
|
280
|
-
RecordingStatusResponse,
|
|
281
275
|
TabsCleanupResponse,
|
|
282
|
-
RecordingCancelResponse,
|
|
283
|
-
FlightRecorderStatusResponse,
|
|
284
|
-
FlightRecorderSaveResponse,
|
|
285
|
-
FlightRecorderCancelResponse,
|
|
286
276
|
getObject2,
|
|
287
277
|
RelayRejected,
|
|
288
278
|
Service,
|
|
@@ -290,16 +280,15 @@ import {
|
|
|
290
280
|
relayBuildProblem,
|
|
291
281
|
ensureRelay,
|
|
292
282
|
ensureExtensionConnected
|
|
293
|
-
} from "./main-
|
|
294
|
-
import"./main-
|
|
283
|
+
} from "./main-tcae6pr3.mjs";
|
|
284
|
+
import"./main-nhr7bg32.mjs";
|
|
295
285
|
import {
|
|
296
286
|
updateJson2,
|
|
297
287
|
createUpdateWatcher2
|
|
298
|
-
} from "./main-
|
|
288
|
+
} from "./main-d1hydckg.mjs";
|
|
299
289
|
import {
|
|
300
290
|
makeUnsafe,
|
|
301
291
|
make,
|
|
302
|
-
settingKeys,
|
|
303
292
|
settingSpecs,
|
|
304
293
|
securityVariables,
|
|
305
294
|
isStreamSchema,
|
|
@@ -348,7 +337,6 @@ import {
|
|
|
348
337
|
McpServerClientMiddleware,
|
|
349
338
|
ServerNotificationRpcs,
|
|
350
339
|
EnabledWhen,
|
|
351
|
-
browsersNote2,
|
|
352
340
|
mcpUpdateNote2,
|
|
353
341
|
objectSchema,
|
|
354
342
|
emptyInputSchema,
|
|
@@ -359,7 +347,10 @@ import {
|
|
|
359
347
|
StatusToolOutput,
|
|
360
348
|
CurrentSessionToolOutput,
|
|
361
349
|
SessionDeleteToolOutput,
|
|
362
|
-
|
|
350
|
+
NetworkToolOutput,
|
|
351
|
+
RecordingToolOutput,
|
|
352
|
+
FlightRecorderToolOutput,
|
|
353
|
+
agentSettingKeys,
|
|
363
354
|
SettingsToolOutput,
|
|
364
355
|
SecretsListToolOutput,
|
|
365
356
|
toolOutputJson,
|
|
@@ -368,6 +359,7 @@ import {
|
|
|
368
359
|
parseExecuteArguments,
|
|
369
360
|
parseAdoptArguments,
|
|
370
361
|
requiredStringField,
|
|
362
|
+
requiredAction,
|
|
371
363
|
optionalStringField,
|
|
372
364
|
optionalBooleanField,
|
|
373
365
|
optionalPositiveIntegerField,
|
|
@@ -377,7 +369,7 @@ import {
|
|
|
377
369
|
mcpErrorMessage2,
|
|
378
370
|
toolResult,
|
|
379
371
|
listSecrets
|
|
380
|
-
} from "./main-
|
|
372
|
+
} from "./main-j38051kb.mjs";
|
|
381
373
|
import {
|
|
382
374
|
Clock,
|
|
383
375
|
type,
|
|
@@ -8777,11 +8769,9 @@ function registerMcpTools(options) {
|
|
|
8777
8769
|
});
|
|
8778
8770
|
}
|
|
8779
8771
|
function createMcpToolContext(options) {
|
|
8780
|
-
const browsers = options.browsers ?? [];
|
|
8781
|
-
const browserNote = browsersNote2(browsers);
|
|
8782
8772
|
const browserProperty = {
|
|
8783
8773
|
type: "string",
|
|
8784
|
-
description:
|
|
8774
|
+
description: "Optional browser id for a new session's tabs; omit for the default browser. A session stays in its browser. Call status to list the connected browsers."
|
|
8785
8775
|
};
|
|
8786
8776
|
const resolveSessionId = (input, field = "session") => optionalStringField(input, field) ?? (field === "id" ? optionalStringField(input, "session") : undefined) ?? options.currentSession.id;
|
|
8787
8777
|
const establishCurrentSession = (id) => {
|
|
@@ -8795,8 +8785,6 @@ function createMcpToolContext(options) {
|
|
|
8795
8785
|
update: options.update ?? (() => {
|
|
8796
8786
|
return;
|
|
8797
8787
|
}),
|
|
8798
|
-
browsers,
|
|
8799
|
-
browserNote,
|
|
8800
8788
|
browserProperty,
|
|
8801
8789
|
resolveSessionId,
|
|
8802
8790
|
establishCurrentSession
|
|
@@ -8807,17 +8795,19 @@ function buildRegisteredMcpTools(ctx) {
|
|
|
8807
8795
|
}
|
|
8808
8796
|
|
|
8809
8797
|
// src/mcp/browser.ts
|
|
8798
|
+
var agentSettings = (settings) => Object.fromEntries(agentSettingKeys.map((key) => [key, settings[key]]));
|
|
8810
8799
|
registerMcpTools({
|
|
8811
8800
|
order: 110,
|
|
8812
8801
|
build: (ctx) => [
|
|
8813
8802
|
{
|
|
8814
8803
|
name: "status",
|
|
8815
8804
|
requiresRelayCompatibility: false,
|
|
8816
|
-
description: "Return relay, extension, target, and
|
|
8805
|
+
description: "Return relay, extension, target, session, and connected browser status.",
|
|
8817
8806
|
inputSchema: emptyInputSchema,
|
|
8818
8807
|
readOnly: true,
|
|
8819
8808
|
destructive: false,
|
|
8820
|
-
idempotent:
|
|
8809
|
+
idempotent: true,
|
|
8810
|
+
openWorld: false,
|
|
8821
8811
|
outputSchema: StatusToolOutput,
|
|
8822
8812
|
handle: () => gen(function* () {
|
|
8823
8813
|
const [version, status] = yield* all([ctx.relay.version, ctx.relay.extensionStatus]);
|
|
@@ -8852,6 +8842,7 @@ registerMcpTools({
|
|
|
8852
8842
|
readOnly: false,
|
|
8853
8843
|
destructive: true,
|
|
8854
8844
|
idempotent: true,
|
|
8845
|
+
openWorld: false,
|
|
8855
8846
|
outputSchema: TabsCleanupResponse,
|
|
8856
8847
|
handle: (input) => {
|
|
8857
8848
|
const value = typeof input === "object" && input !== null && "idleMinutes" in input ? input.idleMinutes : undefined;
|
|
@@ -8860,25 +8851,33 @@ registerMcpTools({
|
|
|
8860
8851
|
},
|
|
8861
8852
|
{
|
|
8862
8853
|
name: "settings",
|
|
8863
|
-
description: `Read or change the user's browse settings
|
|
8854
|
+
description: `Read or change the user's browse settings from the extension's options page: where agent tabs open (window), how they're grouped (grouping), when untouched agent tabs close (idleMinutes), the agent cursor (cursor), human-like input (humanInput) and handoff notifications (handoffNotifications). Update behaviour is not available here: only the user changes it, with \`browse settings\` or the extension's options page, and \`status\` reports its current value. Use this tool only when the user asks to change how browse behaves, never on your own initiative. Without \`set\` it returns each setting's stored value, the value in effect, and the relay environment variable that overrides it, if any. With \`set\` it validates every value strictly, applies the change at once (the options page updates live) and returns what changed: tell the user what you changed. A setting an environment variable fixes is not changed, and the result says so. Security switches (${securityVariables.join(", ")}) are environment-only and can never be read or changed here.`,
|
|
8864
8855
|
inputSchema: objectSchema({
|
|
8865
8856
|
set: {
|
|
8866
8857
|
type: "object",
|
|
8867
8858
|
description: "Settings to change; omit to only read them.",
|
|
8868
|
-
properties: Object.fromEntries(
|
|
8859
|
+
properties: Object.fromEntries(agentSettingKeys.map((key) => [key, { enum: [...settingSpecs[key].values], description: settingSpecs[key].label }])),
|
|
8869
8860
|
additionalProperties: false
|
|
8870
8861
|
}
|
|
8871
8862
|
}),
|
|
8872
8863
|
readOnly: false,
|
|
8873
8864
|
destructive: false,
|
|
8874
8865
|
idempotent: true,
|
|
8866
|
+
openWorld: false,
|
|
8875
8867
|
outputSchema: SettingsToolOutput,
|
|
8876
8868
|
handle: (input) => {
|
|
8877
8869
|
const set = getObject2(input)?.set;
|
|
8878
|
-
if (set === undefined)
|
|
8879
|
-
return ctx.relay.settingsGet;
|
|
8870
|
+
if (set === undefined) {
|
|
8871
|
+
return ctx.relay.settingsGet.pipe(map5((result) => ({ ...result, settings: agentSettings(result.settings) })));
|
|
8872
|
+
}
|
|
8880
8873
|
const changes = getObject2(set);
|
|
8881
|
-
|
|
8874
|
+
if (!changes) {
|
|
8875
|
+
return fail4(new Error('set must be an object, for example { "grouping": "shared" }'));
|
|
8876
|
+
}
|
|
8877
|
+
if ("autoUpdate" in changes) {
|
|
8878
|
+
return fail4(new Error("autoUpdate can't be read or changed from MCP. The user can change it with `browse settings set autoUpdate=...` or the extension's options page; `status` reports the current value."));
|
|
8879
|
+
}
|
|
8880
|
+
return ctx.relay.settingsSet(changes).pipe(map5((result) => ({ ...result, settings: agentSettings(result.settings) })));
|
|
8882
8881
|
}
|
|
8883
8882
|
}
|
|
8884
8883
|
]
|
|
@@ -8890,8 +8889,7 @@ registerMcpTools({
|
|
|
8890
8889
|
build: (ctx) => [
|
|
8891
8890
|
{
|
|
8892
8891
|
name: "execute",
|
|
8893
|
-
|
|
8894
|
-
description: `Execute Playwright JavaScript against the browse session. Code runs in a sandbox on the relay without process, require, import(), fs, child_process, http/https or Node fetch; save and read files with the files helper inside the execute file roots, and cookie access is limited to the session's pages. The result includes console logs, warnings, a bounded execution-context diagnostic when relevant, and an aftermath summary (URL movement, navigations, error counts, handoffs, and a bot challenge or block page when one appears: hand interactive ones to the user with handoff(), never solve or retry-loop them).${ctx.browserNote}`,
|
|
8892
|
+
description: `Execute Playwright JavaScript against the browse session. Code runs in a sandbox on the relay without process, require, import(), fs, child_process, http/https or Node fetch; save and read files with the files helper inside the execute file roots, and cookie access is limited to the session's pages. The result includes console logs, warnings, a bounded execution-context diagnostic when relevant, and an aftermath summary (URL movement, navigations, error counts, handoffs, and a bot challenge or block page when one appears: hand interactive ones to the user with handoff(), never solve or retry-loop them).`,
|
|
8895
8893
|
inputSchema: objectSchema({
|
|
8896
8894
|
code: {
|
|
8897
8895
|
type: "string",
|
|
@@ -8920,6 +8918,7 @@ registerMcpTools({
|
|
|
8920
8918
|
readOnly: false,
|
|
8921
8919
|
destructive: true,
|
|
8922
8920
|
idempotent: false,
|
|
8921
|
+
openWorld: true,
|
|
8923
8922
|
outputSchema: ExecuteToolOutput,
|
|
8924
8923
|
result: executeToolResult,
|
|
8925
8924
|
handle: (input) => gen(function* () {
|
|
@@ -8949,56 +8948,98 @@ registerMcpTools({
|
|
|
8949
8948
|
|
|
8950
8949
|
// src/mcp/network.ts
|
|
8951
8950
|
import path from "node:path";
|
|
8951
|
+
var actions = ["start", "status", "stop", "cancel"];
|
|
8952
8952
|
registerMcpTools({
|
|
8953
8953
|
order: 300,
|
|
8954
8954
|
build: (ctx) => [
|
|
8955
8955
|
{
|
|
8956
|
-
name: "
|
|
8957
|
-
description: "Start session-scoped network capture. browse records normalized Playwright exchanges; HAR is only the optional export format. Bodies are embedded by default with per-body and total memory limits.",
|
|
8956
|
+
name: "network",
|
|
8957
|
+
description: "Start, inspect, stop, or cancel session-scoped network capture. browse records normalized Playwright exchanges; HAR is only the optional export format. Bodies are embedded by default with per-body and total memory limits. Actions: start begins a capture; status returns bounded metadata for the active capture without captured values; stop ends it and optionally writes a credential-redacted HAR and stores lossless credential values in a reusable secret profile (at least one of outputPath or secrets is required); cancel ends it and discards the in-memory exchanges.",
|
|
8958
8958
|
inputSchema: objectSchema({
|
|
8959
|
+
action: {
|
|
8960
|
+
type: "string",
|
|
8961
|
+
enum: [...actions],
|
|
8962
|
+
description: "start begins a capture, status reports its bounded metadata, stop writes a redacted HAR and/or secret profile, cancel discards it."
|
|
8963
|
+
},
|
|
8959
8964
|
session: {
|
|
8960
8965
|
type: "string",
|
|
8961
|
-
description: "Optional
|
|
8966
|
+
description: "Optional session id. Defaults to this MCP server's current session; start creates it when missing."
|
|
8962
8967
|
},
|
|
8963
|
-
urlFilter: { type: "string", description: "
|
|
8968
|
+
urlFilter: { type: "string", description: "For start: capture only request URLs containing this text." },
|
|
8964
8969
|
resourceTypes: {
|
|
8965
8970
|
type: "array",
|
|
8966
8971
|
items: { type: "string" },
|
|
8967
|
-
description: "
|
|
8972
|
+
description: "For start: optional Playwright resource types such as fetch and xhr."
|
|
8968
8973
|
},
|
|
8969
8974
|
content: {
|
|
8970
8975
|
type: "string",
|
|
8971
8976
|
enum: ["embed", "omit"],
|
|
8972
|
-
description: "
|
|
8977
|
+
description: "For start: request and response body mode. Defaults to embed."
|
|
8973
8978
|
},
|
|
8974
8979
|
maxBodyBytes: {
|
|
8975
8980
|
type: "integer",
|
|
8976
8981
|
minimum: 1,
|
|
8977
|
-
description: "
|
|
8982
|
+
description: "For start: maximum bytes captured from each body. Defaults to 1000000."
|
|
8978
8983
|
},
|
|
8979
8984
|
maxTotalBodyBytes: {
|
|
8980
8985
|
type: "integer",
|
|
8981
8986
|
minimum: 1,
|
|
8982
|
-
description: "
|
|
8987
|
+
description: "For start: maximum body bytes retained for the capture. Defaults to 25000000."
|
|
8983
8988
|
},
|
|
8984
8989
|
maxEntries: {
|
|
8985
8990
|
type: "integer",
|
|
8986
8991
|
minimum: 1,
|
|
8987
|
-
description: "
|
|
8992
|
+
description: "For start: maximum captured requests. Defaults to 1000."
|
|
8988
8993
|
},
|
|
8989
8994
|
maxDurationMs: {
|
|
8990
8995
|
type: "integer",
|
|
8991
8996
|
minimum: 1,
|
|
8992
8997
|
maximum: 86400000,
|
|
8993
|
-
description: "
|
|
8998
|
+
description: "For start: the capture ends by itself, discarding what it captured, after this long. Defaults to 1800000 (30 minutes). It also ends when this MCP server exits."
|
|
8999
|
+
},
|
|
9000
|
+
outputPath: {
|
|
9001
|
+
type: "string",
|
|
9002
|
+
description: "For stop: optional artifact path, resolved against the MCP process working directory. The HAR contains stable ${BC_SECRET_N} references (and redaction-only ${BC_REDACTED_N} for passwords, one-time codes and token-like URL path segments), not captured values."
|
|
9003
|
+
},
|
|
9004
|
+
secrets: {
|
|
9005
|
+
type: "string",
|
|
9006
|
+
description: "For stop: optional reusable profile name for captured credential values."
|
|
8994
9007
|
}
|
|
8995
|
-
}),
|
|
9008
|
+
}, ["action"]),
|
|
8996
9009
|
readOnly: false,
|
|
8997
|
-
destructive:
|
|
9010
|
+
destructive: true,
|
|
8998
9011
|
idempotent: false,
|
|
8999
|
-
|
|
9012
|
+
openWorld: false,
|
|
9013
|
+
requiresRelayCompatibility: (input) => optionalStringField(input, "action") !== "status",
|
|
9014
|
+
outputSchema: NetworkToolOutput,
|
|
9000
9015
|
handle: (input) => gen(function* () {
|
|
9016
|
+
const action = yield* try_(() => requiredAction(input, actions));
|
|
9001
9017
|
const object = requireObject(input);
|
|
9018
|
+
if (action === "status") {
|
|
9019
|
+
const sessionId = ctx.resolveSessionId(object);
|
|
9020
|
+
return { action, session: sessionId, ...yield* ctx.relay.networkStatus({ sessionId }) };
|
|
9021
|
+
}
|
|
9022
|
+
if (action === "cancel") {
|
|
9023
|
+
const sessionId = ctx.resolveSessionId(object);
|
|
9024
|
+
return { action, session: sessionId, ...yield* ctx.relay.networkCancel({ sessionId }) };
|
|
9025
|
+
}
|
|
9026
|
+
if (action === "stop") {
|
|
9027
|
+
const sessionId = ctx.resolveSessionId(object);
|
|
9028
|
+
const outputPath = optionalStringField(object, "outputPath");
|
|
9029
|
+
const secrets = optionalStringField(object, "secrets");
|
|
9030
|
+
if (!outputPath && !secrets) {
|
|
9031
|
+
return yield* fail4(new Error("network stop requires outputPath, secrets, or both"));
|
|
9032
|
+
}
|
|
9033
|
+
return {
|
|
9034
|
+
action,
|
|
9035
|
+
session: sessionId,
|
|
9036
|
+
...yield* ctx.relay.networkStop({
|
|
9037
|
+
sessionId,
|
|
9038
|
+
...outputPath ? { outputPath: path.resolve(outputPath) } : {},
|
|
9039
|
+
...secrets ? { secrets } : {}
|
|
9040
|
+
})
|
|
9041
|
+
};
|
|
9042
|
+
}
|
|
9002
9043
|
const explicitSession = optionalStringField(object, "session");
|
|
9003
9044
|
const sessionId = explicitSession ?? ctx.currentSession.id;
|
|
9004
9045
|
if (explicitSession) {
|
|
@@ -9028,128 +9069,93 @@ registerMcpTools({
|
|
|
9028
9069
|
...maxEntries === undefined ? {} : { maxEntries },
|
|
9029
9070
|
...maxDurationMs === undefined ? {} : { maxDurationMs }
|
|
9030
9071
|
});
|
|
9031
|
-
return { session: sessionId, ...result };
|
|
9072
|
+
return { action, session: sessionId, ...result };
|
|
9032
9073
|
})
|
|
9033
|
-
},
|
|
9034
|
-
{
|
|
9035
|
-
name: "network_status",
|
|
9036
|
-
requiresRelayCompatibility: false,
|
|
9037
|
-
description: "Return bounded metadata for a session's active network capture. Captured values are never included.",
|
|
9038
|
-
inputSchema: sessionOnlyInputSchema,
|
|
9039
|
-
readOnly: true,
|
|
9040
|
-
destructive: false,
|
|
9041
|
-
idempotent: true,
|
|
9042
|
-
outputSchema: NetworkToolStatus,
|
|
9043
|
-
handle: (input) => {
|
|
9044
|
-
const sessionId = ctx.resolveSessionId(input);
|
|
9045
|
-
return ctx.relay.networkStatus({ sessionId }).pipe(map5((result) => ({ session: sessionId, ...result })));
|
|
9046
|
-
}
|
|
9047
|
-
},
|
|
9048
|
-
{
|
|
9049
|
-
name: "network_stop",
|
|
9050
|
-
description: "Stop network capture. Optionally write a credential-redacted HAR and store lossless credential values in a reusable secret profile. At least one of outputPath or secrets is required.",
|
|
9051
|
-
inputSchema: objectSchema({
|
|
9052
|
-
session: sessionSchemaProperty,
|
|
9053
|
-
outputPath: {
|
|
9054
|
-
type: "string",
|
|
9055
|
-
description: "Optional artifact path, resolved against the MCP process working directory. The HAR contains stable ${BC_SECRET_N} references (and redaction-only ${BC_REDACTED_N} for passwords, one-time codes and token-like URL path segments), not captured values."
|
|
9056
|
-
},
|
|
9057
|
-
secrets: { type: "string", description: "Optional reusable profile name for captured credential values." }
|
|
9058
|
-
}),
|
|
9059
|
-
readOnly: false,
|
|
9060
|
-
destructive: false,
|
|
9061
|
-
idempotent: false,
|
|
9062
|
-
outputSchema: NetworkStopResponse,
|
|
9063
|
-
handle: (input) => gen(function* () {
|
|
9064
|
-
const sessionId = ctx.resolveSessionId(input);
|
|
9065
|
-
const outputPath = optionalStringField(input, "outputPath");
|
|
9066
|
-
const secrets = optionalStringField(input, "secrets");
|
|
9067
|
-
if (!outputPath && !secrets) {
|
|
9068
|
-
return yield* fail4(new Error("network_stop requires outputPath, secrets, or both"));
|
|
9069
|
-
}
|
|
9070
|
-
return yield* ctx.relay.networkStop({
|
|
9071
|
-
sessionId,
|
|
9072
|
-
...outputPath ? { outputPath: path.resolve(outputPath) } : {},
|
|
9073
|
-
...secrets ? { secrets } : {}
|
|
9074
|
-
});
|
|
9075
|
-
})
|
|
9076
|
-
},
|
|
9077
|
-
{
|
|
9078
|
-
name: "network_cancel",
|
|
9079
|
-
description: "Cancel a session's network capture and discard its in-memory exchanges.",
|
|
9080
|
-
inputSchema: sessionOnlyInputSchema,
|
|
9081
|
-
readOnly: false,
|
|
9082
|
-
destructive: true,
|
|
9083
|
-
idempotent: true,
|
|
9084
|
-
outputSchema: NetworkCancelResponse,
|
|
9085
|
-
handle: (input) => ctx.relay.networkCancel({ sessionId: ctx.resolveSessionId(input) })
|
|
9086
9074
|
}
|
|
9087
9075
|
]
|
|
9088
9076
|
});
|
|
9089
9077
|
|
|
9090
9078
|
// src/mcp/recording.ts
|
|
9091
9079
|
import path2 from "node:path";
|
|
9080
|
+
var recordingActions = ["start", "stop", "status", "cancel"];
|
|
9081
|
+
var flightRecorderActions = ["start", "status", "save_last", "cancel"];
|
|
9092
9082
|
registerMcpTools({
|
|
9093
9083
|
order: 400,
|
|
9094
9084
|
build: (ctx) => [
|
|
9095
9085
|
{
|
|
9096
|
-
name: "
|
|
9097
|
-
description: "
|
|
9086
|
+
name: "recording",
|
|
9087
|
+
description: "Record the current session tab. Actions: start begins recording (CDP mode records video to WebM or MP4; tab-capture mode supports WebM and optional audio; outputPath is required); stop finalizes the artifact; status returns bounded status and quality counters; cancel discards the unfinished artifact.",
|
|
9098
9088
|
inputSchema: objectSchema({
|
|
9089
|
+
action: {
|
|
9090
|
+
type: "string",
|
|
9091
|
+
enum: [...recordingActions],
|
|
9092
|
+
description: "start begins, stop finalizes, status reports, cancel discards the recording."
|
|
9093
|
+
},
|
|
9099
9094
|
session: sessionSchemaProperty,
|
|
9100
9095
|
outputPath: {
|
|
9101
9096
|
type: "string",
|
|
9102
|
-
description: "
|
|
9097
|
+
description: "For start: recording artifact path, resolved against the MCP process working directory."
|
|
9103
9098
|
},
|
|
9104
9099
|
mode: {
|
|
9105
9100
|
type: "string",
|
|
9106
9101
|
enum: ["auto", "tab-capture", "cdp"],
|
|
9107
|
-
description: "
|
|
9102
|
+
description: "For start: recording backend. Defaults to auto."
|
|
9103
|
+
},
|
|
9104
|
+
audio: { type: "boolean", description: "For start: capture tab audio in tab-capture mode." },
|
|
9105
|
+
frameRate: { type: "integer", minimum: 1, maximum: 60, description: "For start: requested frame rate." },
|
|
9106
|
+
maxDurationMs: {
|
|
9107
|
+
type: "integer",
|
|
9108
|
+
minimum: 1,
|
|
9109
|
+
description: "For start: maximum recording duration in milliseconds."
|
|
9108
9110
|
},
|
|
9109
|
-
audio: { type: "boolean", description: "Capture tab audio in tab-capture mode." },
|
|
9110
|
-
frameRate: { type: "integer", minimum: 1, maximum: 60, description: "Requested frame rate." },
|
|
9111
|
-
maxDurationMs: { type: "integer", minimum: 1, description: "Maximum recording duration in milliseconds." },
|
|
9112
9111
|
cursor: {
|
|
9113
9112
|
type: "boolean",
|
|
9114
|
-
description: "
|
|
9113
|
+
description: "For start: draw the ghost cursor in the recording, for demo videos. Off by default: recordings show only the page, with nothing from browse in the frame."
|
|
9115
9114
|
}
|
|
9116
|
-
}, ["
|
|
9115
|
+
}, ["action"]),
|
|
9117
9116
|
readOnly: false,
|
|
9118
|
-
destructive:
|
|
9117
|
+
destructive: true,
|
|
9119
9118
|
idempotent: false,
|
|
9120
|
-
|
|
9121
|
-
|
|
9119
|
+
openWorld: false,
|
|
9120
|
+
requiresRelayCompatibility: (input) => optionalStringField(input, "action") !== "status",
|
|
9121
|
+
outputSchema: RecordingToolOutput,
|
|
9122
|
+
handle: (input) => gen(function* () {
|
|
9123
|
+
const action = yield* try_(() => requiredAction(input, recordingActions));
|
|
9122
9124
|
const object = requireObject(input);
|
|
9125
|
+
const sessionId = ctx.resolveSessionId(object);
|
|
9126
|
+
if (action === "status") {
|
|
9127
|
+
return { action, session: sessionId, ...yield* ctx.relay.recordingStatus({ sessionId }) };
|
|
9128
|
+
}
|
|
9129
|
+
if (action === "cancel") {
|
|
9130
|
+
return { action, session: sessionId, ...yield* ctx.relay.recordingCancel({ sessionId }) };
|
|
9131
|
+
}
|
|
9132
|
+
if (action === "stop") {
|
|
9133
|
+
return { action, session: sessionId, ...yield* ctx.relay.recordingStop({ sessionId }) };
|
|
9134
|
+
}
|
|
9123
9135
|
const mode = optionalStringField(object, "mode");
|
|
9124
9136
|
if (mode !== undefined && mode !== "auto" && mode !== "tab-capture" && mode !== "cdp") {
|
|
9125
|
-
return fail4(new Error("mode must be auto, tab-capture, or cdp"));
|
|
9137
|
+
return yield* fail4(new Error("mode must be auto, tab-capture, or cdp"));
|
|
9126
9138
|
}
|
|
9127
9139
|
const frameRate = optionalPositiveIntegerField(object, "frameRate");
|
|
9128
9140
|
if (frameRate !== undefined && frameRate > 60)
|
|
9129
|
-
return fail4(new Error("frameRate must be at most 60"));
|
|
9141
|
+
return yield* fail4(new Error("frameRate must be at most 60"));
|
|
9130
9142
|
const maxDurationMs = optionalPositiveIntegerField(object, "maxDurationMs");
|
|
9131
9143
|
const audio = optionalBooleanField(object, "audio");
|
|
9132
9144
|
const cursor = optionalBooleanField(object, "cursor");
|
|
9133
|
-
return
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
...
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9147
|
-
inputSchema: sessionOnlyInputSchema,
|
|
9148
|
-
readOnly: false,
|
|
9149
|
-
destructive: false,
|
|
9150
|
-
idempotent: false,
|
|
9151
|
-
outputSchema: RecordingStopResponse,
|
|
9152
|
-
handle: (input) => ctx.relay.recordingStop({ sessionId: ctx.resolveSessionId(input) })
|
|
9145
|
+
return {
|
|
9146
|
+
action,
|
|
9147
|
+
session: sessionId,
|
|
9148
|
+
...yield* ctx.relay.recordingStart({
|
|
9149
|
+
sessionId,
|
|
9150
|
+
outputPath: path2.resolve(requiredStringField(object, "outputPath")),
|
|
9151
|
+
...mode ? { mode } : {},
|
|
9152
|
+
...audio === undefined ? {} : { audio },
|
|
9153
|
+
...frameRate === undefined ? {} : { frameRate },
|
|
9154
|
+
...maxDurationMs === undefined ? {} : { maxDurationMs },
|
|
9155
|
+
...cursor === undefined ? {} : { cursor }
|
|
9156
|
+
})
|
|
9157
|
+
};
|
|
9158
|
+
})
|
|
9153
9159
|
}
|
|
9154
9160
|
]
|
|
9155
9161
|
});
|
|
@@ -9157,111 +9163,83 @@ registerMcpTools({
|
|
|
9157
9163
|
order: 500,
|
|
9158
9164
|
build: (ctx) => [
|
|
9159
9165
|
{
|
|
9160
|
-
name: "
|
|
9161
|
-
|
|
9162
|
-
description: "Return bounded status and quality counters for a session recording.",
|
|
9163
|
-
inputSchema: sessionOnlyInputSchema,
|
|
9164
|
-
readOnly: true,
|
|
9165
|
-
destructive: false,
|
|
9166
|
-
idempotent: true,
|
|
9167
|
-
outputSchema: RecordingStatusResponse,
|
|
9168
|
-
handle: (input) => ctx.relay.recordingStatus({ sessionId: ctx.resolveSessionId(input) })
|
|
9169
|
-
},
|
|
9170
|
-
{
|
|
9171
|
-
name: "recording_cancel",
|
|
9172
|
-
description: "Cancel a session recording and discard its unfinished artifact.",
|
|
9173
|
-
inputSchema: sessionOnlyInputSchema,
|
|
9174
|
-
readOnly: false,
|
|
9175
|
-
destructive: true,
|
|
9176
|
-
idempotent: true,
|
|
9177
|
-
outputSchema: RecordingCancelResponse,
|
|
9178
|
-
handle: (input) => ctx.relay.recordingCancel({ sessionId: ctx.resolveSessionId(input) })
|
|
9179
|
-
},
|
|
9180
|
-
{
|
|
9181
|
-
name: "flight_recorder_start",
|
|
9182
|
-
description: "Start a rolling in-memory video buffer for the current session tab. Saving a clip does not stop buffering.",
|
|
9166
|
+
name: "flight_recorder",
|
|
9167
|
+
description: "Keep a rolling in-memory video buffer for the current session tab. Actions: start begins buffering; status returns bounded rolling-buffer duration, frame, byte and drop counters; save_last encodes and saves the most recent buffered video without stopping the buffer (outputPath is required); cancel stops and discards the buffer.",
|
|
9183
9168
|
inputSchema: objectSchema({
|
|
9169
|
+
action: {
|
|
9170
|
+
type: "string",
|
|
9171
|
+
enum: [...flightRecorderActions],
|
|
9172
|
+
description: "start begins buffering, status reports, save_last saves a clip, cancel discards the buffer."
|
|
9173
|
+
},
|
|
9184
9174
|
session: sessionSchemaProperty,
|
|
9185
9175
|
retentionMs: {
|
|
9186
9176
|
type: "integer",
|
|
9187
9177
|
minimum: 1000,
|
|
9188
9178
|
maximum: 120000,
|
|
9189
|
-
description: "
|
|
9179
|
+
description: "For start: rolling retention window. Defaults to 60000."
|
|
9190
9180
|
},
|
|
9191
9181
|
frameRate: {
|
|
9192
9182
|
type: "integer",
|
|
9193
9183
|
minimum: 1,
|
|
9194
9184
|
maximum: 60,
|
|
9195
|
-
description: "
|
|
9185
|
+
description: "For start: saved clip frame rate. Defaults to 60."
|
|
9186
|
+
},
|
|
9187
|
+
cursor: {
|
|
9188
|
+
type: "boolean",
|
|
9189
|
+
description: "For start: draw the ghost cursor in the buffered video. Off by default."
|
|
9196
9190
|
},
|
|
9197
|
-
cursor: { type: "boolean", description: "Draw the ghost cursor in the buffered video. Off by default." }
|
|
9198
|
-
}),
|
|
9199
|
-
readOnly: false,
|
|
9200
|
-
destructive: false,
|
|
9201
|
-
idempotent: false,
|
|
9202
|
-
outputSchema: FlightRecorderStatusResponse,
|
|
9203
|
-
handle: (input) => {
|
|
9204
|
-
const object = requireObject(input);
|
|
9205
|
-
const retentionMs = optionalPositiveIntegerField(object, "retentionMs");
|
|
9206
|
-
const frameRate = optionalPositiveIntegerField(object, "frameRate");
|
|
9207
|
-
const cursor = optionalBooleanField(object, "cursor");
|
|
9208
|
-
return ctx.relay.flightRecorderStart({
|
|
9209
|
-
sessionId: ctx.resolveSessionId(object),
|
|
9210
|
-
...retentionMs === undefined ? {} : { retentionMs },
|
|
9211
|
-
...frameRate === undefined ? {} : { frameRate },
|
|
9212
|
-
...cursor === undefined ? {} : { cursor }
|
|
9213
|
-
});
|
|
9214
|
-
}
|
|
9215
|
-
},
|
|
9216
|
-
{
|
|
9217
|
-
name: "flight_recorder_status",
|
|
9218
|
-
requiresRelayCompatibility: false,
|
|
9219
|
-
description: "Return bounded rolling-buffer duration, frame, byte, and drop counters.",
|
|
9220
|
-
inputSchema: sessionOnlyInputSchema,
|
|
9221
|
-
readOnly: true,
|
|
9222
|
-
destructive: false,
|
|
9223
|
-
idempotent: true,
|
|
9224
|
-
outputSchema: FlightRecorderStatusResponse,
|
|
9225
|
-
handle: (input) => ctx.relay.flightRecorderStatus({ sessionId: ctx.resolveSessionId(input) })
|
|
9226
|
-
},
|
|
9227
|
-
{
|
|
9228
|
-
name: "flight_recorder_save_last",
|
|
9229
|
-
description: "Encode and save the most recent buffered browser video without stopping the flight recorder.",
|
|
9230
|
-
inputSchema: objectSchema({
|
|
9231
|
-
session: sessionSchemaProperty,
|
|
9232
9191
|
outputPath: {
|
|
9233
9192
|
type: "string",
|
|
9234
|
-
description: "
|
|
9193
|
+
description: "For save_last: fresh .webm or .mp4 path, resolved against the MCP process working directory."
|
|
9235
9194
|
},
|
|
9236
9195
|
durationMs: {
|
|
9237
9196
|
type: "integer",
|
|
9238
9197
|
minimum: 1,
|
|
9239
|
-
description: "
|
|
9198
|
+
description: "For save_last: recent duration to save. Defaults to 30000 and cannot exceed retention."
|
|
9240
9199
|
}
|
|
9241
|
-
}, ["
|
|
9200
|
+
}, ["action"]),
|
|
9242
9201
|
readOnly: false,
|
|
9243
|
-
destructive:
|
|
9202
|
+
destructive: true,
|
|
9244
9203
|
idempotent: false,
|
|
9245
|
-
|
|
9246
|
-
|
|
9204
|
+
openWorld: false,
|
|
9205
|
+
requiresRelayCompatibility: (input) => optionalStringField(input, "action") !== "status",
|
|
9206
|
+
outputSchema: FlightRecorderToolOutput,
|
|
9207
|
+
handle: (input) => gen(function* () {
|
|
9208
|
+
const action = yield* try_(() => requiredAction(input, flightRecorderActions));
|
|
9247
9209
|
const object = requireObject(input);
|
|
9248
|
-
const
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9210
|
+
const sessionId = ctx.resolveSessionId(object);
|
|
9211
|
+
if (action === "status") {
|
|
9212
|
+
return { action, session: sessionId, ...yield* ctx.relay.flightRecorderStatus({ sessionId }) };
|
|
9213
|
+
}
|
|
9214
|
+
if (action === "cancel") {
|
|
9215
|
+
return { action, session: sessionId, ...yield* ctx.relay.flightRecorderCancel({ sessionId }) };
|
|
9216
|
+
}
|
|
9217
|
+
if (action === "save_last") {
|
|
9218
|
+
const durationMs = optionalPositiveIntegerField(object, "durationMs");
|
|
9219
|
+
return {
|
|
9220
|
+
action,
|
|
9221
|
+
session: sessionId,
|
|
9222
|
+
...yield* ctx.relay.flightRecorderSaveLast({
|
|
9223
|
+
sessionId,
|
|
9224
|
+
outputPath: path2.resolve(requiredStringField(object, "outputPath")),
|
|
9225
|
+
...durationMs === undefined ? {} : { durationMs }
|
|
9226
|
+
})
|
|
9227
|
+
};
|
|
9228
|
+
}
|
|
9229
|
+
const retentionMs = optionalPositiveIntegerField(object, "retentionMs");
|
|
9230
|
+
const frameRate = optionalPositiveIntegerField(object, "frameRate");
|
|
9231
|
+
const cursor = optionalBooleanField(object, "cursor");
|
|
9232
|
+
return {
|
|
9233
|
+
action,
|
|
9234
|
+
session: sessionId,
|
|
9235
|
+
...yield* ctx.relay.flightRecorderStart({
|
|
9236
|
+
sessionId,
|
|
9237
|
+
...retentionMs === undefined ? {} : { retentionMs },
|
|
9238
|
+
...frameRate === undefined ? {} : { frameRate },
|
|
9239
|
+
...cursor === undefined ? {} : { cursor }
|
|
9240
|
+
})
|
|
9241
|
+
};
|
|
9242
|
+
})
|
|
9265
9243
|
}
|
|
9266
9244
|
]
|
|
9267
9245
|
});
|
|
@@ -9279,6 +9257,7 @@ registerMcpTools({
|
|
|
9279
9257
|
readOnly: true,
|
|
9280
9258
|
destructive: false,
|
|
9281
9259
|
idempotent: true,
|
|
9260
|
+
openWorld: false,
|
|
9282
9261
|
outputSchema: SecretsListToolOutput,
|
|
9283
9262
|
handle: () => gen(function* () {
|
|
9284
9263
|
const secrets = yield* listSecrets();
|
|
@@ -9293,6 +9272,7 @@ registerMcpTools({
|
|
|
9293
9272
|
readOnly: true,
|
|
9294
9273
|
destructive: false,
|
|
9295
9274
|
idempotent: true,
|
|
9275
|
+
openWorld: false,
|
|
9296
9276
|
outputSchema: AuthProfileSummary,
|
|
9297
9277
|
handle: (input) => ctx.relay.authStatus({ name: requiredStringField(input, "name") })
|
|
9298
9278
|
},
|
|
@@ -9308,6 +9288,7 @@ registerMcpTools({
|
|
|
9308
9288
|
readOnly: false,
|
|
9309
9289
|
destructive: true,
|
|
9310
9290
|
idempotent: false,
|
|
9291
|
+
openWorld: true,
|
|
9311
9292
|
outputSchema: NetworkStopResponse,
|
|
9312
9293
|
handle: (input) => {
|
|
9313
9294
|
const object = requireObject(input);
|
|
@@ -9334,6 +9315,7 @@ registerMcpTools({
|
|
|
9334
9315
|
readOnly: false,
|
|
9335
9316
|
destructive: true,
|
|
9336
9317
|
idempotent: false,
|
|
9318
|
+
openWorld: false,
|
|
9337
9319
|
outputSchema: AuthRunResponse,
|
|
9338
9320
|
handle: (input) => {
|
|
9339
9321
|
const object = requireObject(input);
|
|
@@ -9358,8 +9340,7 @@ registerMcpTools({
|
|
|
9358
9340
|
build: (ctx) => [
|
|
9359
9341
|
{
|
|
9360
9342
|
name: "session_new",
|
|
9361
|
-
|
|
9362
|
-
description: `Create a browse session and make it current for this MCP server.${ctx.browserNote}`,
|
|
9343
|
+
description: "Create a browse session and make it current for this MCP server.",
|
|
9363
9344
|
inputSchema: objectSchema({
|
|
9364
9345
|
browser: ctx.browserProperty,
|
|
9365
9346
|
id: { type: "string", description: "Optional lowercase session id." },
|
|
@@ -9376,6 +9357,7 @@ registerMcpTools({
|
|
|
9376
9357
|
readOnly: false,
|
|
9377
9358
|
destructive: false,
|
|
9378
9359
|
idempotent: false,
|
|
9360
|
+
openWorld: false,
|
|
9379
9361
|
outputSchema: SessionContainer,
|
|
9380
9362
|
handle: (input) => gen(function* () {
|
|
9381
9363
|
const requestedId = optionalStringField(input, "id");
|
|
@@ -9406,6 +9388,7 @@ registerMcpTools({
|
|
|
9406
9388
|
readOnly: false,
|
|
9407
9389
|
destructive: false,
|
|
9408
9390
|
idempotent: true,
|
|
9391
|
+
openWorld: false,
|
|
9409
9392
|
outputSchema: SessionContainer,
|
|
9410
9393
|
handle: (input) => gen(function* () {
|
|
9411
9394
|
const sessionId = ctx.resolveSessionId(input);
|
|
@@ -9423,21 +9406,11 @@ registerMcpTools({
|
|
|
9423
9406
|
inputSchema: emptyInputSchema,
|
|
9424
9407
|
readOnly: true,
|
|
9425
9408
|
destructive: false,
|
|
9426
|
-
idempotent:
|
|
9409
|
+
idempotent: true,
|
|
9410
|
+
openWorld: false,
|
|
9427
9411
|
outputSchema: SessionsContainer,
|
|
9428
9412
|
handle: () => ctx.relay.sessions.pipe(map5((sessions) => ({ sessions })))
|
|
9429
9413
|
},
|
|
9430
|
-
{
|
|
9431
|
-
name: "session_current",
|
|
9432
|
-
requiresRelayCompatibility: false,
|
|
9433
|
-
description: "Return this MCP server's current browse session id.",
|
|
9434
|
-
inputSchema: emptyInputSchema,
|
|
9435
|
-
readOnly: true,
|
|
9436
|
-
destructive: false,
|
|
9437
|
-
idempotent: true,
|
|
9438
|
-
outputSchema: CurrentSessionToolOutput,
|
|
9439
|
-
handle: () => succeed6({ currentSession: ctx.currentSession.id })
|
|
9440
|
-
},
|
|
9441
9414
|
{
|
|
9442
9415
|
name: "session_use",
|
|
9443
9416
|
description: "Set this MCP server's current browse session id.",
|
|
@@ -9447,6 +9420,7 @@ registerMcpTools({
|
|
|
9447
9420
|
readOnly: false,
|
|
9448
9421
|
destructive: false,
|
|
9449
9422
|
idempotent: true,
|
|
9423
|
+
openWorld: false,
|
|
9450
9424
|
outputSchema: CurrentSessionToolOutput,
|
|
9451
9425
|
handle: (input) => gen(function* () {
|
|
9452
9426
|
const id = yield* try_(() => requiredStringField(input, "id"));
|
|
@@ -9465,6 +9439,7 @@ registerMcpTools({
|
|
|
9465
9439
|
readOnly: false,
|
|
9466
9440
|
destructive: true,
|
|
9467
9441
|
idempotent: false,
|
|
9442
|
+
openWorld: false,
|
|
9468
9443
|
outputSchema: SessionResetResponse,
|
|
9469
9444
|
handle: (input) => gen(function* () {
|
|
9470
9445
|
const id = ctx.resolveSessionId(input, "id");
|
|
@@ -9483,6 +9458,7 @@ registerMcpTools({
|
|
|
9483
9458
|
readOnly: false,
|
|
9484
9459
|
destructive: true,
|
|
9485
9460
|
idempotent: true,
|
|
9461
|
+
openWorld: false,
|
|
9486
9462
|
outputSchema: SessionDeleteToolOutput,
|
|
9487
9463
|
handle: (input) => gen(function* () {
|
|
9488
9464
|
const id = ctx.resolveSessionId(input, "id");
|
|
@@ -9519,6 +9495,7 @@ registerMcpTools({
|
|
|
9519
9495
|
readOnly: false,
|
|
9520
9496
|
destructive: false,
|
|
9521
9497
|
idempotent: false,
|
|
9498
|
+
openWorld: false,
|
|
9522
9499
|
outputSchema: SessionAdoptResponse,
|
|
9523
9500
|
handle: (input) => gen(function* () {
|
|
9524
9501
|
const args = yield* try_(() => parseAdoptArguments(input));
|
|
@@ -9592,37 +9569,26 @@ var registerTools = gen(function* () {
|
|
|
9592
9569
|
readOnlyHint: spec.readOnly,
|
|
9593
9570
|
destructiveHint: spec.destructive,
|
|
9594
9571
|
idempotentHint: spec.idempotent,
|
|
9595
|
-
openWorldHint:
|
|
9572
|
+
openWorldHint: spec.openWorld
|
|
9596
9573
|
}
|
|
9597
9574
|
}),
|
|
9598
9575
|
annotations: empty(),
|
|
9599
9576
|
handle: (payload) => {
|
|
9600
|
-
const
|
|
9577
|
+
const requiresRelay = typeof spec.requiresRelayCompatibility === "function" ? spec.requiresRelayCompatibility(payload) : spec.requiresRelayCompatibility !== false;
|
|
9578
|
+
const operation = requiresRelay ? ensureRelay({ relay }).pipe(flatMap3((readiness) => readiness.buildProblem ? fail4(new Error(readiness.buildProblem)) : spec.handle(payload))) : spec.handle(payload);
|
|
9601
9579
|
return operation.pipe(match3({
|
|
9602
9580
|
onFailure: (error) => toolResult({ text: mcpErrorMessage2(spec.name, error.message), isError: true }),
|
|
9603
9581
|
onSuccess: (value) => spec.result ? spec.result(value) : toolResultForValue2(value, spec.outputSchema ? { outputSchema: spec.outputSchema } : {})
|
|
9604
9582
|
}), map5((result) => withUpdateNote(spec.name, result)));
|
|
9605
9583
|
}
|
|
9606
9584
|
});
|
|
9607
|
-
const
|
|
9608
|
-
let browsers = [];
|
|
9609
|
-
const buildSpecs = (currentBrowsers) => buildRegisteredMcpTools(createMcpToolContext({
|
|
9585
|
+
const specs = buildRegisteredMcpTools(createMcpToolContext({
|
|
9610
9586
|
relay,
|
|
9611
9587
|
currentSession,
|
|
9612
9588
|
packageRoot,
|
|
9613
|
-
update: () => updates.current
|
|
9614
|
-
browsers: currentBrowsers
|
|
9589
|
+
update: () => updates.current
|
|
9615
9590
|
}));
|
|
9616
|
-
yield* forEach(
|
|
9617
|
-
const refreshBrowsers = gen(function* () {
|
|
9618
|
-
const next = yield* connectedBrowsers;
|
|
9619
|
-
if (browsersNote2(next) === browsersNote2(browsers))
|
|
9620
|
-
return;
|
|
9621
|
-
browsers = next;
|
|
9622
|
-
const specs = buildSpecs(browsers).filter((spec) => spec.listsBrowsers === true);
|
|
9623
|
-
yield* forEach(specs, register, { discard: true });
|
|
9624
|
-
});
|
|
9625
|
-
yield* refreshBrowsers.pipe(repeat(spaced("5 seconds")), forkScoped);
|
|
9591
|
+
yield* forEach(specs, register, { discard: true });
|
|
9626
9592
|
});
|
|
9627
9593
|
var mcpServerLayer = layerStdio({
|
|
9628
9594
|
name: "browse",
|
|
@@ -9633,7 +9599,6 @@ var mcpServerLayer = layerStdio({
|
|
|
9633
9599
|
var mcpToolsLayer = effectDiscard(registerTools);
|
|
9634
9600
|
var runMcpServer = launch(mcpServerLayer.pipe(provide2(mcpToolsLayer.pipe(provide2(McpServer.layer))), provide2(layer), provide2(layerFetchMcp)));
|
|
9635
9601
|
export {
|
|
9636
|
-
browsersNote2 as browsersNote,
|
|
9637
9602
|
mcpErrorMessage2 as mcpErrorMessage,
|
|
9638
9603
|
mcpInstructions,
|
|
9639
9604
|
mcpServerLayer,
|