apps 0.0.1-beta.41 → 0.0.1-beta.42

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 (51) hide show
  1. package/framework-reference.json +1 -1
  2. package/js/{chunk-AHGGO2VY.js → chunk-47BLLMRQ.js} +15 -14
  3. package/js/{chunk-ZUKBIHMK.js → chunk-4ZTVLEN6.js} +3 -3
  4. package/js/{chunk-JI3EP2GL.js → chunk-5GLC42LK.js} +35 -26
  5. package/js/{chunk-DKUEYTYD.js → chunk-74YVXBKY.js} +1 -1
  6. package/js/{chunk-RIXVGVA6.js → chunk-AQU56EPI.js} +9 -5
  7. package/js/{chunk-KAQD3DTI.js → chunk-EG72MSVK.js} +1 -1
  8. package/js/{chunk-TT6OU4UG.js → chunk-EJUK2NK5.js} +2 -2
  9. package/js/{chunk-EM4UL26F.js → chunk-EMHFXFTJ.js} +3 -3
  10. package/js/{chunk-YQ35E7KS.js → chunk-H2CJWXA3.js} +1 -1
  11. package/js/{chunk-MXDKXAY4.js → chunk-IFJU5SYQ.js} +10 -0
  12. package/js/{chunk-MJZYV7IO.js → chunk-ILYK7BQG.js} +3 -3
  13. package/js/{chunk-CQD3WSYH.js → chunk-IN2WIN7I.js} +2 -2
  14. package/js/{chunk-NKWWPJYX.js → chunk-JPEUKEV4.js} +1 -1
  15. package/js/{chunk-UOZMSUJ2.js → chunk-KBIKBWSS.js} +5 -3
  16. package/js/{chunk-WPBR4AWB.js → chunk-KGCTYL2S.js} +2 -2
  17. package/js/{chunk-VIU2XXA7.js → chunk-KSGYJV46.js} +2 -2
  18. package/js/{chunk-ADD6H64X.js → chunk-KTPKTBKZ.js} +9 -9
  19. package/js/{chunk-3MMG2H6M.js → chunk-LNSVJS2Q.js} +1 -1
  20. package/js/{chunk-6XGB4BAL.js → chunk-MSDGZ7FA.js} +9 -9
  21. package/js/{chunk-P7MGDPFD.js → chunk-MWKHKOTL.js} +2 -2
  22. package/js/{chunk-VJQXXOQ3.js → chunk-MZH4J2PO.js} +2 -2
  23. package/js/{chunk-OTCLXFLL.js → chunk-OBXHQNWC.js} +5 -5
  24. package/js/{chunk-FXWRE655.js → chunk-RIKH5H2X.js} +7 -7
  25. package/js/{chunk-KIM5HXNK.js → chunk-T65AFHU3.js} +3 -3
  26. package/js/{chunk-PNVCCB4L.js → chunk-VU6GQ2SH.js} +4 -4
  27. package/js/{chunk-JJSLEJ6T.js → chunk-XSD3RZFX.js} +5 -5
  28. package/js/{chunk-UTJIGUSS.js → chunk-Z3S2IVI3.js} +2 -2
  29. package/js/client.js +10 -10
  30. package/js/contracts.js +8 -8
  31. package/js/effect.js +19 -19
  32. package/js/graphql.js +21 -21
  33. package/js/host.js +19 -19
  34. package/js/index.js +12 -12
  35. package/js/mcp/effect.js +21 -21
  36. package/js/mcp/stdio.js +21 -21
  37. package/js/mcp.js +23 -23
  38. package/js/openapi.js +17 -17
  39. package/js/react.js +2 -2
  40. package/js/skills/effect.js +6 -6
  41. package/js/skills.js +50 -23
  42. package/js/ui/auth/contracts.js +2 -2
  43. package/js/ui/auth.js +5 -5
  44. package/js/ui/contracts.js +5 -5
  45. package/js/ui/serving.js +10 -10
  46. package/package.json +1 -1
  47. package/runtime.json +1 -1
  48. package/types/app-cache/src/index.d.ts +10 -1
  49. package/types/apps/src/contracts/cache.d.ts +6 -0
  50. package/types/apps/src/contracts/skills.d.ts +12 -5
  51. package/types/apps/src/implementation/catalog-cache.d.ts +12 -1
@@ -10,6 +10,12 @@ export interface CacheGet<A> {
10
10
  readonly schema: Schema.Decoder<A>;
11
11
  readonly freshFor: Duration.Input;
12
12
  readonly staleFor?: Duration.Input;
13
+ /**
14
+ * What a read does with a value past `freshFor` and within `staleFor`. `serve`, the default,
15
+ * returns it while one background load replaces it. `revalidate` awaits that load first, like a
16
+ * miss; the value stays readable to the load, which can confirm it instead of rebuilding it.
17
+ */
18
+ readonly stale?: "serve" | "revalidate";
13
19
  readonly load: Effect.Effect<A, unknown>;
14
20
  }
15
21
  /** Create a scoped cache client; a background runner must retain all task resources until completion. */
@@ -30,7 +36,10 @@ deadline?: number) => {
30
36
  }[], retention: Duration.Input) => Effect.Effect<void, CacheError, never>;
31
37
  /** Revoke retained data and any loader's right to publish its in-flight result. */
32
38
  invalidate: (key: Schema.Json) => Effect.Effect<void, CacheError, never>;
