@cleocode/contracts 2026.4.100 → 2026.4.102

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 (96) hide show
  1. package/dist/brain-graph.d.ts +245 -0
  2. package/dist/brain-graph.d.ts.map +1 -0
  3. package/dist/brain-graph.js +30 -0
  4. package/dist/brain-graph.js.map +1 -0
  5. package/dist/branch-lock.d.ts +225 -0
  6. package/dist/branch-lock.d.ts.map +1 -0
  7. package/dist/branch-lock.js +43 -0
  8. package/dist/branch-lock.js.map +1 -0
  9. package/dist/exit-codes.d.ts +1 -1
  10. package/dist/exit-codes.d.ts.map +1 -1
  11. package/dist/exit-codes.js +1 -1
  12. package/dist/exit-codes.js.map +1 -1
  13. package/dist/graph.d.ts +2 -0
  14. package/dist/graph.d.ts.map +1 -1
  15. package/dist/index.d.ts +11 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +2 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/nexus-contract-ops.d.ts +186 -0
  20. package/dist/nexus-contract-ops.d.ts.map +1 -0
  21. package/dist/nexus-contract-ops.js +11 -0
  22. package/dist/nexus-contract-ops.js.map +1 -0
  23. package/dist/nexus-living-brain-ops.d.ts +314 -0
  24. package/dist/nexus-living-brain-ops.d.ts.map +1 -0
  25. package/dist/nexus-living-brain-ops.js +15 -0
  26. package/dist/nexus-living-brain-ops.js.map +1 -0
  27. package/dist/nexus-query-ops.d.ts +82 -0
  28. package/dist/nexus-query-ops.d.ts.map +1 -0
  29. package/dist/nexus-query-ops.js +11 -0
  30. package/dist/nexus-query-ops.js.map +1 -0
  31. package/dist/nexus-route-ops.d.ts +103 -0
  32. package/dist/nexus-route-ops.d.ts.map +1 -0
  33. package/dist/nexus-route-ops.js +10 -0
  34. package/dist/nexus-route-ops.js.map +1 -0
  35. package/dist/nexus-tasks-bridge-ops.d.ts +68 -0
  36. package/dist/nexus-tasks-bridge-ops.d.ts.map +1 -0
  37. package/dist/nexus-tasks-bridge-ops.js +11 -0
  38. package/dist/nexus-tasks-bridge-ops.js.map +1 -0
  39. package/dist/nexus-wiki-ops.d.ts +127 -0
  40. package/dist/nexus-wiki-ops.d.ts.map +1 -0
  41. package/dist/nexus-wiki-ops.js +12 -0
  42. package/dist/nexus-wiki-ops.js.map +1 -0
  43. package/dist/operations/admin.d.ts +1781 -0
  44. package/dist/operations/admin.d.ts.map +1 -0
  45. package/dist/operations/admin.js +27 -0
  46. package/dist/operations/admin.js.map +1 -0
  47. package/dist/operations/brain.d.ts +34 -26
  48. package/dist/operations/brain.d.ts.map +1 -1
  49. package/dist/operations/brain.js +7 -6
  50. package/dist/operations/brain.js.map +1 -1
  51. package/dist/operations/docs.d.ts +279 -0
  52. package/dist/operations/docs.d.ts.map +1 -0
  53. package/dist/operations/docs.js +31 -0
  54. package/dist/operations/docs.js.map +1 -0
  55. package/dist/operations/intelligence.d.ts +319 -0
  56. package/dist/operations/intelligence.d.ts.map +1 -0
  57. package/dist/operations/intelligence.js +24 -0
  58. package/dist/operations/intelligence.js.map +1 -0
  59. package/dist/operations/orchestrate.d.ts +113 -2
  60. package/dist/operations/orchestrate.d.ts.map +1 -1
  61. package/dist/operations/orchestrate.js +3 -2
  62. package/dist/operations/orchestrate.js.map +1 -1
  63. package/dist/operations/session.d.ts +193 -47
  64. package/dist/operations/session.d.ts.map +1 -1
  65. package/dist/operations/session.js +7 -6
  66. package/dist/operations/session.js.map +1 -1
  67. package/dist/operations/sticky.d.ts +264 -0
  68. package/dist/operations/sticky.d.ts.map +1 -0
  69. package/dist/operations/sticky.js +19 -0
  70. package/dist/operations/sticky.js.map +1 -0
  71. package/dist/operations/validate.d.ts +145 -19
  72. package/dist/operations/validate.d.ts.map +1 -1
  73. package/dist/operations/validate.js +3 -3
  74. package/dist/task-record.d.ts +19 -0
  75. package/dist/task-record.d.ts.map +1 -1
  76. package/package.json +41 -1
  77. package/src/brain-graph.ts +282 -0
  78. package/src/branch-lock.ts +254 -0
  79. package/src/exit-codes.ts +1 -1
  80. package/src/graph.ts +2 -0
  81. package/src/index.ts +128 -0
  82. package/src/nexus-contract-ops.ts +244 -0
  83. package/src/nexus-living-brain-ops.ts +345 -0
  84. package/src/nexus-query-ops.ts +100 -0
  85. package/src/nexus-route-ops.ts +134 -0
  86. package/src/nexus-tasks-bridge-ops.ts +71 -0
  87. package/src/nexus-wiki-ops.ts +133 -0
  88. package/src/operations/admin.ts +2087 -0
  89. package/src/operations/brain.ts +34 -26
  90. package/src/operations/docs.ts +322 -0
  91. package/src/operations/intelligence.ts +399 -0
  92. package/src/operations/orchestrate.ts +117 -2
  93. package/src/operations/session.ts +225 -48
  94. package/src/operations/sticky.ts +308 -0
  95. package/src/operations/validate.ts +161 -55
  96. package/src/task-record.ts +19 -0
