apps 0.0.1-beta.28 → 0.0.1-beta.30

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 (38) hide show
  1. package/framework-reference.json +1 -1
  2. package/js/{chunk-SDLIDQXG.js → chunk-2D2PKLGQ.js} +117 -196
  3. package/js/{chunk-MWCLJQRI.js → chunk-3SPRHIEE.js} +2 -2
  4. package/js/{chunk-TSLG2WPA.js → chunk-4N26L465.js} +1 -1
  5. package/js/chunk-5ZHHO4OM.js +92 -0
  6. package/js/{chunk-GLIAMV2R.js → chunk-6NK26ONC.js} +7 -7
  7. package/js/{chunk-GQ7GCZ4J.js → chunk-6VWYEQ4X.js} +1 -1
  8. package/js/{chunk-VIQQ52V7.js → chunk-AE4FWJQU.js} +3 -3
  9. package/js/{chunk-V2I3MMPM.js → chunk-BBTELEAN.js} +1 -1
  10. package/js/{chunk-TE2HPDZG.js → chunk-BSRU52RU.js} +1 -1
  11. package/js/{chunk-L76NWXM5.js → chunk-IMCEF6KE.js} +6 -6
  12. package/js/{chunk-NSBRV4FJ.js → chunk-MYCVMDWI.js} +44 -6
  13. package/js/{chunk-VF3X26ZO.js → chunk-OI5CKSBU.js} +2 -2
  14. package/js/{chunk-PTUZSCEV.js → chunk-P46HIAX6.js} +1 -1
  15. package/js/{chunk-JN3PEGMW.js → chunk-PUC24GZP.js} +32 -7
  16. package/js/{chunk-YXKXKGN6.js → chunk-WGBI5MVX.js} +2 -2
  17. package/js/client.js +9 -7
  18. package/js/contracts.js +4 -2
  19. package/js/effect.js +11 -10
  20. package/js/graphql.js +15 -14
  21. package/js/host.js +11 -10
  22. package/js/index.js +6 -4
  23. package/js/mcp/effect.js +13 -12
  24. package/js/mcp/stdio.js +13 -12
  25. package/js/mcp.js +14 -13
  26. package/js/openapi.js +184 -151
  27. package/js/skills/effect.js +4 -2
  28. package/js/skills.js +8 -7
  29. package/js/ui/auth.js +3 -3
  30. package/js/ui/contracts.js +3 -2
  31. package/js/ui/serving.js +7 -6
  32. package/package.json +1 -1
  33. package/runtime.json +1 -1
  34. package/types/apps/src/contracts/openapi.d.ts +22 -1
  35. package/types/apps/src/contracts/skills.d.ts +18 -5
  36. package/types/apps/src/implementation/openapi-compile.d.ts +7 -0
  37. package/types/utils/src/api-error.d.ts +48 -0
  38. package/js/{chunk-B5YJQU45.js → chunk-XGN5IFOZ.js} +2 -2
@@ -207,11 +207,32 @@ export type OpenapiToolsOptions = Omit<typeof OpenapiToolsOptions.Type, "operati
207
207
  readonly operations: unknown;
208
208
  readonly definitions?: unknown;
209
209
  };
210
+ /** The operation a failed call addressed: its method and templated path, never parameter values. */
211
+ export declare const OpenapiFailedOperation: Schema.Struct<{
212
+ readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "QUERY"]>;
213
+ readonly path: Schema.String;
214
+ }>;
215
+ export type OpenapiFailedOperation = typeof OpenapiFailedOperation.Type;
216
+ /** A response media type without parameters, such as `text/html`. */
217
+ export declare const OpenapiMediaType: Schema.String;
210
218
  declare const OpenapiError_base: Schema.Class<OpenapiError, Schema.TaggedStruct<"OpenapiError", {
211
219
  readonly reason: Schema.Literals<readonly ["invalid_definition", "invalid_input", "request"]>;
212
220
  readonly status: Schema.optional<Schema.Number>;
221
+ /** Absent only when the definition itself could not be read. */
222
+ readonly operation: Schema.optional<Schema.Struct<{
223
+ readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "QUERY"]>;
224
+ readonly path: Schema.String;
225
+ }>>;
226
+ readonly contentType: Schema.optional<Schema.String>;
227
+ /** The response's `content-length`, when it declared one. */
228
+ readonly bytes: Schema.optional<Schema.Int>;
213
229
  }>, import("effect/Cause").YieldableError>;
