apps 0.0.1-beta.0 → 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 (114) hide show
  1. package/README.md +97 -4
  2. package/framework-reference.json +1 -1
  3. package/js/browser-XIPJGLH2.js +65 -0
  4. package/js/{chunk-SBKHUC5L.js → chunk-4LPG6RCH.js} +2 -2
  5. package/js/chunk-5MQZEB6Y.js +172 -0
  6. package/js/{chunk-7JXHF5IF.js → chunk-BMOIAIVR.js} +1 -1
  7. package/js/chunk-CZ7CSFO4.js +39 -0
  8. package/js/chunk-D47C7KG5.js +172 -0
  9. package/js/{chunk-YDR4CPJA.js → chunk-EVJUVWN2.js} +8 -8
  10. package/js/chunk-FDNTX5QJ.js +78 -0
  11. package/js/{chunk-2OTCEKL2.js → chunk-FW5HBOIK.js} +2352 -1493
  12. package/js/{chunk-EP6AEUZO.js → chunk-FZJOYIZO.js} +1 -1
  13. package/js/{chunk-VFUZI3NY.js → chunk-HDJH3RPR.js} +4 -4
  14. package/js/{chunk-WIDTG42X.js → chunk-HDTGZWP2.js} +79 -26
  15. package/js/{chunk-Q2FD5IBM.js → chunk-J7O55ZV7.js} +298 -37
  16. package/js/{chunk-X3YBZCJW.js → chunk-JN55AYQH.js} +8 -41
  17. package/js/chunk-LGIYBDWA.js +85 -0
  18. package/js/{chunk-D6BKYP2L.js → chunk-M6ZRRIBI.js} +4 -4
  19. package/js/{chunk-HP7E42X6.js → chunk-MYYEW3RA.js} +767 -249
  20. package/js/{chunk-3ANFZFCV.js → chunk-OHRT55C4.js} +15 -15
  21. package/js/{chunk-R6JMJSVT.js → chunk-PLCMJREA.js} +2 -2
  22. package/js/{chunk-C24KEZXR.js → chunk-PYUYJRSK.js} +36 -2
  23. package/js/{chunk-W7Q5EOTS.js → chunk-QKHR7BMF.js} +32 -32
  24. package/js/{chunk-KWTCHVLT.js → chunk-RN2MXB4R.js} +47 -51
  25. package/js/{chunk-36DNRFZQ.js → chunk-SATWJKN6.js} +1 -1
  26. package/js/chunk-SWPD52J7.js +35 -0
  27. package/js/{chunk-BKVL7XAJ.js → chunk-TE4KO4HI.js} +1 -1
  28. package/js/chunk-UVL56Z6E.js +6641 -0
  29. package/js/chunk-W7D7WVSY.js +18 -0
  30. package/js/{chunk-BPEFS4YF.js → chunk-WFSQXYUT.js} +109 -17
  31. package/js/chunk-YEJOQEII.js +104 -0
  32. package/js/{chunk-LOKGDT6B.js → chunk-Z5NMEGJN.js} +5 -4
  33. package/js/{chunk-OWD2YICM.js → chunk-ZCAMUXSG.js} +116 -87
  34. package/js/chunk-ZJWDMTE3.js +63 -0
  35. package/js/client.js +11 -11
  36. package/js/contracts.js +88 -25
  37. package/js/effect.js +21 -15
  38. package/js/es-APDZKREY.js +40968 -0
  39. package/js/graphql.js +224 -121
  40. package/js/host.js +76 -19
  41. package/js/index.js +193 -51
  42. package/js/mcp/effect.js +25 -17
  43. package/js/mcp/stdio.js +23 -17
  44. package/js/mcp.js +110 -24
  45. package/js/openapi.js +3045 -105
  46. package/js/operations/approval.js +1 -1
  47. package/js/react.js +4 -4
  48. package/js/skills/effect.js +11 -0
  49. package/js/skills.js +894 -0
  50. package/js/storage/facet.js +7 -7
  51. package/js/ui/auth/contracts.js +6 -6
  52. package/js/ui/auth.js +8 -8
  53. package/js/ui/contracts.js +5 -5
  54. package/js/ui/serving.js +12 -12
  55. package/package.json +9 -1
  56. package/runtime.json +1 -1
  57. package/types/app-cache/src/contracts/cache.d.ts +119 -0
  58. package/types/app-cache/src/index.d.ts +93 -0
  59. package/types/apps/src/contracts/api-response-error.d.ts +43 -0
  60. package/types/apps/src/contracts/app.d.ts +11 -0
  61. package/types/apps/src/contracts/cache.d.ts +44 -0
  62. package/types/apps/src/contracts/dynamic-skills.d.ts +10 -0
  63. package/types/apps/src/contracts/dynamic-tools.d.ts +13 -0
  64. package/types/apps/src/contracts/graphql.d.ts +18 -1
  65. package/types/apps/src/contracts/host.d.ts +54 -525
  66. package/types/apps/src/contracts/mcp.d.ts +3 -1
  67. package/types/apps/src/contracts/openapi-compile.d.ts +11 -0
  68. package/types/apps/src/contracts/openapi-document.d.ts +53 -0
  69. package/types/apps/src/contracts/openapi.d.ts +156 -30
  70. package/types/apps/src/contracts/protocol-version.d.ts +6 -0
  71. package/types/apps/src/contracts/protocols/1.d.ts +1575 -0
  72. package/types/apps/src/contracts/provider-error.d.ts +15 -0
  73. package/types/apps/src/contracts/provider.d.ts +18 -1
  74. package/types/apps/src/contracts/skills.d.ts +122 -0
  75. package/types/apps/src/contracts/swagger-client.d.ts +29 -0
  76. package/types/apps/src/graphql.d.ts +6 -6
  77. package/types/apps/src/host.d.ts +1 -0
  78. package/types/apps/src/implementation/account-operations.d.ts +122 -3
  79. package/types/apps/src/implementation/app.d.ts +1 -1
  80. package/types/apps/src/implementation/cache-session.d.ts +7 -0
  81. package/types/apps/src/implementation/cache.d.ts +8 -0
  82. package/types/apps/src/implementation/catalog-cache.d.ts +29 -0
  83. package/types/apps/src/implementation/dynamic-skills.d.ts +7 -0
  84. package/types/apps/src/implementation/dynamic-tools.d.ts +8 -0
  85. package/types/apps/src/implementation/elicitation.d.ts +12 -12
  86. package/types/apps/src/implementation/git.d.ts +25 -0
  87. package/types/apps/src/implementation/graphql-catalog.d.ts +10 -0
  88. package/types/apps/src/implementation/graphql.d.ts +81 -3
  89. package/types/apps/src/implementation/inflate.d.ts +16 -0
  90. package/types/apps/src/implementation/input-problems.d.ts +3 -0
  91. package/types/apps/src/implementation/mcp-call.d.ts +3 -2
  92. package/types/apps/src/implementation/mcp-catalog.d.ts +12 -0
  93. package/types/apps/src/implementation/mcp-client.d.ts +9 -8
  94. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  95. package/types/apps/src/implementation/mcp-tools.d.ts +6 -3
  96. package/types/apps/src/implementation/mcp.d.ts +39 -2
  97. package/types/apps/src/implementation/openapi-compile.d.ts +119 -0
  98. package/types/apps/src/implementation/openapi-document.d.ts +51 -0
  99. package/types/apps/src/implementation/openapi-names.d.ts +18 -0
  100. package/types/apps/src/implementation/openapi-request.d.ts +10 -4
  101. package/types/apps/src/implementation/openapi-source.d.ts +40 -0
  102. package/types/apps/src/implementation/openapi.d.ts +39 -3
  103. package/types/apps/src/implementation/provider-error.d.ts +10 -0
  104. package/types/apps/src/implementation/schema.d.ts +6 -5
  105. package/types/apps/src/implementation/skill-files.d.ts +10 -0
  106. package/types/apps/src/implementation/skills.d.ts +43 -0
  107. package/types/apps/src/implementation/swagger-client.d.ts +28 -0
  108. package/types/apps/src/index.d.ts +7 -0
  109. package/types/apps/src/mcp.d.ts +5 -5
  110. package/types/apps/src/openapi.d.ts +3 -1
  111. package/types/apps/src/skills.d.ts +75 -0
  112. package/types/telemetry/src/config.d.ts +2 -0
  113. package/js/chunk-22WRQZT7.js +0 -389
  114. package/js/chunk-MLKGABMK.js +0 -9
