apps 0.0.1-beta.106 → 0.0.1-beta.109

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/js/graphql.js CHANGED
@@ -1,33 +1,47 @@
1
1
  import {
2
2
  catalogCache,
3
3
  catalogScope
4
- } from "./chunk-EDXNAZLI.js";
4
+ } from "./chunk-SXQVVXJE.js";
5
5
  import {
6
6
  protocolOperations
7
- } from "./chunk-KY7C6BWO.js";
7
+ } from "./chunk-RIV62DRM.js";
8
8
  import "./chunk-BCSNKUAC.js";
9
- import "./chunk-3UWLQMMK.js";
9
+ import "./chunk-JCX2K2SI.js";
10
10
  import {
11
11
  cacheKey
12
- } from "./chunk-2B7FHH7S.js";
13
- import "./chunk-OTDKCYMH.js";
12
+ } from "./chunk-UPTAFF6L.js";
13
+ import {
14
+ GraphqlError,
15
+ GraphqlIntrospection,
16
+ GraphqlResponse,
17
+ GraphqlToolDefinition,
18
+ GraphqlToolsOptions,
19
+ defaultGraphqlClientLimits,
20
+ maxGraphqlStatedErrors,
21
+ maxGraphqlStatedExtensions,
22
+ maxGraphqlStatedFieldLength
23
+ } from "./chunk-BKIQCV72.js";
14
24
  import {
15
25
  failOnNetworkRefusal
16
26
  } from "./chunk-HLMJBE4T.js";
17
27
  import "./chunk-PBGPES67.js";
18
- import "./chunk-QN5BMAG7.js";
28
+ import "./chunk-3BI34I5S.js";
19
29
  import {
20
30
  nativeOperation,
21
31
  routerDeclaration
22
- } from "./chunk-PILIRGJA.js";
32
+ } from "./chunk-ZXG7RMCB.js";
23
33
  import {
24
34
  accountProviderError,
35
+ boundStated,
25
36
  graphqlProviderError,
26
37
  httpProviderError
27
- } from "./chunk-R3O32PQV.js";
38
+ } from "./chunk-OIH73VFM.js";
28
39
  import {
40
+ FailureFieldName,
29
41
  NetworkRefused,
30
- ProviderError
42
+ ProviderError,
43
+ defaultOpenapiErrorLimits,
44
+ maxUpstreamMessageLength
31
45
  } from "./chunk-2RGJMA7N.js";
32
46
  import "./chunk-4PIQKACY.js";
