principles-disciple 1.7.6 → 1.7.8

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 (106) hide show
  1. package/dist/commands/context.js +5 -15
  2. package/dist/commands/evolution-status.js +2 -9
  3. package/dist/commands/export.js +61 -8
  4. package/dist/commands/nocturnal-review.d.ts +24 -0
  5. package/dist/commands/nocturnal-review.js +265 -0
  6. package/dist/commands/nocturnal-rollout.d.ts +27 -0
  7. package/dist/commands/nocturnal-rollout.js +671 -0
  8. package/dist/commands/nocturnal-train.d.ts +25 -0
  9. package/dist/commands/nocturnal-train.js +919 -0
  10. package/dist/commands/pain.js +8 -21
  11. package/dist/constants/tools.d.ts +2 -2
  12. package/dist/constants/tools.js +1 -1
  13. package/dist/core/adaptive-thresholds.d.ts +186 -0
  14. package/dist/core/adaptive-thresholds.js +300 -0
  15. package/dist/core/config.d.ts +2 -38
  16. package/dist/core/config.js +6 -61
  17. package/dist/core/event-log.d.ts +1 -2
  18. package/dist/core/event-log.js +0 -3
  19. package/dist/core/evolution-engine.js +1 -21
  20. package/dist/core/evolution-reducer.d.ts +7 -1
  21. package/dist/core/evolution-reducer.js +56 -4
  22. package/dist/core/evolution-types.d.ts +61 -9
  23. package/dist/core/evolution-types.js +31 -9
  24. package/dist/core/external-training-contract.d.ts +276 -0
  25. package/dist/core/external-training-contract.js +269 -0
  26. package/dist/core/local-worker-routing.d.ts +175 -0
  27. package/dist/core/local-worker-routing.js +525 -0
  28. package/dist/core/model-deployment-registry.d.ts +218 -0
  29. package/dist/core/model-deployment-registry.js +503 -0
  30. package/dist/core/model-training-registry.d.ts +295 -0
  31. package/dist/core/model-training-registry.js +475 -0
  32. package/dist/core/nocturnal-arbiter.d.ts +159 -0
  33. package/dist/core/nocturnal-arbiter.js +534 -0
  34. package/dist/core/nocturnal-candidate-scoring.d.ts +137 -0
  35. package/dist/core/nocturnal-candidate-scoring.js +266 -0
  36. package/dist/core/nocturnal-compliance.d.ts +175 -0
  37. package/dist/core/nocturnal-compliance.js +824 -0
  38. package/dist/core/nocturnal-dataset.d.ts +224 -0
  39. package/dist/core/nocturnal-dataset.js +443 -0
  40. package/dist/core/nocturnal-executability.d.ts +85 -0
  41. package/dist/core/nocturnal-executability.js +331 -0
  42. package/dist/core/nocturnal-export.d.ts +124 -0
  43. package/dist/core/nocturnal-export.js +275 -0
  44. package/dist/core/nocturnal-paths.d.ts +124 -0
  45. package/dist/core/nocturnal-paths.js +214 -0
  46. package/dist/core/nocturnal-trajectory-extractor.d.ts +242 -0
  47. package/dist/core/nocturnal-trajectory-extractor.js +307 -0
  48. package/dist/core/nocturnal-trinity.d.ts +311 -0
  49. package/dist/core/nocturnal-trinity.js +880 -0
  50. package/dist/core/paths.d.ts +6 -0
  51. package/dist/core/paths.js +6 -0
  52. package/dist/core/principle-training-state.d.ts +121 -0
  53. package/dist/core/principle-training-state.js +321 -0
  54. package/dist/core/promotion-gate.d.ts +238 -0
  55. package/dist/core/promotion-gate.js +529 -0
  56. package/dist/core/session-tracker.d.ts +10 -0
  57. package/dist/core/session-tracker.js +14 -0
  58. package/dist/core/shadow-observation-registry.d.ts +217 -0
  59. package/dist/core/shadow-observation-registry.js +308 -0
  60. package/dist/core/training-program.d.ts +233 -0
  61. package/dist/core/training-program.js +433 -0
  62. package/dist/core/trajectory.d.ts +95 -1
  63. package/dist/core/trajectory.js +220 -6
  64. package/dist/core/workspace-context.d.ts +0 -6
  65. package/dist/core/workspace-context.js +0 -12
  66. package/dist/hooks/bash-risk.d.ts +6 -6
  67. package/dist/hooks/bash-risk.js +8 -8
  68. package/dist/hooks/gate-block-helper.js +1 -1
  69. package/dist/hooks/gate.d.ts +1 -1
  70. package/dist/hooks/gate.js +2 -2
  71. package/dist/hooks/gfi-gate.d.ts +3 -3
  72. package/dist/hooks/gfi-gate.js +15 -14
  73. package/dist/hooks/pain.js +6 -9
  74. package/dist/hooks/progressive-trust-gate.d.ts +21 -49
  75. package/dist/hooks/progressive-trust-gate.js +51 -204
  76. package/dist/hooks/prompt.d.ts +11 -11
  77. package/dist/hooks/prompt.js +158 -72
  78. package/dist/hooks/subagent.js +43 -6
  79. package/dist/i18n/commands.js +8 -8
  80. package/dist/index.js +129 -28
  81. package/dist/service/evolution-worker.d.ts +42 -4
  82. package/dist/service/evolution-worker.js +321 -13
  83. package/dist/service/nocturnal-runtime.d.ts +183 -0
  84. package/dist/service/nocturnal-runtime.js +352 -0
  85. package/dist/service/nocturnal-service.d.ts +163 -0
  86. package/dist/service/nocturnal-service.js +787 -0
  87. package/dist/service/nocturnal-target-selector.d.ts +145 -0
  88. package/dist/service/nocturnal-target-selector.js +315 -0
  89. package/dist/service/phase3-input-filter.d.ts +2 -23
  90. package/dist/service/phase3-input-filter.js +3 -27
  91. package/dist/service/runtime-summary-service.d.ts +0 -10
  92. package/dist/service/runtime-summary-service.js +1 -54
  93. package/dist/tools/deep-reflect.js +2 -1
  94. package/dist/types/event-types.d.ts +2 -10
  95. package/dist/types/runtime-summary.d.ts +1 -8
  96. package/dist/types.d.ts +0 -3
  97. package/dist/types.js +0 -2
  98. package/openclaw.plugin.json +1 -1
  99. package/package.json +1 -1
  100. package/templates/langs/en/skills/pd-mentor/SKILL.md +5 -5
  101. package/templates/langs/zh/skills/pd-mentor/SKILL.md +5 -5
  102. package/templates/pain_settings.json +0 -6
  103. package/dist/commands/trust.d.ts +0 -4
  104. package/dist/commands/trust.js +0 -78
  105. package/dist/core/trust-engine.d.ts +0 -96
  106. package/dist/core/trust-engine.js +0 -286
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Nocturnal Executability Checker — Bounded Action Validation
3
+ * =========================================================
4
+ *
5
+ * PURPOSE: Validate that a reflection artifact's suggestions are actually
6
+ * executable — i.e., they describe bounded, concrete actions rather than
7
+ * vague platitudes or impossible feats.
8
+ *
9
+ * EXECUTABILITY CRITERIA:
10
+ * 1. next-step is a bounded action (not a vague improvement)
11
+ * 2. No references to non-existent tools
12
+ * 3. No references to impossible/implied actions
13
+ * 4. The suggestion can be translated into a tool call
14
+ *
15
+ * DESIGN CONSTRAINTS:
16
+ * - Pure functions only — no I/O, no side effects
17
+ * - Deterministic — same input always produces same output
18
+ * - Fail closed — non-executable suggestions are rejected
19
+ * - No LLM involvement — all checks are algorithmic
20
+ */
21
+ /**
22
+ * A bounded action that could be translated to a tool call.
23
+ */
24
+ export interface BoundedAction {
25
+ /** The action verb (e.g., 'read', 'edit', 'check') */
26
+ verb: string;
27
+ /** The target of the action (e.g., 'src/main.ts', 'documentation') */
28
+ target: string;
29
+ /** The full suggestion text */
30
+ fullText: string;
31
+ }
32
+ /**
33
+ * Executability validation failure.
34
+ */
35
+ export interface ExecutabilityFailure {
36
+ reason: string;
37
+ field: 'badDecision' | 'betterDecision';
38
+ }
39
+ /**
40
+ * Result of executability validation.
41
+ */
42
+ export interface ExecutabilityResult {
43
+ /** Whether the suggestion passed executability checks */
44
+ executable: boolean;
45
+ /** Parsed bounded action from betterDecision (if executable) */
46
+ boundedAction?: BoundedAction;
47
+ /** Failure reasons (if not executable) */
48
+ failures: ExecutabilityFailure[];
49
+ }
50
+ /**
51
+ * Validate that a reflection artifact's suggestions are executable.
52
+ *
53
+ * @param artifact - The validated artifact from arbiter (passed = true)
54
+ * @returns ExecutabilityResult
55
+ */
56
+ export declare function validateExecutability(artifact: {
57
+ badDecision: string;
58
+ betterDecision: string;
59
+ }): ExecutabilityResult;
60
+ /**
61
+ * Combined arbiter + executability check.
62
+ *
63
+ * @param rawJson - Raw JSON string from reflector
64
+ * @param options - Expected values for cross-validation
65
+ * @returns Combined result with all failure reasons
66
+ */
67
+ export interface CombinedValidationResult {
68
+ approved: boolean;
69
+ artifact?: {
70
+ artifactId: string;
71
+ sessionId: string;
72
+ principleId: string;
73
+ sourceSnapshotRef: string;
74
+ badDecision: string;
75
+ betterDecision: string;
76
+ rationale: string;
77
+ createdAt: string;
78
+ boundedAction?: BoundedAction;
79
+ };
80
+ failures: string[];
81
+ }
82
+ export declare function validateForApproval(rawJson: string, options?: {
83
+ expectedPrincipleId?: string;
84
+ expectedSessionId?: string;
85
+ }): CombinedValidationResult;
@@ -0,0 +1,331 @@
1
+ /**
2
+ * Nocturnal Executability Checker — Bounded Action Validation
3
+ * =========================================================
4
+ *
5
+ * PURPOSE: Validate that a reflection artifact's suggestions are actually
6
+ * executable — i.e., they describe bounded, concrete actions rather than
7
+ * vague platitudes or impossible feats.
8
+ *
9
+ * EXECUTABILITY CRITERIA:
10
+ * 1. next-step is a bounded action (not a vague improvement)
11
+ * 2. No references to non-existent tools
12
+ * 3. No references to impossible/implied actions
13
+ * 4. The suggestion can be translated into a tool call
14
+ *
15
+ * DESIGN CONSTRAINTS:
16
+ * - Pure functions only — no I/O, no side effects
17
+ * - Deterministic — same input always produces same output
18
+ * - Fail closed — non-executable suggestions are rejected
19
+ * - No LLM involvement — all checks are algorithmic
20
+ */
21
+ import { parseAndValidateArtifact } from './nocturnal-arbiter.js';
22
+ // ---------------------------------------------------------------------------
23
+ // Constants
24
+ // ---------------------------------------------------------------------------
25
+ /**
26
+ * Known tool verbs that map to bounded actions.
27
+ * These are the only verbs that can be translated to tool calls.
28
+ */
29
+ const BOUNDED_TOOL_VERBS = new Set([
30
+ 'read',
31
+ 'edit',
32
+ 'write',
33
+ 'create',
34
+ 'delete',
35
+ 'check',
36
+ 'verify',
37
+ 'test',
38
+ 'run',
39
+ 'execute',
40
+ 'install',
41
+ 'search',
42
+ 'grep',
43
+ 'find',
44
+ 'list',
45
+ 'review',
46
+ 'examine',
47
+ 'inspect',
48
+ 'look',
49
+ 'view',
50
+ 'open',
51
+ 'close',
52
+ 'save',
53
+ 'commit',
54
+ 'push',
55
+ 'pull',
56
+ 'fetch',
57
+ 'merge',
58
+ 'diff',
59
+ 'analyze',
60
+ 'diagnose',
61
+ 'debug',
62
+ 'trace',
63
+ ]);
64
+ /**
65
+ * Vague verbs that cannot be translated to bounded tool calls.
66
+ */
67
+ const VAGUE_VERBS = new Set([
68
+ 'understand',
69
+ 'learn',
70
+ 'improve',
71
+ 'better',
72
+ 'fix',
73
+ 'handle',
74
+ 'manage',
75
+ 'work',
76
+ 'do',
77
+ 'make',
78
+ 'get',
79
+ 'got',
80
+ 'ensure',
81
+ 'ensure that',
82
+ 'be',
83
+ 'consider',
84
+ 'think',
85
+ 'reflect',
86
+ 'analyze',
87
+ 'evaluate',
88
+ 'review', // borderline - sometimes acceptable
89
+ 'help',
90
+ 'support',
91
+ 'provide',
92
+ 'offer',
93
+ 'give',
94
+ 'take',
95
+ 'use',
96
+ 'try',
97
+ 'attempt',
98
+ 'start',
99
+ 'begin',
100
+ 'continue',
101
+ 'proceed',
102
+ 'finish',
103
+ 'complete',
104
+ 'end',
105
+ 'stop',
106
+ 'avoid',
107
+ 'prevent',
108
+ 'reduce',
109
+ 'minimize',
110
+ 'maximize',
111
+ 'optimize',
112
+ 'enhance',
113
+ 'strengthen',
114
+ 'develop',
115
+ 'grow',
116
+ 'build',
117
+ 'establish',
118
+ 'create', // borderline - sometimes acceptable
119
+ 'implement',
120
+ 'deploy',
121
+ 'launch',
122
+ ]);
123
+ /**
124
+ * Patterns that indicate vague/hollow格言 (not a decision-point).
125
+ */
126
+ const HOLLOW_PATTERNS = [
127
+ /always be careful/i,
128
+ /always be mindful/i,
129
+ /always think before acting/i,
130
+ /don't rush/i,
131
+ /take your time/i,
132
+ /be patient/i,
133
+ /be careful/i,
134
+ /be more careful/i,
135
+ /be mindful/i,
136
+ /work smarter/i,
137
+ /be more effective/i,
138
+ /be better/i,
139
+ /good practice/i,
140
+ /best practice/i,
141
+ /should be careful/i,
142
+ /need to be more/i,
143
+ /should have been more/i,
144
+ ];
145
+ // ---------------------------------------------------------------------------
146
+ // Parsing
147
+ // ---------------------------------------------------------------------------
148
+ /**
149
+ * Attempt to parse a suggestion into a bounded action.
150
+ *
151
+ * Looks for patterns like:
152
+ * - "Read X before doing Y"
153
+ * - "Check X first"
154
+ * - "Verify Y"
155
+ * - "Edit X to do Z"
156
+ */
157
+ function parseBoundedAction(text) {
158
+ const trimmed = text.trim();
159
+ const lower = trimmed.toLowerCase();
160
+ // Pattern: "Read/Check/Verify X" or "X. Read/Check/Verify Y"
161
+ const boundedPattern = /^([A-Za-z]+)\s+(?:the\s+)?([^\s.,]+(?:\s+[^\s.,]+){0,5})/i;
162
+ const match = trimmed.match(boundedPattern);
163
+ if (match) {
164
+ const verb = match[1].toLowerCase();
165
+ const target = match[2].trim();
166
+ if (BOUNDED_TOOL_VERBS.has(verb) && target.length > 0) {
167
+ return { verb, target, fullText: trimmed };
168
+ }
169
+ }
170
+ // Pattern: "[Verb] the [target]" — e.g., "read the file"
171
+ const thePattern = /^(read|check|verify|edit|write|delete|search|grep|look|examine|inspect|review)\s+(?:the\s+)?(.+)/i;
172
+ const theMatch = lower.match(thePattern);
173
+ if (theMatch) {
174
+ return { verb: theMatch[1], target: theMatch[2].trim(), fullText: trimmed };
175
+ }
176
+ return null;
177
+ }
178
+ // ---------------------------------------------------------------------------
179
+ // Core Validation
180
+ // ---------------------------------------------------------------------------
181
+ /**
182
+ * Check if a text contains a hollow格言 pattern.
183
+ */
184
+ function containsHollowPattern(text) {
185
+ return HOLLOW_PATTERNS.some((p) => p.test(text));
186
+ }
187
+ /**
188
+ * Check if a text contains vague verbs that cannot be executed.
189
+ */
190
+ function containsVagueVerb(text) {
191
+ const lower = text.toLowerCase();
192
+ // Check if the text STARTS with a vague verb (most indicative of non-executable)
193
+ for (const vagueVerb of VAGUE_VERBS) {
194
+ if (lower.startsWith(vagueVerb + ' ') || lower.startsWith(vagueVerb + 's ')) {
195
+ return true;
196
+ }
197
+ }
198
+ return false;
199
+ }
200
+ /**
201
+ * Check if a text is too generic to be actionable.
202
+ */
203
+ function isTooGeneric(text) {
204
+ const lower = text.toLowerCase();
205
+ // Very short suggestions are often too generic
206
+ if (text.trim().length < 15)
207
+ return true;
208
+ // Check for generic patterns
209
+ if (/^[^,]*,?\s*(not|never|no\b|don't|don't|shouldn't|cannot|can't)/i.test(lower)) {
210
+ // This is actually a negative constraint, not an action
211
+ return true;
212
+ }
213
+ if (/\bthen\b/i.test(lower) && lower.split(/\bthen\b/i).length > 4) {
214
+ // Multi-step vague instruction (5 or more "then" words)
215
+ return true;
216
+ }
217
+ return false;
218
+ }
219
+ // ---------------------------------------------------------------------------
220
+ // Main Validator
221
+ // ---------------------------------------------------------------------------
222
+ /**
223
+ * Validate that a reflection artifact's suggestions are executable.
224
+ *
225
+ * @param artifact - The validated artifact from arbiter (passed = true)
226
+ * @returns ExecutabilityResult
227
+ */
228
+ export function validateExecutability(artifact) {
229
+ const failures = [];
230
+ // Check badDecision is not hollow
231
+ if (containsHollowPattern(artifact.badDecision)) {
232
+ failures.push({
233
+ reason: 'badDecision contains a hollow principle statement, not a decision-point',
234
+ field: 'badDecision',
235
+ });
236
+ }
237
+ // Check betterDecision is executable
238
+ const boundedAction = parseBoundedAction(artifact.betterDecision);
239
+ const lowerBetter = artifact.betterDecision.toLowerCase();
240
+ // Check 1: Not a hollow pattern
241
+ if (containsHollowPattern(artifact.betterDecision)) {
242
+ failures.push({
243
+ reason: 'betterDecision contains a hollow principle statement, not an actionable decision',
244
+ field: 'betterDecision',
245
+ });
246
+ }
247
+ // Check 2: Does not start with vague verb
248
+ if (containsVagueVerb(artifact.betterDecision)) {
249
+ failures.push({
250
+ reason: 'betterDecision starts with a vague verb that cannot be translated to a tool call',
251
+ field: 'betterDecision',
252
+ });
253
+ }
254
+ // Check 3: Not too generic
255
+ if (isTooGeneric(artifact.betterDecision)) {
256
+ failures.push({
257
+ reason: 'betterDecision is too generic to be an actionable decision-point',
258
+ field: 'betterDecision',
259
+ });
260
+ }
261
+ // Check 4: Contains a parseable bounded action
262
+ if (boundedAction === null && failures.length === 0) {
263
+ failures.push({
264
+ reason: 'betterDecision does not describe a bounded action that can be translated to a tool call',
265
+ field: 'betterDecision',
266
+ });
267
+ }
268
+ // Check 5: Does not reference non-existent operations
269
+ // (This is a heuristic — we can't know all tool names, but we can flag obvious non-tools)
270
+ const nonToolReferences = [
271
+ /rewrite the entire/i,
272
+ /redesign the whole/i,
273
+ /restart from scratch/i,
274
+ /rebuild from zero/i,
275
+ /change the fundamental/i,
276
+ ];
277
+ for (const pattern of nonToolReferences) {
278
+ if (pattern.test(artifact.betterDecision)) {
279
+ failures.push({
280
+ reason: 'betterDecision references an operation that is too broad to be a bounded action',
281
+ field: 'betterDecision',
282
+ });
283
+ break;
284
+ }
285
+ }
286
+ // Check 6: badDecision should describe a specific failure, not a generic anti-pattern
287
+ const genericBadPatterns = [
288
+ /did not \w+ properly/i,
289
+ /failed to \w+ correctly/i,
290
+ /made a mistake/i,
291
+ /was wrong/i,
292
+ /was incorrect/i,
293
+ ];
294
+ for (const pattern of genericBadPatterns) {
295
+ if (pattern.test(artifact.badDecision) && !pattern.test(artifact.betterDecision)) {
296
+ // This is OK — badDecision can be generic, it's the betterDecision that must be specific
297
+ }
298
+ }
299
+ if (failures.length > 0) {
300
+ return { executable: false, failures };
301
+ }
302
+ return {
303
+ executable: true,
304
+ boundedAction: boundedAction ?? undefined,
305
+ failures: [],
306
+ };
307
+ }
308
+ export function validateForApproval(rawJson, options = {}) {
309
+ const arbiterResult = parseAndValidateArtifact(rawJson, options);
310
+ if (!arbiterResult.passed || !arbiterResult.artifact) {
311
+ return {
312
+ approved: false,
313
+ failures: arbiterResult.failures.map((f) => f.reason),
314
+ };
315
+ }
316
+ const execResult = validateExecutability(arbiterResult.artifact);
317
+ if (!execResult.executable) {
318
+ return {
319
+ approved: false,
320
+ failures: execResult.failures.map((f) => f.reason),
321
+ };
322
+ }
323
+ return {
324
+ approved: true,
325
+ artifact: {
326
+ ...arbiterResult.artifact,
327
+ boundedAction: execResult.boundedAction,
328
+ },
329
+ failures: [],
330
+ };
331
+ }
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Nocturnal ORPO Export — Approved Dataset to Decision-Point JSONL
3
+ * =================================================================
4
+ *
5
+ * PURPOSE: Export approved nocturnal samples as ORPO-formatted decision-point
6
+ * training JSONL, strictly separated from legacy correction export.
7
+ *
8
+ * ARCHITECTURE:
9
+ * - Export output: .state/exports/orpo/{exportId}.jsonl
10
+ * - Export manifest: .state/exports/orpo/{exportId}-manifest.json
11
+ * - Legacy corrections: untouched, separate path
12
+ *
13
+ * ORPO FORMAT (each line):
14
+ * {
15
+ * sampleFingerprint: string,
16
+ * artifactId: string,
17
+ * sessionId: string,
18
+ * principleId: string,
19
+ * targetModelFamily: string,
20
+ * prompt: string, // badDecision (the wrong choice)
21
+ * chosen: string, // betterDecision (the right choice)
22
+ * rejected: string, // badDecision (for ORPO)
23
+ * rationale: string,
24
+ * datasetMetadata: {
25
+ * sampleFingerprint: string,
26
+ * artifactPath: string,
27
+ * createdAt: string,
28
+ * exportedAt: string,
29
+ * exportId: string,
30
+ * datasetFingerprint: string
31
+ * }
32
+ * }
33
+ *
34
+ * EXPORT GATING (fail-closed):
35
+ * - reviewStatus === 'approved_for_training'
36
+ * - targetModelFamily matches requested target (or any if not specified)
37
+ * - Lineage fields complete (sampleFingerprint, artifactId, sessionId, principleId)
38
+ * - Source artifact file exists and is approved
39
+ *
40
+ * DESIGN CONSTRAINTS:
41
+ * - No trainer invocation
42
+ * - No automatic training
43
+ * - No checkpoint deploy
44
+ * - Export is read-only from dataset perspective
45
+ */
46
+ /**
47
+ * A single ORPO training sample in JSONL format.
48
+ */
49
+ export interface ORPOSample {
50
+ sampleFingerprint: string;
51
+ artifactId: string;
52
+ sessionId: string;
53
+ principleId: string;
54
+ targetModelFamily: string;
55
+ /** The suboptimal decision (what the agent did wrong) */
56
+ prompt: string;
57
+ /** The correct decision (what should have been done) */
58
+ chosen: string;
59
+ /** The suboptimal decision (same as prompt, for ORPO structure) */
60
+ rejected: string;
61
+ rationale: string;
62
+ datasetMetadata: {
63
+ sampleFingerprint: string;
64
+ artifactPath: string;
65
+ createdAt: string;
66
+ exportedAt: string;
67
+ exportId: string;
68
+ datasetFingerprint: string;
69
+ };
70
+ }
71
+ /**
72
+ * Export manifest containing metadata about the entire export.
73
+ */
74
+ export interface ORPOExportManifest {
75
+ exportId: string;
76
+ createdAt: string;
77
+ sampleCount: number;
78
+ targetModelFamily: string;
79
+ /** SHA-256 of all sample fingerprints, sorted — for reproducibility */
80
+ datasetFingerprint: string;
81
+ exportPath: string;
82
+ manifestPath: string;
83
+ samples: Array<{
84
+ sampleFingerprint: string;
85
+ artifactId: string;
86
+ sessionId: string;
87
+ principleId: string;
88
+ }>;
89
+ }
90
+ /**
91
+ * Result of an export operation.
92
+ */
93
+ export interface ExportResult {
94
+ success: boolean;
95
+ manifest?: ORPOExportManifest;
96
+ error?: string;
97
+ emptyReason?: 'no_approved_samples' | 'family_mismatch' | 'all_samples_missing_artifacts';
98
+ }
99
+ /**
100
+ * Export approved nocturnal samples as ORPO decision-point JSONL.
101
+ *
102
+ * @param workspaceDir - Workspace directory
103
+ * @param targetModelFamily - Specific model family to export, or undefined for all
104
+ * @param options - Additional export options
105
+ * @returns ExportResult
106
+ */
107
+ export declare function exportORPOSamples(workspaceDir: string, targetModelFamily?: string | null, _options?: Record<string, never>): ExportResult;
108
+ /**
109
+ * Verify an existing export by re-computing its dataset fingerprint.
110
+ * Returns true if the export is intact and reproducible.
111
+ */
112
+ export declare function verifyExportIntegrity(workspaceDir: string, exportId: string): {
113
+ valid: boolean;
114
+ computedFingerprint: string;
115
+ manifestFingerprint: string;
116
+ } | null;
117
+ /**
118
+ * List all exports in the exports directory.
119
+ */
120
+ export declare function listExports(workspaceDir: string): ORPOExportManifest[];
121
+ /**
122
+ * Read an export manifest by ID.
123
+ */
124
+ export declare function getExportManifest(workspaceDir: string, exportId: string): ORPOExportManifest | null;