apps 0.0.1-beta.9 → 0.0.1-beta.91
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/README.md +56 -38
- package/framework-reference.json +1 -1
- package/js/chunk-3LEVTFD4.js +712 -0
- package/js/chunk-5FHWNLCI.js +88 -0
- package/js/{chunk-FL2QR3XW.js → chunk-5MDA7MKL.js} +338 -73
- package/js/chunk-6XQLA5NC.js +5047 -0
- package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
- package/js/chunk-7PHHWYV4.js +335 -0
- package/js/chunk-DADXWWRZ.js +449 -0
- package/js/{chunk-27F7W2LG.js → chunk-DDHBUKXX.js} +18 -2
- package/js/{chunk-UK573G7W.js → chunk-EOPQ727L.js} +87 -51
- package/js/{chunk-5T57N25Q.js → chunk-GQ33QSNB.js} +583 -69
- package/js/{chunk-JU7VHODU.js → chunk-H72MEDMN.js} +65 -10
- package/js/chunk-I5C7FD5Z.js +171 -0
- package/js/{chunk-CDL5PM2Q.js → chunk-IFJU5SYQ.js} +19082 -18402
- package/js/{chunk-VFZKSM3T.js → chunk-JPEUKEV4.js} +3 -3
- package/js/{chunk-KUMBKVJD.js → chunk-KLYSEHUD.js} +2 -2
- package/js/{chunk-RFVIONFX.js → chunk-KUCCHNVY.js} +123 -44
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
- package/js/{chunk-72JNVHPK.js → chunk-PYQLOLOC.js} +4 -3
- package/js/{chunk-ODEIDRGW.js → chunk-QWQM3CLH.js} +795 -176
- package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
- package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
- package/js/chunk-XPRZTLHD.js +1915 -0
- package/js/chunk-YNJ5CZMJ.js +93 -0
- package/js/chunk-YRGL4QEF.js +49 -0
- package/js/{chunk-Z5M2LQOZ.js → chunk-YWFUWTUJ.js} +113 -58
- package/js/client.js +142 -78
- package/js/contracts.js +142 -21
- package/js/effect.js +18 -19
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +49 -40
- package/js/host.js +85 -62
- package/js/index.js +165 -70
- package/js/mcp/effect.js +21 -21
- package/js/mcp.js +76 -56
- package/js/openapi.js +4189 -1411
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +208 -81
- package/js/storage/facet.js +1 -540
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +5 -4
- package/js/ui/serving.js +8605 -225
- package/package.json +3 -8
- package/runtime.json +1 -1
- package/types/app-cache/src/contracts/cache.d.ts +18 -0
- package/types/app-cache/src/index.d.ts +34 -2
- package/types/apps/src/contracts/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/app.d.ts +60 -11
- package/types/apps/src/contracts/cache.d.ts +20 -0
- package/types/apps/src/contracts/context.d.ts +60 -17
- package/types/apps/src/contracts/elicitation.d.ts +23 -7
- package/types/apps/src/contracts/events.d.ts +94 -0
- package/types/apps/src/contracts/failure.d.ts +30 -1
- package/types/apps/src/contracts/graphql.d.ts +2 -1
- package/types/apps/src/contracts/host.d.ts +1446 -17
- package/types/apps/src/contracts/icons.d.ts +28 -0
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +81 -20
- package/types/apps/src/contracts/network.d.ts +120 -0
- package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
- package/types/apps/src/contracts/openapi.d.ts +41 -9
- package/types/apps/src/contracts/operations.d.ts +14 -7
- package/types/apps/src/contracts/placement.d.ts +102 -0
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +733 -81
- package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
- package/types/apps/src/contracts/protocols/11.d.ts +1149 -0
- package/types/apps/src/contracts/protocols/12.d.ts +3310 -0
- package/types/apps/src/contracts/protocols/2.d.ts +69 -26
- package/types/apps/src/contracts/protocols/3.d.ts +133 -33
- package/types/apps/src/contracts/protocols/4.d.ts +122 -45
- package/types/apps/src/contracts/protocols/5.d.ts +157 -47
- package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
- package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
- package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
- package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
- package/types/apps/src/contracts/protocols/current.d.ts +6669 -0
- package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
- package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
- package/types/apps/src/contracts/provider-error.d.ts +9 -0
- package/types/apps/src/contracts/provider.d.ts +90 -6
- package/types/apps/src/contracts/schedules.d.ts +7 -1
- package/types/apps/src/contracts/schema.d.ts +21 -0
- package/types/apps/src/contracts/skills.d.ts +50 -13
- package/types/apps/src/contracts/sql.d.ts +63 -0
- package/types/apps/src/contracts/ui.d.ts +44 -14
- package/types/apps/src/contracts/webhooks.d.ts +24 -7
- package/types/apps/src/contracts/workflows.d.ts +19 -17
- package/types/apps/src/facet.d.ts +4 -5
- package/types/apps/src/host.d.ts +5 -0
- package/types/apps/src/implementation/account-router.d.ts +4 -3
- package/types/apps/src/implementation/app.d.ts +41 -14
- package/types/apps/src/implementation/authoring.d.ts +25 -5
- package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
- package/types/apps/src/implementation/cache.d.ts +29 -2
- package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
- package/types/apps/src/implementation/elicitation.d.ts +18 -15
- package/types/apps/src/implementation/events.d.ts +64 -0
- package/types/apps/src/implementation/failure-detail.d.ts +28 -5
- package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
- package/types/apps/src/implementation/graphql.d.ts +4 -3
- package/types/apps/src/implementation/input-problems.d.ts +6 -2
- package/types/apps/src/implementation/invocation-timing.d.ts +18 -0
- package/types/apps/src/implementation/live.d.ts +2 -2
- package/types/apps/src/implementation/mcp-call.d.ts +6 -5
- package/types/apps/src/implementation/mcp-catalog.d.ts +6 -4
- package/types/apps/src/implementation/mcp-client.d.ts +17 -9
- package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
- package/types/apps/src/implementation/mcp.d.ts +20 -9
- package/types/apps/src/implementation/network.d.ts +16 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +28 -7
- package/types/apps/src/implementation/openapi-document.d.ts +46 -19
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-request.d.ts +10 -2
- package/types/apps/src/implementation/openapi-source.d.ts +23 -1
- package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
- package/types/apps/src/implementation/operations.d.ts +57 -7
- package/types/apps/src/implementation/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/placement.d.ts +60 -0
- package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
- package/types/apps/src/implementation/provider-error.d.ts +28 -1
- package/types/apps/src/implementation/provider.d.ts +19 -4
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +20 -18
- package/types/apps/src/implementation/router.d.ts +24 -5
- package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
- package/types/apps/src/implementation/schedules.d.ts +39 -8
- package/types/apps/src/implementation/schema.d.ts +98 -11
- package/types/apps/src/implementation/skills.d.ts +18 -24
- package/types/apps/src/implementation/sql.d.ts +71 -0
- package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
- package/types/apps/src/implementation/ui-auth.d.ts +1 -1
- package/types/apps/src/implementation/ui-client.d.ts +2 -2
- package/types/apps/src/implementation/ui-document.d.ts +5 -0
- package/types/apps/src/implementation/ui-errors.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +26 -9
- package/types/apps/src/implementation/ui-watch.d.ts +1 -1
- package/types/apps/src/implementation/upstream-error.d.ts +7 -0
- package/types/apps/src/implementation/webhooks.d.ts +15 -6
- package/types/apps/src/implementation/workflow-context.d.ts +6 -2
- package/types/apps/src/implementation/workflows.d.ts +11 -4
- package/types/apps/src/index.d.ts +68 -19
- package/types/apps/src/mcp.d.ts +20 -1
- package/types/apps/src/openapi.d.ts +6 -1
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +10 -8
- package/types/apps/src/ui-serving.d.ts +1 -1
- package/types/telemetry/src/app-records.d.ts +42 -0
- package/types/telemetry/src/browser-operations.d.ts +2 -2
- package/types/telemetry/src/browser.d.ts +8 -3
- package/types/telemetry/src/config.d.ts +2 -2
- package/types/telemetry/src/index.d.ts +2 -1
- package/types/telemetry/src/layer.d.ts +10 -4
- package/types/telemetry/src/measurements.d.ts +1 -1
- package/types/telemetry/src/ownership.d.ts +60 -0
- package/types/telemetry/src/recorded-failure.d.ts +29 -0
- package/types/telemetry/src/relay.d.ts +16 -6
- package/types/telemetry/src/span-attributes.d.ts +17 -1
- package/types/telemetry/src/transport.d.ts +8 -1
- package/types/utils/src/api-error.d.ts +55 -0
- package/types/utils/src/connection-failure.d.ts +33 -0
- package/types/utils/src/recorded-message.d.ts +18 -0
- package/types/utils/src/user-facing-error.d.ts +83 -0
- package/js/chunk-7EK2JDX4.js +0 -299
- package/js/chunk-IKS2C5MQ.js +0 -224
- package/js/chunk-MKWZPDR6.js +0 -63
- package/js/chunk-N7YDVXYJ.js +0 -186
- package/js/chunk-NKLWZJLE.js +0 -172
- package/js/chunk-PJJ24GU7.js +0 -877
- package/js/chunk-PZB6T6KU.js +0 -19
- package/js/chunk-R3EV5FTO.js +0 -97
- package/js/chunk-SJFZCGXG.js +0 -1243
- package/js/chunk-WLE7WX2U.js +0 -2645
- package/js/chunk-YXQHV65J.js +0 -242
- package/js/chunk-ZQINWV4W.js +0 -630
- package/js/mcp/stdio.js +0 -128
- package/types/app-data/src/implementation/cursor.d.ts +0 -10
- package/types/app-data/src/implementation/index-key.d.ts +0 -7
- package/types/app-data/src/implementation/promise.d.ts +0 -68
- package/types/app-data/src/implementation/range.d.ts +0 -8
- package/types/app-data/src/implementation/schema.d.ts +0 -18
- package/types/app-data/src/implementation/sqlite.d.ts +0 -11
- package/types/app-data/src/index.d.ts +0 -4
- package/types/apps/src/contracts/storage.d.ts +0 -68
- package/types/apps/src/implementation/mcp-stdio.d.ts +0 -4
- package/types/apps/src/implementation/storage.d.ts +0 -15
- package/types/apps/src/mcp-stdio.d.ts +0 -5
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Predicate_exports
|
|
3
|
+
} from "./chunk-IFJU5SYQ.js";
|
|
4
|
+
|
|
5
|
+
// ../utils/src/recorded-message.ts
|
|
6
|
+
var RecordedMessage = /* @__PURE__ */ Symbol.for("@executor-js/utils/RecordedMessage");
|
|
7
|
+
var recordedMessage = (error) => {
|
|
8
|
+
if (Predicate_exports.hasProperty(error, RecordedMessage)) {
|
|
9
|
+
const message = error[RecordedMessage];
|
|
10
|
+
return typeof message === "string" ? message : void 0;
|
|
11
|
+
}
|
|
12
|
+
return protocolErrorMessage(error) ?? sqlErrorMessage(error);
|
|
13
|
+
};
|
|
14
|
+
var jsonRpcMeanings = {
|
|
15
|
+
[-32700]: "Parse error",
|
|
16
|
+
[-32600]: "Invalid request",
|
|
17
|
+
[-32601]: "Method not found",
|
|
18
|
+
[-32602]: "Invalid params",
|
|
19
|
+
[-32603]: "Internal error",
|
|
20
|
+
[-32002]: "Resource not found"
|
|
21
|
+
};
|
|
22
|
+
var protocolErrorMessage = (error) => {
|
|
23
|
+
if (!Predicate_exports.isTagged(error, "ProtocolError") || !Predicate_exports.hasProperty(error, "code") || typeof error.code !== "number" || !Predicate_exports.hasProperty(error, "message") || !Predicate_exports.isString(error.message))
|
|
24
|
+
return void 0;
|
|
25
|
+
const code = error.code;
|
|
26
|
+
const refusal = /^Tool '.*' not found$/s.test(error.message) ? ": the requested tool does not exist" : error.message.startsWith("Invalid parameters for tool '") ? ": the tool's arguments failed validation" : "";
|
|
27
|
+
const meaning = jsonRpcMeanings[code];
|
|
28
|
+
const kind = meaning === void 0 ? "JSON-RPC error with an unlisted code" : `${meaning} (${code})`;
|
|
29
|
+
return kind + refusal;
|
|
30
|
+
};
|
|
31
|
+
var sqlReasons = /* @__PURE__ */ new Set([
|
|
32
|
+
"ConnectionError",
|
|
33
|
+
"AuthenticationError",
|
|
34
|
+
"AuthorizationError",
|
|
35
|
+
"SqlSyntaxError",
|
|
36
|
+
"UniqueViolation",
|
|
37
|
+
"ConstraintError",
|
|
38
|
+
"DeadlockError",
|
|
39
|
+
"SerializationError",
|
|
40
|
+
"LockTimeoutError",
|
|
41
|
+
"StatementTimeoutError",
|
|
42
|
+
"UnknownError"
|
|
43
|
+
]);
|
|
44
|
+
var sqlMessages = new Set(
|
|
45
|
+
[
|
|
46
|
+
"A pipelined query completed out of order",
|
|
47
|
+
"Connection closed",
|
|
48
|
+
"Connection closed during startup",
|
|
49
|
+
"Connection is closed",
|
|
50
|
+
"Connection timed out",
|
|
51
|
+
"Failed to connect",
|
|
52
|
+
"Failed to decode row",
|
|
53
|
+
"Failed to encode query",
|
|
54
|
+
"Failed to negotiate TLS",
|
|
55
|
+
"Failed to parse SSLRequest error response",
|
|
56
|
+
"Failed to parse server messages",
|
|
57
|
+
"Failed to parse server response",
|
|
58
|
+
"Failed to write query",
|
|
59
|
+
"Failed to write query batch",
|
|
60
|
+
"Invalid SSLRequest response",
|
|
61
|
+
"MD5 authentication failed",
|
|
62
|
+
"No password configured",
|
|
63
|
+
"Protocol desync",
|
|
64
|
+
"Query cancellation timed out",
|
|
65
|
+
"Query failed",
|
|
66
|
+
"SCRAM authentication failed",
|
|
67
|
+
"SCRAM exchange did not complete",
|
|
68
|
+
"SCRAM server verification failed",
|
|
69
|
+
"Server refused TLS",
|
|
70
|
+
"Socket error",
|
|
71
|
+
"Stream cancellation timed out",
|
|
72
|
+
"The server reported an error",
|
|
73
|
+
"Unsupported authentication method"
|
|
74
|
+
].map((message) => `PgConnection: ${message}`)
|
|
75
|
+
);
|
|
76
|
+
var sqlErrorMessage = (error) => {
|
|
77
|
+
if (!Predicate_exports.isTagged(error, "SqlError") || !Predicate_exports.hasProperty(error, "reason"))
|
|
78
|
+
return void 0;
|
|
79
|
+
const reason = error.reason;
|
|
80
|
+
const kind = Predicate_exports.hasProperty(reason, "_tag") && Predicate_exports.isString(reason._tag) && sqlReasons.has(reason._tag) ? reason._tag : "an unlisted kind";
|
|
81
|
+
const message = Predicate_exports.hasProperty(reason, "message") && Predicate_exports.isString(reason.message) && sqlMessages.has(reason.message) ? `: ${reason.message}` : "";
|
|
82
|
+
return `The database failed (${kind})${message}`;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export {
|
|
86
|
+
RecordedMessage,
|
|
87
|
+
recordedMessage
|
|
88
|
+
};
|
|
@@ -1,51 +1,59 @@
|
|
|
1
1
|
import {
|
|
2
2
|
skillFromFiles
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XBG7HHXC.js";
|
|
4
4
|
import {
|
|
5
5
|
joinPath,
|
|
6
6
|
mergeMeta
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YWFUWTUJ.js";
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
isShortenedUpstream,
|
|
10
|
+
parseProviderError,
|
|
11
|
+
providerError
|
|
12
|
+
} from "./chunk-I5C7FD5Z.js";
|
|
11
13
|
import {
|
|
12
14
|
ApiErrorResponse,
|
|
15
|
+
CacheError,
|
|
16
|
+
FailureCode,
|
|
17
|
+
FailureFieldName,
|
|
18
|
+
FetchOptionUnsupported,
|
|
13
19
|
HostDeclarationInvalid,
|
|
14
20
|
HostEvaluationFailed,
|
|
15
21
|
HostedRouter,
|
|
16
22
|
HostedTool,
|
|
17
23
|
HostedToolSummary,
|
|
24
|
+
McpCredentialsUnverified,
|
|
18
25
|
McpError,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
McpError2,
|
|
27
|
+
NetworkRefused,
|
|
28
|
+
SkillLoadFailed as SkillLoadFailed2,
|
|
29
|
+
cacheLimits,
|
|
30
|
+
maxFailureFieldLength,
|
|
31
|
+
maxFailureFields,
|
|
32
|
+
maxFailureMessageLength,
|
|
33
|
+
maxUpstreamMessageLength
|
|
34
|
+
} from "./chunk-6XQLA5NC.js";
|
|
24
35
|
import {
|
|
25
36
|
SkillLoadFailed,
|
|
26
37
|
skillFormatLimits
|
|
27
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-H72MEDMN.js";
|
|
28
39
|
import {
|
|
29
40
|
jsonSchemaDocument
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import {
|
|
32
|
-
AppStorageError,
|
|
33
|
-
AppStorageUnavailable
|
|
34
|
-
} from "./chunk-PZB6T6KU.js";
|
|
41
|
+
} from "./chunk-GQ33QSNB.js";
|
|
35
42
|
import {
|
|
36
43
|
AccountId,
|
|
37
44
|
HttpUrl,
|
|
38
45
|
JsonObject
|
|
39
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-DDHBUKXX.js";
|
|
40
47
|
import {
|
|
41
48
|
Cause_exports,
|
|
42
49
|
Effect_exports,
|
|
50
|
+
Match_exports,
|
|
43
51
|
Option_exports,
|
|
44
52
|
Predicate_exports,
|
|
45
53
|
Redacted_exports,
|
|
46
54
|
Result_exports,
|
|
47
55
|
Schema_exports
|
|
48
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-IFJU5SYQ.js";
|
|
49
57
|
|
|
50
58
|
// src/contracts/openapi.ts
|
|
51
59
|
var OpenapiErrorResponse = Schema_exports.Struct({
|
|
@@ -59,7 +67,8 @@ var OpenapiErrorResponse = Schema_exports.Struct({
|
|
|
59
67
|
});
|
|
60
68
|
var OpenapiParameter = Schema_exports.Struct({
|
|
61
69
|
name: Schema_exports.String,
|
|
62
|
-
|
|
70
|
+
/** OpenAPI 3.2's `querystring` is the whole query string, serialized from one `content` value. */
|
|
71
|
+
in: Schema_exports.Literals(["path", "query", "querystring", "header", "cookie"]),
|
|
63
72
|
required: Schema_exports.optionalKey(Schema_exports.Boolean),
|
|
64
73
|
schema: Schema_exports.optionalKey(JsonObject),
|
|
65
74
|
style: Schema_exports.optionalKey(Schema_exports.String),
|
|
@@ -84,7 +93,7 @@ var OpenapiOperation = Schema_exports.Struct({
|
|
|
84
93
|
/** The document's operationId, when it declares one. `kinds` overrides are keyed by it. */
|
|
85
94
|
operationId: Schema_exports.optionalKey(Schema_exports.String),
|
|
86
95
|
description: Schema_exports.String,
|
|
87
|
-
method: Schema_exports.Literals(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]),
|
|
96
|
+
method: Schema_exports.Literals(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "QUERY"]),
|
|
88
97
|
path: Schema_exports.String,
|
|
89
98
|
baseUrl: HttpUrl,
|
|
90
99
|
openapi: Schema_exports.String,
|
|
@@ -104,6 +113,7 @@ var OpenapiOperation = Schema_exports.Struct({
|
|
|
104
113
|
outputSchema: Schema_exports.optionalKey(JsonObject),
|
|
105
114
|
errorResponses: Schema_exports.optionalKey(Schema_exports.Array(OpenapiErrorResponse))
|
|
106
115
|
});
|
|
116
|
+
var isOpenapiReadMethod = (method) => method === "GET" || method === "HEAD" || method === "OPTIONS" || method === "QUERY";
|
|
107
117
|
var CredentialBinding = Schema_exports.Struct({
|
|
108
118
|
scheme: Schema_exports.String,
|
|
109
119
|
field: Schema_exports.String,
|
|
@@ -136,16 +146,30 @@ var OpenapiToolsOptions = Schema_exports.Struct({
|
|
|
136
146
|
Schema_exports.declare((value) => typeof value === "function")
|
|
137
147
|
)
|
|
138
148
|
});
|
|
149
|
+
var OpenapiFailedOperation = Schema_exports.Struct({
|
|
150
|
+
method: OpenapiOperation.fields.method,
|
|
151
|
+
path: Schema_exports.String
|
|
152
|
+
});
|
|
153
|
+
var OpenapiMediaType = Schema_exports.String.check(
|
|
154
|
+
Schema_exports.isMaxLength(128),
|
|
155
|
+
Schema_exports.isPattern(/^[\w!#$&^.+-]+\/[\w!#$&^.+-]+$/u)
|
|
156
|
+
);
|
|
139
157
|
var OpenapiError = class extends Schema_exports.TaggedError()("OpenapiError", {
|
|
140
158
|
reason: Schema_exports.Literals(["invalid_definition", "invalid_input", "request"]),
|
|
141
|
-
status: Schema_exports.optional(Schema_exports.Number)
|
|
159
|
+
status: Schema_exports.optional(Schema_exports.Number),
|
|
160
|
+
/** Absent only when the definition itself could not be read. */
|
|
161
|
+
operation: Schema_exports.optional(OpenapiFailedOperation),
|
|
162
|
+
contentType: Schema_exports.optional(OpenapiMediaType),
|
|
163
|
+
/** The response's `content-length`, when it declared one. */
|
|
164
|
+
bytes: Schema_exports.optional(Schema_exports.Int.check(Schema_exports.isGreaterThanOrEqualTo(0)))
|
|
142
165
|
}) {
|
|
143
166
|
};
|
|
144
167
|
var defaultOpenapiResponseLimits = {
|
|
145
168
|
maxBodyBytes: 16777216,
|
|
146
169
|
readTimeoutMs: 3e4
|
|
147
170
|
};
|
|
148
|
-
var
|
|
171
|
+
var isOpenapiJsonSequence = (type) => /^application\/(?:x-)?(?:ndjson|jsonl|jsonlines|json-seq)\s*(?:;|$)/i.test(type);
|
|
172
|
+
var isOpenapiTextMedia = (type) => isOpenapiJsonSequence(type) || /^(?:text\/|application\/(?:[\w.-]+\+)?(?:json|xml)|application\/(?:javascript|x-www-form-urlencoded))/i.test(
|
|
149
173
|
type
|
|
150
174
|
);
|
|
151
175
|
var isOpenapiFileSchema = (shape) => shape.contentMediaType !== void 0 && shape.contentEncoding === void 0 || shape.type === "string" && shape.format === "binary";
|
|
@@ -158,23 +182,158 @@ var openapiBinaryResultSchema = {
|
|
|
158
182
|
required: ["base64", "contentType"],
|
|
159
183
|
additionalProperties: false
|
|
160
184
|
};
|
|
161
|
-
var openapiMediaKind = (type) => type.includes("json") && !type
|
|
185
|
+
var openapiMediaKind = (type) => type.includes("json") && !isOpenapiJsonSequence(type) ? "json" : type === "application/x-www-form-urlencoded" ? "form" : type === "multipart/form-data" ? "multipart" : isOpenapiTextMedia(type) ? "text" : "binary";
|
|
186
|
+
|
|
187
|
+
// src/contracts/openapi-compile.ts
|
|
188
|
+
var OpenapiCompileErrorCode = Schema_exports.Literals([
|
|
189
|
+
"server_protocol",
|
|
190
|
+
"server_url",
|
|
191
|
+
"external_reference",
|
|
192
|
+
"circular_reference",
|
|
193
|
+
"schema_keyword",
|
|
194
|
+
"schema_reference",
|
|
195
|
+
"missing_component",
|
|
196
|
+
"openapi_version",
|
|
197
|
+
"auth_helper",
|
|
198
|
+
"auth_missing",
|
|
199
|
+
"operation_path",
|
|
200
|
+
"operation_method",
|
|
201
|
+
"duplicate_operation",
|
|
202
|
+
"server_missing",
|
|
203
|
+
"multiple_hosts",
|
|
204
|
+
"parameter_encoding",
|
|
205
|
+
"parameter_style",
|
|
206
|
+
"request_body",
|
|
207
|
+
"combined_oauth",
|
|
208
|
+
"auth_method",
|
|
209
|
+
"event_stream",
|
|
210
|
+
"input_schema",
|
|
211
|
+
"no_operations",
|
|
212
|
+
"no_supported_operations",
|
|
213
|
+
"invalid_document",
|
|
214
|
+
"source_generation",
|
|
215
|
+
"authoring_reference"
|
|
216
|
+
]);
|
|
217
|
+
var OpenapiSkippedOperation = Schema_exports.Struct({
|
|
218
|
+
/** The tool name the operation would have; reading that tool reports why it is missing. */
|
|
219
|
+
name: Schema_exports.String,
|
|
220
|
+
/** The HTTP method, such as `GET`. */
|
|
221
|
+
method: Schema_exports.String,
|
|
222
|
+
/** The path as the definition declares it. */
|
|
223
|
+
path: Schema_exports.String,
|
|
224
|
+
code: OpenapiCompileErrorCode,
|
|
225
|
+
reason: Schema_exports.String
|
|
226
|
+
});
|
|
227
|
+
var listedReasons = 8;
|
|
228
|
+
var reasonLength = 240;
|
|
229
|
+
var cut = (text) => text.length <= reasonLength ? text : `${text.slice(0, reasonLength - 1)}\u2026`;
|
|
230
|
+
var customTool = `To call a left-out operation anyway, write a custom tool for it in this app with the same account: see "Custom tools beside generated ones" in the app-authoring skill's integrations.md.`;
|
|
231
|
+
var compileMessage = (error) => {
|
|
232
|
+
const skipped = error.skipped ?? [];
|
|
233
|
+
if (skipped.length === 0) return error.reason;
|
|
234
|
+
const close = skipped.some(({ code }) => code !== "event_stream") ? ` ${customTool}` : "";
|
|
235
|
+
const groups = /* @__PURE__ */ new Map();
|
|
236
|
+
for (const operation of skipped) {
|
|
237
|
+
const key = JSON.stringify([operation.code, operation.reason]);
|
|
238
|
+
const group = groups.get(key);
|
|
239
|
+
if (group === void 0) groups.set(key, { first: operation, count: 1 });
|
|
240
|
+
else group.count++;
|
|
241
|
+
}
|
|
242
|
+
const example = ({ first, count: count2 }) => `${first.method} ${first.path}${count2 > 1 ? ` and ${count2 - 1} more` : ""}`;
|
|
243
|
+
const [only, ...others] = groups.values();
|
|
244
|
+
if (only !== void 0 && others.length === 0 && only.first.code === error.code && only.first.reason === error.reason)
|
|
245
|
+
return `${error.reason} Left out: ${example(only)}.${close}`;
|
|
246
|
+
const listed = [];
|
|
247
|
+
let room = maxFailureMessageLength - `${error.reason} Left out: ; and ${groups.size} other reasons.${close}`.length;
|
|
248
|
+
for (const group of groups.values()) {
|
|
249
|
+
const text = `${example(group)} (${group.first.code}: ${cut(group.first.reason.replace(/\.$/, ""))})`;
|
|
250
|
+
if (listed.length === listedReasons || text.length + 2 > room) break;
|
|
251
|
+
listed.push(text);
|
|
252
|
+
room -= text.length + 2;
|
|
253
|
+
}
|
|
254
|
+
const rest = groups.size - listed.length;
|
|
255
|
+
return `${error.reason} Left out: ${listed.join("; ")}${rest > 0 ? `; and ${rest} other reasons` : ""}.${close}`;
|
|
256
|
+
};
|
|
257
|
+
var OpenapiCompileError = class extends Schema_exports.TaggedError()(
|
|
258
|
+
"OpenapiCompileError",
|
|
259
|
+
{
|
|
260
|
+
code: OpenapiCompileErrorCode,
|
|
261
|
+
reason: Schema_exports.String,
|
|
262
|
+
skipped: Schema_exports.optionalKey(Schema_exports.Array(OpenapiSkippedOperation)),
|
|
263
|
+
origins: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String))
|
|
264
|
+
}
|
|
265
|
+
) {
|
|
266
|
+
get message() {
|
|
267
|
+
return compileMessage(this);
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
var OpenapiToolName = Schema_exports.Struct({
|
|
271
|
+
/** The tool name relative to the router, as `withApprovals` receives it. */
|
|
272
|
+
name: Schema_exports.String,
|
|
273
|
+
/** The HTTP method, such as `GET`. */
|
|
274
|
+
method: Schema_exports.String,
|
|
275
|
+
/** The request path, including any `pathPrefix`. */
|
|
276
|
+
path: Schema_exports.String,
|
|
277
|
+
operationId: Schema_exports.optionalKey(Schema_exports.String),
|
|
278
|
+
/** After `kinds` (keyed by `operationId`, else `name`); otherwise reading methods are queries. */
|
|
279
|
+
kind: Schema_exports.Literals(["query", "mutation"]),
|
|
280
|
+
/** Callable without credentials, so every account and a router without one expose it. */
|
|
281
|
+
public: Schema_exports.Boolean,
|
|
282
|
+
/** The `methods` and `oauth` entries whose accounts expose it. */
|
|
283
|
+
methods: Schema_exports.Array(Schema_exports.String)
|
|
284
|
+
});
|
|
285
|
+
var OpenapiToolNames = Schema_exports.Struct({
|
|
286
|
+
tools: Schema_exports.Array(OpenapiToolName),
|
|
287
|
+
/**
|
|
288
|
+
* Operations the compiler left out, and why. An operation it imports but no configured `methods`
|
|
289
|
+
* or `oauth` entry can authorize is missing from `tools` and is not listed here.
|
|
290
|
+
*/
|
|
291
|
+
skipped: Schema_exports.Array(OpenapiSkippedOperation)
|
|
292
|
+
});
|
|
162
293
|
|
|
163
294
|
// src/implementation/failure-detail.ts
|
|
164
|
-
var
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
295
|
+
var cacheMessages = {
|
|
296
|
+
capacity: "A cache key, value or batch exceeded the app cache's size limits.",
|
|
297
|
+
invalid: "The app made a cache request the app cache could not accept.",
|
|
298
|
+
unavailable: "The app cache was not available for this operation.",
|
|
299
|
+
storage: "The app cache failed to complete the operation.",
|
|
300
|
+
timeout: "The app cache did not respond in time."
|
|
301
|
+
};
|
|
302
|
+
var count = (value) => value.toLocaleString("en-US");
|
|
303
|
+
var cacheLimitMessages = {
|
|
304
|
+
keyBytes: `A cache key exceeded the app cache's limit of ${count(cacheLimits.keyBytes)} bytes per key.`,
|
|
305
|
+
entryBytes: `A cache value exceeded the app cache's limit of ${count(cacheLimits.entryBytes)} bytes per entry.`,
|
|
306
|
+
batchBytes: `A cache read or write exceeded the app cache's limit of ${count(cacheLimits.batchBytes)} bytes per batch.`,
|
|
307
|
+
batchEntries: `A cache read or write exceeded the app cache's limit of ${count(cacheLimits.batchEntries)} entries per batch.`,
|
|
308
|
+
totalBytes: `The app cache is full: it holds at most ${count(cacheLimits.totalBytes)} bytes.`,
|
|
309
|
+
totalEntries: `The app cache is full: it holds at most ${count(cacheLimits.totalEntries)} entries.`
|
|
310
|
+
};
|
|
311
|
+
var mcpStages = {
|
|
312
|
+
connect: "connecting",
|
|
313
|
+
transport: "connecting",
|
|
314
|
+
discover: "listing its tools",
|
|
315
|
+
schema: "reading a tool's schema",
|
|
316
|
+
call: "calling a tool"
|
|
317
|
+
};
|
|
318
|
+
var mcpMessage = ({ phase, reason, status }) => {
|
|
319
|
+
const stage = mcpStages[phase];
|
|
320
|
+
return Match_exports.value(reason).pipe(
|
|
321
|
+
Match_exports.when("timeout", () => `The MCP server did not respond in time while ${stage}.`),
|
|
322
|
+
Match_exports.when("unauthorized", () => `The MCP server rejected the credentials while ${stage}.`),
|
|
323
|
+
Match_exports.when(
|
|
324
|
+
"invalid_response",
|
|
325
|
+
() => `The MCP server returned a response Executor could not use while ${stage}, such as an unreadable message or an address on another origin.`
|
|
326
|
+
),
|
|
327
|
+
Match_exports.when("invalid_input", () => "The MCP server URL or connection settings are invalid."),
|
|
328
|
+
// Only a transport failure has no answer from the server; a JSON-RPC error is an answer.
|
|
329
|
+
Match_exports.when(
|
|
330
|
+
"request",
|
|
331
|
+
() => status !== void 0 ? `The MCP server answered HTTP ${status} while ${stage}.` : phase === "transport" ? `Executor could not reach the MCP server while ${stage}.` : `The request to the MCP server failed while ${stage}.`
|
|
332
|
+
),
|
|
333
|
+
Match_exports.exhaustive
|
|
334
|
+
);
|
|
177
335
|
};
|
|
336
|
+
var unverifiedMessage = ({ anonymous }) => anonymous === "answered" ? "This MCP server answers without credentials, so Executor can't check this account. A refused key will show up when a tool is called." : `The MCP server accepted the credentials, but the same check without them failed, so Executor can't tell whether it requires them. ${Schema_exports.is(McpError)(anonymous) ? mcpMessage(anonymous) : anonymous.status === void 0 ? "The MCP server could not answer the request." : `The MCP server answered HTTP ${anonymous.status}.`}`;
|
|
178
337
|
var minimumSecretLength = 6;
|
|
179
338
|
var secretValues = (value, found) => {
|
|
180
339
|
if (typeof value === "string") {
|
|
@@ -187,61 +346,165 @@ var secretValues = (value, found) => {
|
|
|
187
346
|
var accountFieldSecrets = (accounts) => {
|
|
188
347
|
const found = /* @__PURE__ */ new Set();
|
|
189
348
|
if (Predicate_exports.isObject(accounts)) {
|
|
190
|
-
for (const
|
|
191
|
-
|
|
192
|
-
|
|
349
|
+
for (const scope of [accounts["app"], accounts["user"]])
|
|
350
|
+
if (Predicate_exports.isObject(scope)) {
|
|
351
|
+
for (const slot of Object.values(scope))
|
|
352
|
+
for (const account of Array.isArray(slot) ? slot : [slot])
|
|
353
|
+
if (Predicate_exports.hasProperty(account, "fields")) secretValues(account.fields, found);
|
|
354
|
+
}
|
|
193
355
|
}
|
|
194
356
|
return [...found].sort((a, b) => b.length - a.length);
|
|
195
357
|
};
|
|
196
358
|
var accountSecrets = (accounts) => accountFieldSecrets(Redacted_exports.value(accounts));
|
|
197
|
-
var
|
|
198
|
-
let redacted =
|
|
359
|
+
var replaceSecrets = (text, secrets) => {
|
|
360
|
+
let redacted = text;
|
|
199
361
|
for (const secret of secrets) redacted = redacted.split(secret).join("[redacted]");
|
|
200
|
-
return redacted
|
|
362
|
+
return redacted;
|
|
363
|
+
};
|
|
364
|
+
var bound = (text, maximum) => text.length <= maximum ? text : `${text.slice(0, maximum - 1)}\u2026`;
|
|
365
|
+
var boundText = (text, secrets, maximum) => bound(replaceSecrets(text, secrets), maximum);
|
|
366
|
+
var replaceSecretStart = (text, secrets) => {
|
|
367
|
+
let longest = 0;
|
|
368
|
+
for (const secret of secrets)
|
|
369
|
+
for (let length = Math.min(secret.length - 1, text.length); length > longest; length--)
|
|
370
|
+
if (text.endsWith(secret.slice(0, length))) {
|
|
371
|
+
longest = length;
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
return longest === 0 ? text : `${text.slice(0, -longest)}[redacted]`;
|
|
375
|
+
};
|
|
376
|
+
var boundFailureMessage = (message, secrets) => boundText(message, secrets, maxFailureMessageLength);
|
|
377
|
+
var redactUpstream = (upstream, secrets) => {
|
|
378
|
+
if (upstream?.message === void 0) return upstream;
|
|
379
|
+
const message = isShortenedUpstream(upstream.message) ? `${replaceSecretStart(replaceSecrets(upstream.message.slice(0, -1), secrets), secrets)}\u2026` : replaceSecrets(upstream.message, secrets);
|
|
380
|
+
return { code: upstream.code, message: bound(message, maxUpstreamMessageLength) };
|
|
201
381
|
};
|
|
382
|
+
var leavingProviderError = (error, secrets, phase) => providerError({
|
|
383
|
+
...error,
|
|
384
|
+
phase: error.phase ?? phase,
|
|
385
|
+
upstream: redactUpstream(error.upstream, secrets)
|
|
386
|
+
});
|
|
387
|
+
var parseMcpError = (error, secrets) => Schema_exports.decodeUnknownOption(McpError)(error).pipe(
|
|
388
|
+
Option_exports.map(({ phase, reason, status, upstream, session }) => {
|
|
389
|
+
const stated = redactUpstream(upstream, secrets);
|
|
390
|
+
return new McpError2({
|
|
391
|
+
phase,
|
|
392
|
+
reason,
|
|
393
|
+
...status === void 0 ? {} : { status },
|
|
394
|
+
...stated === void 0 ? {} : { upstream: stated },
|
|
395
|
+
...session === void 0 ? {} : { session }
|
|
396
|
+
});
|
|
397
|
+
})
|
|
398
|
+
);
|
|
399
|
+
var parseSkillLoadFailed = (error) => Schema_exports.decodeUnknownOption(SkillLoadFailed)(error).pipe(
|
|
400
|
+
Option_exports.map(
|
|
401
|
+
({ reason, message, status, missing }) => new SkillLoadFailed2({
|
|
402
|
+
reason,
|
|
403
|
+
...message ? { message } : {},
|
|
404
|
+
...status === void 0 ? {} : { status },
|
|
405
|
+
...missing === void 0 ? {} : { missing }
|
|
406
|
+
})
|
|
407
|
+
)
|
|
408
|
+
);
|
|
202
409
|
var errorName = (error) => (error.name.length > 0 ? error.name : "Error").slice(0, 128);
|
|
410
|
+
var ownCode = (error, secrets) => Predicate_exports.hasProperty(error, "code") && Schema_exports.is(FailureCode)(error.code) && error.code !== "" ? boundText(error.code, secrets, 128) : void 0;
|
|
411
|
+
var reservedFields = /* @__PURE__ */ new Set(["name", "message", "stack", "cause", "_tag"]);
|
|
412
|
+
var ownFields = (error, code, secrets) => {
|
|
413
|
+
const fields = {};
|
|
414
|
+
let count2 = 0;
|
|
415
|
+
for (const [key, value] of Object.entries(error)) {
|
|
416
|
+
if (count2 === maxFailureFields) break;
|
|
417
|
+
if (reservedFields.has(key) || key === "code" && code !== void 0) continue;
|
|
418
|
+
if (!Schema_exports.is(FailureFieldName)(key)) continue;
|
|
419
|
+
if (typeof value === "string") fields[key] = boundText(value, secrets, maxFailureFieldLength);
|
|
420
|
+
else if (typeof value === "boolean" || typeof value === "number" && Number.isFinite(value))
|
|
421
|
+
fields[key] = value;
|
|
422
|
+
else continue;
|
|
423
|
+
count2++;
|
|
424
|
+
}
|
|
425
|
+
return count2 === 0 ? void 0 : fields;
|
|
426
|
+
};
|
|
203
427
|
var ownMessage = (error) => {
|
|
204
428
|
const cause = error.cause;
|
|
205
429
|
const suffix = cause instanceof Error && cause.message.length > 0 ? ` (caused by ${errorName(cause)}: ${cause.message})` : "";
|
|
206
430
|
return error.message.length > 0 ? `${error.message}${suffix}` : void 0;
|
|
207
431
|
};
|
|
208
432
|
var describeFailure = (error) => error instanceof Error ? `${errorName(error)}: ${ownMessage(error) ?? "(no message)"}` : typeof error === "string" ? error : `A non-Error ${error === null ? "null" : typeof error} value was thrown`;
|
|
433
|
+
var openapiFailureMessage = (error) => {
|
|
434
|
+
const operation = error.operation === void 0 ? "The API request" : `${error.operation.method} ${error.operation.path}`;
|
|
435
|
+
if (error.reason === "invalid_definition")
|
|
436
|
+
return "The API's OpenAPI definition for this operation is invalid.";
|
|
437
|
+
if (error.reason === "invalid_input")
|
|
438
|
+
return error.operation === void 0 ? "The input could not be encoded as a request for this API operation." : `The input could not be encoded as a request for ${operation}.`;
|
|
439
|
+
if (error.status === void 0) return `${operation} failed before a response arrived.`;
|
|
440
|
+
const shape = [error.contentType, error.bytes === void 0 ? void 0 : `${error.bytes} bytes`].filter((part) => part !== void 0).join(", ");
|
|
441
|
+
const response = `${operation} responded with HTTP ${error.status}${shape === "" ? "" : ` (${shape})`}`;
|
|
442
|
+
return error.status >= 200 && error.status < 300 ? `${response}, but its body could not be read within the response limits.` : `${response}, which matches no error with a message in the API's OpenAPI document.`;
|
|
443
|
+
};
|
|
209
444
|
var failureDetail = (error, secrets) => {
|
|
210
|
-
if (Schema_exports.is(
|
|
445
|
+
if (Schema_exports.is(CacheError)(error))
|
|
211
446
|
return {
|
|
212
447
|
source: "storage",
|
|
213
|
-
errorName: "
|
|
448
|
+
errorName: "CacheError",
|
|
214
449
|
code: error.reason,
|
|
215
|
-
message:
|
|
450
|
+
message: error.limit === void 0 ? cacheMessages[error.reason] : cacheLimitMessages[error.limit]
|
|
216
451
|
};
|
|
217
|
-
if (Schema_exports.is(
|
|
452
|
+
if (Schema_exports.is(OpenapiError)(error))
|
|
218
453
|
return {
|
|
219
|
-
source: "
|
|
220
|
-
errorName: "
|
|
221
|
-
|
|
454
|
+
source: "service",
|
|
455
|
+
errorName: "OpenapiError",
|
|
456
|
+
code: error.reason,
|
|
457
|
+
message: boundFailureMessage(openapiFailureMessage(error), secrets)
|
|
222
458
|
};
|
|
223
|
-
if (Schema_exports.is(
|
|
459
|
+
if (Schema_exports.is(McpError)(error))
|
|
224
460
|
return {
|
|
225
|
-
source: "
|
|
226
|
-
errorName: "
|
|
227
|
-
|
|
461
|
+
source: "service",
|
|
462
|
+
errorName: "McpError",
|
|
463
|
+
code: error.reason,
|
|
464
|
+
message: mcpMessage(error)
|
|
228
465
|
};
|
|
229
|
-
if (Schema_exports.is(
|
|
466
|
+
if (Schema_exports.is(McpCredentialsUnverified)(error))
|
|
230
467
|
return {
|
|
231
468
|
source: "service",
|
|
232
|
-
errorName: "
|
|
233
|
-
code: error.reason,
|
|
234
|
-
message: error
|
|
469
|
+
errorName: "McpCredentialsUnverified",
|
|
470
|
+
code: error.anonymous === "answered" ? "anonymous_access" : error.anonymous.reason,
|
|
471
|
+
message: unverifiedMessage(error)
|
|
472
|
+
};
|
|
473
|
+
if (Schema_exports.is(OpenapiCompileError)(error))
|
|
474
|
+
return {
|
|
475
|
+
source: "app",
|
|
476
|
+
errorName: "OpenapiCompileError",
|
|
477
|
+
code: error.code,
|
|
478
|
+
message: boundFailureMessage(error.message, secrets)
|
|
479
|
+
};
|
|
480
|
+
if (Schema_exports.is(NetworkRefused)(error))
|
|
481
|
+
return {
|
|
482
|
+
source: "app",
|
|
483
|
+
errorName: "NetworkRefused",
|
|
484
|
+
code: error.refusal.reason,
|
|
485
|
+
message: boundFailureMessage(error.message, secrets)
|
|
486
|
+
};
|
|
487
|
+
if (Schema_exports.is(FetchOptionUnsupported)(error))
|
|
488
|
+
return {
|
|
489
|
+
source: "app",
|
|
490
|
+
errorName: "FetchOptionUnsupported",
|
|
491
|
+
code: error.option,
|
|
492
|
+
message: boundFailureMessage(error.message, secrets)
|
|
235
493
|
};
|
|
236
|
-
if (error instanceof Error)
|
|
494
|
+
if (error instanceof Error) {
|
|
495
|
+
const code = ownCode(error, secrets);
|
|
496
|
+
const fields = ownFields(error, code, secrets);
|
|
237
497
|
return {
|
|
238
498
|
source: "app",
|
|
239
499
|
errorName: errorName(error),
|
|
500
|
+
...code === void 0 ? {} : { code },
|
|
240
501
|
message: boundFailureMessage(
|
|
241
502
|
ownMessage(error) ?? `${errorName(error)} was thrown without a message.`,
|
|
242
503
|
secrets
|
|
243
|
-
)
|
|
504
|
+
),
|
|
505
|
+
...fields === void 0 ? {} : { fields }
|
|
244
506
|
};
|
|
507
|
+
}
|
|
245
508
|
if (typeof error === "string")
|
|
246
509
|
return { source: "app", errorName: "string", message: boundFailureMessage(error, secrets) };
|
|
247
510
|
return {
|
|
@@ -254,21 +517,11 @@ var failureDetail = (error, secrets) => {
|
|
|
254
517
|
// src/implementation/router-catalog.ts
|
|
255
518
|
var safeFailure = (error, secrets) => {
|
|
256
519
|
const provider = parseProviderError(error);
|
|
257
|
-
if (Option_exports.isSome(provider)) return provider.value;
|
|
258
|
-
const skills =
|
|
259
|
-
if (Option_exports.isSome(skills))
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
reason,
|
|
263
|
-
...message ? { message } : {},
|
|
264
|
-
...status === void 0 ? {} : { status }
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
const mcp = Schema_exports.decodeUnknownOption(McpError)(error);
|
|
268
|
-
if (Option_exports.isSome(mcp)) {
|
|
269
|
-
const { phase, reason, status } = mcp.value;
|
|
270
|
-
return new McpError({ phase, reason, ...status === void 0 ? {} : { status } });
|
|
271
|
-
}
|
|
520
|
+
if (Option_exports.isSome(provider)) return leavingProviderError(provider.value, secrets, "discover");
|
|
521
|
+
const skills = parseSkillLoadFailed(error);
|
|
522
|
+
if (Option_exports.isSome(skills)) return skills.value;
|
|
523
|
+
const mcp = parseMcpError(error, secrets);
|
|
524
|
+
if (Option_exports.isSome(mcp)) return mcp.value;
|
|
272
525
|
if (Schema_exports.is(HostDeclarationInvalid)(error)) return error;
|
|
273
526
|
return new HostEvaluationFailed(failureDetail(error, secrets));
|
|
274
527
|
};
|
|
@@ -490,17 +743,29 @@ export {
|
|
|
490
743
|
OpenapiParameter,
|
|
491
744
|
OpenapiRequestBody,
|
|
492
745
|
OpenapiOperation,
|
|
746
|
+
isOpenapiReadMethod,
|
|
493
747
|
OpenapiToolsOptions,
|
|
748
|
+
OpenapiMediaType,
|
|
494
749
|
OpenapiError,
|
|
495
750
|
defaultOpenapiResponseLimits,
|
|
751
|
+
isOpenapiJsonSequence,
|
|
496
752
|
isOpenapiTextMedia,
|
|
497
753
|
isOpenapiFileSchema,
|
|
498
754
|
openapiBinaryResultSchema,
|
|
499
755
|
openapiMediaKind,
|
|
756
|
+
OpenapiCompileErrorCode,
|
|
757
|
+
OpenapiSkippedOperation,
|
|
758
|
+
OpenapiCompileError,
|
|
759
|
+
OpenapiToolName,
|
|
760
|
+
OpenapiToolNames,
|
|
500
761
|
accountSecrets,
|
|
501
762
|
boundFailureMessage,
|
|
763
|
+
leavingProviderError,
|
|
764
|
+
parseMcpError,
|
|
765
|
+
parseSkillLoadFailed,
|
|
502
766
|
describeFailure,
|
|
503
767
|
failureDetail,
|
|
768
|
+
operationDescription,
|
|
504
769
|
fixedRouter,
|
|
505
770
|
readCatalog,
|
|
506
771
|
routerSkills
|