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
package/js/index.js
CHANGED
|
@@ -1,54 +1,62 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ResponseDecodeError,
|
|
3
3
|
ResponseStatusError,
|
|
4
|
+
base64,
|
|
5
|
+
basic,
|
|
6
|
+
bearer,
|
|
7
|
+
declarePlacements,
|
|
4
8
|
defineApp,
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
event,
|
|
10
|
+
header,
|
|
11
|
+
query,
|
|
12
|
+
t,
|
|
7
13
|
workflow
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-ZQINWV4W.js";
|
|
14
|
+
} from "./chunk-DADXWWRZ.js";
|
|
10
15
|
import {
|
|
11
16
|
dynamicRouter,
|
|
12
|
-
fromPromise,
|
|
13
17
|
mutation,
|
|
14
18
|
nativeOperation,
|
|
15
19
|
nativeRouter,
|
|
16
20
|
operationDeclaration,
|
|
17
|
-
query,
|
|
21
|
+
query as query2,
|
|
22
|
+
renameTools,
|
|
18
23
|
router,
|
|
19
24
|
routerDeclaration,
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
toolAnnotations,
|
|
26
|
+
withApproval,
|
|
27
|
+
withApprovals
|
|
28
|
+
} from "./chunk-YWFUWTUJ.js";
|
|
22
29
|
import {
|
|
23
|
-
accountProviderError
|
|
24
|
-
|
|
30
|
+
accountProviderError,
|
|
31
|
+
fromPromise
|
|
32
|
+
} from "./chunk-I5C7FD5Z.js";
|
|
25
33
|
import {
|
|
34
|
+
CacheError,
|
|
26
35
|
CalendarSchedule,
|
|
27
36
|
ElicitationFailed,
|
|
37
|
+
FetchOptionUnsupported,
|
|
28
38
|
HostedTool,
|
|
29
39
|
HostedToolSummary,
|
|
30
40
|
Interval,
|
|
41
|
+
NetworkRefused,
|
|
31
42
|
NonRetryableError,
|
|
32
43
|
OAuth2AccessToken,
|
|
33
44
|
OAuth2Config,
|
|
34
45
|
OAuth2Method,
|
|
35
46
|
Provider,
|
|
47
|
+
ProviderError,
|
|
36
48
|
ScheduleTiming,
|
|
37
49
|
SecretsMethod,
|
|
38
50
|
WorkflowFailure
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import {
|
|
42
|
-
CacheError,
|
|
43
|
-
ProviderError
|
|
44
|
-
} from "./chunk-R3EV5FTO.js";
|
|
45
|
-
import "./chunk-JU7VHODU.js";
|
|
51
|
+
} from "./chunk-6XQLA5NC.js";
|
|
52
|
+
import "./chunk-H72MEDMN.js";
|
|
46
53
|
import {
|
|
47
54
|
array,
|
|
48
55
|
boolean,
|
|
49
56
|
decoderOf,
|
|
50
|
-
|
|
57
|
+
fieldExposure,
|
|
51
58
|
importedJsonSchema,
|
|
59
|
+
isSchema,
|
|
52
60
|
json,
|
|
53
61
|
jsonSchema,
|
|
54
62
|
literal,
|
|
@@ -57,22 +65,29 @@ import {
|
|
|
57
65
|
object,
|
|
58
66
|
once,
|
|
59
67
|
parse,
|
|
68
|
+
parseDeclaration,
|
|
69
|
+
plain,
|
|
70
|
+
raw,
|
|
60
71
|
record,
|
|
61
72
|
string,
|
|
62
|
-
userId,
|
|
63
73
|
withLazyJsonSchemaDocument,
|
|
64
74
|
wrap
|
|
65
|
-
} from "./chunk-
|
|
66
|
-
import "./chunk-
|
|
75
|
+
} from "./chunk-GQ33QSNB.js";
|
|
76
|
+
import "./chunk-QWQM3CLH.js";
|
|
77
|
+
import "./chunk-PD6I2SDG.js";
|
|
78
|
+
import "./chunk-5FHWNLCI.js";
|
|
67
79
|
import {
|
|
80
|
+
DeclarationInvalid,
|
|
68
81
|
JsonObject,
|
|
69
82
|
JsonValue,
|
|
70
83
|
ValidationError
|
|
71
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-DDHBUKXX.js";
|
|
85
|
+
import "./chunk-TUMGL2OC.js";
|
|
86
|
+
import "./chunk-EOPQ727L.js";
|
|
72
87
|
import {
|
|
73
88
|
Effect_exports,
|
|
74
89
|
Schema_exports
|
|
75
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-IFJU5SYQ.js";
|
|
76
91
|
import "./chunk-CZ7CSFO4.js";
|
|
77
92
|
|
|
78
93
|
// src/implementation/http.ts
|
|
@@ -86,27 +101,50 @@ var decodeJson = (response, schema) => Effect_exports.gen(function* () {
|
|
|
86
101
|
|
|
87
102
|
// src/implementation/provider.ts
|
|
88
103
|
var secrets = (options) => new SecretsMethod(options);
|
|
89
|
-
var
|
|
104
|
+
var clientCredentials = Schema_exports.is(Schema_exports.Struct({ grant: Schema_exports.Literal("client_credentials") }));
|
|
105
|
+
var oauth2Form = (config) => {
|
|
106
|
+
const [discovered, declared, discoveredMachine, declaredMachine] = OAuth2Config.members;
|
|
107
|
+
const discovers = typeof config === "object" && config !== null && Object.hasOwn(config, "discover");
|
|
108
|
+
if (clientCredentials(config)) return discovers ? discoveredMachine : declaredMachine;
|
|
109
|
+
return discovers ? discovered : declared;
|
|
110
|
+
};
|
|
111
|
+
var oauth2 = (config, response, exposure, request) => parseDeclaration(OAuth2Config, config, "oauth2()", oauth2Form).pipe(
|
|
112
|
+
Effect_exports.map(
|
|
113
|
+
(config2) => new OAuth2Method({
|
|
114
|
+
config: config2,
|
|
115
|
+
response,
|
|
116
|
+
...exposure === void 0 ? {} : { exposure },
|
|
117
|
+
...request === void 0 ? {} : { request }
|
|
118
|
+
})
|
|
119
|
+
)
|
|
120
|
+
);
|
|
90
121
|
var defineProvider = ({
|
|
91
122
|
health,
|
|
92
123
|
...options
|
|
93
124
|
}) => {
|
|
125
|
+
const placed = Object.entries(options.auth).filter(([, method]) => method.request !== void 0);
|
|
126
|
+
if (options.hosts === void 0 && placed.length > 0)
|
|
127
|
+
throw new TypeError(
|
|
128
|
+
`Provider "${options.name}" declares a request for ${placed.map(([name]) => name).join(", ")} but no hosts. Declare the hosts its credentials may be sent to.`
|
|
129
|
+
);
|
|
94
130
|
if (health === void 0) return new Provider(options);
|
|
95
|
-
const run = fromPromise(health);
|
|
131
|
+
const run = fromPromise(health, "check");
|
|
96
132
|
return new Provider({ ...options, health: { run } });
|
|
97
133
|
};
|
|
98
134
|
|
|
99
135
|
// src/implementation/account-router.ts
|
|
100
|
-
var
|
|
101
|
-
const imported = importedJsonSchema(
|
|
136
|
+
var decoderDocument = (decoder) => {
|
|
137
|
+
const imported = importedJsonSchema(decoder);
|
|
102
138
|
if (imported !== void 0) return Schema_exports.decodeUnknownSync(JsonObject)(imported);
|
|
103
|
-
const document = Schema_exports.toJsonSchemaDocument(
|
|
139
|
+
const document = Schema_exports.toJsonSchemaDocument(decoder);
|
|
104
140
|
return Schema_exports.decodeUnknownSync(JsonObject)({ ...document.schema, $defs: document.definitions });
|
|
105
141
|
};
|
|
106
142
|
var declaresOutput = (operation) => {
|
|
143
|
+
if (operation.output !== void 0) return true;
|
|
107
144
|
const property = Object.getOwnPropertyDescriptor(operation, "outputSchema");
|
|
108
145
|
return property !== void 0 && (property.get !== void 0 || property.value !== void 0);
|
|
109
146
|
};
|
|
147
|
+
var outputDocument = (operation) => operation.output === void 0 ? operation.outputSchema : decoderDocument(operation.output);
|
|
110
148
|
var combineOperation = (accounts) => {
|
|
111
149
|
const variants = [...accounts.values()];
|
|
112
150
|
const first = variants[0];
|
|
@@ -129,7 +167,10 @@ var combineOperation = (accounts) => {
|
|
|
129
167
|
type: "object",
|
|
130
168
|
properties: {
|
|
131
169
|
accountId: { type: "string", const: accountId },
|
|
132
|
-
input: nestJsonSchema(
|
|
170
|
+
input: nestJsonSchema(
|
|
171
|
+
decoderDocument(operation.input),
|
|
172
|
+
`#/anyOf/${index}/properties/input`
|
|
173
|
+
)
|
|
133
174
|
},
|
|
134
175
|
required: ["accountId", "input"]
|
|
135
176
|
}))
|
|
@@ -159,9 +200,10 @@ var combineOperation = (accounts) => {
|
|
|
159
200
|
});
|
|
160
201
|
if (variants.every(declaresOutput)) {
|
|
161
202
|
const outputSchema = once(() => ({
|
|
162
|
-
anyOf: variants.flatMap(
|
|
163
|
-
|
|
164
|
-
|
|
203
|
+
anyOf: variants.flatMap((operation) => {
|
|
204
|
+
const output = outputDocument(operation);
|
|
205
|
+
return output === void 0 ? [] : [output];
|
|
206
|
+
}).map((output, index) => nestJsonSchema(output, `#/anyOf/${index}`))
|
|
165
207
|
}));
|
|
166
208
|
const native2 = nativeOperation(declaration2);
|
|
167
209
|
if (native2 !== void 0)
|
|
@@ -218,7 +260,7 @@ var combineDynamic = (sources) => {
|
|
|
218
260
|
);
|
|
219
261
|
for (const tool of tools) {
|
|
220
262
|
const variants = groups.get(tool.name) ?? [];
|
|
221
|
-
if (variants.some(([
|
|
263
|
+
if (variants.some(([id]) => id === accountId))
|
|
222
264
|
return yield* Effect_exports.die(new Error("Duplicate source operation"));
|
|
223
265
|
variants.push([accountId, tool]);
|
|
224
266
|
groups.set(tool.name, variants);
|
|
@@ -307,7 +349,7 @@ var accountRouter = (accounts, discover, options) => Effect_exports.runPromise(
|
|
|
307
349
|
const routers = /* @__PURE__ */ new Map();
|
|
308
350
|
for (const account of accounts) {
|
|
309
351
|
const declaration2 = yield* Effect_exports.tryPromise({
|
|
310
|
-
try: () => discover(account),
|
|
352
|
+
try: async () => discover(account),
|
|
311
353
|
catch: (error) => accountProviderError(error, account.id)
|
|
312
354
|
});
|
|
313
355
|
if (routers.has(account.id))
|
|
@@ -327,7 +369,7 @@ var accountRouter = (accounts, discover, options) => Effect_exports.runPromise(
|
|
|
327
369
|
|
|
328
370
|
// src/implementation/dynamic-skills.ts
|
|
329
371
|
var dynamicSkills = (source) => ({
|
|
330
|
-
list: fromPromise(async () => source.list())
|
|
372
|
+
list: fromPromise(async () => source.list(), "skills")
|
|
331
373
|
});
|
|
332
374
|
|
|
333
375
|
// src/contracts/app.ts
|
|
@@ -337,58 +379,102 @@ var NotImplemented = class extends Schema_exports.TaggedError()("NotImplemented"
|
|
|
337
379
|
};
|
|
338
380
|
|
|
339
381
|
// src/implementation/schedules.ts
|
|
340
|
-
var declaration = (timing, operation, input) => {
|
|
382
|
+
var declaration = (scope, timing, operation, input) => {
|
|
341
383
|
const native = nativeOperation(operation);
|
|
342
384
|
if (native === void 0 || native.kind !== "mutation")
|
|
343
385
|
throw new Error("A schedule must reference a mutation");
|
|
386
|
+
if (scope === "app" && native.approval !== void 0)
|
|
387
|
+
throw new Error("An app schedule must reference a mutation without an approval");
|
|
344
388
|
Schema_exports.decodeUnknownSync(native.input)(input);
|
|
345
|
-
return { operation, timing, input: Schema_exports.decodeUnknownSync(JsonValue)(input) };
|
|
389
|
+
return { scope, operation, timing, input: Schema_exports.decodeUnknownSync(JsonValue)(input) };
|
|
346
390
|
};
|
|
347
|
-
var
|
|
391
|
+
var intervalTiming = (duration) => {
|
|
348
392
|
const value = Schema_exports.decodeUnknownSync(Interval)(duration);
|
|
349
393
|
const milliseconds = value.seconds !== void 0 ? value.seconds * 1e3 : value.minutes !== void 0 ? value.minutes * 6e4 : value.hours * 36e5;
|
|
350
|
-
return
|
|
351
|
-
Schema_exports.decodeUnknownSync(ScheduleTiming)({ kind: "interval", milliseconds }),
|
|
352
|
-
operation,
|
|
353
|
-
input
|
|
354
|
-
);
|
|
394
|
+
return Schema_exports.decodeUnknownSync(ScheduleTiming)({ kind: "interval", milliseconds });
|
|
355
395
|
};
|
|
356
|
-
var
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
calendar
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
);
|
|
396
|
+
var cronTiming = (calendar) => ({
|
|
397
|
+
kind: "cron",
|
|
398
|
+
calendar: Schema_exports.decodeUnknownSync(CalendarSchedule)({
|
|
399
|
+
...calendar,
|
|
400
|
+
timezone: calendar.timezone ?? "UTC"
|
|
401
|
+
})
|
|
402
|
+
});
|
|
403
|
+
var userInterval = (duration, operation, input) => declaration("user", intervalTiming(duration), operation, input);
|
|
404
|
+
var userCron = (calendar, operation, input) => declaration("user", cronTiming(calendar), operation, input);
|
|
405
|
+
var appInterval = (duration, operation, input) => declaration("app", intervalTiming(duration), operation, input);
|
|
406
|
+
var appCron = (calendar, operation, input) => declaration("app", cronTiming(calendar), operation, input);
|
|
367
407
|
|
|
368
408
|
// src/index.ts
|
|
409
|
+
var isFields = (value) => typeof value === "object" && value !== null && Object.values(value).every(isSchema);
|
|
410
|
+
var accountDecoder = (schema) => (
|
|
411
|
+
// SAFETY: the brand exists only in types; secret values are strings at runtime.
|
|
412
|
+
decoderOf(schema)
|
|
413
|
+
);
|
|
414
|
+
var exposureOf = (schema) => {
|
|
415
|
+
const marked = "fields" in schema && isFields(schema.fields) ? fieldExposure(schema.fields) : {};
|
|
416
|
+
return Object.keys(marked).length === 0 ? {} : { exposure: marked };
|
|
417
|
+
};
|
|
418
|
+
var fieldNames = (schema) => "fields" in schema && isFields(schema.fields) ? Object.keys(schema.fields) : schema === OAuth2AccessToken2 ? ["access_token"] : [];
|
|
419
|
+
var placementsOf = (method, schema, request) => request === void 0 ? {} : {
|
|
420
|
+
request: declarePlacements(
|
|
421
|
+
method,
|
|
422
|
+
fieldNames(schema),
|
|
423
|
+
exposureOf(schema).exposure,
|
|
424
|
+
request
|
|
425
|
+
)
|
|
426
|
+
};
|
|
369
427
|
var OAuth2AccessToken2 = wrap(OAuth2AccessToken, false);
|
|
370
|
-
var secrets2 = (options) => secrets({
|
|
428
|
+
var secrets2 = (options) => secrets({
|
|
429
|
+
label: options.label,
|
|
430
|
+
fields: accountDecoder(options.fields),
|
|
431
|
+
...exposureOf(options.fields),
|
|
432
|
+
// SAFETY: the callback receives references named by the schema's own keys.
|
|
433
|
+
...placementsOf(
|
|
434
|
+
`"${options.label}"`,
|
|
435
|
+
options.fields,
|
|
436
|
+
options.request
|
|
437
|
+
)
|
|
438
|
+
});
|
|
371
439
|
function oauth22(options) {
|
|
372
|
-
const { response = OAuth2AccessToken2, ...config } = options;
|
|
373
|
-
return Effect_exports.runSync(
|
|
440
|
+
const { response = OAuth2AccessToken2, request, ...config } = options;
|
|
441
|
+
return Effect_exports.runSync(
|
|
442
|
+
oauth2(
|
|
443
|
+
config,
|
|
444
|
+
accountDecoder(response),
|
|
445
|
+
exposureOf(response).exposure,
|
|
446
|
+
// SAFETY: the callback receives references named by the response projection's own keys.
|
|
447
|
+
placementsOf("OAuth", response, request).request
|
|
448
|
+
)
|
|
449
|
+
);
|
|
374
450
|
}
|
|
375
451
|
var decodeJson2 = (response, schema) => {
|
|
376
452
|
const native = {
|
|
377
453
|
status: response.status,
|
|
378
|
-
json: () =>
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
454
|
+
json: () => (
|
|
455
|
+
// oxlint-disable-next-line executor/authored-code-through-adapter -- a Response the app passes from its own code
|
|
456
|
+
Effect_exports.tryPromise({
|
|
457
|
+
try: () => response.json(),
|
|
458
|
+
catch: (error) => error
|
|
459
|
+
}).pipe(
|
|
460
|
+
Effect_exports.catch(
|
|
461
|
+
(error) => error instanceof SyntaxError ? Effect_exports.fail(new ResponseDecodeError()) : Effect_exports.die(error)
|
|
462
|
+
)
|
|
384
463
|
)
|
|
385
464
|
)
|
|
386
465
|
};
|
|
387
466
|
return Effect_exports.runPromise(decodeJson(native, decoderOf(schema)));
|
|
388
467
|
};
|
|
468
|
+
function query3(first, second) {
|
|
469
|
+
if (typeof first === "string") return query(first, second);
|
|
470
|
+
return query2(...[first, second]);
|
|
471
|
+
}
|
|
389
472
|
export {
|
|
390
473
|
CacheError,
|
|
474
|
+
DeclarationInvalid,
|
|
391
475
|
ElicitationFailed,
|
|
476
|
+
FetchOptionUnsupported,
|
|
477
|
+
NetworkRefused,
|
|
392
478
|
NonRetryableError,
|
|
393
479
|
NotImplemented,
|
|
394
480
|
OAuth2AccessToken2 as OAuth2AccessToken,
|
|
@@ -398,17 +484,20 @@ export {
|
|
|
398
484
|
ValidationError,
|
|
399
485
|
WorkflowFailure,
|
|
400
486
|
accountRouter,
|
|
487
|
+
appCron,
|
|
488
|
+
appInterval,
|
|
401
489
|
array,
|
|
490
|
+
base64,
|
|
491
|
+
basic,
|
|
492
|
+
bearer,
|
|
402
493
|
boolean,
|
|
403
|
-
cron,
|
|
404
494
|
decodeJson2 as decodeJson,
|
|
405
495
|
defineApp,
|
|
406
|
-
defineDatabase,
|
|
407
496
|
defineProvider,
|
|
408
497
|
dynamicRouter,
|
|
409
498
|
dynamicSkills,
|
|
410
|
-
|
|
411
|
-
|
|
499
|
+
event,
|
|
500
|
+
header,
|
|
412
501
|
json,
|
|
413
502
|
jsonSchema,
|
|
414
503
|
literal,
|
|
@@ -416,13 +505,19 @@ export {
|
|
|
416
505
|
number,
|
|
417
506
|
oauth22 as oauth2,
|
|
418
507
|
object,
|
|
419
|
-
|
|
508
|
+
plain,
|
|
509
|
+
query3 as query,
|
|
510
|
+
raw,
|
|
420
511
|
record,
|
|
512
|
+
renameTools,
|
|
421
513
|
router,
|
|
422
514
|
secrets2 as secrets,
|
|
423
515
|
string,
|
|
424
|
-
|
|
425
|
-
|
|
516
|
+
t,
|
|
517
|
+
toolAnnotations,
|
|
518
|
+
userCron,
|
|
519
|
+
userInterval,
|
|
426
520
|
withApproval,
|
|
521
|
+
withApprovals,
|
|
427
522
|
workflow
|
|
428
523
|
};
|
package/js/mcp/effect.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mcpClientEffect,
|
|
3
|
+
mcpHealthEffect,
|
|
3
4
|
mcpToolsEffect
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-7EK2JDX4.js";
|
|
5
|
+
} from "../chunk-3LEVTFD4.js";
|
|
6
6
|
import "../chunk-BCSNKUAC.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-CDL5PM2Q.js";
|
|
7
|
+
import "../chunk-XPRZTLHD.js";
|
|
8
|
+
import "../chunk-7PHHWYV4.js";
|
|
9
|
+
import "../chunk-5MDA7MKL.js";
|
|
10
|
+
import "../chunk-YRGL4QEF.js";
|
|
11
|
+
import "../chunk-XBG7HHXC.js";
|
|
12
|
+
import "../chunk-DADXWWRZ.js";
|
|
13
|
+
import "../chunk-YWFUWTUJ.js";
|
|
14
|
+
import "../chunk-I5C7FD5Z.js";
|
|
15
|
+
import "../chunk-6XQLA5NC.js";
|
|
16
|
+
import "../chunk-H72MEDMN.js";
|
|
17
|
+
import "../chunk-GQ33QSNB.js";
|
|
18
|
+
import "../chunk-QWQM3CLH.js";
|
|
19
|
+
import "../chunk-PD6I2SDG.js";
|
|
20
|
+
import "../chunk-5FHWNLCI.js";
|
|
21
|
+
import "../chunk-DDHBUKXX.js";
|
|
22
|
+
import "../chunk-TUMGL2OC.js";
|
|
23
|
+
import "../chunk-EOPQ727L.js";
|
|
24
|
+
import "../chunk-IFJU5SYQ.js";
|
|
26
25
|
import "../chunk-CZ7CSFO4.js";
|
|
27
26
|
export {
|
|
28
27
|
mcpClientEffect,
|
|
28
|
+
mcpHealthEffect,
|
|
29
29
|
mcpToolsEffect
|
|
30
30
|
};
|
package/js/mcp.js
CHANGED
|
@@ -1,55 +1,59 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
catalogCache
|
|
6
|
-
} from "./chunk-RFVIONFX.js";
|
|
7
|
-
import {
|
|
8
|
-
adaptMcpTool
|
|
9
|
-
} from "./chunk-7EK2JDX4.js";
|
|
2
|
+
catalogCache,
|
|
3
|
+
catalogScope
|
|
4
|
+
} from "./chunk-KUCCHNVY.js";
|
|
10
5
|
import {
|
|
11
6
|
protocolOperations
|
|
12
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PYQLOLOC.js";
|
|
8
|
+
import {
|
|
9
|
+
adaptMcpTool,
|
|
10
|
+
mcpClientEffect,
|
|
11
|
+
mcpHealthEffect
|
|
12
|
+
} from "./chunk-3LEVTFD4.js";
|
|
13
13
|
import "./chunk-BCSNKUAC.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-XPRZTLHD.js";
|
|
15
15
|
import {
|
|
16
16
|
cacheKey
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-7PHHWYV4.js";
|
|
18
|
+
import {
|
|
19
|
+
operationDescription
|
|
20
|
+
} from "./chunk-5MDA7MKL.js";
|
|
21
|
+
import "./chunk-YRGL4QEF.js";
|
|
22
|
+
import "./chunk-XBG7HHXC.js";
|
|
23
|
+
import "./chunk-DADXWWRZ.js";
|
|
22
24
|
import {
|
|
23
25
|
nativeOperation,
|
|
24
26
|
routerDeclaration
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import
|
|
27
|
+
} from "./chunk-YWFUWTUJ.js";
|
|
28
|
+
import {
|
|
29
|
+
fromPromise,
|
|
30
|
+
method
|
|
31
|
+
} from "./chunk-I5C7FD5Z.js";
|
|
27
32
|
import {
|
|
33
|
+
McpCredentialsUnverified,
|
|
28
34
|
McpError,
|
|
29
35
|
McpServerHeader,
|
|
30
36
|
McpToolMetadata,
|
|
31
37
|
McpToolsOptions
|
|
32
|
-
} from "./chunk-
|
|
33
|
-
import "./chunk-
|
|
34
|
-
import "./chunk-
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-
|
|
37
|
-
import "./chunk-
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import "./chunk-27F7W2LG.js";
|
|
38
|
+
} from "./chunk-6XQLA5NC.js";
|
|
39
|
+
import "./chunk-H72MEDMN.js";
|
|
40
|
+
import "./chunk-GQ33QSNB.js";
|
|
41
|
+
import "./chunk-QWQM3CLH.js";
|
|
42
|
+
import "./chunk-PD6I2SDG.js";
|
|
43
|
+
import "./chunk-5FHWNLCI.js";
|
|
44
|
+
import "./chunk-DDHBUKXX.js";
|
|
45
|
+
import "./chunk-TUMGL2OC.js";
|
|
46
|
+
import "./chunk-EOPQ727L.js";
|
|
42
47
|
import {
|
|
43
48
|
Effect_exports,
|
|
44
49
|
Schema_exports
|
|
45
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-IFJU5SYQ.js";
|
|
46
51
|
import "./chunk-CZ7CSFO4.js";
|
|
47
52
|
|
|
48
53
|
// src/implementation/mcp-catalog.ts
|
|
49
54
|
var McpToolSummary = McpToolMetadata.mapFields(
|
|
50
55
|
({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
|
|
51
56
|
);
|
|
52
|
-
var invoke = (work) => Effect_exports.tryPromise({ try: work, catch: (error) => error });
|
|
53
57
|
var serverMeta = (server) => {
|
|
54
58
|
const title = server.title ?? server.name;
|
|
55
59
|
return {
|
|
@@ -60,20 +64,22 @@ var serverMeta = (server) => {
|
|
|
60
64
|
};
|
|
61
65
|
};
|
|
62
66
|
var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
const invalid = () => new McpError({ phase: "connect", reason: "invalid_input" });
|
|
68
|
+
const parsed = yield* Schema_exports.decodeUnknownEffect(McpToolsOptions)({
|
|
69
|
+
url: options.url,
|
|
70
|
+
accountId: options.account?.id,
|
|
71
|
+
headers: options.headers,
|
|
72
|
+
signal: options.signal,
|
|
73
|
+
timeoutMs: options.timeoutMs
|
|
74
|
+
}).pipe(Effect_exports.mapError(invalid));
|
|
75
|
+
const cache = yield* catalogScope(options, options.headers, invalid);
|
|
76
|
+
const id = yield* cacheKey({ url: parsed.url });
|
|
71
77
|
const key = ["mcp-catalog-v3", id, "current"];
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
const client = yield* mcpClientEffect(options, changed);
|
|
78
|
+
const changed = cache === void 0 ? void 0 : fromPromise(method(cache, "invalidate"), "cache")(key);
|
|
79
|
+
const client = yield* mcpClientEffect(parsed, changed);
|
|
75
80
|
const catalog = yield* catalogCache({
|
|
76
81
|
...options,
|
|
82
|
+
cache,
|
|
77
83
|
prefix: ["mcp-catalog-v3", id],
|
|
78
84
|
schema: McpToolMetadata,
|
|
79
85
|
summary: {
|
|
@@ -82,7 +88,7 @@ var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
|
|
|
82
88
|
},
|
|
83
89
|
load: (context) => (context === void 0 ? client.list : mcpClientEffect(
|
|
84
90
|
{ ...parsed, signal: context.signal },
|
|
85
|
-
|
|
91
|
+
fromPromise(method(context.cache, "invalidate"), "cache")(key)
|
|
86
92
|
).pipe(Effect_exports.flatMap((source) => source.list))).pipe(
|
|
87
93
|
Effect_exports.flatMap(
|
|
88
94
|
({ tools, server }) => Schema_exports.encodeEffect(McpServerHeader)(server).pipe(
|
|
@@ -99,12 +105,18 @@ var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
|
|
|
99
105
|
...tool.title === void 0 ? {} : { title: tool.title },
|
|
100
106
|
annotations: { ...tool.annotations, readOnlyHint: kindOf(tool) === "query" }
|
|
101
107
|
});
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
const operation = (tool) => adaptMcpTool(client, tool).pipe(
|
|
109
|
+
Effect_exports.map(
|
|
110
|
+
(adapted) => nativeOperation(
|
|
111
|
+
protocolOperations({ selected: adapted }, { selected: kindOf(tool) }).selected
|
|
112
|
+
)
|
|
113
|
+
)
|
|
114
|
+
);
|
|
115
|
+
const describe = (tool) => operation(tool).pipe(
|
|
116
|
+
Effect_exports.flatMap(
|
|
117
|
+
(selected) => selected === void 0 ? Effect_exports.succeed(void 0) : operationDescription(tool.name, "", selected)
|
|
118
|
+
)
|
|
119
|
+
);
|
|
108
120
|
const router = {
|
|
109
121
|
kind: "dynamic",
|
|
110
122
|
meta: () => catalog.header().pipe(
|
|
@@ -113,16 +125,21 @@ var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
|
|
|
113
125
|
),
|
|
114
126
|
Effect_exports.map(serverMeta)
|
|
115
127
|
),
|
|
116
|
-
list: () => catalog.list().pipe(
|
|
128
|
+
list: () => catalog.list().pipe(
|
|
129
|
+
Effect_exports.flatMap((tools) => Effect_exports.forEach(tools, describe)),
|
|
130
|
+
Effect_exports.map((tools) => tools.filter((tool) => tool !== void 0))
|
|
131
|
+
),
|
|
117
132
|
summaries: () => catalog.summaries().pipe(Effect_exports.map((tools) => tools.map(summarize))),
|
|
118
|
-
describe: (name) => catalog.resolve(name).pipe(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
133
|
+
describe: (name) => catalog.resolve(name).pipe(
|
|
134
|
+
Effect_exports.flatMap(
|
|
135
|
+
(tool) => tool === void 0 ? Effect_exports.succeed(void 0) : describe(tool)
|
|
136
|
+
)
|
|
137
|
+
),
|
|
138
|
+
resolve: (name) => catalog.resolve(name).pipe(
|
|
139
|
+
Effect_exports.flatMap(
|
|
140
|
+
(tool) => tool === void 0 ? Effect_exports.succeed(void 0) : operation(tool)
|
|
141
|
+
)
|
|
142
|
+
)
|
|
126
143
|
};
|
|
127
144
|
return routerDeclaration(router);
|
|
128
145
|
});
|
|
@@ -132,7 +149,10 @@ var mcpRouter = (options, kinds = {}) => Effect_exports.runPromise(
|
|
|
132
149
|
mcpCatalog(options, kinds),
|
|
133
150
|
options.signal === void 0 ? {} : { signal: options.signal }
|
|
134
151
|
);
|
|
152
|
+
var mcpHealth = (check, options) => Effect_exports.runPromise(mcpHealthEffect(check, options), { signal: check.signal });
|
|
135
153
|
export {
|
|
154
|
+
McpCredentialsUnverified,
|
|
136
155
|
McpError,
|
|
156
|
+
mcpHealth,
|
|
137
157
|
mcpRouter
|
|
138
158
|
};
|