apps 0.0.1-beta.5 → 0.0.1-beta.55
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 +68 -44
- package/framework-reference.json +1 -1
- package/js/chunk-47F7VXST.js +221 -0
- package/js/chunk-5FHWNLCI.js +88 -0
- package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
- package/js/chunk-7UUHJR2Q.js +49 -0
- package/js/{chunk-CYYBFC2K.js → chunk-AQU56EPI.js} +9 -5
- package/js/chunk-BTSIG4NQ.js +1885 -0
- package/js/chunk-CDXQDN7W.js +92 -0
- package/js/{chunk-UK573G7W.js → chunk-EOPQ727L.js} +87 -51
- package/js/{chunk-27F7W2LG.js → chunk-H2CJWXA3.js} +2 -2
- package/js/{chunk-JU7VHODU.js → chunk-H72MEDMN.js} +65 -10
- package/js/{chunk-CDL5PM2Q.js → chunk-IFJU5SYQ.js} +19082 -18402
- package/js/{chunk-UDDE5KOR.js → chunk-JK5S2N2S.js} +148 -34
- package/js/{chunk-RJDDBDSN.js → chunk-JM7LOD2W.js} +628 -85
- package/js/{chunk-VFZKSM3T.js → chunk-JPEUKEV4.js} +3 -3
- package/js/{chunk-FWQC6I3C.js → chunk-KGCTYL2S.js} +523 -63
- package/js/{chunk-KUMBKVJD.js → chunk-KLYSEHUD.js} +2 -2
- package/js/chunk-L4K2K22P.js +42 -0
- package/js/chunk-LTDHQJ2Z.js +171 -0
- package/js/chunk-MWKHKOTL.js +240 -0
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
- package/js/chunk-PXXZ6ABC.js +266 -0
- package/js/chunk-QEBRH5AP.js +729 -0
- package/js/chunk-TLWLJ7PD.js +4342 -0
- package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
- package/js/{chunk-XHO2ZX6W.js → chunk-UM62MBJQ.js} +96 -41
- package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
- package/js/chunk-XCSG7FT7.js +340 -0
- package/js/client.js +142 -94
- package/js/contracts.js +123 -33
- package/js/effect.js +19 -21
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +63 -60
- package/js/host.js +83 -60
- package/js/index.js +262 -222
- package/js/mcp/effect.js +23 -23
- package/js/mcp/stdio.js +48 -40
- package/js/mcp.js +109 -72
- package/js/openapi.js +4129 -1419
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +208 -82
- package/js/storage/facet.js +1 -540
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +5 -4
- package/js/ui/serving.js +8517 -214
- package/package.json +2 -3
- package/runtime.json +1 -1
- package/types/app-cache/src/index.d.ts +10 -1
- package/types/apps/src/contracts/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/app.d.ts +9 -8
- package/types/apps/src/contracts/cache.d.ts +20 -0
- package/types/apps/src/contracts/context.d.ts +19 -11
- package/types/apps/src/contracts/elicitation.d.ts +6 -6
- package/types/apps/src/contracts/events.d.ts +93 -0
- package/types/apps/src/contracts/failure.d.ts +30 -1
- package/types/apps/src/contracts/graphql.d.ts +2 -1
- package/types/apps/src/contracts/host.d.ts +57 -18
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +96 -10
- package/types/apps/src/contracts/network.d.ts +84 -0
- package/types/apps/src/contracts/openapi-compile.d.ts +32 -3
- package/types/apps/src/contracts/openapi.d.ts +45 -9
- package/types/apps/src/contracts/operations.d.ts +8 -9
- 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/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 +1306 -0
- package/types/apps/src/contracts/protocols/5.d.ts +1200 -0
- 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 +2476 -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 +115 -10
- package/types/apps/src/contracts/router.d.ts +59 -0
- package/types/apps/src/contracts/skills.d.ts +50 -13
- package/types/apps/src/contracts/sql.d.ts +58 -0
- package/types/apps/src/contracts/ui.d.ts +19 -1
- package/types/apps/src/contracts/workflows.d.ts +6 -0
- package/types/apps/src/facet.d.ts +4 -5
- package/types/apps/src/graphql.d.ts +1 -3
- package/types/apps/src/host.d.ts +5 -0
- package/types/apps/src/implementation/account-router.d.ts +13 -0
- package/types/apps/src/implementation/app.d.ts +5 -4
- 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 +4 -0
- package/types/apps/src/implementation/catalog-cache.d.ts +43 -5
- package/types/apps/src/implementation/elicitation.d.ts +18 -15
- package/types/apps/src/implementation/events.d.ts +59 -0
- package/types/apps/src/implementation/failure-detail.d.ts +25 -3
- package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
- 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 +16 -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 +7 -8
- package/types/apps/src/implementation/mcp-client.d.ts +49 -25
- package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
- package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
- package/types/apps/src/implementation/mcp.d.ts +52 -25
- package/types/apps/src/implementation/network.d.ts +16 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +27 -6
- package/types/apps/src/implementation/openapi-document.d.ts +46 -19
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-request.d.ts +10 -2
- package/types/apps/src/implementation/openapi-source.d.ts +8 -6
- package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
- package/types/apps/src/implementation/operations.d.ts +43 -5
- package/types/apps/src/implementation/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
- package/types/apps/src/implementation/provider-error.d.ts +28 -1
- package/types/apps/src/implementation/provider.d.ts +19 -5
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +223 -0
- package/types/apps/src/implementation/router.d.ts +70 -0
- package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
- package/types/apps/src/implementation/schema.d.ts +95 -11
- package/types/apps/src/implementation/skills.d.ts +18 -24
- package/types/apps/src/implementation/sql.d.ts +71 -0
- package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
- package/types/apps/src/implementation/ui-auth.d.ts +1 -1
- package/types/apps/src/implementation/ui-client.d.ts +2 -2
- package/types/apps/src/implementation/ui-document.d.ts +5 -0
- package/types/apps/src/implementation/ui-errors.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +11 -5
- package/types/apps/src/implementation/ui-watch.d.ts +1 -1
- package/types/apps/src/implementation/upstream-error.d.ts +7 -0
- package/types/apps/src/implementation/webhooks.d.ts +1 -1
- package/types/apps/src/implementation/workflow-context.d.ts +1 -1
- package/types/apps/src/implementation/workflows.d.ts +1 -1
- package/types/apps/src/index.d.ts +32 -13
- package/types/apps/src/mcp-stdio.d.ts +2 -5
- package/types/apps/src/mcp.d.ts +25 -5
- package/types/apps/src/openapi.d.ts +6 -6
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +10 -8
- package/types/telemetry/src/app-records.d.ts +42 -0
- package/types/telemetry/src/browser-operations.d.ts +7 -4
- 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 +1 -0
- package/types/telemetry/src/layer.d.ts +2 -2
- package/types/telemetry/src/ownership.d.ts +56 -0
- package/types/telemetry/src/recorded-failure.d.ts +29 -0
- package/types/telemetry/src/relay.d.ts +2 -2
- package/types/telemetry/src/transport.d.ts +8 -1
- package/types/utils/src/api-error.d.ts +55 -0
- package/types/utils/src/connection-failure.d.ts +33 -0
- package/types/utils/src/recorded-message.d.ts +18 -0
- package/types/utils/src/user-facing-error.d.ts +83 -0
- package/js/chunk-3XKZDQLM.js +0 -93
- package/js/chunk-4M277YTM.js +0 -136
- package/js/chunk-67EVWIGJ.js +0 -224
- package/js/chunk-C3VAOK5B.js +0 -215
- package/js/chunk-DQAZTA4I.js +0 -2375
- package/js/chunk-G7T27IWB.js +0 -63
- package/js/chunk-LUVSFETN.js +0 -1347
- package/js/chunk-N7YDVXYJ.js +0 -186
- package/js/chunk-PJJ24GU7.js +0 -877
- package/js/chunk-PZB6T6KU.js +0 -19
- package/js/chunk-SB3V4YVR.js +0 -18
- package/js/chunk-TDNYXSIX.js +0 -29
- package/js/chunk-W4DMKWAB.js +0 -35
- package/js/chunk-YEPYT6SD.js +0 -85
- package/js/chunk-ZQINWV4W.js +0 -630
- 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/dynamic-tools.d.ts +0 -13
- package/types/apps/src/contracts/storage.d.ts +0 -68
- package/types/apps/src/implementation/account-operations.d.ts +0 -151
- package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
- package/types/apps/src/implementation/storage.d.ts +0 -15
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-74YVXBKY.js";
|
|
7
6
|
import {
|
|
8
7
|
Option_exports
|
|
9
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-IFJU5SYQ.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-XBG7HHXC.js";
|
|
5
|
+
import "../chunk-H72MEDMN.js";
|
|
6
|
+
import "../chunk-5FHWNLCI.js";
|
|
7
|
+
import "../chunk-TUMGL2OC.js";
|
|
8
|
+
import "../chunk-EOPQ727L.js";
|
|
9
|
+
import "../chunk-IFJU5SYQ.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-UM62MBJQ.js";
|
|
5
|
+
import "./chunk-AQU56EPI.js";
|
|
6
|
+
import {
|
|
7
|
+
failOnNetworkRefusal
|
|
8
|
+
} from "./chunk-7UUHJR2Q.js";
|
|
5
9
|
import {
|
|
6
10
|
folderSkillsEffect,
|
|
7
11
|
skillFromFiles
|
|
8
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XBG7HHXC.js";
|
|
13
|
+
import {
|
|
14
|
+
accountProviderError,
|
|
15
|
+
fromPromise,
|
|
16
|
+
httpProviderError,
|
|
17
|
+
method,
|
|
18
|
+
toPromise
|
|
19
|
+
} from "./chunk-LTDHQJ2Z.js";
|
|
9
20
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
21
|
+
NetworkRefused,
|
|
22
|
+
ProviderError,
|
|
23
|
+
networkRefusalStatus
|
|
24
|
+
} from "./chunk-MWKHKOTL.js";
|
|
13
25
|
import {
|
|
14
26
|
AppSkillMetadata,
|
|
15
27
|
AppSkillSource,
|
|
@@ -19,25 +31,29 @@ import {
|
|
|
19
31
|
SkillLoadFailed,
|
|
20
32
|
SkillServiceName,
|
|
21
33
|
skillLoadLimits
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import
|
|
34
|
+
} from "./chunk-H72MEDMN.js";
|
|
35
|
+
import {
|
|
36
|
+
wrap
|
|
37
|
+
} from "./chunk-KGCTYL2S.js";
|
|
38
|
+
import "./chunk-JM7LOD2W.js";
|
|
24
39
|
import {
|
|
25
40
|
FetchHttpClient_exports
|
|
26
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-PD6I2SDG.js";
|
|
42
|
+
import "./chunk-5FHWNLCI.js";
|
|
43
|
+
import "./chunk-H2CJWXA3.js";
|
|
44
|
+
import "./chunk-TUMGL2OC.js";
|
|
27
45
|
import {
|
|
28
46
|
HttpBody_exports,
|
|
29
47
|
HttpClient_exports
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import {
|
|
32
|
-
wrap
|
|
33
|
-
} from "./chunk-FWQC6I3C.js";
|
|
34
|
-
import "./chunk-27F7W2LG.js";
|
|
48
|
+
} from "./chunk-EOPQ727L.js";
|
|
35
49
|
import {
|
|
50
|
+
Base64_exports,
|
|
36
51
|
Effect_exports,
|
|
52
|
+
Hex_exports,
|
|
37
53
|
Ref_exports,
|
|
38
54
|
Schema_exports,
|
|
39
55
|
Stream_exports
|
|
40
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-IFJU5SYQ.js";
|
|
41
57
|
import "./chunk-CZ7CSFO4.js";
|
|
42
58
|
|
|
43
59
|
// src/implementation/inflate.ts
|
|
@@ -593,13 +609,15 @@ var describe = (service, { reason, status }) => {
|
|
|
593
609
|
};
|
|
594
610
|
var withService = (service) => (effect) => service === void 0 || !Schema_exports.is(SkillServiceName)(service) ? effect : effect.pipe(
|
|
595
611
|
Effect_exports.mapError(
|
|
596
|
-
(error) => !error.message ? new SkillLoadFailed({
|
|
612
|
+
(error) => Schema_exports.is(SkillLoadFailed)(error) && !error.message ? new SkillLoadFailed({
|
|
597
613
|
reason: error.reason,
|
|
598
614
|
message: describe(service, error),
|
|
599
|
-
...error.status === void 0 ? {} : { status: error.status }
|
|
615
|
+
...error.status === void 0 ? {} : { status: error.status },
|
|
616
|
+
...error.missing === void 0 ? {} : { missing: error.missing }
|
|
600
617
|
}) : error
|
|
601
618
|
)
|
|
602
619
|
);
|
|
620
|
+
var loaderFailure = (error, otherwise) => Schema_exports.is(SkillLoadFailed)(error) || Schema_exports.is(NetworkRefused)(error) ? error : otherwise();
|
|
603
621
|
var parse = (schema, input) => Schema_exports.decodeUnknownEffect(schema)(input).pipe(Effect_exports.mapError(() => failed("document")));
|
|
604
622
|
var resourcePath = (path) => {
|
|
605
623
|
if (!Schema_exports.is(SkillFilePath)(path)) return false;
|
|
@@ -615,23 +633,31 @@ var resourcePath = (path) => {
|
|
|
615
633
|
var pathUrl = (base, path) => new URL(path.split("/").map(encodeURIComponent).join("/"), base).href;
|
|
616
634
|
var reader = (transport) => Effect_exports.gen(function* () {
|
|
617
635
|
const budget = yield* Ref_exports.make(0);
|
|
618
|
-
const fetchBytes = (url,
|
|
636
|
+
const fetchBytes = (url, request = {}) => Effect_exports.gen(function* () {
|
|
619
637
|
const parsed = yield* Effect_exports.try({
|
|
620
638
|
try: () => new URL(url),
|
|
621
639
|
catch: () => failed("source")
|
|
622
640
|
});
|
|
623
641
|
if (!["https:", "http:"].includes(parsed.protocol) || parsed.username || parsed.password || parsed.hash)
|
|
624
642
|
return yield* failed("source");
|
|
643
|
+
const refusal = request.refused ?? ((refused) => refused);
|
|
625
644
|
const client = HttpClient_exports.withScope(yield* HttpClient_exports.HttpClient);
|
|
626
645
|
const headers = {
|
|
627
646
|
"User-Agent": "executor-skills",
|
|
628
647
|
Accept: "application/json, text/plain",
|
|
629
|
-
"Cache-Control": "no-cache"
|
|
648
|
+
"Cache-Control": "no-cache",
|
|
649
|
+
...request.headers
|
|
630
650
|
};
|
|
631
|
-
const response = yield* (
|
|
632
|
-
headers
|
|
633
|
-
body: HttpBody_exports.uint8Array(
|
|
634
|
-
})).pipe(
|
|
651
|
+
const response = yield* (request.body === void 0 ? client.get(parsed, { headers }) : client.post(parsed, {
|
|
652
|
+
headers,
|
|
653
|
+
body: HttpBody_exports.uint8Array(request.body, request.headers?.["Content-Type"])
|
|
654
|
+
})).pipe(
|
|
655
|
+
// `ctx.fetch` rejects with a network refusal; any other failed request got no answer.
|
|
656
|
+
Effect_exports.mapError(
|
|
657
|
+
(error) => Schema_exports.is(NetworkRefused)(error.cause) ? refusal(error.cause) : failed("request")
|
|
658
|
+
)
|
|
659
|
+
);
|
|
660
|
+
yield* failOnNetworkRefusal(response).pipe(Effect_exports.mapError(refusal));
|
|
635
661
|
if (response.status < 200 || response.status >= 300)
|
|
636
662
|
return yield* rejected(response.status, response.headers);
|
|
637
663
|
const chunks = [];
|
|
@@ -661,7 +687,7 @@ var reader = (transport) => Effect_exports.gen(function* () {
|
|
|
661
687
|
Effect_exports.provideService(FetchHttpClient_exports.RequestInit, { redirect: "manual" }),
|
|
662
688
|
Effect_exports.provideService(FetchHttpClient_exports.Fetch, transport.fetch ?? globalThis.fetch)
|
|
663
689
|
);
|
|
664
|
-
const read = (url) => fetchBytes(url).pipe(
|
|
690
|
+
const read = (url, request = {}) => fetchBytes(url, request).pipe(
|
|
665
691
|
Effect_exports.flatMap(
|
|
666
692
|
(result) => Effect_exports.try({
|
|
667
693
|
try: () => new TextDecoder("utf-8", { fatal: true }).decode(result),
|
|
@@ -676,39 +702,68 @@ var unreadable = () => new SkillLoadFailed({
|
|
|
676
702
|
reason: "request",
|
|
677
703
|
message: "GitHub returned a git response Executor could not read."
|
|
678
704
|
});
|
|
679
|
-
var git = (run) =>
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
705
|
+
var git = (run) => (
|
|
706
|
+
// oxlint-disable-next-line executor/authored-code-through-adapter -- this module's git parsing
|
|
707
|
+
Effect_exports.tryPromise({
|
|
708
|
+
try: async () => run(),
|
|
709
|
+
catch: (error) => error instanceof InflateLimitExceeded ? failed("limit") : unreadable()
|
|
710
|
+
})
|
|
711
|
+
);
|
|
712
|
+
var githubHosts = ["github.com", "raw.githubusercontent.com"];
|
|
713
|
+
var githubRequests = (remote, repo, token) => {
|
|
714
|
+
const refused = (host) => (refusal) => refusal.refusal.reason === "credential_host" ? new SkillLoadFailed({
|
|
715
|
+
reason: "source",
|
|
716
|
+
status: networkRefusalStatus,
|
|
717
|
+
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.`
|
|
718
|
+
}) : refusal;
|
|
719
|
+
const upload = (body) => remote.fetchBytes(`https://${githubHosts[0]}/${repo}.git/git-upload-pack`, {
|
|
720
|
+
body,
|
|
721
|
+
headers: {
|
|
722
|
+
...gitRequestHeaders,
|
|
723
|
+
...token === void 0 ? {} : { Authorization: `Basic ${Base64_exports.encode(`x-access-token:${token}`)}` }
|
|
724
|
+
},
|
|
725
|
+
refused: refused(githubHosts[0])
|
|
726
|
+
});
|
|
727
|
+
const file = (commit, path) => remote.read(pathUrl(`https://${githubHosts[1]}/${repo}/${commit}/`, path), {
|
|
728
|
+
...token === void 0 ? {} : { headers: { Authorization: `token ${token}` } },
|
|
729
|
+
refused: refused(githubHosts[1])
|
|
730
|
+
});
|
|
731
|
+
return { repo, authenticated: token !== void 0, upload, file };
|
|
732
|
+
};
|
|
733
|
+
var resolveCommit = (github, ref) => Effect_exports.gen(function* () {
|
|
734
|
+
const { repo } = github;
|
|
684
735
|
if (ref !== void 0 && /^[a-f0-9]{40}$/.test(ref)) return ref;
|
|
685
736
|
const names = refCandidates(ref);
|
|
686
|
-
const response = yield*
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
737
|
+
const response = yield* github.upload(lsRefsRequest(names)).pipe(
|
|
738
|
+
Effect_exports.mapError((error) => {
|
|
739
|
+
if (!Schema_exports.is(SkillLoadFailed)(error) || error.reason !== "request") return error;
|
|
740
|
+
if (!github.authenticated && (error.status === 404 || error.status === 401))
|
|
741
|
+
return new SkillLoadFailed({
|
|
742
|
+
reason: "source",
|
|
743
|
+
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.`,
|
|
744
|
+
status: error.status,
|
|
745
|
+
missing: "repository"
|
|
746
|
+
});
|
|
747
|
+
if (github.authenticated && error.status === 404)
|
|
748
|
+
return new SkillLoadFailed({
|
|
749
|
+
reason: "request",
|
|
750
|
+
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.`,
|
|
751
|
+
status: error.status
|
|
752
|
+
});
|
|
753
|
+
return error;
|
|
754
|
+
})
|
|
698
755
|
);
|
|
699
756
|
const refs = yield* git(() => parseLsRefs(response));
|
|
700
757
|
const commit = names.map((name) => refs.get(name)).find((sha) => sha !== void 0);
|
|
701
758
|
if (commit === void 0)
|
|
702
759
|
return yield* new SkillLoadFailed({
|
|
703
760
|
reason: "source",
|
|
704
|
-
message: `GitHub repository ${repo}
|
|
761
|
+
message: `The refs read from GitHub repository ${repo} include no branch or tag named ${ref}.`,
|
|
762
|
+
missing: "ref"
|
|
705
763
|
});
|
|
706
764
|
return commit;
|
|
707
765
|
});
|
|
708
|
-
var listFiles = (
|
|
709
|
-
body: treeFetchRequest(commit),
|
|
710
|
-
headers: gitRequestHeaders
|
|
711
|
-
}).pipe(
|
|
766
|
+
var listFiles = (github, commit, path) => github.upload(treeFetchRequest(commit)).pipe(
|
|
712
767
|
Effect_exports.flatMap(
|
|
713
768
|
(response) => git(
|
|
714
769
|
() => parseTreeFetch(response, commit, path, { objectBytes: skillLoadLimits.fileBytes })
|
|
@@ -721,8 +776,8 @@ var SkillDirectories = Schema_exports.Array(
|
|
|
721
776
|
files: Schema_exports.Array(Schema_exports.Struct({ path: Schema_exports.String, mode: Schema_exports.String }))
|
|
722
777
|
})
|
|
723
778
|
);
|
|
724
|
-
var skillDirectories = (
|
|
725
|
-
const files = yield* listFiles(
|
|
779
|
+
var skillDirectories = (github, commit, path) => Effect_exports.gen(function* () {
|
|
780
|
+
const files = yield* listFiles(github, commit, path);
|
|
726
781
|
const documents = files.filter(
|
|
727
782
|
(file) => file.path === "SKILL.md" || file.path.endsWith("/SKILL.md")
|
|
728
783
|
);
|
|
@@ -734,55 +789,122 @@ var skillDirectories = (remote, repo, commit, path) => Effect_exports.gen(functi
|
|
|
734
789
|
return yield* failed("limit");
|
|
735
790
|
return directories;
|
|
736
791
|
});
|
|
737
|
-
var cachedSkillDirectories = (cache, transport,
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
792
|
+
var cachedSkillDirectories = (cache, transport, options, commit) => fromPromise(
|
|
793
|
+
method(cache, "get"),
|
|
794
|
+
"cache"
|
|
795
|
+
)({
|
|
796
|
+
key: ["apps/githubSkills/directories", 1, options.repo, commit, options.path ?? null],
|
|
797
|
+
schema: wrap(SkillDirectories, false),
|
|
798
|
+
freshFor: "7 days",
|
|
799
|
+
// Executor's own loader: the app's cache runs it natively, so only its requests are upstream.
|
|
800
|
+
load: toPromise(
|
|
801
|
+
(context) => (
|
|
802
|
+
// Keep the author's fetch and this read's token, as every other request in it does.
|
|
744
803
|
reader({ fetch: transport.fetch, signal: context.signal }).pipe(
|
|
745
|
-
Effect_exports.flatMap(
|
|
746
|
-
|
|
747
|
-
|
|
804
|
+
Effect_exports.flatMap(
|
|
805
|
+
(remote) => skillDirectories(
|
|
806
|
+
githubRequests(remote, options.repo, options.token),
|
|
807
|
+
commit,
|
|
808
|
+
options.path
|
|
809
|
+
)
|
|
810
|
+
)
|
|
811
|
+
)
|
|
812
|
+
),
|
|
813
|
+
// A cache may call the loader as a Promise; its own signal cancels that load.
|
|
814
|
+
(context) => context.signal
|
|
815
|
+
)
|
|
816
|
+
}).pipe(
|
|
817
|
+
Effect_exports.mapError(
|
|
818
|
+
(error) => loaderFailure(
|
|
819
|
+
error,
|
|
820
|
+
() => new SkillLoadFailed({
|
|
821
|
+
reason: "request",
|
|
822
|
+
message: "Executor could not read or update the app cache for skills."
|
|
823
|
+
})
|
|
748
824
|
)
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
825
|
+
)
|
|
826
|
+
);
|
|
827
|
+
var digest = (value) => (
|
|
828
|
+
// oxlint-disable-next-line executor/authored-code-through-adapter -- Web Crypto
|
|
829
|
+
Effect_exports.promise(
|
|
830
|
+
() => crypto.subtle.digest("SHA-256", new TextEncoder().encode(JSON.stringify(value)))
|
|
831
|
+
).pipe(Effect_exports.map((bytes) => Hex_exports.encode(new Uint8Array(bytes))))
|
|
832
|
+
);
|
|
833
|
+
var checked = (request) => request.pipe(
|
|
834
|
+
Effect_exports.timeoutOrElse({
|
|
835
|
+
duration: skillLoadLimits.checkMillis,
|
|
836
|
+
orElse: () => Effect_exports.fail(failed("request"))
|
|
753
837
|
})
|
|
754
|
-
|
|
755
|
-
var cachedCatalog = (options, prefix,
|
|
838
|
+
);
|
|
839
|
+
var cachedCatalog = (options, prefix, publication) => options.cache === void 0 ? publication(options, void 0).pipe(Effect_exports.flatMap((source) => source.load)) : catalogCache({
|
|
756
840
|
cache: options.cache,
|
|
757
841
|
...options.freshFor === void 0 ? {} : { freshFor: options.freshFor },
|
|
758
842
|
...options.staleFor === void 0 ? {} : { staleFor: options.staleFor },
|
|
843
|
+
stale: "revalidate",
|
|
759
844
|
prefix,
|
|
760
845
|
schema: AppSkillSource,
|
|
761
846
|
summary: { schema: AppSkillMetadata, of: ({ files: _files, ...metadata }) => metadata },
|
|
762
|
-
load: (context) =>
|
|
847
|
+
load: (context, kept) => Effect_exports.gen(function* () {
|
|
848
|
+
const source = yield* context === void 0 ? publication(options, options.cache) : publication({ fetch: options.fetch, signal: context.signal }, context.cache);
|
|
849
|
+
if (source.id === void 0) return { tools: yield* source.load };
|
|
850
|
+
const previous = kept === void 0 ? void 0 : yield* kept;
|
|
851
|
+
const tools = previous?.header?.["publication"] === source.id ? yield* previous.tools : yield* source.load;
|
|
852
|
+
return { tools, header: { publication: source.id } };
|
|
853
|
+
})
|
|
763
854
|
}).pipe(
|
|
764
855
|
Effect_exports.flatMap((catalog) => catalog.list()),
|
|
765
856
|
Effect_exports.mapError(
|
|
766
|
-
(error) =>
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
857
|
+
(error) => loaderFailure(
|
|
858
|
+
error,
|
|
859
|
+
() => new SkillLoadFailed({
|
|
860
|
+
reason: "request",
|
|
861
|
+
message: "Executor could not read or update the app cache for skills."
|
|
862
|
+
})
|
|
863
|
+
)
|
|
770
864
|
)
|
|
771
865
|
);
|
|
866
|
+
var GitHubToken = Schema_exports.String.check(Schema_exports.isPattern(/^[\x21-\x7e]+$/u));
|
|
867
|
+
var scopeMessages = {
|
|
868
|
+
"missing-account": "A GitHub token needs its account. Pass account: ctx.accounts.<slot> with it.",
|
|
869
|
+
"unselected-account": "The GitHub account is not one of this app's selected accounts."
|
|
870
|
+
};
|
|
871
|
+
var githubCache = (options) => options.account !== void 0 && !Schema_exports.is(GitHubToken)(options.token) ? Effect_exports.fail(
|
|
872
|
+
new SkillLoadFailed({
|
|
873
|
+
reason: "source",
|
|
874
|
+
message: "The GitHub account was passed without a valid token."
|
|
875
|
+
})
|
|
876
|
+
) : catalogScope(
|
|
877
|
+
options,
|
|
878
|
+
options.token,
|
|
879
|
+
(problem) => new SkillLoadFailed({ reason: "source", message: scopeMessages[problem] })
|
|
880
|
+
);
|
|
881
|
+
var attributed = (account) => (error) => account !== void 0 && Schema_exports.is(SkillLoadFailed)(error) && error.reason === "request" && (error.status === 401 || error.status === 403) ? accountProviderError(
|
|
882
|
+
new ProviderError({
|
|
883
|
+
reason: error.status === 401 ? "unauthorized" : "rejected",
|
|
884
|
+
status: error.status
|
|
885
|
+
}),
|
|
886
|
+
account.id
|
|
887
|
+
) : error;
|
|
772
888
|
var githubSkillsEffect = (options) => Effect_exports.gen(function* () {
|
|
773
889
|
if (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(options.repo) || options.path !== void 0 && !resourcePath(options.path))
|
|
774
890
|
return yield* failed("source");
|
|
891
|
+
const cache = yield* githubCache(options);
|
|
775
892
|
return yield* cachedCatalog(
|
|
776
|
-
options,
|
|
893
|
+
cache === void 0 ? options : { ...options, cache },
|
|
777
894
|
["apps/githubSkills/catalog", 1, options.repo, options.ref ?? null, options.path ?? null],
|
|
778
|
-
(transport,
|
|
895
|
+
(transport, cache2) => githubPublication(options, transport, cache2)
|
|
779
896
|
);
|
|
780
|
-
}).pipe(withService("GitHub"));
|
|
781
|
-
var
|
|
782
|
-
const
|
|
783
|
-
const commit = yield* resolveCommit(
|
|
784
|
-
|
|
785
|
-
|
|
897
|
+
}).pipe(withService("GitHub"), Effect_exports.mapError(attributed(options.account)));
|
|
898
|
+
var githubPublication = (options, transport, cache) => Effect_exports.gen(function* () {
|
|
899
|
+
const github = githubRequests(yield* reader(transport), options.repo, options.token);
|
|
900
|
+
const commit = yield* checked(resolveCommit(github, options.ref));
|
|
901
|
+
return {
|
|
902
|
+
id: commit,
|
|
903
|
+
load: githubCatalog(options, github, commit, transport, cache)
|
|
904
|
+
};
|
|
905
|
+
});
|
|
906
|
+
var githubCatalog = (options, github, commit, transport, cache) => Effect_exports.gen(function* () {
|
|
907
|
+
const resources = yield* cache === void 0 ? skillDirectories(github, commit, options.path) : cachedSkillDirectories(cache, transport, options, commit);
|
|
786
908
|
const skills = yield* Effect_exports.forEach(
|
|
787
909
|
resources,
|
|
788
910
|
({ directory, files }) => Effect_exports.gen(function* () {
|
|
@@ -792,7 +914,7 @@ var githubCatalog = (options, transport, cache) => Effect_exports.gen(function*
|
|
|
792
914
|
const path = file.path.slice(directory.length);
|
|
793
915
|
if (!resourcePath(file.path) || !resourcePath(path) || file.mode === "120000")
|
|
794
916
|
return yield* failed("source");
|
|
795
|
-
return { path, content: yield*
|
|
917
|
+
return { path, content: yield* github.file(commit, file.path) };
|
|
796
918
|
}),
|
|
797
919
|
{ concurrency: skillLoadLimits.concurrency }
|
|
798
920
|
);
|
|
@@ -826,13 +948,17 @@ var wellKnownSkillsEffect = (options) => Effect_exports.gen(function* () {
|
|
|
826
948
|
return yield* cachedCatalog(
|
|
827
949
|
options,
|
|
828
950
|
["apps/wellKnownSkills/catalog", 1, url.href],
|
|
829
|
-
(transport) =>
|
|
951
|
+
(transport) => wellKnownPublication(url, transport)
|
|
830
952
|
);
|
|
831
953
|
}).pipe(withService(URL.canParse(options.url) ? new URL(options.url).hostname : void 0));
|
|
832
|
-
var
|
|
954
|
+
var wellKnownPublication = (url, transport) => Effect_exports.gen(function* () {
|
|
833
955
|
const remote = yield* reader(transport);
|
|
834
|
-
const first = yield* remote.read(url.href);
|
|
956
|
+
const first = yield* checked(remote.read(url.href));
|
|
835
957
|
const index = yield* parse(Schema_exports.fromJsonString(Index), first);
|
|
958
|
+
const id = index.skills.every((skill) => skill.version !== void 0) ? yield* digest(index.skills.map(({ name, version, files }) => [name, version, files])) : void 0;
|
|
959
|
+
return { id, load: wellKnownCatalog(url, remote, first, index) };
|
|
960
|
+
});
|
|
961
|
+
var wellKnownCatalog = (url, remote, first, index) => Effect_exports.gen(function* () {
|
|
836
962
|
if (index.skills.reduce((count, skill) => count + skill.files.length, 0) > skillLoadLimits.files)
|
|
837
963
|
return yield* failed("limit");
|
|
838
964
|
const skills = yield* Effect_exports.forEach(
|