@memberjunction/conversations-runtime 6.2.0-edge.0 → 6.2.0-edge.2
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/ConversationsRuntime.d.ts +27 -0
- package/dist/ConversationsRuntime.d.ts.map +1 -1
- package/dist/ConversationsRuntime.js +36 -0
- package/dist/ConversationsRuntime.js.map +1 -1
- package/dist/agent-runner/ConversationAgentRunner.d.ts +27 -1
- package/dist/agent-runner/ConversationAgentRunner.d.ts.map +1 -1
- package/dist/agent-runner/ConversationAgentRunner.js +26 -3
- package/dist/agent-runner/ConversationAgentRunner.js.map +1 -1
- package/dist/default-agent/DefaultAgentResolver.d.ts +2 -0
- package/dist/default-agent/DefaultAgentResolver.d.ts.map +1 -1
- package/dist/default-agent/DefaultAgentResolver.js +5 -1
- package/dist/default-agent/DefaultAgentResolver.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/mentions/MentionAutocomplete.d.ts +29 -2
- package/dist/mentions/MentionAutocomplete.d.ts.map +1 -1
- package/dist/mentions/MentionAutocomplete.js +80 -41
- package/dist/mentions/MentionAutocomplete.js.map +1 -1
- package/dist/mentions/MentionParser.d.ts +10 -0
- package/dist/mentions/MentionParser.d.ts.map +1 -1
- package/dist/mentions/MentionParser.js +25 -5
- package/dist/mentions/MentionParser.js.map +1 -1
- package/dist/mentions/MentionSuggestion.d.ts +26 -0
- package/dist/mentions/MentionSuggestion.d.ts.map +1 -1
- package/dist/streaming/ConversationLiveness.d.ts +93 -0
- package/dist/streaming/ConversationLiveness.d.ts.map +1 -0
- package/dist/streaming/ConversationLiveness.js +126 -0
- package/dist/streaming/ConversationLiveness.js.map +1 -0
- package/dist/streaming/ConversationStreaming.d.ts +94 -1
- package/dist/streaming/ConversationStreaming.d.ts.map +1 -1
- package/dist/streaming/ConversationStreaming.js +221 -17
- package/dist/streaming/ConversationStreaming.js.map +1 -1
- package/dist/streaming/ConversationTail.d.ts +38 -0
- package/dist/streaming/ConversationTail.d.ts.map +1 -0
- package/dist/streaming/ConversationTail.js +93 -0
- package/dist/streaming/ConversationTail.js.map +1 -0
- package/dist/timeline/RealtimeSessionTimeline.d.ts +71 -3
- package/dist/timeline/RealtimeSessionTimeline.d.ts.map +1 -1
- package/dist/timeline/RealtimeSessionTimeline.js +123 -9
- package/dist/timeline/RealtimeSessionTimeline.js.map +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Liveness supervisor — decides when client state may have fallen behind the
|
|
3
|
+
* server and a reconciliation against durable state is required (MJ #4222).
|
|
4
|
+
*
|
|
5
|
+
* WHY THIS EXISTS. The conversations stack had five recovery mechanisms — graphql-ws's
|
|
6
|
+
* `retryAttempts`, `GraphQLDataProvider._socketStateSubject`, Explorer's
|
|
7
|
+
* `ServerConnectivityService`, `ConversationStreaming.scheduleReconnection()` and
|
|
8
|
+
* `FireAndForgetHelper.onStreamEnd` — and every one of them is triggered by the WebSocket
|
|
9
|
+
* `closed` event. The failure they all needed to catch is precisely the one where the socket
|
|
10
|
+
* NEVER closes, so they failed together. That is not defence in depth; it is one layer drawn
|
|
11
|
+
* five times.
|
|
12
|
+
*
|
|
13
|
+
* This class is the independent trigger. It aggregates signals that do NOT depend on a clean
|
|
14
|
+
* close — a socket retry, a stream re-subscribe, a tab regaining focus, the browser coming back
|
|
15
|
+
* online — and emits a single coalesced "go re-read the truth" event.
|
|
16
|
+
*
|
|
17
|
+
* WHY L0 (this package) AND NOT THE ANGULAR LAYER. `ServerConnectivityService` already does
|
|
18
|
+
* something similar, but it lives in `@memberjunction/ng-explorer-core`, and
|
|
19
|
+
* `@memberjunction/ng-conversations` declares `"mjUILayer": "widgets"`, which
|
|
20
|
+
* `packages/Standards/src/checks/ui-layers.ts` forbids from importing any `ng-explorer*`
|
|
21
|
+
* package at severity `error`. This package already depends on `@memberjunction/graphql-dataprovider`
|
|
22
|
+
* and has no Angular dependency, so it is the layer-legal home — and it serves headless consumers
|
|
23
|
+
* (Node workers, CLI tools, test harnesses) for free.
|
|
24
|
+
*
|
|
25
|
+
* DOM EVENTS ARE DELIBERATELY NOT HANDLED HERE. This package is documented as Node-consumable,
|
|
26
|
+
* so `document`/`window` are not assumed to exist. The Angular host translates those events into
|
|
27
|
+
* {@link ConversationLiveness.NotifyTabVisible} / {@link ConversationLiveness.NotifyBrowserOnline}.
|
|
28
|
+
*/
|
|
29
|
+
import { Subject, Subscription, throttleTime } from 'rxjs';
|
|
30
|
+
import { GraphQLDataProvider } from '@memberjunction/graphql-dataprovider';
|
|
31
|
+
/**
|
|
32
|
+
* Coalescing window. Closing a laptop lid and reopening it produces a socket reconnect, a stream
|
|
33
|
+
* re-init, a `visibilitychange` and an `online` within roughly a second of each other. Downstream
|
|
34
|
+
* reconciliation is idempotent but expensive (a `RunView` plus, per repaired message, a window
|
|
35
|
+
* refresh and an artifact rebuild), so collapse the storm into one pass.
|
|
36
|
+
*
|
|
37
|
+
* Leading-edge, NOT trailing: recovery is user-visible and should start immediately rather than
|
|
38
|
+
* waiting out the window. Subsequent triggers inside the window are absorbed.
|
|
39
|
+
*/
|
|
40
|
+
export const RECONCILE_THROTTLE_MS = 500;
|
|
41
|
+
/**
|
|
42
|
+
* Emits when something suggests the client may have missed server events and should re-read
|
|
43
|
+
* authoritative state.
|
|
44
|
+
*
|
|
45
|
+
* Usually reached via `ConversationsRuntime.Instance.Liveness`. Call {@link Initialize} once after
|
|
46
|
+
* the data provider exists; hosts translate DOM events in via the `Notify*` methods.
|
|
47
|
+
*/
|
|
48
|
+
export class ConversationLiveness {
|
|
49
|
+
constructor() {
|
|
50
|
+
this.triggers$ = new Subject();
|
|
51
|
+
this.subscriptions = new Subscription();
|
|
52
|
+
this.initialized = false;
|
|
53
|
+
this.streamWired = false;
|
|
54
|
+
/**
|
|
55
|
+
* Fires when client state may be stale. Already coalesced — subscribe and reconcile.
|
|
56
|
+
*
|
|
57
|
+
* Deliberately does NOT replay: a late subscriber must not be handed a reconciliation
|
|
58
|
+
* request for an outage that was already resolved.
|
|
59
|
+
*/
|
|
60
|
+
this.ReconciliationRequired$ = this.triggers$.pipe(throttleTime(RECONCILE_THROTTLE_MS, undefined, { leading: true, trailing: false }));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Wire up the transport-level signals. Idempotent.
|
|
64
|
+
*
|
|
65
|
+
* @param streamReconnected$ Optional stream-level reconnect signal, supplied by
|
|
66
|
+
* {@link ConversationStreaming}. Passed in rather than imported so this class stays
|
|
67
|
+
* independent of the streaming implementation and is trivially testable.
|
|
68
|
+
*/
|
|
69
|
+
Initialize(streamReconnected$) {
|
|
70
|
+
if (this.initialized) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
let socketWired = false;
|
|
74
|
+
try {
|
|
75
|
+
// `Instance` returns undefined rather than throwing when the provider is not yet
|
|
76
|
+
// constructed, so a missing provider is a falsy value here, not a caught error.
|
|
77
|
+
const provider = GraphQLDataProvider.Instance;
|
|
78
|
+
if (provider) {
|
|
79
|
+
// `SocketReconnected$` fires on `wasRetry`, which is the only trustworthy
|
|
80
|
+
// reconnect indicator: graphql-ws restores subscriptions transparently, so the
|
|
81
|
+
// RxJS stream may never error and the socket state may never pass through
|
|
82
|
+
// 'disconnected'.
|
|
83
|
+
this.subscriptions.add(provider.SocketReconnected$.subscribe(() => this.Trigger('socket-reconnected')));
|
|
84
|
+
socketWired = true;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
// A provider that is not yet constructed is not a failure — the DOM-level and
|
|
89
|
+
// stream-level triggers still work, and the socket signal is retried below.
|
|
90
|
+
console.warn('[ConversationLiveness] Socket signal unavailable:', error);
|
|
91
|
+
}
|
|
92
|
+
// Wired at most once, because the retry path below can bring execution back here.
|
|
93
|
+
if (streamReconnected$ && !this.streamWired) {
|
|
94
|
+
this.subscriptions.add(streamReconnected$.subscribe(() => this.Trigger('stream-reconnected')));
|
|
95
|
+
this.streamWired = true;
|
|
96
|
+
}
|
|
97
|
+
// Complete only once the socket signal is attached. Marking initialized without it would
|
|
98
|
+
// early-return every later call and leave that signal unwired for the life of the page.
|
|
99
|
+
this.initialized = socketWired;
|
|
100
|
+
}
|
|
101
|
+
/** The tab became visible again. Called by the host's `visibilitychange` handler. */
|
|
102
|
+
NotifyTabVisible() {
|
|
103
|
+
this.Trigger('tab-visible');
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The browser reported it is back online. Called by the host's `online` handler.
|
|
107
|
+
*
|
|
108
|
+
* `navigator.onLine` only describes the link layer — it reads true behind a captive portal
|
|
109
|
+
* or a dead VPN — so this is a reason to re-check, never evidence that anything is reachable.
|
|
110
|
+
*/
|
|
111
|
+
NotifyBrowserOnline() {
|
|
112
|
+
this.Trigger('browser-online');
|
|
113
|
+
}
|
|
114
|
+
/** Raise a reconciliation request directly. Exposed for hosts with their own signals. */
|
|
115
|
+
Trigger(reason) {
|
|
116
|
+
this.triggers$.next(reason);
|
|
117
|
+
}
|
|
118
|
+
/** Tear down transport subscriptions. Safe to call more than once. */
|
|
119
|
+
Dispose() {
|
|
120
|
+
this.subscriptions.unsubscribe();
|
|
121
|
+
this.subscriptions = new Subscription();
|
|
122
|
+
this.initialized = false;
|
|
123
|
+
this.streamWired = false;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=ConversationLiveness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationLiveness.js","sourceRoot":"","sources":["../../src/streaming/ConversationLiveness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAc,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CA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,CAAC;YAC1C,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,kBAAkB,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;YAC/F,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAC5B,CAAC;QAED,yFAAyF;QACzF,wFAAwF;QACxF,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;IAED,qFAAqF;IAC9E,gBAAgB;QACnB,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACI,mBAAmB;QACtB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACnC,CAAC;IAED,yFAAyF;IAClF,OAAO,CAAC,MAA4B;QACvC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAED,sEAAsE;IAC/D,OAAO;QACV,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,IAAI,YAAY,EAAE,CAAC;QACxC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC7B,CAAC;CACJ"}
|
|
@@ -91,6 +91,8 @@ export type StreamingConnectionStatus = 'connected' | 'disconnected' | 'error' |
|
|
|
91
91
|
export declare class ConversationStreaming {
|
|
92
92
|
private readonly context;
|
|
93
93
|
private pushStatusSubscription?;
|
|
94
|
+
/** Watches the socket for a server acknowledgement, which clears the backoff. */
|
|
95
|
+
private socketStateSubscription?;
|
|
94
96
|
private readonly callbackRegistry;
|
|
95
97
|
/**
|
|
96
98
|
* Per-message accumulation of streamed final-response deltas, keyed by
|
|
@@ -103,14 +105,34 @@ export declare class ConversationStreaming {
|
|
|
103
105
|
*/
|
|
104
106
|
private readonly streamingAccumulator;
|
|
105
107
|
private readonly recentCompletions;
|
|
108
|
+
/** Browser time (ms) of the last frame received for each agent run, keyed by normalized run ID. */
|
|
109
|
+
private readonly lastHeardAtByRunId;
|
|
110
|
+
/** Browser time (ms) of the last frame that named each message, keyed by normalized detail ID. */
|
|
111
|
+
private readonly lastHeardAtByDetailId;
|
|
106
112
|
private readonly connectionStatus$;
|
|
107
113
|
private initialized;
|
|
108
114
|
private reconnectionTimeout?;
|
|
115
|
+
/** Consecutive failed reconnects; drives the backoff. */
|
|
116
|
+
private reconnectionAttempts;
|
|
117
|
+
/** True while recovering from a drop, so a successful re-subscribe can be told from first boot. */
|
|
118
|
+
private reconnecting;
|
|
119
|
+
/**
|
|
120
|
+
* Fires when the push-status subscription is re-established after having dropped — never on
|
|
121
|
+
* the first successful subscribe.
|
|
122
|
+
*
|
|
123
|
+
* Events published while the subscription was down are gone: the server's topic is an
|
|
124
|
+
* in-memory `PubSub` with no replay, and the client's `Subject` is explicitly unbuffered.
|
|
125
|
+
* A listener must therefore reconcile against durable state rather than assume the stream
|
|
126
|
+
* resumed seamlessly. Consumed by `ConversationLiveness` (MJ #4222).
|
|
127
|
+
*/
|
|
128
|
+
readonly StreamReconnected$: Subject<void>;
|
|
109
129
|
/**
|
|
110
130
|
* Observable for components to subscribe to completion events in real-time.
|
|
111
131
|
* Emits enriched completion data once per agent finish.
|
|
112
132
|
*/
|
|
113
|
-
readonly
|
|
133
|
+
readonly CompletionEvents$: Subject<CompletionEvent>;
|
|
134
|
+
/** @deprecated Use {@link CompletionEvents$}. */
|
|
135
|
+
get completionEvents$(): Subject<CompletionEvent>;
|
|
114
136
|
/**
|
|
115
137
|
* @param context Runtime context providing live access to the registered
|
|
116
138
|
* {@link IActiveTaskTracker}. Read on every event dispatch so adapter swaps
|
|
@@ -122,38 +144,88 @@ export declare class ConversationStreaming {
|
|
|
122
144
|
* times. Should be called once at app startup (e.g., the Angular widget calls
|
|
123
145
|
* this when the workspace mounts).
|
|
124
146
|
*/
|
|
147
|
+
Initialize(): void;
|
|
148
|
+
/** @deprecated Use {@link Initialize}. */
|
|
125
149
|
initialize(): void;
|
|
126
150
|
/** Current connection status as an observable. */
|
|
151
|
+
GetConnectionStatus$(): import("rxjs").Observable<StreamingConnectionStatus>;
|
|
152
|
+
/** @deprecated Use {@link GetConnectionStatus$}. */
|
|
127
153
|
getConnectionStatus$(): import("rxjs").Observable<StreamingConnectionStatus>;
|
|
128
154
|
/** Current connection status value (synchronous). */
|
|
155
|
+
GetConnectionStatus(): StreamingConnectionStatus;
|
|
156
|
+
/** @deprecated Use {@link GetConnectionStatus}. */
|
|
129
157
|
getConnectionStatus(): StreamingConnectionStatus;
|
|
130
158
|
/**
|
|
131
159
|
* Register a callback for a specific conversation detail (message). The callback
|
|
132
160
|
* is invoked whenever progress updates arrive for that message.
|
|
133
161
|
*/
|
|
162
|
+
RegisterMessageCallback(conversationDetailId: string, callback: MessageProgressCallback): void;
|
|
163
|
+
/** @deprecated Use {@link RegisterMessageCallback}. */
|
|
134
164
|
registerMessageCallback(conversationDetailId: string, callback: MessageProgressCallback): void;
|
|
135
165
|
/**
|
|
136
166
|
* Unregister a callback for a specific conversation detail. When `callback` is
|
|
137
167
|
* omitted, ALL callbacks for that message are removed.
|
|
138
168
|
*/
|
|
169
|
+
UnregisterMessageCallback(conversationDetailId: string, callback?: MessageProgressCallback): void;
|
|
170
|
+
/** @deprecated Use {@link UnregisterMessageCallback}. */
|
|
139
171
|
unregisterMessageCallback(conversationDetailId: string, callback?: MessageProgressCallback): void;
|
|
140
172
|
/** Total number of registered callbacks (diagnostic). */
|
|
173
|
+
GetRegisteredCallbackCount(): number;
|
|
174
|
+
/** @deprecated Use {@link GetRegisteredCallbackCount}. */
|
|
141
175
|
getRegisteredCallbackCount(): number;
|
|
142
176
|
/** Number of distinct messages currently being tracked (diagnostic). */
|
|
177
|
+
GetTrackedMessageCount(): number;
|
|
178
|
+
/** @deprecated Use {@link GetTrackedMessageCount}. */
|
|
143
179
|
getTrackedMessageCount(): number;
|
|
144
180
|
/**
|
|
145
181
|
* Replay a recently completed event so a late-mounting component can pick it up.
|
|
146
182
|
* Returns `undefined` if no completion is in the 5-minute replay window.
|
|
147
183
|
*/
|
|
184
|
+
GetRecentCompletion(conversationDetailId: string): {
|
|
185
|
+
agentRunId: string;
|
|
186
|
+
} | undefined;
|
|
187
|
+
/** @deprecated Use {@link GetRecentCompletion}. */
|
|
148
188
|
getRecentCompletion(conversationDetailId: string): {
|
|
149
189
|
agentRunId: string;
|
|
150
190
|
} | undefined;
|
|
191
|
+
/**
|
|
192
|
+
* Browser time (ms since epoch) at which the last push frame for this agent run arrived:
|
|
193
|
+
* progress, streamed content, or the server's liveness pulse.
|
|
194
|
+
*
|
|
195
|
+
* This is the reliable "still running" signal. The run object inside progress frames is the
|
|
196
|
+
* server's in-memory entity, whose timestamps do not move until the run ends.
|
|
197
|
+
*
|
|
198
|
+
* @returns `undefined` when nothing has been heard for the run, or it has completed.
|
|
199
|
+
*/
|
|
200
|
+
LastHeardFromRun(agentRunId: string): number | undefined;
|
|
201
|
+
/**
|
|
202
|
+
* Browser time (ms since epoch) at which the last push frame that names this message arrived.
|
|
203
|
+
*
|
|
204
|
+
* Covers a row with no MJ agent run to look up, such as one written by a host's own turn
|
|
205
|
+
* handler that reports progress through the same publisher.
|
|
206
|
+
*
|
|
207
|
+
* @returns `undefined` when nothing has named the message, or it has completed.
|
|
208
|
+
*/
|
|
209
|
+
LastHeardForMessage(conversationDetailId: string): number | undefined;
|
|
151
210
|
/** Clear a recent completion after the late-mounting component has handled it. */
|
|
211
|
+
ClearRecentCompletion(conversationDetailId: string): void;
|
|
212
|
+
/** @deprecated Use {@link ClearRecentCompletion}. */
|
|
152
213
|
clearRecentCompletion(conversationDetailId: string): void;
|
|
153
214
|
/**
|
|
154
215
|
* Diagnostic snapshot for a specific message — used by debugging tools to dump
|
|
155
216
|
* live in-memory state.
|
|
156
217
|
*/
|
|
218
|
+
GetDiagnosticSnapshot(messageId: string): {
|
|
219
|
+
hasCallbacks: boolean;
|
|
220
|
+
callbackCount: number;
|
|
221
|
+
recentCompletion: {
|
|
222
|
+
conversationDetailId: string;
|
|
223
|
+
agentRunId: string;
|
|
224
|
+
timestamp: Date;
|
|
225
|
+
} | undefined;
|
|
226
|
+
connectionStatus: StreamingConnectionStatus;
|
|
227
|
+
};
|
|
228
|
+
/** @deprecated Use {@link GetDiagnosticSnapshot}. */
|
|
157
229
|
getDiagnosticSnapshot(messageId: string): {
|
|
158
230
|
hasCallbacks: boolean;
|
|
159
231
|
callbackCount: number;
|
|
@@ -199,9 +271,30 @@ export declare class ConversationStreaming {
|
|
|
199
271
|
private routeStreamingContent;
|
|
200
272
|
/** Invoke every callback registered for `conversationDetailId`, swallowing per-callback errors. */
|
|
201
273
|
private dispatchCallbacks;
|
|
274
|
+
/**
|
|
275
|
+
* Record evidence that the transport is genuinely alive: a delivered frame, or the server's
|
|
276
|
+
* connection acknowledgement. Clears the reconnection backoff so the next outage starts from
|
|
277
|
+
* scratch. A bare re-subscribe is not evidence; it succeeds against a dead socket.
|
|
278
|
+
*/
|
|
279
|
+
private noteStreamAlive;
|
|
280
|
+
/**
|
|
281
|
+
* Clear the backoff whenever the socket reports `connected`. That state follows the server's
|
|
282
|
+
* connection acknowledgement, a real round trip, so a quiet but healthy stream does not start
|
|
283
|
+
* its next outage at the ceiling. Subscribes once for the life of the service.
|
|
284
|
+
*/
|
|
285
|
+
private watchSocketAcknowledgement;
|
|
202
286
|
/** Schedule a reconnection attempt after a connection error or completion. */
|
|
203
287
|
private scheduleReconnection;
|
|
204
288
|
/** Evict completions older than the replay window to bound memory. */
|
|
205
289
|
private cleanupOldCompletions;
|
|
290
|
+
/**
|
|
291
|
+
* Record that a frame naming an agent run or a message arrived, or forget both when the frame
|
|
292
|
+
* completes them.
|
|
293
|
+
*
|
|
294
|
+
* Progress, streaming and completion frames name the run as `data.agentRunId`; the liveness
|
|
295
|
+
* pulse names it as `data.runId`. The message is `data.conversationDetailId`, or the
|
|
296
|
+
* `ConversationDetailID` of the run a progress frame carries.
|
|
297
|
+
*/
|
|
298
|
+
private noteActivity;
|
|
206
299
|
}
|
|
207
300
|
//# sourceMappingURL=ConversationStreaming.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationStreaming.d.ts","sourceRoot":"","sources":["../../src/streaming/ConversationStreaming.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAmB,OAAO,EAAgB,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ConversationStreaming.d.ts","sourceRoot":"","sources":["../../src/streaming/ConversationStreaming.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAmB,OAAO,EAAgB,MAAM,MAAM,CAAC;AAI9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AAEvF;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,uDAAuD;AACvD,MAAM,WAAW,uBAAuB;IACpC,kDAAkD;IAClD,QAAQ,CAAC,EAAE;QACP,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,uDAAuD;IACvD,QAAQ,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,iDAAiD;IACjD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