@@ -1,16 +1,24 @@
1
1
  /**
2
- * Session Domain Operations (9 operations)
2
+ * Session Domain Operations (15 operations)
3
3
  *
4
- * Query operations: 4
5
- * Mutate operations: 5
4
+ * Query operations: 8 (status, list, show, find, decision.log, context.drift, handoff.show, briefing.show)
5
+ * Mutate operations: 7 (start, end, resume, suspend, gc, record.decision, record.assumption)
6
6
  *
7
- * SYNC: Canonical type definitions live in the CLI package at:
8
- * src/types/session.ts (Session, SessionScope, etc.)
9
- * These operation types are the API contract (wire format).
7
+ * SYNC: Canonical domain types live in packages/contracts/src/session.ts.
8
+ * These operation types are the API contract (wire format) for the dispatch layer.
9
+ *
10
+ * @task T975 — typed-dispatch migration (Wave D · T962)
10
11
  */
11
12
 
13
+ import type { Session } from '../session.js';
14
+
15
+ // ---------------------------------------------------------------------------
16
+ // Common session types (simplified wire-format representation)
17
+ // ---------------------------------------------------------------------------
18
+
12
19
  /**
13
- * Common session types
20
+ * Minimal session representation for wire-format responses.
21
+ * Used in results that return simplified session data.
14
22
  */
