create-principles-disciple 1.142.3 → 1.142.4
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/core/dist/runtime-v2/__tests__/pain-signal-observability.test.js +29 -0
- package/core/dist/runtime-v2/__tests__/pain-signal-observability.test.js.map +1 -1
- package/core/dist/runtime-v2/observer/correction-observer.d.ts.map +1 -1
- package/core/dist/runtime-v2/observer/correction-observer.js +5 -0
- package/core/dist/runtime-v2/observer/correction-observer.js.map +1 -1
- package/core/dist/runtime-v2/pain-signal-observability.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-signal-observability.js +16 -0
- package/core/dist/runtime-v2/pain-signal-observability.js.map +1 -1
- package/core/package.json +1 -1
- package/host-runtime/dist/governance-signal-admission.d.ts +3 -1
- package/host-runtime/dist/governance-signal-admission.js +30 -5
- package/host-runtime/package.json +1 -1
- package/package.json +2 -2
- package/pd-cli/dist/commands/runtime-init.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-init.js +2 -0
- package/pd-cli/dist/commands/runtime-init.js.map +1 -1
- package/plugin/dist/bundle.js +477 -428
- package/plugin/dist/core/pd-config-loader.d.ts +2 -0
- package/plugin/dist/core/signal-collector-host.d.ts +39 -0
- package/plugin/dist/core/trajectory-types.d.ts +30 -0
- package/plugin/dist/core/trajectory.d.ts +17 -1
- package/plugin/dist/governance-audit.js +104 -104
- package/plugin/dist/hooks/prompt.d.ts +2 -0
- package/plugin/dist/rulehost-evidence.js +208 -175
- package/plugin/dist/service/correction-observer-service.d.ts +14 -1
- package/plugin/openclaw.plugin.json +1 -1
- package/plugin/package.json +1 -1
- package/release-manager/package.json +2 -2
|
@@ -15,6 +15,8 @@ export interface ObserverConfigResult {
|
|
|
15
15
|
provider: string | null;
|
|
16
16
|
model: string | null;
|
|
17
17
|
timeoutMs: number | null;
|
|
18
|
+
/** PRI-788 G3: profile 的 maxTokens(思考型本地模型需要显式大 token 预算) */
|
|
19
|
+
maxTokens: number | null;
|
|
18
20
|
baseUrl: string | null;
|
|
19
21
|
configErrors?: PluginConfigLoadResult['errors'];
|
|
20
22
|
}
|
|
@@ -54,12 +54,20 @@ export interface SignalCollectorHostOptions {
|
|
|
54
54
|
config?: SignalCollectorConfig;
|
|
55
55
|
/** Stage2 LLM 分类器。null/undefined → 降级纯关键词。 */
|
|
56
56
|
llmClassifier?: SignalLlmClassifier | null;
|
|
57
|
+
/**
|
|
58
|
+
* PRI-788 G3: 关键词确认反馈(earned precision 的证据源)。LLM 确认 verdict
|
|
59
|
+
* 出现时以命中的词回调——wasCorrection=true 记 TP(LLM 确认是纠正),
|
|
60
|
+
* false 记 FP(命中但不是纠正)。由 prompt.ts 接线到 CorrectionCueLearner;
|
|
61
|
+
* 未注入时为 no-op(earned 永不升级,行为=G3 之前)。
|
|
62
|
+
*/
|
|
63
|
+
cueFeedbackRecorder?: (terms: readonly string[], wasCorrection: boolean) => void;
|
|
57
64
|
}
|
|
58
65
|
export declare class SignalCollectorHost {
|
|
59
66
|
private readonly wctx;
|
|
60
67
|
private readonly storeProvider;
|
|
61
68
|
private readonly config;
|
|
62
69
|
private readonly llmClassifier;
|
|
70
|
+
private readonly cueFeedbackRecorder?;
|
|
63
71
|
/** rate limit 状态:sessionId → STRONG 计数桶 */
|
|
64
72
|
private readonly rateLimit;
|
|
65
73
|
constructor(wctx: WorkspaceContext, options?: SignalCollectorHostOptions);
|
|
@@ -87,6 +95,37 @@ export declare class SignalCollectorHost {
|
|
|
87
95
|
* 3. 按 strength 分流:STRONG → emitPainDetectedEvent;WEAK → trackFriction 累积 GFI;none → 仅记录
|
|
88
96
|
*/
|
|
89
97
|
private detectAsyncAndRoute;
|
|
98
|
+
/**
|
|
99
|
+
* PRI-788 G3: 把 LLM 确认 verdict 转成关键词 TP/FP 反馈(earned precision 的
|
|
100
|
+
* 证据源)。recorder 未注入或抛错均不阻塞路由(rc-9:抛错记结构化日志)。
|
|
101
|
+
*/
|
|
102
|
+
private emitCueFeedback;
|
|
103
|
+
/**
|
|
104
|
+
* PRI-788 G2: Stage2 不可用时的持久化兜底。LLM 不可用/超时/解析失败的丢弃
|
|
105
|
+
* 分支改为落库 signal_confirmations(pending),由 CorrectionObserverService
|
|
106
|
+
* 每周期批量确认——通道恢复后信号可补确认,不再"通道死=信号丢"。
|
|
107
|
+
*
|
|
108
|
+
* 只入队"词库命中过的歧义候选":零命中的普通消息体量与噪声不可控,其纠正
|
|
109
|
+
* 语义覆盖由 G3 的词库扩充/earned 解锁承担。
|
|
110
|
+
*/
|
|
111
|
+
private queueUnconfirmedForBatch;
|
|
112
|
+
/**
|
|
113
|
+
* PRI-788 G2: 批量确认一条持久化的待确认信号(CorrectionObserverService 每
|
|
114
|
+
* 周期调用)。用调用方提供的 classifier(每 cycle 新鲜解析)重新分类:
|
|
115
|
+
* correction → 回写标志 + 复用 realtime STRONG 分流(限流/身份派生一致);
|
|
116
|
+
* WEAK → trackFriction;none → rejected;classifier 失败 → failed(调用方
|
|
117
|
+
* attempts++,达上限转 abandoned)。
|
|
118
|
+
*/
|
|
119
|
+
confirmPendingSignal(item: {
|
|
120
|
+
sessionId: string;
|
|
121
|
+
userTurnRowid: number;
|
|
122
|
+
occurrenceId: string;
|
|
123
|
+
excerpt: string;
|
|
124
|
+
terms?: readonly string[];
|
|
125
|
+
}, classifier: SignalLlmClassifier): Promise<{
|
|
126
|
+
disposition: 'confirmed' | 'rejected' | 'failed';
|
|
127
|
+
detail: string;
|
|
128
|
+
}>;
|
|
90
129
|
/**
|
|
91
130
|
* PRI-788 G1: Stage2 确认为纠正后回写 user_turns.correction_detected(G1)。
|
|
92
131
|
* 以 Stage1 写入返回的 rowid 精确寻址(rc-7);rowid 缺失/行已不存在均为
|
|
@@ -246,3 +246,33 @@ export interface RuleHostContextResult {
|
|
|
246
246
|
readonly truncated: boolean;
|
|
247
247
|
}
|
|
248
248
|
export type { DailyMetricRow };
|
|
249
|
+
export type SignalConfirmationStatus = 'pending' | 'confirmed' | 'rejected' | 'abandoned';
|
|
250
|
+
/** 入队载荷(id 由 store 派生:sha256(sessionId:userTurnRowid) 前 12 位)。 */
|
|
251
|
+
export interface SignalConfirmationInput {
|
|
252
|
+
readonly sessionId: string;
|
|
253
|
+
/** Stage1 写入 user_turns 返回的 rowid(G1 回写寻址键;UNIQUE 幂等)。 */
|
|
254
|
+
readonly userTurnRowid: number;
|
|
255
|
+
/** 与 realtime 路径一致的 occurrence 身份(ADR-0020 §11.4,批量确认复现同一 canonical pain)。 */
|
|
256
|
+
readonly occurrenceId: string;
|
|
257
|
+
readonly excerpt: string;
|
|
258
|
+
/** Stage1 命中的词列表(JSON 落库)。 */
|
|
259
|
+
readonly terms: readonly string[];
|
|
260
|
+
/** Stage1 建议类别:correction | empathy。 */
|
|
261
|
+
readonly suggestedType: string;
|
|
262
|
+
readonly createdAt: string;
|
|
263
|
+
}
|
|
264
|
+
/** signal_confirmations 行(camelCase 投影)。 */
|
|
265
|
+
export interface SignalConfirmationRow {
|
|
266
|
+
readonly id: string;
|
|
267
|
+
readonly sessionId: string;
|
|
268
|
+
readonly userTurnRowid: number;
|
|
269
|
+
readonly occurrenceId: string;
|
|
270
|
+
readonly excerpt: string;
|
|
271
|
+
readonly terms: readonly string[];
|
|
272
|
+
readonly suggestedType: string;
|
|
273
|
+
readonly status: SignalConfirmationStatus;
|
|
274
|
+
readonly attempts: number;
|
|
275
|
+
readonly createdAt: string;
|
|
276
|
+
readonly resolvedAt: string | null;
|
|
277
|
+
readonly resolution: string | null;
|
|
278
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CorrectionSampleReviewStatus, CorrectionExportMode, TrajectoryDataStats, TrajectoryAssistantTurnInput, TrajectoryUserTurnInput, TrajectoryToolCallInput, TrajectoryPainEventInput, TrajectoryGateBlockInput, TrajectoryTrustChangeInput, TrajectoryPrincipleEventInput, TrajectoryTaskOutcomeInput, TrajectorySessionInput, EvolutionTaskRecord, EvolutionEventRecord, EvolutionTaskFilters, AssistantTurnRecord, CorrectionSampleRecord, TrajectoryExportResult, TrajectoryDatabaseOptions, RuleHostContextResult, RuleHostEvidenceRow } from './trajectory-types.js';
|
|
1
|
+
import type { CorrectionSampleReviewStatus, CorrectionExportMode, SignalConfirmationInput, SignalConfirmationRow, SignalConfirmationStatus, TrajectoryDataStats, TrajectoryAssistantTurnInput, TrajectoryUserTurnInput, TrajectoryToolCallInput, TrajectoryPainEventInput, TrajectoryGateBlockInput, TrajectoryTrustChangeInput, TrajectoryPrincipleEventInput, TrajectoryTaskOutcomeInput, TrajectorySessionInput, EvolutionTaskRecord, EvolutionEventRecord, EvolutionTaskFilters, AssistantTurnRecord, CorrectionSampleRecord, TrajectoryExportResult, TrajectoryDatabaseOptions, RuleHostContextResult, RuleHostEvidenceRow } from './trajectory-types.js';
|
|
2
2
|
export type { CorrectionSampleReviewStatus, CorrectionExportMode, TrajectoryDataStats, TrajectoryAssistantTurnInput, TrajectoryUserTurnInput, TrajectoryToolCallInput, TrajectoryPainEventInput, TrajectoryGateBlockInput, DailyMetricRow, TrajectoryTrustChangeInput, TrajectoryPrincipleEventInput, TrajectoryTaskOutcomeInput, TrajectorySessionInput, TaskKind, TaskPriority, EvolutionTaskInput, EvolutionEventInput, EvolutionTaskRecord, EvolutionEventRecord, EvolutionTaskFilters, AssistantTurnRecord, CorrectionSampleRecord, TrajectoryExportResult, TrajectoryDatabaseOptions, RuleHostContextRow, RuleHostContextResult, RuleHostEvidenceRow, } from './trajectory-types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Initialize trajectory.db schema at the given workspace directory.
|
|
@@ -232,6 +232,22 @@ export declare class TrajectoryDatabase {
|
|
|
232
232
|
* violation signal (human-verified, unlike heuristic pain detection).
|
|
233
233
|
*/
|
|
234
234
|
private recordCorrectionRejectedPain;
|
|
235
|
+
/**
|
|
236
|
+
* 入队一条待确认信号。幂等:UNIQUE(user_turn_rowid) 兜底,重复入队是 no-op
|
|
237
|
+
* (同一轮消息只会在队列里出现一次)。id 由 (sessionId, rowid) 确定性派生。
|
|
238
|
+
*/
|
|
239
|
+
enqueueSignalConfirmation(input: SignalConfirmationInput): void;
|
|
240
|
+
/** 按 attempts ASC, created_at ASC 取 pending 队列(最久未确认的优先)。 */
|
|
241
|
+
listPendingSignalConfirmations(limit: number): SignalConfirmationRow[];
|
|
242
|
+
/** 确认失败一次:attempts++(仍 pending,可重试)。返回累加后的 attempts。 */
|
|
243
|
+
bumpSignalConfirmationAttempt(id: string): number;
|
|
244
|
+
/**
|
|
245
|
+
* 终态转移(confirmed/rejected/abandoned)。乐观锁守卫:仅当仍为 pending 时
|
|
246
|
+
* 生效(照 principle_candidates 模式);返回是否实际转移。
|
|
247
|
+
*/
|
|
248
|
+
markSignalConfirmationResult(id: string, status: Exclude<SignalConfirmationStatus, 'pending'>, resolution: string): boolean;
|
|
249
|
+
/** 经济性:pending 总量(健康度指标 G4 用,O(1) 走索引)。 */
|
|
250
|
+
countPendingSignalConfirmations(): number;
|
|
235
251
|
/**
|
|
236
252
|
* Export correction samples to JSONL file.
|
|
237
253
|
*
|