@harnessio/ai-chat-core 0.0.23 → 0.0.24
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.
|
@@ -35,6 +35,21 @@ export declare class ThreadRuntime extends BaseSubscribable {
|
|
|
35
35
|
* do not need their own queueing primitive.
|
|
36
36
|
*/
|
|
37
37
|
sendSystemEvent(systemEvent: SystemEvent): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Registers a generic background task that keeps the thread reported as
|
|
40
|
+
* running for as long as it is active, even when no stream run is in
|
|
41
|
+
* flight. Use this for UI-driven async work (e.g. a card polling a status
|
|
42
|
+
* API) so the composer shows a running/stop affordance. The work is
|
|
43
|
+
* cancelled when the user presses stop (cancelRun), which invokes the
|
|
44
|
+
* provided onCancel callback. Returns an opaque id for stopBackgroundTask.
|
|
45
|
+
*/
|
|
46
|
+
startBackgroundTask(options?: {
|
|
47
|
+
onCancel?: () => void;
|
|
48
|
+
}): string;
|
|
49
|
+
/**
|
|
50
|
+
* Removes a previously registered background task by its id.
|
|
51
|
+
*/
|
|
52
|
+
stopBackgroundTask(id: string): void;
|
|
38
53
|
cancelRun(): void;
|
|
39
54
|
clear(): void;
|
|
40
55
|
reset(messages?: Message[]): void;
|
|
@@ -20,6 +20,7 @@ export declare class ThreadRuntimeCore extends BaseSubscribable {
|
|
|
20
20
|
private _conversationId?;
|
|
21
21
|
private _title?;
|
|
22
22
|
private _idleWaiters;
|
|
23
|
+
private _backgroundTasks;
|
|
23
24
|
private _currentPart;
|
|
24
25
|
constructor(config: ThreadRuntimeCoreConfig);
|
|
25
26
|
get messages(): readonly Message[];
|
|
@@ -45,6 +46,26 @@ export declare class ThreadRuntimeCore extends BaseSubscribable {
|
|
|
45
46
|
*/
|
|
46
47
|
waitForIdle(): Promise<void>;
|
|
47
48
|
private drainIdleWaiters;
|
|
49
|
+
/**
|
|
50
|
+
* Registers a generic background task that keeps the thread reported as
|
|
51
|
+
* running (isRunning === true) for as long as it is active, even when no
|
|
52
|
+
* stream run is in flight. Use this for UI-driven async work — e.g. a card
|
|
53
|
+
* that polls a status API — so the composer shows a running/stop
|
|
54
|
+
* affordance and the work is cancelled when the user presses stop.
|
|
55
|
+
*
|
|
56
|
+
* Returns an opaque id to pass to stopBackgroundTask. The optional onCancel
|
|
57
|
+
* callback is invoked if the task is cancelled via cancelRun (stop button).
|
|
58
|
+
*/
|
|
59
|
+
startBackgroundTask(options?: {
|
|
60
|
+
onCancel?: () => void;
|
|
61
|
+
}): string;
|
|
62
|
+
/**
|
|
63
|
+
* Removes a previously registered background task. Once the last task is
|
|
64
|
+
* removed (and no run is in flight) any idle waiters are drained so queued
|
|
65
|
+
* dispatches can proceed.
|
|
66
|
+
*/
|
|
67
|
+
stopBackgroundTask(id: string): void;
|
|
68
|
+
private cancelBackgroundTasks;
|
|
48
69
|
startSystemEventRun(systemEvent: SystemEvent): Promise<void>;
|
|
49
70
|
startRun(userMessage: AppendMessage): Promise<void>;
|
|
50
71
|
private handleStreamEvent;
|
package/dist/types/adapters.d.ts
CHANGED
|
@@ -38,12 +38,12 @@ export type StreamEvent = {
|
|
|
38
38
|
readonly parentId?: string;
|
|
39
39
|
[key: string]: any;
|
|
40
40
|
};
|
|
41
|
-
export type SystemEventType = 'action_completed' | 'action_cancelled';
|
|
41
|
+
export type SystemEventType = 'action_completed' | 'action_cancelled' | 'pipeline_status_updated';
|
|
42
42
|
export interface SystemEvent {
|
|
43
43
|
event_type: SystemEventType;
|
|
44
44
|
capability_id: string;
|
|
45
45
|
result?: {
|
|
46
|
-
success
|
|
46
|
+
success?: boolean;
|
|
47
47
|
[key: string]: unknown;
|
|
48
48
|
};
|
|
49
49
|
target_page_id?: string;
|