apps 0.0.1-beta.7 → 0.0.1-beta.73
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-RJDDBDSN.js → chunk-3CVQ3VPP.js} +762 -171
- package/js/chunk-3R3KFCDU.js +426 -0
- 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-CMYUWAX7.js → chunk-G7L5DHQX.js} +126 -31
- 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-LTF4TLMO.js +347 -0
- package/js/chunk-MHB7IFG7.js +49 -0
- package/js/{chunk-FL2QR3XW.js → chunk-OBYMFSWA.js} +333 -69
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
- package/js/{chunk-72JNVHPK.js → chunk-QGHGYH5V.js} +4 -3
- package/js/{chunk-NKLWZJLE.js → chunk-RUP4JMKO.js} +25 -14
- package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
- package/js/{chunk-UESPOTUI.js → chunk-WCVV4PPS.js} +899 -190
- 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 +4071 -1357
- 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
|
@@ -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";
|
|
@@ -49,6 +50,11 @@ declare const WorkflowFailure_base: Schema.Class<WorkflowFailure, Schema.TaggedS
|
|
|
49
50
|
}>, import("effect/Cause").YieldableError>;
|
|
50
51
|
/** Failures cross host boundaries as reason codes plus the app's own bounded error detail. */
|
|
51
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;
|
|
52
58
|
}
|
|
53
59
|
/** Explicitly stop retrying an authored step. Its message is reported like any step error. */
|
|
54
60
|
export declare class NonRetryableError extends Error {
|
|
@@ -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;
|
package/types/apps/src/host.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ export { isolatedCacheSession } from "./implementation/cache-session.js";
|
|
|
6
6
|
export declare const hostContext: (accounts: ResolvedAccountsInput, approval?: unknown) => HostContext;
|
|
7
7
|
/** Portable Promise handler. Invoke only after the host has authorized and resolved accounts. */
|
|
8
8
|
export declare const createAppHandler: (app: unknown) => ((request: Request, context: HostContext) => Promise<Response>);
|
|
9
|
+
/**
|
|
10
|
+
* The clock this framework's spans read, in nanoseconds. The runtime's bridge times the isolate's
|
|
11
|
+
* whole dispatch with it, so that time and the invocation's own timing share one clock.
|
|
12
|
+
*/
|
|
13
|
+
export declare const isolatedClock: () => bigint;
|
|
9
14
|
/** Isolates return bounded, telemetry beside the protocol result; no exporter secret enters app code. */
|
|
10
15
|
export declare const createIsolatedAppHandler: (app: unknown) => (request: Request, context: HostContext) => Promise<Response>;
|
|
11
16
|
/**
|
|
@@ -3,10 +3,11 @@ import { type RouterDeclaration } from "./router.js";
|
|
|
3
3
|
* Discover each selected account's router and combine matching names.
|
|
4
4
|
* Calls take { accountId, input }; each branch retains its account's input schema,
|
|
5
5
|
* credentials, approval and output validation. Empty selections expose no operations.
|
|
6
|
-
* Discovery is sequential and cancellation follows the caller's signal.
|
|
6
|
+
* Discovery is sequential and cancellation follows the caller's signal. `discover` may return the
|
|
7
|
+
* router or a Promise of it, and the combined router keeps its operations' handler contexts.
|
|
7
8
|
*/
|
|
8
9
|
export declare const accountRouter: <Account extends {
|
|
9
10
|
readonly id: string;
|
|
10
|
-
}>(accounts: readonly Account[], discover: (account: Account) => Promise<RouterDeclaration
|
|
11
|
+
}, Query = unknown, Mutation = unknown>(accounts: readonly Account[], discover: (account: Account) => RouterDeclaration<Query, Mutation> | Promise<RouterDeclaration<Query, Mutation>>, options: {
|
|
11
12
|
readonly signal: AbortSignal;
|
|
12
|
-
}) => Promise<RouterDeclaration
|
|
13
|
+
}) => Promise<RouterDeclaration<Query, Mutation>>;
|
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
/** Small, explicit adapters between authored callbacks and native Effect operations. */
|
|
2
|
-
import { Effect } from "effect";
|
|
2
|
+
import { Effect, type Context } from "effect";
|
|
3
3
|
/** Project one Effect operation into its author-facing Promise signature. */
|
|
4
4
|
export type PromiseMethod<Method> = Method extends (...args: infer Args) => Effect.Effect<infer A, infer _E> ? (...args: Args) => Promise<A> : Method;
|
|
5
5
|
/** Project only an object's methods; data and schema types are not recursively rewritten. */
|
|
6
6
|
export type PromiseMethods<T> = {
|
|
7
7
|
readonly [Key in keyof T]: PromiseMethod<T[Key]>;
|
|
8
8
|
};
|
|
9
|
-
/**
|
|
10
|
-
export
|
|
11
|
-
/**
|
|
12
|
-
|
|
9
|
+
/** Which of the app's callbacks runs, recorded on the `app.code` span around it. */
|
|
10
|
+
export type AppCode = "factory" | "router" | "approval" | "handler" | "loader" | "cache" | "webhook" | "check" | "skills" | "elicitation" | "workflow" | "step";
|
|
11
|
+
/**
|
|
12
|
+
* Run `effect` as the app's own code. Its time is the app's, except for work it starts for
|
|
13
|
+
* Executor, an upstream or a person, which opens its own boundary inside.
|
|
14
|
+
*/
|
|
15
|
+
export declare const appCode: (code: AppCode) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, import("effect/Tracer").ParentSpan>>;
|
|
16
|
+
/**
|
|
17
|
+
* Reuse a framework callback's cancellation-bound Effect, or run an ordinary async callback as the
|
|
18
|
+
* app's code. Every callback an app supplies enters the framework here, so its time is the app's.
|
|
19
|
+
*/
|
|
20
|
+
export declare const fromPromise: <Args extends readonly unknown[], A>(callback: (...args: Args) => Promise<A>, code: AppCode) => ((...args: Args) => Effect.Effect<A, unknown>);
|
|
21
|
+
/**
|
|
22
|
+
* `target[key]`, called on `target`. A method read off its object as a bare value loses its
|
|
23
|
+
* receiver, so an app's method, such as one of its cache's, enters `fromPromise` through this.
|
|
24
|
+
*/
|
|
25
|
+
export declare const method: <K extends PropertyKey, T extends { readonly [P in K]: (...args: never) => unknown; }>(target: T, key: K) => T[K];
|
|
26
|
+
/**
|
|
27
|
+
* Bind cancellation once so Promise callers and native framework callers run the same operation.
|
|
28
|
+
* `signalOf` is the signal, or reads it from each call's arguments, such as a loader's `context.signal`.
|
|
29
|
+
*/
|
|
30
|
+
export declare const toPromise: <Args extends readonly unknown[], A, E>(operation: (...args: Args) => Effect.Effect<A, E>, signalOf?: AbortSignal | ((...args: Args) => AbortSignal),
|
|
31
|
+
/** Services a Promise call runs with, such as its invocation's telemetry. */
|
|
32
|
+
services?: Context.Context<never>) => ((...args: Args) => Promise<A>);
|
|
@@ -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,12 @@
|
|
|
1
|
+
/** Bind the portable Effect cache to an app invocation's author API. */
|
|
2
|
+
import { type Context } from "effect";
|
|
1
3
|
import type { AppCache, HostCache } from "../contracts/cache.js";
|
|
2
4
|
import type { ResolvedAccounts } from "../contracts/host.js";
|
|
3
5
|
/** Missing host support is explicit on use; ordinary apps do not need cache support. */
|
|
4
6
|
export declare const unavailableCache: HostCache;
|
|
5
7
|
/** Account scopes are derived from trusted current bindings. Loaders get a fresh owned HTTP signal. */
|
|
6
8
|
export declare const authorCache: (host: HostCache, accounts: ResolvedAccounts, signal: AbortSignal,
|
|
9
|
+
/** The invocation's telemetry, which Promise calls from authored code run in. */
|
|
10
|
+
telemetry: Context.Context<never>,
|
|
7
11
|
/** The invocation's trusted deadline. Waiting on another caller's load never runs past it. */
|
|
8
12
|
deadline?: number) => AppCache;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Duration, Effect, Schema } from "effect";
|
|
2
|
-
import type { AppCache, CacheLoadContext } from "../contracts/cache.js";
|
|
2
|
+
import type { AccountCredential, AppCache, CacheLoadContext } from "../contracts/cache.js";
|
|
3
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,14 +11,39 @@ 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>;
|
|
14
32
|
/** One load: the tools, and optionally a record describing the whole catalog. */
|
|
15
33
|
export interface CatalogLoad<A> {
|
|
16
34
|
readonly tools: readonly A[];
|
|
17
35
|
readonly header?: JsonObject;
|
|
18
36
|
}
|
|
37
|
+
/** The catalog a refresh replaces, read only when its loader asks for it. */
|
|
38
|
+
export interface KeptCatalog<A> {
|
|
39
|
+
readonly header: JsonObject | undefined;
|
|
40
|
+
readonly tools: Effect.Effect<readonly A[], unknown>;
|
|
41
|
+
}
|
|
19
42
|
export declare const catalogCache: <A extends {
|
|
20
43
|
readonly name: string;
|
|
21
|
-
}, S>(options: CatalogCacheOptions & {
|
|
44
|
+
}, S>(options: Omit<CatalogCacheOptions, "cache"> & {
|
|
45
|
+
/** The scope from `catalogScope`; undefined keeps discovery invocation-local. */
|
|
46
|
+
readonly cache: AppCache | undefined;
|
|
22
47
|
readonly prefix: readonly JsonValue[];
|
|
23
48
|
readonly schema: Schema.Decoder<A>;
|
|
24
49
|
/** Schema-free projection stored beside the full pages, so browsing never reads schemas. */
|
|
@@ -26,7 +51,13 @@ export declare const catalogCache: <A extends {
|
|
|
26
51
|
readonly schema: Schema.Decoder<S>;
|
|
27
52
|
readonly of: (tool: A) => S;
|
|
28
53
|
};
|
|
29
|
-
|
|
54
|
+
/** Past `freshFor`, serve the kept catalog while refreshing, or refresh first. */
|
|
55
|
+
readonly stale?: "serve" | "revalidate";
|
|
56
|
+
/**
|
|
57
|
+
* Load the catalog. A refresh also gets the catalog it replaces, if one is kept, so a source
|
|
58
|
+
* that can confirm it is unchanged need not load it again.
|
|
59
|
+
*/
|
|
60
|
+
readonly load: (context?: CacheLoadContext, kept?: Effect.Effect<KeptCatalog<A> | undefined, unknown>) => Effect.Effect<CatalogLoad<A>, unknown>;
|
|
30
61
|
}) => Effect.Effect<{
|
|
31
62
|
list: () => Effect.Effect<readonly A[], unknown, never>;
|
|
32
63
|
/** The record stored with the current revision, if the source supplied one. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Validate both sides of a tool's form and bind delivery to its invocation lifetime. */
|
|
2
|
-
import { Effect, Schema } from "effect";
|
|
2
|
+
import { Effect, Schema, type Context } from "effect";
|
|
3
3
|
import { ElicitationFailed, type ElicitationHandler, type Elicit } from "../contracts/elicitation.js";
|
|
4
4
|
/** Parse a form and retain its response parser, so invalid answers can be rejected before consuming a host continuation. */
|
|
5
5
|
export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
|
|
@@ -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 description?: string;
|
|
68
69
|
readonly default?: number;
|
|
70
|
+
readonly minimum?: number;
|
|
69
71
|
readonly maximum?: number;
|
|
70
|
-
readonly description?: string;
|
|
71
72
|
readonly title?: string;
|
|
72
|
-
readonly minimum?: number;
|
|
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
|
};
|
|
@@ -99,5 +99,8 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
|
|
|
99
99
|
} | undefined;
|
|
100
100
|
}, ElicitationFailed, never>;
|
|
101
101
|
}, ElicitationFailed, never>;
|
|
102
|
-
/**
|
|
103
|
-
|
|
102
|
+
/**
|
|
103
|
+
* Bind a validated interaction to the live invocation; transport adapters share its form parser.
|
|
104
|
+
* Authored code's Promise calls run in the invocation's telemetry, like framework callers.
|
|
105
|
+
*/
|
|
106
|
+
export declare const makeElicit: (handler: ElicitationHandler | undefined, signal: AbortSignal, telemetry: Context.Context<never>) => Elicit;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Event declarations and the per-invocation emitter. Emitted events leave in the reply. */
|
|
2
|
+
import { Effect, Schema as EffectSchema } from "effect";
|
|
3
|
+
import { EmittedEvent, type AppEvent, type EmitOptions } from "../contracts/events.js";
|
|
4
|
+
import { type Fields, type Infer, type ObjectValue, type Schema } from "./schema.js";
|
|
5
|
+
declare const Native: unique symbol;
|
|
6
|
+
/** An event an app emits. Declare it in `defineApp`'s requirements under `events`. */
|
|
7
|
+
export interface EventDeclaration<F extends Fields, P extends Schema<unknown, boolean>> {
|
|
8
|
+
readonly [Native]: AppEvent;
|
|
9
|
+
readonly description: string;
|
|
10
|
+
readonly filters: F;
|
|
11
|
+
readonly payload: P;
|
|
12
|
+
}
|
|
13
|
+
/** Any declared event, for requirement constraints. */
|
|
14
|
+
export type AnyEventDeclaration = EventDeclaration<Fields, Schema<unknown, boolean>>;
|
|
15
|
+
/**
|
|
16
|
+
* Declare an event. `filters` are scalar fields subscribers can narrow on, such as a repository;
|
|
17
|
+
* every emitted occurrence supplies their values. `payload` describes each occurrence's data.
|
|
18
|
+
*/
|
|
19
|
+
export declare const event: <const F extends Fields = {}, P extends Schema<unknown, boolean> = Schema<unknown>>(options: {
|
|
20
|
+
readonly description: string;
|
|
21
|
+
readonly filters?: F;
|
|
22
|
+
readonly payload: P;
|
|
23
|
+
}) => EventDeclaration<F, P>;
|
|
24
|
+
/** The native declaration retained by an author event. */
|
|
25
|
+
export declare const nativeEvent: (declaration: unknown) => AppEvent | undefined;
|
|
26
|
+
/** JSON Schema for each declared event, as the host reads it from requirements. */
|
|
27
|
+
export declare const declaredEvents: (events: Readonly<Record<string, AppEvent>>) => Effect.Effect<{
|
|
28
|
+
readonly [x: string]: {
|
|
29
|
+
readonly description: string;
|
|
30
|
+
readonly filters: {
|
|
31
|
+
readonly [x: string]: EffectSchema.Json;
|
|
32
|
+
};
|
|
33
|
+
readonly payload: {
|
|
34
|
+
readonly [x: string]: EffectSchema.Json;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
}, EffectSchema.SchemaError, never>;
|
|
38
|
+
/** Emit options typed by the event's filters: required exactly when it declares some. */
|
|
39
|
+
type OptionsFor<F extends Fields> = keyof F extends never ? [options?: Omit<EmitOptions<never>, "filters">] : [options: EmitOptions<ObjectValue<F>> & {
|
|
40
|
+
readonly filters: ObjectValue<F>;
|
|
41
|
+
}];
|
|
42
|
+
/** `ctx.events` in mutations and webhook handlers. */
|
|
43
|
+
export interface EventEmitter<Events extends Readonly<Record<string, AnyEventDeclaration>>> {
|
|
44
|
+
/**
|
|
45
|
+
* Record an occurrence. It is delivered only if this invocation succeeds. Invalid data, filters
|
|
46
|
+
* or options throw here, before anything is recorded.
|
|
47
|
+
*/
|
|
48
|
+
readonly emit: <Name extends keyof Events & string>(name: Name, data: Infer<Events[Name]["payload"]>, ...options: OptionsFor<Events[Name]["filters"]>) => void;
|
|
49
|
+
}
|
|
50
|
+
/** One invocation's buffer. The handler reads `emitted` only after the invocation succeeds. */
|
|
51
|
+
export declare const makeEmitter: (input: {
|
|
52
|
+
readonly events: Readonly<Record<string, AppEvent>>;
|
|
53
|
+
/** Every account ID bound to this invocation. */
|
|
54
|
+
readonly accounts: readonly string[];
|
|
55
|
+
/** The webhook's source account, which an emit names by default. */
|
|
56
|
+
readonly sourceAccount?: string;
|
|
57
|
+
readonly emitted: EmittedEvent[];
|
|
58
|
+
}) => EventEmitter<Readonly<Record<string, AnyEventDeclaration>>>;
|
|
59
|
+
export {};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { Redacted } from "effect";
|
|
2
|
-
import type
|
|
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";
|
|
3
5
|
/** Fields of `FailureDetail` as constructor input. */
|
|
4
6
|
export interface FailureDetail {
|
|
5
7
|
readonly source?: "app" | "storage" | "service";
|
|
6
8
|
readonly errorName?: string;
|
|
7
9
|
readonly code?: string;
|
|
8
10
|
readonly message?: string;
|
|
11
|
+
readonly fields?: FailureFields;
|
|
9
12
|
}
|
|
10
13
|
/**
|
|
11
14
|
* Every credential field value of a slot-to-account record, longest first. Accepts both resolved
|
|
@@ -16,10 +19,29 @@ export declare const accountFieldSecrets: (accounts: unknown) => string[];
|
|
|
16
19
|
export declare const accountSecrets: (accounts: Redacted.Redacted<ResolvedAccounts>) => string[];
|
|
17
20
|
/** Replace account secrets and bound the message for the runtime boundary. */
|
|
18
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>;
|
|
19
39
|
/** `Name: message` for any thrown value, before redaction. */
|
|
20
40
|
export declare const describeFailure: (error: unknown) => string;
|
|
21
41
|
/**
|
|
22
42
|
* Describe what an operation raised for the app's own caller. App data failures keep their
|
|
23
|
-
* reason as a code
|
|
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.
|
|
24
46
|
*/
|
|
25
47
|
export declare const failureDetail: (error: unknown, secrets: readonly string[]) => FailureDetail;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { GraphqlToolsOptions } from "../contracts/graphql.js";
|
|
3
|
-
import { type CatalogCacheOptions } from "./catalog-cache.js";
|
|
3
|
+
import { type CatalogAccount, type CatalogCacheOptions } from "./catalog-cache.js";
|
|
4
4
|
import { type OperationKinds } from "./protocol-operations.js";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/** An endpoint, the account whose schema it is, and the metadata policy. */
|
|
6
|
+
export type GraphqlCatalogOptions = Omit<GraphqlToolsOptions, "accountId" | "headers"> & CatalogCacheOptions & CatalogAccount;
|
|
7
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;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Divide a tool invocation's time, on its own isolate's clock, by who the work belonged to:
|
|
3
|
+
* Executor, the app's authored code, upstream providers, or a person answering an elicitation.
|
|
4
|
+
* Each boundary declares its owner where the work starts (see `owned`); the invocation's own span is
|
|
5
|
+
* Executor's. The host adds the other isolates' parts.
|
|
6
|
+
*/
|
|
7
|
+
import { Effect } from "effect";
|
|
8
|
+
/** The span `makeElicit` opens while a person answers. */
|
|
9
|
+
export declare const elicitationWaitSpan = "app.elicitation.wait";
|
|
10
|
+
/** The span around each workflow control an app calls, which Executor answers. */
|
|
11
|
+
export declare const workflowControlSpan = "app.workflow.control";
|
|
12
|
+
/**
|
|
13
|
+
* Run a tool operation in its `app.<operation>` span and time it from the span's own start to its
|
|
14
|
+
* own end. The span records each part, and the isolated handler returns them to the host.
|
|
15
|
+
*/
|
|
16
|
+
export declare const timedInvocation: (operation: "call" | "query" | "mutate") => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, import("effect/Tracer").ParentSpan>>;
|
|
@@ -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,9 +1,11 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { McpToolsOptions } from "../contracts/mcp.js";
|
|
3
|
-
import { type CatalogCacheOptions } from "./catalog-cache.js";
|
|
3
|
+
import { type CatalogAccount, type CatalogCacheOptions } from "./catalog-cache.js";
|
|
4
4
|
import { type OperationKinds } from "./protocol-operations.js";
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
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;
|
|
8
10
|
/** Construction opens no transport unless explicit revalidation is requested. */
|
|
9
11
|
export declare const mcpCatalog: (options: McpCatalogOptions, kinds: OperationKinds) => Effect.Effect<import("./operations.js").RouterDeclaration<unknown, unknown>, unknown, never>;
|
|
@@ -1,18 +1,25 @@
|
|
|
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
24
|
tools: {
|
|
18
25
|
readonly name: string;
|
|
@@ -36,11 +43,11 @@ export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number,
|
|
|
36
43
|
} | undefined;
|
|
37
44
|
}[];
|
|
38
45
|
server: {
|
|
46
|
+
readonly description?: string;
|
|
39
47
|
readonly version?: string;
|
|
40
48
|
readonly name?: string;
|
|
41
|
-
readonly description?: string;
|
|
42
|
-
readonly title?: string;
|
|
43
49
|
readonly instructions?: string;
|
|
50
|
+
readonly title?: string;
|
|
44
51
|
readonly icons?: readonly {
|
|
45
52
|
readonly src: string;
|
|
46
53
|
readonly mimeType?: string;
|
|
@@ -49,19 +56,20 @@ export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number,
|
|
|
49
56
|
}[];
|
|
50
57
|
readonly websiteUrl?: string;
|
|
51
58
|
} | {};
|
|
52
|
-
}, ProviderError | McpError, never>;
|
|
59
|
+
}, ProviderError | NetworkRefused | McpError, never>;
|
|
60
|
+
check: Effect.Effect<void, ProviderError | NetworkRefused | McpError, never>;
|
|
53
61
|
call: (name: string, input: JsonObject, context: McpToolContext) => Effect.Effect<{
|
|
54
62
|
readonly content: readonly {
|
|
55
63
|
readonly [x: string]: Schema.Json;
|
|
56
64
|
}[];
|
|
57
65
|
readonly _meta?: {
|
|
58
66
|
readonly [x: string]: Schema.Json;
|
|
59
|
-
}
|
|
67
|
+
};
|
|
60
68
|
readonly structuredContent?: {
|
|
61
69
|
readonly [x: string]: Schema.Json;
|
|
62
|
-
}
|
|
63
|
-
readonly isError?: boolean
|
|
64
|
-
}, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
|
|
70
|
+
};
|
|
71
|
+
readonly isError?: boolean;
|
|
72
|
+
}, ProviderError | NetworkRefused | import("../index.js").ElicitationFailed | McpError, never>;
|
|
65
73
|
};
|
|
66
74
|
/** Transport-independent operations consumed by the app tool adapter. */
|
|
67
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>;
|