@copilotkit/react-core 1.50.0-beta.7 → 1.50.0-beta.8

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.
@@ -43,7 +43,7 @@ import {
43
43
  } from "../chunk-ZVF5Q6IH.mjs";
44
44
  import {
45
45
  useCopilotReadable
46
- } from "../chunk-2CYJN455.mjs";
46
+ } from "../chunk-RQ6LWR6S.mjs";
47
47
  import {
48
48
  useCopilotRuntimeClient
49
49
  } from "../chunk-6ESSSQ7Q.mjs";
@@ -1,3 +1,4 @@
1
+ type DataType = object | number | string | boolean | null | undefined;
1
2
  /**
2
3
  * Options for the useCopilotReadable hook.
3
4
  */
@@ -9,7 +10,7 @@ interface UseCopilotReadableOptions {
9
10
  /**
10
11
  * The value to be added to the Copilot context. Object values are automatically stringified.
11
12
  */
12
- value: any;
13
+ value: DataType | Record<string, any> | DataType[];
13
14
  /**
14
15
  * The ID of the parent context, if any.
15
16
  */
@@ -27,11 +28,11 @@ interface UseCopilotReadableOptions {
27
28
  * A custom conversion function to use to serialize the value to a string. If not provided, the value
28
29
  * will be serialized using `JSON.stringify`.
29
30
  */
30
- convert?: (description: string, value: any) => string;
31
+ convert?: (value: any) => string;
31
32
  }
32
33
  /**
33
34
  * Adds the given information to the Copilot context to make it readable by Copilot.
34
35
  */
35
- declare function useCopilotReadable({ description, value }: UseCopilotReadableOptions, dependencies?: any[]): undefined;
36
+ declare function useCopilotReadable({ description, value, convert, available }: UseCopilotReadableOptions, dependencies?: any[]): string | undefined;
36
37
 
37
38
  export { UseCopilotReadableOptions, useCopilotReadable };
@@ -24,12 +24,35 @@ __export(use_copilot_readable_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(use_copilot_readable_exports);
26
26
  var import_react = require("@copilotkitnext/react");
27
- function useCopilotReadable({ description, value }, dependencies) {
28
- (0, import_react.useAgentContext)({
29
- description,
30
- value
31
- });
32
- return;
27
+ var import_react2 = require("react");
28
+ function useCopilotReadable({ description, value, convert, available }, dependencies) {
29
+ const { copilotkit } = (0, import_react.useCopilotKit)();
30
+ const ctxIdRef = (0, import_react2.useRef)(void 0);
31
+ (0, import_react2.useEffect)(() => {
32
+ if (!copilotkit)
33
+ return;
34
+ const found = Object.entries(copilotkit.context).find(([id, ctxItem]) => {
35
+ return JSON.stringify({ description, value }) == JSON.stringify(ctxItem);
36
+ });
37
+ if (found) {
38
+ ctxIdRef.current = found[0];
39
+ if (available === "disabled")
40
+ copilotkit.removeContext(ctxIdRef.current);
41
+ return;
42
+ }
43
+ if (!found && available === "disabled")
44
+ return;
45
+ ctxIdRef.current = copilotkit.addContext({
46
+ description,
47
+ value: (convert != null ? convert : JSON.stringify)(value)
48
+ });
49
+ return () => {
50
+ if (!ctxIdRef.current)
51
+ return;
52
+ copilotkit.removeContext(ctxIdRef.current);
53
+ };
54
+ }, [description, value, convert]);
55
+ return ctxIdRef.current;
33
56
  }
34
57
  // Annotate the CommonJS export names for ESM import in node:
35
58
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/use-copilot-readable.ts"],"sourcesContent":["/**\n * `useCopilotReadable` is a React hook that provides app-state and other information\n * to the Copilot. Optionally, the hook can also handle hierarchical state within your\n * application, passing these parent-child relationships to the Copilot.\n *\n * ## Usage\n *\n * ### Simple Usage\n *\n * In its most basic usage, useCopilotReadable accepts a single string argument\n * representing any piece of app state, making it available for the Copilot to use\n * as context when responding to user input.\n *\n * ```tsx\n * import { useCopilotReadable } from \"@copilotkit/react-core\";\n *\n * export function MyComponent() {\n * const [employees, setEmployees] = useState([]);\n *\n * useCopilotReadable({\n * description: \"The list of employees\",\n * value: employees,\n * });\n * }\n * ```\n *\n * ### Nested Components\n *\n * Optionally, you can maintain the hierarchical structure of information by passing\n * `parentId`. This allows you to use `useCopilotReadable` in nested components:\n *\n * ```tsx /employeeContextId/1 {17,23}\n * import { useCopilotReadable } from \"@copilotkit/react-core\";\n *\n * function Employee(props: EmployeeProps) {\n * const { employeeName, workProfile, metadata } = props;\n *\n * // propagate any information to copilot\n * const employeeContextId = useCopilotReadable({\n * description: \"Employee name\",\n * value: employeeName\n * });\n *\n * // Pass a parentID to maintain a hierarchical structure.\n * // Especially useful with child React components, list elements, etc.\n * useCopilotReadable({\n * description: \"Work profile\",\n * value: workProfile.description(),\n * parentId: employeeContextId\n * });\n *\n * useCopilotReadable({\n * description: \"Employee metadata\",\n * value: metadata.description(),\n * parentId: employeeContextId\n * });\n *\n * return (\n * // Render as usual...\n * );\n * }\n * ```\n */\nimport { useEffect, useRef } from \"react\";\nimport { useCopilotContext } from \"../context/copilot-context\";\nimport { useAgentContext } from \"@copilotkitnext/react\";\n\n/**\n * Options for the useCopilotReadable hook.\n */\nexport interface UseCopilotReadableOptions {\n /**\n * The description of the information to be added to the Copilot context.\n */\n description: string;\n /**\n * The value to be added to the Copilot context. Object values are automatically stringified.\n */\n value: any;\n /**\n * The ID of the parent context, if any.\n */\n parentId?: string;\n /**\n * An array of categories to control which context are visible where. Particularly useful\n * with CopilotTextarea (see `useMakeAutosuggestionFunction`)\n */\n categories?: string[];\n\n /**\n * Whether the context is available to the Copilot.\n */\n available?: \"enabled\" | \"disabled\";\n\n /**\n * A custom conversion function to use to serialize the value to a string. If not provided, the value\n * will be serialized using `JSON.stringify`.\n */\n convert?: (description: string, value: any) => string;\n}\n\nfunction convertToJSON(description: string, value: any): string {\n return `${description}: ${typeof value === \"string\" ? value : JSON.stringify(value)}`;\n}\n\n/**\n * Adds the given information to the Copilot context to make it readable by Copilot.\n */\nexport function useCopilotReadable(\n { description, value }: UseCopilotReadableOptions,\n dependencies?: any[],\n): undefined {\n useAgentContext({\n description,\n value,\n });\n return;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiEA,mBAAgC;AA2CzB,SAAS,mBACd,EAAE,aAAa,MAAM,GACrB,cACW;AACX,oCAAgB;AAAA,IACd;AAAA,IACA;AAAA,EACF,CAAC;AACD;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/hooks/use-copilot-readable.ts"],"sourcesContent":["/**\n * `useCopilotReadable` is a React hook that provides app-state and other information\n * to the Copilot. Optionally, the hook can also handle hierarchical state within your\n * application, passing these parent-child relationships to the Copilot.\n *\n * ## Usage\n *\n * ### Simple Usage\n *\n * In its most basic usage, useCopilotReadable accepts a single string argument\n * representing any piece of app state, making it available for the Copilot to use\n * as context when responding to user input.\n *\n * ```tsx\n * import { useCopilotReadable } from \"@copilotkit/react-core\";\n *\n * export function MyComponent() {\n * const [employees, setEmployees] = useState([]);\n *\n * useCopilotReadable({\n * description: \"The list of employees\",\n * value: employees,\n * });\n * }\n * ```\n *\n * ### Nested Components\n *\n * Optionally, you can maintain the hierarchical structure of information by passing\n * `parentId`. This allows you to use `useCopilotReadable` in nested components:\n *\n * ```tsx /employeeContextId/1 {17,23}\n * import { useCopilotReadable } from \"@copilotkit/react-core\";\n *\n * function Employee(props: EmployeeProps) {\n * const { employeeName, workProfile, metadata } = props;\n *\n * // propagate any information to copilot\n * const employeeContextId = useCopilotReadable({\n * description: \"Employee name\",\n * value: employeeName\n * });\n *\n * // Pass a parentID to maintain a hierarchical structure.\n * // Especially useful with child React components, list elements, etc.\n * useCopilotReadable({\n * description: \"Work profile\",\n * value: workProfile.description(),\n * parentId: employeeContextId\n * });\n *\n * useCopilotReadable({\n * description: \"Employee metadata\",\n * value: metadata.description(),\n * parentId: employeeContextId\n * });\n *\n * return (\n * // Render as usual...\n * );\n * }\n * ```\n */\nimport { useCopilotKit } from \"@copilotkitnext/react\";\nimport { useEffect, useRef } from \"react\";\n\ntype DataType = object | number | string | boolean | null | undefined;\n\n/**\n * Options for the useCopilotReadable hook.\n */\nexport interface UseCopilotReadableOptions {\n /**\n * The description of the information to be added to the Copilot context.\n */\n description: string;\n /**\n * The value to be added to the Copilot context. Object values are automatically stringified.\n */\n value: DataType | Record<string, any> | DataType[];\n /**\n * The ID of the parent context, if any.\n */\n parentId?: string;\n /**\n * An array of categories to control which context are visible where. Particularly useful\n * with CopilotTextarea (see `useMakeAutosuggestionFunction`)\n */\n categories?: string[];\n\n /**\n * Whether the context is available to the Copilot.\n */\n available?: \"enabled\" | \"disabled\";\n\n /**\n * A custom conversion function to use to serialize the value to a string. If not provided, the value\n * will be serialized using `JSON.stringify`.\n */\n convert?: (value: any) => string;\n}\n\n/**\n * Adds the given information to the Copilot context to make it readable by Copilot.\n */\nexport function useCopilotReadable(\n { description, value, convert, available }: UseCopilotReadableOptions,\n dependencies?: any[],\n): string | undefined {\n const { copilotkit } = useCopilotKit();\n const ctxIdRef = useRef<string | undefined>(undefined);\n useEffect(() => {\n if (!copilotkit) return;\n\n const found = Object.entries(copilotkit.context).find(([id, ctxItem]) => {\n return JSON.stringify({ description, value }) == JSON.stringify(ctxItem);\n });\n if (found) {\n ctxIdRef.current = found[0];\n if (available === \"disabled\") copilotkit.removeContext(ctxIdRef.current);\n return;\n }\n if (!found && available === \"disabled\") return;\n\n ctxIdRef.current = copilotkit.addContext({\n description,\n value: (convert ?? JSON.stringify)(value),\n });\n\n return () => {\n if (!ctxIdRef.current) return;\n copilotkit.removeContext(ctxIdRef.current);\n };\n }, [description, value, convert]);\n\n return ctxIdRef.current;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+DA,mBAA8B;AAC9B,IAAAA,gBAAkC;AAyC3B,SAAS,mBACd,EAAE,aAAa,OAAO,SAAS,UAAU,GACzC,cACoB;AACpB,QAAM,EAAE,WAAW,QAAI,4BAAc;AACrC,QAAM,eAAW,sBAA2B,MAAS;AACrD,+BAAU,MAAM;AACd,QAAI,CAAC;AAAY;AAEjB,UAAM,QAAQ,OAAO,QAAQ,WAAW,OAAO,EAAE,KAAK,CAAC,CAAC,IAAI,OAAO,MAAM;AACvE,aAAO,KAAK,UAAU,EAAE,aAAa,MAAM,CAAC,KAAK,KAAK,UAAU,OAAO;AAAA,IACzE,CAAC;AACD,QAAI,OAAO;AACT,eAAS,UAAU,MAAM,CAAC;AAC1B,UAAI,cAAc;AAAY,mBAAW,cAAc,SAAS,OAAO;AACvE;AAAA,IACF;AACA,QAAI,CAAC,SAAS,cAAc;AAAY;AAExC,aAAS,UAAU,WAAW,WAAW;AAAA,MACvC;AAAA,MACA,QAAQ,4BAAW,KAAK,WAAW,KAAK;AAAA,IAC1C,CAAC;AAED,WAAO,MAAM;AACX,UAAI,CAAC,SAAS;AAAS;AACvB,iBAAW,cAAc,SAAS,OAAO;AAAA,IAC3C;AAAA,EACF,GAAG,CAAC,aAAa,OAAO,OAAO,CAAC;AAEhC,SAAO,SAAS;AAClB;","names":["import_react"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useCopilotReadable
3
- } from "../chunk-2CYJN455.mjs";
3
+ } from "../chunk-RQ6LWR6S.mjs";
4
4
  import "../chunk-SKC7AJIV.mjs";
5
5
  export {
6
6
  useCopilotReadable
package/dist/index.js CHANGED
@@ -4420,22 +4420,45 @@ function useMakeCopilotDocumentReadable(document2, categories, dependencies = []
4420
4420
 
4421
4421
  // src/hooks/use-copilot-readable.ts
4422
4422
  var import_react39 = require("@copilotkitnext/react");
4423
- function useCopilotReadable({ description, value }, dependencies) {
4424
- (0, import_react39.useAgentContext)({
4425
- description,
4426
- value
4427
- });
4428
- return;
4423
+ var import_react40 = require("react");
4424
+ function useCopilotReadable({ description, value, convert, available }, dependencies) {
4425
+ const { copilotkit } = (0, import_react39.useCopilotKit)();
4426
+ const ctxIdRef = (0, import_react40.useRef)(void 0);
4427
+ (0, import_react40.useEffect)(() => {
4428
+ if (!copilotkit)
4429
+ return;
4430
+ const found = Object.entries(copilotkit.context).find(([id, ctxItem]) => {
4431
+ return JSON.stringify({ description, value }) == JSON.stringify(ctxItem);
4432
+ });
4433
+ if (found) {
4434
+ ctxIdRef.current = found[0];
4435
+ if (available === "disabled")
4436
+ copilotkit.removeContext(ctxIdRef.current);
4437
+ return;
4438
+ }
4439
+ if (!found && available === "disabled")
4440
+ return;
4441
+ ctxIdRef.current = copilotkit.addContext({
4442
+ description,
4443
+ value: (convert != null ? convert : JSON.stringify)(value)
4444
+ });
4445
+ return () => {
4446
+ if (!ctxIdRef.current)
4447
+ return;
4448
+ copilotkit.removeContext(ctxIdRef.current);
4449
+ };
4450
+ }, [description, value, convert]);
4451
+ return ctxIdRef.current;
4429
4452
  }
4430
4453
 
4431
4454
  // src/hooks/use-coagent.ts
4432
- var import_react40 = require("react");
4433
- var import_react41 = require("@copilotkitnext/react");
4455
+ var import_react41 = require("react");
4456
+ var import_react42 = require("@copilotkitnext/react");
4434
4457
  function useCoAgent(options) {
4435
- const { agent } = (0, import_react41.useAgent)({ agentId: options.name });
4436
- const { copilotkit } = (0, import_react41.useCopilotKit)();
4458
+ const { agent } = (0, import_react42.useAgent)({ agentId: options.name });
4459
+ const { copilotkit } = (0, import_react42.useCopilotKit)();
4437
4460
  const nodeName = useAgentNodeName(options.name);
4438
- const handleStateUpdate = (0, import_react40.useCallback)(
4461
+ const handleStateUpdate = (0, import_react41.useCallback)(
4439
4462
  (newState) => {
4440
4463
  if (!agent)
4441
4464
  return;
@@ -4448,7 +4471,7 @@ function useCoAgent(options) {
4448
4471
  },
4449
4472
  [agent == null ? void 0 : agent.state, agent == null ? void 0 : agent.setState]
4450
4473
  );
4451
- (0, import_react40.useEffect)(() => {
4474
+ (0, import_react41.useEffect)(() => {
4452
4475
  var _a;
4453
4476
  if (!options.config && !options.configurable)
4454
4477
  return;
@@ -4460,22 +4483,22 @@ function useCoAgent(options) {
4460
4483
  }
4461
4484
  copilotkit.setProperties(config);
4462
4485
  }, [options.config, options.configurable]);
4463
- const externalStateStr = (0, import_react40.useMemo)(
4486
+ const externalStateStr = (0, import_react41.useMemo)(
4464
4487
  () => isExternalStateManagement(options) ? JSON.stringify(options.state) : void 0,
4465
4488
  [isExternalStateManagement(options) ? JSON.stringify(options.state) : void 0]
4466
4489
  );
4467
- (0, import_react40.useEffect)(() => {
4490
+ (0, import_react41.useEffect)(() => {
4468
4491
  if ((agent == null ? void 0 : agent.state) && isExternalStateManagement(options) && JSON.stringify(options.state) !== JSON.stringify(agent.state)) {
4469
4492
  handleStateUpdate(options.state);
4470
4493
  }
4471
4494
  }, [agent, externalStateStr, handleStateUpdate]);
4472
- const hasStateValues = (0, import_react40.useCallback)((value) => {
4495
+ const hasStateValues = (0, import_react41.useCallback)((value) => {
4473
4496
  return Boolean(value && Object.keys(value).length);
4474
4497
  }, []);
4475
- const initialStateRef = (0, import_react40.useRef)(
4498
+ const initialStateRef = (0, import_react41.useRef)(
4476
4499
  isExternalStateManagement(options) ? options.state : "initialState" in options ? options.initialState : void 0
4477
4500
  );
4478
- (0, import_react40.useEffect)(() => {
4501
+ (0, import_react41.useEffect)(() => {
4479
4502
  if (isExternalStateManagement(options)) {
4480
4503
  initialStateRef.current = options.state;
4481
4504
  } else if ("initialState" in options) {
@@ -4484,7 +4507,7 @@ function useCoAgent(options) {
4484
4507
  }, [
4485
4508
  isExternalStateManagement(options) ? JSON.stringify(options.state) : "initialState" in options ? JSON.stringify(options.initialState) : void 0
4486
4509
  ]);
4487
- (0, import_react40.useEffect)(() => {
4510
+ (0, import_react41.useEffect)(() => {
4488
4511
  if (!agent)
4489
4512
  return;
4490
4513
  const subscriber = {
@@ -4512,7 +4535,7 @@ function useCoAgent(options) {
4512
4535
  subscription.unsubscribe();
4513
4536
  };
4514
4537
  }, [agent, handleStateUpdate, hasStateValues]);
4515
- return (0, import_react40.useMemo)(() => {
4538
+ return (0, import_react41.useMemo)(() => {
4516
4539
  var _a, _b, _c;
4517
4540
  if (!agent) {
4518
4541
  const noop = () => {
@@ -4568,12 +4591,12 @@ var isExternalStateManagement = (options) => {
4568
4591
 
4569
4592
  // src/hooks/use-copilot-runtime-client.ts
4570
4593
  var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
4571
- var import_react42 = require("react");
4594
+ var import_react43 = require("react");
4572
4595
  var import_shared22 = require("@copilotkit/shared");
4573
4596
  var useCopilotRuntimeClient = (options) => {
4574
4597
  const { setBannerError } = useToast();
4575
4598
  const _a = options, { showDevConsole, onError } = _a, runtimeOptions = __objRest(_a, ["showDevConsole", "onError"]);
4576
- const lastStructuredErrorRef = (0, import_react42.useRef)(null);
4599
+ const lastStructuredErrorRef = (0, import_react43.useRef)(null);
4577
4600
  const traceUIError = (error, originalError) => __async(void 0, null, function* () {
4578
4601
  try {
4579
4602
  const errorEvent = {
@@ -4599,7 +4622,7 @@ var useCopilotRuntimeClient = (options) => {
4599
4622
  console.error("Error in onError handler:", error2);
4600
4623
  }
4601
4624
  });
4602
- const runtimeClient = (0, import_react42.useMemo)(() => {
4625
+ const runtimeClient = (0, import_react43.useMemo)(() => {
4603
4626
  return new import_runtime_client_gql3.CopilotRuntimeClient(__spreadProps(__spreadValues({}, runtimeOptions), {
4604
4627
  handleGQLErrors: (error) => {
4605
4628
  var _a2;
@@ -4678,28 +4701,28 @@ function createStructuredError(gqlError) {
4678
4701
  }
4679
4702
 
4680
4703
  // src/hooks/use-copilot-authenticated-action.ts
4681
- var import_react43 = require("react");
4682
- var import_react44 = __toESM(require("react"));
4704
+ var import_react44 = require("react");
4705
+ var import_react45 = __toESM(require("react"));
4683
4706
  function useCopilotAuthenticatedAction_c(action, dependencies) {
4684
4707
  const { authConfig_c, authStates_c, setAuthStates_c } = useCopilotContext();
4685
- const pendingActionRef = (0, import_react43.useRef)(null);
4686
- const executeAction = (0, import_react43.useCallback)(
4708
+ const pendingActionRef = (0, import_react44.useRef)(null);
4709
+ const executeAction = (0, import_react44.useCallback)(
4687
4710
  (props) => {
4688
4711
  if (typeof action.render === "function") {
4689
4712
  return action.render(props);
4690
4713
  }
4691
- return action.render || import_react44.default.createElement(import_react43.Fragment);
4714
+ return action.render || import_react45.default.createElement(import_react44.Fragment);
4692
4715
  },
4693
4716
  [action]
4694
4717
  );
4695
- const wrappedRender = (0, import_react43.useCallback)(
4718
+ const wrappedRender = (0, import_react44.useCallback)(
4696
4719
  (props) => {
4697
4720
  const isAuthenticated = Object.values(authStates_c || {}).some(
4698
4721
  (state) => state.status === "authenticated"
4699
4722
  );
4700
4723
  if (!isAuthenticated) {
4701
4724
  pendingActionRef.current = props;
4702
- return (authConfig_c == null ? void 0 : authConfig_c.SignInComponent) ? import_react44.default.createElement(authConfig_c.SignInComponent, {
4725
+ return (authConfig_c == null ? void 0 : authConfig_c.SignInComponent) ? import_react45.default.createElement(authConfig_c.SignInComponent, {
4703
4726
  onSignInComplete: (authState) => {
4704
4727
  setAuthStates_c == null ? void 0 : setAuthStates_c((prev) => __spreadProps(__spreadValues({}, prev), { [action.name]: authState }));
4705
4728
  if (pendingActionRef.current) {
@@ -4707,7 +4730,7 @@ function useCopilotAuthenticatedAction_c(action, dependencies) {
4707
4730
  pendingActionRef.current = null;
4708
4731
  }
4709
4732
  }
4710
- }) : import_react44.default.createElement(import_react43.Fragment);
4733
+ }) : import_react45.default.createElement(import_react44.Fragment);
4711
4734
  }
4712
4735
  return executeAction(props);
4713
4736
  },
@@ -4722,13 +4745,13 @@ function useCopilotAuthenticatedAction_c(action, dependencies) {
4722
4745
  }
4723
4746
 
4724
4747
  // src/hooks/use-langgraph-interrupt.ts
4725
- var import_react45 = require("react");
4748
+ var import_react46 = require("react");
4726
4749
  var import_shared23 = require("@copilotkit/shared");
4727
4750
  function useLangGraphInterrupt(action, dependencies) {
4728
- const { setInterruptAction, removeInterruptAction, interruptActions, threadId } = (0, import_react45.useContext)(CopilotContext);
4751
+ const { setInterruptAction, removeInterruptAction, interruptActions, threadId } = (0, import_react46.useContext)(CopilotContext);
4729
4752
  const { addToast } = useToast();
4730
4753
  const actionId = (0, import_shared23.dataToUUID)(action, "lgAction");
4731
- (0, import_react45.useEffect)(() => {
4754
+ (0, import_react46.useEffect)(() => {
4732
4755
  if (!action)
4733
4756
  return;
4734
4757
  setInterruptAction(__spreadProps(__spreadValues({}, action), { id: actionId }));
@@ -4739,10 +4762,10 @@ function useLangGraphInterrupt(action, dependencies) {
4739
4762
  }
4740
4763
 
4741
4764
  // src/hooks/use-copilot-additional-instructions.ts
4742
- var import_react46 = require("react");
4765
+ var import_react47 = require("react");
4743
4766
  function useCopilotAdditionalInstructions({ instructions, available = "enabled" }, dependencies) {
4744
4767
  const { setAdditionalInstructions } = useCopilotContext();
4745
- (0, import_react46.useEffect)(() => {
4768
+ (0, import_react47.useEffect)(() => {
4746
4769
  if (available === "disabled")
4747
4770
  return;
4748
4771
  setAdditionalInstructions((prevInstructions) => [...prevInstructions || [], instructions]);