@copilotkit/vue 1.78.0 → 1.79.1-canary.1792034358

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 (28) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.mjs +2 -2
  3. package/dist/use-render-activity-message-ClNDOux7.cjs +70 -0
  4. package/dist/use-render-activity-message-ClNDOux7.cjs.map +1 -0
  5. package/dist/{use-render-activity-message-B9MOLfR_.js → use-render-activity-message-D2MaLmz3.js} +2359 -2373
  6. package/dist/use-render-activity-message-D2MaLmz3.js.map +1 -0
  7. package/dist/v2/hooks/use-agent.d.ts.map +1 -1
  8. package/dist/v2/hooks/use-threads.d.ts.map +1 -1
  9. package/dist/v2/index.cjs +1 -1
  10. package/dist/v2/index.mjs +1 -1
  11. package/dist/v2/providers/CopilotKitProvider.types.d.ts +7 -2
  12. package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
  13. package/dist/v2/providers/CopilotKitProvider.vue.d.ts +2 -1
  14. package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
  15. package/package.json +7 -7
  16. package/src/v2/hooks/__tests__/use-agent-stability.test.ts +11 -0
  17. package/src/v2/hooks/__tests__/use-threads.test.ts +27 -6
  18. package/src/v2/hooks/use-agent.ts +28 -22
  19. package/src/v2/hooks/use-threads.ts +9 -8
  20. package/src/v2/lib/__tests__/transcription-client.test.ts +2 -0
  21. package/src/v2/lib/transcription-client.ts +1 -1
  22. package/src/v2/providers/CopilotKitProvider.types.ts +7 -1
  23. package/src/v2/providers/CopilotKitProvider.vue +62 -12
  24. package/src/v2/providers/__tests__/CopilotKitProvider.headersAtSendTime.test.ts +598 -0
  25. package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +8 -3
  26. package/dist/use-render-activity-message-B9MOLfR_.js.map +0 -1
  27. package/dist/use-render-activity-message-eN0gdzOa.cjs +0 -70
  28. package/dist/use-render-activity-message-eN0gdzOa.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"use-agent.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/use-agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAanD,oBAAY,cAAc;IACxB,iBAAiB,sBAAsB;IACvC,cAAc,mBAAmB;IACjC,kBAAkB,uBAAuB;CAC1C;AAQD,UAAU,iBAAiB;IACzB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACnD;AAED;;;;;GAKG;AACH,UAAU,yBAAyB;IACjC;;;;OAIG;IACH,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAClC;;;;;;;;OAQG;IACH,cAAc,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzC;;;;;;OAMG;IACH,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;CACpC;AAED;;;;;;;;GAQG;AACH,UAAU,qBAAqB;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC/C,iFAAiF;IACjF,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,iFAAiF;IACjF,cAAc,CAAC,EAAE,SAAS,CAAC;CAC5B;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAC3C,CAAC,yBAAyB,GAAG,qBAAqB,CAAC,CAAC;AAEtD;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,KAAK,GAAE,aAAkB;;EAmVjD"}
