@cleocode/contracts 2026.9.8 → 2026.9.10
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/__tests__/acceptance-gate.test.js +242 -1
- package/dist/__tests__/acceptance-gate.test.js.map +1 -1
- package/dist/__tests__/evidence-atom-schema.test.js +17 -14
- package/dist/__tests__/evidence-atom-schema.test.js.map +1 -1
- package/dist/__tests__/memory-wire-shapes.test.js.map +1 -1
- package/dist/__tests__/operations-registry.test.js +18 -0
- package/dist/__tests__/operations-registry.test.js.map +1 -1
- package/dist/acceptance-gate-schema.d.ts +60 -2
- package/dist/acceptance-gate-schema.d.ts.map +1 -1
- package/dist/acceptance-gate-schema.js +273 -1
- package/dist/acceptance-gate-schema.js.map +1 -1
- package/dist/acceptance-gate.d.ts +133 -11
- package/dist/acceptance-gate.d.ts.map +1 -1
- package/dist/acceptance-gate.js +3 -3
- package/dist/audit.d.ts +71 -2
- package/dist/audit.d.ts.map +1 -1
- package/dist/backup-manifest.d.ts +80 -0
- package/dist/backup-manifest.d.ts.map +1 -1
- package/dist/caamp-markers.d.ts +20 -0
- package/dist/caamp-markers.d.ts.map +1 -1
- package/dist/capabilities.d.ts +282 -0
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/changesets.d.ts +4 -4
- package/dist/code-symbol.d.ts +33 -0
- package/dist/code-symbol.d.ts.map +1 -1
- package/dist/daemon/health.d.ts +3 -3
- package/dist/data-accessor.d.ts +15 -0
- package/dist/data-accessor.d.ts.map +1 -1
- package/dist/data-accessor.js.map +1 -1
- package/dist/dispatch/__tests__/tasks-gateway-crud-ops.test.js +19 -1
- package/dist/dispatch/__tests__/tasks-gateway-crud-ops.test.js.map +1 -1
- package/dist/dispatch/operations-registry.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.js +713 -3
- package/dist/dispatch/operations-registry.js.map +1 -1
- package/dist/docs-taxonomy.d.ts +25 -0
- package/dist/docs-taxonomy.d.ts.map +1 -1
- package/dist/docs-taxonomy.js.map +1 -1
- package/dist/evidence-atom-schema.d.ts +7 -6
- package/dist/evidence-atom-schema.d.ts.map +1 -1
- package/dist/evidence-atom-schema.js +10 -9
- package/dist/evidence-atom-schema.js.map +1 -1
- package/dist/graph.d.ts +283 -2
- package/dist/graph.d.ts.map +1 -1
- package/dist/index.d.ts +8 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/invariants/adr-070-orchestration.d.ts.map +1 -1
- package/dist/invariants/adr-070-orchestration.js +1 -1
- package/dist/invariants/adr-070-orchestration.js.map +1 -1
- package/dist/invariants/adr-073-saga.js +2 -2
- package/dist/invariants/adr-073-saga.js.map +1 -1
- package/dist/jobs.d.ts +329 -3
- package/dist/jobs.d.ts.map +1 -1
- package/dist/knowledge-health.d.ts +695 -0
- package/dist/knowledge-health.d.ts.map +1 -0
- package/dist/knowledge-health.js +8 -0
- package/dist/knowledge-health.js.map +1 -0
- package/dist/llm/catalog-schema.d.ts +4 -4
- package/dist/memory/observe.d.ts +4 -2
- package/dist/memory/observe.d.ts.map +1 -1
- package/dist/memory/search.d.ts +4 -0
- package/dist/memory/search.d.ts.map +1 -1
- package/dist/nexus-living-brain-ops.d.ts +28 -3
- package/dist/nexus-living-brain-ops.d.ts.map +1 -1
- package/dist/nexus-tasks-bridge-ops.d.ts +11 -0
- package/dist/nexus-tasks-bridge-ops.d.ts.map +1 -1
- package/dist/operations/admin.d.ts +10 -4
- package/dist/operations/admin.d.ts.map +1 -1
- package/dist/operations/docs.d.ts +138 -0
- package/dist/operations/docs.d.ts.map +1 -1
- package/dist/operations/docs.js +47 -0
- package/dist/operations/docs.js.map +1 -1
- package/dist/operations/focus.d.ts +7 -0
- package/dist/operations/focus.d.ts.map +1 -1
- package/dist/operations/nexus.d.ts +7 -2
- package/dist/operations/nexus.d.ts.map +1 -1
- package/dist/operations/output-contracts-data.d.ts.map +1 -1
- package/dist/operations/output-contracts-data.js +31 -3
- package/dist/operations/output-contracts-data.js.map +1 -1
- package/dist/operations/research.d.ts +33 -0
- package/dist/operations/research.d.ts.map +1 -1
- package/dist/operations/tasks.d.ts +107 -4
- package/dist/operations/tasks.d.ts.map +1 -1
- package/dist/operations/tasks.js +5 -0
- package/dist/operations/tasks.js.map +1 -1
- package/dist/operations/validate.d.ts +23 -0
- package/dist/operations/validate.d.ts.map +1 -1
- package/dist/package-artifact.d.ts +112 -0
- package/dist/package-artifact.d.ts.map +1 -0
- package/dist/package-artifact.js +8 -0
- package/dist/package-artifact.js.map +1 -0
- package/dist/project-context.d.ts +18 -0
- package/dist/project-context.d.ts.map +1 -1
- package/dist/release/evidence-atoms.d.ts +10 -0
- package/dist/release/evidence-atoms.d.ts.map +1 -1
- package/dist/release/evidence-atoms.js +6 -0
- package/dist/release/evidence-atoms.js.map +1 -1
- package/dist/release/plan.d.ts +6 -6
- package/dist/resource-governor.d.ts +114 -0
- package/dist/resource-governor.d.ts.map +1 -1
- package/dist/resource-governor.js.map +1 -1
- package/dist/supervisor-ipc/messages.d.ts +6 -6
- package/dist/task-record.d.ts +25 -4
- package/dist/task-record.d.ts.map +1 -1
- package/dist/task.d.ts +55 -36
- package/dist/task.d.ts.map +1 -1
- package/dist/task.js.map +1 -1
- package/dist/tasks/archive.d.ts +3 -3
- package/dist/templates/manifest.d.ts +1 -1
- package/dist/workgraph.d.ts +5 -3
- package/dist/workgraph.d.ts.map +1 -1
- package/dist/workgraph.js +19 -0
- package/dist/workgraph.js.map +1 -1
- package/package.json +2 -2
- package/schemas/gate-result.schema.json +350 -1
- package/src/__tests__/__snapshots__/operations-registry.test.ts.snap +1 -1
- package/src/__tests__/acceptance-gate.test.ts +282 -1
- package/src/__tests__/evidence-atom-schema.test.ts +17 -14
- package/src/__tests__/memory-wire-shapes.test.ts +2 -0
- package/src/__tests__/operations-registry.test.ts +26 -0
- package/src/acceptance-gate-schema.ts +320 -14
- package/src/acceptance-gate.ts +144 -11
- package/src/audit.ts +72 -2
- package/src/backup-manifest.ts +88 -0
- package/src/caamp-markers.ts +22 -0
- package/src/capabilities.ts +311 -0
- package/src/code-symbol.ts +37 -0
- package/src/data-accessor.ts +16 -0
- package/src/dispatch/__tests__/tasks-gateway-crud-ops.test.ts +31 -1
- package/src/dispatch/operations-registry.ts +719 -3
- package/src/docs-taxonomy.ts +26 -0
- package/src/evidence-atom-schema.ts +10 -9
- package/src/graph.ts +326 -2
- package/src/index.ts +45 -1
- package/src/invariants/adr-070-orchestration.ts +2 -1
- package/src/invariants/adr-073-saga.ts +2 -2
- package/src/jobs.ts +382 -3
- package/src/knowledge-health.ts +748 -0
- package/src/memory/observe.ts +4 -2
- package/src/memory/search.ts +4 -0
- package/src/nexus-living-brain-ops.ts +34 -3
- package/src/nexus-tasks-bridge-ops.ts +12 -0
- package/src/operations/admin.ts +11 -4
- package/src/operations/docs.ts +153 -0
- package/src/operations/focus.ts +11 -0
- package/src/operations/nexus.ts +7 -1
- package/src/operations/output-contracts-data.ts +33 -3
- package/src/operations/research.ts +36 -0
- package/src/operations/tasks.ts +116 -4
- package/src/operations/validate.ts +24 -0
- package/src/package-artifact.ts +127 -0
- package/src/project-context.ts +19 -0
- package/src/release/evidence-atoms.ts +6 -0
- package/src/resource-governor.ts +132 -0
- package/src/task-record.ts +27 -4
- package/src/task.ts +58 -36
- package/src/workgraph.ts +19 -0
package/src/memory/observe.ts
CHANGED
|
@@ -117,8 +117,10 @@ export interface ObserveBrainParams {
|
|
|
117
117
|
provenanceChain?: string[] | null;
|
|
118
118
|
/**
|
|
119
119
|
* T992: Internal flag — when true, bypasses the verifyAndStore gate.
|
|
120
|
-
* Set
|
|
121
|
-
*
|
|
120
|
+
* Set by storeVerifiedCandidate in extraction-gate.ts to avoid recursion,
|
|
121
|
+
* or by the prepared docs projection executor after authentic canonical
|
|
122
|
+
* source validation. That executor requires its persisted proposal and a
|
|
123
|
+
* current job fence at the actual observation transaction boundary.
|
|
122
124
|
* External callers MUST NOT set this flag.
|
|
123
125
|
*/
|
|
124
126
|
_skipGate?: boolean;
|
package/src/memory/search.ts
CHANGED
|
@@ -30,6 +30,8 @@
|
|
|
30
30
|
* @since SG-ARCH-SOLID Saga T9831 · E-CONTRACTS-FOUNDATION T9832 · T9956 (Phase 0e)
|
|
31
31
|
*/
|
|
32
32
|
export interface BrainCompactHit {
|
|
33
|
+
/** Obsolete decision IDs matching the query whose explicit supersededBy chain resolves to this current hit. */
|
|
34
|
+
matchedHistoricalIds?: string[];
|
|
33
35
|
/** Entry identifier (e.g. `D-arch-001`, `P-feat-042`). */
|
|
34
36
|
id: string;
|
|
35
37
|
/** Source BRAIN table that produced the hit. */
|
|
@@ -70,6 +72,8 @@ export interface BrainCompactHit {
|
|
|
70
72
|
* @since SG-ARCH-SOLID Saga T9831 · E-CONTRACTS-FOUNDATION T9832 · T9956 (Phase 0e)
|
|
71
73
|
*/
|
|
72
74
|
export interface SearchBrainCompactParams {
|
|
75
|
+
/** Explicitly include superseded and invalidated records for historical retrieval. */
|
|
76
|
+
includeHistory?: boolean;
|
|
73
77
|
/** Free-text query (FTS5 + optional vector recall). */
|
|
74
78
|
query: string;
|
|
75
79
|
/** Maximum number of hits to return (caller-bounded). */
|
|
@@ -12,6 +12,13 @@
|
|
|
12
12
|
* @epic T1042
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
import type {
|
|
16
|
+
KnowledgeAuthorityStatus,
|
|
17
|
+
KnowledgeCoverage,
|
|
18
|
+
KnowledgeEvidenceRef,
|
|
19
|
+
KnowledgeRepairFinding,
|
|
20
|
+
} from './knowledge-health.js';
|
|
21
|
+
|
|
15
22
|
// ---------------------------------------------------------------------------
|
|
16
23
|
// Sub-interfaces — each substrate's projection
|
|
17
24
|
// ---------------------------------------------------------------------------
|
|
@@ -59,6 +66,8 @@ export interface NexusContext {
|
|
|
59
66
|
* references a code symbol via one of the cross-substrate edge types.
|
|
60
67
|
*/
|
|
61
68
|
export interface BrainMemoryRef {
|
|
69
|
+
/** Canonical source authority; missing legacy source records remain unverified. */
|
|
70
|
+
authority?: KnowledgeAuthorityStatus;
|
|
62
71
|
/** Brain page node ID (e.g., 'observation:abc123'). */
|
|
63
72
|
nodeId: string;
|
|
64
73
|
/** Node type. */
|
|
@@ -135,6 +144,8 @@ export interface PlasticityMeasure {
|
|
|
135
144
|
* Returned by {@link getSymbolFullContext}.
|
|
136
145
|
*/
|
|
137
146
|
export interface SymbolFullContext {
|
|
147
|
+
/** Evidence coverage; omitted only by legacy producers that have not assessed it. */
|
|
148
|
+
coverage?: KnowledgeCoverage;
|
|
138
149
|
/** Symbol identifier (nexus node ID or name). */
|
|
139
150
|
symbolId: string;
|
|
140
151
|
/** Nexus code graph context: callers, callees, community, process. */
|
|
@@ -157,11 +168,15 @@ export interface SymbolFullContext {
|
|
|
157
168
|
* Returned by {@link getTaskCodeImpact}.
|
|
158
169
|
*/
|
|
159
170
|
export interface TaskCodeImpact {
|
|
171
|
+
/** Unresolved evidence and path interpretations that require caller action. */
|
|
172
|
+
findings?: KnowledgeRepairFinding[];
|
|
173
|
+
/** Evidence coverage, independent of risk; absent legacy coverage is not current. */
|
|
174
|
+
coverage?: KnowledgeCoverage;
|
|
160
175
|
/** Task ID. */
|
|
161
176
|
taskId: string;
|
|
162
|
-
/** Files
|
|
177
|
+
/** Files associated by task metadata, verification, commits, or canonical attachments. */
|
|
163
178
|
files: string[];
|
|
164
|
-
/** Symbols in those files
|
|
179
|
+
/** Symbols in those files; file-level evidence does not prove each symbol changed. */
|
|
165
180
|
symbols: SymbolImpactEntry[];
|
|
166
181
|
/** Aggregate blast radius across all symbols. */
|
|
167
182
|
blastRadius: BlastRadiusSummary;
|
|
@@ -177,6 +192,10 @@ export interface TaskCodeImpact {
|
|
|
177
192
|
* Impact entry for a single symbol in a task's footprint.
|
|
178
193
|
*/
|
|
179
194
|
export interface SymbolImpactEntry {
|
|
195
|
+
/** Precision of the task association, independent of graph impact. */
|
|
196
|
+
precision?: 'file' | 'symbol';
|
|
197
|
+
/** Historical evidence supporting the task association. */
|
|
198
|
+
evidence?: KnowledgeEvidenceRef[];
|
|
180
199
|
/** Nexus node ID. */
|
|
181
200
|
nexusNodeId: string;
|
|
182
201
|
/** Display label. */
|
|
@@ -219,8 +238,12 @@ export interface DecisionRef {
|
|
|
219
238
|
|
|
220
239
|
/**
|
|
221
240
|
* Risk tier for a symbol's impact analysis.
|
|
241
|
+
*
|
|
242
|
+
* UNKNOWN means missing coverage prevents assessment. NONE is reserved for an
|
|
243
|
+
* assessed graph with no detected impact; static analysis cannot prove that all
|
|
244
|
+
* runtime callers have been discovered. UNKNOWN is not an ordinal severity.
|
|
222
245
|
*/
|
|
223
|
-
export type RiskTier = 'NONE' | 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
|
|
246
|
+
export type RiskTier = 'UNKNOWN' | 'NONE' | 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
|
|
224
247
|
|
|
225
248
|
// ---------------------------------------------------------------------------
|
|
226
249
|
// T1069 — Extended Code Reasoning types
|
|
@@ -230,6 +253,8 @@ export type RiskTier = 'NONE' | 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
|
|
|
230
253
|
* A single step in a code reasoning trace chain.
|
|
231
254
|
*/
|
|
232
255
|
export interface ReasonTraceStep {
|
|
256
|
+
/** Authority of the underlying memory source when this is a memory step. */
|
|
257
|
+
authority?: KnowledgeAuthorityStatus;
|
|
233
258
|
/** Step type discriminant. */
|
|
234
259
|
type: 'decision' | 'observation' | 'task' | 'symbol';
|
|
235
260
|
/** ID of this entry (brain ID, task ID, or nexus node ID). */
|
|
@@ -246,6 +271,8 @@ export interface ReasonTraceStep {
|
|
|
246
271
|
* Returned by {@link reasonWhySymbol}.
|
|
247
272
|
*/
|
|
248
273
|
export interface CodeReasonTrace {
|
|
274
|
+
/** Evidence coverage; missing reasoning is distinct from an assessed absence. */
|
|
275
|
+
coverage?: KnowledgeCoverage;
|
|
249
276
|
/** The nexus symbol ID queried. */
|
|
250
277
|
symbolId: string;
|
|
251
278
|
/** Human-readable narrative summarizing the trace. */
|
|
@@ -258,6 +285,8 @@ export interface CodeReasonTrace {
|
|
|
258
285
|
* A brain risk note associated with a symbol change.
|
|
259
286
|
*/
|
|
260
287
|
export interface BrainRiskNote {
|
|
288
|
+
/** Canonical source authority, independent of graph proximity. */
|
|
289
|
+
authority?: KnowledgeAuthorityStatus;
|
|
261
290
|
/** Brain node ID. */
|
|
262
291
|
nodeId: string;
|
|
263
292
|
/** Node type (observation, decision, etc.). */
|
|
@@ -276,6 +305,8 @@ export interface BrainRiskNote {
|
|
|
276
305
|
* Returned by {@link reasonImpactOfChange}.
|
|
277
306
|
*/
|
|
278
307
|
export interface ImpactFullReport {
|
|
308
|
+
/** Evidence coverage, independent of merged risk. */
|
|
309
|
+
coverage?: KnowledgeCoverage;
|
|
279
310
|
/** The nexus symbol ID analyzed. */
|
|
280
311
|
symbolId: string;
|
|
281
312
|
/** Structural blast radius from analyzeImpact BFS. */
|
|
@@ -8,11 +8,15 @@
|
|
|
8
8
|
* @epic T1042
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import type { KnowledgeEvidenceRef } from './knowledge-health.js';
|
|
12
|
+
|
|
11
13
|
/**
|
|
12
14
|
* A single task reference in a symbol context.
|
|
13
15
|
* Used by getTasksForSymbol() reverse-lookup queries.
|
|
14
16
|
*/
|
|
15
17
|
export interface TaskReference {
|
|
18
|
+
/** File association does not prove that this individual symbol changed. */
|
|
19
|
+
precision?: 'file' | 'symbol';
|
|
16
20
|
/** Task ID (e.g., 'T001'). */
|
|
17
21
|
taskId: string;
|
|
18
22
|
/** Display label for the task. */
|
|
@@ -28,6 +32,10 @@ export interface TaskReference {
|
|
|
28
32
|
* Used by getSymbolsForTask() forward-lookup queries.
|
|
29
33
|
*/
|
|
30
34
|
export interface SymbolReference {
|
|
35
|
+
/** File scope means association only, not proof that this symbol changed. */
|
|
36
|
+
precision?: 'file' | 'symbol';
|
|
37
|
+
/** Explicit sources supporting this relationship. */
|
|
38
|
+
evidence?: KnowledgeEvidenceRef[];
|
|
31
39
|
/** Nexus node ID (format: '<filePath>::<name>' or '<filePath>'). */
|
|
32
40
|
nexusNodeId: string;
|
|
33
41
|
/** Display label for the symbol (file path or function name). */
|
|
@@ -46,6 +54,10 @@ export interface SymbolReference {
|
|
|
46
54
|
* Result from linkTaskToSymbols() operation.
|
|
47
55
|
*/
|
|
48
56
|
export interface LinkTaskResult {
|
|
57
|
+
/** Explicit failure state; omitted on successful legacy results. */
|
|
58
|
+
status?: 'complete' | 'failed';
|
|
59
|
+
/** Observable persistence or input failure, when present. */
|
|
60
|
+
reason?: string;
|
|
49
61
|
/** Number of task_touches_symbol edges created or found. */
|
|
50
62
|
linked: number;
|
|
51
63
|
/** Task ID that was linked. */
|
package/src/operations/admin.ts
CHANGED
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
* @see packages/cleo/src/dispatch/domains/admin.ts
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
+
import type { BackgroundJobStatus } from '../jobs.js';
|
|
28
|
+
import type { AcceptanceItem } from '../task.js';
|
|
29
|
+
|
|
27
30
|
// ============================================================================
|
|
28
31
|
// Shared primitive types
|
|
29
32
|
// ============================================================================
|
|
@@ -759,8 +762,8 @@ export interface AdminContextPullResult {
|
|
|
759
762
|
title: string;
|
|
760
763
|
/** Current status. */
|
|
761
764
|
status: string;
|
|
762
|
-
/**
|
|
763
|
-
acceptance:
|
|
765
|
+
/** Canonical literal criteria and typed requirements, without projection loss. */
|
|
766
|
+
acceptance: AcceptanceItem[];
|
|
764
767
|
};
|
|
765
768
|
/** Relevant brain memory hits (up to 5). */
|
|
766
769
|
relevantMemory: AdminContextPullMemoryHit[];
|
|
@@ -1759,10 +1762,14 @@ export interface AdminJobCancelParams {
|
|
|
1759
1762
|
|
|
1760
1763
|
/** Result of `admin.job.cancel`. */
|
|
1761
1764
|
export interface AdminJobCancelResult {
|
|
1762
|
-
/** The job
|
|
1765
|
+
/** The inspected job identity. */
|
|
1763
1766
|
jobId: string;
|
|
1764
|
-
/** Whether
|
|
1767
|
+
/** Whether this call recorded or reaffirmed a request for running work. */
|
|
1768
|
+
cancellationRequested: boolean;
|
|
1769
|
+
/** Whether the executor has acknowledged terminal cancellation. */
|
|
1765
1770
|
cancelled: boolean;
|
|
1771
|
+
/** Persisted lifecycle state observed after the request. */
|
|
1772
|
+
status: BackgroundJobStatus;
|
|
1766
1773
|
}
|
|
1767
1774
|
|
|
1768
1775
|
// ---------------------------------------------------------------------------
|
package/src/operations/docs.ts
CHANGED
|
@@ -30,8 +30,15 @@
|
|
|
30
30
|
* @see packages/contracts/src/operations/index.ts
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
+
import { z } from 'zod';
|
|
33
34
|
import type { AttachmentKind } from '../attachment.js';
|
|
34
35
|
import { BUILTIN_DOC_KIND_VALUES, type BuiltinDocKind } from '../docs-taxonomy.js';
|
|
36
|
+
import type {
|
|
37
|
+
BackgroundJobStatus,
|
|
38
|
+
OperationExecutionContext,
|
|
39
|
+
OperationExecutionIdentity,
|
|
40
|
+
} from '../jobs.js';
|
|
41
|
+
import type { DocAttachmentObservationPayload } from '../memory/observe.js';
|
|
35
42
|
|
|
36
43
|
// ============================================================================
|
|
37
44
|
// Shared Attachment Types (API wire format)
|
|
@@ -464,10 +471,156 @@ export interface DocsAddParams {
|
|
|
464
471
|
strict?: boolean;
|
|
465
472
|
}
|
|
466
473
|
|
|
474
|
+
/** Canonical attachment and owner whose optional projections may be prepared. */
|
|
475
|
+
export interface DocsProjectionSource {
|
|
476
|
+
/** Canonical attachment identity, never synthesized from a missing record. */
|
|
477
|
+
readonly attachmentId: string;
|
|
478
|
+
/** Expected canonical SHA-256; a changed source refuses preparation. */
|
|
479
|
+
readonly sha256: string;
|
|
480
|
+
/** Exact existing owner reference. */
|
|
481
|
+
readonly ownerId: string;
|
|
482
|
+
/** Kind of the referenced owner. */
|
|
483
|
+
readonly ownerType: AttachmentOwnerType;
|
|
484
|
+
/** Human-readable graph label captured before asynchronous work. */
|
|
485
|
+
readonly label: string;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/** Authentic domain inputs stored before any optional document projection executes. */
|
|
489
|
+
export interface DocsProjectionProposal {
|
|
490
|
+
/** Version of the supported deterministic proposal shape. */
|
|
491
|
+
readonly version: 1;
|
|
492
|
+
/** Exact domain operation, independent of the caller's foreground operation. */
|
|
493
|
+
readonly operation: 'docs.projection';
|
|
494
|
+
/** Captured project, root and actor provenance. */
|
|
495
|
+
readonly identity: OperationExecutionIdentity;
|
|
496
|
+
/** Verified canonical source and owner. */
|
|
497
|
+
readonly source: DocsProjectionSource;
|
|
498
|
+
/** Sourced observation payload; preparation does not call a model. */
|
|
499
|
+
readonly observation: DocAttachmentObservationPayload;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/** Strict persisted input validator for the one supported document projection operation. */
|
|
503
|
+
export const DOCS_PROJECTION_PROPOSAL_SCHEMA = z
|
|
504
|
+
.object({
|
|
505
|
+
version: z.literal(1),
|
|
506
|
+
operation: z.literal('docs.projection'),
|
|
507
|
+
identity: z
|
|
508
|
+
.object({
|
|
509
|
+
projectId: z.string().min(1),
|
|
510
|
+
projectRoot: z.string().min(1),
|
|
511
|
+
actor: z.string().min(1),
|
|
512
|
+
operation: z.literal('docs.projection'),
|
|
513
|
+
idempotencyKey: z.string().min(1),
|
|
514
|
+
})
|
|
515
|
+
.strict(),
|
|
516
|
+
source: z
|
|
517
|
+
.object({
|
|
518
|
+
attachmentId: z.string().min(1),
|
|
519
|
+
sha256: z.string().regex(/^[a-f0-9]{64}$/),
|
|
520
|
+
ownerId: z.string().min(1),
|
|
521
|
+
ownerType: z.enum(['task', 'session', 'observation', 'decision', 'learning', 'pattern']),
|
|
522
|
+
label: z.string().min(1),
|
|
523
|
+
})
|
|
524
|
+
.strict(),
|
|
525
|
+
observation: z
|
|
526
|
+
.object({
|
|
527
|
+
kind: z.literal('doc-attachment'),
|
|
528
|
+
attachmentId: z.string().min(1),
|
|
529
|
+
ownerId: z.string().min(1),
|
|
530
|
+
addedAt: z.string().min(1),
|
|
531
|
+
slug: z.string().optional(),
|
|
532
|
+
type: z.string().optional(),
|
|
533
|
+
})
|
|
534
|
+
.strict(),
|
|
535
|
+
})
|
|
536
|
+
.strict() satisfies z.ZodType<DocsProjectionProposal>;
|
|
537
|
+
|
|
538
|
+
/** Verifiable result retained in the existing durable job result column. */
|
|
539
|
+
export const DOCS_PROJECTION_RECEIPT_SCHEMA = z
|
|
540
|
+
.object({
|
|
541
|
+
version: z.literal(1),
|
|
542
|
+
sourceHash: z.string().regex(/^[a-f0-9]{64}$/),
|
|
543
|
+
graph: z.enum(['completed', 'disabled']),
|
|
544
|
+
observationId: z.string().min(1),
|
|
545
|
+
verifiedAt: z.string().min(1),
|
|
546
|
+
actor: z.string().min(1),
|
|
547
|
+
})
|
|
548
|
+
.strict();
|
|
549
|
+
|
|
550
|
+
/** Domain verification record; this is not a cross-database atomic repair receipt. */
|
|
551
|
+
export type DocsProjectionReceipt = z.infer<typeof DOCS_PROJECTION_RECEIPT_SCHEMA>;
|
|
552
|
+
|
|
553
|
+
/** Truthful bounded observation of optional work following an accepted canonical attachment. */
|
|
554
|
+
export interface DocsProjectionOutcome {
|
|
555
|
+
/** Captured project identity, or null when canonical identity could not be read. */
|
|
556
|
+
projectId: string | null;
|
|
557
|
+
/** Captured explicit repository root. */
|
|
558
|
+
projectRoot: string;
|
|
559
|
+
/** Completed verification, resumable pending work, or an observed failure. */
|
|
560
|
+
status: 'completed' | 'pending' | 'failed';
|
|
561
|
+
/** Current proof, incomplete proof, missing preparation or an observed diagnostic failure. */
|
|
562
|
+
coverage: 'current' | 'partial' | 'missing' | 'failed';
|
|
563
|
+
/** Durable pending/claimed job when preparation committed. */
|
|
564
|
+
jobId?: string;
|
|
565
|
+
/** Actual verified receipt when available. */
|
|
566
|
+
receipt?: DocsProjectionReceipt;
|
|
567
|
+
/** Explicit failures or unresolved-outcome details. */
|
|
568
|
+
diagnostics: string[];
|
|
569
|
+
/** Original shared deadline. */
|
|
570
|
+
deadlineAt: number;
|
|
571
|
+
/** True when foreground observation crossed the deadline; no preemption is implied. */
|
|
572
|
+
deadlineExceeded: boolean;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/** Captured maintenance lifetime or an explicit unavailable identity diagnostic. */
|
|
576
|
+
export type DocsProjectionCapture =
|
|
577
|
+
| {
|
|
578
|
+
/** A canonical stable project identity was read successfully. */
|
|
579
|
+
status: 'ready';
|
|
580
|
+
/** Original deadline and cancellation shared by every optional stage. */
|
|
581
|
+
context: OperationExecutionContext;
|
|
582
|
+
}
|
|
583
|
+
| {
|
|
584
|
+
/** No optional work may be admitted under a guessed identity. */
|
|
585
|
+
status: 'unavailable';
|
|
586
|
+
/** Diagnostic returned alongside accepted canonical bytes. */
|
|
587
|
+
outcome: DocsProjectionOutcome;
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
/** Durable preparation result; does not assert that optional projections completed. */
|
|
591
|
+
export interface DocsProjectionPreparation {
|
|
592
|
+
/** Existing durable job identity for explicit inspection and later execution. */
|
|
593
|
+
jobId: string;
|
|
594
|
+
/** Hash of the exact persisted proposal JSON bytes. */
|
|
595
|
+
proposalHash: string;
|
|
596
|
+
/** Owning project identity captured before asynchronous work. */
|
|
597
|
+
projectId: string;
|
|
598
|
+
/** Captured root used for canonical validation and pending storage. */
|
|
599
|
+
projectRoot: string;
|
|
600
|
+
/** Observed persisted lifecycle; preparation never schedules an executor. */
|
|
601
|
+
jobStatus: BackgroundJobStatus;
|
|
602
|
+
/** Absolute caller deadline, shared rather than reset by this stage. */
|
|
603
|
+
deadlineAt: number;
|
|
604
|
+
/** True if synchronous persistence returned after its admission deadline. */
|
|
605
|
+
deadlineExceeded: boolean;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/** Successful or policy-disabled optional graph projection of a canonical document. */
|
|
609
|
+
export interface DocsGraphProjectionResult {
|
|
610
|
+
/** Explicit policy outcome; failures are not represented as successful completion. */
|
|
611
|
+
status: 'completed' | 'disabled';
|
|
612
|
+
/** Captured project identity owning the graph. */
|
|
613
|
+
projectId: string;
|
|
614
|
+
/** Captured absolute repository root used for all graph writes. */
|
|
615
|
+
projectRoot: string;
|
|
616
|
+
}
|
|
617
|
+
|
|
467
618
|
/**
|
|
468
619
|
* Result of `docs.add`.
|
|
469
620
|
*/
|
|
470
621
|
export interface DocsAddResult {
|
|
622
|
+
/** Optional projection coverage; canonical attachment acceptance remains independent. */
|
|
623
|
+
projection?: DocsProjectionOutcome;
|
|
471
624
|
/** Newly-created or existing attachment ID. */
|
|
472
625
|
attachmentId: string;
|
|
473
626
|
/** SHA-256 hash of the attached content. */
|
package/src/operations/focus.ts
CHANGED
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
* @epic T9964 E-ORIENT-V2
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
import type {
|
|
16
|
+
KnowledgeCoverage,
|
|
17
|
+
KnowledgeDiagnostic,
|
|
18
|
+
KnowledgeHealth,
|
|
19
|
+
} from '../knowledge-health.js';
|
|
15
20
|
import type { MviDigest } from '../mvi.js';
|
|
16
21
|
import type { AttentionScopeKind } from './attention.js';
|
|
17
22
|
import type { MemoryCompactHit } from './memory.js';
|
|
@@ -188,6 +193,12 @@ export interface FocusBrainContext {
|
|
|
188
193
|
* @epic T9964
|
|
189
194
|
*/
|
|
190
195
|
export interface FocusShowResult {
|
|
196
|
+
/** Assessed graph coverage; absence on legacy responses is not healthy coverage. */
|
|
197
|
+
coverage?: KnowledgeCoverage;
|
|
198
|
+
/** Bounded deterministic maintenance and sourced repair findings for the foreground caller. */
|
|
199
|
+
knowledgeHealth?: KnowledgeHealth;
|
|
200
|
+
/** Failed auxiliary reads are distinct from successfully empty sources. */
|
|
201
|
+
sourceDiagnostics?: Record<string, KnowledgeDiagnostic>;
|
|
191
202
|
/** Core identity of the focused entity. */
|
|
192
203
|
identity: FocusIdentity;
|
|
193
204
|
/** Scope hierarchy (saga → epic → task) derived from ancestry. */
|
package/src/operations/nexus.ts
CHANGED
|
@@ -20,12 +20,14 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
// API contract result types (T1065)
|
|
23
|
+
import type { KnowledgeCoverage } from '../knowledge-health.js';
|
|
23
24
|
import type { ContractCompatibilityMatrix } from '../nexus-contract-ops.js';
|
|
24
25
|
// Living-brain result types (T1068)
|
|
25
26
|
import type {
|
|
26
27
|
CodeAnchorResult,
|
|
27
28
|
CodeReasonTrace,
|
|
28
29
|
ImpactFullReport,
|
|
30
|
+
RiskTier,
|
|
29
31
|
SymbolFullContext,
|
|
30
32
|
TaskCodeImpact,
|
|
31
33
|
} from '../nexus-living-brain-ops.js';
|
|
@@ -860,6 +862,8 @@ export interface NexusImpactAffectedNode {
|
|
|
860
862
|
}
|
|
861
863
|
/** Result of `nexus.impact`. */
|
|
862
864
|
export interface NexusImpactResult {
|
|
865
|
+
/** Evidence coverage assessed independently of impact severity. */
|
|
866
|
+
coverage?: KnowledgeCoverage;
|
|
863
867
|
/** Original symbol query string. */
|
|
864
868
|
query: string;
|
|
865
869
|
/** Project ID the analysis ran against. */
|
|
@@ -871,7 +875,7 @@ export interface NexusImpactResult {
|
|
|
871
875
|
/** Whether `why` reasons were requested and populated. */
|
|
872
876
|
why: boolean;
|
|
873
877
|
/** Risk tier based on totalImpact count. */
|
|
874
|
-
riskLevel:
|
|
878
|
+
riskLevel: RiskTier;
|
|
875
879
|
/** Total affected symbols across all depths (excludes the target itself). */
|
|
876
880
|
totalImpact: number;
|
|
877
881
|
/** Maximum traversal depth applied. */
|
|
@@ -1038,6 +1042,8 @@ export interface NexusTaskSymbolsParams {
|
|
|
1038
1042
|
}
|
|
1039
1043
|
/** Result of `nexus.task-symbols`. */
|
|
1040
1044
|
export interface NexusTaskSymbolsResult {
|
|
1045
|
+
/** Coverage and unresolved evidence, independent of the number of matches. */
|
|
1046
|
+
coverage?: KnowledgeCoverage;
|
|
1041
1047
|
/** Task ID that was queried. */
|
|
1042
1048
|
taskId: string;
|
|
1043
1049
|
/** Count of symbols found. */
|
|
@@ -144,12 +144,28 @@ const tasksShowOutputContract: OperationOutputContract = {
|
|
|
144
144
|
*
|
|
145
145
|
* Grounded in {@link TasksListResult}: `{ tasks: TaskOp[], total, filtered }`.
|
|
146
146
|
*/
|
|
147
|
+
const taskPopulationSchema = {
|
|
148
|
+
type: 'object',
|
|
149
|
+
required: ['matched', 'returned', 'truncated', 'archive', 'limit', 'offset'],
|
|
150
|
+
properties: {
|
|
151
|
+
matched: { type: 'number', description: 'All rows matching the query before pagination.' },
|
|
152
|
+
returned: {
|
|
153
|
+
type: 'number',
|
|
154
|
+
description: 'Rows present in this response; also --output count.',
|
|
155
|
+
},
|
|
156
|
+
truncated: { type: 'boolean', description: 'Matching rows are omitted by this page.' },
|
|
157
|
+
archive: { type: 'string', enum: ['included', 'excluded', 'only'] },
|
|
158
|
+
limit: { type: ['number', 'null'] },
|
|
159
|
+
offset: { type: 'number' },
|
|
160
|
+
},
|
|
161
|
+
} as const;
|
|
162
|
+
|
|
147
163
|
const tasksListOutputContract: OperationOutputContract = {
|
|
148
164
|
operation: 'tasks.list',
|
|
149
165
|
shapeNote: 'Rows are under /data/tasks (an array); counts are /data/total and /data/filtered.',
|
|
150
166
|
dataSchema: {
|
|
151
167
|
type: 'object',
|
|
152
|
-
required: ['tasks', 'total', 'filtered'],
|
|
168
|
+
required: ['tasks', 'total', 'filtered', 'population'],
|
|
153
169
|
additionalProperties: true,
|
|
154
170
|
properties: {
|
|
155
171
|
tasks: {
|
|
@@ -166,6 +182,7 @@ const tasksListOutputContract: OperationOutputContract = {
|
|
|
166
182
|
},
|
|
167
183
|
total: { type: 'number', description: 'Total tasks before filtering.' },
|
|
168
184
|
filtered: { type: 'number', description: 'Number of tasks after filters applied.' },
|
|
185
|
+
population: taskPopulationSchema,
|
|
169
186
|
},
|
|
170
187
|
},
|
|
171
188
|
fieldPointers: [
|
|
@@ -174,6 +191,9 @@ const tasksListOutputContract: OperationOutputContract = {
|
|
|
174
191
|
'/data/tasks/0/status',
|
|
175
192
|
'/data/total',
|
|
176
193
|
'/data/filtered',
|
|
194
|
+
'/data/population/matched',
|
|
195
|
+
'/data/population/returned',
|
|
196
|
+
'/data/population/archive',
|
|
177
197
|
],
|
|
178
198
|
};
|
|
179
199
|
|
|
@@ -198,7 +218,7 @@ const tasksFindOutputContract: OperationOutputContract = {
|
|
|
198
218
|
'Use /data/results/0/id — NOT /data/0/id.',
|
|
199
219
|
dataSchema: {
|
|
200
220
|
type: 'object',
|
|
201
|
-
required: ['results', 'total'],
|
|
221
|
+
required: ['results', 'total', 'population'],
|
|
202
222
|
additionalProperties: true,
|
|
203
223
|
properties: {
|
|
204
224
|
results: {
|
|
@@ -215,15 +235,25 @@ const tasksFindOutputContract: OperationOutputContract = {
|
|
|
215
235
|
},
|
|
216
236
|
},
|
|
217
237
|
total: { type: 'number', description: 'Total matching tasks.' },
|
|
238
|
+
population: taskPopulationSchema,
|
|
218
239
|
query: { type: 'string', description: 'The query string that was searched.' },
|
|
219
|
-
searchType: {
|
|
240
|
+
searchType: {
|
|
241
|
+
type: 'string',
|
|
242
|
+
description:
|
|
243
|
+
'Requested matching mode: lexical (default), fuzzy (explicit opt-in), exact, id, or filter.',
|
|
244
|
+
},
|
|
220
245
|
},
|
|
221
246
|
},
|
|
222
247
|
fieldPointers: [
|
|
223
248
|
'/data/results/0/id',
|
|
224
249
|
'/data/results/0/title',
|
|
225
250
|
'/data/results/0/status',
|
|
251
|
+
'/data/results/0/match',
|
|
252
|
+
'/data/searchType',
|
|
226
253
|
'/data/total',
|
|
254
|
+
'/data/population/matched',
|
|
255
|
+
'/data/population/returned',
|
|
256
|
+
'/data/population/archive',
|
|
227
257
|
],
|
|
228
258
|
};
|
|
229
259
|
|
|
@@ -154,3 +154,39 @@ export interface ResearchManifestArchiveResult {
|
|
|
154
154
|
entryIds: string[];
|
|
155
155
|
filesMovedCount?: number;
|
|
156
156
|
}
|
|
157
|
+
|
|
158
|
+
/** Physical manifest table contributing authentic stored evidence.
|
|
159
|
+
* @remarks Table identity does not imply scientific or decision authority.
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* const table: ManifestStorageTable = 'docs_pipeline_manifest';
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export type ManifestStorageTable = 'docs_pipeline_manifest' | 'pipeline_manifest';
|
|
166
|
+
|
|
167
|
+
/** Physical provenance of a manifest read; multiple tables imply identical stored payloads.
|
|
168
|
+
* @remarks Database identity is observed on the captured project binding; tables are not inferred from recency.
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* const source: ManifestStorageProvenance = { databasePath: '/project/.cleo/cleo.db', tables: ['docs_pipeline_manifest'] };
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
export interface ManifestStorageProvenance {
|
|
175
|
+
/** Absolute path of the canonical project database actually read. */
|
|
176
|
+
databasePath: string;
|
|
177
|
+
/** Tables containing byte-equivalent persisted rows, modern first. */
|
|
178
|
+
tables: ManifestStorageTable[];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Existing manifest data augmented with its storage provenance.
|
|
182
|
+
* @typeParam T - Existing row or public entry contract.
|
|
183
|
+
* @remarks Adds provenance without replacing the existing manifest result fields.
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* type SourcedEntry = ManifestWithProvenance<ManifestEntry>;
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
export type ManifestWithProvenance<T> = T & {
|
|
190
|
+
/** Observed physical storage sources; never an authority ranking. */
|
|
191
|
+
provenance: ManifestStorageProvenance;
|
|
192
|
+
};
|