apps 0.0.1-beta.14 → 0.0.1-beta.141
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 +60 -42
- package/framework-reference.json +1 -1
- package/js/{chunk-M3B3DE4K.js → chunk-2XDCAXAR.js} +612 -246
- package/js/{chunk-IPI4MFSN.js → chunk-34RH47V5.js} +2 -2
- package/js/chunk-5JBDHSLK.js +449 -0
- package/js/{chunk-KUMBKVJD.js → chunk-6QZVXLF2.js} +2 -2
- package/js/chunk-7MPPHKRW.js +5418 -0
- package/js/chunk-DQ6FIDC3.js +335 -0
- package/js/{chunk-5T57N25Q.js → chunk-EKXBHVMR.js} +697 -70
- package/js/chunk-EYZHR4UA.js +1945 -0
- package/js/chunk-GJG5G6CH.js +1022 -0
- package/js/chunk-H2K7OZ47.js +90 -0
- package/js/chunk-I6QAWNUM.js +161 -0
- package/js/{chunk-ODEIDRGW.js → chunk-JH3MOQZR.js} +1166 -504
- package/js/{chunk-QS6CAHKC.js → chunk-JHAHT26O.js} +4 -3
- package/js/{chunk-RFVIONFX.js → chunk-JIXIOWZP.js} +136 -45
- package/js/chunk-LSOHA2RH.js +88 -0
- package/js/{chunk-UK573G7W.js → chunk-MB6L5YZE.js} +1817 -632
- package/js/chunk-OBT33ZDK.js +95 -0
- package/js/{chunk-JU7VHODU.js → chunk-QTX7OUFH.js} +65 -10
- package/js/chunk-RBSXSRPU.js +175 -0
- package/js/chunk-SB2DNKDL.js +593 -0
- package/js/{chunk-VFZKSM3T.js → chunk-VX36SA7Y.js} +3 -3
- package/js/chunk-YF7TYPDS.js +49 -0
- package/js/{chunk-CDL5PM2Q.js → chunk-YFSOSNF3.js} +17265 -12477
- package/js/{chunk-IJX4CYZO.js → chunk-YVN2AMAU.js} +976 -447
- package/js/chunk-Z6DSU4VL.js +724 -0
- package/js/client.js +333 -98
- package/js/contracts.js +154 -21
- package/js/effect.js +18 -19
- package/js/graphql.js +231 -188
- package/js/host.js +138 -80
- package/js/index.js +153 -300
- package/js/mcp/effect.js +21 -21
- package/js/mcp.js +91 -57
- package/js/openapi.js +4950 -4201
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +220 -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 +9 -8
- package/js/ui/serving.js +8624 -235
- 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 +56 -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 +40 -2
- package/types/apps/src/contracts/help-text.d.ts +31 -0
- package/types/apps/src/contracts/host.d.ts +1493 -20
- 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-document.d.ts +1 -1
- package/types/apps/src/contracts/openapi.d.ts +47 -8
- 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 +513 -15
- 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/13.d.ts +6001 -0
- package/types/apps/src/contracts/protocols/2.d.ts +9 -8
- package/types/apps/src/contracts/protocols/3.d.ts +73 -15
- package/types/apps/src/contracts/protocols/4.d.ts +22 -15
- package/types/apps/src/contracts/protocols/5.d.ts +37 -11
- 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 +7114 -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 +56 -0
- package/types/apps/src/contracts/router.d.ts +2 -1
- 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/shared-catalog.d.ts +11 -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 +70 -30
- package/types/apps/src/contracts/webhooks.d.ts +24 -7
- package/types/apps/src/contracts/workflows.d.ts +56 -34
- 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 +20 -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 +16 -13
- 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/help-text.d.ts +5 -0
- 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 +33 -5
- package/types/apps/src/implementation/openapi-document.d.ts +35 -18
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-request.d.ts +2 -1
- package/types/apps/src/implementation/openapi-source.d.ts +23 -1
- package/types/apps/src/implementation/operations.d.ts +58 -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 +20 -4
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +22 -97
- package/types/apps/src/implementation/router.d.ts +26 -6
- package/types/apps/src/implementation/schedules.d.ts +39 -8
- package/types/apps/src/implementation/schema.d.ts +148 -17
- 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 +3 -3
- 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 +38 -12
- package/types/apps/src/implementation/upstream-error.d.ts +17 -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 +67 -17
- package/types/apps/src/mcp.d.ts +20 -1
- package/types/apps/src/openapi.d.ts +22 -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 -2
- 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 +3 -2
- package/types/telemetry/src/keepalive.d.ts +53 -0
- package/types/telemetry/src/layer.d.ts +10 -4
- package/types/telemetry/src/measurements.d.ts +6 -2
- 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 +32 -7
- package/types/telemetry/src/span-attributes.d.ts +22 -3
- package/types/telemetry/src/transport.d.ts +10 -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/legacy-keys.d.ts +20 -0
- package/types/utils/src/random-uuid.d.ts +6 -0
- package/types/utils/src/recorded-message.d.ts +18 -0
- package/types/utils/src/schema-definitions.d.ts +13 -0
- package/types/utils/src/user-facing-error.d.ts +83 -0
- package/js/chunk-27F7W2LG.js +0 -34
- package/js/chunk-4ASNKGCV.js +0 -242
- package/js/chunk-4DWF4ZWI.js +0 -1280
- package/js/chunk-57RKNWL2.js +0 -75
- package/js/chunk-6HSH75OI.js +0 -2688
- package/js/chunk-G4FT53I7.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-S73JGVR5.js +0 -507
- package/js/chunk-TG6DOCRO.js +0 -299
- package/js/chunk-YPKG2QO5.js +0 -209
- 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/implementation/ui-watch.d.ts +0 -2
- package/types/apps/src/mcp-stdio.d.ts +0 -5
package/js/index.js
CHANGED
|
@@ -1,78 +1,83 @@
|
|
|
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-5JBDHSLK.js";
|
|
10
15
|
import {
|
|
16
|
+
accountRouter,
|
|
11
17
|
dynamicRouter,
|
|
12
|
-
fromPromise,
|
|
13
18
|
mutation,
|
|
14
19
|
nativeOperation,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
query,
|
|
20
|
+
query as query2,
|
|
21
|
+
renameTools,
|
|
18
22
|
router,
|
|
19
|
-
|
|
20
|
-
withApproval
|
|
21
|
-
|
|
23
|
+
toolAnnotations,
|
|
24
|
+
withApproval,
|
|
25
|
+
withApprovals
|
|
26
|
+
} from "./chunk-SB2DNKDL.js";
|
|
22
27
|
import {
|
|
23
|
-
|
|
24
|
-
} from "./chunk-
|
|
28
|
+
fromPromise
|
|
29
|
+
} from "./chunk-RBSXSRPU.js";
|
|
25
30
|
import {
|
|
31
|
+
CacheError,
|
|
26
32
|
CalendarSchedule,
|
|
27
33
|
ElicitationFailed,
|
|
28
|
-
|
|
29
|
-
HostedToolSummary,
|
|
34
|
+
FetchOptionUnsupported,
|
|
30
35
|
Interval,
|
|
36
|
+
NetworkRefused,
|
|
31
37
|
NonRetryableError,
|
|
32
38
|
OAuth2AccessToken,
|
|
33
39
|
OAuth2Config,
|
|
34
40
|
OAuth2Method,
|
|
35
41
|
Provider,
|
|
42
|
+
ProviderError,
|
|
36
43
|
ScheduleTiming,
|
|
37
44
|
SecretsMethod,
|
|
38
45
|
WorkflowFailure
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import {
|
|
42
|
-
CacheError,
|
|
43
|
-
ProviderError
|
|
44
|
-
} from "./chunk-R3EV5FTO.js";
|
|
45
|
-
import "./chunk-JU7VHODU.js";
|
|
46
|
+
} from "./chunk-7MPPHKRW.js";
|
|
47
|
+
import "./chunk-QTX7OUFH.js";
|
|
46
48
|
import {
|
|
47
49
|
array,
|
|
48
50
|
boolean,
|
|
49
51
|
decoderOf,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
fieldExposure,
|
|
53
|
+
isSchema,
|
|
52
54
|
json,
|
|
53
55
|
jsonSchema,
|
|
54
56
|
literal,
|
|
55
|
-
nestJsonSchema,
|
|
56
57
|
number,
|
|
57
58
|
object,
|
|
58
|
-
once,
|
|
59
59
|
parse,
|
|
60
|
+
parseDeclaration,
|
|
61
|
+
plain,
|
|
62
|
+
raw,
|
|
60
63
|
record,
|
|
61
64
|
string,
|
|
62
|
-
userId,
|
|
63
|
-
withLazyJsonSchemaDocument,
|
|
64
65
|
wrap
|
|
65
|
-
} from "./chunk-
|
|
66
|
-
import "./chunk-
|
|
66
|
+
} from "./chunk-EKXBHVMR.js";
|
|
67
|
+
import "./chunk-JH3MOQZR.js";
|
|
68
|
+
import "./chunk-I6QAWNUM.js";
|
|
69
|
+
import "./chunk-LSOHA2RH.js";
|
|
67
70
|
import {
|
|
68
|
-
|
|
71
|
+
DeclarationInvalid,
|
|
69
72
|
JsonValue,
|
|
70
73
|
ValidationError
|
|
71
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-H2K7OZ47.js";
|
|
75
|
+
import "./chunk-YVN2AMAU.js";
|
|
76
|
+
import "./chunk-MB6L5YZE.js";
|
|
72
77
|
import {
|
|
73
78
|
Effect_exports,
|
|
74
79
|
Schema_exports
|
|
75
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-YFSOSNF3.js";
|
|
76
81
|
import "./chunk-CZ7CSFO4.js";
|
|
77
82
|
|
|
78
83
|
// src/implementation/http.ts
|
|
@@ -86,248 +91,41 @@ var decodeJson = (response, schema) => Effect_exports.gen(function* () {
|
|
|
86
91
|
|
|
87
92
|
// src/implementation/provider.ts
|
|
88
93
|
var secrets = (options) => new SecretsMethod(options);
|
|
89
|
-
var
|
|
94
|
+
var clientCredentials = Schema_exports.is(Schema_exports.Struct({ grant: Schema_exports.Literal("client_credentials") }));
|
|
95
|
+
var oauth2Form = (config) => {
|
|
96
|
+
const [discovered, declared, discoveredMachine, declaredMachine] = OAuth2Config.members;
|
|
97
|
+
const discovers = typeof config === "object" && config !== null && Object.hasOwn(config, "discover");
|
|
98
|
+
if (clientCredentials(config)) return discovers ? discoveredMachine : declaredMachine;
|
|
99
|
+
return discovers ? discovered : declared;
|
|
100
|
+
};
|
|
101
|
+
var oauth2 = (config, response, exposure, request, clientGuide) => parseDeclaration(OAuth2Config, config, "oauth2()", oauth2Form).pipe(
|
|
102
|
+
Effect_exports.map(
|
|
103
|
+
(config2) => new OAuth2Method({
|
|
104
|
+
config: config2,
|
|
105
|
+
response,
|
|
106
|
+
...exposure === void 0 ? {} : { exposure },
|
|
107
|
+
...request === void 0 ? {} : { request },
|
|
108
|
+
...clientGuide === void 0 ? {} : { clientGuide }
|
|
109
|
+
})
|
|
110
|
+
)
|
|
111
|
+
);
|
|
90
112
|
var defineProvider = ({
|
|
91
113
|
health,
|
|
92
114
|
...options
|
|
93
115
|
}) => {
|
|
116
|
+
const placed = Object.entries(options.auth).filter(([, method]) => method.request !== void 0);
|
|
117
|
+
if (options.hosts === void 0 && placed.length > 0)
|
|
118
|
+
throw new TypeError(
|
|
119
|
+
`Provider "${options.name}" declares a request for ${placed.map(([name]) => name).join(", ")} but no hosts. Declare the hosts its credentials may be sent to.`
|
|
120
|
+
);
|
|
94
121
|
if (health === void 0) return new Provider(options);
|
|
95
|
-
const run = fromPromise(health);
|
|
122
|
+
const run = fromPromise(health, "check");
|
|
96
123
|
return new Provider({ ...options, health: { run } });
|
|
97
124
|
};
|
|
98
125
|
|
|
99
|
-
// src/implementation/account-router.ts
|
|
100
|
-
var inputDocument = (operation) => {
|
|
101
|
-
const imported = importedJsonSchema(operation.input);
|
|
102
|
-
if (imported !== void 0) return Schema_exports.decodeUnknownSync(JsonObject)(imported);
|
|
103
|
-
const document = Schema_exports.toJsonSchemaDocument(operation.input);
|
|
104
|
-
return Schema_exports.decodeUnknownSync(JsonObject)({ ...document.schema, $defs: document.definitions });
|
|
105
|
-
};
|
|
106
|
-
var declaresOutput = (operation) => {
|
|
107
|
-
const property = Object.getOwnPropertyDescriptor(operation, "outputSchema");
|
|
108
|
-
return property !== void 0 && (property.get !== void 0 || property.value !== void 0);
|
|
109
|
-
};
|
|
110
|
-
var combineOperation = (accounts) => {
|
|
111
|
-
const variants = [...accounts.values()];
|
|
112
|
-
const first = variants[0];
|
|
113
|
-
if (first === void 0) throw new Error("An account operation must have at least one account");
|
|
114
|
-
const kind = variants.every((operation) => operation.kind === "query") ? "query" : "mutation";
|
|
115
|
-
const select = (input2) => {
|
|
116
|
-
const operation = accounts.get(input2.accountId);
|
|
117
|
-
if (operation === void 0)
|
|
118
|
-
throw new Error("Account selection must be decoded before execution");
|
|
119
|
-
return operation;
|
|
120
|
-
};
|
|
121
|
-
const input = Schema_exports.Union(
|
|
122
|
-
[...accounts].map(
|
|
123
|
-
([accountId, operation]) => Schema_exports.Struct({ accountId: Schema_exports.Literal(accountId), input: operation.input })
|
|
124
|
-
)
|
|
125
|
-
);
|
|
126
|
-
const inputSchema = () => ({
|
|
127
|
-
type: "object",
|
|
128
|
-
anyOf: [...accounts].map(([accountId, operation], index) => ({
|
|
129
|
-
type: "object",
|
|
130
|
-
properties: {
|
|
131
|
-
accountId: { type: "string", const: accountId },
|
|
132
|
-
input: nestJsonSchema(inputDocument(operation), `#/anyOf/${index}/properties/input`)
|
|
133
|
-
},
|
|
134
|
-
required: ["accountId", "input"]
|
|
135
|
-
}))
|
|
136
|
-
});
|
|
137
|
-
const declaration2 = operationDeclaration({
|
|
138
|
-
kind,
|
|
139
|
-
...first.description === void 0 ? {} : { description: first.description },
|
|
140
|
-
...first.title === void 0 ? {} : { title: first.title },
|
|
141
|
-
...first.annotations === void 0 || !variants.every(
|
|
142
|
-
(operation) => JSON.stringify(operation.annotations) === JSON.stringify(first.annotations)
|
|
143
|
-
) ? {} : { annotations: first.annotations },
|
|
144
|
-
...first._meta === void 0 || !variants.every((operation) => JSON.stringify(operation._meta) === JSON.stringify(first._meta)) ? {} : { _meta: first._meta },
|
|
145
|
-
input: withLazyJsonSchemaDocument(input, inputSchema),
|
|
146
|
-
approval: (context) => {
|
|
147
|
-
const operation = select(context.toolInput);
|
|
148
|
-
return operation.approval === void 0 ? Effect_exports.succeed("approved") : operation.approval({ ...context, toolInput: context.toolInput.input });
|
|
149
|
-
},
|
|
150
|
-
run: (context, input2) => {
|
|
151
|
-
const operation = select(input2);
|
|
152
|
-
return operation.run(context, input2.input).pipe(
|
|
153
|
-
Effect_exports.mapError((error) => accountProviderError(error, input2.accountId)),
|
|
154
|
-
Effect_exports.flatMap(
|
|
155
|
-
(output) => operation.output === void 0 ? Effect_exports.succeed(output) : Schema_exports.decodeUnknownEffect(operation.output)(output)
|
|
156
|
-
)
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
if (variants.every(declaresOutput)) {
|
|
161
|
-
const outputSchema = once(() => ({
|
|
162
|
-
anyOf: variants.flatMap(
|
|
163
|
-
(operation) => operation.outputSchema === void 0 ? [] : [operation.outputSchema]
|
|
164
|
-
).map((output, index) => nestJsonSchema(output, `#/anyOf/${index}`))
|
|
165
|
-
}));
|
|
166
|
-
const native2 = nativeOperation(declaration2);
|
|
167
|
-
if (native2 !== void 0)
|
|
168
|
-
Object.defineProperty(native2, "outputSchema", { enumerable: true, get: outputSchema });
|
|
169
|
-
}
|
|
170
|
-
const native = nativeOperation(declaration2);
|
|
171
|
-
if (native === void 0) throw new Error("Expected a combined operation");
|
|
172
|
-
return native;
|
|
173
|
-
};
|
|
174
|
-
var sameAcross = (key, variants) => {
|
|
175
|
-
const first = variants[0]?.[1][key];
|
|
176
|
-
return first !== void 0 && variants.every(([, tool]) => JSON.stringify(tool[key]) === JSON.stringify(first)) ? { [key]: first } : {};
|
|
177
|
-
};
|
|
178
|
-
var mergeSummary = (name, variants) => {
|
|
179
|
-
const first = variants[0]?.[1];
|
|
180
|
-
if (first === void 0) throw new Error("Expected a source operation");
|
|
181
|
-
return Schema_exports.decodeUnknownSync(HostedToolSummary)({
|
|
182
|
-
name,
|
|
183
|
-
description: first.description,
|
|
184
|
-
...first.title === void 0 ? {} : { title: first.title },
|
|
185
|
-
readOnly: variants.every(([, tool]) => tool.readOnly === true),
|
|
186
|
-
...sameAcross("annotations", variants)
|
|
187
|
-
});
|
|
188
|
-
};
|
|
189
|
-
var merge = (name, variants) => Schema_exports.decodeUnknownSync(HostedTool)({
|
|
190
|
-
...mergeSummary(name, variants),
|
|
191
|
-
inputSchema: {
|
|
192
|
-
type: "object",
|
|
193
|
-
anyOf: variants.map(([accountId, tool], index) => ({
|
|
194
|
-
type: "object",
|
|
195
|
-
properties: {
|
|
196
|
-
accountId: { type: "string", const: accountId },
|
|
197
|
-
input: nestJsonSchema(tool.inputSchema, `#/anyOf/${index}/properties/input`)
|
|
198
|
-
},
|
|
199
|
-
required: ["accountId", "input"]
|
|
200
|
-
}))
|
|
201
|
-
},
|
|
202
|
-
...variants.every(([, tool]) => tool.outputSchema !== void 0) ? {
|
|
203
|
-
outputSchema: {
|
|
204
|
-
anyOf: variants.flatMap(
|
|
205
|
-
([, tool], index) => tool.outputSchema === void 0 ? [] : [nestJsonSchema(tool.outputSchema, `#/anyOf/${index}`)]
|
|
206
|
-
)
|
|
207
|
-
}
|
|
208
|
-
} : {},
|
|
209
|
-
...sameAcross("_meta", variants)
|
|
210
|
-
});
|
|
211
|
-
var combineDynamic = (sources) => {
|
|
212
|
-
const first = [...sources.values()][0];
|
|
213
|
-
const grouped = (read) => Effect_exports.gen(function* () {
|
|
214
|
-
const groups = /* @__PURE__ */ new Map();
|
|
215
|
-
for (const [accountId, source] of sources) {
|
|
216
|
-
const tools = yield* read(source).pipe(
|
|
217
|
-
Effect_exports.mapError((error) => accountProviderError(error, accountId))
|
|
218
|
-
);
|
|
219
|
-
for (const tool of tools) {
|
|
220
|
-
const variants = groups.get(tool.name) ?? [];
|
|
221
|
-
if (variants.some(([id2]) => id2 === accountId))
|
|
222
|
-
return yield* Effect_exports.die(new Error("Duplicate source operation"));
|
|
223
|
-
variants.push([accountId, tool]);
|
|
224
|
-
groups.set(tool.name, variants);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
return groups;
|
|
228
|
-
});
|
|
229
|
-
return {
|
|
230
|
-
kind: "dynamic",
|
|
231
|
-
// Accounts share one source, so the first account describes the router.
|
|
232
|
-
...first?.meta === void 0 ? {} : { meta: first.meta },
|
|
233
|
-
...first?.overrides === void 0 ? {} : { overrides: first.overrides },
|
|
234
|
-
list: () => grouped((source) => source.list()).pipe(
|
|
235
|
-
Effect_exports.map((groups) => [...groups].map(([name, variants]) => merge(name, variants)))
|
|
236
|
-
),
|
|
237
|
-
summaries: () => grouped(
|
|
238
|
-
(source) => source.summaries === void 0 ? source.list() : source.summaries()
|
|
239
|
-
).pipe(
|
|
240
|
-
Effect_exports.map((groups) => [...groups].map(([name, variants]) => mergeSummary(name, variants)))
|
|
241
|
-
),
|
|
242
|
-
describe: (name) => Effect_exports.gen(function* () {
|
|
243
|
-
const variants = [];
|
|
244
|
-
for (const [accountId, source] of sources) {
|
|
245
|
-
const tool = yield* (source.describe === void 0 ? source.list().pipe(Effect_exports.map((tools) => tools.find((tool2) => tool2.name === name))) : source.describe(name)).pipe(Effect_exports.mapError((error) => accountProviderError(error, accountId)));
|
|
246
|
-
if (tool !== void 0) variants.push([accountId, tool]);
|
|
247
|
-
}
|
|
248
|
-
return variants.length === 0 ? void 0 : merge(name, variants);
|
|
249
|
-
}),
|
|
250
|
-
resolve: (name) => Effect_exports.gen(function* () {
|
|
251
|
-
const operations = /* @__PURE__ */ new Map();
|
|
252
|
-
for (const [accountId, source] of sources) {
|
|
253
|
-
const operation = yield* source.resolve(name).pipe(Effect_exports.mapError((error) => accountProviderError(error, accountId)));
|
|
254
|
-
if (operation !== void 0) operations.set(accountId, operation);
|
|
255
|
-
}
|
|
256
|
-
return operations.size === 0 ? void 0 : combineOperation(operations);
|
|
257
|
-
})
|
|
258
|
-
};
|
|
259
|
-
};
|
|
260
|
-
var combineNode = (variants) => {
|
|
261
|
-
const nodes = [...variants.values()];
|
|
262
|
-
const first = nodes[0];
|
|
263
|
-
if (first === void 0) throw new Error("An account operation must have at least one account");
|
|
264
|
-
switch (first.kind) {
|
|
265
|
-
case "query":
|
|
266
|
-
case "mutation":
|
|
267
|
-
return combineOperation(
|
|
268
|
-
narrow(
|
|
269
|
-
variants,
|
|
270
|
-
(node) => node.kind === "query" || node.kind === "mutation"
|
|
271
|
-
)
|
|
272
|
-
);
|
|
273
|
-
case "dynamic":
|
|
274
|
-
return combineDynamic(
|
|
275
|
-
narrow(variants, (node) => node.kind === "dynamic")
|
|
276
|
-
);
|
|
277
|
-
case "router": {
|
|
278
|
-
const routers = narrow(variants, (node) => node.kind === "router");
|
|
279
|
-
const keys = new Set([...routers.values()].flatMap((router2) => Object.keys(router2.children)));
|
|
280
|
-
return {
|
|
281
|
-
kind: "router",
|
|
282
|
-
...first.meta === void 0 ? {} : { meta: first.meta },
|
|
283
|
-
children: Object.fromEntries(
|
|
284
|
-
[...keys].map((key) => {
|
|
285
|
-
const children = /* @__PURE__ */ new Map();
|
|
286
|
-
for (const [accountId, router2] of routers) {
|
|
287
|
-
const child = Object.hasOwn(router2.children, key) ? router2.children[key] : void 0;
|
|
288
|
-
if (child !== void 0) children.set(accountId, child);
|
|
289
|
-
}
|
|
290
|
-
return [key, combineNode(children)];
|
|
291
|
-
})
|
|
292
|
-
)
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
|
-
var narrow = (variants, is) => {
|
|
298
|
-
const narrowed = /* @__PURE__ */ new Map();
|
|
299
|
-
for (const [accountId, node] of variants) {
|
|
300
|
-
if (!is(node)) throw new Error("Each account's router must have the same shape");
|
|
301
|
-
narrowed.set(accountId, node);
|
|
302
|
-
}
|
|
303
|
-
return narrowed;
|
|
304
|
-
};
|
|
305
|
-
var accountRouter = (accounts, discover, options) => Effect_exports.runPromise(
|
|
306
|
-
Effect_exports.gen(function* () {
|
|
307
|
-
const routers = /* @__PURE__ */ new Map();
|
|
308
|
-
for (const account of accounts) {
|
|
309
|
-
const declaration2 = yield* Effect_exports.tryPromise({
|
|
310
|
-
try: () => discover(account),
|
|
311
|
-
catch: (error) => accountProviderError(error, account.id)
|
|
312
|
-
});
|
|
313
|
-
if (routers.has(account.id))
|
|
314
|
-
return yield* Effect_exports.die(new Error("Account selections must be unique"));
|
|
315
|
-
const router2 = nativeRouter(declaration2);
|
|
316
|
-
if (router2 === void 0) return yield* Effect_exports.die(new Error("Expected a protocol router"));
|
|
317
|
-
routers.set(account.id, router2);
|
|
318
|
-
}
|
|
319
|
-
if (routers.size === 0) return routerDeclaration({ kind: "router", children: {} });
|
|
320
|
-
const combined = combineNode(routers);
|
|
321
|
-
if (combined.kind !== "router" && combined.kind !== "dynamic")
|
|
322
|
-
return yield* Effect_exports.die(new Error("Expected a protocol router"));
|
|
323
|
-
return routerDeclaration(combined);
|
|
324
|
-
}),
|
|
325
|
-
options
|
|
326
|
-
);
|
|
327
|
-
|
|
328
126
|
// src/implementation/dynamic-skills.ts
|
|
329
127
|
var dynamicSkills = (source) => ({
|
|
330
|
-
list: fromPromise(async () => source.list())
|
|
128
|
+
list: fromPromise(async () => source.list(), "skills")
|
|
331
129
|
});
|
|
332
130
|
|
|
333
131
|
// src/contracts/app.ts
|
|
@@ -337,58 +135,104 @@ var NotImplemented = class extends Schema_exports.TaggedError()("NotImplemented"
|
|
|
337
135
|
};
|
|
338
136
|
|
|
339
137
|
// src/implementation/schedules.ts
|
|
340
|
-
var declaration = (timing, operation, input) => {
|
|
138
|
+
var declaration = (scope, timing, operation, input) => {
|
|
341
139
|
const native = nativeOperation(operation);
|
|
342
140
|
if (native === void 0 || native.kind !== "mutation")
|
|
343
141
|
throw new Error("A schedule must reference a mutation");
|
|
142
|
+
if (scope === "app" && native.approval !== void 0)
|
|
143
|
+
throw new Error("An app schedule must reference a mutation without an approval");
|
|
344
144
|
Schema_exports.decodeUnknownSync(native.input)(input);
|
|
345
|
-
return { operation, timing, input: Schema_exports.decodeUnknownSync(JsonValue)(input) };
|
|
145
|
+
return { scope, operation, timing, input: Schema_exports.decodeUnknownSync(JsonValue)(input) };
|
|
346
146
|
};
|
|
347
|
-
var
|
|
147
|
+
var intervalTiming = (duration) => {
|
|
348
148
|
const value = Schema_exports.decodeUnknownSync(Interval)(duration);
|
|
349
149
|
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
|
-
);
|
|
150
|
+
return Schema_exports.decodeUnknownSync(ScheduleTiming)({ kind: "interval", milliseconds });
|
|
355
151
|
};
|
|
356
|
-
var
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
calendar
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
);
|
|
152
|
+
var cronTiming = (calendar) => ({
|
|
153
|
+
kind: "cron",
|
|
154
|
+
calendar: Schema_exports.decodeUnknownSync(CalendarSchedule)({
|
|
155
|
+
...calendar,
|
|
156
|
+
timezone: calendar.timezone ?? "UTC"
|
|
157
|
+
})
|
|
158
|
+
});
|
|
159
|
+
var userInterval = (duration, operation, input) => declaration("user", intervalTiming(duration), operation, input);
|
|
160
|
+
var userCron = (calendar, operation, input) => declaration("user", cronTiming(calendar), operation, input);
|
|
161
|
+
var appInterval = (duration, operation, input) => declaration("app", intervalTiming(duration), operation, input);
|
|
162
|
+
var appCron = (calendar, operation, input) => declaration("app", cronTiming(calendar), operation, input);
|
|
367
163
|
|
|
368
164
|
// src/index.ts
|
|
165
|
+
var isFields = (value) => typeof value === "object" && value !== null && Object.values(value).every(isSchema);
|
|
166
|
+
var accountDecoder = (schema) => (
|
|
167
|
+
// SAFETY: the brand exists only in types; secret values are strings at runtime.
|
|
168
|
+
decoderOf(schema)
|
|
169
|
+
);
|
|
170
|
+
var exposureOf = (schema) => {
|
|
171
|
+
const marked = "fields" in schema && isFields(schema.fields) ? fieldExposure(schema.fields) : {};
|
|
172
|
+
return Object.keys(marked).length === 0 ? {} : { exposure: marked };
|
|
173
|
+
};
|
|
174
|
+
var fieldNames = (schema) => "fields" in schema && isFields(schema.fields) ? Object.keys(schema.fields) : schema === OAuth2AccessToken2 ? ["access_token"] : [];
|
|
175
|
+
var placementsOf = (method, schema, request) => request === void 0 ? {} : {
|
|
176
|
+
request: declarePlacements(
|
|
177
|
+
method,
|
|
178
|
+
fieldNames(schema),
|
|
179
|
+
exposureOf(schema).exposure,
|
|
180
|
+
request
|
|
181
|
+
)
|
|
182
|
+
};
|
|
369
183
|
var OAuth2AccessToken2 = wrap(OAuth2AccessToken, false);
|
|
370
|
-
var secrets2 = (options) => secrets({
|
|
184
|
+
var secrets2 = (options) => secrets({
|
|
185
|
+
label: options.label,
|
|
186
|
+
...options.guide === void 0 ? {} : { guide: options.guide },
|
|
187
|
+
fields: accountDecoder(options.fields),
|
|
188
|
+
...exposureOf(options.fields),
|
|
189
|
+
// SAFETY: the callback receives references named by the schema's own keys.
|
|
190
|
+
...placementsOf(
|
|
191
|
+
`"${options.label}"`,
|
|
192
|
+
options.fields,
|
|
193
|
+
options.request
|
|
194
|
+
)
|
|
195
|
+
});
|
|
371
196
|
function oauth22(options) {
|
|
372
|
-
const { response = OAuth2AccessToken2, ...config } = options;
|
|
373
|
-
return Effect_exports.runSync(
|
|
197
|
+
const { response = OAuth2AccessToken2, request, clientGuide, ...config } = options;
|
|
198
|
+
return Effect_exports.runSync(
|
|
199
|
+
oauth2(
|
|
200
|
+
config,
|
|
201
|
+
accountDecoder(response),
|
|
202
|
+
exposureOf(response).exposure,
|
|
203
|
+
// SAFETY: the callback receives references named by the response projection's own keys.
|
|
204
|
+
placementsOf("OAuth", response, request).request,
|
|
205
|
+
clientGuide
|
|
206
|
+
)
|
|
207
|
+
);
|
|
374
208
|
}
|
|
375
209
|
var decodeJson2 = (response, schema) => {
|
|
376
210
|
const native = {
|
|
377
211
|
status: response.status,
|
|
378
|
-
json: () =>
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
212
|
+
json: () => (
|
|
213
|
+
// oxlint-disable-next-line executor/authored-code-through-adapter -- a Response the app passes from its own code
|
|
214
|
+
Effect_exports.tryPromise({
|
|
215
|
+
try: () => response.json(),
|
|
216
|
+
catch: (error) => error
|
|
217
|
+
}).pipe(
|
|
218
|
+
Effect_exports.catch(
|
|
219
|
+
(error) => error instanceof SyntaxError ? Effect_exports.fail(new ResponseDecodeError()) : Effect_exports.die(error)
|
|
220
|
+
)
|
|
384
221
|
)
|
|
385
222
|
)
|
|
386
223
|
};
|
|
387
224
|
return Effect_exports.runPromise(decodeJson(native, decoderOf(schema)));
|
|
388
225
|
};
|
|
226
|
+
function query3(first, second) {
|
|
227
|
+
if (typeof first === "string") return query(first, second);
|
|
228
|
+
return query2(...[first, second]);
|
|
229
|
+
}
|
|
389
230
|
export {
|
|
390
231
|
CacheError,
|
|
232
|
+
DeclarationInvalid,
|
|
391
233
|
ElicitationFailed,
|
|
234
|
+
FetchOptionUnsupported,
|
|
235
|
+
NetworkRefused,
|
|
392
236
|
NonRetryableError,
|
|
393
237
|
NotImplemented,
|
|
394
238
|
OAuth2AccessToken2 as OAuth2AccessToken,
|
|
@@ -398,17 +242,20 @@ export {
|
|
|
398
242
|
ValidationError,
|
|
399
243
|
WorkflowFailure,
|
|
400
244
|
accountRouter,
|
|
245
|
+
appCron,
|
|
246
|
+
appInterval,
|
|
401
247
|
array,
|
|
248
|
+
base64,
|
|
249
|
+
basic,
|
|
250
|
+
bearer,
|
|
402
251
|
boolean,
|
|
403
|
-
cron,
|
|
404
252
|
decodeJson2 as decodeJson,
|
|
405
253
|
defineApp,
|
|
406
|
-
defineDatabase,
|
|
407
254
|
defineProvider,
|
|
408
255
|
dynamicRouter,
|
|
409
256
|
dynamicSkills,
|
|
410
|
-
|
|
411
|
-
|
|
257
|
+
event,
|
|
258
|
+
header,
|
|
412
259
|
json,
|
|
413
260
|
jsonSchema,
|
|
414
261
|
literal,
|
|
@@ -416,13 +263,19 @@ export {
|
|
|
416
263
|
number,
|
|
417
264
|
oauth22 as oauth2,
|
|
418
265
|
object,
|
|
419
|
-
|
|
266
|
+
plain,
|
|
267
|
+
query3 as query,
|
|
268
|
+
raw,
|
|
420
269
|
record,
|
|
270
|
+
renameTools,
|
|
421
271
|
router,
|
|
422
272
|
secrets2 as secrets,
|
|
423
273
|
string,
|
|
424
|
-
|
|
425
|
-
|
|
274
|
+
t,
|
|
275
|
+
toolAnnotations,
|
|
276
|
+
userCron,
|
|
277
|
+
userInterval,
|
|
426
278
|
withApproval,
|
|
279
|
+
withApprovals,
|
|
427
280
|
workflow
|
|
428
281
|
};
|
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-TG6DOCRO.js";
|
|
5
|
+
} from "../chunk-Z6DSU4VL.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-EYZHR4UA.js";
|
|
8
|
+
import "../chunk-DQ6FIDC3.js";
|
|
9
|
+
import "../chunk-GJG5G6CH.js";
|
|
10
|
+
import "../chunk-YF7TYPDS.js";
|
|
11
|
+
import "../chunk-34RH47V5.js";
|
|
12
|
+
import "../chunk-5JBDHSLK.js";
|
|
13
|
+
import "../chunk-SB2DNKDL.js";
|
|
14
|
+
import "../chunk-RBSXSRPU.js";
|
|
15
|
+
import "../chunk-7MPPHKRW.js";
|
|
16
|
+
import "../chunk-QTX7OUFH.js";
|
|
17
|
+
import "../chunk-EKXBHVMR.js";
|
|
18
|
+
import "../chunk-JH3MOQZR.js";
|
|
19
|
+
import "../chunk-I6QAWNUM.js";
|
|
20
|
+
import "../chunk-LSOHA2RH.js";
|
|
21
|
+
import "../chunk-H2K7OZ47.js";
|
|
22
|
+
import "../chunk-YVN2AMAU.js";
|
|
23
|
+
import "../chunk-MB6L5YZE.js";
|
|
24
|
+
import "../chunk-YFSOSNF3.js";
|
|
26
25
|
import "../chunk-CZ7CSFO4.js";
|
|
27
26
|
export {
|
|
28
27
|
mcpClientEffect,
|
|
28
|
+
mcpHealthEffect,
|
|
29
29
|
mcpToolsEffect
|
|
30
30
|
};
|