principles-disciple 2.7.0 → 3.0.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/bundle.js +478 -482
- package/dist/commands/promote-impl.d.ts +1 -1
- package/dist/constants/tool-semantics.d.ts +1 -1
- package/dist/core/correction-types.d.ts +2 -2
- package/dist/core/event-log.d.ts +3 -3
- package/dist/core/evolution-types.d.ts +5 -5
- package/dist/core/intent-doc-reader-adapter.d.ts +1 -1
- package/dist/core/intent-doc-reader.d.ts +1 -1
- package/dist/core/pd-task-types.d.ts +2 -2
- package/dist/core/principle-compiler/code-validator.d.ts +2 -2
- package/dist/core/principle-compiler/compiler.d.ts +2 -2
- package/dist/core/principle-compiler/template-generator.d.ts +1 -1
- package/dist/core/principle-internalization/filesystem-lifecycle-datasource.d.ts +2 -2
- package/dist/core/principle-internalization/lifecycle-read-model.d.ts +5 -5
- package/dist/core/principle-internalization/principle-lifecycle-service.d.ts +3 -3
- package/dist/core/principle-tree-ledger.d.ts +1 -1
- package/dist/core/replay-engine.d.ts +1 -1
- package/dist/core/rule-context-assembler.d.ts +1 -1
- package/dist/core/rule-host.d.ts +3 -3
- package/dist/core/{runtime-v2-prompt-activation-reader.d.ts → runtime-prompt-activation-reader.d.ts} +2 -2
- package/dist/core/signal-collector-host.d.ts +28 -8
- package/dist/core/workspace-context.d.ts +1 -1
- package/dist/governance-audit.d.ts +2 -2
- package/dist/governance-audit.js +1 -1
- package/dist/hooks/gate.d.ts +1 -1
- package/dist/hooks/message-sanitize.d.ts +1 -1
- package/dist/hooks/pain-ingress-adapter.d.ts +1 -1
- package/dist/hooks/prompt-presence-expectations.d.ts +69 -0
- package/dist/hooks/prompt.d.ts +40 -0
- package/dist/hooks/raw-observation-adapter.d.ts +2 -2
- package/dist/hooks/raw-observation-types.d.ts +2 -2
- package/dist/hooks/trajectory-evidence.d.ts +1 -1
- package/dist/hooks/triage-adapter.d.ts +1 -1
- package/dist/host-runtime/openclaw-host-runtime.d.ts +24 -1
- package/dist/index.d.ts +17 -10
- package/dist/openclaw-sdk.d.ts +16 -0
- package/dist/openclaw.plugin.json +1 -1
- package/dist/service/correction-observer-service.d.ts +1 -1
- package/dist/service/keyword-optimization-service.d.ts +2 -2
- package/dist/types/event-types.d.ts +2 -2
- package/dist/types/hygiene-types.d.ts +2 -2
- package/dist/types/principle-tree-schema.d.ts +2 -2
- package/dist/utils/workspace-resolver.d.ts +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +4 -4
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* - Only candidate -> active is valid for promotion
|
|
17
17
|
* - NOTE (PRI-230): The legacy replay generation path has been retired.
|
|
18
18
|
* This command is temporarily unavailable for implementations without
|
|
19
|
-
* pre-existing replay reports until a Runtime
|
|
19
|
+
* pre-existing replay reports until a Runtime replay entry is wired.
|
|
20
20
|
*/
|
|
21
21
|
import type { PluginCommandContext, PluginCommandResult } from '../openclaw-sdk.js';
|
|
22
22
|
export declare function handlePromoteImplCommand(ctx: PluginCommandContext): PluginCommandResult;
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* Fail loud at module load if the derived declaration is invalid — a broken
|
|
31
31
|
* static declaration is a programming error, not a runtime condition (rc-3).
|
|
32
32
|
*/
|
|
33
|
-
import { type ToolSemanticMappingV1, type ToolSemanticRegistry } from '@principles/core/runtime
|
|
33
|
+
import { type ToolSemanticMappingV1, type ToolSemanticRegistry } from '@principles/core/runtime/internalization/tool-semantic-registry';
|
|
34
34
|
export declare const OPENCLAW_TOOL_SEMANTIC_MAPPINGS: readonly ToolSemanticMappingV1[];
|
|
35
35
|
/** The OpenClaw ToolSemanticRegistry — ONE instance shared by replay and production. */
|
|
36
36
|
export declare const OPENCLAW_TOOL_SEMANTICS: ToolSemanticRegistry;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { CorrectionKeyword, CorrectionKeywordStore } from '@principles/core/runtime
|
|
1
|
+
import type { CorrectionKeyword, CorrectionKeywordStore } from '@principles/core/runtime';
|
|
2
2
|
export type { CorrectionKeyword, CorrectionKeywordStore, };
|
|
3
|
-
export { MAX_CORRECTION_KEYWORDS, CORRECTION_SEED_KEYWORDS, } from '@principles/core/runtime
|
|
3
|
+
export { MAX_CORRECTION_KEYWORDS, CORRECTION_SEED_KEYWORDS, } from '@principles/core/runtime';
|
package/dist/core/event-log.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type AdaptiveDeliveryRecord } from '@principles/core/runtime
|
|
2
|
-
import type { EventLogEntry, DailyStats, EmpathyEventStats, ToolCallEventData, PainSignalEventData, RulePromotionEventData, GovernanceActionEventData, HookExecutionEventData, GateBlockEventData, GateBypassEventData, EmpathyRollbackEventData, DiagnosisTaskEventData, HeartbeatDiagnosisEventData, DiagnosticianReportEventData, PrincipleCandidateEventData, RuleEnforcedEventData, RuleHostEvaluatedEventData, RuleHostBlockedEventData, RuleHostRequireApprovalEventData, RuleHostAutoCorrectProposedEventData, RuleHostAutoCorrectAppliedEventData,
|
|
1
|
+
import { type AdaptiveDeliveryRecord } from '@principles/core/runtime/adaptive-delivery-record';
|
|
2
|
+
import type { EventLogEntry, DailyStats, EmpathyEventStats, ToolCallEventData, PainSignalEventData, RulePromotionEventData, GovernanceActionEventData, HookExecutionEventData, GateBlockEventData, GateBypassEventData, EmpathyRollbackEventData, DiagnosisTaskEventData, HeartbeatDiagnosisEventData, DiagnosticianReportEventData, PrincipleCandidateEventData, RuleEnforcedEventData, RuleHostEvaluatedEventData, RuleHostBlockedEventData, RuleHostRequireApprovalEventData, RuleHostAutoCorrectProposedEventData, RuleHostAutoCorrectAppliedEventData, RuntimePromptActivationsInjectedEventData, RuleHostUnhealthyEventData, RuleHostSkippedEventData, TrajectoryObservabilityFailureEventData } from '../types/event-types.js';
|
|
3
3
|
import type { PluginLogger } from '../openclaw-sdk.js';
|
|
4
4
|
export declare class EventLog {
|
|
5
5
|
private readonly logsDir;
|
|
@@ -43,7 +43,7 @@ export declare class EventLog {
|
|
|
43
43
|
recordRuleHostRequireApproval(data: RuleHostRequireApprovalEventData): void;
|
|
44
44
|
recordRuleHostAutoCorrectProposed(data: RuleHostAutoCorrectProposedEventData): void;
|
|
45
45
|
recordRuleHostAutoCorrectApplied(data: RuleHostAutoCorrectAppliedEventData): void;
|
|
46
|
-
|
|
46
|
+
recordRuntimeActivationsInjected(data: RuntimePromptActivationsInjectedEventData): void;
|
|
47
47
|
/**
|
|
48
48
|
* PRI-437: Record that an approved rule failed to compile or load.
|
|
49
49
|
*
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Evolution domain type surface for the plugin.
|
|
3
3
|
*
|
|
4
|
-
* Canonical definitions live in @principles/core/runtime
|
|
4
|
+
* Canonical definitions live in @principles/core/runtime (evolution/).
|
|
5
5
|
* This file keeps the plugin-facing backward-compatible aliases.
|
|
6
6
|
*
|
|
7
7
|
* NOTE: Principle → EvolutionPrinciple, PrincipleStatus → EvolutionPrincipleStatus
|
|
8
|
-
* to avoid collision with runtime
|
|
8
|
+
* to avoid collision with runtime/types/principle-schema.ts Principle.
|
|
9
9
|
* Backward-compatible aliases are provided below.
|
|
10
10
|
*
|
|
11
11
|
* PRI-770: the Evolution Points/Tier re-exports (tiers, scorecards, storage /
|
|
12
12
|
* config contracts) and the V2 queue item types were removed — their
|
|
13
13
|
* subsystems were retired (PRI-737) and no consumer remained.
|
|
14
14
|
*/
|
|
15
|
-
import type { EvolutionPrinciple as EvolutionPrincipleType, EvolutionPrincipleStatus as EvolutionPrincipleStatusType, EvolutionPrincipleSuggestedRule as EvolutionPrincipleSuggestedRuleType, EvolutionPrincipleValueMetricsSnapshot as EvolutionPrincipleValueMetricsSnapshotType, EvolutionPainDetectedData as EvolutionPainDetectedDataType } from '@principles/core/runtime
|
|
16
|
-
export { isCompleteDetectorMetadata, } from '@principles/core/runtime
|
|
17
|
-
export type { EvolutionPrincipleStatus, PrincipleEvaluatorLevel, Evaluability, PrincipleDetectorSpec, EvolutionPrinciple, EvolutionPrincipleSuggestedRule, EvolutionPrincipleValueMetricsSnapshot, EvolutionLoopEventType, EvolutionPainDetectedData, CandidateCreatedData, PrinciplePromotedData, PrincipleDeprecatedData, PrincipleRolledBackData, CircuitBreakerOpenedData, LegacyImportData, EvolutionLoopEvent, } from '@principles/core/runtime
|
|
15
|
+
import type { EvolutionPrinciple as EvolutionPrincipleType, EvolutionPrincipleStatus as EvolutionPrincipleStatusType, EvolutionPrincipleSuggestedRule as EvolutionPrincipleSuggestedRuleType, EvolutionPrincipleValueMetricsSnapshot as EvolutionPrincipleValueMetricsSnapshotType, EvolutionPainDetectedData as EvolutionPainDetectedDataType } from '@principles/core/runtime';
|
|
16
|
+
export { isCompleteDetectorMetadata, } from '@principles/core/runtime';
|
|
17
|
+
export type { EvolutionPrincipleStatus, PrincipleEvaluatorLevel, Evaluability, PrincipleDetectorSpec, EvolutionPrinciple, EvolutionPrincipleSuggestedRule, EvolutionPrincipleValueMetricsSnapshot, EvolutionLoopEventType, EvolutionPainDetectedData, CandidateCreatedData, PrinciplePromotedData, PrincipleDeprecatedData, PrincipleRolledBackData, CircuitBreakerOpenedData, LegacyImportData, EvolutionLoopEvent, } from '@principles/core/runtime';
|
|
18
18
|
/** @deprecated Use EvolutionPrinciple instead. Alias for backward compatibility. */
|
|
19
19
|
export type Principle = EvolutionPrincipleType;
|
|
20
20
|
/** @deprecated Use EvolutionPrincipleStatus instead. Alias for backward compatibility. */
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* Architecture: this file is I/O (delegates to fs-reading safeReadIntentDoc).
|
|
18
18
|
* It will be added to KNOWN_PLUGIN_CORE_FILES in architecture-regression.test.ts.
|
|
19
19
|
*/
|
|
20
|
-
import type { IntentDocReader, IntentLang } from '@principles/core/runtime
|
|
20
|
+
import type { IntentDocReader, IntentLang } from '@principles/core/runtime';
|
|
21
21
|
/**
|
|
22
22
|
* Detect which language's INTENT file exists on disk.
|
|
23
23
|
* Priority: zh-CN first, then en. Defaults to zh-CN if neither exists.
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* Architecture: this file is I/O (fs, path). It is whitelisted in
|
|
22
22
|
* architecture-regression.test.ts KNOWN_PLUGIN_CORE_FILES.
|
|
23
23
|
*/
|
|
24
|
-
import { type IntentDocSections, type IntentDocWarning, type IntentLang } from '@principles/core/runtime
|
|
24
|
+
import { type IntentDocSections, type IntentDocWarning, type IntentLang } from '@principles/core/runtime';
|
|
25
25
|
export type SafeReadIntentDocReason = 'flag_disabled' | 'not_found' | 'oversized' | 'read_error';
|
|
26
26
|
export interface IntentDoc {
|
|
27
27
|
/** Raw INTENT.md content (unescaped — caller escapes for prompt injection). */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { PDTaskSchedule as CorePDTaskSchedule, PDTaskExecution as CorePDTaskExecution, PDTaskDelivery as CorePDTaskDelivery, PDTaskMeta as CorePDTaskMeta, PDTaskSpec as CorePDTaskSpec } from '@principles/core/runtime
|
|
1
|
+
import type { PDTaskSchedule as CorePDTaskSchedule, PDTaskExecution as CorePDTaskExecution, PDTaskDelivery as CorePDTaskDelivery, PDTaskMeta as CorePDTaskMeta, PDTaskSpec as CorePDTaskSpec } from '@principles/core/runtime';
|
|
2
2
|
export type PDTaskSchedule = CorePDTaskSchedule;
|
|
3
3
|
export type PDTaskExecution = CorePDTaskExecution;
|
|
4
4
|
export type PDTaskDelivery = CorePDTaskDelivery;
|
|
5
5
|
export type PDTaskMeta = CorePDTaskMeta;
|
|
6
6
|
export type PDTaskSpec = CorePDTaskSpec;
|
|
7
|
-
export { PDTaskScheduleSchema, PDTaskExecutionSchema, PDTaskDeliverySchema, PDTaskMetaSchema, PDTaskSpecSchema, } from '@principles/core/runtime
|
|
7
|
+
export { PDTaskScheduleSchema, PDTaskExecutionSchema, PDTaskDeliverySchema, PDTaskMetaSchema, PDTaskSpecSchema, } from '@principles/core/runtime';
|
|
8
8
|
export declare const BUILTIN_PD_TASKS: PDTaskSpec[];
|
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
*
|
|
10
10
|
* PRI-44: Forbidden pattern detection extracted to @principles/core.
|
|
11
11
|
*/
|
|
12
|
-
import { type ValidationResult } from '@principles/core/runtime
|
|
13
|
-
export type { ValidationResult } from '@principles/core/runtime
|
|
12
|
+
import { type ValidationResult } from '@principles/core/runtime';
|
|
13
|
+
export type { ValidationResult } from '@principles/core/runtime';
|
|
14
14
|
export declare function validateGeneratedCode(code: string): ValidationResult;
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
* - PRI-115: Replay validation gate runs after code validation, before registration
|
|
13
13
|
*/
|
|
14
14
|
import type { TrajectoryDatabase } from '../trajectory.js';
|
|
15
|
-
import type { CompileResult } from '@principles/core/runtime
|
|
16
|
-
export type { CompileResult } from '@principles/core/runtime
|
|
15
|
+
import type { CompileResult } from '@principles/core/runtime';
|
|
16
|
+
export type { CompileResult } from '@principles/core/runtime';
|
|
17
17
|
export declare class PrincipleCompiler {
|
|
18
18
|
private readonly stateDir;
|
|
19
19
|
private readonly collector;
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* PRI-44: Pure template generation logic moved to core.
|
|
5
5
|
* This file re-exports for backward compatibility.
|
|
6
6
|
*/
|
|
7
|
-
export { generateFromTemplate, type PainPattern } from '@principles/core/runtime
|
|
7
|
+
export { generateFromTemplate, type PainPattern } from '@principles/core/runtime';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { LifecycleDatasource } from '@principles/core/runtime
|
|
2
|
-
import type { LedgerTreeStore, ReplayReport, ArtifactLineageRecord } from '@principles/core/runtime
|
|
1
|
+
import type { LifecycleDatasource } from '@principles/core/runtime';
|
|
2
|
+
import type { LedgerTreeStore, ReplayReport, ArtifactLineageRecord } from '@principles/core/runtime';
|
|
3
3
|
export declare class LineageSourceRetiredError extends Error {
|
|
4
4
|
constructor();
|
|
5
5
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Lifecycle read model — re-export facade (PRI-56).
|
|
3
3
|
*
|
|
4
|
-
* All computation lives in @principles/core/runtime
|
|
4
|
+
* All computation lives in @principles/core/runtime.
|
|
5
5
|
* This file re-exports types, the core builder, and provides
|
|
6
6
|
* a backward-compatible path-based wrapper for existing consumers.
|
|
7
7
|
*/
|
|
8
|
-
export type { LifecycleClassificationTotals, RuleReplayEvidence, RuleLiveEvidence, RuleLineageEvidence, ImplementationLifecycleEvidence, RuleLifecycleEvidence, PrincipleLifecycleEvidence, LifecycleReadModel, } from '@principles/core/runtime
|
|
9
|
-
export { buildLifecycleReadModel } from '@principles/core/runtime
|
|
10
|
-
export type { LifecycleDatasource } from '@principles/core/runtime
|
|
8
|
+
export type { LifecycleClassificationTotals, RuleReplayEvidence, RuleLiveEvidence, RuleLineageEvidence, ImplementationLifecycleEvidence, RuleLifecycleEvidence, PrincipleLifecycleEvidence, LifecycleReadModel, } from '@principles/core/runtime';
|
|
9
|
+
export { buildLifecycleReadModel } from '@principles/core/runtime';
|
|
10
|
+
export type { LifecycleDatasource } from '@principles/core/runtime';
|
|
11
11
|
export { FilesystemLifecycleDatasource, LineageSourceRetiredError } from './filesystem-lifecycle-datasource.js';
|
|
12
12
|
/**
|
|
13
13
|
* Backward-compatible wrapper — accepts directory paths like the original API.
|
|
14
14
|
* Existing consumers (lifecycle-refresh, evolution-status, nocturnal-service)
|
|
15
15
|
* continue using this without changes.
|
|
16
16
|
*/
|
|
17
|
-
export declare function buildLifecycleReadModelFromPaths(workspaceDir: string, stateDir: string): import("@principles/core/runtime
|
|
17
|
+
export declare function buildLifecycleReadModelFromPaths(workspaceDir: string, stateDir: string): import("@principles/core/runtime").LifecycleReadModel;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type LifecycleReadModel, type PrincipleLifecycleEvidence } from './lifecycle-read-model.js';
|
|
2
|
-
import { type PrincipleAdherenceResult, type RuleMetricResult } from '@principles/core/runtime
|
|
3
|
-
import { type DeprecatedReadinessAssessment } from '@principles/core/runtime
|
|
4
|
-
import { type LifecycleRouteRecommendation } from '@principles/core/runtime
|
|
2
|
+
import { type PrincipleAdherenceResult, type RuleMetricResult } from '@principles/core/runtime';
|
|
3
|
+
import { type DeprecatedReadinessAssessment } from '@principles/core/runtime';
|
|
4
|
+
import { type LifecycleRouteRecommendation } from '@principles/core/runtime';
|
|
5
5
|
export interface RecomputedPrincipleLifecycle {
|
|
6
6
|
principleId: string;
|
|
7
7
|
ruleMetrics: Record<string, RuleMetricResult>;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* load by the other.
|
|
15
15
|
*
|
|
16
16
|
* Both are now fixed by converging on a SINGLE source of truth in core:
|
|
17
|
-
* - parse/serialize: @principles/core/runtime
|
|
17
|
+
* - parse/serialize: @principles/core/runtime/principle-tree/ledger-codec
|
|
18
18
|
* - mutation (with cross-process file lock): @principles/core/principle-tree-ledger
|
|
19
19
|
*
|
|
20
20
|
* This file is now a thin re-export so existing relative imports
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReplayReport, ClassificationSummary, ReplayResult } from '@principles/core/runtime
|
|
1
|
+
import type { ReplayReport, ClassificationSummary, ReplayResult } from '@principles/core/runtime';
|
|
2
2
|
export type { ReplayReport, ClassificationSummary, ReplayResult };
|
|
3
3
|
export declare class ReplayEngine {
|
|
4
4
|
private readonly workspaceDir;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Spec: docs/superpowers/specs/2026-06-27-rulecode-context-vision-design.md §5.
|
|
16
16
|
*/
|
|
17
|
-
import type { RuleContextV2, RuleHistoryWindow } from '@principles/core/runtime
|
|
17
|
+
import type { RuleContextV2, RuleHistoryWindow } from '@principles/core/runtime';
|
|
18
18
|
import type { RuleHostContextResult, RuleHostContextRow } from './trajectory-types.js';
|
|
19
19
|
/**
|
|
20
20
|
* Minimal interface for the data source that TrajectoryDatabase satisfies.
|
package/dist/core/rule-host.d.ts
CHANGED
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
* - On ANY host error (load failure, eval error, vm error): return undefined
|
|
24
24
|
* - Never throw, never bypass downstream gates (Progressive Gate, Edit Verification)
|
|
25
25
|
*/
|
|
26
|
-
import type { RuleHostInput, RuleHostResult } from '@principles/core/runtime
|
|
27
|
-
import type { RuleHostLogger } from '@principles/core/runtime
|
|
28
|
-
export type { RuleHostLogger } from '@principles/core/runtime
|
|
26
|
+
import type { RuleHostInput, RuleHostResult } from '@principles/core/runtime';
|
|
27
|
+
import type { RuleHostLogger } from '@principles/core/runtime';
|
|
28
|
+
export type { RuleHostLogger } from '@principles/core/runtime';
|
|
29
29
|
export interface RuleHostOptions {
|
|
30
30
|
/** Workspace directory for SQLite access. Required for RuleHost to load active code_tool_hook activations. */
|
|
31
31
|
workspaceDir?: string;
|
package/dist/core/{runtime-v2-prompt-activation-reader.d.ts → runtime-prompt-activation-reader.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ActivatedPrinciple, PromptActivationReaderResult } from '@principles/core/runtime
|
|
2
|
-
export {
|
|
1
|
+
import type { ActivatedPrinciple, PromptActivationReaderResult } from '@principles/core/runtime';
|
|
2
|
+
export { RUNTIME_PRINCIPLE_BUDGET } from '@principles/core/runtime';
|
|
3
3
|
export type { ActivatedPrinciple, PromptActivationReaderResult };
|
|
4
4
|
export interface PromptActivationReaderDeps {
|
|
5
5
|
logger?: {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* 降级不静默 (rc-9):所有降级路径走 SystemLogger。
|
|
19
19
|
*/
|
|
20
|
-
import { type UnifiedKeywordStore, type SignalCollectorConfig } from '@principles/core/runtime
|
|
20
|
+
import { type UnifiedKeywordStore, type SignalCollectorConfig } from '@principles/core/runtime';
|
|
21
21
|
import type { PluginLogger } from '../openclaw-sdk.js';
|
|
22
22
|
import type { WorkspaceContext } from './workspace-context.js';
|
|
23
23
|
export declare const DEFAULT_SIGNAL_CONFIG: SignalCollectorConfig;
|
|
@@ -31,11 +31,8 @@ export declare const DEFAULT_SIGNAL_CONFIG: SignalCollectorConfig;
|
|
|
31
31
|
export declare function isUserInteractionTrigger(trigger: string | undefined): boolean;
|
|
32
32
|
export declare function buildDefaultKeywordStore(): UnifiedKeywordStore;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* 本文件不依赖具体的 PDRuntimeAdapter 实现,只依赖一个最小的分类函数,
|
|
38
|
-
* 以保持 host 可单测 (测试可注入 mock classifier)。
|
|
34
|
+
* Adapter abstraction for Stage-2 LLM classification. The plugin may inject
|
|
35
|
+
* a real provider; null/unavailable keeps the host on keyword-only fallback.
|
|
39
36
|
*/
|
|
40
37
|
export type SignalLlmClassifier = (text: string, promptTemplate: string) => Promise<{
|
|
41
38
|
is_feedback: boolean;
|
|
@@ -43,6 +40,22 @@ export type SignalLlmClassifier = (text: string, promptTemplate: string) => Prom
|
|
|
43
40
|
confidence: number;
|
|
44
41
|
reason: string;
|
|
45
42
|
} | null>;
|
|
43
|
+
/**
|
|
44
|
+
* PRI-1137: `detectSync` must report whether THIS invocation's `user_turns`
|
|
45
|
+
* row was actually persisted. A `void` return made a swallowed write failure
|
|
46
|
+
* indistinguishable from success, so the shared round-key provider could read
|
|
47
|
+
* a PREVIOUS ordinal and claim fair rotation for a round that was never
|
|
48
|
+
* recorded. Only `user_turn_persisted` authorises a round key / run claim.
|
|
49
|
+
*/
|
|
50
|
+
export type SignalSyncOutcome = {
|
|
51
|
+
readonly status: 'not_user_interaction';
|
|
52
|
+
} | {
|
|
53
|
+
readonly status: 'user_turn_persisted';
|
|
54
|
+
readonly userTurnRowid: number;
|
|
55
|
+
} | {
|
|
56
|
+
readonly status: 'user_turn_persist_failed';
|
|
57
|
+
readonly reason: string;
|
|
58
|
+
};
|
|
46
59
|
export interface SignalCollectorHostOptions {
|
|
47
60
|
keywordStore?: UnifiedKeywordStore;
|
|
48
61
|
/**
|
|
@@ -70,7 +83,13 @@ export declare class SignalCollectorHost {
|
|
|
70
83
|
private readonly cueFeedbackRecorder?;
|
|
71
84
|
/** rate limit 状态:sessionId → STRONG 计数桶 */
|
|
72
85
|
private readonly rateLimit;
|
|
73
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* Same-run retry cache. A failed user_turn persistence may be retried, but
|
|
88
|
+
* Stage-1 classification, discovery-budget consumption and signal routing
|
|
89
|
+
* are one-shot for that host run.
|
|
90
|
+
*/
|
|
91
|
+
private readonly processedRuns;
|
|
92
|
+
/** Zero-hit discovery budget for this workspace's host process. */
|
|
74
93
|
private discoveryBucket;
|
|
75
94
|
constructor(wctx: WorkspaceContext, options?: SignalCollectorHostOptions);
|
|
76
95
|
/**
|
|
@@ -87,7 +106,8 @@ export declare class SignalCollectorHost {
|
|
|
87
106
|
detectSync(userMessage: string, sessionId: string, trigger: string, options?: {
|
|
88
107
|
referencesAssistantTurnId?: number | null;
|
|
89
108
|
turnIndex?: number;
|
|
90
|
-
|
|
109
|
+
idempotencyKey?: string;
|
|
110
|
+
}): SignalSyncOutcome;
|
|
91
111
|
/**
|
|
92
112
|
* ★ 异步路径 (fire-and-forget)。
|
|
93
113
|
*
|
|
@@ -82,7 +82,7 @@ export declare class WorkspaceContext {
|
|
|
82
82
|
static fromHookContext(ctx: any): WorkspaceContext;
|
|
83
83
|
/**
|
|
84
84
|
* Creates a WorkspaceContext requiring explicit workspaceDir.
|
|
85
|
-
* For Runtime
|
|
85
|
+
* For Runtime entrypoints where implicit PathResolver fallback is unacceptable.
|
|
86
86
|
* @throws Error if workspaceDir is not provided in the context.
|
|
87
87
|
*/
|
|
88
88
|
static fromHookContextExplicit(ctx: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { GovernanceActionEventData } from '@principles/core/runtime
|
|
1
|
+
import type { GovernanceActionEventData } from '@principles/core/runtime';
|
|
2
2
|
export type GovernanceAuditWriter = (stateDir: string, data: GovernanceActionEventData) => void;
|
|
3
3
|
export declare const writeGovernanceAction: GovernanceAuditWriter;
|
|
4
4
|
export declare function authorizeGovernanceAction<T>(stateDir: string, data: GovernanceActionEventData, mutation: () => Promise<T>, writer?: GovernanceAuditWriter): Promise<T>;
|
|
5
|
-
export type { GovernanceActionEventData } from '@principles/core/runtime
|
|
5
|
+
export type { GovernanceActionEventData } from '@principles/core/runtime';
|