apps 0.0.1-beta.4 → 0.0.1-beta.41
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 +68 -44
- package/framework-reference.json +1 -1
- package/js/{chunk-QKHR7BMF.js → chunk-3MMG2H6M.js} +89 -53
- package/js/{chunk-EQB7JMAL.js → chunk-6XGB4BAL.js} +146 -31
- package/js/chunk-ADD6H64X.js +729 -0
- package/js/{chunk-6VRYO2BG.js → chunk-AHGGO2VY.js} +837 -254
- package/js/{chunk-FDNTX5QJ.js → chunk-CQD3WSYH.js} +2 -2
- package/js/{chunk-EVJUVWN2.js → chunk-DKUEYTYD.js} +463 -218
- package/js/chunk-EM4UL26F.js +118 -0
- package/js/{chunk-2VPJHFOU.js → chunk-FXWRE655.js} +128 -24
- package/js/{chunk-5MQZEB6Y.js → chunk-JI3EP2GL.js} +40 -12
- package/js/chunk-JJSLEJ6T.js +156 -0
- package/js/chunk-KAQD3DTI.js +16 -0
- package/js/chunk-KIM5HXNK.js +49 -0
- package/js/chunk-MJZYV7IO.js +255 -0
- package/js/{chunk-FW5HBOIK.js → chunk-MXDKXAY4.js} +19117 -18309
- package/js/{chunk-T2LAZCAD.js → chunk-NKWWPJYX.js} +3 -3
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/{chunk-3M2MEDNL.js → chunk-OTCLXFLL.js} +1337 -188
- package/js/chunk-P7MGDPFD.js +240 -0
- package/js/{chunk-ZCAMUXSG.js → chunk-PNVCCB4L.js} +432 -79
- package/js/{chunk-D47C7KG5.js → chunk-RIXVGVA6.js} +2 -2
- package/js/{chunk-NQ3OMCA5.js → chunk-TT6OU4UG.js} +2 -2
- package/js/{chunk-YEJOQEII.js → chunk-UOZMSUJ2.js} +61 -9
- package/js/chunk-UTJIGUSS.js +42 -0
- package/js/{chunk-G7ZIRKMK.js → chunk-VIU2XXA7.js} +228 -264
- package/js/{chunk-HDJH3RPR.js → chunk-VJQXXOQ3.js} +4 -4
- package/js/{chunk-WFSQXYUT.js → chunk-WPBR4AWB.js} +523 -63
- package/js/{chunk-SATWJKN6.js → chunk-YQ35E7KS.js} +2 -2
- package/js/chunk-ZUKBIHMK.js +92 -0
- package/js/client.js +122 -88
- package/js/contracts.js +116 -25
- package/js/effect.js +19 -20
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +57 -55
- package/js/host.js +19 -20
- package/js/index.js +245 -212
- package/js/mcp/effect.js +23 -22
- package/js/mcp/stdio.js +34 -30
- package/js/mcp.js +104 -68
- package/js/openapi.js +4087 -1503
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +147 -65
- 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 +2 -3
- package/runtime.json +1 -1
- package/types/app-data/src/contracts/database.d.ts +33 -6
- package/types/apps/src/contracts/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/app.d.ts +7 -8
- package/types/apps/src/contracts/cache.d.ts +14 -0
- package/types/apps/src/contracts/context.d.ts +12 -11
- package/types/apps/src/contracts/elicitation.d.ts +6 -6
- package/types/apps/src/contracts/failure.d.ts +54 -0
- package/types/apps/src/contracts/graphql.d.ts +2 -1
- package/types/apps/src/contracts/host.d.ts +44 -17
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +96 -10
- package/types/apps/src/contracts/network.d.ts +84 -0
- package/types/apps/src/contracts/openapi-compile.d.ts +32 -3
- package/types/apps/src/contracts/openapi.d.ts +45 -9
- package/types/apps/src/contracts/operations.d.ts +8 -9
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +263 -74
- package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
- package/types/apps/src/contracts/protocols/2.d.ts +66 -24
- package/types/apps/src/contracts/protocols/3.d.ts +715 -0
- package/types/apps/src/contracts/protocols/4.d.ts +1297 -0
- package/types/apps/src/contracts/protocols/5.d.ts +1174 -0
- package/types/apps/src/contracts/protocols/6.d.ts +1620 -0
- package/types/apps/src/contracts/protocols/7.d.ts +1784 -0
- package/types/apps/src/contracts/protocols/8.d.ts +1130 -0
- package/types/apps/src/contracts/protocols/9.d.ts +1106 -0
- package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
- package/types/apps/src/contracts/provider-error.d.ts +9 -0
- package/types/apps/src/contracts/provider.d.ts +115 -10
- package/types/apps/src/contracts/router.d.ts +59 -0
- package/types/apps/src/contracts/skills.d.ts +39 -9
- package/types/apps/src/contracts/sql.d.ts +58 -0
- package/types/apps/src/contracts/ui.d.ts +19 -1
- package/types/apps/src/contracts/workflows.d.ts +40 -3
- package/types/apps/src/facet.d.ts +4 -5
- package/types/apps/src/graphql.d.ts +1 -3
- package/types/apps/src/implementation/account-router.d.ts +12 -0
- package/types/apps/src/implementation/app.d.ts +5 -4
- package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
- package/types/apps/src/implementation/catalog-cache.d.ts +32 -5
- package/types/apps/src/implementation/elicitation.d.ts +12 -12
- package/types/apps/src/implementation/failure-detail.d.ts +47 -0
- package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
- 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/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 +7 -8
- package/types/apps/src/implementation/mcp-client.d.ts +49 -25
- 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 +52 -25
- package/types/apps/src/implementation/network.d.ts +16 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +27 -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 +8 -6
- package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
- package/types/apps/src/implementation/operations.d.ts +36 -3
- package/types/apps/src/implementation/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
- package/types/apps/src/implementation/provider-error.d.ts +28 -1
- package/types/apps/src/implementation/provider.d.ts +19 -5
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +223 -0
- package/types/apps/src/implementation/router.d.ts +68 -0
- package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
- package/types/apps/src/implementation/schema.d.ts +95 -11
- package/types/apps/src/implementation/skills.d.ts +18 -24
- package/types/apps/src/implementation/sql.d.ts +66 -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/workflow-context.d.ts +11 -3
- package/types/apps/src/index.d.ts +30 -13
- package/types/apps/src/mcp-stdio.d.ts +2 -5
- package/types/apps/src/mcp.d.ts +25 -5
- package/types/apps/src/openapi.d.ts +6 -6
- 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 +6 -3
- package/types/telemetry/src/browser.d.ts +2 -2
- package/types/telemetry/src/config.d.ts +2 -2
- package/types/telemetry/src/layer.d.ts +2 -2
- package/types/telemetry/src/recorded-failure.d.ts +20 -0
- package/types/telemetry/src/relay.d.ts +2 -2
- package/types/telemetry/src/transport.d.ts +8 -1
- package/types/utils/src/api-error.d.ts +53 -0
- package/types/utils/src/recorded-message.d.ts +15 -0
- package/js/chunk-BMOIAIVR.js +0 -138
- package/js/chunk-DHUDODG5.js +0 -213
- package/js/chunk-FZJOYIZO.js +0 -19
- package/js/chunk-LGIYBDWA.js +0 -85
- package/js/chunk-M6ZRRIBI.js +0 -877
- package/js/chunk-PLCMJREA.js +0 -590
- package/js/chunk-PYUYJRSK.js +0 -93
- package/js/chunk-SWPD52J7.js +0 -35
- package/js/chunk-W7D7WVSY.js +0 -18
- package/js/chunk-Z5NMEGJN.js +0 -29
- package/js/chunk-ZJWDMTE3.js +0 -63
- 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 -33
- 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/dynamic-tools.d.ts +0 -13
- package/types/apps/src/contracts/storage.d.ts +0 -68
- package/types/apps/src/implementation/account-operations.d.ts +0 -151
- package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
- package/types/apps/src/implementation/storage.d.ts +0 -13
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Portable workflow declarations, run views and durable execution capabilities. */
|
|
2
2
|
import { Schema, type Effect } from "effect";
|
|
3
|
+
import { RecordedMessage } from "../../../utils/src/recorded-message.js";
|
|
3
4
|
import { JsonValue } from "./schema.js";
|
|
4
5
|
import type { AppContext, AppRequirements, QueryContext, MutationContext } from "./context.js";
|
|
5
6
|
import type { Operation } from "../implementation/operations.js";
|
|
@@ -24,14 +25,38 @@ export declare const WorkflowStepOptions: Schema.Struct<{
|
|
|
24
25
|
readonly timeout: Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.NonEmptyString]>>;
|
|
25
26
|
}>;
|
|
26
27
|
export type WorkflowStepOptions = typeof WorkflowStepOptions.Type;
|
|
28
|
+
/**
|
|
29
|
+
* Where and why a run failed: the failing step and the error the app's own code raised, its
|
|
30
|
+
* message bounded and with account secrets replaced. Runs from before these fields existed have none.
|
|
31
|
+
*/
|
|
32
|
+
export declare const WorkflowFailureDetail: {
|
|
33
|
+
step: Schema.optionalKey<Schema.String>;
|
|
34
|
+
errorName: Schema.optionalKey<Schema.String>;
|
|
35
|
+
message: Schema.optionalKey<Schema.String>;
|
|
36
|
+
};
|
|
37
|
+
/** A failed run's recorded step and app error. */
|
|
38
|
+
export declare const WorkflowRunFailure: Schema.Struct<{
|
|
39
|
+
step: Schema.optionalKey<Schema.String>;
|
|
40
|
+
errorName: Schema.optionalKey<Schema.String>;
|
|
41
|
+
message: Schema.optionalKey<Schema.String>;
|
|
42
|
+
}>;
|
|
43
|
+
export type WorkflowRunFailure = typeof WorkflowRunFailure.Type;
|
|
27
44
|
declare const WorkflowFailure_base: Schema.Class<WorkflowFailure, Schema.TaggedStruct<"WorkflowFailure", {
|
|
28
45
|
readonly reason: Schema.Literals<readonly ["unavailable", "not_found", "input", "output", "operation", "approval", "credentials", "terminated", "execution", "conflict", "engine"]>;
|
|
29
46
|
readonly retryable: Schema.Boolean;
|
|
47
|
+
readonly step: Schema.optionalKey<Schema.String>;
|
|
48
|
+
readonly errorName: Schema.optionalKey<Schema.String>;
|
|
49
|
+
readonly message: Schema.optionalKey<Schema.String>;
|
|
30
50
|
}>, import("effect/Cause").YieldableError>;
|
|
31
|
-
/**
|
|
51
|
+
/** Failures cross host boundaries as reason codes plus the app's own bounded error detail. */
|
|
32
52
|
export declare class WorkflowFailure extends WorkflowFailure_base {
|
|
53
|
+
/**
|
|
54
|
+
* The step name and error detail are the app's. Its run's owner reads them; telemetry records
|
|
55
|
+
* only the reason, however the failure was built or decoded.
|
|
56
|
+
*/
|
|
57
|
+
get [RecordedMessage](): string | undefined;
|
|
33
58
|
}
|
|
34
|
-
/** Explicitly stop retrying an authored step. Its message
|
|
59
|
+
/** Explicitly stop retrying an authored step. Its message is reported like any step error. */
|
|
35
60
|
export declare class NonRetryableError extends Error {
|
|
36
61
|
readonly name = "NonRetryableError";
|
|
37
62
|
}
|
|
@@ -45,7 +70,7 @@ export declare const HostedWorkflow: Schema.Struct<{
|
|
|
45
70
|
readonly outputSchema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
46
71
|
}>;
|
|
47
72
|
export type HostedWorkflow = typeof HostedWorkflow.Type;
|
|
48
|
-
/** Results are available only on completed runs;
|
|
73
|
+
/** Results are available only on completed runs; failures carry a reason code and app error detail. */
|
|
49
74
|
export declare const WorkflowRun: Schema.Union<readonly [Schema.Struct<{
|
|
50
75
|
readonly status: Schema.Literals<readonly ["queued", "running", "waiting", "paused", "waitingForPause"]>;
|
|
51
76
|
readonly profile: Schema.optionalKey<Schema.NonEmptyString>;
|
|
@@ -66,6 +91,12 @@ export declare const WorkflowRun: Schema.Union<readonly [Schema.Struct<{
|
|
|
66
91
|
}>, Schema.Struct<{
|
|
67
92
|
readonly status: Schema.Literal<"errored">;
|
|
68
93
|
readonly error: Schema.Literals<readonly ["unavailable", "not_found", "input", "output", "operation", "approval", "credentials", "terminated", "execution", "conflict", "engine"]>;
|
|
94
|
+
/** The failing step and the app's own error, when the run recorded them. */
|
|
95
|
+
readonly failure: Schema.optionalKey<Schema.Struct<{
|
|
96
|
+
step: Schema.optionalKey<Schema.String>;
|
|
97
|
+
errorName: Schema.optionalKey<Schema.String>;
|
|
98
|
+
message: Schema.optionalKey<Schema.String>;
|
|
99
|
+
}>>;
|
|
69
100
|
readonly profile: Schema.optionalKey<Schema.NonEmptyString>;
|
|
70
101
|
readonly id: Schema.brand<Schema.NonEmptyString, "wfr">;
|
|
71
102
|
readonly app: Schema.NonEmptyString;
|
|
@@ -104,6 +135,12 @@ export declare const WorkflowRunPage: Schema.Struct<{
|
|
|
104
135
|
}>, Schema.Struct<{
|
|
105
136
|
readonly status: Schema.Literal<"errored">;
|
|
106
137
|
readonly error: Schema.Literals<readonly ["unavailable", "not_found", "input", "output", "operation", "approval", "credentials", "terminated", "execution", "conflict", "engine"]>;
|
|
138
|
+
/** The failing step and the app's own error, when the run recorded them. */
|
|
139
|
+
readonly failure: Schema.optionalKey<Schema.Struct<{
|
|
140
|
+
step: Schema.optionalKey<Schema.String>;
|
|
141
|
+
errorName: Schema.optionalKey<Schema.String>;
|
|
142
|
+
message: Schema.optionalKey<Schema.String>;
|
|
143
|
+
}>>;
|
|
107
144
|
readonly profile: Schema.optionalKey<Schema.NonEmptyString>;
|
|
108
145
|
readonly id: Schema.brand<Schema.NonEmptyString, "wfr">;
|
|
109
146
|
readonly app: Schema.NonEmptyString;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare const facetStorage: (storage: NonNullable<Sqlite.SqliteClientConfig["storage"]>) => AppStorage;
|
|
1
|
+
/** The data facet's storage capability; used only by the generated data facet, never browser bundles. */
|
|
2
|
+
import type { AppSqlStorage } from "./contracts/sql.js";
|
|
3
|
+
/** Bind one facet's storage at the runtime edge. App code receives `ctx.sql` over it, never the storage. */
|
|
4
|
+
export declare const facetStorage: (storage: AppSqlStorage) => AppSqlStorage;
|
|
@@ -4,7 +4,5 @@ import { type GraphqlCatalogOptions } from "./implementation/graphql-catalog.js"
|
|
|
4
4
|
export { GraphqlError, type GraphqlToolsOptions } from "./contracts/graphql.js";
|
|
5
5
|
export type { GraphqlCatalogOptions } from "./implementation/graphql-catalog.js";
|
|
6
6
|
/** Lazy tools with optional persistent metadata caching for the selected account. */
|
|
7
|
-
export declare const
|
|
8
|
-
dynamicTools: import("./contracts/dynamic-tools.js").DynamicTools;
|
|
9
|
-
}>;
|
|
7
|
+
export declare const graphqlRouter: (options: GraphqlCatalogOptions, kinds?: OperationKinds) => Promise<import("./index.js").RouterDeclaration<unknown, unknown>>;
|
|
10
8
|
export type { OperationKinds } from "./implementation/protocol-operations.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type RouterDeclaration } from "./router.js";
|
|
2
|
+
/**
|
|
3
|
+
* Discover each selected account's router and combine matching names.
|
|
4
|
+
* Calls take { accountId, input }; each branch retains its account's input schema,
|
|
5
|
+
* credentials, approval and output validation. Empty selections expose no operations.
|
|
6
|
+
* Discovery is sequential and cancellation follows the caller's signal.
|
|
7
|
+
*/
|
|
8
|
+
export declare const accountRouter: <Account extends {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
}>(accounts: readonly Account[], discover: (account: Account) => Promise<RouterDeclaration>, options: {
|
|
11
|
+
readonly signal: AbortSignal;
|
|
12
|
+
}) => Promise<RouterDeclaration>;
|
|
@@ -4,7 +4,7 @@ import type { AppRequirements, AppContext, QueryContext, MutationContext, Webhoo
|
|
|
4
4
|
import { type PromiseMethods } from "./authoring.js";
|
|
5
5
|
import { type WorkflowDeclaration } from "./workflows.js";
|
|
6
6
|
import type { WorkflowContext } from "../contracts/workflows.js";
|
|
7
|
-
import { type
|
|
7
|
+
import { type RouterDeclaration } from "./router.js";
|
|
8
8
|
import { type Schema } from "./schema.js";
|
|
9
9
|
type PromiseCatalog<Catalog> = Catalog extends Readonly<Record<string, object>> ? {
|
|
10
10
|
readonly [Name in keyof Catalog]: {
|
|
@@ -14,15 +14,16 @@ type PromiseCatalog<Catalog> = Catalog extends Readonly<Record<string, object>>
|
|
|
14
14
|
/** Author definition projected from native capabilities. Excluding callable objects keeps
|
|
15
15
|
* factories from being inferred as definitions and preserves contextual handler inference. */
|
|
16
16
|
export type AppDefinition<Requirements extends AppRequirements> = {
|
|
17
|
-
readonly [Key in keyof NativeDefinition<WebhookContext<Requirements>>]: Key extends "workflows" ? Readonly<Record<string, WorkflowDeclaration<WorkflowContext<Requirements>>>> : Key extends "schedules" ? Readonly<Record<string, ScheduleDeclaration<MutationContext<Requirements>>>> : Key extends "
|
|
17
|
+
readonly [Key in keyof NativeDefinition<WebhookContext<Requirements>>]: Key extends "workflows" ? Readonly<Record<string, WorkflowDeclaration<WorkflowContext<Requirements>>>> : Key extends "schedules" ? Readonly<Record<string, ScheduleDeclaration<MutationContext<Requirements>>>> : Key extends "tools" ? RouterDeclaration<QueryContext<Requirements>, MutationContext<Requirements>> : Key extends "webhooks" ? PromiseCatalog<NonNullable<NativeDefinition<WebhookContext<Requirements>>[Key]>> : NativeDefinition<WebhookContext<Requirements>>[Key];
|
|
18
18
|
} & {
|
|
19
19
|
readonly name?: never;
|
|
20
|
-
readonly
|
|
20
|
+
readonly queries?: never;
|
|
21
|
+
readonly mutations?: never;
|
|
21
22
|
readonly call?: never;
|
|
22
23
|
};
|
|
23
24
|
/** Adapt operation and webhook catalogs without evaluating their handlers. */
|
|
24
25
|
export type EffectDefinition<Def> = {
|
|
25
|
-
readonly [Key in keyof Def]: Key extends "
|
|
26
|
+
readonly [Key in keyof Def]: Key extends "tools" ? NonNullable<NativeDefinition<unknown>["tools"]> : Key extends "workflows" ? Readonly<Record<string, import("../contracts/workflows.js").AppWorkflow>> : Key extends "schedules" ? NonNullable<NativeDefinition<unknown>["schedules"]> : Key extends "webhooks" ? NonNullable<NativeDefinition<WebhookContext>["webhooks"]> : Key extends "skills" ? NonNullable<NativeDefinition<unknown>["skills"]> : Key extends "dynamicSkills" ? NonNullable<NativeDefinition<unknown>["dynamicSkills"]> : Def[Key];
|
|
26
27
|
};
|
|
27
28
|
declare const InternalApp: unique symbol;
|
|
28
29
|
/** Recognize a declaration from this framework instance before host adaptation. */
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Compiled from src/browser/app-watch.ts. */
|
|
2
|
+
export declare const appWatchSource = "\"use strict\";(()=>{var s=()=>{let i=document.getElementById(\"executor-context\")?.textContent;if(!i)return;let n=JSON.parse(i);if(typeof n!=\"object\"||n===null||!(\"deployment\"in n))return;let r=n.deployment;if(typeof r!=\"string\"||r.length===0)return;let t=new EventSource(\"/_executor/version\"),l=!1,o=()=>{l||(l=!0,t.close(),location.reload())};t.addEventListener(\"version\",d=>{let e=JSON.parse(d.data);typeof e==\"object\"&&e!==null&&\"deployment\"in e&&(e.deployment===null||typeof e.deployment==\"string\")&&e.deployment!==r&&o()}),t.addEventListener(\"revoked\",o),window.addEventListener(\"executor:deployment-changed\",o),window.addEventListener(\"pagehide\",()=>t.close(),{once:!0}),window.addEventListener(\"pageshow\",d=>{d.persisted&&o()})};s();})();";
|
|
3
|
+
/** Compiled from src/browser/app-failure.ts. */
|
|
4
|
+
export declare const appFailureSource = "\"use strict\";(()=>{var D=()=>{let d,w=Date.now(),m=0,g=0,f=new Map,A=/^(?:chrome|moz|safari-web)-extension:/,R=new Set([\"Error\",\"TypeError\",\"ReferenceError\",\"SyntaxError\",\"RangeError\",\"URIError\",\"EvalError\",\"AggregateError\"]),x=(e,t=0,i=0)=>{let r=[];if(!URL.canParse(e))return r;let a=new URL(e);return a.origin!==location.origin||!a.pathname.startsWith(\"/_executor/assets/\")||!a.pathname.endsWith(\".js\")||(r.push({key:\"code.file.path\",value:{stringValue:a.pathname}}),Number.isSafeInteger(t)&&t>0&&r.push({key:\"code.line.number\",value:{intValue:String(t)}}),Number.isSafeInteger(i)&&i>0&&r.push({key:\"code.column.number\",value:{intValue:String(i)}})),r},E=(e,t,i=[])=>{let r=Date.now();r-w>=6e4&&(w=r,m=0,f.clear());let a=`${e}:${t.slice(0,2e3)}`,b=f.get(a);if(b!==void 0&&r-b<1e3||m>=20){g++;return}f.set(a,r),m++,i.push({key:\"executor.ui.failure.suppressed\",value:{intValue:String(g)}}),g=0;let h=Array.from(crypto.getRandomValues(new Uint8Array(16)),s=>s.toString(16).padStart(2,\"0\")).join(\"\"),S=`${Date.now()}000000`,n,u=\"Sending error report\\u2026\",k=()=>{if(d?.open)return;let s=document.createElement(\"div\"),V=s.attachShadow({mode:\"open\"}),o=document.createElement(\"dialog\");d=o,o.setAttribute(\"aria-labelledby\",\"executor-failure-title\");let y=document.createElement(\"h2\");y.id=\"executor-failure-title\",y.textContent=e===\"script\"?\"This app could not load\":\"This app stopped working\";let C=document.createElement(\"p\");C.textContent=e===\"script\"?\"A file needed by this page did not load. Reload the page to try again.\":\"The app encountered an unexpected error. Reload the page to try again.\";let L=document.createElement(\"p\");L.textContent=\"Copy any unsaved work before reloading.\";let T=document.createElement(\"details\"),v=document.createElement(\"summary\");v.textContent=\"Error details\";let c=document.createElement(\"textarea\");c.readOnly=!0,c.rows=10,c.cols=36,c.setAttribute(\"aria-label\",\"Error details\"),c.value=`${t.slice(0,12e3)}\n\nDiagnostic ID: ${h}`,T.append(v,c),n=document.createElement(\"p\"),n.setAttribute(\"role\",\"status\"),n.textContent=u;let l=document.createElement(\"button\");l.type=\"button\",l.textContent=\"Reload page\",l.addEventListener(\"click\",()=>location.reload());let p=document.createElement(\"button\");p.type=\"button\",p.textContent=\"Close\",p.addEventListener(\"click\",()=>o.close()),o.addEventListener(\"close\",()=>{d===o&&(d=void 0),s.remove()}),o.append(y,C,L,T,n,l,p),V.append(o),document.documentElement.append(s),o.showModal()};document.readyState===\"loading\"?document.addEventListener(\"DOMContentLoaded\",k,{once:!0}):k(),fetch(\"/_executor/api/telemetry/traces\",{method:\"POST\",headers:{\"content-type\":\"application/json\"},credentials:\"same-origin\",keepalive:!0,body:JSON.stringify({resourceSpans:[{scopeSpans:[{spans:[{traceId:h,spanId:h.slice(0,16),name:\"ui.app.failure\",kind:1,startTimeUnixNano:S,endTimeUnixNano:S,status:{code:2},attributes:[{key:\"executor.ui.failure.kind\",value:{stringValue:e}},...i]}]}]}]})}).then(s=>{u=s.ok?\"Error report sent.\":\"Could not send the error report. You can copy the error details.\",n&&(n.textContent=u)},()=>{u=\"Could not send the error report. You can copy the error details.\",n&&(n.textContent=u)})};window.addEventListener(\"error\",e=>{if(e instanceof ErrorEvent){if(A.test(e.filename))return;let t=x(e.filename,e.lineno,e.colno);e.error instanceof Error&&R.has(e.error.name)&&t.push({key:\"exception.type\",value:{stringValue:e.error.name}}),E(\"runtime\",e.error instanceof Error?e.error.stack??e.message:e.message,t)}else e.target instanceof HTMLScriptElement&&E(\"script\",`Could not load script: ${e.target.src}`,x(e.target.src))},!0),window.addEventListener(\"unhandledrejection\",e=>{let t=e.reason;E(\"rejection\",t instanceof Error?t.stack??t.message:\"An app operation failed without handling its error.\")})};D();})();";
|
|
5
|
+
/** Compiled from src/browser/account-notice.ts. */
|
|
6
|
+
export declare const accountNoticeSource = "\"use strict\";(()=>{var g=()=>{let r=document.getElementById(\"executor-account-notice\")?.textContent;if(!r)return;let t=JSON.parse(r);if(typeof t!=\"object\"||t===null||!(\"items\"in t)||!(\"fix\"in t))return;let c=t.items,s=t.fix;if(!Array.isArray(c)||typeof s!=\"string\")return;let a=()=>{let i=document.createElement(\"div\"),x=i.attachShadow({mode:\"open\"}),d=document.createElement(\"style\");d.textContent=\"aside{position:fixed;right:16px;bottom:16px;z-index:2147483647;max-width:360px;box-sizing:border-box;padding:14px 16px;border-radius:10px;border:1px solid #fcd34d;background:#fffbeb;color:#451a03;font:14px/1.45 ui-sans-serif,system-ui,sans-serif;box-shadow:0 8px 24px rgb(0 0 0/.12)}strong{display:block;margin-bottom:4px}ul{margin:0 0 10px;padding-left:18px}div{display:flex;gap:12px;align-items:center}a{color:inherit;font-weight:600}button{margin-left:auto;font:inherit;background:none;border:0;padding:0;color:inherit;text-decoration:underline;cursor:pointer}\";let e=document.createElement(\"aside\");e.setAttribute(\"role\",\"status\"),e.setAttribute(\"aria-label\",\"Account warning\");let l=document.createElement(\"strong\");l.textContent=\"Some things might not work\";let m=document.createElement(\"ul\");for(let f of c){let p=document.createElement(\"li\");p.textContent=String(f),m.append(p)}let u=document.createElement(\"div\"),n=document.createElement(\"a\");n.href=s,n.target=\"_top\",n.textContent=\"Review accounts\";let o=document.createElement(\"button\");o.type=\"button\",o.textContent=\"Dismiss\",o.addEventListener(\"click\",()=>i.remove()),u.append(n,o),e.append(l,m,u),x.append(d,e),document.documentElement.append(i)};document.readyState===\"loading\"?document.addEventListener(\"DOMContentLoaded\",a,{once:!0}):a()};g();})();";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Duration, Effect, Schema } from "effect";
|
|
2
|
-
import type { AppCache, CacheLoadContext } from "../contracts/cache.js";
|
|
3
|
-
import { type JsonValue } from "../contracts/schema.js";
|
|
2
|
+
import type { AccountCredential, AppCache, CacheLoadContext } from "../contracts/cache.js";
|
|
3
|
+
import { JsonObject, type JsonValue } from "../contracts/schema.js";
|
|
4
4
|
export interface CatalogCacheOptions {
|
|
5
|
-
/**
|
|
5
|
+
/** The app's cache. An account's catalog is kept in that account's scope. */
|
|
6
6
|
readonly cache?: AppCache;
|
|
7
7
|
/** Reuse metadata for this duration. Defaults to five minutes. */
|
|
8
8
|
readonly freshFor?: Duration.Input;
|
|
@@ -11,9 +11,34 @@ export interface CatalogCacheOptions {
|
|
|
11
11
|
/** Await a fresh revision at an explicit logical connection or refresh boundary. */
|
|
12
12
|
readonly revalidate?: boolean;
|
|
13
13
|
}
|
|
14
|
+
/** Whose catalog a remote router reads, and the headers, such as credentials, it sends. */
|
|
15
|
+
export type CatalogAccount = AccountCredential<{
|
|
16
|
+
/** Headers for this account's requests, such as its credentials. */
|
|
17
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
18
|
+
}>;
|
|
19
|
+
/** Why a read cannot use its account's scope. */
|
|
20
|
+
export type CatalogScopeProblem = "missing-account" | "unselected-account";
|
|
21
|
+
/**
|
|
22
|
+
* The cache an account's catalog lives in: the account's own scope, which token renewals keep.
|
|
23
|
+
* `credential` is what the read sends, such as headers or a token; it never enters a key. A
|
|
24
|
+
* credential without an account, or an account the app was not given, fails with `invalid`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const catalogScope: <E>(options: {
|
|
27
|
+
readonly cache?: AppCache | undefined;
|
|
28
|
+
readonly account?: {
|
|
29
|
+
readonly id: string;
|
|
30
|
+
} | undefined;
|
|
31
|
+
}, credential: unknown, invalid: (problem: CatalogScopeProblem) => E) => Effect.Effect<AppCache | undefined, E>;
|
|
32
|
+
/** One load: the tools, and optionally a record describing the whole catalog. */
|
|
33
|
+
export interface CatalogLoad<A> {
|
|
34
|
+
readonly tools: readonly A[];
|
|
35
|
+
readonly header?: JsonObject;
|
|
36
|
+
}
|
|
14
37
|
export declare const catalogCache: <A extends {
|
|
15
38
|
readonly name: string;
|
|
16
|
-
}, S>(options: CatalogCacheOptions & {
|
|
39
|
+
}, S>(options: Omit<CatalogCacheOptions, "cache"> & {
|
|
40
|
+
/** The scope from `catalogScope`; undefined keeps discovery invocation-local. */
|
|
41
|
+
readonly cache: AppCache | undefined;
|
|
17
42
|
readonly prefix: readonly JsonValue[];
|
|
18
43
|
readonly schema: Schema.Decoder<A>;
|
|
19
44
|
/** Schema-free projection stored beside the full pages, so browsing never reads schemas. */
|
|
@@ -21,9 +46,11 @@ export declare const catalogCache: <A extends {
|
|
|
21
46
|
readonly schema: Schema.Decoder<S>;
|
|
22
47
|
readonly of: (tool: A) => S;
|
|
23
48
|
};
|
|
24
|
-
readonly load: (context?: CacheLoadContext) => Effect.Effect<
|
|
49
|
+
readonly load: (context?: CacheLoadContext) => Effect.Effect<CatalogLoad<A>, unknown>;
|
|
25
50
|
}) => Effect.Effect<{
|
|
26
51
|
list: () => Effect.Effect<readonly A[], unknown, never>;
|
|
52
|
+
/** The record stored with the current revision, if the source supplied one. */
|
|
53
|
+
header: () => Effect.Effect<JsonObject | undefined, unknown>;
|
|
27
54
|
summaries: () => Effect.Effect<S[], unknown, never>;
|
|
28
55
|
resolve: (name: string) => Effect.Effect<A | undefined, unknown, never>;
|
|
29
56
|
}, unknown, never>;
|
|
@@ -12,15 +12,15 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
|
|
|
12
12
|
readonly [x: string]: {
|
|
13
13
|
readonly type: "string";
|
|
14
14
|
readonly enum: readonly string[];
|
|
15
|
-
readonly default?: string;
|
|
16
15
|
readonly description?: string;
|
|
16
|
+
readonly default?: string;
|
|
17
17
|
readonly title?: string;
|
|
18
18
|
readonly enumNames?: readonly string[];
|
|
19
19
|
} | {
|
|
20
20
|
readonly type: "string";
|
|
21
21
|
readonly enum: readonly string[];
|
|
22
|
-
readonly default?: string;
|
|
23
22
|
readonly description?: string;
|
|
23
|
+
readonly default?: string;
|
|
24
24
|
readonly title?: string;
|
|
25
25
|
} | {
|
|
26
26
|
readonly type: "string";
|
|
@@ -28,8 +28,8 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
|
|
|
28
28
|
readonly const: string;
|
|
29
29
|
readonly title: string;
|
|
30
30
|
}[];
|
|
31
|
-
readonly default?: string;
|
|
32
31
|
readonly description?: string;
|
|
32
|
+
readonly default?: string;
|
|
33
33
|
readonly title?: string;
|
|
34
34
|
} | {
|
|
35
35
|
readonly type: "array";
|
|
@@ -37,11 +37,11 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
|
|
|
37
37
|
readonly type: "string";
|
|
38
38
|
readonly enum: readonly string[];
|
|
39
39
|
};
|
|
40
|
-
readonly default?: readonly string[];
|
|
41
40
|
readonly description?: string;
|
|
42
|
-
readonly
|
|
41
|
+
readonly default?: readonly string[];
|
|
43
42
|
readonly minItems?: number;
|
|
44
43
|
readonly maxItems?: number;
|
|
44
|
+
readonly title?: string;
|
|
45
45
|
} | {
|
|
46
46
|
readonly type: "array";
|
|
47
47
|
readonly items: {
|
|
@@ -50,30 +50,30 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
|
|
|
50
50
|
readonly title: string;
|
|
51
51
|
}[];
|
|
52
52
|
};
|
|
53
|
-
readonly default?: readonly string[];
|
|
54
53
|
readonly description?: string;
|
|
55
|
-
readonly
|
|
54
|
+
readonly default?: readonly string[];
|
|
56
55
|
readonly minItems?: number;
|
|
57
56
|
readonly maxItems?: number;
|
|
57
|
+
readonly title?: string;
|
|
58
58
|
} | {
|
|
59
59
|
readonly type: "string";
|
|
60
|
+
readonly description?: string;
|
|
60
61
|
readonly default?: string;
|
|
61
62
|
readonly format?: "email" | "uri" | "date" | "date-time";
|
|
62
|
-
readonly description?: string;
|
|
63
|
-
readonly title?: string;
|
|
64
63
|
readonly minLength?: number;
|
|
65
64
|
readonly maxLength?: number;
|
|
65
|
+
readonly title?: string;
|
|
66
66
|
} | {
|
|
67
67
|
readonly type: "number" | "integer";
|
|
68
|
-
readonly default?: number;
|
|
69
68
|
readonly description?: string;
|
|
70
|
-
readonly
|
|
69
|
+
readonly default?: number;
|
|
71
70
|
readonly minimum?: number;
|
|
72
71
|
readonly maximum?: number;
|
|
72
|
+
readonly title?: string;
|
|
73
73
|
} | {
|
|
74
74
|
readonly type: "boolean";
|
|
75
|
-
readonly default?: boolean;
|
|
76
75
|
readonly description?: string;
|
|
76
|
+
readonly default?: boolean;
|
|
77
77
|
readonly title?: string;
|
|
78
78
|
};
|
|
79
79
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Option, Redacted } from "effect";
|
|
2
|
+
import { McpError as HostMcpError, SkillLoadFailed as HostSkillLoadFailed, type ResolvedAccounts } from "../contracts/host.js";
|
|
3
|
+
import type { ProviderError } from "../contracts/provider-error.js";
|
|
4
|
+
import { type FailureFields, type FailurePhase, type UpstreamError } from "../contracts/failure.js";
|
|
5
|
+
/** Fields of `FailureDetail` as constructor input. */
|
|
6
|
+
export interface FailureDetail {
|
|
7
|
+
readonly source?: "app" | "storage" | "service";
|
|
8
|
+
readonly errorName?: string;
|
|
9
|
+
readonly code?: string;
|
|
10
|
+
readonly message?: string;
|
|
11
|
+
readonly fields?: FailureFields;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Every credential field value of a slot-to-account record, longest first. Accepts both resolved
|
|
15
|
+
* host accounts and bound author accounts; each account keeps its credential values in `fields`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const accountFieldSecrets: (accounts: unknown) => string[];
|
|
18
|
+
/** Every credential field value of an invocation's selected accounts. */
|
|
19
|
+
export declare const accountSecrets: (accounts: Redacted.Redacted<ResolvedAccounts>) => string[];
|
|
20
|
+
/** Replace account secrets and bound the message for the runtime boundary. */
|
|
21
|
+
export declare const boundFailureMessage: (message: string, secrets: readonly string[]) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Replace account secrets in the error a service stated, as it leaves the bundle. A message
|
|
24
|
+
* shortened where it was read can end partway through a secret; that part is replaced too.
|
|
25
|
+
*/
|
|
26
|
+
export declare const redactUpstream: (upstream: UpstreamError | undefined, secrets: readonly string[]) => UpstreamError | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* A provider failure as it leaves the bundle: in the phase it happened, unless its raiser named a
|
|
29
|
+
* more precise one, with account secrets replaced in the error the service stated.
|
|
30
|
+
*/
|
|
31
|
+
export declare const leavingProviderError: (error: ProviderError, secrets: readonly string[], phase?: FailurePhase) => ProviderError;
|
|
32
|
+
/**
|
|
33
|
+
* Rebuild an MCP failure's allowlisted fields, with account secrets replaced in the server's
|
|
34
|
+
* error. Absent fields have no key, as catalogs cross the boundary as JSON values.
|
|
35
|
+
*/
|
|
36
|
+
export declare const parseMcpError: (error: unknown, secrets: readonly string[]) => Option.Option<HostMcpError>;
|
|
37
|
+
/** Rebuild only the allowlisted skill loader fields from an author-visible rejection. */
|
|
38
|
+
export declare const parseSkillLoadFailed: (error: unknown) => Option.Option<HostSkillLoadFailed>;
|
|
39
|
+
/** `Name: message` for any thrown value, before redaction. */
|
|
40
|
+
export declare const describeFailure: (error: unknown) => string;
|
|
41
|
+
/**
|
|
42
|
+
* Describe what an operation raised for the app's own caller. App data failures keep their
|
|
43
|
+
* reason as a code, as do app cache failures and OpenAPI and MCP service failures, such as an
|
|
44
|
+
* `mcpHealth` check that cannot reach its server or cannot verify the credentials; any other thrown
|
|
45
|
+
* value is the app's own error, with its own code and scalar fields. Account secrets are replaced.
|
|
46
|
+
*/
|
|
47
|
+
export declare const failureDetail: (error: unknown, secrets: readonly string[]) => FailureDetail;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { GraphqlToolsOptions } from "../contracts/graphql.js";
|
|
3
|
-
import type
|
|
4
|
-
import { type CatalogCacheOptions } from "./catalog-cache.js";
|
|
3
|
+
import { type CatalogAccount, type CatalogCacheOptions } from "./catalog-cache.js";
|
|
5
4
|
import { type OperationKinds } from "./protocol-operations.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare const graphqlCatalog: (options: GraphqlCatalogOptions, kinds: OperationKinds) => Effect.Effect<
|
|
9
|
-
dynamicTools: DynamicTools;
|
|
10
|
-
}, unknown, never>;
|
|
5
|
+
/** An endpoint, the account whose schema it is, and the metadata policy. */
|
|
6
|
+
export type GraphqlCatalogOptions = Omit<GraphqlToolsOptions, "accountId" | "headers"> & CatalogCacheOptions & CatalogAccount;
|
|
7
|
+
export declare const graphqlCatalog: (options: GraphqlCatalogOptions, kinds: OperationKinds) => Effect.Effect<import("./operations.js").RouterDeclaration<unknown, unknown>, unknown, never>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ProviderError } from "../contracts/provider-error.js";
|
|
2
|
+
import { NetworkRefused } from "../contracts/network.js";
|
|
2
3
|
/** Discover GraphQL tools live; transport, decoding and cancellation stay in Effect. */
|
|
3
4
|
import { Effect, Schema } from "effect";
|
|
4
5
|
import { OperationTypeNode } from "graphql";
|
|
@@ -8,7 +9,7 @@ import { JsonObject } from "../effect.js";
|
|
|
8
9
|
export declare const graphqlClientEffect: (input: GraphqlToolsOptions) => Effect.Effect<{
|
|
9
10
|
request: (phase: "discover" | "call", query: string, variables?: JsonObject) => Effect.Effect<{
|
|
10
11
|
readonly [x: string]: Schema.Json;
|
|
11
|
-
}, ProviderError | GraphqlError, never>;
|
|
12
|
+
}, ProviderError | NetworkRefused | GraphqlError, never>;
|
|
12
13
|
discover: Effect.Effect<{
|
|
13
14
|
readonly __schema: {
|
|
14
15
|
readonly queryType: {
|
|
@@ -42,7 +43,7 @@ export declare const graphqlClientEffect: (input: GraphqlToolsOptions) => Effect
|
|
|
42
43
|
}[] | null;
|
|
43
44
|
}[];
|
|
44
45
|
};
|
|
45
|
-
}, ProviderError | GraphqlError, never>;
|
|
46
|
+
}, ProviderError | NetworkRefused | GraphqlError, never>;
|
|
46
47
|
}, GraphqlError, never>;
|
|
47
48
|
/** Build serializable definitions once per introspection revision, without compiling validators. */
|
|
48
49
|
export declare const graphqlDefinitions: (catalog: GraphqlIntrospection) => Effect.Effect<{
|
|
@@ -80,4 +81,4 @@ export declare const graphqlDefinitions: (catalog: GraphqlIntrospection) => Effe
|
|
|
80
81
|
/** Bind only the selected definition to current credentials and compile its input decoder. */
|
|
81
82
|
export declare const adaptGraphqlTool: (client: Effect.Success<ReturnType<typeof graphqlClientEffect>>, definition: GraphqlToolDefinition) => Effect.Effect<import("../contracts/graphql.js").GraphqlTool, GraphqlError, never>;
|
|
82
83
|
/** Low-level callers can still request a complete invocation-owned tool map. */
|
|
83
|
-
export declare const graphqlToolsEffect: (input: GraphqlToolsOptions) => Effect.Effect<GraphqlTools, GraphqlError | ProviderError>;
|
|
84
|
+
export declare const graphqlToolsEffect: (input: GraphqlToolsOptions) => Effect.Effect<GraphqlTools, GraphqlError | ProviderError | NetworkRefused>;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { HostInputInvalid } from "../contracts/host.js";
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Failing input paths and what each expects, from a schema decode failure, without supplied
|
|
4
|
+
* values. An expected object names its keys, so a caller can correct nesting from the problem.
|
|
5
|
+
* A missing key also asks about a place where `input`, the rejected input, may have that key.
|
|
6
|
+
*/
|
|
7
|
+
export declare const inputInvalid: (error: unknown, input: unknown) => HostInputInvalid;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Atom } from "effect/
|
|
1
|
+
import { Atom } from "effect/reactivity";
|
|
2
2
|
import { AppQueryFailed, type OperationReference, type QueryTransport } from "../contracts/live.js";
|
|
3
3
|
import type { Operation } from "./operations.js";
|
|
4
4
|
import { type Schema } from "./schema.js";
|
|
@@ -14,5 +14,5 @@ export declare const mutationReference: <Mutation>(name: Mutation extends Operat
|
|
|
14
14
|
export declare const liveQueryAtom: <Input, Output>(reference: OperationReference<Input, Output, "query">, input: NoInfer<Input>, options: {
|
|
15
15
|
readonly output: Schema<NoInfer<Output>, boolean>;
|
|
16
16
|
readonly transport: QueryTransport;
|
|
17
|
-
}) => Atom.Atom<import("effect/
|
|
17
|
+
}) => Atom.Atom<import("effect/reactivity/AsyncResult").AsyncResult<NoInfer<Output>, import("effect/Cause").NoSuchElementError | AppQueryFailed>>;
|
|
18
18
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ProviderError } from "../contracts/provider-error.js";
|
|
2
|
+
import type { NetworkRefused } from "../contracts/network.js";
|
|
2
3
|
/** One upstream call, with form requests forwarded to the invocation's existing elicitation capability. */
|
|
3
4
|
import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
4
5
|
import { Effect, Schema } from "effect";
|
|
@@ -6,15 +7,15 @@ import { ElicitationFailed } from "../contracts/elicitation.js";
|
|
|
6
7
|
import { McpError, type McpToolContext } from "../contracts/mcp.js";
|
|
7
8
|
import type { JsonObject } from "../contracts/schema.js";
|
|
8
9
|
/** Register prompts only around tools/call, preserve metadata, and close every callback with the call. Never retries. */
|
|
9
|
-
export declare const mcpCall: (client: Client, name: string, input: JsonObject, context: McpToolContext, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError) => Effect.Effect<{
|
|
10
|
+
export declare const mcpCall: (client: Client, name: string, input: JsonObject, context: McpToolContext, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError | NetworkRefused) => Effect.Effect<{
|
|
10
11
|
readonly content: readonly {
|
|
11
12
|
readonly [x: string]: Schema.Json;
|
|
12
13
|
}[];
|
|
13
14
|
readonly _meta?: {
|
|
14
15
|
readonly [x: string]: Schema.Json;
|
|
15
|
-
}
|
|
16
|
+
};
|
|
16
17
|
readonly structuredContent?: {
|
|
17
18
|
readonly [x: string]: Schema.Json;
|
|
18
|
-
}
|
|
19
|
-
readonly isError?: boolean
|
|
20
|
-
}, ProviderError | ElicitationFailed | McpError, never>;
|
|
19
|
+
};
|
|
20
|
+
readonly isError?: boolean;
|
|
21
|
+
}, ProviderError | NetworkRefused | ElicitationFailed | McpError, never>;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import type { DynamicTools } from "../contracts/dynamic-tools.js";
|
|
3
2
|
import { McpToolsOptions } from "../contracts/mcp.js";
|
|
4
|
-
import { type CatalogCacheOptions } from "./catalog-cache.js";
|
|
3
|
+
import { type CatalogAccount, type CatalogCacheOptions } from "./catalog-cache.js";
|
|
5
4
|
import { type OperationKinds } from "./protocol-operations.js";
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
/**
|
|
6
|
+
* A server, the account whose catalog it is, and the metadata policy for HTTP/SSE sources. A
|
|
7
|
+
* missing cache keeps discovery invocation-local.
|
|
8
|
+
*/
|
|
9
|
+
export type McpCatalogOptions = Omit<McpToolsOptions, "accountId" | "headers"> & CatalogCacheOptions & CatalogAccount;
|
|
9
10
|
/** Construction opens no transport unless explicit revalidation is requested. */
|
|
10
|
-
export declare const mcpCatalog: (options: McpCatalogOptions, kinds: OperationKinds) => Effect.Effect<
|
|
11
|
-
dynamicTools: DynamicTools;
|
|
12
|
-
}, unknown, never>;
|
|
11
|
+
export declare const mcpCatalog: (options: McpCatalogOptions, kinds: OperationKinds) => Effect.Effect<import("./operations.js").RouterDeclaration<unknown, unknown>, unknown, never>;
|
|
@@ -1,51 +1,75 @@
|
|
|
1
1
|
import type { ProviderError } from "../contracts/provider-error.js";
|
|
2
|
+
import type { NetworkRefused } from "../contracts/network.js";
|
|
2
3
|
/** Shared MCP pagination, wire parsing and calls. Transport owns connection lifetime. */
|
|
3
4
|
import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
4
5
|
import type { jsonSchemaValidator } from "@modelcontextprotocol/sdk/validation/types.js";
|
|
5
6
|
import { Effect, Schema } from "effect";
|
|
6
7
|
import { McpError, type McpToolContext } from "../contracts/mcp.js";
|
|
8
|
+
import type { UpstreamError } from "../contracts/failure.js";
|
|
7
9
|
import type { JsonObject } from "../effect.js";
|
|
10
|
+
/**
|
|
11
|
+
* The JSON-RPC error a server answered a request with, if `error` is one. The SDK formats its
|
|
12
|
+
* message as `MCP error <code>: <message>`; the server's own message follows that prefix.
|
|
13
|
+
*/
|
|
14
|
+
export declare const answeredError: (error: unknown) => UpstreamError | undefined;
|
|
8
15
|
/** Use the framework-owned interpreter at the MCP SDK's synchronous validation boundary. */
|
|
9
16
|
export declare const mcpJsonSchemaValidator: jsonSchemaValidator;
|
|
10
17
|
/** An operation owns its connection; it must close even when interrupted. */
|
|
11
18
|
export interface WithMcpClient {
|
|
12
|
-
<A, E>(mode: "discover" | "call", use: (client: Client) => Effect.Effect<A, E>): Effect.Effect<A, E | McpError | ProviderError>;
|
|
19
|
+
<A, E>(mode: "discover" | "call", use: (client: Client) => Effect.Effect<A, E>): Effect.Effect<A, E | McpError | ProviderError | NetworkRefused>;
|
|
13
20
|
}
|
|
14
21
|
/** Shared client operations never cache catalogs or account credentials. */
|
|
15
|
-
export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError): {
|
|
22
|
+
export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError | NetworkRefused): {
|
|
16
23
|
list: Effect.Effect<{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
readonly
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
readonly
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
readonly
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
tools: {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly inputSchema: {
|
|
27
|
+
readonly [x: string]: Schema.Json;
|
|
28
|
+
};
|
|
29
|
+
readonly description?: string | undefined;
|
|
30
|
+
readonly _meta?: {
|
|
31
|
+
readonly [x: string]: Schema.Json;
|
|
32
|
+
} | undefined;
|
|
33
|
+
readonly title?: string | undefined;
|
|
34
|
+
readonly annotations?: {
|
|
35
|
+
readonly title?: string;
|
|
36
|
+
readonly readOnlyHint?: boolean;
|
|
37
|
+
readonly destructiveHint?: boolean;
|
|
38
|
+
readonly idempotentHint?: boolean;
|
|
39
|
+
readonly openWorldHint?: boolean;
|
|
40
|
+
} | undefined;
|
|
41
|
+
readonly outputSchema?: {
|
|
42
|
+
readonly [x: string]: Schema.Json;
|
|
43
|
+
} | undefined;
|
|
44
|
+
}[];
|
|
45
|
+
server: {
|
|
46
|
+
readonly description?: string;
|
|
47
|
+
readonly version?: string;
|
|
48
|
+
readonly name?: string;
|
|
49
|
+
readonly instructions?: string;
|
|
30
50
|
readonly title?: string;
|
|
31
|
-
readonly
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
51
|
+
readonly icons?: readonly {
|
|
52
|
+
readonly src: string;
|
|
53
|
+
readonly mimeType?: string;
|
|
54
|
+
readonly sizes?: readonly string[];
|
|
55
|
+
readonly theme?: "light" | "dark";
|
|
56
|
+
}[];
|
|
57
|
+
readonly websiteUrl?: string;
|
|
58
|
+
} | {};
|
|
59
|
+
}, ProviderError | NetworkRefused | McpError, never>;
|
|
60
|
+
check: Effect.Effect<void, ProviderError | NetworkRefused | McpError, never>;
|
|
37
61
|
call: (name: string, input: JsonObject, context: McpToolContext) => Effect.Effect<{
|
|
38
62
|
readonly content: readonly {
|
|
39
63
|
readonly [x: string]: Schema.Json;
|
|
40
64
|
}[];
|
|
41
65
|
readonly _meta?: {
|
|
42
66
|
readonly [x: string]: Schema.Json;
|
|
43
|
-
}
|
|
67
|
+
};
|
|
44
68
|
readonly structuredContent?: {
|
|
45
69
|
readonly [x: string]: Schema.Json;
|
|
46
|
-
}
|
|
47
|
-
readonly isError?: boolean
|
|
48
|
-
}, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
|
|
70
|
+
};
|
|
71
|
+
readonly isError?: boolean;
|
|
72
|
+
}, ProviderError | NetworkRefused | import("../index.js").ElicitationFailed | McpError, never>;
|
|
49
73
|
};
|
|
50
74
|
/** Transport-independent operations consumed by the app tool adapter. */
|
|
51
75
|
export type McpClient = ReturnType<typeof mcpClient>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { McpError, ProcessConfig } from "../contracts/mcp.js";
|
|
3
3
|
/** Each discovery/call owns and closes its subprocess. Deployment never starts it. */
|
|
4
|
-
export declare const stdioToolsEffect: (input: ProcessConfig) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, import("../index.js").ProviderError | McpError, never>;
|
|
4
|
+
export declare const stdioToolsEffect: (input: ProcessConfig) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, import("../index.js").ProviderError | import("../index.js").NetworkRefused | McpError, never>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ProviderError } from "../contracts/provider-error.js";
|
|
2
|
+
import type { NetworkRefused } from "../contracts/network.js";
|
|
2
3
|
/** Adapt any MCP transport into ordinary tools with shared validation behavior. */
|
|
3
4
|
import { Effect } from "effect";
|
|
4
5
|
import { McpError, type McpTools, type McpToolMetadata } from "../contracts/mcp.js";
|
|
@@ -6,4 +7,4 @@ import type { McpClient } from "./mcp-client.js";
|
|
|
6
7
|
/** Compile only the selected tool and bind its executable to the current invocation. */
|
|
7
8
|
export declare const adaptMcpTool: (client: McpClient, tool: McpToolMetadata) => Effect.Effect<import("../contracts/mcp.js").McpTool, McpError, never>;
|
|
8
9
|
/** Discover a complete catalog for probes and uncached low-level callers. */
|
|
9
|
-
export declare const adaptMcpTools: (client: McpClient) => Effect.Effect<McpTools, McpError | ProviderError>;
|
|
10
|
+
export declare const adaptMcpTools: (client: McpClient) => Effect.Effect<McpTools, McpError | ProviderError | NetworkRefused>;
|