apps 0.0.1-beta.1 → 0.0.1-beta.100

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.
Files changed (211) hide show
  1. package/README.md +112 -72
  2. package/framework-reference.json +1 -1
  3. package/js/browser-XIPJGLH2.js +65 -0
  4. package/js/chunk-2CURR5Y7.js +264 -0
  5. package/js/chunk-2LSGC7XY.js +42 -0
  6. package/js/{chunk-YEJOQEII.js → chunk-4PIQKACY.js} +65 -10
  7. package/js/chunk-4UPC36ZL.js +5185 -0
  8. package/js/{chunk-4LPG6RCH.js → chunk-4X2UI4R2.js} +7 -27
  9. package/js/chunk-5C6RAGAS.js +335 -0
  10. package/js/chunk-62NVUKED.js +39 -0
  11. package/js/chunk-74H25C4X.js +95 -0
  12. package/js/chunk-7HG422GB.js +90 -0
  13. package/js/chunk-7STIP5CS.js +171 -0
  14. package/js/{chunk-QKHR7BMF.js → chunk-ACQXVKVQ.js} +87 -51
  15. package/js/{chunk-OHRT55C4.js → chunk-DILSCQPJ.js} +226 -265
  16. package/js/chunk-ILYCJ3HV.js +449 -0
  17. package/js/chunk-K6TSCYAO.js +712 -0
  18. package/js/{chunk-EVJUVWN2.js → chunk-KLSEU35Y.js} +463 -218
  19. package/js/chunk-OD3KFKZD.js +1617 -0
  20. package/js/chunk-OWN3DP2W.js +88 -0
  21. package/js/{chunk-ZTFQHGEB.js → chunk-PBGPES67.js} +3 -5
  22. package/js/chunk-QI66R4FP.js +786 -0
  23. package/js/chunk-RN4YB4JT.js +1922 -0
  24. package/js/{chunk-ZCAMUXSG.js → chunk-URKOTNDA.js} +795 -177
  25. package/js/{chunk-NCYXZN2G.js → chunk-UVL56Z6E.js} +390 -23
  26. package/js/{chunk-2HHMABB6.js → chunk-VAI3EVCS.js} +700 -78
  27. package/js/chunk-VCYWAA4N.js +49 -0
  28. package/js/{chunk-HDJH3RPR.js → chunk-YDW7DX3A.js} +4 -4
  29. package/js/chunk-YWVISRZD.js +268 -0
  30. package/js/{chunk-FW5HBOIK.js → chunk-ZKDXML77.js} +19272 -18299
  31. package/js/client.js +148 -100
  32. package/js/contracts.js +208 -24
  33. package/js/effect.js +18 -19
  34. package/js/es-DIULA3ZF.js +39371 -0
  35. package/js/graphql.js +62 -58
  36. package/js/host.js +83 -60
  37. package/js/index.js +381 -263
  38. package/js/mcp/effect.js +21 -21
  39. package/js/mcp.js +117 -74
  40. package/js/openapi.js +4613 -42691
  41. package/js/react.js +2 -3
  42. package/js/skills/effect.js +6 -4
  43. package/js/skills.js +233 -70
  44. package/js/storage/facet.js +1 -540
  45. package/js/ui/auth/contracts.js +8 -9
  46. package/js/ui/auth.js +16 -14
  47. package/js/ui/contracts.js +9 -8
  48. package/js/ui/serving.js +8609 -227
  49. package/package.json +3 -8
  50. package/runtime.json +1 -1
  51. package/types/app-cache/src/contracts/cache.d.ts +60 -2
  52. package/types/app-cache/src/index.d.ts +92 -2
  53. package/types/app-data/src/contracts/database.d.ts +33 -6
  54. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  55. package/types/apps/src/contracts/app.d.ts +63 -17
  56. package/types/apps/src/contracts/cache.d.ts +24 -1
  57. package/types/apps/src/contracts/context.d.ts +60 -17
  58. package/types/apps/src/contracts/elicitation.d.ts +23 -7
  59. package/types/apps/src/contracts/events.d.ts +94 -0
  60. package/types/apps/src/contracts/failure.d.ts +54 -0
  61. package/types/apps/src/contracts/graphql.d.ts +2 -1
  62. package/types/apps/src/contracts/host.d.ts +1325 -534
  63. package/types/apps/src/contracts/icons.d.ts +28 -0
  64. package/types/apps/src/contracts/live.d.ts +2 -0
  65. package/types/apps/src/contracts/mcp.d.ts +97 -20
  66. package/types/apps/src/contracts/network.d.ts +120 -0
  67. package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
  68. package/types/apps/src/contracts/openapi-document.d.ts +1 -1
  69. package/types/apps/src/contracts/openapi.d.ts +51 -9
  70. package/types/apps/src/contracts/operations.d.ts +14 -12
  71. package/types/apps/src/contracts/placement.d.ts +102 -0
  72. package/types/apps/src/contracts/protocol-version.d.ts +6 -0
  73. package/types/apps/src/contracts/protocols/1.d.ts +2241 -0
  74. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  75. package/types/apps/src/contracts/protocols/11.d.ts +1149 -0
  76. package/types/apps/src/contracts/protocols/12.d.ts +3310 -0
  77. package/types/apps/src/contracts/protocols/2.d.ts +711 -0
  78. package/types/apps/src/contracts/protocols/3.d.ts +776 -0
  79. package/types/apps/src/contracts/protocols/4.d.ts +1306 -0
  80. package/types/apps/src/contracts/protocols/5.d.ts +1200 -0
  81. package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
  82. package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
  83. package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
  84. package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
  85. package/types/apps/src/contracts/protocols/current.d.ts +6857 -0
  86. package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
  87. package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
  88. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  89. package/types/apps/src/contracts/provider.d.ts +140 -10
  90. package/types/apps/src/contracts/router.d.ts +59 -0
  91. package/types/apps/src/contracts/schedules.d.ts +7 -1
  92. package/types/apps/src/contracts/schema.d.ts +21 -0
  93. package/types/apps/src/contracts/shared-catalog.d.ts +11 -0
  94. package/types/apps/src/contracts/skills.d.ts +60 -14
  95. package/types/apps/src/contracts/sql.d.ts +63 -0
  96. package/types/apps/src/contracts/ui-auth.d.ts +6 -14
  97. package/types/apps/src/contracts/ui.d.ts +70 -30
  98. package/types/apps/src/contracts/webhooks.d.ts +24 -7
  99. package/types/apps/src/contracts/workflows.d.ts +89 -36
  100. package/types/apps/src/facet.d.ts +4 -5
  101. package/types/apps/src/graphql.d.ts +1 -3
  102. package/types/apps/src/host.d.ts +5 -0
  103. package/types/apps/src/implementation/account-router.d.ts +13 -0
  104. package/types/apps/src/implementation/app.d.ts +44 -16
  105. package/types/apps/src/implementation/authoring.d.ts +25 -5
  106. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  107. package/types/apps/src/implementation/cache.d.ts +32 -3
  108. package/types/apps/src/implementation/catalog-cache.d.ts +43 -5
  109. package/types/apps/src/implementation/elicitation.d.ts +18 -15
  110. package/types/apps/src/implementation/events.d.ts +64 -0
  111. package/types/apps/src/implementation/failure-detail.d.ts +48 -0
  112. package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
  113. package/types/apps/src/implementation/graphql.d.ts +4 -3
  114. package/types/apps/src/implementation/input-problems.d.ts +6 -2
  115. package/types/apps/src/implementation/invocation-timing.d.ts +18 -0
  116. package/types/apps/src/implementation/live.d.ts +2 -2
  117. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  118. package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
  119. package/types/apps/src/implementation/mcp-client.d.ts +49 -25
  120. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  121. package/types/apps/src/implementation/mcp.d.ts +52 -25
  122. package/types/apps/src/implementation/network.d.ts +16 -0
  123. package/types/apps/src/implementation/openapi-compile.d.ts +30 -8
  124. package/types/apps/src/implementation/openapi-document.d.ts +46 -21
  125. package/types/apps/src/implementation/openapi-names.d.ts +23 -0
  126. package/types/apps/src/implementation/openapi-request.d.ts +10 -3
  127. package/types/apps/src/implementation/openapi-source.d.ts +30 -8
  128. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  129. package/types/apps/src/implementation/operations.d.ts +84 -10
  130. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  131. package/types/apps/src/implementation/placement.d.ts +60 -0
  132. package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
  133. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  134. package/types/apps/src/implementation/provider.d.ts +26 -6
  135. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  136. package/types/apps/src/implementation/router-catalog.d.ts +227 -0
  137. package/types/apps/src/implementation/router.d.ts +78 -0
  138. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  139. package/types/apps/src/implementation/schedules.d.ts +39 -8
  140. package/types/apps/src/implementation/schema.d.ts +111 -15
  141. package/types/apps/src/implementation/skills.d.ts +18 -24
  142. package/types/apps/src/implementation/sql.d.ts +71 -0
  143. package/types/apps/src/implementation/swagger-client.d.ts +28 -0
  144. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  145. package/types/apps/src/implementation/ui-auth.d.ts +12 -6
  146. package/types/apps/src/implementation/ui-client.d.ts +3 -3
  147. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  148. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  149. package/types/apps/src/implementation/ui-serving.d.ts +31 -12
  150. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  151. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  152. package/types/apps/src/implementation/webhooks.d.ts +15 -6
  153. package/types/apps/src/implementation/workflow-context.d.ts +17 -5
  154. package/types/apps/src/implementation/workflows.d.ts +11 -4
  155. package/types/apps/src/index.d.ts +71 -21
  156. package/types/apps/src/mcp.d.ts +25 -5
  157. package/types/apps/src/openapi.d.ts +11 -6
  158. package/types/apps/src/react.d.ts +1 -1
  159. package/types/apps/src/skills.d.ts +13 -8
  160. package/types/apps/src/ui-auth.d.ts +2 -2
  161. package/types/apps/src/ui-serving.d.ts +1 -1
  162. package/types/telemetry/src/app-records.d.ts +42 -0
  163. package/types/telemetry/src/browser-operations.d.ts +7 -4
  164. package/types/telemetry/src/browser.d.ts +8 -3
  165. package/types/telemetry/src/config.d.ts +2 -2
  166. package/types/telemetry/src/index.d.ts +2 -1
  167. package/types/telemetry/src/layer.d.ts +10 -4
  168. package/types/telemetry/src/measurements.d.ts +1 -1
  169. package/types/telemetry/src/ownership.d.ts +60 -0
  170. package/types/telemetry/src/recorded-failure.d.ts +29 -0
  171. package/types/telemetry/src/relay.d.ts +16 -6
  172. package/types/telemetry/src/span-attributes.d.ts +17 -1
  173. package/types/telemetry/src/transport.d.ts +8 -1
  174. package/types/utils/src/api-error.d.ts +55 -0
  175. package/types/utils/src/connection-failure.d.ts +33 -0
  176. package/types/utils/src/legacy-keys.d.ts +20 -0
  177. package/types/utils/src/recorded-message.d.ts +18 -0
  178. package/types/utils/src/schema-definitions.d.ts +13 -0
  179. package/types/utils/src/user-facing-error.d.ts +83 -0
  180. package/js/chunk-6IIO4NPI.js +0 -29
  181. package/js/chunk-6YBRWRK3.js +0 -160
  182. package/js/chunk-BMOIAIVR.js +0 -138
  183. package/js/chunk-FZJOYIZO.js +0 -19
  184. package/js/chunk-G7IE6BKC.js +0 -224
  185. package/js/chunk-IHQ4ML7K.js +0 -2193
  186. package/js/chunk-KOXMLKTM.js +0 -1288
  187. package/js/chunk-M6ZRRIBI.js +0 -877
  188. package/js/chunk-PLCMJREA.js +0 -590
  189. package/js/chunk-PZ36XMXW.js +0 -93
  190. package/js/chunk-RBAC33PQ.js +0 -267
  191. package/js/chunk-SATWJKN6.js +0 -34
  192. package/js/chunk-SWPD52J7.js +0 -35
  193. package/js/chunk-TE4KO4HI.js +0 -47
  194. package/js/chunk-W7D7WVSY.js +0 -18
  195. package/js/chunk-X7SFGU4Q.js +0 -280
  196. package/js/chunk-ZJWDMTE3.js +0 -63
  197. package/js/mcp/stdio.js +0 -128
  198. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  199. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  200. package/types/app-data/src/implementation/promise.d.ts +0 -68
  201. package/types/app-data/src/implementation/range.d.ts +0 -8
  202. package/types/app-data/src/implementation/schema.d.ts +0 -33
  203. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  204. package/types/app-data/src/index.d.ts +0 -4
  205. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  206. package/types/apps/src/contracts/storage.d.ts +0 -68
  207. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  208. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
  209. package/types/apps/src/implementation/mcp-stdio.d.ts +0 -4
  210. package/types/apps/src/implementation/storage.d.ts +0 -13
  211. package/types/apps/src/mcp-stdio.d.ts +0 -8
