@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,188 @@
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
+ import type { TaskRecord } from './task-record.js';
10
+ /** Task summary counts used in dashboard and stats views. */
11
+ export interface TaskSummary {
12
+ pending: number;
13
+ active: number;
14
+ blocked: number;
15
+ done: number;
16
+ cancelled: number;
17
+ total: number;
18
+ archived: number;
19
+ grandTotal: number;
20
+ }
21
+ /** Label frequency entry. */
22
+ export interface LabelCount {
23
+ label: string;
24
+ count: number;
25
+ }
26
+ /** Dashboard result from system.dash query. */
27
+ export interface DashboardResult {
28
+ project: string;
29
+ currentPhase: string | null;
30
+ summary: TaskSummary;
31
+ taskWork: {
32
+ currentTask: string | null;
33
+ task: TaskRecord | null;
34
+ };
35
+ activeSession: string | null;
36
+ highPriority: {
37
+ count: number;
38
+ tasks: TaskRecord[];
39
+ };
40
+ blockedTasks: {
41
+ count: number;
42
+ limit: number;
43
+ tasks: TaskRecord[];
44
+ };
45
+ recentCompletions: TaskRecord[];
46
+ topLabels: LabelCount[];
47
+ }
48
+ /** Current state counts used in stats results. */
49
+ export interface StatsCurrentState {
50
+ pending: number;
51
+ active: number;
52
+ done: number;
53
+ blocked: number;
54
+ cancelled: number;
55
+ totalActive: number;
56
+ archived: number;
57
+ grandTotal: number;
58
+ }
59
+ /** Completion metrics for a given time period. */
60
+ export interface StatsCompletionMetrics {
61
+ periodDays: number;
62
+ completedInPeriod: number;
63
+ createdInPeriod: number;
64
+ completionRate: number;
65
+ }
66
+ /** Activity metrics for a given time period. */
67
+ export interface StatsActivityMetrics {
68
+ createdInPeriod: number;
69
+ completedInPeriod: number;
70
+ archivedInPeriod: number;
71
+ }
72
+ /** All-time cumulative statistics. */
73
+ export interface StatsAllTime {
74
+ totalCreated: number;
75
+ totalCompleted: number;
76
+ totalCancelled: number;
77
+ totalArchived: number;
78
+ archivedCompleted: number;
79
+ }
80
+ /** Cycle time statistics. */
81
+ export interface StatsCycleTimes {
82
+ averageDays: number | null;
83
+ samples: number;
84
+ }
85
+ /** Stats result from system.stats query. */
86
+ export interface StatsResult {
87
+ currentState: StatsCurrentState;
88
+ byPriority: Record<string, number>;
89
+ byType: Record<string, number>;
90
+ byPhase: Record<string, number>;
91
+ completionMetrics: StatsCompletionMetrics;
92
+ activityMetrics: StatsActivityMetrics;
93
+ allTime: StatsAllTime;
94
+ cycleTimes: StatsCycleTimes;
95
+ }
96
+ /** Log query result from system.log query. */
97
+ export interface LogQueryResult {
98
+ entries: Array<{
99
+ operation: string;
100
+ taskId?: string;
101
+ timestamp: string;
102
+ [key: string]: unknown;
103
+ }>;
104
+ pagination: {
105
+ total: number;
106
+ offset: number;
107
+ limit: number;
108
+ hasMore: boolean;
109
+ };
110
+ }
111
+ /** Context monitoring data from system.context query. */
112
+ export interface ContextResult {
113
+ available: boolean;
114
+ status: string;
115
+ percentage: number;
116
+ currentTokens: number;
117
+ maxTokens: number;
118
+ timestamp: string | null;
119
+ stale: boolean;
120
+ sessions: Array<{
121
+ file: string;
122
+ sessionId: string | null;
123
+ percentage: number;
124
+ status: string;
125
+ timestamp: string;
126
+ }>;
127
+ }
128
+ /** Sequence counter data from system.sequence query. */
129
+ export interface SequenceResult {
130
+ counter: number;
131
+ lastId: string;
132
+ checksum: string;
133
+ nextId: string;
134
+ }
135
+ /** Compact task reference used across analysis and dependency results. */
136
+ export interface TaskRef {
137
+ id: string;
138
+ title: string;
139
+ status: string;
140
+ }
141
+ /** Task reference with optional priority (used in orchestrator/HITL contexts). */
142
+ export type TaskRefPriority = Pick<TaskRef, 'id' | 'title'> & {
143
+ priority?: string;
144
+ };
145
+ /** Task with leverage score for prioritization. */
146
+ export interface LeveragedTask {
147
+ id: string;
148
+ title: string;
149
+ leverage: number;
150
+ reason?: string;
151
+ }
152
+ /** Bottleneck task — blocks other tasks. */
153
+ export interface BottleneckTask {
154
+ id: string;
155
+ title: string;
156
+ blocksCount: number;
157
+ }
158
+ /** Task analysis result from tasks.analyze. */
159
+ export interface TaskAnalysisResult {
160
+ recommended: (LeveragedTask & {
161
+ reason: string;
162
+ }) | null;
163
+ bottlenecks: BottleneckTask[];
164
+ tiers: {
165
+ critical: LeveragedTask[];
166
+ high: LeveragedTask[];
167
+ normal: LeveragedTask[];
168
+ };
169
+ metrics: {
170
+ totalTasks: number;
171
+ actionable: number;
172
+ blocked: number;
173
+ avgLeverage: number;
174
+ };
175
+ }
176
+ /** Single task dependency result from tasks.deps. */
177
+ export interface TaskDepsResult {
178
+ taskId: string;
179
+ dependsOn: TaskRef[];
180
+ dependedOnBy: TaskRef[];
181
+ unresolvedDeps: string[];
182
+ allDepsReady: boolean;
183
+ }
184
+ /** Completion result — unblocked tasks after completing a task. */
185
+ export interface CompleteTaskUnblocked {
186
+ unblockedTasks?: TaskRef[];
187
+ }
188
+ //# sourceMappingURL=results.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../src/results.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,6DAA6D;AAC7D,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,6BAA6B;AAC7B,MAAM,WAAW,UAAU;IACzB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,CAAC;IACzD,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,KAAK,EAAE;QACL,QAAQ,EAAE,aAAa,EAAE,CAAC;QAC1B,IAAI,EAAE,aAAa,EAAE,CAAC;QACtB,MAAM,EAAE,aAAa,EAAE,CAAC;KACzB,CAAC;IACF,OAAO,EAAE;QACP,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED,qDAAqD;AACrD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,EAAE,CAAC;IACrB,YAAY,EAAE,OAAO,EAAE,CAAC;IACxB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,mEAAmE;AACnE,MAAM,WAAW,qBAAqB;IACpC,cAAc,CAAC,EAAE,OAAO,EAAE,CAAC;CAC5B"}
@@ -0,0 +1,10 @@
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
+ export {};
10
+ //# sourceMappingURL=results.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"results.js","sourceRoot":"","sources":["../src/results.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Session type definitions for CLEO V2.
3
+ *
4
+ * Plain TypeScript interfaces derived from the Drizzle/Zod schemas
5
+ * in src/store/validation-schemas.ts. Contracts must not depend on Zod/Drizzle.
6
+ *
7
+ * @epic T4454
8
+ */
9
+ import type { SessionStatus } from './status-registry.js';
10
+ export type { SessionStatus };
11
+ /** Session scope JSON blob shape. */
12
+ export interface SessionScope {
13
+ type: string;
14
+ epicId?: string;
15
+ rootTaskId?: string;
16
+ includeDescendants?: boolean;
17
+ phaseFilter?: string | null;
18
+ labelFilter?: string[] | null;
19
+ maxDepth?: number | null;
20
+ explicitTaskIds?: string[] | null;
21
+ excludeTaskIds?: string[] | null;
22
+ computedTaskIds?: string[];
23
+ computedAt?: string;
24
+ }
25
+ /** Session statistics. */
26
+ export interface SessionStats {
27
+ tasksCompleted: number;
28
+ tasksCreated: number;
29
+ tasksUpdated: number;
30
+ focusChanges: number;
31
+ totalActiveMinutes: number;
32
+ suspendCount: number;
33
+ }
34
+ /** Active task work state within a session. */
35
+ export interface SessionTaskWork {
36
+ taskId: string | null;
37
+ setAt: string | null;
38
+ }
39
+ /** Session domain type — plain interface aligned with Drizzle sessions table. */
40
+ export interface Session {
41
+ id: string;
42
+ name: string;
43
+ status: SessionStatus;
44
+ scope: SessionScope;
45
+ taskWork: SessionTaskWork;
46
+ startedAt: string;
47
+ endedAt?: string;
48
+ agent?: string;
49
+ notes?: string[];
50
+ tasksCompleted?: string[];
51
+ tasksCreated?: string[];
52
+ handoffJson?: string | null;
53
+ previousSessionId?: string | null;
54
+ nextSessionId?: string | null;
55
+ agentIdentifier?: string | null;
56
+ handoffConsumedAt?: string | null;
57
+ handoffConsumedBy?: string | null;
58
+ debriefJson?: string | null;
59
+ stats?: SessionStats;
60
+ resumeCount?: number;
61
+ gradeMode?: boolean;
62
+ providerId?: string | null;
63
+ }
64
+ /**
65
+ * Result of a session start operation.
66
+ *
67
+ * The `sessionId` field is a convenience alias for `session.id`,
68
+ * provided for consumers that expect it at the top level of the result.
69
+ */
70
+ export interface SessionStartResult {
71
+ session: Session;
72
+ sessionId: string;
73
+ }
74
+ /**
75
+ * SessionView — typed wrapper over Session[] with collection helpers.
76
+ *
77
+ * Provides discoverable query methods for common session lookups.
78
+ * Does NOT change the DataAccessor interface — consumers create views from Session[].
79
+ */
80
+ export declare class SessionView {
81
+ private readonly _sessions;
82
+ constructor(sessions: Session[]);
83
+ /** Create a SessionView from a Session array. */
84
+ static from(sessions: Session[]): SessionView;
85
+ /** All sessions in the view (readonly). */
86
+ get all(): readonly Session[];
87
+ /** Number of sessions. */
88
+ get length(): number;
89
+ /** Find the currently active session (if any). */
90
+ findActive(): Session | undefined;
91
+ /** Find a session by ID. */
92
+ findById(id: string): Session | undefined;
93
+ /** Filter sessions by one or more statuses. */
94
+ filterByStatus(...statuses: SessionStatus[]): Session[];
95
+ /** Find sessions matching a scope type and optional rootTaskId. */
96
+ findByScope(type: string, rootTaskId?: string): Session[];
97
+ /** Sort sessions by a date field. Returns a new array (does not mutate). */
98
+ sortByDate(field: 'startedAt' | 'endedAt', descending?: boolean): Session[];
99
+ /** Get the most recently started session. */
100
+ mostRecent(): Session | undefined;
101
+ /** Convert back to a plain Session array (shallow copy). */
102
+ toArray(): Session[];
103
+ /** Support for-of iteration. */
104
+ [Symbol.iterator](): Iterator<Session>;
105
+ }
106
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,qCAAqC;AACrC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAClC,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACjC,eAAe,CAAC,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Drizzle/Zod schemas
5
+ * in src/store/validation-schemas.ts. Contracts must not depend on Zod/Drizzle.
6
+ *
7
+ * @epic T4454
8
+ */
9
+ /**
10
+ * SessionView — typed wrapper over Session[] with collection helpers.
11
+ *
12
+ * Provides discoverable query methods for common session lookups.
13
+ * Does NOT change the DataAccessor interface — consumers create views from Session[].
14
+ */
15
+ export class SessionView {
16
+ _sessions;
17
+ constructor(sessions) {
18
+ this._sessions = sessions;
19
+ }
20
+ /** Create a SessionView from a Session array. */
21
+ static from(sessions) {
22
+ return new SessionView(sessions);
23
+ }
24
+ /** All sessions in the view (readonly). */
25
+ get all() {
26
+ return this._sessions;
27
+ }
28
+ /** Number of sessions. */
29
+ get length() {
30
+ return this._sessions.length;
31
+ }
32
+ /** Find the currently active session (if any). */
33
+ findActive() {
34
+ return this._sessions.find((s) => s.status === 'active');
35
+ }
36
+ /** Find a session by ID. */
37
+ findById(id) {
38
+ return this._sessions.find((s) => s.id === id);
39
+ }
40
+ /** Filter sessions by one or more statuses. */
41
+ filterByStatus(...statuses) {
42
+ return this._sessions.filter((s) => statuses.includes(s.status));
43
+ }
44
+ /** Find sessions matching a scope type and optional rootTaskId. */
45
+ findByScope(type, rootTaskId) {
46
+ return this._sessions.filter((s) => {
47
+ if (s.scope?.type !== type)
48
+ return false;
49
+ if (rootTaskId && s.scope?.rootTaskId !== rootTaskId)
50
+ return false;
51
+ return true;
52
+ });
53
+ }
54
+ /** Sort sessions by a date field. Returns a new array (does not mutate). */
55
+ sortByDate(field, descending = true) {
56
+ return [...this._sessions].sort((a, b) => {
57
+ const aDate = new Date(a[field] || '').getTime();
58
+ const bDate = new Date(b[field] || '').getTime();
59
+ return descending ? bDate - aDate : aDate - bDate;
60
+ });
61
+ }
62
+ /** Get the most recently started session. */
63
+ mostRecent() {
64
+ if (this._sessions.length === 0)
65
+ return undefined;
66
+ return this.sortByDate('startedAt', true)[0];
67
+ }
68
+ /** Convert back to a plain Session array (shallow copy). */
69
+ toArray() {
70
+ return [...this._sessions];
71
+ }
72
+ /** Support for-of iteration. */
73
+ [Symbol.iterator]() {
74
+ return this._sessions[Symbol.iterator]();
75
+ }
76
+ }
77
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAyEH;;;;;GAKG;AACH,MAAM,OAAO,WAAW;IACL,SAAS,CAAY;IAEtC,YAAY,QAAmB;QAC7B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,iDAAiD;IACjD,MAAM,CAAC,IAAI,CAAC,QAAmB;QAC7B,OAAO,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED,2CAA2C;IAC3C,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,0BAA0B;IAC1B,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;IAC/B,CAAC;IAED,kDAAkD;IAClD,UAAU;QACR,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC;IAC3D,CAAC;IAED,4BAA4B;IAC5B,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,+CAA+C;IAC/C,cAAc,CAAC,GAAG,QAAyB;QACzC,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAE,QAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IACjF,CAAC;IAED,mEAAmE;IACnE,WAAW,CAAC,IAAY,EAAE,UAAmB;QAC3C,OAA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AC;CACF"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * CLEO Spawn Adapter Types
3
+ *
4
+ * Type definitions for the spawn adapter system that wraps/extends
5
+ * CAAMP SpawnAdapter interface. Self-contained version for contracts
6
+ * (no dependency on @cleocode/caamp).
7
+ *
8
+ * @task T5236
9
+ * @phase 1B
10
+ */
11
+ /**
12
+ * Provider identifier for spawn operations.
13
+ */
14
+ export type Provider = string;
15
+ /**
16
+ * CAAMP-compatible spawn options (inlined for zero-dep contracts).
17
+ */
18
+ export interface CAAMPSpawnOptions {
19
+ [key: string]: unknown;
20
+ }
21
+ /**
22
+ * CAAMP-compatible spawn result (inlined for zero-dep contracts).
23
+ */
24
+ export interface CAAMPSpawnResult {
25
+ instanceId: string;
26
+ output: string;
27
+ exitCode: number;
28
+ [key: string]: unknown;
29
+ }
30
+ /**
31
+ * CLEO-specific spawn context
32
+ * Extends CAAMP options with CLEO task and protocol metadata
33
+ */
34
+ export interface CLEOSpawnContext {
35
+ /** Task ID being spawned */
36
+ taskId: string;
37
+ /** Protocol to use for the spawned task */
38
+ protocol: string;
39
+ /** Fully-resolved prompt to send to subagent */
40
+ prompt: string;
41
+ /** Provider to use for spawning */
42
+ provider: Provider;
43
+ /** CAAMP-compatible spawn options */
44
+ options: CAAMPSpawnOptions;
45
+ /** Project root or working directory for provider-specific files and process execution */
46
+ workingDirectory?: string;
47
+ /** Token resolution information for the prompt */
48
+ tokenResolution?: TokenResolution;
49
+ }
50
+ /**
51
+ * CLEO spawn result
52
+ * Extends CAAMP SpawnResult with CLEO-specific timing and metadata
53
+ */
54
+ export interface CLEOSpawnResult extends CAAMPSpawnResult {
55
+ /** Task ID that was spawned */
56
+ taskId: string;
57
+ /** Provider ID used for the spawn */
58
+ providerId: string;
59
+ /** Timing information for the spawn operation */
60
+ timing: {
61
+ /** ISO timestamp when spawn started */
62
+ startTime: string;
63
+ /** ISO timestamp when spawn completed (if finished) */
64
+ endTime?: string;
65
+ /** Duration in milliseconds */
66
+ durationMs?: number;
67
+ };
68
+ /** Reference to manifest entry if output was captured */
69
+ manifestEntryId?: string;
70
+ }
71
+ /**
72
+ * Spawn adapter interface
73
+ * Wraps CAAMP SpawnAdapter with CLEO-specific context and result types
74
+ */
75
+ export interface CLEOSpawnAdapter {
76
+ /** Unique identifier for this adapter instance */
77
+ readonly id: string;
78
+ /** Provider ID this adapter uses */
79
+ readonly providerId: string;
80
+ /**
81
+ * Check if this adapter can spawn in the current environment
82
+ * @returns Promise resolving to true if spawning is possible
83
+ */
84
+ canSpawn(): Promise<boolean>;
85
+ /**
86
+ * Execute a spawn using the provider's native mechanism
87
+ * @param context - Fully-resolved spawn context
88
+ * @returns Promise resolving to spawn result
89
+ * @throws SpawnExecutionError if spawn fails
90
+ */
91
+ spawn(context: CLEOSpawnContext): Promise<CLEOSpawnResult>;
92
+ /**
93
+ * List currently running spawns
94
+ * @returns Promise resolving to array of running spawn results
95
+ */
96
+ listRunning(): Promise<CLEOSpawnResult[]>;
97
+ /**
98
+ * Terminate a running spawn
99
+ * @param instanceId - ID of the spawn instance to terminate
100
+ * @returns Promise that resolves when termination is complete
101
+ */
102
+ terminate(instanceId: string): Promise<void>;
103
+ }
104
+ /**
105
+ * Token resolution information for prompt processing
106
+ */
107
+ export interface TokenResolution {
108
+ /** Array of resolved token identifiers */
109
+ resolved: string[];
110
+ /** Array of unresolved token identifiers */
111
+ unresolved: string[];
112
+ /** Total number of tokens processed */
113
+ totalTokens: number;
114
+ }
115
+ /**
116
+ * Spawn status values
117
+ */
118
+ export type SpawnStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
119
+ //# sourceMappingURL=spawn-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawn-types.d.ts","sourceRoot":"","sources":["../src/spawn-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B;;GAEG;AACH,MAAM,WAAW,iBAAiB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AAC;IAE7B;;;;;OAKG;IACH,KAAK,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE3D;;;OAGG;IACH,WAAW,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IAE1C;;;;OAIG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,4CAA4C;IAC5C,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * CLEO Spawn Adapter Types
3
+ *
4
+ * Type definitions for the spawn adapter system that wraps/extends
5
+ * CAAMP SpawnAdapter interface. Self-contained version for contracts
6
+ * (no dependency on @cleocode/caamp).
7
+ *
8
+ * @task T5236
9
+ * @phase 1B
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=spawn-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawn-types.js","sourceRoot":"","sources":["../src/spawn-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Spawn provider interface for CLEO provider adapters.
3
+ *
4
+ * @task T5240
5
+ */
6
+ export interface AdapterSpawnProvider {
7
+ canSpawn(): Promise<boolean>;
8
+ spawn(context: SpawnContext): Promise<SpawnResult>;
9
+ listRunning(): Promise<SpawnResult[]>;
10
+ terminate(instanceId: string): Promise<void>;
11
+ }
12
+ export interface SpawnContext {
13
+ taskId: string;
14
+ prompt: string;
15
+ workingDirectory?: string;
16
+ options?: Record<string, unknown>;
17
+ }
18
+ export interface SpawnResult {
19
+ instanceId: string;
20
+ taskId: string;
21
+ providerId: string;
22
+ /** Output captured from the spawned process. Optional for detached/fire-and-forget spawns. */
23
+ output?: string;
24
+ /** Exit code of the spawned process. Optional for detached/fire-and-forget spawns. */
25
+ exitCode?: number;
26
+ status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
27
+ startTime: string;
28
+ endTime?: string;
29
+ }
30
+ //# sourceMappingURL=spawn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../src/spawn.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7B,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACnD,WAAW,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACtC,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,8FAA8F;IAC9F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sFAAsF;IACtF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
package/dist/spawn.js ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Spawn provider interface for CLEO provider adapters.
3
+ *
4
+ * @task T5240
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=spawn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawn.js","sourceRoot":"","sources":["../src/spawn.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Unified Status Registry — single source of truth for all status enums.
3
+ *
4
+ * ADR-018: All status constants and types MUST be defined here.
5
+ * No other file may define status enum arrays as constants.
6
+ *
7
+ * Dependency direction:
8
+ * status-registry.ts → schema.ts, types/task.ts, validation/engine.ts,
9
+ * mcp/lib/security.ts, dispatch/lib/security.ts, ...
10
+ */
11
+ export declare const TASK_STATUSES: readonly ["pending", "active", "blocked", "done", "cancelled", "archived"];
12
+ export declare const SESSION_STATUSES: readonly ["active", "ended", "orphaned", "suspended"];
13
+ export declare const LIFECYCLE_PIPELINE_STATUSES: readonly ["active", "completed", "blocked", "failed", "cancelled", "aborted"];
14
+ export declare const LIFECYCLE_STAGE_STATUSES: readonly ["not_started", "in_progress", "blocked", "completed", "skipped", "failed"];
15
+ export declare const ADR_STATUSES: readonly ["proposed", "accepted", "superseded", "deprecated"];
16
+ export declare const GATE_STATUSES: readonly ["pending", "passed", "failed", "waived"];
17
+ export declare const MANIFEST_STATUSES: readonly ["completed", "partial", "blocked", "archived"];
18
+ export type TaskStatus = (typeof TASK_STATUSES)[number];
19
+ export type SessionStatus = (typeof SESSION_STATUSES)[number];
20
+ export type PipelineStatus = (typeof LIFECYCLE_PIPELINE_STATUSES)[number];
21
+ export type StageStatus = (typeof LIFECYCLE_STAGE_STATUSES)[number];
22
+ export type AdrStatus = (typeof ADR_STATUSES)[number];
23
+ export type GateStatus = (typeof GATE_STATUSES)[number];
24
+ export type ManifestStatus = (typeof MANIFEST_STATUSES)[number];
25
+ export declare const TERMINAL_TASK_STATUSES: ReadonlySet<TaskStatus>;
26
+ export declare const TERMINAL_PIPELINE_STATUSES: ReadonlySet<PipelineStatus>;
27
+ export declare const TERMINAL_STAGE_STATUSES: ReadonlySet<StageStatus>;
28
+ export type EntityType = 'task' | 'session' | 'lifecycle_pipeline' | 'lifecycle_stage' | 'adr' | 'gate' | 'manifest';
29
+ export declare const STATUS_REGISTRY: Record<EntityType, readonly string[]>;
30
+ export declare function isValidStatus(entityType: EntityType, value: string): boolean;
31
+ /**
32
+ * Pipeline status → Unicode progress icon.
33
+ * Used wherever lifecycle pipeline status is rendered to a terminal.
34
+ */
35
+ export declare const PIPELINE_STATUS_ICONS: Record<PipelineStatus, string>;
36
+ /**
37
+ * Stage status → Unicode progress icon.
38
+ * Used wherever pipeline stage status is rendered to a terminal.
39
+ */
40
+ export declare const STAGE_STATUS_ICONS: Record<StageStatus, string>;
41
+ /**
42
+ * Task status → Unicode symbol (rich terminal / Unicode-enabled).
43
+ * Falls back to TASK_STATUS_SYMBOLS_ASCII when Unicode is unavailable.
44
+ */
45
+ export declare const TASK_STATUS_SYMBOLS_UNICODE: Record<TaskStatus, string>;
46
+ /**
47
+ * Task status → ASCII fallback symbol (non-Unicode terminals, CI output).
48
+ */
49
+ export declare const TASK_STATUS_SYMBOLS_ASCII: Record<TaskStatus, string>;
50
+ //# sourceMappingURL=status-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-registry.d.ts","sourceRoot":"","sources":["../src/status-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,eAAO,MAAM,aAAa,4EAOhB,CAAC;AAEX,eAAO,MAAM,gBAAgB,uDAAwD,CAAC;AAEtF,eAAO,MAAM,2BAA2B,+EAO9B,CAAC;AAEX,eAAO,MAAM,wBAAwB,sFAO3B,CAAC;AAKX,eAAO,MAAM,YAAY,+DAAgE,CAAC;AAE1F,eAAO,MAAM,aAAa,oDAAqD,CAAC;AAMhF,eAAO,MAAM,iBAAiB,0DAA2D,CAAC;AAI1F,MAAM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