apps 0.0.1-beta.1 → 0.0.1-beta.2

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 (47) hide show
  1. package/framework-reference.json +1 -1
  2. package/js/browser-XIPJGLH2.js +65 -0
  3. package/js/{chunk-6YBRWRK3.js → chunk-5MQZEB6Y.js} +16 -4
  4. package/js/chunk-D47C7KG5.js +172 -0
  5. package/js/{chunk-ZTFQHGEB.js → chunk-FDNTX5QJ.js} +1 -3
  6. package/js/{chunk-G7IE6BKC.js → chunk-HDTGZWP2.js} +2 -2
  7. package/js/{chunk-KOXMLKTM.js → chunk-J7O55ZV7.js} +20 -148
  8. package/js/{chunk-RBAC33PQ.js → chunk-JN55AYQH.js} +3 -57
  9. package/js/chunk-LGIYBDWA.js +85 -0
  10. package/js/{chunk-IHQ4ML7K.js → chunk-MYYEW3RA.js} +130 -86
  11. package/js/{chunk-PZ36XMXW.js → chunk-PYUYJRSK.js} +1 -1
  12. package/js/{chunk-X7SFGU4Q.js → chunk-RN2MXB4R.js} +4 -4
  13. package/js/{chunk-NCYXZN2G.js → chunk-UVL56Z6E.js} +390 -23
  14. package/js/{chunk-2HHMABB6.js → chunk-WFSQXYUT.js} +46 -10
  15. package/js/{chunk-6IIO4NPI.js → chunk-Z5NMEGJN.js} +1 -1
  16. package/js/client.js +1 -1
  17. package/js/contracts.js +8 -1
  18. package/js/effect.js +8 -7
  19. package/js/es-APDZKREY.js +40968 -0
  20. package/js/graphql.js +10 -9
  21. package/js/host.js +12 -11
  22. package/js/index.js +7 -5
  23. package/js/mcp/effect.js +10 -9
  24. package/js/mcp/stdio.js +10 -9
  25. package/js/mcp.js +12 -11
  26. package/js/openapi.js +776 -41590
  27. package/js/skills/effect.js +1 -2
  28. package/js/skills.js +47 -10
  29. package/package.json +1 -1
  30. package/runtime.json +1 -1
  31. package/types/app-cache/src/contracts/cache.d.ts +42 -2
  32. package/types/app-cache/src/index.d.ts +59 -1
  33. package/types/apps/src/contracts/cache.d.ts +4 -1
  34. package/types/apps/src/contracts/host.d.ts +8 -672
  35. package/types/apps/src/contracts/openapi.d.ts +6 -0
  36. package/types/apps/src/contracts/protocol-version.d.ts +6 -0
  37. package/types/apps/src/contracts/protocols/1.d.ts +1575 -0
  38. package/types/apps/src/contracts/skills.d.ts +17 -8
  39. package/types/apps/src/implementation/cache.d.ts +3 -1
  40. package/types/apps/src/implementation/openapi-compile.d.ts +1 -1
  41. package/types/apps/src/implementation/openapi-document.d.ts +0 -2
  42. package/types/apps/src/implementation/openapi-names.d.ts +18 -0
  43. package/types/apps/src/implementation/openapi-request.d.ts +0 -1
  44. package/types/apps/src/implementation/openapi-source.d.ts +5 -1
  45. package/types/apps/src/implementation/schema.d.ts +0 -5
  46. package/types/apps/src/implementation/swagger-client.d.ts +28 -0
  47. package/types/apps/src/skills.d.ts +6 -3
@@ -16,7 +16,17 @@ export declare const cacheLimits: {
16
16
  readonly totalEntries: 100000;
17
17
  readonly retentionMs: number;
18
18
  readonly loadTimeoutMs: 90000;
19
- readonly leaseMs: 120000;
19
+ /**
20
+ * A loader's lease lapses this long after its host last renewed it. Hosts renew every
21
+ * `renewMs` while the invocation that claimed it runs, so a stalled or lost holder frees the
22
+ * key well inside an MCP execute budget.
23
+ */
24
+ readonly leaseMs: 15000;
25
+ readonly renewMs: 5000;
26
+ /** The longest a caller waits on another loader before loading for itself without publishing. */
27
+ readonly waitMs: 10000;
28
+ /** Bound for one command to a host store; a lost reply fails instead of holding its caller. */
29
+ readonly commandTimeoutMs: 10000;
20
30
  };
