@yourgpt/copilot-sdk 2.1.0 → 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-MUZ2RYS2.cjs → chunk-BNBEKK3U.cjs} +226 -33
  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-3SP6V22Y.js → chunk-VXT2O6R6.js} +202 -9
  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 +130 -15
  27. package/dist/react/index.d.ts +130 -15
  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-3SP6V22Y.js.map +0 -1
  75. package/dist/chunk-MUZ2RYS2.cjs.map +0 -1
@@ -8,7 +8,7 @@ import { VariantProps } from 'class-variance-authority';
8
8
  import * as use_stick_to_bottom from 'use-stick-to-bottom';
9
9
  import { d as WebSearchResult, f as WebSearchResponse } from '../types-ZguuKEs_.cjs';
10
10
  import { T as Thread, b as ThreadStorageAdapter, A as AsyncThreadStorageAdapter } from '../types-DG2ya08y.cjs';
11
- import { T as ToolDefinition } from '../tools-Clyufshc.cjs';
11
+ import { T as ToolDefinition } from '../tools-BHQRB_YT.cjs';
12
12
  import { d as MCPUIIntent, n as MCPUIFrameProps, M as MCPUIResource } from '../types-B20VCJXL.cjs';
13
13
  import { ClassValue } from 'clsx';
14
14
 
@@ -1266,6 +1266,11 @@ interface ToolExecutionData {
1266
1266
  approvalMessage?: string;
1267
1267
  /** Data passed from user's approval action (e.g., selected item) */
1268
1268
  approvalData?: Record<string, unknown>;
1269
+ /**
1270
+ * Whether this tool execution should be hidden from the UI.
1271
+ * Server-side tools can set this to hide internal operations from users.
1272
+ */
1273
+ hidden?: boolean;
1269
1274
  }
1270
1275
 
1271
1276
  /**
@@ -8,7 +8,7 @@ import { VariantProps } from 'class-variance-authority';
8
8
  import * as use_stick_to_bottom from 'use-stick-to-bottom';
9
9
  import { d as WebSearchResult, f as WebSearchResponse } from '../types-ZguuKEs_.js';
10
10
  import { T as Thread, b as ThreadStorageAdapter, A as AsyncThreadStorageAdapter } from '../types-DG2ya08y.js';
11
- import { T as ToolDefinition } from '../tools-Clyufshc.js';
11
+ import { T as ToolDefinition } from '../tools-BHQRB_YT.js';
12
12
  import { d as MCPUIIntent, n as MCPUIFrameProps, M as MCPUIResource } from '../types-B20VCJXL.js';
13
13
  import { ClassValue } from 'clsx';
14
14
 
@@ -1266,6 +1266,11 @@ interface ToolExecutionData {
1266
1266
  approvalMessage?: string;
1267
1267
  /** Data passed from user's approval action (e.g., selected item) */
1268
1268
  approvalData?: Record<string, unknown>;
1269
+ /**
1270
+ * Whether this tool execution should be hidden from the UI.
1271
+ * Server-side tools can set this to hide internal operations from users.
1272
+ */
1273
+ hidden?: boolean;
1269
1274
  }
1270
1275
 
1271
1276
  /**
package/dist/ui/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { useCopilot, useThreadManager } from '../chunk-3SP6V22Y.js';
2
- import { createServerAdapter } from '../chunk-7PJ4GAJR.js';
1
+ import { useCopilot, useThreadManager } from '../chunk-VXT2O6R6.js';
2
+ import { createServerAdapter } from '../chunk-XAC7NTIO.js';
3
3
  import { DEFAULT_MCP_UI_SANDBOX, parseMCPUIMessage } from '../chunk-G4SF2PNQ.js';
4
4
  import '../chunk-EWVQWTNV.js';
5
- import '../chunk-7YZVSG62.js';
6
- import '../chunk-BRUDSHCV.js';
5
+ import '../chunk-VUHP6TAN.js';
6
+ import '../chunk-BMYNG3WM.js';
7
7
  import '../chunk-XGITAEXU.js';
8
8
  import '../chunk-7W7QLZNC.js';
9
9
  import '../chunk-CEOMTQTP.js';
@@ -4340,15 +4340,16 @@ function DefaultMessage({
4340
4340
  }
4341
4341
  );
4342
4342
  }
4343
- const isToolHidden = (toolName) => {
4344
- const toolDef = registeredTools?.find((t) => t.name === toolName);
4343
+ const isToolHidden = (exec) => {
4344
+ if (exec.hidden === true) return true;
4345
+ const toolDef = registeredTools?.find((t) => t.name === exec.name);
4345
4346
  return toolDef?.hidden === true;
4346
4347
  };
4347
4348
  const pendingApprovalTools = message.toolExecutions?.filter(
4348
- (exec) => exec.approvalStatus === "required" && !isToolHidden(exec.name)
4349
+ (exec) => exec.approvalStatus === "required" && !isToolHidden(exec)
4349
4350
  );
4350
4351
  const completedTools = message.toolExecutions?.filter(
4351
- (exec) => exec.approvalStatus !== "required" && !isToolHidden(exec.name)
4352
+ (exec) => exec.approvalStatus !== "required" && !isToolHidden(exec)
4352
4353
  );
4353
4354
  const hasCustomRender = (toolName, execSource) => {
4354
4355
  if (toolRenderers?.[toolName]) return true;
@@ -4485,7 +4486,7 @@ function DefaultMessage({
4485
4486
  children: /* @__PURE__ */ jsx(ToolSteps, { steps: toolSteps })
