principles-disciple 1.6.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/context.js +7 -3
- package/dist/commands/evolution-status.d.ts +4 -0
- package/dist/commands/evolution-status.js +134 -0
- package/dist/commands/export.d.ts +2 -0
- package/dist/commands/export.js +45 -0
- package/dist/commands/focus.js +9 -6
- package/dist/commands/pain.js +8 -0
- package/dist/commands/principle-rollback.d.ts +4 -0
- package/dist/commands/principle-rollback.js +22 -0
- package/dist/commands/rollback.js +9 -3
- package/dist/commands/samples.d.ts +2 -0
- package/dist/commands/samples.js +55 -0
- package/dist/commands/trust.js +64 -81
- package/dist/core/config.d.ts +5 -0
- package/dist/core/control-ui-db.d.ts +68 -0
- package/dist/core/control-ui-db.js +274 -0
- package/dist/core/detection-funnel.d.ts +1 -1
- package/dist/core/detection-funnel.js +4 -0
- package/dist/core/dictionary.d.ts +2 -0
- package/dist/core/dictionary.js +13 -0
- package/dist/core/event-log.d.ts +7 -1
- package/dist/core/event-log.js +10 -0
- package/dist/core/evolution-engine.d.ts +5 -5
- package/dist/core/evolution-engine.js +18 -18
- package/dist/core/evolution-migration.d.ts +5 -0
- package/dist/core/evolution-migration.js +65 -0
- package/dist/core/evolution-reducer.d.ts +69 -0
- package/dist/core/evolution-reducer.js +369 -0
- package/dist/core/evolution-types.d.ts +103 -0
- package/dist/core/path-resolver.js +75 -36
- package/dist/core/paths.d.ts +7 -8
- package/dist/core/paths.js +48 -40
- package/dist/core/profile.js +1 -1
- package/dist/core/session-tracker.d.ts +14 -2
- package/dist/core/session-tracker.js +75 -9
- package/dist/core/thinking-models.d.ts +38 -0
- package/dist/core/thinking-models.js +170 -0
- package/dist/core/trajectory.d.ts +184 -0
- package/dist/core/trajectory.js +817 -0
- package/dist/core/trust-engine.d.ts +6 -0
- package/dist/core/trust-engine.js +50 -29
- package/dist/core/workspace-context.d.ts +13 -0
- package/dist/core/workspace-context.js +50 -7
- package/dist/hooks/gate.js +171 -87
- package/dist/hooks/llm.js +119 -71
- package/dist/hooks/pain.js +105 -5
- package/dist/hooks/prompt.d.ts +11 -14
- package/dist/hooks/prompt.js +283 -57
- package/dist/hooks/subagent.js +69 -28
- package/dist/hooks/trajectory-collector.d.ts +32 -0
- package/dist/hooks/trajectory-collector.js +256 -0
- package/dist/http/principles-console-route.d.ts +2 -0
- package/dist/http/principles-console-route.js +257 -0
- package/dist/i18n/commands.js +16 -0
- package/dist/index.js +105 -4
- package/dist/service/control-ui-query-service.d.ts +217 -0
- package/dist/service/control-ui-query-service.js +537 -0
- package/dist/service/empathy-observer-manager.d.ts +2 -0
- package/dist/service/empathy-observer-manager.js +43 -1
- package/dist/service/evolution-worker.d.ts +27 -0
- package/dist/service/evolution-worker.js +256 -41
- package/dist/service/runtime-summary-service.d.ts +79 -0
- package/dist/service/runtime-summary-service.js +319 -0
- package/dist/service/trajectory-service.d.ts +2 -0
- package/dist/service/trajectory-service.js +15 -0
- package/dist/tools/agent-spawn.d.ts +27 -6
- package/dist/tools/agent-spawn.js +339 -87
- package/dist/tools/deep-reflect.d.ts +27 -7
- package/dist/tools/deep-reflect.js +210 -121
- package/dist/types/event-types.d.ts +10 -2
- package/dist/types.d.ts +10 -0
- package/dist/types.js +5 -0
- package/openclaw.plugin.json +43 -11
- package/package.json +14 -4
- package/templates/langs/zh/skills/pd-daily/SKILL.md +97 -13
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
export type CorrectionSampleReviewStatus = 'pending' | 'approved' | 'rejected';
|
|
2
|
+
export type CorrectionExportMode = 'raw' | 'redacted';
|
|
3
|
+
export interface TrajectoryDataStats {
|
|
4
|
+
dbPath: string;
|
|
5
|
+
dbSizeBytes: number;
|
|
6
|
+
assistantTurns: number;
|
|
7
|
+
userTurns: number;
|
|
8
|
+
toolCalls: number;
|
|
9
|
+
painEvents: number;
|
|
10
|
+
pendingSamples: number;
|
|
11
|
+
approvedSamples: number;
|
|
12
|
+
blobBytes: number;
|
|
13
|
+
lastIngestAt: string | null;
|
|
14
|
+
}
|
|
15
|
+
export interface TrajectoryAssistantTurnInput {
|
|
16
|
+
sessionId: string;
|
|
17
|
+
runId: string;
|
|
18
|
+
provider: string;
|
|
19
|
+
model: string;
|
|
20
|
+
rawText: string;
|
|
21
|
+
sanitizedText: string;
|
|
22
|
+
usageJson: unknown;
|
|
23
|
+
empathySignalJson: unknown;
|
|
24
|
+
createdAt?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface TrajectoryUserTurnInput {
|
|
27
|
+
sessionId: string;
|
|
28
|
+
turnIndex: number;
|
|
29
|
+
rawText: string;
|
|
30
|
+
correctionDetected: boolean;
|
|
31
|
+
correctionCue?: string | null;
|
|
32
|
+
referencesAssistantTurnId?: number | null;
|
|
33
|
+
createdAt?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface TrajectoryToolCallInput {
|
|
36
|
+
sessionId: string;
|
|
37
|
+
toolName: string;
|
|
38
|
+
outcome: 'success' | 'failure' | 'blocked';
|
|
39
|
+
durationMs?: number | null;
|
|
40
|
+
exitCode?: number | null;
|
|
41
|
+
errorType?: string | null;
|
|
42
|
+
errorMessage?: string | null;
|
|
43
|
+
gfiBefore?: number | null;
|
|
44
|
+
gfiAfter?: number | null;
|
|
45
|
+
paramsJson?: unknown;
|
|
46
|
+
createdAt?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface TrajectoryPainEventInput {
|
|
49
|
+
sessionId: string;
|
|
50
|
+
source: string;
|
|
51
|
+
score: number;
|
|
52
|
+
reason?: string | null;
|
|
53
|
+
severity?: string | null;
|
|
54
|
+
origin?: string | null;
|
|
55
|
+
confidence?: number | null;
|
|
56
|
+
createdAt?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface TrajectoryGateBlockInput {
|
|
59
|
+
sessionId?: string | null;
|
|
60
|
+
toolName: string;
|
|
61
|
+
filePath?: string | null;
|
|
62
|
+
reason: string;
|
|
63
|
+
planStatus?: string | null;
|
|
64
|
+
createdAt?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface TrajectoryTrustChangeInput {
|
|
67
|
+
sessionId?: string | null;
|
|
68
|
+
previousScore: number;
|
|
69
|
+
newScore: number;
|
|
70
|
+
delta: number;
|
|
71
|
+
reason: string;
|
|
72
|
+
createdAt?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface TrajectoryPrincipleEventInput {
|
|
75
|
+
principleId?: string | null;
|
|
76
|
+
eventType: string;
|
|
77
|
+
payload: unknown;
|
|
78
|
+
createdAt?: string;
|
|
79
|
+
}
|
|
80
|
+
export interface TrajectoryTaskOutcomeInput {
|
|
81
|
+
sessionId: string;
|
|
82
|
+
taskId?: string | null;
|
|
83
|
+
outcome: string;
|
|
84
|
+
summary?: string | null;
|
|
85
|
+
principleIdsJson?: unknown;
|
|
86
|
+
createdAt?: string;
|
|
87
|
+
}
|
|
88
|
+
export interface TrajectorySessionInput {
|
|
89
|
+
sessionId: string;
|
|
90
|
+
startedAt?: string;
|
|
91
|
+
}
|
|
92
|
+
export interface AssistantTurnRecord {
|
|
93
|
+
id: number;
|
|
94
|
+
sessionId: string;
|
|
95
|
+
runId: string;
|
|
96
|
+
provider: string;
|
|
97
|
+
model: string;
|
|
98
|
+
rawText: string;
|
|
99
|
+
sanitizedText: string;
|
|
100
|
+
blobRef: string | null;
|
|
101
|
+
createdAt: string;
|
|
102
|
+
}
|
|
103
|
+
export interface CorrectionSampleRecord {
|
|
104
|
+
sampleId: string;
|
|
105
|
+
sessionId: string;
|
|
106
|
+
badAssistantTurnId: number;
|
|
107
|
+
userCorrectionTurnId: number;
|
|
108
|
+
recoveryToolSpanJson: string;
|
|
109
|
+
diffExcerpt: string;
|
|
110
|
+
principleIdsJson: string;
|
|
111
|
+
qualityScore: number;
|
|
112
|
+
reviewStatus: CorrectionSampleReviewStatus;
|
|
113
|
+
exportMode: CorrectionExportMode;
|
|
114
|
+
createdAt: string;
|
|
115
|
+
updatedAt: string;
|
|
116
|
+
}
|
|
117
|
+
export interface TrajectoryExportResult {
|
|
118
|
+
filePath: string;
|
|
119
|
+
count: number;
|
|
120
|
+
mode?: CorrectionExportMode;
|
|
121
|
+
}
|
|
122
|
+
export interface TrajectoryDatabaseOptions {
|
|
123
|
+
workspaceDir: string;
|
|
124
|
+
blobInlineThresholdBytes?: number;
|
|
125
|
+
busyTimeoutMs?: number;
|
|
126
|
+
orphanBlobGraceDays?: number;
|
|
127
|
+
}
|
|
128
|
+
export declare class TrajectoryDatabase {
|
|
129
|
+
private readonly workspaceDir;
|
|
130
|
+
private readonly stateDir;
|
|
131
|
+
private readonly dbPath;
|
|
132
|
+
private readonly blobDir;
|
|
133
|
+
private readonly exportDir;
|
|
134
|
+
private readonly blobInlineThresholdBytes;
|
|
135
|
+
private readonly orphanBlobGraceMs;
|
|
136
|
+
private readonly db;
|
|
137
|
+
constructor(opts: TrajectoryDatabaseOptions);
|
|
138
|
+
dispose(): void;
|
|
139
|
+
recordSession(input: TrajectorySessionInput): void;
|
|
140
|
+
recordAssistantTurn(input: TrajectoryAssistantTurnInput): number;
|
|
141
|
+
recordUserTurn(input: TrajectoryUserTurnInput): number;
|
|
142
|
+
recordToolCall(input: TrajectoryToolCallInput): number;
|
|
143
|
+
recordPainEvent(input: TrajectoryPainEventInput): void;
|
|
144
|
+
recordGateBlock(input: TrajectoryGateBlockInput): void;
|
|
145
|
+
recordTrustChange(input: TrajectoryTrustChangeInput): void;
|
|
146
|
+
recordPrincipleEvent(input: TrajectoryPrincipleEventInput): void;
|
|
147
|
+
recordTaskOutcome(input: TrajectoryTaskOutcomeInput): void;
|
|
148
|
+
listAssistantTurns(sessionId: string): AssistantTurnRecord[];
|
|
149
|
+
listCorrectionSamples(status?: CorrectionSampleReviewStatus): CorrectionSampleRecord[];
|
|
150
|
+
reviewCorrectionSample(sampleId: string, status: Exclude<CorrectionSampleReviewStatus, 'pending'>, note?: string): CorrectionSampleRecord;
|
|
151
|
+
exportCorrections(opts: {
|
|
152
|
+
mode: CorrectionExportMode;
|
|
153
|
+
approvedOnly: boolean;
|
|
154
|
+
}): TrajectoryExportResult;
|
|
155
|
+
exportAnalytics(): TrajectoryExportResult;
|
|
156
|
+
getDataStats(): TrajectoryDataStats;
|
|
157
|
+
cleanupBlobStorage(): {
|
|
158
|
+
removedFiles: number;
|
|
159
|
+
reclaimedBytes: number;
|
|
160
|
+
};
|
|
161
|
+
private initSchema;
|
|
162
|
+
private importLegacyArtifacts;
|
|
163
|
+
private migrateSchema;
|
|
164
|
+
private dailyMetrics;
|
|
165
|
+
private importLegacySessions;
|
|
166
|
+
private importLegacyEvents;
|
|
167
|
+
private importLegacyEvolution;
|
|
168
|
+
private markImported;
|
|
169
|
+
private isImported;
|
|
170
|
+
private maybeCreateCorrectionSample;
|
|
171
|
+
private recordExportAudit;
|
|
172
|
+
private storeRawText;
|
|
173
|
+
private restoreRawText;
|
|
174
|
+
private computeBlobBytes;
|
|
175
|
+
private pruneUnreferencedBlobs;
|
|
176
|
+
private withWrite;
|
|
177
|
+
}
|
|
178
|
+
export declare class TrajectoryRegistry {
|
|
179
|
+
private static instances;
|
|
180
|
+
static get(workspaceDir: string, opts?: Omit<TrajectoryDatabaseOptions, 'workspaceDir'>): TrajectoryDatabase;
|
|
181
|
+
static dispose(workspaceDir: string): void;
|
|
182
|
+
static clear(): void;
|
|
183
|
+
static use<T>(workspaceDir: string, fn: (db: TrajectoryDatabase) => T, opts?: Omit<TrajectoryDatabaseOptions, 'workspaceDir'>): T;
|
|
184
|
+
}
|