apps 0.0.1-beta.8 → 0.0.1-beta.81
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 +25 -22
- package/framework-reference.json +1 -1
- package/js/{chunk-72JNVHPK.js → chunk-4NFSABEA.js} +4 -3
- package/js/chunk-5FHWNLCI.js +88 -0
- package/js/chunk-5WGONRKQ.js +426 -0
- package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
- 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-FL2QR3XW.js → chunk-HJG4RBYM.js} +333 -69
- package/js/chunk-I6Q7ZPKJ.js +49 -0
- package/js/{chunk-CDL5PM2Q.js → chunk-IFJU5SYQ.js} +19082 -18402
- package/js/{chunk-VFZKSM3T.js → chunk-JPEUKEV4.js} +3 -3
- package/js/{chunk-5T57N25Q.js → chunk-KGCTYL2S.js} +511 -63
- package/js/{chunk-KUMBKVJD.js → chunk-KLYSEHUD.js} +2 -2
- package/js/{chunk-WLE7WX2U.js → chunk-NG56RPCA.js} +2348 -472
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/{chunk-Z5M2LQOZ.js → chunk-OY47QPQY.js} +67 -55
- package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
- package/js/chunk-PL5KOEZD.js +334 -0
- package/js/chunk-Q4IZAUIF.js +285 -0
- package/js/{chunk-RJDDBDSN.js → chunk-QWQM3CLH.js} +795 -177
- package/js/{chunk-RFVIONFX.js → chunk-TE25A7D6.js} +123 -44
- package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
- package/js/chunk-W6XCQAXP.js +171 -0
- package/js/chunk-WCGAO3X5.js +348 -0
- package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
- package/js/{chunk-CMYUWAX7.js → chunk-YQUG4CES.js} +126 -31
- package/js/{chunk-UESPOTUI.js → chunk-Z2SWTZCF.js} +861 -231
- package/js/client.js +142 -94
- package/js/contracts.js +127 -26
- package/js/effect.js +19 -19
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +50 -40
- package/js/host.js +83 -58
- package/js/index.js +131 -46
- package/js/mcp/effect.js +23 -21
- package/js/mcp/stdio.js +44 -34
- package/js/mcp.js +76 -53
- package/js/openapi.js +4071 -1357
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +208 -81
- package/js/storage/facet.js +1 -540
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +5 -4
- package/js/ui/serving.js +8604 -223
- package/package.json +3 -4
- 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 +7 -3
- 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 +23 -7
- 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 +649 -17
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +80 -10
- package/types/apps/src/contracts/network.d.ts +120 -0
- package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
- package/types/apps/src/contracts/openapi.d.ts +41 -9
- package/types/apps/src/contracts/operations.d.ts +8 -4
- 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/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 +3843 -0
- package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
- package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
- package/types/apps/src/contracts/provider-error.d.ts +9 -0
- package/types/apps/src/contracts/provider.d.ts +90 -6
- package/types/apps/src/contracts/skills.d.ts +50 -13
- package/types/apps/src/contracts/sql.d.ts +63 -0
- package/types/apps/src/contracts/ui.d.ts +37 -3
- package/types/apps/src/contracts/workflows.d.ts +6 -0
- package/types/apps/src/facet.d.ts +4 -5
- package/types/apps/src/host.d.ts +5 -0
- package/types/apps/src/implementation/account-router.d.ts +4 -3
- package/types/apps/src/implementation/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 +28 -1
- 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 +59 -0
- package/types/apps/src/implementation/failure-detail.d.ts +25 -3
- 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-stdio.d.ts +1 -1
- 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 +26 -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 +18 -0
- package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
- package/types/apps/src/implementation/operations.d.ts +17 -2
- 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 +18 -3
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +11 -13
- package/types/apps/src/implementation/router.d.ts +16 -5
- package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
- package/types/apps/src/implementation/schema.d.ts +90 -10
- 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 +28 -9
- package/types/apps/src/implementation/ui-watch.d.ts +1 -1
- package/types/apps/src/implementation/upstream-error.d.ts +7 -0
- package/types/apps/src/implementation/webhooks.d.ts +1 -1
- package/types/apps/src/implementation/workflows.d.ts +1 -1
- package/types/apps/src/index.d.ts +55 -13
- package/types/apps/src/mcp.d.ts +20 -1
- package/types/apps/src/openapi.d.ts +1 -1
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +10 -8
- package/types/apps/src/ui-serving.d.ts +1 -1
- package/types/telemetry/src/app-records.d.ts +42 -0
- package/types/telemetry/src/browser-operations.d.ts +2 -2
- package/types/telemetry/src/browser.d.ts +8 -3
- package/types/telemetry/src/config.d.ts +2 -2
- package/types/telemetry/src/index.d.ts +2 -1
- package/types/telemetry/src/layer.d.ts +10 -4
- package/types/telemetry/src/measurements.d.ts +1 -1
- package/types/telemetry/src/ownership.d.ts +60 -0
- package/types/telemetry/src/recorded-failure.d.ts +29 -0
- package/types/telemetry/src/relay.d.ts +16 -6
- package/types/telemetry/src/span-attributes.d.ts +17 -1
- package/types/telemetry/src/transport.d.ts +8 -1
- package/types/utils/src/api-error.d.ts +55 -0
- package/types/utils/src/connection-failure.d.ts +33 -0
- package/types/utils/src/recorded-message.d.ts +18 -0
- package/types/utils/src/user-facing-error.d.ts +83 -0
- package/js/chunk-MKWZPDR6.js +0 -63
- package/js/chunk-N7YDVXYJ.js +0 -186
- package/js/chunk-NKLWZJLE.js +0 -172
- package/js/chunk-OCYUEU47.js +0 -224
- package/js/chunk-PJJ24GU7.js +0 -877
- package/js/chunk-PZB6T6KU.js +0 -19
- package/js/chunk-R3EV5FTO.js +0 -97
- package/js/chunk-YXQHV65J.js +0 -242
- 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/storage.d.ts +0 -68
- 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-TE25A7D6.js";
|
|
5
|
+
import "./chunk-PL5KOEZD.js";
|
|
6
|
+
import {
|
|
7
|
+
failOnNetworkRefusal
|
|
8
|
+
} from "./chunk-I6Q7ZPKJ.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-W6XCQAXP.js";
|
|
9
20
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
21
|
+
NetworkRefused,
|
|
22
|
+
ProviderError,
|
|
23
|
+
networkRefusalStatus
|
|
24
|
+
} from "./chunk-Q4IZAUIF.js";
|
|
13
25
|
import {
|
|
14
26
|
AppSkillMetadata,
|
|
15
27
|
AppSkillSource,
|
|
@@ -19,24 +31,29 @@ import {
|
|
|
19
31
|
SkillLoadFailed,
|
|
20
32
|
SkillServiceName,
|
|
21
33
|
skillLoadLimits
|
|
22
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-H72MEDMN.js";
|
|
35
|
+
import {
|
|
36
|
+
wrap
|
|
37
|
+
} from "./chunk-KGCTYL2S.js";
|
|
38
|
+
import "./chunk-QWQM3CLH.js";
|
|
23
39
|
import {
|
|
24
40
|
FetchHttpClient_exports
|
|
25
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-PD6I2SDG.js";
|
|
42
|
+
import "./chunk-5FHWNLCI.js";
|
|
43
|
+
import "./chunk-H2CJWXA3.js";
|
|
44
|
+
import "./chunk-TUMGL2OC.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-EOPQ727L.js";
|
|
34
49
|
import {
|
|
50
|
+
Base64_exports,
|
|
35
51
|
Effect_exports,
|
|
52
|
+
Hex_exports,
|
|
36
53
|
Ref_exports,
|
|
37
54
|
Schema_exports,
|
|
38
55
|
Stream_exports
|
|
39
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-IFJU5SYQ.js";
|
|
40
57
|
import "./chunk-CZ7CSFO4.js";
|
|
41
58
|
|
|
42
59
|
// src/implementation/inflate.ts
|
|
@@ -592,13 +609,15 @@ var describe = (service, { reason, status }) => {
|
|
|
592
609
|
};
|
|
593
610
|
var withService = (service) => (effect) => service === void 0 || !Schema_exports.is(SkillServiceName)(service) ? effect : effect.pipe(
|
|
594
611
|
Effect_exports.mapError(
|
|
595
|
-
(error) => !error.message ? new SkillLoadFailed({
|
|
612
|
+
(error) => Schema_exports.is(SkillLoadFailed)(error) && !error.message ? new SkillLoadFailed({
|
|
596
613
|
reason: error.reason,
|
|
597
614
|
message: describe(service, error),
|
|
598
|
-
...error.status === void 0 ? {} : { status: error.status }
|
|
615
|
+
...error.status === void 0 ? {} : { status: error.status },
|
|
616
|
+
...error.missing === void 0 ? {} : { missing: error.missing }
|
|
599
617
|
}) : error
|
|
600
618
|
)
|
|
601
619
|
);
|
|
620
|
+
var loaderFailure = (error, otherwise) => Schema_exports.is(SkillLoadFailed)(error) || Schema_exports.is(NetworkRefused)(error) ? error : otherwise();
|
|
602
621
|
var parse = (schema, input) => Schema_exports.decodeUnknownEffect(schema)(input).pipe(Effect_exports.mapError(() => failed("document")));
|
|
603
622
|
var resourcePath = (path) => {
|
|
604
623
|
if (!Schema_exports.is(SkillFilePath)(path)) return false;
|
|
@@ -614,23 +633,31 @@ var resourcePath = (path) => {
|
|
|
614
633
|
var pathUrl = (base, path) => new URL(path.split("/").map(encodeURIComponent).join("/"), base).href;
|
|
615
634
|
var reader = (transport) => Effect_exports.gen(function* () {
|
|
616
635
|
const budget = yield* Ref_exports.make(0);
|
|
617
|
-
const fetchBytes = (url,
|
|
636
|
+
const fetchBytes = (url, request = {}) => Effect_exports.gen(function* () {
|
|
618
637
|
const parsed = yield* Effect_exports.try({
|
|
619
638
|
try: () => new URL(url),
|
|
620
639
|
catch: () => failed("source")
|
|
621
640
|
});
|
|
622
641
|
if (!["https:", "http:"].includes(parsed.protocol) || parsed.username || parsed.password || parsed.hash)
|
|
623
642
|
return yield* failed("source");
|
|
643
|
+
const refusal = request.refused ?? ((refused) => refused);
|
|
624
644
|
const client = HttpClient_exports.withScope(yield* HttpClient_exports.HttpClient);
|
|
625
645
|
const headers = {
|
|
626
646
|
"User-Agent": "executor-skills",
|
|
627
647
|
Accept: "application/json, text/plain",
|
|
628
|
-
"Cache-Control": "no-cache"
|
|
648
|
+
"Cache-Control": "no-cache",
|
|
649
|
+
...request.headers
|
|
629
650
|
};
|
|
630
|
-
const response = yield* (
|
|
631
|
-
headers
|
|
632
|
-
body: HttpBody_exports.uint8Array(
|
|
633
|
-
})).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));
|
|
634
661
|
if (response.status < 200 || response.status >= 300)
|
|
635
662
|
return yield* rejected(response.status, response.headers);
|
|
636
663
|
const chunks = [];
|
|
@@ -660,7 +687,7 @@ var reader = (transport) => Effect_exports.gen(function* () {
|
|
|
660
687
|
Effect_exports.provideService(FetchHttpClient_exports.RequestInit, { redirect: "manual" }),
|
|
661
688
|
Effect_exports.provideService(FetchHttpClient_exports.Fetch, transport.fetch ?? globalThis.fetch)
|
|
662
689
|
);
|
|
663
|
-
const read = (url) => fetchBytes(url).pipe(
|
|
690
|
+
const read = (url, request = {}) => fetchBytes(url, request).pipe(
|
|
664
691
|
Effect_exports.flatMap(
|
|
665
692
|
(result) => Effect_exports.try({
|
|
666
693
|
try: () => new TextDecoder("utf-8", { fatal: true }).decode(result),
|
|
@@ -675,39 +702,68 @@ var unreadable = () => new SkillLoadFailed({
|
|
|
675
702
|
reason: "request",
|
|
676
703
|
message: "GitHub returned a git response Executor could not read."
|
|
677
704
|
});
|
|
678
|
-
var git = (run) =>
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
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;
|
|
683
735
|
if (ref !== void 0 && /^[a-f0-9]{40}$/.test(ref)) return ref;
|
|
684
736
|
const names = refCandidates(ref);
|
|
685
|
-
const response = yield*
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
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
|
+
})
|
|
697
755
|
);
|
|
698
756
|
const refs = yield* git(() => parseLsRefs(response));
|
|
699
757
|
const commit = names.map((name) => refs.get(name)).find((sha) => sha !== void 0);
|
|
700
758
|
if (commit === void 0)
|
|
701
759
|
return yield* new SkillLoadFailed({
|
|
702
760
|
reason: "source",
|
|
703
|
-
message: `GitHub repository ${repo}
|
|
761
|
+
message: `The refs read from GitHub repository ${repo} include no branch or tag named ${ref}.`,
|
|
762
|
+
missing: "ref"
|
|
704
763
|
});
|
|
705
764
|
return commit;
|
|
706
765
|
});
|
|
707
|
-
var listFiles = (
|
|
708
|
-
body: treeFetchRequest(commit),
|
|
709
|
-
headers: gitRequestHeaders
|
|
710
|
-
}).pipe(
|
|
766
|
+
var listFiles = (github, commit, path) => github.upload(treeFetchRequest(commit)).pipe(
|
|
711
767
|
Effect_exports.flatMap(
|
|
712
768
|
(response) => git(
|
|
713
769
|
() => parseTreeFetch(response, commit, path, { objectBytes: skillLoadLimits.fileBytes })
|
|
@@ -720,8 +776,8 @@ var SkillDirectories = Schema_exports.Array(
|
|
|
720
776
|
files: Schema_exports.Array(Schema_exports.Struct({ path: Schema_exports.String, mode: Schema_exports.String }))
|
|
721
777
|
})
|
|
722
778
|
);
|
|
723
|
-
var skillDirectories = (
|
|
724
|
-
const files = yield* listFiles(
|
|
779
|
+
var skillDirectories = (github, commit, path) => Effect_exports.gen(function* () {
|
|
780
|
+
const files = yield* listFiles(github, commit, path);
|
|
725
781
|
const documents = files.filter(
|
|
726
782
|
(file) => file.path === "SKILL.md" || file.path.endsWith("/SKILL.md")
|
|
727
783
|
);
|
|
@@ -733,55 +789,122 @@ var skillDirectories = (remote, repo, commit, path) => Effect_exports.gen(functi
|
|
|
733
789
|
return yield* failed("limit");
|
|
734
790
|
return directories;
|
|
735
791
|
});
|
|
736
|
-
var cachedSkillDirectories = (cache, transport,
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
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.
|
|
743
803
|
reader({ fetch: transport.fetch, signal: context.signal }).pipe(
|
|
744
|
-
Effect_exports.flatMap(
|
|
745
|
-
|
|
746
|
-
|
|
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
|
+
})
|
|
747
824
|
)
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
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"))
|
|
752
837
|
})
|
|
753
|
-
|
|
754
|
-
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({
|
|
755
840
|
cache: options.cache,
|
|
756
841
|
...options.freshFor === void 0 ? {} : { freshFor: options.freshFor },
|
|
757
842
|
...options.staleFor === void 0 ? {} : { staleFor: options.staleFor },
|
|
843
|
+
stale: "revalidate",
|
|
758
844
|
prefix,
|
|
759
845
|
schema: AppSkillSource,
|
|
760
846
|
summary: { schema: AppSkillMetadata, of: ({ files: _files, ...metadata }) => metadata },
|
|
761
|
-
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
|
+
})
|
|
762
854
|
}).pipe(
|
|
763
855
|
Effect_exports.flatMap((catalog) => catalog.list()),
|
|
764
856
|
Effect_exports.mapError(
|
|
765
|
-
(error) =>
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
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
|
+
)
|
|
769
864
|
)
|
|
770
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;
|
|
771
888
|
var githubSkillsEffect = (options) => Effect_exports.gen(function* () {
|
|
772
889
|
if (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(options.repo) || options.path !== void 0 && !resourcePath(options.path))
|
|
773
890
|
return yield* failed("source");
|
|
891
|
+
const cache = yield* githubCache(options);
|
|
774
892
|
return yield* cachedCatalog(
|
|
775
|
-
options,
|
|
893
|
+
cache === void 0 ? options : { ...options, cache },
|
|
776
894
|
["apps/githubSkills/catalog", 1, options.repo, options.ref ?? null, options.path ?? null],
|
|
777
|
-
(transport,
|
|
895
|
+
(transport, cache2) => githubPublication(options, transport, cache2)
|
|
778
896
|
);
|
|
779
|
-
}).pipe(withService("GitHub"));
|
|
780
|
-
var
|
|
781
|
-
const
|
|
782
|
-
const commit = yield* resolveCommit(
|
|
783
|
-
|
|
784
|
-
|
|
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);
|
|
785
908
|
const skills = yield* Effect_exports.forEach(
|
|
786
909
|
resources,
|
|
787
910
|
({ directory, files }) => Effect_exports.gen(function* () {
|
|
@@ -791,7 +914,7 @@ var githubCatalog = (options, transport, cache) => Effect_exports.gen(function*
|
|
|
791
914
|
const path = file.path.slice(directory.length);
|
|
792
915
|
if (!resourcePath(file.path) || !resourcePath(path) || file.mode === "120000")
|
|
793
916
|
return yield* failed("source");
|
|
794
|
-
return { path, content: yield*
|
|
917
|
+
return { path, content: yield* github.file(commit, file.path) };
|
|
795
918
|
}),
|
|
796
919
|
{ concurrency: skillLoadLimits.concurrency }
|
|
797
920
|
);
|
|
@@ -825,13 +948,17 @@ var wellKnownSkillsEffect = (options) => Effect_exports.gen(function* () {
|
|
|
825
948
|
return yield* cachedCatalog(
|
|
826
949
|
options,
|
|
827
950
|
["apps/wellKnownSkills/catalog", 1, url.href],
|
|
828
|
-
(transport) =>
|
|
951
|
+
(transport) => wellKnownPublication(url, transport)
|
|
829
952
|
);
|
|
830
953
|
}).pipe(withService(URL.canParse(options.url) ? new URL(options.url).hostname : void 0));
|
|
831
|
-
var
|
|
954
|
+
var wellKnownPublication = (url, transport) => Effect_exports.gen(function* () {
|
|
832
955
|
const remote = yield* reader(transport);
|
|
833
|
-
const first = yield* remote.read(url.href);
|
|
956
|
+
const first = yield* checked(remote.read(url.href));
|
|
834
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* () {
|
|
835
962
|
if (index.skills.reduce((count, skill) => count + skill.files.length, 0) > skillLoadLimits.files)
|
|
836
963
|
return yield* failed("limit");
|
|
837
964
|
const skills = yield* Effect_exports.forEach(
|