apps 0.0.1-beta.74 → 0.0.1-beta.76
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/framework-reference.json +1 -1
- package/js/{chunk-RUP4JMKO.js → chunk-A5JIYK7N.js} +141 -14
- package/js/{chunk-MHB7IFG7.js → chunk-BPROQMUB.js} +1 -1
- package/js/{chunk-2QWOG4UJ.js → chunk-D3EM6XUC.js} +3 -3
- package/js/{chunk-PZ535RJX.js → chunk-DFPNS3O3.js} +2 -2
- package/js/{chunk-JSWN4D6V.js → chunk-DV6PXM42.js} +3 -3
- package/js/{chunk-F2OAC6GE.js → chunk-EAVF4IPZ.js} +1 -1
- package/js/{chunk-TSPJFGA6.js → chunk-GLPG3W7P.js} +4 -4
- package/js/{chunk-UCQBJUA5.js → chunk-JREDSVGB.js} +24 -107
- package/js/{chunk-OABWTKGG.js → chunk-L5OGF662.js} +2 -2
- package/js/{chunk-AE45SVBH.js → chunk-PKFTT3HW.js} +5 -5
- package/js/{chunk-7LMU3ER3.js → chunk-Q4IZAUIF.js} +13 -2
- package/js/{chunk-ECCWT5GJ.js → chunk-SNLZ5SUI.js} +65 -24
- package/js/{chunk-ZR7QAG67.js → chunk-ZHHWNWV3.js} +1 -1
- package/js/contracts.js +2 -2
- package/js/effect.js +9 -9
- package/js/graphql.js +11 -11
- package/js/host.js +9 -9
- package/js/index.js +5 -5
- package/js/mcp/effect.js +11 -11
- package/js/mcp/stdio.js +11 -11
- package/js/mcp.js +13 -13
- package/js/openapi.js +7 -7
- package/js/skills.js +5 -5
- package/js/ui/serving.js +1 -1
- package/package.json +1 -1
- package/runtime.json +1 -1
- package/types/app-cache/src/contracts/cache.d.ts +16 -0
- package/types/app-cache/src/index.d.ts +18 -0
- package/types/apps/src/contracts/protocols/current.d.ts +1 -0
- package/types/apps/src/implementation/browser-scripts.gen.d.ts +1 -1
- package/types/apps/src/implementation/cache.d.ts +24 -1
- package/types/apps/src/implementation/ui-errors.d.ts +1 -1
|
@@ -1,9 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
appInvocationFetch
|
|
3
|
+
} from "./chunk-BPROQMUB.js";
|
|
4
|
+
import {
|
|
5
|
+
fromPromise,
|
|
6
|
+
method,
|
|
7
|
+
toPromise
|
|
8
|
+
} from "./chunk-ZHHWNWV3.js";
|
|
1
9
|
import {
|
|
2
10
|
CacheAcquired,
|
|
3
11
|
CacheEntry,
|
|
4
12
|
CacheError,
|
|
5
13
|
cacheLimits
|
|
6
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-Q4IZAUIF.js";
|
|
15
|
+
import {
|
|
16
|
+
decoderOf
|
|
17
|
+
} from "./chunk-KGCTYL2S.js";
|
|
18
|
+
import {
|
|
19
|
+
owned
|
|
20
|
+
} from "./chunk-3CVQ3VPP.js";
|
|
7
21
|
import {
|
|
8
22
|
Clock_exports,
|
|
9
23
|
Duration_exports,
|
|
@@ -60,8 +74,16 @@ var makeCache = (host, background, scope = "shared", deadline) => {
|
|
|
60
74
|
)
|
|
61
75
|
)
|
|
62
76
|
);
|
|
63
|
-
const get = (options, refresh) => Effect_exports.gen(function* () {
|
|
77
|
+
const get = (options, refresh, also = () => []) => Effect_exports.gen(function* () {
|
|
64
78
|
const key = yield* keyOf(options.key);
|
|
79
|
+
const extra = also(key);
|
|
80
|
+
const reads = extra.length === 0 ? void 0 : yield* Effect_exports.forEach(extra, keyOf);
|
|
81
|
+
const withReads = (value, entries) => ({
|
|
82
|
+
value,
|
|
83
|
+
key,
|
|
84
|
+
reads: entries
|
|
85
|
+
});
|
|
86
|
+
const loaded = (value) => ({ value, key, reads: void 0 });
|
|
65
87
|
const { fresh, stale } = yield* durations(options.freshFor, options.staleFor);
|
|
66
88
|
const decode = (value) => Schema_exports.decodeUnknownEffect(options.schema)(value);
|
|
67
89
|
const load = (lease) => Effect_exports.gen(function* () {
|
|
@@ -99,11 +121,12 @@ var makeCache = (host, background, scope = "shared", deadline) => {
|
|
|
99
121
|
);
|
|
100
122
|
let initialVersion;
|
|
101
123
|
while (true) {
|
|
102
|
-
const
|
|
124
|
+
const acquired = yield* transport({
|
|
103
125
|
operation: "acquire",
|
|
104
126
|
key,
|
|
105
127
|
refresh,
|
|
106
|
-
...initialVersion === void 0 ? {} : { version: initialVersion }
|
|
128
|
+
...initialVersion === void 0 ? {} : { version: initialVersion },
|
|
129
|
+
...reads === void 0 ? {} : { reads }
|
|
107
130
|
}).pipe(
|
|
108
131
|
Effect_exports.flatMap(
|
|
109
132
|
(reply) => Schema_exports.decodeUnknownEffect(CacheAcquired)(reply).pipe(
|
|
@@ -111,29 +134,33 @@ var makeCache = (host, background, scope = "shared", deadline) => {
|
|
|
111
134
|
)
|
|
112
135
|
)
|
|
113
136
|
);
|
|
137
|
+
const { entry, lease } = acquired;
|
|
138
|
+
const together = acquired.reads?.length === reads?.length ? acquired.reads : void 0;
|
|
114
139
|
const now = yield* Clock_exports.currentTimeMillis;
|
|
115
140
|
if (initialVersion === void 0) initialVersion = entry?.version ?? null;
|
|
116
141
|
const refreshed = refresh && entry !== null && entry.version !== initialVersion;
|
|
117
142
|
if (entry !== null && (refreshed || !refresh && lease === null && now < entry.freshUntil)) {
|
|
118
143
|
yield* Effect_exports.annotateCurrentSpan("cache.result", "fresh");
|
|
119
|
-
return yield* decode(entry.value);
|
|
144
|
+
return withReads(yield* decode(entry.value), together);
|
|
120
145
|
}
|
|
121
146
|
const kept = !refresh && entry !== null && now < entry.staleUntil;
|
|
122
147
|
if (kept && options.stale !== "revalidate") {
|
|
123
148
|
yield* Effect_exports.annotateCurrentSpan("cache.result", "stale");
|
|
124
149
|
if (lease !== null) yield* background(load(lease).pipe(Effect_exports.asVoid));
|
|
125
|
-
return yield* decode(entry.value);
|
|
150
|
+
return withReads(yield* decode(entry.value), together);
|
|
126
151
|
}
|
|
127
152
|
if (lease !== null) {
|
|
128
153
|
yield* Effect_exports.annotateCurrentSpan("cache.result", kept ? "revalidated" : "miss");
|
|
129
|
-
return yield* load(lease);
|
|
154
|
+
return loaded(yield* load(lease));
|
|
130
155
|
}
|
|
131
156
|
if (now >= waitUntil) {
|
|
132
157
|
yield* Effect_exports.annotateCurrentSpan("cache.result", "local");
|
|
133
|
-
return
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
158
|
+
return loaded(
|
|
159
|
+
yield* options.load.pipe(
|
|
160
|
+
Effect_exports.flatMap(decode),
|
|
161
|
+
Effect_exports.timeout(cacheLimits.loadTimeoutMs),
|
|
162
|
+
Effect_exports.withSpan("app.cache.load", { attributes: { "cache.load.leased": false } })
|
|
163
|
+
)
|
|
137
164
|
);
|
|
138
165
|
}
|
|
139
166
|
yield* Effect_exports.sleep("100 millis");
|
|
@@ -171,13 +198,113 @@ var makeCache = (host, background, scope = "shared", deadline) => {
|
|
|
171
198
|
* Read fresh data, refresh stale data in the background (or first, with `stale: "revalidate"`),
|
|
172
199
|
* or wait for the lease owner.
|
|
173
200
|
*/
|
|
174
|
-
get: (options) => get(options, false),
|
|
201
|
+
get: (options) => get(options, false).pipe(Effect_exports.map(({ value }) => value)),
|
|
202
|
+
/**
|
|
203
|
+
* `get`, also reading the keys of this scope that `keys` names in the same round trip. `keys`
|
|
204
|
+
* gets the entry's store key, which is unique to this scope and key, so a caller can remember
|
|
205
|
+
* what it read under it. `reads` holds their entries, undecoded and in order, when the value
|
|
206
|
+
* was read from the store; it is undefined when the value was loaded or the store did not read
|
|
207
|
+
* them, and the caller then reads what it still needs.
|
|
208
|
+
*/
|
|
209
|
+
getWith: (options, keys) => get(options, false, keys),
|
|
175
210
|
/** Force one awaited refresh without removing the retained value. Concurrent refreshes share a load. */
|
|
176
|
-
revalidate: (options) => get(options, true)
|
|
211
|
+
revalidate: (options) => get(options, true).pipe(Effect_exports.map(({ value }) => value))
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// src/implementation/cache.ts
|
|
216
|
+
var getWithReads = /* @__PURE__ */ Symbol("executor.cache.getWithReads");
|
|
217
|
+
var unavailableCache = {
|
|
218
|
+
transport: () => Effect_exports.fail(new CacheError({ reason: "unavailable" })),
|
|
219
|
+
background: () => Effect_exports.die(new Error("Cache background runner is unavailable"))
|
|
220
|
+
};
|
|
221
|
+
var authorCache = (host, accounts, signal, telemetry, deadline) => {
|
|
222
|
+
const scoped = (scope, callerSignal = signal) => {
|
|
223
|
+
const cache = makeCache(host.transport, host.background, scope, deadline);
|
|
224
|
+
const getOptions = (options) => ({
|
|
225
|
+
key: options.key,
|
|
226
|
+
schema: decoderOf(options.schema),
|
|
227
|
+
freshFor: options.freshFor,
|
|
228
|
+
...options.staleFor === void 0 ? {} : { staleFor: options.staleFor },
|
|
229
|
+
...options.stale === void 0 ? {} : { stale: options.stale },
|
|
230
|
+
load: Effect_exports.acquireUseRelease(
|
|
231
|
+
Effect_exports.sync(() => new AbortController()),
|
|
232
|
+
(controller) => appInvocationFetch(controller.signal).pipe(
|
|
233
|
+
Effect_exports.flatMap(
|
|
234
|
+
(fetch) => fromPromise(
|
|
235
|
+
method(options, "load"),
|
|
236
|
+
"loader"
|
|
237
|
+
)({
|
|
238
|
+
fetch,
|
|
239
|
+
signal: controller.signal,
|
|
240
|
+
cache: scoped(scope, controller.signal)
|
|
241
|
+
})
|
|
242
|
+
)
|
|
243
|
+
),
|
|
244
|
+
(controller) => Effect_exports.sync(() => controller.abort())
|
|
245
|
+
)
|
|
246
|
+
});
|
|
247
|
+
const load = (read, given) => cache[read](getOptions(given));
|
|
248
|
+
const decodeEntries = (entries, schema) => Effect_exports.forEach(
|
|
249
|
+
entries,
|
|
250
|
+
(entry) => entry === null ? Effect_exports.succeed(void 0) : Schema_exports.decodeUnknownEffect(decoderOf(schema))(entry.value)
|
|
251
|
+
);
|
|
252
|
+
const service = (method2, operation) => toPromise(
|
|
253
|
+
(...args) => operation(...args).pipe(
|
|
254
|
+
owned("executor", "app.cache.call", { attributes: { "cache.method": method2 } })
|
|
255
|
+
),
|
|
256
|
+
callerSignal,
|
|
257
|
+
telemetry
|
|
258
|
+
);
|
|
259
|
+
const authored = {
|
|
260
|
+
get: service("get", (options) => load("get", options)),
|
|
261
|
+
revalidate: service(
|
|
262
|
+
"revalidate",
|
|
263
|
+
(options) => load("revalidate", options)
|
|
264
|
+
),
|
|
265
|
+
read: service(
|
|
266
|
+
"read",
|
|
267
|
+
(key, schema) => cache.read([key]).pipe(
|
|
268
|
+
Effect_exports.flatMap((entries) => {
|
|
269
|
+
const entry = entries[0];
|
|
270
|
+
return entry === void 0 || entry === null ? Effect_exports.succeed(void 0) : Schema_exports.decodeUnknownEffect(decoderOf(schema))(entry.value);
|
|
271
|
+
})
|
|
272
|
+
)
|
|
273
|
+
),
|
|
274
|
+
readMany: service(
|
|
275
|
+
"readMany",
|
|
276
|
+
(keys, schema) => cache.read(keys).pipe(Effect_exports.flatMap((entries) => decodeEntries(entries, schema)))
|
|
277
|
+
),
|
|
278
|
+
write: service("write", cache.write),
|
|
279
|
+
invalidate: service("invalidate", cache.invalidate),
|
|
280
|
+
forAccount: (account) => {
|
|
281
|
+
const bound = Object.values(accounts).flatMap((value) => Array.isArray(value) ? value : [value]).find((value) => value.id === account.id);
|
|
282
|
+
if (bound === void 0) throw new CacheError({ reason: "invalid" });
|
|
283
|
+
return scoped(
|
|
284
|
+
{ account: bound.id, method: bound.method, generation: bound.generation },
|
|
285
|
+
callerSignal
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
return Object.defineProperty(authored, getWithReads, {
|
|
290
|
+
value: service(
|
|
291
|
+
"get",
|
|
292
|
+
(given, keys) => cache.getWith(getOptions(given), keys).pipe(
|
|
293
|
+
Effect_exports.map(({ value, key, reads }) => ({
|
|
294
|
+
value,
|
|
295
|
+
key,
|
|
296
|
+
reads: reads?.map((entry) => entry === null ? void 0 : entry.value)
|
|
297
|
+
}))
|
|
298
|
+
)
|
|
299
|
+
)
|
|
300
|
+
});
|
|
177
301
|
};
|
|
302
|
+
return scoped("shared");
|
|
178
303
|
};
|
|
179
304
|
|
|
180
305
|
export {
|
|
181
306
|
cacheKey,
|
|
182
|
-
|
|
307
|
+
getWithReads,
|
|
308
|
+
unavailableCache,
|
|
309
|
+
authorCache
|
|
183
310
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
prepareElicitation
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JREDSVGB.js";
|
|
4
4
|
import {
|
|
5
5
|
bodyUpstreamError,
|
|
6
6
|
fromPromise
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZHHWNWV3.js";
|
|
8
8
|
import {
|
|
9
9
|
ElicitationFailed,
|
|
10
10
|
McpError,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
defaultElicitationLimits,
|
|
17
17
|
defaultMcpClientLimits,
|
|
18
18
|
mcpSdkTimerCeilingMs
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-EAVF4IPZ.js";
|
|
20
20
|
import {
|
|
21
21
|
jsonSchemaDecoder,
|
|
22
22
|
nestJsonSchema,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fixedRouter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GLPG3W7P.js";
|
|
4
4
|
import {
|
|
5
5
|
nativeOperation,
|
|
6
6
|
operationDeclaration,
|
|
7
7
|
routerDeclaration
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-L5OGF662.js";
|
|
9
9
|
|
|
10
10
|
// src/implementation/protocol-operations.ts
|
|
11
11
|
var protocolOperations = (operations, kinds = {}) => {
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
declaredOperations,
|
|
3
3
|
nativeOperation,
|
|
4
4
|
nativeRouter
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-L5OGF662.js";
|
|
6
6
|
import {
|
|
7
7
|
fromPromise,
|
|
8
8
|
method
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZHHWNWV3.js";
|
|
10
10
|
import {
|
|
11
11
|
EmittedEvent,
|
|
12
12
|
EventName,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
normalizePlacements,
|
|
17
17
|
placementFields,
|
|
18
18
|
renderPlacement
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-EAVF4IPZ.js";
|
|
20
20
|
import {
|
|
21
21
|
decoderOf,
|
|
22
22
|
isSchema,
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
joinPath,
|
|
6
6
|
mergeMeta
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-L5OGF662.js";
|
|
8
8
|
import {
|
|
9
9
|
isShortenedUpstream,
|
|
10
10
|
parseProviderError,
|
|
11
11
|
providerError
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZHHWNWV3.js";
|
|
13
13
|
import {
|
|
14
14
|
ApiErrorResponse,
|
|
15
15
|
HostDeclarationInvalid,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
McpError,
|
|
22
22
|
McpError2,
|
|
23
23
|
SkillLoadFailed as SkillLoadFailed2
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-EAVF4IPZ.js";
|
|
25
25
|
import {
|
|
26
26
|
CacheError,
|
|
27
27
|
FailureCode,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
maxFailureFields,
|
|
34
34
|
maxFailureMessageLength,
|
|
35
35
|
maxUpstreamMessageLength
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-Q4IZAUIF.js";
|
|
37
37
|
import {
|
|
38
38
|
SkillLoadFailed,
|
|
39
39
|
skillFormatLimits
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
authorCache,
|
|
3
|
+
unavailableCache
|
|
4
|
+
} from "./chunk-A5JIYK7N.js";
|
|
4
5
|
import {
|
|
5
6
|
accountSecrets,
|
|
6
7
|
boundFailureMessage,
|
|
@@ -11,10 +12,10 @@ import {
|
|
|
11
12
|
parseSkillLoadFailed,
|
|
12
13
|
readCatalog,
|
|
13
14
|
routerSkills
|
|
14
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GLPG3W7P.js";
|
|
15
16
|
import {
|
|
16
17
|
appInvocationFetch
|
|
17
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-BPROQMUB.js";
|
|
18
19
|
import {
|
|
19
20
|
folderSkillsEffect
|
|
20
21
|
} from "./chunk-XBG7HHXC.js";
|
|
@@ -25,21 +26,20 @@ import {
|
|
|
25
26
|
makeEmitter,
|
|
26
27
|
toEffectApp,
|
|
27
28
|
withPlacements
|
|
28
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-DV6PXM42.js";
|
|
29
30
|
import {
|
|
30
31
|
declaredOperations,
|
|
31
32
|
locate,
|
|
32
33
|
nativeOperation
|
|
33
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-L5OGF662.js";
|
|
34
35
|
import {
|
|
35
36
|
accountProviderError,
|
|
36
37
|
appCode,
|
|
37
38
|
fromPromise,
|
|
38
39
|
httpProviderError,
|
|
39
|
-
method,
|
|
40
40
|
parseProviderError,
|
|
41
41
|
toPromise
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-ZHHWNWV3.js";
|
|
43
43
|
import {
|
|
44
44
|
AccountCheckResult,
|
|
45
45
|
DeclaredProvider,
|
|
@@ -91,17 +91,13 @@ import {
|
|
|
91
91
|
reservedTablePrefix,
|
|
92
92
|
sqlBindingsLimit,
|
|
93
93
|
workflowDurationMillis
|
|
94
|
-
} from "./chunk-
|
|
95
|
-
import {
|
|
96
|
-
CacheError
|
|
97
|
-
} from "./chunk-7LMU3ER3.js";
|
|
94
|
+
} from "./chunk-EAVF4IPZ.js";
|
|
98
95
|
import {
|
|
99
96
|
AppSkills,
|
|
100
97
|
SkillFile
|
|
101
98
|
} from "./chunk-H72MEDMN.js";
|
|
102
99
|
import {
|
|
103
100
|
allowedValues,
|
|
104
|
-
decoderOf,
|
|
105
101
|
echoableKey,
|
|
106
102
|
importedJsonSchema,
|
|
107
103
|
importedSchemaKeys,
|
|
@@ -1071,85 +1067,6 @@ var migrate = (storage, files) => Effect_exports.gen(function* () {
|
|
|
1071
1067
|
);
|
|
1072
1068
|
});
|
|
1073
1069
|
|
|
1074
|
-
// src/implementation/cache.ts
|
|
1075
|
-
var unavailableCache = {
|
|
1076
|
-
transport: () => Effect_exports.fail(new CacheError({ reason: "unavailable" })),
|
|
1077
|
-
background: () => Effect_exports.die(new Error("Cache background runner is unavailable"))
|
|
1078
|
-
};
|
|
1079
|
-
var authorCache = (host, accounts, signal, telemetry, deadline) => {
|
|
1080
|
-
const scoped = (scope, callerSignal = signal) => {
|
|
1081
|
-
const cache = makeCache(host.transport, host.background, scope, deadline);
|
|
1082
|
-
const load = (read, options) => cache[read]({
|
|
1083
|
-
key: options.key,
|
|
1084
|
-
schema: decoderOf(options.schema),
|
|
1085
|
-
freshFor: options.freshFor,
|
|
1086
|
-
...options.staleFor === void 0 ? {} : { staleFor: options.staleFor },
|
|
1087
|
-
...options.stale === void 0 ? {} : { stale: options.stale },
|
|
1088
|
-
load: Effect_exports.acquireUseRelease(
|
|
1089
|
-
Effect_exports.sync(() => new AbortController()),
|
|
1090
|
-
(controller) => appInvocationFetch(controller.signal).pipe(
|
|
1091
|
-
Effect_exports.flatMap(
|
|
1092
|
-
(fetch) => fromPromise(
|
|
1093
|
-
method(options, "load"),
|
|
1094
|
-
"loader"
|
|
1095
|
-
)({
|
|
1096
|
-
fetch,
|
|
1097
|
-
signal: controller.signal,
|
|
1098
|
-
cache: scoped(scope, controller.signal)
|
|
1099
|
-
})
|
|
1100
|
-
)
|
|
1101
|
-
),
|
|
1102
|
-
(controller) => Effect_exports.sync(() => controller.abort())
|
|
1103
|
-
)
|
|
1104
|
-
});
|
|
1105
|
-
const service = (method2, operation) => toPromise(
|
|
1106
|
-
(...args) => operation(...args).pipe(
|
|
1107
|
-
owned("executor", "app.cache.call", { attributes: { "cache.method": method2 } })
|
|
1108
|
-
),
|
|
1109
|
-
callerSignal,
|
|
1110
|
-
telemetry
|
|
1111
|
-
);
|
|
1112
|
-
return {
|
|
1113
|
-
get: service("get", (options) => load("get", options)),
|
|
1114
|
-
revalidate: service(
|
|
1115
|
-
"revalidate",
|
|
1116
|
-
(options) => load("revalidate", options)
|
|
1117
|
-
),
|
|
1118
|
-
read: service(
|
|
1119
|
-
"read",
|
|
1120
|
-
(key, schema) => cache.read([key]).pipe(
|
|
1121
|
-
Effect_exports.flatMap((entries) => {
|
|
1122
|
-
const entry = entries[0];
|
|
1123
|
-
return entry === void 0 || entry === null ? Effect_exports.succeed(void 0) : Schema_exports.decodeUnknownEffect(decoderOf(schema))(entry.value);
|
|
1124
|
-
})
|
|
1125
|
-
)
|
|
1126
|
-
),
|
|
1127
|
-
readMany: service(
|
|
1128
|
-
"readMany",
|
|
1129
|
-
(keys, schema) => cache.read(keys).pipe(
|
|
1130
|
-
Effect_exports.flatMap(
|
|
1131
|
-
(entries) => Effect_exports.forEach(
|
|
1132
|
-
entries,
|
|
1133
|
-
(entry) => entry === null ? Effect_exports.succeed(void 0) : Schema_exports.decodeUnknownEffect(decoderOf(schema))(entry.value)
|
|
1134
|
-
)
|
|
1135
|
-
)
|
|
1136
|
-
)
|
|
1137
|
-
),
|
|
1138
|
-
write: service("write", cache.write),
|
|
1139
|
-
invalidate: service("invalidate", cache.invalidate),
|
|
1140
|
-
forAccount: (account) => {
|
|
1141
|
-
const bound = Object.values(accounts).flatMap((value) => Array.isArray(value) ? value : [value]).find((value) => value.id === account.id);
|
|
1142
|
-
if (bound === void 0) throw new CacheError({ reason: "invalid" });
|
|
1143
|
-
return scoped(
|
|
1144
|
-
{ account: bound.id, method: bound.method, generation: bound.generation },
|
|
1145
|
-
callerSignal
|
|
1146
|
-
);
|
|
1147
|
-
}
|
|
1148
|
-
};
|
|
1149
|
-
};
|
|
1150
|
-
return scoped("shared");
|
|
1151
|
-
};
|
|
1152
|
-
|
|
1153
1070
|
// src/implementation/host.ts
|
|
1154
1071
|
var WireCatalog = Schema_exports.Struct({
|
|
1155
1072
|
tools: Schema_exports.Array(Schema_exports.Union([HostedTool, HostedToolSummary])),
|
|
@@ -1200,24 +1117,24 @@ function providerDeclaration(provider) {
|
|
|
1200
1117
|
return declarationSafe(
|
|
1201
1118
|
() => Effect_exports.gen(function* () {
|
|
1202
1119
|
const auth = /* @__PURE__ */ new Map();
|
|
1203
|
-
for (const [name,
|
|
1204
|
-
switch (
|
|
1120
|
+
for (const [name, method] of Object.entries(provider.auth)) {
|
|
1121
|
+
switch (method._tag) {
|
|
1205
1122
|
case "secrets":
|
|
1206
1123
|
auth.set(name, {
|
|
1207
1124
|
type: "secrets",
|
|
1208
|
-
label:
|
|
1209
|
-
fields: yield* jsonSchemaDocument(
|
|
1210
|
-
...declaredExposure(
|
|
1211
|
-
...declaredPlacements(
|
|
1125
|
+
label: method.label,
|
|
1126
|
+
fields: yield* jsonSchemaDocument(method.fields),
|
|
1127
|
+
...declaredExposure(method.exposure),
|
|
1128
|
+
...declaredPlacements(method.request)
|
|
1212
1129
|
});
|
|
1213
1130
|
break;
|
|
1214
1131
|
case "oauth2":
|
|
1215
1132
|
auth.set(name, {
|
|
1216
1133
|
type: "oauth2",
|
|
1217
|
-
...
|
|
1218
|
-
response: yield* jsonSchemaDocument(
|
|
1219
|
-
...declaredExposure(
|
|
1220
|
-
...declaredPlacements(
|
|
1134
|
+
...method.config,
|
|
1135
|
+
response: yield* jsonSchemaDocument(method.response),
|
|
1136
|
+
...declaredExposure(method.exposure),
|
|
1137
|
+
...declaredPlacements(method.request)
|
|
1221
1138
|
});
|
|
1222
1139
|
break;
|
|
1223
1140
|
}
|
|
@@ -1271,9 +1188,9 @@ function withoutGrants({ hosts: _hosts, ...provider }) {
|
|
|
1271
1188
|
return {
|
|
1272
1189
|
...provider,
|
|
1273
1190
|
auth: Object.fromEntries(
|
|
1274
|
-
Object.entries(provider.auth).map(([name, { request: _request, ...
|
|
1191
|
+
Object.entries(provider.auth).map(([name, { request: _request, ...method }]) => [
|
|
1275
1192
|
name,
|
|
1276
|
-
|
|
1193
|
+
method
|
|
1277
1194
|
])
|
|
1278
1195
|
)
|
|
1279
1196
|
};
|
|
@@ -1305,10 +1222,10 @@ function bindAccounts(slots, declarations, context) {
|
|
|
1305
1222
|
ids.add(account.id);
|
|
1306
1223
|
if (canonical(withoutGrants(account.provider)) !== canonical(withoutGrants(requirement.definition)) || !Object.hasOwn(provider.auth, account.method))
|
|
1307
1224
|
return yield* Effect_exports.fail(new HostAccountsInvalid());
|
|
1308
|
-
const
|
|
1309
|
-
if (
|
|
1225
|
+
const method = provider.auth[account.method];
|
|
1226
|
+
if (method === void 0) return yield* Effect_exports.fail(new HostAccountsInvalid());
|
|
1310
1227
|
const fields = yield* Schema_exports.decodeUnknownEffect(
|
|
1311
|
-
|
|
1228
|
+
method._tag === "secrets" ? method.fields : method.response
|
|
1312
1229
|
)(account.fields);
|
|
1313
1230
|
const granted = Object.hasOwn(account.provider.auth, account.method) ? account.provider.auth[account.method]?.request : void 0;
|
|
1314
1231
|
values.push(
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fromPromise
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZHHWNWV3.js";
|
|
4
4
|
import {
|
|
5
5
|
HostedTool,
|
|
6
6
|
RouterKey,
|
|
7
7
|
RouterMeta,
|
|
8
8
|
reservedRouterKeys
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EAVF4IPZ.js";
|
|
10
10
|
import {
|
|
11
11
|
decoderOf,
|
|
12
12
|
schemaArgument
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
answeredError,
|
|
4
4
|
mcpClient,
|
|
5
5
|
mcpJsonSchemaValidator
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-D3EM6XUC.js";
|
|
7
7
|
import {
|
|
8
8
|
failOnNetworkRefusal
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BPROQMUB.js";
|
|
10
10
|
import {
|
|
11
11
|
accountProviderError,
|
|
12
12
|
bodyUpstreamError,
|
|
13
13
|
httpProviderError,
|
|
14
14
|
providerErrorDetail
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ZHHWNWV3.js";
|
|
16
16
|
import {
|
|
17
17
|
McpCredentialsUnverified,
|
|
18
18
|
McpError,
|
|
@@ -20,11 +20,11 @@ import {
|
|
|
20
20
|
McpToolsOptions,
|
|
21
21
|
defaultMcpClientLimits,
|
|
22
22
|
mcpHealthReserveMs
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-EAVF4IPZ.js";
|
|
24
24
|
import {
|
|
25
25
|
NetworkRefused,
|
|
26
26
|
ProviderError
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-Q4IZAUIF.js";
|
|
28
28
|
import {
|
|
29
29
|
captureTelemetry,
|
|
30
30
|
owned
|
|
@@ -203,7 +203,13 @@ var CacheEntry = Schema_exports.Struct({
|
|
|
203
203
|
});
|
|
204
204
|
var CacheAcquired = Schema_exports.Struct({
|
|
205
205
|
entry: Schema_exports.NullOr(CacheEntry),
|
|
206
|
-
lease: Schema_exports.NullOr(Schema_exports.String)
|
|
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)))
|
|
207
213
|
});
|
|
208
214
|
var CacheCommand = Schema_exports.Union([
|
|
209
215
|
Schema_exports.Struct({ operation: Schema_exports.Literal("read"), keys: Schema_exports.Array(Key) }),
|
|
@@ -213,7 +219,12 @@ var CacheCommand = Schema_exports.Union([
|
|
|
213
219
|
/** Claim even a fresh entry, as an explicit refresh does. */
|
|
214
220
|
refresh: Schema_exports.Boolean,
|
|
215
221
|
/** Claim only while the entry still has this version. Absent accepts the current one. */
|
|
216
|
-
version: Schema_exports.optionalKey(Schema_exports.NullOr(Schema_exports.String))
|
|
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))
|
|
217
228
|
}),
|
|
218
229
|
Schema_exports.Struct({
|
|
219
230
|
operation: Schema_exports.Literal("claim"),
|