15
23
  export interface SessionOp {
16
24
  id: string;
@@ -23,64 +31,151 @@ export interface SessionOp {
23
31
  notes?: string[];
24
32
  }
25
33
 
26
- /**
27
- * Query Operations
28
- */
34
+ // ---------------------------------------------------------------------------
35
+ // Query Operations
36
+ // ---------------------------------------------------------------------------
29
37
 
30
38
  // session.status
39
+ /** Parameters for `session.status` — no params required. */
31
40
  export type SessionStatusParams = Record<string, never>;
41
+
32
42
  /**
33
43
  * Result of `session.status`.
34
44
  *
35
45
  * @remarks
36
46
  * Re-synced to match the envelope returned by `sessionStatus` in
37
- * `packages/cleo/src/dispatch/engines/session-engine.ts`. The legacy
38
- * contract's `{current, hasStartedTask, startedTask}` shape predated the
39
- * current engine and never matched dispatch output — agents reading the
40
- * contract would never find their data.
47
+ * `packages/cleo/src/dispatch/engines/session-engine.ts`.
41
48
  *
42
49
  * @task T963 — contract↔impl drift reconciliation (T910 audit)
43
50
  */
44
51
  export interface SessionStatusResult {
45
- /** True when a session is currently active. @task T963 */
52
+ /** True when a session is currently active. */
46
53
  hasActiveSession: boolean;
47
- /**
48
- * Active session record (full shape per `Session` contract) or `null`
49
- * when none active.
50
- * @task T963
51
- */
52
- session?: SessionOp | null;
53
- /**
54
- * Current task work state from `meta.focus_state` — tracks the
55
- * task the orchestrator is focused on within the session.
56
- * @task T963
57
- */
54
+ /** Active session record or `null` when none active. */
55
+ session?: Session | null;
56
+ /** Current task work state from `meta.focus_state`. */
58
57
  taskWork?: import('../task.js').TaskWorkState | null;
59
58
  }
60
59
 
61
60
  // session.list
61
+ /** Parameters for `session.list`. */
62
62
  export interface SessionListParams {
63
63
  active?: boolean;
64
64
  status?: string;
65
65
  limit?: number;
66
66
  offset?: number;
67
67
  }
68
+ /** Result of `session.list`. */
68
69
  export interface SessionListResult {
69
- sessions: SessionOp[];
70
+ sessions: Session[];
70
71
  total: number;
71
72
  filtered: number;
72
73
  }
73
74
 
74
75
  // session.show
76
+ /** Parameters for `session.show`. */
75
77
  export interface SessionShowParams {
76
78
  sessionId: string;
79
+ /** When set to 'debrief', returns debrief data instead of the raw session. */
80
+ include?: string;
81
+ }
82
+ /**
83
+ * Result of `session.show`.
84
+ *
85
+ * @remarks
86
+ * `unknown` because `show` with `include='debrief'` returns opaque debrief
87
+ * data (DebriefData | fallback object) rather than a Session record.
88
+ */
89
+ export type SessionShowResult = unknown;
90
+
91
+ // session.find
92
+ /** Parameters for `session.find` — lightweight session discovery. */
93
+ export interface SessionFindParams {
94
+ status?: string;
95
+ scope?: string;
96
+ query?: string;
97
+ limit?: number;
98
+ }
99
+ /** Result of `session.find` — minimal session records. */
100
+ export interface SessionFindResult {
101
+ sessions: Array<{
102
+ id: string;
103
+ name: string;
104
+ status: string;
105
+ startedAt: string;
106
+ scope: unknown;
107
+ }>;
108
+ }
109
+
110
+ // session.decision.log
111
+ /** Parameters for `session.decision.log`. */
112
+ export interface SessionDecisionLogParams {
113
+ sessionId?: string;
114
+ taskId?: string;
115
+ }
116
+ /** A single decision record in the audit trail. */
117
+ export interface DecisionRecord {
118
+ id: string;
119
+ sessionId: string;
120
+ taskId: string;
121
+ decision: string;
122
+ rationale: string;
123
+ alternatives?: string[];
124
+ timestamp: string;
125
+ }
126
+ /** Result of `session.decision.log`. */
127
+ export type SessionDecisionLogResult = DecisionRecord[];
128
+
129
+ // session.context.drift
130
+ /** Parameters for `session.context.drift`. */
131
+ export interface SessionContextDriftParams {
132
+ sessionId?: string;
133
+ }
134
+ /** Result of `session.context.drift`. */
135
+ export interface SessionContextDriftResult {
136
+ score: number;
137
+ factors: string[];
138
+ completedInScope: number;
139
+ totalInScope: number;
140
+ outOfScope: number;
141
+ }
142
+
143
+ // session.handoff.show
144
+ /** Parameters for `session.handoff.show`. */
145
+ export interface SessionHandoffShowParams {
146
+ /**
147
+ * Scope filter string. Use 'global' for global scope or 'epic:<id>' for
148
+ * epic-scoped handoff data.
149
+ */
150
+ scope?: string;
151
+ }
152
+ /** Result of `session.handoff.show`. */
153
+ export interface SessionHandoffShowResult {
154
+ sessionId: string;
155
+ handoff: unknown;
156
+ }
157
+
158
+ // session.briefing.show
159
+ /** Parameters for `session.briefing.show`. */
160
+ export interface SessionBriefingShowParams {
161
+ maxNextTasks?: number;
162
+ maxBugs?: number;
163
+ maxBlocked?: number;
164
+ maxEpics?: number;
165
+ scope?: string;
77
166
  }
78
- export type SessionShowResult = SessionOp;
167
+ /**
168
+ * Result of `session.briefing.show` — composite session-start context.
169
+ * The full shape is defined in `@cleocode/core/internal.SessionBriefing`.
170
+ */
171
+ export type SessionBriefingShowResult = unknown;
79
172
 
80
- // session.history
173
+ // session.history (query — not in primary handler but exported for completeness)
174
+ /** Parameters for `session.history`. */
81
175
  export interface SessionHistoryParams {
82
176
  limit?: number;
83
177
  }
178
+ /** A single session history entry. */
84
179
  export interface SessionHistoryEntry {
85
180
  sessionId: string;
86
181
  name: string;
@@ -89,24 +184,41 @@ export interface SessionHistoryEntry {
89
184
  tasksCompleted: number;
90
185
  duration: string;
91
186
  }
187
+ /** Result of `session.history`. */
92
188
  export type SessionHistoryResult = SessionHistoryEntry[];
93
189
 
94
- /**
95
- * Mutate Operations
96
- */
190
+ // ---------------------------------------------------------------------------
191
+ // Mutate Operations
192
+ // ---------------------------------------------------------------------------
97
193
 
98
194
  // session.start
195
+ /** Parameters for `session.start`. */
99
196
  export interface SessionStartParams {
100
197
  scope: string;
101
198
  name?: string;
102
199
  autoStart?: boolean;
103
200
  startTask?: string;
201
+ /** Alias for startTask — accepted from CLI for backward compat. */
202
+ focus?: string;
203
+ /** Enable full query+mutation audit logging for behavioral grading. */
204
+ grade?: boolean;
205
+ /**
206
+ * HMAC-SHA256 owner-auth token for L4a override authentication (T1118).
207
+ *
208
+ * Derived from HMAC-SHA256(key=password, data=sessionId) during
209
+ * `cleo session start --owner-auth`. Stored in sessions.owner_auth_token
210
+ * and validated on every `CLEO_OWNER_OVERRIDE` call.
211
+ */
212
+ ownerAuthToken?: string;
104
213
  }
105
- export type SessionStartResult = SessionOp;
214
+ /** Result of `session.start` — the newly created session. */
215
+ export type SessionStartResult = Session;
106
216
 
107
217
  // session.end
218
+ /** Parameters for `session.end`. */
108
219
  export interface SessionEndParams {
109
- notes?: string;
220
+ note?: string;
221
+ nextAction?: string;
110
222
  /**
111
223
  * Structured session summary for direct ingestion into brain.db.
112
224
  * When provided, CLEO persists key learnings, decisions, patterns, and next actions.
@@ -114,13 +226,10 @@ export interface SessionEndParams {
114
226
  */
115
227
  sessionSummary?: import('../config.js').SessionSummaryInput;
116
228
  }
229
+ /** Result of `session.end`. */
117
230
  export interface SessionEndResult {
118
- session: SessionOp;
119
- summary: {
120
- duration: string;
121
- tasksCompleted: number;
122
- tasksCreated: number;
123
- };
231
+ sessionId: string;
232
+ ended: boolean;
124
233
  /**
125
234
  * A summarization prompt built from this session's debrief data.
126
235
  * Populated when `brain.summarization.enabled` is true.
@@ -130,25 +239,93 @@ export interface SessionEndResult {
130
239
  }
131
240
 
132
241
  // session.resume
242
+ /** Parameters for `session.resume`. */
133
243
  export interface SessionResumeParams {
134
244
  sessionId: string;
135
245
  }
136
- export type SessionResumeResult = SessionOp;
246
+ /** Result of `session.resume` — the resumed session. */
247
+ export type SessionResumeResult = Session;
137
248
 
138
249
  // session.suspend
250
+ /** Parameters for `session.suspend`. */
139
251
  export interface SessionSuspendParams {
140
- notes?: string;
141
- }
142
- export interface SessionSuspendResult {
143
252
  sessionId: string;
144
- suspended: string;
253
+ reason?: string;
145
254
  }
255
+ /** Result of `session.suspend` — the suspended session. */
256
+ export type SessionSuspendResult = Session;
146
257
 
147
258
  // session.gc
259
+ /** Parameters for `session.gc`. */
148
260
  export interface SessionGcParams {
149
- olderThan?: string;
261
+ maxAgeDays?: number;
150
262
  }
263
+ /** Result of `session.gc`. */
151
264
  export interface SessionGcResult {
152
- cleaned: number;
153
- sessionIds: string[];
265
+ orphaned: string[];
266
+ removed: string[];
267
+ }
268
+
269
+ // session.record.decision
270
+ /** Parameters for `session.record.decision`. */
271
+ export interface SessionRecordDecisionParams {
272
+ sessionId?: string;
273
+ taskId: string;
274
+ decision: string;
275
+ rationale: string;
276
+ alternatives?: string[];
277
+ }
278
+ /** Result of `session.record.decision`. */
279
+ export type SessionRecordDecisionResult = DecisionRecord;
280
+
281
+ // session.record.assumption
282
+ /** Parameters for `session.record.assumption`. */
283
+ export interface SessionRecordAssumptionParams {
284
+ sessionId?: string;
285
+ taskId?: string;
286
+ assumption: string;
287
+ confidence: 'high' | 'medium' | 'low';
288
+ }
289
+ /** Result of `session.record.assumption`. */
290
+ export interface SessionRecordAssumptionResult {
291
+ id: string;
292
+ sessionId: string;
293
+ taskId: string | null;
294
+ assumption: string;
295
+ confidence: string;
296
+ timestamp: string;
154
297
  }
298
+
299
+ // ---------------------------------------------------------------------------
300
+ // Typed operation record (Wave D adapter — T975)
301
+ // ---------------------------------------------------------------------------
302
+
303
+ /**
304
+ * Typed operation record for the session domain.
305
+ *
306
+ * Maps each operation name (as dispatched by the registry — no domain prefix)
307
+ * to its `[Params, Result]` tuple. Used by `TypedDomainHandler<SessionOps>`
308
+ * in the dispatch layer to provide compile-time narrowing of params.
309
+ *
310
+ * @task T975 — Wave D typed-dispatch migration
311
+ */
312
+ export type SessionOps = {
313
+ readonly status: readonly [SessionStatusParams, SessionStatusResult];
314
+ readonly list: readonly [SessionListParams, SessionListResult];
315
+ readonly show: readonly [SessionShowParams, SessionShowResult];
316
+ readonly find: readonly [SessionFindParams, SessionFindResult];
317
+ readonly 'decision.log': readonly [SessionDecisionLogParams, SessionDecisionLogResult];
318
+ readonly 'context.drift': readonly [SessionContextDriftParams, SessionContextDriftResult];
319
+ readonly 'handoff.show': readonly [SessionHandoffShowParams, SessionHandoffShowResult | null];
320
+ readonly 'briefing.show': readonly [SessionBriefingShowParams, SessionBriefingShowResult];
321
+ readonly start: readonly [SessionStartParams, SessionStartResult];
322
+ readonly end: readonly [SessionEndParams, SessionEndResult];
323
+ readonly resume: readonly [SessionResumeParams, SessionResumeResult];
324
+ readonly suspend: readonly [SessionSuspendParams, SessionSuspendResult];
325
+ readonly gc: readonly [SessionGcParams, SessionGcResult];
326
+ readonly 'record.decision': readonly [SessionRecordDecisionParams, SessionRecordDecisionResult];
327
+ readonly 'record.assumption': readonly [
328
+ SessionRecordAssumptionParams,
329
+ SessionRecordAssumptionResult,
330
+ ];
331
+ };
@@ -0,0 +1,308 @@
1
+ /**
2
+ * Sticky Domain Operations Contract (6 operations)
3
+ *
4
+ * Query operations: 2
5
+ * Mutate operations: 4
6
+ *
7
+ * Sticky notes are ephemeral task fragments stored in a project-local SQLite database.
8
+ * They support filtering by status (active/converted/archived), color, priority, and tags.
9
+ * CLI identifiers start with `sticky.*` and are routed through the `sticky` domain handler.
10
+ *
11
+ * SYNC: Canonical type definitions live in packages/core/src/sticky/types.ts.
12
+ * These operation types are the API contract (wire format).
13
+ *
14
+ * @task T1031 — Contract authoring for T980 migration worker
15
+ * @see packages/cleo/src/dispatch/domains/sticky.ts
16
+ * @see packages/core/src/sticky/types.ts
17
+ */
18
+
19
+ /**
20
+ * Sticky note status classification.
21
+ */
22
+ export type StickyNoteStatus = 'active' | 'converted' | 'archived';
23
+
24
+ /**
25
+ * Sticky note color options.
26
+ */
27
+ export type StickyNoteColor = 'yellow' | 'blue' | 'green' | 'red' | 'purple';
28
+
29
+ /**
30
+ * Sticky note priority levels.
31
+ */
32
+ export type StickyNotePriority = 'low' | 'medium' | 'high';
33
+
34
+ /**
35
+ * Converted target type for note transformation.
36
+ */
37
+ export type StickyConvertTargetType = 'task' | 'memory' | 'session_note' | 'task_note';
38
+
39
+ /**
40
+ * Reference to a converted target (task, memory, session note, or task note).
41
+ */
42
+ export interface StickyConvertedTarget {
43
+ /** Type of the conversion target. */
44
+ type: StickyConvertTargetType;
45
+ /** ID of the target item. */
46
+ id: string;
47
+ }
48
+
49
+ /**
50
+ * Core sticky note wire format (API projection).
51
+ *
52
+ * Returned by list, show, add, archive, purge operations.
53
+ */
54
+ export interface StickyNoteOp {
55
+ /** Unique ID (SN-001, SN-002...). */
56
+ id: string;
57
+ /** Raw note text content. */
58
+ content: string;
59
+ /** ISO 8601 creation timestamp. */
60
+ createdAt: string;
61
+ /** ISO 8601 last update timestamp. */
62
+ updatedAt?: string;
63
+ /** Array of user-assigned tags. */
64
+ tags: string[];
65
+ /** Current status (active/converted/archived). */
66
+ status: StickyNoteStatus;
67
+ /** Conversion target if converted (nullable). */
68
+ convertedTo?: StickyConvertedTarget;
69
+ /** Visual color indicator. */
70
+ color?: StickyNoteColor;
71
+ /** Priority level. */
72
+ priority?: StickyNotePriority;
73
+ /** Source type for BRAIN queries. */
74
+ sourceType: string;
75
+ }
76
+
77
+ /**
78
+ * List of sticky notes with pagination metadata.
79
+ */
80
+ export interface StickyListData {
81
+ /** Array of sticky notes matching the filter. */
82
+ stickies: StickyNoteOp[];
83
+ /** Total count of stickies in the project (ignoring pagination). */
84
+ total: number;
85
+ /** Count of stickies that matched the filter. */
86
+ filtered: number;
87
+ }
88
+
89
+ // ============================================================================
90
+ // Query Operations
91
+ // ============================================================================
92
+
93
+ // --------------------------------------------------------------------------
94
+ // sticky.list
95
+ // --------------------------------------------------------------------------
96
+
97
+ /**
98
+ * Parameters for `sticky.list`.
99
+ *
100
+ * @remarks
101
+ * All filter parameters are optional and combine with AND logic (all must match).
102
+ * Pagination applies to filtered results.
103
+ */
104
+ export interface StickyListParams {
105
+ /** Filter to notes with a specific status. */
106
+ status?: StickyNoteStatus;
107
+ /** Filter to notes with a specific color. */
108
+ color?: StickyNoteColor;
109
+ /** Filter to notes with a specific priority. */
110
+ priority?: StickyNotePriority;
111
+ /** Filter to notes containing ALL of the specified tags. */
112
+ tags?: string[];
113
+ /** Max results to return (pagination limit). */
114
+ limit?: number;
115
+ /** Pagination offset (number of results to skip). */
116
+ offset?: number;
117
+ }
118
+
119
+ /**
120
+ * Result of `sticky.list`.
121
+ *
122
+ * @remarks
123
+ * Returns a paginated list of sticky notes with total and filtered counts.
124
+ */
125
+ export interface StickyListResult {
126
+ /** Array of sticky notes for this page. */
127
+ stickies: StickyNoteOp[];
128
+ /** Total sticky note count across all filters. */
129
+ total: number;
130
+ /** Count of stickies matching the applied filters. */
131
+ filtered: number;
132
+ }
133
+
134
+ // --------------------------------------------------------------------------
135
+ // sticky.show
136
+ // --------------------------------------------------------------------------
137
+
138
+ /**
139
+ * Parameters for `sticky.show`.
140
+ */
141
+ export interface StickyShowParams {
142
+ /** Sticky note ID to retrieve (required). */
143
+ stickyId: string;
144
+ }
145
+
146
+ /**
147
+ * Result of `sticky.show`.
148
+ *
149
+ * @remarks
150
+ * Returns the full sticky note record, or error if not found.
151
+ */
152
+ export type StickyShowResult = StickyNoteOp;
153
+
154
+ // ============================================================================
155
+ // Mutate Operations
156
+ // ============================================================================
157
+
158
+ // --------------------------------------------------------------------------
159
+ // sticky.add
160
+ // --------------------------------------------------------------------------
161
+
162
+ /**
163
+ * Parameters for `sticky.add`.
164
+ */
165
+ export interface StickyAddParams {
166
+ /** Note text content (required). */
167
+ content: string;
168
+ /** User-assigned tags. */
169
+ tags?: string[];
170
+ /** Visual color indicator. */
171
+ color?: StickyNoteColor;
172
+ /** Priority level. */
173
+ priority?: StickyNotePriority;
174
+ }
175
+
176
+ /**
177
+ * Result of `sticky.add`.
178
+ *
179
+ * @remarks
180
+ * Returns the newly-created sticky note record.
181
+ */
182
+ export type StickyAddResult = StickyNoteOp;
183
+
184
+ // --------------------------------------------------------------------------
185
+ // sticky.convert
186
+ // --------------------------------------------------------------------------
187
+
188
+ /**
189
+ * Parameters for `sticky.convert`.
190
+ *
191
+ * @remarks
192
+ * Converts a sticky note to a different item type (task, memory, session note, task note).
193
+ * Required params vary by targetType:
194
+ * - task: optional title
195
+ * - memory: optional memoryType
196
+ * - session_note: optional sessionId
197
+ * - task_note: required taskId
198
+ */
199
+ export interface StickyConvertParams {
200
+ /** Sticky note ID to convert (required). */
201
+ stickyId: string;
202
+ /** Target item type: task, memory, session_note, or task_note (required). */
203
+ targetType: StickyConvertTargetType;
204
+ /** Optional title when converting to task. */
205
+ title?: string;
206
+ /** Optional memory type when converting to memory (observation, decision, pattern, etc.). */
207
+ memoryType?: string;
208
+ /** Required task ID when converting to task_note. */
209
+ taskId?: string;
210
+ /** Optional session ID when converting to session_note. */
211
+ sessionId?: string;
212
+ }
213
+
214
+ /**
215
+ * Result of `sticky.convert`.
216
+ *
217
+ * @remarks
218
+ * Returns the target item ID that was created/updated by the conversion.
219
+ * The returned key varies by targetType:
220
+ * - task → taskId
221
+ * - memory → memoryId
222
+ * - session_note → sessionId
223
+ * - task_note → taskId
224
+ */
225
+ export interface StickyConvertResult {
226
+ /** ID of the created or updated target item (key name varies by type). */
227
+ taskId?: string;
228
+ memoryId?: string;
229
+ sessionId?: string;
230
+ }
231
+
232
+ // --------------------------------------------------------------------------
233
+ // sticky.archive
234
+ // --------------------------------------------------------------------------
235
+
236
+ /**
237
+ * Parameters for `sticky.archive`.
238
+ */
239
+ export interface StickyArchiveParams {
240
+ /** Sticky note ID to archive (required). */
241
+ stickyId: string;
242
+ }
243
+
244
+ /**
245
+ * Result of `sticky.archive`.
246
+ *
247
+ * @remarks
248
+ * Returns the archived sticky note record with status updated to 'archived'.
249
+ */
250
+ export type StickyArchiveResult = StickyNoteOp;
251
+
252
+ // --------------------------------------------------------------------------
253
+ // sticky.purge
254
+ // --------------------------------------------------------------------------
255
+
256
+ /**
257
+ * Parameters for `sticky.purge`.
258
+ */
259
+ export interface StickyPurgeParams {
260
+ /** Sticky note ID to permanently delete (required). */
261
+ stickyId: string;
262
+ }
263
+
264
+ /**
265
+ * Result of `sticky.purge`.
266
+ *
267
+ * @remarks
268
+ * Returns the purged sticky note record. After purge, the note is permanently deleted
269
+ * from the database and cannot be recovered.
270
+ */
271
+ export type StickyPurgeResult = StickyNoteOp;
272
+
273
+ // ============================================================================
274
+ // Discriminated Union Types
275
+ // ============================================================================
276
+
277
+ /**
278
+ * All sticky operation keys (for TypedDomainHandler routing).
279
+ */
280
+ export type StickyOpKey =
281
+ | 'sticky.list'
282
+ | 'sticky.show'
283
+ | 'sticky.add'
284
+ | 'sticky.convert'
285
+ | 'sticky.archive'
286
+ | 'sticky.purge';
287
+
288
+ /**
289
+ * Sticky operations discriminated union.
290
+ *
291
+ * @remarks
292
+ * Each variant carries:
293
+ * - `op`: the operation key (for routing)
294
+ * - `params`: strongly-typed parameters for this operation
295
+ * - `result`: strongly-typed return type for this operation
296
+ *
297
+ * Consumed by packages/cleo/src/dispatch/domains/sticky.ts via TypedDomainHandler<StickyOps>.
298
+ *
299
+ * @task T1031
300
+ * @task T980 — migration worker that consumes this contract
301
+ */
302
+ export type StickyOps =
303
+ | { op: 'sticky.list'; params: StickyListParams; result: StickyListResult }
304
+ | { op: 'sticky.show'; params: StickyShowParams; result: StickyShowResult }
305
+ | { op: 'sticky.add'; params: StickyAddParams; result: StickyAddResult }
306
+ | { op: 'sticky.convert'; params: StickyConvertParams; result: StickyConvertResult }
307
+ | { op: 'sticky.archive'; params: StickyArchiveParams; result: StickyArchiveResult }
308
+ | { op: 'sticky.purge'; params: StickyPurgeParams; result: StickyPurgeResult };