apps 0.0.1-beta.12 → 0.0.1-beta.121
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-ODEIDRGW.js → chunk-2EEUUSL7.js} +807 -179
- package/js/chunk-3KNB4HRA.js +95 -0
- package/js/chunk-3OADIFKV.js +576 -0
- package/js/chunk-573E3S2U.js +5339 -0
- package/js/{chunk-RFVIONFX.js → chunk-5IWCEMLY.js} +136 -45
- package/js/{chunk-UK573G7W.js → chunk-5TYZML5C.js} +87 -51
- package/js/chunk-AUZGGAPP.js +449 -0
- package/js/chunk-C23S3WPT.js +175 -0
- package/js/chunk-CCJUTN55.js +88 -0
- package/js/chunk-CL3K7BJD.js +49 -0
- package/js/{chunk-5T57N25Q.js → chunk-DA6RXOMJ.js} +643 -69
- package/js/chunk-DONRL25A.js +713 -0
- package/js/{chunk-57RKNWL2.js → chunk-EAPSQBFN.js} +4 -4
- package/js/{chunk-JU7VHODU.js → chunk-EPZ3P7IX.js} +65 -10
- package/js/{chunk-YQNLXHHM.js → chunk-GU25DFBC.js} +931 -289
- package/js/{chunk-VFZKSM3T.js → chunk-KJW5IPM4.js} +3 -3
- package/js/chunk-KY4KYPUZ.js +335 -0
- package/js/{chunk-KUMBKVJD.js → chunk-MJUHAHDG.js} +2 -2
- package/js/chunk-NCOPALJZ.js +90 -0
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/chunk-OLUDW4HL.js +1016 -0
- package/js/{chunk-M3B3DE4K.js → chunk-QUFLMMTG.js} +463 -218
- package/js/{chunk-IPI4MFSN.js → chunk-SO33LZ7J.js} +2 -2
- package/js/{chunk-CDL5PM2Q.js → chunk-U2GHFWX2.js} +19257 -18404
- package/js/{chunk-WVVV4TX2.js → chunk-UPICNVJO.js} +4 -3
- package/js/{chunk-IJX4CYZO.js → chunk-VXBCDIWD.js} +228 -264
- package/js/client.js +148 -84
- package/js/contracts.js +152 -21
- package/js/effect.js +18 -19
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +231 -188
- package/js/host.js +116 -78
- package/js/index.js +150 -300
- package/js/mcp/effect.js +21 -21
- package/js/mcp.js +91 -57
- package/js/openapi.js +4357 -1415
- 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 +8618 -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/host.d.ts +1457 -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 +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/13.d.ts +6001 -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 +6870 -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 +82 -5
- 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 +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 +38 -7
- package/types/apps/src/implementation/openapi-document.d.ts +50 -20
- 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 +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 +19 -4
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +19 -94
- package/types/apps/src/implementation/router.d.ts +26 -6
- 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 +108 -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 +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 +51 -16
- 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 +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/legacy-keys.d.ts +20 -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-GPFVWWDZ.js +0 -209
- package/js/chunk-KRSCJDTW.js +0 -2668
- 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-S6YVNPFS.js +0 -224
- package/js/chunk-TYVDBQSI.js +0 -242
- package/js/chunk-Y32GRPVD.js +0 -299
- package/js/chunk-Z2QY3YTF.js +0 -507
- 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-AUZGGAPP.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-3OADIFKV.js";
|
|
22
27
|
import {
|
|
23
|
-
|
|
24
|
-
} from "./chunk-
|
|
28
|
+
fromPromise
|
|
29
|
+
} from "./chunk-C23S3WPT.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-573E3S2U.js";
|
|
47
|
+
import "./chunk-EPZ3P7IX.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-DA6RXOMJ.js";
|
|
67
|
+
import "./chunk-2EEUUSL7.js";
|
|
68
|
+
import "./chunk-EAPSQBFN.js";
|
|
69
|
+
import "./chunk-CCJUTN55.js";
|
|
67
70
|
import {
|
|
68
|
-
|
|
71
|
+
DeclarationInvalid,
|
|
69
72
|
JsonValue,
|
|
70
73
|
ValidationError
|
|
71
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-NCOPALJZ.js";
|
|
75
|
+
import "./chunk-VXBCDIWD.js";
|
|
76
|
+
import "./chunk-5TYZML5C.js";
|
|
72
77
|
import {
|
|
73
78
|
Effect_exports,
|
|
74
79
|
Schema_exports
|
|
75
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-U2GHFWX2.js";
|
|
76
81
|
import "./chunk-CZ7CSFO4.js";
|
|
77
82
|
|
|
78
83
|
// src/implementation/http.ts
|
|
@@ -86,248 +91,40 @@ 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) => 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
|
+
})
|
|
109
|
+
)
|
|
110
|
+
);
|
|
90
111
|
var defineProvider = ({
|
|
91
112
|
health,
|
|
92
113
|
...options
|
|
93
114
|
}) => {
|
|
115
|
+
const placed = Object.entries(options.auth).filter(([, method]) => method.request !== void 0);
|
|
116
|
+
if (options.hosts === void 0 && placed.length > 0)
|
|
117
|
+
throw new TypeError(
|
|
118
|
+
`Provider "${options.name}" declares a request for ${placed.map(([name]) => name).join(", ")} but no hosts. Declare the hosts its credentials may be sent to.`
|
|
119
|
+
);
|
|
94
120
|
if (health === void 0) return new Provider(options);
|
|
95
|
-
const run = fromPromise(health);
|
|
121
|
+
const run = fromPromise(health, "check");
|
|
96
122
|
return new Provider({ ...options, health: { run } });
|
|
97
123
|
};
|
|
98
124
|
|
|
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
125
|
// src/implementation/dynamic-skills.ts
|
|
329
126
|
var dynamicSkills = (source) => ({
|
|
330
|
-
list: fromPromise(async () => source.list())
|
|
127
|
+
list: fromPromise(async () => source.list(), "skills")
|
|
331
128
|
});
|
|
332
129
|
|
|
333
130
|
// src/contracts/app.ts
|
|
@@ -337,58 +134,102 @@ var NotImplemented = class extends Schema_exports.TaggedError()("NotImplemented"
|
|
|
337
134
|
};
|
|
338
135
|
|
|
339
136
|
// src/implementation/schedules.ts
|
|
340
|
-
var declaration = (timing, operation, input) => {
|
|
137
|
+
var declaration = (scope, timing, operation, input) => {
|
|
341
138
|
const native = nativeOperation(operation);
|
|
342
139
|
if (native === void 0 || native.kind !== "mutation")
|
|
343
140
|
throw new Error("A schedule must reference a mutation");
|
|
141
|
+
if (scope === "app" && native.approval !== void 0)
|
|
142
|
+
throw new Error("An app schedule must reference a mutation without an approval");
|
|
344
143
|
Schema_exports.decodeUnknownSync(native.input)(input);
|
|
345
|
-
return { operation, timing, input: Schema_exports.decodeUnknownSync(JsonValue)(input) };
|
|
144
|
+
return { scope, operation, timing, input: Schema_exports.decodeUnknownSync(JsonValue)(input) };
|
|
346
145
|
};
|
|
347
|
-
var
|
|
146
|
+
var intervalTiming = (duration) => {
|
|
348
147
|
const value = Schema_exports.decodeUnknownSync(Interval)(duration);
|
|
349
148
|
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
|
-
);
|
|
149
|
+
return Schema_exports.decodeUnknownSync(ScheduleTiming)({ kind: "interval", milliseconds });
|
|
355
150
|
};
|
|
356
|
-
var
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
calendar
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
);
|
|
151
|
+
var cronTiming = (calendar) => ({
|
|
152
|
+
kind: "cron",
|
|
153
|
+
calendar: Schema_exports.decodeUnknownSync(CalendarSchedule)({
|
|
154
|
+
...calendar,
|
|
155
|
+
timezone: calendar.timezone ?? "UTC"
|
|
156
|
+
})
|
|
157
|
+
});
|
|
158
|
+
var userInterval = (duration, operation, input) => declaration("user", intervalTiming(duration), operation, input);
|
|
159
|
+
var userCron = (calendar, operation, input) => declaration("user", cronTiming(calendar), operation, input);
|
|
160
|
+
var appInterval = (duration, operation, input) => declaration("app", intervalTiming(duration), operation, input);
|
|
161
|
+
var appCron = (calendar, operation, input) => declaration("app", cronTiming(calendar), operation, input);
|
|
367
162
|
|
|
368
163
|
// src/index.ts
|
|
164
|
+
var isFields = (value) => typeof value === "object" && value !== null && Object.values(value).every(isSchema);
|
|
165
|
+
var accountDecoder = (schema) => (
|
|
166
|
+
// SAFETY: the brand exists only in types; secret values are strings at runtime.
|
|
167
|
+
decoderOf(schema)
|
|
168
|
+
);
|
|
169
|
+
var exposureOf = (schema) => {
|
|
170
|
+
const marked = "fields" in schema && isFields(schema.fields) ? fieldExposure(schema.fields) : {};
|
|
171
|
+
return Object.keys(marked).length === 0 ? {} : { exposure: marked };
|
|
172
|
+
};
|
|
173
|
+
var fieldNames = (schema) => "fields" in schema && isFields(schema.fields) ? Object.keys(schema.fields) : schema === OAuth2AccessToken2 ? ["access_token"] : [];
|
|
174
|
+
var placementsOf = (method, schema, request) => request === void 0 ? {} : {
|
|
175
|
+
request: declarePlacements(
|
|
176
|
+
method,
|
|
177
|
+
fieldNames(schema),
|
|
178
|
+
exposureOf(schema).exposure,
|
|
179
|
+
request
|
|
180
|
+
)
|
|
181
|
+
};
|
|
369
182
|
var OAuth2AccessToken2 = wrap(OAuth2AccessToken, false);
|
|
370
|
-
var secrets2 = (options) => secrets({
|
|
183
|
+
var secrets2 = (options) => secrets({
|
|
184
|
+
label: options.label,
|
|
185
|
+
fields: accountDecoder(options.fields),
|
|
186
|
+
...exposureOf(options.fields),
|
|
187
|
+
// SAFETY: the callback receives references named by the schema's own keys.
|
|
188
|
+
...placementsOf(
|
|
189
|
+
`"${options.label}"`,
|
|
190
|
+
options.fields,
|
|
191
|
+
options.request
|
|
192
|
+
)
|
|
193
|
+
});
|
|
371
194
|
function oauth22(options) {
|
|
372
|
-
const { response = OAuth2AccessToken2, ...config } = options;
|
|
373
|
-
return Effect_exports.runSync(
|
|
195
|
+
const { response = OAuth2AccessToken2, request, ...config } = options;
|
|
196
|
+
return Effect_exports.runSync(
|
|
197
|
+
oauth2(
|
|
198
|
+
config,
|
|
199
|
+
accountDecoder(response),
|
|
200
|
+
exposureOf(response).exposure,
|
|
201
|
+
// SAFETY: the callback receives references named by the response projection's own keys.
|
|
202
|
+
placementsOf("OAuth", response, request).request
|
|
203
|
+
)
|
|
204
|
+
);
|
|
374
205
|
}
|
|
375
206
|
var decodeJson2 = (response, schema) => {
|
|
376
207
|
const native = {
|
|
377
208
|
status: response.status,
|
|
378
|
-
json: () =>
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
209
|
+
json: () => (
|
|
210
|
+
// oxlint-disable-next-line executor/authored-code-through-adapter -- a Response the app passes from its own code
|
|
211
|
+
Effect_exports.tryPromise({
|
|
212
|
+
try: () => response.json(),
|
|
213
|
+
catch: (error) => error
|
|
214
|
+
}).pipe(
|
|
215
|
+
Effect_exports.catch(
|
|
216
|
+
(error) => error instanceof SyntaxError ? Effect_exports.fail(new ResponseDecodeError()) : Effect_exports.die(error)
|
|
217
|
+
)
|
|
384
218
|
)
|
|
385
219
|
)
|
|
386
220
|
};
|
|
387
221
|
return Effect_exports.runPromise(decodeJson(native, decoderOf(schema)));
|
|
388
222
|
};
|
|
223
|
+
function query3(first, second) {
|
|
224
|
+
if (typeof first === "string") return query(first, second);
|
|
225
|
+
return query2(...[first, second]);
|
|
226
|
+
}
|
|
389
227
|
export {
|
|
390
228
|
CacheError,
|
|
229
|
+
DeclarationInvalid,
|
|
391
230
|
ElicitationFailed,
|
|
231
|
+
FetchOptionUnsupported,
|
|
232
|
+
NetworkRefused,
|
|
392
233
|
NonRetryableError,
|
|
393
234
|
NotImplemented,
|
|
394
235
|
OAuth2AccessToken2 as OAuth2AccessToken,
|
|
@@ -398,17 +239,20 @@ export {
|
|
|
398
239
|
ValidationError,
|
|
399
240
|
WorkflowFailure,
|
|
400
241
|
accountRouter,
|
|
242
|
+
appCron,
|
|
243
|
+
appInterval,
|
|
401
244
|
array,
|
|
245
|
+
base64,
|
|
246
|
+
basic,
|
|
247
|
+
bearer,
|
|
402
248
|
boolean,
|
|
403
|
-
cron,
|
|
404
249
|
decodeJson2 as decodeJson,
|
|
405
250
|
defineApp,
|
|
406
|
-
defineDatabase,
|
|
407
251
|
defineProvider,
|
|
408
252
|
dynamicRouter,
|
|
409
253
|
dynamicSkills,
|
|
410
|
-
|
|
411
|
-
|
|
254
|
+
event,
|
|
255
|
+
header,
|
|
412
256
|
json,
|
|
413
257
|
jsonSchema,
|
|
414
258
|
literal,
|
|
@@ -416,13 +260,19 @@ export {
|
|
|
416
260
|
number,
|
|
417
261
|
oauth22 as oauth2,
|
|
418
262
|
object,
|
|
419
|
-
|
|
263
|
+
plain,
|
|
264
|
+
query3 as query,
|
|
265
|
+
raw,
|
|
420
266
|
record,
|
|
267
|
+
renameTools,
|
|
421
268
|
router,
|
|
422
269
|
secrets2 as secrets,
|
|
423
270
|
string,
|
|
424
|
-
|
|
425
|
-
|
|
271
|
+
t,
|
|
272
|
+
toolAnnotations,
|
|
273
|
+
userCron,
|
|
274
|
+
userInterval,
|
|
426
275
|
withApproval,
|
|
276
|
+
withApprovals,
|
|
427
277
|
workflow
|
|
428
278
|
};
|
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-Y32GRPVD.js";
|
|
5
|
+
} from "../chunk-DONRL25A.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-GU25DFBC.js";
|
|
8
|
+
import "../chunk-KY4KYPUZ.js";
|
|
9
|
+
import "../chunk-OLUDW4HL.js";
|
|
10
|
+
import "../chunk-CL3K7BJD.js";
|
|
11
|
+
import "../chunk-SO33LZ7J.js";
|
|
12
|
+
import "../chunk-AUZGGAPP.js";
|
|
13
|
+
import "../chunk-3OADIFKV.js";
|
|
14
|
+
import "../chunk-C23S3WPT.js";
|
|
15
|
+
import "../chunk-573E3S2U.js";
|
|
16
|
+
import "../chunk-EPZ3P7IX.js";
|
|
17
|
+
import "../chunk-DA6RXOMJ.js";
|
|
18
|
+
import "../chunk-2EEUUSL7.js";
|
|
19
|
+
import "../chunk-EAPSQBFN.js";
|
|
20
|
+
import "../chunk-CCJUTN55.js";
|
|
21
|
+
import "../chunk-NCOPALJZ.js";
|
|
22
|
+
import "../chunk-VXBCDIWD.js";
|
|
23
|
+
import "../chunk-5TYZML5C.js";
|
|
24
|
+
import "../chunk-U2GHFWX2.js";
|
|
26
25
|
import "../chunk-CZ7CSFO4.js";
|
|
27
26
|
export {
|
|
28
27
|
mcpClientEffect,
|
|
28
|
+
mcpHealthEffect,
|
|
29
29
|
mcpToolsEffect
|
|
30
30
|
};
|