package/js/react.js CHANGED
@@ -2,11 +2,10 @@ import {
2
2
  AsyncResult_exports,
3
3
  AtomRegistry_exports,
4
4
  queryCommitted
5
- } from "./chunk-EVJUVWN2.js";
6
- import "./chunk-M6ZRRIBI.js";
5
+ } from "./chunk-KLSEU35Y.js";
7
6
  import {
8
7
  Option_exports
9
- } from "./chunk-FW5HBOIK.js";
8
+ } from "./chunk-ZKDXML77.js";
10
9
  import "./chunk-CZ7CSFO4.js";
11
10
 
12
11
  // src/react.ts
@@ -1,10 +1,12 @@
1
1
  import {
2
2
  folderSkillsEffect,
3
3
  skillFromFiles
4
- } from "../chunk-ZTFQHGEB.js";
5
- import "../chunk-NCYXZN2G.js";
6
- import "../chunk-YEJOQEII.js";
7
- import "../chunk-FW5HBOIK.js";
4
+ } from "../chunk-PBGPES67.js";
5
+ import "../chunk-4PIQKACY.js";
6
+ import "../chunk-OWN3DP2W.js";
7
+ import "../chunk-DILSCQPJ.js";
8
+ import "../chunk-ACQXVKVQ.js";
9
+ import "../chunk-ZKDXML77.js";
8
10
  import "../chunk-CZ7CSFO4.js";
