@taico/events 0.0.1 → 0.0.3
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 +2 -0
- package/dist/index.js +2 -0
- package/dist/types/task-events.d.ts +198 -0
- package/dist/types/task-events.js +38 -0
- package/dist/types/thread-events.d.ts +147 -0
- package/dist/types/thread-events.js +27 -0
- package/package.json +9 -3
- package/src/index.ts +0 -1
- package/src/types/task-events.ts +0 -219
- package/tsconfig.build.json +0 -13
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task Wire Event Types for WebSocket Communication
|
|
3
|
+
*
|
|
4
|
+
* These types define the structure of events sent between backend and frontend
|
|
5
|
+
* via WebSocket for the Tasks domain. They serve as a contract between the
|
|
6
|
+
* backend gateway and frontend consumers.
|
|
7
|
+
*
|
|
8
|
+
* Import these types in both backend (for emission) and frontend (for reception)
|
|
9
|
+
* to ensure type safety across the wire protocol.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Wire event names for Tasks domain
|
|
13
|
+
* These are the stable, external event identifiers sent over the wire protocol.
|
|
14
|
+
*/
|
|
15
|
+
export declare const TaskWireEvents: {
|
|
16
|
+
readonly TASK_CREATED: "task.created";
|
|
17
|
+
readonly TASK_UPDATED: "task.updated";
|
|
18
|
+
readonly TASK_DELETED: "task.deleted";
|
|
19
|
+
readonly TASK_ASSIGNED: "task.assigned";
|
|
20
|
+
readonly TASK_STATUS_CHANGED: "task.status_changed";
|
|
21
|
+
readonly TASK_COMMENTED: "task.commented";
|
|
22
|
+
readonly TASK_ARTEFACT_ADDED: "task.artefact_added";
|
|
23
|
+
readonly INPUT_REQUEST_ANSWERED: "input.request.answered";
|
|
24
|
+
readonly TASK_ACTIVITY: "task.activity";
|
|
25
|
+
readonly TASK_ACTIVITY_POST: "task.activity.post";
|
|
26
|
+
};
|
|
27
|
+
export type TaskWireEventName = (typeof TaskWireEvents)[keyof typeof TaskWireEvents];
|
|
28
|
+
/**
|
|
29
|
+
* Base actor structure included in all events
|
|
30
|
+
*/
|
|
31
|
+
export interface EventActor {
|
|
32
|
+
id: string;
|
|
33
|
+
type?: string;
|
|
34
|
+
slug?: string;
|
|
35
|
+
displayName?: string;
|
|
36
|
+
avatarUrl?: string | null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Actor structure for minimal event payloads
|
|
40
|
+
*/
|
|
41
|
+
export interface MinimalEventActor {
|
|
42
|
+
id: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Task structure as sent over the wire
|
|
46
|
+
* Matches TaskResponseDto from backend
|
|
47
|
+
*/
|
|
48
|
+
export interface TaskWirePayload {
|
|
49
|
+
id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
description: string;
|
|
52
|
+
status: 'NOT_STARTED' | 'IN_PROGRESS' | 'FOR_REVIEW' | 'DONE';
|
|
53
|
+
assignee: string | null;
|
|
54
|
+
assigneeActor: EventActor | null;
|
|
55
|
+
sessionId: string;
|
|
56
|
+
comments: CommentWirePayload[];
|
|
57
|
+
artefacts: ArtefactWirePayload[];
|
|
58
|
+
inputRequests: InputRequestWirePayload[];
|
|
59
|
+
tags: TagWirePayload[];
|
|
60
|
+
createdByActor: EventActor;
|
|
61
|
+
dependsOnIds: string[];
|
|
62
|
+
createdAt: string;
|
|
63
|
+
updatedAt: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Comment structure as sent over the wire
|
|
67
|
+
* Matches CommentResponseDto from backend
|
|
68
|
+
*/
|
|
69
|
+
export interface CommentWirePayload {
|
|
70
|
+
id: string;
|
|
71
|
+
taskId: string;
|
|
72
|
+
commenterName: string;
|
|
73
|
+
commenterActor: EventActor | null;
|
|
74
|
+
content: string;
|
|
75
|
+
createdAt: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Artefact structure as sent over the wire
|
|
79
|
+
* Matches ArtefactResponseDto from backend
|
|
80
|
+
*/
|
|
81
|
+
export interface ArtefactWirePayload {
|
|
82
|
+
id: string;
|
|
83
|
+
taskId: string;
|
|
84
|
+
name: string;
|
|
85
|
+
link: string;
|
|
86
|
+
createdAt: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Input request structure as sent over the wire
|
|
90
|
+
* Matches InputRequestResponseDto from backend
|
|
91
|
+
*/
|
|
92
|
+
export interface InputRequestWirePayload {
|
|
93
|
+
id: string;
|
|
94
|
+
taskId: string;
|
|
95
|
+
askedByActorId: string;
|
|
96
|
+
assignedToActorId: string;
|
|
97
|
+
question: string;
|
|
98
|
+
answer: string | null;
|
|
99
|
+
resolvedAt: string | null;
|
|
100
|
+
createdAt: string;
|
|
101
|
+
updatedAt: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Tag structure as sent over the wire
|
|
105
|
+
* Matches TagResponseDto from backend
|
|
106
|
+
*/
|
|
107
|
+
export interface TagWirePayload {
|
|
108
|
+
id: string;
|
|
109
|
+
name: string;
|
|
110
|
+
color?: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Task created event
|
|
114
|
+
* Emitted when a new task is created
|
|
115
|
+
*/
|
|
116
|
+
export interface TaskCreatedWireEvent {
|
|
117
|
+
payload: TaskWirePayload;
|
|
118
|
+
actor: MinimalEventActor;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Task updated event
|
|
122
|
+
* Emitted when a task is updated
|
|
123
|
+
*/
|
|
124
|
+
export interface TaskUpdatedWireEvent {
|
|
125
|
+
payload: TaskWirePayload;
|
|
126
|
+
actor: MinimalEventActor;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Task deleted event
|
|
130
|
+
* Emitted when a task is deleted
|
|
131
|
+
*/
|
|
132
|
+
export interface TaskDeletedWireEvent {
|
|
133
|
+
payload: {
|
|
134
|
+
taskId: string;
|
|
135
|
+
};
|
|
136
|
+
actor: MinimalEventActor;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Task assigned event
|
|
140
|
+
* Emitted when a task is assigned to an actor
|
|
141
|
+
*/
|
|
142
|
+
export interface TaskAssignedWireEvent {
|
|
143
|
+
payload: TaskWirePayload;
|
|
144
|
+
actor: MinimalEventActor;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Task status changed event
|
|
148
|
+
* Emitted when a task's status changes
|
|
149
|
+
*/
|
|
150
|
+
export interface TaskStatusChangedWireEvent {
|
|
151
|
+
payload: TaskWirePayload;
|
|
152
|
+
actor: MinimalEventActor;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Comment added event
|
|
156
|
+
* Emitted when a comment is added to a task
|
|
157
|
+
*/
|
|
158
|
+
export interface TaskCommentedWireEvent {
|
|
159
|
+
payload: CommentWirePayload;
|
|
160
|
+
actor: MinimalEventActor;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Artefact added event
|
|
164
|
+
* Emitted when an artefact is added to a task
|
|
165
|
+
*/
|
|
166
|
+
export interface TaskArtefactAddedWireEvent {
|
|
167
|
+
payload: ArtefactWirePayload;
|
|
168
|
+
actor: MinimalEventActor;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Input request answered event
|
|
172
|
+
* Emitted when an input request is answered
|
|
173
|
+
*/
|
|
174
|
+
export interface InputRequestAnsweredWireEvent {
|
|
175
|
+
payload: InputRequestWirePayload;
|
|
176
|
+
actor: MinimalEventActor;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Task activity event (ephemeral)
|
|
180
|
+
* Emitted for real-time activity updates (e.g., agent working on task)
|
|
181
|
+
*/
|
|
182
|
+
export interface TaskActivityWireEvent {
|
|
183
|
+
taskId: string;
|
|
184
|
+
kind: string;
|
|
185
|
+
message?: string;
|
|
186
|
+
ts: number;
|
|
187
|
+
by?: string;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Union type of all task wire events
|
|
191
|
+
*/
|
|
192
|
+
export type TaskWireEvent = TaskCreatedWireEvent | TaskUpdatedWireEvent | TaskDeletedWireEvent | TaskAssignedWireEvent | TaskStatusChangedWireEvent | TaskCommentedWireEvent | TaskArtefactAddedWireEvent | InputRequestAnsweredWireEvent;
|
|
193
|
+
/**
|
|
194
|
+
* Type guards for event identification
|
|
195
|
+
*/
|
|
196
|
+
export declare function isTaskCreatedEvent(event: TaskWireEvent): event is TaskCreatedWireEvent;
|
|
197
|
+
export declare function isTaskDeletedEvent(event: TaskWireEvent): event is TaskDeletedWireEvent;
|
|
198
|
+
export declare function isTaskCommentedEvent(event: TaskWireEvent): event is TaskCommentedWireEvent;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task Wire Event Types for WebSocket Communication
|
|
3
|
+
*
|
|
4
|
+
* These types define the structure of events sent between backend and frontend
|
|
5
|
+
* via WebSocket for the Tasks domain. They serve as a contract between the
|
|
6
|
+
* backend gateway and frontend consumers.
|
|
7
|
+
*
|
|
8
|
+
* Import these types in both backend (for emission) and frontend (for reception)
|
|
9
|
+
* to ensure type safety across the wire protocol.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Wire event names for Tasks domain
|
|
13
|
+
* These are the stable, external event identifiers sent over the wire protocol.
|
|
14
|
+
*/
|
|
15
|
+
export const TaskWireEvents = {
|
|
16
|
+
TASK_CREATED: 'task.created',
|
|
17
|
+
TASK_UPDATED: 'task.updated',
|
|
18
|
+
TASK_DELETED: 'task.deleted',
|
|
19
|
+
TASK_ASSIGNED: 'task.assigned',
|
|
20
|
+
TASK_STATUS_CHANGED: 'task.status_changed',
|
|
21
|
+
TASK_COMMENTED: 'task.commented',
|
|
22
|
+
TASK_ARTEFACT_ADDED: 'task.artefact_added',
|
|
23
|
+
INPUT_REQUEST_ANSWERED: 'input.request.answered',
|
|
24
|
+
TASK_ACTIVITY: 'task.activity',
|
|
25
|
+
TASK_ACTIVITY_POST: 'task.activity.post',
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Type guards for event identification
|
|
29
|
+
*/
|
|
30
|
+
export function isTaskCreatedEvent(event) {
|
|
31
|
+
return 'payload' in event && 'id' in event.payload && 'name' in event.payload;
|
|
32
|
+
}
|
|
33
|
+
export function isTaskDeletedEvent(event) {
|
|
34
|
+
return 'payload' in event && 'taskId' in event.payload;
|
|
35
|
+
}
|
|
36
|
+
export function isTaskCommentedEvent(event) {
|
|
37
|
+
return ('payload' in event && 'taskId' in event.payload && 'content' in event.payload);
|
|
38
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thread Wire Event Types for WebSocket Communication
|
|
3
|
+
*
|
|
4
|
+
* These types define the structure of events sent between backend and frontend
|
|
5
|
+
* via WebSocket for the Threads domain. They serve as a contract between the
|
|
6
|
+
* backend gateway and frontend consumers.
|
|
7
|
+
*
|
|
8
|
+
* Import these types in both backend (for emission) and frontend (for reception)
|
|
9
|
+
* to ensure type safety across the wire protocol.
|
|
10
|
+
*/
|
|
11
|
+
import type { MinimalEventActor, TagWirePayload } from './task-events.js';
|
|
12
|
+
/**
|
|
13
|
+
* Wire event names for Threads domain
|
|
14
|
+
* These are the stable, external event identifiers sent over the wire protocol.
|
|
15
|
+
*/
|
|
16
|
+
export declare const ThreadWireEvents: {
|
|
17
|
+
readonly THREAD_CREATED: "thread.created";
|
|
18
|
+
readonly THREAD_UPDATED: "thread.updated";
|
|
19
|
+
readonly THREAD_DELETED: "thread.deleted";
|
|
20
|
+
readonly THREAD_TITLE_UPDATED: "thread.title.updated";
|
|
21
|
+
readonly MESSAGE_CREATED: "thread.message.created";
|
|
22
|
+
readonly AGENT_ACTIVITY: "thread.agent.activity";
|
|
23
|
+
};
|
|
24
|
+
export type ThreadWireEventName = (typeof ThreadWireEvents)[keyof typeof ThreadWireEvents];
|
|
25
|
+
/**
|
|
26
|
+
* Task summary structure as sent over the wire
|
|
27
|
+
*/
|
|
28
|
+
export interface TaskSummaryWirePayload {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
status: 'NOT_STARTED' | 'IN_PROGRESS' | 'FOR_REVIEW' | 'DONE';
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Context block summary structure as sent over the wire
|
|
35
|
+
*/
|
|
36
|
+
export interface ContextBlockSummaryWirePayload {
|
|
37
|
+
id: string;
|
|
38
|
+
title: string;
|
|
39
|
+
}
|
|
40
|
+
export declare enum ActorType {
|
|
41
|
+
HUMAN = "human",
|
|
42
|
+
AGENT = "agent"
|
|
43
|
+
}
|
|
44
|
+
export interface Actor {
|
|
45
|
+
id: string;
|
|
46
|
+
type: ActorType;
|
|
47
|
+
slug: string;
|
|
48
|
+
displayName: string;
|
|
49
|
+
avatarUrl: string | null;
|
|
50
|
+
introduction: string | null;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Thread structure as sent over the wire
|
|
54
|
+
* Matches ThreadResponseDto from backend
|
|
55
|
+
*/
|
|
56
|
+
export interface ThreadWirePayload {
|
|
57
|
+
id: string;
|
|
58
|
+
title: string;
|
|
59
|
+
createdByActorId: string;
|
|
60
|
+
createdByActor: Actor;
|
|
61
|
+
parentTaskId: string | null;
|
|
62
|
+
parentTask: TaskSummaryWirePayload | null;
|
|
63
|
+
stateBlockId: string;
|
|
64
|
+
stateBlock: ContextBlockSummaryWirePayload;
|
|
65
|
+
tags: TagWirePayload[];
|
|
66
|
+
tasks: TaskSummaryWirePayload[];
|
|
67
|
+
contextBlocks: ContextBlockSummaryWirePayload[];
|
|
68
|
+
participantActorIds: string[];
|
|
69
|
+
participants: Actor[];
|
|
70
|
+
rowVersion: number;
|
|
71
|
+
createdAt: string;
|
|
72
|
+
updatedAt: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Thread message structure as sent over the wire
|
|
76
|
+
* Matches ThreadMessageResponseDto from backend
|
|
77
|
+
*/
|
|
78
|
+
export interface ThreadMessageWirePayload {
|
|
79
|
+
id: string;
|
|
80
|
+
threadId: string;
|
|
81
|
+
content: string;
|
|
82
|
+
createdByActorId: string | null;
|
|
83
|
+
createdByActor: Actor | null;
|
|
84
|
+
createdAt: string;
|
|
85
|
+
updatedAt: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Thread created event
|
|
89
|
+
* Emitted when a new thread is created
|
|
90
|
+
*/
|
|
91
|
+
export interface ThreadCreatedWireEvent {
|
|
92
|
+
payload: ThreadWirePayload;
|
|
93
|
+
actor: MinimalEventActor;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Thread updated event
|
|
97
|
+
* Emitted when a thread is updated
|
|
98
|
+
*/
|
|
99
|
+
export interface ThreadUpdatedWireEvent {
|
|
100
|
+
payload: ThreadWirePayload;
|
|
101
|
+
actor: MinimalEventActor;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Thread deleted event
|
|
105
|
+
* Emitted when a thread is deleted
|
|
106
|
+
*/
|
|
107
|
+
export interface ThreadDeletedWireEvent {
|
|
108
|
+
payload: {
|
|
109
|
+
threadId: string;
|
|
110
|
+
};
|
|
111
|
+
actor: MinimalEventActor;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Thread title updated event
|
|
115
|
+
* Emitted when a thread title changes after initial creation.
|
|
116
|
+
*/
|
|
117
|
+
export interface ThreadTitleUpdatedWireEvent {
|
|
118
|
+
payload: {
|
|
119
|
+
threadId: string;
|
|
120
|
+
title: string;
|
|
121
|
+
};
|
|
122
|
+
actor: MinimalEventActor;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Message created event
|
|
126
|
+
* Emitted when a message is created in a thread
|
|
127
|
+
*/
|
|
128
|
+
export interface MessageCreatedWireEvent {
|
|
129
|
+
payload: ThreadMessageWirePayload;
|
|
130
|
+
actor: MinimalEventActor;
|
|
131
|
+
}
|
|
132
|
+
export type ThreadAgentActivityKind = 'thinking' | 'tool_calling';
|
|
133
|
+
/**
|
|
134
|
+
* Agent activity event
|
|
135
|
+
* Emitted for ephemeral assistant actions (thinking/tool calling)
|
|
136
|
+
*/
|
|
137
|
+
export interface AgentActivityWireEvent {
|
|
138
|
+
payload: {
|
|
139
|
+
threadId: string;
|
|
140
|
+
kind: ThreadAgentActivityKind;
|
|
141
|
+
};
|
|
142
|
+
actor: MinimalEventActor;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Union type of all thread wire events
|
|
146
|
+
*/
|
|
147
|
+
export type ThreadWireEvent = ThreadCreatedWireEvent | ThreadUpdatedWireEvent | ThreadDeletedWireEvent | ThreadTitleUpdatedWireEvent | MessageCreatedWireEvent | AgentActivityWireEvent;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thread Wire Event Types for WebSocket Communication
|
|
3
|
+
*
|
|
4
|
+
* These types define the structure of events sent between backend and frontend
|
|
5
|
+
* via WebSocket for the Threads domain. They serve as a contract between the
|
|
6
|
+
* backend gateway and frontend consumers.
|
|
7
|
+
*
|
|
8
|
+
* Import these types in both backend (for emission) and frontend (for reception)
|
|
9
|
+
* to ensure type safety across the wire protocol.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Wire event names for Threads domain
|
|
13
|
+
* These are the stable, external event identifiers sent over the wire protocol.
|
|
14
|
+
*/
|
|
15
|
+
export const ThreadWireEvents = {
|
|
16
|
+
THREAD_CREATED: 'thread.created',
|
|
17
|
+
THREAD_UPDATED: 'thread.updated',
|
|
18
|
+
THREAD_DELETED: 'thread.deleted',
|
|
19
|
+
THREAD_TITLE_UPDATED: 'thread.title.updated',
|
|
20
|
+
MESSAGE_CREATED: 'thread.message.created',
|
|
21
|
+
AGENT_ACTIVITY: 'thread.agent.activity',
|
|
22
|
+
};
|
|
23
|
+
export var ActorType;
|
|
24
|
+
(function (ActorType) {
|
|
25
|
+
ActorType["HUMAN"] = "human";
|
|
26
|
+
ActorType["AGENT"] = "agent";
|
|
27
|
+
})(ActorType || (ActorType = {}));
|
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taico/events",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"package.json"
|
|
12
|
+
],
|
|
9
13
|
"exports": {
|
|
10
14
|
".": {
|
|
11
15
|
"types": "./dist/index.d.ts",
|
|
@@ -15,9 +19,11 @@
|
|
|
15
19
|
"./package.json": "./package.json"
|
|
16
20
|
},
|
|
17
21
|
"scripts": {
|
|
18
|
-
"build": "tsc -p tsconfig.build.json"
|
|
22
|
+
"build": "tsc -p tsconfig.build.json",
|
|
23
|
+
"pack": "npm run build && npm pack",
|
|
24
|
+
"release": "npm run build && npm publish --access public"
|
|
19
25
|
},
|
|
20
26
|
"devDependencies": {
|
|
21
27
|
"typescript": "^5.6.3"
|
|
22
28
|
}
|
|
23
|
-
}
|
|
29
|
+
}
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './types/task-events.js';
|
package/src/types/task-events.ts
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task Wire Event Types for WebSocket Communication
|
|
3
|
-
*
|
|
4
|
-
* These types define the structure of events sent between backend and frontend
|
|
5
|
-
* via WebSocket for the Tasks domain. They serve as a contract between the
|
|
6
|
-
* backend gateway and frontend consumers.
|
|
7
|
-
*
|
|
8
|
-
* Import these types in both backend (for emission) and frontend (for reception)
|
|
9
|
-
* to ensure type safety across the wire protocol.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Wire event names for Tasks domain
|
|
14
|
-
* These are the stable, external event identifiers sent over the wire protocol.
|
|
15
|
-
*/
|
|
16
|
-
export const TaskWireEvents = {
|
|
17
|
-
TASK_CREATED: 'task.created',
|
|
18
|
-
TASK_UPDATED: 'task.updated',
|
|
19
|
-
TASK_DELETED: 'task.deleted',
|
|
20
|
-
TASK_ASSIGNED: 'task.assigned',
|
|
21
|
-
TASK_STATUS_CHANGED: 'task.status_changed',
|
|
22
|
-
TASK_COMMENTED: 'task.commented',
|
|
23
|
-
INPUT_REQUEST_ANSWERED: 'input.request.answered',
|
|
24
|
-
TASK_ACTIVITY: 'task.activity',
|
|
25
|
-
TASK_ACTIVITY_POST: 'task.activity.post',
|
|
26
|
-
} as const;
|
|
27
|
-
|
|
28
|
-
export type TaskWireEventName =
|
|
29
|
-
(typeof TaskWireEvents)[keyof typeof TaskWireEvents];
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Base actor structure included in all events
|
|
33
|
-
*/
|
|
34
|
-
export interface EventActor {
|
|
35
|
-
id: string;
|
|
36
|
-
type?: string;
|
|
37
|
-
slug?: string;
|
|
38
|
-
displayName?: string;
|
|
39
|
-
avatarUrl?: string | null;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Actor structure for minimal event payloads
|
|
44
|
-
*/
|
|
45
|
-
export interface MinimalEventActor {
|
|
46
|
-
id: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Task structure as sent over the wire
|
|
51
|
-
* Matches TaskResponseDto from backend
|
|
52
|
-
*/
|
|
53
|
-
export interface TaskWirePayload {
|
|
54
|
-
id: string;
|
|
55
|
-
name: string;
|
|
56
|
-
description: string;
|
|
57
|
-
status: 'NOT_STARTED' | 'IN_PROGRESS' | 'FOR_REVIEW' | 'DONE';
|
|
58
|
-
assignee: string | null;
|
|
59
|
-
assigneeActor: EventActor | null;
|
|
60
|
-
sessionId: string;
|
|
61
|
-
comments: CommentWirePayload[];
|
|
62
|
-
inputRequests: InputRequestWirePayload[];
|
|
63
|
-
tags: TagWirePayload[];
|
|
64
|
-
createdByActor: EventActor;
|
|
65
|
-
dependsOnIds: string[];
|
|
66
|
-
createdAt: string;
|
|
67
|
-
updatedAt: string;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Comment structure as sent over the wire
|
|
72
|
-
* Matches CommentResponseDto from backend
|
|
73
|
-
*/
|
|
74
|
-
export interface CommentWirePayload {
|
|
75
|
-
id: string;
|
|
76
|
-
taskId: string;
|
|
77
|
-
commenterName: string;
|
|
78
|
-
commenterActor: EventActor | null;
|
|
79
|
-
content: string;
|
|
80
|
-
createdAt: string;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Input request structure as sent over the wire
|
|
85
|
-
* Matches InputRequestResponseDto from backend
|
|
86
|
-
*/
|
|
87
|
-
export interface InputRequestWirePayload {
|
|
88
|
-
id: string;
|
|
89
|
-
taskId: string;
|
|
90
|
-
askedByActorId: string;
|
|
91
|
-
assignedToActorId: string;
|
|
92
|
-
question: string;
|
|
93
|
-
answer: string | null;
|
|
94
|
-
resolvedAt: string | null;
|
|
95
|
-
createdAt: string;
|
|
96
|
-
updatedAt: string;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Tag structure as sent over the wire
|
|
101
|
-
* Matches TagResponseDto from backend
|
|
102
|
-
*/
|
|
103
|
-
export interface TagWirePayload {
|
|
104
|
-
id: string;
|
|
105
|
-
name: string;
|
|
106
|
-
color?: string;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Task created event
|
|
111
|
-
* Emitted when a new task is created
|
|
112
|
-
*/
|
|
113
|
-
export interface TaskCreatedWireEvent {
|
|
114
|
-
payload: TaskWirePayload;
|
|
115
|
-
actor: MinimalEventActor;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Task updated event
|
|
120
|
-
* Emitted when a task is updated
|
|
121
|
-
*/
|
|
122
|
-
export interface TaskUpdatedWireEvent {
|
|
123
|
-
payload: TaskWirePayload;
|
|
124
|
-
actor: MinimalEventActor;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Task deleted event
|
|
129
|
-
* Emitted when a task is deleted
|
|
130
|
-
*/
|
|
131
|
-
export interface TaskDeletedWireEvent {
|
|
132
|
-
payload: {
|
|
133
|
-
taskId: string;
|
|
134
|
-
};
|
|
135
|
-
actor: MinimalEventActor;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Task assigned event
|
|
140
|
-
* Emitted when a task is assigned to an actor
|
|
141
|
-
*/
|
|
142
|
-
export interface TaskAssignedWireEvent {
|
|
143
|
-
payload: TaskWirePayload;
|
|
144
|
-
actor: MinimalEventActor;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Task status changed event
|
|
149
|
-
* Emitted when a task's status changes
|
|
150
|
-
*/
|
|
151
|
-
export interface TaskStatusChangedWireEvent {
|
|
152
|
-
payload: TaskWirePayload;
|
|
153
|
-
actor: MinimalEventActor;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Comment added event
|
|
158
|
-
* Emitted when a comment is added to a task
|
|
159
|
-
*/
|
|
160
|
-
export interface TaskCommentedWireEvent {
|
|
161
|
-
payload: CommentWirePayload;
|
|
162
|
-
actor: MinimalEventActor;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Input request answered event
|
|
167
|
-
* Emitted when an input request is answered
|
|
168
|
-
*/
|
|
169
|
-
export interface InputRequestAnsweredWireEvent {
|
|
170
|
-
payload: InputRequestWirePayload;
|
|
171
|
-
actor: MinimalEventActor;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Task activity event (ephemeral)
|
|
176
|
-
* Emitted for real-time activity updates (e.g., agent working on task)
|
|
177
|
-
*/
|
|
178
|
-
export interface TaskActivityWireEvent {
|
|
179
|
-
taskId: string;
|
|
180
|
-
kind: string;
|
|
181
|
-
message?: string;
|
|
182
|
-
ts: number;
|
|
183
|
-
by?: string;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Union type of all task wire events
|
|
188
|
-
*/
|
|
189
|
-
export type TaskWireEvent =
|
|
190
|
-
| TaskCreatedWireEvent
|
|
191
|
-
| TaskUpdatedWireEvent
|
|
192
|
-
| TaskDeletedWireEvent
|
|
193
|
-
| TaskAssignedWireEvent
|
|
194
|
-
| TaskStatusChangedWireEvent
|
|
195
|
-
| TaskCommentedWireEvent
|
|
196
|
-
| InputRequestAnsweredWireEvent;
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Type guards for event identification
|
|
200
|
-
*/
|
|
201
|
-
export function isTaskCreatedEvent(
|
|
202
|
-
event: TaskWireEvent,
|
|
203
|
-
): event is TaskCreatedWireEvent {
|
|
204
|
-
return 'payload' in event && 'id' in event.payload && 'name' in event.payload;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
export function isTaskDeletedEvent(
|
|
208
|
-
event: TaskWireEvent,
|
|
209
|
-
): event is TaskDeletedWireEvent {
|
|
210
|
-
return 'payload' in event && 'taskId' in event.payload;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
export function isTaskCommentedEvent(
|
|
214
|
-
event: TaskWireEvent,
|
|
215
|
-
): event is TaskCommentedWireEvent {
|
|
216
|
-
return (
|
|
217
|
-
'payload' in event && 'taskId' in event.payload && 'content' in event.payload
|
|
218
|
-
);
|
|
219
|
-
}
|
package/tsconfig.build.json
DELETED