@cleocode/core 2026.3.70 → 2026.3.71
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/cleo.d.ts +2 -300
- package/dist/cleo.d.ts.map +1 -1
- package/dist/index.js +53 -16
- package/dist/index.js.map +4 -4
- package/package.json +5 -5
- package/src/cleo.ts +30 -251
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleocode/core",
|
|
3
|
-
"version": "2026.3.
|
|
3
|
+
"version": "2026.3.71",
|
|
4
4
|
"description": "CLEO core business logic kernel — tasks, sessions, memory, orchestration, lifecycle, with bundled SQLite store",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"write-file-atomic": "^6.0.0",
|
|
38
38
|
"yaml": "^2.8.2",
|
|
39
39
|
"zod": "^3.25.76",
|
|
40
|
-
"@cleocode/
|
|
41
|
-
"@cleocode/
|
|
42
|
-
"@cleocode/
|
|
43
|
-
"@cleocode/
|
|
40
|
+
"@cleocode/agents": "2026.3.71",
|
|
41
|
+
"@cleocode/adapters": "2026.3.71",
|
|
42
|
+
"@cleocode/skills": "2026.3.71",
|
|
43
|
+
"@cleocode/contracts": "2026.3.71"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=24.0.0"
|
package/src/cleo.ts
CHANGED
|
@@ -16,26 +16,26 @@
|
|
|
16
16
|
|
|
17
17
|
import path from 'node:path';
|
|
18
18
|
import type {
|
|
19
|
+
AdminAPI,
|
|
20
|
+
AgentsAPI,
|
|
21
|
+
CleoInitOptions,
|
|
19
22
|
DataAccessor,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
IntelligenceAPI,
|
|
24
|
+
LifecycleAPI,
|
|
25
|
+
MemoryAPI,
|
|
26
|
+
NexusAPI,
|
|
27
|
+
OrchestrationAPI,
|
|
28
|
+
ReleaseAPI,
|
|
29
|
+
SessionsAPI,
|
|
30
|
+
StickyAPI,
|
|
31
|
+
SyncAPI,
|
|
32
|
+
TasksAPI,
|
|
29
33
|
} from '@cleocode/contracts';
|
|
30
34
|
// Admin
|
|
31
35
|
import { exportTasks } from './admin/export.js';
|
|
32
|
-
import type { ImportParams } from './admin/import.js';
|
|
33
36
|
import { importTasks } from './admin/import.js';
|
|
34
37
|
// Agents
|
|
35
38
|
import {
|
|
36
|
-
type AgentCapacity,
|
|
37
|
-
type AgentHealthStatus,
|
|
38
|
-
type AgentInstanceRow,
|
|
39
39
|
checkAgentHealth,
|
|
40
40
|
deregisterAgent,
|
|
41
41
|
detectCrashedAgents,
|
|
@@ -43,16 +43,10 @@ import {
|
|
|
43
43
|
heartbeat,
|
|
44
44
|
isOverloaded,
|
|
45
45
|
listAgentInstances,
|
|
46
|
-
type RegisterAgentOptions,
|
|
47
46
|
registerAgent,
|
|
48
47
|
} from './agents/index.js';
|
|
49
48
|
// Intelligence
|
|
50
|
-
import {
|
|
51
|
-
type BlastRadius,
|
|
52
|
-
calculateBlastRadius,
|
|
53
|
-
type ImpactReport,
|
|
54
|
-
predictImpact,
|
|
55
|
-
} from './intelligence/index.js';
|
|
49
|
+
import { calculateBlastRadius, predictImpact } from './intelligence/index.js';
|
|
56
50
|
// Lifecycle
|
|
57
51
|
import {
|
|
58
52
|
checkGate,
|
|
@@ -66,7 +60,6 @@ import {
|
|
|
66
60
|
skipStage,
|
|
67
61
|
startStage,
|
|
68
62
|
} from './lifecycle/index.js';
|
|
69
|
-
import type { BrainObservationType } from './memory/brain-retrieval.js';
|
|
70
63
|
// Memory
|
|
71
64
|
import {
|
|
72
65
|
fetchBrainEntries,
|
|
@@ -74,7 +67,6 @@ import {
|
|
|
74
67
|
searchBrainCompact,
|
|
75
68
|
timelineBrain,
|
|
76
69
|
} from './memory/brain-retrieval.js';
|
|
77
|
-
import type { HybridSearchOptions } from './memory/brain-search.js';
|
|
78
70
|
import { hybridSearch, searchBrain } from './memory/brain-search.js';
|
|
79
71
|
// Nexus
|
|
80
72
|
import { discoverRelated, searchAcrossProjects } from './nexus/discover.js';
|
|
@@ -162,237 +154,24 @@ import { showTask } from './tasks/show.js';
|
|
|
162
154
|
import { updateTask } from './tasks/update.js';
|
|
163
155
|
|
|
164
156
|
// ============================================================================
|
|
165
|
-
// Domain API interfaces
|
|
166
|
-
// ============================================================================
|
|
167
|
-
|
|
168
|
-
export interface TasksAPI {
|
|
169
|
-
add(params: {
|
|
170
|
-
title: string;
|
|
171
|
-
description: string;
|
|
172
|
-
parent?: string;
|
|
173
|
-
priority?: TaskPriority;
|
|
174
|
-
type?: TaskType;
|
|
175
|
-
size?: TaskSize;
|
|
176
|
-
phase?: string;
|
|
177
|
-
labels?: string[];
|
|
178
|
-
depends?: string[];
|
|
179
|
-
notes?: string;
|
|
180
|
-
}): Promise<unknown>;
|
|
181
|
-
find(params: {
|
|
182
|
-
query?: string;
|
|
183
|
-
id?: string;
|
|
184
|
-
status?: TaskStatus;
|
|
185
|
-
limit?: number;
|
|
186
|
-
}): Promise<unknown>;
|
|
187
|
-
show(taskId: string): Promise<unknown>;
|
|
188
|
-
list(params?: {
|
|
189
|
-
status?: TaskStatus;
|
|
190
|
-
priority?: TaskPriority;
|
|
191
|
-
parentId?: string;
|
|
192
|
-
phase?: string;
|
|
193
|
-
limit?: number;
|
|
194
|
-
}): Promise<unknown>;
|
|
195
|
-
update(params: {
|
|
196
|
-
taskId: string;
|
|
197
|
-
title?: string;
|
|
198
|
-
status?: TaskStatus;
|
|
199
|
-
priority?: TaskPriority;
|
|
200
|
-
description?: string;
|
|
201
|
-
notes?: string;
|
|
202
|
-
}): Promise<unknown>;
|
|
203
|
-
complete(params: { taskId: string; notes?: string }): Promise<unknown>;
|
|
204
|
-
delete(params: { taskId: string; force?: boolean }): Promise<unknown>;
|
|
205
|
-
archive(params?: { before?: string; taskIds?: string[]; dryRun?: boolean }): Promise<unknown>;
|
|
206
|
-
/** Start working on a specific task (sets focus). */
|
|
207
|
-
start(taskId: string): Promise<unknown>;
|
|
208
|
-
/** Stop working on the current task (clears focus). */
|
|
209
|
-
stop(): Promise<{ previousTask: string | null }>;
|
|
210
|
-
/** Get the current task work state. */
|
|
211
|
-
current(): Promise<unknown>;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
export interface SessionsAPI {
|
|
215
|
-
start(params: {
|
|
216
|
-
name: string;
|
|
217
|
-
scope: string;
|
|
218
|
-
agent?: string;
|
|
219
|
-
startTask?: string;
|
|
220
|
-
}): Promise<unknown>;
|
|
221
|
-
end(params?: { note?: string }): Promise<unknown>;
|
|
222
|
-
status(): Promise<unknown>;
|
|
223
|
-
resume(sessionId: string): Promise<unknown>;
|
|
224
|
-
list(params?: { status?: string; limit?: number }): Promise<unknown>;
|
|
225
|
-
find(params?: {
|
|
226
|
-
status?: string;
|
|
227
|
-
scope?: string;
|
|
228
|
-
query?: string;
|
|
229
|
-
limit?: number;
|
|
230
|
-
}): Promise<unknown>;
|
|
231
|
-
show(sessionId: string): Promise<unknown>;
|
|
232
|
-
suspend(sessionId: string, reason?: string): Promise<unknown>;
|
|
233
|
-
briefing(params?: { maxNextTasks?: number; scope?: string }): Promise<unknown>;
|
|
234
|
-
handoff(sessionId: string, options?: { note?: string; nextAction?: string }): Promise<unknown>;
|
|
235
|
-
gc(maxAgeHours?: number): Promise<unknown>;
|
|
236
|
-
recordDecision(params: {
|
|
237
|
-
sessionId: string;
|
|
238
|
-
taskId: string;
|
|
239
|
-
decision: string;
|
|
240
|
-
rationale: string;
|
|
241
|
-
alternatives?: string[];
|
|
242
|
-
}): Promise<unknown>;
|
|
243
|
-
recordAssumption(params: {
|
|
244
|
-
assumption: string;
|
|
245
|
-
confidence: 'high' | 'medium' | 'low';
|
|
246
|
-
sessionId?: string;
|
|
247
|
-
taskId?: string;
|
|
248
|
-
}): Promise<unknown>;
|
|
249
|
-
contextDrift(params?: { sessionId?: string }): Promise<unknown>;
|
|
250
|
-
decisionLog(params?: { sessionId?: string; taskId?: string }): Promise<unknown>;
|
|
251
|
-
lastHandoff(scope?: { type: string; epicId?: string }): Promise<unknown>;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
export interface MemoryAPI {
|
|
255
|
-
observe(params: { text: string; title?: string; type?: BrainObservationType }): Promise<unknown>;
|
|
256
|
-
find(params: {
|
|
257
|
-
query: string;
|
|
258
|
-
limit?: number;
|
|
259
|
-
tables?: Array<'decisions' | 'patterns' | 'learnings' | 'observations'>;
|
|
260
|
-
}): Promise<unknown>;
|
|
261
|
-
fetch(params: { ids: string[] }): Promise<unknown>;
|
|
262
|
-
timeline(params: { anchor: string; depthBefore?: number; depthAfter?: number }): Promise<unknown>;
|
|
263
|
-
search(query: string, options?: { limit?: number }): Promise<unknown>;
|
|
264
|
-
hybridSearch(query: string, options?: HybridSearchOptions): Promise<unknown>;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export interface OrchestrationAPI {
|
|
268
|
-
start(epicId: string): Promise<unknown>;
|
|
269
|
-
analyze(epicId: string): Promise<unknown>;
|
|
270
|
-
readyTasks(epicId: string): Promise<unknown>;
|
|
271
|
-
nextTask(epicId: string): Promise<unknown>;
|
|
272
|
-
context(epicId: string): Promise<unknown>;
|
|
273
|
-
dependencyGraph(tasks: Task[]): unknown;
|
|
274
|
-
epicStatus(epicId: string, title: string, children: Task[]): unknown;
|
|
275
|
-
progress(tasks: Task[]): unknown;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
export interface LifecycleAPI {
|
|
279
|
-
status(epicId: string): Promise<unknown>;
|
|
280
|
-
startStage(epicId: string, stage: string): Promise<unknown>;
|
|
281
|
-
completeStage(epicId: string, stage: string, artifacts?: string[]): Promise<unknown>;
|
|
282
|
-
skipStage(epicId: string, stage: string, reason: string): Promise<unknown>;
|
|
283
|
-
checkGate(epicId: string, targetStage: string): Promise<unknown>;
|
|
284
|
-
history(epicId: string): Promise<unknown>;
|
|
285
|
-
resetStage(epicId: string, stage: string, reason: string): Promise<unknown>;
|
|
286
|
-
passGate(epicId: string, gateName: string, agent?: string): Promise<unknown>;
|
|
287
|
-
failGate(epicId: string, gateName: string, reason?: string): Promise<unknown>;
|
|
288
|
-
stages: readonly string[];
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
export interface ReleaseAPI {
|
|
292
|
-
prepare(params: { version: string; tasks?: string[]; notes?: string }): Promise<unknown>;
|
|
293
|
-
commit(params: { version: string }): Promise<unknown>;
|
|
294
|
-
tag(params: { version: string }): Promise<unknown>;
|
|
295
|
-
push(params: { version: string; remote?: string; explicitPush?: boolean }): Promise<unknown>;
|
|
296
|
-
rollback(params: { version: string; reason?: string }): Promise<unknown>;
|
|
297
|
-
calculateVersion(current: string, bumpType: string): string;
|
|
298
|
-
bumpVersion(): Promise<unknown>;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
export interface AdminAPI {
|
|
302
|
-
export(params?: Record<string, unknown>): Promise<unknown>;
|
|
303
|
-
import(params: Omit<ImportParams, 'cwd'>): Promise<unknown>;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
export interface StickyAPI {
|
|
307
|
-
add(params: {
|
|
308
|
-
content: string;
|
|
309
|
-
tags?: string[];
|
|
310
|
-
priority?: string;
|
|
311
|
-
color?: string;
|
|
312
|
-
}): Promise<unknown>;
|
|
313
|
-
show(stickyId: string): Promise<unknown>;
|
|
314
|
-
list(params?: {
|
|
315
|
-
status?: string;
|
|
316
|
-
color?: string;
|
|
317
|
-
priority?: string;
|
|
318
|
-
limit?: number;
|
|
319
|
-
}): Promise<unknown>;
|
|
320
|
-
archive(stickyId: string): Promise<unknown>;
|
|
321
|
-
purge(stickyId: string): Promise<unknown>;
|
|
322
|
-
convert(params: {
|
|
323
|
-
stickyId: string;
|
|
324
|
-
targetType: 'task' | 'memory' | 'task_note' | 'session_note';
|
|
325
|
-
title?: string;
|
|
326
|
-
memoryType?: string;
|
|
327
|
-
taskId?: string;
|
|
328
|
-
}): Promise<unknown>;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
export interface NexusAPI {
|
|
332
|
-
init(): Promise<unknown>;
|
|
333
|
-
register(params: { path: string; name?: string; permissions?: string }): Promise<unknown>;
|
|
334
|
-
unregister(params: { name: string }): Promise<unknown>;
|
|
335
|
-
list(): Promise<unknown>;
|
|
336
|
-
show(params: { name: string }): Promise<unknown>;
|
|
337
|
-
sync(params?: { name?: string }): Promise<unknown>;
|
|
338
|
-
discover(params: { query: string; method?: string; limit?: number }): Promise<unknown>;
|
|
339
|
-
search(params: { pattern: string; project?: string; limit?: number }): Promise<unknown>;
|
|
340
|
-
setPermission(params: { name: string; level: 'read' | 'write' | 'execute' }): Promise<unknown>;
|
|
341
|
-
sharingStatus(): Promise<unknown>;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
export interface SyncAPI {
|
|
345
|
-
/** Reconcile external tasks with CLEO as SSoT. */
|
|
346
|
-
reconcile(params: {
|
|
347
|
-
externalTasks: ExternalTask[];
|
|
348
|
-
providerId: string;
|
|
349
|
-
dryRun?: boolean;
|
|
350
|
-
conflictPolicy?: ReconcileOptions['conflictPolicy'];
|
|
351
|
-
defaultPhase?: string;
|
|
352
|
-
defaultLabels?: string[];
|
|
353
|
-
}): Promise<ReconcileResult>;
|
|
354
|
-
/** Get all external task links for a provider. */
|
|
355
|
-
getLinks(providerId: string): Promise<ExternalTaskLink[]>;
|
|
356
|
-
/** Get all external task links for a CLEO task. */
|
|
357
|
-
getTaskLinks(taskId: string): Promise<ExternalTaskLink[]>;
|
|
358
|
-
/** Remove all external task links for a provider. */
|
|
359
|
-
removeProviderLinks(providerId: string): Promise<number>;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
export interface AgentsAPI {
|
|
363
|
-
/** Register a new agent instance. */
|
|
364
|
-
register(options: RegisterAgentOptions): Promise<AgentInstanceRow>;
|
|
365
|
-
/** Deregister an agent instance. */
|
|
366
|
-
deregister(agentId: string): Promise<AgentInstanceRow | null>;
|
|
367
|
-
/** Get health status for a specific agent. */
|
|
368
|
-
health(agentId: string): Promise<AgentHealthStatus | null>;
|
|
369
|
-
/** Detect agents that have crashed (missed heartbeats). */
|
|
370
|
-
detectCrashed(thresholdMs?: number): Promise<AgentInstanceRow[]>;
|
|
371
|
-
/** Record a heartbeat for an agent. */
|
|
372
|
-
recordHeartbeat(agentId: string): Promise<unknown>;
|
|
373
|
-
/** Get capacity info for an agent. */
|
|
374
|
-
capacity(agentId: string): Promise<AgentCapacity | null>;
|
|
375
|
-
/** Check if system is overloaded (available capacity below threshold). */
|
|
376
|
-
isOverloaded(threshold?: number): Promise<boolean>;
|
|
377
|
-
/** List all agent instances with optional filters. */
|
|
378
|
-
list(params?: { status?: string; agentType?: string }): Promise<AgentInstanceRow[]>;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
export interface IntelligenceAPI {
|
|
382
|
-
/** Predict impact of a change description on related tasks. */
|
|
383
|
-
predictImpact(change: string): Promise<ImpactReport>;
|
|
384
|
-
/** Calculate blast radius for a task change. */
|
|
385
|
-
blastRadius(taskId: string): Promise<BlastRadius>;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
// ============================================================================
|
|
389
|
-
// Init options
|
|
157
|
+
// Domain API interfaces — re-exported from @cleocode/contracts/facade
|
|
390
158
|
// ============================================================================
|
|
391
159
|
|
|
392
|
-
export
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
160
|
+
export type {
|
|
161
|
+
AdminAPI,
|
|
162
|
+
AgentsAPI,
|
|
163
|
+
CleoInitOptions,
|
|
164
|
+
IntelligenceAPI,
|
|
165
|
+
LifecycleAPI,
|
|
166
|
+
MemoryAPI,
|
|
167
|
+
NexusAPI,
|
|
168
|
+
OrchestrationAPI,
|
|
169
|
+
ReleaseAPI,
|
|
170
|
+
SessionsAPI,
|
|
171
|
+
StickyAPI,
|
|
172
|
+
SyncAPI,
|
|
173
|
+
TasksAPI,
|
|
174
|
+
} from '@cleocode/contracts';
|
|
396
175
|
|
|
397
176
|
// ============================================================================
|
|
398
177
|
// Cleo facade class
|