214
- /** Safe failures omit request headers, credentials and upstream bodies. */
230
+ /**
231
+ * Safe failures omit request headers, credentials and upstream body text: the failure message is
232
+ * also recorded in traces. A `request` failure with a status names the response that no declared
233
+ * error matched, or the success response whose body could not be read, by its media type and
234
+ * declared length.
235
+ */
215
236
  export declare class OpenapiError extends OpenapiError_base {
216
237
  }
217
238
  /** An ordinary native tool bound to one selected account. */
@@ -1,5 +1,6 @@
1
1
  /** Portable Agent Skills returned by an app factory or loaded from published files. */
2
2
  import { Schema } from "effect";
3
+ import { ApiError } from "../../../utils/src/api-error.js";
3
4
  /** Canonical resource path within one skill. */
4
5
  export declare const SkillFilePath: Schema.NonEmptyString;
5
6
  /** UTF-8 text resource. Reading a resource never executes it. */
@@ -40,13 +41,25 @@ export declare const AppSkillSource: Schema.Struct<{
40
41
  readonly "allowed-tools": Schema.optionalKey<Schema.String>;
41
42
  }>;
42
43
  export type AppSkillSource = typeof AppSkillSource.Type;
43
- declare const SkillDefinitionInvalid_base: Schema.Class<SkillDefinitionInvalid, Schema.TaggedStruct<"SkillDefinitionInvalid", {
44
+ /** Invalid selected skill files fail the load. Errors identify the file without disclosing its contents. */
45
+ export declare const SkillDefinitionInvalid: Schema.Class<{
46
+ readonly file: string;
47
+ readonly reason: "metadata" | "files" | "directory" | "missing-document" | "frontmatter" | "name-mismatch";
48
+ } & ApiError & {
49
+ readonly _tag: "SkillDefinitionInvalid";
50
+ }, Omit<Schema.TaggedStruct<"SkillDefinitionInvalid", {
44
51
  readonly file: Schema.NonEmptyString;
45
52
  readonly reason: Schema.Literals<readonly ["files", "directory", "missing-document", "frontmatter", "metadata", "name-mismatch"]>;
46
- }>, import("effect/Cause").YieldableError>;
47
- /** Invalid selected skill files fail the load. Errors identify the file without disclosing its contents. */
48
- export declare class SkillDefinitionInvalid extends SkillDefinitionInvalid_base {
49
- }
53
+ } & {
54
+ readonly message: typeof import("../../../utils/src/api-error.js").MessageField;
55
+ }>, "~type.make.in"> & {
56
+ readonly "~type.make.in": {
57
+ readonly reason: "metadata" | "files" | "directory" | "missing-document" | "frontmatter" | "name-mismatch";
58
+ readonly file: string;
59
+ readonly _tag?: "SkillDefinitionInvalid";
60
+ };
61
+ }, ApiError>;
62
+ export type SkillDefinitionInvalid = typeof SkillDefinitionInvalid.Type;
50
63
  /** One evaluated catalog cannot contain ambiguous names. */
