apps 0.0.1-beta.0
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 +191 -0
- package/check-publish.mjs +10 -0
- package/framework-reference.json +1 -0
- package/js/chunk-22WRQZT7.js +389 -0
- package/js/chunk-2OTCEKL2.js +29480 -0
- package/js/chunk-36DNRFZQ.js +34 -0
- package/js/chunk-3ANFZFCV.js +1799 -0
- package/js/chunk-7JXHF5IF.js +138 -0
- package/js/chunk-BCSNKUAC.js +0 -0
- package/js/chunk-BKVL7XAJ.js +47 -0
- package/js/chunk-BPEFS4YF.js +1323 -0
- package/js/chunk-C24KEZXR.js +59 -0
- package/js/chunk-D6BKYP2L.js +877 -0
- package/js/chunk-EP6AEUZO.js +19 -0
- package/js/chunk-HP7E42X6.js +1719 -0
- package/js/chunk-KWTCHVLT.js +284 -0
- package/js/chunk-LOKGDT6B.js +28 -0
- package/js/chunk-MLKGABMK.js +9 -0
- package/js/chunk-OWD2YICM.js +2486 -0
- package/js/chunk-Q2FD5IBM.js +899 -0
- package/js/chunk-R6JMJSVT.js +590 -0
- package/js/chunk-SBKHUC5L.js +56 -0
- package/js/chunk-VFUZI3NY.js +75 -0
- package/js/chunk-W7Q5EOTS.js +4375 -0
- package/js/chunk-WIDTG42X.js +171 -0
- package/js/chunk-X3YBZCJW.js +246 -0
- package/js/chunk-YDR4CPJA.js +2357 -0
- package/js/client.js +1023 -0
- package/js/contracts.js +163 -0
- package/js/effect.js +44 -0
- package/js/graphql.js +392 -0
- package/js/host.js +193 -0
- package/js/index.js +284 -0
- package/js/mcp/effect.js +23 -0
- package/js/mcp/stdio.js +123 -0
- package/js/mcp.js +37 -0
- package/js/openapi.js +246 -0
- package/js/operations/approval.js +9 -0
- package/js/react.js +37 -0
- package/js/storage/facet.js +546 -0
- package/js/ui/auth/contracts.js +19 -0
- package/js/ui/auth.js +28 -0
- package/js/ui/contracts.js +24 -0
- package/js/ui/serving.js +286 -0
- package/package.json +116 -0
- package/runtime.json +1 -0
- package/types/app-data/src/contracts/database.d.ts +193 -0
- package/types/app-data/src/implementation/cursor.d.ts +10 -0
- package/types/app-data/src/implementation/index-key.d.ts +7 -0
- package/types/app-data/src/implementation/promise.d.ts +68 -0
- package/types/app-data/src/implementation/range.d.ts +8 -0
- package/types/app-data/src/implementation/schema.d.ts +33 -0
- package/types/app-data/src/implementation/sqlite.d.ts +11 -0
- package/types/app-data/src/index.d.ts +4 -0
- package/types/apps/src/approval.d.ts +10 -0
- package/types/apps/src/client.d.ts +5 -0
- package/types/apps/src/contracts/app.d.ts +58 -0
- package/types/apps/src/contracts/approval.d.ts +14 -0
- package/types/apps/src/contracts/context.d.ts +25 -0
- package/types/apps/src/contracts/elicitation.d.ts +86 -0
- package/types/apps/src/contracts/graphql.d.ts +102 -0
- package/types/apps/src/contracts/host.d.ts +568 -0
- package/types/apps/src/contracts/http.d.ts +20 -0
- package/types/apps/src/contracts/live.d.ts +26 -0
- package/types/apps/src/contracts/mcp.d.ts +93 -0
- package/types/apps/src/contracts/openapi.d.ts +105 -0
- package/types/apps/src/contracts/operations.d.ts +30 -0
- package/types/apps/src/contracts/optimistic.d.ts +22 -0
- package/types/apps/src/contracts/provider.d.ts +96 -0
- package/types/apps/src/contracts/schedules.d.ts +51 -0
- package/types/apps/src/contracts/schema.d.ts +20 -0
- package/types/apps/src/contracts/storage.d.ts +68 -0
- package/types/apps/src/contracts/tools.d.ts +11 -0
- package/types/apps/src/contracts/ui-auth.d.ts +28 -0
- package/types/apps/src/contracts/ui.d.ts +90 -0
- package/types/apps/src/contracts/webhook-protocol.d.ts +102 -0
- package/types/apps/src/contracts/webhooks.d.ts +53 -0
- package/types/apps/src/contracts/workflows.d.ts +277 -0
- package/types/apps/src/effect.d.ts +10 -0
- package/types/apps/src/facet.d.ts +5 -0
- package/types/apps/src/graphql.d.ts +10 -0
- package/types/apps/src/host.d.ts +16 -0
- package/types/apps/src/implementation/account-operations.d.ts +32 -0
- package/types/apps/src/implementation/app.d.ts +40 -0
- package/types/apps/src/implementation/authoring.d.ts +12 -0
- package/types/apps/src/implementation/elicitation.d.ts +103 -0
- package/types/apps/src/implementation/graphql.d.ts +5 -0
- package/types/apps/src/implementation/host.d.ts +3 -0
- package/types/apps/src/implementation/http.d.ts +5 -0
- package/types/apps/src/implementation/live.d.ts +18 -0
- package/types/apps/src/implementation/mcp-call.d.ts +19 -0
- package/types/apps/src/implementation/mcp-client.d.ts +50 -0
- package/types/apps/src/implementation/mcp-stdio.d.ts +4 -0
- package/types/apps/src/implementation/mcp-tools.d.ts +6 -0
- package/types/apps/src/implementation/mcp.d.ts +4 -0
- package/types/apps/src/implementation/openapi-request.d.ts +11 -0
- package/types/apps/src/implementation/openapi.d.ts +5 -0
- package/types/apps/src/implementation/operations.d.ts +65 -0
- package/types/apps/src/implementation/optimistic.d.ts +30 -0
- package/types/apps/src/implementation/protocol-operations.d.ts +24 -0
- package/types/apps/src/implementation/provider.d.ts +16 -0
- package/types/apps/src/implementation/query-commit.d.ts +10 -0
- package/types/apps/src/implementation/schedules.d.ts +16 -0
- package/types/apps/src/implementation/schema.d.ts +93 -0
- package/types/apps/src/implementation/storage.d.ts +13 -0
- package/types/apps/src/implementation/ui-auth.d.ts +13 -0
- package/types/apps/src/implementation/ui-client.d.ts +16 -0
- package/types/apps/src/implementation/ui-errors.d.ts +2 -0
- package/types/apps/src/implementation/ui-serving.d.ts +16 -0
- package/types/apps/src/implementation/ui-watch.d.ts +2 -0
- package/types/apps/src/implementation/webhooks.d.ts +29 -0
- package/types/apps/src/implementation/workflow-context.d.ts +8 -0
- package/types/apps/src/implementation/workflow-rpc.d.ts +5 -0
- package/types/apps/src/implementation/workflows.d.ts +27 -0
- package/types/apps/src/index.d.ts +58 -0
- package/types/apps/src/mcp-stdio.d.ts +8 -0
- package/types/apps/src/mcp.d.ts +10 -0
- package/types/apps/src/openapi.d.ts +10 -0
- package/types/apps/src/react.d.ts +7 -0
- package/types/apps/src/ui-auth.d.ts +3 -0
- package/types/apps/src/ui-serving.d.ts +3 -0
- package/types/telemetry/src/browser-operations.d.ts +16 -0
- package/types/telemetry/src/browser-performance.d.ts +11 -0
- package/types/telemetry/src/browser-request-timing.d.ts +2 -0
- package/types/telemetry/src/browser.d.ts +27 -0
- package/types/telemetry/src/config.d.ts +83 -0
- package/types/telemetry/src/context.d.ts +14 -0
- package/types/telemetry/src/index.d.ts +9 -0
- package/types/telemetry/src/layer.d.ts +7 -0
- package/types/telemetry/src/measurements.d.ts +8 -0
- package/types/telemetry/src/pending-span.d.ts +7 -0
- package/types/telemetry/src/relay.d.ts +28 -0
- package/types/telemetry/src/span-attributes.d.ts +29 -0
- package/types/telemetry/src/trace-context.d.ts +20 -0
- package/types/telemetry/src/transport.d.ts +6 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/** Portable, serialized app database declarations and operations. No product identity or database secrets cross this boundary. */
|
|
2
|
+
import { Schema, type Effect } from "effect";
|
|
3
|
+
/** Names have Lakebed's identifier shape and are always bound SQL values, never raw SQL. */
|
|
4
|
+
export declare const DataName: Schema.String;
|
|
5
|
+
/** Stored fields and index terms use finite scalar values; absent optional fields are represented by null in transport. */
|
|
6
|
+
export declare const Scalar: Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>;
|
|
7
|
+
export type Scalar = typeof Scalar.Type;
|
|
8
|
+
export declare const Field: Schema.Struct<{
|
|
9
|
+
readonly kind: Schema.Literals<readonly ["string", "number", "boolean", "id", "userId"]>;
|
|
10
|
+
readonly optional: Schema.optional<Schema.Boolean>;
|
|
11
|
+
readonly default: Schema.optional<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>;
|
|
12
|
+
readonly references: Schema.optional<Schema.String>;
|
|
13
|
+
}>;
|
|
14
|
+
export type Field = typeof Field.Type;
|
|
15
|
+
export declare const Index: Schema.Struct<{
|
|
16
|
+
readonly name: Schema.String;
|
|
17
|
+
readonly fields: Schema.NonEmptyArray<Schema.String>;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const Table: Schema.Struct<{
|
|
20
|
+
readonly fields: Schema.$Record<Schema.String, Schema.Struct<{
|
|
21
|
+
readonly kind: Schema.Literals<readonly ["string", "number", "boolean", "id", "userId"]>;
|
|
22
|
+
readonly optional: Schema.optional<Schema.Boolean>;
|
|
23
|
+
readonly default: Schema.optional<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>;
|
|
24
|
+
readonly references: Schema.optional<Schema.String>;
|
|
25
|
+
}>>;
|
|
26
|
+
readonly indexes: Schema.$Array<Schema.Struct<{
|
|
27
|
+
readonly name: Schema.String;
|
|
28
|
+
readonly fields: Schema.NonEmptyArray<Schema.String>;
|
|
29
|
+
}>>;
|
|
30
|
+
}>;
|
|
31
|
+
export type Table = typeof Table.Type;
|
|
32
|
+
export declare const DatabaseSchema: Schema.$Record<Schema.String, Schema.Struct<{
|
|
33
|
+
readonly fields: Schema.$Record<Schema.String, Schema.Struct<{
|
|
34
|
+
readonly kind: Schema.Literals<readonly ["string", "number", "boolean", "id", "userId"]>;
|
|
35
|
+
readonly optional: Schema.optional<Schema.Boolean>;
|
|
36
|
+
readonly default: Schema.optional<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>;
|
|
37
|
+
readonly references: Schema.optional<Schema.String>;
|
|
38
|
+
}>>;
|
|
39
|
+
readonly indexes: Schema.$Array<Schema.Struct<{
|
|
40
|
+
readonly name: Schema.String;
|
|
41
|
+
readonly fields: Schema.NonEmptyArray<Schema.String>;
|
|
42
|
+
}>>;
|
|
43
|
+
}>>;
|
|
44
|
+
export type DatabaseSchema = typeof DatabaseSchema.Type;
|
|
45
|
+
/** The engine owns stable row identity and timestamps. */
|
|
46
|
+
export declare const Row: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>;
|
|
47
|
+
export type Row = typeof Row.Type;
|
|
48
|
+
export declare const RowMetadata: Schema.Struct<{
|
|
49
|
+
readonly id: Schema.NonEmptyString;
|
|
50
|
+
readonly createdAt: Schema.String;
|
|
51
|
+
readonly updatedAt: Schema.String;
|
|
52
|
+
}>;
|
|
53
|
+
export declare const Patch: Schema.$Record<Schema.String, Schema.NullOr<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>>;
|
|
54
|
+
export declare const RangeClause: Schema.Struct<{
|
|
55
|
+
readonly field: Schema.String;
|
|
56
|
+
readonly op: Schema.Literals<readonly ["eq", "gt", "gte", "lt", "lte"]>;
|
|
57
|
+
readonly value: Schema.NullOr<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>;
|
|
58
|
+
}>;
|
|
59
|
+
export declare const QueryPlan: Schema.Struct<{
|
|
60
|
+
readonly table: Schema.String;
|
|
61
|
+
readonly index: Schema.String;
|
|
62
|
+
readonly order: Schema.Literals<readonly ["asc", "desc"]>;
|
|
63
|
+
readonly clauses: Schema.$Array<Schema.Struct<{
|
|
64
|
+
readonly field: Schema.String;
|
|
65
|
+
readonly op: Schema.Literals<readonly ["eq", "gt", "gte", "lt", "lte"]>;
|
|
66
|
+
readonly value: Schema.NullOr<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>;
|
|
67
|
+
}>>;
|
|
68
|
+
}>;
|
|
69
|
+
export type QueryPlan = typeof QueryPlan.Type;
|
|
70
|
+
export declare const QueryTerminal: Schema.Union<readonly [Schema.Struct<{
|
|
71
|
+
readonly kind: Schema.Literal<"collect">;
|
|
72
|
+
}>, Schema.Struct<{
|
|
73
|
+
readonly kind: Schema.Literal<"count">;
|
|
74
|
+
}>, Schema.Struct<{
|
|
75
|
+
readonly kind: Schema.Literal<"first">;
|
|
76
|
+
}>, Schema.Struct<{
|
|
77
|
+
readonly kind: Schema.Literal<"take">;
|
|
78
|
+
readonly count: Schema.Int;
|
|
79
|
+
}>, Schema.Struct<{
|
|
80
|
+
readonly kind: Schema.Literal<"paginate">;
|
|
81
|
+
readonly cursor: Schema.NullOr<Schema.String>;
|
|
82
|
+
readonly numItems: Schema.Int;
|
|
83
|
+
}>]>;
|
|
84
|
+
export declare const DatabaseOperation: Schema.Union<readonly [Schema.Struct<{
|
|
85
|
+
readonly kind: Schema.Literal<"get">;
|
|
86
|
+
readonly table: Schema.String;
|
|
87
|
+
readonly id: Schema.NonEmptyString;
|
|
88
|
+
}>, Schema.Struct<{
|
|
89
|
+
readonly kind: Schema.Literal<"insert">;
|
|
90
|
+
readonly table: Schema.String;
|
|
91
|
+
readonly value: Schema.$Record<Schema.String, Schema.NullOr<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>>;
|
|
92
|
+
}>, Schema.Struct<{
|
|
93
|
+
readonly kind: Schema.Literal<"update">;
|
|
94
|
+
readonly table: Schema.String;
|
|
95
|
+
readonly id: Schema.NonEmptyString;
|
|
96
|
+
readonly patch: Schema.$Record<Schema.String, Schema.NullOr<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>>;
|
|
97
|
+
}>, Schema.Struct<{
|
|
98
|
+
readonly kind: Schema.Literal<"delete">;
|
|
99
|
+
readonly table: Schema.String;
|
|
100
|
+
readonly id: Schema.NonEmptyString;
|
|
101
|
+
}>, Schema.Struct<{
|
|
102
|
+
readonly kind: Schema.Literal<"query">;
|
|
103
|
+
readonly plan: Schema.Struct<{
|
|
104
|
+
readonly table: Schema.String;
|
|
105
|
+
readonly index: Schema.String;
|
|
106
|
+
readonly order: Schema.Literals<readonly ["asc", "desc"]>;
|
|
107
|
+
readonly clauses: Schema.$Array<Schema.Struct<{
|
|
108
|
+
readonly field: Schema.String;
|
|
109
|
+
readonly op: Schema.Literals<readonly ["eq", "gt", "gte", "lt", "lte"]>;
|
|
110
|
+
readonly value: Schema.NullOr<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>;
|
|
111
|
+
}>>;
|
|
112
|
+
}>;
|
|
113
|
+
readonly terminal: Schema.Union<readonly [Schema.Struct<{
|
|
114
|
+
readonly kind: Schema.Literal<"collect">;
|
|
115
|
+
}>, Schema.Struct<{
|
|
116
|
+
readonly kind: Schema.Literal<"count">;
|
|
117
|
+
}>, Schema.Struct<{
|
|
118
|
+
readonly kind: Schema.Literal<"first">;
|
|
119
|
+
}>, Schema.Struct<{
|
|
120
|
+
readonly kind: Schema.Literal<"take">;
|
|
121
|
+
readonly count: Schema.Int;
|
|
122
|
+
}>, Schema.Struct<{
|
|
123
|
+
readonly kind: Schema.Literal<"paginate">;
|
|
124
|
+
readonly cursor: Schema.NullOr<Schema.String>;
|
|
125
|
+
readonly numItems: Schema.Int;
|
|
126
|
+
}>]>;
|
|
127
|
+
}>]>;
|
|
128
|
+
export type DatabaseOperation = typeof DatabaseOperation.Type;
|
|
129
|
+
export declare const PaginationResult: Schema.Struct<{
|
|
130
|
+
readonly page: Schema.$Array<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>>;
|
|
131
|
+
readonly continueCursor: Schema.NullOr<Schema.String>;
|
|
132
|
+
readonly isDone: Schema.Boolean;
|
|
133
|
+
}>;
|
|
134
|
+
export declare const OperationResult: Schema.Union<readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>, Schema.$Array<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>>, Schema.Struct<{
|
|
135
|
+
readonly page: Schema.$Array<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>>;
|
|
136
|
+
readonly continueCursor: Schema.NullOr<Schema.String>;
|
|
137
|
+
readonly isDone: Schema.Boolean;
|
|
138
|
+
}>, Schema.Boolean, Schema.Finite, Schema.Null]>;
|
|
139
|
+
export type OperationResult = typeof OperationResult.Type;
|
|
140
|
+
declare const AppDatabaseError_base: Schema.Class<AppDatabaseError, Schema.TaggedStruct<"AppDatabaseError", {
|
|
141
|
+
readonly reason: Schema.Literals<readonly ["schema", "schema_changed", "table", "index", "range", "value", "readonly", "cursor", "limit", "closed", "storage", "replay"]>;
|
|
142
|
+
}>, import("effect/Cause").YieldableError>;
|
|
143
|
+
/** Safe expected failures, without supplied documents, SQL text, cursor payloads or credentials. */
|
|
144
|
+
export declare class AppDatabaseError extends AppDatabaseError_base {
|
|
145
|
+
}
|
|
146
|
+
/** Bounded work per authored operation. collect/count do not silently truncate. */
|
|
147
|
+
export declare const DatabaseLimits: Schema.Struct<{
|
|
148
|
+
readonly rowsRead: Schema.Int;
|
|
149
|
+
readonly rowsReturned: Schema.Int;
|
|
150
|
+
readonly bytesRead: Schema.Int;
|
|
151
|
+
readonly writes: Schema.Int;
|
|
152
|
+
readonly scanCalls: Schema.Int;
|
|
153
|
+
readonly directGets: Schema.Int;
|
|
154
|
+
readonly valueBytes: Schema.Int;
|
|
155
|
+
readonly indexBytes: Schema.Int;
|
|
156
|
+
}>;
|
|
157
|
+
export type DatabaseLimits = typeof DatabaseLimits.Type;
|
|
158
|
+
/** Current per-invocation budgets, shared by every database adapter. */
|
|
159
|
+
export declare const defaultDatabaseLimits: DatabaseLimits;
|
|
160
|
+
/** Host resource bounds outside an individual database transaction. Durations are milliseconds. */
|
|
161
|
+
export declare const DatabaseRuntimeLimits: Schema.Struct<{
|
|
162
|
+
readonly maxCursorChars: Schema.Int;
|
|
163
|
+
readonly connectionCacheCapacity: Schema.Int;
|
|
164
|
+
readonly connectionCacheTtlMs: Schema.Int;
|
|
165
|
+
}>;
|
|
166
|
+
export type DatabaseRuntimeLimits = typeof DatabaseRuntimeLimits.Type;
|
|
167
|
+
/** Cache eviction closes idle connections; it does not limit installed apps or expire their data. */
|
|
168
|
+
export declare const defaultDatabaseRuntimeLimits: {
|
|
169
|
+
readonly maxCursorChars: number;
|
|
170
|
+
readonly connectionCacheCapacity: number;
|
|
171
|
+
readonly connectionCacheTtlMs: number;
|
|
172
|
+
};
|
|
173
|
+
/** The host binds one database and read/write authority for the entire invocation. */
|
|
174
|
+
export interface DatabaseSession {
|
|
175
|
+
/** Host-only idempotency receipt, committed atomically with the mutation and validated result. */
|
|
176
|
+
readonly once: <E, R>(key: string, fingerprint: string, work: () => Effect.Effect<Schema.Json, E, R>) => Effect.Effect<Schema.Json, E | AppDatabaseError, R>;
|
|
177
|
+
readonly readTables: ReadonlySet<string>;
|
|
178
|
+
readonly changedTables: ReadonlySet<string>;
|
|
179
|
+
readonly execute: (operation: DatabaseOperation) => Effect.Effect<OperationResult, AppDatabaseError>;
|
|
180
|
+
}
|
|
181
|
+
/** Native operation scope owns snapshot consistency, write rollback and commit notifications. */
|
|
182
|
+
export interface AppDatabase {
|
|
183
|
+
readonly schema: DatabaseSchema;
|
|
184
|
+
readonly schemaHash: string;
|
|
185
|
+
readonly read: <A, E, R>(work: (session: DatabaseSession) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | AppDatabaseError, R>;
|
|
186
|
+
readonly mutate: <A, E, R>(work: (session: DatabaseSession) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | AppDatabaseError, R>;
|
|
187
|
+
}
|
|
188
|
+
/** Product-independent app partitions. A host supplies persistent storage; callers never choose filenames. */
|
|
189
|
+
export interface AppDatabases {
|
|
190
|
+
readonly read: <A, E>(app: string, schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | AppDatabaseError>;
|
|
191
|
+
readonly mutate: <A, E>(app: string, schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | AppDatabaseError>;
|
|
192
|
+
}
|
|
193
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Authenticated, opaque continuation tokens tied to one installation, schema and query plan. */
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import { AppDatabaseError } from "../contracts/database.js";
|
|
4
|
+
/** Stable SHA-256 fingerprints contain no raw query arguments in logs or metadata keys. */
|
|
5
|
+
export declare const fingerprint: (crypto: Crypto, value: string) => Effect.Effect<string, AppDatabaseError, never>;
|
|
6
|
+
/** Capture a per-database key. Nonces are fresh, and malformed/tampered/cross-query cursors fail closed. */
|
|
7
|
+
export declare const cursorCodec: (crypto: Crypto, bytes: Uint8Array) => Effect.Effect<{
|
|
8
|
+
encode: (query: string, position: Uint8Array) => Effect.Effect<string, AppDatabaseError, never>;
|
|
9
|
+
decode: (query: string, token: string) => Effect.Effect<Uint8Array<ArrayBufferLike>, AppDatabaseError, never>;
|
|
10
|
+
}, AppDatabaseError, never>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Order-preserving scalar tuples. SQLite BLOB ordering supplies bounded prefix/range scans. */
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import { AppDatabaseError, type Scalar } from "../contracts/database.js";
|
|
4
|
+
/** Compare UTF-8 strings, booleans and finite doubles consistently, with absence before present values. */
|
|
5
|
+
export declare const encodeIndexKey: (values: readonly (Scalar | null)[], maximum?: number) => Effect.Effect<Uint8Array<ArrayBuffer>, AppDatabaseError, never>;
|
|
6
|
+
/** Exclusive upper bound for all tuples beginning with this prefix. */
|
|
7
|
+
export declare const prefixEnd: (prefix: Uint8Array) => Uint8Array | undefined;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Row, type DatabaseSession } from "../contracts/database.js";
|
|
2
|
+
/** Index predicates are accumulated immutably, then checked against the declaration by the engine. */
|
|
3
|
+
export interface IndexRange<Fields> {
|
|
4
|
+
/** Constrain an index prefix field to one value. Null matches a cleared optional field. */
|
|
5
|
+
readonly eq: <Key extends keyof Fields & string>(field: Key, value: Fields[Key] | null) => IndexRange<Fields>;
|
|
6
|
+
/** Require a value greater than the bound on the next index field. */
|
|
7
|
+
readonly gt: <Key extends keyof Fields & string>(field: Key, value: Fields[Key]) => IndexRange<Fields>;
|
|
8
|
+
/** Require a value greater than or equal to the bound on the next index field. */
|
|
9
|
+
readonly gte: <Key extends keyof Fields & string>(field: Key, value: Fields[Key]) => IndexRange<Fields>;
|
|
10
|
+
/** Require a value less than the bound on the next index field. */
|
|
11
|
+
readonly lt: <Key extends keyof Fields & string>(field: Key, value: Fields[Key]) => IndexRange<Fields>;
|
|
12
|
+
/** Require a value less than or equal to the bound on the next index field. */
|
|
13
|
+
readonly lte: <Key extends keyof Fields & string>(field: Key, value: Fields[Key]) => IndexRange<Fields>;
|
|
14
|
+
}
|
|
15
|
+
/** Bounded indexed reads; collect/count reject work beyond the invocation budget. */
|
|
16
|
+
export interface Query<Row> {
|
|
17
|
+
/** Choose ascending or descending index order without changing this query. */
|
|
18
|
+
readonly order: (direction: "asc" | "desc") => Query<Row>;
|
|
19
|
+
/** Read all matching rows within the invocation budget; exceeding it fails. */
|
|
20
|
+
readonly collect: () => Promise<readonly Row[]>;
|
|
21
|
+
/** Count matching rows within the scan budget; exceeding it fails. */
|
|
22
|
+
readonly count: () => Promise<number>;
|
|
23
|
+
/** Read the first matching row, or null when no row matches. */
|
|
24
|
+
readonly first: () => Promise<Row | null>;
|
|
25
|
+
/** Read at most count matching rows within the invocation budget. */
|
|
26
|
+
readonly take: (count: number) => Promise<readonly Row[]>;
|
|
27
|
+
/** Read one cursor page. Return its rows, continuation cursor and completion flag. */
|
|
28
|
+
readonly paginate: (options: {
|
|
29
|
+
readonly numItems: number;
|
|
30
|
+
readonly cursor: string | null;
|
|
31
|
+
}) => Promise<{
|
|
32
|
+
readonly page: readonly Row[];
|
|
33
|
+
readonly continueCursor: string | null;
|
|
34
|
+
readonly isDone: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
/** Typed table operations exposed to authored queries. */
|
|
38
|
+
export interface ReadTable<Row, Index extends string = string> {
|
|
39
|
+
/** Read a complete row by ID, or null when it does not exist. */
|
|
40
|
+
readonly get: (id: string) => Promise<Row | null>;
|
|
41
|
+
/** Select a declared index or by_creation, with optional prefix and range constraints. */
|
|
42
|
+
readonly withIndex: (index: Index | "by_creation", range?: (query: IndexRange<Row>) => IndexRange<Row>) => Query<Row>;
|
|
43
|
+
}
|
|
44
|
+
/** Writes are valid only inside their owning mutation. */
|
|
45
|
+
export interface WriteTable<Row, Insert, Index extends string = string> extends ReadTable<Row, Index> {
|
|
46
|
+
/** Insert authored fields and return the complete row with generated id, createdAt and updatedAt. */
|
|
47
|
+
readonly insert: (value: Insert) => Promise<Row>;
|
|
48
|
+
/** Patch authored fields and return the complete row, or null if the ID does not exist. */
|
|
49
|
+
readonly update: (id: string, patch: Partial<Insert>) => Promise<Row | null>;
|
|
50
|
+
/** Delete the row and return whether it existed. */
|
|
51
|
+
readonly delete: (id: string) => Promise<boolean>;
|
|
52
|
+
}
|
|
53
|
+
/** Build an untyped transport facade; the author schema layer installs exact field and row decoders. */
|
|
54
|
+
export declare const promiseTable: (session: DatabaseSession, table: string, signal: AbortSignal) => {
|
|
55
|
+
get: (id: string) => Promise<{
|
|
56
|
+
readonly [x: string]: string | number | boolean;
|
|
57
|
+
} | null>;
|
|
58
|
+
insert: (value: unknown) => Promise<{
|
|
59
|
+
readonly [x: string]: string | number | boolean;
|
|
60
|
+
}>;
|
|
61
|
+
update: (id: string, patch: unknown) => Promise<{
|
|
62
|
+
readonly [x: string]: string | number | boolean;
|
|
63
|
+
} | null>;
|
|
64
|
+
delete: (id: string) => Promise<boolean>;
|
|
65
|
+
withIndex: (index: string, range?: (query: IndexRange<Row>) => IndexRange<Row>) => Query<{
|
|
66
|
+
readonly [x: string]: string | number | boolean;
|
|
67
|
+
}>;
|
|
68
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Index-prefix equality followed by at most one field's lower and upper bounds. */
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import { AppDatabaseError, type QueryPlan, type Table } from "../contracts/database.js";
|
|
4
|
+
/** Produce half-open BLOB bounds; absent optional values do not satisfy ordinary range predicates. */
|
|
5
|
+
export declare const queryBounds: (table: Table, plan: QueryPlan, maximum: number) => Effect.Effect<{
|
|
6
|
+
lower: Uint8Array<ArrayBufferLike>;
|
|
7
|
+
upper: Uint8Array<ArrayBufferLike> | undefined;
|
|
8
|
+
}, AppDatabaseError, never>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Validate declarations and write values before touching SQLite. */
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import { AppDatabaseError, DatabaseSchema, RowMetadata, type Field, type Row, type Scalar, type Table } from "../contracts/database.js";
|
|
4
|
+
/** Built-in creation ordering and stable tie-breakers apply to every index. */
|
|
5
|
+
export declare const indexesFor: (table: Table) => {
|
|
6
|
+
name: string;
|
|
7
|
+
fields: string[];
|
|
8
|
+
}[];
|
|
9
|
+
/** Metadata fields have stable string semantics and cannot be overwritten. */
|
|
10
|
+
export declare const fieldFor: (table: Table, name: string) => Field | undefined;
|
|
11
|
+
/** Finite numbers and well-formed strings keep JSON and index ordering consistent. */
|
|
12
|
+
export declare const validScalar: (field: Field, value: unknown) => value is Scalar;
|
|
13
|
+
/** Parse the whole schema, including references and composite-index definitions. */
|
|
14
|
+
export declare const parseDatabaseSchema: (input: unknown) => Effect.Effect<{
|
|
15
|
+
readonly [x: string]: {
|
|
16
|
+
readonly fields: {
|
|
17
|
+
readonly [x: string]: {
|
|
18
|
+
readonly kind: "string" | "number" | "boolean" | "id" | "userId";
|
|
19
|
+
readonly optional?: boolean | undefined;
|
|
20
|
+
readonly default?: string | number | boolean | undefined;
|
|
21
|
+
readonly references?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
readonly indexes: readonly {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly fields: readonly [string, ...string[]];
|
|
27
|
+
}[];
|
|
28
|
+
};
|
|
29
|
+
}, AppDatabaseError, never>;
|
|
30
|
+
/** Canonical ordering for schema fingerprints and query-bound cursors. */
|
|
31
|
+
export declare const canonicalSchema: (schema: DatabaseSchema) => string;
|
|
32
|
+
/** Inserts apply declared defaults; updates reject unknown/metadata fields and clear optional values with null. */
|
|
33
|
+
export declare const writeValue: (table: Table, values: Readonly<Record<string, Scalar | null>>, previous: Row | undefined, meta: typeof RowMetadata.Type) => Effect.Effect<Record<string, string | number | boolean>, AppDatabaseError, never>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Shared SQLite engine. Drivers, persistent paths and app ownership belong to the host. */
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import type { SqlClient } from "effect/unstable/sql/SqlClient";
|
|
4
|
+
import { AppDatabaseError, DatabaseLimits, type AppDatabase } from "../contracts/database.js";
|
|
5
|
+
/** Open a database whose storage is owned by exactly one configured app. Schema changes fail closed. */
|
|
6
|
+
export declare const makeSqliteDatabase: (options: {
|
|
7
|
+
readonly sql: SqlClient;
|
|
8
|
+
readonly schema: unknown;
|
|
9
|
+
readonly crypto: Crypto;
|
|
10
|
+
readonly limits?: DatabaseLimits;
|
|
11
|
+
}) => Effect.Effect<AppDatabase, AppDatabaseError>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Portable, app-owned database engine and contracts. */
|
|
2
|
+
export * from "./contracts/database.js";
|
|
3
|
+
export { makeSqliteDatabase } from "./implementation/sqlite.js";
|
|
4
|
+
export { promiseTable, type IndexRange, type Query, type ReadTable, type WriteTable, } from "./implementation/promise.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Tool approval author API; no state or execution starts during declaration. */
|
|
2
|
+
import type { Effect } from "effect";
|
|
3
|
+
import type { Approval as NativeApproval } from "./contracts/approval.js";
|
|
4
|
+
export type { ApprovalContext, ApprovalDecision } from "./contracts/approval.js";
|
|
5
|
+
/** Synchronous or async policy, projected from the framework's native contract. */
|
|
6
|
+
export type Approval<Input = unknown> = (...args: Parameters<NativeApproval<Input>>) => Effect.Success<ReturnType<NativeApproval<Input>>> | Promise<Effect.Success<ReturnType<NativeApproval<Input>>>>;
|
|
7
|
+
/** Require human approval for every call to the tool. */
|
|
8
|
+
export declare const always: <Input = unknown>() => Approval<Input>;
|
|
9
|
+
/** Never require human approval for this tool. Product access checks still apply. */
|
|
10
|
+
export declare const never: <Input = unknown>() => Approval<Input>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Browser-safe live query API. Server operations are referenced using type-only imports. */
|
|
2
|
+
export { queryReference, mutationReference, liveQueryAtom } from "./implementation/live.js";
|
|
3
|
+
export { AppQueryFailed, type OperationReference, type QueryDescriptor, type QueryTransport, } from "./contracts/live.js";
|
|
4
|
+
export { createAppClient } from "./implementation/ui-client.js";
|
|
5
|
+
export type { AppMutation, OptimisticLocalStore, OptimisticUpdate, } from "./contracts/optimistic.js";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { DatabaseDefinition } from "./storage.js";
|
|
2
|
+
/** Native app contracts; factories and handlers compose in the host's Effect runtime. */
|
|
3
|
+
import { type Effect, Schema } from "effect";
|
|
4
|
+
import type { OperationSchedule } from "./schedules.js";
|
|
5
|
+
import type { AppOperation } from "./operations.js";
|
|
6
|
+
import type { AccountOf, AuthMethods, ManyAccounts, Provider } from "./provider.js";
|
|
7
|
+
import type { AppWorkflow, WorkflowReads } from "./workflows.js";
|
|
8
|
+
import type { Elicit } from "./elicitation.js";
|
|
9
|
+
/** Composition-only view. Specific handler inputs and outputs stay on the inferred definition. */
|
|
10
|
+
type Handler<Context> = (context: Context, input: never) => Effect.Effect<unknown, unknown>;
|
|
11
|
+
/** App capabilities share one account context. Package metadata belongs in package.json. */
|
|
12
|
+
export interface AppDefinition<Context> {
|
|
13
|
+
readonly workflows?: Readonly<Record<string, AppWorkflow>>;
|
|
14
|
+
readonly schedules?: Readonly<Record<string, Omit<OperationSchedule, "name"> & {
|
|
15
|
+
readonly tool: string;
|
|
16
|
+
}>>;
|
|
17
|
+
readonly queries?: Readonly<Record<string, AppOperation>>;
|
|
18
|
+
readonly mutations?: Readonly<Record<string, AppOperation>>;
|
|
19
|
+
readonly webhooks?: Readonly<Record<string, {
|
|
20
|
+
readonly account: string;
|
|
21
|
+
readonly config: Schema.Decoder<unknown>;
|
|
22
|
+
readonly state: Schema.Decoder<unknown>;
|
|
23
|
+
readonly setup?: import("./webhook-protocol.js").ManualWebhookSetup;
|
|
24
|
+
readonly register?: Handler<Context>;
|
|
25
|
+
readonly handle: Handler<Context>;
|
|
26
|
+
readonly unregister?: Handler<Context>;
|
|
27
|
+
}>>;
|
|
28
|
+
}
|
|
29
|
+
/** Named requirements for one account or a collection from a provider. */
|
|
30
|
+
export type AccountSlots = Readonly<Record<string, Provider<AuthMethods> | ManyAccounts<AuthMethods>>>;
|
|
31
|
+
type AccountsFor<Slot> = Slot extends ManyAccounts<infer Auth> ? readonly AccountOf<Provider<Auth>>[] : AccountOf<Slot>;
|
|
32
|
+
/** Current credentials for one invocation. Never retained in source or build output. */
|
|
33
|
+
export interface BoundContext<Slots extends AccountSlots> {
|
|
34
|
+
/** Read-only run management, bound to this configured app. */
|
|
35
|
+
readonly workflows: WorkflowReads;
|
|
36
|
+
/** Ask for user input during this tool call. Unavailable during discovery and after the invocation closes. */
|
|
37
|
+
readonly elicit: Elicit;
|
|
38
|
+
/** Invocation-owned HTTP requests with trace propagation and host cancellation. */
|
|
39
|
+
readonly fetch: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
40
|
+
/** Host cancellation for this invocation. Pass it to fetch and other interruptible APIs. */
|
|
41
|
+
readonly signal: AbortSignal;
|
|
42
|
+
readonly accounts: {
|
|
43
|
+
readonly [Slot in keyof Slots]: AccountsFor<Slots[Slot]>;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** The host evaluates this factory fresh with the configured app's selected accounts. */
|
|
47
|
+
export interface App<Slots extends AccountSlots, Def extends AppDefinition<never>> {
|
|
48
|
+
readonly accounts: Slots;
|
|
49
|
+
readonly database?: DatabaseDefinition;
|
|
50
|
+
readonly evaluate: (context: BoundContext<Slots>) => Effect.Effect<Def, unknown>;
|
|
51
|
+
}
|
|
52
|
+
declare const NotImplemented_base: Schema.Class<NotImplemented, Schema.TaggedStruct<"NotImplemented", {
|
|
53
|
+
readonly operation: Schema.String;
|
|
54
|
+
}>, import("effect/Cause").YieldableError>;
|
|
55
|
+
/** Explicit failure for authored capabilities that are still only sketches. */
|
|
56
|
+
export declare class NotImplemented extends NotImplemented_base {
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Tool-owned approval policies, evaluated after native input decoding. */
|
|
2
|
+
import { Schema, type Effect } from "effect";
|
|
3
|
+
/** Approve this call, deny it, or stop for a human decision. */
|
|
4
|
+
export declare const ApprovalDecision: Schema.Literals<readonly ["approved", "denied", "user-approval"]>;
|
|
5
|
+
/** Parsed result of one tool approval policy. */
|
|
6
|
+
export type ApprovalDecision = typeof ApprovalDecision.Type;
|
|
7
|
+
/** Context for one tool's policy. toolInput is the same decoded value passed to run. */
|
|
8
|
+
export interface ApprovalContext<Input = unknown> {
|
|
9
|
+
readonly toolName: string;
|
|
10
|
+
readonly toolInput: Input;
|
|
11
|
+
readonly signal: AbortSignal;
|
|
12
|
+
}
|
|
13
|
+
/** Native policy for this tool only. Failures prevent execution and remain private. */
|
|
14
|
+
export type Approval<Input = unknown> = (context: ApprovalContext<Input>) => Effect.Effect<ApprovalDecision, unknown>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Public handler contexts derive capabilities from one shared requirements declaration. */
|
|
2
|
+
import type { WorkflowControls } from "./workflows.js";
|
|
3
|
+
import type { AccountSlots, BoundContext } from "./app.js";
|
|
4
|
+
import type { Database, DatabaseDefinition, DatabaseReader, Tables } from "./storage.js";
|
|
5
|
+
/** Requirements are pure values; selected accounts and database sessions belong to invocations. */
|
|
6
|
+
export interface AppRequirements {
|
|
7
|
+
readonly accounts: AccountSlots;
|
|
8
|
+
readonly database?: DatabaseDefinition;
|
|
9
|
+
}
|
|
10
|
+
type StorageContext<Requirements, Writable extends boolean> = Requirements extends {
|
|
11
|
+
readonly database: DatabaseDefinition<infer T extends Tables>;
|
|
12
|
+
} ? {
|
|
13
|
+
readonly db: Writable extends true ? Database<T> : DatabaseReader<T>;
|
|
14
|
+
} : {};
|
|
15
|
+
/** Context available during dynamic app evaluation; storage opens only for handlers. */
|
|
16
|
+
export type AppContext<Requirements extends AppRequirements = AppRequirements> = BoundContext<Requirements["accounts"]>;
|
|
17
|
+
/** Interactive query context; declared storage exposes only read methods. */
|
|
18
|
+
export type QueryContext<Requirements extends AppRequirements = AppRequirements> = AppContext<Requirements> & StorageContext<Requirements, false>;
|
|
19
|
+
/** Interactive mutation context; declared storage belongs to the invocation transaction. */
|
|
20
|
+
export type MutationContext<Requirements extends AppRequirements = AppRequirements> = Omit<AppContext<Requirements>, "workflows"> & {
|
|
21
|
+
readonly workflows: WorkflowControls;
|
|
22
|
+
} & StorageContext<Requirements, true>;
|
|
23
|
+
/** Background webhook context has account and storage access without interactive input. */
|
|
24
|
+
export type WebhookContext<Requirements extends AppRequirements = AppRequirements> = Omit<MutationContext<Requirements>, "elicit">;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** Shared MCP elicitation data. Delivery belongs to the host, independently of its transport. */
|
|
2
|
+
import { Schema, type Effect } from "effect";
|
|
3
|
+
import * as McpSchema from "effect/unstable/ai/McpSchema";
|
|
4
|
+
import { type JsonValue } from "./schema.js";
|
|
5
|
+
/** Maximum human-input wait, separate from active provider execution time. */
|
|
6
|
+
export declare const ElicitationLimits: Schema.Struct<{
|
|
7
|
+
readonly timeoutMs: Schema.Int;
|
|
8
|
+
}>;
|
|
9
|
+
export type ElicitationLimits = typeof ElicitationLimits.Type;
|
|
10
|
+
/** Shared input lifetime for MCP collection and upstream forms. */
|
|
11
|
+
export declare const defaultElicitationLimits: {
|
|
12
|
+
readonly timeoutMs: number;
|
|
13
|
+
};
|
|
14
|
+
/** Plain-data form request derived from the pinned MCP protocol schema. */
|
|
15
|
+
export declare const FormElicitation: Schema.Struct<{
|
|
16
|
+
readonly mode: Schema.Literal<"form">;
|
|
17
|
+
readonly requestedSchema: Schema.toEncoded<Schema.Struct<{
|
|
18
|
+
readonly $schema: Schema.decodeTo<Schema.optional<Schema.String>, Schema.optionalKey<Schema.String>, never, never>;
|
|
19
|
+
readonly type: Schema.tag<"object">;
|
|
20
|
+
readonly properties: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Union<readonly [typeof McpSchema.LegacyTitledEnum, Schema.Union<readonly [typeof McpSchema.UntitledSingleSelectEnum, typeof McpSchema.TitledSingleSelectEnum]>, Schema.Union<readonly [typeof McpSchema.UntitledMultiSelectEnum, typeof McpSchema.TitledMultiSelectEnum]>]>, typeof McpSchema.ElicitationString, typeof McpSchema.ElicitationNumber, typeof McpSchema.ElicitationBoolean]>>;
|
|
21
|
+
readonly required: Schema.decodeTo<Schema.optional<Schema.$Array<Schema.String>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
|
|
22
|
+
}>>;
|
|
23
|
+
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
24
|
+
readonly message: Schema.String;
|
|
25
|
+
}>;
|
|
26
|
+
export type FormElicitation = typeof FormElicitation.Type;
|
|
27
|
+
/** MCP accept/decline/cancel response, without imposing a client or transport on app code. */
|
|
28
|
+
export declare const ElicitationResponse: Schema.Union<readonly [Schema.Struct<{
|
|
29
|
+
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
30
|
+
readonly action: Schema.Literal<"accept">;
|
|
31
|
+
readonly content: Schema.decodeTo<Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.$Array<Schema.String>]>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.$Array<Schema.String>]>>>, never, never>;
|
|
32
|
+
}>, Schema.Struct<{
|
|
33
|
+
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
34
|
+
readonly action: Schema.Literals<readonly ["cancel", "decline"]>;
|
|
35
|
+
}>]>;
|
|
36
|
+
export type ElicitationResponse = typeof ElicitationResponse.Type;
|
|
37
|
+
declare const ElicitationFailed_base: Schema.Class<ElicitationFailed, Schema.TaggedStruct<"ElicitationFailed", {
|
|
38
|
+
readonly reason: Schema.Literals<readonly ["unavailable", "transaction", "invalid-request", "invalid-response", "transport", "expired", "forbidden"]>;
|
|
39
|
+
}>, import("effect/Cause").YieldableError>;
|
|
40
|
+
/** A tool interaction could not be delivered or its request/response was invalid. No private payload is retained. */
|
|
41
|
+
export declare class ElicitationFailed extends ElicitationFailed_base {
|
|
42
|
+
}
|
|
43
|
+
/** Trusted, invocation-owned delivery. The signal expires with the tool invocation. */
|
|
44
|
+
export type ElicitationHandler = (request: FormElicitation, signal: AbortSignal) => Effect.Effect<ElicitationResponse, ElicitationFailed>;
|
|
45
|
+
/** App authors await standard MCP form responses without depending on Effect or a particular host. */
|
|
46
|
+
export type Elicit = (request: FormElicitation) => Promise<ElicitationResponse>;
|
|
47
|
+
/** Safe reply for a runtime that crosses an RPC boundary. */
|
|
48
|
+
export declare const ElicitationReply: Schema.Union<readonly [Schema.Struct<{
|
|
49
|
+
readonly ok: Schema.Literal<true>;
|
|
50
|
+
readonly response: Schema.Union<readonly [Schema.Struct<{
|
|
51
|
+
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
52
|
+
readonly action: Schema.Literal<"accept">;
|
|
53
|
+
readonly content: Schema.decodeTo<Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.$Array<Schema.String>]>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.$Array<Schema.String>]>>>, never, never>;
|
|
54
|
+
}>, Schema.Struct<{
|
|
55
|
+
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
56
|
+
readonly action: Schema.Literals<readonly ["cancel", "decline"]>;
|
|
57
|
+
}>]>;
|
|
58
|
+
}>, Schema.Struct<{
|
|
59
|
+
readonly ok: Schema.Literal<false>;
|
|
60
|
+
readonly error: typeof ElicitationFailed;
|
|
61
|
+
}>]>;
|
|
62
|
+
export type ElicitationReply = typeof ElicitationReply.Type;
|
|
63
|
+
/** Invocation consent requests no additional fields; arguments are reviewed, never edited in the form. */
|
|
64
|
+
export declare const ApprovalElicitation: Schema.Struct<{
|
|
65
|
+
readonly requestedSchema: Schema.Struct<{
|
|
66
|
+
readonly type: Schema.Literal<"object">;
|
|
67
|
+
readonly properties: Schema.$Record<Schema.String, Schema.Never>;
|
|
68
|
+
}>;
|
|
69
|
+
readonly mode: Schema.Literal<"form">;
|
|
70
|
+
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
71
|
+
readonly message: Schema.String;
|
|
72
|
+
}>;
|
|
73
|
+
export type ApprovalElicitation = typeof ApprovalElicitation.Type;
|
|
74
|
+
/** Only empty form content can answer invocation consent. Extra fields cannot change approved arguments. */
|
|
75
|
+
export declare const ApprovalResponse: Schema.Union<readonly [Schema.Struct<{
|
|
76
|
+
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
77
|
+
readonly action: Schema.Literal<"accept">;
|
|
78
|
+
readonly content: Schema.decodeTo<Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.$Array<Schema.String>]>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.$Array<Schema.String>]>>>, never, never>;
|
|
79
|
+
}>, Schema.Struct<{
|
|
80
|
+
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
81
|
+
readonly action: Schema.Literals<readonly ["cancel", "decline"]>;
|
|
82
|
+
}>]>;
|
|
83
|
+
export type ApprovalResponse = typeof ApprovalResponse.Type;
|
|
84
|
+
/** Build the framework's own policy prompt after native input decoding. Includes no account credentials. */
|
|
85
|
+
export declare const approvalElicitation: (toolName: string, input: JsonValue) => ApprovalElicitation;
|
|
86
|
+
export {};
|