1
+ {"version":3,"file":"use-agent.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/use-agent.ts"],"names":[],"mappings":"AACA,O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,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IACzB,2EAA2E;IAC3E,SAAS,EAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IAC7B;;;;;OAKG;IACH,cAAc,EAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IAClC,cAAc,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7B,qBAAqB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACpC,UAAU,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACzB,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD;AAcD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB,CAmQnE"}
package/dist/v2/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@copilotkit/core"),a=require("@ag-ui/client"),e=require("../use-render-activity-message-eN0gdzOa.cjs"),n=require("@copilotkit/mcp-apps-renderer/activity"),c=require("@copilotkit/shared");Object.defineProperty(exports,"PROTOCOL_VERSION",{enumerable:!0,get:()=>a.PROTOCOL_VERSION});exports.A2UIActivityContentSchema=e.A2UIActivityContentSchema;exports.A2UISurfaceActivityRenderer=e._sfc_main;exports.A2UISurfaceActivityType=e.A2UISurfaceActivityType;exports.ActivityDeltaEventSchema=e.ActivityDeltaEventSchema;exports.ActivityMessageSchema=e.ActivityMessageSchema;exports.ActivitySnapshotEventSchema=e.ActivitySnapshotEventSchema;exports.AddOperationSchema=e.AddOperationSchema;exports.AgentCapabilitiesSchema=e.AgentCapabilitiesSchema;exports.AssistantMessageSchema=e.AssistantMessageSchema;exports.AttributableSchema=e.AttributableSchema;exports.AudioInputContentSchema=e.AudioPartSchema;exports.AudioInputPartSchema=e.AudioPartSchema;exports.AudioPartSchema=e.AudioPartSchema;exports.BaseEventSchema=e.BaseEventSchema;exports.BaseMessageSchema=e.BaseMessageSchema;exports.ContentPartSchema=e.ContentPartSchema;exports.ContextSchema=e.ContextSchema;exports.CopilotChat=e.CopilotChat;exports.CopilotChatAssistantMessage=e._sfc_main$1;exports.CopilotChatAttachmentQueue=e._sfc_main$2;exports.CopilotChatAttachmentRenderer=e._sfc_main$3;exports.CopilotChatAudioRecorder=e._sfc_main$4;exports.CopilotChatConfigurationProvider=e._sfc_main$5;exports.CopilotChatDefaultLabels=e.CopilotChatDefaultLabels;exports.CopilotChatInput=e._sfc_main$6;exports.CopilotChatMessageView=e._sfc_main$7;exports.CopilotChatReasoningMessage=e._sfc_main$8;exports.CopilotChatSuggestionPill=e._sfc_main$9;exports.CopilotChatSuggestionView=e._sfc_main$10;exports.CopilotChatToggleButton=e.CopilotChatToggleButton;exports.CopilotChatToggleButtonCloseIcon=e.CopilotChatToggleButtonCloseIcon;exports.CopilotChatToggleButtonOpenIcon=e.CopilotChatToggleButtonOpenIcon;exports.CopilotChatToolCallsView=e._sfc_main$11;exports.CopilotChatUserMessage=e._sfc_main$12;exports.CopilotChatView=e._sfc_main$13;exports.CopilotKitCoreVue=e.CopilotKitCoreVue;exports.CopilotKitInspector=e._sfc_main$14;exports.CopilotKitProvider=e._sfc_main$15;exports.CopilotModalHeader=e.CopilotModalHeader;exports.CopilotPopup=e._sfc_main$16;exports.CopilotPopupView=e.CopilotPopupView;exports.CopilotSidebar=e._sfc_main$17;exports.CopilotSidebarView=e.CopilotSidebarView;exports.CopilotThreadsDrawer=e._sfc_main$18;exports.CopyOperationSchema=e.CopyOperationSchema;exports.CustomEventSchema=e.CustomEventSchema;exports.DataSourceSchema=e.DataSourceSchema;exports.DeveloperMessageSchema=e.DeveloperMessageSchema;exports.DocumentInputContentSchema=e.DocumentPartSchema;exports.DocumentInputPartSchema=e.DocumentPartSchema;exports.DocumentPartSchema=e.DocumentPartSchema;exports.EventSchema=e.EventSchema;exports.EventSchemas=e.EventSchema;exports.EventTypeSchema=e.EventTypeSchema;exports.ExecutionCapabilitiesSchema=e.ExecutionCapabilitiesSchema;exports.FileSourceSchema=e.FileSourceSchema;exports.FunctionCallSchema=e.FunctionCallSchema;exports.GenerateSandboxedUiArgsSchema=e.GenerateSandboxedUiArgsSchema;exports.HumanInTheLoopCapabilitiesSchema=e.HumanInTheLoopCapabilitiesSchema;exports.IdentityCapabilitiesSchema=e.IdentityCapabilitiesSchema;exports.ImageInputContentSchema=e.ImagePartSchema;exports.ImageInputPartSchema=e.ImagePartSchema;exports.ImagePartSchema=e.ImagePartSchema;exports.InputContentDataSourceSchema=e.DataSourceSchema;exports.InputContentSchema=e.ContentPartSchema;exports.InputContentSourceSchema=e.PartSourceSchema;exports.InputContentUrlSourceSchema=e.UrlSourceSchema;exports.InterruptSchema=e.InterruptSchema;exports.JsonPatchOperationSchema=e.JsonPatchOperationSchema;exports.JsonPatchSchema=e.JsonPatchSchema;exports.JsonPointerSchema=e.JsonPointerSchema;exports.LicenseContextKey=e.LicenseContextKey;exports.MCPAppsActivityRenderer=e.MCPAppsActivityRenderer;exports.MessageSchema=e.MessageSchema;exports.MessagesSnapshotEventSchema=e.MessagesSnapshotEventSchema;exports.MetadataSchema=e.MetadataSchema;exports.MoveOperationSchema=e.MoveOperationSchema;exports.MultiAgentCapabilitiesSchema=e.MultiAgentCapabilitiesSchema;exports.MultimodalCapabilitiesSchema=e.MultimodalCapabilitiesSchema;exports.MultimodalInputCapabilitiesSchema=e.MultimodalInputCapabilitiesSchema;exports.MultimodalOutputCapabilitiesSchema=e.MultimodalOutputCapabilitiesSchema;exports.OpenGenerativeUIActivityRenderer=e.OpenGenerativeUIActivityRenderer;exports.OpenGenerativeUIActivityType=e.OpenGenerativeUIActivityType;exports.OpenGenerativeUIContentSchema=e.OpenGenerativeUIContentSchema;exports.OpenGenerativeUIRenderer=e.OpenGenerativeUIRenderer;exports.OpenGenerativeUIToolRenderer=e.OpenGenerativeUIToolRenderer;exports.OptionalMetadataSchema=e.OptionalMetadataSchema;exports.OutputCapabilitiesSchema=e.OutputCapabilitiesSchema;exports.PartSourceSchema=e.PartSourceSchema;exports.RawEventSchema=e.RawEventSchema;exports.ReasoningCapabilitiesSchema=e.ReasoningCapabilitiesSchema;exports.ReasoningEncryptedValueEventSchema=e.ReasoningEncryptedValueEventSchema;exports.ReasoningEncryptedValueSubtypeSchema=e.ReasoningEncryptedValueSubtypeSchema;exports.ReasoningEndEventSchema=e.ReasoningEndEventSchema;exports.ReasoningMessageChunkEventSchema=e.ReasoningMessageChunkEventSchema;exports.ReasoningMessageContentEventSchema=e.ReasoningMessageContentEventSchema;exports.ReasoningMessageEndEventSchema=e.ReasoningMessageEndEventSchema;exports.ReasoningMessageSchema=e.ReasoningMessageSchema;exports.ReasoningMessageStartEventSchema=e.ReasoningMessageStartEventSchema;exports.ReasoningStartEventSchema=e.ReasoningStartEventSchema;exports.RemoveOperationSchema=e.RemoveOperationSchema;exports.ReplaceOperationSchema=e.ReplaceOperationSchema;exports.ResumeEntrySchema=e.ResumeEntrySchema;exports.RoleSchema=e.RoleSchema;exports.RunAgentInputSchema=e.RunAgentInputSchema;exports.RunErrorEventSchema=e.RunErrorEventSchema;exports.RunFinishedCancelledOutcomeSchema=e.RunFinishedCancelledOutcomeSchema;exports.RunFinishedEventSchema=e.RunFinishedEventSchema;exports.RunFinishedInterruptOutcomeSchema=e.RunFinishedInterruptOutcomeSchema;exports.RunFinishedOutcomeSchema=e.RunFinishedOutcomeSchema;exports.RunFinishedSuccessOutcomeSchema=e.RunFinishedSuccessOutcomeSchema;exports.RunStartedEventSchema=e.RunStartedEventSchema;exports.StateCapabilitiesSchema=e.StateCapabilitiesSchema;exports.StateDeltaEventSchema=e.StateDeltaEventSchema;exports.StateSchema=e.StateSchema;exports.StateSnapshotEventSchema=e.StateSnapshotEventSchema;exports.StepFinishedEventSchema=e.StepFinishedEventSchema;exports.StepStartedEventSchema=e.StepStartedEventSchema;exports.SubagentErrorEventSchema=e.SubagentErrorEventSchema;exports.SubagentFinishedEventSchema=e.SubagentFinishedEventSchema;exports.SubagentFinishedOutcomeSchema=e.SubagentFinishedOutcomeSchema;exports.SubagentFinishedSuccessOutcomeSchema=e.SubagentFinishedSuccessOutcomeSchema;exports.SubagentFinishedSuspendedOutcomeSchema=e.SubagentFinishedSuspendedOutcomeSchema;exports.SubagentInfoSchema=e.SubagentInfoSchema;exports.SubagentRunIdSchema=e.SubagentRunIdSchema;exports.SubagentStartedEventSchema=e.SubagentStartedEventSchema;exports.SystemMessageSchema=e.SystemMessageSchema;exports.TestOperationSchema=e.TestOperationSchema;exports.TextInputContentSchema=e.TextPartSchema;exports.TextMessageChunkEventSchema=e.TextMessageChunkEventSchema;exports.TextMessageContentEventSchema=e.TextMessageContentEventSchema;exports.TextMessageEndEventSchema=e.TextMessageEndEventSchema;exports.TextMessageRoleSchema=e.TextMessageRoleSchema;exports.TextMessageStartEventSchema=e.TextMessageStartEventSchema;exports.TextPartSchema=e.TextPartSchema;exports.TokenUsageSchema=e.TokenUsageSchema;exports.ToolCallArgsEventSchema=e.ToolCallArgsEventSchema;exports.ToolCallChunkEventSchema=e.ToolCallChunkEventSchema;exports.ToolCallEndEventSchema=e.ToolCallEndEventSchema;exports.ToolCallResultEventSchema=e.ToolCallResultEventSchema;exports.ToolCallSchema=e.ToolCallSchema;exports.ToolCallStartEventSchema=e.ToolCallStartEventSchema;exports.ToolMessageSchema=e.ToolMessageSchema;exports.ToolSchema=e.ToolSchema;exports.ToolsCapabilitiesSchema=e.ToolsCapabilitiesSchema;exports.TransportCapabilitiesSchema=e.TransportCapabilitiesSchema;exports.UrlSourceSchema=e.UrlSourceSchema;exports.UseAgentUpdate=e.UseAgentUpdate;exports.UserMessageSchema=e.UserMessageSchema;exports.VideoInputContentSchema=e.VideoPartSchema;exports.VideoInputPartSchema=e.VideoPartSchema;exports.VideoPartSchema=e.VideoPartSchema;exports.createA2UIMessageRenderer=e.createA2UIMessageRenderer;exports.createDefaultLicenseRef=e.createDefaultLicenseRef;exports.defineToolCallRenderer=e.defineToolCallRenderer;exports.extractCompleteStyles=e.extractCompleteStyles;exports.getOperationSurfaceId=e.getOperationSurfaceId;exports.processPartialHtml=e.processPartialHtml;exports.useAgent=e.useAgent;exports.useAgentContext=e.useAgentContext;exports.useAttachments=e.useAttachments;exports.useCapabilities=e.useCapabilities;exports.useComponent=e.useComponent;exports.useConfigureSuggestions=e.useConfigureSuggestions;exports.useCopilotChatConfiguration=e.useCopilotChatConfiguration;exports.useCopilotKit=e.useCopilotKit;exports.useDefaultRenderTool=e.useDefaultRenderTool;exports.useFrontendTool=e.useFrontendTool;exports.useHumanInTheLoop=e.useHumanInTheLoop;exports.useInterrupt=e.useInterrupt;exports.useKatexStyles=e.useKatexStyles;exports.useKeyboardHeight=e.useKeyboardHeight;exports.useLicenseContext=e.useLicenseContext;exports.useRenderActivityMessage=e.useRenderActivityMessage;exports.useRenderCustomMessages=e.useRenderCustomMessages;exports.useRenderTool=e.useRenderTool;exports.useSandboxFunctions=e.useSandboxFunctions;exports.useSuggestions=e.useSuggestions;exports.useThreads=e.useThreads;exports.vueBasicCatalog=e.vueBasicCatalog;Object.defineProperty(exports,"MCPAppsActivityContentSchema",{enumerable:!0,get:()=>n.MCPAppsActivityContentSchema});Object.defineProperty(exports,"MCPAppsActivityType",{enumerable:!0,get:()=>n.MCPAppsActivityType});Object.defineProperty(exports,"ɵrunMcpFollowUp",{enumerable:!0,get:()=>n.ɵrunMcpFollowUp});Object.defineProperty(exports,"createLicenseContextValue",{enumerable:!0,get:()=>c.createLicenseContextValue});Object.keys(o).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>o[t]})});Object.keys(a).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>a[t]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@copilotkit/core"),a=require("@ag-ui/client"),e=require("../use-render-activity-message-ClNDOux7.cjs"),n=require("@copilotkit/mcp-apps-renderer/activity"),c=require("@copilotkit/shared");Object.defineProperty(exports,"PROTOCOL_VERSION",{enumerable:!0,get:()=>a.PROTOCOL_VERSION});exports.A2UIActivityContentSchema=e.A2UIActivityContentSchema;exports.A2UISurfaceActivityRenderer=e._sfc_main;exports.A2UISurfaceActivityType=e.A2UISurfaceActivityType;exports.ActivityDeltaEventSchema=e.ActivityDeltaEventSchema;exports.ActivityMessageSchema=e.ActivityMessageSchema;exports.ActivitySnapshotEventSchema=e.ActivitySnapshotEventSchema;exports.AddOperationSchema=e.AddOperationSchema;exports.AgentCapabilitiesSchema=e.AgentCapabilitiesSchema;exports.AssistantMessageSchema=e.AssistantMessageSchema;exports.AttributableSchema=e.AttributableSchema;exports.AudioInputContentSchema=e.AudioPartSchema;exports.AudioInputPartSchema=e.AudioPartSchema;exports.AudioPartSchema=e.AudioPartSchema;exports.BaseEventSchema=e.BaseEventSchema;exports.BaseMessageSchema=e.BaseMessageSchema;exports.ContentPartSchema=e.ContentPartSchema;exports.ContextSchema=e.ContextSchema;exports.CopilotChat=e.CopilotChat;exports.CopilotChatAssistantMessage=e._sfc_main$1;exports.CopilotChatAttachmentQueue=e._sfc_main$2;exports.CopilotChatAttachmentRenderer=e._sfc_main$3;exports.CopilotChatAudioRecorder=e._sfc_main$4;exports.CopilotChatConfigurationProvider=e._sfc_main$5;exports.CopilotChatDefaultLabels=e.CopilotChatDefaultLabels;exports.CopilotChatInput=e._sfc_main$6;exports.CopilotChatMessageView=e._sfc_main$7;exports.CopilotChatReasoningMessage=e._sfc_main$8;exports.CopilotChatSuggestionPill=e._sfc_main$9;exports.CopilotChatSuggestionView=e._sfc_main$10;exports.CopilotChatToggleButton=e.CopilotChatToggleButton;exports.CopilotChatToggleButtonCloseIcon=e.CopilotChatToggleButtonCloseIcon;exports.CopilotChatToggleButtonOpenIcon=e.CopilotChatToggleButtonOpenIcon;exports.CopilotChatToolCallsView=e._sfc_main$11;exports.CopilotChatUserMessage=e._sfc_main$12;exports.CopilotChatView=e._sfc_main$13;exports.CopilotKitCoreVue=e.CopilotKitCoreVue;exports.CopilotKitInspector=e._sfc_main$14;exports.CopilotKitProvider=e._sfc_main$15;exports.CopilotModalHeader=e.CopilotModalHeader;exports.CopilotPopup=e._sfc_main$16;exports.CopilotPopupView=e.CopilotPopupView;exports.CopilotSidebar=e._sfc_main$17;exports.CopilotSidebarView=e.CopilotSidebarView;exports.CopilotThreadsDrawer=e._sfc_main$18;exports.CopyOperationSchema=e.CopyOperationSchema;exports.CustomEventSchema=e.CustomEventSchema;exports.DataSourceSchema=e.DataSourceSchema;exports.DeveloperMessageSchema=e.DeveloperMessageSchema;exports.DocumentInputContentSchema=e.DocumentPartSchema;exports.DocumentInputPartSchema=e.DocumentPartSchema;exports.DocumentPartSchema=e.DocumentPartSchema;exports.EventSchema=e.EventSchema;exports.EventSchemas=e.EventSchema;exports.EventTypeSchema=e.EventTypeSchema;exports.ExecutionCapabilitiesSchema=e.ExecutionCapabilitiesSchema;exports.FileSourceSchema=e.FileSourceSchema;exports.FunctionCallSchema=e.FunctionCallSchema;exports.GenerateSandboxedUiArgsSchema=e.GenerateSandboxedUiArgsSchema;exports.HumanInTheLoopCapabilitiesSchema=e.HumanInTheLoopCapabilitiesSchema;exports.IdentityCapabilitiesSchema=e.IdentityCapabilitiesSchema;exports.ImageInputContentSchema=e.ImagePartSchema;exports.ImageInputPartSchema=e.ImagePartSchema;exports.ImagePartSchema=e.ImagePartSchema;exports.InputContentDataSourceSchema=e.DataSourceSchema;exports.InputContentSchema=e.ContentPartSchema;exports.InputContentSourceSchema=e.PartSourceSchema;exports.InputContentUrlSourceSchema=e.UrlSourceSchema;exports.InterruptSchema=e.InterruptSchema;exports.JsonPatchOperationSchema=e.JsonPatchOperationSchema;exports.JsonPatchSchema=e.JsonPatchSchema;exports.JsonPointerSchema=e.JsonPointerSchema;exports.LicenseContextKey=e.LicenseContextKey;exports.MCPAppsActivityRenderer=e.MCPAppsActivityRenderer;exports.MessageSchema=e.MessageSchema;exports.MessagesSnapshotEventSchema=e.MessagesSnapshotEventSchema;exports.MetadataSchema=e.MetadataSchema;exports.MoveOperationSchema=e.MoveOperationSchema;exports.MultiAgentCapabilitiesSchema=e.MultiAgentCapabilitiesSchema;exports.MultimodalCapabilitiesSchema=e.MultimodalCapabilitiesSchema;exports.MultimodalInputCapabilitiesSchema=e.MultimodalInputCapabilitiesSchema;exports.MultimodalOutputCapabilitiesSchema=e.MultimodalOutputCapabilitiesSchema;exports.OpenGenerativeUIActivityRenderer=e.OpenGenerativeUIActivityRenderer;exports.OpenGenerativeUIActivityType=e.OpenGenerativeUIActivityType;exports.OpenGenerativeUIContentSchema=e.OpenGenerativeUIContentSchema;exports.OpenGenerativeUIRenderer=e.OpenGenerativeUIRenderer;exports.OpenGenerativeUIToolRenderer=e.OpenGenerativeUIToolRenderer;exports.OptionalMetadataSchema=e.OptionalMetadataSchema;exports.OutputCapabilitiesSchema=e.OutputCapabilitiesSchema;exports.PartSourceSchema=e.PartSourceSchema;exports.RawEventSchema=e.RawEventSchema;exports.ReasoningCapabilitiesSchema=e.ReasoningCapabilitiesSchema;exports.ReasoningEncryptedValueEventSchema=e.ReasoningEncryptedValueEventSchema;exports.ReasoningEncryptedValueSubtypeSchema=e.ReasoningEncryptedValueSubtypeSchema;exports.ReasoningEndEventSchema=e.ReasoningEndEventSchema;exports.ReasoningMessageChunkEventSchema=e.ReasoningMessageChunkEventSchema;exports.ReasoningMessageContentEventSchema=e.ReasoningMessageContentEventSchema;exports.ReasoningMessageEndEventSchema=e.ReasoningMessageEndEventSchema;exports.ReasoningMessageSchema=e.ReasoningMessageSchema;exports.ReasoningMessageStartEventSchema=e.ReasoningMessageStartEventSchema;exports.ReasoningStartEventSchema=e.ReasoningStartEventSchema;exports.RemoveOperationSchema=e.RemoveOperationSchema;exports.ReplaceOperationSchema=e.ReplaceOperationSchema;exports.ResumeEntrySchema=e.ResumeEntrySchema;exports.RoleSchema=e.RoleSchema;exports.RunAgentInputSchema=e.RunAgentInputSchema;exports.RunErrorEventSchema=e.RunErrorEventSchema;exports.RunFinishedCancelledOutcomeSchema=e.RunFinishedCancelledOutcomeSchema;exports.RunFinishedEventSchema=e.RunFinishedEventSchema;exports.RunFinishedInterruptOutcomeSchema=e.RunFinishedInterruptOutcomeSchema;exports.RunFinishedOutcomeSchema=e.RunFinishedOutcomeSchema;exports.RunFinishedSuccessOutcomeSchema=e.RunFinishedSuccessOutcomeSchema;exports.RunStartedEventSchema=e.RunStartedEventSchema;exports.StateCapabilitiesSchema=e.StateCapabilitiesSchema;exports.StateDeltaEventSchema=e.StateDeltaEventSchema;exports.StateSchema=e.StateSchema;exports.StateSnapshotEventSchema=e.StateSnapshotEventSchema;exports.StepFinishedEventSchema=e.StepFinishedEventSchema;exports.StepStartedEventSchema=e.StepStartedEventSchema;exports.SubagentErrorEventSchema=e.SubagentErrorEventSchema;exports.SubagentFinishedEventSchema=e.SubagentFinishedEventSchema;exports.SubagentFinishedOutcomeSchema=e.SubagentFinishedOutcomeSchema;exports.SubagentFinishedSuccessOutcomeSchema=e.SubagentFinishedSuccessOutcomeSchema;exports.SubagentFinishedSuspendedOutcomeSchema=e.SubagentFinishedSuspendedOutcomeSchema;exports.SubagentInfoSchema=e.SubagentInfoSchema;exports.SubagentRunIdSchema=e.SubagentRunIdSchema;exports.SubagentStartedEventSchema=e.SubagentStartedEventSchema;exports.SystemMessageSchema=e.SystemMessageSchema;exports.TestOperationSchema=e.TestOperationSchema;exports.TextInputContentSchema=e.TextPartSchema;exports.TextMessageChunkEventSchema=e.TextMessageChunkEventSchema;exports.TextMessageContentEventSchema=e.TextMessageContentEventSchema;exports.TextMessageEndEventSchema=e.TextMessageEndEventSchema;exports.TextMessageRoleSchema=e.TextMessageRoleSchema;exports.TextMessageStartEventSchema=e.TextMessageStartEventSchema;exports.TextPartSchema=e.TextPartSchema;exports.TokenUsageSchema=e.TokenUsageSchema;exports.ToolCallArgsEventSchema=e.ToolCallArgsEventSchema;exports.ToolCallChunkEventSchema=e.ToolCallChunkEventSchema;exports.ToolCallEndEventSchema=e.ToolCallEndEventSchema;exports.ToolCallResultEventSchema=e.ToolCallResultEventSchema;exports.ToolCallSchema=e.ToolCallSchema;exports.ToolCallStartEventSchema=e.ToolCallStartEventSchema;exports.ToolMessageSchema=e.ToolMessageSchema;exports.ToolSchema=e.ToolSchema;exports.ToolsCapabilitiesSchema=e.ToolsCapabilitiesSchema;exports.TransportCapabilitiesSchema=e.TransportCapabilitiesSchema;exports.UrlSourceSchema=e.UrlSourceSchema;exports.UseAgentUpdate=e.UseAgentUpdate;exports.UserMessageSchema=e.UserMessageSchema;exports.VideoInputContentSchema=e.VideoPartSchema;exports.VideoInputPartSchema=e.VideoPartSchema;exports.VideoPartSchema=e.VideoPartSchema;exports.createA2UIMessageRenderer=e.createA2UIMessageRenderer;exports.createDefaultLicenseRef=e.createDefaultLicenseRef;exports.defineToolCallRenderer=e.defineToolCallRenderer;exports.extractCompleteStyles=e.extractCompleteStyles;exports.getOperationSurfaceId=e.getOperationSurfaceId;exports.processPartialHtml=e.processPartialHtml;exports.useAgent=e.useAgent;exports.useAgentContext=e.useAgentContext;exports.useAttachments=e.useAttachments;exports.useCapabilities=e.useCapabilities;exports.useComponent=e.useComponent;exports.useConfigureSuggestions=e.useConfigureSuggestions;exports.useCopilotChatConfiguration=e.useCopilotChatConfiguration;exports.useCopilotKit=e.useCopilotKit;exports.useDefaultRenderTool=e.useDefaultRenderTool;exports.useFrontendTool=e.useFrontendTool;exports.useHumanInTheLoop=e.useHumanInTheLoop;exports.useInterrupt=e.useInterrupt;exports.useKatexStyles=e.useKatexStyles;exports.useKeyboardHeight=e.useKeyboardHeight;exports.useLicenseContext=e.useLicenseContext;exports.useRenderActivityMessage=e.useRenderActivityMessage;exports.useRenderCustomMessages=e.useRenderCustomMessages;exports.useRenderTool=e.useRenderTool;exports.useSandboxFunctions=e.useSandboxFunctions;exports.useSuggestions=e.useSuggestions;exports.useThreads=e.useThreads;exports.vueBasicCatalog=e.vueBasicCatalog;Object.defineProperty(exports,"MCPAppsActivityContentSchema",{enumerable:!0,get:()=>n.MCPAppsActivityContentSchema});Object.defineProperty(exports,"MCPAppsActivityType",{enumerable:!0,get:()=>n.MCPAppsActivityType});Object.defineProperty(exports,"ɵrunMcpFollowUp",{enumerable:!0,get:()=>n.ɵrunMcpFollowUp});Object.defineProperty(exports,"createLicenseContextValue",{enumerable:!0,get:()=>c.createLicenseContextValue});Object.keys(o).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>o[t]})});Object.keys(a).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>a[t]})});
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/v2/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from "@copilotkit/core";
2
2
  export * from "@ag-ui/client";
