@cleocode/contracts 2026.5.2 → 2026.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lafs.d.ts +16 -143
- package/dist/lafs.d.ts.map +1 -1
- package/dist/lafs.js +11 -4
- package/dist/lafs.js.map +1 -1
- package/dist/operations/conduit.d.ts +15 -3
- package/dist/operations/conduit.d.ts.map +1 -1
- package/dist/operations/docs.d.ts +18 -15
- package/dist/operations/docs.d.ts.map +1 -1
- package/dist/operations/index.d.ts +5 -0
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/operations/index.js +5 -0
- package/dist/operations/index.js.map +1 -1
- package/dist/operations/lifecycle.d.ts +3 -4
- package/dist/operations/lifecycle.d.ts.map +1 -1
- package/dist/operations/nexus.d.ts +341 -34
- package/dist/operations/nexus.d.ts.map +1 -1
- package/dist/operations/session.d.ts +201 -9
- package/dist/operations/session.d.ts.map +1 -1
- package/dist/operations/tasks.d.ts +381 -35
- package/dist/operations/tasks.d.ts.map +1 -1
- package/dist/operations/tasks.js +4 -3
- package/dist/operations/tasks.js.map +1 -1
- package/dist/tasks.d.ts +357 -0
- package/dist/tasks.d.ts.map +1 -0
- package/dist/tasks.js +18 -0
- package/dist/tasks.js.map +1 -0
- package/package.json +4 -2
- package/schemas/acceptance-gate.schema.json +484 -5
- package/schemas/attachment.schema.json +210 -5
- package/schemas/gate-result-details.schema.json +174 -5
- package/schemas/gate-result.schema.json +236 -5
- package/schemas/task-evidence.schema.json +199 -5
- package/schemas/task.schema.json +568 -5
- package/src/index.ts +37 -7
- package/src/lafs.ts +34 -162
- package/src/operations/conduit.ts +16 -3
- package/src/operations/docs.ts +22 -16
- package/src/operations/index.ts +5 -0
- package/src/operations/lifecycle.ts +3 -5
- package/src/operations/nexus.ts +355 -34
- package/src/operations/session.ts +213 -10
- package/src/operations/tasks.ts +377 -36
- package/src/tasks.ts +413 -0
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* @task T975 — typed-dispatch migration (Wave D · T962)
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import type { Session } from '../session.js';
|
|
13
|
+
import type { Session, SessionStartResult } from '../session.js';
|
|
14
|
+
import type { MemoryCompactHit, RetrievalBundle } from './memory.js';
|
|
14
15
|
|
|
15
16
|
// ---------------------------------------------------------------------------
|
|
16
17
|
// Common session types (simplified wire-format representation)
|
|
@@ -79,14 +80,58 @@ export interface SessionShowParams {
|
|
|
79
80
|
/** When set to 'debrief', returns debrief data instead of the raw session. */
|
|
80
81
|
include?: string;
|
|
81
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Wire-format debrief payload returned by `session.show` when
|
|
85
|
+
* `include='debrief'` is specified (T5615 — debrief.show absorption).
|
|
86
|
+
*
|
|
87
|
+
* Mirrors the fields of `DebriefData` from
|
|
88
|
+
* `packages/core/src/sessions/handoff.ts` that are exposed over the wire.
|
|
89
|
+
* The nested `handoff` field is kept opaque (`Record<string, unknown>`) to
|
|
90
|
+
* avoid pulling `HandoffData` internals into the contracts package.
|
|
91
|
+
*/
|
|
92
|
+
export interface SessionDebriefData {
|
|
93
|
+
/** The session that produced this debrief. */
|
|
94
|
+
sessionId: string;
|
|
95
|
+
/** Agent / conversation identifier (if known). */
|
|
96
|
+
agentIdentifier: string | null;
|
|
97
|
+
/** Session start time (ISO 8601). */
|
|
98
|
+
startedAt: string;
|
|
99
|
+
/** Session end time (ISO 8601). */
|
|
100
|
+
endedAt: string;
|
|
101
|
+
/** Duration in minutes. */
|
|
102
|
+
durationMinutes: number;
|
|
103
|
+
/** Decisions captured during the session. */
|
|
104
|
+
decisions: Array<{
|
|
105
|
+
/** Decision statement. */
|
|
106
|
+
decision: string;
|
|
107
|
+
/** Rationale for the decision. */
|
|
108
|
+
rationale: string;
|
|
109
|
+
/** Alternatives considered. */
|
|
110
|
+
alternatives?: string[];
|
|
111
|
+
/** ISO 8601 timestamp. */
|
|
112
|
+
timestamp: string;
|
|
113
|
+
}>;
|
|
114
|
+
/** Standard handoff payload (backward-compat opaque shape). */
|
|
115
|
+
handoff: Record<string, unknown>;
|
|
116
|
+
/** Git state at session end (best-effort; null when git unavailable). */
|
|
117
|
+
gitState: Record<string, unknown> | null;
|
|
118
|
+
/** Position of this session in the session chain (1-based). */
|
|
119
|
+
chainPosition: number;
|
|
120
|
+
/** Total length of the session chain. */
|
|
121
|
+
chainLength: number;
|
|
122
|
+
}
|
|
123
|
+
|
|
82
124
|
/**
|
|
83
125
|
* Result of `session.show`.
|
|
84
126
|
*
|
|
85
127
|
* @remarks
|
|
86
|
-
*
|
|
87
|
-
*
|
|
128
|
+
* Returns the raw `Session` record for standard queries. When
|
|
129
|
+
* `include='debrief'` is specified, returns a `SessionDebriefData` envelope
|
|
130
|
+
* instead (T5615 — `debrief.show` was absorbed into `session.show`).
|
|
131
|
+
*
|
|
132
|
+
* @see SessionDebriefData
|
|
88
133
|
*/
|
|
89
|
-
export type SessionShowResult =
|
|
134
|
+
export type SessionShowResult = Session | SessionDebriefData;
|
|
90
135
|
|
|
91
136
|
// session.find
|
|
92
137
|
/** Parameters for `session.find` — lightweight session discovery. */
|
|
@@ -164,11 +209,172 @@ export interface SessionBriefingShowParams {
|
|
|
164
209
|
maxEpics?: number;
|
|
165
210
|
scope?: string;
|
|
166
211
|
}
|
|
212
|
+
|
|
213
|
+
/** Compact task entry in a session briefing's next-tasks list. */
|
|
214
|
+
export interface SessionBriefingTask {
|
|
215
|
+
/** Task identifier. */
|
|
216
|
+
id: string;
|
|
217
|
+
/** Task title. */
|
|
218
|
+
title: string;
|
|
219
|
+
/** Leverage-derived priority score (higher = higher priority). */
|
|
220
|
+
leverage: number;
|
|
221
|
+
/** Composite relevance score used for ordering. */
|
|
222
|
+
score: number;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** Compact bug entry in a session briefing. */
|
|
226
|
+
export interface SessionBriefingBug {
|
|
227
|
+
/** Task identifier. */
|
|
228
|
+
id: string;
|
|
229
|
+
/** Bug title. */
|
|
230
|
+
title: string;
|
|
231
|
+
/** Priority level. */
|
|
232
|
+
priority: string;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** Compact blocked-task entry in a session briefing. */
|
|
236
|
+
export interface SessionBriefingBlockedTask {
|
|
237
|
+
/** Task identifier. */
|
|
238
|
+
id: string;
|
|
239
|
+
/** Task title. */
|
|
240
|
+
title: string;
|
|
241
|
+
/** IDs of tasks blocking this one. */
|
|
242
|
+
blockedBy: string[];
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** Compact active-epic entry in a session briefing. */
|
|
246
|
+
export interface SessionBriefingEpic {
|
|
247
|
+
/** Epic task identifier. */
|
|
248
|
+
id: string;
|
|
249
|
+
/** Epic title. */
|
|
250
|
+
title: string;
|
|
251
|
+
/** Completion percentage [0–100]. */
|
|
252
|
+
completionPercent: number;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** Pipeline stage snapshot surfaced in a session briefing. */
|
|
256
|
+
export interface SessionBriefingPipelineStage {
|
|
257
|
+
/** Current pipeline stage name (e.g. `'implementation'`). */
|
|
258
|
+
currentStage: string;
|
|
259
|
+
/** Stage lifecycle status. */
|
|
260
|
+
stageStatus: string;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/** A single document reference included in the briefing docs-context pillar. */
|
|
264
|
+
export interface SessionBriefingDocRef {
|
|
265
|
+
/** Task that owns this attachment. */
|
|
266
|
+
taskId: string;
|
|
267
|
+
/** Attachment identifier. */
|
|
268
|
+
attachmentId: string;
|
|
269
|
+
/** Attachment kind (local-file, url, blob, llms-txt, llmtxt-doc). */
|
|
270
|
+
kind: string;
|
|
271
|
+
/** Optional human-readable description. */
|
|
272
|
+
description?: string;
|
|
273
|
+
/** Optional categorisation labels. */
|
|
274
|
+
labels?: string[];
|
|
275
|
+
/** ISO 8601 creation timestamp. */
|
|
276
|
+
createdAt: string;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/** Docs-context pillar of the session briefing (T1616). */
|
|
280
|
+
export interface SessionBriefingDocsContext {
|
|
281
|
+
/** Document references for the currently focused task. */
|
|
282
|
+
currentTaskDocs: SessionBriefingDocRef[];
|
|
283
|
+
/** Document references for other in-scope tasks. */
|
|
284
|
+
relatedDocs: SessionBriefingDocRef[];
|
|
285
|
+
/** Total document references surfaced. */
|
|
286
|
+
totalDocs: number;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/** Brain memory context included in the session briefing when available. */
|
|
290
|
+
export interface SessionBriefingMemoryContext {
|
|
291
|
+
/** Recent decisions relevant to the current scope. */
|
|
292
|
+
recentDecisions: MemoryCompactHit[];
|
|
293
|
+
/** Patterns relevant to the current scope. */
|
|
294
|
+
relevantPatterns: MemoryCompactHit[];
|
|
295
|
+
/** Recent observations from prior sessions. */
|
|
296
|
+
recentObservations: MemoryCompactHit[];
|
|
297
|
+
/** Recent learnings relevant to the current scope. */
|
|
298
|
+
recentLearnings: MemoryCompactHit[];
|
|
299
|
+
/** Estimated token weight of this context block. */
|
|
300
|
+
tokensEstimated: number;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** Info about the last ended session, for session-start continuity. */
|
|
304
|
+
export interface SessionBriefingLastSession {
|
|
305
|
+
/** ISO 8601 end timestamp. */
|
|
306
|
+
endedAt: string;
|
|
307
|
+
/** Duration in minutes. */
|
|
308
|
+
duration: number;
|
|
309
|
+
/** Handoff data (opaque shape from `HandoffData`). */
|
|
310
|
+
handoff: Record<string, unknown>;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** Info about the currently active task in the briefing. */
|
|
314
|
+
export interface SessionBriefingCurrentTask {
|
|
315
|
+
/** Task identifier. */
|
|
316
|
+
id: string;
|
|
317
|
+
/** Task title. */
|
|
318
|
+
title: string;
|
|
319
|
+
/** Current lifecycle status. */
|
|
320
|
+
status: string;
|
|
321
|
+
/** IDs of tasks blocking this one, if any. */
|
|
322
|
+
blockedBy?: string[];
|
|
323
|
+
}
|
|
324
|
+
|
|
167
325
|
/**
|
|
168
|
-
* Result of `session.briefing.show
|
|
169
|
-
*
|
|
326
|
+
* Result of `session.briefing.show`.
|
|
327
|
+
*
|
|
328
|
+
* @remarks
|
|
329
|
+
* Mirrors `SessionBriefing` from
|
|
330
|
+
* `packages/core/src/sessions/briefing.ts`. Three pillars:
|
|
331
|
+
* - state: `currentTask` + `nextTasks` + `blockedTasks` + `activeEpics` + `openBugs`
|
|
332
|
+
* - rationale: `memoryContext` + `bundle` (PSYCHE Wave 4 retrieval)
|
|
333
|
+
* - references: `docsContext` (T1616)
|
|
334
|
+
*
|
|
335
|
+
* All optional fields (`pipelineStage`, `warnings`, `memoryContext`, `bundle`,
|
|
336
|
+
* `docsContext`) are omitted when the data source is unavailable or empty.
|
|
337
|
+
*
|
|
338
|
+
* @task T1091 — PSYCHE Wave 4 `bundle`
|
|
339
|
+
* @task T1616 — docs context pillar
|
|
170
340
|
*/
|
|
171
|
-
export
|
|
341
|
+
export interface SessionBriefingShowResult {
|
|
342
|
+
/** Last ended session info, or null when no previous session exists. */
|
|
343
|
+
lastSession: SessionBriefingLastSession | null;
|
|
344
|
+
/** Currently active task, or null when no task is focused. */
|
|
345
|
+
currentTask: SessionBriefingCurrentTask | null;
|
|
346
|
+
/** Ordered list of next tasks to work on (leverage-sorted). */
|
|
347
|
+
nextTasks: SessionBriefingTask[];
|
|
348
|
+
/** Open bugs relevant to the current scope. */
|
|
349
|
+
openBugs: SessionBriefingBug[];
|
|
350
|
+
/** Tasks currently blocked (up to `maxBlocked`). */
|
|
351
|
+
blockedTasks: SessionBriefingBlockedTask[];
|
|
352
|
+
/** Active epics with completion rollup. */
|
|
353
|
+
activeEpics: SessionBriefingEpic[];
|
|
354
|
+
/** Current pipeline stage snapshot (omitted when no lifecycle active). */
|
|
355
|
+
pipelineStage?: SessionBriefingPipelineStage;
|
|
356
|
+
/** Non-fatal warnings emitted during briefing computation. */
|
|
357
|
+
warnings?: string[];
|
|
358
|
+
/** Brain memory context (omitted when memory store unavailable). */
|
|
359
|
+
memoryContext?: SessionBriefingMemoryContext;
|
|
360
|
+
/**
|
|
361
|
+
* PSYCHE Wave 4 multi-pass retrieval bundle.
|
|
362
|
+
*
|
|
363
|
+
* Contains cold (user-profile + peer instructions), warm (peer-scoped
|
|
364
|
+
* memory), and hot (live session state) passes. Present when the active
|
|
365
|
+
* session and peer ID are resolvable; omitted otherwise.
|
|
366
|
+
*
|
|
367
|
+
* @task T1091
|
|
368
|
+
*/
|
|
369
|
+
bundle?: RetrievalBundle;
|
|
370
|
+
/**
|
|
371
|
+
* Docs-context pillar — task-attached document references (T1616).
|
|
372
|
+
*
|
|
373
|
+
* Present when at least one in-scope task has attachments; omitted
|
|
374
|
+
* when the attachment store is unavailable or no attachments exist.
|
|
375
|
+
*/
|
|
376
|
+
docsContext?: SessionBriefingDocsContext;
|
|
377
|
+
}
|
|
172
378
|
|
|
173
379
|
// session.history (query — not in primary handler but exported for completeness)
|
|
174
380
|
/** Parameters for `session.history`. */
|
|
@@ -212,9 +418,6 @@ export interface SessionStartParams {
|
|
|
212
418
|
*/
|
|
213
419
|
ownerAuthToken?: string;
|
|
214
420
|
}
|
|
215
|
-
/** Result of `session.start` — the newly created session. */
|
|
216
|
-
export type SessionStartResult = Session;
|
|
217
|
-
|
|
218
421
|
// session.end
|
|
219
422
|
/** Parameters for `session.end`. */
|
|
220
423
|
export interface SessionEndParams {
|