9
11
  export {
10
12
  folderSkillsEffect,
package/js/skills.js CHANGED
@@ -1,38 +1,59 @@
1
+ import {
2
+ catalogCache,
3
+ catalogScope
4
+ } from "./chunk-YWVISRZD.js";
5
+ import "./chunk-5C6RAGAS.js";
6
+ import {
7
+ failOnNetworkRefusal
8
+ } from "./chunk-VCYWAA4N.js";
1
9
  import {
2
10
  folderSkillsEffect,
3
11
  skillFromFiles
4
- } from "./chunk-ZTFQHGEB.js";
5
- import "./chunk-NCYXZN2G.js";
12
+ } from "./chunk-PBGPES67.js";
6
13
  import {
7
- httpProviderError
8
- } from "./chunk-ZJWDMTE3.js";
14
+ accountProviderError,
15
+ fromPromise,
16
+ httpProviderError,
17
+ method,
18
+ toPromise
19
+ } from "./chunk-7STIP5CS.js";
20
+ import {
21
+ NetworkRefused,
22
+ ProviderError,
23
+ networkRefusalStatus
24
+ } from "./chunk-4UPC36ZL.js";
9
25
  import {
10
26
  AppSkillMetadata,
27
+ AppSkillSource,
11
28
  AppSkills,
12
29
  SkillDefinitionInvalid,
13
30
  SkillFilePath,
14
31
  SkillLoadFailed,
15
32
  SkillServiceName,
16
33
  skillLoadLimits
17
- } from "./chunk-YEJOQEII.js";
18
- import "./chunk-W7D7WVSY.js";
34
+ } from "./chunk-4PIQKACY.js";
35
+ import {
36
+ wrap
37
+ } from "./chunk-VAI3EVCS.js";
38
+ import "./chunk-URKOTNDA.js";
19
39
  import {
20
40
  FetchHttpClient_exports
21
- } from "./chunk-HDJH3RPR.js";
41
+ } from "./chunk-YDW7DX3A.js";
42
+ import "./chunk-OWN3DP2W.js";
43
+ import "./chunk-7HG422GB.js";
44
+ import "./chunk-DILSCQPJ.js";
22
45
  import {
23
46
  HttpBody_exports,
24
47
  HttpClient_exports
25
- } from "./chunk-QKHR7BMF.js";
26
- import {
27
- wrap
28
- } from "./chunk-2HHMABB6.js";
29
- import "./chunk-SATWJKN6.js";
48
+ } from "./chunk-ACQXVKVQ.js";
30
49
  import {
50
+ Base64_exports,
31
51
  Effect_exports,
52
+ Hex_exports,
32
53
  Ref_exports,
33
54
  Schema_exports,
34
55
  Stream_exports
35
- } from "./chunk-FW5HBOIK.js";
56
+ } from "./chunk-ZKDXML77.js";
36
57
  import "./chunk-CZ7CSFO4.js";
