@opencode/browse 0.0.17-dev.148 → 0.0.17-dev.150
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/Runtime-qfc1eg1n.mjs +16 -0
- package/dist/{Undici-mxpvn7gy.mjs → Undici-xgvbtsb1.mjs} +1 -1
- package/dist/{cli-mnatacxh.mjs → cli-nxa4be03.mjs} +69 -65
- package/dist/cli.mjs +30 -13
- package/dist/{helpers-p5ccdp6m.mjs → helpers-gnxbvn63.mjs} +2 -2
- package/dist/{index-6gkr235e.mjs → index-7d47yfra.mjs} +2 -1
- package/dist/{main-vfezh1ps.mjs → main-10w7c97b.mjs} +69 -67
- package/dist/main-37phhnge.mjs +4 -0
- package/dist/{main-xearn98x.mjs → main-3s4j1k2p.mjs} +71 -69
- package/dist/{main-er120rjm.mjs → main-4074weqb.mjs} +2 -2
- package/dist/{main-0dj0x4v6.mjs → main-4gtznd5c.mjs} +53 -27
- package/dist/{main-azpzpy0x.mjs → main-4h7rfhhr.mjs} +1 -1
- package/dist/main-9bk4pprj.mjs +64 -0
- package/dist/{main-9t2s5ptx.mjs → main-bc8cjey0.mjs} +32 -77
- package/dist/main-j98fzrvv.mjs +68 -0
- package/dist/{main-njy3y27f.mjs → main-ksfgzap6.mjs} +2 -2
- package/dist/{main-1mdsf5xe.mjs → main-md18jc5k.mjs} +3 -3
- package/dist/{main-r5tqkv4q.mjs → main-pw38k92k.mjs} +7 -5
- package/dist/{main-ken6azcs.mjs → main-qazf3bhk.mjs} +1 -68
- package/dist/main-v6hzbxjd.mjs +5547 -0
- package/dist/{main-nmyajqdg.mjs → main-vc68m0bh.mjs} +3 -3
- package/dist/{main-q495p3mp.mjs → main-x17fgxar.mjs} +2 -2
- package/dist/main-xycdhwqs.mjs +5196 -0
- package/dist/{main-zqsvbh95.mjs → main-z06ajk37.mjs} +2 -2
- package/dist/{main-687c47zw.mjs → main-zawbkazp.mjs} +4 -4
- package/dist/{mcp-kzwj8kxh.mjs → mcp-hq2ebg2s.mjs} +151 -148
- package/dist/{migrate-zh7f23ky.mjs → migrate-n3f5q6qj.mjs} +5 -5
- package/dist/{relay-ega4yy44.mjs → relay-wxnp7mgw.mjs} +53 -51
- package/dist/{runtime-update-6qna94mr.mjs → runtime-update-hewr1tyf.mjs} +8 -7
- package/dist/{setup-wz32kw2e.mjs → setup-q0vwkvd0.mjs} +8 -8
- package/dist/{supervisor-6e6rq4q3.mjs → supervisor-7hmg5qra.mjs} +26 -8
- package/dist/{update-1kdp2x13.mjs → update-y5bgqv5w.mjs} +3 -3
- package/dist/{version-x9pnjwap.mjs → version-x703dhvw.mjs} +1 -1
- package/package.json +1 -1
- package/dist/main-8e96v2gf.mjs +0 -4
- package/dist/main-yf5j8g79.mjs +0 -10662
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
bodyJson,
|
|
13
13
|
HttpClient,
|
|
14
14
|
layerNodeHttp
|
|
15
|
-
} from "./main-
|
|
15
|
+
} from "./main-bc8cjey0.mjs";
|
|
16
16
|
import {
|
|
17
17
|
opencodeBrowserBuildId2
|
|
18
|
-
} from "./main-
|
|
18
|
+
} from "./main-37phhnge.mjs";
|
|
19
19
|
import {
|
|
20
20
|
compiledBinary,
|
|
21
21
|
scriptEntry,
|
|
@@ -24,10 +24,54 @@ import {
|
|
|
24
24
|
compareVersions,
|
|
25
25
|
installedRuntime2,
|
|
26
26
|
installedVersion
|
|
27
|
-
} from "./main-
|
|
27
|
+
} from "./main-md18jc5k.mjs";
|
|
28
28
|
import {
|
|
29
29
|
relayAuthorization
|
|
30
|
-
} from "./main-
|
|
30
|
+
} from "./main-ksfgzap6.mjs";
|
|
31
|
+
import {
|
|
32
|
+
Pointer,
|
|
33
|
+
passthrough,
|
|
34
|
+
transformEffect,
|
|
35
|
+
Transformation,
|
|
36
|
+
unknown,
|
|
37
|
+
applyToSelfOrLastLinkEncoding,
|
|
38
|
+
decodeTo,
|
|
39
|
+
toEncoded,
|
|
40
|
+
_is,
|
|
41
|
+
decodeUnknownEffect,
|
|
42
|
+
SchemaError,
|
|
43
|
+
decodeUnknownEffect2,
|
|
44
|
+
decodeUnknownOption,
|
|
45
|
+
make8,
|
|
46
|
+
optionalKey,
|
|
47
|
+
Literal,
|
|
48
|
+
Unknown,
|
|
49
|
+
String3,
|
|
50
|
+
Number2,
|
|
51
|
+
Boolean3,
|
|
52
|
+
Struct,
|
|
53
|
+
fieldsAssign,
|
|
54
|
+
Record,
|
|
55
|
+
ArraySchema,
|
|
56
|
+
Union,
|
|
57
|
+
Literals,
|
|
58
|
+
NullOr,
|
|
59
|
+
BooleanLiterals,
|
|
60
|
+
TaggedUnion,
|
|
61
|
+
makeFilter,
|
|
62
|
+
isPattern,
|
|
63
|
+
isGreaterThan,
|
|
64
|
+
isGreaterThanOrEqualTo,
|
|
65
|
+
isBetween,
|
|
66
|
+
isInt,
|
|
67
|
+
Int2,
|
|
68
|
+
isMaxLength,
|
|
69
|
+
NonEmptyString,
|
|
70
|
+
Defect,
|
|
71
|
+
TaggedError2,
|
|
72
|
+
toCodecStringTree,
|
|
73
|
+
Json
|
|
74
|
+
} from "./main-v6hzbxjd.mjs";
|
|
31
75
|
import {
|
|
32
76
|
assignProperty,
|
|
33
77
|
PipeInspectableProto,
|
|
@@ -56,7 +100,7 @@ import {
|
|
|
56
100
|
void_3,
|
|
57
101
|
callback2,
|
|
58
102
|
fail6,
|
|
59
|
-
|
|
103
|
+
die3,
|
|
60
104
|
try_2,
|
|
61
105
|
fromResult,
|
|
62
106
|
flatMap3,
|
|
@@ -66,7 +110,7 @@ import {
|
|
|
66
110
|
map5,
|
|
67
111
|
catch_,
|
|
68
112
|
catchDefect,
|
|
69
|
-
|
|
113
|
+
mapError2,
|
|
70
114
|
orDie,
|
|
71
115
|
tapError,
|
|
72
116
|
retry,
|
|
@@ -78,50 +122,8 @@ import {
|
|
|
78
122
|
fn,
|
|
79
123
|
mapEager,
|
|
80
124
|
flatMapEager,
|
|
81
|
-
catchEager
|
|
82
|
-
|
|
83
|
-
passthrough,
|
|
84
|
-
transformEffect,
|
|
85
|
-
Transformation,
|
|
86
|
-
unknown,
|
|
87
|
-
applyToSelfOrLastLinkEncoding,
|
|
88
|
-
decodeTo,
|
|
89
|
-
toEncoded,
|
|
90
|
-
_is,
|
|
91
|
-
decodeUnknownEffect,
|
|
92
|
-
SchemaError,
|
|
93
|
-
decodeUnknownEffect2,
|
|
94
|
-
decodeUnknownOption,
|
|
95
|
-
make12,
|
|
96
|
-
optionalKey,
|
|
97
|
-
Literal,
|
|
98
|
-
Unknown,
|
|
99
|
-
String3,
|
|
100
|
-
Number2,
|
|
101
|
-
Boolean3,
|
|
102
|
-
Struct,
|
|
103
|
-
fieldsAssign,
|
|
104
|
-
Record,
|
|
105
|
-
ArraySchema,
|
|
106
|
-
Union,
|
|
107
|
-
Literals,
|
|
108
|
-
NullOr,
|
|
109
|
-
BooleanLiterals,
|
|
110
|
-
TaggedUnion,
|
|
111
|
-
makeFilter,
|
|
112
|
-
isPattern,
|
|
113
|
-
isGreaterThan,
|
|
114
|
-
isGreaterThanOrEqualTo2,
|
|
115
|
-
isBetween,
|
|
116
|
-
isInt,
|
|
117
|
-
Int2,
|
|
118
|
-
isMaxLength,
|
|
119
|
-
NonEmptyString,
|
|
120
|
-
Defect,
|
|
121
|
-
TaggedError2,
|
|
122
|
-
toCodecStringTree,
|
|
123
|
-
Json
|
|
124
|
-
} from "./main-yf5j8g79.mjs";
|
|
125
|
+
catchEager
|
|
126
|
+
} from "./main-xycdhwqs.mjs";
|
|
125
127
|
import {
|
|
126
128
|
dual,
|
|
127
129
|
memoize,
|
|
@@ -129,7 +131,7 @@ import {
|
|
|
129
131
|
isNumber,
|
|
130
132
|
isObject,
|
|
131
133
|
isTagged
|
|
132
|
-
} from "./main-
|
|
134
|
+
} from "./main-qazf3bhk.mjs";
|
|
133
135
|
|
|
134
136
|
// node_modules/effect/dist/ConfigProvider.js
|
|
135
137
|
function makeValue(value) {
|
|
@@ -386,14 +388,14 @@ var toConfigCursorAST = /* @__PURE__ */ memoize((root) => {
|
|
|
386
388
|
function schema(codec, path) {
|
|
387
389
|
const codecStringTree = toCodecStringTree(codec);
|
|
388
390
|
const encodedAst = toEncoded(codecStringTree.ast);
|
|
389
|
-
const decodeCursor = decodeUnknownEffect(
|
|
391
|
+
const decodeCursor = decodeUnknownEffect(make8(toConfigCursorAST(codecStringTree.ast)));
|
|
390
392
|
const localPath = typeof path === "string" ? [path] : path ?? [];
|
|
391
393
|
return make2((provider, pathPrefix) => {
|
|
392
394
|
const fullPath = [...pathPrefix, ...localPath];
|
|
393
395
|
return loadCursor(provider, fullPath).pipe(flatMapEager((cursor) => decodeCursor(cursor).pipe(mapEager(succeed), catchEager((issue) => {
|
|
394
396
|
const error = new ConfigError(new SchemaError(fullPath.length > 0 ? new Pointer(fullPath, issue) : issue));
|
|
395
397
|
return hasProviderInput(encodedAst, cursor.node) ? fail6(error) : succeed6(fail2(error));
|
|
396
|
-
}))), catchDefect((defect) => isSourceError(defect) ? fail6(new ConfigError(defect)) :
|
|
398
|
+
}))), catchDefect((defect) => isSourceError(defect) ? fail6(new ConfigError(defect)) : die3(defect)));
|
|
397
399
|
});
|
|
398
400
|
}
|
|
399
401
|
function String2(name) {
|
|
@@ -443,7 +445,7 @@ var SessionResetResponse = Struct({
|
|
|
443
445
|
});
|
|
444
446
|
var TargetSelection = Struct({
|
|
445
447
|
urlIncludes: optionalKey(NonEmptyString),
|
|
446
|
-
index: optionalKey(Int2.check(
|
|
448
|
+
index: optionalKey(Int2.check(isGreaterThanOrEqualTo(0)))
|
|
447
449
|
}).check(makeFilter((selection) => {
|
|
448
450
|
const hasUrl = selection.urlIncludes !== undefined;
|
|
449
451
|
const hasIndex = selection.index !== undefined;
|
|
@@ -455,7 +457,7 @@ var ExecuteRequest = Struct({
|
|
|
455
457
|
createIfMissing: Boolean3,
|
|
456
458
|
browser: optionalKey(String3),
|
|
457
459
|
removeAfterExecute: optionalKey(Boolean3),
|
|
458
|
-
timeoutMs: optionalKey(Int2.check(
|
|
460
|
+
timeoutMs: optionalKey(Int2.check(isGreaterThanOrEqualTo(0))),
|
|
459
461
|
targetSelection: optionalKey(TargetSelection)
|
|
460
462
|
});
|
|
461
463
|
var SessionAdoptRequest = Struct({
|
|
@@ -598,7 +600,7 @@ var ConnectedBrowser = Struct({
|
|
|
598
600
|
connected: Boolean3,
|
|
599
601
|
unresponsive: optionalKey(Boolean3),
|
|
600
602
|
version: NullOr(String3),
|
|
601
|
-
tabs: Int2.check(
|
|
603
|
+
tabs: Int2.check(isGreaterThanOrEqualTo(0))
|
|
602
604
|
});
|
|
603
605
|
var ExtensionStatus = Struct({
|
|
604
606
|
connected: Boolean3,
|
|
@@ -611,10 +613,10 @@ var ExtensionStatus = Struct({
|
|
|
611
613
|
protocolCompatible: optionalKey(NullOr(Boolean3)),
|
|
612
614
|
protocolLegacy: optionalKey(NullOr(Boolean3)),
|
|
613
615
|
browsers: optionalKey(ArraySchema(ConnectedBrowser)),
|
|
614
|
-
rejectedConnections: optionalKey(Int2.check(
|
|
615
|
-
pairingFailures: optionalKey(Int2.check(
|
|
616
|
+
rejectedConnections: optionalKey(Int2.check(isGreaterThanOrEqualTo(0))),
|
|
617
|
+
pairingFailures: optionalKey(Int2.check(isGreaterThanOrEqualTo(0))),
|
|
616
618
|
processFaults: optionalKey(Struct({
|
|
617
|
-
suppressed: Int2.check(
|
|
619
|
+
suppressed: Int2.check(isGreaterThanOrEqualTo(0)),
|
|
618
620
|
lastAt: optionalKey(String3),
|
|
619
621
|
lastMessage: optionalKey(String3)
|
|
620
622
|
})),
|
|
@@ -1158,7 +1160,7 @@ var defaultHost2 = "127.0.0.1";
|
|
|
1158
1160
|
var defaultPort2 = 19988;
|
|
1159
1161
|
var RawTargetSelection = Struct({
|
|
1160
1162
|
urlIncludes: optionalKey(String3),
|
|
1161
|
-
index: optionalKey(Int2.check(
|
|
1163
|
+
index: optionalKey(Int2.check(isGreaterThanOrEqualTo(0)))
|
|
1162
1164
|
});
|
|
1163
1165
|
var decodeRawTargetSelection = decodeUnknownOption(RawTargetSelection);
|
|
1164
1166
|
var RawTargetInfo = Struct({
|
|
@@ -1372,13 +1374,13 @@ class Service extends Service2()("opencode-browser-cli/RelayClient") {
|
|
|
1372
1374
|
var decodeErrorEnvelope = decodeUnknownOption(ErrorEnvelope);
|
|
1373
1375
|
var decodeErrorMessage = decodeUnknownOption(Struct({ error: String3 }));
|
|
1374
1376
|
var make3 = fn("RelayClient.make")(function* (options) {
|
|
1375
|
-
const port = yield* portConfig.pipe(
|
|
1377
|
+
const port = yield* portConfig.pipe(mapError2((cause) => new RelayConfigInvalid({
|
|
1376
1378
|
message: `Invalid OPENCODE_BROWSER_PORT configuration: ${cause.message}`,
|
|
1377
1379
|
cause
|
|
1378
1380
|
})));
|
|
1379
1381
|
const endpoint = options?.endpoint ?? endpointForPort(port);
|
|
1380
1382
|
const httpClient = yield* HttpClient;
|
|
1381
|
-
const readBody = (response, path) => response.json.pipe(
|
|
1383
|
+
const readBody = (response, path) => response.json.pipe(mapError2((cause) => new RelayDecodeFailed({
|
|
1382
1384
|
message: `Relay returned an unreadable response for ${path}`,
|
|
1383
1385
|
path,
|
|
1384
1386
|
cause
|
|
@@ -1394,7 +1396,7 @@ var make3 = fn("RelayClient.make")(function* (options) {
|
|
|
1394
1396
|
...isSome(envelope) && envelope.value.code ? { code: envelope.value.code } : {}
|
|
1395
1397
|
}));
|
|
1396
1398
|
}
|
|
1397
|
-
return decodeUnknownEffect2(schema)(body).pipe(
|
|
1399
|
+
return decodeUnknownEffect2(schema)(body).pipe(mapError2((cause) => new RelayDecodeFailed({
|
|
1398
1400
|
message: `Relay response for ${path} did not match the expected shape: ${cause.message}`,
|
|
1399
1401
|
path,
|
|
1400
1402
|
cause
|
|
@@ -1422,17 +1424,17 @@ var make3 = fn("RelayClient.make")(function* (options) {
|
|
|
1422
1424
|
})));
|
|
1423
1425
|
const getJson = (path, schema) => suspend2(() => {
|
|
1424
1426
|
const seconds = relayAnswered ? busyRelayReadSeconds : unknownRelayReadSeconds;
|
|
1425
|
-
return execute(get(new URL(path, endpoint))).pipe(
|
|
1427
|
+
return execute(get(new URL(path, endpoint))).pipe(mapError2(transportError(path)), flatMap3((response) => handleResponse(response, path, schema)), timeoutOrElse({ duration: `${seconds} seconds`, orElse: () => fail6(new RelayTimedOut({
|
|
1426
1428
|
message: `The relay on port ${new URL(endpoint).port} isn't answering (${path} timed out after ${seconds}s).`,
|
|
1427
1429
|
path
|
|
1428
1430
|
})) }));
|
|
1429
1431
|
});
|
|
1430
1432
|
const checkWhileWaiting = sleep(30000).pipe(andThen2(getJson("/version", RelayVersion)), forever);
|
|
1431
|
-
const postJson = (path, body, schema) => post(new URL(path, endpoint)).pipe(bodyJson(body),
|
|
1433
|
+
const postJson = (path, body, schema) => post(new URL(path, endpoint)).pipe(bodyJson(body), mapError2((cause) => new RelayEncodeFailed({
|
|
1432
1434
|
message: `Could not encode relay request for ${path}`,
|
|
1433
1435
|
path,
|
|
1434
1436
|
cause
|
|
1435
|
-
})), flatMap3((request) => execute(request).pipe(
|
|
1437
|
+
})), flatMap3((request) => execute(request).pipe(mapError2(transportError(path)), flatMap3((response) => handleResponse(response, path, schema)), raceFirst(checkWhileWaiting))));
|
|
1436
1438
|
const recordingTargetBody = (target) => ({
|
|
1437
1439
|
...target.sessionId ? { sessionId: target.sessionId } : {},
|
|
1438
1440
|
...target.tabId === undefined ? {} : { tabId: target.tabId }
|
|
@@ -1450,7 +1452,7 @@ var make3 = fn("RelayClient.make")(function* (options) {
|
|
|
1450
1452
|
};
|
|
1451
1453
|
return Service.of({
|
|
1452
1454
|
endpoint,
|
|
1453
|
-
version: getJson("/version", RelayVersion).pipe(
|
|
1455
|
+
version: getJson("/version", RelayVersion).pipe(mapError2((error) => error instanceof RelayDecodeFailed || error instanceof RelayRejected && !error.code && error.status === 404 ? new RelayDecodeFailed({ message: `Relay port ${new URL(endpoint).port} is in use by another program (not a browse /version response).`, path: "/version", cause: error }) : error)),
|
|
1454
1456
|
shutdown: (request) => postJson("/shutdown", { ...request }, RelayShutdownResponse),
|
|
1455
1457
|
extensionStatus: getJson("/extension/status", ExtensionStatus),
|
|
1456
1458
|
targets: getJson("/json/list", TargetSummaries),
|
|
@@ -1570,7 +1572,7 @@ var ensureRelay = fn("RelayLifecycle.ensureRelay")(function* (options) {
|
|
|
1570
1572
|
return yield* initial.failure;
|
|
1571
1573
|
}
|
|
1572
1574
|
if (relayWasAbsent) {
|
|
1573
|
-
const autoStart = yield* Boolean2("OPENCODE_BROWSER_AUTOSTART").pipe(withDefault(true),
|
|
1575
|
+
const autoStart = yield* Boolean2("OPENCODE_BROWSER_AUTOSTART").pipe(withDefault(true), mapError2((cause) => new Error("Invalid OPENCODE_BROWSER_AUTOSTART configuration", { cause })));
|
|
1574
1576
|
if (!autoStart) {
|
|
1575
1577
|
return yield* fail6(new Error(`Automatic relay startup is disabled; no relay is available at ${options.relay.endpoint}`));
|
|
1576
1578
|
}
|
|
@@ -1586,7 +1588,7 @@ function waitForRelayReady(options) {
|
|
|
1586
1588
|
times: options.retryTimes ?? 200,
|
|
1587
1589
|
schedule: spaced(options.retryDelayMs ?? 50),
|
|
1588
1590
|
while: isRelayStartingOrUnreachable
|
|
1589
|
-
}),
|
|
1591
|
+
}), mapError2((error) => isRelayStartingOrUnreachable(error) ? new RelayStartFailed({
|
|
1590
1592
|
message: `browse relay did not start at ${options.relay.endpoint}`,
|
|
1591
1593
|
endpoint: options.relay.endpoint,
|
|
1592
1594
|
cause: error
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
isSuccess,
|
|
6
6
|
ClockRef,
|
|
7
7
|
currentTimeMillis2
|
|
8
|
-
} from "./main-
|
|
8
|
+
} from "./main-xycdhwqs.mjs";
|
|
9
9
|
import {
|
|
10
10
|
pipeArguments,
|
|
11
11
|
identity,
|
|
12
12
|
isString,
|
|
13
13
|
isNumber,
|
|
14
14
|
isBoolean
|
|
15
|
-
} from "./main-
|
|
15
|
+
} from "./main-qazf3bhk.mjs";
|
|
16
16
|
|
|
17
17
|
// node_modules/effect/dist/Clock.js
|
|
18
18
|
var Clock = ClockRef;
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isNodeError,
|
|
3
3
|
writeJsonFileAtomically
|
|
4
|
-
} from "./main-
|
|
4
|
+
} from "./main-4h7rfhhr.mjs";
|
|
5
|
+
import {
|
|
6
|
+
decodeUnknownEffect2,
|
|
7
|
+
decodeUnknownSync,
|
|
8
|
+
optionalKey,
|
|
9
|
+
Literal,
|
|
10
|
+
String3,
|
|
11
|
+
Struct,
|
|
12
|
+
ArraySchema,
|
|
13
|
+
Literals,
|
|
14
|
+
makeFilter,
|
|
15
|
+
isPattern,
|
|
16
|
+
Defect,
|
|
17
|
+
TaggedError2
|
|
18
|
+
} from "./main-v6hzbxjd.mjs";
|
|
5
19
|
import {
|
|
6
20
|
withFiber,
|
|
7
21
|
getCurrentFiber,
|
|
@@ -24,33 +38,21 @@ import {
|
|
|
24
38
|
try_2,
|
|
25
39
|
option2,
|
|
26
40
|
catchIf,
|
|
27
|
-
|
|
41
|
+
mapError2,
|
|
28
42
|
acquireUseRelease,
|
|
29
43
|
fnUntraced,
|
|
30
|
-
fn
|
|
31
|
-
|
|
32
|
-
decodeUnknownSync,
|
|
33
|
-
optionalKey,
|
|
34
|
-
Literal,
|
|
35
|
-
String3,
|
|
36
|
-
Struct,
|
|
37
|
-
ArraySchema,
|
|
38
|
-
Literals,
|
|
39
|
-
makeFilter,
|
|
40
|
-
isPattern,
|
|
41
|
-
Defect,
|
|
42
|
-
TaggedError2
|
|
43
|
-
} from "./main-yf5j8g79.mjs";
|
|
44
|
+
fn
|
|
45
|
+
} from "./main-xycdhwqs.mjs";
|
|
44
46
|
import {
|
|
45
47
|
isString,
|
|
46
48
|
isNumber,
|
|
47
49
|
isBoolean,
|
|
48
50
|
isObject
|
|
49
|
-
} from "./main-
|
|
51
|
+
} from "./main-qazf3bhk.mjs";
|
|
50
52
|
import {
|
|
51
53
|
dataRoot,
|
|
52
54
|
cliCommand
|
|
53
|
-
} from "./main-
|
|
55
|
+
} from "./main-md18jc5k.mjs";
|
|
54
56
|
|
|
55
57
|
// node_modules/effect/dist/Semaphore.js
|
|
56
58
|
var makeUnsafe = (permits) => new SemaphoreImpl(permits);
|
|
@@ -209,6 +211,23 @@ var secretHeaders = new Set([
|
|
|
209
211
|
"csrf-token",
|
|
210
212
|
"x-xsrf-token"
|
|
211
213
|
]);
|
|
214
|
+
var nonSecretHeaders = new Set([
|
|
215
|
+
":authority",
|
|
216
|
+
":method",
|
|
217
|
+
":scheme",
|
|
218
|
+
":status",
|
|
219
|
+
":protocol",
|
|
220
|
+
"access-control-allow-credentials",
|
|
221
|
+
"access-control-allow-origin",
|
|
222
|
+
"access-control-allow-methods",
|
|
223
|
+
"access-control-allow-headers",
|
|
224
|
+
"access-control-expose-headers",
|
|
225
|
+
"access-control-max-age",
|
|
226
|
+
"access-control-request-method",
|
|
227
|
+
"access-control-request-headers",
|
|
228
|
+
"access-control-allow-private-network",
|
|
229
|
+
"access-control-request-private-network"
|
|
230
|
+
]);
|
|
212
231
|
|
|
213
232
|
class SecretCollector {
|
|
214
233
|
slotsByRef = new Map;
|
|
@@ -246,7 +265,7 @@ class SecretCollector {
|
|
|
246
265
|
occurrences.set(lowerName, occurrence + 1);
|
|
247
266
|
return {
|
|
248
267
|
name,
|
|
249
|
-
value: this.protectHeader(name, value, sourceName(requestScope, `${location}.header.${lowerName}`, occurrence))
|
|
268
|
+
value: this.protectHeader(name, value, sourceName(requestScope, `${location}.header.${lowerName}`, occurrence), requestScope)
|
|
250
269
|
};
|
|
251
270
|
});
|
|
252
271
|
}
|
|
@@ -355,19 +374,23 @@ class SecretCollector {
|
|
|
355
374
|
}
|
|
356
375
|
return `\${${ref}}`;
|
|
357
376
|
}
|
|
358
|
-
protectHeader(name, value, source) {
|
|
377
|
+
protectHeader(name, value, source, requestScope = "") {
|
|
359
378
|
if (!value)
|
|
360
379
|
return value;
|
|
361
380
|
const lower = name.toLowerCase();
|
|
381
|
+
if (lower === ":path")
|
|
382
|
+
return this.protectUrl(value, requestScope);
|
|
383
|
+
if (nonSecretHeaders.has(lower))
|
|
384
|
+
return value;
|
|
362
385
|
if (lower === "cookie" || lower === "set-cookie") {
|
|
363
386
|
const cookieOccurrences = new Map;
|
|
364
|
-
|
|
387
|
+
const protectLine = (line) => line.split(/;\s*/).map((part, index) => {
|
|
365
388
|
const separator = part.indexOf("=");
|
|
366
389
|
if (separator < 1)
|
|
367
390
|
return part;
|
|
368
391
|
const cookieName = part.slice(0, separator).trim();
|
|
369
392
|
const cookieValue = part.slice(separator + 1);
|
|
370
|
-
if (lower === "set-cookie" && index > 0 && /^(domain|path|expires|max-age|samesite)$/i.test(cookieName)) {
|
|
393
|
+
if (lower === "set-cookie" && index > 0 && /^(domain|path|expires|max-age|samesite|priority|partitioned|secure|httponly)$/i.test(cookieName)) {
|
|
371
394
|
return part;
|
|
372
395
|
}
|
|
373
396
|
if (!cookieValue)
|
|
@@ -376,6 +399,9 @@ class SecretCollector {
|
|
|
376
399
|
cookieOccurrences.set(cookieName, occurrence + 1);
|
|
377
400
|
return `${cookieName}=${this.reference(cookieValue, sourceName("", `${source}.${cookieName}`, occurrence))}`;
|
|
378
401
|
}).join("; ");
|
|
402
|
+
return lower === "set-cookie" ? value.split(`
|
|
403
|
+
`).map(protectLine).join(`
|
|
404
|
+
`) : protectLine(value);
|
|
379
405
|
}
|
|
380
406
|
if (lower === "location" || lower === "referer" || lower === "referrer") {
|
|
381
407
|
return this.protectUrl(value, `${source}.url`);
|
|
@@ -699,7 +725,7 @@ var read = fn("AuthProfile.read")(function* (name, options = {}) {
|
|
|
699
725
|
return yield* decodeUnknownEffect2(StoredAuthProfile)(yield* try_2({
|
|
700
726
|
try: () => JSON.parse(text),
|
|
701
727
|
catch: (cause) => new AuthProfileError({ message: `Auth profile is not valid JSON: ${name}`, operation: "read", reason: "invalid-json", cause })
|
|
702
|
-
})).pipe(
|
|
728
|
+
})).pipe(mapError2((cause) => cause instanceof AuthProfileError ? cause : new AuthProfileError({ message: `Auth profile has an invalid shape: ${name}`, operation: "read", reason: "invalid-profile", cause })));
|
|
703
729
|
});
|
|
704
730
|
var readOptional = fn("AuthProfile.readOptional")(function* (name, options = {}) {
|
|
705
731
|
return yield* read(name, options).pipe(catchIf((error) => error.reason === "not-found", () => succeed6(undefined)));
|
|
@@ -770,7 +796,7 @@ var writeProfile = fnUntraced(function* (options) {
|
|
|
770
796
|
...slot.expiresAt ? { expiresAt: slot.expiresAt } : {}
|
|
771
797
|
}))
|
|
772
798
|
};
|
|
773
|
-
yield* decodeUnknownEffect2(StoredAuthProfile)(profile).pipe(
|
|
799
|
+
yield* decodeUnknownEffect2(StoredAuthProfile)(profile).pipe(mapError2((cause) => new AuthProfileError({ message: `Auth profile has an invalid shape: ${options.name}`, operation: "write", reason: "invalid-profile", cause })));
|
|
774
800
|
if (existing && sameSlots(existing.slots, profile.slots))
|
|
775
801
|
return summary(existing);
|
|
776
802
|
yield* tryPromise({
|
|
@@ -807,7 +833,7 @@ var run = fn("AuthProfile.run")(function* (options) {
|
|
|
807
833
|
timeoutMs,
|
|
808
834
|
maxOutputBytes: maxOutputBytes + maxSecretBytes,
|
|
809
835
|
env: Object.fromEntries(profile.slots.map((slot) => [slot.ref, slot.value]))
|
|
810
|
-
}).pipe(
|
|
836
|
+
}).pipe(mapError2((cause) => new AuthProfileError({ message: `Could not run command with auth profile ${options.name}`, operation: "run", reason: "run-failed", cause })));
|
|
811
837
|
const stdout = redactOutput(result.stdout, profile.slots, maxOutputBytes);
|
|
812
838
|
const stderr = redactOutput(result.stderr, profile.slots, maxOutputBytes);
|
|
813
839
|
return {
|
|
@@ -1200,7 +1226,7 @@ var addSecret = fn("SiteSecrets.add")(function* (options) {
|
|
|
1200
1226
|
});
|
|
1201
1227
|
return summary2(secret);
|
|
1202
1228
|
});
|
|
1203
|
-
return yield* withLock(options.name, { baseDir }, write).pipe(
|
|
1229
|
+
return yield* withLock(options.name, { baseDir }, write).pipe(mapError2((error) => error instanceof SiteSecretError ? error : new SiteSecretError({ message: error.message, reason: "write-failed", cause: error })));
|
|
1204
1230
|
});
|
|
1205
1231
|
var listSecrets = fn("SiteSecrets.list")(function* (options = {}) {
|
|
1206
1232
|
const baseDir = options.baseDir ?? defaultSiteSecretsDir();
|
|
@@ -1222,7 +1248,7 @@ var removeSecret = fn("SiteSecrets.remove")(function* (name, options = {}) {
|
|
|
1222
1248
|
return yield* withLock(name, { baseDir }, tryPromise({
|
|
1223
1249
|
try: () => fs2.rm(filePath).then(() => true, (cause) => isNodeError(cause) && cause.code === "ENOENT" ? false : Promise.reject(cause)),
|
|
1224
1250
|
catch: (cause) => new SiteSecretError({ message: `Could not remove secret ${name}`, reason: "write-failed", cause })
|
|
1225
|
-
})).pipe(
|
|
1251
|
+
})).pipe(mapError2((error) => error instanceof SiteSecretError ? error : new SiteSecretError({ message: error.message, reason: "write-failed", cause: error })));
|
|
1226
1252
|
});
|
|
1227
1253
|
function base32Decode(input) {
|
|
1228
1254
|
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
hasInterruptsOnly,
|
|
3
|
+
squash,
|
|
4
|
+
isSuccess2,
|
|
5
|
+
isEffect,
|
|
6
|
+
void_3,
|
|
7
|
+
tapCause,
|
|
8
|
+
runFork,
|
|
9
|
+
logError
|
|
10
|
+
} from "./main-xycdhwqs.mjs";
|
|
11
|
+
import {
|
|
12
|
+
dual,
|
|
13
|
+
constVoid
|
|
14
|
+
} from "./main-qazf3bhk.mjs";
|
|
15
|
+
|
|
16
|
+
// node_modules/effect/dist/Runtime.js
|
|
17
|
+
var defaultTeardown2 = (exit, onExit) => {
|
|
18
|
+
if (isSuccess2(exit))
|
|
19
|
+
return onExit(0);
|
|
20
|
+
if (hasInterruptsOnly(exit.cause))
|
|
21
|
+
return onExit(130);
|
|
22
|
+
return onExit(getErrorExitCode2(squash(exit.cause)));
|
|
23
|
+
};
|
|
24
|
+
var makeRunMain2 = (f) => dual((args) => isEffect(args[0]), (effect, options) => {
|
|
25
|
+
const fiber = options?.disableErrorReporting === true ? runFork(effect) : runFork(tapCause(effect, (cause) => {
|
|
26
|
+
if (hasInterruptsOnly(cause))
|
|
27
|
+
return void_3;
|
|
28
|
+
const isReported = getErrorReported2(squash(cause));
|
|
29
|
+
return isReported ? logError(cause) : void_3;
|
|
30
|
+
}));
|
|
31
|
+
try {
|
|
32
|
+
const keepAlive = globalThis.setInterval(constVoid, 2147483647);
|
|
33
|
+
fiber.addObserver(() => {
|
|
34
|
+
clearInterval(keepAlive);
|
|
35
|
+
});
|
|
36
|
+
} catch {}
|
|
37
|
+
const teardown = options?.teardown ?? defaultTeardown2;
|
|
38
|
+
return f({
|
|
39
|
+
fiber,
|
|
40
|
+
teardown
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
var errorExitCode2 = "~effect/Runtime/errorExitCode";
|
|
44
|
+
var getErrorExitCode2 = (u) => {
|
|
45
|
+
if (typeof u === "object" && u !== null && errorExitCode2 in u) {
|
|
46
|
+
const code = u[errorExitCode2];
|
|
47
|
+
if (typeof code === "number") {
|
|
48
|
+
return code;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return 1;
|
|
52
|
+
};
|
|
53
|
+
var errorReported2 = "~effect/Runtime/errorReported";
|
|
54
|
+
var getErrorReported2 = (u) => {
|
|
55
|
+
if (typeof u === "object" && u !== null && errorReported2 in u) {
|
|
56
|
+
const isReported = u[errorReported2];
|
|
57
|
+
if (typeof isReported === "boolean") {
|
|
58
|
+
return isReported;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export { defaultTeardown2, makeRunMain2, errorExitCode2, getErrorExitCode2, errorReported2, getErrorReported2 };
|