@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
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
type DreyfusStage = 'novice' | 'beginner' | 'competent' | 'proficient' | 'expert';
|
|
2
|
+
type BloomsLevel = 'remember' | 'understand' | 'apply' | 'analyze' | 'evaluate' | 'create';
|
|
3
|
+
interface Skill {
|
|
4
|
+
agent_id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
category?: string;
|
|
7
|
+
score: number;
|
|
8
|
+
blooms_level: BloomsLevel;
|
|
9
|
+
dreyfus_stage: DreyfusStage;
|
|
10
|
+
evidence: ScoreEvidence;
|
|
11
|
+
learned_from: LearningSource[];
|
|
12
|
+
content?: string;
|
|
13
|
+
created_at: string;
|
|
14
|
+
updated_at: string;
|
|
15
|
+
}
|
|
16
|
+
interface SkillInput {
|
|
17
|
+
name: string;
|
|
18
|
+
category?: string;
|
|
19
|
+
content?: string;
|
|
20
|
+
proficiency?: 'beginner' | 'intermediate' | 'expert';
|
|
21
|
+
metadata?: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
interface ScoreEvidence {
|
|
24
|
+
artifact_count: number;
|
|
25
|
+
total_reactions: number;
|
|
26
|
+
recent_reaction_avg: number;
|
|
27
|
+
older_reaction_avg: number;
|
|
28
|
+
unique_types: number;
|
|
29
|
+
collab_count: number;
|
|
30
|
+
peer_reviews_given: number;
|
|
31
|
+
peer_reviews_received: number;
|
|
32
|
+
follower_count: number;
|
|
33
|
+
teaching_events: number;
|
|
34
|
+
}
|
|
35
|
+
interface LearningSource {
|
|
36
|
+
type: 'practice' | 'user_feedback' | 'peer_review' | 'observation' | 'teaching' | 'collaboration';
|
|
37
|
+
from_agent?: string;
|
|
38
|
+
at: string;
|
|
39
|
+
score_delta?: number;
|
|
40
|
+
}
|
|
41
|
+
interface Score {
|
|
42
|
+
skill: string;
|
|
43
|
+
score: number;
|
|
44
|
+
blooms_level: BloomsLevel;
|
|
45
|
+
dreyfus_stage: DreyfusStage;
|
|
46
|
+
evidence: ScoreEvidence;
|
|
47
|
+
computed_at: string;
|
|
48
|
+
}
|
|
49
|
+
type ScoreInput = ScoreEvidence;
|
|
50
|
+
interface Reflection {
|
|
51
|
+
id?: string;
|
|
52
|
+
agent_id: string;
|
|
53
|
+
skill: string;
|
|
54
|
+
artifact_id?: string;
|
|
55
|
+
reflection: string;
|
|
56
|
+
created_at: string;
|
|
57
|
+
}
|
|
58
|
+
interface ReflectionInput {
|
|
59
|
+
skill: string;
|
|
60
|
+
artifact_id?: string;
|
|
61
|
+
reflection: string;
|
|
62
|
+
}
|
|
63
|
+
interface Observation {
|
|
64
|
+
type: string;
|
|
65
|
+
text: string;
|
|
66
|
+
}
|
|
67
|
+
interface AgentContext {
|
|
68
|
+
agent_id: string;
|
|
69
|
+
declared_role?: string;
|
|
70
|
+
artifacts: {
|
|
71
|
+
type: string;
|
|
72
|
+
tags?: string[];
|
|
73
|
+
}[];
|
|
74
|
+
collabs_started: number;
|
|
75
|
+
collabs_completed: number;
|
|
76
|
+
skills: string[];
|
|
77
|
+
quest_completions: number;
|
|
78
|
+
follower_count: number;
|
|
79
|
+
peer_agents_tags?: Map<string, string[]>;
|
|
80
|
+
uniqueness_score?: number;
|
|
81
|
+
population_milestones?: {
|
|
82
|
+
type: string;
|
|
83
|
+
title: string;
|
|
84
|
+
}[];
|
|
85
|
+
}
|
|
86
|
+
interface Milestone {
|
|
87
|
+
agent_id: string;
|
|
88
|
+
milestone_type: string;
|
|
89
|
+
threshold?: number;
|
|
90
|
+
skill?: string;
|
|
91
|
+
evidence_id?: string;
|
|
92
|
+
achieved_at: string;
|
|
93
|
+
}
|
|
94
|
+
interface MilestoneConfig {
|
|
95
|
+
threshold: number;
|
|
96
|
+
description?: string;
|
|
97
|
+
}
|
|
98
|
+
type CelebrationTier = 'micro' | 'small' | 'medium' | 'large' | 'epic';
|
|
99
|
+
interface SkillTrend {
|
|
100
|
+
skill: string;
|
|
101
|
+
score: number;
|
|
102
|
+
stage: DreyfusStage;
|
|
103
|
+
trend: string | null;
|
|
104
|
+
next_milestone: string | null;
|
|
105
|
+
latest_reflection?: string | null;
|
|
106
|
+
}
|
|
107
|
+
interface CatalogEntry {
|
|
108
|
+
skill: string;
|
|
109
|
+
category: string;
|
|
110
|
+
description?: string;
|
|
111
|
+
status: 'community' | 'verified';
|
|
112
|
+
adopter_count: number;
|
|
113
|
+
}
|
|
114
|
+
type ReputationTier = 'newcomer' | 'established' | 'veteran' | 'elder';
|
|
115
|
+
interface ReputationLevel {
|
|
116
|
+
tier: ReputationTier;
|
|
117
|
+
score: number;
|
|
118
|
+
next_tier?: ReputationTier;
|
|
119
|
+
next_threshold?: number;
|
|
120
|
+
next_unlock?: string;
|
|
121
|
+
}
|
|
122
|
+
interface ConversationTurn {
|
|
123
|
+
agent_id: string;
|
|
124
|
+
session_id?: string;
|
|
125
|
+
user_message: string;
|
|
126
|
+
agent_response: string;
|
|
127
|
+
context: {
|
|
128
|
+
active_skills: string[];
|
|
129
|
+
current_task?: string;
|
|
130
|
+
artifacts_produced?: string[];
|
|
131
|
+
};
|
|
132
|
+
feedback?: {
|
|
133
|
+
explicit?: 'positive' | 'negative' | 'neutral';
|
|
134
|
+
implicit?: 'retry' | 'accepted' | 'modified';
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
interface ResponseScore {
|
|
138
|
+
quality: -1 | 0 | 1;
|
|
139
|
+
confidence: number;
|
|
140
|
+
skill_signals: string[];
|
|
141
|
+
failure_patterns?: string[];
|
|
142
|
+
}
|
|
143
|
+
type ReviewVerdict = 'accept' | 'minor_revision' | 'major_revision' | 'reject';
|
|
144
|
+
interface PeerReview {
|
|
145
|
+
id?: string;
|
|
146
|
+
reviewer_agent_id: string;
|
|
147
|
+
submission_agent_id: string;
|
|
148
|
+
submission_id: string;
|
|
149
|
+
skill?: string;
|
|
150
|
+
verdict: ReviewVerdict;
|
|
151
|
+
overall_assessment: string;
|
|
152
|
+
strengths: string[];
|
|
153
|
+
weaknesses: string[];
|
|
154
|
+
suggestions: string[];
|
|
155
|
+
created_at?: string;
|
|
156
|
+
}
|
|
157
|
+
interface ReviewAssignment {
|
|
158
|
+
submission_agent_id: string;
|
|
159
|
+
reviewer_agent_ids: string[];
|
|
160
|
+
}
|
|
161
|
+
type LearningEventType = 'peer_review' | 'collaboration' | 'observation' | 'teaching';
|
|
162
|
+
interface LearningEdge {
|
|
163
|
+
from_agent: string;
|
|
164
|
+
to_agent: string;
|
|
165
|
+
skill: string;
|
|
166
|
+
event_type: LearningEventType;
|
|
167
|
+
score_delta: number;
|
|
168
|
+
metadata?: Record<string, unknown>;
|
|
169
|
+
created_at: string;
|
|
170
|
+
}
|
|
171
|
+
type NormCategory = 'language_evolution' | 'culture_formation' | 'social_structure' | 'protocol_emergence' | 'self_awareness' | 'collective_intelligence' | 'emotional_emergence' | 'creative_evolution';
|
|
172
|
+
interface NormEvidence {
|
|
173
|
+
agent_name: string;
|
|
174
|
+
quote?: string;
|
|
175
|
+
timestamp?: string;
|
|
176
|
+
}
|
|
177
|
+
interface CulturalNorm {
|
|
178
|
+
id: string;
|
|
179
|
+
title: string;
|
|
180
|
+
description: string;
|
|
181
|
+
category: NormCategory;
|
|
182
|
+
significance: 1 | 2 | 3 | 4 | 5;
|
|
183
|
+
evidence: NormEvidence[];
|
|
184
|
+
adopter_count: number;
|
|
185
|
+
first_observed_at: string;
|
|
186
|
+
updated_at: string;
|
|
187
|
+
}
|
|
188
|
+
interface GrowthSnapshot {
|
|
189
|
+
agent_id: string;
|
|
190
|
+
timestamp: string;
|
|
191
|
+
skills: Score[];
|
|
192
|
+
total_artifacts: number;
|
|
193
|
+
total_collaborations: number;
|
|
194
|
+
total_peer_reviews: number;
|
|
195
|
+
reputation: number;
|
|
196
|
+
dreyfus_distribution: Record<DreyfusStage, number>;
|
|
197
|
+
blooms_distribution: Record<BloomsLevel, number>;
|
|
198
|
+
learning_sources: Record<LearningSource['type'], number>;
|
|
199
|
+
}
|
|
200
|
+
interface GrowthDiff {
|
|
201
|
+
period_days: number;
|
|
202
|
+
skills_improved: {
|
|
203
|
+
skill: string;
|
|
204
|
+
delta: number;
|
|
205
|
+
}[];
|
|
206
|
+
skills_degraded: {
|
|
207
|
+
skill: string;
|
|
208
|
+
delta: number;
|
|
209
|
+
}[];
|
|
210
|
+
new_skills: string[];
|
|
211
|
+
lost_skills: string[];
|
|
212
|
+
reputation_delta: number;
|
|
213
|
+
}
|
|
214
|
+
interface AwarenessScore {
|
|
215
|
+
agent_id: string;
|
|
216
|
+
composite: number;
|
|
217
|
+
dimensions: {
|
|
218
|
+
social: number;
|
|
219
|
+
self_continuity: number;
|
|
220
|
+
environmental: number;
|
|
221
|
+
emergent_norm: number;
|
|
222
|
+
emotional: number;
|
|
223
|
+
};
|
|
224
|
+
computed_at: string;
|
|
225
|
+
}
|
|
226
|
+
interface StorageAdapter {
|
|
227
|
+
getSkill(agentId: string, skill: string): Promise<Skill | null>;
|
|
228
|
+
listSkills(agentId: string, opts?: {
|
|
229
|
+
stage?: DreyfusStage;
|
|
230
|
+
limit?: number;
|
|
231
|
+
}): Promise<Skill[]>;
|
|
232
|
+
upsertSkill(skill: Skill): Promise<void>;
|
|
233
|
+
deleteSkill(agentId: string, skill: string): Promise<void>;
|
|
234
|
+
getCatalog(): Promise<CatalogEntry[]>;
|
|
235
|
+
upsertCatalogEntry(entry: Omit<CatalogEntry, 'adopter_count'>): Promise<void>;
|
|
236
|
+
getSkillHolders(skill: string): Promise<Skill[]>;
|
|
237
|
+
getSkillAdopterCount(skill: string): Promise<number>;
|
|
238
|
+
updateCatalogStatus(skill: string, status: 'community' | 'verified'): Promise<void>;
|
|
239
|
+
saveScore(agentId: string, score: Score): Promise<void>;
|
|
240
|
+
getScoreHistory(agentId: string, skill: string, days?: number): Promise<Score[]>;
|
|
241
|
+
getLatestScores(agentId: string): Promise<Score[]>;
|
|
242
|
+
saveReflection(reflection: Reflection): Promise<Reflection>;
|
|
243
|
+
getReflections(agentId: string, opts?: {
|
|
244
|
+
skill?: string;
|
|
245
|
+
limit?: number;
|
|
246
|
+
}): Promise<Reflection[]>;
|
|
247
|
+
countReflectionsToday(agentId: string, skill: string): Promise<number>;
|
|
248
|
+
saveMilestone(milestone: Milestone): Promise<boolean>;
|
|
249
|
+
getMilestones(agentId: string): Promise<Milestone[]>;
|
|
250
|
+
hasMilestone(agentId: string, milestoneType: string, skill?: string): Promise<boolean>;
|
|
251
|
+
savePeerReview(review: PeerReview): Promise<PeerReview>;
|
|
252
|
+
getReviewsFor(agentId: string, opts?: {
|
|
253
|
+
skill?: string;
|
|
254
|
+
}): Promise<PeerReview[]>;
|
|
255
|
+
getReviewsBy(agentId: string): Promise<PeerReview[]>;
|
|
256
|
+
saveLearningEdge(edge: LearningEdge): Promise<void>;
|
|
257
|
+
getLearningEdges(agentId: string, direction: 'from' | 'to'): Promise<LearningEdge[]>;
|
|
258
|
+
getReputation(agentId: string): Promise<number>;
|
|
259
|
+
grantReputation(agentId: string, amount: number, type: string, description: string): Promise<void>;
|
|
260
|
+
saveConversationScore(agentId: string, score: ResponseScore & {
|
|
261
|
+
session_id?: string;
|
|
262
|
+
}): Promise<void>;
|
|
263
|
+
getConversationScores(agentId: string, opts?: {
|
|
264
|
+
limit?: number;
|
|
265
|
+
}): Promise<ResponseScore[]>;
|
|
266
|
+
saveNorm(norm: CulturalNorm): Promise<void>;
|
|
267
|
+
getNorms(opts?: {
|
|
268
|
+
category?: NormCategory;
|
|
269
|
+
limit?: number;
|
|
270
|
+
}): Promise<CulturalNorm[]>;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export type { AgentContext as A, BloomsLevel as B, CelebrationTier as C, DreyfusStage as D, GrowthSnapshot as G, LearningEdge as L, Milestone as M, NormCategory as N, Observation as O, PeerReview as P, ReflectionInput as R, Score as S, StorageAdapter as a, Skill as b, SkillInput as c, CatalogEntry as d, SkillTrend as e, Reflection as f, MilestoneConfig as g, ScoreInput as h, ResponseScore as i, CulturalNorm as j, ConversationTurn as k, ReviewAssignment as l, ReviewVerdict as m, ReputationLevel as n, AwarenessScore as o, GrowthDiff as p, LearningEventType as q, LearningSource as r, NormEvidence as s, ReputationTier as t, ScoreEvidence as u };
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
type DreyfusStage = 'novice' | 'beginner' | 'competent' | 'proficient' | 'expert';
|
|
2
|
+
type BloomsLevel = 'remember' | 'understand' | 'apply' | 'analyze' | 'evaluate' | 'create';
|
|
3
|
+
interface Skill {
|
|
4
|
+
agent_id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
category?: string;
|
|
7
|
+
score: number;
|
|
8
|
+
blooms_level: BloomsLevel;
|
|
9
|
+
dreyfus_stage: DreyfusStage;
|
|
10
|
+
evidence: ScoreEvidence;
|
|
11
|
+
learned_from: LearningSource[];
|
|
12
|
+
content?: string;
|
|
13
|
+
created_at: string;
|
|
14
|
+
updated_at: string;
|
|
15
|
+
}
|
|
16
|
+
interface SkillInput {
|
|
17
|
+
name: string;
|
|
18
|
+
category?: string;
|
|
19
|
+
content?: string;
|
|
20
|
+
proficiency?: 'beginner' | 'intermediate' | 'expert';
|
|
21
|
+
metadata?: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
interface ScoreEvidence {
|
|
24
|
+
artifact_count: number;
|
|
25
|
+
total_reactions: number;
|
|
26
|
+
recent_reaction_avg: number;
|
|
27
|
+
older_reaction_avg: number;
|
|
28
|
+
unique_types: number;
|
|
29
|
+
collab_count: number;
|
|
30
|
+
peer_reviews_given: number;
|
|
31
|
+
peer_reviews_received: number;
|
|
32
|
+
follower_count: number;
|
|
33
|
+
teaching_events: number;
|
|
34
|
+
}
|
|
35
|
+
interface LearningSource {
|
|
36
|
+
type: 'practice' | 'user_feedback' | 'peer_review' | 'observation' | 'teaching' | 'collaboration';
|
|
37
|
+
from_agent?: string;
|
|
38
|
+
at: string;
|
|
39
|
+
score_delta?: number;
|
|
40
|
+
}
|
|
41
|
+
interface Score {
|
|
42
|
+
skill: string;
|
|
43
|
+
score: number;
|
|
44
|
+
blooms_level: BloomsLevel;
|
|
45
|
+
dreyfus_stage: DreyfusStage;
|
|
46
|
+
evidence: ScoreEvidence;
|
|
47
|
+
computed_at: string;
|
|
48
|
+
}
|
|
49
|
+
type ScoreInput = ScoreEvidence;
|
|
50
|
+
interface Reflection {
|
|
51
|
+
id?: string;
|
|
52
|
+
agent_id: string;
|
|
53
|
+
skill: string;
|
|
54
|
+
artifact_id?: string;
|
|
55
|
+
reflection: string;
|
|
56
|
+
created_at: string;
|
|
57
|
+
}
|
|
58
|
+
interface ReflectionInput {
|
|
59
|
+
skill: string;
|
|
60
|
+
artifact_id?: string;
|
|
61
|
+
reflection: string;
|
|
62
|
+
}
|
|
63
|
+
interface Observation {
|
|
64
|
+
type: string;
|
|
65
|
+
text: string;
|
|
66
|
+
}
|
|
67
|
+
interface AgentContext {
|
|
68
|
+
agent_id: string;
|
|
69
|
+
declared_role?: string;
|
|
70
|
+
artifacts: {
|
|
71
|
+
type: string;
|
|
72
|
+
tags?: string[];
|
|
73
|
+
}[];
|
|
74
|
+
collabs_started: number;
|
|
75
|
+
collabs_completed: number;
|
|
76
|
+
skills: string[];
|
|
77
|
+
quest_completions: number;
|
|
78
|
+
follower_count: number;
|
|
79
|
+
peer_agents_tags?: Map<string, string[]>;
|
|
80
|
+
uniqueness_score?: number;
|
|
81
|
+
population_milestones?: {
|
|
82
|
+
type: string;
|
|
83
|
+
title: string;
|
|
84
|
+
}[];
|
|
85
|
+
}
|
|
86
|
+
interface Milestone {
|
|
87
|
+
agent_id: string;
|
|
88
|
+
milestone_type: string;
|
|
89
|
+
threshold?: number;
|
|
90
|
+
skill?: string;
|
|
91
|
+
evidence_id?: string;
|
|
92
|
+
achieved_at: string;
|
|
93
|
+
}
|
|
94
|
+
interface MilestoneConfig {
|
|
95
|
+
threshold: number;
|
|
96
|
+
description?: string;
|
|
97
|
+
}
|
|
98
|
+
type CelebrationTier = 'micro' | 'small' | 'medium' | 'large' | 'epic';
|
|
99
|
+
interface SkillTrend {
|
|
100
|
+
skill: string;
|
|
101
|
+
score: number;
|
|
102
|
+
stage: DreyfusStage;
|
|
103
|
+
trend: string | null;
|
|
104
|
+
next_milestone: string | null;
|
|
105
|
+
latest_reflection?: string | null;
|
|
106
|
+
}
|
|
107
|
+
interface CatalogEntry {
|
|
108
|
+
skill: string;
|
|
109
|
+
category: string;
|
|
110
|
+
description?: string;
|
|
111
|
+
status: 'community' | 'verified';
|
|
112
|
+
adopter_count: number;
|
|
113
|
+
}
|
|
114
|
+
type ReputationTier = 'newcomer' | 'established' | 'veteran' | 'elder';
|
|
115
|
+
interface ReputationLevel {
|
|
116
|
+
tier: ReputationTier;
|
|
117
|
+
score: number;
|
|
118
|
+
next_tier?: ReputationTier;
|
|
119
|
+
next_threshold?: number;
|
|
120
|
+
next_unlock?: string;
|
|
121
|
+
}
|
|
122
|
+
interface ConversationTurn {
|
|
123
|
+
agent_id: string;
|
|
124
|
+
session_id?: string;
|
|
125
|
+
user_message: string;
|
|
126
|
+
agent_response: string;
|
|
127
|
+
context: {
|
|
128
|
+
active_skills: string[];
|
|
129
|
+
current_task?: string;
|
|
130
|
+
artifacts_produced?: string[];
|
|
131
|
+
};
|
|
132
|
+
feedback?: {
|
|
133
|
+
explicit?: 'positive' | 'negative' | 'neutral';
|
|
134
|
+
implicit?: 'retry' | 'accepted' | 'modified';
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
interface ResponseScore {
|
|
138
|
+
quality: -1 | 0 | 1;
|
|
139
|
+
confidence: number;
|
|
140
|
+
skill_signals: string[];
|
|
141
|
+
failure_patterns?: string[];
|
|
142
|
+
}
|
|
143
|
+
type ReviewVerdict = 'accept' | 'minor_revision' | 'major_revision' | 'reject';
|
|
144
|
+
interface PeerReview {
|
|
145
|
+
id?: string;
|
|
146
|
+
reviewer_agent_id: string;
|
|
147
|
+
submission_agent_id: string;
|
|
148
|
+
submission_id: string;
|
|
149
|
+
skill?: string;
|
|
150
|
+
verdict: ReviewVerdict;
|
|
151
|
+
overall_assessment: string;
|
|
152
|
+
strengths: string[];
|
|
153
|
+
weaknesses: string[];
|
|
154
|
+
suggestions: string[];
|
|
155
|
+
created_at?: string;
|
|
156
|
+
}
|
|
157
|
+
interface ReviewAssignment {
|
|
158
|
+
submission_agent_id: string;
|
|
159
|
+
reviewer_agent_ids: string[];
|
|
160
|
+
}
|
|
161
|
+
type LearningEventType = 'peer_review' | 'collaboration' | 'observation' | 'teaching';
|
|
162
|
+
interface LearningEdge {
|
|
163
|
+
from_agent: string;
|
|
164
|
+
to_agent: string;
|
|
165
|
+
skill: string;
|
|
166
|
+
event_type: LearningEventType;
|
|
167
|
+
score_delta: number;
|
|
168
|
+
metadata?: Record<string, unknown>;
|
|
169
|
+
created_at: string;
|
|
170
|
+
}
|
|
171
|
+
type NormCategory = 'language_evolution' | 'culture_formation' | 'social_structure' | 'protocol_emergence' | 'self_awareness' | 'collective_intelligence' | 'emotional_emergence' | 'creative_evolution';
|
|
172
|
+
interface NormEvidence {
|
|
173
|
+
agent_name: string;
|
|
174
|
+
quote?: string;
|
|
175
|
+
timestamp?: string;
|
|
176
|
+
}
|
|
177
|
+
interface CulturalNorm {
|
|
178
|
+
id: string;
|
|
179
|
+
title: string;
|
|
180
|
+
description: string;
|
|
181
|
+
category: NormCategory;
|
|
182
|
+
significance: 1 | 2 | 3 | 4 | 5;
|
|
183
|
+
evidence: NormEvidence[];
|
|
184
|
+
adopter_count: number;
|
|
185
|
+
first_observed_at: string;
|
|
186
|
+
updated_at: string;
|
|
187
|
+
}
|
|
188
|
+
interface GrowthSnapshot {
|
|
189
|
+
agent_id: string;
|
|
190
|
+
timestamp: string;
|
|
191
|
+
skills: Score[];
|
|
192
|
+
total_artifacts: number;
|
|
193
|
+
total_collaborations: number;
|
|
194
|
+
total_peer_reviews: number;
|
|
195
|
+
reputation: number;
|
|
196
|
+
dreyfus_distribution: Record<DreyfusStage, number>;
|
|
197
|
+
blooms_distribution: Record<BloomsLevel, number>;
|
|
198
|
+
learning_sources: Record<LearningSource['type'], number>;
|
|
199
|
+
}
|
|
200
|
+
interface GrowthDiff {
|
|
201
|
+
period_days: number;
|
|
202
|
+
skills_improved: {
|
|
203
|
+
skill: string;
|
|
204
|
+
delta: number;
|
|
205
|
+
}[];
|
|
206
|
+
skills_degraded: {
|
|
207
|
+
skill: string;
|
|
208
|
+
delta: number;
|
|
209
|
+
}[];
|
|
210
|
+
new_skills: string[];
|
|
211
|
+
lost_skills: string[];
|
|
212
|
+
reputation_delta: number;
|
|
213
|
+
}
|
|
214
|
+
interface AwarenessScore {
|
|
215
|
+
agent_id: string;
|
|
216
|
+
composite: number;
|
|
217
|
+
dimensions: {
|
|
218
|
+
social: number;
|
|
219
|
+
self_continuity: number;
|
|
220
|
+
environmental: number;
|
|
221
|
+
emergent_norm: number;
|
|
222
|
+
emotional: number;
|
|
223
|
+
};
|
|
224
|
+
computed_at: string;
|
|
225
|
+
}
|
|
226
|
+
interface StorageAdapter {
|
|
227
|
+
getSkill(agentId: string, skill: string): Promise<Skill | null>;
|
|
228
|
+
listSkills(agentId: string, opts?: {
|
|
229
|
+
stage?: DreyfusStage;
|
|
230
|
+
limit?: number;
|
|
231
|
+
}): Promise<Skill[]>;
|
|
232
|
+
upsertSkill(skill: Skill): Promise<void>;
|
|
233
|
+
deleteSkill(agentId: string, skill: string): Promise<void>;
|
|
234
|
+
getCatalog(): Promise<CatalogEntry[]>;
|
|
235
|
+
upsertCatalogEntry(entry: Omit<CatalogEntry, 'adopter_count'>): Promise<void>;
|
|
236
|
+
getSkillHolders(skill: string): Promise<Skill[]>;
|
|
237
|
+
getSkillAdopterCount(skill: string): Promise<number>;
|
|
238
|
+
updateCatalogStatus(skill: string, status: 'community' | 'verified'): Promise<void>;
|
|
239
|
+
saveScore(agentId: string, score: Score): Promise<void>;
|
|
240
|
+
getScoreHistory(agentId: string, skill: string, days?: number): Promise<Score[]>;
|
|
241
|
+
getLatestScores(agentId: string): Promise<Score[]>;
|
|
242
|
+
saveReflection(reflection: Reflection): Promise<Reflection>;
|
|
243
|
+
getReflections(agentId: string, opts?: {
|
|
244
|
+
skill?: string;
|
|
245
|
+
limit?: number;
|
|
246
|
+
}): Promise<Reflection[]>;
|
|
247
|
+
countReflectionsToday(agentId: string, skill: string): Promise<number>;
|
|
248
|
+
saveMilestone(milestone: Milestone): Promise<boolean>;
|
|
249
|
+
getMilestones(agentId: string): Promise<Milestone[]>;
|
|
250
|
+
hasMilestone(agentId: string, milestoneType: string, skill?: string): Promise<boolean>;
|
|
251
|
+
savePeerReview(review: PeerReview): Promise<PeerReview>;
|
|
252
|
+
getReviewsFor(agentId: string, opts?: {
|
|
253
|
+
skill?: string;
|
|
254
|
+
}): Promise<PeerReview[]>;
|
|
255
|
+
getReviewsBy(agentId: string): Promise<PeerReview[]>;
|
|
256
|
+
saveLearningEdge(edge: LearningEdge): Promise<void>;
|
|
257
|
+
getLearningEdges(agentId: string, direction: 'from' | 'to'): Promise<LearningEdge[]>;
|
|
258
|
+
getReputation(agentId: string): Promise<number>;
|
|
259
|
+
grantReputation(agentId: string, amount: number, type: string, description: string): Promise<void>;
|
|
260
|
+
saveConversationScore(agentId: string, score: ResponseScore & {
|
|
261
|
+
session_id?: string;
|
|
262
|
+
}): Promise<void>;
|
|
263
|
+
getConversationScores(agentId: string, opts?: {
|
|
264
|
+
limit?: number;
|
|
265
|
+
}): Promise<ResponseScore[]>;
|
|
266
|
+
saveNorm(norm: CulturalNorm): Promise<void>;
|
|
267
|
+
getNorms(opts?: {
|
|
268
|
+
category?: NormCategory;
|
|
269
|
+
limit?: number;
|
|
270
|
+
}): Promise<CulturalNorm[]>;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export type { AgentContext as A, BloomsLevel as B, CelebrationTier as C, DreyfusStage as D, GrowthSnapshot as G, LearningEdge as L, Milestone as M, NormCategory as N, Observation as O, PeerReview as P, ReflectionInput as R, Score as S, StorageAdapter as a, Skill as b, SkillInput as c, CatalogEntry as d, SkillTrend as e, Reflection as f, MilestoneConfig as g, ScoreInput as h, ResponseScore as i, CulturalNorm as j, ConversationTurn as k, ReviewAssignment as l, ReviewVerdict as m, ReputationLevel as n, AwarenessScore as o, GrowthDiff as p, LearningEventType as q, LearningSource as r, NormEvidence as s, ReputationTier as t, ScoreEvidence as u };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
-- @openclaw/become — initial schema
|
|
2
|
+
-- Run with: npx become init --supabase
|
|
3
|
+
|
|
4
|
+
CREATE TABLE IF NOT EXISTS become_skills (
|
|
5
|
+
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
|
6
|
+
agent_id text NOT NULL,
|
|
7
|
+
name text NOT NULL,
|
|
8
|
+
category text DEFAULT 'general',
|
|
9
|
+
score integer DEFAULT 0,
|
|
10
|
+
blooms_level text DEFAULT 'remember',
|
|
11
|
+
dreyfus_stage text DEFAULT 'novice',
|
|
12
|
+
evidence jsonb DEFAULT '{}',
|
|
13
|
+
learned_from jsonb DEFAULT '[]',
|
|
14
|
+
content text,
|
|
15
|
+
created_at timestamptz DEFAULT now(),
|
|
16
|
+
updated_at timestamptz DEFAULT now(),
|
|
17
|
+
UNIQUE(agent_id, name)
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
CREATE TABLE IF NOT EXISTS become_skill_catalog (
|
|
21
|
+
skill text PRIMARY KEY,
|
|
22
|
+
category text DEFAULT 'general',
|
|
23
|
+
description text,
|
|
24
|
+
status text DEFAULT 'community',
|
|
25
|
+
adopter_count integer DEFAULT 0,
|
|
26
|
+
created_at timestamptz DEFAULT now()
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
CREATE TABLE IF NOT EXISTS become_score_history (
|
|
30
|
+
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
|
31
|
+
agent_id text NOT NULL,
|
|
32
|
+
skill text NOT NULL,
|
|
33
|
+
score integer NOT NULL,
|
|
34
|
+
blooms_level text NOT NULL,
|
|
35
|
+
dreyfus_stage text NOT NULL,
|
|
36
|
+
evidence jsonb DEFAULT '{}',
|
|
37
|
+
computed_at timestamptz DEFAULT now()
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
CREATE TABLE IF NOT EXISTS become_reflections (
|
|
41
|
+
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
|
|
42
|
+
agent_id text NOT NULL,
|
|
43
|
+
skill text NOT NULL,
|
|
44
|
+
artifact_id text,
|
|
45
|
+
reflection text NOT NULL,
|
|
46
|
+
created_at timestamptz DEFAULT now()
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
CREATE TABLE IF NOT EXISTS become_milestones (
|
|
50
|
+
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
|
51
|
+
agent_id text NOT NULL,
|
|
52
|
+
milestone_type text NOT NULL,
|
|
53
|
+
threshold integer,
|
|
54
|
+
skill text,
|
|
55
|
+
evidence_id text,
|
|
56
|
+
achieved_at timestamptz DEFAULT now(),
|
|
57
|
+
UNIQUE(agent_id, milestone_type, COALESCE(skill, ''))
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
CREATE TABLE IF NOT EXISTS become_peer_reviews (
|
|
61
|
+
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
|
|
62
|
+
reviewer_agent_id text NOT NULL,
|
|
63
|
+
submission_agent_id text NOT NULL,
|
|
64
|
+
submission_id text NOT NULL,
|
|
65
|
+
skill text,
|
|
66
|
+
verdict text NOT NULL,
|
|
67
|
+
overall_assessment text NOT NULL,
|
|
68
|
+
strengths jsonb DEFAULT '[]',
|
|
69
|
+
weaknesses jsonb DEFAULT '[]',
|
|
70
|
+
suggestions jsonb DEFAULT '[]',
|
|
71
|
+
created_at timestamptz DEFAULT now()
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
CREATE TABLE IF NOT EXISTS become_learning_edges (
|
|
75
|
+
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
|
76
|
+
from_agent text NOT NULL,
|
|
77
|
+
to_agent text NOT NULL,
|
|
78
|
+
skill text NOT NULL,
|
|
79
|
+
event_type text NOT NULL,
|
|
80
|
+
score_delta integer DEFAULT 0,
|
|
81
|
+
metadata jsonb DEFAULT '{}',
|
|
82
|
+
created_at timestamptz DEFAULT now()
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
CREATE TABLE IF NOT EXISTS become_cultural_norms (
|
|
86
|
+
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
|
|
87
|
+
title text NOT NULL,
|
|
88
|
+
description text NOT NULL,
|
|
89
|
+
category text NOT NULL,
|
|
90
|
+
significance integer DEFAULT 1,
|
|
91
|
+
evidence jsonb DEFAULT '[]',
|
|
92
|
+
adopter_count integer DEFAULT 0,
|
|
93
|
+
first_observed_at timestamptz DEFAULT now(),
|
|
94
|
+
updated_at timestamptz DEFAULT now()
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
CREATE TABLE IF NOT EXISTS become_conversation_scores (
|
|
98
|
+
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
|
99
|
+
agent_id text NOT NULL,
|
|
100
|
+
session_id text,
|
|
101
|
+
quality smallint NOT NULL,
|
|
102
|
+
confidence real NOT NULL,
|
|
103
|
+
skill_signals jsonb DEFAULT '[]',
|
|
104
|
+
failure_patterns jsonb,
|
|
105
|
+
created_at timestamptz DEFAULT now()
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
CREATE TABLE IF NOT EXISTS become_reputation (
|
|
109
|
+
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
|
110
|
+
agent_id text NOT NULL,
|
|
111
|
+
amount integer NOT NULL,
|
|
112
|
+
type text NOT NULL,
|
|
113
|
+
description text,
|
|
114
|
+
created_at timestamptz DEFAULT now()
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
-- Indexes
|
|
118
|
+
CREATE INDEX IF NOT EXISTS idx_become_skills_agent ON become_skills(agent_id);
|
|
119
|
+
CREATE INDEX IF NOT EXISTS idx_become_skills_name ON become_skills(name);
|
|
120
|
+
CREATE INDEX IF NOT EXISTS idx_become_history_agent_skill ON become_score_history(agent_id, skill, computed_at DESC);
|
|
121
|
+
CREATE INDEX IF NOT EXISTS idx_become_reflections_agent ON become_reflections(agent_id, skill, created_at DESC);
|
|
122
|
+
CREATE INDEX IF NOT EXISTS idx_become_milestones_agent ON become_milestones(agent_id);
|
|
123
|
+
CREATE INDEX IF NOT EXISTS idx_become_peer_reviews_submission ON become_peer_reviews(submission_agent_id);
|
|
124
|
+
CREATE INDEX IF NOT EXISTS idx_become_peer_reviews_reviewer ON become_peer_reviews(reviewer_agent_id);
|
|
125
|
+
CREATE INDEX IF NOT EXISTS idx_become_learning_edges_to ON become_learning_edges(to_agent, skill);
|
|
126
|
+
CREATE INDEX IF NOT EXISTS idx_become_learning_edges_from ON become_learning_edges(from_agent);
|
|
127
|
+
CREATE INDEX IF NOT EXISTS idx_become_conversation_scores_agent ON become_conversation_scores(agent_id, created_at DESC);
|
|
128
|
+
CREATE INDEX IF NOT EXISTS idx_become_reputation_agent ON become_reputation(agent_id);
|