@opencode/browse 0.0.11-dev.76 → 0.0.11-dev.77
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-qpkh40gh.mjs → cli-mx6tbg2m.mjs} +63 -52
- package/dist/cli.mjs +30 -19
- package/dist/{helpers-kp0j46jt.mjs → helpers-hgm1z9h5.mjs} +2 -2
- package/dist/{index-0dcypq31.mjs → index-yzz55kxm.mjs} +1 -1
- package/dist/{main-brv9dhy5.mjs → main-1fdejpga.mjs} +9 -9
- package/dist/{main-ajza8egc.mjs → main-6chyyr6j.mjs} +44 -39
- package/dist/{main-rt6g5418.mjs → main-8z9d979q.mjs} +15 -15
- package/dist/{setup-j76yv51b.mjs → main-b7g6460c.mjs} +3608 -4406
- package/dist/{main-gevbt7h7.mjs → main-csnx585b.mjs} +151 -151
- package/dist/{main-nqmm7pdz.mjs → main-cymarjp4.mjs} +47 -47
- package/dist/main-j2ehvkhk.mjs +465 -0
- package/dist/main-r3a6053j.mjs +157 -0
- package/dist/main-s7017yah.mjs +161 -0
- package/dist/main-sjrzyg3x.mjs +73 -0
- package/dist/main-vgzr4689.mjs +61 -0
- package/dist/{main-eej5z0y5.mjs → main-zq79yb8r.mjs} +6 -6
- package/dist/main-zya5ttbr.mjs +4 -0
- package/dist/{mcp-sy8qgkyr.mjs → mcp-h0qcxhqc.mjs} +138 -137
- package/dist/migrate-pgckfkg5.mjs +233 -0
- package/dist/{relay-ateyg5ax.mjs → relay-gafgjtav.mjs} +128 -123
- package/dist/runtime-update-p2pnfdy1.mjs +156 -0
- package/dist/setup-fhhjnx9r.mjs +956 -0
- package/dist/{skill-text-x7sccp6h.mjs → skill-text-6p6scqwe.mjs} +2 -2
- package/dist/{supervisor-0rvjpf4e.mjs → supervisor-06t66v4t.mjs} +38 -17
- package/dist/{update-rbd2025v.mjs → update-7hagfdc0.mjs} +3 -3
- package/dist/{version-4cjr3wpp.mjs → version-hhcvk9wm.mjs} +1 -1
- package/package.json +1 -1
- package/skills/browse/SKILL.md +2 -2
- package/dist/main-7wgmq04v.mjs +0 -303
- package/dist/main-exnm62gg.mjs +0 -4
- package/dist/main-hm4fcpfz.mjs +0 -131
- package/dist/main-rn7hdcq2.mjs +0 -805
- package/dist/runtime-update-70gqzynp.mjs +0 -200
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
make4,
|
|
20
20
|
Reference,
|
|
21
21
|
succeed,
|
|
22
|
-
|
|
22
|
+
fail2,
|
|
23
23
|
isFailure,
|
|
24
24
|
match2,
|
|
25
25
|
isReadonlyArrayNonEmpty,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
void_3,
|
|
48
48
|
never,
|
|
49
49
|
gen,
|
|
50
|
-
|
|
50
|
+
fail5,
|
|
51
51
|
try_,
|
|
52
52
|
flatMap3,
|
|
53
53
|
andThen,
|
|
@@ -72,10 +72,8 @@ import {
|
|
|
72
72
|
fnUntraced,
|
|
73
73
|
fn,
|
|
74
74
|
make7,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
FileSystem,
|
|
78
|
-
is,
|
|
75
|
+
value2,
|
|
76
|
+
is2,
|
|
79
77
|
decodeUnknownEffect2,
|
|
80
78
|
optionalKey,
|
|
81
79
|
optional,
|
|
@@ -93,21 +91,26 @@ import {
|
|
|
93
91
|
Defect,
|
|
94
92
|
TaggedError2,
|
|
95
93
|
toCodecStringTree,
|
|
94
|
+
take3,
|
|
95
|
+
FileSystem,
|
|
96
|
+
Path,
|
|
96
97
|
errorExitCode,
|
|
97
98
|
errorReported,
|
|
98
|
-
runMain,
|
|
99
|
-
Path,
|
|
100
99
|
QuitError,
|
|
101
100
|
isQuitError,
|
|
102
101
|
Terminal,
|
|
102
|
+
runMain,
|
|
103
103
|
layer2
|
|
104
|
-
} from "./main-
|
|
104
|
+
} from "./main-csnx585b.mjs";
|
|
105
105
|
import {
|
|
106
106
|
opencodeBrowserVersion2,
|
|
107
107
|
opencodeBrowserBuildId2
|
|
108
|
-
} from "./main-
|
|
108
|
+
} from "./main-zya5ttbr.mjs";
|
|
109
109
|
import {
|
|
110
|
+
configRoot2,
|
|
110
111
|
dataRoot,
|
|
112
|
+
stateRoot,
|
|
113
|
+
cacheRoot,
|
|
111
114
|
fromCheckout,
|
|
112
115
|
compiledBinary,
|
|
113
116
|
binaryPackage,
|
|
@@ -115,7 +118,7 @@ import {
|
|
|
115
118
|
devExtension,
|
|
116
119
|
installCommand,
|
|
117
120
|
autoUpdateStatus
|
|
118
|
-
} from "./main-
|
|
121
|
+
} from "./main-j2ehvkhk.mjs";
|
|
119
122
|
import {
|
|
120
123
|
extensionProtocolVersion,
|
|
121
124
|
extensionProtocolAdvice
|
|
@@ -141,13 +144,13 @@ import {
|
|
|
141
144
|
ensureExtensionConnected,
|
|
142
145
|
stoppedRelayStatus,
|
|
143
146
|
statusCollections
|
|
144
|
-
} from "./main-
|
|
145
|
-
import"./main-
|
|
147
|
+
} from "./main-6chyyr6j.mjs";
|
|
148
|
+
import"./main-vgzr4689.mjs";
|
|
146
149
|
import {
|
|
147
150
|
updateJson2,
|
|
148
151
|
formatUpdateNotice2,
|
|
149
152
|
updateNotice2
|
|
150
|
-
} from "./main-
|
|
153
|
+
} from "./main-1fdejpga.mjs";
|
|
151
154
|
import {
|
|
152
155
|
settingKeys,
|
|
153
156
|
formatSettings,
|
|
@@ -155,12 +158,13 @@ import {
|
|
|
155
158
|
addSecret,
|
|
156
159
|
listSecrets,
|
|
157
160
|
removeSecret
|
|
158
|
-
} from "./main-
|
|
161
|
+
} from "./main-cymarjp4.mjs";
|
|
159
162
|
import {
|
|
160
163
|
defaultJournalBaseDir,
|
|
161
164
|
readJournalEntries,
|
|
162
165
|
formatJournalEntry
|
|
163
|
-
} from "./main-
|
|
166
|
+
} from "./main-zq79yb8r.mjs";
|
|
167
|
+
import"./main-sjrzyg3x.mjs";
|
|
164
168
|
import {
|
|
165
169
|
pipeArguments,
|
|
166
170
|
dual,
|
|
@@ -322,8 +326,8 @@ var Proto = {
|
|
|
322
326
|
_A: identity
|
|
323
327
|
}
|
|
324
328
|
};
|
|
325
|
-
var isTrueLiteral = /* @__PURE__ */
|
|
326
|
-
var isFalseLiteral = /* @__PURE__ */
|
|
329
|
+
var isTrueLiteral = /* @__PURE__ */ is2(TrueLiterals);
|
|
330
|
+
var isFalseLiteral = /* @__PURE__ */ is2(FalseLiterals);
|
|
327
331
|
var isBoolean = (p) => p._tag === "Boolean";
|
|
328
332
|
var makePrimitive = (tag, parse) => Object.assign(Object.create(Proto), {
|
|
329
333
|
_tag: tag,
|
|
@@ -344,7 +348,7 @@ var Choice = (choices) => {
|
|
|
344
348
|
if (choiceMap.has(value)) {
|
|
345
349
|
return succeed6(choiceMap.get(value));
|
|
346
350
|
}
|
|
347
|
-
return
|
|
351
|
+
return fail5(validChoices);
|
|
348
352
|
});
|
|
349
353
|
return Object.assign(primitive, {
|
|
350
354
|
choiceKeys: choices.map(([key]) => key)
|
|
@@ -581,10 +585,10 @@ var Number3 = (options) => {
|
|
|
581
585
|
precision: 2,
|
|
582
586
|
validate: (n) => {
|
|
583
587
|
if (n < opts.min) {
|
|
584
|
-
return
|
|
588
|
+
return fail5(`${n} must be greater than or equal to ${opts.min}`);
|
|
585
589
|
}
|
|
586
590
|
if (n > opts.max) {
|
|
587
|
-
return
|
|
591
|
+
return fail5(`${n} must be less than or equal to ${opts.max}`);
|
|
588
592
|
}
|
|
589
593
|
return succeed6(n);
|
|
590
594
|
},
|
|
@@ -611,10 +615,10 @@ var Int4 = (options) => {
|
|
|
611
615
|
decrementBy: 1,
|
|
612
616
|
validate: (n) => {
|
|
613
617
|
if (n < opts.min) {
|
|
614
|
-
return
|
|
618
|
+
return fail5(`${n} must be greater than or equal to ${opts.min}`);
|
|
615
619
|
}
|
|
616
620
|
if (n > opts.max) {
|
|
617
|
-
return
|
|
621
|
+
return fail5(`${n} must be less than or equal to ${opts.max}`);
|
|
618
622
|
}
|
|
619
623
|
return succeed6(n);
|
|
620
624
|
},
|
|
@@ -3394,7 +3398,7 @@ var makeCommand = (options) => {
|
|
|
3394
3398
|
const annotations = options.annotations ?? empty();
|
|
3395
3399
|
const globalFlags = options.globalFlags ?? [];
|
|
3396
3400
|
const subcommands = options.subcommands ?? [];
|
|
3397
|
-
const handle = (input, commandPath) => isNotUndefined(options.handle) ? options.handle(input, commandPath) :
|
|
3401
|
+
const handle = (input, commandPath) => isNotUndefined(options.handle) ? options.handle(input, commandPath) : fail5(new ShowHelp({
|
|
3398
3402
|
commandPath,
|
|
3399
3403
|
errors: []
|
|
3400
3404
|
}));
|
|
@@ -4648,7 +4652,7 @@ var promptSingle = (single) => {
|
|
|
4648
4652
|
case "Redacted":
|
|
4649
4653
|
return map5(run(Password({
|
|
4650
4654
|
message
|
|
4651
|
-
})), (
|
|
4655
|
+
})), (value) => commandLineArg(value2(value), "<redacted>"));
|
|
4652
4656
|
default:
|
|
4653
4657
|
return map5(run(String5({
|
|
4654
4658
|
message
|
|
@@ -4977,7 +4981,7 @@ var runWith = (command, config) => {
|
|
|
4977
4981
|
onSome: (level) => make4(MinimumLogLevel, level)
|
|
4978
4982
|
});
|
|
4979
4983
|
yield* provideContext(program, services);
|
|
4980
|
-
}, catchFilter((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed(error) :
|
|
4984
|
+
}, catchFilter((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed(error) : fail2(error), (error) => andThen(showHelp(command, error, config.renderErrors !== false), fail5(error))), catchFilter((error) => config.renderErrors !== false && isCliError(error) && error._tag === "UserError" ? succeed(error) : fail2(error), (error) => andThen(showUserError(error), fail5(error))), catchFilter((e) => isQuitError(e) ? succeed(e) : fail2(e), (_) => interrupt2));
|
|
4981
4985
|
};
|
|
4982
4986
|
// src/cli.ts
|
|
4983
4987
|
import path5 from "node:path";
|
|
@@ -5039,7 +5043,7 @@ var StoreFile = Struct({
|
|
|
5039
5043
|
class Service3 extends Service2()("opencode-browser-cli/SessionStore") {
|
|
5040
5044
|
}
|
|
5041
5045
|
var defaultFilePath = () => {
|
|
5042
|
-
return `${
|
|
5046
|
+
return `${stateRoot()}/session.json`;
|
|
5043
5047
|
};
|
|
5044
5048
|
var make2 = fn("SessionStore.make")(function* (options) {
|
|
5045
5049
|
const fs = yield* FileSystem;
|
|
@@ -5057,7 +5061,7 @@ var make2 = fn("SessionStore.make")(function* (options) {
|
|
|
5057
5061
|
operation,
|
|
5058
5062
|
cause
|
|
5059
5063
|
});
|
|
5060
|
-
const readStore = fs.readFileString(filePath).pipe(map5(some), catchTag("PlatformError", (error) => isTagged(error.reason, "NotFound") ? succeed6(none()) :
|
|
5064
|
+
const readStore = fs.readFileString(filePath).pipe(map5(some), catchTag("PlatformError", (error) => isTagged(error.reason, "NotFound") ? succeed6(none()) : fail5(error)), mapError(storeError("read")), flatMap3(match({
|
|
5061
5065
|
onNone: () => succeed6({}),
|
|
5062
5066
|
onSome: (text) => try_({
|
|
5063
5067
|
try: () => JSON.parse(text),
|
|
@@ -5182,6 +5186,12 @@ var createDoctorReport = fn("Doctor.createReport")(function* (options) {
|
|
|
5182
5186
|
const report = {
|
|
5183
5187
|
status: summarizeCheckStatus(checks),
|
|
5184
5188
|
endpoint: relay.endpoint,
|
|
5189
|
+
paths: {
|
|
5190
|
+
config: configRoot2(),
|
|
5191
|
+
data: dataRoot(),
|
|
5192
|
+
state: stateRoot(),
|
|
5193
|
+
cache: cacheRoot()
|
|
5194
|
+
},
|
|
5185
5195
|
cli: { version: opencodeBrowserVersion2, buildId: opencodeBrowserBuildId2 },
|
|
5186
5196
|
package: {
|
|
5187
5197
|
path: path.join(options.packageRoot, "package.json"),
|
|
@@ -5461,6 +5471,7 @@ function formatDoctorReport(report) {
|
|
|
5461
5471
|
"browse doctor",
|
|
5462
5472
|
`Status: ${report.status}`,
|
|
5463
5473
|
`Endpoint: ${report.endpoint}`,
|
|
5474
|
+
`Paths: config=${report.paths.config} data=${report.paths.data} state=${report.paths.state} cache=${report.paths.cache}`,
|
|
5464
5475
|
`CLI: ${report.cli.version} (${report.cli.buildId})`,
|
|
5465
5476
|
`Package: ${report.package.name && report.package.version ? `${report.package.name} ${report.package.version}` : report.package.error ?? "unknown"}`,
|
|
5466
5477
|
`Relay: ${report.relay.reachable ? `reachable (${report.relay.version ?? "unknown"}, ${report.relay.buildId ?? "unknown build"})` : `unreachable (${report.relay.error ?? "unknown error"})`}`,
|
|
@@ -5614,7 +5625,7 @@ var ensureCliRelay = fnUntraced(function* () {
|
|
|
5614
5625
|
yield* error(`Started browse relay at ${relay.endpoint}`);
|
|
5615
5626
|
}
|
|
5616
5627
|
if (readiness.buildProblem) {
|
|
5617
|
-
return yield*
|
|
5628
|
+
return yield* fail5(new Error(readiness.buildProblem));
|
|
5618
5629
|
}
|
|
5619
5630
|
return readiness;
|
|
5620
5631
|
});
|
|
@@ -5632,7 +5643,7 @@ var resolveSelectedSessionId = fnUntraced(function* (explicitSessionId) {
|
|
|
5632
5643
|
const store = yield* Service3;
|
|
5633
5644
|
const sessionId = explicitSessionId ?? (yield* store.read);
|
|
5634
5645
|
if (!sessionId) {
|
|
5635
|
-
return yield*
|
|
5646
|
+
return yield* fail5(new Error("No session provided and no current browse session exists"));
|
|
5636
5647
|
}
|
|
5637
5648
|
return sessionId;
|
|
5638
5649
|
});
|
|
@@ -5652,7 +5663,7 @@ var recordingTarget = fnUntraced(function* (options) {
|
|
|
5652
5663
|
const sessionId = getOrUndefined(options.session);
|
|
5653
5664
|
const tabId = getOrUndefined(options.tabId);
|
|
5654
5665
|
if (sessionId && tabId !== undefined) {
|
|
5655
|
-
return yield*
|
|
5666
|
+
return yield* fail5(new Error("Use only one recording target selector: --session or --tab-id"));
|
|
5656
5667
|
}
|
|
5657
5668
|
return {
|
|
5658
5669
|
...sessionId ? { sessionId } : {},
|
|
@@ -5666,7 +5677,7 @@ var parseRecordingModeOption = fnUntraced(function* (value) {
|
|
|
5666
5677
|
if (value === "auto" || value === "tab-capture" || value === "cdp") {
|
|
5667
5678
|
return value;
|
|
5668
5679
|
}
|
|
5669
|
-
return yield*
|
|
5680
|
+
return yield* fail5(new Error("Recording mode must be auto, tab-capture, or cdp"));
|
|
5670
5681
|
});
|
|
5671
5682
|
var networkSession = fnUntraced(function* (session) {
|
|
5672
5683
|
return yield* resolveSelectedSessionId(getOrUndefined(session) ?? getOrUndefined(yield* sessionIdConfig));
|
|
@@ -5718,7 +5729,7 @@ var settingsSet = make("set", {
|
|
|
5718
5729
|
for (const assignment of assignments) {
|
|
5719
5730
|
const index = assignment.indexOf("=");
|
|
5720
5731
|
if (index <= 0)
|
|
5721
|
-
return yield*
|
|
5732
|
+
return yield* fail5(new Error(`Expected key=value, got "${assignment}". Settings: ${settingKeys.join(", ")}.`));
|
|
5722
5733
|
changes[assignment.slice(0, index)] = assignment.slice(index + 1);
|
|
5723
5734
|
}
|
|
5724
5735
|
const relay = yield* Service;
|
|
@@ -5856,7 +5867,7 @@ var status = make("status", {
|
|
|
5856
5867
|
}
|
|
5857
5868
|
})).pipe(withDescription4("Show relay, extension, and target status"));
|
|
5858
5869
|
var mcp = make("mcp", {}, fn("Cli.mcp")(function* () {
|
|
5859
|
-
const { runMcpServer } = yield* promise(() => import("./mcp-
|
|
5870
|
+
const { runMcpServer } = yield* promise(() => import("./mcp-h0qcxhqc.mjs"));
|
|
5860
5871
|
yield* runMcpServer;
|
|
5861
5872
|
})).pipe(withDescription4("Run the browse MCP server over stdio"));
|
|
5862
5873
|
registerCliCommand(400, () => tabs);
|
|
@@ -5877,7 +5888,7 @@ registerCliCommand(810, ({ packageRoot }) => make("doctor", {
|
|
|
5877
5888
|
}
|
|
5878
5889
|
})).pipe(withDescription4("Diagnose the local browse install and runtime")));
|
|
5879
5890
|
registerCliCommand(820, () => make("skill", {}, fn("Cli.skill")(function* () {
|
|
5880
|
-
const { skillText } = yield* promise(() => import("./skill-text-
|
|
5891
|
+
const { skillText } = yield* promise(() => import("./skill-text-6p6scqwe.mjs"));
|
|
5881
5892
|
yield* log(skillText.trimEnd());
|
|
5882
5893
|
})).pipe(withDescription4("Print the browse agent skill text")));
|
|
5883
5894
|
registerCliCommand(900, () => mcp);
|
|
@@ -5962,19 +5973,19 @@ var execute = make("execute", {
|
|
|
5962
5973
|
const relay = yield* Service;
|
|
5963
5974
|
const filePath = getOrUndefined(file);
|
|
5964
5975
|
if (code.length > 0 && filePath) {
|
|
5965
|
-
return yield*
|
|
5976
|
+
return yield* fail5(new Error("Use either positional code or --file, not both"));
|
|
5966
5977
|
}
|
|
5967
5978
|
if (code.length === 0 && !filePath) {
|
|
5968
|
-
return yield*
|
|
5979
|
+
return yield* fail5(new Error("Execute requires positional code or --file <path>"));
|
|
5969
5980
|
}
|
|
5970
5981
|
const timeoutMsValue = getOrUndefined(timeoutMs);
|
|
5971
5982
|
if (timeoutMsValue !== undefined && timeoutMsValue < 0) {
|
|
5972
|
-
return yield*
|
|
5983
|
+
return yield* fail5(new Error("Timeout must be a non-negative integer"));
|
|
5973
5984
|
}
|
|
5974
5985
|
const executeCode = filePath ? yield* readExecuteFile(filePath) : code.join(" ");
|
|
5975
5986
|
const explicitSessionId = getOrUndefined(session) ?? getOrUndefined(yield* sessionIdConfig);
|
|
5976
5987
|
if (rm && explicitSessionId) {
|
|
5977
|
-
return yield*
|
|
5988
|
+
return yield* fail5(new Error("Use --rm without --session or OPENCODE_BROWSER_SESSION"));
|
|
5978
5989
|
}
|
|
5979
5990
|
const agentWorkSessionId = agentDefaultSessionId(getOrUndefined(yield* agentSessionIdConfig));
|
|
5980
5991
|
const workSessionId = explicitSessionId ?? (rm ? undefined : agentWorkSessionId);
|
|
@@ -5982,10 +5993,10 @@ var execute = make("execute", {
|
|
|
5982
5993
|
const targetUrlValue = getOrUndefined(targetUrl) ?? getOrUndefined(yield* targetUrlConfig);
|
|
5983
5994
|
const targetIndexValue = getOrUndefined(targetIndex) ?? getOrUndefined(yield* targetIndexConfig);
|
|
5984
5995
|
if (targetIndexValue !== undefined && targetIndexValue < 0) {
|
|
5985
|
-
return yield*
|
|
5996
|
+
return yield* fail5(new Error("Target index must be a non-negative integer"));
|
|
5986
5997
|
}
|
|
5987
5998
|
if (targetUrlValue && targetIndexValue !== undefined) {
|
|
5988
|
-
return yield*
|
|
5999
|
+
return yield* fail5(new Error("Use only one target selector: --target-url/OPENCODE_BROWSER_TARGET_URL or --target-index/OPENCODE_BROWSER_TARGET_INDEX"));
|
|
5989
6000
|
}
|
|
5990
6001
|
const result2 = yield* relay.execute({
|
|
5991
6002
|
...workSessionId ? { sessionId: workSessionId } : {},
|
|
@@ -6047,7 +6058,7 @@ var parseNetworkContent = fnUntraced(function* (content) {
|
|
|
6047
6058
|
const value = getOrUndefined(content);
|
|
6048
6059
|
if (value === undefined || value === "embed" || value === "omit")
|
|
6049
6060
|
return value;
|
|
6050
|
-
return yield*
|
|
6061
|
+
return yield* fail5(new Error("Network content must be embed or omit"));
|
|
6051
6062
|
});
|
|
6052
6063
|
function formatNetworkStatus(status) {
|
|
6053
6064
|
if (!status.active)
|
|
@@ -6116,7 +6127,7 @@ var networkStop = make("stop", {
|
|
|
6116
6127
|
const outputValue = getOrUndefined(output);
|
|
6117
6128
|
const secretsValue = getOrUndefined(secrets);
|
|
6118
6129
|
if (!outputValue && !secretsValue) {
|
|
6119
|
-
return yield*
|
|
6130
|
+
return yield* fail5(new Error("network stop requires --output, --secrets, or both"));
|
|
6120
6131
|
}
|
|
6121
6132
|
const sessionId = yield* networkSession(session);
|
|
6122
6133
|
yield* ensureCliRelay();
|
|
@@ -6161,7 +6172,7 @@ var recordingStart = make("start", {
|
|
|
6161
6172
|
json
|
|
6162
6173
|
}) {
|
|
6163
6174
|
if (isSome(frameRate) && (frameRate.value < 1 || frameRate.value > 60)) {
|
|
6164
|
-
return yield*
|
|
6175
|
+
return yield* fail5(new Error("Recording frameRate must be an integer from 1 to 60"));
|
|
6165
6176
|
}
|
|
6166
6177
|
const relay = yield* Service;
|
|
6167
6178
|
yield* ensureCliRelayAndExtension();
|
|
@@ -6178,7 +6189,7 @@ var recordingStart = make("start", {
|
|
|
6178
6189
|
...cursor ? { cursor } : {}
|
|
6179
6190
|
});
|
|
6180
6191
|
if (!result.success) {
|
|
6181
|
-
return yield*
|
|
6192
|
+
return yield* fail5(new Error(result.error ?? "Failed to start recording"));
|
|
6182
6193
|
}
|
|
6183
6194
|
yield* printOr(json, result, `Recording started: ${result.path ?? resolvedOutputPath} tab=${result.tabId ?? "unknown"} mode=${result.mode ?? "tab-capture"} artifact=${result.artifactType ?? "webm"} mime=${result.mimeType ?? "video/webm"} fps=${result.frameRate ?? "unknown"}`);
|
|
6184
6195
|
})).pipe(withDescription4("Start recording an attached tab"));
|
|
@@ -6192,7 +6203,7 @@ var recordingStop = make("stop", {
|
|
|
6192
6203
|
const target = yield* recordingTarget({ session, tabId });
|
|
6193
6204
|
const result = yield* relay.recordingStop(target);
|
|
6194
6205
|
if (!result.success) {
|
|
6195
|
-
return yield*
|
|
6206
|
+
return yield* fail5(new Error(result.error ?? "Failed to stop recording"));
|
|
6196
6207
|
}
|
|
6197
6208
|
if (json)
|
|
6198
6209
|
return yield* emitJson(result);
|
|
@@ -6230,7 +6241,7 @@ var recordingCancel = make("cancel", {
|
|
|
6230
6241
|
const target = yield* recordingTarget({ session, tabId });
|
|
6231
6242
|
const result = yield* relay.recordingCancel(target);
|
|
6232
6243
|
if (!result.success) {
|
|
6233
|
-
return yield*
|
|
6244
|
+
return yield* fail5(new Error(result.error ?? "Failed to cancel recording"));
|
|
6234
6245
|
}
|
|
6235
6246
|
yield* log("Recording cancelled");
|
|
6236
6247
|
})).pipe(withDescription4("Cancel recording without writing a file"));
|
|
@@ -6304,7 +6315,7 @@ registerCliCommand(710, () => flightRecorder);
|
|
|
6304
6315
|
|
|
6305
6316
|
// src/cli/relay.ts
|
|
6306
6317
|
var serve = make("serve", {}, fn("Cli.serve")(function* () {
|
|
6307
|
-
const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-
|
|
6318
|
+
const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-gafgjtav.mjs"), import("./helpers-hgm1z9h5.mjs")]));
|
|
6308
6319
|
const port = yield* portConfig;
|
|
6309
6320
|
const additionalExtensionOrigins = parseAdditionalExtensionOrigins(yield* extensionOriginsConfig);
|
|
6310
6321
|
yield* scoped(gen(function* () {
|
|
@@ -6371,7 +6382,7 @@ var secretsRun = make("run", {
|
|
|
6371
6382
|
yield* ensureCliRelay();
|
|
6372
6383
|
const [executable, ...args] = decodeCliOperands(command);
|
|
6373
6384
|
if (!executable)
|
|
6374
|
-
return yield*
|
|
6385
|
+
return yield* fail5(new Error("secrets run requires a command after --"));
|
|
6375
6386
|
const result = yield* relay.authRun({
|
|
6376
6387
|
name,
|
|
6377
6388
|
command: executable,
|
|
@@ -6558,11 +6569,11 @@ var sessionAdopt = make("adopt", {
|
|
|
6558
6569
|
const targetUrlValue = getOrUndefined(targetUrl);
|
|
6559
6570
|
const targetIndexValue = getOrUndefined(targetIndex);
|
|
6560
6571
|
if (targetIndexValue !== undefined && targetIndexValue < 0) {
|
|
6561
|
-
return yield*
|
|
6572
|
+
return yield* fail5(new Error("Target index must be a non-negative integer"));
|
|
6562
6573
|
}
|
|
6563
6574
|
const tabIdValue = getOrUndefined(tabId);
|
|
6564
6575
|
if ([targetUrlValue, targetIndexValue, tabIdValue].filter((value) => value !== undefined).length > 1) {
|
|
6565
|
-
return yield*
|
|
6576
|
+
return yield* fail5(new Error("Use only one target selector: --target-url, --target-index, or --tab-id"));
|
|
6566
6577
|
}
|
|
6567
6578
|
const targetSelection = targetUrlValue ? { urlIncludes: targetUrlValue } : targetIndexValue !== undefined ? { index: targetIndexValue } : undefined;
|
|
6568
6579
|
const result = yield* relay.sessionAdopt({
|
|
@@ -6602,7 +6613,7 @@ var sessionAllow = make("allow", {
|
|
|
6602
6613
|
const relay = yield* Service;
|
|
6603
6614
|
yield* ensureCliRelay();
|
|
6604
6615
|
if (!clear && origins.length === 0) {
|
|
6605
|
-
return yield*
|
|
6616
|
+
return yield* fail5(new Error("session allow needs origins, or --clear to remove the allowlist"));
|
|
6606
6617
|
}
|
|
6607
6618
|
const id = yield* resolvePositionalOrFlagSessionId(none(), session);
|
|
6608
6619
|
const result = yield* relay.sessionAllowlist(id, clear ? [] : origins);
|
package/dist/cli.mjs
CHANGED
|
@@ -1,30 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/main.ts
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import os from "node:os";
|
|
4
6
|
import path from "node:path";
|
|
5
|
-
var embeddedVersion = "0.0.11-dev.
|
|
6
|
-
var setupCommands = new Set(["install", "uninstall", "extension", "pair", "
|
|
7
|
+
var embeddedVersion = "0.0.11-dev.77";
|
|
8
|
+
var setupCommands = new Set(["install", "uninstall", "extension", "pair", "set"]);
|
|
7
9
|
var command = process.argv[2];
|
|
8
10
|
var invokedAs = path.basename(process.argv[1] ?? "");
|
|
11
|
+
var legacyDataRoot = process.platform === "win32" ? path.join(process.env.LOCALAPPDATA ?? path.join(os.homedir(), "AppData", "Local"), "opencode-browser") : path.join(process.env.XDG_DATA_HOME ?? path.join(os.homedir(), ".local", "share"), "opencode-browser");
|
|
12
|
+
if (command !== "--version" && command !== "-v" && !process.env.OPENCODE_BROWSER_HOME && [path.join(os.homedir(), ".browse"), legacyDataRoot].some((root) => fs.existsSync(root))) {
|
|
13
|
+
try {
|
|
14
|
+
const { migrateLegacy } = await import("./migrate-pgckfkg5.mjs");
|
|
15
|
+
migrateLegacy();
|
|
16
|
+
} catch {}
|
|
17
|
+
}
|
|
9
18
|
if (command === "--version" || command === "-v") {
|
|
10
|
-
const opencodeBrowserVersion = embeddedVersion ?? (await import("./version-
|
|
19
|
+
const opencodeBrowserVersion = embeddedVersion ?? (await import("./version-hhcvk9wm.mjs")).opencodeBrowserVersion;
|
|
11
20
|
process.stdout.write(`${opencodeBrowserVersion}
|
|
12
21
|
`);
|
|
13
|
-
} else if (command === "mcp" &&
|
|
14
|
-
const { runBinaryMcp } = await import("./supervisor-
|
|
22
|
+
} else if (command === "mcp" && process.env.OPENCODE_BROWSER_MCP_DIRECT !== "1" && (await import("./supervisor-06t66v4t.mjs")).supervisesMcp()) {
|
|
23
|
+
const { runBinaryMcp } = await import("./supervisor-06t66v4t.mjs");
|
|
15
24
|
await runBinaryMcp(process.argv.slice(3));
|
|
16
25
|
} else if (invokedAs === "opencode-browser-mcp" || command === "mcp" && process.argv.length === 3) {
|
|
17
|
-
const { NodeRuntime } = await import("./index-
|
|
18
|
-
const { runMcpServer } = await import("./mcp-
|
|
26
|
+
const { NodeRuntime } = await import("./index-yzz55kxm.mjs");
|
|
27
|
+
const { runMcpServer } = await import("./mcp-h0qcxhqc.mjs");
|
|
19
28
|
runMcpServer.pipe(NodeRuntime.runMain);
|
|
20
|
-
} else if (command === "
|
|
21
|
-
const {
|
|
22
|
-
await (command === "
|
|
29
|
+
} else if (command === "self-update" || command === "runtime-switch") {
|
|
30
|
+
const { runSelfUpdate, runRuntimeSwitch } = await import("./runtime-update-p2pnfdy1.mjs");
|
|
31
|
+
await (command === "self-update" ? runSelfUpdate : runRuntimeSwitch)(process.argv.slice(3));
|
|
23
32
|
} else if (command === "update") {
|
|
24
|
-
const { runUpdateCommand } = await import("./update-
|
|
33
|
+
const { runUpdateCommand } = await import("./update-7hagfdc0.mjs");
|
|
25
34
|
await runUpdateCommand(process.argv.slice(3));
|
|
26
35
|
} else if (command && setupCommands.has(command)) {
|
|
27
|
-
const { runSetup } = await import("./setup-
|
|
36
|
+
const { runSetup } = await import("./setup-fhhjnx9r.mjs");
|
|
28
37
|
await runSetup(command, process.argv.slice(3));
|
|
29
38
|
} else {
|
|
30
39
|
if (!command || command === "--help" || command === "-h") {
|
|
@@ -48,20 +57,22 @@ if (command === "--version" || command === "-v") {
|
|
|
48
57
|
\`--revoke legacy\` retires the shared code of earlier versions
|
|
49
58
|
set hostname <address> Where the relay listens: 127.0.0.1 (this computer, the default) or 0.0.0.0
|
|
50
59
|
(browsers on other computers can connect too, after pairing)
|
|
51
|
-
update [--check] Update now
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
rollback [--force] npm installs: go back to the version before the last update (and skip
|
|
55
|
-
the one rolled back from until a newer one is published)
|
|
60
|
+
update [--check] Update now: rerun whatever installed browse (the install script for a binary
|
|
61
|
+
install, npm install -g for an npm one); --check only says whether there's an
|
|
62
|
+
update. A git clone pulls the newer commits and runs setup again.
|
|
56
63
|
uninstall [--yes] Remove everything install set up (--yes skips confirming that stored
|
|
57
64
|
secret profiles are deleted)
|
|
58
65
|
|
|
66
|
+
browse keeps its files in $XDG_CONFIG_HOME/browse, $XDG_DATA_HOME/browse, $XDG_STATE_HOME/browse and
|
|
67
|
+
$XDG_CACHE_HOME/browse (defaults under ~/.config, ~/.local/share, ~/.local/state and ~/.cache), and the
|
|
68
|
+
executable in ~/.local/bin (or $XDG_BIN_HOME).
|
|
69
|
+
|
|
59
70
|
`);
|
|
60
71
|
}
|
|
61
72
|
if (command === "status" && !process.argv.includes("--json")) {
|
|
62
|
-
const { printSetupStatus } = await import("./setup-
|
|
73
|
+
const { printSetupStatus } = await import("./setup-fhhjnx9r.mjs");
|
|
63
74
|
printSetupStatus();
|
|
64
75
|
}
|
|
65
|
-
const { runCli } = await import("./cli-
|
|
76
|
+
const { runCli } = await import("./cli-mx6tbg2m.mjs");
|
|
66
77
|
runCli();
|
|
67
78
|
}
|
|
@@ -31,8 +31,8 @@ import {
|
|
|
31
31
|
isRestrictedTarget2,
|
|
32
32
|
isRestrictedUrl2,
|
|
33
33
|
dataUrlDocument2
|
|
34
|
-
} from "./main-
|
|
35
|
-
import"./main-
|
|
34
|
+
} from "./main-6chyyr6j.mjs";
|
|
35
|
+
import"./main-vgzr4689.mjs";
|
|
36
36
|
import"./main-mrew6jy8.mjs";
|
|
37
37
|
export {
|
|
38
38
|
HttpRouteError2 as HttpRouteError,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
cacheRoot,
|
|
3
3
|
compiledBinary,
|
|
4
4
|
checkoutRoot,
|
|
5
5
|
cliCommand,
|
|
6
6
|
compareVersions,
|
|
7
|
-
|
|
7
|
+
installedRuntime2,
|
|
8
8
|
autoUpdateStatus
|
|
9
|
-
} from "./main-
|
|
9
|
+
} from "./main-j2ehvkhk.mjs";
|
|
10
10
|
import {
|
|
11
11
|
unpackedReloadAdvice
|
|
12
12
|
} from "./main-mrew6jy8.mjs";
|
|
@@ -127,19 +127,19 @@ async function updateNotice2(options = {}) {
|
|
|
127
127
|
const repo = options.repo ?? checkoutRoot();
|
|
128
128
|
if (!repo || !updateCheckEnabled() || !existsSync(path.join(repo, ".git")))
|
|
129
129
|
return;
|
|
130
|
-
const check = await cachedUpdateCheck({ repo, dataDir: options.dataDir ??
|
|
130
|
+
const check = await cachedUpdateCheck({ repo, dataDir: options.dataDir ?? cacheRoot(), ...options.git ? { git: options.git } : {} });
|
|
131
131
|
return check?.available ? { summary: describeUpdate(check), command: cliCommand("update"), check } : undefined;
|
|
132
132
|
} catch {
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
function npmUpdateNotice() {
|
|
137
|
-
const runtime =
|
|
137
|
+
const runtime = installedRuntime2();
|
|
138
138
|
if (!runtime)
|
|
139
139
|
return false;
|
|
140
140
|
const status = autoUpdateStatus({ runtime });
|
|
141
141
|
const latest = status.latest;
|
|
142
|
-
if (!latest || compareVersions(latest, runtime.version) <= 0 || status.effective === "off"
|
|
142
|
+
if (!latest || compareVersions(latest, runtime.version) <= 0 || status.effective === "off")
|
|
143
143
|
return;
|
|
144
144
|
if (status.effective === "on" && !status.lastError)
|
|
145
145
|
return;
|
|
@@ -315,8 +315,8 @@ function runUpdate(args, deps) {
|
|
|
315
315
|
async function runUpdateCommand2(args) {
|
|
316
316
|
const log = (line) => process.stdout.write(line + `
|
|
317
317
|
`);
|
|
318
|
-
const {
|
|
319
|
-
if (await
|
|
318
|
+
const { runInstalledUpdate } = await import("./runtime-update-p2pnfdy1.mjs");
|
|
319
|
+
if (await runInstalledUpdate(args))
|
|
320
320
|
return;
|
|
321
321
|
if (compiledBinary()) {
|
|
322
322
|
log(`This browse isn't installed. Run \`${cliCommand("install")}\` to set it up; it updates itself from then on.`);
|
|
@@ -329,7 +329,7 @@ async function runUpdateCommand2(args) {
|
|
|
329
329
|
return log("Installed from npm: run `npx @opencode/browse@latest install` to update.");
|
|
330
330
|
const check = await checkForUpdate(repo);
|
|
331
331
|
if (check)
|
|
332
|
-
writeCache(path.join(
|
|
332
|
+
writeCache(path.join(cacheRoot(), CACHE_FILE), check);
|
|
333
333
|
if (!check)
|
|
334
334
|
return log("Can't check: this clone isn't on a branch that tracks a remote.");
|
|
335
335
|
if (check.failed)
|