@taico/events 0.2.8 → 0.2.10
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.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -20,6 +20,8 @@ export declare const ExecutionWireEvents: {
|
|
|
20
20
|
readonly EXECUTION_ACTIVITY: "execution.activity";
|
|
21
21
|
readonly EXECUTION_ACTIVITY_POST: "execution.activity.post";
|
|
22
22
|
readonly EXECUTION_HEARTBEAT_POST: "execution.heartbeat.post";
|
|
23
|
+
readonly WORKER_HEARTBEAT_POST: "worker.heartbeat.post";
|
|
24
|
+
readonly WORKER_HARNESSES_REPORT_REQUESTED: "worker.harnesses.report.requested";
|
|
23
25
|
};
|
|
24
26
|
export type ExecutionWireEventName = (typeof ExecutionWireEvents)[keyof typeof ExecutionWireEvents];
|
|
25
27
|
/**
|
|
@@ -19,6 +19,8 @@ export const ExecutionWireEvents = {
|
|
|
19
19
|
EXECUTION_ACTIVITY: 'execution.activity',
|
|
20
20
|
EXECUTION_ACTIVITY_POST: 'execution.activity.post',
|
|
21
21
|
EXECUTION_HEARTBEAT_POST: 'execution.heartbeat.post',
|
|
22
|
+
WORKER_HEARTBEAT_POST: 'worker.heartbeat.post',
|
|
23
|
+
WORKER_HARNESSES_REPORT_REQUESTED: 'worker.harnesses.report.requested',
|
|
22
24
|
};
|
|
23
25
|
/**
|
|
24
26
|
* Type guards for event identification
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Worker Wire Event Types for WebSocket Communication
|
|
3
3
|
*
|
|
4
|
-
* These types define the structure of events sent between backend and
|
|
4
|
+
* These types define the structure of events sent between backend and frontend
|
|
5
5
|
* via WebSocket for the Workers domain. They serve as a contract between the
|
|
6
|
-
* backend gateway and
|
|
6
|
+
* backend gateway and frontend consumers.
|
|
7
7
|
*
|
|
8
|
-
* Import these types in both backend (for emission
|
|
8
|
+
* Import these types in both backend (for emission) and frontend (for reception)
|
|
9
9
|
* to ensure type safety across the wire protocol.
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
@@ -13,100 +13,30 @@
|
|
|
13
13
|
* These are the stable, external event identifiers sent over the wire protocol.
|
|
14
14
|
*/
|
|
15
15
|
export declare const WorkerWireEvents: {
|
|
16
|
-
readonly
|
|
17
|
-
readonly WORKER_HEARTBEAT: "worker.heartbeat";
|
|
18
|
-
readonly RUN_STARTED: "run.started";
|
|
19
|
-
readonly RUN_COMPLETED: "run.completed";
|
|
20
|
-
readonly RUN_FAILED: "run.failed";
|
|
21
|
-
readonly RUN_ASSIGNED: "run.assigned";
|
|
22
|
-
readonly STOP_REQUESTED: "stop.requested";
|
|
16
|
+
readonly WORKER_SEEN: "worker.seen";
|
|
23
17
|
};
|
|
24
18
|
export type WorkerWireEventName = (typeof WorkerWireEvents)[keyof typeof WorkerWireEvents];
|
|
25
19
|
/**
|
|
26
|
-
* Worker
|
|
27
|
-
*
|
|
20
|
+
* Worker structure as sent over the wire
|
|
21
|
+
* Matches WorkerResponseDto from backend
|
|
28
22
|
*/
|
|
29
|
-
export interface
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
export interface WorkerWirePayload {
|
|
24
|
+
id: string;
|
|
25
|
+
oauthClientId: string;
|
|
26
|
+
lastSeenAt: string;
|
|
27
|
+
harnesses: string[];
|
|
28
|
+
createdAt: string;
|
|
29
|
+
updatedAt: string;
|
|
34
30
|
}
|
|
35
31
|
/**
|
|
36
|
-
* Worker
|
|
37
|
-
*
|
|
32
|
+
* Worker seen event
|
|
33
|
+
* Emitted when a worker is seen (connects, sends heartbeat, or executes)
|
|
38
34
|
*/
|
|
39
|
-
export interface
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
export interface WorkerSeenWireEvent {
|
|
36
|
+
worker: WorkerWirePayload;
|
|
37
|
+
occurredAt: string;
|
|
42
38
|
}
|
|
43
39
|
/**
|
|
44
|
-
*
|
|
45
|
-
* Sent by worker when it begins executing a task
|
|
40
|
+
* Union type of all worker wire events
|
|
46
41
|
*/
|
|
47
|
-
export
|
|
48
|
-
executionId: string;
|
|
49
|
-
sessionId: string;
|
|
50
|
-
startedAt: string;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Run completed message payload
|
|
54
|
-
* Sent by worker when task execution finishes successfully
|
|
55
|
-
*/
|
|
56
|
-
export interface RunCompletedPayload {
|
|
57
|
-
executionId: string;
|
|
58
|
-
sessionId: string;
|
|
59
|
-
completedAt: string;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Run failed message payload
|
|
63
|
-
* Sent by worker when task execution fails
|
|
64
|
-
*/
|
|
65
|
-
export interface RunFailedPayload {
|
|
66
|
-
executionId: string;
|
|
67
|
-
sessionId: string;
|
|
68
|
-
failedAt: string;
|
|
69
|
-
reason?: string;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Run assigned wire event
|
|
73
|
-
* Sent by backend to worker when a task execution is assigned
|
|
74
|
-
*/
|
|
75
|
-
export interface RunAssignedWireEvent {
|
|
76
|
-
executionId: string;
|
|
77
|
-
taskId: string;
|
|
78
|
-
agentActorId: string;
|
|
79
|
-
triggerReason?: string;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Stop requested wire event
|
|
83
|
-
* Sent by backend to worker to request stopping a running execution
|
|
84
|
-
*/
|
|
85
|
-
export interface StopRequestedWireEvent {
|
|
86
|
-
executionId: string;
|
|
87
|
-
taskId: string;
|
|
88
|
-
reason?: string;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Worker hello wire event
|
|
92
|
-
* Response sent by backend after successful registration
|
|
93
|
-
*/
|
|
94
|
-
export interface WorkerHelloResponse {
|
|
95
|
-
sessionId: string;
|
|
96
|
-
serverTime: number;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Worker heartbeat wire event
|
|
100
|
-
* Response sent by backend after processing heartbeat
|
|
101
|
-
*/
|
|
102
|
-
export interface WorkerHeartbeatResponse {
|
|
103
|
-
ok: boolean;
|
|
104
|
-
serverTime: number;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Generic acknowledgment for run lifecycle events
|
|
108
|
-
*/
|
|
109
|
-
export interface RunLifecycleAck {
|
|
110
|
-
ok: boolean;
|
|
111
|
-
executionId: string;
|
|
112
|
-
}
|
|
42
|
+
export type WorkerWireEvent = WorkerSeenWireEvent;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Worker Wire Event Types for WebSocket Communication
|
|
3
3
|
*
|
|
4
|
-
* These types define the structure of events sent between backend and
|
|
4
|
+
* These types define the structure of events sent between backend and frontend
|
|
5
5
|
* via WebSocket for the Workers domain. They serve as a contract between the
|
|
6
|
-
* backend gateway and
|
|
6
|
+
* backend gateway and frontend consumers.
|
|
7
7
|
*
|
|
8
|
-
* Import these types in both backend (for emission
|
|
8
|
+
* Import these types in both backend (for emission) and frontend (for reception)
|
|
9
9
|
* to ensure type safety across the wire protocol.
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
@@ -13,13 +13,5 @@
|
|
|
13
13
|
* These are the stable, external event identifiers sent over the wire protocol.
|
|
14
14
|
*/
|
|
15
15
|
export const WorkerWireEvents = {
|
|
16
|
-
|
|
17
|
-
WORKER_HELLO: 'worker.hello',
|
|
18
|
-
WORKER_HEARTBEAT: 'worker.heartbeat',
|
|
19
|
-
RUN_STARTED: 'run.started',
|
|
20
|
-
RUN_COMPLETED: 'run.completed',
|
|
21
|
-
RUN_FAILED: 'run.failed',
|
|
22
|
-
// Backend -> Worker
|
|
23
|
-
RUN_ASSIGNED: 'run.assigned',
|
|
24
|
-
STOP_REQUESTED: 'stop.requested',
|
|
16
|
+
WORKER_SEEN: 'worker.seen',
|
|
25
17
|
};
|