@yourgpt/copilot-sdk 2.1.1 → 2.1.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 (75) hide show
  1. package/dist/{chunk-33JSFVGH.cjs → chunk-7MZLBGFQ.cjs} +23 -23
  2. package/dist/{chunk-33JSFVGH.cjs.map → chunk-7MZLBGFQ.cjs.map} +1 -1
  3. package/dist/{chunk-BRUDSHCV.js → chunk-BMYNG3WM.js} +2 -2
  4. package/dist/{chunk-BRUDSHCV.js.map → chunk-BMYNG3WM.js.map} +1 -1
  5. package/dist/{chunk-5UMM5VYB.cjs → chunk-BNBEKK3U.cjs} +77 -31
  6. package/dist/chunk-BNBEKK3U.cjs.map +1 -0
  7. package/dist/{chunk-HNRFRNMY.cjs → chunk-CSEZZ5DX.cjs} +2 -2
  8. package/dist/{chunk-HNRFRNMY.cjs.map → chunk-CSEZZ5DX.cjs.map} +1 -1
  9. package/dist/{chunk-O33I4HBL.cjs → chunk-GSTTJ46F.cjs} +5 -5
  10. package/dist/{chunk-O33I4HBL.cjs.map → chunk-GSTTJ46F.cjs.map} +1 -1
  11. package/dist/{chunk-7YZVSG62.js → chunk-VUHP6TAN.js} +3 -3
  12. package/dist/{chunk-7YZVSG62.js.map → chunk-VUHP6TAN.js.map} +1 -1
  13. package/dist/{chunk-SNI7VN2U.js → chunk-VXT2O6R6.js} +53 -7
  14. package/dist/chunk-VXT2O6R6.js.map +1 -0
  15. package/dist/{chunk-7PJ4GAJR.js → chunk-XAC7NTIO.js} +4 -4
  16. package/dist/{chunk-7PJ4GAJR.js.map → chunk-XAC7NTIO.js.map} +1 -1
  17. package/dist/core/index.cjs +80 -80
  18. package/dist/core/index.d.cts +3 -3
  19. package/dist/core/index.d.ts +3 -3
  20. package/dist/core/index.js +3 -3
  21. package/dist/{index-25qIYJ21.d.ts → index-Du3Akr_E.d.ts} +1 -1
  22. package/dist/{index-C261xY-B.d.cts → index-jwRcC2QD.d.cts} +1 -1
  23. package/dist/mcp/index.d.cts +3 -3
  24. package/dist/mcp/index.d.ts +3 -3
  25. package/dist/react/index.cjs +49 -49
  26. package/dist/react/index.d.cts +25 -5
  27. package/dist/react/index.d.ts +25 -5
  28. package/dist/react/index.js +4 -4
  29. package/dist/tools/anthropic/index.d.cts +1 -1
  30. package/dist/tools/anthropic/index.d.ts +1 -1
  31. package/dist/tools/brave/index.cjs +2 -2
  32. package/dist/tools/brave/index.d.cts +1 -1
  33. package/dist/tools/brave/index.d.ts +1 -1
  34. package/dist/tools/brave/index.js +1 -1
  35. package/dist/tools/exa/index.cjs +2 -2
  36. package/dist/tools/exa/index.d.cts +1 -1
  37. package/dist/tools/exa/index.d.ts +1 -1
  38. package/dist/tools/exa/index.js +1 -1
  39. package/dist/tools/google/index.cjs +2 -2
  40. package/dist/tools/google/index.d.cts +1 -1
  41. package/dist/tools/google/index.d.ts +1 -1
  42. package/dist/tools/google/index.js +1 -1
  43. package/dist/tools/openai/index.cjs +2 -2
  44. package/dist/tools/openai/index.d.cts +1 -1
  45. package/dist/tools/openai/index.d.ts +1 -1
  46. package/dist/tools/openai/index.js +1 -1
  47. package/dist/tools/searxng/index.cjs +2 -2
  48. package/dist/tools/searxng/index.d.cts +1 -1
  49. package/dist/tools/searxng/index.d.ts +1 -1
  50. package/dist/tools/searxng/index.js +1 -1
  51. package/dist/tools/serper/index.cjs +2 -2
  52. package/dist/tools/serper/index.d.cts +1 -1
  53. package/dist/tools/serper/index.d.ts +1 -1
  54. package/dist/tools/serper/index.js +1 -1
  55. package/dist/tools/tavily/index.cjs +2 -2
  56. package/dist/tools/tavily/index.d.cts +1 -1
  57. package/dist/tools/tavily/index.d.ts +1 -1
  58. package/dist/tools/tavily/index.js +1 -1
  59. package/dist/tools/web-search/index.cjs +3 -3
  60. package/dist/tools/web-search/index.d.cts +2 -2
  61. package/dist/tools/web-search/index.d.ts +2 -2
  62. package/dist/tools/web-search/index.js +2 -2
  63. package/dist/{tools-Clyufshc.d.cts → tools-BHQRB_YT.d.cts} +5 -0
  64. package/dist/{tools-Clyufshc.d.ts → tools-BHQRB_YT.d.ts} +5 -0
  65. package/dist/{types-DM6M_pv_.d.cts → types-8_Hp2rmm.d.cts} +1 -1
  66. package/dist/{types-wudOhedT.d.ts → types-OYi-iUVY.d.ts} +1 -1
  67. package/dist/ui/index.cjs +39 -18
  68. package/dist/ui/index.cjs.map +1 -1
  69. package/dist/ui/index.d.cts +6 -1
  70. package/dist/ui/index.d.ts +6 -1
  71. package/dist/ui/index.js +35 -14
  72. package/dist/ui/index.js.map +1 -1
  73. package/package.json +1 -1
  74. package/dist/chunk-5UMM5VYB.cjs.map +0 -1
  75. package/dist/chunk-SNI7VN2U.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { failure } from '../../chunk-BRUDSHCV.js';
