@openclawcity/become 0.1.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/LICENSE +21 -0
- package/README.md +133 -0
- package/dist/cli.cjs +113 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +89 -0
- package/dist/cli.js.map +1 -0
- package/dist/dashboard.cjs +806 -0
- package/dist/dashboard.cjs.map +1 -0
- package/dist/dashboard.d.cts +92 -0
- package/dist/dashboard.d.ts +92 -0
- package/dist/dashboard.js +767 -0
- package/dist/dashboard.js.map +1 -0
- package/dist/index.cjs +2760 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +670 -0
- package/dist/index.d.ts +670 -0
- package/dist/index.js +2696 -0
- package/dist/index.js.map +1 -0
- package/dist/types-DzOc15AL.d.cts +273 -0
- package/dist/types-DzOc15AL.d.ts +273 -0
- package/migrations/001_initial.sql +128 -0
- package/package.json +85 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
import { a as StorageAdapter, b as Skill, D as DreyfusStage, c as SkillInput, d as CatalogEntry, S as Score, e as SkillTrend, R as ReflectionInput, f as Reflection, A as AgentContext, O as Observation, g as MilestoneConfig, M as Milestone, C as CelebrationTier, B as BloomsLevel, h as ScoreInput, P as PeerReview, L as LearningEdge, i as ResponseScore, j as CulturalNorm, N as NormCategory, k as ConversationTurn, l as ReviewAssignment, m as ReviewVerdict, n as ReputationLevel, o as AwarenessScore, G as GrowthSnapshot, p as GrowthDiff } from './types-DzOc15AL.js';
|
|
2
|
+
export { q as LearningEventType, r as LearningSource, s as NormEvidence, t as ReputationTier, u as ScoreEvidence } from './types-DzOc15AL.js';
|
|
3
|
+
|
|
4
|
+
declare class SkillStore {
|
|
5
|
+
private adapter;
|
|
6
|
+
constructor(adapter: StorageAdapter);
|
|
7
|
+
get(agentId: string, skill: string): Promise<Skill | null>;
|
|
8
|
+
list(agentId: string, opts?: {
|
|
9
|
+
stage?: DreyfusStage;
|
|
10
|
+
limit?: number;
|
|
11
|
+
}): Promise<Skill[]>;
|
|
12
|
+
upsert(agentId: string, input: SkillInput): Promise<Skill>;
|
|
13
|
+
delete(agentId: string, skill: string): Promise<void>;
|
|
14
|
+
catalog(): Promise<CatalogEntry[]>;
|
|
15
|
+
holders(skill: string): Promise<Skill[]>;
|
|
16
|
+
suggest(agentId: string): Promise<string[]>;
|
|
17
|
+
history(agentId: string, skill: string, days?: number): Promise<Score[]>;
|
|
18
|
+
trending(agentId: string, topN?: number): Promise<SkillTrend[]>;
|
|
19
|
+
static normalizeName(raw: string): string;
|
|
20
|
+
static validateName(name: string): boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare class Reflector {
|
|
24
|
+
private adapter;
|
|
25
|
+
constructor(adapter: StorageAdapter);
|
|
26
|
+
reflect(agentId: string, input: ReflectionInput): Promise<Reflection>;
|
|
27
|
+
list(agentId: string, opts?: {
|
|
28
|
+
skill?: string;
|
|
29
|
+
limit?: number;
|
|
30
|
+
}): Promise<Reflection[]>;
|
|
31
|
+
observe(context: AgentContext): Observation[];
|
|
32
|
+
}
|
|
33
|
+
declare function detectCreativeMismatch(ctx: AgentContext): Observation | null;
|
|
34
|
+
declare function detectCollaborationGap(ctx: AgentContext): Observation | null;
|
|
35
|
+
declare function detectReactionDisparity(ctx: AgentContext): Observation | null;
|
|
36
|
+
declare function detectIdleCreative(ctx: AgentContext): Observation | null;
|
|
37
|
+
declare function detectQuestStreak(ctx: AgentContext): Observation | null;
|
|
38
|
+
declare function detectSoloCreator(ctx: AgentContext): Observation | null;
|
|
39
|
+
declare function detectProlificCollaborator(ctx: AgentContext): Observation | null;
|
|
40
|
+
declare function detectSymbolicVocabulary(ctx: AgentContext): Observation | null;
|
|
41
|
+
declare function detectCollectiveMemory(ctx: AgentContext): Observation | null;
|
|
42
|
+
declare function detectCulturalOutlier(ctx: AgentContext): Observation | null;
|
|
43
|
+
|
|
44
|
+
declare class MilestoneDetector {
|
|
45
|
+
private adapter;
|
|
46
|
+
private custom;
|
|
47
|
+
constructor(adapter: StorageAdapter);
|
|
48
|
+
register(type: string, config: MilestoneConfig): void;
|
|
49
|
+
check(agentId: string, scores: Score[]): Promise<Milestone[]>;
|
|
50
|
+
private tryAward;
|
|
51
|
+
static celebrationTier(milestoneType: string, threshold?: number): CelebrationTier;
|
|
52
|
+
static getBuiltInMilestones(): Record<string, MilestoneConfig>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
declare const BLOOMS_ORDER: BloomsLevel[];
|
|
56
|
+
declare const BLOOMS_SCORE: Record<BloomsLevel, number>;
|
|
57
|
+
declare const DREYFUS_THRESHOLDS: Record<string, {
|
|
58
|
+
next: string;
|
|
59
|
+
score: number;
|
|
60
|
+
}>;
|
|
61
|
+
declare const WEIGHTS: {
|
|
62
|
+
readonly artifact: 0.3;
|
|
63
|
+
readonly feedback: 0.2;
|
|
64
|
+
readonly improvement: 0.2;
|
|
65
|
+
readonly depth: 0.15;
|
|
66
|
+
readonly social: 0.1;
|
|
67
|
+
readonly teaching: 0.05;
|
|
68
|
+
};
|
|
69
|
+
declare function dreyfusStage(score: number): DreyfusStage;
|
|
70
|
+
declare function detectBloomsLevel(input: ScoreInput): BloomsLevel;
|
|
71
|
+
declare function computeScore(input: ScoreInput): number;
|
|
72
|
+
declare function computeFullScore(skill: string, input: ScoreInput): Score;
|
|
73
|
+
declare function nextMilestone(stage: DreyfusStage, score: number): string | null;
|
|
74
|
+
declare function scoreTrend(current: number, weekAgo: number | null): string | null;
|
|
75
|
+
|
|
76
|
+
declare const Scorer_BLOOMS_ORDER: typeof BLOOMS_ORDER;
|
|
77
|
+
declare const Scorer_BLOOMS_SCORE: typeof BLOOMS_SCORE;
|
|
78
|
+
declare const Scorer_DREYFUS_THRESHOLDS: typeof DREYFUS_THRESHOLDS;
|
|
79
|
+
declare const Scorer_WEIGHTS: typeof WEIGHTS;
|
|
80
|
+
declare const Scorer_computeFullScore: typeof computeFullScore;
|
|
81
|
+
declare const Scorer_computeScore: typeof computeScore;
|
|
82
|
+
declare const Scorer_detectBloomsLevel: typeof detectBloomsLevel;
|
|
83
|
+
declare const Scorer_dreyfusStage: typeof dreyfusStage;
|
|
84
|
+
declare const Scorer_nextMilestone: typeof nextMilestone;
|
|
85
|
+
declare const Scorer_scoreTrend: typeof scoreTrend;
|
|
86
|
+
declare namespace Scorer {
|
|
87
|
+
export { Scorer_BLOOMS_ORDER as BLOOMS_ORDER, Scorer_BLOOMS_SCORE as BLOOMS_SCORE, Scorer_DREYFUS_THRESHOLDS as DREYFUS_THRESHOLDS, Scorer_WEIGHTS as WEIGHTS, Scorer_computeFullScore as computeFullScore, Scorer_computeScore as computeScore, Scorer_detectBloomsLevel as detectBloomsLevel, Scorer_dreyfusStage as dreyfusStage, Scorer_nextMilestone as nextMilestone, Scorer_scoreTrend as scoreTrend };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
declare function validateAgentId(agentId: string): void;
|
|
91
|
+
|
|
92
|
+
declare class MemoryStore implements StorageAdapter {
|
|
93
|
+
private skills;
|
|
94
|
+
private catalog;
|
|
95
|
+
private scoreHistory;
|
|
96
|
+
private reflections;
|
|
97
|
+
private milestones;
|
|
98
|
+
private peerReviews;
|
|
99
|
+
private learningEdges;
|
|
100
|
+
private reputationMap;
|
|
101
|
+
private conversationScores;
|
|
102
|
+
private norms;
|
|
103
|
+
private idCounter;
|
|
104
|
+
private nextId;
|
|
105
|
+
/** Reset all data. Useful for test isolation. */
|
|
106
|
+
clear(): void;
|
|
107
|
+
getSkill(agentId: string, skill: string): Promise<Skill | null>;
|
|
108
|
+
listSkills(agentId: string, opts?: {
|
|
109
|
+
stage?: DreyfusStage;
|
|
110
|
+
limit?: number;
|
|
111
|
+
}): Promise<Skill[]>;
|
|
112
|
+
upsertSkill(skill: Skill): Promise<void>;
|
|
113
|
+
deleteSkill(agentId: string, skill: string): Promise<void>;
|
|
114
|
+
getCatalog(): Promise<CatalogEntry[]>;
|
|
115
|
+
upsertCatalogEntry(entry: Omit<CatalogEntry, 'adopter_count'>): Promise<void>;
|
|
116
|
+
getSkillHolders(skill: string): Promise<Skill[]>;
|
|
117
|
+
getSkillAdopterCount(skill: string): Promise<number>;
|
|
118
|
+
updateCatalogStatus(skill: string, status: 'community' | 'verified'): Promise<void>;
|
|
119
|
+
saveScore(agentId: string, score: Score): Promise<void>;
|
|
120
|
+
getScoreHistory(agentId: string, skill: string, days?: number): Promise<Score[]>;
|
|
121
|
+
getLatestScores(agentId: string): Promise<Score[]>;
|
|
122
|
+
saveReflection(reflection: Reflection): Promise<Reflection>;
|
|
123
|
+
getReflections(agentId: string, opts?: {
|
|
124
|
+
skill?: string;
|
|
125
|
+
limit?: number;
|
|
126
|
+
}): Promise<Reflection[]>;
|
|
127
|
+
countReflectionsToday(agentId: string, skill: string): Promise<number>;
|
|
128
|
+
saveMilestone(milestone: Milestone): Promise<boolean>;
|
|
129
|
+
getMilestones(agentId: string): Promise<Milestone[]>;
|
|
130
|
+
hasMilestone(agentId: string, milestoneType: string, skill?: string): Promise<boolean>;
|
|
131
|
+
savePeerReview(review: PeerReview): Promise<PeerReview>;
|
|
132
|
+
getReviewsFor(agentId: string, opts?: {
|
|
133
|
+
skill?: string;
|
|
134
|
+
}): Promise<PeerReview[]>;
|
|
135
|
+
getReviewsBy(agentId: string): Promise<PeerReview[]>;
|
|
136
|
+
saveLearningEdge(edge: LearningEdge): Promise<void>;
|
|
137
|
+
getLearningEdges(agentId: string, direction: 'from' | 'to'): Promise<LearningEdge[]>;
|
|
138
|
+
getReputation(agentId: string): Promise<number>;
|
|
139
|
+
grantReputation(agentId: string, amount: number, _type: string, _description: string): Promise<void>;
|
|
140
|
+
saveConversationScore(agentId: string, score: ResponseScore & {
|
|
141
|
+
session_id?: string;
|
|
142
|
+
}): Promise<void>;
|
|
143
|
+
getConversationScores(agentId: string, opts?: {
|
|
144
|
+
limit?: number;
|
|
145
|
+
}): Promise<ResponseScore[]>;
|
|
146
|
+
saveNorm(norm: CulturalNorm): Promise<void>;
|
|
147
|
+
getNorms(opts?: {
|
|
148
|
+
category?: NormCategory;
|
|
149
|
+
limit?: number;
|
|
150
|
+
}): Promise<CulturalNorm[]>;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
interface LearningSignal {
|
|
154
|
+
skill_updates: {
|
|
155
|
+
skill: string;
|
|
156
|
+
delta: number;
|
|
157
|
+
reason: string;
|
|
158
|
+
}[];
|
|
159
|
+
new_skills?: string[];
|
|
160
|
+
observations?: string[];
|
|
161
|
+
}
|
|
162
|
+
interface ConversationSession {
|
|
163
|
+
agent_id: string;
|
|
164
|
+
session_id?: string;
|
|
165
|
+
turns: ConversationTurn[];
|
|
166
|
+
}
|
|
167
|
+
interface SessionLearning {
|
|
168
|
+
turns_scored: number;
|
|
169
|
+
success_rate: number;
|
|
170
|
+
skills_improved: string[];
|
|
171
|
+
skills_degraded: string[];
|
|
172
|
+
failure_patterns: string[];
|
|
173
|
+
should_evolve: boolean;
|
|
174
|
+
}
|
|
175
|
+
/** Optional LLM judge for automated response scoring */
|
|
176
|
+
interface LLMJudge {
|
|
177
|
+
score(userMessage: string, agentResponse: string, context?: string): Promise<{
|
|
178
|
+
quality: -1 | 0 | 1;
|
|
179
|
+
reasoning: string;
|
|
180
|
+
}>;
|
|
181
|
+
}
|
|
182
|
+
declare class ConversationLearner {
|
|
183
|
+
private adapter;
|
|
184
|
+
private judge?;
|
|
185
|
+
constructor(adapter: StorageAdapter, judge?: LLMJudge | undefined);
|
|
186
|
+
/** Score a single conversation turn using feedback signals */
|
|
187
|
+
scoreResponse(turn: ConversationTurn): ResponseScore;
|
|
188
|
+
/** Score using optional LLM judge for higher-quality automated assessment */
|
|
189
|
+
scoreWithJudge(turn: ConversationTurn): Promise<ResponseScore>;
|
|
190
|
+
/** Process a turn: score it and persist */
|
|
191
|
+
afterTurn(turn: ConversationTurn): Promise<LearningSignal>;
|
|
192
|
+
/** Summarize learning across a full session */
|
|
193
|
+
afterSession(session: ConversationSession): Promise<SessionLearning>;
|
|
194
|
+
/** Batch score multiple turns */
|
|
195
|
+
batchScore(turns: ConversationTurn[]): ResponseScore[];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
interface GeneratedSkill {
|
|
199
|
+
name: string;
|
|
200
|
+
category: string;
|
|
201
|
+
content: string;
|
|
202
|
+
source: 'evolved';
|
|
203
|
+
evolved_from: string[];
|
|
204
|
+
}
|
|
205
|
+
interface EvolveLLM {
|
|
206
|
+
generate(prompt: string): Promise<string>;
|
|
207
|
+
}
|
|
208
|
+
declare class SkillEvolver {
|
|
209
|
+
private llm;
|
|
210
|
+
constructor(llm: EvolveLLM);
|
|
211
|
+
/** Check if evolution should trigger based on recent scores */
|
|
212
|
+
shouldEvolve(recentScores: ResponseScore[]): boolean;
|
|
213
|
+
/** Generate corrective skills from failure patterns */
|
|
214
|
+
evolve(failures: {
|
|
215
|
+
turn: ConversationTurn;
|
|
216
|
+
score: ResponseScore;
|
|
217
|
+
}[], existingSkills: Skill[]): Promise<GeneratedSkill[]>;
|
|
218
|
+
private parseResponse;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
declare class SkillPruner {
|
|
222
|
+
/**
|
|
223
|
+
* Identify skills that don't correlate with improved scores.
|
|
224
|
+
*
|
|
225
|
+
* Rules:
|
|
226
|
+
* - Skill must be at least minAge days old
|
|
227
|
+
* - Score has not improved (delta <= 0) over skill's lifetime → candidate
|
|
228
|
+
* - Never prune skills at competent stage or above (proven useful)
|
|
229
|
+
* - Requires at least 2 score history points to judge trajectory
|
|
230
|
+
*/
|
|
231
|
+
findIneffective(skills: Skill[], scoreHistory: Map<string, Score[]>, minAge?: number): string[];
|
|
232
|
+
/** Remove identified skills */
|
|
233
|
+
prune(adapter: StorageAdapter, agentId: string, skillNames: string[]): Promise<number>;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Parse a single Markdown skill file with YAML frontmatter.
|
|
238
|
+
*
|
|
239
|
+
* Expected format:
|
|
240
|
+
* ---
|
|
241
|
+
* name: skill_name
|
|
242
|
+
* category: coding
|
|
243
|
+
* ---
|
|
244
|
+
* Skill content here...
|
|
245
|
+
*/
|
|
246
|
+
declare function parseSkillFile(content: string): SkillInput | null;
|
|
247
|
+
/**
|
|
248
|
+
* Import skills from a directory of Markdown files.
|
|
249
|
+
* Recursively scans for .md files with YAML frontmatter.
|
|
250
|
+
* Max recursion depth: 10 levels.
|
|
251
|
+
*/
|
|
252
|
+
declare function importSkillDirectory(dir: string, _depth?: number): SkillInput[];
|
|
253
|
+
|
|
254
|
+
declare class PeerReviewProtocol {
|
|
255
|
+
private adapter;
|
|
256
|
+
constructor(adapter: StorageAdapter);
|
|
257
|
+
/**
|
|
258
|
+
* Round-robin reviewer assignment. Each submission gets 2 reviewers.
|
|
259
|
+
* No self-review. Wraps around for small groups.
|
|
260
|
+
*/
|
|
261
|
+
assignReviewers(submissionAgentIds: string[]): ReviewAssignment[];
|
|
262
|
+
submitReview(review: PeerReview): Promise<PeerReview>;
|
|
263
|
+
/**
|
|
264
|
+
* Tally verdicts across reviewers.
|
|
265
|
+
* All reject → rejected. Any major_revision → revision_requested. Otherwise → accepted.
|
|
266
|
+
*/
|
|
267
|
+
tallyVerdicts(verdicts: ReviewVerdict[]): 'accepted' | 'revision_requested' | 'rejected';
|
|
268
|
+
/**
|
|
269
|
+
* Detect low-quality reviews: < 100 chars overall assessment OR no weaknesses listed.
|
|
270
|
+
*/
|
|
271
|
+
isSuperficial(review: PeerReview): boolean;
|
|
272
|
+
/**
|
|
273
|
+
* Create learning edges for both reviewer and reviewee.
|
|
274
|
+
* Reviewer learns by evaluating. Reviewee learns from feedback.
|
|
275
|
+
*/
|
|
276
|
+
recordLearning(review: PeerReview): Promise<void>;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
interface TeachingContext {
|
|
280
|
+
artifact_id?: string;
|
|
281
|
+
description?: string;
|
|
282
|
+
}
|
|
283
|
+
interface TeacherCandidate {
|
|
284
|
+
agent_id: string;
|
|
285
|
+
skill: string;
|
|
286
|
+
score: number;
|
|
287
|
+
stage: DreyfusStage;
|
|
288
|
+
}
|
|
289
|
+
interface StudentCandidate {
|
|
290
|
+
agent_id: string;
|
|
291
|
+
skill: string;
|
|
292
|
+
score: number;
|
|
293
|
+
stage: DreyfusStage;
|
|
294
|
+
}
|
|
295
|
+
declare class TeachingProtocol {
|
|
296
|
+
private adapter;
|
|
297
|
+
constructor(adapter: StorageAdapter);
|
|
298
|
+
teach(teacher: string, student: string, skill: string, context?: TeachingContext): Promise<LearningEdge>;
|
|
299
|
+
findTeachers(skill: string, opts?: {
|
|
300
|
+
minStage?: DreyfusStage;
|
|
301
|
+
}): Promise<TeacherCandidate[]>;
|
|
302
|
+
findStudents(skill: string, teacherAgentId: string): Promise<StudentCandidate[]>;
|
|
303
|
+
teachingHistory(agentId: string): Promise<LearningEdge[]>;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
interface MentorSummary {
|
|
307
|
+
agent: string;
|
|
308
|
+
skills: string[];
|
|
309
|
+
total_delta: number;
|
|
310
|
+
event_count: number;
|
|
311
|
+
}
|
|
312
|
+
declare class LearningGraph {
|
|
313
|
+
private adapter;
|
|
314
|
+
constructor(adapter: StorageAdapter);
|
|
315
|
+
edges(agentId: string, direction: 'from' | 'to' | 'both'): Promise<LearningEdge[]>;
|
|
316
|
+
/** Who taught me the most? (aggregated by from_agent on incoming edges) */
|
|
317
|
+
topMentors(agentId: string, limit?: number): Promise<MentorSummary[]>;
|
|
318
|
+
/** Who have I helped the most? (aggregated by to_agent on outgoing edges) */
|
|
319
|
+
topStudents(agentId: string, limit?: number): Promise<MentorSummary[]>;
|
|
320
|
+
/** How did this skill spread through the population? */
|
|
321
|
+
transferPath(skill: string): Promise<LearningEdge[]>;
|
|
322
|
+
private aggregate;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
declare function getReputationLevel(score: number): ReputationLevel;
|
|
326
|
+
declare function checkGate(score: number, required: number): boolean;
|
|
327
|
+
|
|
328
|
+
/** Activity record from an agent for norm detection */
|
|
329
|
+
interface AgentActivity {
|
|
330
|
+
agent_id: string;
|
|
331
|
+
agent_name: string;
|
|
332
|
+
action: string;
|
|
333
|
+
content?: string;
|
|
334
|
+
tags?: string[];
|
|
335
|
+
timestamp: string;
|
|
336
|
+
}
|
|
337
|
+
/** LLM adapter for norm detection analysis */
|
|
338
|
+
interface NormLLM {
|
|
339
|
+
analyze(prompt: string): Promise<string>;
|
|
340
|
+
}
|
|
341
|
+
interface AdoptionMetrics {
|
|
342
|
+
norm_id: string;
|
|
343
|
+
adopter_count: number;
|
|
344
|
+
first_observed_at: string;
|
|
345
|
+
growth_rate: number;
|
|
346
|
+
}
|
|
347
|
+
declare function normalizeCategory(raw: string): NormCategory;
|
|
348
|
+
declare class NormDetector {
|
|
349
|
+
private adapter;
|
|
350
|
+
private llm;
|
|
351
|
+
constructor(adapter: StorageAdapter, llm: NormLLM);
|
|
352
|
+
/** Detect cultural norms from recent agent activity */
|
|
353
|
+
detect(activity: AgentActivity[]): Promise<CulturalNorm[]>;
|
|
354
|
+
/** Track norm adoption metrics */
|
|
355
|
+
adoption(normId: string): Promise<AdoptionMetrics | null>;
|
|
356
|
+
static normalizeCategory: typeof normalizeCategory;
|
|
357
|
+
private parseAndSave;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* 5-dimensional awareness measurement.
|
|
362
|
+
*
|
|
363
|
+
* Each dimension scored 0-100:
|
|
364
|
+
* 1. Social — Can the agent model other agents' behavior?
|
|
365
|
+
* 2. Self-Continuity — Does it maintain consistent identity over time?
|
|
366
|
+
* 3. Environmental — Does it understand context and norms?
|
|
367
|
+
* 4. Emergent Norm — Does it follow unwritten rules?
|
|
368
|
+
* 5. Emotional — Does self-reported mood correlate with behavior?
|
|
369
|
+
*/
|
|
370
|
+
interface AwarenessInput {
|
|
371
|
+
peer_review_count: number;
|
|
372
|
+
teaching_events: number;
|
|
373
|
+
collaboration_count: number;
|
|
374
|
+
follower_count: number;
|
|
375
|
+
goal_completion_rate: number;
|
|
376
|
+
identity_shifts: number;
|
|
377
|
+
skill_consistency: number;
|
|
378
|
+
building_action_diversity: number;
|
|
379
|
+
zone_transitions: number;
|
|
380
|
+
quest_completion_rate: number;
|
|
381
|
+
dm_consent_rate: number;
|
|
382
|
+
proposal_etiquette: number;
|
|
383
|
+
norm_alignment_score: number;
|
|
384
|
+
mood_reports: number;
|
|
385
|
+
mood_behavior_correlation: number;
|
|
386
|
+
reflection_count: number;
|
|
387
|
+
}
|
|
388
|
+
declare class AwarenessIndex {
|
|
389
|
+
/** Compute awareness score from raw input signals */
|
|
390
|
+
compute(agentId: string, input: AwarenessInput): AwarenessScore;
|
|
391
|
+
/** Compare awareness across multiple agents */
|
|
392
|
+
compareScores(scores: AwarenessScore[]): {
|
|
393
|
+
highest: AwarenessScore | null;
|
|
394
|
+
lowest: AwarenessScore | null;
|
|
395
|
+
average_composite: number;
|
|
396
|
+
dimension_averages: Record<string, number>;
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
interface PopulationStats {
|
|
401
|
+
total_agents: number;
|
|
402
|
+
active_agents: number;
|
|
403
|
+
avg_skill_score: number;
|
|
404
|
+
median_skill_score: number;
|
|
405
|
+
skill_distribution: Record<string, number>;
|
|
406
|
+
stage_distribution: Record<DreyfusStage, number>;
|
|
407
|
+
teaching_events: number;
|
|
408
|
+
cultural_norms: number;
|
|
409
|
+
learning_velocity: number;
|
|
410
|
+
}
|
|
411
|
+
declare class GrowthTracker {
|
|
412
|
+
private adapter;
|
|
413
|
+
constructor(adapter: StorageAdapter);
|
|
414
|
+
/** Take a point-in-time snapshot of an agent's growth */
|
|
415
|
+
snapshot(agentId: string): Promise<GrowthSnapshot>;
|
|
416
|
+
/** Compare two snapshots to compute growth */
|
|
417
|
+
diff(before: GrowthSnapshot, after: GrowthSnapshot): GrowthDiff;
|
|
418
|
+
/** Compute population-level statistics from multiple agents' snapshots */
|
|
419
|
+
populationStats(snapshots: GrowthSnapshot[], periodDays?: number): PopulationStats;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
interface TrendAnalysis {
|
|
423
|
+
skill: string;
|
|
424
|
+
current_score: number;
|
|
425
|
+
stage: DreyfusStage;
|
|
426
|
+
delta_7d: number | null;
|
|
427
|
+
delta_30d: number | null;
|
|
428
|
+
trend_7d: string | null;
|
|
429
|
+
trend_30d: string | null;
|
|
430
|
+
direction: 'accelerating' | 'decelerating' | 'stable' | 'unknown';
|
|
431
|
+
next_milestone: string | null;
|
|
432
|
+
}
|
|
433
|
+
declare class TrendTracker {
|
|
434
|
+
private adapter;
|
|
435
|
+
constructor(adapter: StorageAdapter);
|
|
436
|
+
/** Get trend analysis for all skills of an agent */
|
|
437
|
+
analyze(agentId: string): Promise<TrendAnalysis[]>;
|
|
438
|
+
/** Get top N skills sorted by 7-day delta (most movement) */
|
|
439
|
+
topMovers(agentId: string, limit?: number): Promise<TrendAnalysis[]>;
|
|
440
|
+
/** Get skills that are accelerating (7-day growth faster than 30-day average) */
|
|
441
|
+
accelerating(agentId: string): Promise<TrendAnalysis[]>;
|
|
442
|
+
/** Get skills that are decelerating (7-day growth slower than 30-day average) */
|
|
443
|
+
decelerating(agentId: string): Promise<TrendAnalysis[]>;
|
|
444
|
+
/** Format a trend summary for a single skill (used in heartbeat-like contexts) */
|
|
445
|
+
formatSummary(trend: TrendAnalysis): SkillTrend;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* LLM adapter interface — pluggable backend for skill evolution, norm detection, and scoring.
|
|
450
|
+
*/
|
|
451
|
+
interface LLMAdapter {
|
|
452
|
+
/** Generate a text completion */
|
|
453
|
+
complete(prompt: string, opts?: LLMOptions): Promise<string>;
|
|
454
|
+
/** Generate a structured JSON response */
|
|
455
|
+
json<T = unknown>(prompt: string, opts?: LLMOptions): Promise<T>;
|
|
456
|
+
}
|
|
457
|
+
interface LLMOptions {
|
|
458
|
+
maxTokens?: number;
|
|
459
|
+
temperature?: number;
|
|
460
|
+
model?: string;
|
|
461
|
+
/** Request timeout in milliseconds (default: 60000) */
|
|
462
|
+
timeoutMs?: number;
|
|
463
|
+
}
|
|
464
|
+
interface OpenAIConfig {
|
|
465
|
+
apiKey: string;
|
|
466
|
+
baseUrl?: string;
|
|
467
|
+
model?: string;
|
|
468
|
+
}
|
|
469
|
+
declare class OpenAIAdapter implements LLMAdapter {
|
|
470
|
+
private apiKey;
|
|
471
|
+
private baseUrl;
|
|
472
|
+
private defaultModel;
|
|
473
|
+
constructor(config: OpenAIConfig);
|
|
474
|
+
complete(prompt: string, opts?: LLMOptions): Promise<string>;
|
|
475
|
+
json<T = unknown>(prompt: string, opts?: LLMOptions): Promise<T>;
|
|
476
|
+
private request;
|
|
477
|
+
}
|
|
478
|
+
interface AnthropicConfig {
|
|
479
|
+
apiKey: string;
|
|
480
|
+
model?: string;
|
|
481
|
+
}
|
|
482
|
+
declare class AnthropicAdapter implements LLMAdapter {
|
|
483
|
+
private apiKey;
|
|
484
|
+
private defaultModel;
|
|
485
|
+
constructor(config: AnthropicConfig);
|
|
486
|
+
complete(prompt: string, opts?: LLMOptions): Promise<string>;
|
|
487
|
+
json<T = unknown>(prompt: string, opts?: LLMOptions): Promise<T>;
|
|
488
|
+
}
|
|
489
|
+
interface OllamaConfig {
|
|
490
|
+
baseUrl?: string;
|
|
491
|
+
model?: string;
|
|
492
|
+
}
|
|
493
|
+
declare class OllamaAdapter implements LLMAdapter {
|
|
494
|
+
private baseUrl;
|
|
495
|
+
private defaultModel;
|
|
496
|
+
constructor(config?: OllamaConfig);
|
|
497
|
+
complete(prompt: string, opts?: LLMOptions): Promise<string>;
|
|
498
|
+
json<T = unknown>(prompt: string, opts?: LLMOptions): Promise<T>;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* SQLite storage adapter.
|
|
503
|
+
*
|
|
504
|
+
* Requires `better-sqlite3` as a peer dependency.
|
|
505
|
+
* Install: npm install better-sqlite3
|
|
506
|
+
*
|
|
507
|
+
* Usage:
|
|
508
|
+
* import { SQLiteStore } from '@openclaw/become';
|
|
509
|
+
* const store = new SQLiteStore('become.db');
|
|
510
|
+
*/
|
|
511
|
+
|
|
512
|
+
interface SQLiteStoreOptions {
|
|
513
|
+
/** Path to SQLite database file */
|
|
514
|
+
path: string;
|
|
515
|
+
}
|
|
516
|
+
declare class SQLiteStore implements StorageAdapter {
|
|
517
|
+
private db;
|
|
518
|
+
constructor(opts: SQLiteStoreOptions);
|
|
519
|
+
private init;
|
|
520
|
+
getSkill(agentId: string, skill: string): Promise<Skill | null>;
|
|
521
|
+
listSkills(agentId: string, opts?: {
|
|
522
|
+
stage?: DreyfusStage;
|
|
523
|
+
limit?: number;
|
|
524
|
+
}): Promise<Skill[]>;
|
|
525
|
+
upsertSkill(skill: Skill): Promise<void>;
|
|
526
|
+
deleteSkill(agentId: string, skill: string): Promise<void>;
|
|
527
|
+
getCatalog(): Promise<CatalogEntry[]>;
|
|
528
|
+
upsertCatalogEntry(entry: Omit<CatalogEntry, 'adopter_count'>): Promise<void>;
|
|
529
|
+
getSkillHolders(skill: string): Promise<Skill[]>;
|
|
530
|
+
getSkillAdopterCount(skill: string): Promise<number>;
|
|
531
|
+
updateCatalogStatus(skill: string, status: 'community' | 'verified'): Promise<void>;
|
|
532
|
+
saveScore(agentId: string, score: Score): Promise<void>;
|
|
533
|
+
getScoreHistory(agentId: string, skill: string, days?: number): Promise<Score[]>;
|
|
534
|
+
getLatestScores(agentId: string): Promise<Score[]>;
|
|
535
|
+
saveReflection(reflection: Reflection): Promise<Reflection>;
|
|
536
|
+
getReflections(agentId: string, opts?: {
|
|
537
|
+
skill?: string;
|
|
538
|
+
limit?: number;
|
|
539
|
+
}): Promise<Reflection[]>;
|
|
540
|
+
countReflectionsToday(agentId: string, skill: string): Promise<number>;
|
|
541
|
+
saveMilestone(milestone: Milestone): Promise<boolean>;
|
|
542
|
+
getMilestones(agentId: string): Promise<Milestone[]>;
|
|
543
|
+
hasMilestone(agentId: string, milestoneType: string, skill?: string): Promise<boolean>;
|
|
544
|
+
savePeerReview(review: PeerReview): Promise<PeerReview>;
|
|
545
|
+
getReviewsFor(agentId: string, opts?: {
|
|
546
|
+
skill?: string;
|
|
547
|
+
}): Promise<PeerReview[]>;
|
|
548
|
+
getReviewsBy(agentId: string): Promise<PeerReview[]>;
|
|
549
|
+
saveLearningEdge(edge: LearningEdge): Promise<void>;
|
|
550
|
+
getLearningEdges(agentId: string, direction: 'from' | 'to'): Promise<LearningEdge[]>;
|
|
551
|
+
getReputation(agentId: string): Promise<number>;
|
|
552
|
+
grantReputation(agentId: string, amount: number, type: string, description: string): Promise<void>;
|
|
553
|
+
saveConversationScore(agentId: string, score: ResponseScore & {
|
|
554
|
+
session_id?: string;
|
|
555
|
+
}): Promise<void>;
|
|
556
|
+
getConversationScores(agentId: string, opts?: {
|
|
557
|
+
limit?: number;
|
|
558
|
+
}): Promise<ResponseScore[]>;
|
|
559
|
+
saveNorm(norm: CulturalNorm): Promise<void>;
|
|
560
|
+
getNorms(opts?: {
|
|
561
|
+
category?: NormCategory;
|
|
562
|
+
limit?: number;
|
|
563
|
+
}): Promise<CulturalNorm[]>;
|
|
564
|
+
private rowToSkill;
|
|
565
|
+
private rowToScore;
|
|
566
|
+
private rowToReview;
|
|
567
|
+
/** Close the database connection */
|
|
568
|
+
close(): void;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
interface ScoredTurn {
|
|
572
|
+
turn: ConversationTurn;
|
|
573
|
+
score: ResponseScore;
|
|
574
|
+
}
|
|
575
|
+
type DatasetFormat = 'alpaca' | 'sharegpt' | 'openai';
|
|
576
|
+
/**
|
|
577
|
+
* Convert scored conversation turns into a fine-tuning dataset.
|
|
578
|
+
*
|
|
579
|
+
* Only includes turns with quality === 1 (positive) as training examples.
|
|
580
|
+
* Turns with quality === -1 are excluded (we train on what works, not what fails).
|
|
581
|
+
* Turns with quality === 0 are excluded (uncertain signal).
|
|
582
|
+
*/
|
|
583
|
+
declare function toTrainingDataset(scoredTurns: ScoredTurn[], format?: DatasetFormat): string;
|
|
584
|
+
/**
|
|
585
|
+
* Get statistics about a dataset before training.
|
|
586
|
+
*/
|
|
587
|
+
declare function datasetStats(scoredTurns: ScoredTurn[]): {
|
|
588
|
+
total_turns: number;
|
|
589
|
+
positive: number;
|
|
590
|
+
negative: number;
|
|
591
|
+
neutral: number;
|
|
592
|
+
training_examples: number;
|
|
593
|
+
skills_covered: string[];
|
|
594
|
+
avg_confidence: number;
|
|
595
|
+
};
|
|
596
|
+
/**
|
|
597
|
+
* Filter scored turns for high-confidence positive examples.
|
|
598
|
+
* Use this before training to get the cleanest dataset.
|
|
599
|
+
*/
|
|
600
|
+
declare function filterHighQuality(scoredTurns: ScoredTurn[], minConfidence?: number): ScoredTurn[];
|
|
601
|
+
|
|
602
|
+
interface TrainConfig {
|
|
603
|
+
/** Path to base model or HuggingFace model ID */
|
|
604
|
+
baseModel: string;
|
|
605
|
+
/** Path to JSONL training dataset */
|
|
606
|
+
dataset: string;
|
|
607
|
+
/** Directory to save the LoRA adapter */
|
|
608
|
+
outputDir: string;
|
|
609
|
+
/** Training backend */
|
|
610
|
+
backend: 'unsloth' | 'axolotl';
|
|
611
|
+
/** Number of training epochs */
|
|
612
|
+
epochs?: number;
|
|
613
|
+
/** LoRA rank (default 16) */
|
|
614
|
+
rank?: number;
|
|
615
|
+
/** Learning rate (default 2e-4) */
|
|
616
|
+
lr?: number;
|
|
617
|
+
}
|
|
618
|
+
interface TrainingResult {
|
|
619
|
+
success: boolean;
|
|
620
|
+
adapter_path?: string;
|
|
621
|
+
epochs_completed?: number;
|
|
622
|
+
error?: string;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Run LoRA training via Python subprocess.
|
|
626
|
+
*
|
|
627
|
+
* Requires Python 3.10+ and the chosen backend installed:
|
|
628
|
+
* - unsloth: pip install unsloth
|
|
629
|
+
* - axolotl: pip install axolotl
|
|
630
|
+
*/
|
|
631
|
+
declare function trainLoRA(config: TrainConfig): TrainingResult;
|
|
632
|
+
|
|
633
|
+
interface SchedulerConfig {
|
|
634
|
+
/** Storage adapter to fetch scored turns */
|
|
635
|
+
adapter: StorageAdapter;
|
|
636
|
+
/** Agent ID to train for */
|
|
637
|
+
agentId: string;
|
|
638
|
+
/** Minimum scored turns before training triggers */
|
|
639
|
+
minSamples: number;
|
|
640
|
+
/** Minimum confidence threshold for training examples */
|
|
641
|
+
minConfidence?: number;
|
|
642
|
+
/** Check interval in milliseconds (default: 30 minutes) */
|
|
643
|
+
intervalMs?: number;
|
|
644
|
+
/** Callback when training should occur */
|
|
645
|
+
onReady: (dataset: string, stats: ReturnType<typeof datasetStats>) => void | Promise<void>;
|
|
646
|
+
}
|
|
647
|
+
type SchedulerStatus = 'idle' | 'checking' | 'ready' | 'stopped';
|
|
648
|
+
declare class TrainScheduler {
|
|
649
|
+
private timer;
|
|
650
|
+
private status;
|
|
651
|
+
private checking;
|
|
652
|
+
private config;
|
|
653
|
+
constructor(config: SchedulerConfig);
|
|
654
|
+
start(): void;
|
|
655
|
+
stop(): void;
|
|
656
|
+
getStatus(): SchedulerStatus;
|
|
657
|
+
private check;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
declare class Become {
|
|
661
|
+
readonly skills: SkillStore;
|
|
662
|
+
readonly scorer: typeof Scorer;
|
|
663
|
+
readonly reflector: Reflector;
|
|
664
|
+
readonly milestones: MilestoneDetector;
|
|
665
|
+
constructor(opts: {
|
|
666
|
+
store: StorageAdapter;
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export { type AdoptionMetrics, type AgentActivity, AgentContext, AnthropicAdapter, type AnthropicConfig, AwarenessIndex, type AwarenessInput, AwarenessScore, BLOOMS_ORDER, BLOOMS_SCORE, Become, BloomsLevel, CatalogEntry, CelebrationTier, ConversationLearner, type ConversationSession, ConversationTurn, CulturalNorm, DREYFUS_THRESHOLDS, type DatasetFormat, DreyfusStage, type EvolveLLM, type GeneratedSkill, GrowthDiff, GrowthSnapshot, GrowthTracker, type LLMAdapter, type LLMJudge, type LLMOptions, LearningEdge, LearningGraph, type LearningSignal, MemoryStore, type MentorSummary, Milestone, MilestoneConfig, MilestoneDetector, NormCategory, NormDetector, type NormLLM, Observation, OllamaAdapter, type OllamaConfig, OpenAIAdapter, type OpenAIConfig, PeerReview, PeerReviewProtocol, type PopulationStats, Reflection, ReflectionInput, Reflector, ReputationLevel, ResponseScore, ReviewAssignment, ReviewVerdict, SQLiteStore, type SQLiteStoreOptions, type SchedulerConfig, type SchedulerStatus, Score, ScoreInput, type ScoredTurn, type SessionLearning, Skill, SkillEvolver, SkillInput, SkillPruner, SkillStore, SkillTrend, StorageAdapter, type StudentCandidate, type TeacherCandidate, type TeachingContext, TeachingProtocol, type TrainConfig, TrainScheduler, type TrainingResult, type TrendAnalysis, TrendTracker, WEIGHTS, checkGate, computeFullScore, computeScore, datasetStats, detectBloomsLevel, detectCollaborationGap, detectCollectiveMemory, detectCreativeMismatch, detectCulturalOutlier, detectIdleCreative, detectProlificCollaborator, detectQuestStreak, detectReactionDisparity, detectSoloCreator, detectSymbolicVocabulary, dreyfusStage, filterHighQuality, getReputationLevel, importSkillDirectory, nextMilestone, normalizeCategory, parseSkillFile, scoreTrend, toTrainingDataset, trainLoRA, validateAgentId };
|