@yourgpt/copilot-sdk 1.2.10 → 1.3.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.
package/README.md CHANGED
@@ -15,7 +15,6 @@ npm install @yourgpt/copilot-sdk @yourgpt/llm-sdk
15
15
  ```tsx
16
16
  import { CopilotProvider } from "@yourgpt/copilot-sdk/react";
17
17
  import { CopilotChat } from "@yourgpt/copilot-sdk/ui";
18
- import "@yourgpt/copilot-sdk/ui/styles.css";
19
18
 
20
19
  function App() {
21
20
  return (
@@ -37,26 +36,36 @@ function App() {
37
36
 
38
37
  ## Styling (Tailwind CSS v4)
39
38
 
40
- Add the SDK source to your Tailwind config:
41
-
42
39
  ```css
43
40
  /* app/globals.css */
44
41
  @import "tailwindcss";
45
-
46
42
  @source "node_modules/@yourgpt/copilot-sdk/src/**/*.{ts,tsx}";
47
-
48
43
  @custom-variant dark (&:is(.dark *));
49
44
  ```
50
45
 
51
- For theming, optionally import the default CSS variables:
46
+ ## Theming
52
47
 
53
- ```css
54
- @import "@yourgpt/copilot-sdk/ui/styles.css";
48
+ Works automatically with existing shadcn/ui setup. For projects without shadcn:
49
+
50
+ ```tsx
51
+ import "@yourgpt/copilot-sdk/ui/styles.css";
52
+ import "@yourgpt/copilot-sdk/ui/themes/claude.css"; // Optional preset
53
+
54
+ <div className="csdk-theme-claude">
55
+ <CopilotChat />
56
+ </div>;
55
57
  ```
56
58
 
59
+ **8 theme presets available:** Claude, Vercel, Supabase, Twitter, Linear, PostHog, Catppuccin, Modern
60
+
57
61
  ## Documentation
58
62
 
59
- Visit [copilot-sdk.yourgpt.ai](https://copilot-sdk.yourgpt.ai)
63
+ Visit [copilot-sdk.yourgpt.ai](https://copilot-sdk.yourgpt.ai) for full documentation including:
64
+
65
+ - Theme customization & CSS variables
66
+ - Semantic CSS classes (`csdk-*`)
67
+ - Creating custom themes
68
+ - Dark mode support
60
69
 
61
70
  ## License
62
71
 
@@ -704,6 +704,14 @@ var AbstractChat = class {
704
704
  this.dynamicContext = context;
705
705
  this.debug("Context updated", { length: context.length });
706
706
  }
707
+ /**
708
+ * Set system prompt dynamically
709
+ * This allows updating the system prompt after initialization
710
+ */
711
+ setSystemPrompt(prompt) {
712
+ this.config.systemPrompt = prompt;
713
+ this.debug("System prompt updated", { length: prompt.length });
714
+ }
707
715
  /**
708
716
  * Build the request payload
709
717
  */
@@ -1483,6 +1491,12 @@ var ChatWithTools = class {
1483
1491
  setContext(context) {
1484
1492
  this.chat.setContext(context);
1485
1493
  }
1494
+ /**
1495
+ * Set system prompt dynamically
1496
+ */
1497
+ setSystemPrompt(prompt) {
1498
+ this.chat.setSystemPrompt(prompt);
1499
+ }
1486
1500
  // ============================================
1487
1501
  // Tool Registration
1488
1502
  // ============================================
@@ -1836,6 +1850,12 @@ function CopilotProvider({
1836
1850
  }
1837
1851
  );
1838
1852
  }
1853
+ react.useEffect(() => {
1854
+ if (chatRef.current && systemPrompt !== void 0) {
1855
+ chatRef.current.setSystemPrompt(systemPrompt);
1856
+ debugLog("System prompt updated from prop");
1857
+ }
1858
+ }, [systemPrompt, debugLog]);
1839
1859
  const messages = react.useSyncExternalStore(
1840
1860
  chatRef.current.subscribe,
1841
1861
  () => chatRef.current.messages,
@@ -1915,6 +1935,13 @@ function CopilotProvider({
1915
1935
  },
1916
1936
  [debugLog]
1917
1937
  );
1938
+ const setSystemPrompt = react.useCallback(
1939
+ (prompt) => {
1940
+ chatRef.current?.setSystemPrompt(prompt);
1941
+ debugLog("System prompt updated via function");
1942
+ },
1943
+ [debugLog]
1944
+ );
1918
1945
  const sendMessage = react.useCallback(
1919
1946
  async (content, attachments) => {
1920
1947
  debugLog("Sending message:", content);
@@ -1989,6 +2016,8 @@ function CopilotProvider({
1989
2016
  // AI Context
1990
2017
  addContext,
1991
2018
  removeContext,
2019
+ // System Prompt
2020
+ setSystemPrompt,
1992
2021
  // Config
1993
2022
  threadId,
1994
2023
  runtimeUrl,
@@ -2016,6 +2045,7 @@ function CopilotProvider({
2016
2045
  registeredActions,
2017
2046
  addContext,
2018
2047
  removeContext,
2048
+ setSystemPrompt,
2019
2049
  threadId,
2020
2050
  runtimeUrl,
2021
2051
  toolsConfig
@@ -3768,5 +3798,5 @@ exports.useToolExecutor = useToolExecutor;
3768
3798
  exports.useToolWithSchema = useToolWithSchema;
3769
3799
  exports.useTools = useTools;
3770
3800
  exports.useToolsWithSchema = useToolsWithSchema;
3771
- //# sourceMappingURL=chunk-MHLF2QXY.cjs.map
3772
- //# sourceMappingURL=chunk-MHLF2QXY.cjs.map
3801
+ //# sourceMappingURL=chunk-3427BQ4M.cjs.map
3802
+ //# sourceMappingURL=chunk-3427BQ4M.cjs.map