33
47
  import {
@@ -41,8 +55,6 @@ import {
41
55
  } from "./chunk-YDW7DX3A.js";
42
56
  import "./chunk-OWN3DP2W.js";
43
57
  import {
44
- AccountId,
45
- HttpUrl,
46
58
  JsonObject
47
59
  } from "./chunk-7HG422GB.js";
48
60
  import "./chunk-DILSCQPJ.js";
@@ -52,106 +64,19 @@ import {
52
64
  } from "./chunk-ACQXVKVQ.js";
53
65
  import {
54
66
  Effect_exports,
67
+ Option_exports,
55
68
  Redacted_exports,
56
- Schema_exports
69
+ Ref_exports,
70
+ Result_exports,
71
+ Schema_exports,
72
+ Stream_exports
57
73
  } from "./chunk-ZKDXML77.js";
58
74
  import "./chunk-CZ7CSFO4.js";
59
75
 
60
- // src/contracts/graphql.ts
61
- var GraphqlClientLimits = Schema_exports.Struct({
62
- timeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
63
- maxTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
64
- });
65
- var defaultGraphqlClientLimits = GraphqlClientLimits.make({
66
- timeoutMs: 3e4,
67
- maxTimeoutMs: 3e5
68
- });
69
- var GraphqlToolsOptions = Schema_exports.Struct({
70
- url: HttpUrl,
71
- accountId: Schema_exports.optional(AccountId),
72
- headers: Schema_exports.optional(Schema_exports.Record(Schema_exports.String, Schema_exports.String)),
73
- signal: Schema_exports.optional(Schema_exports.instanceOf(AbortSignal)),
74
- timeoutMs: Schema_exports.optional(
75
- Schema_exports.Int.check(
76
- Schema_exports.isBetween({ minimum: 1, maximum: defaultGraphqlClientLimits.maxTimeoutMs })
77
- )
78
- )
79
- });
80
- var GraphqlError = class extends Schema_exports.TaggedError()("GraphqlError", {
81
- phase: Schema_exports.Literals(["discover", "call"]),
82
- reason: Schema_exports.Literals([
83
- "request",
84
- "unauthorized",
85
- "invalid_response",
86
- "invalid_input",
87
- "timeout",
88
- "execution"
89
- ]),
90
- status: Schema_exports.optional(Schema_exports.Number)
91
- }) {
92
- };
93
- var Name = Schema_exports.String.check(Schema_exports.isPattern(/^[_A-Za-z][_0-9A-Za-z]*$/u));
94
- var Kind = Schema_exports.Literals([
95
- "SCALAR",
96
- "OBJECT",
97
- "INTERFACE",
98
- "UNION",
99
- "ENUM",
100
- "INPUT_OBJECT",
101
- "LIST",
102
- "NON_NULL"
103
- ]);
104
- var GraphqlTypeRef = Schema_exports.Struct({
105
- kind: Kind,
106
- name: Schema_exports.NullOr(Name),
107
- ofType: Schema_exports.optional(Schema_exports.NullOr(Schema_exports.suspend(() => GraphqlTypeRef)))
108
- });
109
- var Argument = Schema_exports.Struct({
110
- name: Name,
111
- description: Schema_exports.NullOr(Schema_exports.String),
112
- type: GraphqlTypeRef,
113
- defaultValue: Schema_exports.NullOr(Schema_exports.String)
114
- });
115
- var GraphqlField = Schema_exports.Struct({
116
- name: Name,
117
- description: Schema_exports.NullOr(Schema_exports.String),
118
- args: Schema_exports.Array(Argument),
119
- type: GraphqlTypeRef
120
- });
121
- var GraphqlIntrospection = Schema_exports.Struct({
122
- __schema: Schema_exports.Struct({
123
- queryType: Schema_exports.NullOr(Schema_exports.Struct({ name: Name })),
124
- mutationType: Schema_exports.NullOr(Schema_exports.Struct({ name: Name })),
125
- types: Schema_exports.Array(
126
- Schema_exports.Struct({
127
- kind: Kind,
128
- name: Name,
129
- fields: Schema_exports.NullOr(Schema_exports.Array(GraphqlField)),
130
- inputFields: Schema_exports.NullOr(Schema_exports.Array(Argument)),
131
- enumValues: Schema_exports.NullOr(Schema_exports.Array(Schema_exports.Struct({ name: Name })))
132
- })
133
- )
134
- })
135
- });
136
- var GraphqlResponse = Schema_exports.Struct({
137
- data: Schema_exports.optional(Schema_exports.NullOr(JsonObject)),
138
- errors: Schema_exports.optional(Schema_exports.Array(JsonObject))
139
- });
140
- var GraphqlToolDefinition = Schema_exports.Struct({
141
- name: Name,
142
- kind: Schema_exports.Literals(["query", "mutation"]),
143
- field: Name,
144
- description: Schema_exports.String,
145
- arguments: Schema_exports.Array(Schema_exports.Struct({ name: Name, type: Schema_exports.String })),
146
- inputSchema: JsonObject,
147
- composite: Schema_exports.Boolean,
148
- selection: Schema_exports.String
149
- });
150
-
151
76
  // src/implementation/graphql.ts
152
77
  import {
153
78
  getIntrospectionQuery,
154
- Kind as Kind2,
79
+ Kind,
155
80
  OperationTypeNode,
156
81
  parse,
157
82
  parseType,
@@ -243,14 +168,91 @@ function fieldInput(field, types) {
243
168
  }
244
169
  };
245
170
  }
