apps 0.0.1-beta.36 → 0.0.1-beta.37

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 (34) hide show
  1. package/framework-reference.json +1 -1
  2. package/js/{chunk-KZFV3WCJ.js → chunk-24EIFQYZ.js} +377 -50
  3. package/js/chunk-2FWXCU5I.js +16 -0
  4. package/js/{chunk-ZQWDOHEO.js → chunk-3LRFKLUX.js} +4 -4
  5. package/js/{chunk-BKJDZYK7.js → chunk-7KEKFBV7.js} +1 -1
  6. package/js/{chunk-4U2VUDET.js → chunk-BWUHMKHQ.js} +1 -1
  7. package/js/{chunk-CZLCA2O4.js → chunk-CAOHGMNW.js} +2 -2
  8. package/js/{chunk-SRB2WDU7.js → chunk-D45FU4TZ.js} +1 -1
  9. package/js/{chunk-UBAKWXAJ.js → chunk-GHDZEEPO.js} +24 -20
  10. package/js/{chunk-556EWA6P.js → chunk-KEZ4YZSP.js} +16 -3
  11. package/js/{chunk-XEXUHXC3.js → chunk-LQBR7AI7.js} +11 -1
  12. package/js/{chunk-WAGGHNWH.js → chunk-QQKHJ72Y.js} +4 -4
  13. package/js/{chunk-A2NN45C7.js → chunk-U74JVKTQ.js} +3 -3
  14. package/js/{chunk-WMVTBHGK.js → chunk-UCOMVHGW.js} +2 -2
  15. package/js/client.js +2 -1
  16. package/js/contracts.js +3 -2
  17. package/js/effect.js +10 -9
  18. package/js/graphql.js +11 -10
  19. package/js/host.js +10 -9
  20. package/js/index.js +5 -4
  21. package/js/mcp/effect.js +12 -11
  22. package/js/mcp/stdio.js +12 -11
  23. package/js/mcp.js +13 -12
  24. package/js/openapi.js +9 -8
  25. package/js/skills/effect.js +3 -2
  26. package/js/skills.js +5 -4
  27. package/js/ui/serving.js +2 -1
  28. package/package.json +1 -1
  29. package/runtime.json +1 -1
  30. package/types/apps/src/contracts/workflows.d.ts +6 -0
  31. package/types/telemetry/src/app-records.d.ts +42 -0
  32. package/types/telemetry/src/recorded-failure.d.ts +20 -0
  33. package/types/utils/src/api-error.d.ts +5 -0
  34. package/types/utils/src/recorded-message.d.ts +15 -0
@@ -1,5 +1,6 @@
1
1
  /** Portable workflow declarations, run views and durable execution capabilities. */
2
2
  import { Schema, type Effect } from "effect";
3
+ import { RecordedMessage } from "../../../utils/src/recorded-message.js";
3
4
  import { JsonValue } from "./schema.js";
4
5
  import type { AppContext, AppRequirements, QueryContext, MutationContext } from "./context.js";
5
6
  import type { Operation } from "../implementation/operations.js";
@@ -49,6 +50,11 @@ declare const WorkflowFailure_base: Schema.Class<WorkflowFailure, Schema.TaggedS
49
50
  }>, import("effect/Cause").YieldableError>;
50
51
  /** Failures cross host boundaries as reason codes plus the app's own bounded error detail. */
51
52
  export declare class WorkflowFailure extends WorkflowFailure_base {
53
+ /**
54
+ * The step name and error detail are the app's. Its run's owner reads them; telemetry records
55
+ * only the reason, however the failure was built or decoded.
56
+ */
57
+ get [RecordedMessage](): string | undefined;
52
58
  }
53
59
  /** Explicitly stop retrying an authored step. Its message is reported like any step error. */
54
60
  export declare class NonRetryableError extends Error {
@@ -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 {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Failures as Executor's telemetry records them. An error whose message can carry an app's own
3
+ * text declares a fixed sentence instead (see `RecordedMessage`); traces and error reports record
4
+ * that sentence with the error's name. The error itself, and what its caller receives, are
5
+ * unchanged.
6
+ */
7
+ import { Cause } from "effect";
8
+ /**
9
+ * The error a trace or error report records in place of `error`. Its stack is generated here and
10
+ * names no frames: the error's own stack begins with its message, which can span lines that look
11
+ * like frames, so none of its text is kept. Traces still show where it failed through the
12
+ * operation's own spans, which Effect appends to a recorded stack.
13
+ */
14
+ export declare const recordedError: (error: unknown) => unknown;
15
+ /**
16
+ * A failure's cause as traces record it. A defect is recorded the same way when it is an error that
17
+ * declares a recorded message, such as a workflow failure a host turned into a defect; other
18
+ * defects and interruptions are unchanged. Each reason keeps its annotations, which locate it.
19
+ */
20
+ export declare const recordedCause: <E>(cause: Cause.Cause<E>) => Cause.Cause<unknown>;
@@ -23,6 +23,11 @@ type Definition<Tag extends string, Fields extends Schema.Struct.Fields> = Heade
23
23
  * record, so it never includes credentials, upstream response text or submitted values.
24
24
  */
25
25
  readonly message: string | ((fields: Schema.Struct.Type<Fields>) => string);
26
+ /**
27
+ * What traces and error reports record instead of `message`, when the message quotes an app's
28
+ * own error or a service's stated error for its caller. Only fixed text and typed fields.
29
+ */
30
+ readonly recorded?: (fields: Schema.Struct.Type<Fields>) => string;
26
31
  };
27
32
  type ErrorFields<Tag extends string, Fields extends Schema.Struct.Fields> = Omit<Schema.TaggedStruct<Tag, Fields & {
28
33
  readonly message: typeof MessageField;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * What traces and error reports record for an error in place of its message. An error declares
3
+ * one when its message can carry text from outside Executor: an app's own error or output, or an
4
+ * error a service stated through an app. That text still reaches the caller the error is for;
5
+ * Executor's telemetry records only this fixed sentence, beside the error's name.
6
+ */
7
+ export declare const RecordedMessage: unique symbol;
8
+ /** The fixed sentence an error declares for telemetry, if it declares one. */
9
+ export declare const recordedMessage: (error: unknown) => string | undefined;
10
+ /**
11
+ * Declare a recorded message on one error that Executor did not define the text of, such as an
12
+ * error decoded from an app's reply. An error class's own declaration is kept. The error's fields
13
+ * and wire encoding are unchanged.
14
+ */
15
+ export declare const recordAs: <E>(error: E, message: string) => E;