apps 0.0.1-beta.14 → 0.0.1-beta.140
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 +60 -42
- package/framework-reference.json +1 -1
- package/js/{chunk-M3B3DE4K.js → chunk-2XDCAXAR.js} +612 -246
- package/js/{chunk-IPI4MFSN.js → chunk-34RH47V5.js} +2 -2
- package/js/chunk-5JBDHSLK.js +449 -0
- package/js/{chunk-KUMBKVJD.js → chunk-6QZVXLF2.js} +2 -2
- package/js/chunk-7MPPHKRW.js +5418 -0
- package/js/chunk-DQ6FIDC3.js +335 -0
- package/js/{chunk-5T57N25Q.js → chunk-EKXBHVMR.js} +697 -70
- package/js/chunk-EYZHR4UA.js +1945 -0
- package/js/chunk-GJG5G6CH.js +1022 -0
- package/js/chunk-H2K7OZ47.js +90 -0
- package/js/chunk-I6QAWNUM.js +161 -0
- package/js/{chunk-ODEIDRGW.js → chunk-JH3MOQZR.js} +1166 -504
- package/js/{chunk-QS6CAHKC.js → chunk-JHAHT26O.js} +4 -3
- package/js/{chunk-RFVIONFX.js → chunk-JIXIOWZP.js} +136 -45
- package/js/chunk-LSOHA2RH.js +88 -0
- package/js/{chunk-UK573G7W.js → chunk-MB6L5YZE.js} +1817 -632
- package/js/chunk-OBT33ZDK.js +95 -0
- package/js/{chunk-JU7VHODU.js → chunk-QTX7OUFH.js} +65 -10
- package/js/chunk-RBSXSRPU.js +175 -0
- package/js/chunk-SB2DNKDL.js +593 -0
- package/js/{chunk-VFZKSM3T.js → chunk-VX36SA7Y.js} +3 -3
- package/js/chunk-YF7TYPDS.js +49 -0
- package/js/{chunk-CDL5PM2Q.js → chunk-YFSOSNF3.js} +17265 -12477
- package/js/{chunk-IJX4CYZO.js → chunk-YVN2AMAU.js} +976 -447
- package/js/chunk-Z6DSU4VL.js +724 -0
- package/js/client.js +333 -98
- package/js/contracts.js +154 -21
- package/js/effect.js +18 -19
- package/js/graphql.js +231 -188
- package/js/host.js +138 -80
- package/js/index.js +153 -300
- package/js/mcp/effect.js +21 -21
- package/js/mcp.js +91 -57
- package/js/openapi.js +4950 -4201
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +220 -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 +9 -8
- package/js/ui/serving.js +8618 -235
- package/package.json +3 -8
- 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 +56 -11
- package/types/apps/src/contracts/cache.d.ts +20 -0
- package/types/apps/src/contracts/context.d.ts +60 -17
- package/types/apps/src/contracts/elicitation.d.ts +23 -7
- package/types/apps/src/contracts/events.d.ts +94 -0
- package/types/apps/src/contracts/failure.d.ts +30 -1
- package/types/apps/src/contracts/graphql.d.ts +40 -2
- package/types/apps/src/contracts/help-text.d.ts +31 -0
- package/types/apps/src/contracts/host.d.ts +1493 -20
- package/types/apps/src/contracts/icons.d.ts +28 -0
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +81 -20
- 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-document.d.ts +1 -1
- package/types/apps/src/contracts/openapi.d.ts +47 -8
- package/types/apps/src/contracts/operations.d.ts +14 -7
- 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 +513 -15
- package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
- package/types/apps/src/contracts/protocols/11.d.ts +1149 -0
- package/types/apps/src/contracts/protocols/12.d.ts +3310 -0
- package/types/apps/src/contracts/protocols/13.d.ts +6001 -0
- package/types/apps/src/contracts/protocols/2.d.ts +9 -8
- package/types/apps/src/contracts/protocols/3.d.ts +73 -15
- package/types/apps/src/contracts/protocols/4.d.ts +22 -15
- package/types/apps/src/contracts/protocols/5.d.ts +37 -11
- 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 +7114 -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 +56 -0
- package/types/apps/src/contracts/router.d.ts +2 -1
- package/types/apps/src/contracts/schedules.d.ts +7 -1
- package/types/apps/src/contracts/schema.d.ts +21 -0
- package/types/apps/src/contracts/shared-catalog.d.ts +11 -0
- 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 +70 -30
- package/types/apps/src/contracts/webhooks.d.ts +24 -7
- package/types/apps/src/contracts/workflows.d.ts +56 -34
- 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 +20 -3
- package/types/apps/src/implementation/app.d.ts +41 -14
- 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 +29 -2
- package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
- package/types/apps/src/implementation/elicitation.d.ts +16 -13
- package/types/apps/src/implementation/events.d.ts +64 -0
- package/types/apps/src/implementation/failure-detail.d.ts +28 -5
- 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/help-text.d.ts +5 -0
- 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-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 +33 -5
- package/types/apps/src/implementation/openapi-document.d.ts +35 -18
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-request.d.ts +2 -1
- package/types/apps/src/implementation/openapi-source.d.ts +23 -1
- package/types/apps/src/implementation/operations.d.ts +58 -7
- 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 +20 -4
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +22 -97
- package/types/apps/src/implementation/router.d.ts +26 -6
- package/types/apps/src/implementation/schedules.d.ts +39 -8
- package/types/apps/src/implementation/schema.d.ts +148 -17
- 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 +3 -3
- 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 +38 -12
- package/types/apps/src/implementation/upstream-error.d.ts +17 -0
- package/types/apps/src/implementation/webhooks.d.ts +15 -6
- package/types/apps/src/implementation/workflow-context.d.ts +6 -2
- package/types/apps/src/implementation/workflows.d.ts +11 -4
- package/types/apps/src/index.d.ts +67 -17
- package/types/apps/src/mcp.d.ts +20 -1
- package/types/apps/src/openapi.d.ts +22 -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 -2
- 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 +3 -2
- package/types/telemetry/src/keepalive.d.ts +53 -0
- package/types/telemetry/src/layer.d.ts +10 -4
- package/types/telemetry/src/measurements.d.ts +6 -2
- 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 +32 -7
- package/types/telemetry/src/span-attributes.d.ts +22 -3
- package/types/telemetry/src/transport.d.ts +10 -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/legacy-keys.d.ts +20 -0
- package/types/utils/src/random-uuid.d.ts +6 -0
- package/types/utils/src/recorded-message.d.ts +18 -0
- package/types/utils/src/schema-definitions.d.ts +13 -0
- package/types/utils/src/user-facing-error.d.ts +83 -0
- package/js/chunk-27F7W2LG.js +0 -34
- package/js/chunk-4ASNKGCV.js +0 -242
- package/js/chunk-4DWF4ZWI.js +0 -1280
- package/js/chunk-57RKNWL2.js +0 -75
- package/js/chunk-6HSH75OI.js +0 -2688
- package/js/chunk-G4FT53I7.js +0 -224
- package/js/chunk-MKWZPDR6.js +0 -63
- package/js/chunk-N7YDVXYJ.js +0 -186
- package/js/chunk-NKLWZJLE.js +0 -172
- package/js/chunk-PJJ24GU7.js +0 -877
- package/js/chunk-PZB6T6KU.js +0 -19
- package/js/chunk-R3EV5FTO.js +0 -97
- package/js/chunk-S73JGVR5.js +0 -507
- package/js/chunk-TG6DOCRO.js +0 -299
- package/js/chunk-YPKG2QO5.js +0 -209
- package/js/chunk-ZQINWV4W.js +0 -630
- package/js/mcp/stdio.js +0 -128
- 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/mcp-stdio.d.ts +0 -4
- package/types/apps/src/implementation/storage.d.ts +0 -15
- package/types/apps/src/implementation/ui-watch.d.ts +0 -2
- package/types/apps/src/mcp-stdio.d.ts +0 -5
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
* is reported on its own entry; the root failing fails the read, as a single-source app would.
|
|
4
4
|
*/
|
|
5
5
|
import { Effect, Schema } from "effect";
|
|
6
|
-
import { HostDeclarationInvalid, HostEvaluationFailed, type HostRouterError } from "../contracts/host.js";
|
|
7
|
-
import { McpError } from "../contracts/mcp.js";
|
|
6
|
+
import { HostDeclarationInvalid, HostEvaluationFailed, HostedRouter, HostedTool, HostedToolSummary, type HostRouterError } from "../contracts/host.js";
|
|
8
7
|
import type { AppOperation } from "../contracts/operations.js";
|
|
9
8
|
import type { AppRouter, DynamicRouter, RouterMeta } from "../contracts/router.js";
|
|
10
|
-
import { SkillLoadFailed } from "../contracts/skills.js";
|
|
11
9
|
import type { OperationSchedule } from "../contracts/schedules.js";
|
|
12
10
|
/**
|
|
13
11
|
* Keep only a failure's safe fields. Anything unrecognized becomes an evaluation failure with the
|
|
@@ -29,9 +27,10 @@ export declare const routerSkillPrefix = "tools";
|
|
|
29
27
|
export declare const routerSkillName: (path: string) => string;
|
|
30
28
|
/** A declared operation's catalog entry without schemas. `router` is its owning router's path. */
|
|
31
29
|
export declare const operationSummary: (name: string, router: string, operation: AppOperation, schedules?: readonly OperationSchedule[]) => Effect.Effect<{
|
|
32
|
-
readonly name: string;
|
|
33
30
|
readonly description: string;
|
|
31
|
+
readonly name: string;
|
|
34
32
|
readonly title?: string;
|
|
33
|
+
readonly router?: string;
|
|
35
34
|
readonly annotations?: {
|
|
36
35
|
readonly title?: string;
|
|
37
36
|
readonly readOnlyHint?: boolean;
|
|
@@ -52,22 +51,24 @@ export declare const operationSummary: (name: string, router: string, operation:
|
|
|
52
51
|
};
|
|
53
52
|
};
|
|
54
53
|
readonly input: Schema.Json;
|
|
54
|
+
readonly scope?: "app";
|
|
55
55
|
}[];
|
|
56
|
-
readonly readOnly?: boolean;
|
|
57
|
-
readonly router?: string;
|
|
58
56
|
readonly tags?: readonly string[];
|
|
57
|
+
readonly readOnly?: boolean;
|
|
58
|
+
readonly kindConfirmed?: boolean;
|
|
59
59
|
}, HostDeclarationInvalid, never>;
|
|
60
60
|
/** A declared operation's full description, including rendered schemas. */
|
|
61
61
|
export declare const operationDescription: (name: string, router: string, operation: AppOperation, schedules?: readonly OperationSchedule[]) => Effect.Effect<{
|
|
62
|
-
readonly name: string;
|
|
63
62
|
readonly description: string;
|
|
63
|
+
readonly name: string;
|
|
64
64
|
readonly inputSchema: {
|
|
65
65
|
readonly [x: string]: Schema.Json;
|
|
66
66
|
};
|
|
67
|
+
readonly title?: string;
|
|
67
68
|
readonly _meta?: {
|
|
68
69
|
readonly [x: string]: Schema.Json;
|
|
69
70
|
};
|
|
70
|
-
readonly
|
|
71
|
+
readonly router?: string;
|
|
71
72
|
readonly annotations?: {
|
|
72
73
|
readonly title?: string;
|
|
73
74
|
readonly readOnlyHint?: boolean;
|
|
@@ -91,16 +92,22 @@ export declare const operationDescription: (name: string, router: string, operat
|
|
|
91
92
|
};
|
|
92
93
|
};
|
|
93
94
|
readonly input: Schema.Json;
|
|
95
|
+
readonly scope?: "app";
|
|
94
96
|
}[];
|
|
95
|
-
readonly readOnly?: boolean;
|
|
96
|
-
readonly router?: string;
|
|
97
97
|
readonly tags?: readonly string[];
|
|
98
|
+
readonly readOnly?: boolean;
|
|
99
|
+
readonly kindConfirmed?: boolean;
|
|
98
100
|
}, HostDeclarationInvalid, never>;
|
|
99
101
|
/**
|
|
100
|
-
* A dynamic router over operations already discovered, such as an eager OpenAPI document
|
|
101
|
-
*
|
|
102
|
+
* A dynamic router over operations already discovered, such as an eager OpenAPI document.
|
|
103
|
+
* Upstream names can contain dots, which static router keys cannot.
|
|
102
104
|
*/
|
|
103
105
|
export declare const fixedRouter: (operations: Readonly<Record<string, AppOperation>>, meta?: RouterMeta) => DynamicRouter;
|
|
106
|
+
/** Tools and routers of a catalog, or of part of one, in router order. */
|
|
107
|
+
interface Catalog {
|
|
108
|
+
readonly tools: ReadonlyArray<HostedTool | HostedToolSummary>;
|
|
109
|
+
readonly routers: ReadonlyArray<HostedRouter>;
|
|
110
|
+
}
|
|
104
111
|
export interface CatalogOptions {
|
|
105
112
|
/** Omit schemas. */
|
|
106
113
|
readonly summary: boolean;
|
|
@@ -120,98 +127,15 @@ export interface CatalogOptions {
|
|
|
120
127
|
* Read a router tree. Every nested router is listed, for grouping; the root only when it has
|
|
121
128
|
* metadata. A nested dynamic source that fails is reported on its router's entry.
|
|
122
129
|
*/
|
|
123
|
-
export declare const readCatalog: (root: AppRouter | DynamicRouter | undefined, options: CatalogOptions) => Effect.Effect<
|
|
124
|
-
tools: ({
|
|
125
|
-
readonly name: string;
|
|
126
|
-
readonly description: string;
|
|
127
|
-
readonly inputSchema: {
|
|
128
|
-
readonly [x: string]: Schema.Json;
|
|
129
|
-
};
|
|
130
|
-
readonly _meta?: {
|
|
131
|
-
readonly [x: string]: Schema.Json;
|
|
132
|
-
};
|
|
133
|
-
readonly title?: string;
|
|
134
|
-
readonly annotations?: {
|
|
135
|
-
readonly title?: string;
|
|
136
|
-
readonly readOnlyHint?: boolean;
|
|
137
|
-
readonly destructiveHint?: boolean;
|
|
138
|
-
readonly idempotentHint?: boolean;
|
|
139
|
-
readonly openWorldHint?: boolean;
|
|
140
|
-
};
|
|
141
|
-
readonly outputSchema?: {
|
|
142
|
-
readonly [x: string]: Schema.Json;
|
|
143
|
-
};
|
|
144
|
-
readonly schedules?: readonly {
|
|
145
|
-
readonly name: string;
|
|
146
|
-
readonly timing: {
|
|
147
|
-
readonly kind: "interval";
|
|
148
|
-
readonly milliseconds: number;
|
|
149
|
-
} | {
|
|
150
|
-
readonly kind: "cron";
|
|
151
|
-
readonly calendar: {
|
|
152
|
-
readonly expression: string;
|
|
153
|
-
readonly timezone: string;
|
|
154
|
-
};
|
|
155
|
-
};
|
|
156
|
-
readonly input: Schema.Json;
|
|
157
|
-
}[];
|
|
158
|
-
readonly readOnly?: boolean;
|
|
159
|
-
readonly router?: string;
|
|
160
|
-
readonly tags?: readonly string[];
|
|
161
|
-
} | {
|
|
162
|
-
readonly name: string;
|
|
163
|
-
readonly description: string;
|
|
164
|
-
readonly title?: string;
|
|
165
|
-
readonly annotations?: {
|
|
166
|
-
readonly title?: string;
|
|
167
|
-
readonly readOnlyHint?: boolean;
|
|
168
|
-
readonly destructiveHint?: boolean;
|
|
169
|
-
readonly idempotentHint?: boolean;
|
|
170
|
-
readonly openWorldHint?: boolean;
|
|
171
|
-
};
|
|
172
|
-
readonly schedules?: readonly {
|
|
173
|
-
readonly name: string;
|
|
174
|
-
readonly timing: {
|
|
175
|
-
readonly kind: "interval";
|
|
176
|
-
readonly milliseconds: number;
|
|
177
|
-
} | {
|
|
178
|
-
readonly kind: "cron";
|
|
179
|
-
readonly calendar: {
|
|
180
|
-
readonly expression: string;
|
|
181
|
-
readonly timezone: string;
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
readonly input: Schema.Json;
|
|
185
|
-
}[];
|
|
186
|
-
readonly readOnly?: boolean;
|
|
187
|
-
readonly router?: string;
|
|
188
|
-
readonly tags?: readonly string[];
|
|
189
|
-
})[];
|
|
190
|
-
routers: {
|
|
191
|
-
readonly path: string;
|
|
192
|
-
readonly error?: import("../index.js").ProviderError | SkillLoadFailed | McpError | HostDeclarationInvalid | HostEvaluationFailed;
|
|
193
|
-
readonly description?: string;
|
|
194
|
-
readonly title?: string;
|
|
195
|
-
readonly tags?: {
|
|
196
|
-
readonly [x: string]: string;
|
|
197
|
-
};
|
|
198
|
-
readonly icons?: readonly {
|
|
199
|
-
readonly src: string;
|
|
200
|
-
readonly mimeType?: string;
|
|
201
|
-
readonly sizes?: readonly string[];
|
|
202
|
-
readonly theme?: "light" | "dark";
|
|
203
|
-
}[];
|
|
204
|
-
readonly skill?: string;
|
|
205
|
-
}[];
|
|
206
|
-
}, import("../index.js").ProviderError | SkillLoadFailed | McpError | HostDeclarationInvalid | HostEvaluationFailed, never>;
|
|
130
|
+
export declare const readCatalog: (root: AppRouter | DynamicRouter | undefined, options: CatalogOptions) => Effect.Effect<Catalog, import("../index.js").ProviderError | import("../contracts/host.js").McpError | import("../contracts/host.js").SkillLoadFailed | HostDeclarationInvalid | HostEvaluationFailed, never>;
|
|
207
131
|
/**
|
|
208
132
|
* One skill for each router with instructions. Skills and tools fail independently: a dynamic
|
|
209
133
|
* router whose metadata cannot be read, including the root, contributes no skill and does not
|
|
210
134
|
* fail the others. Metadata comes through each source's catalog cache, like a tool listing.
|
|
211
135
|
*/
|
|
212
136
|
export declare const routerSkills: (root: AppRouter | DynamicRouter | undefined) => Effect.Effect<{
|
|
213
|
-
readonly name: string;
|
|
214
137
|
readonly description: string;
|
|
138
|
+
readonly name: string;
|
|
215
139
|
readonly files: readonly {
|
|
216
140
|
readonly path: string;
|
|
217
141
|
readonly content: string;
|
|
@@ -223,3 +147,4 @@ export declare const routerSkills: (root: AppRouter | DynamicRouter | undefined)
|
|
|
223
147
|
};
|
|
224
148
|
readonly "allowed-tools"?: string;
|
|
225
149
|
}[], never, never>;
|
|
150
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { HostedTool } from "../contracts/host.js";
|
|
2
2
|
import type { AppOperation } from "../contracts/operations.js";
|
|
3
3
|
import { RouterMeta, type AppRouter, type DynamicRouter, type RouterIcon } from "../contracts/router.js";
|
|
4
|
-
import
|
|
5
|
-
|
|
4
|
+
import type { Approval } from "../approval.js";
|
|
5
|
+
import { type OperationChild, type OperationDeclaration, type RouterChild, type RouterDeclaration } from "./operations.js";
|
|
6
|
+
export type { OperationChild, OperationDeclaration, RouterChild, RouterDeclaration, } from "./operations.js";
|
|
6
7
|
/** Author metadata for a router. Instructions become a skill named after the router's path. */
|
|
7
8
|
export interface RouterOptions {
|
|
8
9
|
readonly title?: string;
|
|
@@ -26,13 +27,16 @@ export declare function router<Query = unknown, Mutation = unknown>(children: Re
|
|
|
26
27
|
export declare function router<Query, Mutation>(source: RouterDeclaration<Query, Mutation>, options: RouterOptions): RouterDeclaration<Query, Mutation>;
|
|
27
28
|
/**
|
|
28
29
|
* Declare a router whose tools are discovered when read. `list` returns tools with names relative
|
|
29
|
-
* to this router; mark queries with `readOnly: true
|
|
30
|
+
* to this router; mark queries with `readOnly: true`, and add `kindConfirmed: true` when your code,
|
|
31
|
+
* not an upstream service's claim, decides the kind. `resolve` receives one of those names.
|
|
32
|
+
* The router carries the handler contexts of the operations `resolve` returns, so `defineApp`
|
|
33
|
+
* checks them like a static router's.
|
|
30
34
|
*/
|
|
31
|
-
export declare const dynamicRouter: (source: {
|
|
35
|
+
export declare const dynamicRouter: <Query = unknown, Mutation = unknown>(source: {
|
|
32
36
|
readonly meta?: () => RouterOptions | Promise<RouterOptions>;
|
|
33
37
|
readonly list: () => readonly HostedTool[] | Promise<readonly HostedTool[]>;
|
|
34
|
-
readonly resolve: (name: string) =>
|
|
35
|
-
}) => RouterDeclaration
|
|
38
|
+
readonly resolve: (name: string) => OperationChild<Query, Mutation> | undefined | Promise<OperationChild<Query, Mutation> | undefined>;
|
|
39
|
+
}) => RouterDeclaration<Query, Mutation>;
|
|
36
40
|
/** Join a router path and a relative name. The root router's path is "". */
|
|
37
41
|
export declare const joinPath: (path: string, name: string) => string;
|
|
38
42
|
/** Where a full tool name points: a declared operation, or a name inside a dynamic router. */
|
|
@@ -57,3 +61,19 @@ export declare const declaredOperations: (root: AppRouter | undefined, path?: st
|
|
|
57
61
|
readonly router: string;
|
|
58
62
|
readonly operation: AppOperation;
|
|
59
63
|
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Choose an approval for each operation a router contains, including tools a dynamic router
|
|
66
|
+
* resolves later. `policy` receives the operation and its name relative to this router; returning
|
|
67
|
+
* undefined keeps the operation's own approval. Read hints with `toolAnnotations(operation)`.
|
|
68
|
+
* Apply it to each account's router before `accountRouter` combines them, so every account keeps
|
|
69
|
+
* its own tools' hints.
|
|
70
|
+
*/
|
|
71
|
+
export declare const withApprovals: <Query, Mutation>(source: RouterDeclaration<Query, Mutation>, policy: (operation: OperationDeclaration<"query" | "mutation", never>, name: string) => Approval | undefined) => RouterDeclaration<Query, Mutation>;
|
|
72
|
+
/**
|
|
73
|
+
* Expose a protocol router's tools under other names, such as the names an earlier client used.
|
|
74
|
+
* `rename` receives each tool's name relative to this router and returns the name to expose, or
|
|
75
|
+
* undefined to leave the tool out. When two tools would share a name, the first listed keeps it.
|
|
76
|
+
* Calls and descriptions find a tool by its exposed name. Works on routers that discover their
|
|
77
|
+
* tools, such as `mcpRouter`, `graphqlRouter` and `liveOpenapiRouter`.
|
|
78
|
+
*/
|
|
79
|
+
export declare const renameTools: <Query, Mutation>(source: RouterDeclaration<Query, Mutation>, rename: (name: string) => string | undefined) => RouterDeclaration<Query, Mutation>;
|
|
@@ -1,16 +1,47 @@
|
|
|
1
1
|
import { Interval, ScheduleTiming } from "../contracts/schedules.js";
|
|
2
2
|
import { JsonValue } from "../contracts/schema.js";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import type { AccountScope } from "../contracts/app.js";
|
|
4
|
+
import { type Operation, type OperationDeclaration, type WithoutApproval } from "./operations.js";
|
|
5
|
+
/**
|
|
6
|
+
* The app adapter resolves this operation handle to its declared mutation name. A `"user"`
|
|
7
|
+
* schedule has one copy per member who enables it, run as them with their linked accounts. An
|
|
8
|
+
* `"app"` schedule is one schedule, enabled by an app manager, run without a caller with the app's
|
|
9
|
+
* accounts only.
|
|
10
|
+
*/
|
|
11
|
+
export interface ScheduleDeclaration<Context = never, Scope extends AccountScope = AccountScope> {
|
|
12
|
+
readonly scope: Scope;
|
|
6
13
|
readonly operation: OperationDeclaration<"mutation", Context>;
|
|
7
14
|
readonly timing: ScheduleTiming;
|
|
8
15
|
readonly input: JsonValue;
|
|
9
16
|
}
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Refuses, with a message the type error shows, a mutation whose handler context has the caller's
|
|
19
|
+
* `user`, such as one that declares a context without a type.
|
|
20
|
+
*/
|
|
21
|
+
type RunsAsApp<Context> = [Context] extends [{
|
|
22
|
+
readonly user: unknown;
|
|
23
|
+
}] ? {
|
|
24
|
+
readonly 'An app schedule runs without a caller: type the handler\'s context as MutationContext<typeof requirements, "app">, pass it as the third type argument, or declare no parameters and pass no type arguments': never;
|
|
25
|
+
} : unknown;
|
|
26
|
+
/** Run an existing mutation at a fixed interval, once per member who enables it, as them. */
|
|
27
|
+
export declare const userInterval: <Input, Output, Context>(duration: Interval, operation: Operation<Input, Output, "mutation", Context>, input: NoInfer<Input>) => ScheduleDeclaration<Context, "user">;
|
|
28
|
+
/**
|
|
29
|
+
* Calendar alternative for wall-clock schedules, once per member who enables it, as them. UTC is the
|
|
30
|
+
* explicit default when timezone is omitted.
|
|
31
|
+
*/
|
|
32
|
+
export declare const userCron: <Input, Output, Context>(calendar: {
|
|
14
33
|
readonly expression: string;
|
|
15
34
|
readonly timezone?: string;
|
|
16
|
-
}, operation: Operation<Input, Output, "mutation", Context>, input: NoInfer<Input>) => ScheduleDeclaration<Context>;
|
|
35
|
+
}, operation: Operation<Input, Output, "mutation", Context>, input: NoInfer<Input>) => ScheduleDeclaration<Context, "user">;
|
|
36
|
+
/**
|
|
37
|
+
* Run an existing mutation at a fixed interval as the app: one schedule an app manager enables, run
|
|
38
|
+
* without a caller with the app's accounts. The mutation takes a context of the `"app"` scope and
|
|
39
|
+
* declares no approval.
|
|
40
|
+
*/
|
|
41
|
+
export declare const appInterval: <Input, Output, Context>(duration: Interval, operation: Operation<Input, Output, "mutation", Context> & WithoutApproval & RunsAsApp<Context>, input: NoInfer<Input>) => ScheduleDeclaration<Context, "app">;
|
|
42
|
+
/** Calendar alternative to `appInterval`. UTC is the explicit default when timezone is omitted. */
|
|
43
|
+
export declare const appCron: <Input, Output, Context>(calendar: {
|
|
44
|
+
readonly expression: string;
|
|
45
|
+
readonly timezone?: string;
|
|
46
|
+
}, operation: Operation<Input, Output, "mutation", Context> & WithoutApproval & RunsAsApp<Context>, input: NoInfer<Input>) => ScheduleDeclaration<Context, "app">;
|
|
47
|
+
export {};
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/** Author schema facade. Internals use the native decoder retained by each value. */
|
|
2
2
|
import { Effect, Schema as EffectSchema } from "effect";
|
|
3
|
-
import { JsonObject, ValidationError } from "../contracts/schema.js";
|
|
4
|
-
import type {
|
|
5
|
-
declare const StorageField: unique symbol;
|
|
3
|
+
import { DeclarationInvalid, JsonObject, ValidationError, type JsonValue } from "../contracts/schema.js";
|
|
4
|
+
import type { FieldExposure } from "../contracts/provider.js";
|
|
6
5
|
declare const Decoder: unique symbol;
|
|
7
6
|
/** An author-facing value schema. Effect is never required in author code. */
|
|
8
7
|
export interface Schema<T, Optional extends boolean = false> {
|
|
9
|
-
readonly [StorageField]?: Field;
|
|
10
8
|
readonly [Decoder]: EffectSchema.Decoder<T>;
|
|
11
9
|
readonly optionalValue: Optional;
|
|
12
10
|
/** Parse an unknown value; invalid input throws a safe ValidationError. */
|
|
@@ -37,18 +35,41 @@ export interface ObjectSchema<F extends Fields> extends Schema<ObjectValue<F>> {
|
|
|
37
35
|
export declare const decoderOf: <T>(schema: Schema<T, boolean>) => EffectSchema.Decoder<T>;
|
|
38
36
|
/** Recognize schemas made by this author facade when adapting a definition. */
|
|
39
37
|
export declare const isSchema: (value: unknown) => value is Schema<unknown, boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Source that skipped type checking can pass any value where a schema belongs, such as `string`
|
|
40
|
+
* for `string()`. Name the argument and the mistake before a native constructor reads it.
|
|
41
|
+
*/
|
|
42
|
+
export declare const schemaArgument: <S extends Schema<unknown, boolean>>(value: S, role: string) => S;
|
|
40
43
|
/** Decode within an Effect program. Invalid input is omitted from the failure. */
|
|
41
44
|
export declare const parse: <T>(decoder: EffectSchema.Decoder<T>, input: unknown) => Effect.Effect<T, ValidationError>;
|
|
45
|
+
/**
|
|
46
|
+
* Decode an author's declaration, naming every failing path. A declaration with several forms,
|
|
47
|
+
* such as `oauth2()`'s discovered, declared and client credentials endpoints, is explained by the
|
|
48
|
+
* form its author chose (`intended`), so the problems are that form's, including the options it
|
|
49
|
+
* lacks, rather than every other form's objections. Messages never include the supplied values.
|
|
50
|
+
*/
|
|
51
|
+
export declare const parseDeclaration: <T>(decoder: EffectSchema.Decoder<T>, input: unknown, declaration: string, intended?: (input: unknown) => EffectSchema.Decoder<unknown>) => Effect.Effect<T, DeclarationInvalid>;
|
|
42
52
|
/** Present a native decoder through the synchronous author API. */
|
|
43
|
-
export declare function wrap<T, Optional extends boolean>(decoder: EffectSchema.Decoder<T>, optionalValue: Optional
|
|
44
|
-
/**
|
|
45
|
-
|
|
53
|
+
export declare function wrap<T, Optional extends boolean>(decoder: EffectSchema.Decoder<T>, optionalValue: Optional): Schema<T, Optional>;
|
|
54
|
+
/**
|
|
55
|
+
* A value's name and explanation in its JSON Schema, such as a tool input or an account field. In
|
|
56
|
+
* an account field, `title` replaces the field's name as its connect form label, and `description`
|
|
57
|
+
* says where to find the value: Markdown of at most 1,000 characters whose links are absolute
|
|
58
|
+
* https URLs, with no HTML or images. Indentation common to its lines is removed, so a template
|
|
59
|
+
* literal can be indented. Neither changes the provider.
|
|
60
|
+
*/
|
|
61
|
+
export interface FieldHelp {
|
|
62
|
+
readonly title?: string;
|
|
63
|
+
readonly description?: string;
|
|
64
|
+
}
|
|
65
|
+
/** A string, optionally with a minimum length, title and description. No coercion. */
|
|
66
|
+
export declare function string(options?: FieldHelp & {
|
|
46
67
|
readonly minLength?: number;
|
|
47
68
|
}): Schema<string>;
|
|
48
|
-
/** A finite JSON number. No coercion. */
|
|
49
|
-
export declare const number: () => Schema<number>;
|
|
50
|
-
/** A boolean. No coercion. */
|
|
51
|
-
export declare const boolean: () => Schema<boolean>;
|
|
69
|
+
/** A finite JSON number, optionally with a title and description. No coercion. */
|
|
70
|
+
export declare const number: (options?: FieldHelp) => Schema<number>;
|
|
71
|
+
/** A boolean, optionally with a title and description. No coercion. */
|
|
72
|
+
export declare const boolean: (options?: FieldHelp) => Schema<boolean>;
|
|
52
73
|
/** Any JSON value. Values still cross the native JSON decoder. */
|
|
53
74
|
export declare const json: () => Schema<EffectSchema.Json>;
|
|
54
75
|
/** Named values with a common schema. */
|
|
@@ -59,6 +80,44 @@ export declare function literal<const T extends string | number | boolean | null
|
|
|
59
80
|
export declare const array: <T>(item: Schema<T, boolean>) => Schema<readonly T[]>;
|
|
60
81
|
/** Parse declared fields and omit undeclared fields. */
|
|
61
82
|
export declare function object<const F extends Fields>(fields: F): ObjectSchema<F>;
|
|
83
|
+
declare const Exposure: unique symbol;
|
|
84
|
+
/** A schema marked with how app code sees the field in a provider that declares hosts. */
|
|
85
|
+
export type Exposed<S, E extends FieldExposure = FieldExposure> = S & {
|
|
86
|
+
readonly [Exposure]: E;
|
|
87
|
+
};
|
|
88
|
+
/** The marking of one account field, if any. */
|
|
89
|
+
export declare const exposureOf: (schema: Schema<unknown, boolean>) => FieldExposure | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* A field that is not secret, such as a subdomain or region. App code reads its real value and
|
|
92
|
+
* the connect form shows it.
|
|
93
|
+
*/
|
|
94
|
+
export declare const plain: <S extends Schema<unknown, boolean>>(schema: S) => Exposed<S, "plain">;
|
|
95
|
+
/**
|
|
96
|
+
* A secret field that app code reads as its real value, for request signing and similar uses.
|
|
97
|
+
* The connect form warns that the app can read it. Prefer an unmarked field, which app code
|
|
98
|
+
* receives as a handle that only reaches the provider's declared hosts.
|
|
99
|
+
*/
|
|
100
|
+
export declare const raw: <S extends Schema<unknown, boolean>>(schema: S) => Exposed<S, "raw">;
|
|
101
|
+
/** Marked fields of an account object, by name. */
|
|
102
|
+
export declare const fieldExposure: (fields: Fields) => Readonly<Record<string, FieldExposure>>;
|
|
103
|
+
declare const Secret: unique symbol;
|
|
104
|
+
/**
|
|
105
|
+
* A secret account value. In a provider that declares hosts it is a handle, which the host's
|
|
106
|
+
* outbound network replaces with the real value only on requests to those hosts. Pass it to
|
|
107
|
+
* clients and headers as an ordinary string; do not decode or transform it.
|
|
108
|
+
*/
|
|
109
|
+
export type SecretString = string & {
|
|
110
|
+
readonly [Secret]: true;
|
|
111
|
+
};
|
|
112
|
+
type Sealed<T> = T extends string ? SecretString : T;
|
|
113
|
+
/** Account fields as app code receives them: unmarked string fields are secret. */
|
|
114
|
+
export type SecretFields<F extends Fields> = {
|
|
115
|
+
readonly [Key in keyof ObjectValue<F>]: Key extends keyof F ? F[Key] extends Exposed<unknown> ? ObjectValue<F>[Key] : Sealed<ObjectValue<F>[Key]> : ObjectValue<F>[Key];
|
|
116
|
+
};
|
|
117
|
+
/** An account object without declared fields, such as a default OAuth projection. */
|
|
118
|
+
export type SecretObject<T> = {
|
|
119
|
+
readonly [Key in keyof T]: Sealed<T[Key]>;
|
|
120
|
+
};
|
|
62
121
|
declare const ImportedJsonSchema: unique symbol;
|
|
63
122
|
/** Read the original document for an imported decoder without a lossy schema round trip. */
|
|
64
123
|
export declare const importedJsonSchema: (decoder: EffectSchema.Decoder<unknown>) => unknown | undefined;
|
|
@@ -72,8 +131,78 @@ export declare const withLazyJsonSchemaDocument: <S extends EffectSchema.Decoder
|
|
|
72
131
|
* Relocate a self-contained JSON Schema under a document pointer. Resolve references
|
|
73
132
|
* before nesting so account schemas can reuse definition names, IDs and anchors.
|
|
74
133
|
* Only schema nodes are rewritten; examples and ordinary property values stay intact.
|
|
134
|
+
* A `$recursiveRef` becomes the pointer to its static target, such as the relocated root. The
|
|
135
|
+
* patched validator applies it like `"#"` was: the recursive anchor in scope, else that target.
|
|
75
136
|
*/
|
|
76
137
|
export declare const nestJsonSchema: (input: JsonObject, pointer: string) => JsonObject;
|
|
138
|
+
/**
|
|
139
|
+
* What one listing learns about the definitions its tools' schemas hold. Routers such as the
|
|
140
|
+
* OpenAPI importer give every tool that reaches a definition the same object, and a densely
|
|
141
|
+
* connected API reaches most of its definitions from every tool: Stripe's 610 tools name about
|
|
142
|
+
* 330,000 `$defs` entries but only a few thousand distinct definitions. Combining schemas reads
|
|
143
|
+
* each definition object once per listing, rather than once for every tool that reaches it, so a
|
|
144
|
+
* listing's cost follows its distinct definitions instead of its tools times its definitions.
|
|
145
|
+
* Values are only read, never changed: the memo is valid while the listing's objects are, so
|
|
146
|
+
* make one for each listing or description and drop it with them.
|
|
147
|
+
*/
|
|
148
|
+
export interface SchemaMemo {
|
|
149
|
+
/** Equal numbers for definitions whose JSON text is equal. */
|
|
150
|
+
readonly textId: (definition: JsonValue) => number;
|
|
151
|
+
/** The `$defs` names the definition refers to, or undefined, as `definitionReferences`. */
|
|
152
|
+
readonly references: (definition: JsonValue) => ReadonlySet<string> | undefined;
|
|
153
|
+
}
|
|
154
|
+
export declare const schemaMemo: () => SchemaMemo;
|
|
155
|
+
/**
|
|
156
|
+
* A key equal for schemas whose JSON text is equal, without writing the definitions in their
|
|
157
|
+
* `$defs`: each definition stands for its memo number.
|
|
158
|
+
*/
|
|
159
|
+
export declare const schemaIdentity: (schema: JsonObject, memo: SchemaMemo) => string;
|
|
160
|
+
/**
|
|
161
|
+
* Self-contained schemas placed side by side in one document, such as the branches of a union.
|
|
162
|
+
* A schema whose references all name its root `$defs` gives those entries to the document's root
|
|
163
|
+
* `$defs` when no entry of the same name differs, so definitions stay where listings share them
|
|
164
|
+
* among tools. Any other schema is relocated with `nestJsonSchema` under `pointer(index)`.
|
|
165
|
+
* Definitions are compared by object first and by text only when two objects share a name.
|
|
166
|
+
*/
|
|
167
|
+
export declare const combineJsonSchemas: (schemas: readonly JsonObject[], pointer: (index: number) => string, memo?: SchemaMemo) => {
|
|
168
|
+
readonly $defs?: JsonObject;
|
|
169
|
+
readonly schemas: readonly JsonObject[];
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Whether an input key may be named in a validation problem. Other keys can carry supplied data,
|
|
173
|
+
* so problems locate them without echoing them.
|
|
174
|
+
*/
|
|
175
|
+
export declare const echoableKey: (key: string) => boolean;
|
|
176
|
+
/**
|
|
177
|
+
* The keys an object accepts, as `object {name, optional?}`. `...` marks an object that also
|
|
178
|
+
* accepts other keys. Names come from the schema, never from supplied input.
|
|
179
|
+
*/
|
|
180
|
+
export declare const objectShape: (keys: readonly {
|
|
181
|
+
readonly name: string;
|
|
182
|
+
readonly optional: boolean;
|
|
183
|
+
}[], open: boolean, limit?: number) => string;
|
|
184
|
+
/**
|
|
185
|
+
* The values a schema fixes, as `"v1"` or `one of "a", "b" and 3 more`. Agents already read
|
|
186
|
+
* these values in the tool's signature, so problems list them, up to {@link maxListedValues}
|
|
187
|
+
* values and {@link maxValuesText} characters. They come from the schema, never from input.
|
|
188
|
+
*/
|
|
189
|
+
export declare const allowedValues: (values: readonly unknown[]) => string;
|
|
190
|
+
/** Keys listed for each union alternative, so several alternatives fit in one problem. */
|
|
191
|
+
export declare const maxAlternativeKeys = 8;
|
|
192
|
+
/**
|
|
193
|
+
* The alternatives a union accepts, as `string or object {id}`, and the key whose value tells
|
|
194
|
+
* them apart. Shapes, values and the key come from the schema, never from supplied input.
|
|
195
|
+
*/
|
|
196
|
+
export declare const unionShape: (alternatives: readonly string[], selector: string | undefined) => string;
|
|
197
|
+
/** The problem for a required key the input omits, with what its schema expects when stated. */
|
|
198
|
+
export declare const missingKey: (expected: string | undefined) => string;
|
|
199
|
+
/** The text every missing-key problem starts with, so the caller can add where the input has it. */
|
|
200
|
+
export declare const missingKeyText = "Missing key";
|
|
201
|
+
/**
|
|
202
|
+
* Whether the imported schema whose check failed may accept a key as an object's own key, for a
|
|
203
|
+
* failure's check; undefined when the check is not an imported schema's.
|
|
204
|
+
*/
|
|
205
|
+
export declare const importedSchemaKeys: (check: object) => ((key: string) => boolean) | undefined;
|
|
77
206
|
/** Prepare an interpreted validator. No eval or generated JavaScript runs in any host. */
|
|
78
207
|
export declare const compileJsonSchemaDecoder: (document: JsonObject) => Effect.Effect<EffectSchema.Codec<EffectSchema.Json, EffectSchema.Json, never, never> & {
|
|
79
208
|
[ImportedJsonSchema]: {
|
|
@@ -81,16 +210,18 @@ export declare const compileJsonSchemaDecoder: (document: JsonObject) => Effect.
|
|
|
81
210
|
};
|
|
82
211
|
}, ValidationError, never>;
|
|
83
212
|
export declare const lazyJsonSchemaDecoder: (document: () => JsonObject) => Effect.Effect<EffectSchema.declareConstructor<EffectSchema.Json, EffectSchema.Json, readonly [], EffectSchema.Json>, never, never>;
|
|
213
|
+
/**
|
|
214
|
+
* A lazy decoder and the compilation it decodes with. Running `compile` first lets a caller
|
|
215
|
+
* reject an unsupported schema before a side effect whose result the decoder will check.
|
|
216
|
+
*/
|
|
217
|
+
export declare const preparedJsonSchemaDecoder: (document: JsonObject) => {
|
|
218
|
+
decoder: EffectSchema.declareConstructor<EffectSchema.Json, EffectSchema.Json, readonly [], EffectSchema.Json>;
|
|
219
|
+
compile: Effect.Effect<EffectSchema.Decoder<EffectSchema.Json, never>, ValidationError, never>;
|
|
220
|
+
};
|
|
84
221
|
/** Preserve the JSON document; compile its validator only when a value is first decoded. */
|
|
85
222
|
export declare const jsonSchemaDecoder: (input: unknown) => Effect.Effect<EffectSchema.declareConstructor<EffectSchema.Json, EffectSchema.Json, readonly [], EffectSchema.Json>, ValidationError, never>;
|
|
86
223
|
/** Import JSON metadata now; unsupported schemas and invalid values fail when parsed. */
|
|
87
224
|
export declare const jsonSchema: (input: unknown) => Schema<EffectSchema.Json>;
|
|
88
|
-
/** Database declaration retained by primitive constructors; nested payload schemas are not database fields. */
|
|
89
|
-
export declare const storageFieldOf: (schema: Schema<unknown, boolean>) => Field | undefined;
|
|
90
|
-
/** A row reference records the target table; existence is not a foreign-key constraint. */
|
|
91
|
-
export declare const id: (table: string) => Schema<string>;
|
|
92
|
-
/** A host user identifier, stored as a string without imposing a product auth model. */
|
|
93
|
-
export declare const userId: () => Schema<string>;
|
|
94
225
|
/** Render a decoder as a JSON Schema document, keeping an imported upstream document as-is. */
|
|
95
226
|
export declare const jsonSchemaDocument: (decoder: EffectSchema.Decoder<unknown>) => Effect.Effect<{
|
|
96
227
|
readonly [x: string]: EffectSchema.Json;
|
|
@@ -1,35 +1,28 @@
|
|
|
1
1
|
/** Remote skill readers return complete portable bundles, never installed host files. */
|
|
2
2
|
import { Effect } from "effect";
|
|
3
|
-
import {
|
|
3
|
+
import { NetworkRefused } from "../contracts/network.js";
|
|
4
|
+
import { ProviderError } from "../contracts/provider-error.js";
|
|
5
|
+
import { AppSkills, SkillLoadFailed, type GitHubSkillsOptions, type WellKnownSkillsOptions, type SkillTransport } from "../contracts/skills.js";
|
|
4
6
|
/** Give every failure without a message one that names the service. */
|
|
5
|
-
export declare const withService: (service: string | undefined) => <A, R>(effect: Effect.Effect<A, SkillLoadFailed, R>) => Effect.Effect<A, SkillLoadFailed, R>;
|
|
7
|
+
export declare const withService: (service: string | undefined) => <A, R>(effect: Effect.Effect<A, SkillLoadFailed | NetworkRefused, R>) => Effect.Effect<A, NetworkRefused | SkillLoadFailed, R>;
|
|
8
|
+
interface ReadRequest {
|
|
9
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
10
|
+
/** Describe a refusal by Executor's app network; defaults to the refusal itself. */
|
|
11
|
+
readonly refused?: (refused: NetworkRefused) => SkillLoadFailed | NetworkRefused;
|
|
12
|
+
}
|
|
6
13
|
/** One loader invocation owns its byte budget and all of its network requests. */
|
|
7
14
|
export declare const reader: (transport: SkillTransport) => Effect.Effect<{
|
|
8
|
-
fetchBytes: (url: string,
|
|
9
|
-
readonly body
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
json: (url: string) => Effect.Effect<unknown, SkillLoadFailed, never>;
|
|
15
|
+
fetchBytes: (url: string, request?: ReadRequest & {
|
|
16
|
+
readonly body?: Uint8Array;
|
|
17
|
+
}) => Effect.Effect<Uint8Array<ArrayBuffer>, NetworkRefused | SkillLoadFailed, never>;
|
|
18
|
+
read: (url: string, request?: ReadRequest) => Effect.Effect<string, NetworkRefused | SkillLoadFailed, never>;
|
|
19
|
+
json: (url: string) => Effect.Effect<unknown, NetworkRefused | SkillLoadFailed, never>;
|
|
14
20
|
}, never, never>;
|
|
15
|
-
export declare const githubSkillsEffect: (options: GitHubSkillsOptions) => Effect.Effect<
|
|
16
|
-
readonly name: string;
|
|
17
|
-
readonly description: string;
|
|
18
|
-
readonly files: readonly {
|
|
19
|
-
readonly path: string;
|
|
20
|
-
readonly content: string;
|
|
21
|
-
}[];
|
|
22
|
-
readonly license?: string;
|
|
23
|
-
readonly compatibility?: string;
|
|
24
|
-
readonly metadata?: {
|
|
25
|
-
readonly [x: string]: string;
|
|
26
|
-
};
|
|
27
|
-
readonly "allowed-tools"?: string;
|
|
28
|
-
}[], SkillLoadFailed, never>;
|
|
21
|
+
export declare const githubSkillsEffect: (options: GitHubSkillsOptions) => Effect.Effect<typeof AppSkills.Type, SkillLoadFailed | NetworkRefused | ProviderError>;
|
|
29
22
|
/** Fetch all indexed files and reject a publication whose index changes during the read. */
|
|
30
23
|
export declare const wellKnownSkillsEffect: (options: WellKnownSkillsOptions) => Effect.Effect<readonly {
|
|
31
|
-
readonly name: string;
|
|
32
24
|
readonly description: string;
|
|
25
|
+
readonly name: string;
|
|
33
26
|
readonly files: readonly {
|
|
34
27
|
readonly path: string;
|
|
35
28
|
readonly content: string;
|
|
@@ -40,4 +33,5 @@ export declare const wellKnownSkillsEffect: (options: WellKnownSkillsOptions) =>
|
|
|
40
33
|
readonly [x: string]: string;
|
|
41
34
|
};
|
|
42
35
|
readonly "allowed-tools"?: string;
|
|
43
|
-
}[], SkillLoadFailed, never>;
|
|
36
|
+
}[], NetworkRefused | SkillLoadFailed, never>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ctx.sql` over a data facet's SQLite storage, and the deploy-time migrator.
|
|
3
|
+
*
|
|
4
|
+
* Every statement runs inside a synchronous SQLite transaction: alone, or inside the author's
|
|
5
|
+
* `transaction`. Nothing here can wait on another call, so no lock or transaction outlives the
|
|
6
|
+
* statement that needs it. What a statement may do is decided by SQLite, not by reading the SQL:
|
|
7
|
+
* a query runs in a transaction that is always rolled back.
|
|
8
|
+
*/
|
|
9
|
+
import { Effect, Schema } from "effect";
|
|
10
|
+
import { type AppSqlStorage, type Sql, type SqlReader } from "../contracts/sql.js";
|
|
11
|
+
import type { SkillFile } from "../contracts/skills.js";
|
|
12
|
+
export declare const noDatabase: Sql;
|
|
13
|
+
/** A workflow step mutation's identity, from the host's replay record. */
|
|
14
|
+
export interface StepReplay {
|
|
15
|
+
readonly key: string;
|
|
16
|
+
readonly fingerprint: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* One invocation's SQL. Once the invocation ends or `signal` aborts, every statement is refused, so
|
|
20
|
+
* code still running after a timeout or cancellation cannot write late.
|
|
21
|
+
*/
|
|
22
|
+
export declare const authorSql: (storage: AppSqlStorage, options: {
|
|
23
|
+
readonly signal: AbortSignal;
|
|
24
|
+
readonly step?: StepReplay;
|
|
25
|
+
/**
|
|
26
|
+
* The invocation's emitted events. A transaction that rolls back also discards the events its
|
|
27
|
+
* callback emitted, so subscribers never hear of writes that did not commit.
|
|
28
|
+
*/
|
|
29
|
+
readonly emitted?: unknown[];
|
|
30
|
+
}) => {
|
|
31
|
+
reader: SqlReader;
|
|
32
|
+
writer: Sql;
|
|
33
|
+
close: () => void;
|
|
34
|
+
};
|
|
35
|
+
declare const MigrationFileInvalid_base: Schema.Class<MigrationFileInvalid, Schema.TaggedStruct<"MigrationFileInvalid", {
|
|
36
|
+
readonly path: Schema.String;
|
|
37
|
+
readonly reason: Schema.String;
|
|
38
|
+
}>, import("effect/Cause").YieldableError>;
|
|
39
|
+
/** A file in `migrations/` that is not a migration the host can order. */
|
|
40
|
+
export declare class MigrationFileInvalid extends MigrationFileInvalid_base {
|
|
41
|
+
get message(): string;
|
|
42
|
+
}
|
|
43
|
+
declare const MigrationHistoryChanged_base: Schema.Class<MigrationHistoryChanged, Schema.TaggedStruct<"MigrationHistoryChanged", {
|
|
44
|
+
readonly reason: Schema.String;
|
|
45
|
+
}>, import("effect/Cause").YieldableError>;
|
|
46
|
+
/** The build's migrations no longer start with the ones already applied to the database. */
|
|
47
|
+
export declare class MigrationHistoryChanged extends MigrationHistoryChanged_base {
|
|
48
|
+
get message(): string;
|
|
49
|
+
}
|
|
50
|
+
declare const MigrationFailed_base: Schema.Class<MigrationFailed, Schema.TaggedStruct<"MigrationFailed", {
|
|
51
|
+
readonly path: Schema.String;
|
|
52
|
+
readonly reason: Schema.String;
|
|
53
|
+
}>, import("effect/Cause").YieldableError>;
|
|
54
|
+
/** SQLite rejected a migration. Every migration of the deploy rolled back. */
|
|
55
|
+
export declare class MigrationFailed extends MigrationFailed_base {
|
|
56
|
+
get message(): string;
|
|
57
|
+
}
|
|
58
|
+
/** Whether a build's files give the app a database: any `.sql` file in `migrations/`. */
|
|
59
|
+
export declare const hasMigrations: (files: readonly {
|
|
60
|
+
readonly path: string;
|
|
61
|
+
}[]) => boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Apply the build's pending migrations and report which ran. Every pending migration runs in one
|
|
64
|
+
* transaction, so a failing one leaves the database exactly as the active version knows it. The
|
|
65
|
+
* migrations already applied must still be the build's first ones, byte for byte.
|
|
66
|
+
*/
|
|
67
|
+
export declare const migrate: (storage: AppSqlStorage, files: readonly SkillFile[]) => Effect.Effect<{
|
|
68
|
+
readonly id: number;
|
|
69
|
+
readonly name: string;
|
|
70
|
+
}[], MigrationFileInvalid | MigrationHistoryChanged | MigrationFailed, never>;
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Host-rendered account notices; no authored app code or provider responses enter them. */
|
|
2
|
+
import type { UiAccountNotice, UiAccountProblem } from "../contracts/ui.js";
|
|
3
|
+
/** Missing, removed, incompatible, or rejected accounts stop the app; other failed checks are advisory. */
|
|
4
|
+
export declare const accountProblemBlocks: (problem: UiAccountProblem) => boolean;
|
|
5
|
+
export declare const accountProblemText: (problem: UiAccountProblem) => string;
|
|
6
|
+
/** Full page shown instead of the app while an account problem stops it from working. */
|
|
7
|
+
export declare const accountBlockedPage: (notice: UiAccountNotice) => string;
|
|
8
|
+
/** Inline card for advisory problems; the app still loads underneath. */
|
|
9
|
+
export declare const accountNoticeBootstrap: (notice: UiAccountNotice) => string;
|