@@ -0,0 +1,119 @@
1
+ /** Serializable cache protocol. Hosts bind the application and build namespace separately. */
2
+ import { Schema, type Effect } from "effect";
3
+ declare const CacheError_base: Schema.Class<CacheError, Schema.TaggedStruct<"CacheError", {
4
+ readonly reason: Schema.Literals<readonly ["unavailable", "storage", "invalid", "capacity", "timeout"]>;
5
+ }>, import("effect/Cause").YieldableError>;
6
+ /** Expected cache failures never include keys, values or upstream exception text. */
7
+ export declare class CacheError extends CacheError_base {
8
+ }
9
+ /** Bounded defaults shared by loaders and persistent adapters. */
10
+ export declare const cacheLimits: {
11
+ readonly keyBytes: 8192;
12
+ readonly entryBytes: 2000000;
13
+ readonly batchBytes: 8000000;
14
+ readonly batchEntries: 128;
15
+ readonly totalBytes: 128000000;
16
+ readonly totalEntries: 100000;
17
+ readonly retentionMs: number;
18
+ readonly loadTimeoutMs: 90000;
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;
30
+ };
31
+ /** Stored values carry a version independent of their freshness clock. */
32
+ export declare const CacheEntry: Schema.Struct<{
33
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
34
+ readonly version: Schema.String;
35
+ readonly freshUntil: Schema.Finite;
36
+ readonly staleUntil: Schema.Finite;
37
+ }>;
38
+ /** Decoded cache value envelope. */
39
+ export type CacheEntry = typeof CacheEntry.Type;
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
+ */
55
+ export declare const CacheCommand: Schema.Union<readonly [Schema.Struct<{
56
+ readonly operation: Schema.Literal<"read">;
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>>;
65
+ }>, Schema.Struct<{
66
+ readonly operation: Schema.Literal<"claim">;
67
+ readonly key: Schema.String;
68
+ readonly version: Schema.NullOr<Schema.String>;
69
+ }>, Schema.Struct<{
70
+ readonly operation: Schema.Literal<"publish">;
71
+ readonly key: Schema.String;
72
+ readonly lease: Schema.String;
73
+ readonly entry: Schema.Struct<{
74
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
75
+ readonly version: Schema.String;
76
+ readonly freshUntil: Schema.Finite;
77
+ readonly staleUntil: Schema.Finite;
78
+ }>;
79
+ }>, Schema.Struct<{
80
+ readonly operation: Schema.Literal<"release">;
81
+ readonly key: Schema.String;
82
+ readonly lease: Schema.String;
83
+ }>, Schema.Struct<{
84
+ readonly operation: Schema.Literal<"renew">;
85
+ readonly key: Schema.String;
86
+ readonly lease: Schema.String;
87
+ }>, Schema.Struct<{
88
+ readonly operation: Schema.Literal<"write">;
89
+ readonly entries: Schema.$Array<Schema.Struct<{
90
+ readonly key: Schema.String;
91
+ readonly entry: Schema.Struct<{
92
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
93
+ readonly version: Schema.String;
94
+ readonly freshUntil: Schema.Finite;
95
+ readonly staleUntil: Schema.Finite;
96
+ }>;
97
+ }>>;
98
+ }>, Schema.Struct<{
99
+ readonly operation: Schema.Literal<"invalidate">;
100
+ readonly key: Schema.String;
101
+ }>]>;
102
+ /** Parsed host command; namespaces cannot be selected by app code. */
103
+ export type CacheCommand = typeof CacheCommand.Type;
104
+ /** Replies remain JSON across Worker RPC and are decoded by each caller. */
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;
111
+ /** Safe protocol envelope used at process boundaries. */
112
+ export declare const CacheReply: Schema.Union<readonly [Schema.Struct<{
113
+ readonly ok: Schema.Literal<true>;
114
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
115
+ }>, Schema.Struct<{
116
+ readonly ok: Schema.Literal<false>;
117
+ readonly error: typeof CacheError;
118
+ }>]>;
119
+ export {};
@@ -0,0 +1,93 @@
1
+ /** Portable Effect cache mechanics. Adapters own storage and the background task lifetime. */
2
+ import { Duration, Effect, Schema } from "effect";
3
+ import { CacheError, type CacheTransport } from "./contracts/cache.js";
4
+ export * from "./contracts/cache.js";
5
+ /** Hash key material before storage or transport; keys and credential scope never enter telemetry. */
6
+ export declare const cacheKey: (key: unknown) => Effect.Effect<string, CacheError, never>;
7
+ /** A cache hit is decoded with the caller's schema. Loader failures are never cached. */
8
+ export interface CacheGet<A> {
9
+ readonly key: Schema.Json;
10
+ readonly schema: Schema.Decoder<A>;
11
+ readonly freshFor: Duration.Input;
12
+ readonly staleFor?: Duration.Input;
13
+ readonly load: Effect.Effect<A, unknown>;
14
+ }
15
+ /** Create a scoped cache client; a background runner must retain all task resources until completion. */
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) => {
19
+ /** Read arbitrary retained JSON entries without initiating a refresh. Missing and null are distinct. */
20
+ read: (keys: readonly Schema.Json[]) => Effect.Effect<readonly ({
21
+ readonly value: Schema.Json;
22
+ readonly version: string;
23
+ readonly freshUntil: number;
24
+ readonly staleUntil: number;
25
+ } | null)[], CacheError, never>;
26
+ /** Publish bounded immutable parts before publishing the manifest that references them. */
27
+ write: (entries: readonly {
28
+ readonly key: Schema.Json;
29
+ readonly value: Schema.Json;
30
+ }[], retention: Duration.Input) => Effect.Effect<void, CacheError, never>;
31
+ /** Revoke retained data and any loader's right to publish its in-flight result. */
32
+ 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. */
34
+ get: <A>(options: CacheGet<A>) => Effect.Effect<A, unknown, never>;
35
+ /** Force one awaited refresh without removing the retained value. Concurrent refreshes share a load. */
36
+ revalidate: <A>(options: CacheGet<A>) => Effect.Effect<A, unknown, never>;
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>;
@@ -0,0 +1,43 @@
1
+ import { Schema } from "effect";
2
+ /** Bounded recovery a declared API error published for its caller: a short next step and agent guidance. */
3
+ export declare const ApiErrorRecovery: Schema.Struct<{
4
+ readonly action: Schema.NonEmptyString;
5
+ readonly instructions: Schema.NonEmptyString;
6
+ }>;
7
+ /** Recovery copied from an error response body; extra keys are dropped on decode. */
8
+ export type ApiErrorRecovery = typeof ApiErrorRecovery.Type;
9
+ /** Bounded public fields from a response matching its declared API error schema. */
10
+ export declare const ApiErrorResponse: Schema.Struct<{
11
+ readonly code: Schema.NonEmptyString;
12
+ readonly status: Schema.Int;
13
+ readonly message: Schema.NonEmptyString;
14
+ readonly recovery: Schema.optionalKey<Schema.Struct<{
15
+ readonly action: Schema.NonEmptyString;
16
+ readonly instructions: Schema.NonEmptyString;
17
+ }>>;
18
+ }>;
19
+ /** Safe projection of a response matching a declared API error schema. */
20
+ export type ApiErrorResponse = typeof ApiErrorResponse.Type;
21
+ declare const OpenapiResponseError_base: Schema.Class<OpenapiResponseError, Schema.TaggedStruct<"OpenapiResponseError", {
22
+ readonly code: Schema.NonEmptyString;
23
+ readonly status: Schema.Int;
24
+ readonly message: Schema.NonEmptyString;
25
+ readonly recovery: Schema.optionalKey<Schema.Struct<{
26
+ readonly action: Schema.NonEmptyString;
27
+ readonly instructions: Schema.NonEmptyString;
28
+ }>>;
29
+ }>, import("effect/Cause").YieldableError>;
30
+ /** A validated OpenAPI failure with its declared message or static schema explanation. */
31
+ export declare class OpenapiResponseError extends OpenapiResponseError_base {
32
+ }
33
+ /** Error response reads have independent byte and time bounds, including chunked bodies. */
34
+ export declare const OpenapiErrorLimits: Schema.Struct<{
35
+ readonly maxBodyBytes: Schema.Int;
36
+ readonly readTimeoutMs: Schema.Int;
37
+ }>;
38
+ /** Stop reading on overflow or timeout and keep the generic HTTP failure. */
39
+ export declare const defaultOpenapiErrorLimits: {
40
+ readonly maxBodyBytes: number;
41
+ readonly readTimeoutMs: number;
42
+ };
43
+ export {};
@@ -1,3 +1,4 @@
1
+ import type { AppSkillSource, SkillFile } from "./skills.js";
1
2
  import type { DatabaseDefinition } from "./storage.js";
2
3
  /** Native app contracts; factories and handlers compose in the host's Effect runtime. */
3
4
  import { type Effect, Schema } from "effect";
@@ -10,6 +11,12 @@ import type { Elicit } from "./elicitation.js";
10
11
  type Handler<Context> = (context: Context, input: never) => Effect.Effect<unknown, unknown>;
11
12
  /** App capabilities share one account context. Package metadata belongs in package.json. */
12
13
  export interface AppDefinition<Context> {
14
+ /** Optional dynamic tools; resolution does not enumerate the catalog. */
15
+ readonly dynamicTools?: import("./dynamic-tools.js").DynamicTools;
16
+ /** Omission reads packaged skills/. An explicit catalog replaces that default, including []. */
17
+ readonly skills?: readonly AppSkillSource[];
18
+ /** Optional lazy skills, added to the static catalog. Only skill reads call them. */
19
+ readonly dynamicSkills?: import("./dynamic-skills.js").DynamicSkills;
13
20
  readonly workflows?: Readonly<Record<string, AppWorkflow>>;
14
21
  readonly schedules?: Readonly<Record<string, Omit<OperationSchedule, "name"> & {
15
22
  readonly tool: string;
@@ -31,6 +38,10 @@ export type AccountSlots = Readonly<Record<string, Provider<AuthMethods> | ManyA
31
38
  type AccountsFor<Slot> = Slot extends ManyAccounts<infer Auth> ? readonly AccountOf<Provider<Auth>>[] : AccountOf<Slot>;
32
39
  /** Current credentials for one invocation. Never retained in source or build output. */
33
40
  export interface BoundContext<Slots extends AccountSlots> {
41
+ /** Explicit app/build-scoped caching. Account-specific loaders opt into forAccount. */
42
+ readonly cache: import("./cache.js").AppCache;
43
+ /** Text files retained in this deployment. Paths are package-relative, never host filesystem paths. */
44
+ readonly files: readonly SkillFile[];
34
45
  /** Read-only run management, bound to this configured app. */
35
46
  readonly workflows: WorkflowReads;
36
47
  /** Ask for user input during this tool call. Unavailable during discovery and after the invocation closes. */
@@ -0,0 +1,44 @@
1
+ /** Author cache API; schemas parse persisted values before they re-enter app code. */
2
+ import type { Duration, Effect } from "effect";
3
+ import type { CacheTransport } from "../../../app-cache/src/contracts/cache.js";
4
+ import type { Schema } from "../implementation/schema.js";
5
+ import type { JsonValue } from "./schema.js";
6
+ /** A cache loader owns its own cancellation and HTTP capability, including during SWR. */
7
+ export interface CacheLoadContext {
8
+ readonly cache: AppCache;
9
+ readonly signal: AbortSignal;
10
+ readonly fetch: typeof globalThis.fetch;
11
+ }
12
+ /** Load options shared by normal reads and explicit refreshes. */
13
+ export interface CacheGetOptions<A> {
14
+ readonly key: JsonValue;
15
+ readonly schema: Schema<A, boolean>;
16
+ readonly freshFor: Duration.Input;
17
+ readonly staleFor?: Duration.Input;
18
+ readonly load: (context: CacheLoadContext) => Promise<A>;
19
+ }
20
+ /** Cache keys describe every input that affects the value; the host adds app/build isolation. */
21
+ export interface AppCache {
22
+ readonly get: <A>(options: CacheGetOptions<A>) => Promise<A>;
23
+ /** Await a fresh load, coalescing concurrent refreshes and retaining the previous value on failure. */
24
+ readonly revalidate: <A>(options: CacheGetOptions<A>) => Promise<A>;
25
+ readonly read: <A>(key: JsonValue, schema: Schema<A, boolean>) => Promise<A | undefined>;
26
+ readonly readMany: <A>(keys: readonly JsonValue[], schema: Schema<A, boolean>) => Promise<readonly (A | undefined)[]>;
27
+ readonly write: (entries: readonly {
28
+ readonly key: JsonValue;
29
+ readonly value: JsonValue;
30
+ }[], retention: Duration.Input) => Promise<void>;
31
+ readonly invalidate: (key: JsonValue) => Promise<void>;
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
+ */
36
+ readonly forAccount: (account: {
37
+ readonly id: string;
38
+ }) => AppCache;
39
+ }
40
+ /** Trusted storage and background ownership; never accepted from request JSON. */
41
+ export interface HostCache {
42
+ readonly transport: CacheTransport;
43
+ readonly background: (task: Effect.Effect<void, unknown>) => Effect.Effect<void>;
44
+ }
@@ -0,0 +1,10 @@
1
+ /** Lazy skill loading, shaped like dynamic tools. Only skill reads call it. */
2
+ import type { Effect } from "effect";
3
+ import type { AppSkillSource } from "./skills.js";
4
+ /**
5
+ * `list` returns complete skills, including their files, added to the static catalog. Every
6
+ * skill read loads the full catalog. Names must not repeat across both catalogs.
7
+ */
8
+ export interface DynamicSkills {
9
+ readonly list: () => Effect.Effect<readonly AppSkillSource[], unknown>;
10
+ }
@@ -0,0 +1,13 @@
1
+ /** Lazy operation discovery and resolution. Executables remain invocation-owned. */
2
+ import type { Effect } from "effect";
3
+ import type { HostedTool, HostedToolSummary } from "./host.js";
4
+ import type { AppOperation } from "./operations.js";
5
+ /** Tool names include their queries./mutations. prefix. Resolution never requires listing. */
6
+ export interface DynamicTools {
7
+ readonly list: () => Effect.Effect<readonly HostedTool[], unknown>;
8
+ readonly resolve: (name: string) => Effect.Effect<AppOperation | undefined, unknown>;
9
+ /** Names and descriptions without schemas. Omitted sources reduce list(). */
10
+ readonly summaries?: () => Effect.Effect<readonly HostedToolSummary[], unknown>;
11
+ /** One tool's full metadata without listing. Omitted sources search list(). */
12
+ readonly describe?: (name: string) => Effect.Effect<HostedTool | undefined, unknown>;
13
+ }
@@ -1,3 +1,4 @@
1
+ import type { ProviderError } from "./provider-error.js";
1
2
  /** GraphQL discovery contracts. Catalogs are evaluated with the selected account. */
2
3
  import { Schema, type Effect } from "effect";
3
4
  import { type JsonValue } from "./schema.js";
@@ -15,6 +16,7 @@ export declare const defaultGraphqlClientLimits: {
15
16
  /** Endpoint and credential snapshot for one app evaluation. */
16
17
  export declare const GraphqlToolsOptions: Schema.Struct<{
17
18
  readonly url: Schema.String;
19
+ readonly accountId: Schema.optional<Schema.brand<Schema.String, "acc">>;
18
20
  readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
19
21
  readonly signal: Schema.optional<Schema.instanceOf<AbortSignal, AbortSignal>>;
20
22
  readonly timeoutMs: Schema.optional<Schema.Int>;
@@ -95,8 +97,23 @@ export interface GraphqlTool {
95
97
  readonly description: string;
96
98
  readonly readOnly: boolean;
97
99
  readonly input: Schema.Decoder<JsonValue>;
98
- readonly run: (context: unknown, input: JsonValue) => Effect.Effect<JsonValue, GraphqlError>;
100
+ readonly run: (context: unknown, input: JsonValue) => Effect.Effect<JsonValue, GraphqlError | ProviderError>;
99
101
  }
100
102
  /** One tool per root field; subscriptions require a separate long-lived host. */
101
103
  export type GraphqlTools = Readonly<Record<string, GraphqlTool>>;
104
+ /** Persisted execution data for one root field; no credentials or executable schema. */
105
+ export declare const GraphqlToolDefinition: Schema.Struct<{
106
+ readonly name: Schema.String;
107
+ readonly kind: Schema.Literals<readonly ["query", "mutation"]>;
108
+ readonly field: Schema.String;
109
+ readonly description: Schema.String;
110
+ readonly arguments: Schema.$Array<Schema.Struct<{
111
+ readonly name: Schema.String;
112
+ readonly type: Schema.String;
113
+ }>>;
114
+ readonly inputSchema: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
115
+ readonly composite: Schema.Boolean;
116
+ readonly selection: Schema.String;
117
+ }>;
118
+ export type GraphqlToolDefinition = typeof GraphqlToolDefinition.Type;
102
119
  export {};