apps 0.0.1-beta.143 → 0.0.1-beta.148

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +14 -0
  2. package/check-publish.mjs +0 -1
  3. package/framework-reference.json +1 -1
  4. package/js/{chunk-IWLFLMIL.js → chunk-4XXHO5UG.js} +3966 -1760
  5. package/js/{chunk-NXUNFV44.js → chunk-63BS5GBH.js} +9 -14
  6. package/js/{chunk-2XEQYDQY.js → chunk-A6FRLRCN.js} +0 -1
  7. package/js/{chunk-PASOVDON.js → chunk-ALZDZ3ZT.js} +9 -30
  8. package/js/{chunk-H4JK7UTH.js → chunk-CQCY3OZS.js} +8 -49
  9. package/js/{chunk-V6OUBNL4.js → chunk-CWAPV2TN.js} +4 -6
  10. package/js/{chunk-RW5EXIO6.js → chunk-DX5DD6Z2.js} +8 -17
  11. package/js/{chunk-B54D6AN7.js → chunk-E2PVLAGK.js} +7 -15
  12. package/js/{chunk-LRXY54YF.js → chunk-EXL6F456.js} +1 -1
  13. package/js/{chunk-Y3QPWYHC.js → chunk-FWK2WTJB.js} +4 -5
  14. package/js/{chunk-2OGVSUNI.js → chunk-GWFQCQB5.js} +2 -2
  15. package/js/chunk-HEFJFDU4.js +87 -0
  16. package/js/{chunk-XRNSAU62.js → chunk-I7MYW7IK.js} +2 -2
  17. package/js/{chunk-ADG72XX3.js → chunk-JLHRRTRH.js} +6 -13
  18. package/js/{chunk-K24M6LZ7.js → chunk-MXFPSMNM.js} +2 -2
  19. package/js/{chunk-INQON4A2.js → chunk-OA4UYCJ4.js} +2 -2
  20. package/js/{chunk-3RIEA22Q.js → chunk-PUMGAWHB.js} +24 -43
  21. package/js/{chunk-W6V5OIHB.js → chunk-SEJXUMGT.js} +267 -1
  22. package/js/{chunk-RUSVGD5N.js → chunk-SXYFFXHM.js} +2 -2
  23. package/js/{chunk-BHSWVS3Q.js → chunk-UT2CBMW3.js} +4 -1
  24. package/js/{chunk-XAOJP46A.js → chunk-XR7KZNKD.js} +1 -1
  25. package/js/{chunk-TMYRAFMC.js → chunk-ZWFMEH2Y.js} +18 -1
  26. package/js/client.js +31 -14
  27. package/js/contracts.js +3 -4
  28. package/js/effect.js +14 -15
  29. package/js/graphql.js +16 -19
  30. package/js/host.js +14 -17
  31. package/js/index.js +10 -16
  32. package/js/mcp/effect.js +15 -16
  33. package/js/mcp.js +17 -18
  34. package/js/openapi.js +14 -22
  35. package/js/react.js +122 -3
  36. package/js/skills/effect.js +3 -4
  37. package/js/skills.js +17 -24
  38. package/js/ui/auth/contracts.js +5 -1
  39. package/js/ui/auth.js +7 -4
  40. package/js/ui/contracts.js +52 -5
  41. package/js/ui/serving.js +55 -17
  42. package/package.json +1 -1
  43. package/runtime.json +1 -1
  44. package/types/app-cache/src/index.d.ts +1 -40
  45. package/types/app-data/src/contracts/database.d.ts +0 -21
  46. package/types/apps/src/client.d.ts +3 -0
  47. package/types/apps/src/contracts/desktop-errors.d.ts +46 -0
  48. package/types/apps/src/contracts/desktop.d.ts +228 -0
  49. package/types/apps/src/contracts/ui-auth.d.ts +4 -1
  50. package/types/apps/src/contracts/ui.d.ts +43 -1
  51. package/types/apps/src/implementation/desktop.d.ts +85 -0
  52. package/types/apps/src/implementation/ui-serving.d.ts +13 -1
  53. package/types/apps/src/react.d.ts +29 -0
  54. package/types/apps/src/ui-serving.d.ts +1 -1
  55. package/types/telemetry/src/app-records.d.ts +0 -24
  56. package/types/telemetry/src/browser-operations.d.ts +0 -8
  57. package/types/telemetry/src/browser-performance.d.ts +0 -2
  58. package/types/telemetry/src/browser-request-timing.d.ts +0 -1
  59. package/types/telemetry/src/browser.d.ts +0 -10
  60. package/types/telemetry/src/config.d.ts +0 -8
  61. package/types/telemetry/src/context.d.ts +0 -6
  62. package/types/telemetry/src/index.d.ts +0 -1
  63. package/types/telemetry/src/keepalive.d.ts +0 -44
  64. package/types/telemetry/src/layer.d.ts +0 -8
  65. package/types/telemetry/src/measurements.d.ts +0 -8
  66. package/types/telemetry/src/ownership.d.ts +0 -45
  67. package/types/telemetry/src/pending-span.d.ts +0 -2
  68. package/types/telemetry/src/recorded-failure.d.ts +0 -26
  69. package/types/telemetry/src/relay.d.ts +0 -29
  70. package/types/telemetry/src/span-attributes.d.ts +0 -38
  71. package/types/telemetry/src/trace-context.d.ts +0 -6
  72. package/types/telemetry/src/transport.d.ts +0 -10
  73. package/types/utils/src/api-error.d.ts +0 -22
  74. package/types/utils/src/connection-failure.d.ts +0 -10
  75. package/types/utils/src/random-uuid.d.ts +0 -5
  76. package/types/utils/src/recorded-message.d.ts +0 -15
  77. package/types/utils/src/schema-definitions.d.ts +0 -6
  78. package/types/utils/src/user-facing-error.d.ts +0 -19
  79. package/js/chunk-QLUWYCOT.js +0 -2325
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  skillFromFiles
3
- } from "./chunk-XAOJP46A.js";
3
+ } from "./chunk-XR7KZNKD.js";
4
4
  import {
5
5
  PartialListing,
6
6
  joinPath,
7
7
  mergeMeta
8
- } from "./chunk-B54D6AN7.js";
8
+ } from "./chunk-E2PVLAGK.js";
9
9
  import {
10
10
  isShortenedStated,
11
11
  parseProviderError,
12
12
  providerError
13
- } from "./chunk-RUSVGD5N.js";
13
+ } from "./chunk-SXYFFXHM.js";
14
14
  import {
15
15
  ApiErrorResponse,
16
16
  CacheError,
@@ -33,14 +33,14 @@ import {
33
33
  maxFailureFields,
34
34
  maxFailureMessageLength,
35
35
  maxUpstreamMessageLength
36
- } from "./chunk-LRXY54YF.js";
36
+ } from "./chunk-EXL6F456.js";
37
37
  import {
38
38
  SkillLoadFailed,
39
39
  skillFormatLimits
40
- } from "./chunk-2XEQYDQY.js";
40
+ } from "./chunk-A6FRLRCN.js";
41
41
  import {
42
42
  jsonSchemaDocument
43
- } from "./chunk-ADG72XX3.js";
43
+ } from "./chunk-JLHRRTRH.js";
44
44
  import {
45
45
  AccountId,
46
46
  HttpUrl,
@@ -460,7 +460,6 @@ var mcpMessage = ({ phase, reason, status }) => {
460
460
  () => `The MCP server returned a response Executor could not use while ${stage}, such as an unreadable message or an address on another origin.`
461
461
  ),
462
462
  Match_exports.when("invalid_input", () => "The MCP server URL or connection settings are invalid."),
463
- // Only a transport failure has no answer from the server; a JSON-RPC error is an answer.
464
463
  Match_exports.when(
465
464
  "request",
466
465
  () => status !== void 0 ? `The MCP server answered HTTP ${status} while ${stage}.` : phase === "transport" ? `Executor could not reach the MCP server while ${stage}.` : `The request to the MCP server failed while ${stage}.`
@@ -778,7 +777,6 @@ var summaryFields = (name, router, operation, schedules) => {
778
777
  description: operation.description ?? `${readOnly ? "Query" : "Mutate"} ${name}`,
779
778
  ...operation.title === void 0 ? {} : { title: operation.title },
780
779
  readOnly,
781
- // A declared operation's kind is the app's own, or its protocol's, such as an HTTP method.
782
780
  kindConfirmed: true,
783
781
  annotations: { ...operation.annotations, readOnlyHint: readOnly }
784
782
  };
@@ -949,12 +947,9 @@ var routerSkills = (root) => Effect_exports.gen(function* () {
949
947
  if (root !== void 0) collect(root, "");
950
948
  const skills = yield* Effect_exports.forEach(
951
949
  nodes,
952
- ({ path, node }) => (
953
- // Skills that fail are skipped, so their failures are never reported.
954
- routerMeta(node, []).pipe(
955
- Effect_exports.flatMap((meta) => routerSkill(path, meta)),
956
- Effect_exports.orElseSucceed(() => void 0)
957
- )
950
+ ({ path, node }) => routerMeta(node, []).pipe(
951
+ Effect_exports.flatMap((meta) => routerSkill(path, meta)),
952
+ Effect_exports.orElseSucceed(() => void 0)
958
953
  ),
959
954
  { concurrency: "unbounded" }
960
955
  );
@@ -129,7 +129,6 @@ var SkillLoadFailed = class extends Schema_exports.TaggedError()("SkillLoadFaile
129
129
  "changed",
130
130
  "encoding"
131
131
  ]),
132
- // Error instances read an omitted message as "", so an empty message means none was given.
133
132
  message: Schema_exports.optional(Schema_exports.String.check(Schema_exports.isMaxLength(500))),
134
133
  status: Schema_exports.optional(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 100, maximum: 599 }))),
135
134
  missing: Schema_exports.optional(Schema_exports.Literals(["repository", "ref"]))
@@ -1,26 +1,26 @@
1
1
  import {
2
2
  appInvocationFetch
3
- } from "./chunk-K24M6LZ7.js";
3
+ } from "./chunk-MXFPSMNM.js";
4
4
  import {
5
5
  fromPromise,
6
6
  method,
7
7
  toPromise
8
- } from "./chunk-RUSVGD5N.js";
8
+ } from "./chunk-SXYFFXHM.js";
9
9
  import {
10
10
  CacheAcquired,
11
11
  CacheEntry,
12
12
  CacheError,
13
13
  cacheLimits,
14
14
  scopedSlots
15
- } from "./chunk-LRXY54YF.js";
15
+ } from "./chunk-EXL6F456.js";
16
16
  import {
17
17
  decoderOf
18
- } from "./chunk-ADG72XX3.js";
18
+ } from "./chunk-JLHRRTRH.js";
19
19
  import {
20
20
  captureTelemetry,
21
21
  owned,
22
22
  ownedBy
23
- } from "./chunk-H4JK7UTH.js";
23
+ } from "./chunk-CQCY3OZS.js";
24
24
  import {
25
25
  Clock_exports,
26
26
  Duration_exports,
@@ -68,13 +68,10 @@ var makeCache = (host, background, scope = "shared", deadline, leaseWait = (effe
68
68
  catch: () => new CacheError({ reason: "invalid" })
69
69
  }).pipe(
70
70
  Effect_exports.flatMap(
71
- ({ fresh, stale }) => ![fresh, stale].every((value) => Number.isFinite(value) && value >= 0) ? Effect_exports.fail(new CacheError({ reason: "invalid" })) : (
72
- // The cache keeps nothing past its retention: a longer lifetime loses staleness first.
73
- Effect_exports.succeed({
74
- fresh: Math.min(fresh, cacheLimits.retentionMs),
75
- stale: Math.max(0, Math.min(stale, cacheLimits.retentionMs - fresh))
76
- })
77
- )
71
+ ({ fresh, stale }) => ![fresh, stale].every((value) => Number.isFinite(value) && value >= 0) ? Effect_exports.fail(new CacheError({ reason: "invalid" })) : Effect_exports.succeed({
72
+ fresh: Math.min(fresh, cacheLimits.retentionMs),
73
+ stale: Math.max(0, Math.min(stale, cacheLimits.retentionMs - fresh))
74
+ })
78
75
  )
79
76
  );
80
77
  const get = (options, refresh, also = () => []) => Effect_exports.gen(function* () {
@@ -111,7 +108,6 @@ var makeCache = (host, background, scope = "shared", deadline, leaseWait = (effe
111
108
  }).pipe(
112
109
  Effect_exports.withSpan("app.cache.load"),
113
110
  Effect_exports.timeout(cacheLimits.loadTimeoutMs),
114
- // Publishing clears the lease in the same transaction. Only an unpublished load releases it.
115
111
  Effect_exports.onExit(
116
112
  (exit) => Exit_exports.isSuccess(exit) ? Effect_exports.void : transport({ operation: "release", key, lease }).pipe(
117
113
  Effect_exports.catch(() => Effect_exports.void)
@@ -183,9 +179,7 @@ var makeCache = (host, background, scope = "shared", deadline, leaseWait = (effe
183
179
  }
184
180
  }).pipe(Effect_exports.withSpan("app.cache.get"));
185
181
  return {
186
- /** Read arbitrary retained JSON entries without initiating a refresh. Missing and null are distinct. */
187
182
  read: (keys) => Effect_exports.forEach(keys, keyOf).pipe(Effect_exports.flatMap(readKeys)),
188
- /** Publish bounded immutable parts before publishing the manifest that references them. */
189
183
  write: (entries, retention) => Effect_exports.gen(function* () {
190
184
  const { fresh } = yield* durations(retention);
191
185
  const now = yield* Clock_exports.currentTimeMillis;
@@ -205,25 +199,12 @@ var makeCache = (host, background, scope = "shared", deadline, leaseWait = (effe
205
199
  );
206
200
  yield* transport({ operation: "write", entries: values });
207
201
  }),
208
- /** Revoke retained data and any loader's right to publish its in-flight result. */
209
202
  invalidate: (key) => keyOf(key).pipe(
210
203
  Effect_exports.flatMap((key2) => transport({ operation: "invalidate", key: key2 })),
211
204
  Effect_exports.asVoid
212
205
  ),
213
- /**
214
- * Read fresh data, refresh stale data in the background (or first, with `stale: "revalidate"`),
215
- * or wait for the lease owner.
216
- */
217
206
  get: (options) => get(options, false).pipe(Effect_exports.map(({ value }) => value)),
218
- /**
219
- * `get`, also reading the keys of this scope that `keys` names in the same round trip. `keys`
220
- * gets the entry's store key, which is unique to this scope and key, so a caller can remember
221
- * what it read under it. `reads` holds their entries, undecoded and in order, when the value
222
- * was read from the store; it is undefined when the value was loaded or the store did not read
223
- * them, and the caller then reads what it still needs.
224
- */
225
207
  getWith: (options, keys) => get(options, false, keys),
226
- /** Force one awaited refresh without removing the retained value. Concurrent refreshes share a load. */
227
208
  revalidate: (options) => get(options, true).pipe(Effect_exports.map(({ value }) => value))
228
209
  };
229
210
  };
@@ -238,11 +219,9 @@ var authorCache = (host, accounts, signal, telemetry, deadline) => {
238
219
  const scoped = (scope, callerSignal = signal, services = telemetry) => {
239
220
  const cache = makeCache(
240
221
  host.transport,
241
- // A refresh handed to the background runs beside the caller, which does not wait on it.
242
222
  (task) => host.background(task.pipe(owned("background", "app.cache.refresh"))),
243
223
  scope,
244
224
  deadline,
245
- // Waiting on another caller's load is waiting, not Executor's work.
246
225
  (wait) => wait.pipe(Effect_exports.withSpan("app.cache.lease.wait", ownedBy("lease")))
247
226
  );
248
227
  const getOptions = (options) => ({
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FetchHttpClient_exports
3
- } from "./chunk-2OGVSUNI.js";
3
+ } from "./chunk-GWFQCQB5.js";
4
4
  import {
5
5
  recordedMessage
6
6
  } from "./chunk-6XBOKQ4E.js";
@@ -25,7 +25,7 @@ import {
25
25
  text,
26
26
  transformResponse,
27
27
  uint8Array
28
- } from "./chunk-IWLFLMIL.js";
28
+ } from "./chunk-4XXHO5UG.js";
29
29
  import {
30
30
  Array as Array2,
31
31
  Boolean2 as Boolean,
@@ -233,7 +233,6 @@ var makeOwnershipAccounting = (origin, owner) => {
233
233
  const declared = inBackground ? "background" : declaredOwner(options.annotations);
234
234
  const boundary = {
235
235
  owner: declared ?? enclosingBoundary?.owner ?? owner,
236
- // Background work runs beside its caller, which stays innermost meanwhile.
237
236
  parent: declared === "background" ? void 0 : enclosingBoundary,
238
237
  open: true,
239
238
  children: 0
@@ -288,15 +287,10 @@ var makeOwnershipAccounting = (origin, owner) => {
288
287
  }
289
288
  });
290
289
  return {
291
- /** Run `effect` with the spans it opens observed, including spans it hands to later work. */
292
290
  observe: (effect2) => Effect_exports.gen(function* () {
293
291
  const tracer = yield* Tracer_exports.Tracer;
294
292
  return yield* effect2.pipe(Effect_exports.provideService(Tracer_exports.Tracer, observed(tracer)));
295
293
  }),
296
- /**
297
- * Close the window at `end` and return its milliseconds by owner, each instant counted once.
298
- * Spans still open count up to `end`; spans that open or end afterwards are ignored.
299
- */
300
294
  read: (end) => {
301
295
  if (!done) advance(end);
302
296
  done = true;
@@ -907,11 +901,7 @@ var CurrentTelemetryClient = Context_exports.Reference(
907
901
  var selectedClient = Layer_exports.unwrap(
908
902
  CurrentTelemetryClient.pipe(
909
903
  Effect_exports.map(
910
- (client) => (
911
- // Export-only RequestInit options, such as browser keepalive, must not
912
- // enter product clients that share the page's Layer memo map.
913
- client === void 0 ? Layer_exports.fresh(FetchHttpClient_exports.layer) : Layer_exports.succeed(HttpClient_exports.HttpClient, client)
914
- )
904
+ (client) => client === void 0 ? Layer_exports.fresh(FetchHttpClient_exports.layer) : Layer_exports.succeed(HttpClient_exports.HttpClient, client)
915
905
  )
916
906
  )
917
907
  );
@@ -1111,20 +1101,14 @@ var httpSpanAttributeAllowlist = /* @__PURE__ */ new Set([
1111
1101
  "http.response.status_code",
1112
1102
  "server.address",
1113
1103
  "url.scheme",
1114
- // Path only. `url.full` and `url.query` carry the query string, so neither is listed.
1115
- // Once a route is recorded, the path is that route's template (`allowlistedSpan`).
1116
1104
  "url.path",
1117
- // The router's matched path template, such as `/api/organizations/:organization`; no values.
1118
1105
  "http.route",
1119
1106
  "http.request.header.content-type",
1120
1107
  "http.request.header.content-length",
1121
1108
  "http.request.header.user-agent",
1122
1109
  "http.response.header.content-type",
1123
1110
  "http.response.header.content-length",
1124
- // The server tracer records the user agent a second time under its own name.
1125
1111
  "user_agent.original",
1126
- // The server tracer's remote address: the peer the host saw, or on Cloud the address
1127
- // Cloudflare saw (`cf-connecting-ip`, which Cloudflare overwrites on every incoming request).
1128
1112
  "client.address"
1129
1113
  ]);
1130
1114
  var spanAttributeAllowed = (key) => {
@@ -1167,9 +1151,6 @@ var allowlistedSpan = (span, ended) => {
1167
1151
  get kind() {
1168
1152
  return span.kind;
1169
1153
  },
1170
- // A successful transport can carry a failed domain operation. The producer
1171
- // explicitly marks that outcome; arbitrary result payloads are never inspected.
1172
- // A failure records the fixed message an error declares in place of an app's text.
1173
1154
  end: (endTime, exit) => {
1174
1155
  span.end(
1175
1156
  endTime,
@@ -2442,24 +2423,16 @@ var telemetryLayer = (config, lifetime = "process", logger = Logger_exports.with
2442
2423
  url: target.url,
2443
2424
  resource,
2444
2425
  ...target.headers === void 0 ? {} : { headers: Redacted_exports.value(target.headers) },
2445
- // An event exports when its scope closes. With no interval the exporter runs no loop, so a
2446
- // span or log recorded from another event never resumes a fiber of this one.
2447
2426
  exportInterval: lifetime === "event" ? Duration_exports.infinity : "1 second",
2448
2427
  shutdownTimeout: shutdownTimeouts[name] ?? "3 seconds"
2449
2428
  });
2450
2429
  const console = Logger_exports.layer([logger]);
2451
2430
  return Layer_exports.mergeAll(
2452
2431
  Layer_exports.succeed(CurrentTelemetryConfig, config),
2453
- config.traces === void 0 ? Layer_exports.empty : (
2454
- // Credentials travel in provider headers and query strings this product does
2455
- // not choose, so every exported span records only allowlisted HTTP attributes.
2456
- // Record every operation. Caller-supplied sampling is correlation metadata,
2457
- // not authority to suppress server diagnostics.
2458
- spanAttributes(config.clock, true).pipe(
2459
- Layer_exports.provideMerge(
2460
- OtlpTracer_exports.layer(signal(config.traces, "traces")).pipe(
2461
- Layer_exports.provide(OtlpSerialization_exports.layerJson)
2462
- )
2432
+ config.traces === void 0 ? Layer_exports.empty : spanAttributes(config.clock, true).pipe(
2433
+ Layer_exports.provideMerge(
2434
+ OtlpTracer_exports.layer(signal(config.traces, "traces")).pipe(
2435
+ Layer_exports.provide(OtlpSerialization_exports.layerJson)
2463
2436
  )
2464
2437
  )
2465
2438
  ),
@@ -2478,10 +2451,7 @@ var telemetryLayer = (config, lifetime = "process", logger = Logger_exports.with
2478
2451
  )
2479
2452
  ).pipe(
2480
2453
  Layer_exports.provide(telemetryHttpClient),
2481
- // Export fibers capture services during construction. Their failure evidence
2482
- // must reach the host logger even after the remote log exporter is closed.
2483
2454
  Layer_exports.provide(console),
2484
- // Each event exports only its own measurements; process hosts share a process registry.
2485
2455
  Layer_exports.provideMerge(Layer_exports.sync(Metric_exports.MetricRegistry, () => /* @__PURE__ */ new Map()))
2486
2456
  );
2487
2457
  };
@@ -2621,13 +2591,11 @@ var errorKinds = /* @__PURE__ */ new Set([
2621
2591
  "function"
2622
2592
  ]);
2623
2593
  var failureCodes = /* @__PURE__ */ new Set([
2624
- // CacheError
2625
2594
  "unavailable",
2626
2595
  "storage",
2627
2596
  "invalid",
2628
2597
  "capacity",
2629
2598
  "timeout",
2630
- // AppDatabaseError
2631
2599
  "schema",
2632
2600
  "schema_changed",
2633
2601
  "table",
@@ -2639,18 +2607,15 @@ var failureCodes = /* @__PURE__ */ new Set([
2639
2607
  "limit",
2640
2608
  "closed",
2641
2609
  "replay",
2642
- // OpenapiError
2643
2610
  "invalid_definition",
2644
2611
  "invalid_input",
2645
2612
  "request",
2646
- // McpError, McpCredentialsUnverified and ProviderError
2647
2613
  "unauthorized",
2648
2614
  "invalid_response",
2649
2615
  "forbidden",
2650
2616
  "rate_limited",
2651
2617
  "rejected",
2652
2618
  "anonymous_access",
2653
- // NetworkRefused and FetchOptionUnsupported
2654
2619
  "private_address",
2655
2620
  "credential_host",
2656
2621
  "credential_app",
@@ -2729,8 +2694,6 @@ var spanAttributes2 = {
2729
2694
  "http.request.method": oneOf(...httpMethods),
2730
2695
  "http.response.status_code": status,
2731
2696
  "url.scheme": oneOf("http", "https"),
2732
- // Effect 4.1 marks an interrupted span with `effect.fiber.interrupted`; apps built on an
2733
- // earlier Effect still send the label and `status.interrupted`.
2734
2697
  "effect.fiber.interrupted": flag,
2735
2698
  "span.label": oneOf("\u26A0\uFE0E Interrupted"),
2736
2699
  "status.interrupted": flag,
@@ -2903,11 +2866,7 @@ var TelemetryDrainScope = Context_exports.Reference(
2903
2866
  );
2904
2867
  var makeTelemetryForwarder = Effect_exports.flatMap(
2905
2868
  TelemetryDrainScope,
2906
- (scope) => scope === void 0 ? forwarder : (
2907
- // A scope of its own: its drain runs before its queue is interrupted, even when the host's
2908
- // scope closes its finalizers in parallel.
2909
- Effect_exports.flatMap(Scope_exports.fork(scope, "sequential"), (own) => Scope_exports.provide(forwarder, own))
2910
- )
2869
+ (scope) => scope === void 0 ? forwarder : Effect_exports.flatMap(Scope_exports.fork(scope, "sequential"), (own) => Scope_exports.provide(forwarder, own))
2911
2870
  );
2912
2871
  var queueBudget = 8 * 1048576;
2913
2872
  var exportBudget2 = 4 * 1048576;
@@ -2,11 +2,11 @@ import {
2
2
  declaredOperations,
3
3
  nativeOperation,
4
4
  nativeRouter
5
- } from "./chunk-B54D6AN7.js";
5
+ } from "./chunk-E2PVLAGK.js";
6
6
  import {
7
7
  fromPromise,
8
8
  method
9
- } from "./chunk-RUSVGD5N.js";
9
+ } from "./chunk-SXYFFXHM.js";
10
10
  import {
11
11
  EmittedEvent,
12
12
  EventName,
@@ -17,13 +17,13 @@ import {
17
17
  normalizePlacements,
18
18
  placementFields,
19
19
  renderPlacement
20
- } from "./chunk-LRXY54YF.js";
20
+ } from "./chunk-EXL6F456.js";
21
21
  import {
22
22
  decoderOf,
23
23
  isSchema,
24
24
  jsonSchemaDocument,
25
25
  schemaArgument
26
- } from "./chunk-ADG72XX3.js";
26
+ } from "./chunk-JLHRRTRH.js";
27
27
  import {
28
28
  JsonValue
29
29
  } from "./chunk-7A4ZSEM3.js";
@@ -205,7 +205,6 @@ var workflow = (options, run) => ({
205
205
  input: decoderOf(schemaArgument(options.input, "The workflow input")),
206
206
  ...options.output === void 0 ? {} : { output: decoderOf(schemaArgument(options.output, "The workflow output")) },
207
207
  ...options.description === void 0 ? {} : { description: options.description },
208
- // SAFETY: defineApp checks required context; the host supplies the pinned run's capabilities.
209
208
  run: (context, input) => fromPromise(run, "workflow")(context, input)
210
209
  }
211
210
  });
@@ -306,7 +305,6 @@ function rejectCatalogs(definition) {
306
305
  function adaptDefinition(definition) {
307
306
  rejectCatalogs(definition);
308
307
  const webhooks = definition.webhooks === void 0 ? {} : {
309
- // SAFETY: `Required` only where the optional method was just checked to be present.
310
308
  webhooks: Object.fromEntries(
311
309
  Object.entries(definition.webhooks).map(([name, webhook]) => [
312
310
  name,
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  prepareElicitation
3
- } from "./chunk-3RIEA22Q.js";
3
+ } from "./chunk-PUMGAWHB.js";
4
4
  import {
5
5
  failOnNetworkRefusal
6
- } from "./chunk-K24M6LZ7.js";
6
+ } from "./chunk-MXFPSMNM.js";
7
7
  import {
8
8
  accountProviderError,
9
9
  bodyUpstreamError,
10
10
  fromPromise,
11
11
  httpProviderError,
12
12
  providerErrorDetail
13
- } from "./chunk-RUSVGD5N.js";
13
+ } from "./chunk-SXYFFXHM.js";
14
14
  import {
15
15
  AfterReply,
16
16
  ElicitationFailed,
@@ -29,26 +29,26 @@ import {
29
29
  defaultMcpClientLimits,
30
30
  mcpHealthReserveMs,
31
31
  mcpSdkTimerCeilingMs
32
- } from "./chunk-LRXY54YF.js";
32
+ } from "./chunk-EXL6F456.js";
33
33
  import {
34
34
  jsonSchemaDecoder,
35
35
  nestJsonSchema,
36
36
  preparedJsonSchemaDecoder
37
- } from "./chunk-ADG72XX3.js";
37
+ } from "./chunk-JLHRRTRH.js";
38
38
  import {
39
39
  captureTelemetry,
40
40
  owned
41
- } from "./chunk-H4JK7UTH.js";
41
+ } from "./chunk-CQCY3OZS.js";
42
42
  import {
43
43
  FetchHttpClient_exports
44
- } from "./chunk-2OGVSUNI.js";
44
+ } from "./chunk-GWFQCQB5.js";
45
45
  import {
46
46
  JsonObject
47
47
  } from "./chunk-7A4ZSEM3.js";
48
48
  import {
49
49
  HttpClientRequest_exports,
50
50
  HttpClient_exports
51
- } from "./chunk-IWLFLMIL.js";
51
+ } from "./chunk-4XXHO5UG.js";
52
52
  import {
53
53
  Clock_exports,
54
54
  Deferred_exports,
@@ -112,7 +112,6 @@ var resultSchema = (structuredContent) => {
112
112
  return { type: "object", properties: resultFields, required: ["content"] };
113
113
  const { schema, root } = placed(structuredContent, "#/anyOf/0/properties/structuredContent");
114
114
  return {
115
- // The envelope's keywords mean the same in every draft, so the server's draft applies.
116
115
  ...structuredContent.$schema === void 0 ? {} : { $schema: structuredContent.$schema },
117
116
  ...root,
118
117
  anyOf: [
@@ -292,9 +291,6 @@ var mcpCall = (client, name, input, context, timeoutMs, failure2) => Effect_expo
292
291
  });
293
292
  return yield* Effect_exports.tryPromise({
294
293
  try: (signal) => client.callTool({ name, arguments: input }, void 0, {
295
- // Only this request's own signal, which Effect aborts when the call is interrupted, as
296
- // a failed prompt or an expired budget does. The SDK never removes its abort listener,
297
- // so `lifetime`, aborted at release, would cancel a call the server already answered.
298
294
  signal,
299
295
  timeout: mcpSdkTimerCeilingMs
300
296
  }),
@@ -363,8 +359,6 @@ function mcpClient(withClient2, timeoutMs, failure2) {
363
359
  let cursor;
364
360
  do {
365
361
  const page = yield* Effect_exports.tryPromise({
366
- // This session only reads metadata. listTools() also eagerly compiles
367
- // every output validator; mcpRouter validates the selected tool on call.
368
362
  try: (signal) => client.request(
369
363
  { method: "tools/list", params: cursor === void 0 ? {} : { cursor } },
370
364
  ListToolsResultSchema,
@@ -495,7 +489,6 @@ var transportFetch = (connection, telemetry, rejected, answered, kind) => (url,
495
489
  if (!headers.has("user-agent")) headers.set("user-agent", "Executor");
496
490
  return HttpClientRequest_exports.fromWeb(new Request(target, { ...init, headers }));
497
491
  },
498
- // The provider's headers cannot form an HTTP request, such as a name with a space.
499
492
  catch: () => new McpError({ phase: "transport", reason: "invalid_input" })
500
493
  });
501
494
  const client = yield* HttpClient_exports.HttpClient;
@@ -659,7 +652,6 @@ function withClient(connection, mode, use, changed) {
659
652
  })
660
653
  );
661
654
  return attempt("http").pipe(
662
- // Fallback is only for negotiation. Tool calls are never automatically replayed.
663
655
  Effect_exports.catch(
664
656
  (error) => Schema_exports.is(McpError)(error) && error.phase === "connect" && (error.status === 404 || error.status === 405) ? attempt("sse") : Effect_exports.fail(error)
665
657
  ),
@@ -720,7 +712,6 @@ var mcpHealthEffect = (check, options) => Effect_exports.gen(function* () {
720
712
  Effect_exports.flatMap((anonymous) => anonymous.check),
721
713
  Effect_exports.matchEffect({
722
714
  onSuccess: () => Effect_exports.fail(new McpCredentialsUnverified({ anonymous: "answered" })),
723
- // Executor's network refused the attempt, so the server never answered it.
724
715
  onFailure: (error) => Schema_exports.is(NetworkRefused)(error) ? Effect_exports.fail(error) : refusesCredentials(error) ? Effect_exports.void : Effect_exports.fail(new McpCredentialsUnverified({ anonymous: error }))
725
716
  }),
726
717
  owned("upstream", "provider.mcp.anonymous")
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  accountProviderError,
3
3
  fromPromise
4
- } from "./chunk-RUSVGD5N.js";
4
+ } from "./chunk-SXYFFXHM.js";
5
5
  import {
6
6
  HostedTool,
7
7
  HostedToolSummary,
8
8
  RouterKey,
9
9
  RouterMeta,
10
10
  reservedRouterKeys
11
- } from "./chunk-LRXY54YF.js";
11
+ } from "./chunk-EXL6F456.js";
12
12
  import {
13
13
  combineJsonSchemas,
14
14
  decoderOf,
@@ -18,7 +18,7 @@ import {
18
18
  schemaIdentity,
19
19
  schemaMemo,
20
20
  withLazyJsonSchemaDocument
21
- } from "./chunk-ADG72XX3.js";
21
+ } from "./chunk-JLHRRTRH.js";
22
22
  import {
23
23
  JsonObject
24
24
  } from "./chunk-7A4ZSEM3.js";
@@ -59,21 +59,15 @@ var approvedOperation = (operation, approval) => {
59
59
  value: (context) => fromPromise(async () => approval(context), "approval")()
60
60
  });
61
61
  };
62
- var withApproval = (operation, approval) => (
63
- // SAFETY: `Approved` is a type-only mark; the native operation now carries the approval.
64
- {
65
- ...operation,
66
- [NativeOperation]: approvedOperation(operation[NativeOperation], approval)
67
- }
68
- );
62
+ var withApproval = (operation, approval) => ({
63
+ ...operation,
64
+ [NativeOperation]: approvedOperation(operation[NativeOperation], approval)
65
+ });
69
66
  var toolAnnotations = (operation) => nativeOperation(operation)?.annotations;
70
67
  var make = (kind, options, run) => operationDeclaration({
71
68
  ...operationOptions({ ...options, input: schemaArgument(options.input, `The ${kind} input`) }),
72
69
  kind,
73
- // The host always validates JSON serialization, even without a stronger output declaration.
74
70
  ...options.output === void 0 ? {} : { output: decoderOf(schemaArgument(options.output, `The ${kind} output`)) },
75
- // SAFETY: defineApp checks the handler context against its requirements.
76
- // The host validates account bindings and creates the matching storage facade.
77
71
  run: (context, input) => fromPromise(run, "handler")(context, input)
78
72
  });
79
73
  var query = (options, run) => make("query", options, run);
@@ -450,7 +444,6 @@ var combineDynamic = (sources) => {
450
444
  });
451
445
  return {
452
446
  kind: "dynamic",
453
- // Accounts share one source, so the first account that can describe it describes the router.
454
447
  ...first?.meta === void 0 ? {} : {
455
448
  meta: () => Effect_exports.gen(function* () {
456
449
  const failures = [];
@@ -464,7 +457,6 @@ var combineDynamic = (sources) => {
464
457
  })
465
458
  },
466
459
  ...first?.overrides === void 0 ? {} : { overrides: first.overrides },
467
- // One memo per listing: its tools share definition objects, which it reads once.
468
460
  list: () => Effect_exports.suspend(() => {
469
461
  const memo = schemaMemo();
470
462
  return grouped(
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  AppSkillName,
3
3
  AppSkills
4
- } from "./chunk-2XEQYDQY.js";
4
+ } from "./chunk-A6FRLRCN.js";
5
5
  import {
6
6
  RecordedMessage
7
7
  } from "./chunk-6XBOKQ4E.js";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  getWithReads
3
- } from "./chunk-PASOVDON.js";
3
+ } from "./chunk-ALZDZ3ZT.js";
4
4
  import {
5
5
  fromPromise,
6
6
  method,
7
7
  toPromise
8
- } from "./chunk-RUSVGD5N.js";
8
+ } from "./chunk-SXYFFXHM.js";
9
9
  import {
10
10
  CacheError
11
- } from "./chunk-LRXY54YF.js";
11
+ } from "./chunk-EXL6F456.js";
12
12
  import {
13
13
  wrap
14
- } from "./chunk-ADG72XX3.js";
14
+ } from "./chunk-JLHRRTRH.js";
15
15
  import {
16
16
  JsonObject
17
17
  } from "./chunk-7A4ZSEM3.js";
@@ -190,7 +190,6 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
190
190
  freshFor,
191
191
  staleFor,
192
192
  ...options.stale === void 0 ? {} : { stale: options.stale },
193
- // A cache may call the loader as a Promise; its own signal cancels that load.
194
193
  load: toPromise(refresh, (context) => context.signal)
195
194
  };
196
195
  let reading;
@@ -4,8 +4,8 @@ import {
4
4
  TransportError,
5
5
  fromWeb,
6
6
  layerMergedContext,
7
- make2 as make
8
- } from "./chunk-IWLFLMIL.js";
7
+ make
8
+ } from "./chunk-4XXHO5UG.js";
9
9
  import {
10
10
  Reference,
11
11
  Service,