3
3
  import { PROTOCOL_VERSION as n } from "@ag-ui/client";
4
- import { A as i, _ as c, a as S, b as h, c as m, d as u, e as r, f as p, g as l, h as C, i as b, i as g, i as d, B as v, j as E, C as R, k as I, l as A, m as T, n as M, o as y, p as O, q as x, r as P, s as f, t as U, u as F, v as V, w as D, x as w, y as L, z as K, D as B, E as G, F as H, G as k, H as J, I as j, J as q, K as z, L as N, M as Q, N as _, O as W, P as X, Q as Y, R as Z, S as $, T as aa, T as ea, T as ta, U as sa, U as na, V as oa, W as ia, X as ca, Y as Sa, Z as ha, $ as ma, a0 as ua, a1 as ra, a1 as pa, a1 as la, R as Ca, C as ba, a2 as ga, a3 as da, a4 as va, a5 as Ea, a6 as Ra, a7 as Ia, a8 as Aa, a9 as Ta, aa as Ma, ab as ya, ac as Oa, ad as xa, ae as Pa, af as fa, ag as Ua, ah as Fa, ai as Va, aj as Da, ak as wa, al as La, am as Ka, an as Ba, ao as Ga, a2 as Ha, ap as ka, aq as Ja, ar as ja, as as qa, at as za, au as Na, av as Qa, aw as _a, ax as Wa, ay as Xa, az as Ya, aA as Za, aB as $a, aC as ae, aD as ee, aE as te, aF as se, aG as ne, aH as oe, aI as ie, aJ as ce, aK as Se, aL as he, aM as me, aN as ue, aO as re, aP as pe, aQ as le, aR as Ce, aS as be, aT as ge, aU as de, aV as ve, aW as Ee, aX as Re, aY as Ie, aZ as Ae, a_ as Te, a$ as Me, b0 as ye, b1 as Oe, b2 as xe, b3 as Pe, b4 as fe, b5 as Ue, b0 as Fe, b6 as Ve, b7 as De, b8 as we, b9 as Le, ba as Ke, bb as Be, bc as Ge, bd as He, be as ke, bf as Je, bg as je, a3 as qe, bh as ze, bi as Ne, bj as Qe, bj as _e, bj as We, bk as Xe, bl as Ye, bm as Ze, bn as $e, bo as at, bp as et, bq as tt, br as st, bs as nt, bt as ot, bu as it, bv as ct, bw as St, bx as ht, by as mt, bz as ut, bA as rt, bB as pt, bC as lt, bD as Ct, bE as bt, bF as gt, bG as dt, bH as vt, bI as Et, bJ as Rt, bK as It, bL as At } from "../use-render-activity-message-B9MOLfR_.js";
4
+ import { A as i, _ as c, a as S, b as h, c as m, d as u, e as r, f as p, g as l, h as C, i as b, i as g, i as d, B as v, j as E, C as R, k as I, l as A, m as T, n as M, o as y, p as O, q as x, r as P, s as f, t as U, u as F, v as V, w as D, x as w, y as L, z as K, D as B, E as G, F as H, G as k, H as J, I as j, J as q, K as z, L as N, M as Q, N as _, O as W, P as X, Q as Y, R as Z, S as $, T as aa, T as ea, T as ta, U as sa, U as na, V as oa, W as ia, X as ca, Y as Sa, Z as ha, $ as ma, a0 as ua, a1 as ra, a1 as pa, a1 as la, R as Ca, C as ba, a2 as ga, a3 as da, a4 as va, a5 as Ea, a6 as Ra, a7 as Ia, a8 as Aa, a9 as Ta, aa as Ma, ab as ya, ac as Oa, ad as xa, ae as Pa, af as fa, ag as Ua, ah as Fa, ai as Va, aj as Da, ak as wa, al as La, am as Ka, an as Ba, ao as Ga, a2 as Ha, ap as ka, aq as Ja, ar as ja, as as qa, at as za, au as Na, av as Qa, aw as _a, ax as Wa, ay as Xa, az as Ya, aA as Za, aB as $a, aC as ae, aD as ee, aE as te, aF as se, aG as ne, aH as oe, aI as ie, aJ as ce, aK as Se, aL as he, aM as me, aN as ue, aO as re, aP as pe, aQ as le, aR as Ce, aS as be, aT as ge, aU as de, aV as ve, aW as Ee, aX as Re, aY as Ie, aZ as Ae, a_ as Te, a$ as Me, b0 as ye, b1 as Oe, b2 as xe, b3 as Pe, b4 as fe, b5 as Ue, b0 as Fe, b6 as Ve, b7 as De, b8 as we, b9 as Le, ba as Ke, bb as Be, bc as Ge, bd as He, be as ke, bf as Je, bg as je, a3 as qe, bh as ze, bi as Ne, bj as Qe, bj as _e, bj as We, bk as Xe, bl as Ye, bm as Ze, bn as $e, bo as at, bp as et, bq as tt, br as st, bs as nt, bt as ot, bu as it, bv as ct, bw as St, bx as ht, by as mt, bz as ut, bA as rt, bB as pt, bC as lt, bD as Ct, bE as bt, bF as gt, bG as dt, bH as vt, bI as Et, bJ as Rt, bK as It, bL as At } from "../use-render-activity-message-D2MaLmz3.js";
5
5
  import { MCPAppsActivityContentSchema as Mt, MCPAppsActivityType as yt, ɵrunMcpFollowUp as Ot } from "@copilotkit/mcp-apps-renderer/activity";
