@prmichaelsen/task-mcp 0.2.0

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.
Files changed (142) hide show
  1. package/.env.example +19 -0
  2. package/AGENT.md +1165 -0
  3. package/CHANGELOG.md +72 -0
  4. package/agent/commands/acp.commit.md +511 -0
  5. package/agent/commands/acp.init.md +376 -0
  6. package/agent/commands/acp.package-install.md +347 -0
  7. package/agent/commands/acp.proceed.md +311 -0
  8. package/agent/commands/acp.report.md +392 -0
  9. package/agent/commands/acp.status.md +280 -0
  10. package/agent/commands/acp.sync.md +323 -0
  11. package/agent/commands/acp.update.md +301 -0
  12. package/agent/commands/acp.validate.md +385 -0
  13. package/agent/commands/acp.version-check-for-updates.md +275 -0
  14. package/agent/commands/acp.version-check.md +190 -0
  15. package/agent/commands/acp.version-update.md +288 -0
  16. package/agent/commands/command.template.md +273 -0
  17. package/agent/commands/git.commit.md +511 -0
  18. package/agent/commands/git.init.md +513 -0
  19. package/agent/design/.gitkeep +0 -0
  20. package/agent/design/acp-task-execution-requirements.md +555 -0
  21. package/agent/design/api-dto-design.md +394 -0
  22. package/agent/design/code-extraction-guide.md +827 -0
  23. package/agent/design/design.template.md +136 -0
  24. package/agent/design/requirements.template.md +387 -0
  25. package/agent/design/rest-api-integration.md +489 -0
  26. package/agent/design/sdk-export-requirements.md +549 -0
  27. package/agent/milestones/.gitkeep +0 -0
  28. package/agent/milestones/milestone-1-{title}.template.md +206 -0
  29. package/agent/milestones/milestone-2-task-infrastructure.md +232 -0
  30. package/agent/milestones/milestone-4-autonomous-execution.md +235 -0
  31. package/agent/patterns/.gitkeep +0 -0
  32. package/agent/patterns/bootstrap.md +1271 -0
  33. package/agent/patterns/bootstrap.template.md +1237 -0
  34. package/agent/patterns/pattern.template.md +364 -0
  35. package/agent/progress.template.yaml +158 -0
  36. package/agent/progress.yaml +375 -0
  37. package/agent/scripts/check-for-updates.sh +88 -0
  38. package/agent/scripts/install.sh +157 -0
  39. package/agent/scripts/uninstall.sh +75 -0
  40. package/agent/scripts/update.sh +139 -0
  41. package/agent/scripts/version.sh +35 -0
  42. package/agent/tasks/.gitkeep +0 -0
  43. package/agent/tasks/task-1-{title}.template.md +225 -0
  44. package/agent/tasks/task-86-task-data-model-schemas.md +143 -0
  45. package/agent/tasks/task-87-task-database-service.md +220 -0
  46. package/agent/tasks/task-88-firebase-client-wrapper.md +139 -0
  47. package/agent/tasks/task-88-task-execution-engine.md +277 -0
  48. package/agent/tasks/task-89-mcp-server-implementation.md +197 -0
  49. package/agent/tasks/task-90-build-configuration.md +146 -0
  50. package/agent/tasks/task-91-deployment-configuration.md +128 -0
  51. package/coverage/base.css +224 -0
  52. package/coverage/block-navigation.js +87 -0
  53. package/coverage/favicon.png +0 -0
  54. package/coverage/index.html +191 -0
  55. package/coverage/lcov-report/base.css +224 -0
  56. package/coverage/lcov-report/block-navigation.js +87 -0
  57. package/coverage/lcov-report/favicon.png +0 -0
  58. package/coverage/lcov-report/index.html +191 -0
  59. package/coverage/lcov-report/prettify.css +1 -0
  60. package/coverage/lcov-report/prettify.js +2 -0
  61. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  62. package/coverage/lcov-report/sorter.js +210 -0
  63. package/coverage/lcov-report/src/client.ts.html +1030 -0
  64. package/coverage/lcov-report/src/constant/collections.ts.html +469 -0
  65. package/coverage/lcov-report/src/constant/index.html +116 -0
  66. package/coverage/lcov-report/src/dto/index.html +116 -0
  67. package/coverage/lcov-report/src/dto/transformers.ts.html +568 -0
  68. package/coverage/lcov-report/src/index.html +146 -0
  69. package/coverage/lcov-report/src/schemas/index.html +116 -0
  70. package/coverage/lcov-report/src/schemas/task.ts.html +547 -0
  71. package/coverage/lcov-report/src/server-factory.ts.html +418 -0
  72. package/coverage/lcov-report/src/server.ts.html +289 -0
  73. package/coverage/lcov-report/src/services/index.html +116 -0
  74. package/coverage/lcov-report/src/services/task-database.service.ts.html +1495 -0
  75. package/coverage/lcov-report/src/tools/index.html +236 -0
  76. package/coverage/lcov-report/src/tools/index.ts.html +292 -0
  77. package/coverage/lcov-report/src/tools/task-add-message.ts.html +277 -0
  78. package/coverage/lcov-report/src/tools/task-complete-task-item.ts.html +343 -0
  79. package/coverage/lcov-report/src/tools/task-create-milestone.ts.html +286 -0
  80. package/coverage/lcov-report/src/tools/task-create-task-item.ts.html +358 -0
  81. package/coverage/lcov-report/src/tools/task-get-next-step.ts.html +460 -0
  82. package/coverage/lcov-report/src/tools/task-get-status.ts.html +316 -0
  83. package/coverage/lcov-report/src/tools/task-report-completion.ts.html +343 -0
  84. package/coverage/lcov-report/src/tools/task-update-progress.ts.html +232 -0
  85. package/coverage/lcov.info +974 -0
  86. package/coverage/prettify.css +1 -0
  87. package/coverage/prettify.js +2 -0
  88. package/coverage/sort-arrow-sprite.png +0 -0
  89. package/coverage/sorter.js +210 -0
  90. package/coverage/src/client.ts.html +1030 -0
  91. package/coverage/src/constant/collections.ts.html +469 -0
  92. package/coverage/src/constant/index.html +116 -0
  93. package/coverage/src/dto/index.html +116 -0
  94. package/coverage/src/dto/transformers.ts.html +568 -0
  95. package/coverage/src/index.html +146 -0
  96. package/coverage/src/schemas/index.html +116 -0
  97. package/coverage/src/schemas/task.ts.html +547 -0
  98. package/coverage/src/server-factory.ts.html +418 -0
  99. package/coverage/src/server.ts.html +289 -0
  100. package/coverage/src/services/index.html +116 -0
  101. package/coverage/src/services/task-database.service.ts.html +1495 -0
  102. package/coverage/src/tools/index.html +236 -0
  103. package/coverage/src/tools/index.ts.html +292 -0
  104. package/coverage/src/tools/task-add-message.ts.html +277 -0
  105. package/coverage/src/tools/task-complete-task-item.ts.html +343 -0
  106. package/coverage/src/tools/task-create-milestone.ts.html +286 -0
  107. package/coverage/src/tools/task-create-task-item.ts.html +358 -0
  108. package/coverage/src/tools/task-get-next-step.ts.html +460 -0
  109. package/coverage/src/tools/task-get-status.ts.html +316 -0
  110. package/coverage/src/tools/task-report-completion.ts.html +343 -0
  111. package/coverage/src/tools/task-update-progress.ts.html +232 -0
  112. package/firestore.rules +95 -0
  113. package/jest.config.js +31 -0
  114. package/package.json +67 -0
  115. package/src/client.spec.ts +199 -0
  116. package/src/client.ts +315 -0
  117. package/src/constant/collections.ts +128 -0
  118. package/src/dto/index.ts +47 -0
  119. package/src/dto/task-api.dto.ts +219 -0
  120. package/src/dto/transformers.spec.ts +462 -0
  121. package/src/dto/transformers.ts +161 -0
  122. package/src/schemas/task.ts +154 -0
  123. package/src/server-factory.spec.ts +70 -0
  124. package/src/server-factory.ts +111 -0
  125. package/src/server.ts +68 -0
  126. package/src/services/task-database.service.e2e.ts +116 -0
  127. package/src/services/task-database.service.spec.ts +479 -0
  128. package/src/services/task-database.service.ts +470 -0
  129. package/src/test-schemas.ts +161 -0
  130. package/src/tools/index.ts +69 -0
  131. package/src/tools/task-add-message.ts +64 -0
  132. package/src/tools/task-complete-task-item.ts +86 -0
  133. package/src/tools/task-create-milestone.ts +67 -0
  134. package/src/tools/task-create-task-item.ts +91 -0
  135. package/src/tools/task-get-next-step.spec.ts +136 -0
  136. package/src/tools/task-get-next-step.ts +125 -0
  137. package/src/tools/task-get-status.spec.ts +213 -0
  138. package/src/tools/task-get-status.ts +77 -0
  139. package/src/tools/task-report-completion.ts +86 -0
  140. package/src/tools/task-update-progress.ts +49 -0
  141. package/src/tools/tools.spec.ts +194 -0
  142. package/tsconfig.json +31 -0
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Firestore Collection Path Helpers
3
+ *
4
+ * Helper functions to generate consistent Firestore collection paths
5
+ * for user-scoped data access.
6
+ */
7
+
8
+ /**
9
+ * Get the tasks collection path for a specific user
10
+ *
11
+ * @param userId - The user's ID
12
+ * @returns Firestore collection path: users/{userId}/tasks
13
+ *
14
+ * @example
15
+ * const tasksPath = getUserTasks('user123')
16
+ * // Returns: 'users/user123/tasks'
17
+ */
18
+ export function getUserTasks(userId: string): string {
19
+ if (!userId) {
20
+ throw new Error('userId is required')
21
+ }
22
+ return `users/${userId}/tasks`
23
+ }
24
+
25
+ /**
26
+ * Get a specific task document path for a user
27
+ *
28
+ * @param userId - The user's ID
29
+ * @param taskId - The task's ID
30
+ * @returns Firestore document path: users/{userId}/tasks/{taskId}
31
+ *
32
+ * @example
33
+ * const taskPath = getUserTask('user123', 'task456')
34
+ * // Returns: 'users/user123/tasks/task456'
35
+ */
36
+ export function getUserTask(userId: string, taskId: string): string {
37
+ if (!userId) {
38
+ throw new Error('userId is required')
39
+ }
40
+ if (!taskId) {
41
+ throw new Error('taskId is required')
42
+ }
43
+ return `${getUserTasks(userId)}/${taskId}`
44
+ }
45
+
46
+ /**
47
+ * Get the messages subcollection path for a specific task
48
+ *
49
+ * @param userId - The user's ID
50
+ * @param taskId - The task's ID
51
+ * @returns Firestore collection path: users/{userId}/tasks/{taskId}/messages
52
+ *
53
+ * @example
54
+ * const messagesPath = getUserTaskMessages('user123', 'task456')
55
+ * // Returns: 'users/user123/tasks/task456/messages'
56
+ */
57
+ export function getUserTaskMessages(userId: string, taskId: string): string {
58
+ if (!userId) {
59
+ throw new Error('userId is required')
60
+ }
61
+ if (!taskId) {
62
+ throw new Error('taskId is required')
63
+ }
64
+ return `${getUserTask(userId, taskId)}/messages`
65
+ }
66
+
67
+ /**
68
+ * Get a specific task message document path
69
+ *
70
+ * @param userId - The user's ID
71
+ * @param taskId - The task's ID
72
+ * @param messageId - The message's ID
73
+ * @returns Firestore document path: users/{userId}/tasks/{taskId}/messages/{messageId}
74
+ *
75
+ * @example
76
+ * const messagePath = getUserTaskMessage('user123', 'task456', 'msg789')
77
+ * // Returns: 'users/user123/tasks/task456/messages/msg789'
78
+ */
79
+ export function getUserTaskMessage(userId: string, taskId: string, messageId: string): string {
80
+ if (!userId) {
81
+ throw new Error('userId is required')
82
+ }
83
+ if (!taskId) {
84
+ throw new Error('taskId is required')
85
+ }
86
+ if (!messageId) {
87
+ throw new Error('messageId is required')
88
+ }
89
+ return `${getUserTaskMessages(userId, taskId)}/${messageId}`
90
+ }
91
+
92
+ /**
93
+ * Get the task events collection path for a specific user
94
+ *
95
+ * @param userId - The user's ID
96
+ * @returns Firestore collection path: users/{userId}/task_events
97
+ *
98
+ * @example
99
+ * const eventsPath = getUserTaskEvents('user123')
100
+ * // Returns: 'users/user123/task_events'
101
+ */
102
+ export function getUserTaskEvents(userId: string): string {
103
+ if (!userId) {
104
+ throw new Error('userId is required')
105
+ }
106
+ return `users/${userId}/task_events`
107
+ }
108
+
109
+ /**
110
+ * Get a specific task event document path
111
+ *
112
+ * @param userId - The user's ID
113
+ * @param eventId - The event's ID
114
+ * @returns Firestore document path: users/{userId}/task_events/{eventId}
115
+ *
116
+ * @example
117
+ * const eventPath = getUserTaskEvent('user123', 'event789')
118
+ * // Returns: 'users/user123/task_events/event789'
119
+ */
120
+ export function getUserTaskEvent(userId: string, eventId: string): string {
121
+ if (!userId) {
122
+ throw new Error('userId is required')
123
+ }
124
+ if (!eventId) {
125
+ throw new Error('eventId is required')
126
+ }
127
+ return `${getUserTaskEvents(userId)}/${eventId}`
128
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * DTO Module Exports
3
+ *
4
+ * Exports all API Response DTOs and transformation functions.
5
+ * Use these types and functions when building REST API endpoints.
6
+ */
7
+
8
+ // Export all DTO types
9
+ export type {
10
+ // Status enums
11
+ TaskStatus,
12
+ MilestoneStatus,
13
+ TaskItemStatus,
14
+ MessageRole,
15
+
16
+ // Response DTOs
17
+ TaskItemApiResponse,
18
+ MilestoneApiResponse,
19
+ TaskProgressApiResponse,
20
+ TaskConfigApiResponse,
21
+ TaskMetadataApiResponse,
22
+ TaskApiResponse,
23
+ TaskListApiResponse,
24
+ TaskMessageApiResponse,
25
+ TaskMessageListApiResponse,
26
+
27
+ // Input DTOs
28
+ CreateTaskDto,
29
+ UpdateTaskDto,
30
+ CreateMessageDto,
31
+ UpdateProgressDto,
32
+ CreateMilestoneDto,
33
+ CreateTaskItemDto
34
+ } from './task-api.dto.js'
35
+
36
+ // Export all transformer functions
37
+ export {
38
+ toTaskItemApiResponse,
39
+ toMilestoneApiResponse,
40
+ toTaskProgressApiResponse,
41
+ toTaskConfigApiResponse,
42
+ toTaskMetadataApiResponse,
43
+ toTaskApiResponse,
44
+ toTaskMessageApiResponse,
45
+ toTaskListApiResponse,
46
+ toTaskMessageListApiResponse
47
+ } from './transformers.js'
@@ -0,0 +1,219 @@
1
+ /**
2
+ * API Response DTOs
3
+ *
4
+ * These DTOs define the structure of REST API responses.
5
+ * They exclude internal fields and match agentbase.me expectations.
6
+ *
7
+ * Based on design document: agent/design/api-dto-design.md
8
+ */
9
+
10
+ // ============================================================================
11
+ // Status Enums
12
+ // ============================================================================
13
+
14
+ export type TaskStatus = 'not_started' | 'in_progress' | 'paused' | 'completed' | 'failed'
15
+ export type MilestoneStatus = 'not_started' | 'in_progress' | 'completed'
16
+ export type TaskItemStatus = 'not_started' | 'in_progress' | 'completed'
17
+ export type MessageRole = 'user' | 'assistant' | 'system'
18
+
19
+ // ============================================================================
20
+ // Nested DTOs
21
+ // ============================================================================
22
+
23
+ /**
24
+ * Task Item API Response
25
+ * Represents a granular work item within a milestone
26
+ */
27
+ export interface TaskItemApiResponse {
28
+ id: string
29
+ name: string
30
+ description: string
31
+ status: TaskItemStatus
32
+ estimated_hours?: number
33
+ completed_at?: string // ISO 8601 timestamp
34
+ notes?: string
35
+ }
36
+
37
+ /**
38
+ * Milestone API Response
39
+ * Represents a major phase in task execution
40
+ */
41
+ export interface MilestoneApiResponse {
42
+ id: string
43
+ name: string
44
+ description: string
45
+ status: MilestoneStatus
46
+ progress: number // 0-100
47
+ tasks_completed: number
48
+ tasks_total: number
49
+ started_at?: string // ISO 8601 timestamp
50
+ completed_at?: string // ISO 8601 timestamp
51
+ }
52
+
53
+ /**
54
+ * Task Progress API Response
55
+ * Tracks overall progress and milestone/task completion
56
+ */
57
+ export interface TaskProgressApiResponse {
58
+ current_milestone: string
59
+ current_task: string
60
+ overall_percentage: number // 0-100
61
+ milestones: MilestoneApiResponse[]
62
+ tasks: Record<string, TaskItemApiResponse[]> // Keyed by milestone ID
63
+ }
64
+
65
+ /**
66
+ * Task Configuration API Response
67
+ * Configuration for task execution behavior
68
+ * Note: Model is configured globally by the tenant platform, not per-task
69
+ */
70
+ export interface TaskConfigApiResponse {
71
+ system_prompt: string
72
+ auto_approve: boolean
73
+ max_iterations?: number
74
+ }
75
+
76
+ /**
77
+ * Task Metadata API Response
78
+ * Optional metadata for task organization and tracking
79
+ */
80
+ export interface TaskMetadataApiResponse {
81
+ conversation_id?: string
82
+ parent_task_id?: string
83
+ tags?: string[]
84
+ }
85
+
86
+ // ============================================================================
87
+ // Main Task DTO
88
+ // ============================================================================
89
+
90
+ /**
91
+ * Task API Response
92
+ * Complete task representation for REST API responses
93
+ *
94
+ * Note: execution field is EXCLUDED from API responses
95
+ * Internal fields (api_messages, tool_results) are not exposed
96
+ */
97
+ export interface TaskApiResponse {
98
+ id: string
99
+ user_id: string
100
+ title: string
101
+ description: string
102
+ status: TaskStatus
103
+ created_at: string // ISO 8601 timestamp
104
+ updated_at: string // ISO 8601 timestamp
105
+ started_at?: string // ISO 8601 timestamp
106
+ completed_at?: string // ISO 8601 timestamp
107
+
108
+ progress: TaskProgressApiResponse
109
+ config: TaskConfigApiResponse
110
+ metadata?: TaskMetadataApiResponse
111
+
112
+ // Note: execution field is EXCLUDED from API responses
113
+ // Internal fields (api_messages, tool_results) are not exposed
114
+ }
115
+
116
+ // ============================================================================
117
+ // List Response DTO
118
+ // ============================================================================
119
+
120
+ /**
121
+ * Task List API Response
122
+ * Response for listing multiple tasks
123
+ */
124
+ export interface TaskListApiResponse {
125
+ tasks: TaskApiResponse[]
126
+ total: number
127
+ }
128
+
129
+ // ============================================================================
130
+ // Message DTOs
131
+ // ============================================================================
132
+
133
+ /**
134
+ * Task Message API Response
135
+ * Represents a message in the task conversation thread
136
+ */
137
+ export interface TaskMessageApiResponse {
138
+ id: string
139
+ task_id: string
140
+ role: MessageRole
141
+ content: string
142
+ timestamp: string // ISO 8601 timestamp
143
+ metadata?: any
144
+ }
145
+
146
+ /**
147
+ * Task Message List API Response
148
+ * Response for listing task messages
149
+ */
150
+ export interface TaskMessageListApiResponse {
151
+ messages: TaskMessageApiResponse[]
152
+ total: number
153
+ }
154
+
155
+ // ============================================================================
156
+ // Input DTOs (for write operations)
157
+ // ============================================================================
158
+
159
+ /**
160
+ * Create Task Input DTO
161
+ * Request body for creating a new task
162
+ */
163
+ export interface CreateTaskDto {
164
+ title: string
165
+ description: string
166
+ config?: Partial<TaskConfigApiResponse>
167
+ metadata?: TaskMetadataApiResponse
168
+ }
169
+
170
+ /**
171
+ * Update Task Input DTO
172
+ * Request body for updating a task
173
+ */
174
+ export interface UpdateTaskDto {
175
+ title?: string
176
+ description?: string
177
+ status?: TaskStatus
178
+ config?: Partial<TaskConfigApiResponse>
179
+ metadata?: TaskMetadataApiResponse
180
+ }
181
+
182
+ /**
183
+ * Create Message Input DTO
184
+ * Request body for adding a message to a task
185
+ */
186
+ export interface CreateMessageDto {
187
+ role: MessageRole
188
+ content: string
189
+ metadata?: any
190
+ }
191
+
192
+ /**
193
+ * Update Progress Input DTO
194
+ * Request body for updating task progress
195
+ */
196
+ export interface UpdateProgressDto {
197
+ percentage: number // 0-100
198
+ }
199
+
200
+ /**
201
+ * Create Milestone Input DTO
202
+ * Request body for creating a milestone
203
+ */
204
+ export interface CreateMilestoneDto {
205
+ milestone_id: string
206
+ name: string
207
+ description: string
208
+ }
209
+
210
+ /**
211
+ * Create Task Item Input DTO
212
+ * Request body for creating a task item
213
+ */
214
+ export interface CreateTaskItemDto {
215
+ task_item_id: string
216
+ name: string
217
+ description: string
218
+ estimated_hours?: number
219
+ }