claude-flow 3.62.0 → 3.63.0
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/README.md +1 -1
- package/package.json +1 -1
- package/v3/@claude-flow/cli/README.md +1 -1
- package/v3/@claude-flow/cli/catalog-manifest.json +3 -3
- package/v3/@claude-flow/cli/dist/src/mcp-tools/managed-agent-tools.d.ts +1 -20
- package/v3/@claude-flow/cli/dist/src/mcp-tools/managed-agent-tools.js +344 -108
- package/v3/@claude-flow/cli/dist/src/mcp-tools/managed-learning-tool.d.ts +4 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/managed-learning-tool.js +46 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +6 -3
- package/v3/@claude-flow/cli/dist/src/missions/schemas.d.ts +12 -12
- package/v3/@claude-flow/cli/dist/src/services/managed-learning-loop.d.ts +79 -0
- package/v3/@claude-flow/cli/dist/src/services/managed-learning-loop.js +76 -0
- package/v3/@claude-flow/cli/dist/src/services/managed-learning-store.d.ts +187 -0
- package/v3/@claude-flow/cli/dist/src/services/managed-learning-store.js +238 -0
- package/v3/@claude-flow/cli/dist/src/services/managed-learning.d.ts +108 -0
- package/v3/@claude-flow/cli/dist/src/services/managed-learning.js +197 -0
- package/v3/@claude-flow/cli/dist/src/services/managed-memory-client.d.ts +72 -0
- package/v3/@claude-flow/cli/dist/src/services/managed-memory-client.js +236 -0
- package/v3/@claude-flow/cli/dist/src/services/managed-memory-worker.d.ts +56 -0
- package/v3/@claude-flow/cli/dist/src/services/managed-memory-worker.js +161 -0
- package/v3/@claude-flow/cli/dist/src/services/managed-run-collector.d.ts +93 -0
- package/v3/@claude-flow/cli/dist/src/services/managed-run-collector.js +181 -0
- package/v3/@claude-flow/cli/dist/src/services/managed-run-store.d.ts +52 -0
- package/v3/@claude-flow/cli/dist/src/services/managed-run-store.js +119 -0
- package/v3/@claude-flow/cli/dist/src/services/managed-workflows.d.ts +101 -0
- package/v3/@claude-flow/cli/dist/src/services/managed-workflows.js +183 -0
- package/v3/@claude-flow/cli/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** Learning MCP boundary, kept separate from provider transport and native workers. */
|
|
2
|
+
import { getProjectCwd } from './types.js';
|
|
3
|
+
export const managedLearningTool = {
|
|
4
|
+
inputSchema: { type: 'object', properties: {
|
|
5
|
+
action: { type: 'string', enum: ['status', 'record', 'recommend', 'evaluate', 'index', 'recall', 'cycle'] },
|
|
6
|
+
evidence: { type: 'object', description: 'Closed version1 observation and optional host signature; caller trust labels rejected' },
|
|
7
|
+
scope: { type: 'object', description: 'Exact taskType, policyHash and evaluatorHash cohort' },
|
|
8
|
+
manifest: { type: 'object', description: 'Frozen unique heldout taskHashes and at least three trials' },
|
|
9
|
+
cycle: { type: 'object', description: 'Closed scope/evidence batch, optional index, maxP95Ms and evaluation; no commands, keys or promotion flags' },
|
|
10
|
+
baselineId: { type: 'string' }, candidateId: { type: 'string' }, id: { type: 'string' }, maxP95Ms: { type: 'number' },
|
|
11
|
+
}, required: ['action'] },
|
|
12
|
+
handler: async (input) => {
|
|
13
|
+
if (input.action !== 'status' && process.env.RUFLO_MANAGED_LEARNING !== '1')
|
|
14
|
+
return { success: false, error: 'Managed learning writes require host RUFLO_MANAGED_LEARNING=1' };
|
|
15
|
+
const root = getProjectCwd(), key = process.env.RUFLO_MANAGED_VERIFIER_PUBLIC_KEY;
|
|
16
|
+
const authorize = () => process.env.RUFLO_MANAGED_LEARNING === '1' && process.env.RUFLO_MANAGED_VERIFIER_PUBLIC_KEY === key && getProjectCwd() === root;
|
|
17
|
+
try {
|
|
18
|
+
const learning = await import('../services/managed-learning-store.js');
|
|
19
|
+
if (input.action !== 'status' && !authorize())
|
|
20
|
+
throw new Error('Host learning policy changed');
|
|
21
|
+
if (input.action === 'cycle') {
|
|
22
|
+
if (Object.keys(input).some(k => !['action', 'cycle'].includes(k)))
|
|
23
|
+
throw new Error('Invalid cycle envelope');
|
|
24
|
+
const { cycleLearning } = await import('../services/managed-learning-loop.js');
|
|
25
|
+
return { success: true, ...await cycleLearning(root, input.cycle, key, authorize) };
|
|
26
|
+
}
|
|
27
|
+
if (input.action === 'status')
|
|
28
|
+
return { success: true, ...learning.learningStatus(root, key) };
|
|
29
|
+
if (input.action === 'record')
|
|
30
|
+
return { success: true, ...learning.recordLearning(root, input.evidence, key) };
|
|
31
|
+
if (input.action === 'recommend')
|
|
32
|
+
return { success: true, ...learning.recommendLearning(root, input.scope, key, input.maxP95Ms) };
|
|
33
|
+
if (input.action === 'evaluate')
|
|
34
|
+
return { success: true, ...learning.evaluateLearning(root, { scope: input.scope, manifest: input.manifest, baselineId: String(input.baselineId ?? ''), candidateId: String(input.candidateId ?? '') }, key) };
|
|
35
|
+
if (input.action === 'recall')
|
|
36
|
+
return { success: true, ...await learning.recallLearning(root, input.scope, key, authorize) };
|
|
37
|
+
if (input.action === 'index')
|
|
38
|
+
return { success: true, ...await learning.indexLearning(root, String(input.id ?? ''), key, authorize) };
|
|
39
|
+
return { success: false, error: 'Unknown managed learning action' };
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return { success: false, error: 'Managed learning failed: validate metadata, verifier and store; state may persist, inspect status before retrying; no default changed' };
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=managed-learning-tool.js.map
|
|
@@ -1466,13 +1466,16 @@ export const memoryTools = [
|
|
|
1466
1466
|
}
|
|
1467
1467
|
catch { /* namespace may not exist */ }
|
|
1468
1468
|
}
|
|
1469
|
-
// Sort by score, deduplicate by key, take top N
|
|
1469
|
+
// Sort by score, deduplicate by (namespace, key), take top N. An entry is
|
|
1470
|
+
// identified by both (see #2271), so the same key in another namespace is
|
|
1471
|
+
// a different entry and must not be dropped as a duplicate.
|
|
1470
1472
|
allResults.sort((a, b) => b.score - a.score);
|
|
1471
1473
|
const seen = new Set();
|
|
1472
1474
|
const deduplicated = allResults.filter(r => {
|
|
1473
|
-
|
|
1475
|
+
const id = JSON.stringify([r.namespace, r.key]);
|
|
1476
|
+
if (seen.has(id))
|
|
1474
1477
|
return false;
|
|
1475
|
-
seen.add(
|
|
1478
|
+
seen.add(id);
|
|
1476
1479
|
return true;
|
|
1477
1480
|
}).slice(0, limit);
|
|
1478
1481
|
return {
|
|
@@ -77,6 +77,10 @@ export declare const missionRecordSchema: z.ZodObject<{
|
|
|
77
77
|
updatedAt: string;
|
|
78
78
|
schemaVersion: 1;
|
|
79
79
|
state: "completed" | "cancelled" | "failed" | "blocked" | "running" | "paused" | "queued" | "draft" | "planned" | "awaitingAuthorization" | "pauseRequested" | "verifying" | "cancelRequested";
|
|
80
|
+
acceptance: {
|
|
81
|
+
revision: number;
|
|
82
|
+
criteriaDigest: string;
|
|
83
|
+
};
|
|
80
84
|
plan: {
|
|
81
85
|
revision: number;
|
|
82
86
|
digest: string;
|
|
@@ -92,10 +96,6 @@ export declare const missionRecordSchema: z.ZodObject<{
|
|
|
92
96
|
budgetRef: string;
|
|
93
97
|
executionMode: "durable-executor" | "session-bound";
|
|
94
98
|
evidenceRefs: string[];
|
|
95
|
-
acceptance: {
|
|
96
|
-
revision: number;
|
|
97
|
-
criteriaDigest: string;
|
|
98
|
-
};
|
|
99
99
|
lastEventSequence: number;
|
|
100
100
|
authorizationRef?: string | undefined;
|
|
101
101
|
}, {
|
|
@@ -103,6 +103,10 @@ export declare const missionRecordSchema: z.ZodObject<{
|
|
|
103
103
|
updatedAt: string;
|
|
104
104
|
schemaVersion: 1;
|
|
105
105
|
state: "completed" | "cancelled" | "failed" | "blocked" | "running" | "paused" | "queued" | "draft" | "planned" | "awaitingAuthorization" | "pauseRequested" | "verifying" | "cancelRequested";
|
|
106
|
+
acceptance: {
|
|
107
|
+
revision: number;
|
|
108
|
+
criteriaDigest: string;
|
|
109
|
+
};
|
|
106
110
|
plan: {
|
|
107
111
|
revision: number;
|
|
108
112
|
digest: string;
|
|
@@ -118,10 +122,6 @@ export declare const missionRecordSchema: z.ZodObject<{
|
|
|
118
122
|
budgetRef: string;
|
|
119
123
|
executionMode: "durable-executor" | "session-bound";
|
|
120
124
|
evidenceRefs: string[];
|
|
121
|
-
acceptance: {
|
|
122
|
-
revision: number;
|
|
123
|
-
criteriaDigest: string;
|
|
124
|
-
};
|
|
125
125
|
lastEventSequence: number;
|
|
126
126
|
authorizationRef?: string | undefined;
|
|
127
127
|
}>;
|
|
@@ -397,11 +397,11 @@ export declare const createInputSchema: z.ZodObject<{
|
|
|
397
397
|
requestId: z.ZodString;
|
|
398
398
|
objective: z.ZodString;
|
|
399
399
|
}, "strict", z.ZodTypeAny, {
|
|
400
|
-
objective: string;
|
|
401
400
|
requestId: string;
|
|
402
|
-
}, {
|
|
403
401
|
objective: string;
|
|
402
|
+
}, {
|
|
404
403
|
requestId: string;
|
|
404
|
+
objective: string;
|
|
405
405
|
}>;
|
|
406
406
|
export declare const planInputSchema: z.ZodObject<{
|
|
407
407
|
requestId: z.ZodString;
|
|
@@ -580,6 +580,7 @@ export declare const planInputSchema: z.ZodObject<{
|
|
|
580
580
|
} | undefined;
|
|
581
581
|
}>;
|
|
582
582
|
}, "strict", z.ZodTypeAny, {
|
|
583
|
+
requestId: string;
|
|
583
584
|
plan: {
|
|
584
585
|
tasks: {
|
|
585
586
|
id: string;
|
|
@@ -616,10 +617,10 @@ export declare const planInputSchema: z.ZodObject<{
|
|
|
616
617
|
baseline?: string | undefined;
|
|
617
618
|
}[];
|
|
618
619
|
};
|
|
619
|
-
requestId: string;
|
|
620
620
|
missionId: string;
|
|
621
621
|
expectedRevision: number;
|
|
622
622
|
}, {
|
|
623
|
+
requestId: string;
|
|
623
624
|
plan: {
|
|
624
625
|
tasks: {
|
|
625
626
|
id: string;
|
|
@@ -656,7 +657,6 @@ export declare const planInputSchema: z.ZodObject<{
|
|
|
656
657
|
capabilities?: string[] | undefined;
|
|
657
658
|
} | undefined;
|
|
658
659
|
};
|
|
659
|
-
requestId: string;
|
|
660
660
|
missionId: string;
|
|
661
661
|
expectedRevision: number;
|
|
662
662
|
}>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export type ManagedCycleInput = {
|
|
2
|
+
scope: unknown;
|
|
3
|
+
evidence: unknown[];
|
|
4
|
+
index?: boolean;
|
|
5
|
+
maxP95Ms?: number;
|
|
6
|
+
evaluation?: {
|
|
7
|
+
manifest: unknown;
|
|
8
|
+
baselineId: string;
|
|
9
|
+
candidateId: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/** authorize is host-owned and rechecked across asynchronous boundaries. */
|
|
13
|
+
export declare function cycleLearning(root: string, value: unknown, publicKey: string | undefined, authorize: () => boolean): Promise<{
|
|
14
|
+
cycleId: string;
|
|
15
|
+
phases: string[];
|
|
16
|
+
recorded: string[];
|
|
17
|
+
duplicates: string[];
|
|
18
|
+
indexed: string[];
|
|
19
|
+
deferred: string[];
|
|
20
|
+
recommendation: {
|
|
21
|
+
advisory: boolean;
|
|
22
|
+
selected: {
|
|
23
|
+
strategy: {
|
|
24
|
+
id: string;
|
|
25
|
+
model: string;
|
|
26
|
+
workers: number;
|
|
27
|
+
template: string;
|
|
28
|
+
};
|
|
29
|
+
samples: number;
|
|
30
|
+
successes: number;
|
|
31
|
+
successRate: number;
|
|
32
|
+
successesPerDollar: number;
|
|
33
|
+
p95Ms: number;
|
|
34
|
+
evidenceIds: string[];
|
|
35
|
+
};
|
|
36
|
+
candidates: {
|
|
37
|
+
strategy: {
|
|
38
|
+
id: string;
|
|
39
|
+
model: string;
|
|
40
|
+
workers: number;
|
|
41
|
+
template: string;
|
|
42
|
+
};
|
|
43
|
+
samples: number;
|
|
44
|
+
successes: number;
|
|
45
|
+
successRate: number;
|
|
46
|
+
successesPerDollar: number;
|
|
47
|
+
p95Ms: number;
|
|
48
|
+
evidenceIds: string[];
|
|
49
|
+
}[];
|
|
50
|
+
abstained: boolean;
|
|
51
|
+
reason: string;
|
|
52
|
+
defaultsChanged: boolean;
|
|
53
|
+
};
|
|
54
|
+
evaluation: {
|
|
55
|
+
advisory: boolean;
|
|
56
|
+
eligible: boolean;
|
|
57
|
+
baselineP95Ms: number;
|
|
58
|
+
candidateP95Ms: number;
|
|
59
|
+
delta: number;
|
|
60
|
+
baselineEfficiency: number;
|
|
61
|
+
candidateEfficiency: number;
|
|
62
|
+
pairedResults: number;
|
|
63
|
+
corpusHash: string;
|
|
64
|
+
noRegression: boolean;
|
|
65
|
+
metaharness: import("./harness-benchmark.js").AcceptResult;
|
|
66
|
+
defaultsChanged: boolean;
|
|
67
|
+
evidenceIds: string[];
|
|
68
|
+
} | null;
|
|
69
|
+
memory: {
|
|
70
|
+
available: boolean;
|
|
71
|
+
recalled: number;
|
|
72
|
+
backend: string;
|
|
73
|
+
} | null;
|
|
74
|
+
elapsedMs: number;
|
|
75
|
+
advisory: boolean;
|
|
76
|
+
defaultsChanged: boolean;
|
|
77
|
+
promotionRequested: boolean;
|
|
78
|
+
}>;
|
|
79
|
+
//# sourceMappingURL=managed-learning-loop.d.ts.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** Bounded, replayable feedback cycle. Evaluation is never promotion authority. */
|
|
2
|
+
import { digest, evidenceOf, isVerified, manifestOf, scopeOf, trustedEvidence } from './managed-learning.js';
|
|
3
|
+
import { evaluateLearning, indexLearning, recallLearning, recordLearningBatch, recommendLearning } from './managed-learning-store.js';
|
|
4
|
+
function inputOf(value) {
|
|
5
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
6
|
+
throw new Error('Expected a managed cycle');
|
|
7
|
+
const v = value;
|
|
8
|
+
if (Object.keys(v).some(k => !['scope', 'evidence', 'index', 'maxP95Ms', 'evaluation'].includes(k)) || !Array.isArray(v.evidence) || v.evidence.length > 24)
|
|
9
|
+
throw new Error('Managed cycle accepts at most 24 signed outcomes');
|
|
10
|
+
if (v.index !== undefined && typeof v.index !== 'boolean')
|
|
11
|
+
throw new Error('Invalid indexing request');
|
|
12
|
+
if (v.maxP95Ms !== undefined && (typeof v.maxP95Ms !== 'number' || !Number.isFinite(v.maxP95Ms) || v.maxP95Ms <= 0 || v.maxP95Ms > 86_400_000))
|
|
13
|
+
throw new Error('Invalid latency constraint');
|
|
14
|
+
if (v.evaluation !== undefined) {
|
|
15
|
+
const e = v.evaluation;
|
|
16
|
+
if (!e || typeof e !== 'object' || Array.isArray(e) || Object.keys(e).length !== 3 || Object.keys(e).some(k => !['manifest', 'baselineId', 'candidateId'].includes(k)) || typeof e.baselineId !== 'string' || typeof e.candidateId !== 'string' || !/^[a-z][a-z0-9-]{0,39}$/.test(e.baselineId) || !/^[a-z][a-z0-9-]{0,39}$/.test(e.candidateId) || e.baselineId === e.candidateId)
|
|
17
|
+
throw new Error('Invalid evaluation request');
|
|
18
|
+
manifestOf(e.manifest);
|
|
19
|
+
}
|
|
20
|
+
scopeOf(v.scope);
|
|
21
|
+
return structuredClone(v);
|
|
22
|
+
}
|
|
23
|
+
/** authorize is host-owned and rechecked across asynchronous boundaries. */
|
|
24
|
+
export async function cycleLearning(root, value, publicKey, authorize) {
|
|
25
|
+
const started = performance.now(), input = inputOf(value), scope = scopeOf(input.scope);
|
|
26
|
+
const rows = input.evidence.map(evidenceOf);
|
|
27
|
+
const check = () => { if (!authorize() || !publicKey)
|
|
28
|
+
throw new Error('Host learning policy or verifier changed'); };
|
|
29
|
+
check();
|
|
30
|
+
// Reject the whole batch before any write; unsigned input cannot start a cycle.
|
|
31
|
+
for (const e of rows)
|
|
32
|
+
if (!isVerified(e, publicKey) || e.observation.costCents === null || e.observation.durationMs === null || e.observation.taskType !== scope.taskType || e.observation.policyHash !== scope.policyHash || e.observation.evaluatorHash !== scope.evaluatorHash)
|
|
33
|
+
throw new Error('Every cycle outcome must be authenticated, measured and in scope');
|
|
34
|
+
const trusted = trustedEvidence(rows, publicKey).sort((a, b) => digest(a.observation).localeCompare(digest(b.observation)));
|
|
35
|
+
if (input.index && trusted.filter(e => e.observation.split === 'train').length > 6)
|
|
36
|
+
throw new Error('Indexing cycles accept at most six training outcomes; split the batch');
|
|
37
|
+
const cycleId = digest({ scope, evidence: trusted.map(e => digest(e.observation)).sort(), evaluation: input.evaluation ?? null, index: input.index ?? false, maxP95Ms: input.maxP95Ms ?? null });
|
|
38
|
+
const recorded = [], duplicates = [], indexed = [], deferred = [];
|
|
39
|
+
const phases = ['admitted'];
|
|
40
|
+
// One atomic batch avoids per-row sync/summary work. Later native failures
|
|
41
|
+
// leave a resumable signed batch, never a claimed indexed outcome.
|
|
42
|
+
check();
|
|
43
|
+
for (const r of trusted.length ? recordLearningBatch(root, trusted, publicKey) : []) {
|
|
44
|
+
(r.duplicate ? duplicates : recorded).push(r.id);
|
|
45
|
+
}
|
|
46
|
+
phases.push('recorded');
|
|
47
|
+
let memory;
|
|
48
|
+
if (input.index) {
|
|
49
|
+
const training = trusted.filter(e => e.observation.split === 'train');
|
|
50
|
+
for (const e of training.slice(0, 6)) {
|
|
51
|
+
check();
|
|
52
|
+
const r = await indexLearning(root, digest(e.observation), publicKey, authorize);
|
|
53
|
+
check();
|
|
54
|
+
if (r.indexed)
|
|
55
|
+
indexed.push(r.id);
|
|
56
|
+
else
|
|
57
|
+
deferred.push(r.id);
|
|
58
|
+
}
|
|
59
|
+
phases.push('indexed');
|
|
60
|
+
check();
|
|
61
|
+
memory = await recallLearning(root, scope, publicKey, authorize);
|
|
62
|
+
check();
|
|
63
|
+
phases.push('recalled');
|
|
64
|
+
}
|
|
65
|
+
check();
|
|
66
|
+
const recommendation = recommendLearning(root, scope, publicKey, input.maxP95Ms);
|
|
67
|
+
phases.push('recommended');
|
|
68
|
+
check();
|
|
69
|
+
const evaluation = input.evaluation ? evaluateLearning(root, { scope, ...input.evaluation }, publicKey) : null;
|
|
70
|
+
if (evaluation)
|
|
71
|
+
phases.push('evaluated');
|
|
72
|
+
return { cycleId, phases, recorded, duplicates, indexed, deferred, recommendation, evaluation,
|
|
73
|
+
memory: memory ? { available: memory.available, recalled: memory.evidence.length, backend: memory.backend } : null,
|
|
74
|
+
elapsedMs: performance.now() - started, advisory: true, defaultsChanged: false, promotionRequested: false };
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=managed-learning-loop.js.map
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { type Evidence } from './managed-learning.js';
|
|
2
|
+
export declare const LEARNING_PATH = ".claude-flow/managed-learning/state.json";
|
|
3
|
+
export declare function learningStatus(root: string, publicKey?: string): {
|
|
4
|
+
version: number;
|
|
5
|
+
updatedMs: number;
|
|
6
|
+
observations: number;
|
|
7
|
+
verified: number;
|
|
8
|
+
quarantined: number;
|
|
9
|
+
training: number;
|
|
10
|
+
holdout: number;
|
|
11
|
+
verifierConfigured: boolean;
|
|
12
|
+
lastRecommendation: {
|
|
13
|
+
selected: {
|
|
14
|
+
evidenceIds: string[];
|
|
15
|
+
strategy: {
|
|
16
|
+
id: string;
|
|
17
|
+
model: string;
|
|
18
|
+
workers: number;
|
|
19
|
+
template: string;
|
|
20
|
+
};
|
|
21
|
+
samples: number;
|
|
22
|
+
successes: number;
|
|
23
|
+
successRate: number;
|
|
24
|
+
successesPerDollar: number;
|
|
25
|
+
p95Ms: number;
|
|
26
|
+
} | null;
|
|
27
|
+
candidates: {
|
|
28
|
+
evidenceIds: string[];
|
|
29
|
+
strategy: {
|
|
30
|
+
id: string;
|
|
31
|
+
model: string;
|
|
32
|
+
workers: number;
|
|
33
|
+
template: string;
|
|
34
|
+
};
|
|
35
|
+
samples: number;
|
|
36
|
+
successes: number;
|
|
37
|
+
successRate: number;
|
|
38
|
+
successesPerDollar: number;
|
|
39
|
+
p95Ms: number;
|
|
40
|
+
}[];
|
|
41
|
+
advisory: boolean;
|
|
42
|
+
abstained: boolean;
|
|
43
|
+
reason: string;
|
|
44
|
+
defaultsChanged: boolean;
|
|
45
|
+
} | null;
|
|
46
|
+
lastEvaluation: {
|
|
47
|
+
evidenceIds: string[];
|
|
48
|
+
advisory: boolean;
|
|
49
|
+
eligible: boolean;
|
|
50
|
+
baselineP95Ms: number;
|
|
51
|
+
candidateP95Ms: number;
|
|
52
|
+
delta: number;
|
|
53
|
+
baselineEfficiency: number;
|
|
54
|
+
candidateEfficiency: number;
|
|
55
|
+
pairedResults: number;
|
|
56
|
+
corpusHash: string;
|
|
57
|
+
noRegression: boolean;
|
|
58
|
+
metaharness: import("./harness-benchmark.js").AcceptResult;
|
|
59
|
+
defaultsChanged: boolean;
|
|
60
|
+
} | null;
|
|
61
|
+
advisory: boolean;
|
|
62
|
+
defaultsChanged: boolean;
|
|
63
|
+
};
|
|
64
|
+
/** Validate all input before acquiring the writer lock; publish the batch atomically. */
|
|
65
|
+
export declare function recordLearningBatch(root: string, inputs: unknown[], publicKey?: string): {
|
|
66
|
+
stored: boolean;
|
|
67
|
+
duplicate: boolean;
|
|
68
|
+
id: string;
|
|
69
|
+
verified: boolean;
|
|
70
|
+
}[];
|
|
71
|
+
export declare function recordLearning(root: string, input: unknown, publicKey?: string): {
|
|
72
|
+
stored: boolean;
|
|
73
|
+
duplicate: boolean;
|
|
74
|
+
id: string;
|
|
75
|
+
verified: boolean;
|
|
76
|
+
};
|
|
77
|
+
export declare function recommendLearning(root: string, scope: unknown, publicKey?: string, maxP95Ms?: number): {
|
|
78
|
+
advisory: boolean;
|
|
79
|
+
selected: {
|
|
80
|
+
strategy: {
|
|
81
|
+
id: string;
|
|
82
|
+
model: string;
|
|
83
|
+
workers: number;
|
|
84
|
+
template: string;
|
|
85
|
+
};
|
|
86
|
+
samples: number;
|
|
87
|
+
successes: number;
|
|
88
|
+
successRate: number;
|
|
89
|
+
successesPerDollar: number;
|
|
90
|
+
p95Ms: number;
|
|
91
|
+
evidenceIds: string[];
|
|
92
|
+
};
|
|
93
|
+
candidates: {
|
|
94
|
+
strategy: {
|
|
95
|
+
id: string;
|
|
96
|
+
model: string;
|
|
97
|
+
workers: number;
|
|
98
|
+
template: string;
|
|
99
|
+
};
|
|
100
|
+
samples: number;
|
|
101
|
+
successes: number;
|
|
102
|
+
successRate: number;
|
|
103
|
+
successesPerDollar: number;
|
|
104
|
+
p95Ms: number;
|
|
105
|
+
evidenceIds: string[];
|
|
106
|
+
}[];
|
|
107
|
+
abstained: boolean;
|
|
108
|
+
reason: string;
|
|
109
|
+
defaultsChanged: boolean;
|
|
110
|
+
};
|
|
111
|
+
export declare function evaluateLearning(root: string, input: {
|
|
112
|
+
scope: unknown;
|
|
113
|
+
manifest: unknown;
|
|
114
|
+
baselineId: string;
|
|
115
|
+
candidateId: string;
|
|
116
|
+
}, publicKey?: string): {
|
|
117
|
+
advisory: boolean;
|
|
118
|
+
eligible: boolean;
|
|
119
|
+
baselineP95Ms: number;
|
|
120
|
+
candidateP95Ms: number;
|
|
121
|
+
delta: number;
|
|
122
|
+
baselineEfficiency: number;
|
|
123
|
+
candidateEfficiency: number;
|
|
124
|
+
pairedResults: number;
|
|
125
|
+
corpusHash: string;
|
|
126
|
+
noRegression: boolean;
|
|
127
|
+
metaharness: import("./harness-benchmark.js").AcceptResult;
|
|
128
|
+
defaultsChanged: boolean;
|
|
129
|
+
evidenceIds: string[];
|
|
130
|
+
};
|
|
131
|
+
/** Export only verified training evidence to native append-only AgentDB/RuVector storage. */
|
|
132
|
+
export declare function indexLearning(root: string, id: string, publicKey?: string, authorize?: () => boolean): Promise<{
|
|
133
|
+
indexed: boolean;
|
|
134
|
+
durable: boolean;
|
|
135
|
+
namespace: string;
|
|
136
|
+
id: string;
|
|
137
|
+
hasEmbedding: boolean;
|
|
138
|
+
advisory: boolean;
|
|
139
|
+
}>;
|
|
140
|
+
/** Memory similarity supplies recall evidence, never authority or a cherry-picked quality denominator. */
|
|
141
|
+
export declare function recallLearning(root: string, input: unknown, publicKey?: string, authorize?: () => boolean): Promise<{
|
|
142
|
+
available: boolean;
|
|
143
|
+
backend: string;
|
|
144
|
+
evidence: {
|
|
145
|
+
id: string;
|
|
146
|
+
similarity: number;
|
|
147
|
+
strategy: Evidence["observation"]["strategy"];
|
|
148
|
+
sourceHash: string;
|
|
149
|
+
}[];
|
|
150
|
+
recommendation: {
|
|
151
|
+
advisory: boolean;
|
|
152
|
+
selected: {
|
|
153
|
+
strategy: {
|
|
154
|
+
id: string;
|
|
155
|
+
model: string;
|
|
156
|
+
workers: number;
|
|
157
|
+
template: string;
|
|
158
|
+
};
|
|
159
|
+
samples: number;
|
|
160
|
+
successes: number;
|
|
161
|
+
successRate: number;
|
|
162
|
+
successesPerDollar: number;
|
|
163
|
+
p95Ms: number;
|
|
164
|
+
evidenceIds: string[];
|
|
165
|
+
};
|
|
166
|
+
candidates: {
|
|
167
|
+
strategy: {
|
|
168
|
+
id: string;
|
|
169
|
+
model: string;
|
|
170
|
+
workers: number;
|
|
171
|
+
template: string;
|
|
172
|
+
};
|
|
173
|
+
samples: number;
|
|
174
|
+
successes: number;
|
|
175
|
+
successRate: number;
|
|
176
|
+
successesPerDollar: number;
|
|
177
|
+
p95Ms: number;
|
|
178
|
+
evidenceIds: string[];
|
|
179
|
+
}[];
|
|
180
|
+
abstained: boolean;
|
|
181
|
+
reason: string;
|
|
182
|
+
defaultsChanged: boolean;
|
|
183
|
+
};
|
|
184
|
+
advisory: boolean;
|
|
185
|
+
similarityIsVerification: boolean;
|
|
186
|
+
}>;
|
|
187
|
+
//# sourceMappingURL=managed-learning-store.d.ts.map
|