@opencode/browse 0.0.6 → 0.0.8-dev.36

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.
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  writePrivateJsonFileSync
3
- } from "./main-yv64m9we.mjs";
3
+ } from "./main-evpvxp5p.mjs";
4
4
  import {
5
5
  dataRoot,
6
6
  devExtensionUrl,
7
7
  devExtensionFolder
8
- } from "./main-3cza6vx1.mjs";
8
+ } from "./main-0jhjvcrn.mjs";
9
9
 
10
10
  // src/relay/browser-pairing.ts
11
11
  import crypto from "node:crypto";
12
12
  import fs from "node:fs";
13
13
  import path from "node:path";
14
14
  var legacyContext = "opencode-browser-pairing-v2";
15
- var context = "opencode-browser-pairing-v3";
15
+ var context2 = "opencode-browser-pairing-v3";
16
16
  var crockford = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
17
17
  var pairingCodeLength = 8;
18
18
  var codeKeyIterations = 1e5;
19
- var codeKeySalt = `${context}|code`;
19
+ var codeKeySalt = `${context2}|code`;
20
20
  var pairingCodeTtlMs = 10 * 60000;
21
21
  var bundledPairingCodeTtlMs = 60 * 60000;
22
22
  var maxPairingFailures = 5;
@@ -130,7 +130,7 @@ function pairingEndpoint(port) {
130
130
  return `127.0.0.1:${port}/extension`;
131
131
  }
132
132
  function pairingProof(token, role, port, ownNonce, peerNonce) {
133
- return crypto.createHmac("sha256", token).update(`${context}|${role}|${pairingEndpoint(port)}|${peerNonce}|${ownNonce}`).digest("base64url");
133
+ return crypto.createHmac("sha256", token).update(`${context2}|${role}|${pairingEndpoint(port)}|${peerNonce}|${ownNonce}`).digest("base64url");
134
134
  }
135
135
  function ecdhExchange(peerPublicKey) {
136
136
  const peer = Buffer.from(peerPublicKey, "base64url");
@@ -145,13 +145,13 @@ function ecdhExchange(peerPublicKey) {
145
145
  }
146
146
  }
147
147
  function pairingSessionKey(material, secret, transcript) {
148
- return crypto.createHmac("sha256", material).update(`${context}|session|${pairingEndpoint(transcript.port)}|${transcript.extensionNonce}|${transcript.relayNonce}|${transcript.extensionKey}|${transcript.relayKey}|`).update(secret).digest();
148
+ return crypto.createHmac("sha256", material).update(`${context2}|session|${pairingEndpoint(transcript.port)}|${transcript.extensionNonce}|${transcript.relayNonce}|${transcript.extensionKey}|${transcript.relayKey}|`).update(secret).digest();
149
149
  }
150
150
  function sessionProof(sessionKey, role) {
151
- return crypto.createHmac("sha256", sessionKey).update(`${context}|proof|${role}`).digest("base64url");
151
+ return crypto.createHmac("sha256", sessionKey).update(`${context2}|proof|${role}`).digest("base64url");
152
152
  }
153
153
  function wrapToken(sessionKey, token) {
154
- const mask = crypto.createHmac("sha256", sessionKey).update(`${context}|wrap`).digest();
154
+ const mask = crypto.createHmac("sha256", sessionKey).update(`${context2}|wrap`).digest();
155
155
  return Buffer.from(Buffer.from(token, "base64url").map((byte, index) => byte ^ mask[index])).toString("base64url");
156
156
  }
157
157
 
@@ -300,4 +300,4 @@ function isLocalPeer(socket) {
300
300
  return remote !== undefined && (remote === "::1" || remote.startsWith("127."));
301
301
  }
302
302
 
