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,93 @@
|
|
|
1
|
+
/** MCP protocol data uses Effect Schema; executable tool methods use Effect. */
|
|
2
|
+
import { type Effect, type Redacted, Schema } from "effect";
|
|
3
|
+
import type { Elicit, ElicitationFailed } from "./elicitation.js";
|
|
4
|
+
import { type JsonValue } from "./schema.js";
|
|
5
|
+
/** Upstream MCP resource bounds, independent of the outer codemode execution budget. */
|
|
6
|
+
export declare const McpClientLimits: Schema.Struct<{
|
|
7
|
+
readonly timeoutMs: Schema.Int;
|
|
8
|
+
readonly maxTimeoutMs: Schema.Int;
|
|
9
|
+
readonly maxTools: Schema.Int;
|
|
10
|
+
readonly maxPaginationCursors: Schema.Int;
|
|
11
|
+
readonly cleanupTimeoutMs: Schema.Int;
|
|
12
|
+
}>;
|
|
13
|
+
export type McpClientLimits = typeof McpClientLimits.Type;
|
|
14
|
+
/** HTTP and stdio share discovery ceilings and the default provider timeout. */
|
|
15
|
+
export declare const defaultMcpClientLimits: {
|
|
16
|
+
readonly timeoutMs: number;
|
|
17
|
+
readonly maxTimeoutMs: number;
|
|
18
|
+
readonly maxTools: number;
|
|
19
|
+
readonly maxPaginationCursors: number;
|
|
20
|
+
readonly cleanupTimeoutMs: number;
|
|
21
|
+
};
|
|
22
|
+
/** Platform timer ceiling, not an execution allowance; our active-time clock owns the call deadline. */
|
|
23
|
+
export declare const mcpSdkTimerCeilingMs = 2147483647;
|
|
24
|
+
/** Server and headers for this selected account. Headers are a credential snapshot. */
|
|
25
|
+
export declare const McpToolsOptions: Schema.Struct<{
|
|
26
|
+
readonly url: Schema.String;
|
|
27
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
28
|
+
readonly signal: Schema.optional<Schema.instanceOf<AbortSignal, AbortSignal>>;
|
|
29
|
+
readonly timeoutMs: Schema.optional<Schema.Number>;
|
|
30
|
+
}>;
|
|
31
|
+
export type McpToolsOptions = typeof McpToolsOptions.Type;
|
|
32
|
+
/** One parsed server and credential snapshot; never shared across account evaluations. */
|
|
33
|
+
export interface McpConnection {
|
|
34
|
+
readonly url: URL;
|
|
35
|
+
readonly headers: Redacted.Redacted<Readonly<Record<string, string>>>;
|
|
36
|
+
readonly timeoutMs: number;
|
|
37
|
+
}
|
|
38
|
+
export { ToolAnnotations as McpToolAnnotations } from "./tools.js";
|
|
39
|
+
/** Native MCP result semantics. Protocol/transport failures use the Effect error channel. */
|
|
40
|
+
export declare const McpToolResult: Schema.Struct<{
|
|
41
|
+
readonly content: Schema.$Array<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
42
|
+
readonly structuredContent: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
43
|
+
readonly isError: Schema.optional<Schema.Boolean>;
|
|
44
|
+
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
45
|
+
}>;
|
|
46
|
+
export type McpToolResult = typeof McpToolResult.Type;
|
|
47
|
+
/** Remote metadata. Input/output schemas remain upstream JSON Schema documents. */
|
|
48
|
+
export declare const McpToolMetadata: Schema.Struct<{
|
|
49
|
+
readonly name: Schema.String;
|
|
50
|
+
readonly title: Schema.optional<Schema.String>;
|
|
51
|
+
readonly description: Schema.optional<Schema.String>;
|
|
52
|
+
readonly inputSchema: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
53
|
+
readonly outputSchema: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
54
|
+
readonly annotations: Schema.optional<Schema.Struct<{
|
|
55
|
+
readonly title: Schema.optionalKey<Schema.String>;
|
|
56
|
+
readonly readOnlyHint: Schema.optionalKey<Schema.Boolean>;
|
|
57
|
+
readonly destructiveHint: Schema.optionalKey<Schema.Boolean>;
|
|
58
|
+
readonly idempotentHint: Schema.optionalKey<Schema.Boolean>;
|
|
59
|
+
readonly openWorldHint: Schema.optionalKey<Schema.Boolean>;
|
|
60
|
+
}>>;
|
|
61
|
+
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
62
|
+
}>;
|
|
63
|
+
export type McpToolMetadata = typeof McpToolMetadata.Type;
|
|
64
|
+
/** Direct callers can omit interaction capabilities. A server that asks for input then fails explicitly. */
|
|
65
|
+
export interface McpToolContext {
|
|
66
|
+
readonly elicit?: Elicit;
|
|
67
|
+
}
|
|
68
|
+
/** A tool bound to one evaluation's account; do not reuse it with another account. */
|
|
69
|
+
export interface McpTool extends McpToolMetadata {
|
|
70
|
+
readonly description: string;
|
|
71
|
+
readonly input: Schema.Decoder<JsonValue>;
|
|
72
|
+
readonly readOnly?: boolean;
|
|
73
|
+
readonly run: (context: McpToolContext, input: JsonValue) => Effect.Effect<McpToolResult, McpError | ElicitationFailed>;
|
|
74
|
+
}
|
|
75
|
+
/** The discovered catalog keyed by remote tool name. */
|
|
76
|
+
export type McpTools = Readonly<Record<string, McpTool>>;
|
|
77
|
+
declare const McpError_base: Schema.Class<McpError, Schema.TaggedStruct<"McpError", {
|
|
78
|
+
readonly phase: Schema.Literals<readonly ["connect", "discover", "call", "schema", "transport"]>;
|
|
79
|
+
readonly reason: Schema.Literals<readonly ["request", "unauthorized", "invalid_response", "timeout", "invalid_input"]>;
|
|
80
|
+
readonly status: Schema.optional<Schema.Number>;
|
|
81
|
+
}>, import("effect/Cause").YieldableError>;
|
|
82
|
+
/** Safe protocol/transport failure; no raw upstream payloads or credentials. */
|
|
83
|
+
export declare class McpError extends McpError_base {
|
|
84
|
+
}
|
|
85
|
+
/** Public process configuration. Credentials arrive through the selected account. */
|
|
86
|
+
export declare const ProcessConfig: Schema.Struct<{
|
|
87
|
+
readonly command: Schema.NonEmptyString;
|
|
88
|
+
readonly args: Schema.$Array<Schema.String>;
|
|
89
|
+
readonly cwd: Schema.optional<Schema.String>;
|
|
90
|
+
readonly env: Schema.$Record<Schema.String, Schema.String>;
|
|
91
|
+
readonly timeoutMs: Schema.Int;
|
|
92
|
+
}>;
|
|
93
|
+
export type ProcessConfig = typeof ProcessConfig.Type;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/** Normalized OpenAPI metadata retained with app source; no compiler or protocol client is required. */
|
|
2
|
+
import { Schema, type Effect } from "effect";
|
|
3
|
+
import { JsonObject } from "./schema.js";
|
|
4
|
+
/** One parameter's HTTP placement and serialization. */
|
|
5
|
+
export declare const RequestParameter: Schema.Struct<{
|
|
6
|
+
readonly name: Schema.String;
|
|
7
|
+
readonly in: Schema.Literals<readonly ["path", "query", "header"]>;
|
|
8
|
+
readonly style: Schema.String;
|
|
9
|
+
readonly explode: Schema.Boolean;
|
|
10
|
+
}>;
|
|
11
|
+
export type RequestParameter = typeof RequestParameter.Type;
|
|
12
|
+
/** Credential-free operation data emitted by the OpenAPI importer. */
|
|
13
|
+
export declare const OpenapiOperation: Schema.Struct<{
|
|
14
|
+
readonly name: Schema.NonEmptyString;
|
|
15
|
+
readonly description: Schema.String;
|
|
16
|
+
readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]>;
|
|
17
|
+
readonly path: Schema.String;
|
|
18
|
+
readonly baseUrl: Schema.String;
|
|
19
|
+
readonly parameters: Schema.$Array<Schema.Struct<{
|
|
20
|
+
readonly name: Schema.String;
|
|
21
|
+
readonly in: Schema.Literals<readonly ["path", "query", "header"]>;
|
|
22
|
+
readonly style: Schema.String;
|
|
23
|
+
readonly explode: Schema.Boolean;
|
|
24
|
+
}>>;
|
|
25
|
+
readonly body: Schema.Literals<readonly ["json", "base64", "none"]>;
|
|
26
|
+
/** Streams remain in the metadata but cannot run through a single-result tool call. */
|
|
27
|
+
readonly streaming: Schema.optionalKey<Schema.Literal<true>>;
|
|
28
|
+
readonly security: Schema.$Array<Schema.$Array<Schema.String>>;
|
|
29
|
+
readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
30
|
+
readonly outputSchema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
31
|
+
}>;
|
|
32
|
+
export type OpenapiOperation = typeof OpenapiOperation.Type;
|
|
33
|
+
/** One field's placement, potentially combined with other fields in an authentication method. */
|
|
34
|
+
export declare const CredentialBinding: Schema.Struct<{
|
|
35
|
+
readonly scheme: Schema.String;
|
|
36
|
+
readonly field: Schema.String;
|
|
37
|
+
readonly in: Schema.Literals<readonly ["header", "query"]>;
|
|
38
|
+
readonly name: Schema.String;
|
|
39
|
+
readonly prefix: Schema.String;
|
|
40
|
+
}>;
|
|
41
|
+
export type CredentialBinding = typeof CredentialBinding.Type;
|
|
42
|
+
/** Selected credentials stay in the server runtime, separate from operation metadata. */
|
|
43
|
+
export declare const OpenapiAccount: Schema.Struct<{
|
|
44
|
+
readonly method: Schema.String;
|
|
45
|
+
readonly fields: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
46
|
+
}>;
|
|
47
|
+
export type OpenapiAccount = typeof OpenapiAccount.Type;
|
|
48
|
+
/** Parsed options for one account's evaluation. */
|
|
49
|
+
export declare const OpenapiToolsOptions: Schema.Struct<{
|
|
50
|
+
readonly operations: Schema.$Array<Schema.Struct<{
|
|
51
|
+
readonly name: Schema.NonEmptyString;
|
|
52
|
+
readonly description: Schema.String;
|
|
53
|
+
readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]>;
|
|
54
|
+
readonly path: Schema.String;
|
|
55
|
+
readonly baseUrl: Schema.String;
|
|
56
|
+
readonly parameters: Schema.$Array<Schema.Struct<{
|
|
57
|
+
readonly name: Schema.String;
|
|
58
|
+
readonly in: Schema.Literals<readonly ["path", "query", "header"]>;
|
|
59
|
+
readonly style: Schema.String;
|
|
60
|
+
readonly explode: Schema.Boolean;
|
|
61
|
+
}>>;
|
|
62
|
+
readonly body: Schema.Literals<readonly ["json", "base64", "none"]>;
|
|
63
|
+
/** Streams remain in the metadata but cannot run through a single-result tool call. */
|
|
64
|
+
readonly streaming: Schema.optionalKey<Schema.Literal<true>>;
|
|
65
|
+
readonly security: Schema.$Array<Schema.$Array<Schema.String>>;
|
|
66
|
+
readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
67
|
+
readonly outputSchema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
68
|
+
}>>;
|
|
69
|
+
readonly methods: Schema.$Record<Schema.String, Schema.$Array<Schema.Struct<{
|
|
70
|
+
readonly scheme: Schema.String;
|
|
71
|
+
readonly field: Schema.String;
|
|
72
|
+
readonly in: Schema.Literals<readonly ["header", "query"]>;
|
|
73
|
+
readonly name: Schema.String;
|
|
74
|
+
readonly prefix: Schema.String;
|
|
75
|
+
}>>>;
|
|
76
|
+
readonly oauth: Schema.$Array<Schema.String>;
|
|
77
|
+
readonly account: Schema.optional<Schema.Struct<{
|
|
78
|
+
readonly method: Schema.String;
|
|
79
|
+
readonly fields: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
80
|
+
}>>;
|
|
81
|
+
readonly signal: Schema.optional<Schema.instanceOf<AbortSignal, AbortSignal>>;
|
|
82
|
+
readonly fetch: Schema.optional<Schema.declare<typeof fetch, typeof fetch>>;
|
|
83
|
+
}>;
|
|
84
|
+
/** JSON imports are decoded at the helper boundary, without assertions in app source. */
|
|
85
|
+
export type OpenapiToolsOptions = Omit<typeof OpenapiToolsOptions.Type, "operations"> & {
|
|
86
|
+
readonly operations: unknown;
|
|
87
|
+
};
|
|
88
|
+
declare const OpenapiError_base: Schema.Class<OpenapiError, Schema.TaggedStruct<"OpenapiError", {
|
|
89
|
+
readonly reason: Schema.Literals<readonly ["invalid_definition", "invalid_input", "request"]>;
|
|
90
|
+
readonly status: Schema.optional<Schema.Number>;
|
|
91
|
+
}>, import("effect/Cause").YieldableError>;
|
|
92
|
+
/** Safe failures omit request headers, credentials and upstream bodies. */
|
|
93
|
+
export declare class OpenapiError extends OpenapiError_base {
|
|
94
|
+
}
|
|
95
|
+
/** An ordinary native tool bound to one selected account. */
|
|
96
|
+
export interface OpenapiTool {
|
|
97
|
+
readonly description: string;
|
|
98
|
+
readonly readOnly: boolean;
|
|
99
|
+
readonly outputSchema?: JsonObject;
|
|
100
|
+
readonly input: Schema.Decoder<Schema.Json>;
|
|
101
|
+
readonly run: (context: unknown, input: Schema.Json) => Effect.Effect<unknown, OpenapiError>;
|
|
102
|
+
}
|
|
103
|
+
/** Executable operations keyed by their generated names. */
|
|
104
|
+
export type OpenapiTools = Readonly<Record<string, OpenapiTool>>;
|
|
105
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Native operation declarations. Database access is an optional invocation capability. */
|
|
2
|
+
import type { Effect, Schema } from "effect";
|
|
3
|
+
import type { Approval } from "./approval.js";
|
|
4
|
+
import type { BoundContext, AccountSlots } from "./app.js";
|
|
5
|
+
import type { Database, DatabaseReader, Tables } from "./storage.js";
|
|
6
|
+
import type { ToolAnnotations } from "./tools.js";
|
|
7
|
+
import type { JsonObject } from "./schema.js";
|
|
8
|
+
/** Host-bound operation capabilities; the author declaration refines accounts and storage. */
|
|
9
|
+
export type OperationContext = BoundContext<AccountSlots> & {
|
|
10
|
+
readonly db?: DatabaseReader<Tables> | Database<Tables>;
|
|
11
|
+
};
|
|
12
|
+
/** The host validates input, checks approval, then owns the transaction and output validation. */
|
|
13
|
+
export interface AppOperation<Input = unknown, Output = unknown> {
|
|
14
|
+
readonly kind: "query" | "mutation";
|
|
15
|
+
readonly description?: string;
|
|
16
|
+
readonly title?: string;
|
|
17
|
+
readonly annotations?: ToolAnnotations;
|
|
18
|
+
readonly _meta?: JsonObject;
|
|
19
|
+
readonly input: Schema.Decoder<Input>;
|
|
20
|
+
readonly output?: Schema.Decoder<Output>;
|
|
21
|
+
/** Upstream protocol result metadata; the protocol adapter validates its own result envelope. */
|
|
22
|
+
readonly outputSchema?: JsonObject;
|
|
23
|
+
readonly approval?: Approval<Input>;
|
|
24
|
+
readonly run: (context: OperationContext, input: Input) => Effect.Effect<Output, unknown>;
|
|
25
|
+
}
|
|
26
|
+
/** Agent tool names carry the operation kind; catalogs may reuse the same local name. */
|
|
27
|
+
export declare const OperationToolPrefixes: {
|
|
28
|
+
readonly query: "queries.";
|
|
29
|
+
readonly mutate: "mutations.";
|
|
30
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Convex-style temporary query projections; server operations remain authoritative. */
|
|
2
|
+
import type { OperationReference } from "./live.js";
|
|
3
|
+
/** Read or replace mounted queries during a synchronous optimistic update. Never mutate returned values. */
|
|
4
|
+
export interface OptimisticLocalStore {
|
|
5
|
+
/** Read the projected result, or undefined if this query is not loaded in this client. */
|
|
6
|
+
getQuery<Input, Output>(reference: OperationReference<Input, Output, "query">, input: NoInfer<Input>): Output | undefined;
|
|
7
|
+
/** Read all mounted argument variants of an operation, including loading queries. */
|
|
8
|
+
getAllQueries<Input, Output>(reference: OperationReference<Input, Output, "query">): readonly {
|
|
9
|
+
readonly input: Input;
|
|
10
|
+
readonly value: Output | undefined;
|
|
11
|
+
}[];
|
|
12
|
+
/** Replace a mounted query's projected result. The query's output schema validates the new value. */
|
|
13
|
+
setQuery<Input, Output>(reference: OperationReference<Input, Output, "query">, input: NoInfer<Input>, value: NoInfer<Output>): void;
|
|
14
|
+
}
|
|
15
|
+
/** Pure synchronous projection. Replayed over current data; create temporary IDs before invoking the mutation. */
|
|
16
|
+
export type OptimisticUpdate<Input> = (store: OptimisticLocalStore, input: Input) => undefined;
|
|
17
|
+
/** A callable mutation. Success means the write was acknowledged; its overlay stays until fresh reads finish. */
|
|
18
|
+
export interface AppMutation<Input, Output> {
|
|
19
|
+
(input: Input): Promise<Output>;
|
|
20
|
+
/** Return a new mutation handle with this projection. Failures remove only this invocation's changes. */
|
|
21
|
+
withOptimisticUpdate(update: OptimisticUpdate<Input>): AppMutation<Input, Output>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/** Provider declarations use native Effect schemas. The trusted host interprets them. */
|
|
2
|
+
import { Data, Schema } from "effect";
|
|
3
|
+
import { type AccountId } from "./schema.js";
|
|
4
|
+
declare const SecretsMethod_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Readonly<A> & {
|
|
5
|
+
readonly _tag: "secrets";
|
|
6
|
+
} & import("effect/Pipeable").Pipeable;
|
|
7
|
+
/** A named secrets method; its schema retains the provider's own field names. */
|
|
8
|
+
export declare class SecretsMethod<Fields extends Schema.Decoder<unknown>> extends SecretsMethod_base<{
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly fields: Fields;
|
|
11
|
+
}> {
|
|
12
|
+
}
|
|
13
|
+
/** How an OAuth client authenticates at the token endpoint; raw Basic is an explicit provider compatibility option. */
|
|
14
|
+
export declare const OAuthClientAuth: Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
15
|
+
export type OAuthClientAuth = typeof OAuthClientAuth.Type;
|
|
16
|
+
/** Machine clients always authenticate; public clients cannot use the client-credentials grant. */
|
|
17
|
+
export declare const OAuthSecretClientAuth: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
18
|
+
/** OAuth endpoints and protocol choices. Omitted grant means authorization code; clients remain host-owned. */
|
|
19
|
+
export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
|
|
20
|
+
readonly discover: Schema.String;
|
|
21
|
+
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
22
|
+
readonly tokenUrl: Schema.optionalKey<Schema.Never>;
|
|
23
|
+
readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
24
|
+
readonly grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
|
|
25
|
+
readonly tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
|
|
26
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
27
|
+
}>, Schema.Struct<{
|
|
28
|
+
readonly authorizationUrl: Schema.String;
|
|
29
|
+
readonly tokenUrl: Schema.String;
|
|
30
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
31
|
+
readonly discover: Schema.optionalKey<Schema.Never>;
|
|
32
|
+
readonly grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
|
|
33
|
+
readonly tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
|
|
34
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
35
|
+
}>, Schema.Struct<{
|
|
36
|
+
readonly grant: Schema.Literal<"client_credentials">;
|
|
37
|
+
readonly discover: Schema.String;
|
|
38
|
+
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
39
|
+
readonly tokenUrl: Schema.optionalKey<Schema.Never>;
|
|
40
|
+
readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
41
|
+
readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
42
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
43
|
+
}>, Schema.Struct<{
|
|
44
|
+
readonly grant: Schema.Literal<"client_credentials">;
|
|
45
|
+
readonly tokenUrl: Schema.String;
|
|
46
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
47
|
+
readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
48
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
49
|
+
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
50
|
+
readonly discover: Schema.optionalKey<Schema.Never>;
|
|
51
|
+
}>]>;
|
|
52
|
+
export type OAuth2Config = typeof OAuth2Config.Type;
|
|
53
|
+
/** Default app-visible OAuth projection. Refresh tokens and client secrets remain with the host. */
|
|
54
|
+
export declare const OAuth2AccessToken: Schema.Struct<{
|
|
55
|
+
readonly access_token: Schema.String;
|
|
56
|
+
}>;
|
|
57
|
+
declare const OAuth2Method_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Readonly<A> & {
|
|
58
|
+
readonly _tag: "oauth2";
|
|
59
|
+
} & import("effect/Pipeable").Pipeable;
|
|
60
|
+
/** OAuth declaration with an explicit schema for app-visible account fields. */
|
|
61
|
+
export declare class OAuth2Method<Response extends Schema.Decoder<unknown>> extends OAuth2Method_base<{
|
|
62
|
+
readonly config: OAuth2Config;
|
|
63
|
+
readonly response: Response;
|
|
64
|
+
}> {
|
|
65
|
+
}
|
|
66
|
+
/** Supported declarations; these acquire credentials rather than normalize them. */
|
|
67
|
+
export type AuthMethod = SecretsMethod<Schema.Decoder<unknown>> | OAuth2Method<Schema.Decoder<unknown>>;
|
|
68
|
+
/** Auth method names are chosen by the provider author. */
|
|
69
|
+
export type AuthMethods = Readonly<Record<string, AuthMethod>>;
|
|
70
|
+
/** A provider declaration. The future host derives its identity from normalized content. */
|
|
71
|
+
export declare class Provider<Auth extends AuthMethods> extends Data.Class<{
|
|
72
|
+
readonly name: string;
|
|
73
|
+
readonly auth: Auth;
|
|
74
|
+
}> {
|
|
75
|
+
/** Declare zero or more accounts from this provider without performing I/O. */
|
|
76
|
+
many(): ManyAccounts<Auth>;
|
|
77
|
+
}
|
|
78
|
+
declare const ManyAccounts_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Readonly<A> & {
|
|
79
|
+
readonly _tag: "many";
|
|
80
|
+
} & import("effect/Pipeable").Pipeable;
|
|
81
|
+
/** A collection requirement; selecting accounts does not copy or transfer them. */
|
|
82
|
+
export declare class ManyAccounts<Auth extends AuthMethods> extends ManyAccounts_base<{
|
|
83
|
+
readonly provider: Provider<Auth>;
|
|
84
|
+
}> {
|
|
85
|
+
}
|
|
86
|
+
/** Infer the data for one method from its native Effect decoder. */
|
|
87
|
+
export type AuthMethodData<Method> = Method extends SecretsMethod<infer Fields> ? Fields["Type"] : Method extends OAuth2Method<infer Response> ? Response["Type"] : never;
|
|
88
|
+
/** One selected account, discriminated by its author-chosen method name. */
|
|
89
|
+
export type AccountOf<P> = P extends Provider<infer Auth> ? {
|
|
90
|
+
readonly [Method in keyof Auth & string]: {
|
|
91
|
+
readonly id: AccountId;
|
|
92
|
+
readonly method: Method;
|
|
93
|
+
readonly fields: AuthMethodData<Auth[Method]>;
|
|
94
|
+
};
|
|
95
|
+
}[keyof Auth & string] : never;
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** Serializable schedules trigger existing mutations; they never introduce another execution path. */
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
/** Dispatch coalesces overdue ticks, so sub-minute intervals promise a cadence the runner cannot keep. */
|
|
4
|
+
export declare const minimumIntervalMilliseconds = 60000;
|
|
5
|
+
export declare const Interval: Schema.Union<readonly [Schema.Struct<{
|
|
6
|
+
readonly seconds: Schema.Int;
|
|
7
|
+
readonly minutes: Schema.optionalKey<Schema.Never>;
|
|
8
|
+
readonly hours: Schema.optionalKey<Schema.Never>;
|
|
9
|
+
}>, Schema.Struct<{
|
|
10
|
+
readonly seconds: Schema.optionalKey<Schema.Never>;
|
|
11
|
+
readonly minutes: Schema.Int;
|
|
12
|
+
readonly hours: Schema.optionalKey<Schema.Never>;
|
|
13
|
+
}>, Schema.Struct<{
|
|
14
|
+
readonly seconds: Schema.optionalKey<Schema.Never>;
|
|
15
|
+
readonly minutes: Schema.optionalKey<Schema.Never>;
|
|
16
|
+
readonly hours: Schema.Int;
|
|
17
|
+
}>]>;
|
|
18
|
+
export type Interval = typeof Interval.Type;
|
|
19
|
+
/** Calendar schedules use five cron fields and an explicit IANA time zone. */
|
|
20
|
+
export declare const CalendarSchedule: Schema.Struct<{
|
|
21
|
+
readonly expression: Schema.NonEmptyString;
|
|
22
|
+
readonly timezone: Schema.NonEmptyString;
|
|
23
|
+
}>;
|
|
24
|
+
/** Validated timing crosses all runtime and persistence boundaries as data. */
|
|
25
|
+
export declare const ScheduleTiming: Schema.Union<readonly [Schema.Struct<{
|
|
26
|
+
readonly kind: Schema.Literal<"interval">;
|
|
27
|
+
readonly milliseconds: Schema.Int;
|
|
28
|
+
}>, Schema.Struct<{
|
|
29
|
+
readonly kind: Schema.Literal<"cron">;
|
|
30
|
+
readonly calendar: Schema.Struct<{
|
|
31
|
+
readonly expression: Schema.NonEmptyString;
|
|
32
|
+
readonly timezone: Schema.NonEmptyString;
|
|
33
|
+
}>;
|
|
34
|
+
}>]>;
|
|
35
|
+
export type ScheduleTiming = typeof ScheduleTiming.Type;
|
|
36
|
+
/** A named trigger attached to the mutation it invokes, including schema-validated arguments. */
|
|
37
|
+
export declare const OperationSchedule: Schema.Struct<{
|
|
38
|
+
readonly name: Schema.NonEmptyString;
|
|
39
|
+
readonly timing: Schema.Union<readonly [Schema.Struct<{
|
|
40
|
+
readonly kind: Schema.Literal<"interval">;
|
|
41
|
+
readonly milliseconds: Schema.Int;
|
|
42
|
+
}>, Schema.Struct<{
|
|
43
|
+
readonly kind: Schema.Literal<"cron">;
|
|
44
|
+
readonly calendar: Schema.Struct<{
|
|
45
|
+
readonly expression: Schema.NonEmptyString;
|
|
46
|
+
readonly timezone: Schema.NonEmptyString;
|
|
47
|
+
}>;
|
|
48
|
+
}>]>;
|
|
49
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
50
|
+
}>;
|
|
51
|
+
export type OperationSchedule = typeof OperationSchedule.Type;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Runtime data schemas shared by the app framework. Author helpers live at the boundary. */
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
/** JSON values carried by remote protocols such as MCP. */
|
|
4
|
+
export declare const JsonValue: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
5
|
+
export type JsonValue = Schema.Json;
|
|
6
|
+
/** A JSON object, distinct from an authored value schema. */
|
|
7
|
+
export declare const JsonObject: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
8
|
+
export type JsonObject = typeof JsonObject.Type;
|
|
9
|
+
/** Stable saved account identity supplied by a host, unchanged across refreshes. */
|
|
10
|
+
export declare const AccountId: Schema.brand<Schema.String, "acc">;
|
|
11
|
+
/** Parsed saved account identity. */
|
|
12
|
+
export type AccountId = typeof AccountId.Type;
|
|
13
|
+
/** Absolute HTTP(S) URL; local HTTP hosts are supported. */
|
|
14
|
+
export declare const HttpUrl: Schema.String;
|
|
15
|
+
declare const ValidationError_base: Schema.Class<ValidationError, Schema.TaggedStruct<"ValidationError", {}>, import("effect/Cause").YieldableError>;
|
|
16
|
+
/** Invalid input. Never includes supplied values, credentials or response bodies. */
|
|
17
|
+
export declare class ValidationError extends ValidationError_base {
|
|
18
|
+
get message(): string;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** Native app data boundary. Hosts bind a configured app before exposing this capability. */
|
|
2
|
+
import { Schema, type Effect } from "effect";
|
|
3
|
+
import type { RowMetadata, ReadTable, WriteTable } from "../../../app-data/src/index.js";
|
|
4
|
+
import type { Fields, ObjectValue } from "../implementation/schema.js";
|
|
5
|
+
import type { DatabaseSchema, DatabaseSession, AppDatabaseError } from "../../../app-data/src/contracts/database.js";
|
|
6
|
+
/** Names for authored operations and tables. */
|
|
7
|
+
export declare const StorageName: Schema.NonEmptyString;
|
|
8
|
+
declare const AppStorageUnavailable_base: Schema.Class<AppStorageUnavailable, Schema.TaggedStruct<"AppStorageUnavailable", {}>, import("effect/Cause").YieldableError>;
|
|
9
|
+
/** Storage is not configured on this host. */
|
|
10
|
+
export declare class AppStorageUnavailable extends AppStorageUnavailable_base {
|
|
11
|
+
}
|
|
12
|
+
declare const AppStorageError_base: Schema.Class<AppStorageError, Schema.TaggedStruct<"AppStorageError", {}>, import("effect/Cause").YieldableError>;
|
|
13
|
+
/** App storage operations never expose SQL, documents or credentials in failures. */
|
|
14
|
+
export declare class AppStorageError extends AppStorageError_base {
|
|
15
|
+
}
|
|
16
|
+
/** The adapter owns the database connection and transaction for the whole authored invocation. */
|
|
17
|
+
export interface AppStorage {
|
|
18
|
+
readonly read: <A, E>(schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | AppDatabaseError | AppStorageUnavailable | AppStorageError>;
|
|
19
|
+
readonly mutate: <A, E>(schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | AppDatabaseError | AppStorageUnavailable | AppStorageError>;
|
|
20
|
+
}
|
|
21
|
+
type InputValue<F extends Fields> = {
|
|
22
|
+
readonly [K in keyof F as F[K]["optionalValue"] extends true ? never : F[K] extends {
|
|
23
|
+
readonly hasDefault: true;
|
|
24
|
+
} ? never : K]: Exclude<import("../implementation/schema.js").Infer<F[K]>, undefined>;
|
|
25
|
+
} & {
|
|
26
|
+
readonly [K in keyof F as F[K]["optionalValue"] extends true ? K : F[K] extends {
|
|
27
|
+
readonly hasDefault: true;
|
|
28
|
+
} ? K : never]?: Exclude<import("../implementation/schema.js").Infer<F[K]>, undefined> | (F[K]["optionalValue"] extends true ? null : F[K] extends {
|
|
29
|
+
readonly inputOptional: true;
|
|
30
|
+
} ? null : never) | undefined;
|
|
31
|
+
};
|
|
32
|
+
/** Typed table declaration; indexes refer only to authored or host metadata fields. */
|
|
33
|
+
export interface Table<F extends Fields, Index extends string = never> {
|
|
34
|
+
readonly fields: F;
|
|
35
|
+
readonly indexes: ReadonlyArray<{
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly fields: readonly string[];
|
|
38
|
+
}>;
|
|
39
|
+
readonly index: <Name extends string>(name: Name, fields: readonly [
|
|
40
|
+
(keyof F & string) | keyof typeof RowMetadata.Type,
|
|
41
|
+
...((keyof F & string) | keyof typeof RowMetadata.Type)[]
|
|
42
|
+
]) => Table<F, Index | Name>;
|
|
43
|
+
}
|
|
44
|
+
/** Structural table catalog accepted at the author boundary. */
|
|
45
|
+
export type Tables = Readonly<Record<string, {
|
|
46
|
+
readonly fields: Fields;
|
|
47
|
+
readonly indexes: ReadonlyArray<{
|
|
48
|
+
readonly name: string;
|
|
49
|
+
readonly fields: readonly string[];
|
|
50
|
+
}>;
|
|
51
|
+
}>>;
|
|
52
|
+
/** Generated row metadata is read-only and unavailable on inserts. */
|
|
53
|
+
export type RowOf<T extends Tables[string]> = ObjectValue<T["fields"]> & typeof RowMetadata.Type;
|
|
54
|
+
type IndexOf<T> = T extends Table<Fields, infer I> ? I : string;
|
|
55
|
+
/** Queries receive only read methods. */
|
|
56
|
+
export type DatabaseReader<T extends Tables> = {
|
|
57
|
+
readonly [K in keyof T]: ReadTable<RowOf<T[K]>, IndexOf<T[K]>>;
|
|
58
|
+
};
|
|
59
|
+
/** Mutation methods stay inside one native SQLite transaction. */
|
|
60
|
+
export type Database<T extends Tables> = {
|
|
61
|
+
readonly [K in keyof T]: WriteTable<RowOf<T[K]>, InputValue<T[K]["fields"]>, IndexOf<T[K]>>;
|
|
62
|
+
};
|
|
63
|
+
/** Pure database declaration shared by requirements and derived handler contexts. */
|
|
64
|
+
export interface DatabaseDefinition<T extends Tables = Tables> {
|
|
65
|
+
readonly schema: DatabaseSchema;
|
|
66
|
+
readonly tables: T;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Agent-facing metadata. Apps author queries and mutations. */
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
/** Advisory tool hints; neither the framework nor these declarations enforce access. */
|
|
4
|
+
export declare const ToolAnnotations: Schema.Struct<{
|
|
5
|
+
readonly title: Schema.optionalKey<Schema.String>;
|
|
6
|
+
readonly readOnlyHint: Schema.optionalKey<Schema.Boolean>;
|
|
7
|
+
readonly destructiveHint: Schema.optionalKey<Schema.Boolean>;
|
|
8
|
+
readonly idempotentHint: Schema.optionalKey<Schema.Boolean>;
|
|
9
|
+
readonly openWorldHint: Schema.optionalKey<Schema.Boolean>;
|
|
10
|
+
}>;
|
|
11
|
+
export type ToolAnnotations = typeof ToolAnnotations.Type;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Browser authentication protocol. Identity and session storage belong to the host. */
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { HttpApi, HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
4
|
+
import { UiFailed, UiForbidden, UiUnauthorized } from "./ui.js";
|
|
5
|
+
/** Opaque correlation ID; possession alone does not authorize an app session. */
|
|
6
|
+
export declare const AppSignInId: Schema.brand<Schema.String, "AppSignInId">;
|
|
7
|
+
export type AppSignInId = typeof AppSignInId.Type;
|
|
8
|
+
/** Authentication proofs are redacted at the HTTP boundary. */
|
|
9
|
+
export declare const AppSignInCode: Schema.RedactedFromValue<Schema.String>;
|
|
10
|
+
/** A path on the current app origin, including its query and fragment; never a redirect to another host or host-owned route. */
|
|
11
|
+
export declare const AppReturnPath: Schema.brand<Schema.String, "AppReturnPath">;
|
|
12
|
+
export type AppReturnPath = typeof AppReturnPath.Type;
|
|
13
|
+
/** The trusted callback exchanges an authorization code bound to a browser attempt. */
|
|
14
|
+
export declare const AppSignInCallback: Schema.Struct<{
|
|
15
|
+
readonly request: Schema.brand<Schema.String, "AppSignInId">;
|
|
16
|
+
readonly code: Schema.RedactedFromValue<Schema.String>;
|
|
17
|
+
}>;
|
|
18
|
+
/** Host-owned endpoints on every app origin, independent of the product's login mechanism. */
|
|
19
|
+
export declare const AppSignInApi: HttpApi.HttpApi<"app-sign-in", HttpApiGroup.HttpApiGroup<"appSignIn", HttpApiEndpoint.HttpApiEndpoint<"start", "POST", "/_executor/auth/start", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
20
|
+
readonly returnTo: Schema.brand<Schema.String, "AppReturnPath">;
|
|
21
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
22
|
+
readonly url: Schema.String;
|
|
23
|
+
}>>, Schema.toCodecJson<typeof UiForbidden | typeof UiFailed>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"complete", "POST", "/_executor/auth/complete", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
24
|
+
readonly request: Schema.brand<Schema.String, "AppSignInId">;
|
|
25
|
+
readonly code: Schema.RedactedFromValue<Schema.String>;
|
|
26
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
27
|
+
readonly returnTo: Schema.brand<Schema.String, "AppReturnPath">;
|
|
28
|
+
}>>, Schema.toCodecJson<typeof UiUnauthorized | typeof UiForbidden | typeof UiFailed>, never, never>, false>>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/** Browser-to-host operations bind identity and authentication outside authored app code. */
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi";
|
|
4
|
+
/** Non-secret page context injected by the serving host. */
|
|
5
|
+
export declare const UiContext: Schema.Struct<{
|
|
6
|
+
readonly deployment: Schema.NonEmptyString;
|
|
7
|
+
readonly profile: Schema.optional<Schema.NonEmptyString>;
|
|
8
|
+
readonly expectedProfileRevision: Schema.optional<Schema.Int>;
|
|
9
|
+
}>;
|
|
10
|
+
/** Retained browser bytes. Hosts authorize access before reading or rendering them. */
|
|
11
|
+
export interface AppUiAsset {
|
|
12
|
+
readonly body: Uint8Array;
|
|
13
|
+
readonly contentType: string;
|
|
14
|
+
}
|
|
15
|
+
/** Requests name an operation on this app and the page's deployment, never another app or account. */
|
|
16
|
+
export declare const UiOperation: Schema.Struct<{
|
|
17
|
+
readonly name: Schema.NonEmptyString;
|
|
18
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
19
|
+
readonly deployment: Schema.NonEmptyString;
|
|
20
|
+
readonly profile: Schema.optional<Schema.NonEmptyString>;
|
|
21
|
+
readonly expectedProfileRevision: Schema.optional<Schema.Int>;
|
|
22
|
+
}>;
|
|
23
|
+
declare const UiUnauthorized_base: Schema.Class<UiUnauthorized, Schema.TaggedStruct<"UiUnauthorized", {}>, import("effect/Cause").YieldableError>;
|
|
24
|
+
/** The app session is absent or its parent login was revoked. */
|
|
25
|
+
export declare class UiUnauthorized extends UiUnauthorized_base {
|
|
26
|
+
}
|
|
27
|
+
declare const UiForbidden_base: Schema.Class<UiForbidden, Schema.TaggedStruct<"UiForbidden", {}>, import("effect/Cause").YieldableError>;
|
|
28
|
+
/** The request did not originate from the configured app. */
|
|
29
|
+
export declare class UiForbidden extends UiForbidden_base {
|
|
30
|
+
}
|
|
31
|
+
declare const UiDeploymentChanged_base: Schema.Class<UiDeploymentChanged, Schema.TaggedStruct<"UiDeploymentChanged", {}>, import("effect/Cause").YieldableError>;
|
|
32
|
+
/** The page should reload before starting another operation. */
|
|
33
|
+
export declare class UiDeploymentChanged extends UiDeploymentChanged_base {
|
|
34
|
+
}
|
|
35
|
+
declare const UiFailed_base: Schema.Class<UiFailed, Schema.TaggedStruct<"UiFailed", {
|
|
36
|
+
readonly reason: Schema.Literals<readonly ["unavailable", "operation_failed", "account_required"]>;
|
|
37
|
+
}>, import("effect/Cause").YieldableError>;
|
|
38
|
+
/** Safe app failure without account fields, author exceptions or upstream responses. */
|
|
39
|
+
export declare class UiFailed extends UiFailed_base {
|
|
40
|
+
}
|
|
41
|
+
/** Every live stream carries heartbeats so the browser can detect a lost connection. */
|
|
42
|
+
export declare const UiSnapshot: Schema.Union<readonly [Schema.Struct<{
|
|
43
|
+
readonly type: Schema.Literal<"snapshot">;
|
|
44
|
+
readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
45
|
+
readonly trace: Schema.optional<Schema.Unknown>;
|
|
46
|
+
}>, Schema.Struct<{
|
|
47
|
+
readonly type: Schema.Literal<"failure">;
|
|
48
|
+
readonly error: typeof UiFailed;
|
|
49
|
+
}>, Schema.Struct<{
|
|
50
|
+
readonly type: Schema.Literal<"heartbeat">;
|
|
51
|
+
}>]>;
|
|
52
|
+
/** Portable serving contract; the host authenticates and resolves the configured app. */
|
|
53
|
+
export declare const AppUiApi: HttpApi.HttpApi<"app-ui", HttpApiGroup.HttpApiGroup<"ui", HttpApiEndpoint.HttpApiEndpoint<"query", "POST", "/_executor/api/query", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
54
|
+
readonly name: Schema.NonEmptyString;
|
|
55
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
56
|
+
readonly deployment: Schema.NonEmptyString;
|
|
57
|
+
readonly profile: Schema.optional<Schema.NonEmptyString>;
|
|
58
|
+
readonly expectedProfileRevision: Schema.optional<Schema.Int>;
|
|
59
|
+
}>>, never, Schema.toCodecJson<Schema.Codec<Schema.Json, Schema.Json, never, never>>, Schema.toCodecJson<typeof UiUnauthorized | typeof UiForbidden | typeof UiDeploymentChanged | typeof UiFailed>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"mutate", "POST", "/_executor/api/mutate", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
60
|
+
readonly name: Schema.NonEmptyString;
|
|
61
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
62
|
+
readonly deployment: Schema.NonEmptyString;
|
|
63
|
+
readonly profile: Schema.optional<Schema.NonEmptyString>;
|
|
64
|
+
readonly expectedProfileRevision: Schema.optional<Schema.Int>;
|
|
65
|
+
}>>, never, Schema.toCodecJson<Schema.Codec<Schema.Json, Schema.Json, never, never>>, Schema.toCodecJson<typeof UiUnauthorized | typeof UiForbidden | typeof UiDeploymentChanged | typeof UiFailed>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"subscribe", "POST", "/_executor/api/subscribe", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
66
|
+
readonly name: Schema.NonEmptyString;
|
|
67
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
68
|
+
readonly deployment: Schema.NonEmptyString;
|
|
69
|
+
readonly profile: Schema.optional<Schema.NonEmptyString>;
|
|
70
|
+
readonly expectedProfileRevision: Schema.optional<Schema.Int>;
|
|
71
|
+
}>>, never, HttpApiSchema.StreamSse<HttpApiSchema.SseEventFromData<Schema.Union<readonly [Schema.Struct<{
|
|
72
|
+
readonly type: Schema.Literal<"snapshot">;
|
|
73
|
+
readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
74
|
+
readonly trace: Schema.optional<Schema.Unknown>;
|
|
75
|
+
}>, Schema.Struct<{
|
|
76
|
+
readonly type: Schema.Literal<"failure">;
|
|
77
|
+
readonly error: typeof UiFailed;
|
|
78
|
+
}>, Schema.Struct<{
|
|
79
|
+
readonly type: Schema.Literal<"heartbeat">;
|
|
80
|
+
}>]>>, Schema.Union<readonly [typeof UiUnauthorized, typeof UiForbidden, typeof UiDeploymentChanged, typeof UiFailed]>, {
|
|
81
|
+
readonly value: Schema.Json;
|
|
82
|
+
readonly type: "snapshot";
|
|
83
|
+
readonly trace?: unknown;
|
|
84
|
+
} | {
|
|
85
|
+
readonly type: "failure";
|
|
86
|
+
readonly error: UiFailed;
|
|
87
|
+
} | {
|
|
88
|
+
readonly type: "heartbeat";
|
|
89
|
+
}>, Schema.toCodecJson<typeof UiUnauthorized | typeof UiForbidden | typeof UiDeploymentChanged | typeof UiFailed>, never, never>, false>>;
|
|
90
|
+
export {};
|