33
- /** Read fresh data, refresh stale data in the background, or wait for the lease owner. */
39
+ /**
40
+ * Read fresh data, refresh stale data in the background (or first, with `stale: "revalidate"`),
41
+ * or wait for the lease owner.
42
+ */
34
43
  get: <A>(options: CacheGet<A>) => Effect.Effect<A, unknown, never>;
35
44
  /** Force one awaited refresh without removing the retained value. Concurrent refreshes share a load. */
36
45
  revalidate: <A>(options: CacheGet<A>) => Effect.Effect<A, unknown, never>;
@@ -15,6 +15,12 @@ export interface CacheGetOptions<A> {
15
15
  readonly schema: Schema<A, boolean>;
16
16
  readonly freshFor: Duration.Input;
17
17
  readonly staleFor?: Duration.Input;
18
+ /**
19
+ * Past `freshFor`, `serve` (the default) returns the kept value while `load` replaces it in the
20
+ * background. `revalidate` awaits `load` first; the kept value stays readable with `read`, so
21
+ * the loader can confirm it with the source instead of rebuilding it.
22
+ */
23
+ readonly stale?: "serve" | "revalidate";
18
24
  readonly load: (context: CacheLoadContext) => Promise<A>;
19
25
  }
20
26
  /** Cache keys describe every input that affects the value; the host adds app/build isolation. */
@@ -98,6 +98,8 @@ export declare const skillLoadLimits: {
98
98
  readonly fileBytes: 2000000;
99
99
  readonly totalBytes: 20000000;
100
100
  readonly concurrency: 8;
101
+ /** The request that checks whether a kept catalog's publication changed. */
102
+ readonly checkMillis: 5000;
101
103
  };
102
104
  /** Invocation-owned transport and cancellation, supplied by the app context. */
103
105
  export interface SkillTransport {
@@ -109,14 +111,19 @@ export interface SkillReaderOptions extends SkillTransport {
109
111
  readonly service: string;
110
112
  }
111
113
  /**
112
- * Catalog reuse shared by remote skill loaders, with the same policy as MCP tool catalogs. Pass
113
- * `ctx.cache` to keep the loaded catalog; without it every read fetches the source again.
114
+ * Catalog reuse shared by remote skill loaders. Pass `ctx.cache` to keep the loaded catalog;
115
+ * without it every read fetches the source again. Unlike an MCP tool catalog, a skill catalog
116
+ * past `freshFor` is not served while it refreshes: the read first asks the source whether its
117
+ * publication changed, so agents never read skills that a refresh replaces moments later.
114
118
  */
115
119
  export interface SkillCacheOptions {
116
120
  readonly cache?: import("./cache.js").AppCache;
117
- /** Reuse the catalog for this duration. Defaults to five minutes. */
121
+ /** Reuse the catalog without asking the source for this duration. Defaults to five minutes. */
118
122
  readonly freshFor?: import("effect").Duration.Input;
119
- /** Serve the retained catalog while refreshing. Defaults to one day. */
123
+ /**
124
+ * Keep the catalog this long after `freshFor`. A read then confirms it with one request and
125
+ * loads the files again only when the publication changed. Defaults to one day.
126
+ */
120
127
  readonly staleFor?: import("effect").Duration.Input;
121
128
  }
122
129
  /**
@@ -133,7 +140,7 @@ export type GitHubSkillsAccount = import("./cache.js").AccountCredential<{
133
140
  }>;
134
141
  /**
135
142
  * A GitHub repository and an optional immutable commit, tag or branch. With a cache, a branch or
136
- * tag is resolved again when the catalog refreshes, and each commit's file list is kept.
143
+ * tag is resolved again once the catalog is past `freshFor`, and each commit's file list is kept.
137
144
  */
138
145
  export type GitHubSkillsOptions = SkillTransport & SkillCacheOptions & GitHubSkillsAccount & {
139
146
  readonly repo: string;
@@ -34,6 +34,11 @@ export interface CatalogLoad<A> {
34
34
  readonly tools: readonly A[];
35
35
  readonly header?: JsonObject;
36
36
  }
37
+ /** The catalog a refresh replaces, read only when its loader asks for it. */
38
+ export interface KeptCatalog<A> {
39
+ readonly header: JsonObject | undefined;
40
+ readonly tools: Effect.Effect<readonly A[], unknown>;
41
+ }
37
42
  export declare const catalogCache: <A extends {
38
43
  readonly name: string;
39
44
  }, S>(options: Omit<CatalogCacheOptions, "cache"> & {
@@ -46,7 +51,13 @@ export declare const catalogCache: <A extends {
46
51
  readonly schema: Schema.Decoder<S>;
47
52
  readonly of: (tool: A) => S;
48
53
  };
49
- readonly load: (context?: CacheLoadContext) => Effect.Effect<CatalogLoad<A>, unknown>;
54
+ /** Past `freshFor`, serve the kept catalog while refreshing, or refresh first. */
55
+ readonly stale?: "serve" | "revalidate";
56
+ /**
57
+ * Load the catalog. A refresh also gets the catalog it replaces, if one is kept, so a source
58
+ * that can confirm it is unchanged need not load it again.
59
+ */
60
+ readonly load: (context?: CacheLoadContext, kept?: Effect.Effect<KeptCatalog<A> | undefined, unknown>) => Effect.Effect<CatalogLoad<A>, unknown>;
50
61
  }) => Effect.Effect<{
51
62
  list: () => Effect.Effect<readonly A[], unknown, never>;
52
63
  /** The record stored with the current revision, if the source supplied one. */