@copilotkit/core 1.59.3 → 1.59.4
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/index.cjs +21 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +38 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +21 -4
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +25 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -137,12 +137,27 @@ var AgentThreadLockedError = class extends Error {
|
|
|
137
137
|
this.name = "AgentThreadLockedError";
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
|
+
/**
|
|
141
|
+
* Type guard for {@link RunCompletionAware}. Returns true when `agent` exposes
|
|
142
|
+
* an `activeRunCompletionPromise` property, so callers can await an in-flight
|
|
143
|
+
* run without an `as unknown as` cast. Returns false for agents that don't
|
|
144
|
+
* implement the contract, letting the caller skip the await and degrade safely.
|
|
145
|
+
*/
|
|
146
|
+
function isRunCompletionAware(agent) {
|
|
147
|
+
return typeof agent === "object" && agent !== null && "activeRunCompletionPromise" in agent;
|
|
148
|
+
}
|
|
140
149
|
var IntelligenceAgent = class IntelligenceAgent extends _ag_ui_client.AbstractAgent {
|
|
141
150
|
config;
|
|
142
151
|
socket = null;
|
|
143
152
|
activeChannel = null;
|
|
144
153
|
canonicalRunId = null;
|
|
145
154
|
sharedState;
|
|
155
|
+
/**
|
|
156
|
+
* Resolves when the active run's pipeline finalizes; `undefined` between runs.
|
|
157
|
+
* Set/cleared inside {@link connectAgent}'s observable lifecycle. Declared
|
|
158
|
+
* here so {@link RunCompletionAware} consumers can read it without a cast.
|
|
159
|
+
*/
|
|
160
|
+
activeRunCompletionPromise;
|
|
146
161
|
constructor(config, sharedState = { lastSeenEventIds: /* @__PURE__ */ new Map() }) {
|
|
147
162
|
super();
|
|
148
163
|
this.config = config;
|
|
@@ -196,7 +211,7 @@ var IntelligenceAgent = class IntelligenceAgent extends _ag_ui_client.AbstractAg
|
|
|
196
211
|
await this.onInitialize(input, subscribers);
|
|
197
212
|
self.activeRunDetach$ = new rxjs.Subject();
|
|
198
213
|
let resolveCompletion;
|
|
199
|
-
|
|
214
|
+
this.activeRunCompletionPromise = new Promise((resolve) => {
|
|
200
215
|
resolveCompletion = resolve;
|
|
201
216
|
});
|
|
202
217
|
const source$ = (0, rxjs.defer)(() => this.connect(input)).pipe((0, _ag_ui_client.transformChunks)(this.debug), (0, rxjs_operators.takeUntil)(self.activeRunDetach$));
|
|
@@ -209,7 +224,7 @@ var IntelligenceAgent = class IntelligenceAgent extends _ag_ui_client.AbstractAg
|
|
|
209
224
|
this.onFinalize(input, subscribers);
|
|
210
225
|
resolveCompletion?.();
|
|
211
226
|
resolveCompletion = void 0;
|
|
212
|
-
|
|
227
|
+
this.activeRunCompletionPromise = void 0;
|
|
213
228
|
self.activeRunDetach$ = void 0;
|
|
214
229
|
})), { defaultValue: void 0 });
|
|
215
230
|
const newMessages = (0, _ag_ui_client.structuredClone_)(this.messages).filter((m) => !previousMessageIds.has(m.id));
|
|
@@ -855,6 +870,7 @@ var AgentRegistry = class {
|
|
|
855
870
|
_runtimeVersion;
|
|
856
871
|
_runtimeConnectionStatus = CopilotKitCoreRuntimeConnectionStatus.Disconnected;
|
|
857
872
|
_runtimeTransport = "auto";
|
|
873
|
+
_requestedTransport = "auto";
|
|
858
874
|
_audioFileTranscriptionEnabled = false;
|
|
859
875
|
_runtimeMode = _copilotkit_shared.RUNTIME_MODE_SSE;
|
|
860
876
|
_intelligence;
|
|
@@ -923,7 +939,8 @@ var AgentRegistry = class {
|
|
|
923
939
|
this.updateRuntimeConnection();
|
|
924
940
|
}
|
|
925
941
|
setRuntimeTransport(runtimeTransport) {
|
|
926
|
-
if (this.
|
|
942
|
+
if (this._requestedTransport === runtimeTransport) return;
|
|
943
|
+
this._requestedTransport = runtimeTransport;
|
|
927
944
|
this._runtimeTransport = runtimeTransport;
|
|
928
945
|
this.updateRuntimeConnection();
|
|
929
946
|
}
|
|
@@ -3901,6 +3918,7 @@ exports.createSelector = createSelector;
|
|
|
3901
3918
|
exports.createStore = createStore;
|
|
3902
3919
|
exports.empty = empty;
|
|
3903
3920
|
exports.ensureObjectArgs = ensureObjectArgs;
|
|
3921
|
+
exports.isRunCompletionAware = isRunCompletionAware;
|
|
3904
3922
|
exports.ofType = ofType;
|
|
3905
3923
|
exports.on = on;
|
|
3906
3924
|
exports.parseToolArguments = parseToolArguments;
|