@frontmcp/sdk 1.10.9-rc.1 → 1.10.9-rc.2

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 (90) hide show
  1. package/browser/agent/agent.registry.mjs +1 -1
  2. package/browser/app/instances/app.esm.instance.mjs +4 -4
  3. package/browser/app/instances/app.remote.instance.mjs +6 -6
  4. package/browser/auth/auth-ui/auth-ui.registry.mjs +6 -6
  5. package/browser/auth/flows/oauth.authorize.flow.mjs +5 -5
  6. package/browser/auth/flows/oauth.callback.flow.mjs +11 -11
  7. package/browser/auth/flows/oauth.connect.flow.mjs +1 -1
  8. package/browser/auth/flows/oauth.register.flow.mjs +1 -1
  9. package/browser/auth/flows/oauth.token.flow.mjs +1 -1
  10. package/browser/auth/flows/well-known.oauth-authorization-server.flow.mjs +5 -5
  11. package/browser/auth/instances/instance.local-primary-auth.mjs +10 -10
  12. package/browser/auth/session/utils/session-id.utils.mjs +1 -1
  13. package/browser/common/entries/skill.entry.mjs +2 -2
  14. package/browser/common/entries/tool.entry.mjs +3 -3
  15. package/browser/common/interfaces/channel.interface.mjs +1 -1
  16. package/browser/common/interfaces/execution-context.interface.mjs +4 -4
  17. package/browser/common/interfaces/internal/primary-auth-provider.interface.mjs +2 -2
  18. package/browser/common/metadata/app.metadata.mjs +1 -1
  19. package/browser/common/metadata/front-mcp.metadata.mjs +5 -5
  20. package/browser/common/tokens/app.tokens.mjs +1 -1
  21. package/browser/common/tokens/front-mcp.tokens.mjs +1 -1
  22. package/browser/common/types/options/http/schema.mjs +4 -4
  23. package/browser/common/types/options/redis/schema.mjs +1 -1
  24. package/browser/common/types/options/sqlite/schema.mjs +3 -3
  25. package/browser/common/types/options/transport/schema.mjs +4 -4
  26. package/browser/common/utils/decide-request-intent.utils.mjs +10 -10
  27. package/browser/context/frontmcp-context.mjs +1 -1
  28. package/browser/direct/direct-client.mjs +29 -29
  29. package/browser/direct/direct-server.mjs +14 -14
  30. package/browser/errors/job.errors.mjs +1 -1
  31. package/browser/errors/mcp.error.mjs +4 -4
  32. package/browser/errors/plugin.errors.mjs +1 -1
  33. package/browser/errors/task.error.mjs +1 -1
  34. package/browser/errors/tool-credentials-required.error.mjs +2 -2
  35. package/browser/esm-loader/esm-module-loader.mjs +1 -7
  36. package/browser/esm-loader/import-computed.mjs +11 -0
  37. package/browser/esm-loader/semver.utils.mjs +17 -11
  38. package/browser/flows/flow.instance.mjs +1 -1
  39. package/browser/front-mcp/front-mcp.mjs +10 -14
  40. package/browser/ha/ha-manager.mjs +1 -1
  41. package/browser/ha/notification-relay.mjs +1 -1
  42. package/browser/index.cjs +1210 -1438
  43. package/browser/index.mjs +4 -4
  44. package/browser/job/store/job-definition-store.factory.mjs +1 -1
  45. package/browser/job/store/redis-job-definition.store.mjs +2 -2
  46. package/browser/job/tools/get-job-status.tool.mjs +1 -1
  47. package/browser/logger/logger.registry.mjs +1 -1
  48. package/browser/metrics/metrics.service.mjs +3 -3
  49. package/browser/prompt/prompt.registry.mjs +1 -1
  50. package/browser/provider/provider.registry.mjs +4 -4
  51. package/browser/remote-mcp/mcp-client.service.mjs +19 -19
  52. package/browser/remote-mcp/resilience/circuit-breaker.mjs +2 -2
  53. package/browser/resource/resource.registry.mjs +2 -2
  54. package/browser/scope/flows/http.request.flow.mjs +3 -3
  55. package/browser/scope/scope.instance.mjs +4 -4
  56. package/browser/scope/scope.utils.mjs +1 -1
  57. package/browser/skill/providers/memory-skill.provider.mjs +2 -2
  58. package/browser/skill/skill.registry.mjs +10 -10
  59. package/browser/task/flows/tasks-result.flow.mjs +2 -2
  60. package/browser/task/task.registry.mjs +5 -5
  61. package/browser/tool/flows/call-tool.flow.mjs +4 -4
  62. package/browser/tool/tool.instance.mjs +4 -4
  63. package/browser/tool/tool.registry.mjs +4 -4
  64. package/browser/tool/ui/ui-shared.mjs +1 -1
  65. package/browser/transport/adapters/transport.local.adapter.mjs +2 -2
  66. package/browser/transport/adapters/transport.streamable-http.adapter.mjs +13 -4
  67. package/browser/transport/event-stores/redis.event-store.mjs +1 -1
  68. package/browser/transport/mcp-20260728/client/mcp-stateless.client.mjs +1 -1
  69. package/browser/transport/mcp-20260728/request-notifications.mjs +1 -1
  70. package/browser/transport/transport.registry.mjs +15 -9
  71. package/browser/transport/web-response.renderer.mjs +2 -2
  72. package/browser/utils/lineage.utils.mjs +1 -1
  73. package/browser/workflow/tools/get-workflow-status.tool.mjs +1 -1
  74. package/esm/esm-loader/import-computed.mjs +10 -0
  75. package/esm/index.mjs +136 -77113
  76. package/esm-loader/esm-module-loader.d.ts.map +1 -1
  77. package/esm-loader/import-computed.d.ts +21 -0
  78. package/esm-loader/import-computed.d.ts.map +1 -0
  79. package/esm-loader/import-computed.js +34 -0
  80. package/esm-loader/semver.utils.d.ts.map +1 -1
  81. package/front-mcp/front-mcp.d.ts.map +1 -1
  82. package/index.d.ts +9 -8
  83. package/index.d.ts.map +1 -1
  84. package/index.js +140 -77769
  85. package/package.json +14 -10
  86. package/transport/adapters/transport.streamable-http.adapter.d.ts +2 -1
  87. package/transport/adapters/transport.streamable-http.adapter.d.ts.map +1 -1
  88. package/transport/transport.registry.d.ts +1 -0
  89. package/transport/transport.registry.d.ts.map +1 -1
  90. package/browser/transport/index.mjs +0 -32