4486
4487
  }
4487
4488
  ),
4488
- message.toolExecutions?.filter((exec) => !isToolHidden(exec.name)).map((exec) => {
4489
+ message.toolExecutions?.filter((exec) => !isToolHidden(exec)).map((exec) => {
4489
4490
  const uiResources = exec.result?._uiResources;
4490
4491
  if (!uiResources || uiResources.length === 0) return null;
4491
4492
  return /* @__PURE__ */ jsx(
@@ -6158,7 +6159,8 @@ function CopilotChatBase(props) {
6158
6159
  result: exec.result,
6159
6160
  error: exec.error,
6160
6161
  timestamp: exec.startedAt ? exec.startedAt.getTime() : Date.now(),
6161
- approvalStatus: exec.approvalStatus
6162
+ approvalStatus: exec.approvalStatus,
6163
+ hidden: exec.hidden
6162
6164
  })
6163
6165
  );
6164
6166
  const toolResultsMap = /* @__PURE__ */ new Map();
@@ -6192,6 +6194,7 @@ function CopilotChatBase(props) {
6192
6194
  }
6193
6195
  );
6194
6196
  } else {
6197
+ const toolCallsHidden = m.metadata?.toolCallsHidden;
6195
6198
  messageToolExecutions = m.toolCalls.map(
6196
6199
  (tc) => {
6197
6200
  const resultContent = toolResultsMap.get(tc.id);
@@ -6208,14 +6211,22 @@ function CopilotChatBase(props) {
6208
6211
  args = JSON.parse(tc.function.arguments || "{}");
6209
6212
  } catch {
6210
6213
  }
6214
+ let hidden = toolCallsHidden?.[tc.id];
6215
+ if (hidden === void 0) {
6216
+ const toolDef = registeredTools?.find(
6217
+ (t) => t.name === tc.function.name
6218
+ );
6219
+ hidden = toolDef?.hidden;
6220
+ }
6211
6221
  return {
6212
6222
  id: tc.id,
6213
6223
  name: tc.function.name,
6214
6224
  args,
6215
6225
  status: result ? "completed" : "pending",
6216
6226
  result,
6217
- timestamp: Date.now()
6227
+ timestamp: Date.now(),
6218
6228
  // Historical - use current time
6229
+ hidden
6219
6230
  };
6220
6231
  }
6221
6232
  );
@@ -6225,6 +6236,9 @@ function CopilotChatBase(props) {
6225
6236
  if (savedExecutions && savedExecutions.length > 0 && !messageToolExecutions) {
6226
6237
  messageToolExecutions = savedExecutions;
6227
6238
  }
6239
+ const visibleToolExecutions = messageToolExecutions?.filter(
6240
+ (exec) => !exec.hidden
6241
+ );
6228
6242
  return {
6229
6243
  id: m.id,
6230
6244
  role: m.role,
@@ -6234,11 +6248,18 @@ function CopilotChatBase(props) {
6234
6248
  attachments: m.attachments,
6235
6249
  // Include tool_calls for assistant messages
6236
6250
  tool_calls: m.toolCalls,
6237
- // Attach matched tool executions to assistant messages
6238
- toolExecutions: messageToolExecutions,
6251
+ // Attach matched tool executions to assistant messages (only visible ones)
6252
+ toolExecutions: visibleToolExecutions,
6239
6253
  // Include metadata (citations from native web search, etc.)
6240
- metadata: m.metadata
6254
+ metadata: m.metadata,
6255
+ // Mark if this message had only hidden tools (for filtering empty bubbles)
6256
+ _hasOnlyHiddenTools: messageToolExecutions && messageToolExecutions.length > 0 && (!visibleToolExecutions || visibleToolExecutions.length === 0)
6241
6257
  };
6258
+ }).filter((m) => {
6259
+ if (m.role === "assistant" && !m.content && m._hasOnlyHiddenTools) {
6260
+ return false;
6261
+ }
6262
+ return true;
6242
6263
  });
6243
6264
  const suggestions = visibleMessages.length === 0 && chatProps.suggestions?.length ? chatProps.suggestions : [];
6244
6265
  const lastMessage = messages[messages.length - 1];