apps 0.0.1-beta.8 → 0.0.1-beta.81
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 +25 -22
- package/framework-reference.json +1 -1
- package/js/{chunk-72JNVHPK.js → chunk-4NFSABEA.js} +4 -3
- package/js/chunk-5FHWNLCI.js +88 -0
- package/js/chunk-5WGONRKQ.js +426 -0
- package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
- package/js/chunk-CDXQDN7W.js +92 -0
- package/js/{chunk-UK573G7W.js → chunk-EOPQ727L.js} +87 -51
- package/js/{chunk-27F7W2LG.js → chunk-H2CJWXA3.js} +2 -2
- package/js/{chunk-JU7VHODU.js → chunk-H72MEDMN.js} +65 -10
- package/js/{chunk-FL2QR3XW.js → chunk-HJG4RBYM.js} +333 -69
- package/js/chunk-I6Q7ZPKJ.js +49 -0
- package/js/{chunk-CDL5PM2Q.js → chunk-IFJU5SYQ.js} +19082 -18402
- package/js/{chunk-VFZKSM3T.js → chunk-JPEUKEV4.js} +3 -3
- package/js/{chunk-5T57N25Q.js → chunk-KGCTYL2S.js} +511 -63
- package/js/{chunk-KUMBKVJD.js → chunk-KLYSEHUD.js} +2 -2
- package/js/{chunk-WLE7WX2U.js → chunk-NG56RPCA.js} +2348 -472
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/{chunk-Z5M2LQOZ.js → chunk-OY47QPQY.js} +67 -55
- package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
- package/js/chunk-PL5KOEZD.js +334 -0
- package/js/chunk-Q4IZAUIF.js +285 -0
- package/js/{chunk-RJDDBDSN.js → chunk-QWQM3CLH.js} +795 -177
- package/js/{chunk-RFVIONFX.js → chunk-TE25A7D6.js} +123 -44
- package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
- package/js/chunk-W6XCQAXP.js +171 -0
- package/js/chunk-WCGAO3X5.js +348 -0
- package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
- package/js/{chunk-CMYUWAX7.js → chunk-YQUG4CES.js} +126 -31
- package/js/{chunk-UESPOTUI.js → chunk-Z2SWTZCF.js} +861 -231
- package/js/client.js +142 -94
- package/js/contracts.js +127 -26
- package/js/effect.js +19 -19
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +50 -40
- package/js/host.js +83 -58
- package/js/index.js +131 -46
- package/js/mcp/effect.js +23 -21
- package/js/mcp/stdio.js +44 -34
- package/js/mcp.js +76 -53
- package/js/openapi.js +4071 -1357
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +208 -81
- package/js/storage/facet.js +1 -540
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +5 -4
- package/js/ui/serving.js +8604 -223
- package/package.json +3 -4
- package/runtime.json +1 -1
- package/types/app-cache/src/contracts/cache.d.ts +18 -0
- package/types/app-cache/src/index.d.ts +34 -2
- package/types/apps/src/contracts/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/app.d.ts +7 -3
- package/types/apps/src/contracts/cache.d.ts +20 -0
- package/types/apps/src/contracts/context.d.ts +19 -11
- package/types/apps/src/contracts/elicitation.d.ts +23 -7
- package/types/apps/src/contracts/events.d.ts +93 -0
- package/types/apps/src/contracts/failure.d.ts +30 -1
- package/types/apps/src/contracts/graphql.d.ts +2 -1
- package/types/apps/src/contracts/host.d.ts +649 -17
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +80 -10
- 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.d.ts +41 -9
- package/types/apps/src/contracts/operations.d.ts +8 -4
- package/types/apps/src/contracts/placement.d.ts +102 -0
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +733 -81
- package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
- package/types/apps/src/contracts/protocols/2.d.ts +69 -26
- package/types/apps/src/contracts/protocols/3.d.ts +133 -33
- package/types/apps/src/contracts/protocols/4.d.ts +122 -45
- package/types/apps/src/contracts/protocols/5.d.ts +157 -47
- 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 +3843 -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 +90 -6
- package/types/apps/src/contracts/skills.d.ts +50 -13
- package/types/apps/src/contracts/sql.d.ts +63 -0
- package/types/apps/src/contracts/ui.d.ts +37 -3
- package/types/apps/src/contracts/workflows.d.ts +6 -0
- package/types/apps/src/facet.d.ts +4 -5
- package/types/apps/src/host.d.ts +5 -0
- package/types/apps/src/implementation/account-router.d.ts +4 -3
- 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 +28 -1
- package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
- package/types/apps/src/implementation/elicitation.d.ts +18 -15
- package/types/apps/src/implementation/events.d.ts +59 -0
- package/types/apps/src/implementation/failure-detail.d.ts +25 -3
- package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
- 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 +6 -4
- package/types/apps/src/implementation/mcp-client.d.ts +17 -9
- package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
- package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
- package/types/apps/src/implementation/mcp.d.ts +20 -9
- package/types/apps/src/implementation/network.d.ts +16 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +26 -6
- package/types/apps/src/implementation/openapi-document.d.ts +46 -19
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-request.d.ts +10 -2
- package/types/apps/src/implementation/openapi-source.d.ts +18 -0
- package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
- package/types/apps/src/implementation/operations.d.ts +17 -2
- 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 +3 -0
- package/types/apps/src/implementation/provider-error.d.ts +28 -1
- package/types/apps/src/implementation/provider.d.ts +18 -3
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +11 -13
- package/types/apps/src/implementation/router.d.ts +16 -5
- package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
- package/types/apps/src/implementation/schema.d.ts +90 -10
- 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/ui-account-notice.d.ts +9 -0
- package/types/apps/src/implementation/ui-auth.d.ts +1 -1
- package/types/apps/src/implementation/ui-client.d.ts +2 -2
- 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 +28 -9
- 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 +1 -1
- package/types/apps/src/implementation/workflows.d.ts +1 -1
- package/types/apps/src/index.d.ts +55 -13
- package/types/apps/src/mcp.d.ts +20 -1
- package/types/apps/src/openapi.d.ts +1 -1
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +10 -8
- 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 +2 -2
- 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/recorded-message.d.ts +18 -0
- package/types/utils/src/user-facing-error.d.ts +83 -0
- package/js/chunk-MKWZPDR6.js +0 -63
- package/js/chunk-N7YDVXYJ.js +0 -186
- package/js/chunk-NKLWZJLE.js +0 -172
- package/js/chunk-OCYUEU47.js +0 -224
- package/js/chunk-PJJ24GU7.js +0 -877
- package/js/chunk-PZB6T6KU.js +0 -19
- package/js/chunk-R3EV5FTO.js +0 -97
- package/js/chunk-YXQHV65J.js +0 -242
- package/js/chunk-ZQINWV4W.js +0 -630
- 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 -18
- 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/storage.d.ts +0 -68
- package/types/apps/src/implementation/storage.d.ts +0 -15
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AccountId
|
|
3
|
+
} from "./chunk-H2CJWXA3.js";
|
|
4
|
+
import {
|
|
5
|
+
Schema_exports
|
|
6
|
+
} from "./chunk-IFJU5SYQ.js";
|
|
7
|
+
|
|
8
|
+
// src/contracts/failure.ts
|
|
9
|
+
var maxFailureMessageLength = 2048;
|
|
10
|
+
var FailureSource = Schema_exports.Literals(["app", "storage", "service"]);
|
|
11
|
+
var FailureName = Schema_exports.String.check(Schema_exports.isMaxLength(128));
|
|
12
|
+
var FailureCode = Schema_exports.String.check(Schema_exports.isMaxLength(128));
|
|
13
|
+
var FailureMessage = Schema_exports.String.check(Schema_exports.isMaxLength(maxFailureMessageLength));
|
|
14
|
+
var maxFailureFields = 8;
|
|
15
|
+
var maxFailureFieldLength = 256;
|
|
16
|
+
var FailureFieldName = Schema_exports.String.check(
|
|
17
|
+
Schema_exports.isPattern(/^[A-Za-z_$][A-Za-z0-9_$]{0,63}$/)
|
|
18
|
+
);
|
|
19
|
+
var FailureFieldValue = Schema_exports.Union([
|
|
20
|
+
Schema_exports.String.check(Schema_exports.isMaxLength(maxFailureFieldLength)),
|
|
21
|
+
Schema_exports.Finite,
|
|
22
|
+
Schema_exports.Boolean
|
|
23
|
+
]);
|
|
24
|
+
var FailureFields = Schema_exports.Record(FailureFieldName, FailureFieldValue).check(
|
|
25
|
+
Schema_exports.isMaxProperties(maxFailureFields)
|
|
26
|
+
);
|
|
27
|
+
var FailureDetail = {
|
|
28
|
+
source: Schema_exports.optionalKey(FailureSource),
|
|
29
|
+
errorName: Schema_exports.optionalKey(FailureName),
|
|
30
|
+
code: Schema_exports.optionalKey(FailureCode),
|
|
31
|
+
message: Schema_exports.optionalKey(FailureMessage),
|
|
32
|
+
fields: Schema_exports.optionalKey(FailureFields)
|
|
33
|
+
};
|
|
34
|
+
var maxUpstreamMessageLength = 1024;
|
|
35
|
+
var UpstreamError = Schema_exports.Struct({
|
|
36
|
+
code: Schema_exports.Union([
|
|
37
|
+
Schema_exports.Int,
|
|
38
|
+
Schema_exports.String.check(Schema_exports.isMinLength(1), Schema_exports.isMaxLength(128))
|
|
39
|
+
]),
|
|
40
|
+
message: Schema_exports.optionalKey(Schema_exports.String.check(Schema_exports.isMaxLength(maxUpstreamMessageLength)))
|
|
41
|
+
});
|
|
42
|
+
var FailurePhase = Schema_exports.Literals(["connect", "discover", "call"]);
|
|
43
|
+
|
|
44
|
+
// src/contracts/provider-error.ts
|
|
45
|
+
var ProviderError = class extends Schema_exports.TaggedError()("ProviderError", {
|
|
46
|
+
reason: Schema_exports.Literals(["unauthorized", "forbidden", "rate_limited", "unavailable", "rejected"]),
|
|
47
|
+
status: Schema_exports.optional(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 100, maximum: 599 }))),
|
|
48
|
+
accountId: Schema_exports.optional(AccountId),
|
|
49
|
+
phase: Schema_exports.optional(FailurePhase),
|
|
50
|
+
upstream: Schema_exports.optional(UpstreamError)
|
|
51
|
+
}) {
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// src/contracts/network.ts
|
|
55
|
+
var NetworkRefusal = Schema_exports.Union([
|
|
56
|
+
Schema_exports.Struct({ reason: Schema_exports.Literal("private_address") }),
|
|
57
|
+
Schema_exports.Struct({
|
|
58
|
+
reason: Schema_exports.Literal("credential_host"),
|
|
59
|
+
/** The provider of the credential handle the request carried. */
|
|
60
|
+
provider: Schema_exports.String,
|
|
61
|
+
/** The hosts that provider's credentials may reach; empty when it declares none. */
|
|
62
|
+
allowedHosts: Schema_exports.Array(Schema_exports.String)
|
|
63
|
+
}),
|
|
64
|
+
Schema_exports.Struct({ reason: Schema_exports.Literal("credential_app") }),
|
|
65
|
+
Schema_exports.Struct({
|
|
66
|
+
reason: Schema_exports.Literal("credential_expired"),
|
|
67
|
+
/** The provider of the expired credential handle. */
|
|
68
|
+
provider: Schema_exports.String
|
|
69
|
+
}),
|
|
70
|
+
Schema_exports.Struct({
|
|
71
|
+
reason: Schema_exports.Literal("credential_placement"),
|
|
72
|
+
/** The provider of the misplaced credential handle. */
|
|
73
|
+
provider: Schema_exports.String,
|
|
74
|
+
/** Where the handle was found, such as `body` or `header x-note`. */
|
|
75
|
+
location: Schema_exports.String
|
|
76
|
+
}),
|
|
77
|
+
Schema_exports.Struct({
|
|
78
|
+
reason: Schema_exports.Literal("credential_transport"),
|
|
79
|
+
/** The provider of the credential handle the request carried. */
|
|
80
|
+
provider: Schema_exports.String
|
|
81
|
+
}),
|
|
82
|
+
Schema_exports.Struct({
|
|
83
|
+
reason: Schema_exports.Literal("credential_method"),
|
|
84
|
+
/** The refused HTTP method. */
|
|
85
|
+
method: Schema_exports.String
|
|
86
|
+
})
|
|
87
|
+
]);
|
|
88
|
+
var NetworkRefused = class extends Schema_exports.TaggedError()("NetworkRefused", {
|
|
89
|
+
/** The refused destination, with its port when the URL names one. */
|
|
90
|
+
host: Schema_exports.String,
|
|
91
|
+
refusal: NetworkRefusal
|
|
92
|
+
}) {
|
|
93
|
+
get message() {
|
|
94
|
+
const refusal = this.refusal;
|
|
95
|
+
switch (refusal.reason) {
|
|
96
|
+
case "private_address":
|
|
97
|
+
return `Executor refused a request to ${this.host}: apps on this instance can reach only public addresses, and ${this.host} is a private, loopback or internal address. The request was not sent.`;
|
|
98
|
+
case "credential_host":
|
|
99
|
+
return refusal.allowedHosts.length === 0 ? `Executor refused this request: ${refusal.provider} credentials cannot be sent to ${this.host}: the provider declares no hosts.` : `Executor refused this request: ${refusal.provider} credentials cannot be sent to ${this.host}. The provider allows: ${refusal.allowedHosts.join(", ")}.`;
|
|
100
|
+
case "credential_app":
|
|
101
|
+
return "Executor refused this request: it carries a credential handle that is not valid for this app. Use the account fields this invocation received.";
|
|
102
|
+
case "credential_expired":
|
|
103
|
+
return `Executor refused this request: it carries an expired ${refusal.provider} credential handle. Use the account fields this invocation received.`;
|
|
104
|
+
case "credential_placement":
|
|
105
|
+
return `Executor refused this request: it carries a ${refusal.provider} credential handle in the ${refusal.location}, where the provider does not place it. Send credentials only as the provider's request declares, for example with the account's headers() and url().`;
|
|
106
|
+
case "credential_transport":
|
|
107
|
+
return `Executor refused this request: ${refusal.provider} credentials are sent only over HTTPS, and ${this.host} was requested over plain HTTP.`;
|
|
108
|
+
case "credential_method":
|
|
109
|
+
return `Executor refused this request: credential handles are never sent with ${refusal.method}, which asks the service to echo the request back.`;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
var networkRefusalStatus = 421;
|
|
114
|
+
var networkRefusalHeader = "x-executor-refused";
|
|
115
|
+
var NetworkRefusedHeader = Schema_exports.StringFromUriComponent.pipe(
|
|
116
|
+
Schema_exports.decodeTo(Schema_exports.fromJsonString(NetworkRefused))
|
|
117
|
+
);
|
|
118
|
+
var encodeRefusal = Schema_exports.encodeSync(NetworkRefused);
|
|
119
|
+
var encodeRefusalHeader = Schema_exports.encodeSync(NetworkRefusedHeader);
|
|
120
|
+
var networkRefusalResponse = (refused) => new Response(JSON.stringify({ ...encodeRefusal(refused), message: refused.message }), {
|
|
121
|
+
status: networkRefusalStatus,
|
|
122
|
+
statusText: "Refused by Executor",
|
|
123
|
+
headers: {
|
|
124
|
+
"content-type": "application/json; charset=utf-8",
|
|
125
|
+
[networkRefusalHeader]: encodeRefusalHeader(refused)
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
var RestrictedFetchOption = Schema_exports.Literals(["redirect", "cache", "integrity"]);
|
|
129
|
+
var supportedFetchOptions = {
|
|
130
|
+
redirect: ["follow", "manual"],
|
|
131
|
+
cache: ["no-store", "no-cache"],
|
|
132
|
+
integrity: [""]
|
|
133
|
+
};
|
|
134
|
+
var FetchOptionUnsupported = class extends Schema_exports.TaggedError()(
|
|
135
|
+
"FetchOptionUnsupported",
|
|
136
|
+
{
|
|
137
|
+
option: RestrictedFetchOption,
|
|
138
|
+
value: Schema_exports.String,
|
|
139
|
+
supported: Schema_exports.Array(Schema_exports.String)
|
|
140
|
+
}
|
|
141
|
+
) {
|
|
142
|
+
get message() {
|
|
143
|
+
const supported = this.supported.map((value) => JSON.stringify(value)).join(" or ");
|
|
144
|
+
return `fetch option ${this.option}: ${JSON.stringify(this.value)} is not supported by Executor's app runtime. Use ${supported}, or omit ${this.option}.${this.advice}`;
|
|
145
|
+
}
|
|
146
|
+
/** What to do instead, when the standard value has an equivalent the runtime supports. */
|
|
147
|
+
get advice() {
|
|
148
|
+
switch (this.option) {
|
|
149
|
+
case "redirect":
|
|
150
|
+
return this.value === "error" ? ` To reject redirects, send redirect: "manual" and treat a 3xx response as the error.` : "";
|
|
151
|
+
case "cache":
|
|
152
|
+
return "";
|
|
153
|
+
case "integrity":
|
|
154
|
+
return " To check a digest, read the body and hash it with crypto.subtle.digest.";
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// ../app-cache/src/contracts/cache.ts
|
|
160
|
+
var CacheError = class extends Schema_exports.TaggedError()("CacheError", {
|
|
161
|
+
reason: Schema_exports.Literals(["unavailable", "storage", "invalid", "capacity", "timeout"]),
|
|
162
|
+
/** Which of `cacheLimits` the request exceeded, when one did. */
|
|
163
|
+
limit: Schema_exports.optionalKey(
|
|
164
|
+
Schema_exports.Literals([
|
|
165
|
+
"keyBytes",
|
|
166
|
+
"entryBytes",
|
|
167
|
+
"batchBytes",
|
|
168
|
+
"batchEntries",
|
|
169
|
+
"totalBytes",
|
|
170
|
+
"totalEntries"
|
|
171
|
+
])
|
|
172
|
+
)
|
|
173
|
+
}) {
|
|
174
|
+
};
|
|
175
|
+
var cacheLimits = {
|
|
176
|
+
keyBytes: 8192,
|
|
177
|
+
entryBytes: 2e6,
|
|
178
|
+
batchBytes: 8e6,
|
|
179
|
+
batchEntries: 128,
|
|
180
|
+
totalBytes: 128e6,
|
|
181
|
+
totalEntries: 1e5,
|
|
182
|
+
retentionMs: 7 * 24 * 60 * 60 * 1e3,
|
|
183
|
+
loadTimeoutMs: 9e4,
|
|
184
|
+
/**
|
|
185
|
+
* A loader's lease lapses this long after its host last renewed it. Hosts renew every
|
|
186
|
+
* `renewMs` while the invocation that claimed it runs, so a stalled or lost holder frees the
|
|
187
|
+
* key well inside an MCP execute budget.
|
|
188
|
+
*/
|
|
189
|
+
leaseMs: 15e3,
|
|
190
|
+
renewMs: 5e3,
|
|
191
|
+
/** The longest a caller waits on another loader before loading for itself without publishing. */
|
|
192
|
+
waitMs: 1e4,
|
|
193
|
+
/** Bound for one command to a host store; a lost reply fails instead of holding its caller. */
|
|
194
|
+
commandTimeoutMs: 1e4
|
|
195
|
+
};
|
|
196
|
+
var Key = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{64}$/));
|
|
197
|
+
var Time = Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0));
|
|
198
|
+
var CacheEntry = Schema_exports.Struct({
|
|
199
|
+
value: Schema_exports.Json,
|
|
200
|
+
version: Schema_exports.String,
|
|
201
|
+
freshUntil: Time,
|
|
202
|
+
staleUntil: Time
|
|
203
|
+
});
|
|
204
|
+
var CacheAcquired = Schema_exports.Struct({
|
|
205
|
+
entry: Schema_exports.NullOr(CacheEntry),
|
|
206
|
+
lease: Schema_exports.NullOr(Schema_exports.String),
|
|
207
|
+
/**
|
|
208
|
+
* The entries of the command's `reads`, in order, read in the same transaction as `entry`.
|
|
209
|
+
* Absent when the store did not read them: a store that predates them, or reads past the
|
|
210
|
+
* batch byte bound. The caller then reads them with a separate `read`.
|
|
211
|
+
*/
|
|
212
|
+
reads: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NullOr(CacheEntry)))
|
|
213
|
+
});
|
|
214
|
+
var CacheCommand = Schema_exports.Union([
|
|
215
|
+
Schema_exports.Struct({ operation: Schema_exports.Literal("read"), keys: Schema_exports.Array(Key) }),
|
|
216
|
+
Schema_exports.Struct({
|
|
217
|
+
operation: Schema_exports.Literal("acquire"),
|
|
218
|
+
key: Key,
|
|
219
|
+
/** Claim even a fresh entry, as an explicit refresh does. */
|
|
220
|
+
refresh: Schema_exports.Boolean,
|
|
221
|
+
/** Claim only while the entry still has this version. Absent accepts the current one. */
|
|
222
|
+
version: Schema_exports.optionalKey(Schema_exports.NullOr(Schema_exports.String)),
|
|
223
|
+
/**
|
|
224
|
+
* Other keys to read in the same transaction, as `read` would, so a caller that needs them
|
|
225
|
+
* beside the entry makes one round trip. Reading them claims and changes nothing.
|
|
226
|
+
*/
|
|
227
|
+
reads: Schema_exports.optionalKey(Schema_exports.Array(Key))
|
|
228
|
+
}),
|
|
229
|
+
Schema_exports.Struct({
|
|
230
|
+
operation: Schema_exports.Literal("claim"),
|
|
231
|
+
key: Key,
|
|
232
|
+
version: Schema_exports.NullOr(Schema_exports.String)
|
|
233
|
+
}),
|
|
234
|
+
Schema_exports.Struct({
|
|
235
|
+
operation: Schema_exports.Literal("publish"),
|
|
236
|
+
key: Key,
|
|
237
|
+
lease: Schema_exports.String,
|
|
238
|
+
entry: CacheEntry
|
|
239
|
+
}),
|
|
240
|
+
Schema_exports.Struct({ operation: Schema_exports.Literal("release"), key: Key, lease: Schema_exports.String }),
|
|
241
|
+
/** Extend a lease its holder still owns. Replies false once the lease lapsed or was replaced. */
|
|
242
|
+
Schema_exports.Struct({ operation: Schema_exports.Literal("renew"), key: Key, lease: Schema_exports.String }),
|
|
243
|
+
Schema_exports.Struct({
|
|
244
|
+
operation: Schema_exports.Literal("write"),
|
|
245
|
+
entries: Schema_exports.Array(Schema_exports.Struct({ key: Key, entry: CacheEntry }))
|
|
246
|
+
}),
|
|
247
|
+
Schema_exports.Struct({ operation: Schema_exports.Literal("invalidate"), key: Key })
|
|
248
|
+
]);
|
|
249
|
+
var CacheReply = Schema_exports.Union([
|
|
250
|
+
Schema_exports.Struct({ ok: Schema_exports.Literal(true), value: Schema_exports.Json }),
|
|
251
|
+
Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: CacheError })
|
|
252
|
+
]);
|
|
253
|
+
|
|
254
|
+
export {
|
|
255
|
+
maxFailureMessageLength,
|
|
256
|
+
FailureSource,
|
|
257
|
+
FailureName,
|
|
258
|
+
FailureCode,
|
|
259
|
+
FailureMessage,
|
|
260
|
+
maxFailureFields,
|
|
261
|
+
maxFailureFieldLength,
|
|
262
|
+
FailureFieldName,
|
|
263
|
+
FailureFieldValue,
|
|
264
|
+
FailureFields,
|
|
265
|
+
FailureDetail,
|
|
266
|
+
maxUpstreamMessageLength,
|
|
267
|
+
UpstreamError,
|
|
268
|
+
FailurePhase,
|
|
269
|
+
ProviderError,
|
|
270
|
+
NetworkRefusal,
|
|
271
|
+
NetworkRefused,
|
|
272
|
+
networkRefusalStatus,
|
|
273
|
+
networkRefusalHeader,
|
|
274
|
+
NetworkRefusedHeader,
|
|
275
|
+
networkRefusalResponse,
|
|
276
|
+
RestrictedFetchOption,
|
|
277
|
+
supportedFetchOptions,
|
|
278
|
+
FetchOptionUnsupported,
|
|
279
|
+
CacheError,
|
|
280
|
+
cacheLimits,
|
|
281
|
+
CacheEntry,
|
|
282
|
+
CacheAcquired,
|
|
283
|
+
CacheCommand,
|
|
284
|
+
CacheReply
|
|
285
|
+
};
|