1
+ import { failure } from '../../chunk-BMYNG3WM.js';
2
2
  import { formatSearchResultsForAI, summarizeSearchResults } from '../../chunk-XGITAEXU.js';
3
3
  import '../../chunk-7W7QLZNC.js';
4
4
  import { searchSerper } from '../../chunk-CEOMTQTP.js';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkHNRFRNMY_cjs = require('../../chunk-HNRFRNMY.cjs');
3
+ var chunkCSEZZ5DX_cjs = require('../../chunk-CSEZZ5DX.cjs');
4
4
  var chunkASV6JLYG_cjs = require('../../chunk-ASV6JLYG.cjs');
5
5
  var chunkCBAHCI4R_cjs = require('../../chunk-CBAHCI4R.cjs');
6
6
  require('../../chunk-MEBXW75C.cjs');
@@ -76,7 +76,7 @@ function tavilySearch(config) {
76
76
  };
77
77
  } catch (error) {
78
78
  const errorMessage = error instanceof Error ? error.message : "Web search failed";
79
- return chunkHNRFRNMY_cjs.failure(errorMessage);
79
+ return chunkCSEZZ5DX_cjs.failure(errorMessage);
80
80
  }
81
81
  }
82
82
  };
@@ -1,4 +1,4 @@
1
- import { T as ToolDefinition } from '../../tools-Clyufshc.cjs';
1
+ import { T as ToolDefinition } from '../../tools-BHQRB_YT.cjs';
2
2
  export { t as tavilyProvider } from '../../tavily-C8cXXojE.cjs';
3
3
  import '../../types-ZguuKEs_.cjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { T as ToolDefinition } from '../../tools-Clyufshc.js';
1
+ import { T as ToolDefinition } from '../../tools-BHQRB_YT.js';
2
2
  export { t as tavilyProvider } from '../../tavily-DdSGVgkE.js';
3
3
  import '../../types-ZguuKEs_.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { failure } from '../../chunk-BRUDSHCV.js';
1
+ import { failure } from '../../chunk-BMYNG3WM.js';
2
2
  import { formatSearchResultsForAI, summarizeSearchResults } from '../../chunk-XGITAEXU.js';
3
3
  import { searchTavily } from '../../chunk-7W7QLZNC.js';
4
4
  export { tavilyProvider } from '../../chunk-7W7QLZNC.js';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkO33I4HBL_cjs = require('../../chunk-O33I4HBL.cjs');
4
- require('../../chunk-HNRFRNMY.cjs');
3
+ var chunkGSTTJ46F_cjs = require('../../chunk-GSTTJ46F.cjs');
4
+ require('../../chunk-CSEZZ5DX.cjs');
5
5
  var chunkASV6JLYG_cjs = require('../../chunk-ASV6JLYG.cjs');
