@copilotkit/core 1.87.0 → 1.88.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/dist/generative-ui/index.d.cts +1 -1
- package/dist/generative-ui/index.d.mts +1 -1
- package/dist/{index-BC1dzn_F.d.mts → index-CDKkFjm_.d.cts} +49 -6
- package/dist/index-CDKkFjm_.d.cts.map +1 -0
- package/dist/{index-wj1XowZI.d.cts → index-CoZgNZB2.d.mts} +49 -6
- package/dist/index-CoZgNZB2.d.mts.map +1 -0
- package/dist/index.cjs +182 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +182 -23
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +187 -24
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
- package/dist/index-BC1dzn_F.d.mts.map +0 -1
- package/dist/index-wj1XowZI.d.cts.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as extractCompleteArrayItems, $n as
|
|
2
|
-
export { A2UIMarkdownOperation, A2UI_FENCE_LANGUAGE, ActionConfig, ActionCreator, ActionFromCreator, ActionFromCreators, ActionGroupConfig, ActionGroupResult, AgentRegistry, AgentThreadLockedError, AnyAction, ChildIdsOf, ChildWalkOptions, ContextStore, CopilotKitCore, CopilotKitCoreAddAgentParams, CopilotKitCoreCatalogComponent, CopilotKitCoreConfig, CopilotKitCoreConnectAgentParams, CopilotKitCoreContinuationHandoff, CopilotKitCoreErrorCode, CopilotKitCoreFriendsAccess, CopilotKitCoreGetSuggestionsResult, CopilotKitCoreGetToolParams, CopilotKitCoreRegisterProxiedAgentParams, CopilotKitCoreRegisterProxiedAgentResult, CopilotKitCoreRunAgentParams, CopilotKitCoreRunToolParams, CopilotKitCoreRunToolResult, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreStopAgentParams, CopilotKitCoreSubscriber, CopilotKitCoreSubscription, CopilotKitHeaderResolutionError, CopilotKitHeadersSource, CopilotKitMessageFilter, CopilotRuntimeTransport, DispatchingEffect, DispatchingEffectOptions, DynamicSuggestionsConfig, Effect, EmptyActionConfig, FrontendTool, FrontendToolHandlerContext, FrontendToolReconnectBehavior, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, InspectorActiveThreadPayload, InspectorMetadataV1, InspectorStopViewingPayload, InspectorViewThreadPayload, InspectorViewThreadResultPayload, IntelligenceAgent, IntelligenceAgentConfig, IntelligenceRuntimeInfo, JsonValue, LearningConfig, LegacyLearningConfig, MEMORY_ERROR_REGISTRY, MarkdownSegment, Memory, MemoryChanges, MemoryError, MemoryErrorCategory, MemoryErrorCode, MemoryErrorRegistryEntry, MemoryKind, MemoryRealtimeStatus, MemoryScope, NewMemory, NonDispatchingEffect, NonDispatchingEffectOptions, OpenThreadRegistration, PropsActionConfig, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgentConfig, Reducer, RunCompletionAware, RunHandler, RuntimeLicenseStatus, RuntimeMode, ScopedContext, ScopedProperties, Selector, StartResult, StateManager, StaticSuggestionsConfig, Store, StoreLifecycleAction, SubscribeToAgentOptions, SubscribeToAgentSubscriber, Suggestion, SuggestionAvailability, SuggestionEngine, SuggestionsConfig, SurfaceSegment, ThreadEndpointRuntimeInfo, ThreadRunActivityNotification, ToolCallStatus, TrajectoryStartOptions, WebMCPModelContext, WebMCPRegistry, WebMCPToolAnnotations, WebMCPToolConfig, classifySurfaceCards, completePartialMarkdown, createActionGroup, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, emitInspectorActiveThread, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, empty, ensureObjectArgs, extractCompleteArrayItems, extractFenceOperations, extractStringField, flattenInformationalCards, getMarkdownOperationSurfaceId, getWebMCPModelContext, isAbortError, isInspectorThreadBridgeEnabled, isRunCompletionAware, ofType, on, onInspectorActiveThread, onInspectorStopViewing, onInspectorViewThread, onInspectorViewThreadResult, parseToolArguments, prepareSurfaceOperations, props, segmentSurfaceProse, select, splitA2UIMarkdown, ɵCOPILOTKIT_FEATURES, ɵCopilotKitFeature, ɵGenerativeUIDebugFunction, ɵGenerativeUIDebugPromptSection, ɵGenerativeUIDebugRun, ɵGenerativeUIDebugSnapshot, ɵGenerativeUIDebugSource, ɵGenerativeUIDebugSurface, ɵInterruptDecision, ɵInterruptEvent, ɵInterruptState, ɵInterruptToolResult, ɵMAX_SOCKET_RETRIES, ɵMemoryEnvironment, ɵMemoryMetadataEvent, ɵMemoryRuntimeContext, ɵMemoryState, ɵMemoryStore, ɵPendingInterrupt, ɵPhoenixChannelLike, ɵPhoenixChannelOptions, ɵPhoenixChannelSession, ɵPhoenixJoinOutcome, ɵPhoenixPushLike, ɵPhoenixSocketLike, ɵPhoenixSocketOptions, ɵPhoenixSocketSession, ɵPhoenixSocketSignal, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵThread, ɵThreadEnvironment, ɵThreadMetadataEvent, ɵThreadRuntimeContext, ɵThreadSelectors, ɵThreadStore, ɵclearAgentInterruptState, createMemoryStore as ɵcreateMemoryStore, ɵcreateThreadSelectors, createThreadStore as ɵcreateThreadStore, ɵgetAgentInterruptState, ɵisCopilotKitFeature, ɵisHttpAgent, isRetryableStatus as ɵisRetryableMemoryStatus, ɵjoinPhoenixChannel$, ɵmapMemoryMetadataEvent, ɵmemoryAdapterEvents, ɵmemoryDomainEvents, ɵmemoryReducer, ɵmemoryRestEvents, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵselectFetchMoreError, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectIsMutating, ɵselectMemories, ɵselectMemoriesAvailable, ɵselectMemoriesError, ɵselectMemoriesIsLoading, ɵselectMemoriesIsMutating, ɵselectMemoriesRealtimeStatus, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading, ɵthreadAdapterEvents, ɵwithHeaderDefaults };
|
|
1
|
+
import { $ as extractCompleteArrayItems, $n as select, $t as ɵselectMemoriesError, A as createThreadStore, An as ActionGroupConfig, Ar as FrontendTool, At as ɵgetAgentInterruptState, B as ɵselectFetchMoreError, Bn as Reducer, Br as SuggestionsConfig, Bt as createMemoryStore, C as ɵGenerativeUIDebugFunction, Cn as ɵobservePhoenixSocketSignals$, Cr as CopilotKitCoreRegisterProxiedAgentResult, Ct as onInspectorViewThreadResult, D as ɵGenerativeUIDebugSource, Dn as ActionCreator, Dr as CopilotKitMessageFilter, Dt as ɵInterruptToolResult, E as ɵGenerativeUIDebugSnapshot, En as ActionConfig, Er as ProxiedCopilotRuntimeAgentConfig, Et as ɵInterruptState, F as ɵThreadMetadataEvent, Fn as Effect, Fr as RuntimeLicenseStatus, Ft as MemoryChanges, G as ɵselectThreadsError, Gn as createEffect, Gr as LearningConfig, Gt as ɵMemoryStore, H as ɵselectIsFetchingNextPage, Hn as Store, Hr as ToolCallStatus, Ht as ɵMemoryMetadataEvent, I as ɵThreadRuntimeContext, In as EmptyActionConfig, Ir as RuntimeMode, It as MemoryKind, J as A2UIMarkdownOperation, Jn as createStore, Jr as TrajectoryStartOptions, Jt as ɵmemoryDomainEvents, K as ɵselectThreadsIsLoading, Kn as createReducer, Kr as LegacyLearningConfig, Kt as ɵmapMemoryMetadataEvent, L as ɵThreadSelectors, Ln as NonDispatchingEffect, Lr as StaticSuggestionsConfig, Lt as MemoryRealtimeStatus, M as ɵTHREAD_REQUEST_TIMEOUT_MS, Mn as AnyAction, Mr as FrontendToolReconnectBehavior, Mt as ɵCopilotKitFeature, N as ɵThread, Nn as DispatchingEffect, Nr as InspectorMetadataV1, Nt as ɵisCopilotKitFeature, O as ɵGenerativeUIDebugSurface, On as ActionFromCreator, Or as CopilotRuntimeTransport, Ot as ɵPendingInterrupt, P as ɵThreadEnvironment, Pn as DispatchingEffectOptions, Pr as IntelligenceRuntimeInfo, Pt as Memory, Q as classifySurfaceCards, Qn as props, Qt as ɵselectMemoriesAvailable, R as ɵThreadStore, Rn as NonDispatchingEffectOptions, Rr as Suggestion, Rt as MemoryScope, S as ɵwithHeaderDefaults, Sn as ɵobservePhoenixSocketHealth$, Sr as CopilotKitCoreRegisterProxiedAgentParams, St as onInspectorViewThread, T as ɵGenerativeUIDebugRun, Tn as ɵphoenixSocket$, Tr as ProxiedCopilotRuntimeAgent, Tt as ɵInterruptEvent, U as ɵselectIsMutating, Un as StoreLifecycleAction, Ur as WebMCPToolAnnotations, Ut as ɵMemoryRuntimeContext, V as ɵselectHasNextPage, Vn as Selector, Vr as ThreadEndpointRuntimeInfo, Vt as ɵMemoryEnvironment, W as ɵselectThreads, Wn as createActionGroup, Wr as WebMCPToolConfig, Wt as ɵMemoryState, X as ChildWalkOptions, Xn as ofType, Xt as ɵmemoryRestEvents, Y as ChildIdsOf, Yn as empty, Yt as ɵmemoryReducer, Z as SurfaceSegment, Zn as on, Zt as ɵselectMemories, _ as StartResult, _n as ɵPhoenixSocketSession, _r as StateManager, _t as emitInspectorViewThread, a as isAbortError, an as MemoryErrorCategory, ar as ɵisHttpAgent, at as segmentSurfaceProse, b as CopilotKitHeaderResolutionError, bn as ɵobservePhoenixEvent$, br as AgentRegistry, bt as onInspectorActiveThread, c as CopilotKitCoreErrorCode, cn as isRetryableStatus, cr as CopilotKitCoreConnectAgentParams, ct as splitA2UIMarkdown, d as CopilotKitCoreRuntimeConnectionStatus, dn as ɵPhoenixChannelParams, dr as CopilotKitCoreRunToolParams, dt as InspectorStopViewingPayload, en as ɵselectMemoriesIsLoading, er as AgentThreadLockedError, et as extractFenceOperations, f as CopilotKitCoreStopAgentParams, fn as ɵPhoenixChannelSession, fr as CopilotKitCoreRunToolResult, ft as InspectorViewThreadPayload, g as ScopedProperties, gn as ɵPhoenixSocketOptions, gr as CopilotKitCoreContinuationHandoff, gt as emitInspectorStopViewing, h as JsonValue, hn as ɵPhoenixSocketLike, hr as parseToolArguments, ht as emitInspectorActiveThread, i as SuggestionEngine, in as MemoryError, ir as isRunCompletionAware, it as prepareSurfaceOperations, j as ɵMAX_SOCKET_RETRIES, jn as ActionGroupResult, jr as FrontendToolHandlerContext, jt as ɵCOPILOTKIT_FEATURES, k as ThreadRunActivityNotification, kn as ActionFromCreators, kr as DynamicSuggestionsConfig, kt as ɵclearAgentInterruptState, l as CopilotKitCoreFriendsAccess, ln as ɵPhoenixChannelLike, lr as CopilotKitCoreGetToolParams, lt as INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, m as CopilotKitCoreSubscription, mn as ɵPhoenixPushLike, mr as ensureObjectArgs, mt as createInspectorThreadRequestId, n as WebMCPRegistry, nn as ɵselectMemoriesRealtimeStatus, nr as IntelligenceAgentConfig, nt as flattenInformationalCards, o as CopilotKitCore, on as MemoryErrorCode, or as completePartialMarkdown, ot as A2UI_FENCE_LANGUAGE, p as CopilotKitCoreSubscriber, pn as ɵPhoenixJoinOutcome, pr as RunHandler, pt as InspectorViewThreadResultPayload, q as ɵthreadAdapterEvents, qn as createSelector, qr as OpenThreadRegistration, qt as ɵmemoryAdapterEvents, r as getWebMCPModelContext, rn as MEMORY_ERROR_REGISTRY, rr as RunCompletionAware, rt as getMarkdownOperationSurfaceId, s as CopilotKitCoreConfig, sn as MemoryErrorRegistryEntry, sr as CopilotKitCoreCatalogComponent, st as MarkdownSegment, t as WebMCPModelContext, tn as ɵselectMemoriesIsMutating, tr as IntelligenceAgent, tt as extractStringField, u as CopilotKitCoreGetSuggestionsResult, un as ɵPhoenixChannelOptions, ur as CopilotKitCoreRunAgentParams, ut as InspectorActiveThreadPayload, v as SubscribeToAgentOptions, vn as ɵPhoenixSocketSignal, vr as ContextStore, vt as emitInspectorViewThreadResult, w as ɵGenerativeUIDebugPromptSection, wn as ɵphoenixChannel$, wr as ɵRUNTIME_PROBE_TIMEOUT_MS, wt as ɵInterruptDecision, x as CopilotKitHeadersSource, xn as ɵobservePhoenixJoinOutcome$, xr as CopilotKitCoreAddAgentParams, xt as onInspectorStopViewing, y as SubscribeToAgentSubscriber, yn as ɵjoinPhoenixChannel$, yr as ScopedContext, yt as isInspectorThreadBridgeEnabled, z as ɵcreateThreadSelectors, zn as PropsActionConfig, zr as SuggestionAvailability, zt as NewMemory } from "./index-CDKkFjm_.cjs";
|
|
2
|
+
export { A2UIMarkdownOperation, A2UI_FENCE_LANGUAGE, ActionConfig, ActionCreator, ActionFromCreator, ActionFromCreators, ActionGroupConfig, ActionGroupResult, AgentRegistry, AgentThreadLockedError, AnyAction, ChildIdsOf, ChildWalkOptions, ContextStore, CopilotKitCore, CopilotKitCoreAddAgentParams, CopilotKitCoreCatalogComponent, CopilotKitCoreConfig, CopilotKitCoreConnectAgentParams, CopilotKitCoreContinuationHandoff, CopilotKitCoreErrorCode, CopilotKitCoreFriendsAccess, CopilotKitCoreGetSuggestionsResult, CopilotKitCoreGetToolParams, CopilotKitCoreRegisterProxiedAgentParams, CopilotKitCoreRegisterProxiedAgentResult, CopilotKitCoreRunAgentParams, CopilotKitCoreRunToolParams, CopilotKitCoreRunToolResult, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreStopAgentParams, CopilotKitCoreSubscriber, CopilotKitCoreSubscription, CopilotKitHeaderResolutionError, CopilotKitHeadersSource, CopilotKitMessageFilter, CopilotRuntimeTransport, DispatchingEffect, DispatchingEffectOptions, DynamicSuggestionsConfig, Effect, EmptyActionConfig, FrontendTool, FrontendToolHandlerContext, FrontendToolReconnectBehavior, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, InspectorActiveThreadPayload, InspectorMetadataV1, InspectorStopViewingPayload, InspectorViewThreadPayload, InspectorViewThreadResultPayload, IntelligenceAgent, IntelligenceAgentConfig, IntelligenceRuntimeInfo, JsonValue, LearningConfig, LegacyLearningConfig, MEMORY_ERROR_REGISTRY, MarkdownSegment, Memory, MemoryChanges, MemoryError, MemoryErrorCategory, MemoryErrorCode, MemoryErrorRegistryEntry, MemoryKind, MemoryRealtimeStatus, MemoryScope, NewMemory, NonDispatchingEffect, NonDispatchingEffectOptions, OpenThreadRegistration, PropsActionConfig, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgentConfig, Reducer, RunCompletionAware, RunHandler, RuntimeLicenseStatus, RuntimeMode, ScopedContext, ScopedProperties, Selector, StartResult, StateManager, StaticSuggestionsConfig, Store, StoreLifecycleAction, SubscribeToAgentOptions, SubscribeToAgentSubscriber, Suggestion, SuggestionAvailability, SuggestionEngine, SuggestionsConfig, SurfaceSegment, ThreadEndpointRuntimeInfo, ThreadRunActivityNotification, ToolCallStatus, TrajectoryStartOptions, WebMCPModelContext, WebMCPRegistry, WebMCPToolAnnotations, WebMCPToolConfig, classifySurfaceCards, completePartialMarkdown, createActionGroup, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, emitInspectorActiveThread, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, empty, ensureObjectArgs, extractCompleteArrayItems, extractFenceOperations, extractStringField, flattenInformationalCards, getMarkdownOperationSurfaceId, getWebMCPModelContext, isAbortError, isInspectorThreadBridgeEnabled, isRunCompletionAware, ofType, on, onInspectorActiveThread, onInspectorStopViewing, onInspectorViewThread, onInspectorViewThreadResult, parseToolArguments, prepareSurfaceOperations, props, segmentSurfaceProse, select, splitA2UIMarkdown, ɵCOPILOTKIT_FEATURES, ɵCopilotKitFeature, ɵGenerativeUIDebugFunction, ɵGenerativeUIDebugPromptSection, ɵGenerativeUIDebugRun, ɵGenerativeUIDebugSnapshot, ɵGenerativeUIDebugSource, ɵGenerativeUIDebugSurface, ɵInterruptDecision, ɵInterruptEvent, ɵInterruptState, ɵInterruptToolResult, ɵMAX_SOCKET_RETRIES, ɵMemoryEnvironment, ɵMemoryMetadataEvent, ɵMemoryRuntimeContext, ɵMemoryState, ɵMemoryStore, ɵPendingInterrupt, ɵPhoenixChannelLike, ɵPhoenixChannelOptions, ɵPhoenixChannelParams, ɵPhoenixChannelSession, ɵPhoenixJoinOutcome, ɵPhoenixPushLike, ɵPhoenixSocketLike, ɵPhoenixSocketOptions, ɵPhoenixSocketSession, ɵPhoenixSocketSignal, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵThread, ɵThreadEnvironment, ɵThreadMetadataEvent, ɵThreadRuntimeContext, ɵThreadSelectors, ɵThreadStore, ɵclearAgentInterruptState, createMemoryStore as ɵcreateMemoryStore, ɵcreateThreadSelectors, createThreadStore as ɵcreateThreadStore, ɵgetAgentInterruptState, ɵisCopilotKitFeature, ɵisHttpAgent, isRetryableStatus as ɵisRetryableMemoryStatus, ɵjoinPhoenixChannel$, ɵmapMemoryMetadataEvent, ɵmemoryAdapterEvents, ɵmemoryDomainEvents, ɵmemoryReducer, ɵmemoryRestEvents, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵselectFetchMoreError, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectIsMutating, ɵselectMemories, ɵselectMemoriesAvailable, ɵselectMemoriesError, ɵselectMemoriesIsLoading, ɵselectMemoriesIsMutating, ɵselectMemoriesRealtimeStatus, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading, ɵthreadAdapterEvents, ɵwithHeaderDefaults };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as extractCompleteArrayItems, $n as
|
|
2
|
-
export { A2UIMarkdownOperation, A2UI_FENCE_LANGUAGE, ActionConfig, ActionCreator, ActionFromCreator, ActionFromCreators, ActionGroupConfig, ActionGroupResult, AgentRegistry, AgentThreadLockedError, AnyAction, ChildIdsOf, ChildWalkOptions, ContextStore, CopilotKitCore, CopilotKitCoreAddAgentParams, CopilotKitCoreCatalogComponent, CopilotKitCoreConfig, CopilotKitCoreConnectAgentParams, CopilotKitCoreContinuationHandoff, CopilotKitCoreErrorCode, CopilotKitCoreFriendsAccess, CopilotKitCoreGetSuggestionsResult, CopilotKitCoreGetToolParams, CopilotKitCoreRegisterProxiedAgentParams, CopilotKitCoreRegisterProxiedAgentResult, CopilotKitCoreRunAgentParams, CopilotKitCoreRunToolParams, CopilotKitCoreRunToolResult, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreStopAgentParams, CopilotKitCoreSubscriber, CopilotKitCoreSubscription, CopilotKitHeaderResolutionError, CopilotKitHeadersSource, CopilotKitMessageFilter, CopilotRuntimeTransport, DispatchingEffect, DispatchingEffectOptions, DynamicSuggestionsConfig, Effect, EmptyActionConfig, FrontendTool, FrontendToolHandlerContext, FrontendToolReconnectBehavior, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, InspectorActiveThreadPayload, InspectorMetadataV1, InspectorStopViewingPayload, InspectorViewThreadPayload, InspectorViewThreadResultPayload, IntelligenceAgent, IntelligenceAgentConfig, IntelligenceRuntimeInfo, JsonValue, LearningConfig, LegacyLearningConfig, MEMORY_ERROR_REGISTRY, MarkdownSegment, Memory, MemoryChanges, MemoryError, MemoryErrorCategory, MemoryErrorCode, MemoryErrorRegistryEntry, MemoryKind, MemoryRealtimeStatus, MemoryScope, NewMemory, NonDispatchingEffect, NonDispatchingEffectOptions, OpenThreadRegistration, PropsActionConfig, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgentConfig, Reducer, RunCompletionAware, RunHandler, RuntimeLicenseStatus, RuntimeMode, ScopedContext, ScopedProperties, Selector, StartResult, StateManager, StaticSuggestionsConfig, Store, StoreLifecycleAction, SubscribeToAgentOptions, SubscribeToAgentSubscriber, Suggestion, SuggestionAvailability, SuggestionEngine, SuggestionsConfig, SurfaceSegment, ThreadEndpointRuntimeInfo, ThreadRunActivityNotification, ToolCallStatus, TrajectoryStartOptions, WebMCPModelContext, WebMCPRegistry, WebMCPToolAnnotations, WebMCPToolConfig, classifySurfaceCards, completePartialMarkdown, createActionGroup, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, emitInspectorActiveThread, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, empty, ensureObjectArgs, extractCompleteArrayItems, extractFenceOperations, extractStringField, flattenInformationalCards, getMarkdownOperationSurfaceId, getWebMCPModelContext, isAbortError, isInspectorThreadBridgeEnabled, isRunCompletionAware, ofType, on, onInspectorActiveThread, onInspectorStopViewing, onInspectorViewThread, onInspectorViewThreadResult, parseToolArguments, prepareSurfaceOperations, props, segmentSurfaceProse, select, splitA2UIMarkdown, ɵCOPILOTKIT_FEATURES, ɵCopilotKitFeature, ɵGenerativeUIDebugFunction, ɵGenerativeUIDebugPromptSection, ɵGenerativeUIDebugRun, ɵGenerativeUIDebugSnapshot, ɵGenerativeUIDebugSource, ɵGenerativeUIDebugSurface, ɵInterruptDecision, ɵInterruptEvent, ɵInterruptState, ɵInterruptToolResult, ɵMAX_SOCKET_RETRIES, ɵMemoryEnvironment, ɵMemoryMetadataEvent, ɵMemoryRuntimeContext, ɵMemoryState, ɵMemoryStore, ɵPendingInterrupt, ɵPhoenixChannelLike, ɵPhoenixChannelOptions, ɵPhoenixChannelSession, ɵPhoenixJoinOutcome, ɵPhoenixPushLike, ɵPhoenixSocketLike, ɵPhoenixSocketOptions, ɵPhoenixSocketSession, ɵPhoenixSocketSignal, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵThread, ɵThreadEnvironment, ɵThreadMetadataEvent, ɵThreadRuntimeContext, ɵThreadSelectors, ɵThreadStore, ɵclearAgentInterruptState, createMemoryStore as ɵcreateMemoryStore, ɵcreateThreadSelectors, createThreadStore as ɵcreateThreadStore, ɵgetAgentInterruptState, ɵisCopilotKitFeature, ɵisHttpAgent, isRetryableStatus as ɵisRetryableMemoryStatus, ɵjoinPhoenixChannel$, ɵmapMemoryMetadataEvent, ɵmemoryAdapterEvents, ɵmemoryDomainEvents, ɵmemoryReducer, ɵmemoryRestEvents, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵselectFetchMoreError, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectIsMutating, ɵselectMemories, ɵselectMemoriesAvailable, ɵselectMemoriesError, ɵselectMemoriesIsLoading, ɵselectMemoriesIsMutating, ɵselectMemoriesRealtimeStatus, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading, ɵthreadAdapterEvents, ɵwithHeaderDefaults };
|
|
1
|
+
import { $ as extractCompleteArrayItems, $n as select, $t as ɵselectMemoriesError, A as createThreadStore, An as ActionGroupConfig, Ar as FrontendTool, At as ɵgetAgentInterruptState, B as ɵselectFetchMoreError, Bn as Reducer, Br as SuggestionsConfig, Bt as createMemoryStore, C as ɵGenerativeUIDebugFunction, Cn as ɵobservePhoenixSocketSignals$, Cr as CopilotKitCoreRegisterProxiedAgentResult, Ct as onInspectorViewThreadResult, D as ɵGenerativeUIDebugSource, Dn as ActionCreator, Dr as CopilotKitMessageFilter, Dt as ɵInterruptToolResult, E as ɵGenerativeUIDebugSnapshot, En as ActionConfig, Er as ProxiedCopilotRuntimeAgentConfig, Et as ɵInterruptState, F as ɵThreadMetadataEvent, Fn as Effect, Fr as RuntimeLicenseStatus, Ft as MemoryChanges, G as ɵselectThreadsError, Gn as createEffect, Gr as LearningConfig, Gt as ɵMemoryStore, H as ɵselectIsFetchingNextPage, Hn as Store, Hr as ToolCallStatus, Ht as ɵMemoryMetadataEvent, I as ɵThreadRuntimeContext, In as EmptyActionConfig, Ir as RuntimeMode, It as MemoryKind, J as A2UIMarkdownOperation, Jn as createStore, Jr as TrajectoryStartOptions, Jt as ɵmemoryDomainEvents, K as ɵselectThreadsIsLoading, Kn as createReducer, Kr as LegacyLearningConfig, Kt as ɵmapMemoryMetadataEvent, L as ɵThreadSelectors, Ln as NonDispatchingEffect, Lr as StaticSuggestionsConfig, Lt as MemoryRealtimeStatus, M as ɵTHREAD_REQUEST_TIMEOUT_MS, Mn as AnyAction, Mr as FrontendToolReconnectBehavior, Mt as ɵCopilotKitFeature, N as ɵThread, Nn as DispatchingEffect, Nr as InspectorMetadataV1, Nt as ɵisCopilotKitFeature, O as ɵGenerativeUIDebugSurface, On as ActionFromCreator, Or as CopilotRuntimeTransport, Ot as ɵPendingInterrupt, P as ɵThreadEnvironment, Pn as DispatchingEffectOptions, Pr as IntelligenceRuntimeInfo, Pt as Memory, Q as classifySurfaceCards, Qn as props, Qt as ɵselectMemoriesAvailable, R as ɵThreadStore, Rn as NonDispatchingEffectOptions, Rr as Suggestion, Rt as MemoryScope, S as ɵwithHeaderDefaults, Sn as ɵobservePhoenixSocketHealth$, Sr as CopilotKitCoreRegisterProxiedAgentParams, St as onInspectorViewThread, T as ɵGenerativeUIDebugRun, Tn as ɵphoenixSocket$, Tr as ProxiedCopilotRuntimeAgent, Tt as ɵInterruptEvent, U as ɵselectIsMutating, Un as StoreLifecycleAction, Ur as WebMCPToolAnnotations, Ut as ɵMemoryRuntimeContext, V as ɵselectHasNextPage, Vn as Selector, Vr as ThreadEndpointRuntimeInfo, Vt as ɵMemoryEnvironment, W as ɵselectThreads, Wn as createActionGroup, Wr as WebMCPToolConfig, Wt as ɵMemoryState, X as ChildWalkOptions, Xn as ofType, Xt as ɵmemoryRestEvents, Y as ChildIdsOf, Yn as empty, Yt as ɵmemoryReducer, Z as SurfaceSegment, Zn as on, Zt as ɵselectMemories, _ as StartResult, _n as ɵPhoenixSocketSession, _r as StateManager, _t as emitInspectorViewThread, a as isAbortError, an as MemoryErrorCategory, ar as ɵisHttpAgent, at as segmentSurfaceProse, b as CopilotKitHeaderResolutionError, bn as ɵobservePhoenixEvent$, br as AgentRegistry, bt as onInspectorActiveThread, c as CopilotKitCoreErrorCode, cn as isRetryableStatus, cr as CopilotKitCoreConnectAgentParams, ct as splitA2UIMarkdown, d as CopilotKitCoreRuntimeConnectionStatus, dn as ɵPhoenixChannelParams, dr as CopilotKitCoreRunToolParams, dt as InspectorStopViewingPayload, en as ɵselectMemoriesIsLoading, er as AgentThreadLockedError, et as extractFenceOperations, f as CopilotKitCoreStopAgentParams, fn as ɵPhoenixChannelSession, fr as CopilotKitCoreRunToolResult, ft as InspectorViewThreadPayload, g as ScopedProperties, gn as ɵPhoenixSocketOptions, gr as CopilotKitCoreContinuationHandoff, gt as emitInspectorStopViewing, h as JsonValue, hn as ɵPhoenixSocketLike, hr as parseToolArguments, ht as emitInspectorActiveThread, i as SuggestionEngine, in as MemoryError, ir as isRunCompletionAware, it as prepareSurfaceOperations, j as ɵMAX_SOCKET_RETRIES, jn as ActionGroupResult, jr as FrontendToolHandlerContext, jt as ɵCOPILOTKIT_FEATURES, k as ThreadRunActivityNotification, kn as ActionFromCreators, kr as DynamicSuggestionsConfig, kt as ɵclearAgentInterruptState, l as CopilotKitCoreFriendsAccess, ln as ɵPhoenixChannelLike, lr as CopilotKitCoreGetToolParams, lt as INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, m as CopilotKitCoreSubscription, mn as ɵPhoenixPushLike, mr as ensureObjectArgs, mt as createInspectorThreadRequestId, n as WebMCPRegistry, nn as ɵselectMemoriesRealtimeStatus, nr as IntelligenceAgentConfig, nt as flattenInformationalCards, o as CopilotKitCore, on as MemoryErrorCode, or as completePartialMarkdown, ot as A2UI_FENCE_LANGUAGE, p as CopilotKitCoreSubscriber, pn as ɵPhoenixJoinOutcome, pr as RunHandler, pt as InspectorViewThreadResultPayload, q as ɵthreadAdapterEvents, qn as createSelector, qr as OpenThreadRegistration, qt as ɵmemoryAdapterEvents, r as getWebMCPModelContext, rn as MEMORY_ERROR_REGISTRY, rr as RunCompletionAware, rt as getMarkdownOperationSurfaceId, s as CopilotKitCoreConfig, sn as MemoryErrorRegistryEntry, sr as CopilotKitCoreCatalogComponent, st as MarkdownSegment, t as WebMCPModelContext, tn as ɵselectMemoriesIsMutating, tr as IntelligenceAgent, tt as extractStringField, u as CopilotKitCoreGetSuggestionsResult, un as ɵPhoenixChannelOptions, ur as CopilotKitCoreRunAgentParams, ut as InspectorActiveThreadPayload, v as SubscribeToAgentOptions, vn as ɵPhoenixSocketSignal, vr as ContextStore, vt as emitInspectorViewThreadResult, w as ɵGenerativeUIDebugPromptSection, wn as ɵphoenixChannel$, wr as ɵRUNTIME_PROBE_TIMEOUT_MS, wt as ɵInterruptDecision, x as CopilotKitHeadersSource, xn as ɵobservePhoenixJoinOutcome$, xr as CopilotKitCoreAddAgentParams, xt as onInspectorStopViewing, y as SubscribeToAgentSubscriber, yn as ɵjoinPhoenixChannel$, yr as ScopedContext, yt as isInspectorThreadBridgeEnabled, z as ɵcreateThreadSelectors, zn as PropsActionConfig, zr as SuggestionAvailability, zt as NewMemory } from "./index-CoZgNZB2.mjs";
|
|
2
|
+
export { A2UIMarkdownOperation, A2UI_FENCE_LANGUAGE, ActionConfig, ActionCreator, ActionFromCreator, ActionFromCreators, ActionGroupConfig, ActionGroupResult, AgentRegistry, AgentThreadLockedError, AnyAction, ChildIdsOf, ChildWalkOptions, ContextStore, CopilotKitCore, CopilotKitCoreAddAgentParams, CopilotKitCoreCatalogComponent, CopilotKitCoreConfig, CopilotKitCoreConnectAgentParams, CopilotKitCoreContinuationHandoff, CopilotKitCoreErrorCode, CopilotKitCoreFriendsAccess, CopilotKitCoreGetSuggestionsResult, CopilotKitCoreGetToolParams, CopilotKitCoreRegisterProxiedAgentParams, CopilotKitCoreRegisterProxiedAgentResult, CopilotKitCoreRunAgentParams, CopilotKitCoreRunToolParams, CopilotKitCoreRunToolResult, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreStopAgentParams, CopilotKitCoreSubscriber, CopilotKitCoreSubscription, CopilotKitHeaderResolutionError, CopilotKitHeadersSource, CopilotKitMessageFilter, CopilotRuntimeTransport, DispatchingEffect, DispatchingEffectOptions, DynamicSuggestionsConfig, Effect, EmptyActionConfig, FrontendTool, FrontendToolHandlerContext, FrontendToolReconnectBehavior, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, InspectorActiveThreadPayload, InspectorMetadataV1, InspectorStopViewingPayload, InspectorViewThreadPayload, InspectorViewThreadResultPayload, IntelligenceAgent, IntelligenceAgentConfig, IntelligenceRuntimeInfo, JsonValue, LearningConfig, LegacyLearningConfig, MEMORY_ERROR_REGISTRY, MarkdownSegment, Memory, MemoryChanges, MemoryError, MemoryErrorCategory, MemoryErrorCode, MemoryErrorRegistryEntry, MemoryKind, MemoryRealtimeStatus, MemoryScope, NewMemory, NonDispatchingEffect, NonDispatchingEffectOptions, OpenThreadRegistration, PropsActionConfig, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgentConfig, Reducer, RunCompletionAware, RunHandler, RuntimeLicenseStatus, RuntimeMode, ScopedContext, ScopedProperties, Selector, StartResult, StateManager, StaticSuggestionsConfig, Store, StoreLifecycleAction, SubscribeToAgentOptions, SubscribeToAgentSubscriber, Suggestion, SuggestionAvailability, SuggestionEngine, SuggestionsConfig, SurfaceSegment, ThreadEndpointRuntimeInfo, ThreadRunActivityNotification, ToolCallStatus, TrajectoryStartOptions, WebMCPModelContext, WebMCPRegistry, WebMCPToolAnnotations, WebMCPToolConfig, classifySurfaceCards, completePartialMarkdown, createActionGroup, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, emitInspectorActiveThread, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, empty, ensureObjectArgs, extractCompleteArrayItems, extractFenceOperations, extractStringField, flattenInformationalCards, getMarkdownOperationSurfaceId, getWebMCPModelContext, isAbortError, isInspectorThreadBridgeEnabled, isRunCompletionAware, ofType, on, onInspectorActiveThread, onInspectorStopViewing, onInspectorViewThread, onInspectorViewThreadResult, parseToolArguments, prepareSurfaceOperations, props, segmentSurfaceProse, select, splitA2UIMarkdown, ɵCOPILOTKIT_FEATURES, ɵCopilotKitFeature, ɵGenerativeUIDebugFunction, ɵGenerativeUIDebugPromptSection, ɵGenerativeUIDebugRun, ɵGenerativeUIDebugSnapshot, ɵGenerativeUIDebugSource, ɵGenerativeUIDebugSurface, ɵInterruptDecision, ɵInterruptEvent, ɵInterruptState, ɵInterruptToolResult, ɵMAX_SOCKET_RETRIES, ɵMemoryEnvironment, ɵMemoryMetadataEvent, ɵMemoryRuntimeContext, ɵMemoryState, ɵMemoryStore, ɵPendingInterrupt, ɵPhoenixChannelLike, ɵPhoenixChannelOptions, ɵPhoenixChannelParams, ɵPhoenixChannelSession, ɵPhoenixJoinOutcome, ɵPhoenixPushLike, ɵPhoenixSocketLike, ɵPhoenixSocketOptions, ɵPhoenixSocketSession, ɵPhoenixSocketSignal, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵThread, ɵThreadEnvironment, ɵThreadMetadataEvent, ɵThreadRuntimeContext, ɵThreadSelectors, ɵThreadStore, ɵclearAgentInterruptState, createMemoryStore as ɵcreateMemoryStore, ɵcreateThreadSelectors, createThreadStore as ɵcreateThreadStore, ɵgetAgentInterruptState, ɵisCopilotKitFeature, ɵisHttpAgent, isRetryableStatus as ɵisRetryableMemoryStatus, ɵjoinPhoenixChannel$, ɵmapMemoryMetadataEvent, ɵmemoryAdapterEvents, ɵmemoryDomainEvents, ɵmemoryReducer, ɵmemoryRestEvents, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵselectFetchMoreError, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectIsMutating, ɵselectMemories, ɵselectMemoriesAvailable, ɵselectMemoriesError, ɵselectMemoriesIsLoading, ɵselectMemoriesIsMutating, ɵselectMemoriesRealtimeStatus, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading, ɵthreadAdapterEvents, ɵwithHeaderDefaults };
|
package/dist/index.mjs
CHANGED
|
@@ -290,6 +290,7 @@ const STOP_RUN_EVENT = "stop_run";
|
|
|
290
290
|
const CONNECT_STREAM_IDLE_REPLAY_FALLBACK_MS = 100;
|
|
291
291
|
const CONNECT_IDLE_WARNING_MS = 3e4;
|
|
292
292
|
const MAX_UNOPENED_CREDENTIAL_REFRESHES = 2;
|
|
293
|
+
const MAX_DELIVERED_UNNUMBERED_IDS = 1024;
|
|
293
294
|
function isMcpResourceRead(input) {
|
|
294
295
|
const forwardedProps = input.forwardedProps;
|
|
295
296
|
const request = forwardedProps?.__proxiedMCPRequest;
|
|
@@ -322,7 +323,10 @@ var IntelligenceAgent = class IntelligenceAgent extends AbstractAgent {
|
|
|
322
323
|
*/
|
|
323
324
|
runGeneration = 0;
|
|
324
325
|
sharedState;
|
|
325
|
-
constructor(config, sharedState = {
|
|
326
|
+
constructor(config, sharedState = {
|
|
327
|
+
lastSeenEventIds: /* @__PURE__ */ new Map(),
|
|
328
|
+
lastSeenEventSeqs: /* @__PURE__ */ new Map()
|
|
329
|
+
}) {
|
|
326
330
|
super();
|
|
327
331
|
this.config = config;
|
|
328
332
|
this.sharedState = sharedState;
|
|
@@ -622,7 +626,20 @@ var IntelligenceAgent = class IntelligenceAgent extends AbstractAgent {
|
|
|
622
626
|
bufferSize: 1,
|
|
623
627
|
refCount: true
|
|
624
628
|
}));
|
|
625
|
-
const
|
|
629
|
+
const sessionCursor = {
|
|
630
|
+
latest: null,
|
|
631
|
+
delivered: {
|
|
632
|
+
runs: /* @__PURE__ */ new Map(),
|
|
633
|
+
unnumberedIds: /* @__PURE__ */ new Set()
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
let reconnectCursor = this.readDurableEventId(options.replayCursor ?? this.getReconnectCursor(input));
|
|
637
|
+
const initialParams = this.createThreadChannelParams(input, options.channelMode ?? options.streamMode, options.replayCursor);
|
|
638
|
+
const params = () => {
|
|
639
|
+
if (sessionCursor.latest === null) return initialParams;
|
|
640
|
+
reconnectCursor = sessionCursor.latest;
|
|
641
|
+
return this.createThreadChannelParams(input, "connect", sessionCursor.latest);
|
|
642
|
+
};
|
|
626
643
|
const channel$ = ɵphoenixChannel$({
|
|
627
644
|
socket$,
|
|
628
645
|
topic: credentials.realtime.topic,
|
|
@@ -634,9 +651,8 @@ var IntelligenceAgent = class IntelligenceAgent extends AbstractAgent {
|
|
|
634
651
|
bufferSize: 1,
|
|
635
652
|
refCount: true
|
|
636
653
|
}));
|
|
637
|
-
const reconnectCursor = this.readDurableEventId(options.replayCursor ?? this.getReconnectCursor(input));
|
|
638
654
|
let latestObservedReplayCursor = null;
|
|
639
|
-
const threadEvents$ = this.observeThreadEvents$(input.threadId, channel$, options).pipe(tap((payload) => {
|
|
655
|
+
const threadEvents$ = this.observeThreadEvents$(input.threadId, channel$, options, sessionCursor).pipe(tap((payload) => {
|
|
640
656
|
latestObservedReplayCursor = this.readEventId(payload) ?? latestObservedReplayCursor;
|
|
641
657
|
scheduleIdleWarning();
|
|
642
658
|
}), share());
|
|
@@ -647,13 +663,13 @@ var IntelligenceAgent = class IntelligenceAgent extends AbstractAgent {
|
|
|
647
663
|
const replayFailed$ = channel$.pipe(switchMap$1(({ channel }) => this.observeChannelEvent$(channel, REPLAY_FAILED_EVENT)), tap(() => {
|
|
648
664
|
controlCursor.replayFailed = true;
|
|
649
665
|
}));
|
|
650
|
-
const replayComplete$ = this.observeControlEvent$(input.threadId, channel$, REPLAY_COMPLETE_EVENT, controlCursor).pipe(tap(() => {
|
|
666
|
+
const replayComplete$ = this.observeControlEvent$(input.threadId, channel$, REPLAY_COMPLETE_EVENT, controlCursor, sessionCursor).pipe(tap(() => {
|
|
651
667
|
replayFinished = true;
|
|
652
668
|
scheduleIdleWarning();
|
|
653
669
|
options.lifecycle?.onReplayFinished?.();
|
|
654
670
|
}), share());
|
|
655
|
-
const streamIdle$ = this.observeControlEvent$(input.threadId, channel$, STREAM_IDLE_EVENT, controlCursor).pipe(share());
|
|
656
|
-
const replayRestart$ = merge(this.observeControlEvent$(input.threadId, channel$, "phx_error", controlCursor), ɵobservePhoenixSocketSignals$(socket$).pipe(filter((signal) => signal.type === "error"))).pipe(tap(() => {
|
|
671
|
+
const streamIdle$ = this.observeControlEvent$(input.threadId, channel$, STREAM_IDLE_EVENT, controlCursor, sessionCursor).pipe(share());
|
|
672
|
+
const replayRestart$ = merge(this.observeControlEvent$(input.threadId, channel$, "phx_error", controlCursor, sessionCursor), ɵobservePhoenixSocketSignals$(socket$).pipe(filter((signal) => signal.type === "error"))).pipe(tap(() => {
|
|
657
673
|
replayFinished = false;
|
|
658
674
|
warnedAboutIdle = false;
|
|
659
675
|
clearIdleWarning();
|
|
@@ -684,17 +700,30 @@ var IntelligenceAgent = class IntelligenceAgent extends AbstractAgent {
|
|
|
684
700
|
if (signal.type === "open") onSocketOpen?.();
|
|
685
701
|
})), 5);
|
|
686
702
|
}
|
|
687
|
-
observeThreadEvents$(threadId, channel$, options) {
|
|
688
|
-
return channel$.pipe(switchMap$1(({ channel }) => this.observeChannelEvent$(channel, CLIENT_AG_UI_EVENT)),
|
|
689
|
-
this.
|
|
703
|
+
observeThreadEvents$(threadId, channel$, options, sessionCursor) {
|
|
704
|
+
return channel$.pipe(switchMap$1(({ channel }) => this.observeChannelEvent$(channel, CLIENT_AG_UI_EVENT)), filter((payload) => {
|
|
705
|
+
const eventId = this.readEventId(payload);
|
|
706
|
+
if (eventId === null) return true;
|
|
707
|
+
if (this.markDelivered(sessionCursor.delivered, eventId, payload)) return true;
|
|
708
|
+
this.debugLogger?.lifecycle("INTELLIGENCE", "Dropping a replayed event this connection already delivered.", {
|
|
709
|
+
threadId,
|
|
710
|
+
eventId,
|
|
711
|
+
type: payload.type
|
|
712
|
+
});
|
|
713
|
+
return false;
|
|
714
|
+
}), tap((payload) => {
|
|
715
|
+
if (this.updateLastSeenEventId(threadId, payload)) sessionCursor.latest = this.readEventId(payload);
|
|
690
716
|
}), map((payload) => options.streamMode === "run" ? stripIntelligenceRoutingFields(payload) : payload), mergeMap((payload) => this.createThreadNotifications(payload, {
|
|
691
717
|
completeOnRunError: options.completeOnRunError,
|
|
692
718
|
completeOnRunFinished: options.streamMode === "run",
|
|
693
719
|
errorOnRunError: options.streamMode === "run"
|
|
694
720
|
})), dematerialize());
|
|
695
721
|
}
|
|
696
|
-
observeControlEvent$(threadId, channel$, eventName, controlCursor) {
|
|
697
|
-
return channel$.pipe(switchMap$1(({ channel }) => this.observeChannelEvent$(channel, eventName)), tap((payload) =>
|
|
722
|
+
observeControlEvent$(threadId, channel$, eventName, controlCursor, sessionCursor) {
|
|
723
|
+
return channel$.pipe(switchMap$1(({ channel }) => this.observeChannelEvent$(channel, eventName)), tap((payload) => {
|
|
724
|
+
const applied = this.updateLastSeenEventIdFromControl(threadId, payload, controlCursor);
|
|
725
|
+
if (applied !== null) sessionCursor.latest = applied;
|
|
726
|
+
}));
|
|
698
727
|
}
|
|
699
728
|
observeChannelEvent$(channel, eventName) {
|
|
700
729
|
return ɵobservePhoenixEvent$(channel, eventName);
|
|
@@ -737,18 +766,37 @@ var IntelligenceAgent = class IntelligenceAgent extends AbstractAgent {
|
|
|
737
766
|
*/
|
|
738
767
|
clearReconnectCursor(threadId) {
|
|
739
768
|
this.sharedState.lastSeenEventIds.delete(threadId);
|
|
769
|
+
this.sharedState.lastSeenEventSeqs?.delete(threadId);
|
|
740
770
|
}
|
|
771
|
+
/**
|
|
772
|
+
* Move the thread's cursor to `payload`'s durable event id. Returns whether
|
|
773
|
+
* it moved.
|
|
774
|
+
*
|
|
775
|
+
* The cursor never moves back within a run: an event whose `cpki_event_seq`
|
|
776
|
+
* is at or below the one already recorded for the same run is a replay, and
|
|
777
|
+
* is ignored. `cpki_event_seq` is ordered per run only, so an event of
|
|
778
|
+
* another run, or one without a run id or sequence, cannot be compared and
|
|
779
|
+
* moves the cursor as before (the gateway delivers thread history in order).
|
|
780
|
+
*/
|
|
741
781
|
updateLastSeenEventId(threadId, payload) {
|
|
742
782
|
const eventId = this.readEventId(payload);
|
|
743
|
-
if (!eventId) return;
|
|
783
|
+
if (!eventId) return false;
|
|
784
|
+
const position = this.readEventSequencePosition(payload);
|
|
785
|
+
const seqs = this.sharedState.lastSeenEventSeqs;
|
|
786
|
+
const previous = seqs?.get(threadId);
|
|
787
|
+
if (position && previous && position.runId === previous.runId && position.seq <= previous.seq) return false;
|
|
744
788
|
this.advanceLastSeenEventId(threadId, eventId);
|
|
789
|
+
if (position) seqs?.set(threadId, position);
|
|
790
|
+
else seqs?.delete(threadId);
|
|
791
|
+
return true;
|
|
745
792
|
}
|
|
746
793
|
updateLastSeenEventIdFromControl(threadId, payload, controlCursor) {
|
|
747
794
|
const eventId = this.readControlEventId(payload);
|
|
748
|
-
if (!eventId) return;
|
|
749
|
-
if (eventId === controlCursor.applied && !controlCursor.replayFailed) return;
|
|
795
|
+
if (!eventId) return null;
|
|
796
|
+
if (eventId === controlCursor.applied && !controlCursor.replayFailed) return null;
|
|
750
797
|
controlCursor.applied = eventId;
|
|
751
798
|
this.advanceLastSeenEventId(threadId, eventId);
|
|
799
|
+
return eventId;
|
|
752
800
|
}
|
|
753
801
|
advanceLastSeenEventId(threadId, eventId) {
|
|
754
802
|
this.sharedState.lastSeenEventIds.set(threadId, eventId);
|
|
@@ -759,6 +807,52 @@ var IntelligenceAgent = class IntelligenceAgent extends AbstractAgent {
|
|
|
759
807
|
const eventMetadata = metadata;
|
|
760
808
|
return this.readDurableEventId(eventMetadata.cpki_event_id);
|
|
761
809
|
}
|
|
810
|
+
/**
|
|
811
|
+
* Record `payload` as delivered. Returns false if this session already
|
|
812
|
+
* delivered it, true if it is new.
|
|
813
|
+
*/
|
|
814
|
+
markDelivered(delivered, eventId, payload) {
|
|
815
|
+
const position = this.readEventSequencePosition(payload);
|
|
816
|
+
if (position === null) {
|
|
817
|
+
if (delivered.unnumberedIds.has(eventId)) return false;
|
|
818
|
+
if (delivered.unnumberedIds.size >= MAX_DELIVERED_UNNUMBERED_IDS) {
|
|
819
|
+
const oldest = delivered.unnumberedIds.values().next().value;
|
|
820
|
+
if (oldest !== void 0) delivered.unnumberedIds.delete(oldest);
|
|
821
|
+
}
|
|
822
|
+
delivered.unnumberedIds.add(eventId);
|
|
823
|
+
return true;
|
|
824
|
+
}
|
|
825
|
+
let run = delivered.runs.get(position.runId);
|
|
826
|
+
if (!run) {
|
|
827
|
+
run = {
|
|
828
|
+
from: position.seq,
|
|
829
|
+
through: position.seq - 1,
|
|
830
|
+
above: /* @__PURE__ */ new Set(),
|
|
831
|
+
below: /* @__PURE__ */ new Set()
|
|
832
|
+
};
|
|
833
|
+
delivered.runs.set(position.runId, run);
|
|
834
|
+
}
|
|
835
|
+
if (position.seq < run.from) {
|
|
836
|
+
if (run.below.has(position.seq)) return false;
|
|
837
|
+
run.below.add(position.seq);
|
|
838
|
+
return true;
|
|
839
|
+
}
|
|
840
|
+
if (position.seq <= run.through || run.above.has(position.seq)) return false;
|
|
841
|
+
run.above.add(position.seq);
|
|
842
|
+
while (run.above.delete(run.through + 1)) run.through += 1;
|
|
843
|
+
return true;
|
|
844
|
+
}
|
|
845
|
+
readEventSequencePosition(payload) {
|
|
846
|
+
const event = payload;
|
|
847
|
+
const runId = event.run_id ?? event.runId;
|
|
848
|
+
const metadata = event.metadata;
|
|
849
|
+
const seq = metadata && typeof metadata === "object" ? metadata.cpki_event_seq : void 0;
|
|
850
|
+
if (typeof runId !== "string" || runId === "" || typeof seq !== "number" || !Number.isFinite(seq)) return null;
|
|
851
|
+
return {
|
|
852
|
+
runId,
|
|
853
|
+
seq
|
|
854
|
+
};
|
|
855
|
+
}
|
|
762
856
|
readControlEventId(payload) {
|
|
763
857
|
if (!payload || typeof payload !== "object") return null;
|
|
764
858
|
const controlPayload = payload;
|
|
@@ -4474,7 +4568,27 @@ var RunHandler = class {
|
|
|
4474
4568
|
if (!logicalHandoff) logicalRunId = params.input.runId;
|
|
4475
4569
|
return onRunStartedEvent?.(params);
|
|
4476
4570
|
};
|
|
4571
|
+
let finishedCleanly = false;
|
|
4572
|
+
let leftCallsOpen = false;
|
|
4573
|
+
const onRunFinishedEvent = agentSubscriber.onRunFinishedEvent;
|
|
4574
|
+
const onRunErrorEvent = agentSubscriber.onRunErrorEvent;
|
|
4575
|
+
const onCustomEvent = agentSubscriber.onCustomEvent;
|
|
4576
|
+
agentSubscriber.onRunFinishedEvent = (params) => {
|
|
4577
|
+
const outcome = params.event.outcome?.type;
|
|
4578
|
+
if (outcome === void 0 || outcome === "success") finishedCleanly = true;
|
|
4579
|
+
else leftCallsOpen = true;
|
|
4580
|
+
return onRunFinishedEvent?.(params);
|
|
4581
|
+
};
|
|
4582
|
+
agentSubscriber.onRunErrorEvent = (params) => {
|
|
4583
|
+
leftCallsOpen = true;
|
|
4584
|
+
return onRunErrorEvent?.(params);
|
|
4585
|
+
};
|
|
4586
|
+
agentSubscriber.onCustomEvent = (params) => {
|
|
4587
|
+
if (params.event.name === "on_interrupt") leftCallsOpen = true;
|
|
4588
|
+
return onCustomEvent?.(params);
|
|
4589
|
+
};
|
|
4477
4590
|
const pinRunIdOnWire = runId !== void 0 && !continuationHandoff;
|
|
4591
|
+
const tools = this.buildFrontendTools(agent.agentId);
|
|
4478
4592
|
const agentRunInput = {
|
|
4479
4593
|
forwardedProps: {
|
|
4480
4594
|
...this._internal.getPropertiesForAgent(agent.agentId),
|
|
@@ -4483,7 +4597,7 @@ var RunHandler = class {
|
|
|
4483
4597
|
},
|
|
4484
4598
|
...resume !== void 0 ? { resume } : {},
|
|
4485
4599
|
...pinRunIdOnWire ? { runId } : {},
|
|
4486
|
-
tools
|
|
4600
|
+
tools,
|
|
4487
4601
|
context: this._internal.getContextForAgent(agent.agentId)
|
|
4488
4602
|
};
|
|
4489
4603
|
const runAgentResult = await agent.runAgent(agentRunInput, agentSubscriber);
|
|
@@ -4493,7 +4607,8 @@ var RunHandler = class {
|
|
|
4493
4607
|
runAgentResult,
|
|
4494
4608
|
agent,
|
|
4495
4609
|
runId: logicalRunId,
|
|
4496
|
-
runController: controller
|
|
4610
|
+
runController: controller,
|
|
4611
|
+
advertisedToolNames: finishedCleanly && !leftCallsOpen ? new Set(tools.map((tool) => tool.name)) : void 0
|
|
4497
4612
|
});
|
|
4498
4613
|
} catch (error) {
|
|
4499
4614
|
logicalHandoff?.cancel();
|
|
@@ -4539,7 +4654,7 @@ var RunHandler = class {
|
|
|
4539
4654
|
/**
|
|
4540
4655
|
* Process agent result and execute tools
|
|
4541
4656
|
*/
|
|
4542
|
-
async processAgentResult({ runAgentResult, agent, runId, toolExecutionMode = "all", runController, signal = runController?.signal, connectionGeneration }) {
|
|
4657
|
+
async processAgentResult({ runAgentResult, agent, runId, toolExecutionMode = "all", runController, signal = runController?.signal, advertisedToolNames, connectionGeneration }) {
|
|
4543
4658
|
const { newMessages } = runAgentResult;
|
|
4544
4659
|
const agentId = agent.agentId;
|
|
4545
4660
|
let needsFollowUp = false;
|
|
@@ -4576,11 +4691,18 @@ var RunHandler = class {
|
|
|
4576
4691
|
continue;
|
|
4577
4692
|
}
|
|
4578
4693
|
if (toolExecutionMode === "restore" && (!executableTool || executableTool.handler && executableTool.type !== "human-in-the-loop" && executableTool.reconnectBehavior !== "resume-pending")) continue;
|
|
4579
|
-
|
|
4580
|
-
|
|
4694
|
+
const runResults = newMessages.filter((m) => m.role === "tool" && m.toolCallId === toolCall.id);
|
|
4695
|
+
const answersRemovedTool = !executableTool && !!advertisedToolNames?.has(toolCall.function.name) && runResults.every((m) => this.isFrontendPlaceholderResult(m));
|
|
4696
|
+
if (existingResult && this.isFrontendPlaceholderResult(existingResult) && (toolExecutionMode === "restore" || executableTool?.handler || answersRemovedTool)) {
|
|
4697
|
+
if (answersRemovedTool) {
|
|
4698
|
+
this.removePlaceholderResults(newMessages, toolCall.id);
|
|
4699
|
+
this.removePlaceholderResults(agent.messages, toolCall.id);
|
|
4700
|
+
} else {
|
|
4701
|
+
if (existingResultIndex !== -1) newMessages.splice(existingResultIndex, 1);
|
|
4702
|
+
const agentMsgIdx = agent.messages.findIndex((m) => m.role === "tool" && m.toolCallId === toolCall.id);
|
|
4703
|
+
if (agentMsgIdx !== -1) agent.messages.splice(agentMsgIdx, 1);
|
|
4704
|
+
}
|
|
4581
4705
|
existingResult = void 0;
|
|
4582
|
-
const agentMsgIdx = agent.messages.findIndex((m) => m.role === "tool" && m.toolCallId === toolCall.id);
|
|
4583
|
-
if (agentMsgIdx !== -1) agent.messages.splice(agentMsgIdx, 1);
|
|
4584
4706
|
}
|
|
4585
4707
|
if (!existingResult) {
|
|
4586
4708
|
executing.add(executionKey);
|
|
@@ -4616,7 +4738,7 @@ var RunHandler = class {
|
|
|
4616
4738
|
ownsHandlerFollowUp ||= !!fallbackTool.handler;
|
|
4617
4739
|
needsFollowUp = true;
|
|
4618
4740
|
}
|
|
4619
|
-
}
|
|
4741
|
+
} else if (advertisedToolNames?.has(toolCall.function.name)) await this.rejectUnregisteredTool(toolCall, message, agent, agentId);
|
|
4620
4742
|
}
|
|
4621
4743
|
} finally {
|
|
4622
4744
|
executing.delete(executionKey);
|
|
@@ -4678,6 +4800,13 @@ var RunHandler = class {
|
|
|
4678
4800
|
}
|
|
4679
4801
|
return insertAt;
|
|
4680
4802
|
}
|
|
4803
|
+
/** Removes, in place, every placeholder result for `toolCallId`. */
|
|
4804
|
+
removePlaceholderResults(messages, toolCallId) {
|
|
4805
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
4806
|
+
const m = messages[i];
|
|
4807
|
+
if (m.role === "tool" && m.toolCallId === toolCallId && this.isFrontendPlaceholderResult(m)) messages.splice(i, 1);
|
|
4808
|
+
}
|
|
4809
|
+
}
|
|
4681
4810
|
/** Identify transport placeholders that must not count as completed answers. */
|
|
4682
4811
|
isFrontendPlaceholderResult(message) {
|
|
4683
4812
|
return message.role === "tool" && isForwardedToClientPlaceholder(message.content);
|
|
@@ -4893,6 +5022,36 @@ var RunHandler = class {
|
|
|
4893
5022
|
return false;
|
|
4894
5023
|
}
|
|
4895
5024
|
/**
|
|
5025
|
+
* Answer a call to a tool the run was offered but that no frontend tool (and
|
|
5026
|
+
* no wildcard) handles any more, e.g. because its component unmounted. Left
|
|
5027
|
+
* open, the call has no result, and providers reject every later request in
|
|
5028
|
+
* the thread. Like a failed handler, the error result starts no follow-up:
|
|
5029
|
+
* the model sees it on the next turn.
|
|
5030
|
+
*/
|
|
5031
|
+
async rejectUnregisteredTool(toolCall, message, agent, agentId) {
|
|
5032
|
+
const messageIndex = agent.messages.findIndex((m) => m.id === message.id);
|
|
5033
|
+
if (messageIndex === -1 || agent.messages.some((m) => m.role === "tool" && m.toolCallId === toolCall.id)) return;
|
|
5034
|
+
const error = /* @__PURE__ */ new Error(`Tool not found: ${toolCall.function.name}`);
|
|
5035
|
+
const errorMessage = toolFailureMessage(error);
|
|
5036
|
+
agent.messages.splice(this.toolResultInsertionIndex(agent.messages, messageIndex, toolCall.id), 0, {
|
|
5037
|
+
id: randomUUID$1(),
|
|
5038
|
+
role: "tool",
|
|
5039
|
+
toolCallId: toolCall.id,
|
|
5040
|
+
content: `Error: ${errorMessage}`,
|
|
5041
|
+
error: errorMessage
|
|
5042
|
+
});
|
|
5043
|
+
await this._internal.emitError({
|
|
5044
|
+
error,
|
|
5045
|
+
code: CopilotKitCoreErrorCode.TOOL_NOT_FOUND,
|
|
5046
|
+
context: {
|
|
5047
|
+
agentId,
|
|
5048
|
+
toolCallId: toolCall.id,
|
|
5049
|
+
toolName: toolCall.function.name,
|
|
5050
|
+
messageId: message.id
|
|
5051
|
+
}
|
|
5052
|
+
});
|
|
5053
|
+
}
|
|
5054
|
+
/**
|
|
4896
5055
|
* Programmatically execute a registered frontend tool without going through an LLM turn.
|
|
4897
5056
|
* The handler runs, render components show up in the UI, and both the tool call and
|
|
4898
5057
|
* result messages are added to `agent.messages`.
|