@cleocode/contracts 2026.9.16 → 2026.9.18
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/agent-registry.d.ts +11 -1
- package/dist/agent-registry.d.ts.map +1 -1
- package/dist/config.d.ts +42 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/credential-transfer.d.ts +103 -0
- package/dist/credential-transfer.d.ts.map +1 -0
- package/dist/credential-transfer.js +21 -0
- package/dist/credential-transfer.js.map +1 -0
- package/dist/dispatch/operations-registry.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.js +7 -2
- package/dist/dispatch/operations-registry.js.map +1 -1
- package/dist/doctor.d.ts +103 -0
- package/dist/doctor.d.ts.map +1 -1
- package/dist/errors.d.ts +5 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +2 -1
- package/dist/errors.js.map +1 -1
- package/dist/graph.d.ts +118 -1
- package/dist/graph.d.ts.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/operations/nexus-scope-map.d.ts +16 -0
- package/dist/operations/nexus-scope-map.d.ts.map +1 -1
- package/dist/operations/nexus-scope-map.js +16 -0
- package/dist/operations/nexus-scope-map.js.map +1 -1
- package/dist/operations/nexus-scope.d.ts +8 -0
- package/dist/operations/nexus-scope.d.ts.map +1 -1
- package/dist/operations/nexus.d.ts +77 -5
- package/dist/operations/nexus.d.ts.map +1 -1
- package/dist/portable-bundle.d.ts +436 -0
- package/dist/portable-bundle.d.ts.map +1 -0
- package/dist/portable-bundle.js +17 -0
- package/dist/portable-bundle.js.map +1 -0
- package/package.json +2 -2
- package/src/__tests__/__snapshots__/operations-registry.test.ts.snap +1 -1
- package/src/agent-registry.ts +11 -1
- package/src/config.ts +44 -0
- package/src/credential-transfer.ts +112 -0
- package/src/dispatch/operations-registry.ts +8 -2
- package/src/doctor.ts +115 -0
- package/src/errors.ts +7 -1
- package/src/graph.ts +122 -1
- package/src/index.ts +50 -0
- package/src/operations/nexus-scope-map.ts +16 -0
- package/src/operations/nexus-scope.ts +9 -0
- package/src/operations/nexus.ts +87 -5
- package/src/portable-bundle.ts +476 -0
|
@@ -125,6 +125,7 @@ export const NEXUS_SCOPE_MAP = {
|
|
|
125
125
|
effect: 'write',
|
|
126
126
|
stores: ['nexus-graph'],
|
|
127
127
|
requiresProject: true,
|
|
128
|
+
indexSensitive: true,
|
|
128
129
|
},
|
|
129
130
|
'share.status': {
|
|
130
131
|
op: 'share.status',
|
|
@@ -149,6 +150,7 @@ export const NEXUS_SCOPE_MAP = {
|
|
|
149
150
|
effect: 'read',
|
|
150
151
|
stores: ['nexus-graph'],
|
|
151
152
|
requiresProject: true,
|
|
153
|
+
indexSensitive: true,
|
|
152
154
|
},
|
|
153
155
|
impact: {
|
|
154
156
|
op: 'impact',
|
|
@@ -166,6 +168,7 @@ export const NEXUS_SCOPE_MAP = {
|
|
|
166
168
|
effect: 'read',
|
|
167
169
|
stores: ['nexus-graph'],
|
|
168
170
|
requiresProject: true,
|
|
171
|
+
indexSensitive: true,
|
|
169
172
|
},
|
|
170
173
|
'task-footprint': {
|
|
171
174
|
op: 'task-footprint',
|
|
@@ -174,6 +177,7 @@ export const NEXUS_SCOPE_MAP = {
|
|
|
174
177
|
effect: 'read',
|
|
175
178
|
stores: ['nexus-graph', 'tasks'],
|
|
176
179
|
requiresProject: true,
|
|
180
|
+
indexSensitive: true,
|
|
177
181
|
},
|
|
178
182
|
'brain-anchors': {
|
|
179
183
|
op: 'brain-anchors',
|
|
@@ -182,6 +186,7 @@ export const NEXUS_SCOPE_MAP = {
|
|
|
182
186
|
effect: 'read',
|
|
183
187
|
stores: ['nexus-graph', 'brain'],
|
|
184
188
|
requiresProject: true,
|
|
189
|
+
indexSensitive: true,
|
|
185
190
|
},
|
|
186
191
|
why: {
|
|
187
192
|
op: 'why',
|
|
@@ -190,6 +195,7 @@ export const NEXUS_SCOPE_MAP = {
|
|
|
190
195
|
effect: 'read',
|
|
191
196
|
stores: ['nexus-graph', 'brain'],
|
|
192
197
|
requiresProject: true,
|
|
198
|
+
indexSensitive: true,
|
|
193
199
|
},
|
|
194
200
|
'impact-full': {
|
|
195
201
|
op: 'impact-full',
|
|
@@ -207,6 +213,7 @@ export const NEXUS_SCOPE_MAP = {
|
|
|
207
213
|
effect: 'read',
|
|
208
214
|
stores: ['nexus-graph'],
|
|
209
215
|
requiresProject: true,
|
|
216
|
+
indexSensitive: true,
|
|
210
217
|
},
|
|
211
218
|
'shape-check': {
|
|
212
219
|
op: 'shape-check',
|
|
@@ -215,6 +222,7 @@ export const NEXUS_SCOPE_MAP = {
|
|
|
215
222
|
effect: 'read',
|
|
216
223
|
stores: ['nexus-graph'],
|
|
217
224
|
requiresProject: true,
|
|
225
|
+
indexSensitive: true,
|
|
218
226
|
},
|
|
219
227
|
'search-code': {
|
|
220
228
|
op: 'search-code',
|
|
@@ -223,6 +231,7 @@ export const NEXUS_SCOPE_MAP = {
|
|
|
223
231
|
effect: 'read',
|
|
224
232
|
stores: ['nexus-graph', 'fs'],
|
|
225
233
|
requiresProject: true,
|
|
234
|
+
indexSensitive: true,
|
|
226
235
|
},
|
|
227
236
|
wiki: {
|
|
228
237
|
op: 'wiki',
|
|
@@ -247,6 +256,7 @@ export const NEXUS_SCOPE_MAP = {
|
|
|
247
256
|
effect: 'read',
|
|
248
257
|
stores: ['nexus-graph', 'tasks'],
|
|
249
258
|
requiresProject: true,
|
|
259
|
+
indexSensitive: true,
|
|
250
260
|
},
|
|
251
261
|
|
|
252
262
|
// ── Profile ops ───────────────────────────────────────────────────────────
|
|
@@ -435,6 +445,7 @@ export const NEXUS_SCOPE_MAP = {
|
|
|
435
445
|
effect: 'read',
|
|
436
446
|
stores: ['nexus-graph'],
|
|
437
447
|
requiresProject: true,
|
|
448
|
+
indexSensitive: true,
|
|
438
449
|
},
|
|
439
450
|
flows: {
|
|
440
451
|
op: 'flows',
|
|
@@ -443,6 +454,7 @@ export const NEXUS_SCOPE_MAP = {
|
|
|
443
454
|
effect: 'read',
|
|
444
455
|
stores: ['nexus-graph'],
|
|
445
456
|
requiresProject: true,
|
|
457
|
+
indexSensitive: true,
|
|
446
458
|
},
|
|
447
459
|
context: {
|
|
448
460
|
op: 'context',
|
|
@@ -517,6 +529,7 @@ export const NEXUS_SCOPE_MAP = {
|
|
|
517
529
|
effect: 'read',
|
|
518
530
|
stores: ['nexus-graph'],
|
|
519
531
|
requiresProject: true,
|
|
532
|
+
indexSensitive: true,
|
|
520
533
|
},
|
|
521
534
|
'hot-paths': {
|
|
522
535
|
op: 'hot-paths',
|
|
@@ -525,6 +538,7 @@ export const NEXUS_SCOPE_MAP = {
|
|
|
525
538
|
effect: 'read',
|
|
526
539
|
stores: ['nexus-graph'],
|
|
527
540
|
requiresProject: true,
|
|
541
|
+
indexSensitive: true,
|
|
528
542
|
},
|
|
529
543
|
'hot-nodes': {
|
|
530
544
|
op: 'hot-nodes',
|
|
@@ -533,6 +547,7 @@ export const NEXUS_SCOPE_MAP = {
|
|
|
533
547
|
effect: 'read',
|
|
534
548
|
stores: ['nexus-graph'],
|
|
535
549
|
requiresProject: true,
|
|
550
|
+
indexSensitive: true,
|
|
536
551
|
},
|
|
537
552
|
'cold-symbols': {
|
|
538
553
|
op: 'cold-symbols',
|
|
@@ -541,6 +556,7 @@ export const NEXUS_SCOPE_MAP = {
|
|
|
541
556
|
effect: 'read',
|
|
542
557
|
stores: ['nexus-graph'],
|
|
543
558
|
requiresProject: true,
|
|
559
|
+
indexSensitive: true,
|
|
544
560
|
},
|
|
545
561
|
} as const satisfies Record<keyof NexusOps, NexusOperationDescriptor>;
|
|
546
562
|
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* @module operations/nexus-scope
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import type { GraphIndexFreshness } from '../graph.js';
|
|
10
|
+
|
|
9
11
|
// ---------------------------------------------------------------------------
|
|
10
12
|
// NexusScope — five-state discriminated union
|
|
11
13
|
// ---------------------------------------------------------------------------
|
|
@@ -184,6 +186,13 @@ export interface NexusScopeMeta {
|
|
|
184
186
|
* top-level CLI invocation (sub-calls inherit via `meta.requestId` lineage).
|
|
185
187
|
*/
|
|
186
188
|
readonly indexFreshness?: 'fresh' | 'stale' | 'unknown';
|
|
189
|
+
/**
|
|
190
|
+
* The facts behind {@link NexusScopeMeta.indexFreshness}: last index time,
|
|
191
|
+
* stale file counts and samples, whether the queried symbol's own file is
|
|
192
|
+
* stale, the refresh command with its estimated cost, and any inline refresh
|
|
193
|
+
* the query performed before answering (T12316).
|
|
194
|
+
*/
|
|
195
|
+
readonly freshness?: GraphIndexFreshness;
|
|
187
196
|
/**
|
|
188
197
|
* The canonical CLI command string for this operation (e.g. `"cleo nexus context"`).
|
|
189
198
|
*/
|
package/src/operations/nexus.ts
CHANGED
|
@@ -116,9 +116,9 @@ export interface NexusProjectRecord {
|
|
|
116
116
|
taskCount: number;
|
|
117
117
|
/** Project-level labels. */
|
|
118
118
|
labels: string[];
|
|
119
|
-
/** Absolute path to project's brain.db
|
|
119
|
+
/** Absolute path to the project's live store holding brain tables (`.cleo/cleo.db`; nullable until populated). */
|
|
120
120
|
brainDbPath: string | null;
|
|
121
|
-
/** Absolute path to project's
|
|
121
|
+
/** Absolute path to the project's live store holding task tables (`.cleo/cleo.db`; nullable until populated). */
|
|
122
122
|
tasksDbPath: string | null;
|
|
123
123
|
/** ISO 8601 timestamp of the last code-intelligence index run. */
|
|
124
124
|
lastIndexed: string | null;
|
|
@@ -1347,9 +1347,9 @@ export interface NexusProjectsCleanParams {
|
|
|
1347
1347
|
dryRun?: boolean;
|
|
1348
1348
|
/** JS regex matched against project_path. */
|
|
1349
1349
|
pattern?: string;
|
|
1350
|
-
/** Match paths containing a .temp/ segment. */
|
|
1350
|
+
/** Match paths containing a .temp/ segment or under the OS temp directory (T12324). */
|
|
1351
1351
|
includeTemp?: boolean;
|
|
1352
|
-
/** Match paths containing tmp/test/fixture/scratch/sandbox segments. */
|
|
1352
|
+
/** Match paths containing tmp/test(s)/__tests__/fixture(s)/scratch/sandbox segments. */
|
|
1353
1353
|
includeTests?: boolean;
|
|
1354
1354
|
/** Also match unhealthy rows. */
|
|
1355
1355
|
matchUnhealthy?: boolean;
|
|
@@ -1359,9 +1359,85 @@ export interface NexusProjectsCleanParams {
|
|
|
1359
1359
|
matchOrphaned?: boolean;
|
|
1360
1360
|
/** Also `rm -rf` matched paths from disk after DB delete (T9117). */
|
|
1361
1361
|
removeFs?: boolean;
|
|
1362
|
-
/**
|
|
1362
|
+
/** VACUUM the GLOBAL registry store (`<cleoHome>/cleo.db`) after delete (T9117 · T12324). */
|
|
1363
1363
|
vacuum?: boolean;
|
|
1364
1364
|
}
|
|
1365
|
+
|
|
1366
|
+
/** One checkout of a project recorded in the device-local path map (T12354). */
|
|
1367
|
+
export interface NexusProjectCheckout {
|
|
1368
|
+
/** Absolute checkout root on this device. */
|
|
1369
|
+
projectPath: string;
|
|
1370
|
+
/** Path fingerprint of the checkout. */
|
|
1371
|
+
projectHash: string;
|
|
1372
|
+
/** ISO 8601 timestamp the checkout was first recorded. */
|
|
1373
|
+
firstSeen: string;
|
|
1374
|
+
/** ISO 8601 timestamp the checkout was last encountered. */
|
|
1375
|
+
lastSeen: string;
|
|
1376
|
+
/** Whether the checkout directory exists now. */
|
|
1377
|
+
exists: boolean;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
/** Why a registry row matched `nexus.projects.clean` criteria (T12324). */
|
|
1381
|
+
export type NexusProjectsCleanReason =
|
|
1382
|
+
| 'pattern'
|
|
1383
|
+
| 'temp-path'
|
|
1384
|
+
| 'test-path'
|
|
1385
|
+
| 'unhealthy'
|
|
1386
|
+
| 'never-indexed'
|
|
1387
|
+
| 'missing-path'
|
|
1388
|
+
| 'path-divergent-duplicate';
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* Criteria-independent classification of every registry row (T12324).
|
|
1392
|
+
*
|
|
1393
|
+
* Categories overlap (a missing temp dir counts in both); `stale` is their
|
|
1394
|
+
* union and `retained` its complement.
|
|
1395
|
+
*/
|
|
1396
|
+
export interface NexusRegistryClassification {
|
|
1397
|
+
/** Registry rows scanned. */
|
|
1398
|
+
total: number;
|
|
1399
|
+
/** Rows whose `project_path` no longer exists on disk. */
|
|
1400
|
+
missingPath: number;
|
|
1401
|
+
/** Rows under a `.temp/` segment or the OS temp directory. */
|
|
1402
|
+
tempPath: number;
|
|
1403
|
+
/** Rows with a tmp/test(s)/__tests__/fixture(s)/scratch/sandbox path segment. */
|
|
1404
|
+
testPath: number;
|
|
1405
|
+
/** Rows in at least one of the categories above. */
|
|
1406
|
+
stale: number;
|
|
1407
|
+
/** Rows in none of the categories above. */
|
|
1408
|
+
retained: number;
|
|
1409
|
+
/** Rows in `nexus_project_id_aliases`. */
|
|
1410
|
+
aliases: number;
|
|
1411
|
+
/** Alias rows whose canonical project no longer has a registry row. */
|
|
1412
|
+
orphanAliases: number;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
/** One registry row removed by `nexus.projects.clean` (T12324). */
|
|
1416
|
+
export interface NexusProjectsCleanRemoval {
|
|
1417
|
+
/** Immutable registry project ID. */
|
|
1418
|
+
projectId: string;
|
|
1419
|
+
/** Registered project path. */
|
|
1420
|
+
projectPath: string;
|
|
1421
|
+
/** Every criterion the row matched. */
|
|
1422
|
+
reasons: NexusProjectsCleanReason[];
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
/** Durable record of an applied `nexus.projects.clean` (T12324). */
|
|
1426
|
+
export interface NexusProjectsCleanReceipt {
|
|
1427
|
+
/** `nexus_audit_log.id` written in the same transaction as the deletes. */
|
|
1428
|
+
auditId: string;
|
|
1429
|
+
/** Global store the rows were removed from. */
|
|
1430
|
+
storePath: string;
|
|
1431
|
+
/** Every removed registry row. */
|
|
1432
|
+
removed: NexusProjectsCleanRemoval[];
|
|
1433
|
+
/** Alias rows removed because their project row was removed. */
|
|
1434
|
+
aliasesRemoved: number;
|
|
1435
|
+
/** Pre-existing orphan alias rows swept in the same transaction. */
|
|
1436
|
+
orphanAliasesRemoved: number;
|
|
1437
|
+
/** Global store size before/after VACUUM, when `vacuum` was requested. */
|
|
1438
|
+
vacuum?: { beforeBytes: number; afterBytes: number };
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1365
1441
|
/** Result of `nexus.projects.clean`. */
|
|
1366
1442
|
export interface NexusProjectsCleanResult {
|
|
1367
1443
|
/** Whether this was a dry-run (no deletions performed). */
|
|
@@ -1382,6 +1458,12 @@ export interface NexusProjectsCleanResult {
|
|
|
1382
1458
|
fsFailed?: number;
|
|
1383
1459
|
/** Bytes freed by VACUUM when `vacuum` is set (T9117). */
|
|
1384
1460
|
vacuumBytesFreed?: number;
|
|
1461
|
+
/** Classification of every registry row, independent of criteria (T12324). */
|
|
1462
|
+
classification: NexusRegistryClassification;
|
|
1463
|
+
/** Matched-row counts per criterion; a row matching several counts in each (T12324). */
|
|
1464
|
+
matchedByReason: Partial<Record<NexusProjectsCleanReason, number>>;
|
|
1465
|
+
/** Receipt of the applied removal; absent on dry-run or when nothing matched (T12324). */
|
|
1466
|
+
receipt?: NexusProjectsCleanReceipt;
|
|
1385
1467
|
}
|
|
1386
1468
|
|
|
1387
1469
|
/** Parameters for `nexus.refresh-bridge`. */
|