apps 1.0.0-beta.3 → 2.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -48
- package/check-publish.mjs +7 -0
- package/package.json +27 -56
- package/src/Access.ts +37 -0
- package/src/Accounts.ts +468 -0
- package/src/App.ts +11 -0
- package/src/Ask.ts +156 -0
- package/src/Changes.ts +13 -0
- package/src/Http.ts +30 -0
- package/src/Provider.ts +146 -0
- package/src/Session.ts +52 -0
- package/src/Settings.ts +164 -0
- package/src/contract.ts +852 -0
- package/src/css-modules.d.ts +2 -0
- package/src/desktop/Desktop.ts +192 -0
- package/src/desktop/bridge.ts +62 -0
- package/src/desktop/errors.ts +88 -0
- package/src/desktop/index.ts +15 -0
- package/src/entry.ts +48 -0
- package/src/index.ts +16 -4
- package/src/internal/defects.ts +62 -0
- package/src/internal/files.ts +369 -0
- package/src/internal/host.ts +17 -0
- package/src/internal/query.ts +114 -0
- package/src/internal/records.ts +838 -0
- package/src/internal/retention.ts +87 -0
- package/src/internal/retries.ts +185 -0
- package/src/internal/telemetry.ts +167 -0
- package/src/migrations.ts +110 -0
- package/src/page/Accounts.ts +27 -0
- package/src/page/Changes.ts +126 -0
- package/src/page/Session.ts +46 -0
- package/src/page/client.ts +107 -0
- package/src/page/errors.ts +15 -0
- package/src/page/http.ts +21 -0
- package/src/page/index.ts +18 -0
- package/src/page/paths.ts +22 -0
- package/src/providers/anthropic.ts +26 -0
- package/src/providers/github.ts +49 -0
- package/src/providers/google.ts +67 -0
- package/src/providers/openai.ts +62 -0
- package/src/providers/slack.ts +81 -0
- package/src/runtime.ts +1540 -0
- package/src/testing.ts +660 -0
- package/src/text-modules.d.ts +5 -0
- package/src/theme.css +50 -0
- package/dist/authoring/index.d.ts +0 -393
- package/dist/authoring/index.js +0 -36
- package/dist/chunk-4OZFMCTT.js +0 -17
- package/dist/chunk-A3H32P2J.js +0 -143
- package/dist/chunk-B7NEUIJL.js +0 -14
- package/dist/chunk-F7GZYEAC.js +0 -41
- package/dist/chunk-MUFMJRXR.js +0 -308
- package/dist/chunk-S5KFP4JQ.js +0 -20
- package/dist/chunk-Y6LLTN7W.js +0 -99
- package/dist/chunk-YUZ4TXOY.js +0 -27
- package/dist/http/index.d.ts +0 -9
- package/dist/http/index.js +0 -6
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -48
- package/dist/manifest/contract.d.ts +0 -63
- package/dist/manifest/contract.js +0 -8
- package/dist/manifest/index.d.ts +0 -20
- package/dist/manifest/index.js +0 -16
- package/dist/mcp/client.d.ts +0 -9
- package/dist/mcp/index.d.ts +0 -11
- package/dist/mcp/index.js +0 -7
- package/dist/openapi/index.d.ts +0 -14
- package/dist/openapi/index.js +0 -7
- package/dist/openapi/mapper.d.ts +0 -7
- package/dist/runner/index.d.ts +0 -4
- package/dist/runner/index.js +0 -66
- package/dist/runner/protocol.d.ts +0 -33
- package/dist/runner/protocol.js +0 -8
- package/dist/runtime/index.d.ts +0 -83
- package/dist/runtime/index.js +0 -12
- package/dist/workerd/index.d.ts +0 -7
- package/dist/workerd/index.js +0 -10
- package/src/authoring/index.ts +0 -658
- package/src/http/index.ts +0 -26
- package/src/manifest/contract.ts +0 -64
- package/src/manifest/index.ts +0 -156
- package/src/mcp/client.ts +0 -59
- package/src/mcp/index.ts +0 -42
- package/src/openapi/index.ts +0 -70
- package/src/openapi/mapper.ts +0 -25
- package/src/runner/index.ts +0 -80
- package/src/runner/protocol.ts +0 -54
- package/src/runtime/index.ts +0 -550
- package/src/workerd/index.ts +0 -17
package/dist/mcp/client.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** Stub-contract MCP client used by the fromMCP dynamic pair. */
|
|
2
|
-
import type { AuthComposeFn, DiscoveredToolSpec, OperationSelection } from "../authoring/index";
|
|
3
|
-
/** Normalize authored placement, or apply MCP's bearer default. */
|
|
4
|
-
export declare const composePlacement: (auth: AuthComposeFn<never> | undefined, ctx: unknown) => {
|
|
5
|
-
headers: Headers;
|
|
6
|
-
searchParams: URLSearchParams;
|
|
7
|
-
};
|
|
8
|
-
export declare const mcpDiscover: (_endpoint: string, _ctx: unknown, _auth: AuthComposeFn<never> | undefined, _operations: OperationSelection | undefined) => Promise<readonly DiscoveredToolSpec[]>;
|
|
9
|
-
export declare const mcpCall: (_endpoint: string, _tool: string, _input: unknown, _ctx: unknown, _auth: AuthComposeFn<never> | undefined) => Promise<unknown>;
|
package/dist/mcp/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** fromMCP sugar over the authored dynamic-tools primitive. */
|
|
2
|
-
import { type AuthComposeFn, type DynamicToolSet, type OperationSelection, type Requirement } from "../authoring/index";
|
|
3
|
-
export type FromMCPOptions<Reqs extends Readonly<Record<string, Requirement>>> = {
|
|
4
|
-
readonly requirements: Reqs;
|
|
5
|
-
readonly auth?: AuthComposeFn<NoInfer<Reqs>>;
|
|
6
|
-
readonly operations?: OperationSelection;
|
|
7
|
-
};
|
|
8
|
-
export declare function fromMCP<const Reqs extends Readonly<Record<string, Requirement>>>(endpoint: string, options: FromMCPOptions<Reqs>): DynamicToolSet;
|
|
9
|
-
export declare function fromMCP(endpoint: string, options?: {
|
|
10
|
-
readonly operations?: OperationSelection;
|
|
11
|
-
}): DynamicToolSet;
|
package/dist/mcp/index.js
DELETED
package/dist/openapi/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/** fromOpenAPI sugar over the authored dynamic-tools primitive. */
|
|
2
|
-
import { type AuthComposeFn, type DynamicToolSet, type OperationSelection, type Requirement, type RequiresAuthCompose } from "../authoring/index";
|
|
3
|
-
export type FromOpenAPIOptions<Reqs extends Readonly<Record<string, Requirement>>> = {
|
|
4
|
-
readonly requirements: Reqs;
|
|
5
|
-
readonly auth?: AuthComposeFn<NoInfer<Reqs>>;
|
|
6
|
-
readonly operations?: OperationSelection;
|
|
7
|
-
} & (RequiresAuthCompose<Reqs> extends true ? {
|
|
8
|
-
readonly auth: AuthComposeFn<NoInfer<Reqs>>;
|
|
9
|
-
} : unknown);
|
|
10
|
-
export type OpenAPIDocumentInput = string | Readonly<Record<string, unknown>>;
|
|
11
|
-
export declare function fromOpenAPI<const Reqs extends Readonly<Record<string, Requirement>>>(spec: OpenAPIDocumentInput, options: FromOpenAPIOptions<Reqs>): DynamicToolSet;
|
|
12
|
-
export declare function fromOpenAPI(spec: OpenAPIDocumentInput, options?: {
|
|
13
|
-
readonly operations?: OperationSelection;
|
|
14
|
-
}): DynamicToolSet;
|
package/dist/openapi/index.js
DELETED
package/dist/openapi/mapper.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/** Stub-contract OpenAPI discovery and call mapper. */
|
|
2
|
-
import type { AuthComposeFn, DiscoveredToolSpec, OperationSelection } from "../authoring/index";
|
|
3
|
-
export declare const openapiDiscover: (_spec: string | Readonly<Record<string, unknown>>, _ctx: unknown, _auth: AuthComposeFn<never> | undefined, _operations: OperationSelection | undefined) => Promise<readonly DiscoveredToolSpec[]>;
|
|
4
|
-
export declare const openapiCall: (_tool: {
|
|
5
|
-
readonly name: string;
|
|
6
|
-
readonly detail: unknown;
|
|
7
|
-
}, _input: unknown, _ctx: unknown, _auth: AuthComposeFn<never> | undefined) => Promise<unknown>;
|
package/dist/runner/index.d.ts
DELETED
package/dist/runner/index.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
loadApp
|
|
3
|
-
} from "../chunk-Y6LLTN7W.js";
|
|
4
|
-
import {
|
|
5
|
-
callTool,
|
|
6
|
-
discoverTool
|
|
7
|
-
} from "../chunk-MUFMJRXR.js";
|
|
8
|
-
import "../chunk-B7NEUIJL.js";
|
|
9
|
-
import {
|
|
10
|
-
CallError,
|
|
11
|
-
DiscoverError
|
|
12
|
-
} from "../chunk-4OZFMCTT.js";
|
|
13
|
-
import "../chunk-A3H32P2J.js";
|
|
14
|
-
|
|
15
|
-
// src/runner/index.ts
|
|
16
|
-
import { Effect } from "effect";
|
|
17
|
-
var localRunner = (appDir) => {
|
|
18
|
-
let cachedLoad;
|
|
19
|
-
const loaded = () => Effect.suspend(() => {
|
|
20
|
-
if (cachedLoad !== void 0) return cachedLoad;
|
|
21
|
-
return Effect.flatMap(
|
|
22
|
-
Effect.cached(loadApp(appDir)),
|
|
23
|
-
(effect) => Effect.sync(() => {
|
|
24
|
-
cachedLoad = effect;
|
|
25
|
-
return effect;
|
|
26
|
-
}).pipe(Effect.flatten)
|
|
27
|
-
);
|
|
28
|
-
});
|
|
29
|
-
const registryFor = (target) => loaded().pipe(
|
|
30
|
-
Effect.map(({ registry }) => registry),
|
|
31
|
-
Effect.mapError(
|
|
32
|
-
(error) => new CallError({
|
|
33
|
-
target,
|
|
34
|
-
kind: "handler",
|
|
35
|
-
reason: `app failed to load (${error.message})`
|
|
36
|
-
})
|
|
37
|
-
)
|
|
38
|
-
);
|
|
39
|
-
const settle = (target, outcome) => outcome.ok ? Effect.succeed(outcome.value) : Effect.fail(new CallError({
|
|
40
|
-
target,
|
|
41
|
-
kind: outcome.kind,
|
|
42
|
-
reason: outcome.reason
|
|
43
|
-
}));
|
|
44
|
-
const settleDiscovery = (segment, outcome) => outcome.ok ? Effect.succeed(outcome.value) : Effect.fail(new DiscoverError({ segment, reason: outcome.reason }));
|
|
45
|
-
return {
|
|
46
|
-
manifest: () => Effect.map(loaded(), ({ result }) => result),
|
|
47
|
-
call: (address, input, ctx, detail) => registryFor(address).pipe(
|
|
48
|
-
Effect.flatMap(
|
|
49
|
-
(registry) => Effect.promise(() => callTool(registry, address, input, ctx, detail))
|
|
50
|
-
),
|
|
51
|
-
Effect.flatMap((outcome) => settle(address, outcome))
|
|
52
|
-
),
|
|
53
|
-
discover: (segment, ctx) => registryFor(segment).pipe(
|
|
54
|
-
Effect.mapError((error) => new DiscoverError({ segment, reason: error.reason })),
|
|
55
|
-
Effect.flatMap(
|
|
56
|
-
(registry) => Effect.promise(() => discoverTool(registry, segment, ctx))
|
|
57
|
-
),
|
|
58
|
-
Effect.flatMap((outcome) => settleDiscovery(segment, outcome))
|
|
59
|
-
)
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
export {
|
|
63
|
-
CallError,
|
|
64
|
-
DiscoverError,
|
|
65
|
-
localRunner
|
|
66
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { type Effect, FileSystem } from "effect";
|
|
2
|
-
import type { AppManifestResult, PublishError } from "../manifest/contract";
|
|
3
|
-
import type { CallFailureKind, DiscoveredTool, ToolCtx } from "../runtime/index";
|
|
4
|
-
export type { DiscoveredTool, ToolCtx, ToolCtxEntry, ToolDescriptor, } from "../runtime/index";
|
|
5
|
-
/** Which invocation phase failed. */
|
|
6
|
-
export type CallErrorKind = CallFailureKind;
|
|
7
|
-
declare const CallError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
8
|
-
readonly _tag: "CallError";
|
|
9
|
-
} & Readonly<A>;
|
|
10
|
-
/** A runner operation failure associated with its target and phase. */
|
|
11
|
-
export declare class CallError extends CallError_base<{
|
|
12
|
-
readonly target: string;
|
|
13
|
-
readonly kind: CallErrorKind;
|
|
14
|
-
readonly reason: string;
|
|
15
|
-
}> {
|
|
16
|
-
get message(): string;
|
|
17
|
-
}
|
|
18
|
-
declare const DiscoverError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
19
|
-
readonly _tag: "DiscoverError";
|
|
20
|
-
} & Readonly<A>;
|
|
21
|
-
/** A discovery failure associated with one dynamic segment. */
|
|
22
|
-
export declare class DiscoverError extends DiscoverError_base<{
|
|
23
|
-
readonly segment: string;
|
|
24
|
-
readonly reason: string;
|
|
25
|
-
}> {
|
|
26
|
-
get message(): string;
|
|
27
|
-
}
|
|
28
|
-
/** The platform protocol implemented by an app execution environment. */
|
|
29
|
-
export interface AppRunner {
|
|
30
|
-
manifest(): Effect.Effect<AppManifestResult, PublishError, FileSystem.FileSystem>;
|
|
31
|
-
call(address: string, input: unknown, ctx: ToolCtx, detail?: unknown): Effect.Effect<unknown, CallError, FileSystem.FileSystem>;
|
|
32
|
-
discover(segment: string, ctx: ToolCtx): Effect.Effect<readonly DiscoveredTool[], DiscoverError, FileSystem.FileSystem>;
|
|
33
|
-
}
|
package/dist/runner/protocol.js
DELETED
package/dist/runtime/index.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The execution core: everything that happens after authored modules
|
|
3
|
-
* load, in any environment. Project a registry into its deterministic
|
|
4
|
-
* manifest, validate a call's input, run the handler, shape the
|
|
5
|
-
* outcome. There is exactly one implementation of this logic; the
|
|
6
|
-
* local runner and the sandboxed workerd guest are both thin doors
|
|
7
|
-
* onto this module.
|
|
8
|
-
*
|
|
9
|
-
* Deliberately dependency-free (no effect, no node builtins): this
|
|
10
|
-
* module bundles into sandboxed guests, where every dependency is
|
|
11
|
-
* paid on each cold start. Digesting uses WebCrypto, which node, bun,
|
|
12
|
-
* and workerd all provide.
|
|
13
|
-
*/
|
|
14
|
-
import type { Registry } from "../authoring/index";
|
|
15
|
-
import type { AppManifestResult, JsonSchemaObject } from "../manifest/contract";
|
|
16
|
-
/** The capability exposed to one tool requirement role. */
|
|
17
|
-
export interface ToolCtxEntry {
|
|
18
|
-
readonly grant: string;
|
|
19
|
-
readonly kind: "bearer" | "basic" | "secrets" | "oauth";
|
|
20
|
-
readonly token?: string;
|
|
21
|
-
readonly username?: string;
|
|
22
|
-
readonly password?: string;
|
|
23
|
-
readonly secrets?: Readonly<Record<string, string>>;
|
|
24
|
-
fetch(path: string, init?: RequestInit): Promise<Response>;
|
|
25
|
-
}
|
|
26
|
-
/** Tool capabilities keyed by requirement role. */
|
|
27
|
-
export type ToolCtx = Readonly<Record<string, ToolCtxEntry>>;
|
|
28
|
-
/** A manifest projection: the app's deterministic description, or why not. */
|
|
29
|
-
export type ManifestOutcome = {
|
|
30
|
-
readonly ok: true;
|
|
31
|
-
readonly result: AppManifestResult;
|
|
32
|
-
} | {
|
|
33
|
-
readonly ok: false;
|
|
34
|
-
readonly problems: readonly string[];
|
|
35
|
-
};
|
|
36
|
-
/** Which invocation phase failed. */
|
|
37
|
-
export type CallFailureKind = "input" | "handler";
|
|
38
|
-
/** One tool invocation's result envelope. */
|
|
39
|
-
export type CallOutcome = {
|
|
40
|
-
readonly ok: true;
|
|
41
|
-
readonly value: unknown;
|
|
42
|
-
} | {
|
|
43
|
-
readonly ok: false;
|
|
44
|
-
readonly kind: CallFailureKind;
|
|
45
|
-
readonly reason: string;
|
|
46
|
-
};
|
|
47
|
-
/** Agent-facing descriptor compiled from one discovery result. */
|
|
48
|
-
export interface ToolDescriptor {
|
|
49
|
-
readonly description: string;
|
|
50
|
-
readonly inputSchema: JsonSchemaObject;
|
|
51
|
-
readonly annotations: {
|
|
52
|
-
readonly readOnly?: boolean;
|
|
53
|
-
readonly destructive?: boolean;
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
/** One tool emitted by a dynamic segment discovery. */
|
|
57
|
-
export interface DiscoveredTool {
|
|
58
|
-
readonly segment: string;
|
|
59
|
-
readonly name: string;
|
|
60
|
-
readonly descriptor: ToolDescriptor;
|
|
61
|
-
readonly detail: unknown;
|
|
62
|
-
}
|
|
63
|
-
/** One dynamic discovery result envelope. */
|
|
64
|
-
export type DiscoverOutcome = {
|
|
65
|
-
readonly ok: true;
|
|
66
|
-
readonly value: readonly DiscoveredTool[];
|
|
67
|
-
} | {
|
|
68
|
-
readonly ok: false;
|
|
69
|
-
readonly reason: string;
|
|
70
|
-
};
|
|
71
|
-
type InputSchemaCompilation = {
|
|
72
|
-
readonly value: JsonSchemaObject;
|
|
73
|
-
} | {
|
|
74
|
-
readonly problem: string;
|
|
75
|
-
};
|
|
76
|
-
export declare const compileInputSchema: (input: object, where: string) => InputSchemaCompilation;
|
|
77
|
-
/** Project a loaded registry into the app's deterministic manifest. */
|
|
78
|
-
export declare const manifestOf: (registry: Registry) => Promise<ManifestOutcome>;
|
|
79
|
-
/** Validate input and run one static or dynamic tool handler. */
|
|
80
|
-
export declare const callTool: (registry: Registry, address: string, input: unknown, ctx: ToolCtx, detail?: unknown) => Promise<CallOutcome>;
|
|
81
|
-
/** Discover and compile one dynamic segment. */
|
|
82
|
-
export declare const discoverTool: (registry: Registry, segment: string, ctx: ToolCtx) => Promise<DiscoverOutcome>;
|
|
83
|
-
export {};
|
package/dist/runtime/index.js
DELETED
package/dist/workerd/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The execution core re-exported for sandboxed guests. A generated
|
|
3
|
-
* guest module imports the authored files (filling the registry) and
|
|
4
|
-
* exposes these verbs over RPC; the logic itself lives in ../runtime
|
|
5
|
-
* and is identical to what the local runner executes. @internal
|
|
6
|
-
*/
|
|
7
|
-
export { callTool, discoverTool, manifestOf, type CallOutcome, type DiscoverOutcome, type DiscoveredTool, type ManifestOutcome, type ToolCtx, type ToolCtxEntry, } from "../runtime/index";
|