6
6
  require('../../chunk-CBAHCI4R.cjs');
7
7
  require('../../chunk-MEBXW75C.cjs');
@@ -17,7 +17,7 @@ require('../../chunk-JEQ2X3Z6.cjs');
17
17
 
18
18
  Object.defineProperty(exports, "webSearchTool", {
19
19
  enumerable: true,
20
- get: function () { return chunkO33I4HBL_cjs.webSearchTool; }
20
+ get: function () { return chunkGSTTJ46F_cjs.webSearchTool; }
21
21
  });
22
22
  Object.defineProperty(exports, "formatSearchResultsForAI", {
23
23
  enumerable: true,
@@ -1,3 +1,3 @@
1
1
  export { b as WebSearchConfig, e as WebSearchImage, c as WebSearchParams, a as WebSearchProvider, W as WebSearchProviderInterface, f as WebSearchResponse, d as WebSearchResult } from '../../types-ZguuKEs_.cjs';
2
- export { f as formatSearchResultsForAI, s as summarizeSearchResults, w as webSearchTool } from '../../index-C261xY-B.cjs';
3
- import '../../tools-Clyufshc.cjs';
2
+ export { f as formatSearchResultsForAI, s as summarizeSearchResults, w as webSearchTool } from '../../index-jwRcC2QD.cjs';
3
+ import '../../tools-BHQRB_YT.cjs';
@@ -1,3 +1,3 @@
1
1
  export { b as WebSearchConfig, e as WebSearchImage, c as WebSearchParams, a as WebSearchProvider, W as WebSearchProviderInterface, f as WebSearchResponse, d as WebSearchResult } from '../../types-ZguuKEs_.js';
2
- export { f as formatSearchResultsForAI, s as summarizeSearchResults, w as webSearchTool } from '../../index-25qIYJ21.js';
3
- import '../../tools-Clyufshc.js';
2
+ export { f as formatSearchResultsForAI, s as summarizeSearchResults, w as webSearchTool } from '../../index-Du3Akr_E.js';
3
+ import '../../tools-BHQRB_YT.js';
@@ -1,5 +1,5 @@
1
- export { webSearchTool } from '../../chunk-7YZVSG62.js';
2
- import '../../chunk-BRUDSHCV.js';
1
+ export { webSearchTool } from '../../chunk-VUHP6TAN.js';
2
+ import '../../chunk-BMYNG3WM.js';
3
3
  export { formatSearchResultsForAI, summarizeSearchResults } from '../../chunk-XGITAEXU.js';
4
4
  import '../../chunk-7W7QLZNC.js';
5
5
  import '../../chunk-CEOMTQTP.js';
@@ -532,6 +532,11 @@ interface ToolExecution {
532
532
  approvalMessage?: string;
533
533
  /** Timestamp when user responded to approval request */
534
534
  approvalTimestamp?: number;
535
+ /**
536
+ * Whether this tool execution should be hidden from the UI.
537
+ * Server-side tools can set this to hide internal operations from users.
538
+ */
539
+ hidden?: boolean;
535
540
  }
536
541
  /**
537
542
  * Agentic loop configuration
@@ -532,6 +532,11 @@ interface ToolExecution {
532
532
  approvalMessage?: string;
533
533
  /** Timestamp when user responded to approval request */
534
534
  approvalTimestamp?: number;
535
+ /**
536
+ * Whether this tool execution should be hidden from the UI.
537
+ * Server-side tools can set this to hide internal operations from users.
538
+ */
539
+ hidden?: boolean;
535
540
  }
536
541
  /**
537
542
  * Agentic loop configuration
@@ -1,4 +1,4 @@
1
- import { T as ToolDefinition } from './tools-Clyufshc.cjs';
1
+ import { T as ToolDefinition } from './tools-BHQRB_YT.cjs';
2
2
 
3
3
  /**
4
4
  * MCP (Model Context Protocol) Type Definitions
@@ -1,4 +1,4 @@
1
- import { T as ToolDefinition } from './tools-Clyufshc.js';
1
+ import { T as ToolDefinition } from './tools-BHQRB_YT.js';
2
2
 
3
3
  /**
4
4
  * MCP (Model Context Protocol) Type Definitions
package/dist/ui/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunk5UMM5VYB_cjs = require('../chunk-5UMM5VYB.cjs');
4
- var chunk33JSFVGH_cjs = require('../chunk-33JSFVGH.cjs');
3
+ var chunkBNBEKK3U_cjs = require('../chunk-BNBEKK3U.cjs');
4
+ var chunk7MZLBGFQ_cjs = require('../chunk-7MZLBGFQ.cjs');
5
5
  var chunkJO4BHPAD_cjs = require('../chunk-JO4BHPAD.cjs');
6
6
  require('../chunk-JGPDQDY4.cjs');
7
- require('../chunk-O33I4HBL.cjs');
8
- require('../chunk-HNRFRNMY.cjs');
7
+ require('../chunk-GSTTJ46F.cjs');
8
+ require('../chunk-CSEZZ5DX.cjs');
9
9
  require('../chunk-ASV6JLYG.cjs');
10
10
  require('../chunk-CBAHCI4R.cjs');
11
11
  require('../chunk-MEBXW75C.cjs');
@@ -4363,15 +4363,16 @@ function DefaultMessage({
4363
4363
  }
4364
4364
  );
4365
4365
  }
4366
- const isToolHidden = (toolName) => {
4367
- const toolDef = registeredTools?.find((t) => t.name === toolName);
4366
+ const isToolHidden = (exec) => {
4367
+ if (exec.hidden === true) return true;
4368
+ const toolDef = registeredTools?.find((t) => t.name === exec.name);
4368
4369
  return toolDef?.hidden === true;
4369
4370
  };
4370
4371
  const pendingApprovalTools = message.toolExecutions?.filter(
4371
- (exec) => exec.approvalStatus === "required" && !isToolHidden(exec.name)
4372
+ (exec) => exec.approvalStatus === "required" && !isToolHidden(exec)
4372
4373
  );
4373
4374
  const completedTools = message.toolExecutions?.filter(
4374
- (exec) => exec.approvalStatus !== "required" && !isToolHidden(exec.name)
4375
+ (exec) => exec.approvalStatus !== "required" && !isToolHidden(exec)
4375
4376
  );
4376
4377
  const hasCustomRender = (toolName, execSource) => {
4377
4378
  if (toolRenderers?.[toolName]) return true;
@@ -4508,7 +4509,7 @@ function DefaultMessage({
4508
4509
  children: /* @__PURE__ */ jsxRuntime.jsx(ToolSteps, { steps: toolSteps })
4509
4510
  }
