@cleocode/contracts 2.0.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 (191) hide show
  1. package/dist/adapter.d.ts +36 -0
  2. package/dist/adapter.d.ts.map +1 -0
  3. package/dist/adapter.js +8 -0
  4. package/dist/adapter.js.map +1 -0
  5. package/dist/archive.d.ts +100 -0
  6. package/dist/archive.d.ts.map +1 -0
  7. package/dist/archive.js +7 -0
  8. package/dist/archive.js.map +1 -0
  9. package/dist/brain.d.ts +36 -0
  10. package/dist/brain.d.ts.map +1 -0
  11. package/dist/brain.js +10 -0
  12. package/dist/brain.js.map +1 -0
  13. package/dist/capabilities.d.ts +21 -0
  14. package/dist/capabilities.d.ts.map +1 -0
  15. package/dist/capabilities.js +7 -0
  16. package/dist/capabilities.js.map +1 -0
  17. package/dist/config.d.ts +118 -0
  18. package/dist/config.d.ts.map +1 -0
  19. package/dist/config.js +12 -0
  20. package/dist/config.js.map +1 -0
  21. package/dist/context-monitor.d.ts +16 -0
  22. package/dist/context-monitor.d.ts.map +1 -0
  23. package/dist/context-monitor.js +7 -0
  24. package/dist/context-monitor.js.map +1 -0
  25. package/dist/data-accessor.d.ts +167 -0
  26. package/dist/data-accessor.d.ts.map +1 -0
  27. package/dist/data-accessor.js +18 -0
  28. package/dist/data-accessor.js.map +1 -0
  29. package/dist/discovery.d.ts +29 -0
  30. package/dist/discovery.d.ts.map +1 -0
  31. package/dist/discovery.js +7 -0
  32. package/dist/discovery.js.map +1 -0
  33. package/dist/exit-codes.d.ts +109 -0
  34. package/dist/exit-codes.d.ts.map +1 -0
  35. package/dist/exit-codes.js +158 -0
  36. package/dist/exit-codes.js.map +1 -0
  37. package/dist/hooks.d.ts +17 -0
  38. package/dist/hooks.d.ts.map +1 -0
  39. package/dist/hooks.js +8 -0
  40. package/dist/hooks.js.map +1 -0
  41. package/dist/index.d.ts +39 -0
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +24 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/install.d.ts +26 -0
  46. package/dist/install.d.ts.map +1 -0
  47. package/dist/install.js +8 -0
  48. package/dist/install.js.map +1 -0
  49. package/dist/lafs.d.ts +132 -0
  50. package/dist/lafs.d.ts.map +1 -0
  51. package/dist/lafs.js +26 -0
  52. package/dist/lafs.js.map +1 -0
  53. package/dist/memory.d.ts +51 -0
  54. package/dist/memory.d.ts.map +1 -0
  55. package/dist/memory.js +8 -0
  56. package/dist/memory.js.map +1 -0
  57. package/dist/operations/index.d.ts +17 -0
  58. package/dist/operations/index.d.ts.map +1 -0
  59. package/dist/operations/index.js +17 -0
  60. package/dist/operations/index.js.map +1 -0
  61. package/dist/operations/issues.d.ts +75 -0
  62. package/dist/operations/issues.d.ts.map +1 -0
  63. package/dist/operations/issues.js +10 -0
  64. package/dist/operations/issues.js.map +1 -0
  65. package/dist/operations/lifecycle.d.ts +141 -0
  66. package/dist/operations/lifecycle.d.ts.map +1 -0
  67. package/dist/operations/lifecycle.js +8 -0
  68. package/dist/operations/lifecycle.js.map +1 -0
  69. package/dist/operations/orchestrate.d.ts +202 -0
  70. package/dist/operations/orchestrate.d.ts.map +1 -0
  71. package/dist/operations/orchestrate.js +8 -0
  72. package/dist/operations/orchestrate.js.map +1 -0
  73. package/dist/operations/release.d.ts +97 -0
  74. package/dist/operations/release.d.ts.map +1 -0
  75. package/dist/operations/release.js +7 -0
  76. package/dist/operations/release.js.map +1 -0
  77. package/dist/operations/research.d.ts +126 -0
  78. package/dist/operations/research.d.ts.map +1 -0
  79. package/dist/operations/research.js +11 -0
  80. package/dist/operations/research.js.map +1 -0
  81. package/dist/operations/session.d.ts +99 -0
  82. package/dist/operations/session.d.ts.map +1 -0
  83. package/dist/operations/session.js +12 -0
  84. package/dist/operations/session.js.map +1 -0
  85. package/dist/operations/skills.d.ts +182 -0
  86. package/dist/operations/skills.d.ts.map +1 -0
  87. package/dist/operations/skills.js +10 -0
  88. package/dist/operations/skills.js.map +1 -0
  89. package/dist/operations/system.d.ts +147 -0
  90. package/dist/operations/system.d.ts.map +1 -0
  91. package/dist/operations/system.js +8 -0
  92. package/dist/operations/system.js.map +1 -0
  93. package/dist/operations/tasks.d.ts +231 -0
  94. package/dist/operations/tasks.d.ts.map +1 -0
  95. package/dist/operations/tasks.js +13 -0
  96. package/dist/operations/tasks.js.map +1 -0
  97. package/dist/operations/validate.d.ts +170 -0
  98. package/dist/operations/validate.d.ts.map +1 -0
  99. package/dist/operations/validate.js +8 -0
  100. package/dist/operations/validate.js.map +1 -0
  101. package/dist/provider-paths.d.ts +16 -0
  102. package/dist/provider-paths.d.ts.map +1 -0
  103. package/dist/provider-paths.js +7 -0
  104. package/dist/provider-paths.js.map +1 -0
  105. package/dist/results.d.ts +188 -0
  106. package/dist/results.d.ts.map +1 -0
  107. package/dist/results.js +10 -0
  108. package/dist/results.js.map +1 -0
  109. package/dist/session.d.ts +106 -0
  110. package/dist/session.d.ts.map +1 -0
  111. package/dist/session.js +77 -0
  112. package/dist/session.js.map +1 -0
  113. package/dist/spawn-types.d.ts +119 -0
  114. package/dist/spawn-types.d.ts.map +1 -0
  115. package/dist/spawn-types.js +12 -0
  116. package/dist/spawn-types.js.map +1 -0
  117. package/dist/spawn.d.ts +30 -0
  118. package/dist/spawn.d.ts.map +1 -0
  119. package/dist/spawn.js +7 -0
  120. package/dist/spawn.js.map +1 -0
  121. package/dist/status-registry.d.ts +50 -0
  122. package/dist/status-registry.d.ts.map +1 -0
  123. package/dist/status-registry.js +125 -0
  124. package/dist/status-registry.js.map +1 -0
  125. package/dist/task-record.d.ts +67 -0
  126. package/dist/task-record.d.ts.map +1 -0
  127. package/dist/task-record.js +11 -0
  128. package/dist/task-record.js.map +1 -0
  129. package/dist/task-sync.d.ts +143 -0
  130. package/dist/task-sync.d.ts.map +1 -0
  131. package/dist/task-sync.js +11 -0
  132. package/dist/task-sync.js.map +1 -0
  133. package/dist/task.d.ts +294 -0
  134. package/dist/task.d.ts.map +1 -0
  135. package/dist/task.js +24 -0
  136. package/dist/task.js.map +1 -0
  137. package/dist/tessera.d.ts +32 -0
  138. package/dist/tessera.d.ts.map +1 -0
  139. package/dist/tessera.js +11 -0
  140. package/dist/tessera.js.map +1 -0
  141. package/dist/todowrite.d.ts +53 -0
  142. package/dist/todowrite.d.ts.map +1 -0
  143. package/dist/todowrite.js +7 -0
  144. package/dist/todowrite.js.map +1 -0
  145. package/dist/transport.d.ts +12 -0
  146. package/dist/transport.d.ts.map +1 -0
  147. package/dist/transport.js +7 -0
  148. package/dist/transport.js.map +1 -0
  149. package/dist/warp-chain.d.ts +121 -0
  150. package/dist/warp-chain.d.ts.map +1 -0
  151. package/dist/warp-chain.js +13 -0
  152. package/dist/warp-chain.js.map +1 -0
  153. package/package.json +29 -0
  154. package/src/adapter.ts +38 -0
  155. package/src/archive.ts +121 -0
  156. package/src/brain.ts +39 -0
  157. package/src/capabilities.ts +21 -0
  158. package/src/config.ts +135 -0
  159. package/src/context-monitor.ts +16 -0
  160. package/src/data-accessor.ts +239 -0
  161. package/src/discovery.ts +31 -0
  162. package/src/exit-codes.ts +175 -0
  163. package/src/hooks.ts +17 -0
  164. package/src/index.ts +298 -0
  165. package/src/install.ts +28 -0
  166. package/src/lafs.ts +194 -0
  167. package/src/memory.ts +57 -0
  168. package/src/operations/index.ts +17 -0
  169. package/src/operations/issues.ts +86 -0
  170. package/src/operations/lifecycle.ts +176 -0
  171. package/src/operations/orchestrate.ts +199 -0
  172. package/src/operations/release.ts +114 -0
  173. package/src/operations/research.ts +156 -0
  174. package/src/operations/session.ts +119 -0
  175. package/src/operations/skills.ts +210 -0
  176. package/src/operations/system.ts +174 -0
  177. package/src/operations/tasks.ts +279 -0
  178. package/src/operations/validate.ts +199 -0
  179. package/src/provider-paths.ts +16 -0
  180. package/src/results.ts +207 -0
  181. package/src/session.ts +157 -0
  182. package/src/spawn-types.ts +140 -0
  183. package/src/spawn.ts +32 -0
  184. package/src/status-registry.ts +166 -0
  185. package/src/task-record.ts +71 -0
  186. package/src/task-sync.ts +167 -0
  187. package/src/task.ts +387 -0
  188. package/src/tessera.ts +35 -0
  189. package/src/todowrite.ts +58 -0
  190. package/src/transport.ts +12 -0
  191. package/src/warp-chain.ts +174 -0
