apps 0.0.1-beta.32 → 0.0.1-beta.34
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-W7F23NQ2.js → chunk-5OM6HBNU.js} +11 -9
- package/js/{chunk-N72RKJ5E.js → chunk-DSUKW6KJ.js} +1 -92
- package/js/{chunk-5DLG2FVN.js → chunk-DXGWKNTQ.js} +91 -0
- package/js/chunk-EPUWF4ZG.js +49 -0
- package/js/{chunk-4OKYLVU4.js → chunk-IU6OK5G2.js} +1 -1
- package/js/{chunk-GG566OOE.js → chunk-MYH3QZ4L.js} +6 -6
- package/js/{chunk-NPGRURDG.js → chunk-O3OAFU7Q.js} +20 -3
- package/js/{chunk-RULZPNGP.js → chunk-O4QOPXQT.js} +8 -47
- package/js/{chunk-WG5DFZFT.js → chunk-PUBNIORL.js} +2 -2
- package/js/{chunk-AYM2FUI5.js → chunk-Q7Q5JTRW.js} +1 -1
- package/js/{chunk-3FJYVAE4.js → chunk-QKVZGWGZ.js} +5 -5
- package/js/{chunk-5XJR4XGW.js → chunk-QUEPZ67T.js} +6 -5
- package/js/{chunk-FULRJSWU.js → chunk-QZD2RZ4S.js} +6 -5
- package/js/{chunk-BGALSHLT.js → chunk-UKMIHP2G.js} +9 -6
- package/js/client.js +1 -1
- package/js/contracts.js +9 -9
- package/js/effect.js +10 -9
- package/js/graphql.js +14 -14
- package/js/host.js +10 -9
- package/js/index.js +8 -8
- package/js/mcp/effect.js +12 -11
- package/js/mcp/stdio.js +12 -11
- package/js/mcp.js +15 -14
- package/js/openapi.js +11 -9
- package/js/skills.js +110 -42
- package/package.json +1 -1
- package/runtime.json +1 -1
- package/types/apps/src/contracts/cache.d.ts +14 -0
- package/types/apps/src/contracts/skills.d.ts +16 -4
- package/types/apps/src/implementation/catalog-cache.d.ts +14 -17
- package/types/apps/src/implementation/schema.d.ts +5 -0
- package/types/apps/src/implementation/skills.d.ts +13 -19
- package/types/apps/src/skills.d.ts +4 -3
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeCache
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Q7Q5JTRW.js";
|
|
4
4
|
import {
|
|
5
5
|
accountSecrets,
|
|
6
|
-
appInvocationFetch,
|
|
7
6
|
boundFailureMessage,
|
|
8
7
|
describeFailure,
|
|
9
8
|
failureDetail,
|
|
@@ -11,7 +10,10 @@ import {
|
|
|
11
10
|
parseMcpError,
|
|
12
11
|
readCatalog,
|
|
13
12
|
routerSkills
|
|
14
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-O4QOPXQT.js";
|
|
14
|
+
import {
|
|
15
|
+
appInvocationFetch
|
|
16
|
+
} from "./chunk-EPUWF4ZG.js";
|
|
15
17
|
import {
|
|
16
18
|
folderSkillsEffect
|
|
17
19
|
} from "./chunk-OX233L7N.js";
|
|
@@ -21,7 +23,7 @@ import {
|
|
|
21
23
|
isApp,
|
|
22
24
|
toEffectApp,
|
|
23
25
|
unavailableStorage
|
|
24
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-QZD2RZ4S.js";
|
|
25
27
|
import {
|
|
26
28
|
parseDatabaseSchema
|
|
27
29
|
} from "./chunk-5JVNM3CQ.js";
|
|
@@ -31,12 +33,12 @@ import {
|
|
|
31
33
|
locate,
|
|
32
34
|
nativeOperation,
|
|
33
35
|
toPromise
|
|
34
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-QUEPZ67T.js";
|
|
35
37
|
import {
|
|
36
38
|
accountProviderError,
|
|
37
39
|
httpProviderError,
|
|
38
40
|
parseProviderError
|
|
39
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-IU6OK5G2.js";
|
|
40
42
|
import {
|
|
41
43
|
AccountCheckResult,
|
|
42
44
|
DeclaredProvider,
|
|
@@ -83,10 +85,10 @@ import {
|
|
|
83
85
|
defaultWebhookTransportLimits,
|
|
84
86
|
maxInputProblems,
|
|
85
87
|
workflowDurationMillis
|
|
86
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-DSUKW6KJ.js";
|
|
87
89
|
import {
|
|
88
90
|
CacheError
|
|
89
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-DXGWKNTQ.js";
|
|
90
92
|
import {
|
|
91
93
|
AppSkills,
|
|
92
94
|
SkillFile,
|
|
@@ -105,7 +107,7 @@ import {
|
|
|
105
107
|
maxAlternativeKeys,
|
|
106
108
|
objectShape,
|
|
107
109
|
unionShape
|
|
108
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-O3OAFU7Q.js";
|
|
109
111
|
import {
|
|
110
112
|
JsonObject,
|
|
111
113
|
JsonValue
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
FailureSource,
|
|
14
14
|
ProviderError,
|
|
15
15
|
UpstreamError
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-DXGWKNTQ.js";
|
|
17
17
|
import {
|
|
18
18
|
AppSkillName,
|
|
19
19
|
AppSkills,
|
|
@@ -226,88 +226,6 @@ var defaultOpenapiErrorLimits = OpenapiErrorLimits.make({
|
|
|
226
226
|
readTimeoutMs: 2e3
|
|
227
227
|
});
|
|
228
228
|
|
|
229
|
-
// src/contracts/network.ts
|
|
230
|
-
var NetworkRefusal = Schema_exports.Union([
|
|
231
|
-
Schema_exports.Struct({ reason: Schema_exports.Literal("private_address") }),
|
|
232
|
-
Schema_exports.Struct({
|
|
233
|
-
reason: Schema_exports.Literal("credential_host"),
|
|
234
|
-
/** The provider of the credential handle the request carried. */
|
|
235
|
-
provider: Schema_exports.String,
|
|
236
|
-
/** The hosts that provider's credentials may reach; empty when it declares none. */
|
|
237
|
-
allowedHosts: Schema_exports.Array(Schema_exports.String)
|
|
238
|
-
}),
|
|
239
|
-
Schema_exports.Struct({ reason: Schema_exports.Literal("credential_app") }),
|
|
240
|
-
Schema_exports.Struct({
|
|
241
|
-
reason: Schema_exports.Literal("credential_expired"),
|
|
242
|
-
/** The provider of the expired credential handle. */
|
|
243
|
-
provider: Schema_exports.String
|
|
244
|
-
})
|
|
245
|
-
]);
|
|
246
|
-
var NetworkRefused = class extends Schema_exports.TaggedError()("NetworkRefused", {
|
|
247
|
-
/** The refused destination, with its port when the URL names one. */
|
|
248
|
-
host: Schema_exports.String,
|
|
249
|
-
refusal: NetworkRefusal
|
|
250
|
-
}) {
|
|
251
|
-
get message() {
|
|
252
|
-
const refusal = this.refusal;
|
|
253
|
-
switch (refusal.reason) {
|
|
254
|
-
case "private_address":
|
|
255
|
-
return `Executor refused a request to ${this.host}: apps on this instance can reach only public addresses, and ${this.host} is a private, loopback or internal address. The request was not sent.`;
|
|
256
|
-
case "credential_host":
|
|
257
|
-
return refusal.allowedHosts.length === 0 ? `Executor refused this request: ${refusal.provider} credentials cannot be sent to ${this.host}: the provider declares no hosts.` : `Executor refused this request: ${refusal.provider} credentials cannot be sent to ${this.host}. The provider allows: ${refusal.allowedHosts.join(", ")}.`;
|
|
258
|
-
case "credential_app":
|
|
259
|
-
return "Executor refused this request: it carries a credential handle that is not valid for this app. Use the account fields this invocation received.";
|
|
260
|
-
case "credential_expired":
|
|
261
|
-
return `Executor refused this request: it carries an expired ${refusal.provider} credential handle. Use the account fields this invocation received.`;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
var networkRefusalStatus = 421;
|
|
266
|
-
var networkRefusalHeader = "x-executor-refused";
|
|
267
|
-
var NetworkRefusedHeader = Schema_exports.StringFromUriComponent.pipe(
|
|
268
|
-
Schema_exports.decodeTo(Schema_exports.fromJsonString(NetworkRefused))
|
|
269
|
-
);
|
|
270
|
-
var encodeRefusal = Schema_exports.encodeSync(NetworkRefused);
|
|
271
|
-
var encodeRefusalHeader = Schema_exports.encodeSync(NetworkRefusedHeader);
|
|
272
|
-
var networkRefusalResponse = (refused) => new Response(JSON.stringify({ ...encodeRefusal(refused), message: refused.message }), {
|
|
273
|
-
status: networkRefusalStatus,
|
|
274
|
-
statusText: "Refused by Executor",
|
|
275
|
-
headers: {
|
|
276
|
-
"content-type": "application/json; charset=utf-8",
|
|
277
|
-
[networkRefusalHeader]: encodeRefusalHeader(refused)
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
var RestrictedFetchOption = Schema_exports.Literals(["redirect", "cache", "integrity"]);
|
|
281
|
-
var supportedFetchOptions = {
|
|
282
|
-
redirect: ["follow", "manual"],
|
|
283
|
-
cache: ["no-store", "no-cache"],
|
|
284
|
-
integrity: [""]
|
|
285
|
-
};
|
|
286
|
-
var FetchOptionUnsupported = class extends Schema_exports.TaggedError()(
|
|
287
|
-
"FetchOptionUnsupported",
|
|
288
|
-
{
|
|
289
|
-
option: RestrictedFetchOption,
|
|
290
|
-
value: Schema_exports.String,
|
|
291
|
-
supported: Schema_exports.Array(Schema_exports.String)
|
|
292
|
-
}
|
|
293
|
-
) {
|
|
294
|
-
get message() {
|
|
295
|
-
const supported = this.supported.map((value) => JSON.stringify(value)).join(" or ");
|
|
296
|
-
return `fetch option ${this.option}: ${JSON.stringify(this.value)} is not supported by Executor's app runtime. Use ${supported}, or omit ${this.option}.${this.advice}`;
|
|
297
|
-
}
|
|
298
|
-
/** What to do instead, when the standard value has an equivalent the runtime supports. */
|
|
299
|
-
get advice() {
|
|
300
|
-
switch (this.option) {
|
|
301
|
-
case "redirect":
|
|
302
|
-
return this.value === "error" ? ` To reject redirects, send redirect: "manual" and treat a 3xx response as the error.` : "";
|
|
303
|
-
case "cache":
|
|
304
|
-
return "";
|
|
305
|
-
case "integrity":
|
|
306
|
-
return " To check a digest, read the body and hash it with crypto.subtle.digest.";
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
|
|
311
229
|
// src/contracts/workflows.ts
|
|
312
230
|
var WorkflowRunId = Schema_exports.NonEmptyString.pipe(Schema_exports.brand("wfr"));
|
|
313
231
|
var WorkflowName = Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(200));
|
|
@@ -3017,15 +2935,6 @@ var ToolResultObservation = Context_exports.Reference(
|
|
|
3017
2935
|
);
|
|
3018
2936
|
|
|
3019
2937
|
export {
|
|
3020
|
-
NetworkRefusal,
|
|
3021
|
-
NetworkRefused,
|
|
3022
|
-
networkRefusalStatus,
|
|
3023
|
-
networkRefusalHeader,
|
|
3024
|
-
NetworkRefusedHeader,
|
|
3025
|
-
networkRefusalResponse,
|
|
3026
|
-
RestrictedFetchOption,
|
|
3027
|
-
supportedFetchOptions,
|
|
3028
|
-
FetchOptionUnsupported,
|
|
3029
2938
|
SecretsMethod,
|
|
3030
2939
|
OAuthClientAuth,
|
|
3031
2940
|
OAuthSecretClientAuth,
|
|
@@ -51,6 +51,88 @@ var ProviderError = class extends Schema_exports.TaggedError()("ProviderError",
|
|
|
51
51
|
}) {
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
+
// src/contracts/network.ts
|
|
55
|
+
var NetworkRefusal = Schema_exports.Union([
|
|
56
|
+
Schema_exports.Struct({ reason: Schema_exports.Literal("private_address") }),
|
|
57
|
+
Schema_exports.Struct({
|
|
58
|
+
reason: Schema_exports.Literal("credential_host"),
|
|
59
|
+
/** The provider of the credential handle the request carried. */
|
|
60
|
+
provider: Schema_exports.String,
|
|
61
|
+
/** The hosts that provider's credentials may reach; empty when it declares none. */
|
|
62
|
+
allowedHosts: Schema_exports.Array(Schema_exports.String)
|
|
63
|
+
}),
|
|
64
|
+
Schema_exports.Struct({ reason: Schema_exports.Literal("credential_app") }),
|
|
65
|
+
Schema_exports.Struct({
|
|
66
|
+
reason: Schema_exports.Literal("credential_expired"),
|
|
67
|
+
/** The provider of the expired credential handle. */
|
|
68
|
+
provider: Schema_exports.String
|
|
69
|
+
})
|
|
70
|
+
]);
|
|
71
|
+
var NetworkRefused = class extends Schema_exports.TaggedError()("NetworkRefused", {
|
|
72
|
+
/** The refused destination, with its port when the URL names one. */
|
|
73
|
+
host: Schema_exports.String,
|
|
74
|
+
refusal: NetworkRefusal
|
|
75
|
+
}) {
|
|
76
|
+
get message() {
|
|
77
|
+
const refusal = this.refusal;
|
|
78
|
+
switch (refusal.reason) {
|
|
79
|
+
case "private_address":
|
|
80
|
+
return `Executor refused a request to ${this.host}: apps on this instance can reach only public addresses, and ${this.host} is a private, loopback or internal address. The request was not sent.`;
|
|
81
|
+
case "credential_host":
|
|
82
|
+
return refusal.allowedHosts.length === 0 ? `Executor refused this request: ${refusal.provider} credentials cannot be sent to ${this.host}: the provider declares no hosts.` : `Executor refused this request: ${refusal.provider} credentials cannot be sent to ${this.host}. The provider allows: ${refusal.allowedHosts.join(", ")}.`;
|
|
83
|
+
case "credential_app":
|
|
84
|
+
return "Executor refused this request: it carries a credential handle that is not valid for this app. Use the account fields this invocation received.";
|
|
85
|
+
case "credential_expired":
|
|
86
|
+
return `Executor refused this request: it carries an expired ${refusal.provider} credential handle. Use the account fields this invocation received.`;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
var networkRefusalStatus = 421;
|
|
91
|
+
var networkRefusalHeader = "x-executor-refused";
|
|
92
|
+
var NetworkRefusedHeader = Schema_exports.StringFromUriComponent.pipe(
|
|
93
|
+
Schema_exports.decodeTo(Schema_exports.fromJsonString(NetworkRefused))
|
|
94
|
+
);
|
|
95
|
+
var encodeRefusal = Schema_exports.encodeSync(NetworkRefused);
|
|
96
|
+
var encodeRefusalHeader = Schema_exports.encodeSync(NetworkRefusedHeader);
|
|
97
|
+
var networkRefusalResponse = (refused) => new Response(JSON.stringify({ ...encodeRefusal(refused), message: refused.message }), {
|
|
98
|
+
status: networkRefusalStatus,
|
|
99
|
+
statusText: "Refused by Executor",
|
|
100
|
+
headers: {
|
|
101
|
+
"content-type": "application/json; charset=utf-8",
|
|
102
|
+
[networkRefusalHeader]: encodeRefusalHeader(refused)
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
var RestrictedFetchOption = Schema_exports.Literals(["redirect", "cache", "integrity"]);
|
|
106
|
+
var supportedFetchOptions = {
|
|
107
|
+
redirect: ["follow", "manual"],
|
|
108
|
+
cache: ["no-store", "no-cache"],
|
|
109
|
+
integrity: [""]
|
|
110
|
+
};
|
|
111
|
+
var FetchOptionUnsupported = class extends Schema_exports.TaggedError()(
|
|
112
|
+
"FetchOptionUnsupported",
|
|
113
|
+
{
|
|
114
|
+
option: RestrictedFetchOption,
|
|
115
|
+
value: Schema_exports.String,
|
|
116
|
+
supported: Schema_exports.Array(Schema_exports.String)
|
|
117
|
+
}
|
|
118
|
+
) {
|
|
119
|
+
get message() {
|
|
120
|
+
const supported = this.supported.map((value) => JSON.stringify(value)).join(" or ");
|
|
121
|
+
return `fetch option ${this.option}: ${JSON.stringify(this.value)} is not supported by Executor's app runtime. Use ${supported}, or omit ${this.option}.${this.advice}`;
|
|
122
|
+
}
|
|
123
|
+
/** What to do instead, when the standard value has an equivalent the runtime supports. */
|
|
124
|
+
get advice() {
|
|
125
|
+
switch (this.option) {
|
|
126
|
+
case "redirect":
|
|
127
|
+
return this.value === "error" ? ` To reject redirects, send redirect: "manual" and treat a 3xx response as the error.` : "";
|
|
128
|
+
case "cache":
|
|
129
|
+
return "";
|
|
130
|
+
case "integrity":
|
|
131
|
+
return " To check a digest, read the body and hash it with crypto.subtle.digest.";
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
54
136
|
// ../app-cache/src/contracts/cache.ts
|
|
55
137
|
var CacheError = class extends Schema_exports.TaggedError()("CacheError", {
|
|
56
138
|
reason: Schema_exports.Literals(["unavailable", "storage", "invalid", "capacity", "timeout"])
|
|
@@ -140,6 +222,15 @@ export {
|
|
|
140
222
|
UpstreamError,
|
|
141
223
|
FailurePhase,
|
|
142
224
|
ProviderError,
|
|
225
|
+
NetworkRefusal,
|
|
226
|
+
NetworkRefused,
|
|
227
|
+
networkRefusalStatus,
|
|
228
|
+
networkRefusalHeader,
|
|
229
|
+
NetworkRefusedHeader,
|
|
230
|
+
networkRefusalResponse,
|
|
231
|
+
RestrictedFetchOption,
|
|
232
|
+
supportedFetchOptions,
|
|
233
|
+
FetchOptionUnsupported,
|
|
143
234
|
CacheError,
|
|
144
235
|
cacheLimits,
|
|
145
236
|
CacheEntry,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FetchOptionUnsupported,
|
|
3
|
+
NetworkRefusedHeader,
|
|
4
|
+
RestrictedFetchOption,
|
|
5
|
+
networkRefusalHeader,
|
|
6
|
+
networkRefusalStatus,
|
|
7
|
+
supportedFetchOptions
|
|
8
|
+
} from "./chunk-DXGWKNTQ.js";
|
|
9
|
+
import {
|
|
10
|
+
invocationFetch
|
|
11
|
+
} from "./chunk-ETLILMHY.js";
|
|
12
|
+
import {
|
|
13
|
+
Effect_exports,
|
|
14
|
+
Schema_exports
|
|
15
|
+
} from "./chunk-EXGKN554.js";
|
|
16
|
+
|
|
17
|
+
// src/implementation/network.ts
|
|
18
|
+
var refusalHeader = (status, header) => status === networkRefusalStatus && header !== null && header !== void 0 ? header : void 0;
|
|
19
|
+
var failOnNetworkRefusal = (response) => {
|
|
20
|
+
const header = refusalHeader(response.status, response.headers[networkRefusalHeader]);
|
|
21
|
+
return header === void 0 ? Effect_exports.void : Schema_exports.decodeUnknownEffect(NetworkRefusedHeader)(header).pipe(
|
|
22
|
+
Effect_exports.orDie,
|
|
23
|
+
Effect_exports.flatMap(Effect_exports.fail)
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
var unsupportedOption = (init) => {
|
|
27
|
+
for (const option of RestrictedFetchOption.literals) {
|
|
28
|
+
const value = init?.[option];
|
|
29
|
+
const supported = supportedFetchOptions[option];
|
|
30
|
+
if (value !== void 0 && !supported.includes(value))
|
|
31
|
+
return new FetchOptionUnsupported({ option, value: String(value), supported });
|
|
32
|
+
}
|
|
33
|
+
return void 0;
|
|
34
|
+
};
|
|
35
|
+
var appFetch = (fetch) => async (input, init) => {
|
|
36
|
+
const unsupported = unsupportedOption(init);
|
|
37
|
+
if (unsupported !== void 0) throw unsupported;
|
|
38
|
+
const response = await fetch(input, init);
|
|
39
|
+
const header = refusalHeader(response.status, response.headers.get(networkRefusalHeader));
|
|
40
|
+
if (header === void 0) return response;
|
|
41
|
+
await response.body?.cancel();
|
|
42
|
+
throw Schema_exports.decodeUnknownSync(NetworkRefusedHeader)(header);
|
|
43
|
+
};
|
|
44
|
+
var appInvocationFetch = (signal) => invocationFetch(signal).pipe(Effect_exports.map(appFetch));
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
failOnNetworkRefusal,
|
|
48
|
+
appInvocationFetch
|
|
49
|
+
};
|
|
@@ -3,28 +3,28 @@ import {
|
|
|
3
3
|
answeredError,
|
|
4
4
|
mcpClient,
|
|
5
5
|
mcpJsonSchemaValidator
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QKVZGWGZ.js";
|
|
7
7
|
import {
|
|
8
8
|
failOnNetworkRefusal
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EPUWF4ZG.js";
|
|
10
10
|
import {
|
|
11
11
|
accountProviderError,
|
|
12
12
|
bodyUpstreamError,
|
|
13
13
|
httpProviderError,
|
|
14
14
|
providerErrorDetail
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-IU6OK5G2.js";
|
|
16
16
|
import {
|
|
17
17
|
McpCredentialsUnverified,
|
|
18
18
|
McpError,
|
|
19
19
|
McpHealthInput,
|
|
20
20
|
McpToolsOptions,
|
|
21
|
-
NetworkRefused,
|
|
22
21
|
defaultMcpClientLimits,
|
|
23
22
|
mcpHealthReserveMs
|
|
24
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-DSUKW6KJ.js";
|
|
25
24
|
import {
|
|
25
|
+
NetworkRefused,
|
|
26
26
|
ProviderError
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-DXGWKNTQ.js";
|
|
28
28
|
import {
|
|
29
29
|
captureTelemetry
|
|
30
30
|
} from "./chunk-ETLILMHY.js";
|
|
@@ -1073,6 +1073,13 @@ var StorageField = /* @__PURE__ */ Symbol("apps.StorageField");
|
|
|
1073
1073
|
var Decoder = /* @__PURE__ */ Symbol("apps.Schema");
|
|
1074
1074
|
var decoderOf = (schema) => schema[Decoder];
|
|
1075
1075
|
var isSchema = (value) => typeof value === "object" && value !== null && Decoder in value;
|
|
1076
|
+
var schemaArgument = (value, role) => {
|
|
1077
|
+
if (isSchema(value)) return value;
|
|
1078
|
+
const received = value;
|
|
1079
|
+
throw new TypeError(
|
|
1080
|
+
`${role} must be a schema, such as string() or object({ ... }), but ${typeof received === "function" ? "it is a function. Call it, as in string()." : received === void 0 ? "it is undefined. Check that it is defined and imported before this declaration." : typeof received === "object" && received !== null && Object.getPrototypeOf(received) === Object.prototype ? "it is a plain object. Wrap its fields in object({ ... })." : "no apps schema constructor created it."}`
|
|
1081
|
+
);
|
|
1082
|
+
};
|
|
1076
1083
|
var parse = (decoder, input) => Effect_exports.suspend(() => Schema_exports.decodeUnknownEffect(decoder)(input)).pipe(
|
|
1077
1084
|
Effect_exports.mapError(() => new ValidationError())
|
|
1078
1085
|
);
|
|
@@ -1120,7 +1127,13 @@ function string(options = {}) {
|
|
|
1120
1127
|
var number = () => wrap(Schema_exports.Finite, false, { kind: "number" });
|
|
1121
1128
|
var boolean = () => wrap(Schema_exports.Boolean, false, { kind: "boolean" });
|
|
1122
1129
|
var json = () => wrap(Schema_exports.Json, false);
|
|
1123
|
-
var record = (value) => wrap(
|
|
1130
|
+
var record = (value) => wrap(
|
|
1131
|
+
Schema_exports.Record(
|
|
1132
|
+
Schema_exports.String,
|
|
1133
|
+
decoderOf(schemaArgument(value, "The record() value"))
|
|
1134
|
+
),
|
|
1135
|
+
false
|
|
1136
|
+
);
|
|
1124
1137
|
function literal(value) {
|
|
1125
1138
|
if (typeof value === "number") Effect_exports.runSync(parse(Schema_exports.Finite, value));
|
|
1126
1139
|
return wrap(
|
|
@@ -1128,10 +1141,13 @@ function literal(value) {
|
|
|
1128
1141
|
false
|
|
1129
1142
|
);
|
|
1130
1143
|
}
|
|
1131
|
-
var array = (item) => wrap(Schema_exports.Array(decoderOf(item)), false);
|
|
1144
|
+
var array = (item) => wrap(Schema_exports.Array(decoderOf(schemaArgument(item, "The array() item"))), false);
|
|
1132
1145
|
function object(fields) {
|
|
1133
1146
|
const entries = Object.entries(fields).map(
|
|
1134
|
-
([key, field]) => [
|
|
1147
|
+
([key, field]) => [
|
|
1148
|
+
key,
|
|
1149
|
+
decoderOf(schemaArgument(field, `The object() field ${JSON.stringify(key)}`))
|
|
1150
|
+
]
|
|
1135
1151
|
);
|
|
1136
1152
|
const decoder = entries.length === 0 ? withJsonSchemaDocument(
|
|
1137
1153
|
// Native Struct({}) accepts every non-null value and retains undeclared fields.
|
|
@@ -1753,6 +1769,7 @@ var jsonSchemaDocument = (decoder) => {
|
|
|
1753
1769
|
export {
|
|
1754
1770
|
decoderOf,
|
|
1755
1771
|
isSchema,
|
|
1772
|
+
schemaArgument,
|
|
1756
1773
|
parse,
|
|
1757
1774
|
wrap,
|
|
1758
1775
|
string,
|
|
@@ -4,29 +4,22 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
joinPath,
|
|
6
6
|
mergeMeta
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QUEPZ67T.js";
|
|
8
8
|
import {
|
|
9
9
|
isShortenedUpstream,
|
|
10
10
|
parseProviderError,
|
|
11
11
|
providerError
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-IU6OK5G2.js";
|
|
13
13
|
import {
|
|
14
14
|
ApiErrorResponse,
|
|
15
|
-
FetchOptionUnsupported,
|
|
16
15
|
HostDeclarationInvalid,
|
|
17
16
|
HostEvaluationFailed,
|
|
18
17
|
HostedRouter,
|
|
19
18
|
HostedTool,
|
|
20
19
|
HostedToolSummary,
|
|
21
20
|
McpCredentialsUnverified,
|
|
22
|
-
McpError
|
|
23
|
-
|
|
24
|
-
NetworkRefusedHeader,
|
|
25
|
-
RestrictedFetchOption,
|
|
26
|
-
networkRefusalHeader,
|
|
27
|
-
networkRefusalStatus,
|
|
28
|
-
supportedFetchOptions
|
|
29
|
-
} from "./chunk-N72RKJ5E.js";
|
|
21
|
+
McpError
|
|
22
|
+
} from "./chunk-DSUKW6KJ.js";
|
|
30
23
|
import {
|
|
31
24
|
AppDatabaseError
|
|
32
25
|
} from "./chunk-UMCMZFXW.js";
|
|
@@ -34,21 +27,20 @@ import {
|
|
|
34
27
|
CacheError,
|
|
35
28
|
FailureCode,
|
|
36
29
|
FailureFieldName,
|
|
30
|
+
FetchOptionUnsupported,
|
|
31
|
+
NetworkRefused,
|
|
37
32
|
maxFailureFieldLength,
|
|
38
33
|
maxFailureFields,
|
|
39
34
|
maxFailureMessageLength,
|
|
40
35
|
maxUpstreamMessageLength
|
|
41
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-DXGWKNTQ.js";
|
|
42
37
|
import {
|
|
43
38
|
SkillLoadFailed,
|
|
44
39
|
skillFormatLimits
|
|
45
40
|
} from "./chunk-HW3DPBZR.js";
|
|
46
|
-
import {
|
|
47
|
-
invocationFetch
|
|
48
|
-
} from "./chunk-ETLILMHY.js";
|
|
49
41
|
import {
|
|
50
42
|
jsonSchemaDocument
|
|
51
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-O3OAFU7Q.js";
|
|
52
44
|
import {
|
|
53
45
|
AppStorageError,
|
|
54
46
|
AppStorageUnavailable
|
|
@@ -275,35 +267,6 @@ var OpenapiCompileError = class extends Schema_exports.TaggedError()(
|
|
|
275
267
|
}
|
|
276
268
|
};
|
|
277
269
|
|
|
278
|
-
// src/implementation/network.ts
|
|
279
|
-
var refusalHeader = (status, header) => status === networkRefusalStatus && header !== null && header !== void 0 ? header : void 0;
|
|
280
|
-
var failOnNetworkRefusal = (response) => {
|
|
281
|
-
const header = refusalHeader(response.status, response.headers[networkRefusalHeader]);
|
|
282
|
-
return header === void 0 ? Effect_exports.void : Schema_exports.decodeUnknownEffect(NetworkRefusedHeader)(header).pipe(
|
|
283
|
-
Effect_exports.orDie,
|
|
284
|
-
Effect_exports.flatMap(Effect_exports.fail)
|
|
285
|
-
);
|
|
286
|
-
};
|
|
287
|
-
var unsupportedOption = (init) => {
|
|
288
|
-
for (const option of RestrictedFetchOption.literals) {
|
|
289
|
-
const value = init?.[option];
|
|
290
|
-
const supported = supportedFetchOptions[option];
|
|
291
|
-
if (value !== void 0 && !supported.includes(value))
|
|
292
|
-
return new FetchOptionUnsupported({ option, value: String(value), supported });
|
|
293
|
-
}
|
|
294
|
-
return void 0;
|
|
295
|
-
};
|
|
296
|
-
var appFetch = (fetch) => async (input, init) => {
|
|
297
|
-
const unsupported = unsupportedOption(init);
|
|
298
|
-
if (unsupported !== void 0) throw unsupported;
|
|
299
|
-
const response = await fetch(input, init);
|
|
300
|
-
const header = refusalHeader(response.status, response.headers.get(networkRefusalHeader));
|
|
301
|
-
if (header === void 0) return response;
|
|
302
|
-
await response.body?.cancel();
|
|
303
|
-
throw Schema_exports.decodeUnknownSync(NetworkRefusedHeader)(header);
|
|
304
|
-
};
|
|
305
|
-
var appInvocationFetch = (signal) => invocationFetch(signal).pipe(Effect_exports.map(appFetch));
|
|
306
|
-
|
|
307
270
|
// src/implementation/failure-detail.ts
|
|
308
271
|
var storageMessages = {
|
|
309
272
|
schema: "The app's database schema is invalid.",
|
|
@@ -792,8 +755,6 @@ export {
|
|
|
792
755
|
parseMcpError,
|
|
793
756
|
describeFailure,
|
|
794
757
|
failureDetail,
|
|
795
|
-
failOnNetworkRefusal,
|
|
796
|
-
appInvocationFetch,
|
|
797
758
|
operationDescription,
|
|
798
759
|
fixedRouter,
|
|
799
760
|
readCatalog,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fixedRouter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-O4QOPXQT.js";
|
|
4
4
|
import {
|
|
5
5
|
nativeOperation,
|
|
6
6
|
operationDeclaration,
|
|
7
7
|
routerDeclaration
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QUEPZ67T.js";
|
|
9
9
|
|
|
10
10
|
// src/implementation/protocol-operations.ts
|
|
11
11
|
var protocolOperations = (operations, kinds = {}) => {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
prepareElicitation
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5OM6HBNU.js";
|
|
4
4
|
import {
|
|
5
5
|
fromPromise
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QUEPZ67T.js";
|
|
7
7
|
import {
|
|
8
8
|
bodyUpstreamError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-IU6OK5G2.js";
|
|
10
10
|
import {
|
|
11
11
|
ElicitationFailed,
|
|
12
12
|
McpError,
|
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
defaultElicitationLimits,
|
|
19
19
|
defaultMcpClientLimits,
|
|
20
20
|
mcpSdkTimerCeilingMs
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-DSUKW6KJ.js";
|
|
22
22
|
import {
|
|
23
23
|
jsonSchemaDecoder,
|
|
24
24
|
nestJsonSchema,
|
|
25
25
|
preparedJsonSchemaDecoder
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-O3OAFU7Q.js";
|
|
27
27
|
import {
|
|
28
28
|
JsonObject
|
|
29
29
|
} from "./chunk-FBBXFFFJ.js";
|
|
@@ -3,10 +3,11 @@ import {
|
|
|
3
3
|
RouterKey,
|
|
4
4
|
RouterMeta,
|
|
5
5
|
reservedRouterKeys
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DSUKW6KJ.js";
|
|
7
7
|
import {
|
|
8
|
-
decoderOf
|
|
9
|
-
|
|
8
|
+
decoderOf,
|
|
9
|
+
schemaArgument
|
|
10
|
+
} from "./chunk-O3OAFU7Q.js";
|
|
10
11
|
import {
|
|
11
12
|
Effect_exports,
|
|
12
13
|
Schema_exports
|
|
@@ -81,10 +82,10 @@ var withApproval = (operation, approval) => ({
|
|
|
81
82
|
});
|
|
82
83
|
var toolAnnotations = (operation) => nativeOperation(operation)?.annotations;
|
|
83
84
|
var make = (kind, options, run) => operationDeclaration({
|
|
84
|
-
...operationOptions(options),
|
|
85
|
+
...operationOptions({ ...options, input: schemaArgument(options.input, `The ${kind} input`) }),
|
|
85
86
|
kind,
|
|
86
87
|
// The host always validates JSON serialization, even without a stronger output declaration.
|
|
87
|
-
...options.output === void 0 ? {} : { output: decoderOf(options.output) },
|
|
88
|
+
...options.output === void 0 ? {} : { output: decoderOf(schemaArgument(options.output, `The ${kind} output`)) },
|
|
88
89
|
run: (context, input) => Effect_exports.tryPromise({
|
|
89
90
|
// SAFETY: defineApp checks the handler context against its requirements.
|
|
90
91
|
// The host validates account bindings and creates the matching storage facade.
|
|
@@ -6,18 +6,19 @@ import {
|
|
|
6
6
|
fromPromise,
|
|
7
7
|
nativeOperation,
|
|
8
8
|
nativeRouter
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QUEPZ67T.js";
|
|
10
10
|
import {
|
|
11
11
|
ScheduleTiming
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DSUKW6KJ.js";
|
|
13
13
|
import {
|
|
14
14
|
DatabaseSchema
|
|
15
15
|
} from "./chunk-UMCMZFXW.js";
|
|
16
16
|
import {
|
|
17
17
|
decoderOf,
|
|
18
18
|
isSchema,
|
|
19
|
+
schemaArgument,
|
|
19
20
|
storageFieldOf
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-O3OAFU7Q.js";
|
|
21
22
|
import {
|
|
22
23
|
AppStorageUnavailable
|
|
23
24
|
} from "./chunk-6KG4DZD7.js";
|
|
@@ -51,8 +52,8 @@ var ResponseDecodeError = class extends Schema_exports.TaggedError()(
|
|
|
51
52
|
var NativeWorkflow = /* @__PURE__ */ Symbol("apps.Workflow");
|
|
52
53
|
var workflow = (options, run) => ({
|
|
53
54
|
[NativeWorkflow]: {
|
|
54
|
-
input: decoderOf(options.input),
|
|
55
|
-
...options.output === void 0 ? {} : { output: decoderOf(options.output) },
|
|
55
|
+
input: decoderOf(schemaArgument(options.input, "The workflow input")),
|
|
56
|
+
...options.output === void 0 ? {} : { output: decoderOf(schemaArgument(options.output, "The workflow output")) },
|
|
56
57
|
...options.description === void 0 ? {} : { description: options.description },
|
|
57
58
|
run: (context, input) => Effect_exports.tryPromise({
|
|
58
59
|
// SAFETY: defineApp checks required context; the host supplies the pinned run's capabilities.
|