4510
4511
  ),
4511
- message.toolExecutions?.filter((exec) => !isToolHidden(exec.name)).map((exec) => {
4512
+ message.toolExecutions?.filter((exec) => !isToolHidden(exec)).map((exec) => {
4512
4513
  const uiResources = exec.result?._uiResources;
4513
4514
  if (!uiResources || uiResources.length === 0) return null;
4514
4515
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -5944,7 +5945,7 @@ function useInternalThreadManager(config = {}) {
5944
5945
  saveDebounce,
5945
5946
  autoRestoreLastThread
5946
5947
  };
5947
- const threadManager = chunk5UMM5VYB_cjs.useThreadManager(threadManagerConfig);
5948
+ const threadManager = chunkBNBEKK3U_cjs.useThreadManager(threadManagerConfig);
5948
5949
  const {
5949
5950
  currentThread,
5950
5951
  currentThreadId,
@@ -5954,7 +5955,7 @@ function useInternalThreadManager(config = {}) {
5954
5955
  clearCurrentThread,
5955
5956
  refreshThreads
5956
5957
  } = threadManager;
5957
- const { messages, setMessages, status, isLoading } = chunk5UMM5VYB_cjs.useCopilot();
5958
+ const { messages, setMessages, status, isLoading } = chunkBNBEKK3U_cjs.useCopilot();
5958
5959
  const isLoadingMessagesRef = React20.useRef(false);
5959
5960
  const savingToThreadRef = React20.useRef(null);
5960
5961
  const lastSavedSnapshotRef = React20.useRef("");
@@ -6121,7 +6122,7 @@ function parsePersistenceConfig(persistence, onThreadChange) {
6121
6122
  };
6122
6123
  case "server":
6123
6124
  return {
6124
- adapter: chunk33JSFVGH_cjs.createServerAdapter({
6125
+ adapter: chunk7MZLBGFQ_cjs.createServerAdapter({
6125
6126
  endpoint: persistence.endpoint,
6126
6127
  headers: persistence.headers
6127
6128
  }),
@@ -6171,7 +6172,7 @@ function CopilotChatBase(props) {
6171
6172
  approveToolExecution,
6172
6173
  rejectToolExecution,
6173
6174
  registeredTools
6174
- } = chunk5UMM5VYB_cjs.useCopilot();
6175
+ } = chunkBNBEKK3U_cjs.useCopilot();
6175
6176
  const toolExecutions = rawToolExecutions.map(
6176
6177
  (exec) => ({
6177
6178
  id: exec.id,
@@ -6181,7 +6182,8 @@ function CopilotChatBase(props) {
6181
6182
  result: exec.result,
6182
6183
  error: exec.error,
6183
6184
  timestamp: exec.startedAt ? exec.startedAt.getTime() : Date.now(),
6184
- approvalStatus: exec.approvalStatus
6185
+ approvalStatus: exec.approvalStatus,
6186
+ hidden: exec.hidden
6185
6187
  })
6186
6188
  );
6187
6189
  const toolResultsMap = /* @__PURE__ */ new Map();
@@ -6215,6 +6217,7 @@ function CopilotChatBase(props) {
6215
6217
  }
6216
6218
  );
6217
6219
  } else {
6220
+ const toolCallsHidden = m.metadata?.toolCallsHidden;
6218
6221
  messageToolExecutions = m.toolCalls.map(
6219
6222
  (tc) => {
6220
6223
  const resultContent = toolResultsMap.get(tc.id);
@@ -6231,14 +6234,22 @@ function CopilotChatBase(props) {
6231
6234
  args = JSON.parse(tc.function.arguments || "{}");
6232
6235
  } catch {
6233
6236
  }
6237
+ let hidden = toolCallsHidden?.[tc.id];
6238
+ if (hidden === void 0) {
6239
+ const toolDef = registeredTools?.find(
6240
+ (t) => t.name === tc.function.name
6241
+ );
6242
+ hidden = toolDef?.hidden;
6243
+ }
6234
6244
  return {
6235
6245
  id: tc.id,
6236
6246
  name: tc.function.name,
6237
6247
  args,
6238
6248
  status: result ? "completed" : "pending",
6239
6249
  result,
6240
- timestamp: Date.now()
6250
+ timestamp: Date.now(),
6241
6251
  // Historical - use current time
6252
+ hidden
6242
6253
  };
6243
6254
  }
6244
6255
  );
@@ -6248,6 +6259,9 @@ function CopilotChatBase(props) {
6248
6259
  if (savedExecutions && savedExecutions.length > 0 && !messageToolExecutions) {
6249
6260
  messageToolExecutions = savedExecutions;
6250
6261
  }
6262
+ const visibleToolExecutions = messageToolExecutions?.filter(
6263
+ (exec) => !exec.hidden
6264
+ );
6251
6265
  return {
6252
6266
  id: m.id,
6253
6267
  role: m.role,
@@ -6257,11 +6271,18 @@ function CopilotChatBase(props) {
6257
6271
  attachments: m.attachments,
6258
6272
  // Include tool_calls for assistant messages
6259
6273
  tool_calls: m.toolCalls,
6260
- // Attach matched tool executions to assistant messages
6261
- toolExecutions: messageToolExecutions,
6274
+ // Attach matched tool executions to assistant messages (only visible ones)
6275
+ toolExecutions: visibleToolExecutions,
6262
6276
  // Include metadata (citations from native web search, etc.)
6263
- metadata: m.metadata
6277
+ metadata: m.metadata,
6278
+ // Mark if this message had only hidden tools (for filtering empty bubbles)
6279
+ _hasOnlyHiddenTools: messageToolExecutions && messageToolExecutions.length > 0 && (!visibleToolExecutions || visibleToolExecutions.length === 0)
6264
6280
  };
6281
+ }).filter((m) => {
6282
+ if (m.role === "assistant" && !m.content && m._hasOnlyHiddenTools) {
6283
+ return false;
6284
+ }
6285
+ return true;
6265
6286
  });
6266
6287
  const suggestions = visibleMessages.length === 0 && chatProps.suggestions?.length ? chatProps.suggestions : [];
6267
6288
  const lastMessage = messages[messages.length - 1];