6
6
  import { createLicenseContextValue as Pt } from "@copilotkit/shared";
7
7
  export {
@@ -1,11 +1,16 @@
1
1
  import type { AbstractAgent } from "@ag-ui/client";
2
- import type { CopilotKitCoreErrorCode, CopilotKitMessageFilter } from "@copilotkit/core";
2
+ import type { CopilotKitCoreErrorCode, CopilotKitHeadersSource, CopilotKitMessageFilter } from "@copilotkit/core";
3
3
  import type { DebugConfig } from "@copilotkit/shared";
4
4
  import type { A2UITheme, SandboxFunction, VueActivityMessageRenderer, VueCustomMessageRenderer, VueFrontendTool, VueHumanInTheLoop, VueToolCallRenderer } from "../types";
5
5
  import type { Component } from "vue";
6
6
  export interface CopilotKitProviderProps {
7
7
  runtimeUrl?: string;
8
- headers?: Record<string, string> | (() => Record<string, string>);
8
+ /**
9
+ * Headers sent with every request. A record, or a sync or async builder
10
+ * that runs when each request is sent. An inline arrow is fine. The builder
11
+ * should be cheap; cache tokens in it.
12
+ */
13
+ headers?: CopilotKitHeadersSource;
9
14
  credentials?: RequestCredentials;
10
15
  /**
11
16
  * Rewrites the message list sent to runtime agents on every run.
@@ -1 +1 @@
1
- {"version":3,"file":"CopilotKitProvider.types.d.ts","sourceRoot":"","sources":["../../../src/v2/providers/CopilotKitProvider.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,0BAA0B,EAC1B,wBAAwB,EACxB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAErC,MAAM,WAAW,uBAAuB;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE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AAM,EAAE,GAAG,CAAC,CAAC;KAC9B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,CAAC,EAAE;QACL,KAAK,CAAC,EAAE,SAAS,CAAC;QAClB,OAAO,CAAC,EAAE,GAAG,CAAC;QACd,gBAAgB,CAAC,EAAE,SAAS,CAAC;QAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;IACF;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB"}
1
+ {"version":3,"file":"CopilotKitProvider.types.d.ts","sourceRoot":"","sources":["../../../src/v2/providers/CopilotKitProvider.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,0BAA0B,EAC1B,wBAAwB,EACxB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAErC,MAAM,WAAW,uBAAuB;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAClC,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MA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import type { CopilotKitHeadersSource } from "@copilotkit/core";
2
3
  import type { CopilotKitProviderProps } from "./CopilotKitProvider.types";
3
4
  import type { SandboxFunction, VueActivityMessageRenderer, VueFrontendTool } from "../types";
4
5
  declare var __VLS_1: {};
@@ -9,7 +10,7 @@ declare const __VLS_component: import("vue").DefineComponent<CopilotKitProviderP
9
10
  renderActivityMessages: VueActivityMessageRenderer<unknown>[];
10
11
  renderCustomMessages: import("..").VueCustomMessageRenderer[];
11
12
  properties: Record<string, unknown>;
12
- headers: Record<string, string> | (() => Record<string, string>);
13
+ headers: CopilotKitHeadersSource;
13
14
  useSingleEndpoint: boolean;
14
15
  agents__unsafe_dev_only: Record<string, AbstractAgent>;
15
16
  selfManagedAgents: Record<string, AbstractAgent>;
@@ -1 +1 @@
1
- {"version":3,"file":"CopilotKitProvider.vue.d.ts","sourceRoot":"","sources":["../../../src/v2/providers/CopilotKitProvider.vue"],"names":[],"mappings":"AAsyBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAsCnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,KAAK,EACV,eAAe,EACf,0BAA0B,EAC1B,eAAe,EAGhB,MAAM,UAAU,CAAC;AA8xBlB,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AA4B/C,QAAA,MAAM,eAAe;;;;;;;;;;;wBAr3BrB,CA1tBa;mBA0tBb,CAxtBA;;;;aAwtBA,CAhtBkB;eAgtBlB,CA/sBE;wBA+sBF,CA/sB8B;qBA+sB9B,CA/sB6D;;6EA2kD3D,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAa1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"CopilotKitProvider.vue.d.ts","sourceRoot":"","sources":["../../../src/v2/providers/CopilotKitProvider.vue"],"names":[],"mappings":"AAw1BA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAGV,uBAAuB,EAExB,MAAM,kBAAkB,CAAC;AAiC1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,KAAK,EACV,eAAe,EACf,0BAA0B,EAC1B,eAAe,EAGhB,MAAM,UAAU,CAAC;AA80BlB,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AA4B/C,QAAA,MAAM,eAAe;;;;;;;;;;;wBAv6BrB,CAvwB6C;mBAuwB7C,CAvwBkF;;;;aAuwBlF,CA9vBkC;eA8vBlC,CA9vB2D;wBA8vB3D,CA7vBQ;qBA6vBR,CA7vBuC;;6EA2qDrC,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAa1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkit/vue",
3
- "version": "1.78.0",
3
+ "version": "1.79.1-canary.1792034358",
4
4
  "private": false,
5
5
  "description": "Vue 3 components and composables for CopilotKit",
6
6
  "keywords": [
@@ -64,17 +64,17 @@
64
64
  "@a2ui/web_core": "0.10.4",
65
65
  "@ag-ui/client": "1.0.2",
66
66
  "@ag-ui/core": "1.0.2",
67
+ "@copilotkit/core": "1.79.1-canary.1792034358",
68
+ "@copilotkit/mcp-apps-renderer": "1.79.1-canary.1792034358",
69
+ "@copilotkit/shared": "1.79.1-canary.1792034358",
70
+ "@copilotkit/web-components": "1.79.1-canary.1792034358",
71
+ "@copilotkit/web-inspector": "1.79.1-canary.1792034358",
67
72
  "@jetbrains/websandbox": "^1.1.3",
68
73
  "katex": "^0.16.27",
69
74
  "lucide-vue-next": "^0.525.0",
70
75
  "streamdown-vue": "^1.0.29",
71
76
  "zod": "^3.25.75",
72
- "zod-to-json-schema": "^3.24.5",
73
- "@copilotkit/mcp-apps-renderer": "1.78.0",
74
- "@copilotkit/shared": "1.78.0",
75
- "@copilotkit/core": "1.78.0",
76
- "@copilotkit/web-components": "1.78.0",
77
- "@copilotkit/web-inspector": "1.78.0"
77
+ "zod-to-json-schema": "^3.24.5"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@eslint/js": "^9.39.2",
@@ -30,6 +30,7 @@ describe("useAgent stability during runtime connection", () => {
30
30
  runtimeTransport: string;
31
31
  headers: Record<string, string>;
32
32
  agents: Record<string, AbstractAgent>;
33
+ applyHeadersToAgent: (agent: AbstractAgent) => void;
33
34
  // Added after the hook moved to consume the shared core API. Mocks only
34
35
  // need a no-op subscription object here; stability/ref-identity behavior
35
36
  // is orthogonal to subscribe internals.
@@ -49,6 +50,16 @@ describe("useAgent stability during runtime connection", () => {
49
50
  runtimeTransport: "rest",
50
51
  headers: {},
51
52
  agents: {},
53
+ // Additive stand-in for core's merge (core headers ON TOP of the
54
+ // agent's own). These tests only assert agent identity / threadId and
55
+ // never remove a header, so this approximation is sufficient; it does
56
+ // NOT model core's frozen construction-time baseline.
57
+ applyHeadersToAgent: (agent) => {
58
+ const target = agent as { headers?: Record<string, string> };
59
+ if (target.headers) {
60
+ target.headers = { ...target.headers, ...mockCopilotkit.headers };
61
+ }
62
+ },
52
63
  subscribeToAgentWithOptions: vi.fn(() => ({ unsubscribe: vi.fn() })),
53
64
  applyHeadersToAgent: vi.fn(),
54
65
  });
@@ -396,6 +396,11 @@ type MockCopilotKit = {
396
396
  runtimeUrl: string | undefined;
397
397
  runtimeConnectionStatus: CopilotKitCoreRuntimeConnectionStatus;
398
398
  headers: Record<string, string>;
399
+ /**
400
+ * Bumped only by a real `setHeaders()` call (a new source). #1937: this —
401
+ * not header VALUES — is what the composable keys re-dispatch on.
402
+ */
403
+ ɵheadersGeneration: number;
399
404
  intelligence: { wsUrl?: string } | undefined;
400
405
  threadEndpoints: ThreadEndpointRuntimeInfo | undefined;
401
406
  registerThreadStore: ReturnType<typeof vi.fn>;
@@ -414,6 +419,7 @@ function setupCopilotKit(
414
419
  runtimeUrl,
415
420
  runtimeConnectionStatus,
416
421
  headers: { Authorization: "Bearer test-token" },
422
+ ɵheadersGeneration: 0,
417
423
  intelligence: {
418
424
  wsUrl: "ws://localhost:4000/client",
419
425
  },
@@ -834,7 +840,7 @@ describe("useThreads", () => {
834
840
  });
835
841
  });
836
842
 
837
- it("reacts to in-place header mutations", async () => {
843
+ it("ignores an in-place header mutation, but re-dispatches when ɵheadersGeneration changes (#1937)", async () => {
838
844
  const copilotkit = setupCopilotKit();
839
845
 
840
846
  fetchMock
@@ -858,19 +864,34 @@ describe("useThreads", () => {
858
864
  expect(getResult().isLoading.value).toBe(false);
859
865
  });
860
866
 
867
+ const callsBeforeMutation = fetchMock.mock.calls.length;
868
+
869
+ // A raw mutation of the headers object — no `setHeaders()`, no
870
+ // generation bump — must NOT re-dispatch the context or refetch. A
871
+ // header builder's returned token can change on every resolution
872
+ // without ever calling `setHeaders`, so this must never be the trigger.
861
873
  copilotkit.value.headers.Authorization = "Bearer mutated";
874
+ await nextTick();
875
+ await nextTick();
876
+ expect(fetchMock.mock.calls.length).toBe(callsBeforeMutation);
877
+
878
+ // A real `setHeaders()` bumps `ɵheadersGeneration` — THAT is the
879
+ // trigger to re-dispatch and refetch.
880
+ copilotkit.value = {
881
+ ...copilotkit.value,
882
+ ɵheadersGeneration: copilotkit.value.ɵheadersGeneration + 1,
883
+ };
862
884
 
863
885
  await vi.waitFor(() => {
864
886
  expect(fetchMock).toHaveBeenCalledWith(
865
887
  expect.stringContaining("/threads?agentId=agent-1"),
866
- expect.objectContaining({
867
- method: "GET",
868
- headers: { Authorization: "Bearer mutated" },
869
- }),
888
+ expect.objectContaining({ method: "GET" }),
870
889
  );
871
890
  });
872
891
 
873
- expect(getResult().threads.value[0].id).toBe("t-4");
892
+ await vi.waitFor(() => {
893
+ expect(getResult().threads.value[0]?.id).toBe("t-4");
894
+ });
874
895
  });
875
896
 
876
897
  it("reacts to includeArchived and limit changes", async () => {
@@ -210,7 +210,6 @@ export function useAgent(props: UseAgentProps = {}) {
210
210
  id: string,
211
211
  runtimeUrl: string,
212
212
  transport: CopilotRuntimeTransport,
213
- headers: Record<string, string>,
214
213
  ) => {
215
214
  const provisional = new ProxiedCopilotRuntimeAgent({
216
215
  runtimeUrl,
@@ -218,7 +217,10 @@ export function useAgent(props: UseAgentProps = {}) {
218
217
  transport,
219
218
  runtimeMode: "pending",
220
219
  });
221
- provisional.headers = { ...headers };
220
+ // Never invokes the headers builder — installs `ɵruntimeFetch` and
221
+ // own-only headers on this proxied agent, so a request it actually sends
222
+ // resolves the current headers at send time (#1937).
223
+ copilotkit.value.applyHeadersToAgent(provisional);
222
224
  return provisional;
223
225
  };
224
226
 
@@ -268,7 +270,7 @@ export function useAgent(props: UseAgentProps = {}) {
268
270
 
269
271
  const cachedProxy = provisionalAgentCache.get(id);
270
272
  if (cachedProxy) {
271
- cachedProxy.headers = { ...core.headers };
273
+ core.applyHeadersToAgent(cachedProxy);
272
274
  agent.value = cachedProxy;
273
275
  subscriptionAgent.value = cachedProxy;
274
276
  return;
@@ -281,7 +283,7 @@ export function useAgent(props: UseAgentProps = {}) {
281
283
  transport: core.runtimeTransport,
282
284
  runtimeMode: "pending",
283
285
  });
284
- provisionalProxy.headers = { ...core.headers };
286
+ core.applyHeadersToAgent(provisionalProxy);
285
287
  provisionalAgentCache.set(id, provisionalProxy);
286
288
  agent.value = provisionalProxy;
287
289
  subscriptionAgent.value = provisionalProxy;
@@ -312,7 +314,7 @@ export function useAgent(props: UseAgentProps = {}) {
312
314
  ) {
313
315
  const cached = provisionalAgentCache.get(id);
314
316
  if (cached) {
315
- cached.headers = { ...core.headers };
317
+ core.applyHeadersToAgent(cached);
316
318
  agent.value = cached;
317
319
  subscriptionAgent.value = cached;
318
320
  return;
@@ -322,7 +324,6 @@ export function useAgent(props: UseAgentProps = {}) {
322
324
  id,
323
325
  core.runtimeUrl!,
324
326
  core.runtimeTransport,
325
- core.headers,
326
327
  );
327
328
  provisionalAgentCache.set(id, provisional);
328
329
  agent.value = provisional;
@@ -343,20 +344,30 @@ export function useAgent(props: UseAgentProps = {}) {
343
344
  );
344
345
  };
345
346
 
347
+ // Keyed on `ɵheadersGeneration`, not header VALUES: a builder's returned
348
+ // token can change on every resolution without a new source ever being
349
+ // set (a run refreshing the snapshot), and this must not re-run
350
+ // `resolveAgent` (and force-trigger `agent`) on that (#1937).
351
+ // A genuine source change (a real `setHeaders()` call) still re-runs it,
352
+ // refreshing a cached provisional's headers via the branches above.
353
+ //
354
+ // `registeredProxy` is wrapped as a getter (`() => registeredProxy.value`)
355
+ // rather than passed directly: Vue's multi-source `watch` sets
356
+ // `forceTrigger = true` for the WHOLE array whenever any raw element is
357
+ // itself a shallowRef/reactive object, which makes the callback run on
358
+ // ANY dependency dirtying regardless of whether a source's value actually
359
+ // changed — silently defeating the `ɵheadersGeneration` rekey above (and
360
+ // every other source's diffing) the moment `registeredProxy` is present.
361
+ // A getter reads the same value without contributing to that flag.
346
362
  watch(
347
363
  [
348
364
  agentId,
349
- registeredProxy,
365
+ () => registeredProxy.value,
350
366
  () => copilotkit.value.agents,
351
367
  () => copilotkit.value.runtimeConnectionStatus,
352
368
  () => copilotkit.value.runtimeUrl,
353
369
  () => copilotkit.value.runtimeTransport,
354
- () =>
355
- JSON.stringify(
356
- Object.entries(copilotkit.value.headers ?? {}).sort(([a], [b]) =>
357
- a.localeCompare(b),
358
- ),
359
- ),
370
+ () => copilotkit.value.ɵheadersGeneration,
360
371
  ],
361
372
  resolveAgent,
362
373
  { immediate: true },
@@ -381,16 +392,11 @@ export function useAgent(props: UseAgentProps = {}) {
381
392
  { immediate: true },
382
393
  );
383
394
 
395
+ // Keyed on `ɵheadersGeneration`, not header VALUES: a builder's returned
396
+ // token can change on every resolution without a new source ever being set,
397
+ // and this watcher must not re-fire on that (see #1937).
384
398
  watch(
385
- [
386
- subscriptionAgent,
387
- () =>
388
- JSON.stringify(
389
- Object.entries(copilotkit.value.headers ?? {}).sort(([a], [b]) =>
390
- a.localeCompare(b),
391
- ),
392
- ),
393
- ],
399
+ [subscriptionAgent, () => copilotkit.value.ɵheadersGeneration],
394
400
  ([currentAgent]) => {
395
401
  if (ɵisHttpAgent(currentAgent)) {
396
402
  copilotkit.value.applyHeadersToAgent(currentAgent);
@@ -133,13 +133,11 @@ export function useThreads(input: UseThreadsInput): UseThreadsResult {
133
133
  ),
134
134
  );
135
135
 
136
- const headersKey = computed(() =>
137
- JSON.stringify(
138
- Object.entries(copilotkit.value.headers ?? {}).sort(([left], [right]) =>
139
- left.localeCompare(right),
140
- ),
141
- ),
142
- );
136
+ // Keyed on the source's generation, not on header VALUES: a builder's
137
+ // returned token can change on every resolution without a new source ever
138
+ // being set, and this must not re-dispatch the thread context on that (see
139
+ // #1937).
140
+ const headersKey = computed(() => copilotkit.value.ɵheadersGeneration);
143
141
 
144
142
  const threads = ref<Thread[]>([]);
145
143
  const storeIsLoading = ref(false);
@@ -248,9 +246,12 @@ export function useThreads(input: UseThreadsInput): UseThreadsResult {
248
246
  return;
249
247
  }
250
248
 
249
+ // No `headers` here: the store's `fetch` is `copilotkit.value.ɵruntimeFetch`,
250
+ // which already resolves and overlays the current core headers at send
251
+ // time (#1937) — a snapshot here would go stale the moment the builder
252
+ // returns something new.
251
253
  const context: ɵThreadRuntimeContext = {
252
254
  runtimeUrl,
253
- headers: { ...copilotkit.value.headers },
254
255
  wsUrl,
255
256
  agentId,
256
257
  includeArchived,
@@ -26,6 +26,7 @@ describe("transcription-client", () => {
26
26
  runtimeUrl: "/api/copilotkit",
27
27
  runtimeTransport: "rest",
28
28
  headers: {},
29
+ resolveHeaders: async () => ({}),
29
30
  } as CopilotKitCoreVue,
30
31
  new Blob(["audio"], { type: "audio/webm" }),
31
32
  );
@@ -52,6 +53,7 @@ describe("transcription-client", () => {
52
53
  runtimeUrl: "/api/copilotkit",
53
54
  runtimeTransport: "rest",
54
55
  headers: {},
56
+ resolveHeaders: async () => ({}),
55
57
  } as CopilotKitCoreVue,
56
58
  new Blob(["audio"], { type: "audio/webm" }),
57
59
  ),
@@ -77,7 +77,7 @@ export async function transcribeAudio(
77
77
  });
78
78
  }
79
79
 
80
- const headers: Record<string, string> = { ...core.headers };
80
+ const headers: Record<string, string> = { ...(await core.resolveHeaders()) };
81
81
  let response: Response;
82
82
 
83
83
  try {
@@ -1,6 +1,7 @@
1
1
  import type { AbstractAgent } from "@ag-ui/client";
2
2
  import type {
3
3
  CopilotKitCoreErrorCode,
4
+ CopilotKitHeadersSource,
4
5
  CopilotKitMessageFilter,
5
6
  } from "@copilotkit/core";
6
7
  import type { DebugConfig } from "@copilotkit/shared";
@@ -17,7 +18,12 @@ import type { Component } from "vue";
17
18
 
18
19
  export interface CopilotKitProviderProps {
19
20
  runtimeUrl?: string;
20
- headers?: Record<string, string> | (() => Record<string, string>);
21
+ /**
22
+ * Headers sent with every request. A record, or a sync or async builder
23
+ * that runs when each request is sent. An inline arrow is fine. The builder
24
+ * should be cheap; cache tokens in it.
25
+ */
26
+ headers?: CopilotKitHeadersSource;
21
27
  credentials?: RequestCredentials;
22
28
  /**
23
29
  * Rewrites the message list sent to runtime agents on every run.
@@ -16,8 +16,10 @@ import { ToolCallStatus } from "@copilotkit/core";
16
16
  import type {
17
17
  CopilotKitCoreErrorCode,
18
18
  CopilotKitCoreSubscriber,
19
+ CopilotKitHeadersSource,
19
20
  FrontendTool,
20
21
  } from "@copilotkit/core";
22
+ import { ɵwithHeaderDefaults } from "@copilotkit/core";
21
23
  import { schemaToJsonSchema, shouldEnableInspector } from "@copilotkit/shared";
22
24
  import type {
23
25
  RuntimeEntitlementResponse,
@@ -191,17 +193,37 @@ const hasLocalAgents = computed(
191
193
  () => Object.keys(mergedAgents.value).length > 0,
192
194
  );
193
195
 
194
- const resolvedHeaders = computed(() =>
195
- typeof props.headers === "function" ? props.headers() : props.headers,
196
+ // Whether `headers` is a builder, as its own computed so that a re-render
197
+ // merely passing a NEW function of the same kind (e.g. a fresh inline arrow)
198
+ // doesn't propagate: this computed's VALUE doesn't change, so Vue never marks
199
+ // `headersSource` below dirty on that account. Reading `props.headers`
200
+ // directly inside `headersSource` would defeat this — its exact identity
201
+ // would then be tracked there instead.
202
+ const isHeadersBuilder = computed(() => typeof props.headers === "function");
203
+
204
+ // Stable for the component's lifetime: reads `props.headers` fresh on every
205
+ // call, so it is always current at send time (#1937), never during render.
206
+ // The read below can return a sync record or an async promise depending on
207
+ // what `props.headers` happens to be at call time, which
208
+ // `CopilotKitHeadersSource`'s shape can't express in one function signature
209
+ // (sync-only OR async-only) — same rationale as the cast inside
210
+ // `ɵwithHeaderDefaults`.
211
+ const latestHeaders = (() =>
212
+ typeof props.headers === "function"
213
+ ? props.headers()
214
+ : props.headers) as () => Record<string, string>;
215
+
216
+ // The source handed to core. A record keeps today's identity semantics (its
217
+ // own reference changes propagate); a builder is represented by the stable
218
+ // `latestHeaders` above, so only `isHeadersBuilder` and `resolvedPublicKey`
219
+ // actually drive recomputation.
220
+ const headersSource = computed<CopilotKitHeadersSource>(() =>
221
+ ɵwithHeaderDefaults(
222
+ isHeadersBuilder.value ? latestHeaders : props.headers,
223
+ resolvedPublicKey.value ? { [HEADER_NAME]: resolvedPublicKey.value } : {},
224
+ ),
196
225
  );
197
226
 
198
- const mergedHeaders = computed(() => {
199
- const headers = resolvedHeaders.value;
200
- if (!resolvedPublicKey.value) return headers;
201
- if (headers[HEADER_NAME]) return headers;
202
- return { ...headers, [HEADER_NAME]: resolvedPublicKey.value };
203
- });
204
-
205
227
  const chatApiEndpoint = computed(
206
228
  () =>
207
229
  props.runtimeUrl ??
@@ -469,7 +491,7 @@ const createCopilotKit = () => {
469
491
  : props.useSingleEndpoint === false
470
492
  ? "rest"
471
493
  : "auto",
472
- headers: mergedHeaders.value,
494
+ headers: headersSource.value,
473
495
  credentials: props.credentials,
474
496
  messageFilter: props.messageFilter,
475
497
  properties: resolvedProperties.value,
@@ -546,12 +568,25 @@ watch(
546
568
  });
547
569
  },
548
570
  });
571
+ // `onHeadersChanged` fires only from a real `setHeaders()` call (a new
572
+ // source), never from a builder resolving a new token — same generation
573
+ // core bumps. Without this, nothing pokes Vue's reactivity when a source
574
+ // change lands: `ɵheadersGeneration` is a plain property read, not a
575
+ // ref/reactive value, so `headersKey` (use-threads.ts) and the
576
+ // HttpAgent watcher (use-agent.ts) only re-read it when SOME OTHER
577
+ // trigger happens to fire around the same time (#1937).
578
+ const sub6 = core.subscribe({
579
+ onHeadersChanged: () => {
580
+ triggerRef(copilotkit);
581
+ },
582
+ });
549
583
  onCleanup(() => {
550
584
  sub1.unsubscribe();
551
585
  sub2.unsubscribe();
552
586
  sub3.unsubscribe();
553
587
  sub4.unsubscribe();
554
588
  sub5.unsubscribe();
589
+ sub6.unsubscribe();
555
590
  });
556
591
  },
557
592
  { immediate: true },
@@ -579,6 +614,18 @@ watch([allRenderActivityMessages], ([renderActivityMessages]) => {
579
614
  triggerRef(copilotkit);
580
615
  });
581
616
 
617
+ // The last `headersSource` reference actually handed to `core.setHeaders`.
618
+ // `syncRuntimeConfig` runs once (unconditionally) from `onMounted` in
619
+ // addition to the constructor already having applied this same value.
620
+ // `HeaderSourceResolver.setSource` itself is a no-op both for an identical
621
+ // function reference and for a record whose normalized values equal the
622
+ // currently applied record's (see #1937), so this reference
623
+ // check is now a cheap pre-filter rather than the only thing preventing a
624
+ // spurious `onHeadersChanged`. It still avoids the `setHeaders` call (and
625
+ // its normalize + shallow-equal work) entirely on the common path where
626
+ // nothing changed.
627
+ let lastAppliedHeadersSource: CopilotKitHeadersSource = headersSource.value;
628
+
582
629
  function syncRuntimeConfig() {
583
630
  copilotkit.value.setRuntimeUrl(chatApiEndpoint.value);
584
631
  copilotkit.value.setRuntimeTransport(
@@ -588,7 +635,10 @@ function syncRuntimeConfig() {
588
635
  ? "rest"
589
636
  : "auto",
590
637
  );
591
- copilotkit.value.setHeaders(mergedHeaders.value);
638
+ if (headersSource.value !== lastAppliedHeadersSource) {
639
+ lastAppliedHeadersSource = headersSource.value;
640
+ copilotkit.value.setHeaders(headersSource.value);
641
+ }
592
642
  copilotkit.value.setCredentials(props.credentials);
593
643
  copilotkit.value.setMessageFilter(props.messageFilter);
594
644
  copilotkit.value.setProperties(resolvedProperties.value);
@@ -600,7 +650,7 @@ function syncRuntimeConfig() {
600
650
  watch(
601
651
  [
602
652
  () => chatApiEndpoint.value,
603
- () => mergedHeaders.value,
653
+ () => headersSource.value,
604
654
  () => props.credentials,
605
655
  () => props.messageFilter,
606
656
  () => resolvedProperties.value,