37
58
 
38
59
  // src/implementation/inflate.ts
@@ -588,13 +609,15 @@ var describe = (service, { reason, status }) => {
588
609
  };
589
610
  var withService = (service) => (effect) => service === void 0 || !Schema_exports.is(SkillServiceName)(service) ? effect : effect.pipe(
590
611
  Effect_exports.mapError(
591
- (error) => !error.message ? new SkillLoadFailed({
612
+ (error) => Schema_exports.is(SkillLoadFailed)(error) && !error.message ? new SkillLoadFailed({
592
613
  reason: error.reason,
593
614
  message: describe(service, error),
594
- ...error.status === void 0 ? {} : { status: error.status }
615
+ ...error.status === void 0 ? {} : { status: error.status },
616
+ ...error.missing === void 0 ? {} : { missing: error.missing }
595
617
  }) : error
596
618
  )
597
619
  );
620
+ var loaderFailure = (error, otherwise) => Schema_exports.is(SkillLoadFailed)(error) || Schema_exports.is(NetworkRefused)(error) ? error : otherwise();
598
621
  var parse = (schema, input) => Schema_exports.decodeUnknownEffect(schema)(input).pipe(Effect_exports.mapError(() => failed("document")));
599
622
  var resourcePath = (path) => {
600
623
  if (!Schema_exports.is(SkillFilePath)(path)) return false;
@@ -610,23 +633,31 @@ var resourcePath = (path) => {
610
633
  var pathUrl = (base, path) => new URL(path.split("/").map(encodeURIComponent).join("/"), base).href;
611
634
  var reader = (transport) => Effect_exports.gen(function* () {
612
635
  const budget = yield* Ref_exports.make(0);
613
- const fetchBytes = (url, post) => Effect_exports.gen(function* () {
636
+ const fetchBytes = (url, request = {}) => Effect_exports.gen(function* () {
614
637
  const parsed = yield* Effect_exports.try({
615
638
  try: () => new URL(url),
616
639
  catch: () => failed("source")
617
640
  });
618
641
  if (!["https:", "http:"].includes(parsed.protocol) || parsed.username || parsed.password || parsed.hash)
619
642
  return yield* failed("source");
643
+ const refusal = request.refused ?? ((refused) => refused);
620
644
  const client = HttpClient_exports.withScope(yield* HttpClient_exports.HttpClient);
621
645
  const headers = {
622
646
  "User-Agent": "executor-skills",
623
647
  Accept: "application/json, text/plain",
624
- "Cache-Control": "no-cache"
648
+ "Cache-Control": "no-cache",
649
+ ...request.headers
625
650
  };
626
- const response = yield* (post === void 0 ? client.get(parsed, { headers }) : client.post(parsed, {
627
- headers: { ...headers, ...post.headers },
628
- body: HttpBody_exports.uint8Array(post.body, post.headers["Content-Type"])
629
- })).pipe(Effect_exports.mapError(() => failed("request")));
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));
630
661
  if (response.status < 200 || response.status >= 300)
631
662
  return yield* rejected(response.status, response.headers);
632
663
  const chunks = [];
@@ -656,7 +687,7 @@ var reader = (transport) => Effect_exports.gen(function* () {
656
687
  Effect_exports.provideService(FetchHttpClient_exports.RequestInit, { redirect: "manual" }),
657
688
  Effect_exports.provideService(FetchHttpClient_exports.Fetch, transport.fetch ?? globalThis.fetch)
658
689
  );
659
- const read = (url) => fetchBytes(url).pipe(
690
+ const read = (url, request = {}) => fetchBytes(url, request).pipe(
660
691
  Effect_exports.flatMap(
661
692
  (result) => Effect_exports.try({
662
693
  try: () => new TextDecoder("utf-8", { fatal: true }).decode(result),
@@ -671,39 +702,68 @@ var unreadable = () => new SkillLoadFailed({
671
702
  reason: "request",
672
703
  message: "GitHub returned a git response Executor could not read."
673
704
  });
674
- var git = (run) => Effect_exports.tryPromise({
675
- try: async () => run(),
676
- catch: (error) => error instanceof InflateLimitExceeded ? failed("limit") : unreadable()
677
- });
678
- var resolveCommit = (remote, repo, ref) => Effect_exports.gen(function* () {
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;
679
735
  if (ref !== void 0 && /^[a-f0-9]{40}$/.test(ref)) return ref;
680
736
  const names = refCandidates(ref);
681
- const response = yield* remote.fetchBytes(`https://github.com/${repo}.git/git-upload-pack`, {
682
- body: lsRefsRequest(names),
683
- headers: gitRequestHeaders
684
- }).pipe(
685
- // GitHub asks for credentials when a repository is missing or private.
686
- Effect_exports.mapError(
687
- (error) => error.status === 401 || error.status === 404 ? new SkillLoadFailed({
688
- reason: "source",
689
- message: `GitHub has no public repository named ${repo}.`,
690
- status: error.status
691
- }) : error
692
- )
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
+ })
693
755
  );
694
756
  const refs = yield* git(() => parseLsRefs(response));
695
757
  const commit = names.map((name) => refs.get(name)).find((sha) => sha !== void 0);
696
758
  if (commit === void 0)
697
759
  return yield* new SkillLoadFailed({
698
760
  reason: "source",
699
- message: `GitHub repository ${repo} has no branch or tag named ${ref}.`
761
+ message: `The refs read from GitHub repository ${repo} include no branch or tag named ${ref}.`,
762
+ missing: "ref"
700
763
  });
701
764
  return commit;
702
765
  });
703
- var listFiles = (remote, repo, commit, path) => remote.fetchBytes(`https://github.com/${repo}.git/git-upload-pack`, {
704
- body: treeFetchRequest(commit),
705
- headers: gitRequestHeaders
706
- }).pipe(
766
+ var listFiles = (github, commit, path) => github.upload(treeFetchRequest(commit)).pipe(
707
767
  Effect_exports.flatMap(
708
768
  (response) => git(
709
769
  () => parseTreeFetch(response, commit, path, { objectBytes: skillLoadLimits.fileBytes })
@@ -716,8 +776,8 @@ var SkillDirectories = Schema_exports.Array(
716
776
  files: Schema_exports.Array(Schema_exports.Struct({ path: Schema_exports.String, mode: Schema_exports.String }))
717
777
  })
718
778
  );
719
- var skillDirectories = (remote, repo, commit, path) => Effect_exports.gen(function* () {
720
- const files = yield* listFiles(remote, repo, commit, path);
779
+ var skillDirectories = (github, commit, path) => Effect_exports.gen(function* () {
780
+ const files = yield* listFiles(github, commit, path);
721
781
  const documents = files.filter(
722
782
  (file) => file.path === "SKILL.md" || file.path.endsWith("/SKILL.md")
723
783
  );
@@ -729,30 +789,122 @@ var skillDirectories = (remote, repo, commit, path) => Effect_exports.gen(functi
729
789
  return yield* failed("limit");
730
790
  return directories;
731
791
  });
732
- var cachedSkillDirectories = (cache, repo, commit, path) => Effect_exports.tryPromise({
733
- try: () => cache.get({
734
- key: ["apps/githubSkills/directories", 1, repo, commit, path ?? null],
735
- schema: wrap(SkillDirectories, false),
736
- freshFor: "7 days",
737
- load: (context) => Effect_exports.runPromise(
738
- reader(context).pipe(
739
- Effect_exports.flatMap((remote) => skillDirectories(remote, repo, commit, path))
740
- ),
741
- { signal: context.signal }
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.
803
+ reader({ fetch: transport.fetch, signal: context.signal }).pipe(
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
+ })
742
824
  )
743
- }),
744
- catch: (error) => Schema_exports.is(SkillLoadFailed)(error) ? error : new SkillLoadFailed({
745
- reason: "request",
746
- message: "Executor could not read or update the app cache for skills."
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"))
747
837
  })
748
- });
838
+ );
839
+ var cachedCatalog = (options, prefix, publication) => options.cache === void 0 ? publication(options, void 0).pipe(Effect_exports.flatMap((source) => source.load)) : catalogCache({
840
+ cache: options.cache,
841
+ ...options.freshFor === void 0 ? {} : { freshFor: options.freshFor },
842
+ ...options.staleFor === void 0 ? {} : { staleFor: options.staleFor },
843
+ stale: "revalidate",
844
+ prefix,
845
+ schema: AppSkillSource,
846
+ summary: { schema: AppSkillMetadata, of: ({ files: _files, ...metadata }) => metadata },
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
+ })
854
+ }).pipe(
855
+ Effect_exports.flatMap((catalog) => catalog.list()),
856
+ Effect_exports.mapError(
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
+ )
864
+ )
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.user.accounts.<slot> or ctx.app.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;
749
888
  var githubSkillsEffect = (options) => Effect_exports.gen(function* () {
750
889
  if (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(options.repo) || options.path !== void 0 && !resourcePath(options.path))
751
890
  return yield* failed("source");
752
- const remote = yield* reader(options);
753
- const commit = yield* resolveCommit(remote, options.repo, options.ref);
754
- const resources = yield* options.cache === void 0 ? skillDirectories(remote, options.repo, commit, options.path) : cachedSkillDirectories(options.cache, options.repo, commit, options.path);
755
- const base = `https://raw.githubusercontent.com/${options.repo}/${commit}/`;
891
+ const cache = yield* githubCache(options);
892
+ return yield* cachedCatalog(
893
+ cache === void 0 ? options : { ...options, cache },
894
+ ["apps/githubSkills/catalog", 1, options.repo, options.ref ?? null, options.path ?? null],
895
+ (transport, cache2) => githubPublication(options, transport, cache2)
896
+ );
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);
756
908
  const skills = yield* Effect_exports.forEach(
757
909
  resources,
758
910
  ({ directory, files }) => Effect_exports.gen(function* () {
@@ -762,7 +914,7 @@ var githubSkillsEffect = (options) => Effect_exports.gen(function* () {
762
914
  const path = file.path.slice(directory.length);
763
915
  if (!resourcePath(file.path) || !resourcePath(path) || file.mode === "120000")
764
916
  return yield* failed("source");
765
- return { path, content: yield* remote.read(pathUrl(base, file.path)) };
917
+ return { path, content: yield* github.file(commit, file.path) };
766
918
  }),
767
919
  { concurrency: skillLoadLimits.concurrency }
768
920
  );
@@ -775,7 +927,7 @@ var githubSkillsEffect = (options) => Effect_exports.gen(function* () {
775
927
  { concurrency: 1 }
776
928
  );
777
929
  return yield* parse(AppSkills, skills);
778
- }).pipe(withService("GitHub"));
930
+ });
779
931
  var Index = Schema_exports.Struct({
780
932
  skills: Schema_exports.Array(
781
933
  Schema_exports.Struct({
@@ -793,9 +945,20 @@ var wellKnownSkillsEffect = (options) => Effect_exports.gen(function* () {
793
945
  if (url.pathname === "/") url.pathname = "/.well-known/agent-skills/index.json";
794
946
  else if (!url.pathname.endsWith("index.json"))
795
947
  url.pathname = `${url.pathname.replace(/\/$/, "")}/index.json`;
796
- const remote = yield* reader(options);
797
- const first = yield* remote.read(url.href);
948
+ return yield* cachedCatalog(
949
+ options,
950
+ ["apps/wellKnownSkills/catalog", 1, url.href],
951
+ (transport) => wellKnownPublication(url, transport)
952
+ );
953
+ }).pipe(withService(URL.canParse(options.url) ? new URL(options.url).hostname : void 0));
954
+ var wellKnownPublication = (url, transport) => Effect_exports.gen(function* () {
955
+ const remote = yield* reader(transport);
956
+ const first = yield* checked(remote.read(url.href));
798
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* () {
799
962
  if (index.skills.reduce((count, skill) => count + skill.files.length, 0) > skillLoadLimits.files)
800
963
  return yield* failed("limit");
801
964
  const skills = yield* Effect_exports.forEach(
@@ -818,7 +981,7 @@ var wellKnownSkillsEffect = (options) => Effect_exports.gen(function* () {
818
981
  );
819
982
  if ((yield* remote.read(url.href)) !== first) return yield* failed("changed");
820
983
  return yield* parse(AppSkills, skills);
821
- }).pipe(withService(URL.canParse(options.url) ? new URL(options.url).hostname : void 0));
984
+ });
822
985
 
823
986
  // src/skills.ts
824
987
  var githubSkills = (options) => Effect_exports.runPromise(