@yourgpt/copilot-sdk 2.0.2-beta.2 → 2.1.0

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 (86) hide show
  1. package/README.md +0 -42
  2. package/dist/{chunk-UOWLKFXK.cjs → chunk-33JSFVGH.cjs} +23 -23
  3. package/dist/{chunk-UOWLKFXK.cjs.map → chunk-33JSFVGH.cjs.map} +1 -1
  4. package/dist/{chunk-IXFV6AW6.js → chunk-3SP6V22Y.js} +246 -219
  5. package/dist/chunk-3SP6V22Y.js.map +1 -0
  6. package/dist/{chunk-7XFFRV7D.js → chunk-7PJ4GAJR.js} +4 -4
  7. package/dist/{chunk-7XFFRV7D.js.map → chunk-7PJ4GAJR.js.map} +1 -1
  8. package/dist/{chunk-ZPYQDMUX.js → chunk-7YZVSG62.js} +3 -3
  9. package/dist/{chunk-ZPYQDMUX.js.map → chunk-7YZVSG62.js.map} +1 -1
  10. package/dist/{chunk-BKO7DSPU.js → chunk-BRUDSHCV.js} +2 -2
  11. package/dist/chunk-BRUDSHCV.js.map +1 -0
  12. package/dist/{chunk-BH7MNDWW.js → chunk-EWVQWTNV.js} +13 -3
  13. package/dist/chunk-EWVQWTNV.js.map +1 -0
  14. package/dist/{chunk-CEKAYA2Q.cjs → chunk-HNRFRNMY.cjs} +2 -2
  15. package/dist/chunk-HNRFRNMY.cjs.map +1 -0
  16. package/dist/{chunk-7K7HZMP4.cjs → chunk-JGPDQDY4.cjs} +13 -3
  17. package/dist/chunk-JGPDQDY4.cjs.map +1 -0
  18. package/dist/{chunk-H5XMKBBA.cjs → chunk-MUZ2RYS2.cjs} +268 -241
  19. package/dist/chunk-MUZ2RYS2.cjs.map +1 -0
  20. package/dist/{chunk-UIWFYMAO.cjs → chunk-O33I4HBL.cjs} +5 -5
  21. package/dist/{chunk-UIWFYMAO.cjs.map → chunk-O33I4HBL.cjs.map} +1 -1
  22. package/dist/core/index.cjs +80 -80
  23. package/dist/core/index.d.cts +3 -3
  24. package/dist/core/index.d.ts +3 -3
  25. package/dist/core/index.js +3 -3
  26. package/dist/{index-pWEH7pUE.d.ts → index-25qIYJ21.d.ts} +1 -1
  27. package/dist/{index-2VtgKM8S.d.cts → index-C261xY-B.d.cts} +1 -1
  28. package/dist/mcp/index.cjs +47 -47
  29. package/dist/mcp/index.d.cts +13 -3
  30. package/dist/mcp/index.d.ts +13 -3
  31. package/dist/mcp/index.js +2 -2
  32. package/dist/react/index.cjs +50 -50
  33. package/dist/react/index.d.cts +18 -5
  34. package/dist/react/index.d.ts +18 -5
  35. package/dist/react/index.js +5 -5
  36. package/dist/tools/anthropic/index.d.cts +1 -1
  37. package/dist/tools/anthropic/index.d.ts +1 -1
  38. package/dist/tools/brave/index.cjs +2 -2
  39. package/dist/tools/brave/index.d.cts +1 -1
  40. package/dist/tools/brave/index.d.ts +1 -1
  41. package/dist/tools/brave/index.js +1 -1
  42. package/dist/tools/exa/index.cjs +2 -2
  43. package/dist/tools/exa/index.d.cts +1 -1
  44. package/dist/tools/exa/index.d.ts +1 -1
  45. package/dist/tools/exa/index.js +1 -1
  46. package/dist/tools/google/index.cjs +2 -2
  47. package/dist/tools/google/index.d.cts +1 -1
  48. package/dist/tools/google/index.d.ts +1 -1
  49. package/dist/tools/google/index.js +1 -1
  50. package/dist/tools/openai/index.cjs +2 -2
  51. package/dist/tools/openai/index.d.cts +1 -1
  52. package/dist/tools/openai/index.d.ts +1 -1
  53. package/dist/tools/openai/index.js +1 -1
  54. package/dist/tools/searxng/index.cjs +2 -2
  55. package/dist/tools/searxng/index.d.cts +1 -1
  56. package/dist/tools/searxng/index.d.ts +1 -1
  57. package/dist/tools/searxng/index.js +1 -1
  58. package/dist/tools/serper/index.cjs +2 -2
  59. package/dist/tools/serper/index.d.cts +1 -1
  60. package/dist/tools/serper/index.d.ts +1 -1
  61. package/dist/tools/serper/index.js +1 -1
  62. package/dist/tools/tavily/index.cjs +2 -2
  63. package/dist/tools/tavily/index.d.cts +1 -1
  64. package/dist/tools/tavily/index.d.ts +1 -1
  65. package/dist/tools/tavily/index.js +1 -1
  66. package/dist/tools/web-search/index.cjs +3 -3
  67. package/dist/tools/web-search/index.d.cts +2 -2
  68. package/dist/tools/web-search/index.d.ts +2 -2
  69. package/dist/tools/web-search/index.js +2 -2
  70. package/dist/{tools-DDWrco4h.d.cts → tools-Clyufshc.d.cts} +14 -1
  71. package/dist/{tools-DDWrco4h.d.ts → tools-Clyufshc.d.ts} +14 -1
  72. package/dist/{types-DjSfYNKj.d.cts → types-DM6M_pv_.d.cts} +43 -2
  73. package/dist/{types-Cizh9K_f.d.ts → types-wudOhedT.d.ts} +43 -2
  74. package/dist/ui/index.cjs +56 -26
  75. package/dist/ui/index.cjs.map +1 -1
  76. package/dist/ui/index.d.cts +37 -3
  77. package/dist/ui/index.d.ts +37 -3
  78. package/dist/ui/index.js +52 -22
  79. package/dist/ui/index.js.map +1 -1
  80. package/package.json +1 -1
  81. package/dist/chunk-7K7HZMP4.cjs.map +0 -1
  82. package/dist/chunk-BH7MNDWW.js.map +0 -1
  83. package/dist/chunk-BKO7DSPU.js.map +0 -1
  84. package/dist/chunk-CEKAYA2Q.cjs.map +0 -1
  85. package/dist/chunk-H5XMKBBA.cjs.map +0 -1
  86. package/dist/chunk-IXFV6AW6.js.map +0 -1
