@opencode/browse 0.0.11-dev.70 → 0.0.11-dev.71
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-fvrcjg4g.mjs → cli-9qxmqyxx.mjs} +10 -10
- package/dist/cli.mjs +10 -10
- package/dist/{helpers-6by6j39a.mjs → helpers-t569ktgs.mjs} +2 -2
- package/dist/{index-8v65jg3n.mjs → index-0dcypq31.mjs} +1 -1
- package/dist/{main-2jk7tv3t.mjs → main-3hpn75c3.mjs} +5 -5
- package/dist/{main-8xg8gp0m.mjs → main-7j6g3ehy.mjs} +4 -4
- package/dist/{main-fx1xgftk.mjs → main-f7j9dybj.mjs} +128 -11
- package/dist/{main-ta3yc4kx.mjs → main-gevbt7h7.mjs} +1134 -2
- package/dist/main-gss8ctxx.mjs +4 -0
- package/dist/{main-0m7y7537.mjs → main-ha41fhf2.mjs} +1 -1
- package/dist/{main-493hqqst.mjs → main-hn9dbnbe.mjs} +2 -2
- package/dist/{main-bfnwm4x3.mjs → main-jfqp0hfn.mjs} +2 -2
- package/dist/{main-kxbs88e4.mjs → main-rt6g5418.mjs} +1 -1
- package/dist/{main-pgrahcqx.mjs → main-srh04zzr.mjs} +3 -3
- package/dist/{mcp-7cz1j97q.mjs → mcp-76x97qkg.mjs} +65 -13
- package/dist/{relay-6vm4z2c4.mjs → relay-dbqekz6m.mjs} +10 -10
- package/dist/{runtime-update-7hq0ms16.mjs → runtime-update-nj2y79eq.mjs} +5 -5
- package/dist/{setup-9m7r8m7t.mjs → setup-c2q8exjt.mjs} +5 -5
- package/dist/{supervisor-d62ebrqn.mjs → supervisor-pss92xc0.mjs} +3 -3
- package/dist/{update-8qjdkkza.mjs → update-2xgyxtvc.mjs} +3 -3
- package/dist/{version-7h7wv1pt.mjs → version-xpt0zd8b.mjs} +1 -1
- package/package.json +1 -1
- package/dist/main-b39e4gny.mjs +0 -4
|
@@ -101,11 +101,11 @@ import {
|
|
|
101
101
|
isQuitError,
|
|
102
102
|
Terminal,
|
|
103
103
|
layer2
|
|
104
|
-
} from "./main-
|
|
104
|
+
} from "./main-gevbt7h7.mjs";
|
|
105
105
|
import {
|
|
106
106
|
opencodeBrowserVersion2,
|
|
107
107
|
opencodeBrowserBuildId2
|
|
108
|
-
} from "./main-
|
|
108
|
+
} from "./main-gss8ctxx.mjs";
|
|
109
109
|
import {
|
|
110
110
|
dataRoot,
|
|
111
111
|
fromCheckout,
|
|
@@ -115,7 +115,7 @@ import {
|
|
|
115
115
|
devExtension,
|
|
116
116
|
installCommand,
|
|
117
117
|
autoUpdateStatus
|
|
118
|
-
} from "./main-
|
|
118
|
+
} from "./main-srh04zzr.mjs";
|
|
119
119
|
import {
|
|
120
120
|
extensionProtocolVersion,
|
|
121
121
|
extensionProtocolAdvice
|
|
@@ -141,13 +141,13 @@ import {
|
|
|
141
141
|
ensureExtensionConnected,
|
|
142
142
|
stoppedRelayStatus,
|
|
143
143
|
statusCollections
|
|
144
|
-
} from "./main-
|
|
145
|
-
import"./main-
|
|
144
|
+
} from "./main-3hpn75c3.mjs";
|
|
145
|
+
import"./main-ha41fhf2.mjs";
|
|
146
146
|
import {
|
|
147
147
|
updateJson2,
|
|
148
148
|
formatUpdateNotice2,
|
|
149
149
|
updateNotice2
|
|
150
|
-
} from "./main-
|
|
150
|
+
} from "./main-hn9dbnbe.mjs";
|
|
151
151
|
import {
|
|
152
152
|
settingKeys,
|
|
153
153
|
formatSettings,
|
|
@@ -155,12 +155,12 @@ import {
|
|
|
155
155
|
addSecret,
|
|
156
156
|
listSecrets,
|
|
157
157
|
removeSecret
|
|
158
|
-
} from "./main-
|
|
158
|
+
} from "./main-f7j9dybj.mjs";
|
|
159
159
|
import {
|
|
160
160
|
defaultJournalBaseDir,
|
|
161
161
|
readJournalEntries,
|
|
162
162
|
formatJournalEntry
|
|
163
|
-
} from "./main-
|
|
163
|
+
} from "./main-7j6g3ehy.mjs";
|
|
164
164
|
import {
|
|
165
165
|
pipeArguments,
|
|
166
166
|
dual,
|
|
@@ -5856,7 +5856,7 @@ var status = make("status", {
|
|
|
5856
5856
|
}
|
|
5857
5857
|
})).pipe(withDescription4("Show relay, extension, and target status"));
|
|
5858
5858
|
var mcp = make("mcp", {}, fn("Cli.mcp")(function* () {
|
|
5859
|
-
const { runMcpServer } = yield* promise(() => import("./mcp-
|
|
5859
|
+
const { runMcpServer } = yield* promise(() => import("./mcp-76x97qkg.mjs"));
|
|
5860
5860
|
yield* runMcpServer;
|
|
5861
5861
|
})).pipe(withDescription4("Run the browse MCP server over stdio"));
|
|
5862
5862
|
registerCliCommand(400, () => tabs);
|
|
@@ -6304,7 +6304,7 @@ registerCliCommand(710, () => flightRecorder);
|
|
|
6304
6304
|
|
|
6305
6305
|
// src/cli/relay.ts
|
|
6306
6306
|
var serve = make("serve", {}, fn("Cli.serve")(function* () {
|
|
6307
|
-
const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-
|
|
6307
|
+
const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-dbqekz6m.mjs"), import("./helpers-t569ktgs.mjs")]));
|
|
6308
6308
|
const port = yield* portConfig;
|
|
6309
6309
|
const additionalExtensionOrigins = parseAdditionalExtensionOrigins(yield* extensionOriginsConfig);
|
|
6310
6310
|
yield* scoped(gen(function* () {
|
package/dist/cli.mjs
CHANGED
|
@@ -2,29 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
// src/main.ts
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
var embeddedVersion = "0.0.11-dev.
|
|
5
|
+
var embeddedVersion = "0.0.11-dev.71";
|
|
6
6
|
var setupCommands = new Set(["install", "uninstall", "extension", "pair", "rollback", "set"]);
|
|
7
7
|
var command = process.argv[2];
|
|
8
8
|
var invokedAs = path.basename(process.argv[1] ?? "");
|
|
9
9
|
if (command === "--version" || command === "-v") {
|
|
10
|
-
const opencodeBrowserVersion = embeddedVersion ?? (await import("./version-
|
|
10
|
+
const opencodeBrowserVersion = embeddedVersion ?? (await import("./version-xpt0zd8b.mjs")).opencodeBrowserVersion;
|
|
11
11
|
process.stdout.write(`${opencodeBrowserVersion}
|
|
12
12
|
`);
|
|
13
13
|
} else if (command === "mcp" && globalThis.__OPENCODE_BROWSER_COMPILED__ && process.env.OPENCODE_BROWSER_MCP_DIRECT !== "1") {
|
|
14
|
-
const { runBinaryMcp } = await import("./supervisor-
|
|
14
|
+
const { runBinaryMcp } = await import("./supervisor-pss92xc0.mjs");
|
|
15
15
|
await runBinaryMcp(process.argv.slice(3));
|
|
16
16
|
} else if (invokedAs === "opencode-browser-mcp" || command === "mcp" && process.argv.length === 3) {
|
|
17
|
-
const { NodeRuntime } = await import("./index-
|
|
18
|
-
const { runMcpServer } = await import("./mcp-
|
|
17
|
+
const { NodeRuntime } = await import("./index-0dcypq31.mjs");
|
|
18
|
+
const { runMcpServer } = await import("./mcp-76x97qkg.mjs");
|
|
19
19
|
runMcpServer.pipe(NodeRuntime.runMain);
|
|
20
20
|
} else if (command === "runtime-install" || command === "runtime-switch") {
|
|
21
|
-
const { runRuntimeInstall, runRuntimeSwitch } = await import("./runtime-update-
|
|
21
|
+
const { runRuntimeInstall, runRuntimeSwitch } = await import("./runtime-update-nj2y79eq.mjs");
|
|
22
22
|
await (command === "runtime-install" ? runRuntimeInstall : runRuntimeSwitch)(process.argv.slice(3));
|
|
23
23
|
} else if (command === "update") {
|
|
24
|
-
const { runUpdateCommand } = await import("./update-
|
|
24
|
+
const { runUpdateCommand } = await import("./update-2xgyxtvc.mjs");
|
|
25
25
|
await runUpdateCommand(process.argv.slice(3));
|
|
26
26
|
} else if (command && setupCommands.has(command)) {
|
|
27
|
-
const { runSetup } = await import("./setup-
|
|
27
|
+
const { runSetup } = await import("./setup-c2q8exjt.mjs");
|
|
28
28
|
await runSetup(command, process.argv.slice(3));
|
|
29
29
|
} else {
|
|
30
30
|
if (!command || command === "--help" || command === "-h") {
|
|
@@ -59,9 +59,9 @@ if (command === "--version" || command === "-v") {
|
|
|
59
59
|
`);
|
|
60
60
|
}
|
|
61
61
|
if (command === "status" && !process.argv.includes("--json")) {
|
|
62
|
-
const { printSetupStatus } = await import("./setup-
|
|
62
|
+
const { printSetupStatus } = await import("./setup-c2q8exjt.mjs");
|
|
63
63
|
printSetupStatus();
|
|
64
64
|
}
|
|
65
|
-
const { runCli } = await import("./cli-
|
|
65
|
+
const { runCli } = await import("./cli-9qxmqyxx.mjs");
|
|
66
66
|
runCli();
|
|
67
67
|
}
|
|
@@ -31,8 +31,8 @@ import {
|
|
|
31
31
|
isRestrictedTarget2,
|
|
32
32
|
isRestrictedUrl2,
|
|
33
33
|
dataUrlDocument2
|
|
34
|
-
} from "./main-
|
|
35
|
-
import"./main-
|
|
34
|
+
} from "./main-3hpn75c3.mjs";
|
|
35
|
+
import"./main-ha41fhf2.mjs";
|
|
36
36
|
import"./main-mrew6jy8.mjs";
|
|
37
37
|
export {
|
|
38
38
|
HttpRouteError2 as HttpRouteError,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./main-mrew6jy8.mjs";
|
|
8
8
|
import {
|
|
9
9
|
relayAuthorization
|
|
10
|
-
} from "./main-
|
|
10
|
+
} from "./main-ha41fhf2.mjs";
|
|
11
11
|
import {
|
|
12
12
|
assignProperty,
|
|
13
13
|
PipeInspectableProto,
|
|
@@ -107,17 +107,17 @@ import {
|
|
|
107
107
|
bodyJson,
|
|
108
108
|
HttpClient,
|
|
109
109
|
layerNodeHttp
|
|
110
|
-
} from "./main-
|
|
110
|
+
} from "./main-gevbt7h7.mjs";
|
|
111
111
|
import {
|
|
112
112
|
opencodeBrowserBuildId2
|
|
113
|
-
} from "./main-
|
|
113
|
+
} from "./main-gss8ctxx.mjs";
|
|
114
114
|
import {
|
|
115
115
|
compiledBinary,
|
|
116
116
|
scriptEntry,
|
|
117
117
|
cliCommand,
|
|
118
118
|
installCommand,
|
|
119
119
|
npmRuntime
|
|
120
|
-
} from "./main-
|
|
120
|
+
} from "./main-srh04zzr.mjs";
|
|
121
121
|
import {
|
|
122
122
|
dual,
|
|
123
123
|
memoize,
|
|
@@ -1807,4 +1807,4 @@ function isRelayStartingOrUnreachable(error) {
|
|
|
1807
1807
|
return isRelayStarting(error) || isRelayUnreachable(error);
|
|
1808
1808
|
}
|
|
1809
1809
|
|
|
1810
|
-
export { withDefault, option, String2, Int, Boolean2, ExecuteRequest, SessionAdoptRequest, SessionNewRequest, SessionEnsureRequest, SessionIdRequest, SessionAllowlistRequest, AuthenticatedJsonRequest, AuthenticatedJsonOutcome, RelayShutdownRequest, NetworkStartRequest, NetworkSessionRequest, NetworkStopRequest, AuthProfileRequest, AuthRefreshRequest, AuthRunRequest, RecordingTargetRequest, RecordingStartRequest, FlightRecorderStartRequest, FlightRecorderSaveRequest, HttpRouteError2, formatHostForUrl2, listenHttpServer2, closeHttpServer2, closeWebSocketServer2, logCloseError2, sendJson2, readJsonBody2, stableUnpackedExtensionOrigin2, chromeExtensionOriginForPath2, parseAdditionalExtensionOrigins2, validateHostHeader2, validateBrowserFetchSite2, validateWebSocketOrigin2, defaultHost2, defaultPort2, optionalSessionId2, isValidSessionId2, requiredSessionId2, parseTargetSelection2, generateSessionId2, sendCdpResponse2, sendCdpEvent2, getObject2, getString2, getNumber2, getIdText2, headerValue2, getTargetInfo2, isRestrictedTarget2, isRestrictedUrl2, dataUrlDocument2, portConfig, extensionOriginsConfig, endpointForPort, RelayUnreachable, RelayRejected, Service, layerFetch, layerFetchMcp, shouldWaitForExtensionReconnect, relayBuildProblem, ensureRelay, restartRelay, extensionReconnectWaitMs, ensureExtensionConnected, stoppedRelayStatus, statusCollections, startManagedRelay };
|
|
1810
|
+
export { withDefault, option, String2, Int, Boolean2, SessionContainer, SessionsContainer, SessionDeleted, SessionResetResponse, ExecuteRequest, SessionAdoptRequest, SessionNewRequest, SessionEnsureRequest, SessionIdRequest, SessionAllowlistRequest, SessionAdoptResponse, ExecuteLogEntry, ExecuteLogSummary, ExecuteAftermath, AuthenticatedJsonRequest, AuthenticatedJsonOutcome, ExtensionStatus, RelayVersion, RelayShutdownRequest, NetworkStartRequest, NetworkSessionRequest, NetworkStopRequest, NetworkStatusResponse, AuthProfileSummary, NetworkStopResponse, NetworkCancelResponse, AuthProfileRequest, AuthRefreshRequest, AuthRunRequest, AuthRunResponse, RecordingTargetRequest, RecordingStartRequest, RecordingStartResponse, RecordingStopResponse, RecordingStatusResponse, TabsCleanupResponse, SettingsGetResponse, SettingsSetResponse, RecordingCancelResponse, FlightRecorderStartRequest, FlightRecorderStatusResponse, FlightRecorderSaveRequest, FlightRecorderSaveResponse, FlightRecorderCancelResponse, HttpRouteError2, formatHostForUrl2, listenHttpServer2, closeHttpServer2, closeWebSocketServer2, logCloseError2, sendJson2, readJsonBody2, stableUnpackedExtensionOrigin2, chromeExtensionOriginForPath2, parseAdditionalExtensionOrigins2, validateHostHeader2, validateBrowserFetchSite2, validateWebSocketOrigin2, defaultHost2, defaultPort2, optionalSessionId2, isValidSessionId2, requiredSessionId2, parseTargetSelection2, generateSessionId2, sendCdpResponse2, sendCdpEvent2, getObject2, getString2, getNumber2, getIdText2, headerValue2, getTargetInfo2, isRestrictedTarget2, isRestrictedUrl2, dataUrlDocument2, portConfig, extensionOriginsConfig, endpointForPort, RelayUnreachable, RelayRejected, Service, layerFetch, layerFetchMcp, shouldWaitForExtensionReconnect, relayBuildProblem, ensureRelay, restartRelay, extensionReconnectWaitMs, ensureExtensionConnected, stoppedRelayStatus, statusCollections, startManagedRelay };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isNodeError
|
|
3
|
-
} from "./main-
|
|
3
|
+
} from "./main-ha41fhf2.mjs";
|
|
4
4
|
import {
|
|
5
5
|
isValidSessionId2
|
|
6
|
-
} from "./main-
|
|
6
|
+
} from "./main-3hpn75c3.mjs";
|
|
7
7
|
import {
|
|
8
8
|
isSome,
|
|
9
9
|
decodeUnknownOption,
|
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
Struct,
|
|
15
15
|
ArraySchema,
|
|
16
16
|
NullOr
|
|
17
|
-
} from "./main-
|
|
17
|
+
} from "./main-gevbt7h7.mjs";
|
|
18
18
|
import {
|
|
19
19
|
dataRoot
|
|
20
|
-
} from "./main-
|
|
20
|
+
} from "./main-srh04zzr.mjs";
|
|
21
21
|
|
|
22
22
|
// src/session-manager/journal.ts
|
|
23
23
|
import fs from "node:fs";
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
+
SessionDeleted,
|
|
3
|
+
ExecuteLogEntry,
|
|
4
|
+
ExecuteLogSummary,
|
|
5
|
+
ExecuteAftermath,
|
|
6
|
+
ExtensionStatus,
|
|
7
|
+
RelayVersion,
|
|
8
|
+
NetworkStatusResponse,
|
|
9
|
+
SettingsGetResponse,
|
|
10
|
+
SettingsSetResponse,
|
|
2
11
|
parseTargetSelection2,
|
|
3
12
|
getObject2,
|
|
4
13
|
getString2
|
|
5
|
-
} from "./main-
|
|
14
|
+
} from "./main-3hpn75c3.mjs";
|
|
6
15
|
import {
|
|
7
16
|
isNodeError,
|
|
8
17
|
writeJsonFileAtomically
|
|
9
|
-
} from "./main-
|
|
18
|
+
} from "./main-ha41fhf2.mjs";
|
|
10
19
|
import {
|
|
11
20
|
getStackTraceLimit,
|
|
12
21
|
setStackTraceLimit,
|
|
@@ -63,6 +72,7 @@ import {
|
|
|
63
72
|
declare,
|
|
64
73
|
decodeUnknownEffect2,
|
|
65
74
|
decodeUnknownSync,
|
|
75
|
+
encodeUnknownOption,
|
|
66
76
|
make11,
|
|
67
77
|
isSchema,
|
|
68
78
|
optionalKey,
|
|
@@ -77,6 +87,7 @@ import {
|
|
|
77
87
|
Boolean3,
|
|
78
88
|
Void,
|
|
79
89
|
Struct,
|
|
90
|
+
fieldsAssign,
|
|
80
91
|
Record,
|
|
81
92
|
StructWithRest,
|
|
82
93
|
ArraySchema,
|
|
@@ -99,9 +110,10 @@ import {
|
|
|
99
110
|
Class2,
|
|
100
111
|
Error2,
|
|
101
112
|
TaggedError2,
|
|
113
|
+
toJsonSchemaDocument,
|
|
102
114
|
Json,
|
|
103
115
|
JsonObject
|
|
104
|
-
} from "./main-
|
|
116
|
+
} from "./main-gevbt7h7.mjs";
|
|
105
117
|
import {
|
|
106
118
|
pipeArguments,
|
|
107
119
|
identity,
|
|
@@ -117,7 +129,7 @@ import {
|
|
|
117
129
|
import {
|
|
118
130
|
dataRoot,
|
|
119
131
|
cliCommand
|
|
120
|
-
} from "./main-
|
|
132
|
+
} from "./main-srh04zzr.mjs";
|
|
121
133
|
|
|
122
134
|
// node_modules/effect/dist/Semaphore.js
|
|
123
135
|
var makeUnsafe = (permits) => new SemaphoreImpl(permits);
|
|
@@ -1486,6 +1498,100 @@ var sessionAliasSchemaProperty = { type: "string", description: "Same as id." };
|
|
|
1486
1498
|
var sessionOnlyInputSchema = objectSchema({
|
|
1487
1499
|
session: sessionSchemaProperty
|
|
1488
1500
|
});
|
|
1501
|
+
var ExecuteToolOutput = Struct({
|
|
1502
|
+
session: String3,
|
|
1503
|
+
value: optionalKey(Unknown),
|
|
1504
|
+
logs: optionalKey(ArraySchema(ExecuteLogEntry)),
|
|
1505
|
+
logSummary: optionalKey(ExecuteLogSummary),
|
|
1506
|
+
warnings: optionalKey(ArraySchema(String3)),
|
|
1507
|
+
diagnostic: optionalKey(String3),
|
|
1508
|
+
aftermath: optionalKey(ExecuteAftermath),
|
|
1509
|
+
notice: optionalKey(String3)
|
|
1510
|
+
});
|
|
1511
|
+
var StatusToolOutput = Struct({
|
|
1512
|
+
endpoint: String3,
|
|
1513
|
+
currentSession: String3,
|
|
1514
|
+
version: RelayVersion,
|
|
1515
|
+
status: ExtensionStatus,
|
|
1516
|
+
buildProblem: optionalKey(String3),
|
|
1517
|
+
update: optionalKey(Json),
|
|
1518
|
+
autoUpdate: Json
|
|
1519
|
+
});
|
|
1520
|
+
var CurrentSessionToolOutput = Struct({
|
|
1521
|
+
currentSession: String3
|
|
1522
|
+
});
|
|
1523
|
+
var SessionDeleteToolOutput = SessionDeleted.pipe(fieldsAssign({
|
|
1524
|
+
currentSession: String3
|
|
1525
|
+
}));
|
|
1526
|
+
var NetworkToolStatus = NetworkStatusResponse.pipe(fieldsAssign({
|
|
1527
|
+
session: String3
|
|
1528
|
+
}));
|
|
1529
|
+
var SettingsToolOutput = Struct({
|
|
1530
|
+
settings: SettingsGetResponse.fields.settings,
|
|
1531
|
+
note: optionalKey(SettingsGetResponse.fields.note),
|
|
1532
|
+
changed: optionalKey(SettingsSetResponse.fields.changed),
|
|
1533
|
+
unchanged: optionalKey(SettingsSetResponse.fields.unchanged),
|
|
1534
|
+
overridden: optionalKey(SettingsSetResponse.fields.overridden),
|
|
1535
|
+
message: optionalKey(SettingsSetResponse.fields.message)
|
|
1536
|
+
});
|
|
1537
|
+
var SecretsListToolOutput = Struct({
|
|
1538
|
+
secrets: ArraySchema(Struct({
|
|
1539
|
+
name: String3,
|
|
1540
|
+
kind: Literals(["password", "totp"]),
|
|
1541
|
+
allowedOrigins: ArraySchema(String3),
|
|
1542
|
+
createdAt: String3,
|
|
1543
|
+
updatedAt: String3
|
|
1544
|
+
}))
|
|
1545
|
+
});
|
|
1546
|
+
function toolOutputJson(schema) {
|
|
1547
|
+
const document = toJsonSchemaDocument(schema);
|
|
1548
|
+
const json = Object.keys(document.definitions).length === 0 ? document.schema : { ...document.schema, $defs: document.definitions };
|
|
1549
|
+
return json;
|
|
1550
|
+
}
|
|
1551
|
+
function logSummaryHasContent(summary) {
|
|
1552
|
+
return summary !== undefined && (summary.totalCount > 0 || summary.returnedCount > 0 || summary.repeatedCount > 0 || summary.omittedCount > 0);
|
|
1553
|
+
}
|
|
1554
|
+
function aftermathHasContent(aftermath) {
|
|
1555
|
+
return aftermath !== undefined && (aftermath.startUrl !== aftermath.endUrl || aftermath.navigations.length > 0 || aftermath.consoleErrorCount > 0 || aftermath.pageErrorCount > 0 || aftermath.handoffs > 0 || aftermath.challenge !== undefined);
|
|
1556
|
+
}
|
|
1557
|
+
function executeToolOutput(result) {
|
|
1558
|
+
return {
|
|
1559
|
+
session: result.session.id,
|
|
1560
|
+
...result.value === undefined ? {} : { value: result.value },
|
|
1561
|
+
...result.logs.length > 0 ? { logs: result.logs } : {},
|
|
1562
|
+
...logSummaryHasContent(result.logSummary) ? { logSummary: result.logSummary } : {},
|
|
1563
|
+
...result.warnings && result.warnings.length > 0 ? { warnings: result.warnings } : {},
|
|
1564
|
+
...result.diagnostic ? { diagnostic: result.diagnostic } : {},
|
|
1565
|
+
...aftermathHasContent(result.aftermath) ? { aftermath: result.aftermath } : {},
|
|
1566
|
+
...result.notice ? { notice: result.notice } : {}
|
|
1567
|
+
};
|
|
1568
|
+
}
|
|
1569
|
+
function executeToolText(result) {
|
|
1570
|
+
const text = result.isError ? result.text : isString(result.value) ? result.value : result.value === undefined ? result.text : JSON.stringify(result.value);
|
|
1571
|
+
return result.notice ? `${text}
|
|
1572
|
+
|
|
1573
|
+
${result.notice}` : text;
|
|
1574
|
+
}
|
|
1575
|
+
function executeToolResult(value) {
|
|
1576
|
+
const result = value;
|
|
1577
|
+
if (result.media && result.media.length > 0) {
|
|
1578
|
+
return new CallToolResult({
|
|
1579
|
+
content: [
|
|
1580
|
+
TextContent.make({ text: result.text }),
|
|
1581
|
+
...result.media.map((image) => ImageContent.make({
|
|
1582
|
+
data: new Uint8Array(Buffer.from(image.data, "base64")),
|
|
1583
|
+
mimeType: image.mimeType
|
|
1584
|
+
}))
|
|
1585
|
+
],
|
|
1586
|
+
isError: result.isError
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1589
|
+
return toolResultForValue2(executeToolOutput(result), {
|
|
1590
|
+
outputSchema: ExecuteToolOutput,
|
|
1591
|
+
text: executeToolText(result),
|
|
1592
|
+
isError: result.isError
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1489
1595
|
var ensureSessionExists = fnUntraced(function* (relay, id) {
|
|
1490
1596
|
const sessions = yield* relay.sessions;
|
|
1491
1597
|
const exists = sessions.some((session) => {
|
|
@@ -1584,11 +1690,17 @@ function stringifyResult(value) {
|
|
|
1584
1690
|
if (isString(value)) {
|
|
1585
1691
|
return value;
|
|
1586
1692
|
}
|
|
1587
|
-
return JSON.stringify(value
|
|
1693
|
+
return JSON.stringify(value);
|
|
1588
1694
|
}
|
|
1589
|
-
function
|
|
1695
|
+
function encodedStructuredContent(value, schema) {
|
|
1696
|
+
if (!schema)
|
|
1697
|
+
return value;
|
|
1698
|
+
const encoded = encodeUnknownOption(schema)(value);
|
|
1699
|
+
return isSome(encoded) ? encoded.value : undefined;
|
|
1700
|
+
}
|
|
1701
|
+
function toolResultForValue2(value, options = {}) {
|
|
1590
1702
|
const object = getObject2(value);
|
|
1591
|
-
const isError = object?.isError === true;
|
|
1703
|
+
const isError = options.isError ?? object?.isError === true;
|
|
1592
1704
|
const media = Array.isArray(object?.media) ? object.media.flatMap((item) => {
|
|
1593
1705
|
const image = getObject2(item);
|
|
1594
1706
|
const mimeType = getString2(image, "mimeType");
|
|
@@ -1598,7 +1710,7 @@ function toolResultForValue2(value) {
|
|
|
1598
1710
|
const errorText = isError ? getString2(object, "text") : undefined;
|
|
1599
1711
|
if (media.length > 0) {
|
|
1600
1712
|
const { media: _media, ...rest } = object ?? {};
|
|
1601
|
-
const text = errorText ?? stringifyResult(rest);
|
|
1713
|
+
const text = options.text ?? errorText ?? stringifyResult(rest);
|
|
1602
1714
|
return new CallToolResult({
|
|
1603
1715
|
content: [
|
|
1604
1716
|
TextContent.make({ text }),
|
|
@@ -1610,8 +1722,13 @@ function toolResultForValue2(value) {
|
|
|
1610
1722
|
isError
|
|
1611
1723
|
});
|
|
1612
1724
|
}
|
|
1613
|
-
const text = errorText ?? stringifyResult(value);
|
|
1614
|
-
|
|
1725
|
+
const text = options.text ?? errorText ?? stringifyResult(value);
|
|
1726
|
+
const structuredContent = object ? encodedStructuredContent(object, options.outputSchema) : undefined;
|
|
1727
|
+
return toolResult({
|
|
1728
|
+
text,
|
|
1729
|
+
...structuredContent === undefined ? {} : { structuredContent },
|
|
1730
|
+
isError
|
|
1731
|
+
});
|
|
1615
1732
|
}
|
|
1616
1733
|
function mcpErrorMessage2(tool, message) {
|
|
1617
1734
|
if (!message.startsWith("Session not found:")) {
|
|
@@ -2723,4 +2840,4 @@ function secretText(secret) {
|
|
|
2723
2840
|
return secret.kind === "totp" ? totpCode(secret.value) : secret.value;
|
|
2724
2841
|
}
|
|
2725
2842
|
|
|
2726
|
-
export { makeUnsafe, make, settingKeys, settingSpecs, securityVariables, SettingsInputError, parseSettingChanges, settingsFromExtension, settingsToExtension, describeSettings, describeChanges, formatSettings, isStreamSchema, getStreamSchemas, ClientAbort, ServerClient, make2, exitSchema, isWrapper, make3, Implementation, ClientCapabilities, INVALID_REQUEST_ERROR_CODE, METHOD_NOT_FOUND_ERROR_CODE, INVALID_PARAMS_ERROR_CODE, INTERNAL_ERROR_CODE, HEADER_MISMATCH_ERROR_CODE, ParseError, InvalidRequest, MethodNotFound, InvalidParams, InternalError, McpError, Ping, Initialize, CancelledNotification, ProgressNotification, ResourceListChangedNotification, ResourceUpdatedNotification, Prompt, TextContent, PromptListChangedNotification, Tool, CallToolResult, ToolListChangedNotification, LoggingLevel, LoggingMessageNotification, CreateMessage, ListRootsResult, ListRoots, Elicit, McpReverseOperationUnsupported, McpReverseOperationError, McpRequestContext, McpServerClient, McpServerClientMiddleware, ServerNotificationRpcs, EnabledWhen, browsersNote2, mcpUpdateNote2, objectSchema, emptyInputSchema, sessionSchemaProperty, sessionAliasSchemaProperty, sessionOnlyInputSchema, ensureSessionExists, parseExecuteArguments, parseAdoptArguments, requiredStringField, optionalStringField, optionalBooleanField, optionalPositiveIntegerField, optionalStringArrayField, requireObject, toolResultForValue2, mcpErrorMessage2, toolResult, terminateChildProcess, SecretCollector, looksLikeTokenSegment, AuthProfileError, read, readOptional, withLock, write, status, run, OriginPatternError, parseOriginPatterns, normalizeOriginPatterns, isPrivateAddress, explicitlyAllowsHost, checkUrl, checkNavigationUrl, readSecret, addSecret, listSecrets, removeSecret, secretText };
|
|
2843
|
+
export { makeUnsafe, make, settingKeys, settingSpecs, securityVariables, SettingsInputError, parseSettingChanges, settingsFromExtension, settingsToExtension, describeSettings, describeChanges, formatSettings, isStreamSchema, getStreamSchemas, ClientAbort, ServerClient, make2, exitSchema, isWrapper, make3, Implementation, ClientCapabilities, INVALID_REQUEST_ERROR_CODE, METHOD_NOT_FOUND_ERROR_CODE, INVALID_PARAMS_ERROR_CODE, INTERNAL_ERROR_CODE, HEADER_MISMATCH_ERROR_CODE, ParseError, InvalidRequest, MethodNotFound, InvalidParams, InternalError, McpError, Ping, Initialize, CancelledNotification, ProgressNotification, ResourceListChangedNotification, ResourceUpdatedNotification, Prompt, TextContent, PromptListChangedNotification, Tool, CallToolResult, ToolListChangedNotification, LoggingLevel, LoggingMessageNotification, CreateMessage, ListRootsResult, ListRoots, Elicit, McpReverseOperationUnsupported, McpReverseOperationError, McpRequestContext, McpServerClient, McpServerClientMiddleware, ServerNotificationRpcs, EnabledWhen, browsersNote2, mcpUpdateNote2, objectSchema, emptyInputSchema, sessionSchemaProperty, sessionAliasSchemaProperty, sessionOnlyInputSchema, ExecuteToolOutput, StatusToolOutput, CurrentSessionToolOutput, SessionDeleteToolOutput, NetworkToolStatus, SettingsToolOutput, SecretsListToolOutput, toolOutputJson, executeToolResult, ensureSessionExists, parseExecuteArguments, parseAdoptArguments, requiredStringField, optionalStringField, optionalBooleanField, optionalPositiveIntegerField, optionalStringArrayField, requireObject, toolResultForValue2, mcpErrorMessage2, toolResult, terminateChildProcess, SecretCollector, looksLikeTokenSegment, AuthProfileError, read, readOptional, withLock, write, status, run, OriginPatternError, parseOriginPatterns, normalizeOriginPatterns, isPrivateAddress, explicitlyAllowsHost, checkUrl, checkNavigationUrl, readSecret, addSecret, listSecrets, removeSecret, secretText };
|