@@ -0,0 +1,279 @@
1
+ /**
2
+ * Tasks Domain Operations (22 operations)
3
+ *
4
+ * Query operations: 10
5
+ * Mutate operations: 12
6
+ *
7
+ * SYNC: Canonical type definitions live in the CLI package at:
8
+ * src/types/task.ts (TaskStatus, TaskPriority, Task, etc.)
9
+ * These MCP operation types are the API contract (wire format).
10
+ * Internal domain types must stay aligned with CLI definitions.
11
+ */
12
+
13
+ /**
14
+ * Common task types (API contract — matches CLI src/types/task.ts)
15
+ */
16
+ import type { TaskStatus } from '../status-registry.js';
17
+ export type { TaskStatus };
18
+ export type TaskPriority = 'low' | 'medium' | 'high' | 'critical';
19
+
20
+ export interface TaskOp {
21
+ id: string;
22
+ title: string;
23
+ description: string;
24
+ status: TaskStatus;
25
+ priority?: TaskPriority;
26
+ parent?: string;
27
+ depends?: string[];
28
+ labels?: string[];
29
+ created: string;
30
+ updated: string;
31
+ completed?: string;
32
+ notes?: string[];
33
+ }
34
+
35
+ export interface MinimalTask {
36
+ id: string;
37
+ title: string;
38
+ status: TaskStatus;
39
+ parent?: string;
40
+ }
41
+
42
+ /**
43
+ * Query Operations
44
+ */
45
+
46
+ // tasks.get
47
+ export interface TasksGetParams {
48
+ taskId: string;
49
+ }
50
+ export type TasksGetResult = TaskOp;
51
+
52
+ // tasks.list
53
+ export interface TasksListParams {
54
+ parent?: string;
55
+ status?: TaskStatus;
56
+ priority?: TaskPriority;
57
+ type?: string;
58
+ phase?: string;
59
+ label?: string;
60
+ children?: boolean;
61
+ limit?: number;
62
+ offset?: number;
63
+ compact?: boolean;
64
+ }
65
+ export interface TasksListResult {
66
+ tasks: TaskOp[];
67
+ total: number;
68
+ filtered: number;
69
+ }
70
+
71
+ // tasks.find
72
+ export interface TasksFindParams {
73
+ query: string;
74
+ limit?: number;
75
+ }
76
+ export type TasksFindResult = MinimalTask[];
77
+
78
+ // tasks.exists
79
+ export interface TasksExistsParams {
80
+ taskId: string;
81
+ }
82
+ export interface TasksExistsResult {
83
+ exists: boolean;
84
+ taskId: string;
85
+ }
86
+
87
+ // tasks.tree
88
+ export interface TasksTreeParams {
89
+ rootId?: string;
90
+ depth?: number;
91
+ }
92
+ export interface TaskTreeNode {
93
+ task: TaskOp;
94
+ children: TaskTreeNode[];
95
+ depth: number;
96
+ }
97
+ export type TasksTreeResult = TaskTreeNode[];
98
+
99
+ // tasks.blockers
100
+ export interface TasksBlockersParams {
101
+ taskId: string;
102
+ }
103
+ export interface Blocker {
104
+ taskId: string;
105
+ title: string;
106
+ status: TaskStatus;
107
+ blockType: 'dependency' | 'parent' | 'gate';
108
+ }
109
+ export type TasksBlockersResult = Blocker[];
110
+
111
+ // tasks.deps
112
+ export interface TasksDepsParams {
113
+ taskId: string;
114
+ direction?: 'upstream' | 'downstream' | 'both';
115
+ }
116
+ export interface TaskDependencyNode {
117
+ taskId: string;
118
+ title: string;
119
+ status: TaskStatus;
120
+ distance: number;
121
+ }
122
+ export interface TasksDepsResult {
123
+ taskId: string;
124
+ upstream: TaskDependencyNode[];
125
+ downstream: TaskDependencyNode[];
126
+ }
127
+
128
+ // tasks.analyze
129
+ export interface TasksAnalyzeParams {
130
+ epicId?: string;
131
+ }
132
+ export interface TriageRecommendation {
133
+ taskId: string;
134
+ title: string;
135
+ priority: number;
136
+ reason: string;
137
+ readiness: 'ready' | 'blocked' | 'pending';
138
+ }
139
+ export type TasksAnalyzeResult = TriageRecommendation[];
140
+
141
+ // tasks.next
142
+ export interface TasksNextParams {
143
+ epicId?: string;
144
+ count?: number;
145
+ }
146
+ export interface SuggestedTask {
147
+ taskId: string;
148
+ title: string;
149
+ score: number;
150
+ rationale: string;
151
+ }
152
+ export type TasksNextResult = SuggestedTask[];
153
+
154
+ /**
155
+ * Mutate Operations
156
+ */
157
+
158
+ // tasks.create
159
+ export interface TasksCreateParams {
160
+ title: string;
161
+ description: string;
162
+ parent?: string;
163
+ depends?: string[];
164
+ priority?: TaskPriority;
165
+ labels?: string[];
166
+ }
167
+ export type TasksCreateResult = TaskOp;
168
+
169
+ // tasks.update
170
+ export interface TasksUpdateParams {
171
+ taskId: string;
172
+ title?: string;
173
+ description?: string;
174
+ status?: TaskStatus;
175
+ priority?: TaskPriority;
176
+ notes?: string;
177
+ parent?: string | null; // Set parent ID, or null/"" to promote to root
178
+ labels?: string[];
179
+ addLabels?: string[];
180
+ removeLabels?: string[];
181
+ depends?: string[];
182
+ addDepends?: string[];
183
+ removeDepends?: string[];
184
+ type?: string;
185
+ size?: string;
186
+ }
187
+ export type TasksUpdateResult = TaskOp;
188
+
189
+ // tasks.complete
190
+ export interface TasksCompleteParams {
191
+ taskId: string;
192
+ notes?: string;
193
+ archive?: boolean;
194
+ }
195
+ export interface TasksCompleteResult {
196
+ taskId: string;
197
+ completed: string;
198
+ archived: boolean;
199
+ }
200
+
201
+ // tasks.delete
202
+ export interface TasksDeleteParams {
203
+ taskId: string;
204
+ force?: boolean;
205
+ }
206
+ export interface TasksDeleteResult {
207
+ taskId: string;
208
+ deleted: true;
209
+ }
210
+
211
+ // tasks.archive
212
+ export interface TasksArchiveParams {
213
+ taskId?: string;
214
+ before?: string;
215
+ }
216
+ export interface TasksArchiveResult {
217
+ archived: number;
218
+ taskIds: string[];
219
+ }
220
+
221
+ // tasks.unarchive
222
+ export interface TasksUnarchiveParams {
223
+ taskId: string;
224
+ }
225
+ export type TasksUnarchiveResult = TaskOp;
226
+
227
+ // tasks.reparent
228
+ export interface TasksReparentParams {
229
+ taskId: string;
230
+ newParent: string;
231
+ }
232
+ export type TasksReparentResult = TaskOp;
233
+
234
+ // tasks.promote
235
+ export interface TasksPromoteParams {
236
+ taskId: string;
237
+ }
238
+ export type TasksPromoteResult = TaskOp;
239
+
240
+ // tasks.reorder
241
+ export interface TasksReorderParams {
242
+ taskId: string;
243
+ position: number;
244
+ }
245
+ export interface TasksReorderResult {
246
+ taskId: string;
247
+ newPosition: number;
248
+ }
249
+
250
+ // tasks.restore (completed tasks) — alias: reopen
251
+ export interface TasksReopenParams {
252
+ taskId: string;
253
+ }
254
+ export type TasksReopenResult = TaskOp;
255
+
256
+ // tasks.start (begin working on a task)
257
+ export interface TasksStartParams {
258
+ taskId: string;
259
+ }
260
+ export interface TasksStartResult {
261
+ taskId: string;
262
+ sessionId: string;
263
+ timestamp: string;
264
+ }
265
+
266
+ // tasks.stop (stop working on current task)
267
+ export type TasksStopParams = Record<string, never>;
268
+ export interface TasksStopResult {
269
+ stopped: true;
270
+ previousTask?: string;
271
+ }
272
+
273
+ // tasks.current (get currently active task)
274
+ export type TasksCurrentParams = Record<string, never>;
275
+ export interface TasksCurrentResult {
276
+ taskId: string | null;
277
+ since?: string;
278
+ sessionId?: string;
279
+ }
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Validate Domain Operations (11 operations)
3
+ *
4
+ * Query operations: 9
5
+ * Mutate operations: 2
6
+ */
7
+
8
+ /**
9
+ * Common validation types
10
+ */
11
+ export type ValidationSeverity = 'error' | 'warning' | 'info';
12
+
13
+ export interface ValidationViolation {
14
+ rule: string;
15
+ severity: ValidationSeverity;
16
+ message: string;
17
+ field?: string;
18
+ value?: unknown;
19
+ expected?: unknown;
20
+ line?: number;
21
+ }
22
+
23
+ export interface ComplianceMetrics {
24
+ total: number;
25
+ passed: number;
26
+ failed: number;
27
+ score: number;
28
+ byProtocol: Record<string, { passed: number; failed: number }>;
29
+ bySeverity: Record<ValidationSeverity, number>;
30
+ }
31
+
32
+ /**
33
+ * Query Operations
34
+ */
35
+
36
+ // validate.schema
37
+ export interface ValidateSchemaParams {
38
+ fileType: 'todo' | 'config' | 'archive' | 'log' | 'manifest';
39
+ filePath?: string;
40
+ }
41
+ export interface ValidateSchemaResult {
42
+ valid: boolean;
43
+ schemaVersion: string;
44
+ violations: ValidationViolation[];
45
+ }
46
+
47
+ // validate.protocol
48
+ export interface ValidateProtocolParams {
49
+ taskId: string;
50
+ protocolType:
51
+ | 'research'
52
+ | 'consensus'
53
+ | 'specification'
54
+ | 'decomposition'
55
+ | 'implementation'
56
+ | 'contribution'
57
+ | 'release';
58
+ }
59
+ export interface ValidateProtocolResult {
60
+ taskId: string;
61
+ protocol: string;
62
+ passed: boolean;
63
+ score: number;
64
+ violations: ValidationViolation[];
65
+ requirements: {
66
+ total: number;
67
+ met: number;
68
+ failed: number;
69
+ };
70
+ }
71
+
72
+ // validate.task
73
+ export interface ValidateTaskParams {
74
+ taskId: string;
75
+ checkMode: 'basic' | 'strict' | 'anti-hallucination';
76
+ }
77
+ export interface ValidateTaskResult {
78
+ taskId: string;
79
+ valid: boolean;
80
+ violations: ValidationViolation[];
81
+ checks: {
82
+ idUniqueness: boolean;
83
+ titleDescriptionDifferent: boolean;
84
+ validStatus: boolean;
85
+ noFutureTimestamps: boolean;
86
+ noDuplicateDescription: boolean;
87
+ };
88
+ }
89
+
90
+ // validate.manifest
91
+ export interface ValidateManifestParams {
92
+ entry?: string;
93
+ taskId?: string;
94
+ }
95
+ export interface ValidateManifestResult {
96
+ valid: boolean;
97
+ entry: {
98
+ id: string;
99
+ file: string;
100
+ exists: boolean;
101
+ };
102
+ violations: ValidationViolation[];
103
+ }
104
+
105
+ // validate.output
106
+ export interface ValidateOutputParams {
107
+ taskId: string;
108
+ filePath: string;
109
+ }
110
+ export interface ValidateOutputResult {
111
+ taskId: string;
112
+ filePath: string;
113
+ valid: boolean;
114
+ checks: {
115
+ fileExists: boolean;
116
+ hasTaskHeader: boolean;
117
+ hasStatus: boolean;
118
+ hasSummary: boolean;
119
+ linkedToTask: boolean;
120
+ };
121
+ violations: ValidationViolation[];
122
+ }
123
+
124
+ // validate.compliance.summary
125
+ export interface ValidateComplianceSummaryParams {
126
+ scope?: string;
127
+ since?: string;
128
+ }
129
+ export type ValidateComplianceSummaryResult = ComplianceMetrics;
130
+
131
+ // validate.compliance.violations
132
+ export interface ValidateComplianceViolationsParams {
133
+ severity?: ValidationSeverity;
134
+ protocol?: string;
135
+ }
136
+ export interface ValidateComplianceViolationsResult {
137
+ violations: Array<
138
+ ValidationViolation & {
139
+ taskId: string;
140
+ protocol: string;
141
+ timestamp: string;
142
+ }
143
+ >;
144
+ total: number;
145
+ }
146
+
147
+ // validate.test.status
148
+ export interface ValidateTestStatusParams {
149
+ taskId?: string;
150
+ }
151
+ export interface ValidateTestStatusResult {
152
+ total: number;
153
+ passed: number;
154
+ failed: number;
155
+ skipped: number;
156
+ passRate: number;
157
+ byTask?: Record<string, { passed: number; failed: number }>;
158
+ }
159
+
160
+ // validate.test.coverage
161
+ export interface ValidateTestCoverageParams {
162
+ taskId?: string;
163
+ }
164
+ export interface ValidateTestCoverageResult {
165
+ lineCoverage: number;
166
+ branchCoverage: number;
167
+ functionCoverage: number;
168
+ statementCoverage: number;
169
+ threshold: number;
170
+ meetsThreshold: boolean;
171
+ }
172
+
173
+ /**
174
+ * Mutate Operations
175
+ */
176
+
177
+ // validate.compliance.record
178
+ export interface ValidateComplianceRecordParams {
179
+ taskId: string;
180
+ result: ValidateProtocolResult;
181
+ }
182
+ export interface ValidateComplianceRecordResult {
183
+ taskId: string;
184
+ recorded: string;
185
+ metrics: ComplianceMetrics;
186
+ }
187
+
188
+ // validate.test.run
189
+ export interface ValidateTestRunParams {
190
+ scope?: string;
191
+ pattern?: string;
192
+ parallel?: boolean;
193
+ }
194
+ export interface ValidateTestRunResult {
195
+ status: ValidateTestStatusResult;
196
+ coverage: ValidateTestCoverageResult;
197
+ duration: string;
198
+ output?: string;
199
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Path provider interface for CLEO provider adapters.
3
+ * Allows providers to declare their OS-specific directory locations.
4
+ * @task T5240
5
+ */
6
+
7
+ export interface AdapterPathProvider {
8
+ /** Get the provider's global config directory (e.g., ~/.claude/) */
9
+ getProviderDir(): string;
10
+ /** Get the path to the provider's settings file, or null if N/A */
11
+ getSettingsPath(): string | null;
12
+ /** Get the directory where this provider installs agents, or null if N/A */
13
+ getAgentInstallDir(): string | null;
14
+ /** Get the path to a third-party memory DB if applicable, or null */
15
+ getMemoryDbPath(): string | null;
16
+ }
package/src/results.ts ADDED
@@ -0,0 +1,207 @@
1
+ /**
2
+ * Result types for system engine queries: dashboard, stats, log, context, sequence.
3
+ *
4
+ * These replace ad-hoc Record<string, unknown> patterns in system-engine.ts.
5
+ *
6
+ * @task T4631
7
+ * @task T4783
8
+ */
9
+
10
+ import type { TaskRecord } from './task-record.js';
11
+
12
+ /** Task summary counts used in dashboard and stats views. */
13
+ export interface TaskSummary {
14
+ pending: number;
15
+ active: number;
16
+ blocked: number;
17
+ done: number;
18
+ cancelled: number;
19
+ total: number;
20
+ archived: number;
21
+ grandTotal: number;
22
+ }
23
+
24
+ /** Label frequency entry. */
25
+ export interface LabelCount {
26
+ label: string;
27
+ count: number;
28
+ }
29
+
30
+ /** Dashboard result from system.dash query. */
31
+ export interface DashboardResult {
32
+ project: string;
33
+ currentPhase: string | null;
34
+ summary: TaskSummary;
35
+ taskWork: {
36
+ currentTask: string | null;
37
+ task: TaskRecord | null;
38
+ };
39
+ activeSession: string | null;
40
+ highPriority: {
41
+ count: number;
42
+ tasks: TaskRecord[];
43
+ };
44
+ blockedTasks: {
45
+ count: number;
46
+ limit: number;
47
+ tasks: TaskRecord[];
48
+ };
49
+ recentCompletions: TaskRecord[];
50
+ topLabels: LabelCount[];
51
+ }
52
+
53
+ /** Current state counts used in stats results. */
54
+ export interface StatsCurrentState {
55
+ pending: number;
56
+ active: number;
57
+ done: number;
58
+ blocked: number;
59
+ cancelled: number;
60
+ totalActive: number;
61
+ archived: number;
62
+ grandTotal: number;
63
+ }
64
+
65
+ /** Completion metrics for a given time period. */
66
+ export interface StatsCompletionMetrics {
67
+ periodDays: number;
68
+ completedInPeriod: number;
69
+ createdInPeriod: number;
70
+ completionRate: number;
71
+ }
72
+
73
+ /** Activity metrics for a given time period. */
74
+ export interface StatsActivityMetrics {
75
+ createdInPeriod: number;
76
+ completedInPeriod: number;
77
+ archivedInPeriod: number;
78
+ }
79
+
80
+ /** All-time cumulative statistics. */
81
+ export interface StatsAllTime {
82
+ totalCreated: number;
83
+ totalCompleted: number;
84
+ totalCancelled: number;
85
+ totalArchived: number;
86
+ archivedCompleted: number;
87
+ }
88
+
89
+ /** Cycle time statistics. */
90
+ export interface StatsCycleTimes {
91
+ averageDays: number | null;
92
+ samples: number;
93
+ }
94
+
95
+ /** Stats result from system.stats query. */
96
+ export interface StatsResult {
97
+ currentState: StatsCurrentState;
98
+ byPriority: Record<string, number>;
99
+ byType: Record<string, number>;
100
+ byPhase: Record<string, number>;
101
+ completionMetrics: StatsCompletionMetrics;
102
+ activityMetrics: StatsActivityMetrics;
103
+ allTime: StatsAllTime;
104
+ cycleTimes: StatsCycleTimes;
105
+ }
106
+
107
+ /** Log query result from system.log query. */
108
+ export interface LogQueryResult {
109
+ entries: Array<{
110
+ operation: string;
111
+ taskId?: string;
112
+ timestamp: string;
113
+ [key: string]: unknown;
114
+ }>;
115
+ pagination: {
116
+ total: number;
117
+ offset: number;
118
+ limit: number;
119
+ hasMore: boolean;
120
+ };
121
+ }
122
+
123
+ /** Context monitoring data from system.context query. */
124
+ export interface ContextResult {
125
+ available: boolean;
126
+ status: string;
127
+ percentage: number;
128
+ currentTokens: number;
129
+ maxTokens: number;
130
+ timestamp: string | null;
131
+ stale: boolean;
132
+ sessions: Array<{
133
+ file: string;
134
+ sessionId: string | null;
135
+ percentage: number;
136
+ status: string;
137
+ timestamp: string;
138
+ }>;
139
+ }
140
+
141
+ /** Sequence counter data from system.sequence query. */
142
+ export interface SequenceResult {
143
+ counter: number;
144
+ lastId: string;
145
+ checksum: string;
146
+ nextId: string;
147
+ }
148
+
149
+ // ============================================================================
150
+ // Task Analysis & Dependency Result Types
151
+ // ============================================================================
152
+
153
+ /** Compact task reference used across analysis and dependency results. */
154
+ export interface TaskRef {
155
+ id: string;
156
+ title: string;
157
+ status: string;
158
+ }
159
+
160
+ /** Task reference with optional priority (used in orchestrator/HITL contexts). */
161
+ export type TaskRefPriority = Pick<TaskRef, 'id' | 'title'> & { priority?: string };
162
+
163
+ /** Task with leverage score for prioritization. */
164
+ export interface LeveragedTask {
165
+ id: string;
166
+ title: string;
167
+ leverage: number;
168
+ reason?: string;
169
+ }
170
+
171
+ /** Bottleneck task — blocks other tasks. */
172
+ export interface BottleneckTask {
173
+ id: string;
174
+ title: string;
175
+ blocksCount: number;
176
+ }
177
+
178
+ /** Task analysis result from tasks.analyze. */
179
+ export interface TaskAnalysisResult {
180
+ recommended: (LeveragedTask & { reason: string }) | null;
181
+ bottlenecks: BottleneckTask[];
182
+ tiers: {
183
+ critical: LeveragedTask[];
184
+ high: LeveragedTask[];
185
+ normal: LeveragedTask[];
186
+ };
187
+ metrics: {
188
+ totalTasks: number;
189
+ actionable: number;
190
+ blocked: number;
191
+ avgLeverage: number;
192
+ };
193
+ }
194
+
195
+ /** Single task dependency result from tasks.deps. */
196
+ export interface TaskDepsResult {
197
+ taskId: string;
198
+ dependsOn: TaskRef[];
199
+ dependedOnBy: TaskRef[];
200
+ unresolvedDeps: string[];
201
+ allDepsReady: boolean;
202
+ }
203
+
204
+ /** Completion result — unblocked tasks after completing a task. */
205
+ export interface CompleteTaskUnblocked {
206
+ unblockedTasks?: TaskRef[];
207
+ }