@hawk.so/types 0.5.2 → 0.5.4

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,33 @@
1
+ /**
2
+ * Task Manager item linked to a particular Event (e.g., GitHub Issue)
3
+ */
4
+ export interface TaskManagerItem {
5
+ /**
6
+ * Type of task manager item (currently only 'github-issue' is supported)
7
+ */
8
+ type: 'github-issue';
9
+ /**
10
+ * Task number (e.g., GitHub Issue number)
11
+ */
12
+ number: number;
13
+ /**
14
+ * URL to the task (e.g., GitHub Issue URL)
15
+ */
16
+ url: string;
17
+ /**
18
+ * Task title
19
+ */
20
+ title: string;
21
+ /**
22
+ * How the task was created (automatically by worker or manually by user)
23
+ */
24
+ createdBy: 'auto' | 'manual';
25
+ /**
26
+ * Task creation timestamp
27
+ */
28
+ createdAt: Date;
29
+ /**
30
+ * Agent assigned to the task (e.g., 'copilot' for GitHub Copilot)
31
+ */
32
+ assignee: 'copilot' | null;
33
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -59,5 +59,43 @@ export interface ProjectTaskManagerConfig {
59
59
  * Repository full name (owner/repo)
60
60
  */
61
61
  repoFullName: string;
62
+ /**
63
+ * Delegated user OAuth token for user-to-server authentication
64
+ * Used for creating issues and assigning Copilot on behalf of the user
65
+ */
66
+ delegatedUser?: {
67
+ /**
68
+ * Hawk user ID who authorized the GitHub App
69
+ */
70
+ hawkUserId: string;
71
+ /**
72
+ * GitHub user ID
73
+ */
74
+ githubUserId: number;
75
+ /**
76
+ * GitHub username/login
77
+ */
78
+ githubLogin: string;
79
+ /**
80
+ * OAuth access token (user-to-server token)
81
+ */
82
+ accessToken: string;
83
+ /**
84
+ * Date when token was created/saved
85
+ */
86
+ tokenCreatedAt: Date;
87
+ /**
88
+ * Date when token was last successfully validated
89
+ * null if never validated
90
+ */
91
+ tokenLastValidatedAt: Date | null;
92
+ /**
93
+ * Token status
94
+ * - active: token is valid (GET /user returns 200)
95
+ * - revoked: token was revoked (GET /user returns 401/403) or user removed authorization
96
+ * - missing: token is not present in project
97
+ */
98
+ status: 'active' | 'revoked' | 'missing';
99
+ };
62
100
  };
63
101
  }
@@ -2,6 +2,7 @@ import type { ObjectId } from 'bson';
2
2
  import type { DecodedEventData, EncodedEventData, EventData } from '../base/event/event.ts';
3
3
  import type { UserDBScheme } from './user.ts';
4
4
  import type { EventAddons } from '../base/event/addons/index.ts';
5
+ import type { TaskManagerItem } from '../base/event/taskManagerItem.ts';
5
6
  /**
6
7
  * Event marks interface for tracking event status
7
8
  */
@@ -53,6 +54,10 @@ export interface GroupedEventDBScheme {
53
54
  * Event marks for tracking status
54
55
  */
55
56
  marks?: EventMarks;
57
+ /**
58
+ * Task Manager item linked to this event (e.g., GitHub Issue)
59
+ */
60
+ taskManagerItem?: TaskManagerItem;
56
61
  }
57
62
  /**
58
63
  * Event where 'context' and 'addons' are decoded from json strings to objects
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hawk.so/types",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "TypeScript definitions for Hawk",
5
5
  "types": "build/index.d.ts",
6
6
  "main": "build/index.js",
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Task Manager item linked to a particular Event (e.g., GitHub Issue)
3
+ */
4
+ export interface TaskManagerItem {
5
+ /**
6
+ * Type of task manager item (currently only 'github-issue' is supported)
7
+ */
8
+ type: 'github-issue';
9
+
10
+ /**
11
+ * Task number (e.g., GitHub Issue number)
12
+ */
13
+ number: number;
14
+
15
+ /**
16
+ * URL to the task (e.g., GitHub Issue URL)
17
+ */
18
+ url: string;
19
+
20
+ /**
21
+ * Task title
22
+ */
23
+ title: string;
24
+
25
+ /**
26
+ * How the task was created (automatically by worker or manually by user)
27
+ */
28
+ createdBy: 'auto' | 'manual';
29
+
30
+ /**
31
+ * Task creation timestamp
32
+ */
33
+ createdAt: Date;
34
+
35
+ /**
36
+ * Agent assigned to the task (e.g., 'copilot' for GitHub Copilot)
37
+ */
38
+ assignee: 'copilot' | null;
39
+ }
@@ -70,5 +70,50 @@ export interface ProjectTaskManagerConfig {
70
70
  * Repository full name (owner/repo)
71
71
  */
72
72
  repoFullName: string;
73
+
74
+ /**
75
+ * Delegated user OAuth token for user-to-server authentication
76
+ * Used for creating issues and assigning Copilot on behalf of the user
77
+ */
78
+ delegatedUser?: {
79
+ /**
80
+ * Hawk user ID who authorized the GitHub App
81
+ */
82
+ hawkUserId: string;
83
+
84
+ /**
85
+ * GitHub user ID
86
+ */
87
+ githubUserId: number;
88
+
89
+ /**
90
+ * GitHub username/login
91
+ */
92
+ githubLogin: string;
93
+
94
+ /**
95
+ * OAuth access token (user-to-server token)
96
+ */
97
+ accessToken: string;
98
+
99
+ /**
100
+ * Date when token was created/saved
101
+ */
102
+ tokenCreatedAt: Date;
103
+
104
+ /**
105
+ * Date when token was last successfully validated
106
+ * null if never validated
107
+ */
108
+ tokenLastValidatedAt: Date | null;
109
+
110
+ /**
111
+ * Token status
112
+ * - active: token is valid (GET /user returns 200)
113
+ * - revoked: token was revoked (GET /user returns 401/403) or user removed authorization
114
+ * - missing: token is not present in project
115
+ */
116
+ status: 'active' | 'revoked' | 'missing';
117
+ };
73
118
  };
74
119
  }
@@ -2,6 +2,7 @@ import type { ObjectId } from 'bson';
2
2
  import type { DecodedEventData, EncodedEventData, EventData } from '../base/event/event.ts';
3
3
  import type { UserDBScheme } from './user.ts';
4
4
  import type { EventAddons } from '../base/event/addons/index.ts';
5
+ import type { TaskManagerItem } from '../base/event/taskManagerItem.ts';
5
6
 
6
7
  /**
7
8
  * Event marks interface for tracking event status
@@ -63,6 +64,11 @@ export interface GroupedEventDBScheme {
63
64
  * Event marks for tracking status
64
65
  */
65
66
  marks?: EventMarks;
67
+
68
+ /**
69
+ * Task Manager item linked to this event (e.g., GitHub Issue)
70
+ */
71
+ taskManagerItem?: TaskManagerItem;
66
72
  }
67
73
 
68
74
  /**