principles-disciple 2.2.4 → 2.2.6
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 +439 -449
- package/dist/core/evolution-reducer.d.ts +0 -2
- package/dist/core/session-tracker.d.ts +0 -4
- package/dist/core/workspace-context.d.ts +0 -8
- package/dist/hooks/after-tool-call-helpers.d.ts +0 -7
- package/dist/hooks/pain.d.ts +3 -4
- package/dist/hooks/prompt-helpers.d.ts +2 -12
- package/dist/hooks/prompt-types.d.ts +0 -4
- package/dist/hooks/prompt.d.ts +1 -11
- package/dist/host-runtime/openclaw-host-runtime.d.ts +0 -1
- package/dist/openclaw.plugin.json +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +4 -5
- package/dist/core/principle-injection.d.ts +0 -10
|
@@ -10,7 +10,6 @@ export interface EvolutionReducer {
|
|
|
10
10
|
promote(_principleId: string, _reason?: string): void;
|
|
11
11
|
deprecate(_principleId: string, _reason: string): void;
|
|
12
12
|
rollbackPrinciple(_principleId: string, _reason: string): void;
|
|
13
|
-
recordProbationFeedback(_principleId: string, _success: boolean): void;
|
|
14
13
|
/**
|
|
15
14
|
* Creates a new principle with generalized trigger/action from diagnostician.
|
|
16
15
|
* Called after diagnostician analysis to create principle directly.
|
|
@@ -66,7 +65,6 @@ export declare class EvolutionReducerImpl implements EvolutionReducer {
|
|
|
66
65
|
promote(principleId: string, reason?: string): void;
|
|
67
66
|
deprecate(principleId: string, reason: string): void;
|
|
68
67
|
rollbackPrinciple(principleId: string, reason: string): void;
|
|
69
|
-
recordProbationFeedback(principleId: string, success: boolean): void;
|
|
70
68
|
/**
|
|
71
69
|
* Creates a new principle with generalized trigger/action from diagnostician.
|
|
72
70
|
* Called after diagnostician analysis to create principle directly (no intermediate overfitted principle).
|
|
@@ -30,7 +30,6 @@ export interface SessionState {
|
|
|
30
30
|
dailyToolFailures: number;
|
|
31
31
|
dailyPainSignals: number;
|
|
32
32
|
dailyGfiPeak: number;
|
|
33
|
-
injectedProbationIds?: string[];
|
|
34
33
|
injectedPrincipleIds?: string[];
|
|
35
34
|
injectedActivationIds?: string[];
|
|
36
35
|
receiptAutoCorrects?: number;
|
|
@@ -62,7 +61,6 @@ export declare function resetFriction(sessionId: string, workspaceDir?: string,
|
|
|
62
61
|
amount?: number;
|
|
63
62
|
}): SessionState;
|
|
64
63
|
export declare function trackBlock(sessionId: string): SessionState;
|
|
65
|
-
export declare function setInjectedProbationIds(sessionId: string, ids: string[], workspaceDir?: string): SessionState;
|
|
66
64
|
/**
|
|
67
65
|
* PRI-534: record the principle ids injected into this session's prompt context.
|
|
68
66
|
* PRI-755 (review fix): call this on EVERY prompt build with the CURRENT set —
|
|
@@ -81,7 +79,6 @@ export declare function setInjectedPrincipleIds(sessionId: string | undefined, i
|
|
|
81
79
|
activationIds?: readonly string[]): void;
|
|
82
80
|
/** PRI-534: count one applied live auto-correction in this session. */
|
|
83
81
|
export declare function trackReceiptAutoCorrect(sessionId: string | undefined, workspaceDir?: string): void;
|
|
84
|
-
export declare function getInjectedProbationIds(sessionId: string, workspaceDir?: string): string[];
|
|
85
82
|
/**
|
|
86
83
|
* PRI-755: read-only view of the principle ids injected into this session's
|
|
87
84
|
* prompt context. Tri-state: an array (possibly empty) means the injection set
|
|
@@ -100,7 +97,6 @@ export declare function getInjectedPrincipleIds(sessionId: string): readonly str
|
|
|
100
97
|
* A consumer must never treat "no pairing" as "some other activation".
|
|
101
98
|
*/
|
|
102
99
|
export declare function getInjectedActivationIds(sessionId: string): readonly string[] | undefined;
|
|
103
|
-
export declare function clearInjectedProbationIds(sessionId: string, workspaceDir?: string): SessionState;
|
|
104
100
|
export declare function getSession(sessionId: string): SessionState | undefined;
|
|
105
101
|
export declare function listSessions(workspaceDir?: string): SessionState[];
|
|
106
102
|
export declare function clearSession(sessionId: string): void;
|
|
@@ -7,7 +7,6 @@ import { EvolutionReducerImpl } from './evolution-reducer.js';
|
|
|
7
7
|
import type { TrajectoryDatabase } from './trajectory.js';
|
|
8
8
|
import { PrincipleLifecycleService } from './principle-internalization/principle-lifecycle-service.js';
|
|
9
9
|
import { type PrincipleSubtree, type LedgerPrinciple, type PrincipleValueMetrics } from './principle-tree-ledger.js';
|
|
10
|
-
import type { Principle as ActivePrinciple } from './evolution-types.js';
|
|
11
10
|
import { RuleHost } from './rule-host.js';
|
|
12
11
|
import type { RuleHostLogger } from './rule-host.js';
|
|
13
12
|
interface PrincipleTreeLedgerAccessor {
|
|
@@ -74,13 +73,6 @@ export declare class WorkspaceContext {
|
|
|
74
73
|
* Phase 15 lifecycle/read-model surface for metrics, assessments, and route recommendations.
|
|
75
74
|
*/
|
|
76
75
|
get principleLifecycle(): PrincipleLifecycleService;
|
|
77
|
-
/**
|
|
78
|
-
* Retrieve active Principle -> Rule -> Implementation subtrees without bypassing reducer authority.
|
|
79
|
-
*/
|
|
80
|
-
getActivePrincipleSubtrees(): {
|
|
81
|
-
principle: ActivePrinciple;
|
|
82
|
-
subtree: PrincipleSubtree;
|
|
83
|
-
}[];
|
|
84
76
|
private getTrajectoryOptions;
|
|
85
77
|
/**
|
|
86
78
|
* Creates or retrieves a WorkspaceContext instance from an OpenClaw hook context.
|
|
@@ -59,13 +59,6 @@ export declare function handleFrictionTrackingForSuccess(sessionId: string, even
|
|
|
59
59
|
* Record hygiene tracking for memory/plan persistence actions on success.
|
|
60
60
|
*/
|
|
61
61
|
export declare function recordHygieneTracking(event: PluginHookAfterToolCallEvent, observation: ToolCallObservation, wctx: WorkspaceContext): void;
|
|
62
|
-
/**
|
|
63
|
-
* Record probation feedback for injected probation IDs.
|
|
64
|
-
*
|
|
65
|
-
* On success: positive feedback for matching principles.
|
|
66
|
-
* On failure: negative feedback for matching principles.
|
|
67
|
-
*/
|
|
68
|
-
export declare function handleProbationFeedback(sessionId: string, toolName: string, workspaceDir: string, wctx: WorkspaceContext, isSuccess: boolean): void;
|
|
69
62
|
/**
|
|
70
63
|
* Evaluate whether a tool failure should trigger pain diagnosis.
|
|
71
64
|
*
|
package/dist/hooks/pain.d.ts
CHANGED
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
* 1. classifyToolCallOutcome — determine failure/success + source
|
|
8
8
|
* 2. buildToolCallObservation — normalize event into observation
|
|
9
9
|
* 3. handleFrictionTracking — GFI, event log, trajectory recording
|
|
10
|
-
* 4.
|
|
11
|
-
* 5.
|
|
12
|
-
* 6. emitPainIfAdmitted — pain signal emission
|
|
10
|
+
* 4. evaluatePainAdmission — triage + gate evaluation
|
|
11
|
+
* 5. emitPainIfAdmitted — pain signal emission
|
|
13
12
|
*
|
|
14
13
|
* The manual pain path (toolName === 'pain') remains inline because it
|
|
15
14
|
* has a different control flow (early return, no triage, no gate on cooldown).
|
|
@@ -44,7 +43,7 @@ export declare function handleAfterToolCall(event: PluginHookAfterToolCallEvent,
|
|
|
44
43
|
}, api?: OpenClawPluginApi): void;
|
|
45
44
|
/**
|
|
46
45
|
* OpenClaw-owned enrichment for the shared ordinary after-tool kernel.
|
|
47
|
-
* Session/GFI, event-log,
|
|
46
|
+
* Session/GFI, event-log, PROFILE and hygiene behavior stays here;
|
|
48
47
|
* the shared runtime owns classification/admission and the atomic trajectory write.
|
|
49
48
|
*/
|
|
50
49
|
export declare function prepareOrdinaryAfterToolCallForSharedRuntime(event: PluginHookAfterToolCallEvent, ctx: PluginHookToolContext & {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* EP-03: Pure functions never swallow errors; invalid input returns empty string
|
|
16
16
|
* EP-09: Pure functions are independently unit-testable without mocks
|
|
17
17
|
*/
|
|
18
|
-
import type { ExtractedUserMessage, CorePrincipleEntry,
|
|
18
|
+
import type { ExtractedUserMessage, CorePrincipleEntry, AppendSystemContextParts } from './prompt-types.js';
|
|
19
19
|
/**
|
|
20
20
|
* Extract the actual user message from the raw prompt text.
|
|
21
21
|
*
|
|
@@ -69,22 +69,12 @@ export declare function assembleHeartbeatChecklist(content: string): string;
|
|
|
69
69
|
* @returns Formatted lines (empty string if no principles)
|
|
70
70
|
*/
|
|
71
71
|
export declare function formatCorePrinciples(principles: CorePrincipleEntry[]): string;
|
|
72
|
-
/**
|
|
73
|
-
* Format evolution principles (active + probation) into prompt-ready text.
|
|
74
|
-
*
|
|
75
|
-
* Pure logic — uses escapeXml for safe XML embedding.
|
|
76
|
-
*
|
|
77
|
-
* @param active Active principles (high priority)
|
|
78
|
-
* @param probation Probation principles (contextual, caution)
|
|
79
|
-
* @returns Formatted lines (empty string if no principles)
|
|
80
|
-
*/
|
|
81
|
-
export declare function formatEvolutionPrinciples(active: EvolutionPrincipleEntry[], probation: EvolutionPrincipleEntry[]): string;
|
|
82
72
|
/**
|
|
83
73
|
* Assemble appendSystemContext from ordered parts.
|
|
84
74
|
*
|
|
85
75
|
* Content order (most important last):
|
|
86
76
|
* behavioral_constraints → project_context → intent_block → working_memory →
|
|
87
|
-
* thinking_os →
|
|
77
|
+
* thinking_os → core_principles
|
|
88
78
|
*
|
|
89
79
|
* PRI-467: intent_block (INTENT.md reference) sits after project_context
|
|
90
80
|
* (stable reference data, lower priority than principles) and before
|
|
@@ -46,9 +46,6 @@ export interface CorePrincipleEntry {
|
|
|
46
46
|
id: string;
|
|
47
47
|
text: string;
|
|
48
48
|
}
|
|
49
|
-
/** Input for formatting evolution principles (active + probation). */
|
|
50
|
-
export interface EvolutionPrincipleEntry extends CorePrincipleEntry {
|
|
51
|
-
}
|
|
52
49
|
/** Parts assembled into appendSystemContext. Order = priority (low → high). */
|
|
53
50
|
export interface AppendSystemContextParts {
|
|
54
51
|
behavioralConstraints?: string;
|
|
@@ -63,7 +60,6 @@ export interface AppendSystemContextParts {
|
|
|
63
60
|
intentBlock?: string;
|
|
64
61
|
workingMemory?: string;
|
|
65
62
|
thinkingOs?: string;
|
|
66
|
-
evolutionPrinciples?: string;
|
|
67
63
|
corePrinciples?: string;
|
|
68
64
|
}
|
|
69
65
|
/** Input for the heartbeat checklist wrapper. */
|
package/dist/hooks/prompt.d.ts
CHANGED
|
@@ -4,16 +4,6 @@ import type { ContextInjectionConfig } from '../types.js';
|
|
|
4
4
|
import type { ActivePrinciplePromptResult } from '@principles/host-runtime';
|
|
5
5
|
import { SignalCollectorHost } from '../core/signal-collector-host.js';
|
|
6
6
|
import type { PromptHookApi } from './prompt-types.js';
|
|
7
|
-
import type { InjectablePrinciple } from '../core/principle-injection.js';
|
|
8
|
-
export interface LegacyPrinciplePromptSelection {
|
|
9
|
-
active: InjectablePrinciple[];
|
|
10
|
-
probation: InjectablePrinciple[];
|
|
11
|
-
content: string;
|
|
12
|
-
selectedIds: ReadonlySet<string>;
|
|
13
|
-
/** PRI-562 Phase 0: either budget-bounded selection dropped candidates. */
|
|
14
|
-
wasTruncated: boolean;
|
|
15
|
-
}
|
|
16
|
-
export declare function selectLegacyPrinciplesForPrompt(workspaceDir: string, reducer: Pick<WorkspaceContext['evolutionReducer'], 'getActivePrinciples' | 'getProbationPrinciples'>, logger?: PluginLogger): LegacyPrinciplePromptSelection;
|
|
17
7
|
/**
|
|
18
8
|
* Reset all module-level prompt state for a workspace.
|
|
19
9
|
* Intended for test isolation — call in beforeEach().
|
|
@@ -33,4 +23,4 @@ export declare function getSignalCollectorHost(wctx: WorkspaceContext, logger?:
|
|
|
33
23
|
export declare function loadContextInjectionConfig(workspaceDir: string): ContextInjectionConfig;
|
|
34
24
|
export declare function handleBeforePromptBuild(event: PluginHookBeforePromptBuildEvent, ctx: PluginHookAgentContext & {
|
|
35
25
|
api?: PromptHookApi;
|
|
36
|
-
}, sharedActivePrinciplePrompt?: ActivePrinciplePromptResult
|
|
26
|
+
}, sharedActivePrinciplePrompt?: ActivePrinciplePromptResult): Promise<PluginHookBeforePromptBuildResult | void>;
|
|
@@ -3,7 +3,6 @@ import type { HostEventResult } from '@principles/core/host';
|
|
|
3
3
|
import type { PluginHookAgentContext, PluginHookAfterToolCallEvent, PluginHookBeforePromptBuildEvent, PluginHookBeforePromptBuildResult, PluginHookBeforeToolCallEvent, PluginHookBeforeToolCallResult, PluginHookToolContext } from '../openclaw-sdk.js';
|
|
4
4
|
export interface OpenClawHostRuntimeOptions {
|
|
5
5
|
beforePromptBuild(event: PluginHookBeforePromptBuildEvent, context: PluginHookAgentContext, prompt: ActivePrinciplePromptResult): Promise<PluginHookBeforePromptBuildResult | void>;
|
|
6
|
-
promptExcludePrincipleIds?(event: PluginHookBeforePromptBuildEvent, context: PluginHookAgentContext): ReadonlySet<string>;
|
|
7
6
|
ruleContextProvider?(event: PluginHookBeforeToolCallEvent, context: PluginHookToolContext, request: ProductionRuleContextRequest): unknown | Promise<unknown>;
|
|
8
7
|
ruleInputEnrichmentProvider?(event: PluginHookBeforeToolCallEvent, context: PluginHookToolContext, request: ProductionRuleContextRequest): unknown | Promise<unknown>;
|
|
9
8
|
onBeforeToolResult?(event: PluginHookBeforeToolCallEvent, context: PluginHookToolContext, result: HostEventResult): PluginHookBeforeToolCallResult | void;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "principles-disciple",
|
|
3
3
|
"name": "Principles Disciple",
|
|
4
4
|
"description": "Principles Disciple is an AI Agent Governance System. Stop correcting the same AI behavior across sessions. Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles.",
|
|
5
|
-
"version": "2.2.
|
|
5
|
+
"version": "2.2.6",
|
|
6
6
|
"activation": {
|
|
7
7
|
"onStartup": true,
|
|
8
8
|
"onCapabilities": [
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "principles-disciple",
|
|
3
3
|
"name": "Principles Disciple",
|
|
4
4
|
"description": "Principles Disciple is an AI Agent Governance System. Stop correcting the same AI behavior across sessions. Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles.",
|
|
5
|
-
"version": "2.2.
|
|
5
|
+
"version": "2.2.6",
|
|
6
6
|
"activation": {
|
|
7
7
|
"onStartup": true,
|
|
8
8
|
"onCapabilities": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "principles-disciple",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.6",
|
|
4
4
|
"description": "Principles Disciple is an AI Agent Governance System. Stop correcting the same AI behavior across sessions. Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -72,11 +72,11 @@
|
|
|
72
72
|
"test:all": "vitest run",
|
|
73
73
|
"lint": "eslint \"src/**/*.ts\"",
|
|
74
74
|
"bootstrap-rules": "node scripts/bootstrap-rules.mjs",
|
|
75
|
-
"compile-principles": "node scripts/compile-principles.mjs"
|
|
76
|
-
"sync-plugin": "node scripts/sync-plugin.mjs"
|
|
75
|
+
"compile-principles": "node scripts/compile-principles.mjs"
|
|
77
76
|
},
|
|
78
77
|
"devDependencies": {
|
|
79
|
-
"@principles/
|
|
78
|
+
"@principles/core": "^1.297.4",
|
|
79
|
+
"@principles/host-runtime": "^0.14.1",
|
|
80
80
|
"@types/better-sqlite3": "^9.6.0",
|
|
81
81
|
"@types/js-yaml": "^4.0.9",
|
|
82
82
|
"@types/micromatch": "^4.0.10",
|
|
@@ -102,7 +102,6 @@
|
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
"dependencies": {
|
|
105
|
-
"@principles/core": "^1.297.2",
|
|
106
105
|
"@sinclair/typebox": "^0.34.52",
|
|
107
106
|
"better-sqlite3": "^13.0.3",
|
|
108
107
|
"commander": "^12.0.0",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Principle Injection — Budget-Aware Principle Selection
|
|
3
|
-
*
|
|
4
|
-
* Phase: PRI-75 Prompt Injection SDK Migration Phase 2
|
|
5
|
-
*
|
|
6
|
-
* This file is now a thin re-export layer.
|
|
7
|
-
* All pure logic lives in @principles/core/prompt-builder/principle-selection.ts.
|
|
8
|
-
*/
|
|
9
|
-
export { formatPrinciple, selectPrinciplesForInjection, DEFAULT_PRINCIPLE_BUDGET, } from '@principles/core/prompt-builder';
|
|
10
|
-
export type { InjectablePrinciple, PrincipleSelectionResult } from '@principles/core/prompt-builder';
|