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
package/dist/i18n/commands.js
CHANGED
|
@@ -66,9 +66,25 @@ export const commandDescriptions = {
|
|
|
66
66
|
zh: '管理 CURRENT_FOCUS.md [status|history|compress|rollback] - 查看/压缩/回滚焦点文件',
|
|
67
67
|
en: 'Manage CURRENT_FOCUS.md [status|history|compress|rollback] - View/compress/rollback focus file'
|
|
68
68
|
},
|
|
69
|
+
'pd-evolution-status': {
|
|
70
|
+
zh: '查看 evolution 闭环状态(candidate/probation/active)',
|
|
71
|
+
en: 'Show evolution loop status (candidate/probation/active)'
|
|
72
|
+
},
|
|
73
|
+
'pd-principle-rollback': {
|
|
74
|
+
zh: '回滚原则并加入黑名单 <principle-id> [reason]',
|
|
75
|
+
en: 'Rollback principle and blacklist pattern <principle-id> [reason]'
|
|
76
|
+
},
|
|
69
77
|
'pd-rollback': {
|
|
70
78
|
zh: '回滚情绪事件惩罚 <event-id>|last',
|
|
71
79
|
en: 'Rollback empathy event penalty <event-id>|last'
|
|
80
|
+
},
|
|
81
|
+
'pd-export': {
|
|
82
|
+
zh: '导出 analytics 或纠错样本 [analytics|corrections --redacted]',
|
|
83
|
+
en: 'Export analytics or correction samples [analytics|corrections --redacted]'
|
|
84
|
+
},
|
|
85
|
+
'pd-samples': {
|
|
86
|
+
zh: '查看或审核纠错样本 [review approve|reject <sample-id> [note]]',
|
|
87
|
+
en: 'List or review correction samples [review approve|reject <sample-id> [note]]'
|
|
72
88
|
}
|
|
73
89
|
};
|
|
74
90
|
/**
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { handleBeforeReset, handleBeforeCompaction, handleAfterCompaction } from
|
|
|
6
6
|
import { handleLlmOutput } from './hooks/llm.js';
|
|
7
7
|
import { handleSubagentEnded } from './hooks/subagent.js';
|
|
8
8
|
import { handleBeforeMessageWrite } from './hooks/message-sanitize.js';
|
|
9
|
+
import * as TrajectoryCollector from './hooks/trajectory-collector.js';
|
|
9
10
|
import { handleInitStrategy, handleManageOkr } from './commands/strategy.js';
|
|
10
11
|
import { handleBootstrapTools, handleResearchTools } from './commands/capabilities.js';
|
|
11
12
|
import { handleThinkingOs } from './commands/thinking-os.js';
|
|
@@ -15,13 +16,19 @@ import { handlePainCommand } from './commands/pain.js';
|
|
|
15
16
|
import { handleContextCommand } from './commands/context.js';
|
|
16
17
|
import { handleFocusCommand } from './commands/focus.js';
|
|
17
18
|
import { handleRollbackCommand } from './commands/rollback.js';
|
|
19
|
+
import { handleEvolutionStatusCommand } from './commands/evolution-status.js';
|
|
20
|
+
import { handlePrincipleRollbackCommand } from './commands/principle-rollback.js';
|
|
21
|
+
import { handleExportCommand } from './commands/export.js';
|
|
22
|
+
import { handleSamplesCommand } from './commands/samples.js';
|
|
18
23
|
import { EvolutionWorkerService } from './service/evolution-worker.js';
|
|
24
|
+
import { TrajectoryService } from './service/trajectory-service.js';
|
|
19
25
|
import { ensureWorkspaceTemplates } from './core/init.js';
|
|
20
26
|
import { migrateDirectoryStructure } from './core/migration.js';
|
|
21
27
|
import { SystemLogger } from './core/system-logger.js';
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
28
|
+
import { createDeepReflectTool } from './tools/deep-reflect.js';
|
|
29
|
+
import { createAgentSpawnTool } from './tools/agent-spawn.js';
|
|
24
30
|
import { PathResolver } from './core/path-resolver.js';
|
|
31
|
+
import { createPrinciplesConsoleRoute } from './http/principles-console-route.js';
|
|
25
32
|
// Track initialization to avoid repeated calls
|
|
26
33
|
let workspaceInitialized = false;
|
|
27
34
|
const plugin = {
|
|
@@ -30,6 +37,7 @@ const plugin = {
|
|
|
30
37
|
register(api) {
|
|
31
38
|
api.logger.info("Principles Disciple Plugin registered.");
|
|
32
39
|
PathResolver.setExtensionRoot(api.rootDir);
|
|
40
|
+
api.registerHttpRoute(createPrinciplesConsoleRoute(api));
|
|
33
41
|
const language = api.pluginConfig?.language || 'en';
|
|
34
42
|
// ── Hook: Prompt Building ──
|
|
35
43
|
api.on('before_prompt_build', async (event, ctx) => {
|
|
@@ -90,6 +98,27 @@ const plugin = {
|
|
|
90
98
|
api.logger.error(`[PD] Error in before_message_write: ${String(err)}`);
|
|
91
99
|
}
|
|
92
100
|
});
|
|
101
|
+
// ── Hook: Trajectory Collection (Behavior Evolution Phase 0) ──
|
|
102
|
+
// Note: after_tool_call and llm_output are safe to collect
|
|
103
|
+
// before_message_write conflicts with message-sanitize, skipping for now
|
|
104
|
+
api.on('after_tool_call', (event, ctx) => {
|
|
105
|
+
try {
|
|
106
|
+
const workspaceDir = ctx.workspaceDir || api.resolvePath('.');
|
|
107
|
+
TrajectoryCollector.handleAfterToolCall(event, { ...ctx, workspaceDir });
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
// Non-critical: don't log, just skip
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
api.on('llm_output', (event, ctx) => {
|
|
114
|
+
try {
|
|
115
|
+
const workspaceDir = ctx.workspaceDir || api.resolvePath('.');
|
|
116
|
+
TrajectoryCollector.handleLlmOutput(event, { ...ctx, workspaceDir });
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
// Non-critical: don't log, just skip
|
|
120
|
+
}
|
|
121
|
+
});
|
|
93
122
|
// ── Hook: Subagent Loop Closure ──
|
|
94
123
|
api.on('subagent_spawning', (_event, _ctx) => {
|
|
95
124
|
// No-op for now, just to satisfy the interface expected by tests.
|
|
@@ -121,6 +150,7 @@ const plugin = {
|
|
|
121
150
|
try {
|
|
122
151
|
EvolutionWorkerService.api = api;
|
|
123
152
|
api.registerService(EvolutionWorkerService);
|
|
153
|
+
api.registerService(TrajectoryService);
|
|
124
154
|
}
|
|
125
155
|
catch (err) {
|
|
126
156
|
api.logger.error(`[PD] Failed to register EvolutionWorkerService: ${String(err)}`);
|
|
@@ -196,6 +226,8 @@ const plugin = {
|
|
|
196
226
|
| \`/pd-status\` | 查看进化状态 | 想了解当前 GFI 和 Pain 情况 |
|
|
197
227
|
| \`/pd-trust\` | 查看信任分数 | 想知道自己的权限等级 |
|
|
198
228
|
| \`/pd-focus\` | 焦点文件管理 | 查看/压缩/回滚历史版本 |
|
|
229
|
+
| \`/pd-export\` | 导出分析/样本 | 导出 analytics 或纠错样本 |
|
|
230
|
+
| \`/pd-samples\` | 审核纠错样本 | 查看待审核样本并批准/拒绝 |
|
|
199
231
|
|
|
200
232
|
## ⚙️ 配置管理
|
|
201
233
|
| 命令 | 用途 | 使用时机 |
|
|
@@ -253,6 +285,8 @@ const plugin = {
|
|
|
253
285
|
| \`/pd-status\` | View evolution status | Check GFI and Pain status |
|
|
254
286
|
| \`/pd-trust\` | View trust score | Check your permission level |
|
|
255
287
|
| \`/pd-focus\` | Focus file management | View/compress/rollback history |
|
|
288
|
+
| \`/pd-export\` | Export analytics/samples | Export analytics or correction samples |
|
|
289
|
+
| \`/pd-samples\` | Review correction samples | Review pending correction samples |
|
|
256
290
|
|
|
257
291
|
## ⚙️ Configuration
|
|
258
292
|
| Command | Purpose | When to Use |
|
|
@@ -356,6 +390,39 @@ const plugin = {
|
|
|
356
390
|
}
|
|
357
391
|
}
|
|
358
392
|
});
|
|
393
|
+
api.registerCommand({
|
|
394
|
+
name: "pd-evolution-status",
|
|
395
|
+
description: getCommandDescription('pd-evolution-status', language),
|
|
396
|
+
handler: (ctx) => {
|
|
397
|
+
try {
|
|
398
|
+
const workspaceDir = api.resolvePath('.');
|
|
399
|
+
if (ctx.config)
|
|
400
|
+
ctx.config.workspaceDir = workspaceDir;
|
|
401
|
+
return handleEvolutionStatusCommand(ctx);
|
|
402
|
+
}
|
|
403
|
+
catch (err) {
|
|
404
|
+
api.logger.error(`[PD] Command /pd-evolution-status failed: ${String(err)}`);
|
|
405
|
+
return { text: language === 'zh' ? "命令执行失败,请检查日志。" : "Command failed. Check logs." };
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
api.registerCommand({
|
|
410
|
+
name: "pd-principle-rollback",
|
|
411
|
+
description: getCommandDescription('pd-principle-rollback', language),
|
|
412
|
+
acceptsArgs: true,
|
|
413
|
+
handler: (ctx) => {
|
|
414
|
+
try {
|
|
415
|
+
const workspaceDir = api.resolvePath('.');
|
|
416
|
+
if (ctx.config)
|
|
417
|
+
ctx.config.workspaceDir = workspaceDir;
|
|
418
|
+
return handlePrincipleRollbackCommand(ctx);
|
|
419
|
+
}
|
|
420
|
+
catch (err) {
|
|
421
|
+
api.logger.error(`[PD] Command /pd-principle-rollback failed: ${String(err)}`);
|
|
422
|
+
return { text: language === 'zh' ? "命令执行失败,请检查日志。" : "Command failed. Check logs." };
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
});
|
|
359
426
|
api.registerCommand({
|
|
360
427
|
name: "pd-rollback",
|
|
361
428
|
description: getCommandDescription('pd-rollback', language),
|
|
@@ -374,8 +441,42 @@ const plugin = {
|
|
|
374
441
|
}
|
|
375
442
|
});
|
|
376
443
|
// ── Tools ──
|
|
377
|
-
api.
|
|
378
|
-
|
|
444
|
+
api.registerCommand({
|
|
445
|
+
name: "pd-export",
|
|
446
|
+
description: getCommandDescription('pd-export', language),
|
|
447
|
+
acceptsArgs: true,
|
|
448
|
+
handler: (ctx) => {
|
|
449
|
+
try {
|
|
450
|
+
const workspaceDir = api.resolvePath('.');
|
|
451
|
+
if (ctx.config)
|
|
452
|
+
ctx.config.workspaceDir = workspaceDir;
|
|
453
|
+
return handleExportCommand(ctx);
|
|
454
|
+
}
|
|
455
|
+
catch (err) {
|
|
456
|
+
api.logger.error(`[PD] Command /pd-export failed: ${String(err)}`);
|
|
457
|
+
return { text: language === 'zh' ? "导出失败,请检查日志。" : "Export failed. Check logs." };
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
api.registerCommand({
|
|
462
|
+
name: "pd-samples",
|
|
463
|
+
description: getCommandDescription('pd-samples', language),
|
|
464
|
+
acceptsArgs: true,
|
|
465
|
+
handler: (ctx) => {
|
|
466
|
+
try {
|
|
467
|
+
const workspaceDir = api.resolvePath('.');
|
|
468
|
+
if (ctx.config)
|
|
469
|
+
ctx.config.workspaceDir = workspaceDir;
|
|
470
|
+
return handleSamplesCommand(ctx);
|
|
471
|
+
}
|
|
472
|
+
catch (err) {
|
|
473
|
+
api.logger.error(`[PD] Command /pd-samples failed: ${String(err)}`);
|
|
474
|
+
return { text: language === 'zh' ? "样本命令执行失败,请检查日志。" : "Samples command failed. Check logs." };
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
api.registerTool(createDeepReflectTool(api));
|
|
479
|
+
api.registerTool(createAgentSpawnTool(api));
|
|
379
480
|
}
|
|
380
481
|
};
|
|
381
482
|
export default plugin;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
export interface OverviewResponse {
|
|
2
|
+
workspaceDir: string;
|
|
3
|
+
generatedAt: string;
|
|
4
|
+
dataFreshness: string | null;
|
|
5
|
+
summary: {
|
|
6
|
+
repeatErrorRate: number;
|
|
7
|
+
userCorrectionRate: number;
|
|
8
|
+
pendingSamples: number;
|
|
9
|
+
approvedSamples: number;
|
|
10
|
+
thinkingCoverageRate: number;
|
|
11
|
+
painEvents: number;
|
|
12
|
+
principleEventCount: number;
|
|
13
|
+
};
|
|
14
|
+
dailyTrend: Array<{
|
|
15
|
+
day: string;
|
|
16
|
+
toolCalls: number;
|
|
17
|
+
failures: number;
|
|
18
|
+
userCorrections: number;
|
|
19
|
+
thinkingTurns: number;
|
|
20
|
+
}>;
|
|
21
|
+
topRegressions: Array<{
|
|
22
|
+
toolName: string;
|
|
23
|
+
errorType: string;
|
|
24
|
+
occurrences: number;
|
|
25
|
+
}>;
|
|
26
|
+
sampleQueue: {
|
|
27
|
+
counters: Record<string, number>;
|
|
28
|
+
preview: Array<{
|
|
29
|
+
sampleId: string;
|
|
30
|
+
sessionId: string;
|
|
31
|
+
qualityScore: number;
|
|
32
|
+
reviewStatus: string;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
}>;
|
|
35
|
+
};
|
|
36
|
+
thinkingSummary: {
|
|
37
|
+
activeModels: number;
|
|
38
|
+
dormantModels: number;
|
|
39
|
+
effectiveModels: number;
|
|
40
|
+
coverageRate: number;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export interface SampleListFilters {
|
|
44
|
+
status?: string;
|
|
45
|
+
qualityMin?: number;
|
|
46
|
+
dateFrom?: string;
|
|
47
|
+
dateTo?: string;
|
|
48
|
+
failureMode?: string;
|
|
49
|
+
page?: number;
|
|
50
|
+
pageSize?: number;
|
|
51
|
+
}
|
|
52
|
+
export interface SamplesResponse {
|
|
53
|
+
counters: Record<string, number>;
|
|
54
|
+
items: Array<{
|
|
55
|
+
sampleId: string;
|
|
56
|
+
sessionId: string;
|
|
57
|
+
reviewStatus: string;
|
|
58
|
+
qualityScore: number;
|
|
59
|
+
failureMode: string;
|
|
60
|
+
relatedThinkingCount: number;
|
|
61
|
+
createdAt: string;
|
|
62
|
+
updatedAt: string;
|
|
63
|
+
diffExcerpt: string;
|
|
64
|
+
}>;
|
|
65
|
+
pagination: {
|
|
66
|
+
page: number;
|
|
67
|
+
pageSize: number;
|
|
68
|
+
total: number;
|
|
69
|
+
totalPages: number;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export interface SampleDetailResponse {
|
|
73
|
+
sampleId: string;
|
|
74
|
+
sessionId: string;
|
|
75
|
+
reviewStatus: string;
|
|
76
|
+
qualityScore: number;
|
|
77
|
+
createdAt: string;
|
|
78
|
+
updatedAt: string;
|
|
79
|
+
badAttempt: {
|
|
80
|
+
assistantTurnId: number;
|
|
81
|
+
rawText: string;
|
|
82
|
+
sanitizedText: string;
|
|
83
|
+
createdAt: string;
|
|
84
|
+
};
|
|
85
|
+
userCorrection: {
|
|
86
|
+
userTurnId: number;
|
|
87
|
+
rawText: string;
|
|
88
|
+
correctionCue: string | null;
|
|
89
|
+
createdAt: string;
|
|
90
|
+
};
|
|
91
|
+
recoveryToolSpan: Array<{
|
|
92
|
+
id: number;
|
|
93
|
+
toolName: string;
|
|
94
|
+
}>;
|
|
95
|
+
relatedPrinciples: Array<{
|
|
96
|
+
principleId: string | null;
|
|
97
|
+
eventType: string;
|
|
98
|
+
createdAt: string;
|
|
99
|
+
}>;
|
|
100
|
+
relatedThinkingHits: Array<{
|
|
101
|
+
id: number;
|
|
102
|
+
modelId: string;
|
|
103
|
+
modelName: string;
|
|
104
|
+
matchedPattern: string;
|
|
105
|
+
scenarios: string[];
|
|
106
|
+
createdAt: string;
|
|
107
|
+
triggerExcerpt: string;
|
|
108
|
+
}>;
|
|
109
|
+
reviewHistory: Array<{
|
|
110
|
+
reviewStatus: string;
|
|
111
|
+
note: string | null;
|
|
112
|
+
createdAt: string;
|
|
113
|
+
}>;
|
|
114
|
+
}
|
|
115
|
+
export interface ThinkingModelSummary {
|
|
116
|
+
modelId: string;
|
|
117
|
+
name: string;
|
|
118
|
+
description: string;
|
|
119
|
+
hits: number;
|
|
120
|
+
coverageRate: number;
|
|
121
|
+
successRate: number;
|
|
122
|
+
failureRate: number;
|
|
123
|
+
painRate: number;
|
|
124
|
+
correctionRate: number;
|
|
125
|
+
correctionSampleRate: number;
|
|
126
|
+
commonScenarios: string[];
|
|
127
|
+
recommendation: 'reinforce' | 'rework' | 'archive';
|
|
128
|
+
}
|
|
129
|
+
export interface ThinkingOverviewResponse {
|
|
130
|
+
summary: {
|
|
131
|
+
totalModels: number;
|
|
132
|
+
activeModels: number;
|
|
133
|
+
dormantModels: number;
|
|
134
|
+
effectiveModels: number;
|
|
135
|
+
coverageRate: number;
|
|
136
|
+
};
|
|
137
|
+
topModels: ThinkingModelSummary[];
|
|
138
|
+
dormantModels: Array<{
|
|
139
|
+
modelId: string;
|
|
140
|
+
name: string;
|
|
141
|
+
description: string;
|
|
142
|
+
}>;
|
|
143
|
+
effectiveModels: ThinkingModelSummary[];
|
|
144
|
+
scenarioMatrix: Array<{
|
|
145
|
+
modelId: string;
|
|
146
|
+
modelName: string;
|
|
147
|
+
scenario: string;
|
|
148
|
+
hits: number;
|
|
149
|
+
}>;
|
|
150
|
+
coverageTrend: Array<{
|
|
151
|
+
day: string;
|
|
152
|
+
assistantTurns: number;
|
|
153
|
+
thinkingTurns: number;
|
|
154
|
+
coverageRate: number;
|
|
155
|
+
}>;
|
|
156
|
+
}
|
|
157
|
+
export interface ThinkingModelDetailResponse {
|
|
158
|
+
modelMeta: {
|
|
159
|
+
modelId: string;
|
|
160
|
+
name: string;
|
|
161
|
+
description: string;
|
|
162
|
+
hits: number;
|
|
163
|
+
coverageRate: number;
|
|
164
|
+
recommendation: 'reinforce' | 'rework' | 'archive';
|
|
165
|
+
};
|
|
166
|
+
usageTrend: Array<{
|
|
167
|
+
day: string;
|
|
168
|
+
hits: number;
|
|
169
|
+
}>;
|
|
170
|
+
scenarioDistribution: Array<{
|
|
171
|
+
scenario: string;
|
|
172
|
+
hits: number;
|
|
173
|
+
}>;
|
|
174
|
+
outcomeStats: {
|
|
175
|
+
events: number;
|
|
176
|
+
successRate: number;
|
|
177
|
+
failureRate: number;
|
|
178
|
+
painRate: number;
|
|
179
|
+
correctionRate: number;
|
|
180
|
+
correctionSampleRate: number;
|
|
181
|
+
};
|
|
182
|
+
recentEvents: Array<{
|
|
183
|
+
id: number;
|
|
184
|
+
createdAt: string;
|
|
185
|
+
matchedPattern: string;
|
|
186
|
+
scenarios: string[];
|
|
187
|
+
triggerExcerpt: string;
|
|
188
|
+
toolContext: Array<{
|
|
189
|
+
toolName: string;
|
|
190
|
+
outcome: string;
|
|
191
|
+
errorType?: string | null;
|
|
192
|
+
}>;
|
|
193
|
+
painContext: Array<{
|
|
194
|
+
source: string;
|
|
195
|
+
score: number;
|
|
196
|
+
}>;
|
|
197
|
+
principleContext: Array<{
|
|
198
|
+
principleId: string | null;
|
|
199
|
+
eventType: string;
|
|
200
|
+
}>;
|
|
201
|
+
}>;
|
|
202
|
+
}
|
|
203
|
+
export declare class ControlUiQueryService {
|
|
204
|
+
private readonly workspaceDir;
|
|
205
|
+
private readonly trajectory;
|
|
206
|
+
private readonly uiDb;
|
|
207
|
+
constructor(workspaceDir: string);
|
|
208
|
+
dispose(): void;
|
|
209
|
+
getOverview(): OverviewResponse;
|
|
210
|
+
listSamples(filters?: SampleListFilters): SamplesResponse;
|
|
211
|
+
getSampleDetail(sampleId: string): SampleDetailResponse | null;
|
|
212
|
+
reviewSample(sampleId: string, decision: 'approved' | 'rejected', note?: string): import("../core/trajectory.js").CorrectionSampleRecord;
|
|
213
|
+
exportCorrections(mode: 'raw' | 'redacted'): import("../core/trajectory.js").TrajectoryExportResult;
|
|
214
|
+
getThinkingOverview(): ThinkingOverviewResponse;
|
|
215
|
+
getThinkingModelDetail(modelId: string): ThinkingModelDetailResponse | null;
|
|
216
|
+
private loadThinkingModelSummaries;
|
|
217
|
+
}
|