303
- export { parseHostname, readRelayConfig, writeRelayConfig, relayHostname, isLocalPeer, context, pairingCodeTtlMs, bundledPairingCodeTtlMs, formatPairingCode, pairingCodeKey, mintPairingCode, pendingPairingCodeKeys, consumePairingCode, recordPairingFailure, writeExtensionPairing, readBrowserPairings, browserToken, newBrowserToken, issueBrowserToken, touchBrowserPairing, revokeBrowserToken, legacyPairingCode, removeLegacyPairingCode, legacyPairingProof, pairingProof, ecdhExchange, pairingSessionKey, sessionProof, wrapToken, installedDevExtension, syncDevExtension };
303
+ export { parseHostname, readRelayConfig, writeRelayConfig, relayHostname, isLocalPeer, context2, pairingCodeTtlMs, bundledPairingCodeTtlMs, formatPairingCode, pairingCodeKey, mintPairingCode, pendingPairingCodeKeys, consumePairingCode, recordPairingFailure, writeExtensionPairing, readBrowserPairings, browserToken, newBrowserToken, issueBrowserToken, touchBrowserPairing, revokeBrowserToken, legacyPairingCode, removeLegacyPairingCode, legacyPairingProof, pairingProof, ecdhExchange, pairingSessionKey, sessionProof, wrapToken, installedDevExtension, syncDevExtension };
@@ -0,0 +1,290 @@
1
+ import { createRequire } from "node:module";
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __reExport = (target, mod, secondTarget) => {
11
+ var keys = mod && typeof mod === "object" || typeof mod === "function" ? __getOwnPropNames(mod) : [];
12
+ for (let key of keys)
13
+ if (!__hasOwnProp.call(target, key) && key !== "default")
14
+ __defProp(target, key, {
15
+ get: __accessProp.bind(mod, key),
16
+ enumerable: true
17
+ });
18
+ if (secondTarget) {
19
+ for (let key of keys)
20
+ if (!__hasOwnProp.call(secondTarget, key) && key !== "default")
21
+ __defProp(secondTarget, key, {
22
+ get: __accessProp.bind(mod, key),
23
+ enumerable: true
24
+ });
25
+ return secondTarget;
26
+ }
27
+ };
28
+ var __toESMCache_node;
29
+ var __toESMCache_esm;
30
+ var __toESM = (mod, isNodeMode, target) => {
31
+ var canCache = mod != null && typeof mod === "object";
32
+ if (canCache) {
33
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
34
+ var cached = cache.get(mod);
35
+ if (cached)
36
+ return cached;
37
+ }
38
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
39
+ const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
40
+ if (mod && typeof mod === "object" || typeof mod === "function") {
41
+ for (let key of __getOwnPropNames(mod))
42
+ if (!__hasOwnProp.call(to, key))
43
+ __defProp(to, key, {
44
+ get: __accessProp.bind(mod, key),
45
+ enumerable: true
46
+ });
47
+ }
48
+ if (canCache)
49
+ cache.set(mod, to);
50
+ return to;
51
+ };
52
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
53
+ var __returnValue = (v) => v;
54
+ function __exportSetter(name, newValue) {
55
+ this[name] = __returnValue.bind(null, newValue);
56
+ }
57
+ var __export = (target, all) => {
58
+ for (var name in all)
59
+ __defProp(target, name, {
60
+ get: all[name],
61
+ enumerable: true,
62
+ configurable: true,
63
+ set: __exportSetter.bind(all, name)
64
+ });
65
+ };
66
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
67
+
68
+ // node_modules/effect/dist/Pipeable.js
69
+ var pipeArguments = (self, args) => {
70
+ switch (args.length) {
71
+ case 0:
72
+ return self;
73
+ case 1:
74
+ return args[0](self);
75
+ case 2:
76
+ return args[1](args[0](self));
77
+ case 3:
78
+ return args[2](args[1](args[0](self)));
79
+ case 4:
80
+ return args[3](args[2](args[1](args[0](self))));
81
+ case 5:
82
+ return args[4](args[3](args[2](args[1](args[0](self)))));
83
+ case 6:
84
+ return args[5](args[4](args[3](args[2](args[1](args[0](self))))));
85
+ case 7:
86
+ return args[6](args[5](args[4](args[3](args[2](args[1](args[0](self)))))));
87
+ case 8:
88
+ return args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self))))))));
89
+ case 9:
90
+ return args[8](args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self)))))))));
91
+ default: {
92
+ let ret = self;
93
+ for (let i = 0, len = args.length;i < len; i++) {
94
+ ret = args[i](ret);
95
+ }
96
+ return ret;
97
+ }
98
+ }
99
+ };
100
+ var Prototype2 = {
101
+ pipe() {
102
+ return pipeArguments(this, arguments);
103
+ }
104
+ };
105
+ var Class3 = /* @__PURE__ */ function() {
106
+ function PipeableBase() {}
107
+ PipeableBase.prototype = Prototype2;
108
+ return PipeableBase;
109
+ }();
110
+
111
+ // node_modules/effect/dist/Function.js
112
+ var dual = function(arity, body) {
113
+ if (typeof arity === "function") {
114
+ return function() {
115
+ return arity(arguments) ? body.apply(this, arguments) : (self) => body(self, ...arguments);
116
+ };
117
+ }
118
+ switch (arity) {
119
+ case 0:
120
+ case 1:
121
+ throw new RangeError(`Invalid arity ${arity}`);
122
+ case 2:
123
+ return function(a, b) {
124
+ if (arguments.length >= 2) {
125
+ return body(a, b);
126
+ }
127
+ return function(self) {
128
+ return body(self, a);
129
+ };
130
+ };
131
+ case 3:
132
+ return function(a, b, c) {
133
+ if (arguments.length >= 3) {
134
+ return body(a, b, c);
135
+ }
136
+ return function(self) {
137
+ return body(self, a, b);
138
+ };
139
+ };
140
+ default:
141
+ return function() {
142
+ if (arguments.length >= arity) {
143
+ return body.apply(this, arguments);
144
+ }
145
+ const args = arguments;
146
+ return function(self) {
147
+ return body(self, ...args);
148
+ };
149
+ };
150
+ }
151
+ };
152
+ var identity = (a) => a;
153
+ var constant = (value) => () => value;
154
+ var constTrue = /* @__PURE__ */ constant(true);
155
+ var constFalse = /* @__PURE__ */ constant(false);
156
+ var constUndefined = /* @__PURE__ */ constant(undefined);
157
+ var constVoid = constUndefined;
158
+ function pipe(a, ...args) {
159
+ return pipeArguments(a, args);
160
+ }
161
+ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
162
+ switch (arguments.length) {
163
+ case 1:
164
+ return ab;
165
+ case 2:
166
+ return function() {
167
+ return bc(ab.apply(this, arguments));
168
+ };
169
+ case 3:
170
+ return function() {
171
+ return cd(bc(ab.apply(this, arguments)));
172
+ };
173
+ case 4:
174
+ return function() {
175
+ return de(cd(bc(ab.apply(this, arguments))));
176
+ };
177
+ case 5:
178
+ return function() {
179
+ return ef(de(cd(bc(ab.apply(this, arguments)))));
180
+ };
181
+ case 6:
182
+ return function() {
183
+ return fg(ef(de(cd(bc(ab.apply(this, arguments))))));
184
+ };
185
+ case 7:
186
+ return function() {
187
+ return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))));
188
+ };
189
+ case 8:
190
+ return function() {
191
+ return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))));
192
+ };
193
+ case 9:
194
+ return function() {
195
+ return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))));
196
+ };
197
+ }
198
+ return;
199
+ }
200
+ function memoize(f) {
201
+ const cache = new WeakMap;
202
+ return (a) => {
203
+ const cached = cache.get(a);
204
+ if (cached !== undefined)
205
+ return cached;
206
+ const result = f(a);
207
+ cache.set(a, result);
208
+ return result;
209
+ };
210
+ }
211
+ function memoizeIdempotent(f) {
212
+ const cache = new WeakMap;
213
+ return (a) => {
214
+ const cached = cache.get(a);
215
+ if (cached !== undefined)
216
+ return cached;
217
+ const result = f(a);
218
+ cache.set(a, result);
219
+ if (result !== a) {
220
+ cache.set(result, result);
221
+ }
222
+ return result;
223
+ };
224
+ }
225
+
226
+ // node_modules/effect/dist/Predicate.js
227
+ function isString(input) {
228
+ return typeof input === "string";
229
+ }
230
+ function isNumber(input) {
231
+ return typeof input === "number";
232
+ }
233
+ function isBoolean(input) {
234
+ return typeof input === "boolean";
235
+ }
236
+ function isBigInt(input) {
237
+ return typeof input === "bigint";
238
+ }
239
+ function isSymbol(input) {
240
+ return typeof input === "symbol";
241
+ }
242
+ function isPropertyKey(u) {
243
+ return isString(u) || isNumber(u) || isSymbol(u);
244
+ }
245
+ function isFunction(input) {
246
+ return typeof input === "function";
247
+ }
248
+ function isUndefined(input) {
249
+ return input === undefined;
250
+ }
251
+ function isNotUndefined(input) {
252
+ return input !== undefined;
253
+ }
254
+ function isNotNull(input) {
255
+ return input !== null;
256
+ }
257
+ function isNullish(input) {
258
+ return input === null || input === undefined;
259
+ }
260
+ function isNotNullish(input) {
261
+ return input != null;
262
+ }
263
+ function isNever(_) {
264
+ return false;
265
+ }
266
+ function isUnknown(_) {
267
+ return true;
268
+ }
269
+ function isObjectOrArray(input) {
270
+ return typeof input === "object" && input !== null;
271
+ }
272
+ function isObject(input) {
273
+ return typeof input === "object" && input !== null && !Array.isArray(input);
274
+ }
275
+ function isReadonlyObject(input) {
276
+ return isObject(input);
277
+ }
278
+ function isObjectKeyword(input) {
279
+ return typeof input === "object" && input !== null || isFunction(input);
280
+ }
281
+ var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObjectKeyword(self) && (property in self));
282
+ var isTagged = /* @__PURE__ */ dual(2, (self, tag) => hasProperty(self, "_tag") && self["_tag"] === tag);
283
+ function isError(input) {
284
+ return input instanceof Error;
285
+ }
286
+ function isIterable(input) {
287
+ return hasProperty(input, Symbol.iterator) || isString(input);
288
+ }
289
+
290
+ export { __reExport, __toESM, __commonJS, __export, __require, pipeArguments, Prototype2, Class3, dual, identity, constant, constTrue, constFalse, constUndefined, constVoid, pipe, flow, memoize, memoizeIdempotent, isString, isNumber, isBoolean, isBigInt, isSymbol, isPropertyKey, isFunction, isUndefined, isNotUndefined, isNotNull, isNullish, isNotNullish, isNever, isUnknown, isObjectOrArray, isObject, isReadonlyObject, isObjectKeyword, hasProperty, isTagged, isError, isIterable };