apps 0.8.3 → 1.0.0-beta.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.
Files changed (49) hide show
  1. package/README.md +51 -166
  2. package/dist/authoring/index.d.ts +205 -0
  3. package/dist/authoring/index.js +26 -0
  4. package/dist/index-8wmxmfhc.js +90 -0
  5. package/dist/index-dh4z81es.js +10 -0
  6. package/dist/index-mcjwntr2.js +13 -0
  7. package/dist/index-wfngzvv2.js +228 -0
  8. package/dist/index.d.ts +9 -0
  9. package/dist/index.js +26 -0
  10. package/dist/manifest/collect.d.ts +64 -0
  11. package/dist/manifest/contract.d.ts +55 -0
  12. package/dist/manifest/contract.js +8 -0
  13. package/dist/manifest/index.d.ts +18 -0
  14. package/dist/manifest/index.js +15 -0
  15. package/dist/runner/index.d.ts +4 -0
  16. package/dist/runner/index.js +61 -0
  17. package/dist/runner/protocol.d.ts +28 -0
  18. package/dist/runner/protocol.js +6 -0
  19. package/dist/workerd/index.d.ts +2 -0
  20. package/dist/workerd/index.js +3 -0
  21. package/package.json +49 -36
  22. package/src/authoring/index.ts +340 -0
  23. package/src/index.ts +9 -0
  24. package/src/manifest/collect.ts +198 -0
  25. package/src/manifest/contract.ts +55 -0
  26. package/src/manifest/index.ts +224 -0
  27. package/src/runner/index.ts +117 -0
  28. package/src/runner/protocol.ts +41 -0
  29. package/src/workerd/index.ts +2 -0
  30. package/.npmignore +0 -1
  31. package/bin/apps +0 -36
  32. package/bin/build +0 -14
  33. package/bin/doc +0 -16
  34. package/dist/app.js +0 -9773
  35. package/dist/app.min.js +0 -5
  36. package/dist/schema.html +0 -119
  37. package/dist/schema.md +0 -156
  38. package/index.html +0 -6
  39. package/index.js +0 -115
  40. package/lib/addons.js +0 -67
  41. package/schema.js +0 -100
  42. package/templates/app.mustache.html +0 -36
  43. package/templates/build.mustache.html +0 -13
  44. package/templates/schema.mustache.html +0 -20
  45. package/test/addons.js +0 -172
  46. package/test/cli.js +0 -53
  47. package/test/fixtures/app.json +0 -32
  48. package/test/index.js +0 -277
  49. package/test/mocha.opts +0 -2
