@love-moon/conductor-sdk 0.13.0 → 0.13.1
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/CHANGELOG.md +2 -0
- package/dist/client.d.ts +6 -0
- package/dist/client.js +16 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/client.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export interface ConductorClientConnectOptions {
|
|
|
31
31
|
onStopTask?: (event: StopTaskEvent) => Promise<void> | void;
|
|
32
32
|
onInterruptTurn?: (event: InterruptTurnEvent) => Promise<boolean | void> | boolean | void;
|
|
33
33
|
onRefreshSession?: (event: RefreshSessionEvent) => Promise<boolean | void> | boolean | void;
|
|
34
|
+
onReportRuntimeStatus?: (event: ReportRuntimeStatusEvent) => Promise<void> | void;
|
|
34
35
|
}
|
|
35
36
|
interface ConductorClientInit {
|
|
36
37
|
config: ConductorConfig;
|
|
@@ -50,6 +51,7 @@ interface ConductorClientInit {
|
|
|
50
51
|
onStopTask?: (event: StopTaskEvent) => Promise<void> | void;
|
|
51
52
|
onInterruptTurn?: (event: InterruptTurnEvent) => Promise<boolean | void> | boolean | void;
|
|
52
53
|
onRefreshSession?: (event: RefreshSessionEvent) => Promise<boolean | void> | boolean | void;
|
|
54
|
+
onReportRuntimeStatus?: (event: ReportRuntimeStatusEvent) => Promise<void> | void;
|
|
53
55
|
}
|
|
54
56
|
export interface StopTaskEvent {
|
|
55
57
|
taskId: string;
|
|
@@ -69,6 +71,9 @@ export interface RefreshSessionEvent {
|
|
|
69
71
|
sessionId: string;
|
|
70
72
|
sessionFilePath?: string;
|
|
71
73
|
}
|
|
74
|
+
export interface ReportRuntimeStatusEvent {
|
|
75
|
+
taskId: string;
|
|
76
|
+
}
|
|
72
77
|
export interface FlushPendingUpstreamEventsOptions {
|
|
73
78
|
timeoutMs?: number;
|
|
74
79
|
retryIntervalMs?: number;
|
|
@@ -90,6 +95,7 @@ export declare class ConductorClient {
|
|
|
90
95
|
private readonly onStopTask?;
|
|
91
96
|
private readonly onInterruptTurn?;
|
|
92
97
|
private readonly onRefreshSession?;
|
|
98
|
+
private readonly onReportRuntimeStatus?;
|
|
93
99
|
private deliveryScopeId;
|
|
94
100
|
private closed;
|
|
95
101
|
private durableOutboxFlushPromise;
|
package/dist/client.js
CHANGED
|
@@ -36,6 +36,7 @@ export class ConductorClient {
|
|
|
36
36
|
onStopTask;
|
|
37
37
|
onInterruptTurn;
|
|
38
38
|
onRefreshSession;
|
|
39
|
+
onReportRuntimeStatus;
|
|
39
40
|
deliveryScopeId;
|
|
40
41
|
closed = false;
|
|
41
42
|
durableOutboxFlushPromise = null;
|
|
@@ -63,6 +64,7 @@ export class ConductorClient {
|
|
|
63
64
|
this.onStopTask = init.onStopTask;
|
|
64
65
|
this.onInterruptTurn = init.onInterruptTurn;
|
|
65
66
|
this.onRefreshSession = init.onRefreshSession;
|
|
67
|
+
this.onReportRuntimeStatus = init.onReportRuntimeStatus;
|
|
66
68
|
this.deliveryScopeId = init.deliveryScopeId;
|
|
67
69
|
this.wsClient.registerHandler(this.handleBackendEvent);
|
|
68
70
|
}
|
|
@@ -115,6 +117,7 @@ export class ConductorClient {
|
|
|
115
117
|
onStopTask: options.onStopTask,
|
|
116
118
|
onInterruptTurn: options.onInterruptTurn,
|
|
117
119
|
onRefreshSession: options.onRefreshSession,
|
|
120
|
+
onReportRuntimeStatus: options.onReportRuntimeStatus,
|
|
118
121
|
});
|
|
119
122
|
client.replayDurableDownstreamInbox();
|
|
120
123
|
try {
|
|
@@ -615,6 +618,19 @@ export class ConductorClient {
|
|
|
615
618
|
});
|
|
616
619
|
return;
|
|
617
620
|
}
|
|
621
|
+
if (typeof payload?.type === 'string' && payload.type === 'report_runtime_status') {
|
|
622
|
+
// Best-effort, non-durable: the app re-asks on its next page load.
|
|
623
|
+
const taskId = typeof payload.payload?.task_id === 'string' ? payload.payload.task_id.trim() : '';
|
|
624
|
+
if (taskId && this.onReportRuntimeStatus) {
|
|
625
|
+
void Promise.resolve()
|
|
626
|
+
.then(() => this.onReportRuntimeStatus?.({ taskId }))
|
|
627
|
+
.catch((error) => {
|
|
628
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
629
|
+
console.warn(`[sdk] report_runtime_status callback failed for task ${taskId}: ${message}`);
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
618
634
|
if (typeof payload?.type === 'string' && payload.type === 'interrupt_turn') {
|
|
619
635
|
await this.handleInterruptTurnCommand(payload);
|
|
620
636
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@love-moon/conductor-sdk",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/lovemoon-ai/conductor.git"
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"typescript": "^5.6.3",
|
|
34
34
|
"vitest": "^2.1.4"
|
|
35
35
|
},
|
|
36
|
-
"gitCommitId": "
|
|
36
|
+
"gitCommitId": "b82ba1c"
|
|
37
37
|
}
|