apps 0.0.1-beta.34 → 0.0.1-beta.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.
- package/framework-reference.json +1 -1
- package/js/{chunk-OX233L7N.js → chunk-4U2VUDET.js} +2 -2
- package/js/{chunk-HW3DPBZR.js → chunk-556EWA6P.js} +3 -2
- package/js/{chunk-UMCMZFXW.js → chunk-73AV3JVU.js} +1 -1
- package/js/{chunk-QKVZGWGZ.js → chunk-A2NN45C7.js} +7 -7
- package/js/{chunk-6ZJ2H6P4.js → chunk-A4O72Z3A.js} +298 -190
- package/js/{chunk-FBBXFFFJ.js → chunk-BI45HZWM.js} +2 -2
- package/js/{chunk-DXGWKNTQ.js → chunk-BI6R577B.js} +2 -2
- package/js/{chunk-QUEPZ67T.js → chunk-BKJDZYK7.js} +3 -3
- package/js/{chunk-QZD2RZ4S.js → chunk-CZLCA2O4.js} +8 -8
- package/js/{chunk-IU6OK5G2.js → chunk-ENJCQWVF.js} +3 -3
- package/js/{chunk-DASNNAP4.js → chunk-HDAQBRT5.js} +391 -14
- package/js/{chunk-EXGKN554.js → chunk-IJQ5LE74.js} +9805 -9254
- package/js/{chunk-5JVNM3CQ.js → chunk-IU7CCCUC.js} +12 -12
- package/js/{chunk-Q7Q5JTRW.js → chunk-JU7F4PRK.js} +2 -2
- package/js/{chunk-CJY5X26R.js → chunk-KOOJUMLR.js} +86 -50
- package/js/{chunk-ETLILMHY.js → chunk-KZFV3WCJ.js} +21 -19
- package/js/{chunk-ZOY7PDMI.js → chunk-NHCFIWN5.js} +1 -1
- package/js/chunk-NHUHTWAF.js +0 -0
- package/js/{chunk-QYM4STZW.js → chunk-PHO7HXTC.js} +149 -353
- package/js/{chunk-O3OAFU7Q.js → chunk-POOIHRPF.js} +2 -2
- package/js/{chunk-AUFVX4KM.js → chunk-RSNZDT4L.js} +2 -2
- package/js/{chunk-EPUWF4ZG.js → chunk-SRB2WDU7.js} +3 -3
- package/js/{chunk-MFHUR5SB.js → chunk-TADLIUEU.js} +4 -4
- package/js/{chunk-5OM6HBNU.js → chunk-UBAKWXAJ.js} +20 -29
- package/js/chunk-V5DWGYRK.js +268 -0
- package/js/{chunk-MYH3QZ4L.js → chunk-WAGGHNWH.js} +23 -15
- package/js/{chunk-GZ4UHXRT.js → chunk-WDBUOIWV.js} +3 -3
- package/js/{chunk-PUBNIORL.js → chunk-WMVTBHGK.js} +2 -2
- package/js/{chunk-DSUKW6KJ.js → chunk-XEXUHXC3.js} +296 -174
- package/js/{chunk-6KG4DZD7.js → chunk-Y3XN4X4Q.js} +1 -1
- package/js/{chunk-UKMIHP2G.js → chunk-YW333DH3.js} +4 -4
- package/js/{chunk-O4QOPXQT.js → chunk-ZQWDOHEO.js} +31 -24
- package/js/client.js +12 -11
- package/js/contracts.js +14 -11
- package/js/effect.js +23 -21
- package/js/graphql.js +25 -23
- package/js/host.js +23 -21
- package/js/index.js +16 -14
- package/js/mcp/effect.js +25 -23
- package/js/mcp/stdio.js +25 -23
- package/js/mcp.js +27 -25
- package/js/openapi.js +22 -21
- package/js/react.js +3 -3
- package/js/skills/effect.js +6 -5
- package/js/skills.js +60 -45
- package/js/storage/facet.js +19 -345
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +6 -5
- package/js/ui/serving.js +10 -9
- package/package.json +3 -3
- package/runtime.json +1 -1
- package/types/app-data/src/implementation/sqlite.d.ts +1 -1
- package/types/apps/src/contracts/elicitation.d.ts +6 -6
- package/types/apps/src/contracts/host.d.ts +10 -6
- package/types/apps/src/contracts/mcp.d.ts +6 -1
- package/types/apps/src/contracts/openapi.d.ts +1 -1
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +12 -5
- package/types/apps/src/contracts/protocols/2.d.ts +5 -5
- package/types/apps/src/contracts/protocols/3.d.ts +5 -6
- package/types/apps/src/contracts/protocols/4.d.ts +5 -6
- package/types/apps/src/contracts/protocols/5.d.ts +7 -7
- package/types/apps/src/contracts/protocols/6.d.ts +7 -7
- package/types/apps/src/contracts/protocols/7.d.ts +7 -7
- package/types/apps/src/contracts/protocols/8.d.ts +17 -6
- package/types/apps/src/contracts/protocols/9.d.ts +1106 -0
- package/types/apps/src/contracts/skills.d.ts +5 -0
- package/types/apps/src/contracts/ui.d.ts +1 -1
- package/types/apps/src/implementation/failure-detail.d.ts +4 -3
- package/types/apps/src/implementation/live.d.ts +2 -2
- package/types/apps/src/implementation/mcp-client.d.ts +1 -1
- package/types/apps/src/implementation/mcp.d.ts +1 -1
- package/types/apps/src/implementation/network.d.ts +1 -1
- package/types/apps/src/implementation/openapi-compile.d.ts +1 -1
- package/types/apps/src/implementation/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +2 -3
- package/types/apps/src/implementation/skills.d.ts +8 -8
- package/types/apps/src/implementation/ui-auth.d.ts +1 -1
- package/types/apps/src/implementation/ui-client.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +1 -1
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +2 -1
- package/types/telemetry/src/browser-operations.d.ts +1 -1
- package/types/telemetry/src/browser.d.ts +2 -2
- package/types/telemetry/src/layer.d.ts +2 -2
- package/types/telemetry/src/relay.d.ts +2 -2
- package/types/telemetry/src/transport.d.ts +1 -1
- package/types/utils/src/api-error.d.ts +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
JsonObject,
|
|
3
3
|
ValidationError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BI45HZWM.js";
|
|
5
5
|
import {
|
|
6
6
|
Cause_exports,
|
|
7
7
|
Effect_exports,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
SchemaIssue_exports,
|
|
11
11
|
SchemaParser_exports,
|
|
12
12
|
Schema_exports
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-IJQ5LE74.js";
|
|
14
14
|
|
|
15
15
|
// ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
|
|
16
16
|
function deepCompareStrict(a, b) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
appSignInCallbackPath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NHCFIWN5.js";
|
|
4
4
|
import {
|
|
5
5
|
HttpServerResponse_exports
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KOOJUMLR.js";
|
|
7
7
|
|
|
8
8
|
// src/implementation/ui-auth.ts
|
|
9
9
|
var appPrivateHeaders = {
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
networkRefusalHeader,
|
|
6
6
|
networkRefusalStatus,
|
|
7
7
|
supportedFetchOptions
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BI6R577B.js";
|
|
9
9
|
import {
|
|
10
10
|
invocationFetch
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-KZFV3WCJ.js";
|
|
12
12
|
import {
|
|
13
13
|
Effect_exports,
|
|
14
14
|
Schema_exports
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-IJQ5LE74.js";
|
|
16
16
|
|
|
17
17
|
// src/implementation/network.ts
|
|
18
18
|
var refusalHeader = (status, header) => status === networkRefusalStatus && header !== null && header !== void 0 ? header : void 0;
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
fromWeb,
|
|
5
5
|
layerMergedContext,
|
|
6
6
|
make2 as make
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KOOJUMLR.js";
|
|
8
8
|
import {
|
|
9
9
|
Reference,
|
|
10
10
|
Service,
|
|
@@ -13,16 +13,16 @@ import {
|
|
|
13
13
|
getOrUndefined2 as getOrUndefined,
|
|
14
14
|
map3 as map,
|
|
15
15
|
merge3 as merge,
|
|
16
|
-
|
|
16
|
+
remove2 as remove,
|
|
17
17
|
succeed4 as succeed,
|
|
18
18
|
toReadableStreamEffect,
|
|
19
19
|
tryPromise
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-IJQ5LE74.js";
|
|
21
21
|
import {
|
|
22
22
|
__export
|
|
23
23
|
} from "./chunk-CZ7CSFO4.js";
|
|
24
24
|
|
|
25
|
-
// ../../node_modules/.bun/effect@
|
|
25
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/http/FetchHttpClient.js
|
|
26
26
|
var FetchHttpClient_exports = {};
|
|
27
27
|
__export(FetchHttpClient_exports, {
|
|
28
28
|
Fetch: () => Fetch,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeCache
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JU7F4PRK.js";
|
|
4
4
|
import {
|
|
5
5
|
accountSecrets,
|
|
6
6
|
boundFailureMessage,
|
|
@@ -8,37 +8,38 @@ import {
|
|
|
8
8
|
failureDetail,
|
|
9
9
|
leavingProviderError,
|
|
10
10
|
parseMcpError,
|
|
11
|
+
parseSkillLoadFailed,
|
|
11
12
|
readCatalog,
|
|
12
13
|
routerSkills
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ZQWDOHEO.js";
|
|
14
15
|
import {
|
|
15
16
|
appInvocationFetch
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-SRB2WDU7.js";
|
|
17
18
|
import {
|
|
18
19
|
folderSkillsEffect
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-4U2VUDET.js";
|
|
20
21
|
import {
|
|
21
22
|
ResponseStatusError,
|
|
22
23
|
authorDatabase,
|
|
23
24
|
isApp,
|
|
24
25
|
toEffectApp,
|
|
25
26
|
unavailableStorage
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-CZLCA2O4.js";
|
|
27
28
|
import {
|
|
28
29
|
parseDatabaseSchema
|
|
29
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-IU7CCCUC.js";
|
|
30
31
|
import {
|
|
31
32
|
declaredOperations,
|
|
32
33
|
fromPromise,
|
|
33
34
|
locate,
|
|
34
35
|
nativeOperation,
|
|
35
36
|
toPromise
|
|
36
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-BKJDZYK7.js";
|
|
37
38
|
import {
|
|
38
39
|
accountProviderError,
|
|
39
40
|
httpProviderError,
|
|
40
41
|
parseProviderError
|
|
41
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-ENJCQWVF.js";
|
|
42
43
|
import {
|
|
43
44
|
AccountCheckResult,
|
|
44
45
|
DeclaredProvider,
|
|
@@ -85,18 +86,17 @@ import {
|
|
|
85
86
|
defaultWebhookTransportLimits,
|
|
86
87
|
maxInputProblems,
|
|
87
88
|
workflowDurationMillis
|
|
88
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-XEXUHXC3.js";
|
|
89
90
|
import {
|
|
90
91
|
CacheError
|
|
91
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-BI6R577B.js";
|
|
92
93
|
import {
|
|
93
94
|
AppSkills,
|
|
94
|
-
SkillFile
|
|
95
|
-
|
|
96
|
-
} from "./chunk-HW3DPBZR.js";
|
|
95
|
+
SkillFile
|
|
96
|
+
} from "./chunk-556EWA6P.js";
|
|
97
97
|
import {
|
|
98
98
|
captureTelemetry
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-KZFV3WCJ.js";
|
|
100
100
|
import {
|
|
101
101
|
allowedValues,
|
|
102
102
|
decoderOf,
|
|
@@ -107,16 +107,16 @@ import {
|
|
|
107
107
|
maxAlternativeKeys,
|
|
108
108
|
objectShape,
|
|
109
109
|
unionShape
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-POOIHRPF.js";
|
|
111
111
|
import {
|
|
112
112
|
JsonObject,
|
|
113
113
|
JsonValue
|
|
114
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-BI45HZWM.js";
|
|
115
115
|
import {
|
|
116
|
+
Base64_exports,
|
|
116
117
|
Cause_exports,
|
|
117
118
|
Clock_exports,
|
|
118
119
|
Effect_exports,
|
|
119
|
-
Encoding_exports,
|
|
120
120
|
Match_exports,
|
|
121
121
|
Option_exports,
|
|
122
122
|
Redacted_exports,
|
|
@@ -124,7 +124,7 @@ import {
|
|
|
124
124
|
SchemaIssue_exports,
|
|
125
125
|
Schema_exports,
|
|
126
126
|
Stream_exports
|
|
127
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-IJQ5LE74.js";
|
|
128
128
|
|
|
129
129
|
// src/implementation/elicitation.ts
|
|
130
130
|
var prepareElicitation = (input) => Effect_exports.gen(function* () {
|
|
@@ -520,7 +520,7 @@ var dispatchWebhook = (definition, command, context, accounts) => Effect_exports
|
|
|
520
520
|
yield* invoke(hook.unregister, { ...input, state });
|
|
521
521
|
return null;
|
|
522
522
|
}
|
|
523
|
-
const body = yield* Effect_exports.fromResult(
|
|
523
|
+
const body = yield* Effect_exports.fromResult(Base64_exports.decode(command.request.body)).pipe(
|
|
524
524
|
Effect_exports.mapError(() => new HostInputInvalid())
|
|
525
525
|
);
|
|
526
526
|
if (body.byteLength > defaultWebhookTransportLimits.maxBodyBytes)
|
|
@@ -569,7 +569,7 @@ var dispatchWebhook = (definition, command, context, accounts) => Effect_exports
|
|
|
569
569
|
() => Schema_exports.decodeUnknownEffect(WebhookResponseData)({
|
|
570
570
|
status: response.status,
|
|
571
571
|
headers,
|
|
572
|
-
body:
|
|
572
|
+
body: Base64_exports.encode(new Uint8Array(bytes))
|
|
573
573
|
}),
|
|
574
574
|
new HostOutputInvalid()
|
|
575
575
|
);
|
|
@@ -1287,15 +1287,6 @@ function checkAccount(slots, declared, requirement, context, signal, deadline) {
|
|
|
1287
1287
|
);
|
|
1288
1288
|
});
|
|
1289
1289
|
}
|
|
1290
|
-
var parseSkillLoadFailed = (error) => Schema_exports.decodeUnknownOption(SkillLoadFailed)(error).pipe(
|
|
1291
|
-
Option_exports.map(
|
|
1292
|
-
({ reason, message, status }) => new SkillLoadFailed({
|
|
1293
|
-
reason,
|
|
1294
|
-
...message ? { message } : {},
|
|
1295
|
-
...status === void 0 ? {} : { status }
|
|
1296
|
-
})
|
|
1297
|
-
)
|
|
1298
|
-
);
|
|
1299
1290
|
var errorStatus = Match_exports.type().pipe(
|
|
1300
1291
|
Match_exports.tagsExhaustive({
|
|
1301
1292
|
ProviderError: () => 502,
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import {
|
|
2
|
+
String,
|
|
3
|
+
Struct,
|
|
4
|
+
TaggedClass,
|
|
5
|
+
TaggedError,
|
|
6
|
+
UndefinedOr,
|
|
7
|
+
decode2 as decode,
|
|
8
|
+
decodeTo,
|
|
9
|
+
fail,
|
|
10
|
+
fail4 as fail2,
|
|
11
|
+
flatMap2 as flatMap,
|
|
12
|
+
fromTransform,
|
|
13
|
+
hasProperty,
|
|
14
|
+
isArrayNonEmpty,
|
|
15
|
+
millis,
|
|
16
|
+
optional,
|
|
17
|
+
pipeTo,
|
|
18
|
+
succeed,
|
|
19
|
+
succeed4 as succeed2,
|
|
20
|
+
suspend,
|
|
21
|
+
sync2 as sync,
|
|
22
|
+
tag,
|
|
23
|
+
transform,
|
|
24
|
+
void_2 as void_
|
|
25
|
+
} from "./chunk-IJQ5LE74.js";
|
|
26
|
+
|
|
27
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/encoding/Sse.js
|
|
28
|
+
var SseErrorTypeId = "~effect/encoding/Sse/SseError";
|
|
29
|
+
var EventTooLarge = class extends (/* @__PURE__ */ TaggedError("EventTooLarge")) {
|
|
30
|
+
get message() {
|
|
31
|
+
return `Pending SSE event exceeded the maximum size of ${this.maxEventSize}`;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var SseError = class extends (/* @__PURE__ */ TaggedError("SseError")) {
|
|
35
|
+
/**
|
|
36
|
+
* Marks this value as an SSE decoding error.
|
|
37
|
+
*
|
|
38
|
+
* @stability unstable
|
|
39
|
+
* @since 4.0.0
|
|
40
|
+
*/
|
|
41
|
+
[SseErrorTypeId] = SseErrorTypeId;
|
|
42
|
+
/**
|
|
43
|
+
* Delegates the public message to the underlying SSE error reason.
|
|
44
|
+
*
|
|
45
|
+
* @stability unstable
|
|
46
|
+
* @since 4.0.0
|
|
47
|
+
*/
|
|
48
|
+
get message() {
|
|
49
|
+
return this.reason.message;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var defaultMaxEventSize = 10 * 1024 * 1024;
|
|
53
|
+
var decode2 = (options) => fromTransform((upstream, _scope) => sync(() => {
|
|
54
|
+
let buffer = [];
|
|
55
|
+
let retry;
|
|
56
|
+
const parser = makeParser((event) => {
|
|
57
|
+
if (event._tag === "Retry") {
|
|
58
|
+
retry = event;
|
|
59
|
+
} else {
|
|
60
|
+
buffer.push(event);
|
|
61
|
+
}
|
|
62
|
+
}, options);
|
|
63
|
+
const pump = flatMap(upstream, (arr) => {
|
|
64
|
+
for (let i = 0; i < arr.length; i++) {
|
|
65
|
+
const error = parser.feed(arr[i]);
|
|
66
|
+
if (error !== void 0) {
|
|
67
|
+
return fail2(error);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return void_;
|
|
71
|
+
});
|
|
72
|
+
return suspend(function loop() {
|
|
73
|
+
if (isArrayNonEmpty(buffer)) {
|
|
74
|
+
const out = buffer;
|
|
75
|
+
buffer = [];
|
|
76
|
+
return succeed2(out);
|
|
77
|
+
} else if (retry) {
|
|
78
|
+
return fail2(retry);
|
|
79
|
+
}
|
|
80
|
+
return flatMap(pump, loop);
|
|
81
|
+
});
|
|
82
|
+
}));
|
|
83
|
+
var decodeSchema = (schema, options, parseOptions) => pipeTo(decode2(options), decode(Event.pipe(decodeTo(schema, transformEvent)), parseOptions)());
|
|
84
|
+
function makeParser(onParse, options) {
|
|
85
|
+
const maxEventSize = options?.maxEventSize ?? defaultMaxEventSize;
|
|
86
|
+
let isFirstChunk;
|
|
87
|
+
let buffer;
|
|
88
|
+
let startingPosition;
|
|
89
|
+
let startingFieldLength;
|
|
90
|
+
let discardTrailingNewline;
|
|
91
|
+
let lastEventId;
|
|
92
|
+
let eventName;
|
|
93
|
+
let data;
|
|
94
|
+
reset();
|
|
95
|
+
return {
|
|
96
|
+
feed,
|
|
97
|
+
reset
|
|
98
|
+
};
|
|
99
|
+
function reset() {
|
|
100
|
+
isFirstChunk = true;
|
|
101
|
+
buffer = "";
|
|
102
|
+
startingPosition = 0;
|
|
103
|
+
startingFieldLength = -1;
|
|
104
|
+
discardTrailingNewline = false;
|
|
105
|
+
lastEventId = void 0;
|
|
106
|
+
eventName = void 0;
|
|
107
|
+
data = "";
|
|
108
|
+
}
|
|
109
|
+
function feed(chunk) {
|
|
110
|
+
buffer = buffer ? buffer + chunk : chunk;
|
|
111
|
+
if (isFirstChunk && buffer.startsWith(BOM)) {
|
|
112
|
+
buffer = buffer.slice(BOM.length);
|
|
113
|
+
}
|
|
114
|
+
isFirstChunk = false;
|
|
115
|
+
const length = buffer.length;
|
|
116
|
+
let position = 0;
|
|
117
|
+
while (position < length) {
|
|
118
|
+
if (discardTrailingNewline) {
|
|
119
|
+
if (buffer[position] === "\n") {
|
|
120
|
+
++position;
|
|
121
|
+
}
|
|
122
|
+
discardTrailingNewline = false;
|
|
123
|
+
}
|
|
124
|
+
let lineLength = -1;
|
|
125
|
+
let fieldLength = startingFieldLength;
|
|
126
|
+
let character;
|
|
127
|
+
for (let index = position + startingPosition; lineLength < 0 && index < length; ++index) {
|
|
128
|
+
character = buffer[index];
|
|
129
|
+
if (character === ":" && fieldLength < 0) {
|
|
130
|
+
fieldLength = index - position;
|
|
131
|
+
} else if (character === "\r") {
|
|
132
|
+
discardTrailingNewline = true;
|
|
133
|
+
lineLength = index - position;
|
|
134
|
+
} else if (character === "\n") {
|
|
135
|
+
lineLength = index - position;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (lineLength < 0) {
|
|
139
|
+
startingPosition = length - position;
|
|
140
|
+
startingFieldLength = fieldLength;
|
|
141
|
+
break;
|
|
142
|
+
} else {
|
|
143
|
+
startingPosition = 0;
|
|
144
|
+
startingFieldLength = -1;
|
|
145
|
+
}
|
|
146
|
+
parseEventStreamLine(buffer, position, fieldLength, lineLength);
|
|
147
|
+
position += lineLength + 1;
|
|
148
|
+
}
|
|
149
|
+
if (position === length) {
|
|
150
|
+
buffer = "";
|
|
151
|
+
} else if (position > 0) {
|
|
152
|
+
buffer = buffer.slice(position);
|
|
153
|
+
}
|
|
154
|
+
if (buffer.length + data.length > maxEventSize) {
|
|
155
|
+
const error = new SseError({
|
|
156
|
+
reason: new EventTooLarge({
|
|
157
|
+
maxEventSize
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
reset();
|
|
161
|
+
return error;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function parseEventStreamLine(lineBuffer, index, fieldLength, lineLength) {
|
|
165
|
+
if (lineLength === 0) {
|
|
166
|
+
if (data.length > 0) {
|
|
167
|
+
onParse({
|
|
168
|
+
_tag: "Event",
|
|
169
|
+
id: lastEventId,
|
|
170
|
+
event: eventName || "message",
|
|
171
|
+
data: data.slice(0, -1)
|
|
172
|
+
// remove trailing newline
|
|
173
|
+
});
|
|
174
|
+
data = "";
|
|
175
|
+
}
|
|
176
|
+
eventName = void 0;
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const noValue = fieldLength < 0;
|
|
180
|
+
const field = lineBuffer.slice(index, index + (noValue ? lineLength : fieldLength));
|
|
181
|
+
let step = 0;
|
|
182
|
+
if (noValue) {
|
|
183
|
+
step = lineLength;
|
|
184
|
+
} else if (lineBuffer[index + fieldLength + 1] === " ") {
|
|
185
|
+
step = fieldLength + 2;
|
|
186
|
+
} else {
|
|
187
|
+
step = fieldLength + 1;
|
|
188
|
+
}
|
|
189
|
+
const position = index + step;
|
|
190
|
+
const valueLength = lineLength - step;
|
|
191
|
+
const value = lineBuffer.slice(position, position + valueLength).toString();
|
|
192
|
+
if (field === "data") {
|
|
193
|
+
data += value ? `${value}
|
|
194
|
+
` : "\n";
|
|
195
|
+
} else if (field === "event") {
|
|
196
|
+
eventName = value;
|
|
197
|
+
} else if (field === "id" && !value.includes("\0")) {
|
|
198
|
+
lastEventId = value;
|
|
199
|
+
} else if (field === "retry" && /^\d+$/.test(value)) {
|
|
200
|
+
const retry = parseInt(value, 10);
|
|
201
|
+
onParse(new Retry({
|
|
202
|
+
duration: millis(retry),
|
|
203
|
+
lastEventId
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
var BOM = "\uFEFF";
|
|
209
|
+
var EventEncoded = /* @__PURE__ */ Struct({
|
|
210
|
+
id: /* @__PURE__ */ optional(String),
|
|
211
|
+
event: String,
|
|
212
|
+
data: String
|
|
213
|
+
});
|
|
214
|
+
var Event = /* @__PURE__ */ Struct({
|
|
215
|
+
_tag: /* @__PURE__ */ tag("Event"),
|
|
216
|
+
id: /* @__PURE__ */ UndefinedOr(String),
|
|
217
|
+
event: String,
|
|
218
|
+
data: String
|
|
219
|
+
});
|
|
220
|
+
var transformEvent = /* @__PURE__ */ transform({
|
|
221
|
+
decode: (event) => event.id === void 0 ? {
|
|
222
|
+
event: event.event,
|
|
223
|
+
data: event.data
|
|
224
|
+
} : {
|
|
225
|
+
id: event.id,
|
|
226
|
+
event: event.event,
|
|
227
|
+
data: event.data
|
|
228
|
+
},
|
|
229
|
+
encode: (event) => ({
|
|
230
|
+
_tag: "Event",
|
|
231
|
+
id: event.id,
|
|
232
|
+
event: event.event ?? "message",
|
|
233
|
+
data: event.data
|
|
234
|
+
})
|
|
235
|
+
});
|
|
236
|
+
var RetryTypeId = "~effect/encoding/Sse/Retry";
|
|
237
|
+
var Retry = class _Retry extends (/* @__PURE__ */ TaggedClass("Retry")) {
|
|
238
|
+
/**
|
|
239
|
+
* Marks this value as an SSE retry directive for runtime guards.
|
|
240
|
+
*
|
|
241
|
+
* @stability unstable
|
|
242
|
+
* @since 4.0.0
|
|
243
|
+
*/
|
|
244
|
+
[RetryTypeId] = RetryTypeId;
|
|
245
|
+
/**
|
|
246
|
+
* Returns `true` when the value is an SSE retry directive.
|
|
247
|
+
*
|
|
248
|
+
* @stability unstable
|
|
249
|
+
* @since 4.0.0
|
|
250
|
+
*/
|
|
251
|
+
static is(u) {
|
|
252
|
+
return hasProperty(u, RetryTypeId);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Separates SSE retry directives from regular event values.
|
|
256
|
+
*
|
|
257
|
+
* @stability unstable
|
|
258
|
+
* @since 4.0.0
|
|
259
|
+
*/
|
|
260
|
+
static filter(u) {
|
|
261
|
+
return _Retry.is(u) ? succeed(u) : fail(u);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
export {
|
|
266
|
+
decodeSchema,
|
|
267
|
+
EventEncoded
|
|
268
|
+
};
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
answeredError,
|
|
4
4
|
mcpClient,
|
|
5
5
|
mcpJsonSchemaValidator
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-A2NN45C7.js";
|
|
7
7
|
import {
|
|
8
8
|
failOnNetworkRefusal
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SRB2WDU7.js";
|
|
10
10
|
import {
|
|
11
11
|
accountProviderError,
|
|
12
12
|
bodyUpstreamError,
|
|
13
13
|
httpProviderError,
|
|
14
14
|
providerErrorDetail
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ENJCQWVF.js";
|
|
16
16
|
import {
|
|
17
17
|
McpCredentialsUnverified,
|
|
18
18
|
McpError,
|
|
@@ -20,21 +20,21 @@ import {
|
|
|
20
20
|
McpToolsOptions,
|
|
21
21
|
defaultMcpClientLimits,
|
|
22
22
|
mcpHealthReserveMs
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-XEXUHXC3.js";
|
|
24
24
|
import {
|
|
25
25
|
NetworkRefused,
|
|
26
26
|
ProviderError
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-BI6R577B.js";
|
|
28
28
|
import {
|
|
29
29
|
captureTelemetry
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-KZFV3WCJ.js";
|
|
31
31
|
import {
|
|
32
32
|
FetchHttpClient_exports
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-TADLIUEU.js";
|
|
34
34
|
import {
|
|
35
35
|
HttpClientRequest_exports,
|
|
36
36
|
HttpClient_exports
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-KOOJUMLR.js";
|
|
38
38
|
import {
|
|
39
39
|
Clock_exports,
|
|
40
40
|
Deferred_exports,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
Ref_exports,
|
|
47
47
|
Schema_exports,
|
|
48
48
|
Stream_exports
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-IJQ5LE74.js";
|
|
50
50
|
|
|
51
51
|
// src/implementation/mcp.ts
|
|
52
52
|
import { UnauthorizedError } from "@modelcontextprotocol/sdk/client/auth.js";
|
|
@@ -138,7 +138,11 @@ var transportFetch = (connection, telemetry, rejected, answered) => (url, init)
|
|
|
138
138
|
yield* Deferred_exports.fail(rejected, refused);
|
|
139
139
|
return yield* refused;
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
const session = new Headers(init?.headers).has("mcp-session-id");
|
|
142
|
+
yield* Ref_exports.update(
|
|
143
|
+
answered,
|
|
144
|
+
(responses) => new Map(responses).set(response.status, { upstream, session })
|
|
145
|
+
);
|
|
142
146
|
return new Response(body, { status: response.status, headers: response.headers });
|
|
143
147
|
}).pipe(
|
|
144
148
|
Effect_exports.provide(FetchHttpClient_exports.layer),
|
|
@@ -157,26 +161,30 @@ var transportFetch = (connection, telemetry, rejected, answered) => (url, init)
|
|
|
157
161
|
),
|
|
158
162
|
init?.signal ? { signal: init.signal } : {}
|
|
159
163
|
);
|
|
160
|
-
var explain = (error, phase,
|
|
164
|
+
var explain = (error, phase, responses) => {
|
|
161
165
|
if (Schema_exports.is(ProviderError)(error)) return providerErrorDetail(error, { phase });
|
|
162
|
-
if (!Schema_exports.is(McpError)(error) || error.
|
|
166
|
+
if (!Schema_exports.is(McpError)(error) || error.status === void 0) return error;
|
|
167
|
+
const response = responses.get(error.status);
|
|
168
|
+
if (response === void 0 || (error.upstream !== void 0 || response.upstream === void 0) && !response.session)
|
|
163
169
|
return error;
|
|
170
|
+
const upstream = error.upstream ?? response.upstream;
|
|
164
171
|
return new McpError({
|
|
165
172
|
phase: error.phase,
|
|
166
173
|
reason: error.reason,
|
|
167
174
|
status: error.status,
|
|
168
|
-
upstream:
|
|
175
|
+
...upstream === void 0 ? {} : { upstream },
|
|
176
|
+
...response.session ? { session: true } : {}
|
|
169
177
|
});
|
|
170
178
|
};
|
|
171
179
|
var explained = (phase, answered) => (error) => Ref_exports.get(answered).pipe(
|
|
172
|
-
Effect_exports.flatMap((
|
|
180
|
+
Effect_exports.flatMap((responses) => Effect_exports.fail(explain(error, phase, responses)))
|
|
173
181
|
);
|
|
174
182
|
function withClient(connection, mode, use, changed) {
|
|
175
183
|
const attempt = (kind) => Effect_exports.scoped(
|
|
176
184
|
Effect_exports.gen(function* () {
|
|
177
185
|
const telemetry = yield* captureTelemetry;
|
|
178
186
|
const rejected = yield* Deferred_exports.make();
|
|
179
|
-
const answered = yield* Ref_exports.make(
|
|
187
|
+
const answered = yield* Ref_exports.make(/* @__PURE__ */ new Map());
|
|
180
188
|
const pending = /* @__PURE__ */ new Set();
|
|
181
189
|
const { client, transport } = yield* Effect_exports.acquireRelease(
|
|
182
190
|
Effect_exports.sync(() => {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
JsonValue
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BI45HZWM.js";
|
|
4
4
|
import {
|
|
5
5
|
HttpApiEndpoint_exports,
|
|
6
6
|
HttpApiGroup_exports,
|
|
7
7
|
HttpApiSchema_exports,
|
|
8
8
|
HttpApi_exports
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PHO7HXTC.js";
|
|
10
10
|
import {
|
|
11
11
|
Schema_exports
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-IJQ5LE74.js";
|
|
13
13
|
|
|
14
14
|
// src/contracts/ui.ts
|
|
15
15
|
var UiContext = Schema_exports.Struct({
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fixedRouter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZQWDOHEO.js";
|
|
4
4
|
import {
|
|
5
5
|
nativeOperation,
|
|
6
6
|
operationDeclaration,
|
|
7
7
|
routerDeclaration
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BKJDZYK7.js";
|
|
9
9
|
|
|
10
10
|
// src/implementation/protocol-operations.ts
|
|
11
11
|
var protocolOperations = (operations, kinds = {}) => {
|