@@ -0,0 +1,228 @@
1
+ import {
2
+ __enterFile,
3
+ __leaveFile,
4
+ newRegistry,
5
+ setActiveRegistry
6
+ } from "./index-8wmxmfhc.js";
7
+ import {
8
+ JsonSchemaObject,
9
+ PublishError
10
+ } from "./index-mcjwntr2.js";
11
+
12
+ // src/manifest/index.ts
13
+ import { fileURLToPath, pathToFileURL } from "node:url";
14
+ import { Crypto, Effect, FileSystem, Schema, Semaphore } from "effect";
15
+
16
+ // src/manifest/collect.ts
17
+ var collectRegistry = (registry, compileInputSchema) => {
18
+ const requirementKey = Symbol.for("executor/apps/requirement");
19
+ const problems = registry.problems.map((problem) => problem.message);
20
+ const app = registry.app;
21
+ const requirementSpecOf = (value) => typeof value === "object" && value !== null && (requirementKey in value) ? value[requirementKey] : undefined;
22
+ const canonicalJson = (value) => {
23
+ const sortKeys = (node) => {
24
+ if (Array.isArray(node))
25
+ return node.map(sortKeys);
26
+ if (typeof node === "object" && node !== null)
27
+ return Object.fromEntries(Object.entries(node).sort(([left], [right]) => left.localeCompare(right)).map(([key, child]) => [key, sortKeys(child)]));
28
+ return node;
29
+ };
30
+ return JSON.stringify(sortKeys(value));
31
+ };
32
+ const claims = new Map;
33
+ for (const [origin, registered] of registry.services) {
34
+ if (registered.file !== "app.ts")
35
+ continue;
36
+ const { decl } = registered;
37
+ claims.set(origin, {
38
+ origin,
39
+ reach: decl.reach ?? [],
40
+ params: decl.params ?? {},
41
+ auth: decl.auth ?? {}
42
+ });
43
+ }
44
+ const collectRequirement = (role, requirement, where) => {
45
+ const spec = requirementSpecOf(requirement);
46
+ if (spec === undefined) {
47
+ problems.push(`${where}: requirement '${role}' is not a service/requirement value`);
48
+ return;
49
+ }
50
+ const origin = spec.service.origin;
51
+ if (!claims.has(origin))
52
+ problems.push(`${where}: requirement '${role}' names ${origin}, which app.ts does not declare`);
53
+ if (spec.grant !== undefined && !(spec.grant in (spec.service.auth ?? {})))
54
+ problems.push(`${where}: requirement '${role}' pins grant '${spec.grant}', not a auth method on ${origin}`);
55
+ return {
56
+ role,
57
+ service: origin,
58
+ arity: spec.arity,
59
+ ...spec.grant === undefined ? {} : { grant: spec.grant },
60
+ ...spec.description === undefined ? {} : { description: spec.description }
61
+ };
62
+ };
63
+ if (app === undefined)
64
+ problems.push("app.ts must call defineApp({...})");
65
+ else if (typeof app.description !== "string" || app.description.trim().length === 0)
66
+ problems.push("app.ts: app description must not be empty");
67
+ for (const [file, summary] of registry.toolFiles) {
68
+ if (summary.definitions > 1 && summary.hasUnnamedTool)
69
+ problems.push(`${file}: multi-tool files must name every tool`);
70
+ }
71
+ const tools = [];
72
+ if (app !== undefined) {
73
+ for (const [name, registered] of registry.tools) {
74
+ const { spec, file } = registered;
75
+ const address = `${app.key}/${name}`;
76
+ if (typeof spec.description !== "string" || spec.description.trim().length === 0)
77
+ problems.push(`${file}: tool '${name}' description must not be empty`);
78
+ const requires = Object.entries(spec.requirements ?? {}).flatMap(([role, requirement]) => {
79
+ const collected = collectRequirement(role, requirement, address);
80
+ return collected === undefined ? [] : [collected];
81
+ }).sort((left, right) => left.role.localeCompare(right.role));
82
+ let compiled;
83
+ try {
84
+ compiled = compileInputSchema(spec.input, address);
85
+ } catch (error) {
86
+ compiled = {
87
+ problem: `${address}: input schema could not compile to JSON schema (${error instanceof Error ? error.message : String(error)})`
88
+ };
89
+ }
90
+ if ("problem" in compiled) {
91
+ problems.push(compiled.problem);
92
+ continue;
93
+ }
94
+ tools.push({
95
+ address,
96
+ name,
97
+ description: spec.description,
98
+ inputSchema: compiled.value,
99
+ annotations: spec.annotations ?? {},
100
+ requires,
101
+ file
102
+ });
103
+ }
104
+ }
105
+ if (problems.length > 0 || app === undefined)
106
+ return { problems };
107
+ const services = [...claims.values()].sort((left, right) => left.origin.localeCompare(right.origin));
108
+ const sortedTools = [...tools].sort((left, right) => left.address.localeCompare(right.address));
109
+ const appResult = { key: app.key, label: app.label, description: app.description };
110
+ const manifest = { app: appResult, services, tools: sortedTools };
111
+ return {
112
+ problems: [],
113
+ manifest,
114
+ canonical: canonicalJson(manifest)
115
+ };
116
+ };
117
+
118
+ // src/manifest/index.ts
119
+ var hasStandardJsonSchema = (input) => ("~standard" in input) && typeof input["~standard"].jsonSchema?.input === "function";
120
+ var compileInputSchema = (input, where) => {
121
+ if ("~standard" in input) {
122
+ if (!hasStandardJsonSchema(input))
123
+ return {
124
+ problem: `${where}: input is a Standard Schema without the jsonSchema extension — use a library that implements it (zod 4+, effect Schema) or pass raw JSON schema`
125
+ };
126
+ }
127
+ try {
128
+ const compiled = strictify(hasStandardJsonSchema(input) ? input["~standard"].jsonSchema.input({ target: "draft-2020-12" }) : structuredClone(input));
129
+ return { value: Schema.decodeUnknownSync(JsonSchemaObject)(compiled) };
130
+ } catch (error) {
131
+ return { problem: schemaPublishProblem(where, error) };
132
+ }
133
+ };
134
+ var schemaPublishProblem = (where, error) => `${where}: input schema could not compile to JSON schema (${error instanceof Error ? error.message : String(error)})`;
135
+ var strictify = (node) => {
136
+ if (typeof node !== "object" || node === null)
137
+ return node;
138
+ if (Array.isArray(node))
139
+ return node.map(strictify);
140
+ const object = { ...node };
141
+ if (object.type === "object" && object.additionalProperties === undefined)
142
+ object.additionalProperties = false;
143
+ for (const key of ["items", "anyOf", "oneOf", "allOf"])
144
+ if (key in object)
145
+ object[key] = strictify(object[key]);
146
+ for (const key of ["properties", "$defs"])
147
+ if (object[key] !== undefined && typeof object[key] === "object" && object[key] !== null)
148
+ object[key] = Object.fromEntries(Object.entries(object[key]).map(([name, value]) => [
149
+ name,
150
+ strictify(value)
151
+ ]));
152
+ return object;
153
+ };
154
+ var digestOf = (content) => Effect.gen(function* () {
155
+ const crypto = yield* Crypto.Crypto;
156
+ const bytes = yield* Effect.orDie(crypto.digest("SHA-256", new TextEncoder().encode(content)));
157
+ return Array.from(bytes.slice(0, 8), (byte) => byte.toString(16).padStart(2, "0")).join("");
158
+ });
159
+ var loadPermit = Semaphore.makeUnsafe(1);
160
+ var runNonce = 0;
161
+ var baseAppImports = new Set;
162
+ var moduleFailure = (where, error) => new PublishError({
163
+ problems: [
164
+ `${where}: failed to execute (${error instanceof Error ? error.message : String(error)})`
165
+ ]
166
+ });
167
+ var canonicalModuleUrl = (path, where) => Effect.gen(function* () {
168
+ const fs = yield* FileSystem.FileSystem;
169
+ const realPath = yield* fs.realPath(path).pipe(Effect.mapError((error) => moduleFailure(where, error)));
170
+ return pathToFileURL(realPath);
171
+ });
172
+ var importModule = (specifier, where) => Effect.tryPromise({
173
+ try: () => import(specifier).then(() => {
174
+ return;
175
+ }),
176
+ catch: (error) => moduleFailure(where, error)
177
+ });
178
+ var recordModuleProblems = (registry, effect) => effect.pipe(Effect.catchTag("PublishError", (error) => Effect.sync(() => {
179
+ registry.problems.push(...error.problems.map((message) => ({ message })));
180
+ })));
181
+ var executeModules = (appDir, files) => loadPermit.withPermit(Effect.uninterruptibleMask((restore) => Effect.gen(function* () {
182
+ const registry = newRegistry();
183
+ const previous = yield* Effect.sync(() => setActiveRegistry(registry));
184
+ const nonce = yield* Effect.sync(() => ++runNonce);
185
+ const execute = Effect.gen(function* () {
186
+ __enterFile("app.ts");
187
+ yield* recordModuleProblems(registry, Effect.gen(function* () {
188
+ const appUrl = yield* canonicalModuleUrl(`${appDir}/app.ts`, "app.ts");
189
+ const baseUrl = appUrl.href;
190
+ const specifier = baseAppImports.has(baseUrl) ? `${fileURLToPath(appUrl)}?m=${nonce}` : baseUrl;
191
+ yield* importModule(specifier, "app.ts");
192
+ yield* Effect.sync(() => baseAppImports.add(baseUrl));
193
+ }));
194
+ for (const file of files) {
195
+ const where = `tools/${file}`;
196
+ __enterFile(where);
197
+ yield* recordModuleProblems(registry, Effect.gen(function* () {
198
+ const url = yield* canonicalModuleUrl(`${appDir}/tools/${file}`, where);
199
+ yield* importModule(`${fileURLToPath(url)}?m=${nonce}`, where);
200
+ }));
201
+ }
202
+ });
203
+ yield* restore(execute).pipe(Effect.ensuring(Effect.sync(() => {
204
+ __leaveFile();
205
+ setActiveRegistry(previous);
206
+ })));
207
+ return registry;
208
+ })));
209
+ var loadApp = (appDir) => Effect.gen(function* () {
210
+ const fs = yield* FileSystem.FileSystem;
211
+ const files = (yield* fs.readDirectory(`${appDir}/tools`).pipe(Effect.mapError((error) => new PublishError({ problems: [`tools/: ${error.message}`] })))).filter((file) => file.endsWith(".ts")).sort();
212
+ const registry = yield* executeModules(appDir, files);
213
+ const collected = collectRegistry(registry, compileInputSchema);
214
+ if (collected.problems.length > 0)
215
+ return yield* new PublishError({ problems: collected.problems });
216
+ if (!("manifest" in collected))
217
+ return yield* Effect.die("validated registry projection unexpectedly missing");
218
+ return {
219
+ registry,
220
+ result: {
221
+ digest: `snap:${yield* digestOf(collected.canonical)}`,
222
+ ...collected.manifest
223
+ }
224
+ };
225
+ });
226
+ var manifest = (appDir) => Effect.map(loadApp(appDir), ({ result }) => result);
227
+
228
+ export { loadApp, manifest };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The authoring surface: what app code imports. Pure and synchronous —
3
+ * no effect dependency, no node builtins — so authored files run
4
+ * unmodified in any execution environment, including sandboxed workers.
5
+ *
6
+ * Host-side machinery lives behind subpaths: "apps/manifest" loads and
7
+ * validates authored sources, "apps/runner" executes them.
8
+ */
9
+ export * from "./authoring/index";
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ import {
2
+ __enterFile,
3
+ __leaveFile,
4
+ defineApp,
5
+ defineTool,
6
+ newRegistry,
7
+ oauth,
8
+ requirementSpecOf,
9
+ secrets,
10
+ service,
11
+ setActiveRegistry,
12
+ toolSpecOf
13
+ } from "./index-8wmxmfhc.js";
14
+ export {
15
+ toolSpecOf,
16
+ setActiveRegistry,
17
+ service,
18
+ secrets,
19
+ requirementSpecOf,
20
+ oauth,
21
+ newRegistry,
22
+ defineTool,
23
+ defineApp,
24
+ __leaveFile,
25
+ __enterFile
26
+ };
@@ -0,0 +1,64 @@
1
+ import type { AuthMethod, ParamSpec, Registry } from "../authoring/index";
2
+ type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
3
+ readonly [key: string]: JsonValue;
4
+ };
5
+ type JsonSchemaObject = Readonly<Record<string, JsonValue>>;
6
+ interface CollectedClaim {
7
+ readonly origin: string;
8
+ readonly reach: readonly string[];
9
+ readonly params: Readonly<Record<string, ParamSpec>>;
10
+ readonly auth: Readonly<Record<string, AuthMethod>>;
11
+ }
12
+ interface CollectedRequirement {
13
+ readonly role: string;
14
+ readonly service: string;
15
+ readonly arity: "one" | "optional" | "many";
16
+ readonly grant?: string;
17
+ readonly description?: string;
18
+ }
19
+ interface CollectedTool {
20
+ readonly address: string;
21
+ readonly name: string;
22
+ readonly description: string;
23
+ readonly inputSchema: JsonSchemaObject;
24
+ readonly annotations: {
25
+ readonly readOnly?: boolean;
26
+ readonly destructive?: boolean;
27
+ readonly scopes?: readonly string[];
28
+ };
29
+ readonly requires: readonly CollectedRequirement[];
30
+ readonly file: string;
31
+ }
32
+ interface CollectedManifest {
33
+ readonly app: {
34
+ readonly key: string;
35
+ readonly label: string;
36
+ readonly description: string;
37
+ };
38
+ readonly services: readonly CollectedClaim[];
39
+ readonly tools: readonly CollectedTool[];
40
+ }
41
+ /** Result of compiling one authored input schema during registry projection. */
42
+ export type InputSchemaCompilation = {
43
+ readonly value: JsonSchemaObject;
44
+ } | {
45
+ readonly problem: string;
46
+ };
47
+ /** Registry projection before the deployment-specific digest implementation. */
48
+ export type RegistryCollection = {
49
+ readonly problems: readonly string[];
50
+ } | {
51
+ readonly problems: readonly [];
52
+ readonly manifest: CollectedManifest;
53
+ readonly canonical: string;
54
+ };
55
+ /**
56
+ * Validate and project an executed authoring registry into deterministic data.
57
+ *
58
+ * This function is deliberately closure-free: the workerd runner injects its
59
+ * source into the guest while the local manifest calls the same function
60
+ * directly. Schema compilation is supplied because each runtime owns its
61
+ * boundary decoder.
62
+ */
63
+ export declare const collectRegistry: (registry: Registry, compileInputSchema: (input: object, where: string) => InputSchemaCompilation) => RegistryCollection;
64
+ export {};
@@ -0,0 +1,55 @@
1
+ import { Schema } from "effect";
2
+ import type { AuthMethod, ParamSpec } from "../authoring/index";
3
+ /** A service claim projected from a registered declaration. */
4
+ export interface CollectedClaim {
5
+ readonly origin: string;
6
+ readonly reach: readonly string[];
7
+ readonly params: Readonly<Record<string, ParamSpec>>;
8
+ readonly auth: Readonly<Record<string, AuthMethod>>;
9
+ }
10
+ /** A tool requirement projected from an authoring value. */
11
+ export interface CollectedRequirement {
12
+ readonly role: string;
13
+ readonly service: string;
14
+ readonly arity: "one" | "optional" | "many";
15
+ readonly grant?: string;
16
+ readonly description?: string;
17
+ }
18
+ /** JSON object accepted for a persisted tool input schema. */
19
+ export declare const JsonSchemaObject: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
20
+ export type JsonSchemaObject = typeof JsonSchemaObject.Type;
21
+ /** A validated, publishable tool row. */
22
+ export interface ManifestTool {
23
+ readonly address: string;
24
+ readonly name: string;
25
+ readonly description: string;
26
+ readonly inputSchema: JsonSchemaObject;
27
+ readonly annotations: {
28
+ readonly readOnly?: boolean;
29
+ readonly destructive?: boolean;
30
+ readonly scopes?: readonly string[];
31
+ };
32
+ readonly requires: readonly CollectedRequirement[];
33
+ readonly file: string;
34
+ }
35
+ /** The deterministic public description of an executor app. */
36
+ export interface AppManifestResult {
37
+ readonly digest: string;
38
+ readonly app: {
39
+ readonly key: string;
40
+ readonly label: string;
41
+ readonly description: string;
42
+ };
43
+ readonly services: readonly CollectedClaim[];
44
+ readonly tools: readonly ManifestTool[];
45
+ }
46
+ declare const PublishError_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 & {
47
+ readonly _tag: "PublishError";
48
+ } & Readonly<A>;
49
+ /** All publish-time authoring problems from one registry load. */
50
+ export declare class PublishError extends PublishError_base<{
51
+ readonly problems: readonly string[];
52
+ }> {
53
+ get message(): string;
54
+ }
55
+ export {};
@@ -0,0 +1,8 @@
1
+ import {
2
+ JsonSchemaObject,
3
+ PublishError
4
+ } from "../index-mcjwntr2.js";
5
+ export {
6
+ PublishError,
7
+ JsonSchemaObject
8
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Manifest: execute an authored app folder, read its registry, validate
3
+ * every claim, and emit the deterministic publish manifest. Defines run
4
+ * without user context; platform services begin at this boundary.
5
+ */
6
+ import { Crypto, Effect, FileSystem } from "effect";
7
+ import { type Registry } from "../authoring/index";
8
+ import { PublishError, type AppManifestResult } from "./contract";
9
+ export * from "./contract";
10
+ /** A registry and its validated public projection. @internal */
11
+ export interface LoadedApp {
12
+ readonly registry: Registry;
13
+ readonly result: AppManifestResult;
14
+ }
15
+ /** Loads an app once and returns both its live registry and manifest. @internal */
16
+ export declare const loadApp: (appDir: string) => Effect.Effect<LoadedApp, PublishError, Crypto.Crypto | FileSystem.FileSystem>;
17
+ /** Executes an app and returns its deterministic publish manifest. */
18
+ export declare const manifest: (appDir: string) => Effect.Effect<AppManifestResult, PublishError, Crypto.Crypto | FileSystem.FileSystem>;
@@ -0,0 +1,15 @@
1
+ import {
2
+ loadApp,
3
+ manifest
4
+ } from "../index-wfngzvv2.js";
5
+ import"../index-8wmxmfhc.js";
6
+ import {
7
+ JsonSchemaObject,
8
+ PublishError
9
+ } from "../index-mcjwntr2.js";
10
+ export {
11
+ manifest,
12
+ loadApp,
13
+ PublishError,
14
+ JsonSchemaObject
15
+ };
@@ -0,0 +1,4 @@
1
+ import { type AppRunner } from "./protocol";
2
+ export * from "./protocol";
3
+ /** Creates a permissive in-process runner for local development and tests. */
4
+ export declare const localRunner: (appDir: string) => AppRunner;
@@ -0,0 +1,61 @@
1
+ import {
2
+ loadApp
3
+ } from "../index-wfngzvv2.js";
4
+ import"../index-8wmxmfhc.js";
5
+ import"../index-mcjwntr2.js";
6
+ import {
7
+ CallError
8
+ } from "../index-dh4z81es.js";
9
+
10
+ // src/runner/index.ts
11
+ import { Effect } from "effect";
12
+ var hasStandardValidate = (input) => ("~standard" in input) && typeof input["~standard"].validate === "function";
13
+ var parseInput = (name, spec, input) => {
14
+ if (!hasStandardValidate(spec.input))
15
+ return Effect.fail(new CallError({ target: name, reason: "input schema does not implement Standard Schema validate" }));
16
+ const standard = spec.input["~standard"];
17
+ return Effect.tryPromise({
18
+ try: () => Promise.resolve(standard.validate(input)),
19
+ catch: (error) => new CallError({
20
+ target: name,
21
+ reason: `input validation threw (${error instanceof Error ? error.message : String(error)})`
22
+ })
23
+ }).pipe(Effect.flatMap((result) => result.issues === undefined ? Effect.succeed(result.value) : Effect.fail(new CallError({
24
+ target: name,
25
+ reason: `invalid input (${result.issues.map((issue) => issue.message).join("; ")})`
26
+ }))));
27
+ };
28
+ var localRunner = (appDir) => {
29
+ let cachedLoad;
30
+ const loaded = () => Effect.suspend(() => {
31
+ if (cachedLoad !== undefined)
32
+ return cachedLoad;
33
+ return Effect.flatMap(Effect.cached(loadApp(appDir)), (effect) => Effect.sync(() => {
34
+ cachedLoad = effect;
35
+ return effect;
36
+ }).pipe(Effect.flatten));
37
+ });
38
+ const loadedFor = (target) => loaded().pipe(Effect.mapError((error) => new CallError({ target, reason: `app failed to load (${error.message})` })));
39
+ return {
40
+ manifest: () => Effect.map(loaded(), ({ result }) => result),
41
+ call: (name, input, ctx) => Effect.gen(function* () {
42
+ const { registry } = yield* loadedFor(name);
43
+ const registered = registry.tools.get(name);
44
+ if (registered === undefined)
45
+ return yield* new CallError({ target: name, reason: "unknown tool" });
46
+ const parsed = yield* parseInput(name, registered.spec, input);
47
+ return yield* Effect.tryPromise({
48
+ try: () => registered.spec.handler(parsed, ctx),
49
+ catch: (error) => new CallError({
50
+ target: name,
51
+ reason: `handler failed (${error instanceof Error ? error.message : String(error)})`
52
+ })
53
+ });
54
+ }),
55
+ discover: (name, _binding) => Effect.fail(new CallError({ target: name, reason: "no dynamic tools yet" }))
56
+ };
57
+ };
58
+ export {
59
+ localRunner,
60
+ CallError
61
+ };
@@ -0,0 +1,28 @@
1
+ import { Crypto, type Effect, FileSystem } from "effect";
2
+ import type { AppManifestResult, PublishError } from "../manifest/contract";
3
+ /** The capability exposed to one tool requirement role. */
4
+ export interface ToolCtxEntry {
5
+ readonly grant: string;
6
+ readonly token?: string;
7
+ readonly secrets?: Readonly<Record<string, string>>;
8
+ fetch(path: string, init?: RequestInit): Promise<Response>;
9
+ }
10
+ /** Tool capabilities keyed by requirement role. */
11
+ export type ToolCtx = Readonly<Record<string, ToolCtxEntry>>;
12
+ 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 & {
13
+ readonly _tag: "CallError";
14
+ } & Readonly<A>;
15
+ /** A runner operation failure associated with its target. */
16
+ export declare class CallError extends CallError_base<{
17
+ readonly target: string;
18
+ readonly reason: string;
19
+ }> {
20
+ get message(): string;
21
+ }
22
+ /** The platform protocol implemented by an app execution environment. */
23
+ export interface AppRunner {
24
+ manifest(): Effect.Effect<AppManifestResult, PublishError, Crypto.Crypto | FileSystem.FileSystem>;
25
+ call(name: string, input: unknown, ctx: ToolCtx): Effect.Effect<unknown, CallError, Crypto.Crypto | FileSystem.FileSystem>;
26
+ discover(name: string, binding: unknown): Effect.Effect<unknown, CallError, Crypto.Crypto | FileSystem.FileSystem>;
27
+ }
28
+ export {};
@@ -0,0 +1,6 @@
1
+ import {
2
+ CallError
3
+ } from "../index-dh4z81es.js";
4
+ export {
5
+ CallError
6
+ };
@@ -0,0 +1,2 @@
1
+ /** Worker-safe registry projection injected into sandboxed app workers. @internal */
2
+ export { collectRegistry } from "../manifest/collect";
@@ -0,0 +1,3 @@
1
+ export {
2
+ collectRegistry
3
+ };
package/package.json CHANGED
@@ -1,47 +1,60 @@
1
1
  {
2
2
  "name": "apps",
3
- "version": "0.8.3",
4
- "description": "Create, validate, and render Heroku app.json manifests",
5
- "main": "index.js",
6
- "bin": {
7
- "app": "./bin/apps",
8
- "apps": "./bin/apps"
9
- },
10
- "scripts": {
11
- "test": "mocha",
12
- "build": "bin/build",
13
- "doc": "bin/doc"
14
- },
3
+ "version": "1.0.0-beta.0",
4
+ "description": "Author executor apps: declare services, auth, and tools in plain TypeScript; the executor platform runs, validates, and serves them.",
5
+ "license": "MIT",
6
+ "type": "module",
15
7
  "repository": {
16
8
  "type": "git",
17
- "url": "https://github.com/heroku/apps"
9
+ "url": "git+https://github.com/UsefulSoftwareCo/executor-rework.git",
10
+ "directory": "sdk/apps"
18
11
  },
19
- "keywords": [
20
- "app.json"
12
+ "sideEffects": false,
13
+ "files": [
14
+ "dist",
15
+ "src",
16
+ "README.md"
21
17
  ],
22
- "author": "Zeke Sikelianos <zeke@sikelianos.com> (http://zeke.sikelianos.com/)",
23
- "license": "ISC",
24
- "bugs": {
25
- "url": "https://github.com/heroku/apps/issues"
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "default": "./dist/index.js"
22
+ },
23
+ "./authoring": {
24
+ "types": "./dist/authoring/index.d.ts",
25
+ "default": "./dist/authoring/index.js"
26
+ },
27
+ "./manifest": {
28
+ "types": "./dist/manifest/index.d.ts",
29
+ "default": "./dist/manifest/index.js"
30
+ },
31
+ "./manifest/contract": {
32
+ "types": "./dist/manifest/contract.d.ts",
33
+ "default": "./dist/manifest/contract.js"
34
+ },
35
+ "./runner": {
36
+ "types": "./dist/runner/index.d.ts",
37
+ "default": "./dist/runner/index.js"
38
+ },
39
+ "./runner/protocol": {
40
+ "types": "./dist/runner/protocol.d.ts",
41
+ "default": "./dist/runner/protocol.js"
42
+ },
43
+ "./workerd": {
44
+ "types": "./dist/workerd/index.d.ts",
45
+ "default": "./dist/workerd/index.js"
46
+ }
47
+ },
48
+ "peerDependencies": {
49
+ "effect": "4.0.0-beta.93"
26
50
  },
27
- "homepage": "https://github.com/heroku/apps",
28
- "dependencies": {
29
- "revalidator": "https://github.com/facundoolano/revalidator/tarball/master",
30
- "github-url-to-object": "^0.4.1",
31
- "superagent": "^0.17.0",
32
- "browserify-hogan": "^0.1.2",
33
- "hogan.js": "^2.0.0",
34
- "brfs": "^1.0.2",
35
- "async": "^0.7.0",
36
- "heroku-client": "^1.2.0",
37
- "commander": "^2.2.0",
38
- "marked": "^0.3.2"
51
+ "peerDependenciesMeta": {
52
+ "effect": {
53
+ "optional": false
54
+ }
39
55
  },
40
56
  "devDependencies": {
41
- "mocha": "^1.18.0",
42
- "browserify": "^3.38.0",
43
- "uglify-js": "^2.4.13",
44
- "cheerio": "^0.15.0",
45
- "nixt": "^0.3.0"
57
+ "@types/node": "22",
58
+ "typescript": "5.9.3"
46
59
  }
47
60
  }