@copilotkit/react-core 1.77.2 → 1.78.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.
@@ -1655,7 +1655,7 @@ function useRenderToolCall() {
1655
1655
 
1656
1656
  //#endregion
1657
1657
  //#region package.json
1658
- var version = "1.77.2";
1658
+ var version = "1.78.0";
1659
1659
 
1660
1660
  //#endregion
1661
1661
  //#region src/v2/components/CopilotKitInspector.tsx
@@ -3415,8 +3415,9 @@ const DEFAULT_DESIGN_SKILL = `When generating UI with generateSandboxedUi, follo
3415
3415
  const DEFAULT_LEARNING = Object.freeze({});
3416
3416
  function toLearningConfig(learning) {
3417
3417
  if (learning === true) return DEFAULT_LEARNING;
3418
- if (learning === false) return void 0;
3419
- return learning;
3418
+ if (learning === false || learning === void 0) return void 0;
3419
+ const { autoStart: _autoStart, ...config } = learning;
3420
+ return config;
3420
3421
  }
3421
3422
  function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
3422
3423
  const empty = (0, react.useMemo)(() => [], []);
@@ -3428,7 +3429,7 @@ function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
3428
3429
  return value;
3429
3430
  }
3430
3431
  const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY_HEADERS, credentials, messageFilter, publicApiKey, publicLicenseKey, licenseToken, properties = EMPTY_PROPERTIES, agents__unsafe_dev_only: agents = EMPTY_AGENTS, selfManagedAgents = EMPTY_AGENTS, renderToolCalls, renderActivityMessages, renderCustomMessages, frontendTools, humanInTheLoop, openGenerativeUI, enableInspector, agentId, showIntelligenceIndicator = true, useSingleEndpoint, onError, a2ui, defaultThrottleMs, debug, learning }) => {
3431
- const learningConfig = toLearningConfig(learning);
3432
+ const learningConfig = (0, react.useMemo)(() => toLearningConfig(learning), [learning]);
3432
3433
  const [shouldRenderInspector, setShouldRenderInspector] = (0, react.useState)(false);
3433
3434
  const [inspectorVisible, setInspectorVisible] = (0, react.useState)(false);
3434
3435
  (0, react.useEffect)(() => {
@@ -3770,15 +3771,25 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3770
3771
  debug
3771
3772
  ]);
3772
3773
  const learningEnabled = learningConfig !== void 0;
3773
- const generatesTrajectoryId = learning === true;
3774
- const suppliedTrajectoryId = learningConfig?.trajectoryId;
3774
+ const autoStart = learningEnabled && (typeof learning !== "object" || learning.autoStart !== false);
3775
+ const suppliedTrajectoryId = autoStart ? learningConfig?.trajectoryId : void 0;
3776
+ const generatesTrajectoryId = autoStart && suppliedTrajectoryId === void 0;
3775
3777
  const learningContainerIdsRef = (0, react.useRef)(learningConfig?.learningContainerIds);
3776
3778
  const generatedTrajectoryIdRef = (0, react.useRef)(void 0);
3777
3779
  (0, react.useEffect)(() => {
3778
3780
  copilotkit.setLearningConfig(learningConfig);
3779
3781
  learningContainerIdsRef.current = learningConfig?.learningContainerIds;
3780
- if (learningConfig?.sink === void 0 && learningConfig?.trajectoryId === void 0 && learningConfig?.learningContainerIds !== void 0) console.warn("[CopilotKit] learningContainerIds is supported only with a custom sink. Authenticated Trajectory capture does not assign Learning Containers; remove learningContainerIds from the capture options.");
3781
- }, [copilotkit, learningConfig]);
3782
+ if (learningConfig?.sink === void 0 && !autoStart && learningConfig?.learningContainerIds !== void 0) console.warn("[CopilotKit] learningContainerIds is supported only with a custom sink. Authenticated Trajectory capture does not assign Learning Containers; remove learningContainerIds from the capture options.");
3783
+ }, [
3784
+ copilotkit,
3785
+ learningConfig,
3786
+ autoStart
3787
+ ]);
3788
+ const ignoresTrajectoryId = !autoStart && learningConfig?.trajectoryId !== void 0;
3789
+ (0, react.useEffect)(() => {
3790
+ if (!ignoresTrajectoryId) return;
3791
+ console.warn("[CopilotKit] learning.trajectoryId is ignored when autoStart is false; pass the ID to startTrajectory() instead.");
3792
+ }, [ignoresTrajectoryId]);
3782
3793
  (0, react.useEffect)(() => {
3783
3794
  if (!generatesTrajectoryId) generatedTrajectoryIdRef.current = void 0;
3784
3795
  if (!learningEnabled) return;
@@ -3873,17 +3884,17 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3873
3884
  const hasNonReadyRuntimeEntitlement = runtimeEntitlements !== void 0 && runtimeEntitlements.status !== "ready";
3874
3885
  const hasLegacyRuntimeEntitlementFallback = runtimeLicenseStatus === "valid" || runtimeLicenseStatus === "expiring";
3875
3886
  const runtimeEntitlementRetryInProgress = retryableRuntimeEntitlementFailure && runtimeEntitlementRetryPending && !hasLegacyRuntimeEntitlementFallback;
3876
- const runtimeEntitlementFailureSettled = hasNonReadyRuntimeEntitlement && !runtimeEntitlementRetryInProgress && !hasLegacyRuntimeEntitlementFallback;
3887
+ const terminalRuntimeEntitlementFailure = hasNonReadyRuntimeEntitlement && !retryableRuntimeEntitlementFailure && !hasLegacyRuntimeEntitlementFallback;
3877
3888
  const licenseContextValue = (0, react.useMemo)(() => {
3878
3889
  const runtimeLicenseContext = (0, _copilotkit_shared.createLicenseContextValue)(runtimeEntitlementRetryInProgress ? void 0 : runtimeLicenseStatus, runtimeEntitlements);
3879
- if (!runtimeEntitlementFailureSettled) return runtimeLicenseContext;
3890
+ if (!terminalRuntimeEntitlementFailure) return runtimeLicenseContext;
3880
3891
  return {
3881
3892
  ...runtimeLicenseContext,
3882
3893
  checkFeature: () => false,
3883
3894
  getLimit: () => null
3884
3895
  };
3885
3896
  }, [
3886
- runtimeEntitlementFailureSettled,
3897
+ terminalRuntimeEntitlementFailure,
3887
3898
  runtimeEntitlementRetryInProgress,
3888
3899
  runtimeEntitlements,
3889
3900
  runtimeLicenseStatus
@@ -13366,4 +13377,4 @@ Object.defineProperty(exports, 'useToast', {
13366
13377
  return useToast;
13367
13378
  }
13368
13379
  });
13369
- //# sourceMappingURL=copilotkit-D7_J5Hs_.cjs.map
13380
+ //# sourceMappingURL=copilotkit-BFeenQQ0.cjs.map