21
31
  /** Stored values carry a version independent of their freshness clock. */
22
32
  export declare const CacheEntry: Schema.Struct<{
@@ -27,10 +37,31 @@ export declare const CacheEntry: Schema.Struct<{
27
37
  }>;
28
38
  /** Decoded cache value envelope. */
29
39
  export type CacheEntry = typeof CacheEntry.Type;
30
- /** Publication requires the lease acquired against the previously observed version. */
40
+ /** The current entry, and a lease when this caller now owns its load. */
41
+ export declare const CacheAcquired: Schema.Struct<{
42
+ readonly entry: Schema.NullOr<Schema.Struct<{
43
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
44
+ readonly version: Schema.String;
45
+ readonly freshUntil: Schema.Finite;
46
+ readonly staleUntil: Schema.Finite;
47
+ }>>;
48
+ readonly lease: Schema.NullOr<Schema.String>;
49
+ }>;
50
+ /**
51
+ * Publication requires the lease acquired against the previously observed version.
52
+ * `acquire` reads one entry and claims its load in the same transaction, so a cache
53
+ * miss costs one round trip. `read` and `claim` remain for builds retained before it.
54
+ */
31
55
  export declare const CacheCommand: Schema.Union<readonly [Schema.Struct<{
32
56
  readonly operation: Schema.Literal<"read">;
33
57
  readonly keys: Schema.$Array<Schema.String>;
58
+ }>, Schema.Struct<{
59
+ readonly operation: Schema.Literal<"acquire">;
60
+ readonly key: Schema.String;
61
+ /** Claim even a fresh entry, as an explicit refresh does. */
62
+ readonly refresh: Schema.Boolean;
63
+ /** Claim only while the entry still has this version. Absent accepts the current one. */
64
+ readonly version: Schema.optionalKey<Schema.NullOr<Schema.String>>;
34
65
  }>, Schema.Struct<{
35
66
  readonly operation: Schema.Literal<"claim">;
36
67
  readonly key: Schema.String;
@@ -49,6 +80,10 @@ export declare const CacheCommand: Schema.Union<readonly [Schema.Struct<{
49
80
  readonly operation: Schema.Literal<"release">;
50
81
  readonly key: Schema.String;
51
82
  readonly lease: Schema.String;
83
+ }>, Schema.Struct<{
84
+ readonly operation: Schema.Literal<"renew">;
85
+ readonly key: Schema.String;
86
+ readonly lease: Schema.String;
52
87
  }>, Schema.Struct<{
53
88
  readonly operation: Schema.Literal<"write">;
54
89
  readonly entries: Schema.$Array<Schema.Struct<{
@@ -68,6 +103,11 @@ export declare const CacheCommand: Schema.Union<readonly [Schema.Struct<{
68
103
  export type CacheCommand = typeof CacheCommand.Type;
69
104
  /** Replies remain JSON across Worker RPC and are decoded by each caller. */
70
105
  export type CacheTransport = (command: CacheCommand) => Effect.Effect<Schema.Json, CacheError>;
106
+ /**
107
+ * Whether a command replaced or removed retained data: a published refresh, a direct write or an
108
+ * invalidation. Hosts report these so results evaluated from the earlier data are not reused.
109
+ */
110
+ export declare const changesCache: (command: unknown) => boolean;
71
111
  /** Safe protocol envelope used at process boundaries. */
72
112
  export declare const CacheReply: Schema.Union<readonly [Schema.Struct<{
73
113
  readonly ok: Schema.Literal<true>;
@@ -13,7 +13,9 @@ export interface CacheGet<A> {
13
13
  readonly load: Effect.Effect<A, unknown>;
14
14
  }
15
15
  /** Create a scoped cache client; a background runner must retain all task resources until completion. */
16
- export declare const makeCache: (transport: CacheTransport, background: (task: Effect.Effect<void, unknown>) => Effect.Effect<void>, scope?: Schema.Json) => {
16
+ export declare const makeCache: (host: CacheTransport, background: (task: Effect.Effect<void, unknown>) => Effect.Effect<void>, scope?: Schema.Json,
17
+ /** The caller's own deadline, when the host supplies one. Waiting never runs past it. */
18
+ deadline?: number) => {
17
19
  /** Read arbitrary retained JSON entries without initiating a refresh. Missing and null are distinct. */
18
20
  read: (keys: readonly Schema.Json[]) => Effect.Effect<readonly ({
19
21
  readonly value: Schema.Json;
@@ -33,3 +35,59 @@ export declare const makeCache: (transport: CacheTransport, background: (task: E
33
35
  /** Force one awaited refresh without removing the retained value. Concurrent refreshes share a load. */
34
36
  revalidate: <A>(options: CacheGet<A>) => Effect.Effect<A, unknown, never>;
35
37
  };
38
+ /**
39
+ * Host-side lease ownership for one app invocation. Leases the invocation claims are renewed while
40
+ * it runs, so a slow load keeps its key, and released when the host ends the invocation, including
41
+ * interrupted and cancelled ones and loads whose own release never arrived. A holder that stops
42
+ * running, or whose store channel stops answering, loses its lease within `leaseMs`.
43
+ */
44
+ export declare const holdLeases: (transport: CacheTransport) => Effect.Effect<{
45
+ /** Use for every command of the invocation. Each command is bounded by `commandTimeoutMs`. */
46
+ transport: (input: {
47
+ readonly operation: "read";
48
+ readonly keys: readonly string[];
49
+ } | {
50
+ readonly operation: "acquire";
51
+ readonly key: string;
52
+ readonly refresh: boolean;
53
+ readonly version?: string | null;
54
+ } | {
55
+ readonly operation: "claim";
56
+ readonly key: string;
57
+ readonly version: string | null;
58
+ } | {
59
+ readonly operation: "publish";
60
+ readonly key: string;
61
+ readonly lease: string;
62
+ readonly entry: {
63
+ readonly value: Schema.Json;
64
+ readonly version: string;
65
+ readonly freshUntil: number;
66
+ readonly staleUntil: number;
67
+ };
68
+ } | {
69
+ readonly operation: "release";
70
+ readonly key: string;
71
+ readonly lease: string;
72
+ } | {
73
+ readonly operation: "renew";
74
+ readonly key: string;
75
+ readonly lease: string;
76
+ } | {
77
+ readonly operation: "write";
78
+ readonly entries: readonly {
79
+ readonly key: string;
80
+ readonly entry: {
81
+ readonly value: Schema.Json;
82
+ readonly version: string;
83
+ readonly freshUntil: number;
84
+ readonly staleUntil: number;
85
+ };
86
+ }[];
87
+ } | {
88
+ readonly operation: "invalidate";
89
+ readonly key: string;
90
+ }) => Effect.Effect<Schema.Json, CacheError, never>;
91
+ /** Stop renewing and release every lease the invocation still holds. */
92
+ close: Effect.Effect<void, never, never>;
93
+ }, never, never>;
@@ -29,7 +29,10 @@ export interface AppCache {
29
29
  readonly value: JsonValue;
30
30
  }[], retention: Duration.Input) => Promise<void>;
31
31
  readonly invalidate: (key: JsonValue) => Promise<void>;
32
- /** Uses the current bound credentials' fingerprint, never just the saved account ID. */
32
+ /**
33
+ * Scope entries to a bound account and its credential generation. Token renewal keeps the
34
+ * entries; reconnecting or replacing the account's credentials starts an empty scope.
35
+ */
33
36
  readonly forAccount: (account: {
34
37
  readonly id: string;
35
38
  }) => AppCache;