@taico/events 0.0.1 → 0.0.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.
@@ -0,0 +1 @@
1
+ export * from './types/task-events.js';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from './types/task-events.js';
@@ -0,0 +1,177 @@
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 INPUT_REQUEST_ANSWERED: "input.request.answered";
23
+ readonly TASK_ACTIVITY: "task.activity";
24
+ readonly TASK_ACTIVITY_POST: "task.activity.post";
25
+ };
26
+ export type TaskWireEventName = (typeof TaskWireEvents)[keyof typeof TaskWireEvents];
27
+ /**
28
+ * Base actor structure included in all events
29
+ */
30
+ export interface EventActor {
31
+ id: string;
32
+ type?: string;
33
+ slug?: string;
34
+ displayName?: string;
35
+ avatarUrl?: string | null;
36
+ }
37
+ /**
38
+ * Actor structure for minimal event payloads
39
+ */
40
+ export interface MinimalEventActor {
41
+ id: string;
42
+ }
43
+ /**
44
+ * Task structure as sent over the wire
45
+ * Matches TaskResponseDto from backend
46
+ */
47
+ export interface TaskWirePayload {
48
+ id: string;
49
+ name: string;
50
+ description: string;
51
+ status: 'NOT_STARTED' | 'IN_PROGRESS' | 'FOR_REVIEW' | 'DONE';
52
+ assignee: string | null;
53
+ assigneeActor: EventActor | null;
54
+ sessionId: string;
55
+ comments: CommentWirePayload[];
56
+ inputRequests: InputRequestWirePayload[];
57
+ tags: TagWirePayload[];
58
+ createdByActor: EventActor;
59
+ dependsOnIds: string[];
60
+ createdAt: string;
61
+ updatedAt: string;
62
+ }
63
+ /**
64
+ * Comment structure as sent over the wire
65
+ * Matches CommentResponseDto from backend
66
+ */
67
+ export interface CommentWirePayload {
68
+ id: string;
69
+ taskId: string;
70
+ commenterName: string;
71
+ commenterActor: EventActor | null;
72
+ content: string;
73
+ createdAt: string;
74
+ }
75
+ /**
76
+ * Input request structure as sent over the wire
77
+ * Matches InputRequestResponseDto from backend
78
+ */
79
+ export interface InputRequestWirePayload {
80
+ id: string;
81
+ taskId: string;
82
+ askedByActorId: string;
83
+ assignedToActorId: string;
84
+ question: string;
85
+ answer: string | null;
86
+ resolvedAt: string | null;
87
+ createdAt: string;
88
+ updatedAt: string;
89
+ }
90
+ /**
91
+ * Tag structure as sent over the wire
92
+ * Matches TagResponseDto from backend
93
+ */
94
+ export interface TagWirePayload {
95
+ id: string;
96
+ name: string;
97
+ color?: string;
98
+ }
99
+ /**
100
+ * Task created event
101
+ * Emitted when a new task is created
102
+ */
103
+ export interface TaskCreatedWireEvent {
104
+ payload: TaskWirePayload;
105
+ actor: MinimalEventActor;
106
+ }
107
+ /**
108
+ * Task updated event
109
+ * Emitted when a task is updated
110
+ */
111
+ export interface TaskUpdatedWireEvent {
112
+ payload: TaskWirePayload;
113
+ actor: MinimalEventActor;
114
+ }
115
+ /**
116
+ * Task deleted event
117
+ * Emitted when a task is deleted
118
+ */
119
+ export interface TaskDeletedWireEvent {
120
+ payload: {
121
+ taskId: string;
122
+ };
123
+ actor: MinimalEventActor;
124
+ }
125
+ /**
126
+ * Task assigned event
127
+ * Emitted when a task is assigned to an actor
128
+ */
129
+ export interface TaskAssignedWireEvent {
130
+ payload: TaskWirePayload;
131
+ actor: MinimalEventActor;
132
+ }
133
+ /**
134
+ * Task status changed event
135
+ * Emitted when a task's status changes
136
+ */
137
+ export interface TaskStatusChangedWireEvent {
138
+ payload: TaskWirePayload;
139
+ actor: MinimalEventActor;
140
+ }
141
+ /**
142
+ * Comment added event
143
+ * Emitted when a comment is added to a task
144
+ */
145
+ export interface TaskCommentedWireEvent {
146
+ payload: CommentWirePayload;
147
+ actor: MinimalEventActor;
148
+ }
149
+ /**
150
+ * Input request answered event
151
+ * Emitted when an input request is answered
152
+ */
153
+ export interface InputRequestAnsweredWireEvent {
154
+ payload: InputRequestWirePayload;
155
+ actor: MinimalEventActor;
156
+ }
157
+ /**
158
+ * Task activity event (ephemeral)
159
+ * Emitted for real-time activity updates (e.g., agent working on task)
160
+ */
161
+ export interface TaskActivityWireEvent {
162
+ taskId: string;
163
+ kind: string;
164
+ message?: string;
165
+ ts: number;
166
+ by?: string;
167
+ }
168
+ /**
169
+ * Union type of all task wire events
170
+ */
171
+ export type TaskWireEvent = TaskCreatedWireEvent | TaskUpdatedWireEvent | TaskDeletedWireEvent | TaskAssignedWireEvent | TaskStatusChangedWireEvent | TaskCommentedWireEvent | InputRequestAnsweredWireEvent;
172
+ /**
173
+ * Type guards for event identification
174
+ */
175
+ export declare function isTaskCreatedEvent(event: TaskWireEvent): event is TaskCreatedWireEvent;
176
+ export declare function isTaskDeletedEvent(event: TaskWireEvent): event is TaskDeletedWireEvent;
177
+ export declare function isTaskCommentedEvent(event: TaskWireEvent): event is TaskCommentedWireEvent;
@@ -0,0 +1,37 @@
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
+ INPUT_REQUEST_ANSWERED: 'input.request.answered',
23
+ TASK_ACTIVITY: 'task.activity',
24
+ TASK_ACTIVITY_POST: 'task.activity.post',
25
+ };
26
+ /**
27
+ * Type guards for event identification
28
+ */
29
+ export function isTaskCreatedEvent(event) {
30
+ return 'payload' in event && 'id' in event.payload && 'name' in event.payload;
31
+ }
32
+ export function isTaskDeletedEvent(event) {
33
+ return 'payload' in event && 'taskId' in event.payload;
34
+ }
35
+ export function isTaskCommentedEvent(event) {
36
+ return ('payload' in event && 'taskId' in event.payload && 'content' in event.payload);
37
+ }
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@taico/events",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
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",
@@ -20,4 +24,4 @@
20
24
  "devDependencies": {
21
25
  "typescript": "^5.6.3"
22
26
  }
23
- }
27
+ }
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './types/task-events.js';
@@ -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
- }
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "declaration": true,
6
- "emitDeclarationOnly": false,
7
- "noEmit": false,
8
- "rootDir": "src",
9
- },
10
- "include": [
11
- "src/**/*",
12
- ],
13
- }