171
+ var ResponseError = Schema_exports.Struct({
172
+ message: Schema_exports.String,
173
+ path: Schema_exports.optional(Schema_exports.Array(Schema_exports.Union([Schema_exports.String, Schema_exports.Int]))),
174
+ extensions: Schema_exports.optional(Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown))
175
+ });
176
+ var boundedPath = (path) => {
177
+ const segments = [];
178
+ let length = 0;
179
+ for (const segment of path) {
180
+ if (length > maxGraphqlStatedFieldLength) break;
181
+ const bounded = typeof segment === "number" ? segment : boundStated(segment, maxGraphqlStatedFieldLength);
182
+ length += typeof bounded === "number" ? String(bounded).length + 2 : Math.max(bounded.length, 1) + (segments.length === 0 ? 0 : 1);
183
+ segments.push(bounded);
184
+ }
185
+ return segments;
186
+ };
187
+ var extensionEntries = (extensions) => {
188
+ const entries = {};
189
+ let count = 0;
190
+ for (const key of [
191
+ ...Object.hasOwn(extensions, "code") ? ["code"] : [],
192
+ ...Object.keys(extensions).filter((key2) => key2 !== "code")
193
+ ]) {
194
+ if (count === maxGraphqlStatedExtensions) break;
195
+ const value = extensions[key];
196
+ if (!Schema_exports.is(FailureFieldName)(key)) continue;
197
+ if (typeof value === "string") entries[key] = boundStated(value, maxGraphqlStatedFieldLength);
198
+ else if (typeof value === "boolean" || typeof value === "number" && Number.isFinite(value))
199
+ entries[key] = value;
200
+ else continue;
201
+ count++;
202
+ }
203
+ return count === 0 ? void 0 : entries;
204
+ };
205
+ var statedErrors = (errors) => {
206
+ const stated = errors.slice(0, maxGraphqlStatedErrors).flatMap((error) => Option_exports.toArray(Schema_exports.decodeUnknownOption(ResponseError)(error))).map(({ message, path, extensions }) => {
207
+ const entries = extensions === void 0 ? void 0 : extensionEntries(extensions);
208
+ return {
209
+ message: boundStated(message, maxUpstreamMessageLength),
210
+ ...path === void 0 || path.length === 0 ? {} : { path: boundedPath(path) },
211
+ ...entries === void 0 ? {} : { extensions: entries }
212
+ };
213
+ });
214
+ return {
215
+ ...stated.length === 0 ? {} : { errors: stated },
216
+ ...errors.length > stated.length ? { stated: errors.length } : {}
217
+ };
218
+ };
219
+ var RefusedBody = Schema_exports.fromJsonString(
220
+ Schema_exports.Struct({ errors: Schema_exports.optional(Schema_exports.Array(Schema_exports.Unknown)) })
221
+ );
222
+ var refusedBody = (response) => Effect_exports.gen(function* () {
223
+ if (!/^application\/(?:[\w.-]+\+)?json$/i.test(
224
+ response.headers["content-type"]?.split(";")[0]?.trim() ?? ""
225
+ ))
226
+ return {};
227
+ const length = response.headers["content-length"];
228
+ if (length !== void 0 && Number(length) > defaultOpenapiErrorLimits.maxBodyBytes)
229
+ return { unreadBody: "too_large" };
230
+ const text = yield* response.stream.pipe(
231
+ Stream_exports.mapError(() => "incomplete"),
232
+ Stream_exports.limitBytes(
233
+ defaultOpenapiErrorLimits.maxBodyBytes,
234
+ () => Stream_exports.fail("too_large")
235
+ ),
236
+ Stream_exports.decodeText,
237
+ Stream_exports.mkString,
238
+ Effect_exports.timeoutOrElse({
239
+ duration: defaultOpenapiErrorLimits.readTimeoutMs,
240
+ orElse: () => Effect_exports.fail("incomplete")
241
+ }),
242
+ Effect_exports.result
243
+ );
244
+ if (Result_exports.isFailure(text)) return { unreadBody: text.failure };
245
+ const body = Schema_exports.decodeUnknownOption(RefusedBody)(text.success);
246
+ return Option_exports.isSome(body) && body.value.errors?.length ? statedErrors(body.value.errors) : {};
247
+ });
246
248
  function selection(text) {
247
249
  const document = parse("query { result { " + text + " } }");
248
250
  const definition = document.definitions[0];
249
- if (document.definitions.length !== 1 || definition?.kind !== Kind2.OPERATION_DEFINITION || definition.selectionSet.selections.length !== 1) {
251
+ if (document.definitions.length !== 1 || definition?.kind !== Kind.OPERATION_DEFINITION || definition.selectionSet.selections.length !== 1) {
250
252
  throw new GraphqlError({ phase: "call", reason: "invalid_input" });
251
253
  }
252
254
  const field = definition.selectionSet.selections[0];
253
- if (field?.kind !== Kind2.FIELD || field.name.value !== "result" || !field.selectionSet)
255
+ if (field?.kind !== Kind.FIELD || field.name.value !== "result" || !field.selectionSet)
254
256
  throw new GraphqlError({ phase: "call", reason: "invalid_input" });
255
257
  return field.selectionSet;
256
258
  }
@@ -262,49 +264,79 @@ var graphqlClientEffect = (input) => Effect_exports.gen(function* () {
262
264
  if (url.username || url.password || url.hash)
263
265
  return yield* new GraphqlError({ phase: "discover", reason: "invalid_input" });
264
266
  const headers = Redacted_exports.make({ ...options.headers });
265
- const request = (phase, query, variables = {}) => Effect_exports.scoped(
266
- Effect_exports.gen(function* () {
267
- const client = yield* HttpClient_exports.HttpClient;
268
- const response = yield* HttpClient_exports.withScope(client).execute(
269
- HttpClientRequest_exports.post(url.href).pipe(
270
- // GitHub requires this header; Workers do not supply one by default.
271
- HttpClientRequest_exports.setHeader("user-agent", "Executor"),
272
- HttpClientRequest_exports.setHeaders(Redacted_exports.value(headers)),
273
- HttpClientRequest_exports.bodyJsonUnsafe({ query, variables })
267
+ const request = (phase, query, variables = {}) => Effect_exports.gen(function* () {
268
+ const refusal = yield* Ref_exports.make(Option_exports.none());
269
+ return yield* Effect_exports.scoped(
270
+ Effect_exports.gen(function* () {
271
+ const client = yield* HttpClient_exports.HttpClient;
272
+ const response = yield* HttpClient_exports.withScope(client).execute(
273
+ HttpClientRequest_exports.post(url.href).pipe(
274
+ // GitHub requires this header; Workers do not supply one by default.
275
+ HttpClientRequest_exports.setHeader("user-agent", "Executor"),
276
+ HttpClientRequest_exports.setHeaders(Redacted_exports.value(headers)),
277
+ HttpClientRequest_exports.bodyJsonUnsafe({ query, variables })
278
+ )
279
+ );
280
+ yield* failOnNetworkRefusal(response);
281
+ if (response.status < 200 || response.status >= 300) {
282
+ const classified = httpProviderError(response.status, response.headers);
283
+ if (classified !== void 0) return yield* classified;
284
+ yield* Ref_exports.set(refusal, Option_exports.some(response.status));
285
+ const refused = yield* refusedBody(response).pipe(
286
+ owned("upstream", "provider.http.response.read")
287
+ );
288
+ return yield* new GraphqlError({
289
+ phase,
290
+ reason: "request",
291
+ status: response.status,
292
+ ...refused
293
+ });
294
+ }
295
+ const result = yield* response.json.pipe(
296
+ owned("upstream", "provider.http.response.read"),
297
+ Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(GraphqlResponse)),
298
+ Effect_exports.mapError(() => new GraphqlError({ phase, reason: "invalid_response" }))
299
+ );
300
+ if (result.errors?.length)
301
+ return yield* graphqlProviderError(result.errors, response.status) ?? new GraphqlError({
302
+ phase,
303
+ reason: "execution",
304
+ status: response.status,
305
+ ...statedErrors(result.errors)
306
+ });
307
+ if (result.data == null)
308
+ return yield* new GraphqlError({ phase, reason: "invalid_response" });
309
+ return result.data;
310
+ })
311
+ ).pipe(
312
+ owned("upstream", "provider.graphql.request", {
313
+ attributes: {
314
+ "executor.operation": phase,
315
+ "server.address": url.hostname
316
+ }
317
+ }),
318
+ Effect_exports.provideService(FetchHttpClient_exports.RequestInit, { redirect: "manual" }),
319
+ Effect_exports.provideService(FetchHttpClient_exports.Fetch, globalThis.fetch),
320
+ Effect_exports.provide(FetchHttpClient_exports.layer),
321
+ Effect_exports.timeoutOrElse({
322
+ duration: options.timeoutMs ?? defaultGraphqlClientLimits.timeoutMs,
323
+ orElse: () => Effect_exports.flatMap(
324
+ Ref_exports.get(refusal),
325
+ (status) => Effect_exports.fail(
326
+ Option_exports.isSome(status) ? new GraphqlError({
327
+ phase,
328
+ reason: "request",
329
+ status: status.value,
330
+ unreadBody: "incomplete"
331
+ }) : new GraphqlError({ phase, reason: "timeout" })
332
+ )
274
333
  )
275
- );
276
- yield* failOnNetworkRefusal(response);
277
- if (response.status < 200 || response.status >= 300)
278
- return yield* httpProviderError(response.status, response.headers) ?? new GraphqlError({ phase, reason: "request", status: response.status });
279
- const result = yield* response.json.pipe(
280
- owned("upstream", "provider.http.response.read"),
281
- Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(GraphqlResponse)),
282
- Effect_exports.mapError(() => new GraphqlError({ phase, reason: "invalid_response" }))
283
- );
284
- if (result.errors?.length)
285
- return yield* graphqlProviderError(result.errors, response.status) ?? new GraphqlError({ phase, reason: "execution", status: response.status });
286
- if (result.data == null)
287
- return yield* new GraphqlError({ phase, reason: "invalid_response" });
288
- return result.data;
289
- })
290
- ).pipe(
291
- owned("upstream", "provider.graphql.request", {
292
- attributes: {
293
- "executor.operation": phase,
294
- "server.address": url.hostname
295
- }
296
- }),
297
- Effect_exports.provideService(FetchHttpClient_exports.RequestInit, { redirect: "manual" }),
298
- Effect_exports.provideService(FetchHttpClient_exports.Fetch, globalThis.fetch),
299
- Effect_exports.provide(FetchHttpClient_exports.layer),
300
- Effect_exports.timeoutOrElse({
301
- duration: options.timeoutMs ?? defaultGraphqlClientLimits.timeoutMs,
302
- orElse: () => Effect_exports.fail(new GraphqlError({ phase, reason: "timeout" }))
303
- }),
304
- Effect_exports.mapError(
305
- (error) => error instanceof ProviderError && options.accountId !== void 0 ? accountProviderError(error, options.accountId) : error instanceof GraphqlError || error instanceof ProviderError || error instanceof NetworkRefused ? error : new GraphqlError({ phase, reason: "request" })
306
- )
307
- );
334
+ }),
335
+ Effect_exports.mapError(
336
+ (error) => error instanceof ProviderError && options.accountId !== void 0 ? accountProviderError(error, options.accountId) : error instanceof GraphqlError || error instanceof ProviderError || error instanceof NetworkRefused ? error : new GraphqlError({ phase, reason: "request" })
337
+ )
338
+ );
339
+ });
308
340
  const discover = request("discover", getIntrospectionQuery()).pipe(
309
341
  Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(GraphqlIntrospection)),
310
342
  Effect_exports.mapError(
@@ -370,31 +402,31 @@ var adaptGraphqlTool = (client, definition) => Effect_exports.gen(function* () {
370
402
  try: () => {
371
403
  const used = definition.arguments.filter((arg) => Object.hasOwn(variables, arg.name));
372
404
  return print({
373
- kind: Kind2.DOCUMENT,
405
+ kind: Kind.DOCUMENT,
374
406
  definitions: [
375
407
  {
376
- kind: Kind2.OPERATION_DEFINITION,
408
+ kind: Kind.OPERATION_DEFINITION,
377
409
  operation: kind,
378
410
  variableDefinitions: used.map((arg) => ({
379
- kind: Kind2.VARIABLE_DEFINITION,
411
+ kind: Kind.VARIABLE_DEFINITION,
380
412
  variable: {
381
- kind: Kind2.VARIABLE,
382
- name: { kind: Kind2.NAME, value: arg.name }
413
+ kind: Kind.VARIABLE,
414
+ name: { kind: Kind.NAME, value: arg.name }
383
415
  },
384
416
  type: parseType(arg.type)
385
417
  })),
386
418
  selectionSet: {
387
- kind: Kind2.SELECTION_SET,
419
+ kind: Kind.SELECTION_SET,
388
420
  selections: [
389
421
  {
390
- kind: Kind2.FIELD,
391
- name: { kind: Kind2.NAME, value: definition.field },
422
+ kind: Kind.FIELD,
423
+ name: { kind: Kind.NAME, value: definition.field },
392
424
  arguments: used.map((arg) => ({
393
- kind: Kind2.ARGUMENT,
394
- name: { kind: Kind2.NAME, value: arg.name },
425
+ kind: Kind.ARGUMENT,
426
+ name: { kind: Kind.NAME, value: arg.name },
395
427
  value: {
396
- kind: Kind2.VARIABLE,
397
- name: { kind: Kind2.NAME, value: arg.name }
428
+ kind: Kind.VARIABLE,
429
+ name: { kind: Kind.NAME, value: arg.name }
398
430
  }
399
431
  })),
400
432
  ...definition.composite ? {
package/js/host.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createAppHandler
3
- } from "./chunk-3UWLQMMK.js";
4
- import "./chunk-2B7FHH7S.js";
5
- import "./chunk-OTDKCYMH.js";
3
+ } from "./chunk-JCX2K2SI.js";
4
+ import "./chunk-UPTAFF6L.js";
5
+ import "./chunk-BKIQCV72.js";
6
6
  import "./chunk-HLMJBE4T.js";
7
7
  import "./chunk-PBGPES67.js";
8
- import "./chunk-QN5BMAG7.js";
9
- import "./chunk-PILIRGJA.js";
10
- import "./chunk-R3O32PQV.js";
8
+ import "./chunk-3BI34I5S.js";
9
+ import "./chunk-ZXG7RMCB.js";
10
+ import "./chunk-OIH73VFM.js";
11
11
  import {
12
12
  CacheCommand,
13
13
  CacheError,
package/js/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  query,
12
12
  t,
13
13
  workflow
14
- } from "./chunk-QN5BMAG7.js";
14
+ } from "./chunk-3BI34I5S.js";
15
15
  import {
16
16
  dynamicRouter,
17
17
  mutation,
@@ -25,11 +25,11 @@ import {
25
25
  toolAnnotations,
26
26
  withApproval,
27
27
  withApprovals
28
- } from "./chunk-PILIRGJA.js";
28
+ } from "./chunk-ZXG7RMCB.js";
29
29
  import {
30
30
  accountProviderError,
31
31
  fromPromise
32
- } from "./chunk-R3O32PQV.js";
32
+ } from "./chunk-OIH73VFM.js";
33
33
  import {
34
34
  CacheError,
35
35
  CalendarSchedule,
package/js/mcp/effect.js CHANGED
@@ -2,16 +2,16 @@ import {
2
2
  mcpClientEffect,
3
3
  mcpHealthEffect,
4
4
  mcpToolsEffect
5
- } from "../chunk-X45GWW4A.js";
5
+ } from "../chunk-3BOEMXAJ.js";
6
6
  import "../chunk-BCSNKUAC.js";
7
- import "../chunk-3UWLQMMK.js";
8
- import "../chunk-2B7FHH7S.js";
9
- import "../chunk-OTDKCYMH.js";
7
+ import "../chunk-JCX2K2SI.js";
8
+ import "../chunk-UPTAFF6L.js";
9
+ import "../chunk-BKIQCV72.js";
10
10
  import "../chunk-HLMJBE4T.js";
11
11
  import "../chunk-PBGPES67.js";
12
- import "../chunk-QN5BMAG7.js";
13
- import "../chunk-PILIRGJA.js";
14
- import "../chunk-R3O32PQV.js";
12
+ import "../chunk-3BI34I5S.js";
13
+ import "../chunk-ZXG7RMCB.js";
14
+ import "../chunk-OIH73VFM.js";
15
15
  import "../chunk-2RGJMA7N.js";
16
16
  import "../chunk-4PIQKACY.js";
17
17
  import "../chunk-VAI3EVCS.js";
package/js/mcp.js CHANGED
@@ -1,34 +1,34 @@
1
1
  import {
2
2
  catalogCache,
3
3
  catalogScope
4
- } from "./chunk-EDXNAZLI.js";
4
+ } from "./chunk-SXQVVXJE.js";
5
5
  import {
6
6
  protocolOperations
7
- } from "./chunk-KY7C6BWO.js";
7
+ } from "./chunk-RIV62DRM.js";
8
8
  import {
9
9
  adaptMcpTool,
10
10
  mcpClientEffect,
11
11
  mcpHealthEffect
12
- } from "./chunk-X45GWW4A.js";
12
+ } from "./chunk-3BOEMXAJ.js";
13
13
  import "./chunk-BCSNKUAC.js";
14
- import "./chunk-3UWLQMMK.js";
14
+ import "./chunk-JCX2K2SI.js";
15
15
  import {
16
16
  cacheKey
17
- } from "./chunk-2B7FHH7S.js";
17
+ } from "./chunk-UPTAFF6L.js";
18
18
  import {
19
19
  operationDescription
20
- } from "./chunk-OTDKCYMH.js";
20
+ } from "./chunk-BKIQCV72.js";
21
21
  import "./chunk-HLMJBE4T.js";
22
22
  import "./chunk-PBGPES67.js";
23
- import "./chunk-QN5BMAG7.js";
23
+ import "./chunk-3BI34I5S.js";
24
24
  import {
25
25
  nativeOperation,
26
26
  routerDeclaration
27
- } from "./chunk-PILIRGJA.js";
27
+ } from "./chunk-ZXG7RMCB.js";
28
28
  import {
29
29
  fromPromise,
30
30
  method
31
- } from "./chunk-R3O32PQV.js";
31
+ } from "./chunk-OIH73VFM.js";
32
32
  import {
33
33
  McpCredentialsUnverified,
34
34
  McpError,
package/js/openapi.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  protocolOperations,
10
10
  protocolRouter
11
- } from "./chunk-KY7C6BWO.js";
11
+ } from "./chunk-RIV62DRM.js";
12
12
  import {
13
13
  OpenapiCompileError,
14
14
  OpenapiCompileErrorCode,
@@ -29,7 +29,7 @@ import {
29
29
  isOpenapiTextMedia,
30
30
  openapiBinaryResultSchema,
31
31
  openapiMediaKind
32
- } from "./chunk-OTDKCYMH.js";
32
+ } from "./chunk-BKIQCV72.js";
33
33
  import {
34
34
  failOnNetworkRefusal
35
35
  } from "./chunk-HLMJBE4T.js";
@@ -37,7 +37,7 @@ import "./chunk-PBGPES67.js";
37
37
  import {
38
38
  nativeOperation,
39
39
  routerDeclaration
40
- } from "./chunk-PILIRGJA.js";
40
+ } from "./chunk-ZXG7RMCB.js";
41
41
  import {
42
42
  accountProviderError,
43
43
  bodyUpstreamError,
@@ -45,8 +45,9 @@ import {
45
45
  httpProviderError,
46
46
  method,
47
47
  providerErrorDetail,
48
+ statedUpstream,
48
49
  toPromise
49
- } from "./chunk-R3O32PQV.js";
50
+ } from "./chunk-OIH73VFM.js";
50
51
  import {
51
52
  ApiErrorRecovery,
52
53
  ApiErrorResponse,
@@ -385,9 +386,15 @@ function createRequest(config) {
385
386
  yield* failOnNetworkRefusal(response);
386
387
  if (response.status < 200 || response.status >= 300) {
387
388
  const provider = httpProviderError(response.status, response.headers);
388
- if (provider !== void 0 && provider.reason !== "rejected") return yield* provider;
389
- const json = provider !== void 0 || errors.some((error) => error.status === response.status) ? yield* errorBody(response) : void 0;
389
+ const declares = errors.some((error) => error.status === response.status);
390
+ if (provider !== void 0 && provider.reason !== "rejected" && (!declares || provider.upstream !== void 0))
391
+ return yield* provider;
392
+ const json = provider !== void 0 || declares ? yield* errorBody(response) : void 0;
390
393
  const declared = json === void 0 ? void 0 : yield* responseError(response.status, json, errors);
394
+ if (provider !== void 0 && provider.reason !== "rejected")
395
+ return yield* declared === void 0 ? provider : providerErrorDetail(provider, {
396
+ upstream: statedUpstream(declared.code, declared.message)
397
+ });
391
398
  const upstream = json === void 0 ? void 0 : bodyUpstreamError(json);
392
399
  return yield* declared ?? (provider === void 0 || upstream === void 0 ? provider : providerErrorDetail(provider, { upstream })) ?? new OpenapiError({ reason: "request", operation, ...responseShape(response) });
393
400
  }
package/js/skills.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  catalogCache,
3
3
  catalogScope
4
- } from "./chunk-EDXNAZLI.js";
5
- import "./chunk-2B7FHH7S.js";
4
+ } from "./chunk-SXQVVXJE.js";
5
+ import "./chunk-UPTAFF6L.js";
6
6
  import {
7
7
  failOnNetworkRefusal
8
8
  } from "./chunk-HLMJBE4T.js";
@@ -16,7 +16,7 @@ import {
16
16
  httpProviderError,
17
17
  method,
18
18
  toPromise
19
- } from "./chunk-R3O32PQV.js";
19
+ } from "./chunk-OIH73VFM.js";
20
20
  import {
21
21
  NetworkRefused,
22
22
  ProviderError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps",
3
- "version": "0.0.1-beta.106",
3
+ "version": "0.0.1-beta.109",
4
4
  "description": "TypeScript apps with typed tools, accounts, storage, and UI.",
5
5
  "type": "module",
6
6
  "sideEffects": false,