apps 0.0.1-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 (135) hide show
  1. package/README.md +191 -0
  2. package/check-publish.mjs +10 -0
  3. package/framework-reference.json +1 -0
  4. package/js/chunk-22WRQZT7.js +389 -0
  5. package/js/chunk-2OTCEKL2.js +29480 -0
  6. package/js/chunk-36DNRFZQ.js +34 -0
  7. package/js/chunk-3ANFZFCV.js +1799 -0
  8. package/js/chunk-7JXHF5IF.js +138 -0
  9. package/js/chunk-BCSNKUAC.js +0 -0
  10. package/js/chunk-BKVL7XAJ.js +47 -0
  11. package/js/chunk-BPEFS4YF.js +1323 -0
  12. package/js/chunk-C24KEZXR.js +59 -0
  13. package/js/chunk-D6BKYP2L.js +877 -0
  14. package/js/chunk-EP6AEUZO.js +19 -0
  15. package/js/chunk-HP7E42X6.js +1719 -0
  16. package/js/chunk-KWTCHVLT.js +284 -0
  17. package/js/chunk-LOKGDT6B.js +28 -0
  18. package/js/chunk-MLKGABMK.js +9 -0
  19. package/js/chunk-OWD2YICM.js +2486 -0
  20. package/js/chunk-Q2FD5IBM.js +899 -0
  21. package/js/chunk-R6JMJSVT.js +590 -0
  22. package/js/chunk-SBKHUC5L.js +56 -0
  23. package/js/chunk-VFUZI3NY.js +75 -0
  24. package/js/chunk-W7Q5EOTS.js +4375 -0
  25. package/js/chunk-WIDTG42X.js +171 -0
  26. package/js/chunk-X3YBZCJW.js +246 -0
  27. package/js/chunk-YDR4CPJA.js +2357 -0
  28. package/js/client.js +1023 -0
  29. package/js/contracts.js +163 -0
  30. package/js/effect.js +44 -0
  31. package/js/graphql.js +392 -0
  32. package/js/host.js +193 -0
  33. package/js/index.js +284 -0
  34. package/js/mcp/effect.js +23 -0
  35. package/js/mcp/stdio.js +123 -0
  36. package/js/mcp.js +37 -0
  37. package/js/openapi.js +246 -0
  38. package/js/operations/approval.js +9 -0
  39. package/js/react.js +37 -0
  40. package/js/storage/facet.js +546 -0
  41. package/js/ui/auth/contracts.js +19 -0
  42. package/js/ui/auth.js +28 -0
  43. package/js/ui/contracts.js +24 -0
  44. package/js/ui/serving.js +286 -0
  45. package/package.json +116 -0
  46. package/runtime.json +1 -0
  47. package/types/app-data/src/contracts/database.d.ts +193 -0
  48. package/types/app-data/src/implementation/cursor.d.ts +10 -0
  49. package/types/app-data/src/implementation/index-key.d.ts +7 -0
  50. package/types/app-data/src/implementation/promise.d.ts +68 -0
  51. package/types/app-data/src/implementation/range.d.ts +8 -0
  52. package/types/app-data/src/implementation/schema.d.ts +33 -0
  53. package/types/app-data/src/implementation/sqlite.d.ts +11 -0
  54. package/types/app-data/src/index.d.ts +4 -0
  55. package/types/apps/src/approval.d.ts +10 -0
  56. package/types/apps/src/client.d.ts +5 -0
  57. package/types/apps/src/contracts/app.d.ts +58 -0
  58. package/types/apps/src/contracts/approval.d.ts +14 -0
  59. package/types/apps/src/contracts/context.d.ts +25 -0
  60. package/types/apps/src/contracts/elicitation.d.ts +86 -0
  61. package/types/apps/src/contracts/graphql.d.ts +102 -0
  62. package/types/apps/src/contracts/host.d.ts +568 -0
  63. package/types/apps/src/contracts/http.d.ts +20 -0
  64. package/types/apps/src/contracts/live.d.ts +26 -0
  65. package/types/apps/src/contracts/mcp.d.ts +93 -0
  66. package/types/apps/src/contracts/openapi.d.ts +105 -0
  67. package/types/apps/src/contracts/operations.d.ts +30 -0
  68. package/types/apps/src/contracts/optimistic.d.ts +22 -0
  69. package/types/apps/src/contracts/provider.d.ts +96 -0
  70. package/types/apps/src/contracts/schedules.d.ts +51 -0
  71. package/types/apps/src/contracts/schema.d.ts +20 -0
  72. package/types/apps/src/contracts/storage.d.ts +68 -0
  73. package/types/apps/src/contracts/tools.d.ts +11 -0
  74. package/types/apps/src/contracts/ui-auth.d.ts +28 -0
  75. package/types/apps/src/contracts/ui.d.ts +90 -0
  76. package/types/apps/src/contracts/webhook-protocol.d.ts +102 -0
  77. package/types/apps/src/contracts/webhooks.d.ts +53 -0
  78. package/types/apps/src/contracts/workflows.d.ts +277 -0
  79. package/types/apps/src/effect.d.ts +10 -0
  80. package/types/apps/src/facet.d.ts +5 -0
  81. package/types/apps/src/graphql.d.ts +10 -0
  82. package/types/apps/src/host.d.ts +16 -0
  83. package/types/apps/src/implementation/account-operations.d.ts +32 -0
  84. package/types/apps/src/implementation/app.d.ts +40 -0
  85. package/types/apps/src/implementation/authoring.d.ts +12 -0
  86. package/types/apps/src/implementation/elicitation.d.ts +103 -0
  87. package/types/apps/src/implementation/graphql.d.ts +5 -0
  88. package/types/apps/src/implementation/host.d.ts +3 -0
  89. package/types/apps/src/implementation/http.d.ts +5 -0
  90. package/types/apps/src/implementation/live.d.ts +18 -0
  91. package/types/apps/src/implementation/mcp-call.d.ts +19 -0
  92. package/types/apps/src/implementation/mcp-client.d.ts +50 -0
  93. package/types/apps/src/implementation/mcp-stdio.d.ts +4 -0
  94. package/types/apps/src/implementation/mcp-tools.d.ts +6 -0
  95. package/types/apps/src/implementation/mcp.d.ts +4 -0
  96. package/types/apps/src/implementation/openapi-request.d.ts +11 -0
  97. package/types/apps/src/implementation/openapi.d.ts +5 -0
  98. package/types/apps/src/implementation/operations.d.ts +65 -0
  99. package/types/apps/src/implementation/optimistic.d.ts +30 -0
  100. package/types/apps/src/implementation/protocol-operations.d.ts +24 -0
  101. package/types/apps/src/implementation/provider.d.ts +16 -0
  102. package/types/apps/src/implementation/query-commit.d.ts +10 -0
  103. package/types/apps/src/implementation/schedules.d.ts +16 -0
  104. package/types/apps/src/implementation/schema.d.ts +93 -0
  105. package/types/apps/src/implementation/storage.d.ts +13 -0
  106. package/types/apps/src/implementation/ui-auth.d.ts +13 -0
  107. package/types/apps/src/implementation/ui-client.d.ts +16 -0
  108. package/types/apps/src/implementation/ui-errors.d.ts +2 -0
  109. package/types/apps/src/implementation/ui-serving.d.ts +16 -0
  110. package/types/apps/src/implementation/ui-watch.d.ts +2 -0
  111. package/types/apps/src/implementation/webhooks.d.ts +29 -0
  112. package/types/apps/src/implementation/workflow-context.d.ts +8 -0
  113. package/types/apps/src/implementation/workflow-rpc.d.ts +5 -0
  114. package/types/apps/src/implementation/workflows.d.ts +27 -0
  115. package/types/apps/src/index.d.ts +58 -0
  116. package/types/apps/src/mcp-stdio.d.ts +8 -0
  117. package/types/apps/src/mcp.d.ts +10 -0
  118. package/types/apps/src/openapi.d.ts +10 -0
  119. package/types/apps/src/react.d.ts +7 -0
  120. package/types/apps/src/ui-auth.d.ts +3 -0
  121. package/types/apps/src/ui-serving.d.ts +3 -0
  122. package/types/telemetry/src/browser-operations.d.ts +16 -0
  123. package/types/telemetry/src/browser-performance.d.ts +11 -0
  124. package/types/telemetry/src/browser-request-timing.d.ts +2 -0
  125. package/types/telemetry/src/browser.d.ts +27 -0
  126. package/types/telemetry/src/config.d.ts +83 -0
  127. package/types/telemetry/src/context.d.ts +14 -0
  128. package/types/telemetry/src/index.d.ts +9 -0
  129. package/types/telemetry/src/layer.d.ts +7 -0
  130. package/types/telemetry/src/measurements.d.ts +8 -0
  131. package/types/telemetry/src/pending-span.d.ts +7 -0
  132. package/types/telemetry/src/relay.d.ts +28 -0
  133. package/types/telemetry/src/span-attributes.d.ts +29 -0
  134. package/types/telemetry/src/trace-context.d.ts +20 -0
  135. package/types/telemetry/src/transport.d.ts +6 -0
