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/react.js
CHANGED
|
@@ -2,11 +2,10 @@ import {
|
|
|
2
2
|
AsyncResult_exports,
|
|
3
3
|
AtomRegistry_exports,
|
|
4
4
|
queryCommitted
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-PJJ24GU7.js";
|
|
5
|
+
} from "./chunk-2XDCAXAR.js";
|
|
7
6
|
import {
|
|
8
7
|
Option_exports
|
|
9
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YFSOSNF3.js";
|
|
10
9
|
import "./chunk-CZ7CSFO4.js";
|
|
11
10
|
|
|
12
11
|
// src/react.ts
|
package/js/skills/effect.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
folderSkillsEffect,
|
|
3
3
|
skillFromFiles
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-34RH47V5.js";
|
|
5
|
+
import "../chunk-QTX7OUFH.js";
|
|
6
|
+
import "../chunk-LSOHA2RH.js";
|
|
7
|
+
import "../chunk-YVN2AMAU.js";
|
|
8
|
+
import "../chunk-MB6L5YZE.js";
|
|
9
|
+
import "../chunk-YFSOSNF3.js";
|
|
7
10
|
import "../chunk-CZ7CSFO4.js";
|
|
8
11
|
export {
|
|
9
12
|
folderSkillsEffect,
|
package/js/skills.js
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
|
-
catalogCache
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
catalogCache,
|
|
3
|
+
catalogScope
|
|
4
|
+
} from "./chunk-JIXIOWZP.js";
|
|
5
|
+
import "./chunk-DQ6FIDC3.js";
|
|
6
|
+
import {
|
|
7
|
+
failOnNetworkRefusal
|
|
8
|
+
} from "./chunk-YF7TYPDS.js";
|
|
5
9
|
import {
|
|
6
10
|
folderSkillsEffect,
|
|
7
11
|
skillFromFiles
|
|
8
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-34RH47V5.js";
|
|
13
|
+
import {
|
|
14
|
+
accountProviderError,
|
|
15
|
+
fromPromise,
|
|
16
|
+
httpProviderError,
|
|
17
|
+
method,
|
|
18
|
+
toPromise
|
|
19
|
+
} from "./chunk-RBSXSRPU.js";
|
|
9
20
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
21
|
+
NetworkRefused,
|
|
22
|
+
ProviderError,
|
|
23
|
+
networkRefusalStatus
|
|
24
|
+
} from "./chunk-7MPPHKRW.js";
|
|
13
25
|
import {
|
|
14
26
|
AppSkillMetadata,
|
|
15
27
|
AppSkillSource,
|
|
@@ -19,24 +31,30 @@ import {
|
|
|
19
31
|
SkillLoadFailed,
|
|
20
32
|
SkillServiceName,
|
|
21
33
|
skillLoadLimits
|
|
22
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-QTX7OUFH.js";
|
|
35
|
+
import {
|
|
36
|
+
wrap
|
|
37
|
+
} from "./chunk-EKXBHVMR.js";
|
|
38
|
+
import "./chunk-JH3MOQZR.js";
|
|
23
39
|
import {
|
|
24
40
|
FetchHttpClient_exports
|
|
25
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-I6QAWNUM.js";
|
|
42
|
+
import "./chunk-LSOHA2RH.js";
|
|
43
|
+
import "./chunk-H2K7OZ47.js";
|
|
44
|
+
import "./chunk-YVN2AMAU.js";
|
|
26
45
|
import {
|
|
27
46
|
HttpBody_exports,
|
|
28
47
|
HttpClient_exports
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import {
|
|
31
|
-
wrap
|
|
32
|
-
} from "./chunk-5T57N25Q.js";
|
|
33
|
-
import "./chunk-27F7W2LG.js";
|
|
48
|
+
} from "./chunk-MB6L5YZE.js";
|
|
34
49
|
import {
|
|
50
|
+
Base64_exports,
|
|
35
51
|
Effect_exports,
|
|
52
|
+
Hex_exports,
|
|
36
53
|
Ref_exports,
|
|
54
|
+
Result_exports,
|
|
37
55
|
Schema_exports,
|
|
38
56
|
Stream_exports
|
|
39
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-YFSOSNF3.js";
|
|
40
58
|
import "./chunk-CZ7CSFO4.js";
|
|
41
59
|
|
|
42
60
|
// src/implementation/inflate.ts
|
|
@@ -592,13 +610,15 @@ var describe = (service, { reason, status }) => {
|
|
|
592
610
|
};
|
|
593
611
|
var withService = (service) => (effect) => service === void 0 || !Schema_exports.is(SkillServiceName)(service) ? effect : effect.pipe(
|
|
594
612
|
Effect_exports.mapError(
|
|
595
|
-
(error) => !error.message ? new SkillLoadFailed({
|
|
613
|
+
(error) => Schema_exports.is(SkillLoadFailed)(error) && !error.message ? new SkillLoadFailed({
|
|
596
614
|
reason: error.reason,
|
|
597
615
|
message: describe(service, error),
|
|
598
|
-
...error.status === void 0 ? {} : { status: error.status }
|
|
616
|
+
...error.status === void 0 ? {} : { status: error.status },
|
|
617
|
+
...error.missing === void 0 ? {} : { missing: error.missing }
|
|
599
618
|
}) : error
|
|
600
619
|
)
|
|
601
620
|
);
|
|
621
|
+
var loaderFailure = (error, otherwise) => Schema_exports.is(SkillLoadFailed)(error) || Schema_exports.is(NetworkRefused)(error) ? error : otherwise();
|
|
602
622
|
var parse = (schema, input) => Schema_exports.decodeUnknownEffect(schema)(input).pipe(Effect_exports.mapError(() => failed("document")));
|
|
603
623
|
var resourcePath = (path) => {
|
|
604
624
|
if (!Schema_exports.is(SkillFilePath)(path)) return false;
|
|
@@ -614,23 +634,31 @@ var resourcePath = (path) => {
|
|
|
614
634
|
var pathUrl = (base, path) => new URL(path.split("/").map(encodeURIComponent).join("/"), base).href;
|
|
615
635
|
var reader = (transport) => Effect_exports.gen(function* () {
|
|
616
636
|
const budget = yield* Ref_exports.make(0);
|
|
617
|
-
const fetchBytes = (url,
|
|
637
|
+
const fetchBytes = (url, request = {}) => Effect_exports.gen(function* () {
|
|
618
638
|
const parsed = yield* Effect_exports.try({
|
|
619
639
|
try: () => new URL(url),
|
|
620
640
|
catch: () => failed("source")
|
|
621
641
|
});
|
|
622
642
|
if (!["https:", "http:"].includes(parsed.protocol) || parsed.username || parsed.password || parsed.hash)
|
|
623
643
|
return yield* failed("source");
|
|
644
|
+
const refusal = request.refused ?? ((refused) => refused);
|
|
624
645
|
const client = HttpClient_exports.withScope(yield* HttpClient_exports.HttpClient);
|
|
625
646
|
const headers = {
|
|
626
647
|
"User-Agent": "executor-skills",
|
|
627
648
|
Accept: "application/json, text/plain",
|
|
628
|
-
"Cache-Control": "no-cache"
|
|
649
|
+
"Cache-Control": "no-cache",
|
|
650
|
+
...request.headers
|
|
629
651
|
};
|
|
630
|
-
const response = yield* (
|
|
631
|
-
headers
|
|
632
|
-
body: HttpBody_exports.uint8Array(
|
|
633
|
-
})).pipe(
|
|
652
|
+
const response = yield* (request.body === void 0 ? client.get(parsed, { headers }) : client.post(parsed, {
|
|
653
|
+
headers,
|
|
654
|
+
body: HttpBody_exports.uint8Array(request.body, request.headers?.["Content-Type"])
|
|
655
|
+
})).pipe(
|
|
656
|
+
// `ctx.fetch` rejects with a network refusal; any other failed request got no answer.
|
|
657
|
+
Effect_exports.mapError(
|
|
658
|
+
(error) => Schema_exports.is(NetworkRefused)(error.cause) ? refusal(error.cause) : failed("request")
|
|
659
|
+
)
|
|
660
|
+
);
|
|
661
|
+
yield* failOnNetworkRefusal(response).pipe(Effect_exports.mapError(refusal));
|
|
634
662
|
if (response.status < 200 || response.status >= 300)
|
|
635
663
|
return yield* rejected(response.status, response.headers);
|
|
636
664
|
const chunks = [];
|
|
@@ -660,7 +688,7 @@ var reader = (transport) => Effect_exports.gen(function* () {
|
|
|
660
688
|
Effect_exports.provideService(FetchHttpClient_exports.RequestInit, { redirect: "manual" }),
|
|
661
689
|
Effect_exports.provideService(FetchHttpClient_exports.Fetch, transport.fetch ?? globalThis.fetch)
|
|
662
690
|
);
|
|
663
|
-
const read = (url) => fetchBytes(url).pipe(
|
|
691
|
+
const read = (url, request = {}) => fetchBytes(url, request).pipe(
|
|
664
692
|
Effect_exports.flatMap(
|
|
665
693
|
(result) => Effect_exports.try({
|
|
666
694
|
try: () => new TextDecoder("utf-8", { fatal: true }).decode(result),
|
|
@@ -675,39 +703,68 @@ var unreadable = () => new SkillLoadFailed({
|
|
|
675
703
|
reason: "request",
|
|
676
704
|
message: "GitHub returned a git response Executor could not read."
|
|
677
705
|
});
|
|
678
|
-
var git = (run) =>
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
706
|
+
var git = (run) => (
|
|
707
|
+
// oxlint-disable-next-line executor/authored-code-through-adapter -- this module's git parsing
|
|
708
|
+
Effect_exports.tryPromise({
|
|
709
|
+
try: async () => run(),
|
|
710
|
+
catch: (error) => error instanceof InflateLimitExceeded ? failed("limit") : unreadable()
|
|
711
|
+
})
|
|
712
|
+
);
|
|
713
|
+
var githubHosts = ["github.com", "raw.githubusercontent.com"];
|
|
714
|
+
var githubRequests = (remote, repo, token) => {
|
|
715
|
+
const refused = (host) => (refusal) => refusal.refusal.reason === "credential_host" ? new SkillLoadFailed({
|
|
716
|
+
reason: "source",
|
|
717
|
+
status: networkRefusalStatus,
|
|
718
|
+
message: `A request with the GitHub token to ${host} was refused because the account's provider does not declare that host. The provider must declare hosts ${githubHosts.join(" and ")}; reconnect an account connected with other hosts.`
|
|
719
|
+
}) : refusal;
|
|
720
|
+
const upload = (body) => remote.fetchBytes(`https://${githubHosts[0]}/${repo}.git/git-upload-pack`, {
|
|
721
|
+
body,
|
|
722
|
+
headers: {
|
|
723
|
+
...gitRequestHeaders,
|
|
724
|
+
...token === void 0 ? {} : { Authorization: `Basic ${Base64_exports.encode(`x-access-token:${token}`)}` }
|
|
725
|
+
},
|
|
726
|
+
refused: refused(githubHosts[0])
|
|
727
|
+
});
|
|
728
|
+
const file = (commit, path) => remote.read(pathUrl(`https://${githubHosts[1]}/${repo}/${commit}/`, path), {
|
|
729
|
+
...token === void 0 ? {} : { headers: { Authorization: `token ${token}` } },
|
|
730
|
+
refused: refused(githubHosts[1])
|
|
731
|
+
});
|
|
732
|
+
return { repo, authenticated: token !== void 0, upload, file };
|
|
733
|
+
};
|
|
734
|
+
var resolveCommit = (github, ref) => Effect_exports.gen(function* () {
|
|
735
|
+
const { repo } = github;
|
|
683
736
|
if (ref !== void 0 && /^[a-f0-9]{40}$/.test(ref)) return ref;
|
|
684
737
|
const names = refCandidates(ref);
|
|
685
|
-
const response = yield*
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
738
|
+
const response = yield* github.upload(lsRefsRequest(names)).pipe(
|
|
739
|
+
Effect_exports.mapError((error) => {
|
|
740
|
+
if (!Schema_exports.is(SkillLoadFailed)(error) || error.reason !== "request") return error;
|
|
741
|
+
if (!github.authenticated && (error.status === 404 || error.status === 401))
|
|
742
|
+
return new SkillLoadFailed({
|
|
743
|
+
reason: "source",
|
|
744
|
+
message: `Reading GitHub repository ${repo} without credentials returned HTTP ${error.status}: it may not exist, or it may be private. To read a private repository, pass a GitHub account and its token.`,
|
|
745
|
+
status: error.status,
|
|
746
|
+
missing: "repository"
|
|
747
|
+
});
|
|
748
|
+
if (github.authenticated && error.status === 404)
|
|
749
|
+
return new SkillLoadFailed({
|
|
750
|
+
reason: "request",
|
|
751
|
+
message: `GitHub repository ${repo} is not available with the account's token (HTTP 404). Check the repository name and that the token can read it.`,
|
|
752
|
+
status: error.status
|
|
753
|
+
});
|
|
754
|
+
return error;
|
|
755
|
+
})
|
|
697
756
|
);
|
|
698
757
|
const refs = yield* git(() => parseLsRefs(response));
|
|
699
758
|
const commit = names.map((name) => refs.get(name)).find((sha) => sha !== void 0);
|
|
700
759
|
if (commit === void 0)
|
|
701
760
|
return yield* new SkillLoadFailed({
|
|
702
761
|
reason: "source",
|
|
703
|
-
message: `GitHub repository ${repo}
|
|
762
|
+
message: `The refs read from GitHub repository ${repo} include no branch or tag named ${ref}.`,
|
|
763
|
+
missing: "ref"
|
|
704
764
|
});
|
|
705
765
|
return commit;
|
|
706
766
|
});
|
|
707
|
-
var listFiles = (
|
|
708
|
-
body: treeFetchRequest(commit),
|
|
709
|
-
headers: gitRequestHeaders
|
|
710
|
-
}).pipe(
|
|
767
|
+
var listFiles = (github, commit, path) => github.upload(treeFetchRequest(commit)).pipe(
|
|
711
768
|
Effect_exports.flatMap(
|
|
712
769
|
(response) => git(
|
|
713
770
|
() => parseTreeFetch(response, commit, path, { objectBytes: skillLoadLimits.fileBytes })
|
|
@@ -720,8 +777,8 @@ var SkillDirectories = Schema_exports.Array(
|
|
|
720
777
|
files: Schema_exports.Array(Schema_exports.Struct({ path: Schema_exports.String, mode: Schema_exports.String }))
|
|
721
778
|
})
|
|
722
779
|
);
|
|
723
|
-
var skillDirectories = (
|
|
724
|
-
const files = yield* listFiles(
|
|
780
|
+
var skillDirectories = (github, commit, path) => Effect_exports.gen(function* () {
|
|
781
|
+
const files = yield* listFiles(github, commit, path);
|
|
725
782
|
const documents = files.filter(
|
|
726
783
|
(file) => file.path === "SKILL.md" || file.path.endsWith("/SKILL.md")
|
|
727
784
|
);
|
|
@@ -733,55 +790,133 @@ var skillDirectories = (remote, repo, commit, path) => Effect_exports.gen(functi
|
|
|
733
790
|
return yield* failed("limit");
|
|
734
791
|
return directories;
|
|
735
792
|
});
|
|
736
|
-
var cachedSkillDirectories = (cache, transport,
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
793
|
+
var cachedSkillDirectories = (cache, transport, options, commit) => fromPromise(
|
|
794
|
+
method(cache, "get"),
|
|
795
|
+
"cache"
|
|
796
|
+
)({
|
|
797
|
+
key: ["apps/githubSkills/directories", 1, options.repo, commit, options.path ?? null],
|
|
798
|
+
schema: wrap(SkillDirectories, false),
|
|
799
|
+
freshFor: "7 days",
|
|
800
|
+
// Executor's own loader: the app's cache runs it natively, so only its requests are upstream.
|
|
801
|
+
load: toPromise(
|
|
802
|
+
(context) => (
|
|
803
|
+
// Keep the author's fetch and this read's token, as every other request in it does.
|
|
743
804
|
reader({ fetch: transport.fetch, signal: context.signal }).pipe(
|
|
744
|
-
Effect_exports.flatMap(
|
|
745
|
-
|
|
746
|
-
|
|
805
|
+
Effect_exports.flatMap(
|
|
806
|
+
(remote) => skillDirectories(
|
|
807
|
+
githubRequests(remote, options.repo, options.token),
|
|
808
|
+
commit,
|
|
809
|
+
options.path
|
|
810
|
+
)
|
|
811
|
+
)
|
|
812
|
+
)
|
|
813
|
+
),
|
|
814
|
+
// A cache may call the loader as a Promise; its own signal cancels that load.
|
|
815
|
+
(context) => context.signal
|
|
816
|
+
)
|
|
817
|
+
}).pipe(
|
|
818
|
+
Effect_exports.mapError(
|
|
819
|
+
(error) => loaderFailure(
|
|
820
|
+
error,
|
|
821
|
+
() => new SkillLoadFailed({
|
|
822
|
+
reason: "request",
|
|
823
|
+
message: "Executor could not read or update the app cache for skills."
|
|
824
|
+
})
|
|
747
825
|
)
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
826
|
+
)
|
|
827
|
+
);
|
|
828
|
+
var digest = (value) => (
|
|
829
|
+
// oxlint-disable-next-line executor/authored-code-through-adapter -- Web Crypto
|
|
830
|
+
Effect_exports.promise(
|
|
831
|
+
() => crypto.subtle.digest("SHA-256", new TextEncoder().encode(JSON.stringify(value)))
|
|
832
|
+
).pipe(Effect_exports.map((bytes) => Hex_exports.encode(new Uint8Array(bytes))))
|
|
833
|
+
);
|
|
834
|
+
var checked = (request) => request.pipe(
|
|
835
|
+
Effect_exports.timeoutOrElse({
|
|
836
|
+
duration: skillLoadLimits.checkMillis,
|
|
837
|
+
orElse: () => Effect_exports.fail(failed("request"))
|
|
752
838
|
})
|
|
753
|
-
|
|
754
|
-
var cachedCatalog = (options, prefix,
|
|
839
|
+
);
|
|
840
|
+
var cachedCatalog = (options, prefix, publication) => options.cache === void 0 ? publication(options, void 0).pipe(Effect_exports.flatMap((source) => source.load)) : catalogCache({
|
|
755
841
|
cache: options.cache,
|
|
756
842
|
...options.freshFor === void 0 ? {} : { freshFor: options.freshFor },
|
|
757
843
|
...options.staleFor === void 0 ? {} : { staleFor: options.staleFor },
|
|
844
|
+
stale: "revalidate",
|
|
758
845
|
prefix,
|
|
759
846
|
schema: AppSkillSource,
|
|
760
847
|
summary: { schema: AppSkillMetadata, of: ({ files: _files, ...metadata }) => metadata },
|
|
761
|
-
load: (context
|
|
848
|
+
load: (context, kept) => Effect_exports.gen(function* () {
|
|
849
|
+
const [checkedSource, keptCatalog] = yield* Effect_exports.all(
|
|
850
|
+
[
|
|
851
|
+
Effect_exports.result(
|
|
852
|
+
context === void 0 ? publication(options, options.cache) : publication({ fetch: options.fetch, signal: context.signal }, context.cache)
|
|
853
|
+
),
|
|
854
|
+
Effect_exports.result(kept ?? Effect_exports.succeed(void 0))
|
|
855
|
+
],
|
|
856
|
+
{ concurrency: "unbounded" }
|
|
857
|
+
);
|
|
858
|
+
if (Result_exports.isFailure(checkedSource)) return yield* Effect_exports.fail(checkedSource.failure);
|
|
859
|
+
const source = checkedSource.success;
|
|
860
|
+
if (source.id === void 0) return { tools: yield* source.load };
|
|
861
|
+
if (Result_exports.isFailure(keptCatalog)) return yield* Effect_exports.fail(keptCatalog.failure);
|
|
862
|
+
const previous = keptCatalog.success;
|
|
863
|
+
const tools = previous?.header?.["publication"] === source.id ? yield* previous.tools : yield* source.load;
|
|
864
|
+
return { tools, header: { publication: source.id } };
|
|
865
|
+
})
|
|
762
866
|
}).pipe(
|
|
763
867
|
Effect_exports.flatMap((catalog) => catalog.list()),
|
|
764
868
|
Effect_exports.mapError(
|
|
765
|
-
(error) =>
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
869
|
+
(error) => loaderFailure(
|
|
870
|
+
error,
|
|
871
|
+
() => new SkillLoadFailed({
|
|
872
|
+
reason: "request",
|
|
873
|
+
message: "Executor could not read or update the app cache for skills."
|
|
874
|
+
})
|
|
875
|
+
)
|
|
769
876
|
)
|
|
770
877
|
);
|
|
878
|
+
var GitHubToken = Schema_exports.String.check(Schema_exports.isPattern(/^[\x21-\x7e]+$/u));
|
|
879
|
+
var scopeMessages = {
|
|
880
|
+
"missing-account": "A GitHub token needs its account. Pass account: ctx.user.accounts.<slot> or ctx.app.accounts.<slot> with it.",
|
|
881
|
+
"unselected-account": "The GitHub account is not one of this app's selected accounts."
|
|
882
|
+
};
|
|
883
|
+
var githubCache = (options) => options.account !== void 0 && !Schema_exports.is(GitHubToken)(options.token) ? Effect_exports.fail(
|
|
884
|
+
new SkillLoadFailed({
|
|
885
|
+
reason: "source",
|
|
886
|
+
message: "The GitHub account was passed without a valid token."
|
|
887
|
+
})
|
|
888
|
+
) : catalogScope(
|
|
889
|
+
options,
|
|
890
|
+
options.token,
|
|
891
|
+
(problem) => new SkillLoadFailed({ reason: "source", message: scopeMessages[problem] })
|
|
892
|
+
);
|
|
893
|
+
var attributed = (account) => (error) => account !== void 0 && Schema_exports.is(SkillLoadFailed)(error) && error.reason === "request" && (error.status === 401 || error.status === 403) ? accountProviderError(
|
|
894
|
+
new ProviderError({
|
|
895
|
+
reason: error.status === 401 ? "unauthorized" : "rejected",
|
|
896
|
+
status: error.status
|
|
897
|
+
}),
|
|
898
|
+
account.id
|
|
899
|
+
) : error;
|
|
771
900
|
var githubSkillsEffect = (options) => Effect_exports.gen(function* () {
|
|
772
901
|
if (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(options.repo) || options.path !== void 0 && !resourcePath(options.path))
|
|
773
902
|
return yield* failed("source");
|
|
903
|
+
const cache = yield* githubCache(options);
|
|
774
904
|
return yield* cachedCatalog(
|
|
775
|
-
options,
|
|
905
|
+
cache === void 0 ? options : { ...options, cache },
|
|
776
906
|
["apps/githubSkills/catalog", 1, options.repo, options.ref ?? null, options.path ?? null],
|
|
777
|
-
(transport,
|
|
907
|
+
(transport, cache2) => githubPublication(options, transport, cache2)
|
|
778
908
|
);
|
|
779
|
-
}).pipe(withService("GitHub"));
|
|
780
|
-
var
|
|
781
|
-
const
|
|
782
|
-
const commit = yield* resolveCommit(
|
|
783
|
-
|
|
784
|
-
|
|
909
|
+
}).pipe(withService("GitHub"), Effect_exports.mapError(attributed(options.account)));
|
|
910
|
+
var githubPublication = (options, transport, cache) => Effect_exports.gen(function* () {
|
|
911
|
+
const github = githubRequests(yield* reader(transport), options.repo, options.token);
|
|
912
|
+
const commit = yield* checked(resolveCommit(github, options.ref));
|
|
913
|
+
return {
|
|
914
|
+
id: commit,
|
|
915
|
+
load: githubCatalog(options, github, commit, transport, cache)
|
|
916
|
+
};
|
|
917
|
+
});
|
|
918
|
+
var githubCatalog = (options, github, commit, transport, cache) => Effect_exports.gen(function* () {
|
|
919
|
+
const resources = yield* cache === void 0 ? skillDirectories(github, commit, options.path) : cachedSkillDirectories(cache, transport, options, commit);
|
|
785
920
|
const skills = yield* Effect_exports.forEach(
|
|
786
921
|
resources,
|
|
787
922
|
({ directory, files }) => Effect_exports.gen(function* () {
|
|
@@ -791,7 +926,7 @@ var githubCatalog = (options, transport, cache) => Effect_exports.gen(function*
|
|
|
791
926
|
const path = file.path.slice(directory.length);
|
|
792
927
|
if (!resourcePath(file.path) || !resourcePath(path) || file.mode === "120000")
|
|
793
928
|
return yield* failed("source");
|
|
794
|
-
return { path, content: yield*
|
|
929
|
+
return { path, content: yield* github.file(commit, file.path) };
|
|
795
930
|
}),
|
|
796
931
|
{ concurrency: skillLoadLimits.concurrency }
|
|
797
932
|
);
|
|
@@ -825,13 +960,17 @@ var wellKnownSkillsEffect = (options) => Effect_exports.gen(function* () {
|
|
|
825
960
|
return yield* cachedCatalog(
|
|
826
961
|
options,
|
|
827
962
|
["apps/wellKnownSkills/catalog", 1, url.href],
|
|
828
|
-
(transport) =>
|
|
963
|
+
(transport) => wellKnownPublication(url, transport)
|
|
829
964
|
);
|
|
830
965
|
}).pipe(withService(URL.canParse(options.url) ? new URL(options.url).hostname : void 0));
|
|
831
|
-
var
|
|
966
|
+
var wellKnownPublication = (url, transport) => Effect_exports.gen(function* () {
|
|
832
967
|
const remote = yield* reader(transport);
|
|
833
|
-
const first = yield* remote.read(url.href);
|
|
968
|
+
const first = yield* checked(remote.read(url.href));
|
|
834
969
|
const index = yield* parse(Schema_exports.fromJsonString(Index), first);
|
|
970
|
+
const id = index.skills.every((skill) => skill.version !== void 0) ? yield* digest(index.skills.map(({ name, version, files }) => [name, version, files])) : void 0;
|
|
971
|
+
return { id, load: wellKnownCatalog(url, remote, first, index) };
|
|
972
|
+
});
|
|
973
|
+
var wellKnownCatalog = (url, remote, first, index) => Effect_exports.gen(function* () {
|
|
835
974
|
if (index.skills.reduce((count, skill) => count + skill.files.length, 0) > skillLoadLimits.files)
|
|
836
975
|
return yield* failed("limit");
|
|
837
976
|
const skills = yield* Effect_exports.forEach(
|