apps 0.0.1-beta.7 → 0.0.1-beta.70
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 +25 -22
- package/framework-reference.json +1 -1
- package/js/{chunk-UESPOTUI.js → chunk-2YSTJMBD.js} +899 -190
- package/js/{chunk-RJDDBDSN.js → chunk-3CVQ3VPP.js} +762 -171
- package/js/chunk-3R3KFCDU.js +426 -0
- package/js/{chunk-FL2QR3XW.js → chunk-4NCIPADO.js} +326 -69
- package/js/chunk-5FHWNLCI.js +88 -0
- package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
- package/js/chunk-7LMU3ER3.js +274 -0
- package/js/chunk-CDXQDN7W.js +92 -0
- package/js/{chunk-RFVIONFX.js → chunk-ECCWT5GJ.js} +79 -41
- package/js/{chunk-UK573G7W.js → chunk-EOPQ727L.js} +87 -51
- package/js/{chunk-27F7W2LG.js → chunk-H2CJWXA3.js} +2 -2
- package/js/{chunk-JU7VHODU.js → chunk-H72MEDMN.js} +65 -10
- package/js/{chunk-CDL5PM2Q.js → chunk-IFJU5SYQ.js} +19082 -18402
- package/js/{chunk-VFZKSM3T.js → chunk-JPEUKEV4.js} +3 -3
- package/js/{chunk-WLE7WX2U.js → chunk-JW5LYSER.js} +2262 -474
- package/js/{chunk-5T57N25Q.js → chunk-KGCTYL2S.js} +511 -63
- package/js/{chunk-KUMBKVJD.js → chunk-KLYSEHUD.js} +2 -2
- package/js/chunk-M5OLYYNU.js +347 -0
- package/js/chunk-MHB7IFG7.js +49 -0
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
- package/js/{chunk-NKLWZJLE.js → chunk-RUP4JMKO.js} +25 -14
- package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
- package/js/{chunk-72JNVHPK.js → chunk-WDIVWSDG.js} +4 -3
- package/js/{chunk-CMYUWAX7.js → chunk-WGQP62EG.js} +126 -31
- package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
- package/js/{chunk-Z5M2LQOZ.js → chunk-ZEJ3IKEC.js} +67 -55
- package/js/chunk-ZR7QAG67.js +171 -0
- package/js/client.js +142 -94
- package/js/contracts.js +125 -26
- package/js/effect.js +19 -19
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +50 -40
- package/js/host.js +83 -58
- package/js/index.js +131 -46
- package/js/mcp/effect.js +23 -21
- package/js/mcp/stdio.js +44 -34
- package/js/mcp.js +76 -53
- package/js/openapi.js +4063 -1359
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +208 -81
- package/js/storage/facet.js +1 -540
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +5 -4
- package/js/ui/serving.js +8517 -214
- package/package.json +3 -4
- package/runtime.json +1 -1
- package/types/app-cache/src/contracts/cache.d.ts +2 -0
- package/types/app-cache/src/index.d.ts +10 -1
- package/types/apps/src/contracts/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/app.d.ts +7 -3
- package/types/apps/src/contracts/cache.d.ts +20 -0
- package/types/apps/src/contracts/context.d.ts +19 -11
- package/types/apps/src/contracts/elicitation.d.ts +6 -6
- package/types/apps/src/contracts/events.d.ts +93 -0
- package/types/apps/src/contracts/failure.d.ts +30 -1
- package/types/apps/src/contracts/graphql.d.ts +2 -1
- package/types/apps/src/contracts/host.d.ts +641 -16
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +80 -10
- package/types/apps/src/contracts/network.d.ts +120 -0
- package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
- package/types/apps/src/contracts/openapi.d.ts +41 -9
- package/types/apps/src/contracts/operations.d.ts +8 -4
- package/types/apps/src/contracts/placement.d.ts +102 -0
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +733 -81
- package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
- package/types/apps/src/contracts/protocols/2.d.ts +69 -26
- package/types/apps/src/contracts/protocols/3.d.ts +133 -33
- package/types/apps/src/contracts/protocols/4.d.ts +122 -45
- package/types/apps/src/contracts/protocols/5.d.ts +157 -47
- package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
- package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
- package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
- package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
- package/types/apps/src/contracts/protocols/current.d.ts +3842 -0
- package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
- package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
- package/types/apps/src/contracts/provider-error.d.ts +9 -0
- package/types/apps/src/contracts/provider.d.ts +90 -6
- package/types/apps/src/contracts/skills.d.ts +50 -13
- package/types/apps/src/contracts/sql.d.ts +63 -0
- package/types/apps/src/contracts/ui.d.ts +19 -1
- package/types/apps/src/contracts/workflows.d.ts +6 -0
- package/types/apps/src/facet.d.ts +4 -5
- package/types/apps/src/host.d.ts +5 -0
- package/types/apps/src/implementation/account-router.d.ts +4 -3
- package/types/apps/src/implementation/authoring.d.ts +25 -5
- package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
- package/types/apps/src/implementation/cache.d.ts +4 -0
- package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
- package/types/apps/src/implementation/elicitation.d.ts +18 -15
- package/types/apps/src/implementation/events.d.ts +59 -0
- package/types/apps/src/implementation/failure-detail.d.ts +25 -3
- package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
- package/types/apps/src/implementation/graphql.d.ts +4 -3
- package/types/apps/src/implementation/input-problems.d.ts +6 -2
- package/types/apps/src/implementation/invocation-timing.d.ts +16 -0
- package/types/apps/src/implementation/live.d.ts +2 -2
- package/types/apps/src/implementation/mcp-call.d.ts +6 -5
- package/types/apps/src/implementation/mcp-catalog.d.ts +6 -4
- package/types/apps/src/implementation/mcp-client.d.ts +17 -9
- package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
- package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
- package/types/apps/src/implementation/mcp.d.ts +20 -9
- package/types/apps/src/implementation/network.d.ts +16 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +26 -6
- package/types/apps/src/implementation/openapi-document.d.ts +46 -19
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-request.d.ts +10 -2
- package/types/apps/src/implementation/openapi-source.d.ts +18 -0
- package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
- package/types/apps/src/implementation/operations.d.ts +17 -2
- package/types/apps/src/implementation/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/placement.d.ts +60 -0
- package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
- package/types/apps/src/implementation/provider-error.d.ts +28 -1
- package/types/apps/src/implementation/provider.d.ts +18 -3
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +11 -13
- package/types/apps/src/implementation/router.d.ts +16 -5
- package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
- package/types/apps/src/implementation/schema.d.ts +90 -10
- package/types/apps/src/implementation/skills.d.ts +18 -24
- package/types/apps/src/implementation/sql.d.ts +71 -0
- package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
- package/types/apps/src/implementation/ui-auth.d.ts +1 -1
- package/types/apps/src/implementation/ui-client.d.ts +2 -2
- package/types/apps/src/implementation/ui-document.d.ts +5 -0
- package/types/apps/src/implementation/ui-errors.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +11 -5
- package/types/apps/src/implementation/ui-watch.d.ts +1 -1
- package/types/apps/src/implementation/upstream-error.d.ts +7 -0
- package/types/apps/src/implementation/webhooks.d.ts +1 -1
- package/types/apps/src/implementation/workflows.d.ts +1 -1
- package/types/apps/src/index.d.ts +55 -13
- package/types/apps/src/mcp.d.ts +20 -1
- package/types/apps/src/openapi.d.ts +1 -1
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +10 -8
- package/types/telemetry/src/app-records.d.ts +42 -0
- package/types/telemetry/src/browser-operations.d.ts +7 -4
- package/types/telemetry/src/browser.d.ts +8 -3
- package/types/telemetry/src/config.d.ts +2 -2
- package/types/telemetry/src/index.d.ts +2 -1
- package/types/telemetry/src/layer.d.ts +2 -2
- package/types/telemetry/src/measurements.d.ts +1 -1
- package/types/telemetry/src/ownership.d.ts +56 -0
- package/types/telemetry/src/recorded-failure.d.ts +29 -0
- package/types/telemetry/src/relay.d.ts +16 -6
- package/types/telemetry/src/span-attributes.d.ts +17 -1
- package/types/telemetry/src/transport.d.ts +8 -1
- package/types/utils/src/api-error.d.ts +55 -0
- package/types/utils/src/connection-failure.d.ts +33 -0
- package/types/utils/src/recorded-message.d.ts +18 -0
- package/types/utils/src/user-facing-error.d.ts +83 -0
- package/js/chunk-MKWZPDR6.js +0 -63
- package/js/chunk-N7YDVXYJ.js +0 -186
- package/js/chunk-OCYUEU47.js +0 -224
- package/js/chunk-PJJ24GU7.js +0 -877
- package/js/chunk-PZB6T6KU.js +0 -19
- package/js/chunk-R3EV5FTO.js +0 -97
- package/js/chunk-YXQHV65J.js +0 -242
- package/js/chunk-ZQINWV4W.js +0 -630
- package/types/app-data/src/implementation/cursor.d.ts +0 -10
- package/types/app-data/src/implementation/index-key.d.ts +0 -7
- package/types/app-data/src/implementation/promise.d.ts +0 -68
- package/types/app-data/src/implementation/range.d.ts +0 -8
- package/types/app-data/src/implementation/schema.d.ts +0 -18
- package/types/app-data/src/implementation/sqlite.d.ts +0 -11
- package/types/app-data/src/index.d.ts +0 -4
- package/types/apps/src/contracts/storage.d.ts +0 -68
- package/types/apps/src/implementation/storage.d.ts +0 -15
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { Schema, type Effect } from "effect";
|
|
3
3
|
declare const CacheError_base: Schema.Class<CacheError, Schema.TaggedStruct<"CacheError", {
|
|
4
4
|
readonly reason: Schema.Literals<readonly ["unavailable", "storage", "invalid", "capacity", "timeout"]>;
|
|
5
|
+
/** Which of `cacheLimits` the request exceeded, when one did. */
|
|
6
|
+
readonly limit: Schema.optionalKey<Schema.Literals<readonly ["keyBytes", "entryBytes", "batchBytes", "batchEntries", "totalBytes", "totalEntries"]>>;
|
|
5
7
|
}>, import("effect/Cause").YieldableError>;
|
|
6
8
|
/** Expected cache failures never include keys, values or upstream exception text. */
|
|
7
9
|
export declare class CacheError extends CacheError_base {
|
|
@@ -10,6 +10,12 @@ export interface CacheGet<A> {
|
|
|
10
10
|
readonly schema: Schema.Decoder<A>;
|
|
11
11
|
readonly freshFor: Duration.Input;
|
|
12
12
|
readonly staleFor?: Duration.Input;
|
|
13
|
+
/**
|
|
14
|
+
* What a read does with a value past `freshFor` and within `staleFor`. `serve`, the default,
|
|
15
|
+
* returns it while one background load replaces it. `revalidate` awaits that load first, like a
|
|
16
|
+
* miss; the value stays readable to the load, which can confirm it instead of rebuilding it.
|
|
17
|
+
*/
|
|
18
|
+
readonly stale?: "serve" | "revalidate";
|
|
13
19
|
readonly load: Effect.Effect<A, unknown>;
|
|
14
20
|
}
|
|
15
21
|
/** Create a scoped cache client; a background runner must retain all task resources until completion. */
|
|
@@ -30,7 +36,10 @@ deadline?: number) => {
|
|
|
30
36
|
}[], retention: Duration.Input) => Effect.Effect<void, CacheError, never>;
|
|
31
37
|
/** Revoke retained data and any loader's right to publish its in-flight result. */
|
|
32
38
|
invalidate: (key: Schema.Json) => Effect.Effect<void, CacheError, never>;
|
|
33
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Read fresh data, refresh stale data in the background (or first, with `stale: "revalidate"`),
|
|
41
|
+
* or wait for the lease owner.
|
|
42
|
+
*/
|
|
34
43
|
get: <A>(options: CacheGet<A>) => Effect.Effect<A, unknown, never>;
|
|
35
44
|
/** Force one awaited refresh without removing the retained value. Concurrent refreshes share a load. */
|
|
36
45
|
revalidate: <A>(options: CacheGet<A>) => Effect.Effect<A, unknown, never>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
+
/** Longest agent guidance an API error's recovery carries. */
|
|
3
|
+
export declare const maxApiErrorInstructionsLength = 4096;
|
|
2
4
|
/** Bounded recovery a declared API error published for its caller: a short next step and agent guidance. */
|
|
3
5
|
export declare const ApiErrorRecovery: Schema.Struct<{
|
|
4
6
|
readonly action: Schema.NonEmptyString;
|
|
@@ -6,6 +8,8 @@ export declare const ApiErrorRecovery: Schema.Struct<{
|
|
|
6
8
|
}>;
|
|
7
9
|
/** Recovery copied from an error response body; extra keys are dropped on decode. */
|
|
8
10
|
export type ApiErrorRecovery = typeof ApiErrorRecovery.Type;
|
|
11
|
+
/** Longest message an API error response carries. */
|
|
12
|
+
export declare const maxApiErrorMessageLength = 4096;
|
|
9
13
|
/** Bounded public fields from a response matching its declared API error schema. */
|
|
10
14
|
export declare const ApiErrorResponse: Schema.Struct<{
|
|
11
15
|
readonly code: Schema.NonEmptyString;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { AppSkillSource, SkillFile } from "./skills.js";
|
|
2
|
-
import type { DatabaseDefinition } from "./storage.js";
|
|
3
2
|
/** Native app contracts; factories and handlers compose in the host's Effect runtime. */
|
|
4
3
|
import { type Effect, Schema } from "effect";
|
|
5
4
|
import type { OperationSchedule } from "./schedules.js";
|
|
@@ -43,7 +42,11 @@ export interface BoundContext<Slots extends AccountSlots> {
|
|
|
43
42
|
readonly workflows: WorkflowReads;
|
|
44
43
|
/** Ask for user input during this tool call. Unavailable during discovery and after the invocation closes. */
|
|
45
44
|
readonly elicit: Elicit;
|
|
46
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Invocation-owned HTTP requests with trace propagation and host cancellation. It lasts until the
|
|
47
|
+
* invocation and every app cache refresh it started in the background have ended, so a catalog
|
|
48
|
+
* loader given this fetch can refresh after the reply.
|
|
49
|
+
*/
|
|
47
50
|
readonly fetch: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
48
51
|
/** Host cancellation for this invocation. Pass it to fetch and other interruptible APIs. */
|
|
49
52
|
readonly signal: AbortSignal;
|
|
@@ -54,7 +57,8 @@ export interface BoundContext<Slots extends AccountSlots> {
|
|
|
54
57
|
/** The host evaluates this factory fresh with the configured app's selected accounts. */
|
|
55
58
|
export interface App<Slots extends AccountSlots, Def extends AppDefinition<never>> {
|
|
56
59
|
readonly accounts: Slots;
|
|
57
|
-
|
|
60
|
+
/** Declared beside the accounts, so a host lists them without evaluating the app. */
|
|
61
|
+
readonly events?: Readonly<Record<string, import("./events.js").AppEvent>>;
|
|
58
62
|
readonly evaluate: (context: BoundContext<Slots>) => Effect.Effect<Def, unknown>;
|
|
59
63
|
}
|
|
60
64
|
declare const NotImplemented_base: Schema.Class<NotImplemented, Schema.TaggedStruct<"NotImplemented", {
|
|
@@ -15,6 +15,12 @@ export interface CacheGetOptions<A> {
|
|
|
15
15
|
readonly schema: Schema<A, boolean>;
|
|
16
16
|
readonly freshFor: Duration.Input;
|
|
17
17
|
readonly staleFor?: Duration.Input;
|
|
18
|
+
/**
|
|
19
|
+
* Past `freshFor`, `serve` (the default) returns the kept value while `load` replaces it in the
|
|
20
|
+
* background. `revalidate` awaits `load` first; the kept value stays readable with `read`, so
|
|
21
|
+
* the loader can confirm it with the source instead of rebuilding it.
|
|
22
|
+
*/
|
|
23
|
+
readonly stale?: "serve" | "revalidate";
|
|
18
24
|
readonly load: (context: CacheLoadContext) => Promise<A>;
|
|
19
25
|
}
|
|
20
26
|
/** Cache keys describe every input that affects the value; the host adds app/build isolation. */
|
|
@@ -37,6 +43,20 @@ export interface AppCache {
|
|
|
37
43
|
readonly id: string;
|
|
38
44
|
}) => AppCache;
|
|
39
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* A credential a remote read sends, and the account it belongs to. A public source takes neither.
|
|
48
|
+
* A credential comes only with its account, so the read is cached in that account's scope.
|
|
49
|
+
*/
|
|
50
|
+
export type AccountCredential<Credential extends object> = ({
|
|
51
|
+
readonly account?: undefined;
|
|
52
|
+
} & {
|
|
53
|
+
readonly [Field in keyof Credential]?: undefined;
|
|
54
|
+
}) | ({
|
|
55
|
+
/** The selected account, as `accounts.<slot>` provides it. */
|
|
56
|
+
readonly account: {
|
|
57
|
+
readonly id: string;
|
|
58
|
+
};
|
|
59
|
+
} & Credential);
|
|
40
60
|
/** Trusted storage and background ownership; never accepted from request JSON. */
|
|
41
61
|
export interface HostCache {
|
|
42
62
|
readonly transport: CacheTransport;
|
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
/** Public handler contexts derive capabilities from one shared requirements declaration. */
|
|
2
2
|
import type { WorkflowControls } from "./workflows.js";
|
|
3
3
|
import type { AccountSlots, BoundContext } from "./app.js";
|
|
4
|
-
import type {
|
|
5
|
-
|
|
4
|
+
import type { Sql, SqlReader } from "./sql.js";
|
|
5
|
+
import type { AnyEventDeclaration, EventEmitter } from "../implementation/events.js";
|
|
6
|
+
/** Requirements are pure values; selected accounts and SQL access belong to invocations. */
|
|
6
7
|
export interface AppRequirements {
|
|
7
8
|
readonly accounts: AccountSlots;
|
|
8
|
-
|
|
9
|
+
/** Events this app emits, by name, such as `issue.opened`. */
|
|
10
|
+
readonly events?: Readonly<Record<string, AnyEventDeclaration>>;
|
|
9
11
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/** The emitter for an app's declared events. */
|
|
13
|
+
type EventsContext<Requirements extends AppRequirements> = {
|
|
14
|
+
readonly events: EventEmitter<NonNullable<Requirements["events"]>>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Every handler has `ctx.sql`. The app's database exists once the build has SQL files in
|
|
18
|
+
* `migrations/`; before that, any statement fails and says so.
|
|
19
|
+
*/
|
|
20
|
+
type StorageContext<Writable extends boolean> = {
|
|
21
|
+
readonly sql: Writable extends true ? Sql : SqlReader;
|
|
22
|
+
};
|
|
15
23
|
/** Context available during dynamic app evaluation; storage opens only for handlers. */
|
|
16
24
|
export type AppContext<Requirements extends AppRequirements = AppRequirements> = BoundContext<Requirements["accounts"]>;
|
|
17
25
|
/** Interactive query context; declared storage exposes only read methods. */
|
|
18
|
-
export type QueryContext<Requirements extends AppRequirements = AppRequirements> = AppContext<Requirements> & StorageContext<
|
|
19
|
-
/** Interactive mutation context;
|
|
26
|
+
export type QueryContext<Requirements extends AppRequirements = AppRequirements> = AppContext<Requirements> & StorageContext<false>;
|
|
27
|
+
/** Interactive mutation context; outside calls happen between SQL transactions, never inside one. */
|
|
20
28
|
export type MutationContext<Requirements extends AppRequirements = AppRequirements> = Omit<AppContext<Requirements>, "workflows"> & {
|
|
21
29
|
readonly workflows: WorkflowControls;
|
|
22
|
-
} & StorageContext<Requirements
|
|
30
|
+
} & StorageContext<true> & EventsContext<Requirements>;
|
|
23
31
|
/** Background webhook context has account and storage access without interactive input. */
|
|
24
32
|
export type WebhookContext<Requirements extends AppRequirements = AppRequirements> = Omit<MutationContext<Requirements>, "elicit">;
|
|
25
33
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Shared MCP elicitation data. Delivery belongs to the host, independently of its transport. */
|
|
2
2
|
import { Schema, type Effect } from "effect";
|
|
3
|
-
import * as McpSchema from "effect/
|
|
3
|
+
import * as McpSchema from "effect/ai/McpSchema";
|
|
4
4
|
import { type JsonValue } from "./schema.js";
|
|
5
5
|
/** Maximum human-input wait, separate from active provider execution time. */
|
|
6
6
|
export declare const ElicitationLimits: Schema.Struct<{
|
|
@@ -15,10 +15,10 @@ export declare const defaultElicitationLimits: {
|
|
|
15
15
|
export declare const FormElicitation: Schema.Struct<{
|
|
16
16
|
readonly mode: Schema.Literal<"form">;
|
|
17
17
|
readonly requestedSchema: Schema.toEncoded<Schema.Struct<{
|
|
18
|
-
readonly $schema: Schema.decodeTo<Schema.optional<Schema.String
|
|
18
|
+
readonly $schema: Schema.decodeTo<Schema.toType<Schema.optional<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
19
19
|
readonly type: Schema.tag<"object">;
|
|
20
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
|
|
21
|
+
readonly required: Schema.decodeTo<Schema.toType<Schema.optional<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
|
|
22
22
|
}>>;
|
|
23
23
|
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
24
24
|
readonly message: Schema.String;
|
|
@@ -28,7 +28,7 @@ export type FormElicitation = typeof FormElicitation.Type;
|
|
|
28
28
|
export declare const ElicitationResponse: Schema.Union<readonly [Schema.Struct<{
|
|
29
29
|
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
30
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>]
|
|
31
|
+
readonly content: Schema.decodeTo<Schema.toType<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
32
|
}>, Schema.Struct<{
|
|
33
33
|
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
34
34
|
readonly action: Schema.Literals<readonly ["cancel", "decline"]>;
|
|
@@ -50,7 +50,7 @@ export declare const ElicitationReply: Schema.Union<readonly [Schema.Struct<{
|
|
|
50
50
|
readonly response: Schema.Union<readonly [Schema.Struct<{
|
|
51
51
|
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
52
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>]
|
|
53
|
+
readonly content: Schema.decodeTo<Schema.toType<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
54
|
}>, Schema.Struct<{
|
|
55
55
|
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
56
56
|
readonly action: Schema.Literals<readonly ["cancel", "decline"]>;
|
|
@@ -75,7 +75,7 @@ export type ApprovalElicitation = typeof ApprovalElicitation.Type;
|
|
|
75
75
|
export declare const ApprovalResponse: Schema.Union<readonly [Schema.Struct<{
|
|
76
76
|
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
77
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>]
|
|
78
|
+
readonly content: Schema.decodeTo<Schema.toType<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
79
|
}>, Schema.Struct<{
|
|
80
80
|
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
81
81
|
readonly action: Schema.Literals<readonly ["cancel", "decline"]>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App events. An app declares the events it emits beside its account requirements, so a host
|
|
3
|
+
* reads them without evaluating the app. Handlers emit occurrences; the host keeps them only
|
|
4
|
+
* when the invocation that emitted them succeeds, then delivers them to its subscribers.
|
|
5
|
+
*/
|
|
6
|
+
import { Schema } from "effect";
|
|
7
|
+
/** Dotted lower-case words, such as `issue.opened`. Hosts prefix them with the app's slug. */
|
|
8
|
+
export declare const EventName: Schema.String;
|
|
9
|
+
export type EventName = typeof EventName.Type;
|
|
10
|
+
/** A filter value: subscribers match an occurrence by equal scalars. */
|
|
11
|
+
export declare const EventFilterValue: Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>;
|
|
12
|
+
export type EventFilterValue = typeof EventFilterValue.Type;
|
|
13
|
+
/** Size and count limits for events; bytes are UTF-8 bytes of the JSON text. */
|
|
14
|
+
export declare const EventLimits: Schema.Struct<{
|
|
15
|
+
/** An occurrence's `data`, leaving room under a 256 KiB delivery for its envelope. */
|
|
16
|
+
readonly maxDataBytes: Schema.Int;
|
|
17
|
+
readonly maxEventsPerInvocation: Schema.Int;
|
|
18
|
+
readonly maxDescriptionLength: Schema.Int;
|
|
19
|
+
readonly maxIdLength: Schema.Int;
|
|
20
|
+
}>;
|
|
21
|
+
export type EventLimits = typeof EventLimits.Type;
|
|
22
|
+
export declare const defaultEventLimits: {
|
|
23
|
+
readonly maxDataBytes: number;
|
|
24
|
+
readonly maxEventsPerInvocation: number;
|
|
25
|
+
readonly maxDescriptionLength: number;
|
|
26
|
+
readonly maxIdLength: number;
|
|
27
|
+
};
|
|
28
|
+
/** One event as the host reads it from an app's requirements. Both schemas are JSON Schema. */
|
|
29
|
+
export declare const DeclaredEvent: Schema.Struct<{
|
|
30
|
+
readonly description: Schema.String;
|
|
31
|
+
/** An object of scalar fields. Subscribers may name any of them to narrow an event. */
|
|
32
|
+
readonly filters: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
33
|
+
/** The shape of each occurrence's `data`. */
|
|
34
|
+
readonly payload: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
35
|
+
}>;
|
|
36
|
+
export type DeclaredEvent = typeof DeclaredEvent.Type;
|
|
37
|
+
/** An app's declared events, by name. */
|
|
38
|
+
export declare const DeclaredEvents: Schema.$Record<Schema.String, Schema.Struct<{
|
|
39
|
+
readonly description: Schema.String;
|
|
40
|
+
/** An object of scalar fields. Subscribers may name any of them to narrow an event. */
|
|
41
|
+
readonly filters: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
42
|
+
/** The shape of each occurrence's `data`. */
|
|
43
|
+
readonly payload: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
44
|
+
}>>;
|
|
45
|
+
export type DeclaredEvents = typeof DeclaredEvents.Type;
|
|
46
|
+
/**
|
|
47
|
+
* One occurrence an invocation emitted. `id` is the stable identifier subscribers deduplicate on,
|
|
48
|
+
* such as the provider's delivery ID. `account` is the account the event came from, or null for
|
|
49
|
+
* an app without accounts.
|
|
50
|
+
*/
|
|
51
|
+
export declare const EmittedEvent: Schema.Struct<{
|
|
52
|
+
readonly name: Schema.String;
|
|
53
|
+
readonly id: Schema.String;
|
|
54
|
+
/** Milliseconds since the epoch when the event happened. */
|
|
55
|
+
readonly occurredAt: Schema.Int;
|
|
56
|
+
readonly data: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
57
|
+
readonly filters: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>;
|
|
58
|
+
readonly account: Schema.NullOr<Schema.brand<Schema.String, "acc">>;
|
|
59
|
+
}>;
|
|
60
|
+
export type EmittedEvent = typeof EmittedEvent.Type;
|
|
61
|
+
/** What a successful invocation emitted, in order. */
|
|
62
|
+
export declare const EmittedEvents: Schema.$Array<Schema.Struct<{
|
|
63
|
+
readonly name: Schema.String;
|
|
64
|
+
readonly id: Schema.String;
|
|
65
|
+
/** Milliseconds since the epoch when the event happened. */
|
|
66
|
+
readonly occurredAt: Schema.Int;
|
|
67
|
+
readonly data: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
68
|
+
readonly filters: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>;
|
|
69
|
+
readonly account: Schema.NullOr<Schema.brand<Schema.String, "acc">>;
|
|
70
|
+
}>>;
|
|
71
|
+
/** Native event declaration. Filters are named scalar fields; the payload is any JSON schema. */
|
|
72
|
+
export interface AppEvent {
|
|
73
|
+
readonly description: string;
|
|
74
|
+
readonly filters: Readonly<Record<string, Schema.Decoder<unknown>>>;
|
|
75
|
+
readonly payload: Schema.Decoder<unknown>;
|
|
76
|
+
}
|
|
77
|
+
/** Options for one emitted occurrence. */
|
|
78
|
+
export interface EmitOptions<Filters> {
|
|
79
|
+
/** Values subscribers filter on. Required when the event declares filters. */
|
|
80
|
+
readonly filters?: Filters;
|
|
81
|
+
/**
|
|
82
|
+
* A stable identifier, such as the provider's delivery or record ID, so a repeated delivery of
|
|
83
|
+
* the same upstream event is not delivered twice. Defaults to a random ID.
|
|
84
|
+
*/
|
|
85
|
+
readonly id?: string | undefined;
|
|
86
|
+
/** When the event happened. Defaults to now. */
|
|
87
|
+
readonly occurredAt?: Date | number | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* The ID of the account the event came from. A webhook handler defaults to its source account,
|
|
90
|
+
* and an invocation with exactly one account to that account. Name it when there are several.
|
|
91
|
+
*/
|
|
92
|
+
readonly account?: string | undefined;
|
|
93
|
+
}
|
|
@@ -9,10 +9,24 @@ export declare const maxFailureMessageLength = 2048;
|
|
|
9
9
|
export declare const FailureSource: Schema.Literals<readonly ["app", "storage", "service"]>;
|
|
10
10
|
/** The thrown error's name, such as `TypeError`, or the host error's tag. */
|
|
11
11
|
export declare const FailureName: Schema.String;
|
|
12
|
-
/** A stable host failure code, such as an app data reason
|
|
12
|
+
/** A stable host failure code, such as an app data reason, or the thrown error's own `code`. */
|
|
13
13
|
export declare const FailureCode: Schema.String;
|
|
14
14
|
/** Bounded, with the invocation's account secrets replaced. */
|
|
15
15
|
export declare const FailureMessage: Schema.String;
|
|
16
|
+
/** Most fields of one thrown error carried across the runtime boundary. */
|
|
17
|
+
export declare const maxFailureFields = 8;
|
|
18
|
+
/** Longest text field value carried across the runtime boundary. */
|
|
19
|
+
export declare const maxFailureFieldLength = 256;
|
|
20
|
+
/** A field name as the error's code spells it, such as `reason` or `pointer`. */
|
|
21
|
+
export declare const FailureFieldName: Schema.String;
|
|
22
|
+
/** Bounded text with account secrets replaced, a finite number, or a boolean. */
|
|
23
|
+
export declare const FailureFieldValue: Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>;
|
|
24
|
+
/**
|
|
25
|
+
* The thrown error's own scalar fields beside its name, code and message, such as the `reason`
|
|
26
|
+
* and `pointer` a spec compiler sets. Nested values, stacks and causes are never carried.
|
|
27
|
+
*/
|
|
28
|
+
export declare const FailureFields: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>;
|
|
29
|
+
export type FailureFields = typeof FailureFields.Type;
|
|
16
30
|
/**
|
|
17
31
|
* The error an app's own code raised, or the specific host failure it hit. Stacks and cause
|
|
18
32
|
* values stay private. Builds from before these fields existed send none.
|
|
@@ -22,4 +36,19 @@ export declare const FailureDetail: {
|
|
|
22
36
|
errorName: Schema.optionalKey<Schema.String>;
|
|
23
37
|
code: Schema.optionalKey<Schema.String>;
|
|
24
38
|
message: Schema.optionalKey<Schema.String>;
|
|
39
|
+
fields: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>>;
|
|
25
40
|
};
|
|
41
|
+
/** Longest error message a service stated, as carried across the runtime boundary. */
|
|
42
|
+
export declare const maxUpstreamMessageLength = 1024;
|
|
43
|
+
/**
|
|
44
|
+
* The error a service stated in its own response: a JSON-RPC error's code and message, or an
|
|
45
|
+
* OAuth Bearer error code and description. Bounded, with the invocation's account secrets replaced.
|
|
46
|
+
*/
|
|
47
|
+
export declare const UpstreamError: Schema.Struct<{
|
|
48
|
+
readonly code: Schema.Union<readonly [Schema.Int, Schema.String]>;
|
|
49
|
+
readonly message: Schema.optionalKey<Schema.String>;
|
|
50
|
+
}>;
|
|
51
|
+
export type UpstreamError = typeof UpstreamError.Type;
|
|
52
|
+
/** Where a service failed: setting up a session, listing tools, or running one. */
|
|
53
|
+
export declare const FailurePhase: Schema.Literals<readonly ["connect", "discover", "call"]>;
|
|
54
|
+
export type FailurePhase = typeof FailurePhase.Type;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ProviderError } from "./provider-error.js";
|
|
2
|
+
import type { NetworkRefused } from "./network.js";
|
|
2
3
|
/** GraphQL discovery contracts. Catalogs are evaluated with the selected account. */
|
|
3
4
|
import { Schema, type Effect } from "effect";
|
|
4
5
|
import { type JsonValue } from "./schema.js";
|
|
@@ -97,7 +98,7 @@ export interface GraphqlTool {
|
|
|
97
98
|
readonly description: string;
|
|
98
99
|
readonly readOnly: boolean;
|
|
99
100
|
readonly input: Schema.Decoder<JsonValue>;
|
|
100
|
-
readonly run: (context: unknown, input: JsonValue) => Effect.Effect<JsonValue, GraphqlError | ProviderError>;
|
|
101
|
+
readonly run: (context: unknown, input: JsonValue) => Effect.Effect<JsonValue, GraphqlError | ProviderError | NetworkRefused>;
|
|
101
102
|
}
|
|
102
103
|
/** One tool per root field; subscriptions require a separate long-lived host. */
|
|
103
104
|
export type GraphqlTools = Readonly<Record<string, GraphqlTool>>;
|