@@ -0,0 +1,8 @@
1
+ /** Author-facing step methods delegate persistence to the host's durable engine. */
2
+ import { Effect } from "effect";
3
+ import type { AppDefinition } from "../contracts/app.js";
4
+ import { WorkflowFailure, type WorkflowContext, type WorkflowExecution, type WorkflowStepContext } from "../contracts/workflows.js";
5
+ /** Preserve typed failures and cancellation; authored exception text never leaves the app. */
6
+ export declare const workflowSafe: <A>(work: Effect.Effect<A, unknown>) => Effect.Effect<A, WorkflowFailure>;
7
+ /** Construct one replay's Promise context. Step callbacks acquire fresh capabilities per actual attempt. */
8
+ export declare const makeWorkflowContext: (execution: WorkflowExecution, definition: Pick<AppDefinition<never>, "queries" | "mutations">, fresh: (stepId: string, signal: AbortSignal) => Effect.Effect<WorkflowStepContext, WorkflowFailure>, signal: AbortSignal) => Effect.Effect<WorkflowContext>;
@@ -0,0 +1,5 @@
1
+ import { type WorkflowExecution, type WorkflowRpc, type WorkflowHostControls } from "../contracts/workflows.js";
2
+ /** Bind a private host callback to this invocation; no workflow capability survives cancellation. */
3
+ export declare const isolatedWorkflowExecution: (run: string, deliver: WorkflowRpc, signal: AbortSignal) => WorkflowExecution;
4
+ /** Reconstruct app-scoped controls from one invocation-owned RPC function. */
5
+ export declare const isolatedWorkflowControls: (deliver: (input: unknown) => Promise<unknown>) => WorkflowHostControls;
@@ -0,0 +1,27 @@
1
+ /** Ordinary async workflow declarations, adapted once into native Effect handlers. */
2
+ import { type Schema as EffectSchema } from "effect";
3
+ import type { AppWorkflow, WorkflowContext } from "../contracts/workflows.js";
4
+ import { type Schema } from "./schema.js";
5
+ declare const NativeWorkflow: unique symbol;
6
+ declare const HandlerContext: unique symbol;
7
+ /** A workflow declaration retains input/output inference and required context compatibility. */
8
+ export interface Workflow<Input, Output, Context extends WorkflowContext = WorkflowContext> {
9
+ readonly [HandlerContext]?: (context: Context) => void;
10
+ readonly [NativeWorkflow]: AppWorkflow<Input, Output>;
11
+ }
12
+ /** Composition view erases input only after retaining its runtime decoder. */
13
+ export interface WorkflowDeclaration<Context extends WorkflowContext> {
14
+ readonly [HandlerContext]?: (context: Context) => void;
15
+ readonly [NativeWorkflow]: Omit<AppWorkflow<never>, "input"> & {
16
+ readonly input: EffectSchema.Decoder<unknown>;
17
+ };
18
+ }
19
+ /** Declare durable orchestration without starting a run or performing I/O. */
20
+ export declare const workflow: <Input, Output, Context extends WorkflowContext = WorkflowContext>(options: {
21
+ readonly input: Schema<Input, boolean>;
22
+ readonly output?: Schema<Output, boolean>;
23
+ readonly description?: string;
24
+ }, run: (context: Context, input: Input) => Promise<Output>) => Workflow<Input, Output, Context>;
25
+ /** Only this module creates the private declaration symbol; input is decoded before invocation. */
26
+ export declare const nativeWorkflow: (value: unknown) => AppWorkflow | undefined;
27
+ export {};
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Public author API. Native contracts live in contracts/; this boundary
3
+ * exposes ordinary declarations, schema helpers and Promise operations.
4
+ */
5
+ import { type Schema as EffectSchema } from "effect";
6
+ import type { WebhookContext } from "./contracts/context.js";
7
+ import { type JsonResponse as NativeResponse } from "./contracts/http.js";
8
+ import { type OAuth2Config, type OAuth2Method as NativeOAuth2Method, type SecretsMethod as NativeSecretsMethod } from "./contracts/provider.js";
9
+ import type { Webhook as NativeWebhook } from "./contracts/webhooks.js";
10
+ import { type PromiseMethods } from "./implementation/authoring.js";
11
+ import { type Fields, type Infer, type ObjectSchema, type Schema } from "./implementation/schema.js";
12
+ export { type JsonObject, type JsonValue, ValidationError } from "./contracts/schema.js";
13
+ export { type Fields, type Infer, type ObjectSchema, type ObjectValue, type Schema, array, boolean, json, jsonSchema, literal, number, object, record, string, } from "./implementation/schema.js";
14
+ export { type AccountOf, type AuthMethod, type AuthMethodData, type AuthMethods, type ManyAccounts, type OAuth2Config, type Provider, } from "./contracts/provider.js";
15
+ export { defineProvider } from "./implementation/provider.js";
16
+ export { accountOperations } from "./implementation/account-operations.js";
17
+ /** A secrets declaration inferred from an author schema. */
18
+ export type SecretsMethod<Shape extends ObjectSchema<Fields>> = NativeSecretsMethod<EffectSchema.Decoder<Infer<Shape>>>;
19
+ /** An OAuth declaration inferred from its author-facing response schema. */
20
+ export type OAuth2Method<Response extends Schema<unknown, boolean>> = NativeOAuth2Method<EffectSchema.Decoder<Infer<Response>>>;
21
+ /** Default OAuth fields visible to app code. Host-only grants and clients stay private. */
22
+ export declare const OAuth2AccessToken: Schema<{
23
+ readonly access_token: string;
24
+ }, false>;
25
+ /** Declare a secrets method without requiring an Effect schema from the author. */
26
+ export declare const secrets: <const F extends Fields>(options: {
27
+ readonly label: string;
28
+ readonly fields: ObjectSchema<F>;
29
+ }) => SecretsMethod<ObjectSchema<F>>;
30
+ /** Declare OAuth discovery/endpoints and an optional app-visible response projection. */
31
+ export declare function oauth2(options: OAuth2Config): OAuth2Method<typeof OAuth2AccessToken>;
32
+ export declare function oauth2<Response extends Schema<unknown, boolean>>(options: OAuth2Config & {
33
+ readonly response: Response;
34
+ }): OAuth2Method<Response>;
35
+ export type { AccountSlots } from "./contracts/app.js";
36
+ export type { AppRequirements, AppContext, QueryContext, MutationContext, WebhookContext, } from "./contracts/context.js";
37
+ export { type App, type AppDefinition, defineApp } from "./implementation/app.js";
38
+ export type { Approval, ApprovalContext, ApprovalDecision } from "./approval.js";
39
+ type AuthorWebhook<Member, Config, State> = Member extends object ? Omit<PromiseMethods<Member>, "config" | "state"> & {
40
+ readonly config: Config;
41
+ readonly state: State;
42
+ } : never;
43
+ /** Author lifecycle methods use async functions and share native decoded context/state types. */
44
+ export type Webhook<Context extends WebhookContext, Config extends Schema<unknown, boolean>, State extends Schema<unknown, boolean>> = AuthorWebhook<NativeWebhook<Context, EffectSchema.Decoder<Infer<Config>>, EffectSchema.Decoder<Infer<State>>>, Config, State>;
45
+ export { ResponseDecodeError, ResponseStatusError } from "./contracts/http.js";
46
+ /** Native fetch-compatible response accepted at the author boundary. */
47
+ export type JsonResponse = PromiseMethods<NativeResponse>;
48
+ /** Decode a fetch response with safe status/body errors. Unexpected reader failures propagate unchanged. */
49
+ export declare const decodeJson: <T>(response: JsonResponse, schema: Schema<T, boolean>) => Promise<T>;
50
+ export { NotImplemented } from "./contracts/app.js";
51
+ export { ElicitationFailed, type FormElicitation, type ElicitationResponse, type Elicit, } from "./contracts/elicitation.js";
52
+ export { table, defineDatabase, type Table, type DatabaseReader, type Database, type DatabaseDefinition, } from "./implementation/storage.js";
53
+ export { id, userId } from "./implementation/schema.js";
54
+ export { query, mutation, withApproval, type Operation, type OperationOptions, } from "./implementation/operations.js";
55
+ export type { OperationContext } from "./contracts/operations.js";
56
+ export { workflow, type Workflow, type WorkflowDeclaration } from "./implementation/workflows.js";
57
+ export { NonRetryableError, WorkflowFailure, type WorkflowContext, type WorkflowStepContext, type WorkflowStep, type WorkflowStepOptions, type WorkflowDuration, type WorkflowReads, type WorkflowControls, } from "./contracts/workflows.js";
58
+ export { interval, cron, type ScheduleDeclaration } from "./implementation/schedules.js";
@@ -0,0 +1,8 @@
1
+ import type { ProcessConfig } from "./contracts/mcp.js";
2
+ import { type OperationKinds } from "./implementation/protocol-operations.js";
3
+ export { McpError, type McpToolContext, type ProcessConfig } from "./contracts/mcp.js";
4
+ /** Discover an account's tools; each discovery and call owns and closes its subprocess. */
5
+ export declare const stdioOperations: (config: ProcessConfig, signal?: AbortSignal, kinds?: OperationKinds) => Promise<{
6
+ queries: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "query", import("./index.js").OperationContext>>;
7
+ mutations: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "mutation", import("./index.js").OperationContext>>;
8
+ }>;
@@ -0,0 +1,10 @@
1
+ /** HTTP MCP helpers. Requires the optional @modelcontextprotocol/sdk peer. */
2
+ import { type OperationKinds } from "./implementation/protocol-operations.js";
3
+ import type { McpToolsOptions } from "./contracts/mcp.js";
4
+ export { McpError, type McpToolContext, type McpToolsOptions, type McpToolResult, } from "./contracts/mcp.js";
5
+ /** Discover operations for the selected account. Kinds override uncertain upstream read-only hints. */
6
+ export declare const mcpOperations: (options: McpToolsOptions, kinds?: OperationKinds) => Promise<{
7
+ queries: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "query", import("./index.js").OperationContext>>;
8
+ mutations: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "mutation", import("./index.js").OperationContext>>;
9
+ }>;
10
+ export type { OperationKinds } from "./implementation/protocol-operations.js";
@@ -0,0 +1,10 @@
1
+ /** OpenAPI helpers over normalized operation metadata; no optional dependency is needed. */
2
+ import { type OperationKinds } from "./implementation/protocol-operations.js";
3
+ import type { OpenapiToolsOptions } from "./contracts/openapi.js";
4
+ export { OpenapiError, type OpenapiToolsOptions, type OpenapiOperation, type CredentialBinding, type RequestParameter, } from "./contracts/openapi.js";
5
+ /** Discover operations for the selected account. Kinds override uncertain upstream read-only hints. */
6
+ export declare const openapiOperations: (options: OpenapiToolsOptions, kinds?: OperationKinds) => Promise<{
7
+ queries: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "query", import("./index.js").OperationContext>>;
8
+ mutations: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "mutation", import("./index.js").OperationContext>>;
9
+ }>;
10
+ export type { OperationKinds } from "./implementation/protocol-operations.js";
@@ -0,0 +1,7 @@
1
+ import { AsyncResult, type Atom } from "effect/unstable/reactivity";
2
+ /** Subscribe for the component lifetime. Each mount owns and disposes its registry, including StrictMode remounts. */
3
+ export declare const useAppQuery: <A, E>(atom: Atom.Atom<AsyncResult.AsyncResult<A, E>>) => {
4
+ data: A | undefined;
5
+ pending: boolean;
6
+ error: string | undefined;
7
+ };
@@ -0,0 +1,3 @@
1
+ /** Host-only app authentication protocol and bootstrap; products supply identity and session lifecycle. */
2
+ export * from "./contracts/ui-auth.js";
3
+ export { appPrivateHeaders, appSignInPage, appSignInScript } from "./implementation/ui-auth.js";
@@ -0,0 +1,3 @@
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";
@@ -0,0 +1,16 @@
1
+ /** Correlate transport and decoded outcomes without exporting response bodies or errors. */
2
+ import { Effect, Schema, Tracer } from "effect";
3
+ import { HttpClient, HttpClientError } from "effect/unstable/http";
4
+ /** A random document identity. It is never an authentication or user identifier. */
5
+ export declare const browserPageId: () => string;
6
+ /** Safe event shared with the host's error reporter and product analytics. */
7
+ export declare const BrowserOperationFailure: Schema.Struct<{
8
+ readonly error_type: Schema.Literals<readonly ["BrowserDecodeFailed", "BrowserTransportFailed", "BrowserOperationFailed"]>;
9
+ readonly trace_id: Schema.String;
10
+ readonly span_id: Schema.String;
11
+ readonly page_id: Schema.String;
12
+ }>;
13
+ /** Observe transport failure and retain only its trace identity for the subsequent decoder. */
14
+ export declare const observeBrowserTransport: (client: HttpClient.HttpClient) => HttpClient.HttpClient.With<HttpClientError.HttpClientError, never>;
15
+ /** AtomHttpApi invokes this after status/body decoding, including handled schema failures. */
16
+ export declare const observeBrowserResponse: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Tracer.ParentSpan>>;
@@ -0,0 +1,11 @@
1
+ /** Native page measurements. Observers and reporting fibers belong to the browser Layer. */
2
+ import { Effect } from "effect";
3
+ /** Collect page measurements without making them parents of unrelated API calls. */
4
+ export declare const observeBrowserPerformance: Effect.Effect<{
5
+ flush: Effect.Effect<void, never, never>;
6
+ pause: Effect.Effect<void, never, never>;
7
+ resume: Effect.Effect<void, never, never>;
8
+ hide: Effect.Effect<void, never, never>;
9
+ restore: Effect.Effect<void, never, never>;
10
+ navigation: (_path: string) => Effect.Effect<void, never, never>;
11
+ }, never, import("effect/Scope").Scope>;
@@ -0,0 +1,2 @@
1
+ /** Missing/restricted browser measurements stay absent instead of being labelled network or cold-start time. */
2
+ export declare const browserRequestTiming: (entry: unknown, origin: string) => Readonly<Record<string, string | number>> | undefined;
@@ -0,0 +1,27 @@
1
+ /** Browser-owned Effect telemetry, shared by Promise calls and Atom runtimes. */
2
+ import { Context, Effect, Layer, ManagedRuntime } from "effect";
3
+ import { OtlpExporter } from "effect/unstable/observability";
4
+ import { Atom } from "effect/unstable/reactivity";
5
+ import type { TelemetryConfig } from "./config.js";
6
+ declare const BrowserTelemetry_base: Context.ServiceClass<BrowserTelemetry, "executor/BrowserTelemetry", {
7
+ readonly navigation: (event: {
8
+ readonly type: "start";
9
+ readonly path: string;
10
+ } | {
11
+ readonly type: "end";
12
+ }) => Effect.Effect<void>;
13
+ readonly flush: Effect.Effect<void>;
14
+ }>;
15
+ /** Page events use the same tracer and export scope as browser API operations. */
16
+ export declare class BrowserTelemetry extends BrowserTelemetry_base {
17
+ }
18
+ /** Install listeners for this page lifetime. Closing the Layer removes them and drains exporters. */
19
+ export declare const browserTelemetryLayer: (settings: Effect.Effect<TelemetryConfig>) => Layer.Layer<OtlpExporter.Flusher | BrowserTelemetry, never, never>;
20
+ /** Share a memo map so the page and its Atom registries acquire one telemetry Layer. */
21
+ export declare const makeBrowserTelemetry: (settings: Effect.Effect<TelemetryConfig>) => {
22
+ runtime: ManagedRuntime.ManagedRuntime<OtlpExporter.Flusher | BrowserTelemetry, never>;
23
+ atoms: Atom.SharedRuntimeFactory;
24
+ };
25
+ /** Read public build metadata and use only same-origin telemetry endpoints. */
26
+ export declare const browserSettings: (basePath: string, service: string) => Effect.Effect<TelemetryConfig>;
27
+ export { browserPageId, BrowserOperationFailure, observeBrowserTransport, observeBrowserResponse, } from "./browser-operations.js";
@@ -0,0 +1,83 @@
1
+ /** Telemetry configuration is parsed at composition roots; headers remain redacted. */
2
+ import { Config, Context, Effect, Schema } from "effect";
3
+ /** One private exporter target. Endpoints are complete signal URLs. */
4
+ export declare const TelemetryTarget: Schema.Struct<{
5
+ readonly url: Schema.String;
6
+ readonly headers: Schema.optional<Schema.RedactedFromValue<Schema.$Record<Schema.String, Schema.String>>>;
7
+ }>;
8
+ /** Parsed target with redaction-safe headers. */
9
+ export type TelemetryTarget = typeof TelemetryTarget.Type;
10
+ /** Shared identity and independently selectable OTLP signals. */
11
+ export declare const TelemetryConfig: Schema.Struct<{
12
+ readonly service: Schema.NonEmptyString;
13
+ readonly version: Schema.NonEmptyString;
14
+ readonly environment: Schema.NonEmptyString;
15
+ readonly clock: Schema.optional<Schema.Literals<readonly ["system", "cloudflare-io"]>>;
16
+ readonly traces: Schema.optional<Schema.Struct<{
17
+ readonly url: Schema.String;
18
+ readonly headers: Schema.optional<Schema.RedactedFromValue<Schema.$Record<Schema.String, Schema.String>>>;
19
+ }>>;
20
+ readonly logs: Schema.optional<Schema.Struct<{
21
+ readonly url: Schema.String;
22
+ readonly headers: Schema.optional<Schema.RedactedFromValue<Schema.$Record<Schema.String, Schema.String>>>;
23
+ }>>;
24
+ readonly metrics: Schema.optional<Schema.Struct<{
25
+ readonly url: Schema.String;
26
+ readonly headers: Schema.optional<Schema.RedactedFromValue<Schema.$Record<Schema.String, Schema.String>>>;
27
+ }>>;
28
+ readonly metricsProtocol: Schema.optional<Schema.Literals<readonly ["http/json", "http/protobuf"]>>;
29
+ }>;
30
+ /** Resolved telemetry configuration. */
31
+ export type TelemetryConfig = typeof TelemetryConfig.Type;
32
+ /** Host-only destinations; never copied into an app's invocation telemetry capability. */
33
+ export declare const CurrentTelemetryConfig: Context.Reference<{
34
+ readonly version: string;
35
+ readonly service: string;
36
+ readonly environment: string;
37
+ readonly clock?: "system" | "cloudflare-io" | undefined;
38
+ readonly traces?: {
39
+ readonly url: string;
40
+ readonly headers?: import("effect/Redacted").Redacted<{
41
+ readonly [x: string]: string;
42
+ }> | undefined;
43
+ } | undefined;
44
+ readonly logs?: {
45
+ readonly url: string;
46
+ readonly headers?: import("effect/Redacted").Redacted<{
47
+ readonly [x: string]: string;
48
+ }> | undefined;
49
+ } | undefined;
50
+ readonly metrics?: {
51
+ readonly url: string;
52
+ readonly headers?: import("effect/Redacted").Redacted<{
53
+ readonly [x: string]: string;
54
+ }> | undefined;
55
+ } | undefined;
56
+ readonly metricsProtocol?: "http/json" | "http/protobuf" | undefined;
57
+ } | undefined>;
58
+ /** Read OTLP endpoints uniformly for all signals; development chooses which signals to configure. */
59
+ export declare const telemetryConfig: (service: string) => Effect.Effect<{
60
+ readonly version: string;
61
+ readonly service: string;
62
+ readonly environment: string;
63
+ readonly clock?: "system" | "cloudflare-io" | undefined;
64
+ readonly traces?: {
65
+ readonly url: string;
66
+ readonly headers?: import("effect/Redacted").Redacted<{
67
+ readonly [x: string]: string;
68
+ }> | undefined;
69
+ } | undefined;
70
+ readonly logs?: {
71
+ readonly url: string;
72
+ readonly headers?: import("effect/Redacted").Redacted<{
73
+ readonly [x: string]: string;
74
+ }> | undefined;
75
+ } | undefined;
76
+ readonly metrics?: {
77
+ readonly url: string;
78
+ readonly headers?: import("effect/Redacted").Redacted<{
79
+ readonly [x: string]: string;
80
+ }> | undefined;
81
+ } | undefined;
82
+ readonly metricsProtocol?: "http/json" | "http/protobuf" | undefined;
83
+ }, Schema.SchemaError | Config.ConfigError, never>;
@@ -0,0 +1,14 @@
1
+ /** Explicit telemetry-only context across Promise and HTTP boundaries. */
2
+ import { Context, Effect, Tracer } from "effect";
3
+ /** Trusted in-process capability containing no product authority, database or credentials. */
4
+ export interface InvocationTelemetry {
5
+ readonly context: Context.Context<never>;
6
+ }
7
+ /** Capture the tracer, loggers, registry and parent for a host-owned callback. */
8
+ export declare const captureTelemetry: Effect.Effect<InvocationTelemetry>;
9
+ /** Encode the active span; absent tracing remains a valid no-header case. */
10
+ export declare const traceHeaders: Effect.Effect<Readonly<Record<string, string>>>;
11
+ /** Decode W3C context and start a server span in the recipient's own telemetry runtime. */
12
+ export declare const withRemoteSpan: (request: Request, name: string) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Tracer.ParentSpan>>;
13
+ /** Plain fetch for app authors, correlated with the invocation and cancelled by its owner. */
14
+ export declare const invocationFetch: (signal: AbortSignal) => Effect.Effect<(input: string | URL | Request, init?: RequestInit) => Promise<Response>, never, never>;
@@ -0,0 +1,9 @@
1
+ /** Effect-native observability shared by Executor hosts and framework operations. */
2
+ export { CurrentTelemetryConfig, TelemetryConfig, TelemetryTarget, telemetryConfig, } from "./config.js";
3
+ export { telemetryLayer, telemetryFromConfig } from "./layer.js";
4
+ export { captureTelemetry, traceHeaders, withRemoteSpan, invocationFetch, type InvocationTelemetry, } from "./context.js";
5
+ export { collectTelemetry, forwardTelemetry, makeTelemetryForwarder, TelemetryBatch, } from "./relay.js";
6
+ export { TraceContext, currentTraceContext, externalTrace, traceLinks } from "./trace-context.js";
7
+ export { pendingSpan } from "./pending-span.js";
8
+ export { recordWorkerMeasurements } from "./measurements.js";
9
+ export { allowlistedSpans, httpSpanAttributeAllowlist, spanAttributeAllowed, } from "./span-attributes.js";
@@ -0,0 +1,7 @@
1
+ /** Portable Effect exporters. The host owns scope and export lifetime. */
2
+ import { Layer, Logger } from "effect";
3
+ import { type TelemetryConfig } from "./config.js";
4
+ /** Build one tracer per runtime. Event mode defers export until Worker scope finalization. */
5
+ export declare const telemetryLayer: (config: TelemetryConfig, lifetime?: "process" | "event", logger?: Logger.Logger<unknown, void>) => Layer.Layer<import("effect/unstable/observability/OtlpExporter").Flusher, never, never>;
6
+ /** Node/local entry points resolve telemetry once and share it for their process lifetime. */
7
+ export declare const telemetryFromConfig: (service: string) => Layer.Layer<import("effect/unstable/observability/OtlpExporter").Flusher, import("effect/Schema").SchemaError | import("effect/Config").ConfigError, never>;
@@ -0,0 +1,8 @@
1
+ /** Low-cardinality transport measurements; these are wall/CPU totals with explicit units, not app data. */
2
+ import { Effect } from "effect";
3
+ /** Classify URLs into a fixed set before attaching attributes; raw paths and query strings are never labels. */
4
+ export declare const recordResponseReady: (path: string | undefined, method: string, status: number, milliseconds: number) => Effect.Effect<void, never, never>;
5
+ /** Fixed failure metadata goes to both local/native logs and the metric registry, even when the remote exporter is down. */
6
+ export declare const recordExportFailure: (path: string, reason?: "transport" | "interrupted" | "partial-success" | "capacity" | "acknowledgement", records?: number) => Effect.Effect<void, never, never>;
7
+ /** Record provider-owned invocation totals separately from response-ready timing. */
8
+ export declare const recordWorkerMeasurements: (worker: string, outcome: string, cpu: number, wall: number) => Effect.Effect<void, never, never>;
@@ -0,0 +1,7 @@
1
+ /** A span ending at an asynchronous milestone, with cancellation owned by its enclosing scope. */
2
+ import { Effect, Exit, type Tracer } from "effect";
3
+ /** End exactly once at completion, failure, or scope release. It is not installed as a parent implicitly. */
4
+ export declare const pendingSpan: (name: string, options?: Tracer.SpanOptionsNoTrace) => Effect.Effect<{
5
+ span: Tracer.Span;
6
+ finish: (exit: Exit.Exit<unknown, unknown>) => Effect.Effect<void, never, never>;
7
+ }, never, import("effect/Scope").Scope>;
@@ -0,0 +1,28 @@
1
+ /** Bounded OTLP return channel for credential-free app isolates. The parent owns export. */
2
+ import { Effect, Schema } from "effect";
3
+ /**
4
+ * Forward app telemetry in the host scope without delaying an app result.
5
+ * One export runs at a time, with at most sixteen pending batches. Overload and
6
+ * shutdown loss are reported through the normal safe export-failure signal.
7
+ * Scope release drains for the same three-second budget as the other exporters.
8
+ */
9
+ export declare const makeTelemetryForwarder: Effect.Effect<(batch: TelemetryBatch, traceId: string, build?: string) => Effect.Effect<void, never, never>, never, import("effect/Scope").Scope>;
10
+ /** Untrusted isolate batches are bounded before decoding; no endpoint or credential crosses back. */
11
+ export declare const TelemetryBatch: Schema.Struct<{
12
+ readonly traces: Schema.$Array<Schema.String>;
13
+ readonly logs: Schema.$Array<Schema.String>;
14
+ readonly dropped: Schema.Int;
15
+ }>;
16
+ /** Parsed isolate telemetry envelope. */
17
+ export type TelemetryBatch = typeof TelemetryBatch.Type;
18
+ /** Collect one invocation into memory, flush before returning, and never contact a remote collector. */
19
+ export declare const collectTelemetry: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<{
20
+ value: A;
21
+ telemetry: {
22
+ traces: string[];
23
+ logs: string[];
24
+ dropped: number;
25
+ };
26
+ }, E, Exclude<Exclude<R, import("effect/unstable/observability/OtlpExporter").Flusher>, never>>;
27
+ /** Validate isolated records and export only this call's trace, using parent-owned credentials/identity. */
28
+ export declare const forwardTelemetry: (batch: TelemetryBatch, traceId: string | undefined, build: string | undefined, service?: "executor-app" | "executor-web") => Effect.Effect<void, Schema.SchemaError | import("effect/unstable/http/HttpClientError").HttpClientError | import("effect/Cause").TimeoutError, never>;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * HTTP span attributes are allowlisted. Nothing else in an HTTP namespace is recorded.
3
+ *
4
+ * Effect's HTTP client and its server tracer write every request and response
5
+ * header, the full URL and the query string onto their spans. This product
6
+ * routes provider API keys through header and query names chosen by an imported
7
+ * OpenAPI spec, and carries bearer capabilities such as the one-click
8
+ * unsubscribe token in a query parameter and in a redirect `Location` header.
9
+ * No list of dangerous names can keep up with that, so HTTP spans record a
10
+ * fixed set of attributes and drop everything else.
11
+ *
12
+ * The allowlist runs on the tracer because that is the single point where the
13
+ * client tracer and the server tracer meet. Effect's
14
+ * `HttpClient.TracerHeaderFilter` controls outgoing headers only: nothing
15
+ * configures the URL attributes on either side, and the server tracer has no
16
+ * header hook at all. A second filter on the client would duplicate this one
17
+ * rather than complete it, so this is the only boundary.
18
+ *
19
+ * Attributes outside these namespaces are the product's own and pass through.
20
+ */
21
+ import { Layer } from "effect";
22
+ /** Every HTTP attribute an exported span may carry. */
23
+ export declare const httpSpanAttributeAllowlist: ReadonlySet<string>;
24
+ /** Record this attribute? HTTP names must be allowlisted; product names pass through. */
25
+ export declare const spanAttributeAllowed: (key: string) => boolean;
26
+ /** Wrap whichever tracer is already in scope; provide this above the exporter. */
27
+ export declare const spanAttributes: (clock?: "system" | "cloudflare-io", recordAll?: boolean) => Layer.Layer<never>;
28
+ /** Header and URL filtering without making an unsupported claim about the runtime clock. */
29
+ export declare const allowlistedSpans: Layer.Layer<never, never, never>;
@@ -0,0 +1,20 @@
1
+ /** Safe W3C identifiers for correlation across transports that do not carry HTTP headers. */
2
+ import { Effect, Option, Schema, Tracer } from "effect";
3
+ /** Trace metadata conveys no authorization and must never contain app values or credentials. */
4
+ export declare const TraceContext: Schema.Struct<{
5
+ readonly traceId: Schema.String;
6
+ readonly spanId: Schema.String;
7
+ readonly sampled: Schema.Boolean;
8
+ }>;
9
+ /** Decoded, non-authorizing trace identity. */
10
+ export type TraceContext = typeof TraceContext.Type;
11
+ /** Capture only the current span's transport-safe identity. */
12
+ export declare const currentTraceContext: Effect.Effect<{
13
+ readonly traceId: string;
14
+ readonly spanId: string;
15
+ readonly sampled: boolean;
16
+ } | undefined, never, never>;
17
+ /** Invalid or absent optional telemetry never prevents otherwise valid application data from rendering. */
18
+ export declare const externalTrace: (input: unknown) => Option.Option<Tracer.ExternalSpan>;
19
+ /** Link a measurement to the observed request without inventing a parent/child lifetime. */
20
+ export declare const traceLinks: (input: unknown, relationship: string) => ReadonlyArray<Tracer.SpanLink>;
@@ -0,0 +1,6 @@
1
+ import { Context, Layer } from "effect";
2
+ import { HttpClient } from "effect/unstable/http";
3
+ /** Local collector discovery can resolve its destination when an export runs. */
4
+ export declare const CurrentTelemetryClient: Context.Reference<HttpClient.HttpClient | undefined>;
5
+ /** Telemetry consumers inspect status and headers; release response I/O inside each export scope. */
6
+ export declare const telemetryHttpClient: Layer.Layer<HttpClient.HttpClient, never, never>;