@@ -1,11 +1,14 @@
1
1
  // libs/sdk/src/transport/adapters/transport.streamable-http.adapter.ts
2
2
  import { toJSONSchema } from "@frontmcp/lazy-zod";
3
- import { ElicitationTimeoutError } from "../../errors/index.mjs";
3
+ import { ElicitationTimeoutError, InternalMcpError } from "../../errors/index.mjs";
4
4
  import { createSessionScopedEventStore } from "../event-stores/session-scoped.event-store.mjs";
5
5
  import { rpcRequest } from "../transport.error.mjs";
6
6
  import { STATELESS_SESSION_ID } from "../transport.types.mjs";
7
- import { RecreateableStreamableHTTPServerTransport } from "./streamable-http-transport.mjs";
8
7
  import { LocalTransportAdapter } from "./transport.local.adapter.mjs";
8
+ var RecreateableTransport;
9
+ async function loadStreamableHttpTransport() {
10
+ RecreateableTransport ??= (await import("./streamable-http-transport.mjs")).RecreateableStreamableHTTPServerTransport;
11
+ }
9
12
  var resolveSessionIdGenerator = (transportType, sessionId) => {
10
13
  return transportType === "stateless-http" ? () => STATELESS_SESSION_ID : () => sessionId;
11
14
  };
