apps 0.0.1-beta.1 → 0.0.1-beta.100
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 +112 -72
- package/framework-reference.json +1 -1
- package/js/browser-XIPJGLH2.js +65 -0
- package/js/chunk-2CURR5Y7.js +264 -0
- package/js/chunk-2LSGC7XY.js +42 -0
- package/js/{chunk-YEJOQEII.js → chunk-4PIQKACY.js} +65 -10
- package/js/chunk-4UPC36ZL.js +5185 -0
- package/js/{chunk-4LPG6RCH.js → chunk-4X2UI4R2.js} +7 -27
- package/js/chunk-5C6RAGAS.js +335 -0
- package/js/chunk-62NVUKED.js +39 -0
- package/js/chunk-74H25C4X.js +95 -0
- package/js/chunk-7HG422GB.js +90 -0
- package/js/chunk-7STIP5CS.js +171 -0
- package/js/{chunk-QKHR7BMF.js → chunk-ACQXVKVQ.js} +87 -51
- package/js/{chunk-OHRT55C4.js → chunk-DILSCQPJ.js} +226 -265
- package/js/chunk-ILYCJ3HV.js +449 -0
- package/js/chunk-K6TSCYAO.js +712 -0
- package/js/{chunk-EVJUVWN2.js → chunk-KLSEU35Y.js} +463 -218
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/chunk-OWN3DP2W.js +88 -0
- package/js/{chunk-ZTFQHGEB.js → chunk-PBGPES67.js} +3 -5
- package/js/chunk-QI66R4FP.js +786 -0
- package/js/chunk-RN4YB4JT.js +1922 -0
- package/js/{chunk-ZCAMUXSG.js → chunk-URKOTNDA.js} +795 -177
- package/js/{chunk-NCYXZN2G.js → chunk-UVL56Z6E.js} +390 -23
- package/js/{chunk-2HHMABB6.js → chunk-VAI3EVCS.js} +700 -78
- package/js/chunk-VCYWAA4N.js +49 -0
- package/js/{chunk-HDJH3RPR.js → chunk-YDW7DX3A.js} +4 -4
- package/js/chunk-YWVISRZD.js +268 -0
- package/js/{chunk-FW5HBOIK.js → chunk-ZKDXML77.js} +19272 -18299
- package/js/client.js +148 -100
- package/js/contracts.js +208 -24
- package/js/effect.js +18 -19
- package/js/es-DIULA3ZF.js +39371 -0
- package/js/graphql.js +62 -58
- package/js/host.js +83 -60
- package/js/index.js +381 -263
- package/js/mcp/effect.js +21 -21
- package/js/mcp.js +117 -74
- package/js/openapi.js +4613 -42691
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -4
- package/js/skills.js +233 -70
- package/js/storage/facet.js +1 -540
- package/js/ui/auth/contracts.js +8 -9
- package/js/ui/auth.js +16 -14
- package/js/ui/contracts.js +9 -8
- package/js/ui/serving.js +8609 -227
- package/package.json +3 -8
- package/runtime.json +1 -1
- package/types/app-cache/src/contracts/cache.d.ts +60 -2
- package/types/app-cache/src/index.d.ts +92 -2
- package/types/app-data/src/contracts/database.d.ts +33 -6
- package/types/apps/src/contracts/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/app.d.ts +63 -17
- package/types/apps/src/contracts/cache.d.ts +24 -1
- package/types/apps/src/contracts/context.d.ts +60 -17
- package/types/apps/src/contracts/elicitation.d.ts +23 -7
- package/types/apps/src/contracts/events.d.ts +94 -0
- package/types/apps/src/contracts/failure.d.ts +54 -0
- package/types/apps/src/contracts/graphql.d.ts +2 -1
- package/types/apps/src/contracts/host.d.ts +1325 -534
- package/types/apps/src/contracts/icons.d.ts +28 -0
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +97 -20
- package/types/apps/src/contracts/network.d.ts +120 -0
- package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
- package/types/apps/src/contracts/openapi-document.d.ts +1 -1
- package/types/apps/src/contracts/openapi.d.ts +51 -9
- package/types/apps/src/contracts/operations.d.ts +14 -12
- package/types/apps/src/contracts/placement.d.ts +102 -0
- package/types/apps/src/contracts/protocol-version.d.ts +6 -0
- package/types/apps/src/contracts/protocols/1.d.ts +2241 -0
- package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
- package/types/apps/src/contracts/protocols/11.d.ts +1149 -0
- package/types/apps/src/contracts/protocols/12.d.ts +3310 -0
- package/types/apps/src/contracts/protocols/2.d.ts +711 -0
- package/types/apps/src/contracts/protocols/3.d.ts +776 -0
- package/types/apps/src/contracts/protocols/4.d.ts +1306 -0
- package/types/apps/src/contracts/protocols/5.d.ts +1200 -0
- package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
- package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
- package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
- package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
- package/types/apps/src/contracts/protocols/current.d.ts +6857 -0
- package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
- package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
- package/types/apps/src/contracts/provider-error.d.ts +9 -0
- package/types/apps/src/contracts/provider.d.ts +140 -10
- package/types/apps/src/contracts/router.d.ts +59 -0
- package/types/apps/src/contracts/schedules.d.ts +7 -1
- package/types/apps/src/contracts/schema.d.ts +21 -0
- package/types/apps/src/contracts/shared-catalog.d.ts +11 -0
- package/types/apps/src/contracts/skills.d.ts +60 -14
- package/types/apps/src/contracts/sql.d.ts +63 -0
- package/types/apps/src/contracts/ui-auth.d.ts +6 -14
- package/types/apps/src/contracts/ui.d.ts +70 -30
- package/types/apps/src/contracts/webhooks.d.ts +24 -7
- package/types/apps/src/contracts/workflows.d.ts +89 -36
- package/types/apps/src/facet.d.ts +4 -5
- package/types/apps/src/graphql.d.ts +1 -3
- package/types/apps/src/host.d.ts +5 -0
- package/types/apps/src/implementation/account-router.d.ts +13 -0
- package/types/apps/src/implementation/app.d.ts +44 -16
- package/types/apps/src/implementation/authoring.d.ts +25 -5
- package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
- package/types/apps/src/implementation/cache.d.ts +32 -3
- package/types/apps/src/implementation/catalog-cache.d.ts +43 -5
- package/types/apps/src/implementation/elicitation.d.ts +18 -15
- package/types/apps/src/implementation/events.d.ts +64 -0
- package/types/apps/src/implementation/failure-detail.d.ts +48 -0
- package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
- package/types/apps/src/implementation/graphql.d.ts +4 -3
- package/types/apps/src/implementation/input-problems.d.ts +6 -2
- package/types/apps/src/implementation/invocation-timing.d.ts +18 -0
- package/types/apps/src/implementation/live.d.ts +2 -2
- package/types/apps/src/implementation/mcp-call.d.ts +6 -5
- package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
- package/types/apps/src/implementation/mcp-client.d.ts +49 -25
- package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
- package/types/apps/src/implementation/mcp.d.ts +52 -25
- package/types/apps/src/implementation/network.d.ts +16 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +30 -8
- package/types/apps/src/implementation/openapi-document.d.ts +46 -21
- package/types/apps/src/implementation/openapi-names.d.ts +23 -0
- package/types/apps/src/implementation/openapi-request.d.ts +10 -3
- package/types/apps/src/implementation/openapi-source.d.ts +30 -8
- package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
- package/types/apps/src/implementation/operations.d.ts +84 -10
- package/types/apps/src/implementation/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/placement.d.ts +60 -0
- package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
- package/types/apps/src/implementation/provider-error.d.ts +28 -1
- package/types/apps/src/implementation/provider.d.ts +26 -6
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +227 -0
- package/types/apps/src/implementation/router.d.ts +78 -0
- package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
- package/types/apps/src/implementation/schedules.d.ts +39 -8
- package/types/apps/src/implementation/schema.d.ts +111 -15
- package/types/apps/src/implementation/skills.d.ts +18 -24
- package/types/apps/src/implementation/sql.d.ts +71 -0
- package/types/apps/src/implementation/swagger-client.d.ts +28 -0
- package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
- package/types/apps/src/implementation/ui-auth.d.ts +12 -6
- package/types/apps/src/implementation/ui-client.d.ts +3 -3
- package/types/apps/src/implementation/ui-document.d.ts +5 -0
- package/types/apps/src/implementation/ui-errors.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +31 -12
- package/types/apps/src/implementation/ui-watch.d.ts +1 -1
- package/types/apps/src/implementation/upstream-error.d.ts +7 -0
- package/types/apps/src/implementation/webhooks.d.ts +15 -6
- package/types/apps/src/implementation/workflow-context.d.ts +17 -5
- package/types/apps/src/implementation/workflows.d.ts +11 -4
- package/types/apps/src/index.d.ts +71 -21
- package/types/apps/src/mcp.d.ts +25 -5
- package/types/apps/src/openapi.d.ts +11 -6
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +13 -8
- package/types/apps/src/ui-auth.d.ts +2 -2
- package/types/apps/src/ui-serving.d.ts +1 -1
- package/types/telemetry/src/app-records.d.ts +42 -0
- package/types/telemetry/src/browser-operations.d.ts +7 -4
- package/types/telemetry/src/browser.d.ts +8 -3
- package/types/telemetry/src/config.d.ts +2 -2
- package/types/telemetry/src/index.d.ts +2 -1
- package/types/telemetry/src/layer.d.ts +10 -4
- package/types/telemetry/src/measurements.d.ts +1 -1
- package/types/telemetry/src/ownership.d.ts +60 -0
- package/types/telemetry/src/recorded-failure.d.ts +29 -0
- package/types/telemetry/src/relay.d.ts +16 -6
- package/types/telemetry/src/span-attributes.d.ts +17 -1
- package/types/telemetry/src/transport.d.ts +8 -1
- package/types/utils/src/api-error.d.ts +55 -0
- package/types/utils/src/connection-failure.d.ts +33 -0
- package/types/utils/src/legacy-keys.d.ts +20 -0
- package/types/utils/src/recorded-message.d.ts +18 -0
- package/types/utils/src/schema-definitions.d.ts +13 -0
- package/types/utils/src/user-facing-error.d.ts +83 -0
- package/js/chunk-6IIO4NPI.js +0 -29
- package/js/chunk-6YBRWRK3.js +0 -160
- package/js/chunk-BMOIAIVR.js +0 -138
- package/js/chunk-FZJOYIZO.js +0 -19
- package/js/chunk-G7IE6BKC.js +0 -224
- package/js/chunk-IHQ4ML7K.js +0 -2193
- package/js/chunk-KOXMLKTM.js +0 -1288
- package/js/chunk-M6ZRRIBI.js +0 -877
- package/js/chunk-PLCMJREA.js +0 -590
- package/js/chunk-PZ36XMXW.js +0 -93
- package/js/chunk-RBAC33PQ.js +0 -267
- package/js/chunk-SATWJKN6.js +0 -34
- package/js/chunk-SWPD52J7.js +0 -35
- package/js/chunk-TE4KO4HI.js +0 -47
- package/js/chunk-W7D7WVSY.js +0 -18
- package/js/chunk-X7SFGU4Q.js +0 -280
- package/js/chunk-ZJWDMTE3.js +0 -63
- package/js/mcp/stdio.js +0 -128
- package/types/app-data/src/implementation/cursor.d.ts +0 -10
- package/types/app-data/src/implementation/index-key.d.ts +0 -7
- package/types/app-data/src/implementation/promise.d.ts +0 -68
- package/types/app-data/src/implementation/range.d.ts +0 -8
- package/types/app-data/src/implementation/schema.d.ts +0 -33
- package/types/app-data/src/implementation/sqlite.d.ts +0 -11
- package/types/app-data/src/index.d.ts +0 -4
- package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
- package/types/apps/src/contracts/storage.d.ts +0 -68
- package/types/apps/src/implementation/account-operations.d.ts +0 -151
- package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
- package/types/apps/src/implementation/mcp-stdio.d.ts +0 -4
- package/types/apps/src/implementation/storage.d.ts +0 -13
- package/types/apps/src/mcp-stdio.d.ts +0 -8
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/** Portable workflow declarations, run views and durable execution capabilities. */
|
|
2
|
+
import { withLegacyKeys } from "../../../utils/src/legacy-keys.js";
|
|
2
3
|
import { Schema, type Effect } from "effect";
|
|
4
|
+
import { RecordedMessage } from "../../../utils/src/recorded-message.js";
|
|
3
5
|
import { JsonValue } from "./schema.js";
|
|
4
6
|
import type { AppContext, AppRequirements, QueryContext, MutationContext } from "./context.js";
|
|
7
|
+
import type { AccountScope } from "./app.js";
|
|
5
8
|
import type { Operation } from "../implementation/operations.js";
|
|
6
9
|
import type { HostContext } from "./host.js";
|
|
7
10
|
/** Run identity is opaque and shared by author and SDK interfaces. */
|
|
@@ -24,14 +27,38 @@ export declare const WorkflowStepOptions: Schema.Struct<{
|
|
|
24
27
|
readonly timeout: Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.NonEmptyString]>>;
|
|
25
28
|
}>;
|
|
26
29
|
export type WorkflowStepOptions = typeof WorkflowStepOptions.Type;
|
|
30
|
+
/**
|
|
31
|
+
* Where and why a run failed: the failing step and the error the app's own code raised, its
|
|
32
|
+
* message bounded and with account secrets replaced. Runs from before these fields existed have none.
|
|
33
|
+
*/
|
|
34
|
+
export declare const WorkflowFailureDetail: {
|
|
35
|
+
step: Schema.optionalKey<Schema.String>;
|
|
36
|
+
errorName: Schema.optionalKey<Schema.String>;
|
|
37
|
+
message: Schema.optionalKey<Schema.String>;
|
|
38
|
+
};
|
|
39
|
+
/** A failed run's recorded step and app error. */
|
|
40
|
+
export declare const WorkflowRunFailure: Schema.Struct<{
|
|
41
|
+
step: Schema.optionalKey<Schema.String>;
|
|
42
|
+
errorName: Schema.optionalKey<Schema.String>;
|
|
43
|
+
message: Schema.optionalKey<Schema.String>;
|
|
44
|
+
}>;
|
|
45
|
+
export type WorkflowRunFailure = typeof WorkflowRunFailure.Type;
|
|
27
46
|
declare const WorkflowFailure_base: Schema.Class<WorkflowFailure, Schema.TaggedStruct<"WorkflowFailure", {
|
|
28
47
|
readonly reason: Schema.Literals<readonly ["unavailable", "not_found", "input", "output", "operation", "approval", "credentials", "terminated", "execution", "conflict", "engine"]>;
|
|
29
48
|
readonly retryable: Schema.Boolean;
|
|
49
|
+
readonly step: Schema.optionalKey<Schema.String>;
|
|
50
|
+
readonly errorName: Schema.optionalKey<Schema.String>;
|
|
51
|
+
readonly message: Schema.optionalKey<Schema.String>;
|
|
30
52
|
}>, import("effect/Cause").YieldableError>;
|
|
31
|
-
/**
|
|
53
|
+
/** Failures cross host boundaries as reason codes plus the app's own bounded error detail. */
|
|
32
54
|
export declare class WorkflowFailure extends WorkflowFailure_base {
|
|
55
|
+
/**
|
|
56
|
+
* The step name and error detail are the app's. Its run's owner reads them; telemetry records
|
|
57
|
+
* only the reason, however the failure was built or decoded.
|
|
58
|
+
*/
|
|
59
|
+
get [RecordedMessage](): string | undefined;
|
|
33
60
|
}
|
|
34
|
-
/** Explicitly stop retrying an authored step. Its message
|
|
61
|
+
/** Explicitly stop retrying an authored step. Its message is reported like any step error. */
|
|
35
62
|
export declare class NonRetryableError extends Error {
|
|
36
63
|
readonly name = "NonRetryableError";
|
|
37
64
|
}
|
|
@@ -45,79 +72,102 @@ export declare const HostedWorkflow: Schema.Struct<{
|
|
|
45
72
|
readonly outputSchema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
46
73
|
}>;
|
|
47
74
|
export type HostedWorkflow = typeof HostedWorkflow.Type;
|
|
48
|
-
/**
|
|
49
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Results are available only on completed runs; failures carry a reason code and app error detail.
|
|
77
|
+
* Runs name their version under its former name too, for apps and callers written before the rename.
|
|
78
|
+
*/
|
|
79
|
+
export declare const WorkflowRun: Schema.Union<readonly [withLegacyKeys<Schema.Struct<{
|
|
50
80
|
readonly status: Schema.Literals<readonly ["queued", "running", "waiting", "paused", "waitingForPause"]>;
|
|
51
|
-
readonly profile: Schema.optionalKey<Schema.NonEmptyString>;
|
|
52
81
|
readonly id: Schema.brand<Schema.NonEmptyString, "wfr">;
|
|
53
82
|
readonly app: Schema.NonEmptyString;
|
|
54
|
-
readonly
|
|
83
|
+
readonly version: Schema.NonEmptyString;
|
|
55
84
|
readonly workflow: Schema.NonEmptyString;
|
|
56
85
|
readonly createdAt: Schema.String;
|
|
57
|
-
}>,
|
|
86
|
+
}>, {
|
|
87
|
+
readonly version: "deployment";
|
|
88
|
+
}>, withLegacyKeys<Schema.Struct<{
|
|
58
89
|
readonly status: Schema.Literal<"complete">;
|
|
59
90
|
readonly output: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
60
|
-
readonly profile: Schema.optionalKey<Schema.NonEmptyString>;
|
|
61
91
|
readonly id: Schema.brand<Schema.NonEmptyString, "wfr">;
|
|
62
92
|
readonly app: Schema.NonEmptyString;
|
|
63
|
-
readonly
|
|
93
|
+
readonly version: Schema.NonEmptyString;
|
|
64
94
|
readonly workflow: Schema.NonEmptyString;
|
|
65
95
|
readonly createdAt: Schema.String;
|
|
66
|
-
}>,
|
|
96
|
+
}>, {
|
|
97
|
+
readonly version: "deployment";
|
|
98
|
+
}>, withLegacyKeys<Schema.Struct<{
|
|
67
99
|
readonly status: Schema.Literal<"errored">;
|
|
68
100
|
readonly error: Schema.Literals<readonly ["unavailable", "not_found", "input", "output", "operation", "approval", "credentials", "terminated", "execution", "conflict", "engine"]>;
|
|
69
|
-
|
|
101
|
+
/** The failing step and the app's own error, when the run recorded them. */
|
|
102
|
+
readonly failure: Schema.optionalKey<Schema.Struct<{
|
|
103
|
+
step: Schema.optionalKey<Schema.String>;
|
|
104
|
+
errorName: Schema.optionalKey<Schema.String>;
|
|
105
|
+
message: Schema.optionalKey<Schema.String>;
|
|
106
|
+
}>>;
|
|
70
107
|
readonly id: Schema.brand<Schema.NonEmptyString, "wfr">;
|
|
71
108
|
readonly app: Schema.NonEmptyString;
|
|
72
|
-
readonly
|
|
109
|
+
readonly version: Schema.NonEmptyString;
|
|
73
110
|
readonly workflow: Schema.NonEmptyString;
|
|
74
111
|
readonly createdAt: Schema.String;
|
|
75
|
-
}>,
|
|
112
|
+
}>, {
|
|
113
|
+
readonly version: "deployment";
|
|
114
|
+
}>, withLegacyKeys<Schema.Struct<{
|
|
76
115
|
readonly status: Schema.Literal<"terminated">;
|
|
77
|
-
readonly profile: Schema.optionalKey<Schema.NonEmptyString>;
|
|
78
116
|
readonly id: Schema.brand<Schema.NonEmptyString, "wfr">;
|
|
79
117
|
readonly app: Schema.NonEmptyString;
|
|
80
|
-
readonly
|
|
118
|
+
readonly version: Schema.NonEmptyString;
|
|
81
119
|
readonly workflow: Schema.NonEmptyString;
|
|
82
120
|
readonly createdAt: Schema.String;
|
|
121
|
+
}>, {
|
|
122
|
+
readonly version: "deployment";
|
|
83
123
|
}>]>;
|
|
84
124
|
export type WorkflowRun = typeof WorkflowRun.Type;
|
|
85
125
|
/** A bounded run-history page, already scoped to an authorized configured app. */
|
|
86
126
|
export declare const WorkflowRunPage: Schema.Struct<{
|
|
87
|
-
readonly items: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
127
|
+
readonly items: Schema.$Array<Schema.Union<readonly [withLegacyKeys<Schema.Struct<{
|
|
88
128
|
readonly status: Schema.Literals<readonly ["queued", "running", "waiting", "paused", "waitingForPause"]>;
|
|
89
|
-
readonly profile: Schema.optionalKey<Schema.NonEmptyString>;
|
|
90
129
|
readonly id: Schema.brand<Schema.NonEmptyString, "wfr">;
|
|
91
130
|
readonly app: Schema.NonEmptyString;
|
|
92
|
-
readonly
|
|
131
|
+
readonly version: Schema.NonEmptyString;
|
|
93
132
|
readonly workflow: Schema.NonEmptyString;
|
|
94
133
|
readonly createdAt: Schema.String;
|
|
95
|
-
}>,
|
|
134
|
+
}>, {
|
|
135
|
+
readonly version: "deployment";
|
|
136
|
+
}>, withLegacyKeys<Schema.Struct<{
|
|
96
137
|
readonly status: Schema.Literal<"complete">;
|
|
97
138
|
readonly output: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
98
|
-
readonly profile: Schema.optionalKey<Schema.NonEmptyString>;
|
|
99
139
|
readonly id: Schema.brand<Schema.NonEmptyString, "wfr">;
|
|
100
140
|
readonly app: Schema.NonEmptyString;
|
|
101
|
-
readonly
|
|
141
|
+
readonly version: Schema.NonEmptyString;
|
|
102
142
|
readonly workflow: Schema.NonEmptyString;
|
|
103
143
|
readonly createdAt: Schema.String;
|
|
104
|
-
}>,
|
|
144
|
+
}>, {
|
|
145
|
+
readonly version: "deployment";
|
|
146
|
+
}>, withLegacyKeys<Schema.Struct<{
|
|
105
147
|
readonly status: Schema.Literal<"errored">;
|
|
106
148
|
readonly error: Schema.Literals<readonly ["unavailable", "not_found", "input", "output", "operation", "approval", "credentials", "terminated", "execution", "conflict", "engine"]>;
|
|
107
|
-
|
|
149
|
+
/** The failing step and the app's own error, when the run recorded them. */
|
|
150
|
+
readonly failure: Schema.optionalKey<Schema.Struct<{
|
|
151
|
+
step: Schema.optionalKey<Schema.String>;
|
|
152
|
+
errorName: Schema.optionalKey<Schema.String>;
|
|
153
|
+
message: Schema.optionalKey<Schema.String>;
|
|
154
|
+
}>>;
|
|
108
155
|
readonly id: Schema.brand<Schema.NonEmptyString, "wfr">;
|
|
109
156
|
readonly app: Schema.NonEmptyString;
|
|
110
|
-
readonly
|
|
157
|
+
readonly version: Schema.NonEmptyString;
|
|
111
158
|
readonly workflow: Schema.NonEmptyString;
|
|
112
159
|
readonly createdAt: Schema.String;
|
|
113
|
-
}>,
|
|
160
|
+
}>, {
|
|
161
|
+
readonly version: "deployment";
|
|
162
|
+
}>, withLegacyKeys<Schema.Struct<{
|
|
114
163
|
readonly status: Schema.Literal<"terminated">;
|
|
115
|
-
readonly profile: Schema.optionalKey<Schema.NonEmptyString>;
|
|
116
164
|
readonly id: Schema.brand<Schema.NonEmptyString, "wfr">;
|
|
117
165
|
readonly app: Schema.NonEmptyString;
|
|
118
|
-
readonly
|
|
166
|
+
readonly version: Schema.NonEmptyString;
|
|
119
167
|
readonly workflow: Schema.NonEmptyString;
|
|
120
168
|
readonly createdAt: Schema.String;
|
|
169
|
+
}>, {
|
|
170
|
+
readonly version: "deployment";
|
|
121
171
|
}>]>>;
|
|
122
172
|
readonly next: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "wfr">>;
|
|
123
173
|
}>;
|
|
@@ -144,25 +194,28 @@ export interface WorkflowControls extends WorkflowReads {
|
|
|
144
194
|
readonly run: string;
|
|
145
195
|
}) => Promise<WorkflowRun>;
|
|
146
196
|
}
|
|
147
|
-
/**
|
|
148
|
-
|
|
197
|
+
/**
|
|
198
|
+
* External steps get fresh credentials and cancellation, without storage or live elicitation. A run
|
|
199
|
+
* started by app-scope work, such as an app schedule, has the `"app"` scope: no `user`.
|
|
200
|
+
*/
|
|
201
|
+
export type WorkflowStepContext<Requirements extends AppRequirements = AppRequirements, Scope extends AccountScope = "user"> = Omit<AppContext<Requirements, Scope>, "elicit" | "workflows"> & {
|
|
149
202
|
readonly runId: WorkflowRunId;
|
|
150
203
|
readonly stepId: string;
|
|
151
204
|
readonly idempotencyKey: string;
|
|
152
205
|
};
|
|
153
206
|
/** Explicit durable boundaries; database access passes through registered app operations. */
|
|
154
|
-
export interface WorkflowStep<Requirements extends AppRequirements = AppRequirements> {
|
|
155
|
-
do<Output>(name: string, run: (context: WorkflowStepContext<Requirements>) => Promise<Output>): Promise<Output>;
|
|
156
|
-
do<Output>(name: string, options: WorkflowStepOptions, run: (context: WorkflowStepContext<Requirements>) => Promise<Output>): Promise<Output>;
|
|
157
|
-
runQuery<Input, Output>(name: string, operation: Operation<Input, Output, "query", QueryContext<Requirements>>, input: NoInfer<Input>, options?: WorkflowStepOptions): Promise<Output>;
|
|
158
|
-
runMutation<Input, Output>(name: string, operation: Operation<Input, Output, "mutation", MutationContext<Requirements>>, input: NoInfer<Input>, options?: WorkflowStepOptions): Promise<Output>;
|
|
207
|
+
export interface WorkflowStep<Requirements extends AppRequirements = AppRequirements, Scope extends AccountScope = "user"> {
|
|
208
|
+
do<Output>(name: string, run: (context: WorkflowStepContext<Requirements, Scope>) => Promise<Output>): Promise<Output>;
|
|
209
|
+
do<Output>(name: string, options: WorkflowStepOptions, run: (context: WorkflowStepContext<Requirements, Scope>) => Promise<Output>): Promise<Output>;
|
|
210
|
+
runQuery<Input, Output>(name: string, operation: Operation<Input, Output, "query", QueryContext<Requirements, Scope>>, input: NoInfer<Input>, options?: WorkflowStepOptions): Promise<Output>;
|
|
211
|
+
runMutation<Input, Output>(name: string, operation: Operation<Input, Output, "mutation", MutationContext<Requirements, Scope>>, input: NoInfer<Input>, options?: WorkflowStepOptions): Promise<Output>;
|
|
159
212
|
readonly sleep: (name: string, duration: WorkflowDuration) => Promise<void>;
|
|
160
213
|
readonly sleepUntil: (name: string, timestamp: number | Date) => Promise<void>;
|
|
161
214
|
}
|
|
162
215
|
/** The orchestration body gets no account, database or interactive capabilities. */
|
|
163
|
-
export interface WorkflowContext<Requirements extends AppRequirements = AppRequirements> {
|
|
216
|
+
export interface WorkflowContext<Requirements extends AppRequirements = AppRequirements, Scope extends AccountScope = "user"> {
|
|
164
217
|
readonly runId: WorkflowRunId;
|
|
165
|
-
readonly step: WorkflowStep<Requirements>;
|
|
218
|
+
readonly step: WorkflowStep<Requirements, Scope>;
|
|
166
219
|
}
|
|
167
220
|
/** Framework-owned native declaration; only the callback crosses the author Promise boundary. */
|
|
168
221
|
export interface AppWorkflow<Input = unknown, Output = unknown> {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare const facetStorage: (storage: NonNullable<Sqlite.SqliteClientConfig["storage"]>) => AppStorage;
|
|
1
|
+
/** The data facet's storage capability; used only by the generated data facet, never browser bundles. */
|
|
2
|
+
import type { AppSqlStorage } from "./contracts/sql.js";
|
|
3
|
+
/** Bind one facet's storage at the runtime edge. App code receives `ctx.sql` over it, never the storage. */
|
|
4
|
+
export declare const facetStorage: (storage: AppSqlStorage) => AppSqlStorage;
|
|
@@ -4,7 +4,5 @@ import { type GraphqlCatalogOptions } from "./implementation/graphql-catalog.js"
|
|
|
4
4
|
export { GraphqlError, type GraphqlToolsOptions } from "./contracts/graphql.js";
|
|
5
5
|
export type { GraphqlCatalogOptions } from "./implementation/graphql-catalog.js";
|
|
6
6
|
/** Lazy tools with optional persistent metadata caching for the selected account. */
|
|
7
|
-
export declare const
|
|
8
|
-
dynamicTools: import("./contracts/dynamic-tools.js").DynamicTools;
|
|
9
|
-
}>;
|
|
7
|
+
export declare const graphqlRouter: (options: GraphqlCatalogOptions, kinds?: OperationKinds) => Promise<import("./index.js").RouterDeclaration<unknown, unknown>>;
|
|
10
8
|
export type { OperationKinds } from "./implementation/protocol-operations.js";
|
package/types/apps/src/host.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ export { isolatedCacheSession } from "./implementation/cache-session.js";
|
|
|
6
6
|
export declare const hostContext: (accounts: ResolvedAccountsInput, approval?: unknown) => HostContext;
|
|
7
7
|
/** Portable Promise handler. Invoke only after the host has authorized and resolved accounts. */
|
|
8
8
|
export declare const createAppHandler: (app: unknown) => ((request: Request, context: HostContext) => Promise<Response>);
|
|
9
|
+
/**
|
|
10
|
+
* The clock this framework's spans read, in nanoseconds. The runtime's bridge times the isolate's
|
|
11
|
+
* whole dispatch with it, so that time and the invocation's own timing share one clock.
|
|
12
|
+
*/
|
|
13
|
+
export declare const isolatedClock: () => bigint;
|
|
9
14
|
/** Isolates return bounded, telemetry beside the protocol result; no exporter secret enters app code. */
|
|
10
15
|
export declare const createIsolatedAppHandler: (app: unknown) => (request: Request, context: HostContext) => Promise<Response>;
|
|
11
16
|
/**
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type RouterDeclaration } from "./router.js";
|
|
2
|
+
/**
|
|
3
|
+
* Discover each selected account's router and combine matching names.
|
|
4
|
+
* Calls take { accountId, input }; each branch retains its account's input schema,
|
|
5
|
+
* credentials, approval and output validation. Empty selections expose no operations.
|
|
6
|
+
* Discovery is sequential and cancellation follows the caller's signal. `discover` may return the
|
|
7
|
+
* router or a Promise of it, and the combined router keeps its operations' handler contexts.
|
|
8
|
+
*/
|
|
9
|
+
export declare const accountRouter: <Account extends {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
}, Query = unknown, Mutation = unknown>(accounts: readonly Account[], discover: (account: Account) => RouterDeclaration<Query, Mutation> | Promise<RouterDeclaration<Query, Mutation>>, options: {
|
|
12
|
+
readonly signal: AbortSignal;
|
|
13
|
+
}) => Promise<RouterDeclaration<Query, Mutation>>;
|
|
@@ -1,40 +1,68 @@
|
|
|
1
1
|
import type { ScheduleDeclaration } from "./schedules.js";
|
|
2
|
-
import type { App as NativeApp, AppDefinition as NativeDefinition } from "../contracts/app.js";
|
|
3
|
-
import type { AppRequirements,
|
|
2
|
+
import type { App as NativeApp, AccountScope, AppDefinition as NativeDefinition, EvaluationContext } from "../contracts/app.js";
|
|
3
|
+
import type { AppRequirements, QueryContext, MutationContext, RequirementSlots, WebhookContext } from "../contracts/context.js";
|
|
4
4
|
import { type PromiseMethods } from "./authoring.js";
|
|
5
5
|
import { type WorkflowDeclaration } from "./workflows.js";
|
|
6
6
|
import type { WorkflowContext } from "../contracts/workflows.js";
|
|
7
|
-
import { type
|
|
7
|
+
import { type RouterDeclaration } from "./router.js";
|
|
8
8
|
import { type Schema } from "./schema.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
/** One native webhook definition with the given handler context. */
|
|
10
|
+
type NativeWebhook<Context> = NonNullable<NativeDefinition<Context>["webhooks"]>[string];
|
|
11
|
+
/** A webhook as authors write it: Promise handlers, author schemas and its source requirement. */
|
|
12
|
+
type AuthorWebhook<Context, Account> = {
|
|
13
|
+
readonly [Key in keyof NativeWebhook<Context>]: Key extends "config" | "state" ? Schema<unknown, boolean> : Key extends "account" ? Account : PromiseMethods<NativeWebhook<Context>>[Key];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A user-account webhook gets the caller-shaped context; an app-account webhook runs without a
|
|
17
|
+
* caller, so its context has no `user`.
|
|
18
|
+
*/
|
|
19
|
+
type AuthorWebhooks<Requirements extends AppRequirements> = Readonly<Record<string, AuthorWebhook<WebhookContext<Requirements>, {
|
|
20
|
+
readonly user: keyof RequirementSlots<Requirements>["user"] & string;
|
|
21
|
+
}> | AuthorWebhook<WebhookContext<Requirements, "app">, {
|
|
22
|
+
readonly app: keyof RequirementSlots<Requirements>["app"] & string;
|
|
23
|
+
}>>>;
|
|
24
|
+
/**
|
|
25
|
+
* User schedules run as each member who enables them; app schedules run without a caller, so their
|
|
26
|
+
* mutation takes a context of the `"app"` scope.
|
|
27
|
+
*/
|
|
28
|
+
type AuthorSchedules<Requirements extends AppRequirements> = Readonly<Record<string, ScheduleDeclaration<MutationContext<Requirements>, "user"> | ScheduleDeclaration<MutationContext<Requirements, "app">, "app">>>;
|
|
29
|
+
/**
|
|
30
|
+
* A run started by a caller binds its accounts; one started without a caller, such as by an app
|
|
31
|
+
* schedule, has no `user`, so its workflow declares a context of the `"app"` scope.
|
|
32
|
+
*/
|
|
33
|
+
type AuthorWorkflows<Requirements extends AppRequirements> = Readonly<Record<string, WorkflowDeclaration<WorkflowContext<Requirements>> | WorkflowDeclaration<WorkflowContext<Requirements, "app">>>>;
|
|
14
34
|
/** Author definition projected from native capabilities. Excluding callable objects keeps
|
|
15
35
|
* factories from being inferred as definitions and preserves contextual handler inference. */
|
|
16
36
|
export type AppDefinition<Requirements extends AppRequirements> = {
|
|
17
|
-
readonly [Key in keyof NativeDefinition<WebhookContext<Requirements>>]: Key extends "workflows" ?
|
|
37
|
+
readonly [Key in keyof NativeDefinition<WebhookContext<Requirements>>]: Key extends "workflows" ? AuthorWorkflows<Requirements> : Key extends "schedules" ? AuthorSchedules<Requirements> : Key extends "tools" ? RouterDeclaration<QueryContext<Requirements>, MutationContext<Requirements>> : Key extends "webhooks" ? AuthorWebhooks<Requirements> : NativeDefinition<WebhookContext<Requirements>>[Key];
|
|
18
38
|
} & {
|
|
19
39
|
readonly name?: never;
|
|
20
|
-
readonly
|
|
40
|
+
readonly queries?: never;
|
|
41
|
+
readonly mutations?: never;
|
|
21
42
|
readonly call?: never;
|
|
22
43
|
};
|
|
44
|
+
/** A webhook context as the host builds it: an app-account hook's has no `user`. */
|
|
45
|
+
type HostWebhookContext = WebhookContext<AppRequirements, AccountScope> & Partial<Pick<WebhookContext, "user">>;
|
|
23
46
|
/** Adapt operation and webhook catalogs without evaluating their handlers. */
|
|
24
47
|
export type EffectDefinition<Def> = {
|
|
25
|
-
readonly [Key in keyof Def]: Key extends "
|
|
48
|
+
readonly [Key in keyof Def]: Key extends "tools" ? NonNullable<NativeDefinition<unknown>["tools"]> : Key extends "workflows" ? Readonly<Record<string, import("../contracts/workflows.js").AppWorkflow>> : Key extends "schedules" ? NonNullable<NativeDefinition<unknown>["schedules"]> : Key extends "webhooks" ? NonNullable<NativeDefinition<HostWebhookContext>["webhooks"]> : Key extends "skills" ? NonNullable<NativeDefinition<unknown>["skills"]> : Key extends "dynamicSkills" ? NonNullable<NativeDefinition<unknown>["dynamicSkills"]> : Def[Key];
|
|
26
49
|
};
|
|
27
50
|
declare const InternalApp: unique symbol;
|
|
28
51
|
/** Recognize a declaration from this framework instance before host adaptation. */
|
|
29
52
|
export declare const isApp: (value: unknown) => value is App<AppRequirements, AppDefinition<AppRequirements>>;
|
|
30
53
|
/** Public app handle; the native app is retained for host use without an async round trip. */
|
|
31
54
|
export interface App<Requirements extends AppRequirements, Def extends AppDefinition<Requirements>> {
|
|
32
|
-
readonly [InternalApp]: NativeApp<Requirements
|
|
33
|
-
readonly accounts: Requirements
|
|
34
|
-
readonly evaluate: (context:
|
|
55
|
+
readonly [InternalApp]: NativeApp<RequirementSlots<Requirements>, EffectDefinition<Def>>;
|
|
56
|
+
readonly accounts: RequirementSlots<Requirements>;
|
|
57
|
+
readonly evaluate: (context: AppFactoryContext<Requirements>) => Promise<Def>;
|
|
35
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* What a dynamic definition's factory receives. App-scope work, such as an app schedule, evaluates
|
|
61
|
+
* the app without a caller, so `user` is absent then.
|
|
62
|
+
*/
|
|
63
|
+
export type AppFactoryContext<Requirements extends AppRequirements> = EvaluationContext<RequirementSlots<Requirements>>;
|
|
36
64
|
/** Retrieve the same declaration for an Effect host. No evaluation or I/O occurs. */
|
|
37
|
-
export declare const toEffectApp: <Requirements extends AppRequirements, Def extends AppDefinition<Requirements>>(app: App<Requirements, Def>) => NativeApp<Requirements
|
|
65
|
+
export declare const toEffectApp: <Requirements extends AppRequirements, Def extends AppDefinition<Requirements>>(app: App<Requirements, Def>) => NativeApp<RequirementSlots<Requirements>, EffectDefinition<Def>>;
|
|
38
66
|
/** Assemble app behavior. Package names belong in package.json; hosts name installed copies. */
|
|
39
|
-
export declare const defineApp: <const Requirements extends AppRequirements, Def extends AppDefinition<Requirements>>(requirements: Requirements, definition: (Def & AppDefinition<Requirements>) | ((context:
|
|
67
|
+
export declare const defineApp: <const Requirements extends AppRequirements, Def extends AppDefinition<Requirements>>(requirements: Requirements, definition: (Def & AppDefinition<Requirements>) | ((context: AppFactoryContext<Requirements>) => Promise<Def & AppDefinition<Requirements>>)) => App<Requirements, Def>;
|
|
40
68
|
export {};
|
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
/** Small, explicit adapters between authored callbacks and native Effect operations. */
|
|
2
|
-
import { Effect } from "effect";
|
|
2
|
+
import { Effect, type Context } from "effect";
|
|
3
3
|
/** Project one Effect operation into its author-facing Promise signature. */
|
|
4
4
|
export type PromiseMethod<Method> = Method extends (...args: infer Args) => Effect.Effect<infer A, infer _E> ? (...args: Args) => Promise<A> : Method;
|
|
5
5
|
/** Project only an object's methods; data and schema types are not recursively rewritten. */
|
|
6
6
|
export type PromiseMethods<T> = {
|
|
7
7
|
readonly [Key in keyof T]: PromiseMethod<T[Key]>;
|
|
8
8
|
};
|
|
9
|
-
/**
|
|
10
|
-
export
|
|
11
|
-
/**
|
|
12
|
-
|
|
9
|
+
/** Which of the app's callbacks runs, recorded on the `app.code` span around it. */
|
|
10
|
+
export type AppCode = "factory" | "router" | "approval" | "handler" | "loader" | "cache" | "webhook" | "check" | "skills" | "elicitation" | "workflow" | "step";
|
|
11
|
+
/**
|
|
12
|
+
* Run `effect` as the app's own code. Its time is the app's, except for work it starts for
|
|
13
|
+
* Executor, an upstream or a person, which opens its own boundary inside.
|
|
14
|
+
*/
|
|
15
|
+
export declare const appCode: (code: AppCode) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, import("effect/Tracer").ParentSpan>>;
|
|
16
|
+
/**
|
|
17
|
+
* Reuse a framework callback's cancellation-bound Effect, or run an ordinary async callback as the
|
|
18
|
+
* app's code. Every callback an app supplies enters the framework here, so its time is the app's.
|
|
19
|
+
*/
|
|
20
|
+
export declare const fromPromise: <Args extends readonly unknown[], A>(callback: (...args: Args) => Promise<A>, code: AppCode) => ((...args: Args) => Effect.Effect<A, unknown>);
|
|
21
|
+
/**
|
|
22
|
+
* `target[key]`, called on `target`. A method read off its object as a bare value loses its
|
|
23
|
+
* receiver, so an app's method, such as one of its cache's, enters `fromPromise` through this.
|
|
24
|
+
*/
|
|
25
|
+
export declare const method: <K extends PropertyKey, T extends { readonly [P in K]: (...args: never) => unknown; }>(target: T, key: K) => T[K];
|
|
26
|
+
/**
|
|
27
|
+
* Bind cancellation once so Promise callers and native framework callers run the same operation.
|
|
28
|
+
* `signalOf` is the signal, or reads it from each call's arguments, such as a loader's `context.signal`.
|
|
29
|
+
*/
|
|
30
|
+
export declare const toPromise: <Args extends readonly unknown[], A, E>(operation: (...args: Args) => Effect.Effect<A, E>, signalOf?: AbortSignal | ((...args: Args) => AbortSignal),
|
|
31
|
+
/** Services a Promise call runs with, such as its invocation's telemetry. */
|
|
32
|
+
services?: Context.Context<never>) => ((...args: Args) => Promise<A>);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Compiled from src/browser/app-watch.ts. */
|
|
2
|
+
export declare const appWatchSource = "\"use strict\";(()=>{var c=()=>{let s=document.getElementById(\"executor-context\")?.textContent;if(!s)return;let n=JSON.parse(s);if(typeof n!=\"object\"||n===null||!(\"version\"in n))return;let r=n.version;if(typeof r!=\"string\"||r.length===0)return;let t=new EventSource(\"/_executor/version\"),d=!1,o=()=>{d||(d=!0,t.close(),location.reload())};t.addEventListener(\"version\",i=>{let e=JSON.parse(i.data);typeof e==\"object\"&&e!==null&&\"version\"in e&&(e.version===null||typeof e.version==\"string\")&&e.version!==r&&o()}),t.addEventListener(\"revoked\",o),window.addEventListener(\"executor:deployment-changed\",o),window.addEventListener(\"pagehide\",()=>t.close(),{once:!0}),window.addEventListener(\"pageshow\",i=>{i.persisted&&o()})};c();})();";
|
|
3
|
+
/** Compiled from src/browser/app-failure.ts. */
|
|
4
|
+
export declare const appFailureSource = "\"use strict\";(()=>{var M=()=>{let d,w=Date.now(),m=0,g=0,f=new Map,v=/^(?:chrome|moz|safari-web)-extension:/,A=new Set([\"ResizeObserver loop completed with undelivered notifications.\",\"ResizeObserver loop limit exceeded\"]),V=new Set([\"Error\",\"TypeError\",\"ReferenceError\",\"SyntaxError\",\"RangeError\",\"URIError\",\"EvalError\",\"AggregateError\"]),b=(e,t=0,i=0)=>{let r=[];if(!URL.canParse(e))return r;let a=new URL(e);return a.origin!==location.origin||!a.pathname.startsWith(\"/_executor/assets/\")||!a.pathname.endsWith(\".js\")||(r.push({key:\"code.file.path\",value:{stringValue:a.pathname}}),Number.isSafeInteger(t)&&t>0&&r.push({key:\"code.line.number\",value:{intValue:String(t)}}),Number.isSafeInteger(i)&&i>0&&r.push({key:\"code.column.number\",value:{intValue:String(i)}})),r},h=(e,t,i=[])=>{let r=Date.now();r-w>=6e4&&(w=r,m=0,f.clear());let a=`${e}:${t.slice(0,2e3)}`,x=f.get(a);if(x!==void 0&&r-x<1e3||m>=20){g++;return}f.set(a,r),m++,i.push({key:\"executor.ui.failure.suppressed\",value:{intValue:String(g)}}),g=0;let E=Array.from(crypto.getRandomValues(new Uint8Array(16)),s=>s.toString(16).padStart(2,\"0\")).join(\"\"),S=`${Date.now()}000000`,n,l=\"Sending error report\\u2026\",k=()=>{if(d?.open)return;let s=document.createElement(\"div\"),D=s.attachShadow({mode:\"open\"}),o=document.createElement(\"dialog\");d=o,o.setAttribute(\"aria-labelledby\",\"executor-failure-title\");let y=document.createElement(\"h2\");y.id=\"executor-failure-title\",y.textContent=e===\"script\"?\"This app could not load\":\"This app stopped working\";let C=document.createElement(\"p\");C.textContent=e===\"script\"?\"A file needed by this page did not load. Reload the page to try again.\":\"The app encountered an unexpected error. Reload the page to try again.\";let L=document.createElement(\"p\");L.textContent=\"Copy any unsaved work before reloading.\";let R=document.createElement(\"details\"),T=document.createElement(\"summary\");T.textContent=\"Error details\";let c=document.createElement(\"textarea\");c.readOnly=!0,c.rows=10,c.cols=36,c.setAttribute(\"aria-label\",\"Error details\"),c.value=`${t.slice(0,12e3)}\n\nDiagnostic ID: ${E}`,R.append(T,c),n=document.createElement(\"p\"),n.setAttribute(\"role\",\"status\"),n.textContent=l;let u=document.createElement(\"button\");u.type=\"button\",u.textContent=\"Reload page\",u.addEventListener(\"click\",()=>location.reload());let p=document.createElement(\"button\");p.type=\"button\",p.textContent=\"Close\",p.addEventListener(\"click\",()=>o.close()),o.addEventListener(\"close\",()=>{d===o&&(d=void 0),s.remove()}),o.append(y,C,L,R,n,u,p),D.append(o),document.documentElement.append(s),o.showModal()};document.readyState===\"loading\"?document.addEventListener(\"DOMContentLoaded\",k,{once:!0}):k(),fetch(\"/_executor/api/telemetry/traces\",{method:\"POST\",headers:{\"content-type\":\"application/json\"},credentials:\"same-origin\",keepalive:!0,body:JSON.stringify({resourceSpans:[{scopeSpans:[{spans:[{traceId:E,spanId:E.slice(0,16),name:\"ui.app.failure\",kind:1,startTimeUnixNano:S,endTimeUnixNano:S,status:{code:2},attributes:[{key:\"executor.ui.failure.kind\",value:{stringValue:e}},...i]}]}]}]})}).then(s=>{l=s.ok?\"Error report sent.\":\"Could not send the error report. You can copy the error details.\",n&&(n.textContent=l)},()=>{l=\"Could not send the error report. You can copy the error details.\",n&&(n.textContent=l)})};window.addEventListener(\"error\",e=>{if(e instanceof ErrorEvent){if(v.test(e.filename)||e.error===null&&e.lineno===0&&A.has(e.message))return;let t=b(e.filename,e.lineno,e.colno);e.error instanceof Error&&V.has(e.error.name)&&t.push({key:\"exception.type\",value:{stringValue:e.error.name}}),h(\"runtime\",e.error instanceof Error?e.error.stack??e.message:e.message,t)}else e.target instanceof HTMLScriptElement&&h(\"script\",`Could not load script: ${e.target.src}`,b(e.target.src))},!0),window.addEventListener(\"unhandledrejection\",e=>{let t=e.reason;h(\"rejection\",t instanceof Error?t.stack??t.message:\"An app operation failed without handling its error.\")})};M();})();";
|
|
5
|
+
/** Compiled from src/browser/account-notice.ts. */
|
|
6
|
+
export declare const accountNoticeSource = "\"use strict\";(()=>{var g=()=>{let r=document.getElementById(\"executor-account-notice\")?.textContent;if(!r)return;let t=JSON.parse(r);if(typeof t!=\"object\"||t===null||!(\"items\"in t)||!(\"fix\"in t))return;let c=t.items,s=t.fix;if(!Array.isArray(c)||typeof s!=\"string\")return;let a=()=>{let i=document.createElement(\"div\"),x=i.attachShadow({mode:\"open\"}),d=document.createElement(\"style\");d.textContent=\"aside{position:fixed;right:16px;bottom:16px;z-index:2147483647;max-width:360px;box-sizing:border-box;padding:14px 16px;border-radius:10px;border:1px solid #fcd34d;background:#fffbeb;color:#451a03;font:14px/1.45 ui-sans-serif,system-ui,sans-serif;box-shadow:0 8px 24px rgb(0 0 0/.12)}strong{display:block;margin-bottom:4px}ul{margin:0 0 10px;padding-left:18px}div{display:flex;gap:12px;align-items:center}a{color:inherit;font-weight:600}button{margin-left:auto;font:inherit;background:none;border:0;padding:0;color:inherit;text-decoration:underline;cursor:pointer}\";let e=document.createElement(\"aside\");e.setAttribute(\"role\",\"status\"),e.setAttribute(\"aria-label\",\"Account warning\");let l=document.createElement(\"strong\");l.textContent=\"Some things might not work\";let m=document.createElement(\"ul\");for(let f of c){let p=document.createElement(\"li\");p.textContent=String(f),m.append(p)}let u=document.createElement(\"div\"),n=document.createElement(\"a\");n.href=s,n.target=\"_top\",n.textContent=\"Review accounts\";let o=document.createElement(\"button\");o.type=\"button\",o.textContent=\"Dismiss\",o.addEventListener(\"click\",()=>i.remove()),u.append(n,o),e.append(l,m,u),x.append(d,e),document.documentElement.append(i)};document.readyState===\"loading\"?document.addEventListener(\"DOMContentLoaded\",a,{once:!0}):a()};g();})();";
|
|
@@ -1,6 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
import type
|
|
1
|
+
/** Bind the portable Effect cache to an app invocation's author API. */
|
|
2
|
+
import { type Context } from "effect";
|
|
3
|
+
import type { AppCache, CacheGetOptions, HostCache } from "../contracts/cache.js";
|
|
4
|
+
import { type ResolvedAccounts } from "../contracts/host.js";
|
|
5
|
+
import type { JsonValue } from "../contracts/schema.js";
|
|
6
|
+
/**
|
|
7
|
+
* Framework-only: `get` that also reads other keys of the same scope in its round trip to the
|
|
8
|
+
* store. Authored code never sees it; framework helpers use it when a cache provides it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const getWithReads: unique symbol;
|
|
11
|
+
/**
|
|
12
|
+
* A `get` value, the store key it was read under, and the stored values of the other keys when
|
|
13
|
+
* the value was read from the store. The values are not decoded: the caller decodes only those it
|
|
14
|
+
* uses. A key with no value reads `undefined`.
|
|
15
|
+
*/
|
|
16
|
+
export interface GetWithReads<A> {
|
|
17
|
+
readonly value: A;
|
|
18
|
+
/** The entry's store key, unique to the cache's scope and the key. */
|
|
19
|
+
readonly key: string;
|
|
20
|
+
/** Undefined when the value was loaded or the store did not read them: read them separately. */
|
|
21
|
+
readonly reads: readonly unknown[] | undefined;
|
|
22
|
+
}
|
|
23
|
+
/** The framework-only `get` an app's cache provides beside the author API. */
|
|
24
|
+
export type CacheWithReads = AppCache & {
|
|
25
|
+
/** `keys` gets the entry's store key and names the other keys to read with it. */
|
|
26
|
+
readonly [getWithReads]?: <A>(options: CacheGetOptions<A>, keys: (key: string) => readonly JsonValue[]) => Promise<GetWithReads<A>>;
|
|
27
|
+
};
|
|
3
28
|
/** Missing host support is explicit on use; ordinary apps do not need cache support. */
|
|
4
29
|
export declare const unavailableCache: HostCache;
|
|
5
30
|
/** Account scopes are derived from trusted current bindings. Loaders get a fresh owned HTTP signal. */
|
|
6
|
-
export declare const authorCache: (host: HostCache, accounts: ResolvedAccounts, signal: AbortSignal
|
|
31
|
+
export declare const authorCache: (host: HostCache, accounts: ResolvedAccounts, signal: AbortSignal,
|
|
32
|
+
/** The invocation's telemetry, which Promise calls from authored code run in. */
|
|
33
|
+
telemetry: Context.Context<never>,
|
|
34
|
+
/** The invocation's trusted deadline. Waiting on another caller's load never runs past it. */
|
|
35
|
+
deadline?: number) => AppCache;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Duration, Effect, Schema } from "effect";
|
|
2
|
-
import type { AppCache, CacheLoadContext } from "../contracts/cache.js";
|
|
3
|
-
import { type JsonValue } from "../contracts/schema.js";
|
|
2
|
+
import type { AccountCredential, AppCache, CacheLoadContext } from "../contracts/cache.js";
|
|
3
|
+
import { JsonObject, type JsonValue } from "../contracts/schema.js";
|
|
4
4
|
export interface CatalogCacheOptions {
|
|
5
|
-
/**
|
|
5
|
+
/** The app's cache. An account's catalog is kept in that account's scope. */
|
|
6
6
|
readonly cache?: AppCache;
|
|
7
7
|
/** Reuse metadata for this duration. Defaults to five minutes. */
|
|
8
8
|
readonly freshFor?: Duration.Input;
|
|
@@ -11,9 +11,39 @@ export interface CatalogCacheOptions {
|
|
|
11
11
|
/** Await a fresh revision at an explicit logical connection or refresh boundary. */
|
|
12
12
|
readonly revalidate?: boolean;
|
|
13
13
|
}
|
|
14
|
+
/** Whose catalog a remote router reads, and the headers, such as credentials, it sends. */
|
|
15
|
+
export type CatalogAccount = AccountCredential<{
|
|
16
|
+
/** Headers for this account's requests, such as its credentials. */
|
|
17
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
18
|
+
}>;
|
|
19
|
+
/** Why a read cannot use its account's scope. */
|
|
20
|
+
export type CatalogScopeProblem = "missing-account" | "unselected-account";
|
|
21
|
+
/**
|
|
22
|
+
* The cache an account's catalog lives in: the account's own scope, which token renewals keep.
|
|
23
|
+
* `credential` is what the read sends, such as headers or a token; it never enters a key. A
|
|
24
|
+
* credential without an account, or an account the app was not given, fails with `invalid`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const catalogScope: <E>(options: {
|
|
27
|
+
readonly cache?: AppCache | undefined;
|
|
28
|
+
readonly account?: {
|
|
29
|
+
readonly id: string;
|
|
30
|
+
} | undefined;
|
|
31
|
+
}, credential: unknown, invalid: (problem: CatalogScopeProblem) => E) => Effect.Effect<AppCache | undefined, E>;
|
|
32
|
+
/** One load: the tools, and optionally a record describing the whole catalog. */
|
|
33
|
+
export interface CatalogLoad<A> {
|
|
34
|
+
readonly tools: readonly A[];
|
|
35
|
+
readonly header?: JsonObject;
|
|
36
|
+
}
|
|
37
|
+
/** The catalog a refresh replaces, read only when its loader asks for it. */
|
|
38
|
+
export interface KeptCatalog<A> {
|
|
39
|
+
readonly header: JsonObject | undefined;
|
|
40
|
+
readonly tools: Effect.Effect<readonly A[], unknown>;
|
|
41
|
+
}
|
|
14
42
|
export declare const catalogCache: <A extends {
|
|
15
43
|
readonly name: string;
|
|
16
|
-
}, S>(options: CatalogCacheOptions & {
|
|
44
|
+
}, S>(options: Omit<CatalogCacheOptions, "cache"> & {
|
|
45
|
+
/** The scope from `catalogScope`; undefined keeps discovery invocation-local. */
|
|
46
|
+
readonly cache: AppCache | undefined;
|
|
17
47
|
readonly prefix: readonly JsonValue[];
|
|
18
48
|
readonly schema: Schema.Decoder<A>;
|
|
19
49
|
/** Schema-free projection stored beside the full pages, so browsing never reads schemas. */
|
|
@@ -21,9 +51,17 @@ export declare const catalogCache: <A extends {
|
|
|
21
51
|
readonly schema: Schema.Decoder<S>;
|
|
22
52
|
readonly of: (tool: A) => S;
|
|
23
53
|
};
|
|
24
|
-
|
|
54
|
+
/** Past `freshFor`, serve the kept catalog while refreshing, or refresh first. */
|
|
55
|
+
readonly stale?: "serve" | "revalidate";
|
|
56
|
+
/**
|
|
57
|
+
* Load the catalog. A refresh also gets the catalog it replaces, if one is kept, so a source
|
|
58
|
+
* that can confirm it is unchanged need not load it again.
|
|
59
|
+
*/
|
|
60
|
+
readonly load: (context?: CacheLoadContext, kept?: Effect.Effect<KeptCatalog<A> | undefined, unknown>) => Effect.Effect<CatalogLoad<A>, unknown>;
|
|
25
61
|
}) => Effect.Effect<{
|
|
26
62
|
list: () => Effect.Effect<readonly A[], unknown, never>;
|
|
63
|
+
/** The record stored with the current revision, if the source supplied one. */
|
|
64
|
+
header: () => Effect.Effect<JsonObject | undefined, unknown>;
|
|
27
65
|
summaries: () => Effect.Effect<S[], unknown, never>;
|
|
28
66
|
resolve: (name: string) => Effect.Effect<A | undefined, unknown, never>;
|
|
29
67
|
}, unknown, never>;
|