51
64
  export declare const AppSkills: Schema.$Array<Schema.Struct<{
52
65
  readonly files: Schema.$Array<Schema.Struct<{
@@ -1,9 +1,16 @@
1
1
  /** Compile an OpenAPI document into tool declarations inside the app runtime, never a second execution engine. */
2
2
  import { Effect, Schema } from "effect";
3
3
  import { JsonObject } from "../contracts/schema.js";
4
+ import { OpenapiErrorResponse } from "../contracts/openapi.js";
4
5
  import { OpenapiCompileError as TemplateError } from "../contracts/openapi-compile.js";
5
6
  import type { OpenApiImport } from "../contracts/openapi-document.js";
6
7
  import { type GeneratedOperation, type GeneratedSecrets } from "../contracts/openapi-document.js";
8
+ import { type OpenApiDocument } from "./openapi-document.js";
9
+ /** Keep tagged errors, including response/component refs and anyOf alternatives.
10
+ * Public text comes from a declared string message or the schema's static description.
11
+ * `scripts/check-api-errors.ts` applies this to Executor's own API documents.
12
+ */
13
+ export declare function errorResponses(document: OpenApiDocument, operation: JsonObject, at: string): OpenapiErrorResponse[];
7
14
  /** Compile a revision of a live OpenAPI source into tool declarations for the app runtime.
8
15
  * The document is consumed: compilation upgrades it in place instead of copying it. It must be a
9
16
  * tree, with no object reached twice, as parsed JSON is.
@@ -0,0 +1,48 @@
1
+ import { Schema, type Cause } from "effect";
2
+ import "effect/unstable/httpapi";
3
+ /**
4
+ * Encode the class's `message` getter as a required wire string. Decoding validates the field,
5
+ * then omits it, so the class derives its own message from the parsed payload and a supplied
6
+ * value never replaces it.
7
+ */
8
+ export declare const MessageField: Schema.decodeTo<Schema.optionalKey<Schema.String>, Schema.String, never, never>;
9
+ /** An expected API error whose response states its cause in a `message` derived from its fields. */
10
+ export interface ApiError extends Cause.YieldableError {
11
+ readonly _tag: string;
12
+ }
13
+ type Header<Tag extends string> = {
14
+ readonly tag: Tag;
15
+ readonly status: number;
16
+ };
17
+ type Definition<Tag extends string, Fields extends Schema.Struct.Fields> = Header<Tag> & {
18
+ readonly fields: Fields & {
19
+ readonly [Key in "_tag" | "message"]?: never;
20
+ };
21
+ /**
22
+ * The cause, stated for API and agent callers. It is also the error's `message`, which traces
23
+ * record, so it never includes credentials, upstream response text or submitted values.
24
+ */
25
+ readonly message: string | ((fields: Schema.Struct.Type<Fields>) => string);
26
+ };
27
+ type ErrorFields<Tag extends string, Fields extends Schema.Struct.Fields> = Omit<Schema.TaggedStruct<Tag, Fields & {
28
+ readonly message: typeof MessageField;
29
+ }>, "~type.make.in"> & {
30
+ readonly "~type.make.in": Schema.TaggedStruct<Tag, Fields>["~type.make.in"];
31
+ };
32
+ type ErrorClass<Tag extends string, Fields extends Schema.Struct.Fields> = Schema.Class<Schema.Struct.Type<Fields> & ApiError & {
33
+ readonly _tag: Tag;
34
+ }, ErrorFields<Tag, Fields>, ApiError>;
35
+ /** Define an error with no payload and a fixed message. Its tag is its public error code. */
36
+ declare function define<const Tag extends string>(definition: Header<Tag> & {
37
+ readonly message: string;
38
+ }): ErrorClass<Tag, {}>;
39
+ /** Define an error whose message can depend on its parsed fields. */
40
+ declare function define<const Tag extends string, const Fields extends Schema.Struct.Fields>(definition: Definition<Tag, Fields>): ErrorClass<Tag, Fields>;
41
+ /**
42
+ * Define the schema, constructor and API message of an expected error together. Errors that need
43
+ * a user-facing title and recovery use `UserFacingError`, which carries the same message field.
44
+ */
45
+ export declare const ApiError: {
46
+ define: typeof define;
47
+ };
48
+ export {};
@@ -4358,6 +4358,8 @@ export {
4358
4358
  bodyFormData,
4359
4359
  HttpClientRequest_exports,
4360
4360
  fromWeb2 as fromWeb,
4361
+ HttpServerResponse_exports,
4362
+ HttpServerRequest_exports,
4361
4363
  HttpTraceContext_exports,
4362
4364
  HttpClient,
4363
4365
  transformResponse,
@@ -4368,8 +4370,6 @@ export {
4368
4370
  TracerPropagationEnabled,
4369
4371
  layerMergedContext,
4370
4372
  HttpClient_exports,
4371
- HttpServerResponse_exports,
4372
- HttpServerRequest_exports,
4373
4373
  prefixPath,
4374
4374
  fromLiteral
4375
4375
  };