@@ -15,7 +18,12 @@ var TransportStreamableHttpAdapter = class extends LocalTransportAdapter {
15
18
  const sharedEventStore = this.scope.eventStore;
16
19
  const eventStore = sharedEventStore ? createSessionScopedEventStore(sharedEventStore, sessionId) : void 0;
17
20
  const isStateless = this.key.type === "stateless-http";
18
- return new RecreateableStreamableHTTPServerTransport({
21
+ if (!RecreateableTransport) {
22
+ throw new InternalMcpError(
23
+ "The Streamable HTTP transport was used before loadStreamableHttpTransport() loaded it"
24
+ );
25
+ }
26
+ return new RecreateableTransport({
19
27
  sessionIdGenerator,
20
28
  isStateless,
21
29
  onsessionclosed: () => {
@@ -47,7 +55,7 @@ var TransportStreamableHttpAdapter = class extends LocalTransportAdapter {
47
55
  });
48
56
  await this.ready;
49
57
  this.logger.verbose("[StreamableHttpAdapter] transport state before handleRequest", {
50
- isRecreatable: this.transport instanceof RecreateableStreamableHTTPServerTransport,
58
+ isRecreatable: RecreateableTransport !== void 0 && this.transport instanceof RecreateableTransport,
51
59
  hasWebTransport: !!this.transport._webStandardTransport,
52
60
  webTransportInitialized: this.transport._webStandardTransport?._initialized,
53
61
  webTransportStarted: this.transport._webStandardTransport?._started,
@@ -224,5 +232,6 @@ var TransportStreamableHttpAdapter = class extends LocalTransportAdapter {
224
232
  };
225
233
  export {
226
234
  TransportStreamableHttpAdapter,
235
+ loadStreamableHttpTransport,
227
236
  resolveSessionIdGenerator
228
237
  };
@@ -116,7 +116,7 @@ var RedisEventStore = class {
116
116
  * rather than data.
117
117
  *
118
118
  * The stream-id half is NOT character-filtered. `xadd`/`xrange` take the key
119
- * as an exact argument — Redis applies no glob matching there — and ioredis
119
+ * as an exact argument \u2014 Redis applies no glob matching there \u2014 and ioredis
120
120
  * length-prefixes it, so no character is special. Filtering here would also
121
121
  * make `storeEvent`, which accepts any `StreamId`, able to mint ids this
122
122
  * function then refuses, silently breaking replay for that stream. Ownership
@@ -158,7 +158,7 @@ var McpStatelessClient = class {
158
158
  * Poll a task handle to a terminal state, answering mid-flight input requests.
159
159
  *
160
160
  * Honours the server's `pollIntervalMs` hint rather than picking our own
161
- * cadence — the server knows how long its work takes.
161
+ * cadence \u2014 the server knows how long its work takes.
162
162
  */
163
163
  async awaitTask(task) {
164
164
  const taskId = String(task["taskId"]);
@@ -23,7 +23,7 @@ var RequestNotificationSink = class {
23
23
  /**
24
24
  * Queue a log message.
25
25
  *
26
- * Dropped outright when the client did not set `logLevel` — the spec makes
26
+ * Dropped outright when the client did not set `logLevel` \u2014 the spec makes
27
27
  * that a MUST NOT, not a preference.
28
28
  */
29
29
  log(level, logger, data) {
@@ -4,6 +4,7 @@ import { createSessionStore } from "../auth/session/session-store.factory.mjs";
4
4
  import { isDeploymentSessionId } from "../auth/session/utils/session-id.utils.mjs";
5
5
  import { sessionIdPresentedBy } from "../common/utils/auth-info.utils.mjs";
6
6
  import { InvalidTransportSessionError, SessionClaimConflictError } from "../errors/transport.errors.mjs";
7
+ import { loadStreamableHttpTransport } from "./adapters/transport.streamable-http.adapter.mjs";
7
8
  import HandleMcp20260728Flow from "./flows/handle.mcp-20260728.flow.mjs";
8
9
  import HandleSseFlow from "./flows/handle.sse.flow.mjs";
9
10
  import HandleStatelessHttpFlow from "./flows/handle.stateless-http.flow.mjs";
@@ -50,7 +51,7 @@ var TransportService = class {
50
51
  persistenceConfig;
51
52
  /**
52
53
  * Pending store configuration for async initialization. Either a Redis/Vercel KV
53
- * shape or a `{ sqlite: ... }` shape — discriminated in `createSessionStore`.
54
+ * shape or a `{ sqlite: ... }` shape \u2014 discriminated in `createSessionStore`.
54
55
  */
55
56
  pendingStoreConfig;
56
57
  /** Set when the configured backend is SQLite. Used for telemetry-only branching. */
@@ -71,6 +72,13 @@ var TransportService = class {
71
72
  * Key: JSON-encoded {t: type, h: tokenHash, s: sessionId}, Value: Promise that resolves when creation completes
72
73
  */
73
74
  creationMutex = /* @__PURE__ */ new Map();
75
+ // The Streamable HTTP transport class loads with the first session that uses it, so stdio and SSE servers never load it.
76
+ async newLocalTransporter(key, res, onDispose) {
77
+ if (key.type === "streamable-http" || key.type === "stateless-http") {
78
+ await loadStreamableHttpTransport();
79
+ }
80
+ return new LocalTransporter(this.scope, key, res, onDispose);
81
+ }
74
82
  /**
75
83
  * Get the default TTL for session persistence.
76
84
  * Returns undefined if persistence is disabled or not configured.
@@ -278,7 +286,7 @@ var TransportService = class {
278
286
  /** True when a backend (Redis / Vercel KV / SQLite) was wired at construction.
279
287
  * Note: this reflects construction-time intent, not live connection state.
280
288
  * A `false` here means no backend was configured at all; a `true` does NOT
281
- * guarantee the store is currently reachable — use `pingSessionStore()` for
289
+ * guarantee the store is currently reachable \u2014 use `pingSessionStore()` for
282
290
  * that signal. */
283
291
  isSessionStoreConfigured() {
284
292
  return this.sessionStoreConfigured;
@@ -348,7 +356,7 @@ var TransportService = class {
348
356
  * owns the session it presents. `undefined` means "serve it here": the session is local,
349
357
  * unknown, owned by this node, or owned by a node that stopped (this node takes it over).
350
358
  *
351
- * Runs before authentication — it only decides where the request is served; the owner
359
+ * Runs before authentication \u2014 it only decides where the request is served; the owner
352
360
  * authenticates it. Only session ids this deployment minted cost a Redis lookup.
353
361
  */
354
362
  async findRemoteSessionOwner(request) {
@@ -659,8 +667,7 @@ var TransportService = class {
659
667
  this.sessionHistory.set(historyKey, storedSession.createdAt);
660
668
  const sessionStore = this.sessionStore;
661
669
  const defaultTtlMs = this.getDefaultTtlMs();
662
- const transporter = new LocalTransporter(
663
- this.scope,
670
+ const transporter = await this.newLocalTransporter(
664
671
  key,
665
672
  res,
666
673
  () => this.onSessionTransportDisposed(key, sessionId, sessionStore)
@@ -720,8 +727,7 @@ var TransportService = class {
720
727
  if (existing) return existing;
721
728
  const sessionStore = this.sessionStore;
722
729
  const defaultTtlMs = this.getDefaultTtlMs();
723
- const transporter = new LocalTransporter(
724
- this.scope,
730
+ const transporter = await this.newLocalTransporter(
725
731
  key,
726
732
  res,
727
733
  () => this.onSessionTransportDisposed(key, sessionId, sessionStore)
@@ -847,7 +853,7 @@ var TransportService = class {
847
853
  const key = this.keyOf(type, "__anonymous__", STATELESS_SESSION_ID);
848
854
  const existing = this.lookupLocal(key);
849
855
  if (existing) return existing;
850
- const transporter = new LocalTransporter(this.scope, key, res, () => {
856
+ const transporter = await this.newLocalTransporter(key, res, () => {
851
857
  this.evictLocal(key);
852
858
  if (this.distributed && this.bus) {
853
859
  this.bus.revoke(key).catch(() => void 0);
@@ -868,7 +874,7 @@ var TransportService = class {
868
874
  const key = this.keyOf(type, token, STATELESS_SESSION_ID);
869
875
  const existing = this.lookupLocal(key);
870
876
  if (existing) return existing;
871
- const transporter = new LocalTransporter(this.scope, key, res, () => {
877
+ const transporter = await this.newLocalTransporter(key, res, () => {
872
878
  this.evictLocal(key);
873
879
  if (this.distributed && this.bus) {
874
880
  this.bus.revoke(key).catch(() => void 0);
@@ -48,10 +48,10 @@ function buildHeaders(out, contentType) {
48
48
  function renderHttpOutputToWebResponse(output) {
49
49
  const out = output;
50
50
  switch (out.kind) {
51
- // Already a Web Response (the MCP execute stage on a worker) — return verbatim.
51
+ // Already a Web Response (the MCP execute stage on a worker) \u2014 return verbatim.
52
52
  case "web-response":
53
53
  return out.response;
54
- // "no response" — let the adapter fall through (404 / next middleware).
54
+ // "no response" \u2014 let the adapter fall through (404 / next middleware).
55
55
  case "next":
56
56
  case "consumed":
57
57
  return void 0;
@@ -51,7 +51,7 @@ var EntryLineageIndex = class {
51
51
  if (!this.lineages.has(row.instance)) this.lineages.set(row.instance, row.lineage);
52
52
  }
53
53
  }
54
- /** Owner lineage (root → leaf) of an entry, or undefined when no row holds it. */
54
+ /** Owner lineage (root \u2192 leaf) of an entry, or undefined when no row holds it. */
55
55
  lineageOf(entry) {
56
56
  return this.lineages.get(entry);
57
57
  }
@@ -41,7 +41,7 @@ var GetWorkflowStatusTool = class extends ToolContext {
41
41
  *
42
42
  * A record carrying NEITHER identity is refused. Such a run cannot be
43
43
  * attributed to anyone, and its inputs and results are exactly what this check
44
- * exists to protect — anyone holding the id would otherwise be able to read
44
+ * exists to protect \u2014 anyone holding the id would otherwise be able to read
45
45
  * it. Internal callers that must read unattributed runs should go through the
46
46
  * execution manager directly rather than this tool.
47
47
  */
@@ -0,0 +1,10 @@
1
+ function importComputed(specifier) {
2
+ return import(
3
+ /* webpackIgnore: true */
4
+ /* @vite-ignore */
5
+ specifier
6
+ );
7
+ }
8
+ export {
9
+ importComputed
10
+ };