apps 0.0.1-beta.14 → 0.0.1-beta.140
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 +60 -42
- package/framework-reference.json +1 -1
- package/js/{chunk-M3B3DE4K.js → chunk-2XDCAXAR.js} +612 -246
- package/js/{chunk-IPI4MFSN.js → chunk-34RH47V5.js} +2 -2
- package/js/chunk-5JBDHSLK.js +449 -0
- package/js/{chunk-KUMBKVJD.js → chunk-6QZVXLF2.js} +2 -2
- package/js/chunk-7MPPHKRW.js +5418 -0
- package/js/chunk-DQ6FIDC3.js +335 -0
- package/js/{chunk-5T57N25Q.js → chunk-EKXBHVMR.js} +697 -70
- package/js/chunk-EYZHR4UA.js +1945 -0
- package/js/chunk-GJG5G6CH.js +1022 -0
- package/js/chunk-H2K7OZ47.js +90 -0
- package/js/chunk-I6QAWNUM.js +161 -0
- package/js/{chunk-ODEIDRGW.js → chunk-JH3MOQZR.js} +1166 -504
- package/js/{chunk-QS6CAHKC.js → chunk-JHAHT26O.js} +4 -3
- package/js/{chunk-RFVIONFX.js → chunk-JIXIOWZP.js} +136 -45
- package/js/chunk-LSOHA2RH.js +88 -0
- package/js/{chunk-UK573G7W.js → chunk-MB6L5YZE.js} +1817 -632
- package/js/chunk-OBT33ZDK.js +95 -0
- package/js/{chunk-JU7VHODU.js → chunk-QTX7OUFH.js} +65 -10
- package/js/chunk-RBSXSRPU.js +175 -0
- package/js/chunk-SB2DNKDL.js +593 -0
- package/js/{chunk-VFZKSM3T.js → chunk-VX36SA7Y.js} +3 -3
- package/js/chunk-YF7TYPDS.js +49 -0
- package/js/{chunk-CDL5PM2Q.js → chunk-YFSOSNF3.js} +17265 -12477
- package/js/{chunk-IJX4CYZO.js → chunk-YVN2AMAU.js} +976 -447
- package/js/chunk-Z6DSU4VL.js +724 -0
- package/js/client.js +333 -98
- package/js/contracts.js +154 -21
- package/js/effect.js +18 -19
- package/js/graphql.js +231 -188
- package/js/host.js +138 -80
- package/js/index.js +153 -300
- package/js/mcp/effect.js +21 -21
- package/js/mcp.js +91 -57
- package/js/openapi.js +4950 -4201
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +220 -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 +9 -8
- package/js/ui/serving.js +8618 -235
- package/package.json +3 -8
- package/runtime.json +1 -1
- package/types/app-cache/src/contracts/cache.d.ts +18 -0
- package/types/app-cache/src/index.d.ts +34 -2
- package/types/apps/src/contracts/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/app.d.ts +56 -11
- package/types/apps/src/contracts/cache.d.ts +20 -0
- package/types/apps/src/contracts/context.d.ts +60 -17
- package/types/apps/src/contracts/elicitation.d.ts +23 -7
- package/types/apps/src/contracts/events.d.ts +94 -0
- package/types/apps/src/contracts/failure.d.ts +30 -1
- package/types/apps/src/contracts/graphql.d.ts +40 -2
- package/types/apps/src/contracts/help-text.d.ts +31 -0
- package/types/apps/src/contracts/host.d.ts +1493 -20
- package/types/apps/src/contracts/icons.d.ts +28 -0
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +81 -20
- 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-document.d.ts +1 -1
- package/types/apps/src/contracts/openapi.d.ts +47 -8
- package/types/apps/src/contracts/operations.d.ts +14 -7
- 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 +513 -15
- package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
- package/types/apps/src/contracts/protocols/11.d.ts +1149 -0
- package/types/apps/src/contracts/protocols/12.d.ts +3310 -0
- package/types/apps/src/contracts/protocols/13.d.ts +6001 -0
- package/types/apps/src/contracts/protocols/2.d.ts +9 -8
- package/types/apps/src/contracts/protocols/3.d.ts +73 -15
- package/types/apps/src/contracts/protocols/4.d.ts +22 -15
- package/types/apps/src/contracts/protocols/5.d.ts +37 -11
- 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 +7114 -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 +56 -0
- package/types/apps/src/contracts/router.d.ts +2 -1
- package/types/apps/src/contracts/schedules.d.ts +7 -1
- package/types/apps/src/contracts/schema.d.ts +21 -0
- package/types/apps/src/contracts/shared-catalog.d.ts +11 -0
- 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 +70 -30
- package/types/apps/src/contracts/webhooks.d.ts +24 -7
- package/types/apps/src/contracts/workflows.d.ts +56 -34
- 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 +20 -3
- package/types/apps/src/implementation/app.d.ts +41 -14
- 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 +29 -2
- package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
- package/types/apps/src/implementation/elicitation.d.ts +16 -13
- package/types/apps/src/implementation/events.d.ts +64 -0
- package/types/apps/src/implementation/failure-detail.d.ts +28 -5
- 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/help-text.d.ts +5 -0
- package/types/apps/src/implementation/input-problems.d.ts +6 -2
- package/types/apps/src/implementation/invocation-timing.d.ts +18 -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-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 +33 -5
- package/types/apps/src/implementation/openapi-document.d.ts +35 -18
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-request.d.ts +2 -1
- package/types/apps/src/implementation/openapi-source.d.ts +23 -1
- package/types/apps/src/implementation/operations.d.ts +58 -7
- 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 +20 -4
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +22 -97
- package/types/apps/src/implementation/router.d.ts +26 -6
- package/types/apps/src/implementation/schedules.d.ts +39 -8
- package/types/apps/src/implementation/schema.d.ts +148 -17
- 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 +3 -3
- 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 +38 -12
- package/types/apps/src/implementation/upstream-error.d.ts +17 -0
- package/types/apps/src/implementation/webhooks.d.ts +15 -6
- package/types/apps/src/implementation/workflow-context.d.ts +6 -2
- package/types/apps/src/implementation/workflows.d.ts +11 -4
- package/types/apps/src/index.d.ts +67 -17
- package/types/apps/src/mcp.d.ts +20 -1
- package/types/apps/src/openapi.d.ts +22 -1
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +10 -8
- package/types/apps/src/ui-serving.d.ts +1 -2
- package/types/telemetry/src/app-records.d.ts +42 -0
- package/types/telemetry/src/browser-operations.d.ts +2 -2
- 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 +3 -2
- package/types/telemetry/src/keepalive.d.ts +53 -0
- package/types/telemetry/src/layer.d.ts +10 -4
- package/types/telemetry/src/measurements.d.ts +6 -2
- package/types/telemetry/src/ownership.d.ts +60 -0
- package/types/telemetry/src/recorded-failure.d.ts +29 -0
- package/types/telemetry/src/relay.d.ts +32 -7
- package/types/telemetry/src/span-attributes.d.ts +22 -3
- package/types/telemetry/src/transport.d.ts +10 -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/legacy-keys.d.ts +20 -0
- package/types/utils/src/random-uuid.d.ts +6 -0
- package/types/utils/src/recorded-message.d.ts +18 -0
- package/types/utils/src/schema-definitions.d.ts +13 -0
- package/types/utils/src/user-facing-error.d.ts +83 -0
- package/js/chunk-27F7W2LG.js +0 -34
- package/js/chunk-4ASNKGCV.js +0 -242
- package/js/chunk-4DWF4ZWI.js +0 -1280
- package/js/chunk-57RKNWL2.js +0 -75
- package/js/chunk-6HSH75OI.js +0 -2688
- package/js/chunk-G4FT53I7.js +0 -224
- package/js/chunk-MKWZPDR6.js +0 -63
- package/js/chunk-N7YDVXYJ.js +0 -186
- package/js/chunk-NKLWZJLE.js +0 -172
- package/js/chunk-PJJ24GU7.js +0 -877
- package/js/chunk-PZB6T6KU.js +0 -19
- package/js/chunk-R3EV5FTO.js +0 -97
- package/js/chunk-S73JGVR5.js +0 -507
- package/js/chunk-TG6DOCRO.js +0 -299
- package/js/chunk-YPKG2QO5.js +0 -209
- package/js/chunk-ZQINWV4W.js +0 -630
- package/js/mcp/stdio.js +0 -128
- 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/mcp-stdio.d.ts +0 -4
- package/types/apps/src/implementation/storage.d.ts +0 -15
- package/types/apps/src/implementation/ui-watch.d.ts +0 -2
- package/types/apps/src/mcp-stdio.d.ts +0 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Host responses around app sign-in. They carry no script and never contain product credentials. */
|
|
2
|
-
import { HttpServerResponse } from "effect/
|
|
2
|
+
import { HttpServerResponse } from "effect/http";
|
|
3
3
|
import { type AppSignInId } from "../contracts/ui-auth.js";
|
|
4
4
|
/** Private app responses must not leak authentication URLs through caches or referrers. */
|
|
5
5
|
export declare const appPrivateHeaders: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Atom } from "effect/
|
|
1
|
+
import { AsyncResult, Atom } from "effect/reactivity";
|
|
2
2
|
import { type OperationReference } from "../contracts/live.js";
|
|
3
3
|
import { type Schema } from "./schema.js";
|
|
4
|
-
/** A scoped page client. Host-injected context carries only the
|
|
4
|
+
/** A scoped page client. Host-injected context carries only the version, never credentials. */
|
|
5
5
|
export declare const createAppClient: () => {
|
|
6
6
|
/** Close this client when its page or embedding owner is removed. */
|
|
7
7
|
dispose: () => Promise<void>;
|
|
@@ -12,5 +12,5 @@ export declare const createAppClient: () => {
|
|
|
12
12
|
/** Create a callable mutation with optional withOptimisticUpdate projections over mounted queries. */
|
|
13
13
|
mutation: <Input, Output>(reference: OperationReference<Input, Output, "mutation">, output: Schema<NoInfer<Output>, boolean>) => import("../client.js").AppMutation<Input, Output>;
|
|
14
14
|
/** Share a live query across mounts and reconcile optimistic changes against fresh server reads. */
|
|
15
|
-
queryAtom: <Input, Output>(reference: OperationReference<Input, Output, "query">, input: NoInfer<Input>, output: Schema<NoInfer<Output>, boolean>) => Atom.Atom<
|
|
15
|
+
queryAtom: <Input, Output>(reference: OperationReference<Input, Output, "query">, input: NoInfer<Input>, output: Schema<NoInfer<Output>, boolean>) => Atom.Atom<AsyncResult.AsyncResult<Output, unknown>>;
|
|
16
16
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retained files sit at the version's asset root. Resolving path-relative resource URLs there,
|
|
3
|
+
* instead of with `<base>`, leaves the document base as the page URL for links, history and forms.
|
|
4
|
+
*/
|
|
5
|
+
export declare const versionDocument: (html: string, version: string) => string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Inline host script: no app dependencies, credentials, or authored HTML enter its source. */
|
|
2
|
-
export declare const appFailureBootstrap:
|
|
2
|
+
export declare const appFailureBootstrap = "<script>\"use strict\";(()=>{var M=()=>{let d,w=Date.now(),m=0,g=0,f=new Map,v=/^(?:chrome|moz|safari-web)-extension:/,A=new Set([\"ResizeObserver loop completed with undelivered notifications.\",\"ResizeObserver loop limit exceeded\"]),V=new Set([\"Error\",\"TypeError\",\"ReferenceError\",\"SyntaxError\",\"RangeError\",\"URIError\",\"EvalError\",\"AggregateError\"]),b=(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},h=(e,t,i=[])=>{let r=Date.now();r-w>=6e4&&(w=r,m=0,f.clear());let a=`${e}:${t.slice(0,2e3)}`,x=f.get(a);if(x!==void 0&&r-x<1e3||m>=20){g++;return}f.set(a,r),m++,i.push({key:\"executor.ui.failure.suppressed\",value:{intValue:String(g)}}),g=0;let E=Array.from(crypto.getRandomValues(new Uint8Array(16)),s=>s.toString(16).padStart(2,\"0\")).join(\"\"),S=`${Date.now()}000000`,n,l=\"Sending error report\\u2026\",k=()=>{if(d?.open)return;let s=document.createElement(\"div\"),D=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 R=document.createElement(\"details\"),T=document.createElement(\"summary\");T.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: ${E}`,R.append(T,c),n=document.createElement(\"p\"),n.setAttribute(\"role\",\"status\"),n.textContent=l;let u=document.createElement(\"button\");u.type=\"button\",u.textContent=\"Reload page\",u.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,R,n,u,p),D.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:E,spanId:E.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=>{l=s.ok?\"Error report sent.\":\"Could not send the error report. You can copy the error details.\",n&&(n.textContent=l)},()=>{l=\"Could not send the error report. You can copy the error details.\",n&&(n.textContent=l)})};window.addEventListener(\"error\",e=>{if(e instanceof ErrorEvent){if(v.test(e.filename)||e.error===null&&e.lineno===0&&A.has(e.message))return;let t=b(e.filename,e.lineno,e.colno);e.error instanceof Error&&V.has(e.error.name)&&t.push({key:\"exception.type\",value:{stringValue:e.error.name}}),h(\"runtime\",e.error instanceof Error?e.error.stack??e.message:e.message,t)}else e.target instanceof HTMLScriptElement&&h(\"script\",`Could not load script: ${e.target.src}`,b(e.target.src))},!0),window.addEventListener(\"unhandledrejection\",e=>{let t=e.reason;h(\"rejection\",t instanceof Error?t.stack??t.message:\"An app operation failed without handling its error.\")})};M();})();</script>";
|
|
@@ -1,18 +1,44 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
import { HttpServerRequest, HttpServerResponse } from "effect/
|
|
3
|
-
import { UiForbidden, type AppUiAsset } from "../contracts/ui.js";
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { Effect, Option, Stream } from "effect";
|
|
2
|
+
import { HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
3
|
+
import { UiFailed, UiForbidden, type AppUiAsset, type AppUiRange, type AppUiStoredFile, type UiAccountNotice } from "../contracts/ui.js";
|
|
4
|
+
/**
|
|
5
|
+
* The version's public file a page path names, or a 404 for a missing file. `None` means the path
|
|
6
|
+
* is the page itself. Hosts answer files before the page's account and usage work, which a file
|
|
7
|
+
* needs none of.
|
|
8
|
+
*/
|
|
9
|
+
export declare const appFile: <E, R>(options: {
|
|
9
10
|
readonly origin: string;
|
|
10
11
|
readonly asset: (path: string) => Effect.Effect<AppUiAsset | undefined, E, R>;
|
|
11
|
-
}) => Effect.Effect<HttpServerResponse.HttpServerResponse
|
|
12
|
+
}) => Effect.Effect<Option.None<HttpServerResponse.HttpServerResponse> | Option.Some<HttpServerResponse.HttpServerResponse>, UiFailed | UiForbidden | E, HttpServerRequest.HttpServerRequest | R>;
|
|
13
|
+
/**
|
|
14
|
+
* Render an authorized version with a host-owned version watcher, for a path `appFile` left to
|
|
15
|
+
* the page. Account problems that stop the app replace its document with a page that links to
|
|
16
|
+
* their fix; others add a dismissible card.
|
|
17
|
+
*/
|
|
18
|
+
export declare const appDocument: <E, R>(options: {
|
|
19
|
+
readonly version: string;
|
|
20
|
+
/** The account IDs the page runs with, by requirement. */
|
|
21
|
+
readonly accountIds?: Readonly<Record<string, readonly string[]>> | undefined;
|
|
22
|
+
readonly accounts?: UiAccountNotice | undefined;
|
|
23
|
+
readonly asset: (path: string) => Effect.Effect<AppUiAsset | undefined, E, R>;
|
|
24
|
+
}) => Effect.Effect<HttpServerResponse.HttpServerResponse, E, R>;
|
|
25
|
+
/**
|
|
26
|
+
* A version's public file, read from the host's store. The version lists it, so bytes that
|
|
27
|
+
* are gone are a storage fault, never a missing page.
|
|
28
|
+
*/
|
|
29
|
+
export declare const storedAppFile: <E1, E2>(stored: {
|
|
30
|
+
readonly contentType: string;
|
|
31
|
+
readonly size: number;
|
|
32
|
+
readonly etag: string;
|
|
33
|
+
}, read: (range: AppUiRange | undefined) => Effect.Effect<Option.Option<{
|
|
34
|
+
readonly body: Stream.Stream<Uint8Array, E1>;
|
|
35
|
+
}>, E2>) => AppUiStoredFile;
|
|
36
|
+
/** The file a URL path names: each segment percent-decoded, or none when one does not decode. */
|
|
37
|
+
export declare const assetPath: (path: string) => Option.Option<string>;
|
|
12
38
|
/** Serve an asset only after the host has checked current access and file existence.
|
|
13
|
-
* Asset URLs name their
|
|
39
|
+
* Asset URLs name their version, so their bytes never change: the browser keeps them for a year
|
|
14
40
|
* and does not ask again. Shared proxies never store them. Revoking access stops every new request
|
|
15
41
|
* and all app data, while bytes a browser already downloaded stay in its cache.
|
|
16
|
-
* HTML remains an uncached host-rendered entry point.
|
|
42
|
+
* HTML remains an uncached host-rendered entry point; other HTML files are served as they are.
|
|
17
43
|
*/
|
|
18
|
-
export declare const appAsset: (asset: AppUiAsset | undefined, build: string, path: string) => Effect.Effect<HttpServerResponse.HttpServerResponse,
|
|
44
|
+
export declare const appAsset: (asset: AppUiAsset | undefined, build: string, path: string) => Effect.Effect<HttpServerResponse.HttpServerResponse, UiFailed, HttpServerRequest.HttpServerRequest>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UpstreamError } from "../contracts/failure.js";
|
|
2
|
+
/**
|
|
3
|
+
* A stated message is bounded where it is read, before the invocation's account secrets are known,
|
|
4
|
+
* so a cut can split a secret. Leaving the bundle replaces the part of one a shortened message
|
|
5
|
+
* ends with; see `isShortenedStated`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const boundStated: (text: string, maximum: number) => string;
|
|
8
|
+
/** Whether `boundStated` shortened this text, so it may end partway through a secret. */
|
|
9
|
+
export declare const isShortenedStated: (text: string, maximum: number) => boolean;
|
|
10
|
+
/** Whether a stated message was shortened where it was read. */
|
|
11
|
+
export declare const isShortenedUpstream: (message: string) => boolean;
|
|
12
|
+
/** A service's stated error code and message, the message bounded. */
|
|
13
|
+
export declare const statedUpstream: (code: number | string, message: string | undefined) => UpstreamError;
|
|
14
|
+
/** The error a JSON error body states, if it uses a nested error object or OAuth's format. */
|
|
15
|
+
export declare const bodyUpstreamError: (json: unknown) => UpstreamError | undefined;
|
|
16
|
+
/** The `error` and `error_description` of a Bearer challenge (RFC 6750, section 3). */
|
|
17
|
+
export declare const challengeUpstreamError: (header: string | undefined) => UpstreamError | undefined;
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
/** Native webhook dispatch. The author verifies signatures before parsing or performing side effects. */
|
|
2
2
|
import { Effect, Schema } from "effect";
|
|
3
|
-
import type { AppDefinition } from "../contracts/app.js";
|
|
4
|
-
import { HostDeclarationInvalid, HostInputInvalid, HostOperationFailed, HostOperationNotFound,
|
|
3
|
+
import type { AppDefinition, ScopedSlots } from "../contracts/app.js";
|
|
4
|
+
import { HostDeclarationInvalid, HostInputInvalid, HostOperationFailed, HostOperationNotFound, HostAccountsInvalid, HostOutputInvalid } from "../contracts/host.js";
|
|
5
5
|
import { type WebhookCommand } from "../contracts/webhook-protocol.js";
|
|
6
|
-
|
|
6
|
+
type ScopeAccounts = {
|
|
7
|
+
readonly accounts: Readonly<Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Run one hook with freshly bound context. No credentials or raw failures enter the response
|
|
11
|
+
* envelope. An app-account hook runs without a caller: its context has no `user`, whatever the
|
|
12
|
+
* invocation bound.
|
|
13
|
+
*/
|
|
7
14
|
export declare const dispatchWebhook: <Context extends {
|
|
8
15
|
readonly signal?: AbortSignal;
|
|
9
|
-
readonly
|
|
10
|
-
|
|
16
|
+
readonly app: ScopeAccounts;
|
|
17
|
+
readonly user?: ScopeAccounts;
|
|
18
|
+
}>(definition: AppDefinition<Context>, command: WebhookCommand, context: Context, slots: ScopedSlots) => Effect.Effect<Schema.Json | {
|
|
11
19
|
readonly name: string;
|
|
12
20
|
readonly account: string;
|
|
13
21
|
readonly configSchema: {
|
|
@@ -26,4 +34,5 @@ export declare const dispatchWebhook: <Context extends {
|
|
|
26
34
|
readonly [x: string]: string;
|
|
27
35
|
};
|
|
28
36
|
readonly body: string;
|
|
29
|
-
},
|
|
37
|
+
}, HostDeclarationInvalid | HostAccountsInvalid | HostOperationNotFound | HostOperationFailed | HostInputInvalid | HostOutputInvalid, never>;
|
|
38
|
+
export {};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/** Author-facing step methods delegate persistence to the host's durable engine. */
|
|
2
2
|
import { Effect } from "effect";
|
|
3
|
-
import type { AppDefinition } from "../contracts/app.js";
|
|
4
|
-
import
|
|
3
|
+
import type { AccountScope, AppDefinition } from "../contracts/app.js";
|
|
4
|
+
import type { AppRequirements } from "../contracts/context.js";
|
|
5
|
+
import { WorkflowFailure, type WorkflowContext, type WorkflowExecution, type WorkflowStepContext as AuthorStepContext } from "../contracts/workflows.js";
|
|
6
|
+
/** A step's context as the host builds it: a run without a caller has no `user`. */
|
|
7
|
+
type WorkflowStepContext = AuthorStepContext<AppRequirements, AccountScope> & Partial<Pick<AuthorStepContext, "user">>;
|
|
5
8
|
/**
|
|
6
9
|
* Preserve typed failures and cancellation. Other errors keep their name and bounded message,
|
|
7
10
|
* with the given account secrets replaced.
|
|
@@ -14,3 +17,4 @@ fresh: (stepId: string, signal: AbortSignal) => Effect.Effect<{
|
|
|
14
17
|
readonly context: WorkflowStepContext;
|
|
15
18
|
readonly secrets: readonly string[];
|
|
16
19
|
}, WorkflowFailure>, signal: AbortSignal) => Effect.Effect<WorkflowContext>;
|
|
20
|
+
export {};
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
/** Ordinary async workflow declarations, adapted once into native Effect handlers. */
|
|
2
|
-
import {
|
|
2
|
+
import type { Schema as EffectSchema } from "effect";
|
|
3
3
|
import type { AppWorkflow, WorkflowContext } from "../contracts/workflows.js";
|
|
4
|
+
import type { AppRequirements } from "../contracts/context.js";
|
|
5
|
+
import type { AccountScope } from "../contracts/app.js";
|
|
4
6
|
import { type Schema } from "./schema.js";
|
|
5
7
|
declare const NativeWorkflow: unique symbol;
|
|
8
|
+
/**
|
|
9
|
+
* The context any workflow may declare: either scope, so a run started without a caller, such as
|
|
10
|
+
* by an app schedule, declares `WorkflowContext<typeof requirements, "app">`.
|
|
11
|
+
*/
|
|
12
|
+
export type AnyWorkflowContext = WorkflowContext<AppRequirements, AccountScope>;
|
|
6
13
|
declare const HandlerContext: unique symbol;
|
|
7
14
|
/** A workflow declaration retains input/output inference and required context compatibility. */
|
|
8
|
-
export interface Workflow<Input, Output, Context extends
|
|
15
|
+
export interface Workflow<Input, Output, Context extends AnyWorkflowContext = WorkflowContext> {
|
|
9
16
|
readonly [HandlerContext]?: (context: Context) => void;
|
|
10
17
|
readonly [NativeWorkflow]: AppWorkflow<Input, Output>;
|
|
11
18
|
}
|
|
12
19
|
/** Composition view erases input only after retaining its runtime decoder. */
|
|
13
|
-
export interface WorkflowDeclaration<Context extends
|
|
20
|
+
export interface WorkflowDeclaration<Context extends AnyWorkflowContext> {
|
|
14
21
|
readonly [HandlerContext]?: (context: Context) => void;
|
|
15
22
|
readonly [NativeWorkflow]: Omit<AppWorkflow<never>, "input"> & {
|
|
16
23
|
readonly input: EffectSchema.Decoder<unknown>;
|
|
17
24
|
};
|
|
18
25
|
}
|
|
19
26
|
/** Declare durable orchestration without starting a run or performing I/O. */
|
|
20
|
-
export declare const workflow: <Input, Output, Context extends
|
|
27
|
+
export declare const workflow: <Input, Output, Context extends AnyWorkflowContext = WorkflowContext>(options: {
|
|
21
28
|
readonly input: Schema<Input, boolean>;
|
|
22
29
|
readonly output?: Schema<Output, boolean>;
|
|
23
30
|
readonly description?: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { ProviderError } from "./contracts/provider-error.js";
|
|
2
|
+
export { FetchOptionUnsupported, NetworkRefused } from "./contracts/network.js";
|
|
2
3
|
export type { AppCache, CacheLoadContext, CacheGetOptions } from "./contracts/cache.js";
|
|
3
4
|
export { CacheError } from "../../app-cache/src/contracts/cache.js";
|
|
4
5
|
/**
|
|
@@ -6,25 +7,38 @@ export { CacheError } from "../../app-cache/src/contracts/cache.js";
|
|
|
6
7
|
* exposes ordinary declarations, schema helpers and Promise operations.
|
|
7
8
|
*/
|
|
8
9
|
import { type Schema as EffectSchema } from "effect";
|
|
9
|
-
import type { WebhookContext } from "./contracts/context.js";
|
|
10
|
+
import type { AppRequirements, WebhookContext } from "./contracts/context.js";
|
|
11
|
+
import type { AccountScope } from "./contracts/app.js";
|
|
10
12
|
import { type JsonResponse as NativeResponse } from "./contracts/http.js";
|
|
11
13
|
import { type OAuth2Config as NativeOAuth2Config, type OAuth2Method as NativeOAuth2Method, type ReservedAuthorizationParam, type SecretsMethod as NativeSecretsMethod } from "./contracts/provider.js";
|
|
12
14
|
import type { Webhook as NativeWebhook } from "./contracts/webhooks.js";
|
|
13
15
|
import { type PromiseMethods } from "./implementation/authoring.js";
|
|
14
|
-
import { type
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
import { type PlacementInput, type RequestPlacements } from "./implementation/placement.js";
|
|
17
|
+
import type { Placement } from "./contracts/placement.js";
|
|
18
|
+
import type { QueryContext as NativeQueryContext } from "./contracts/context.js";
|
|
19
|
+
import { query as operationQuery, type AnyContext, type OperationOptions } from "./implementation/operations.js";
|
|
20
|
+
import { type Fields, type Infer, type ObjectSchema, type Schema, type SecretFields, type SecretObject } from "./implementation/schema.js";
|
|
21
|
+
export { DeclarationInvalid, type DeclarationIssue, type JsonObject, type JsonValue, ValidationError, } from "./contracts/schema.js";
|
|
22
|
+
export { type FieldHelp, type Fields, type Infer, type ObjectSchema, type ObjectValue, type Schema, array, boolean, json, jsonSchema, literal, number, object, record, string, plain, raw, type SecretString, } from "./implementation/schema.js";
|
|
17
23
|
export { type AccountCheckContext, type AccountCheckResult, type AccountInfo, type AccountOf, type AuthMethod, type AuthMethodData, type AuthMethods, type ManyAccounts, type Provider, type ReservedAuthorizationParam, } from "./contracts/provider.js";
|
|
18
24
|
export { defineProvider, type ProviderOptions } from "./implementation/provider.js";
|
|
25
|
+
export { base64, basic, bearer, header, t, type FieldRef, type FieldRefs, type PlacementInput, type PlacementValue, type RequestPlacements, } from "./implementation/placement.js";
|
|
26
|
+
export type { Placement };
|
|
27
|
+
export type { AccountRequest } from "./contracts/provider.js";
|
|
19
28
|
export { accountRouter } from "./implementation/account-router.js";
|
|
20
|
-
export { router, dynamicRouter, type RouterDeclaration, type RouterChild, type RouterOptions, } from "./implementation/router.js";
|
|
29
|
+
export { router, dynamicRouter, withApprovals, renameTools, type OperationChild, type OperationDeclaration, type RouterDeclaration, type RouterChild, type RouterOptions, } from "./implementation/router.js";
|
|
21
30
|
export type { RouterIcon } from "./contracts/router.js";
|
|
31
|
+
export type { AppIcon } from "./contracts/icons.js";
|
|
22
32
|
export { dynamicSkills } from "./implementation/dynamic-skills.js";
|
|
23
33
|
export type { HostedTool as OperationDescription } from "./contracts/host.js";
|
|
34
|
+
/** Account fields as app code receives them from a method declared with this schema. */
|
|
35
|
+
type AccountFields<S> = S extends ObjectSchema<infer F> ? SecretFields<F> : SecretObject<Infer<S>>;
|
|
24
36
|
/** A secrets declaration inferred from an author schema. */
|
|
25
|
-
export type SecretsMethod<Shape extends ObjectSchema<Fields>> = NativeSecretsMethod<EffectSchema.Decoder<
|
|
37
|
+
export type SecretsMethod<Shape extends ObjectSchema<Fields>> = NativeSecretsMethod<EffectSchema.Decoder<AccountFields<Shape>>>;
|
|
26
38
|
/** An OAuth declaration inferred from its author-facing response schema. */
|
|
27
|
-
export type OAuth2Method<Response extends Schema<unknown, boolean>> = NativeOAuth2Method<EffectSchema.Decoder<
|
|
39
|
+
export type OAuth2Method<Response extends Schema<unknown, boolean>> = NativeOAuth2Method<EffectSchema.Decoder<AccountFields<Response>>>;
|
|
40
|
+
/** The names of an object schema's fields, which a method's `request` can reference. */
|
|
41
|
+
type FieldNameOf<S> = S extends ObjectSchema<infer F> ? keyof F & string : never;
|
|
28
42
|
/** Default OAuth fields visible to app code. Host-only grants and clients stay private. */
|
|
29
43
|
export declare const OAuth2AccessToken: Schema<{
|
|
30
44
|
readonly access_token: string;
|
|
@@ -39,30 +53,61 @@ type WithoutReservedParams<Config> = Config extends unknown ? "authorizationPara
|
|
|
39
53
|
readonly [Key in ReservedAuthorizationParam]?: never;
|
|
40
54
|
};
|
|
41
55
|
} : Config : never;
|
|
42
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Declare a secrets method without requiring an Effect schema from the author. Give each field a
|
|
58
|
+
* `description` saying where to find its value; add a `guide` only for ordered setup,
|
|
59
|
+
* prerequisites or warnings. Both are Markdown whose links are absolute https URLs, with no HTML
|
|
60
|
+
* or images, and indentation common to their lines is removed, so a template literal can be
|
|
61
|
+
* indented. `request` says where its secret fields may be sent, such as
|
|
62
|
+
* `({ token }) => bearer(token)`; it runs once, here.
|
|
63
|
+
*/
|
|
43
64
|
export declare const secrets: <const F extends Fields>(options: {
|
|
44
65
|
readonly label: string;
|
|
66
|
+
/** Markdown the connect form shows above the fields, at most 4,000 characters. */
|
|
67
|
+
readonly guide?: string;
|
|
45
68
|
readonly fields: ObjectSchema<F>;
|
|
69
|
+
readonly request?: RequestPlacements<keyof F & string>;
|
|
46
70
|
}) => SecretsMethod<ObjectSchema<F>>;
|
|
71
|
+
/**
|
|
72
|
+
* Markdown the connect form shows where a user enters an OAuth client: where to create one at this
|
|
73
|
+
* service and what to choose there, at most 4,000 characters. Executor's own steps and the
|
|
74
|
+
* redirect URL to copy come before it. Links are absolute https URLs, with no HTML or images, and
|
|
75
|
+
* indentation common to its lines is removed.
|
|
76
|
+
*/
|
|
77
|
+
type ClientGuide = {
|
|
78
|
+
readonly clientGuide?: string;
|
|
79
|
+
};
|
|
47
80
|
/**
|
|
48
81
|
* Declare OAuth discovery/endpoints and an optional app-visible response projection.
|
|
49
82
|
* `authorizationParams` adds service-defined sign-in parameters; a declared `authorizationUrl`
|
|
50
83
|
* keeps its own query. Neither can set host-owned parameters, and each parameter appears once.
|
|
84
|
+
* `request` says where the projected secret fields may be sent, such as
|
|
85
|
+
* `({ access_token }) => bearer(access_token)`; it runs once, here.
|
|
51
86
|
*/
|
|
52
|
-
export declare function oauth2(options: OAuth2Config
|
|
53
|
-
|
|
87
|
+
export declare function oauth2(options: OAuth2Config & ClientGuide & {
|
|
88
|
+
readonly request?: RequestPlacements<"access_token">;
|
|
89
|
+
}): OAuth2Method<typeof OAuth2AccessToken>;
|
|
90
|
+
export declare function oauth2<Response extends Schema<unknown, boolean>>(options: OAuth2Config & ClientGuide & {
|
|
54
91
|
readonly response: Response;
|
|
92
|
+
readonly request?: RequestPlacements<FieldNameOf<Response>>;
|
|
55
93
|
}): OAuth2Method<Response>;
|
|
56
|
-
export type { AccountSlots } from "./contracts/app.js";
|
|
57
|
-
export type { AppRequirements, AppContext, QueryContext, MutationContext, WebhookContext, } from "./contracts/context.js";
|
|
94
|
+
export type { AccountScope, AccountSlots, WebhookAccount } from "./contracts/app.js";
|
|
95
|
+
export type { AnyScopeMutationContext, AppRequirements, AppContext, QueryContext, MutationContext, WebhookContext, } from "./contracts/context.js";
|
|
58
96
|
export { type App, type AppDefinition, defineApp } from "./implementation/app.js";
|
|
97
|
+
export { event, type EventDeclaration, type EventEmitter } from "./implementation/events.js";
|
|
98
|
+
export type { EmitOptions } from "./contracts/events.js";
|
|
59
99
|
export type { Approval, ApprovalContext, ApprovalDecision } from "./approval.js";
|
|
60
100
|
type AuthorWebhook<Member, Config, State> = Member extends object ? Omit<PromiseMethods<Member>, "config" | "state"> & {
|
|
61
101
|
readonly config: Config;
|
|
62
102
|
readonly state: State;
|
|
63
103
|
} : never;
|
|
64
104
|
/** Author lifecycle methods use async functions and share native decoded context/state types. */
|
|
65
|
-
|
|
105
|
+
/**
|
|
106
|
+
* A webhook's context names its source account's scope: one with `user` serves a user requirement
|
|
107
|
+
* (`account: { user: "x" }`), one of the `"app"` scope an app requirement (`account: { app: "x" }`)
|
|
108
|
+
* and runs without a caller.
|
|
109
|
+
*/
|
|
110
|
+
export type Webhook<Context extends WebhookContext<AppRequirements, AccountScope>, Config extends Schema<unknown, boolean>, State extends Schema<unknown, boolean>> = AuthorWebhook<NativeWebhook<Context, EffectSchema.Decoder<Infer<Config>>, EffectSchema.Decoder<Infer<State>>>, Config, State>;
|
|
66
111
|
export { ResponseDecodeError, ResponseStatusError } from "./contracts/http.js";
|
|
67
112
|
/** Native fetch-compatible response accepted at the author boundary. */
|
|
68
113
|
export type JsonResponse = PromiseMethods<NativeResponse>;
|
|
@@ -70,11 +115,16 @@ export type JsonResponse = PromiseMethods<NativeResponse>;
|
|
|
70
115
|
export declare const decodeJson: <T>(response: JsonResponse, schema: Schema<T, boolean>) => Promise<T>;
|
|
71
116
|
export { NotImplemented } from "./contracts/app.js";
|
|
72
117
|
export { ElicitationFailed, type FormElicitation, type ElicitationResponse, type Elicit, } from "./contracts/elicitation.js";
|
|
73
|
-
export {
|
|
74
|
-
|
|
75
|
-
|
|
118
|
+
export type { Sql, SqlCursor, SqlReader, SqlRow, SqlTransaction, SqlValue, } from "./contracts/sql.js";
|
|
119
|
+
/**
|
|
120
|
+
* `query(options, run)` declares a read operation. `query(name, value)` inside a method's
|
|
121
|
+
* `request` places a credential in a query parameter, such as `query("key", key)`.
|
|
122
|
+
*/
|
|
123
|
+
export declare function query(name: string, value: PlacementInput): Placement;
|
|
124
|
+
export declare function query<Input, Output, Context extends AnyContext = NativeQueryContext>(options: OperationOptions<Input, Output>, run: (context: Context, input: Input) => Promise<Output>): ReturnType<typeof operationQuery<Input, Output, Context>>;
|
|
125
|
+
export { mutation, withApproval, toolAnnotations, type Approved, type Operation, type OperationOptions, } from "./implementation/operations.js";
|
|
76
126
|
export type { OperationContext } from "./contracts/operations.js";
|
|
77
127
|
export { workflow, type Workflow, type WorkflowDeclaration } from "./implementation/workflows.js";
|
|
78
128
|
export { NonRetryableError, WorkflowFailure, type WorkflowContext, type WorkflowStepContext, type WorkflowStep, type WorkflowStepOptions, type WorkflowDuration, type WorkflowReads, type WorkflowControls, } from "./contracts/workflows.js";
|
|
79
|
-
export {
|
|
129
|
+
export { appCron, appInterval, userCron, userInterval, type ScheduleDeclaration, } from "./implementation/schedules.js";
|
|
80
130
|
export type { AppSkillSource as Skill, SkillFile } from "./contracts/skills.js";
|
package/types/apps/src/mcp.d.ts
CHANGED
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
/** HTTP MCP helpers. Requires the optional @modelcontextprotocol/sdk peer. */
|
|
2
2
|
import type { OperationKinds } from "./implementation/protocol-operations.js";
|
|
3
|
+
import type { McpHealthOptions } from "./contracts/mcp.js";
|
|
4
|
+
import type { AccountCheckContext, AuthMethods } from "./contracts/provider.js";
|
|
3
5
|
import { type McpCatalogOptions } from "./implementation/mcp-catalog.js";
|
|
4
6
|
export type { McpCatalogOptions } from "./implementation/mcp-catalog.js";
|
|
5
|
-
export { McpError, type McpToolContext, type McpToolsOptions, type McpToolResult, } from "./contracts/mcp.js";
|
|
7
|
+
export { McpCredentialsUnverified, McpError, type McpHealthOptions, type McpToolContext, type McpToolsOptions, type McpToolResult, } from "./contracts/mcp.js";
|
|
6
8
|
/**
|
|
7
9
|
* A router over a server's tools for the selected account. Its title, description and
|
|
8
10
|
* instructions come from the server. Kinds override uncertain upstream read-only hints.
|
|
9
11
|
*/
|
|
10
12
|
export declare const mcpRouter: (options: McpCatalogOptions, kinds?: OperationKinds) => Promise<import("./index.js").RouterDeclaration<unknown, unknown>>;
|
|
13
|
+
/**
|
|
14
|
+
* A provider `health` check for an MCP server. Pass the check context `health` receives, then the
|
|
15
|
+
* server's `url` and the `headers` that send the account's credentials:
|
|
16
|
+
* `health: (check) => mcpHealth(check, { url, headers: headers(check.account) })`.
|
|
17
|
+
*
|
|
18
|
+
* It connects with those headers, initializes, and reads the first page of tools, then does the
|
|
19
|
+
* same without any headers. No tool runs. The check passes only when the server accepts the account
|
|
20
|
+
* and refuses the attempt without credentials. A refused account throws `ProviderError`, as HTTP
|
|
21
|
+
* helpers do. An unreachable or unusable server throws `McpError`, and a request Executor's network
|
|
22
|
+
* refuses throws `NetworkRefused`. A server that also answers without credentials, or whose answer
|
|
23
|
+
* to that attempt is not a refusal, throws `McpCredentialsUnverified`. Each of these errors means
|
|
24
|
+
* the check could not verify the account, and the account form explains why. Send credentials only
|
|
25
|
+
* in `headers`; the attempt without them uses the same `url`. The check context's `signal` cancels
|
|
26
|
+
* both attempts, and they share one budget that ends early enough before its `deadline` to report a
|
|
27
|
+
* server that did not answer in time. `timeoutMs` can only shorten that budget.
|
|
28
|
+
*/
|
|
29
|
+
export declare const mcpHealth: <Auth extends AuthMethods>(check: AccountCheckContext<Auth>, options: McpHealthOptions) => Promise<void>;
|
|
11
30
|
export type { OperationKinds } from "./implementation/protocol-operations.js";
|
|
@@ -9,4 +9,25 @@ export { OpenapiError, isOpenapiTextMedia, openapiBinaryResultSchema, OpenapiErr
|
|
|
9
9
|
export declare const openapiRouter: (options: OpenapiToolsOptions, kinds?: OperationKinds) => Promise<import("./index.js").RouterDeclaration<unknown, unknown>>;
|
|
10
10
|
export type { OperationKinds } from "./implementation/protocol-operations.js";
|
|
11
11
|
export * from "./contracts/openapi-compile.js";
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* The names `liveOpenapiRouter` gives a document's operations, from each operation's
|
|
14
|
+
* operationId, first tag, method and path alone. It reads no document and compiles nothing.
|
|
15
|
+
*/
|
|
16
|
+
export { planOperationNames, type OperationNameInput } from "./implementation/openapi-names.js";
|
|
17
|
+
/** One operation a document declares, as `openapiOperationNames` lists it. */
|
|
18
|
+
export interface OpenapiDeclaredOperation {
|
|
19
|
+
/** The tool name `liveOpenapiRouter` gives the operation. */
|
|
20
|
+
readonly name: string;
|
|
21
|
+
/** The HTTP method, such as `GET`. */
|
|
22
|
+
readonly method: string;
|
|
23
|
+
/** The path as the document declares it. */
|
|
24
|
+
readonly path: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Every operation a document declares, in document order, with the name `liveOpenapiRouter` gives
|
|
28
|
+
* it, whether or not the router can import it. Unlike `planOperationNames`, it reads the document
|
|
29
|
+
* as the router does, references included. It rejects with `OpenapiCompileError` when the
|
|
30
|
+
* document is not one the router reads. The document is not modified.
|
|
31
|
+
*/
|
|
32
|
+
export declare const openapiOperationNames: (document: Readonly<Record<string, unknown>>) => Promise<readonly OpenapiDeclaredOperation[]>;
|
|
33
|
+
export { liveOpenapiRouter, openapiToolNames, type OpenapiSourceOptions, type OpenapiToolNamesOptions, } from "./implementation/openapi-source.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsyncResult, type Atom } from "effect/
|
|
1
|
+
import { AsyncResult, type Atom } from "effect/reactivity";
|
|
2
2
|
/** Subscribe for the component lifetime. Each mount owns and disposes its registry, including StrictMode remounts. */
|
|
3
3
|
export declare const useAppQuery: <A, E>(atom: Atom.Atom<AsyncResult.AsyncResult<A, E>>) => {
|
|
4
4
|
data: A | undefined;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type FolderSkillsOptions, type GitHubSkillsOptions, type SkillReaderOptions, type WellKnownSkillsOptions, type SkillFile } from "./contracts/skills.js";
|
|
2
|
-
export { SkillLoadFailed, SkillDefinitionInvalid, SkillServiceName, type SkillReaderOptions, type FolderSkillsOptions, type AppSkillSource as Skill, type SkillFile, type GitHubSkillsOptions, type SkillCacheOptions, type WellKnownSkillsOptions, } from "./contracts/skills.js";
|
|
2
|
+
export { SkillLoadFailed, SkillDefinitionInvalid, SkillServiceName, type SkillReaderOptions, type FolderSkillsOptions, type AppSkillSource as Skill, type SkillFile, type GitHubSkillsAccount, type GitHubSkillsOptions, type SkillCacheOptions, type WellKnownSkillsOptions, } from "./contracts/skills.js";
|
|
3
3
|
/**
|
|
4
|
-
* Fetch a
|
|
5
|
-
* the catalog; without it, mutable refs resolve
|
|
4
|
+
* Fetch a GitHub skill collection from one resolved commit. A private repository takes `account`
|
|
5
|
+
* and its `token`. Pass `cache: ctx.cache` to reuse the catalog; without it, mutable refs resolve
|
|
6
|
+
* again on each call.
|
|
6
7
|
*/
|
|
7
8
|
export declare const githubSkills: (options: GitHubSkillsOptions) => Promise<readonly {
|
|
8
|
-
readonly name: string;
|
|
9
9
|
readonly description: string;
|
|
10
|
+
readonly name: string;
|
|
10
11
|
readonly files: readonly {
|
|
11
12
|
readonly path: string;
|
|
12
13
|
readonly content: string;
|
|
@@ -20,8 +21,8 @@ export declare const githubSkills: (options: GitHubSkillsOptions) => Promise<rea
|
|
|
20
21
|
}[]>;
|
|
21
22
|
/** Fetch a published skill index and its text files. Pass `cache: ctx.cache` to reuse the catalog. */
|
|
22
23
|
export declare const wellKnownSkills: (options: WellKnownSkillsOptions) => Promise<readonly {
|
|
23
|
-
readonly name: string;
|
|
24
24
|
readonly description: string;
|
|
25
|
+
readonly name: string;
|
|
25
26
|
readonly files: readonly {
|
|
26
27
|
readonly path: string;
|
|
27
28
|
readonly content: string;
|
|
@@ -35,8 +36,8 @@ export declare const wellKnownSkills: (options: WellKnownSkillsOptions) => Promi
|
|
|
35
36
|
}[]>;
|
|
36
37
|
/** Parse a bundled standard skill directory into an app capability. */
|
|
37
38
|
export declare const fileSkill: (files: readonly SkillFile[]) => Promise<{
|
|
38
|
-
readonly name: string;
|
|
39
39
|
readonly description: string;
|
|
40
|
+
readonly name: string;
|
|
40
41
|
readonly files: readonly {
|
|
41
42
|
readonly path: string;
|
|
42
43
|
readonly content: string;
|
|
@@ -50,8 +51,8 @@ export declare const fileSkill: (files: readonly SkillFile[]) => Promise<{
|
|
|
50
51
|
}>;
|
|
51
52
|
/** Read skill directories from ctx.files. Omitted path selects skills/; missing folders return []. */
|
|
52
53
|
export declare const folderSkills: (options: FolderSkillsOptions) => Promise<readonly {
|
|
53
|
-
readonly name: string;
|
|
54
54
|
readonly description: string;
|
|
55
|
+
readonly name: string;
|
|
55
56
|
readonly files: readonly {
|
|
56
57
|
readonly path: string;
|
|
57
58
|
readonly content: string;
|
|
@@ -65,7 +66,8 @@ export declare const folderSkills: (options: FolderSkillsOptions) => Promise<rea
|
|
|
65
66
|
}[]>;
|
|
66
67
|
/**
|
|
67
68
|
* Read files for a custom remote skill loader, such as one for GitLab. Reads share one byte
|
|
68
|
-
* budget and reject with the same safe SkillLoadFailed errors as githubSkills, naming `service
|
|
69
|
+
* budget and reject with the same safe SkillLoadFailed errors as githubSkills, naming `service`,
|
|
70
|
+
* or with `NetworkRefused` when Executor's network refuses a request.
|
|
69
71
|
*/
|
|
70
72
|
export declare const skillReader: (options: SkillReaderOptions) => {
|
|
71
73
|
/** Fetch one UTF-8 text file. */
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
/** Host-only rendering utilities; the host supplies authorized retained assets. */
|
|
2
|
-
export { appDocument, appAsset } from "./implementation/ui-serving.js";
|
|
3
|
-
export { appWatchScript } from "./implementation/ui-watch.js";
|
|
2
|
+
export { appDocument, appAsset, appFile, assetPath, storedAppFile, } from "./implementation/ui-serving.js";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the host keeps of the spans and logs an app isolate returns.
|
|
3
|
+
*
|
|
4
|
+
* Those records come from whatever framework the app's build bundles, and the app's own code runs
|
|
5
|
+
* in the same isolate: it can throw any text, name its errors and codes, and rewrite every record
|
|
6
|
+
* before the isolate returns it. So the host does not filter the records it receives. It builds
|
|
7
|
+
* new ones from a closed vocabulary: the framework's span names, attributes whose values are
|
|
8
|
+
* closed sets, counts and status codes, and each exception's kind. Ids, parents and timings are
|
|
9
|
+
* kept. Everything else, including events other than exceptions, links, status and exception
|
|
10
|
+
* messages, stacks and log bodies, is dropped or replaced with a fixed sentence.
|
|
11
|
+
*
|
|
12
|
+
* The vocabulary is the framework's (`packages/apps`, `app-cache`, `app-data`): host request
|
|
13
|
+
* operations, failure sources and reasons, MCP and cache attributes. A name or value outside it is
|
|
14
|
+
* recorded as `unrecognized` or not at all. `bun run check` (`scripts/check-app-telemetry.ts`)
|
|
15
|
+
* fails when the framework names a span or sets an attribute key this vocabulary does not know.
|
|
16
|
+
*/
|
|
17
|
+
import type { Schema } from "effect";
|
|
18
|
+
type Json = Schema.Json;
|
|
19
|
+
type JsonObject = {
|
|
20
|
+
readonly [key: string]: Json;
|
|
21
|
+
};
|
|
22
|
+
/** What an exception message, stack or log body from an app isolate records instead. */
|
|
23
|
+
export declare const appText = "Text from the app is not recorded";
|
|
24
|
+
/** The framework's span names, and the libraries' spans it runs. */
|
|
25
|
+
export declare const appSpanNames: ReadonlySet<string>;
|
|
26
|
+
export declare const appSpanAttributeKeys: ReadonlySet<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Attributes the framework sets whose values the app chooses, such as its tool names, so the host
|
|
29
|
+
* drops them. `scripts/check-app-telemetry.ts` fails on a framework attribute in neither set.
|
|
30
|
+
*/
|
|
31
|
+
export declare const droppedAppAttributeKeys: ReadonlySet<string>;
|
|
32
|
+
/** The span the host records for one an app isolate returned, or nothing without its timings. */
|
|
33
|
+
export declare const appSpan: (span: JsonObject & {
|
|
34
|
+
readonly traceId: string;
|
|
35
|
+
readonly spanId: string;
|
|
36
|
+
}) => JsonObject | undefined;
|
|
37
|
+
/** The log record the host records for one an app isolate returned. */
|
|
38
|
+
export declare const appLog: (log: JsonObject & {
|
|
39
|
+
readonly traceId?: string | undefined;
|
|
40
|
+
readonly spanId?: string | undefined;
|
|
41
|
+
}) => JsonObject;
|
|
42
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Correlate transport and decoded outcomes without exporting response bodies or errors. */
|
|
2
2
|
import { Effect, Schema, Tracer } from "effect";
|
|
3
|
-
import { HttpClient, HttpClientError } from "effect/
|
|
3
|
+
import { HttpClient, HttpClientError } from "effect/http";
|
|
4
4
|
/**
|
|
5
5
|
* A random identity for the current browser document. It is never an authentication or user
|
|
6
6
|
* identifier. Server renders have no document, so they get none instead of sharing one per isolate.
|
|
@@ -8,7 +8,7 @@ import { HttpClient, HttpClientError } from "effect/unstable/http";
|
|
|
8
8
|
export declare const browserPageId: () => string | undefined;
|
|
9
9
|
/** Safe event shared with the host's error reporter and product analytics. */
|
|
10
10
|
export declare const BrowserOperationFailure: Schema.Struct<{
|
|
11
|
-
readonly error_type: Schema.Literals<readonly ["BrowserDecodeFailed", "BrowserTransportFailed", "BrowserOperationFailed"]>;
|
|
11
|
+
readonly error_type: Schema.Literals<readonly ["BrowserDecodeFailed", "BrowserConnectionFailed", "BrowserTransportFailed", "BrowserOperationFailed"]>;
|
|
12
12
|
readonly trace_id: Schema.String;
|
|
13
13
|
readonly span_id: Schema.String;
|
|
14
14
|
readonly page_id: Schema.String;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
/** Browser-owned Effect telemetry, shared by Promise calls and Atom runtimes. */
|
|
2
2
|
import { Context, Effect, Layer, ManagedRuntime } from "effect";
|
|
3
|
-
import { OtlpExporter } from "effect/
|
|
4
|
-
import { Atom } from "effect/
|
|
3
|
+
import { OtlpExporter } from "effect/observability";
|
|
4
|
+
import { Atom } from "effect/reactivity";
|
|
5
5
|
import type { TelemetryConfig } from "./config.js";
|
|
6
6
|
declare const BrowserTelemetry_base: Context.ServiceClass<BrowserTelemetry, "executor/BrowserTelemetry", {
|
|
7
|
+
/**
|
|
8
|
+
* `load` names the document's initial route without a span: hydration resolves no route
|
|
9
|
+
* change, and first load is measured by the vitals. `start` opens a `ui.navigation` span
|
|
10
|
+
* that the router's next `end` closes or the next `start` interrupts.
|
|
11
|
+
*/
|
|
7
12
|
readonly navigation: (event: {
|
|
8
|
-
readonly type: "start";
|
|
13
|
+
readonly type: "load" | "start";
|
|
9
14
|
readonly path: string;
|
|
10
15
|
} | {
|
|
11
16
|
readonly type: "end";
|
|
@@ -33,8 +33,8 @@ export declare const TelemetryConfig: Schema.Struct<{
|
|
|
33
33
|
export type TelemetryConfig = typeof TelemetryConfig.Type;
|
|
34
34
|
/** Host-only destinations; never copied into an app's invocation telemetry capability. */
|
|
35
35
|
export declare const CurrentTelemetryConfig: Context.Reference<{
|
|
36
|
-
readonly version: string;
|
|
37
36
|
readonly service: string;
|
|
37
|
+
readonly version: string;
|
|
38
38
|
readonly environment: string;
|
|
39
39
|
readonly clock?: "system" | "cloudflare-io" | undefined;
|
|
40
40
|
readonly traces?: {
|
|
@@ -59,8 +59,8 @@ export declare const CurrentTelemetryConfig: Context.Reference<{
|
|
|
59
59
|
} | undefined>;
|
|
60
60
|
/** Read OTLP endpoints uniformly for all signals; development chooses which signals to configure. */
|
|
61
61
|
export declare const telemetryConfig: (service: string) => Effect.Effect<{
|
|
62
|
-
readonly version: string;
|
|
63
62
|
readonly service: string;
|
|
63
|
+
readonly version: string;
|
|
64
64
|
readonly environment: string;
|
|
65
65
|
readonly clock?: "system" | "cloudflare-io" | undefined;
|
|
66
66
|
readonly traces?: {
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
export { CurrentTelemetryConfig, TelemetryConfig, TelemetryTarget, telemetryConfig, } from "./config.js";
|
|
3
3
|
export { telemetryLayer, telemetryFromConfig } from "./layer.js";
|
|
4
4
|
export { captureTelemetry, traceHeaders, withRemoteSpan, invocationFetch, type InvocationTelemetry, } from "./context.js";
|
|
5
|
-
export { collectTelemetry, forwardTelemetry, makeTelemetryForwarder, TelemetryBatch, } from "./relay.js";
|
|
5
|
+
export { collectTelemetry, forwardTelemetry, makeTelemetryForwarder, TelemetryDrainScope, TelemetryWaitReport, type TelemetryWait, TelemetryBatch, } from "./relay.js";
|
|
6
6
|
export { TraceContext, currentTraceContext, externalTrace, traceLinks } from "./trace-context.js";
|
|
7
7
|
export { pendingSpan } from "./pending-span.js";
|
|
8
|
+
export { makeOwnershipAccounting, measuredSpan, owned, ownedBy, ownerAttribute, type Owner, type SpanMeasure, } from "./ownership.js";
|
|
8
9
|
export { recordWorkerMeasurements } from "./measurements.js";
|
|
9
|
-
export { allowlistedSpans, httpSpanAttributeAllowlist, spanAttributeAllowed, } from "./span-attributes.js";
|
|
10
|
+
export { allowlistedSpans, httpSpanAttributeAllowlist, recordRoute, routeTemplates, spanAttributeAllowed, } from "./span-attributes.js";
|