package/dist/ui/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkH5XMKBBA_cjs = require('../chunk-H5XMKBBA.cjs');
4
- var chunkUOWLKFXK_cjs = require('../chunk-UOWLKFXK.cjs');
3
+ var chunkMUZ2RYS2_cjs = require('../chunk-MUZ2RYS2.cjs');
4
+ var chunk33JSFVGH_cjs = require('../chunk-33JSFVGH.cjs');
5
5
  var chunkJO4BHPAD_cjs = require('../chunk-JO4BHPAD.cjs');
6
- require('../chunk-7K7HZMP4.cjs');
7
- require('../chunk-UIWFYMAO.cjs');
8
- require('../chunk-CEKAYA2Q.cjs');
6
+ require('../chunk-JGPDQDY4.cjs');
7
+ require('../chunk-O33I4HBL.cjs');
8
+ require('../chunk-HNRFRNMY.cjs');
9
9
  require('../chunk-ASV6JLYG.cjs');
10
10
  require('../chunk-CBAHCI4R.cjs');
11
11
  require('../chunk-MEBXW75C.cjs');
@@ -351,7 +351,8 @@ var headingComponents = {
351
351
  function MarkdownComponent({
352
352
  children,
353
353
  className,
354
- isStreaming = false
354
+ isStreaming = false,
355
+ linkSafety = { enabled: false }
355
356
  }) {
356
357
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx(
357
358
  streamdown.Streamdown,
@@ -359,6 +360,7 @@ function MarkdownComponent({
359
360
  plugins: { code: code.code },
360
361
  isAnimating: isStreaming,
361
362
  components: headingComponents,
363
+ linkSafety,
362
364
  children
363
365
  }
364
366
  ) });
@@ -1926,8 +1928,8 @@ function ToolStep({
1926
1928
  "aria-hidden": "true"
1927
1929
  }
1928
1930
  ),
1929
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
1930
- !isExecuting && /* @__PURE__ */ jsxRuntime.jsx(StatusIndicator, { status: step.status, className: "mt-0.5" }),
1931
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
1932
+ !isExecuting && /* @__PURE__ */ jsxRuntime.jsx(StatusIndicator, { status: step.status }),
1931
1933
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
1932
1934
  /* @__PURE__ */ jsxRuntime.jsxs(
1933
1935
  "button",
@@ -4249,6 +4251,7 @@ function DefaultMessage({
4249
4251
  loaderVariant = "typing",
4250
4252
  registeredTools,
4251
4253
  toolRenderers,
4254
+ mcpToolRenderer,
4252
4255
  onApproveToolExecution,
4253
4256
  onRejectToolExecution,
4254
4257
  showFollowUps = true,
@@ -4370,17 +4373,19 @@ function DefaultMessage({
4370
4373
  const completedTools = message.toolExecutions?.filter(
4371
4374
  (exec) => exec.approvalStatus !== "required" && !isToolHidden(exec.name)
4372
4375
  );
4373
- const hasCustomRender = (toolName) => {
4376
+ const hasCustomRender = (toolName, execSource) => {
4374
4377
  if (toolRenderers?.[toolName]) return true;
4375
4378
  const toolDef = registeredTools?.find((t) => t.name === toolName);
4379
+ if (mcpToolRenderer && (execSource === "mcp" || toolDef?.source === "mcp"))
4380
+ return true;
4376
4381
  if (toolDef?.render) return true;
4377
4382
  return false;
4378
4383
  };
4379
4384
  const toolsWithCustomRender = completedTools?.filter(
4380
- (exec) => hasCustomRender(exec.name)
4385
+ (exec) => hasCustomRender(exec.name, exec.source)
4381
4386
  );
4382
4387
  const toolsWithoutCustomRender = completedTools?.filter(
4383
- (exec) => !hasCustomRender(exec.name)
4388
+ (exec) => !hasCustomRender(exec.name, exec.source)
4384
4389
  );
4385
4390
  const hasNativeCitations = !!message.metadata?.citations?.length;
4386
4391
  const toolSteps = toolsWithoutCustomRender?.filter((exec) => !(exec.name === "web_search" && hasNativeCitations)).map((exec) => ({
@@ -4430,7 +4435,7 @@ function DefaultMessage({
4430
4435
  children: cleanContent
4431
4436
  }
4432
4437
  ),
4433
- toolsWithCustomRender && toolsWithCustomRender.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 space-y-2", children: toolsWithCustomRender.map((exec) => {
4438
+ toolsWithCustomRender && toolsWithCustomRender.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("space-y-2", cleanContent?.trim() && "mt-2"), children: toolsWithCustomRender.map((exec) => {
4434
4439
  const Renderer = toolRenderers?.[exec.name];
4435
4440
  if (Renderer) {
4436
4441
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -4443,7 +4448,8 @@ function DefaultMessage({
4443
4448
  status: exec.status,
4444
4449
  result: exec.result,
4445
4450
  error: exec.error,
4446
- approvalStatus: exec.approvalStatus
4451
+ approvalStatus: exec.approvalStatus,
4452
+ source: exec.source
4447
4453
  }
4448
4454
  },
4449
4455
  exec.id
@@ -4452,7 +4458,26 @@ function DefaultMessage({
4452
4458
  const toolDef = registeredTools?.find(
4453
4459
  (t) => t.name === exec.name
4454
4460
  );
4455
- if (toolDef?.render) {
4461
+ if (mcpToolRenderer && (exec.source === "mcp" || toolDef?.source === "mcp")) {
4462
+ const MCPRenderer = mcpToolRenderer;
4463
+ return /* @__PURE__ */ jsxRuntime.jsx(
4464
+ MCPRenderer,
4465
+ {
4466
+ execution: {
4467
+ id: exec.id,
4468
+ name: exec.name,
4469
+ args: exec.args,
4470
+ status: exec.status,
4471
+ result: exec.result,
4472
+ error: exec.error,
4473
+ source: exec.source || toolDef?.source
4474
+ }
4475
+ },
4476
+ exec.id
4477
+ );
4478
+ }
4479
+ const toolDefForRender = toolDef ?? registeredTools?.find((t) => t.name === exec.name);
4480
+ if (toolDefForRender?.render) {
4456
4481
  let status = "pending";
4457
4482
  if (exec.status === "executing") status = "executing";
4458
4483
  else if (exec.status === "completed") status = "completed";
@@ -4466,14 +4491,23 @@ function DefaultMessage({
4466
4491
  toolCallId: exec.id,
4467
4492
  toolName: exec.name
4468
4493
  };
4469
- const output = toolDef.render(
4494
+ const output = toolDefForRender.render(
4470
4495
  renderProps
4471
4496
  );
4472
4497
  return /* @__PURE__ */ jsxRuntime.jsx(React20__namespace.Fragment, { children: output }, exec.id);
4473
4498
  }
4474
4499
  return null;
4475
4500
  }) }),
4476
- toolSteps && toolSteps.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 rounded-lg bg-muted/50 px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(ToolSteps, { steps: toolSteps }) }),
4501
+ toolSteps && toolSteps.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
4502
+ "div",
4503
+ {
4504
+ className: cn(
4505
+ "rounded-lg bg-muted/50 px-3 py-2",
4506
+ cleanContent?.trim() && "mt-2"
4507
+ ),
4508
+ children: /* @__PURE__ */ jsxRuntime.jsx(ToolSteps, { steps: toolSteps })
4509
+ }
4510
+ ),
4477
4511
  message.toolExecutions?.filter((exec) => !isToolHidden(exec.name)).map((exec) => {
4478
4512
  const uiResources = exec.result?._uiResources;
4479
4513
  if (!uiResources || uiResources.length === 0) return null;
@@ -5252,6 +5286,7 @@ function ChatComponent({
5252
5286
  isProcessing = false,
5253
5287
  registeredTools,
5254
5288
  toolRenderers,
5289
+ mcpToolRenderer,
5255
5290
  onApproveToolExecution,
5256
5291
  onRejectToolExecution,
5257
5292
  // Follow-up Questions
@@ -5579,6 +5614,7 @@ function ChatComponent({
5579
5614
  loaderVariant,
5580
5615
  registeredTools,
5581
5616
  toolRenderers,
5617
+ mcpToolRenderer,
5582
5618
  onApproveToolExecution,
5583
5619
  onRejectToolExecution,
5584
5620
  showFollowUps,
@@ -5908,7 +5944,7 @@ function useInternalThreadManager(config = {}) {
5908
5944
  saveDebounce,
5909
5945
  autoRestoreLastThread
5910
5946
  };
5911
- const threadManager = chunkH5XMKBBA_cjs.useThreadManager(threadManagerConfig);
5947
+ const threadManager = chunkMUZ2RYS2_cjs.useThreadManager(threadManagerConfig);
5912
5948
  const {
5913
5949
  currentThread,
5914
5950
  currentThreadId,
@@ -5918,7 +5954,7 @@ function useInternalThreadManager(config = {}) {
5918
5954
  clearCurrentThread,
5919
5955
  refreshThreads
5920
5956
  } = threadManager;
5921
- const { messages, setMessages, status, isLoading } = chunkH5XMKBBA_cjs.useCopilot();
5957
+ const { messages, setMessages, status, isLoading } = chunkMUZ2RYS2_cjs.useCopilot();
5922
5958
  const isLoadingMessagesRef = React20.useRef(false);
5923
5959
  const savingToThreadRef = React20.useRef(null);
5924
5960
  const lastSavedSnapshotRef = React20.useRef("");
@@ -5986,9 +6022,6 @@ function useInternalThreadManager(config = {}) {
5986
6022
  });
5987
6023
  }, [clearCurrentThread, setMessages, onThreadChange]);
5988
6024
  React20.useEffect(() => {
5989
- if (!adapter) {
5990
- return;
5991
- }
5992
6025
  if (hasInitializedRef.current || !currentThread) {
5993
6026
  return;
5994
6027
  }
@@ -6020,9 +6053,6 @@ function useInternalThreadManager(config = {}) {
6020
6053
  });
6021
6054
  }, [adapter, currentThread, setMessages, getMessageSnapshot, onThreadChange]);
6022
6055
  React20.useEffect(() => {
6023
- if (!adapter) {
6024
- return;
6025
- }
6026
6056
  if (isLoadingMessagesRef.current) {
6027
6057
  return;
6028
6058
  }
@@ -6091,7 +6121,7 @@ function parsePersistenceConfig(persistence, onThreadChange) {
6091
6121
  };
6092
6122
  case "server":
6093
6123
  return {
6094
- adapter: chunkUOWLKFXK_cjs.createServerAdapter({
6124
+ adapter: chunk33JSFVGH_cjs.createServerAdapter({
6095
6125
  endpoint: persistence.endpoint,
6096
6126
  headers: persistence.headers
6097
6127
  }),
@@ -6141,7 +6171,7 @@ function CopilotChatBase(props) {
6141
6171
  approveToolExecution,
6142
6172
  rejectToolExecution,
6143
6173
  registeredTools
6144
- } = chunkH5XMKBBA_cjs.useCopilot();
6174
+ } = chunkMUZ2RYS2_cjs.useCopilot();
6145
6175
  const toolExecutions = rawToolExecutions.map(
6146
6176
  (exec) => ({
6147
6177
  id: exec.id,