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
|
@@ -3,6 +3,15 @@ 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
|
+
/**
|
|
7
|
+
* PRI-1137: the OpenClaw prompt ROUND authority, supplied by the plugin
|
|
8
|
+
* adapter (`nextSessionTurnOrdinal` after its pre-selection signal
|
|
9
|
+
* collection). Runs before the shared prompt context is built; returning
|
|
10
|
+
* `undefined` (missing sessionId / unreadable trajectory DB / failed
|
|
11
|
+
* ordinal read) is the observable degraded case and selects
|
|
12
|
+
* `legacy_fifo_prefix_v1`. Never fabricate a round here.
|
|
13
|
+
*/
|
|
14
|
+
roundKeyProvider?(event: PluginHookBeforePromptBuildEvent, context: PluginHookAgentContext): number | undefined | Promise<number | undefined>;
|
|
6
15
|
adaptivePriorityProvider?(event: PluginHookBeforePromptBuildEvent, context: PluginHookAgentContext): {
|
|
7
16
|
artifactId: string;
|
|
8
17
|
activationId: string;
|
|
@@ -25,6 +34,20 @@ export interface OpenClawHostRuntime {
|
|
|
25
34
|
readonly runtime: HostRuntime;
|
|
26
35
|
dispatchBeforePromptBuild(event: PluginHookBeforePromptBuildEvent, context: PluginHookAgentContext): Promise<PluginHookBeforePromptBuildResult | void>;
|
|
27
36
|
dispatchBeforeToolCall(event: PluginHookBeforeToolCallEvent, context: PluginHookToolContext): Promise<PluginHookBeforeToolCallResult | void>;
|
|
28
|
-
|
|
37
|
+
/**
|
|
38
|
+
* PRI-1137 final review P1-4: after_tool_call dispatches return the shared
|
|
39
|
+
* runtime's degradation facts (e.g. `trajectory_db_not_found`) instead of an
|
|
40
|
+
* opaque void — evidence that failed to persist must be observable to the
|
|
41
|
+
* operator, never silently recorded as a successful hook execution.
|
|
42
|
+
*/
|
|
43
|
+
dispatchAfterToolCall(event: PluginHookAfterToolCallEvent, context: PluginHookToolContext): Promise<AfterToolCallDispatch>;
|
|
44
|
+
}
|
|
45
|
+
/** Degradation facts surfaced by one after_tool_call dispatch (P1-4). */
|
|
46
|
+
export interface AfterToolCallDispatch {
|
|
47
|
+
/** Shared-runtime warnings (bounded); empty when the evidence path was healthy. */
|
|
48
|
+
warnings: readonly string[];
|
|
49
|
+
/** `unavailable` when the technical evidence could not be persisted. */
|
|
50
|
+
outcome?: 'unavailable' | string;
|
|
51
|
+
nextAction?: string;
|
|
29
52
|
}
|
|
30
53
|
export declare function createOpenClawHostRuntime(options: OpenClawHostRuntimeOptions): OpenClawHostRuntime;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { OpenClawPluginApi } from './openclaw-sdk.js';
|
|
1
|
+
import type { OpenClawPluginApi, PluginHookBeforePromptBuildEvent, PluginHookAgentContext } from './openclaw-sdk.js';
|
|
2
2
|
export { checkConversationAccessConfig, getPluginEntry, ensureConversationAccessInConfig, isExplicitConversationAccessOptOut } from './core/config-health.js';
|
|
3
3
|
export type { ConversationAccessCheckResult } from './core/config-health.js';
|
|
4
|
+
import { handleBeforePromptBuild } from './hooks/prompt.js';
|
|
4
5
|
declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
5
6
|
/**
|
|
6
7
|
* PRI-305/PRI-307: Load feature flag from .pd/config.yaml instead of .pd/feature-flags.yaml.
|
|
@@ -31,14 +32,6 @@ export declare function shouldStartInternalizationAutoConsumer(workspaceDir: str
|
|
|
31
32
|
info?: (msg: string) => void;
|
|
32
33
|
warn?: (msg: string) => void;
|
|
33
34
|
}): InternalizationAutoConsumerGateResult;
|
|
34
|
-
export declare function shouldUseSharedHostRuntime(workspaceDir: string, logger: {
|
|
35
|
-
info?: (msg: string) => void;
|
|
36
|
-
warn?: (msg: string) => void;
|
|
37
|
-
}): {
|
|
38
|
-
enabled: boolean;
|
|
39
|
-
source: string;
|
|
40
|
-
rollbackReason: string | null;
|
|
41
|
-
};
|
|
42
35
|
/**
|
|
43
36
|
* Gate 4 (PRI-1071): keep the host-wide launcher binding in lockstep with an
|
|
44
37
|
* EXPLICITLY DECLARED PD workspace only.
|
|
@@ -72,12 +65,26 @@ export declare function syncMcpBindingFromExplicitWorkspace(options: {
|
|
|
72
65
|
source: string;
|
|
73
66
|
} | null;
|
|
74
67
|
}): McpBindingSyncResult;
|
|
68
|
+
/**
|
|
69
|
+
* PRI-1137: the OpenClaw-specific adaptive-priority decision, extracted from
|
|
70
|
+
* the inline provider so the SAME decision runs on the shared-runtime path.
|
|
71
|
+
* The pre-selection half claims the operator admission (or begins a native
|
|
72
|
+
* delivery invocation) BEFORE the shared selector builds the prompt; the
|
|
73
|
+
* resulting priority is handed to `buildActivePrinciplePromptContext`.
|
|
74
|
+
*/
|
|
75
|
+
export declare function resolveAdaptivePriorityForHook(event: PluginHookBeforePromptBuildEvent, context: PluginHookAgentContext, api: Parameters<typeof handleBeforePromptBuild>[1]['api']): {
|
|
76
|
+
artifactId: string;
|
|
77
|
+
activationId: string;
|
|
78
|
+
hookInvocationId?: string;
|
|
79
|
+
signal?: AbortSignal;
|
|
80
|
+
deadlineAt?: number;
|
|
81
|
+
} | undefined;
|
|
75
82
|
declare const plugin: {
|
|
76
83
|
name: string;
|
|
77
84
|
description: string;
|
|
78
85
|
register(api: OpenClawPluginApi): void;
|
|
79
86
|
};
|
|
80
|
-
export { PrincipleTreeLedgerAdapter } from '@principles/core/runtime
|
|
87
|
+
export { PrincipleTreeLedgerAdapter } from '@principles/core/runtime';
|
|
81
88
|
export { loadFeatureFlagFromWorkspace, isRecord };
|
|
82
89
|
export { initTrajectorySchema } from './core/trajectory.js';
|
|
83
90
|
export default plugin;
|
package/dist/openclaw-sdk.d.ts
CHANGED
|
@@ -199,6 +199,22 @@ export interface PluginHookBeforePromptBuildResult {
|
|
|
199
199
|
appendContext?: string;
|
|
200
200
|
prependSystemContext?: string;
|
|
201
201
|
appendSystemContext?: string;
|
|
202
|
+
/**
|
|
203
|
+
* Frozen forensic expectation set for this prompt build (prompt presence check).
|
|
204
|
+
* Frozen AFTER the size guard, authorization, timeout and budget fallbacks;
|
|
205
|
+
* bodyComplete=false marks a truncated fragment (never yields a full_hit);
|
|
206
|
+
* activations removed by a fallback are excluded entirely. Memory-only; host
|
|
207
|
+
* passes it to the wire checkpoint.
|
|
208
|
+
*/
|
|
209
|
+
injectedExpectations?: {
|
|
210
|
+
activationId: string;
|
|
211
|
+
revision: number | string;
|
|
212
|
+
bodyText: string;
|
|
213
|
+
bodyChars: number;
|
|
214
|
+
bodyComplete: boolean;
|
|
215
|
+
}[];
|
|
216
|
+
/** Entries dropped by this hook's own collection cap; visibility fact. */
|
|
217
|
+
injectedExpectationsOverflow?: number;
|
|
202
218
|
}
|
|
203
219
|
export interface PluginHookBeforeToolCallEvent {
|
|
204
220
|
toolName: string;
|
|
@@ -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": "
|
|
5
|
+
"version": "3.0.1",
|
|
6
6
|
"activation": {
|
|
7
7
|
"onStartup": true,
|
|
8
8
|
"onCapabilities": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OpenClawPluginServiceContext, PluginLogger } from '../openclaw-sdk.js';
|
|
2
2
|
import { WorkspaceContext } from '../core/workspace-context.js';
|
|
3
|
-
import { CorrectionObserver } from '@principles/core/runtime
|
|
3
|
+
import { CorrectionObserver } from '@principles/core/runtime';
|
|
4
4
|
export interface CorrectionObserverServiceShape {
|
|
5
5
|
id: string;
|
|
6
6
|
start: (ctx: OpenClawPluginServiceContext) => void;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* correction keyword store. Invoked by the correction observer service
|
|
6
6
|
* when optimization results are available.
|
|
7
7
|
*/
|
|
8
|
-
import type { CorrectionObserverOutputV1 as CorrectionObserverResult } from '@principles/core/runtime
|
|
8
|
+
import type { CorrectionObserverOutputV1 as CorrectionObserverResult } from '@principles/core/runtime';
|
|
9
9
|
import type { PluginLogger } from '../openclaw-sdk.js';
|
|
10
10
|
/**
|
|
11
11
|
* Applies CorrectionObserverResult mutations to the keyword store.
|
|
@@ -72,4 +72,4 @@ export type TrajectoryHistoryEntry = {
|
|
|
72
72
|
userMessage: string;
|
|
73
73
|
};
|
|
74
74
|
/** Re-export CorrectionObserverPayload for convenience */
|
|
75
|
-
export type { CorrectionObserverPayload } from '@principles/core/runtime
|
|
75
|
+
export type { CorrectionObserverPayload } from '@principles/core/runtime';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { EventType, EventCategory, EventLogEntry, ToolCallEventData, PainSignalEventData, RulePromotionEventData, GovernanceActionEventData, HookExecutionEventData, GateBlockEventData, GateBypassEventData, EvolutionTaskEventData, EmpathyRollbackEventData, HeartbeatDiagnosisEventData, DiagnosisTaskEventData, DiagnosticianReportEventData, PrincipleCandidateEventData, RuleEnforcedEventData, RuleHostEvaluatedEventData, RuleHostBlockedEventData, RuleHostRequireApprovalEventData, RuleHostAutoCorrectProposedEventData, RuleHostAutoCorrectAppliedEventData,
|
|
2
|
-
export { createEmptyDailyStats, } from '@principles/core/runtime
|
|
1
|
+
export type { EventType, EventCategory, EventLogEntry, ToolCallEventData, PainSignalEventData, RulePromotionEventData, GovernanceActionEventData, HookExecutionEventData, GateBlockEventData, GateBypassEventData, EvolutionTaskEventData, EmpathyRollbackEventData, HeartbeatDiagnosisEventData, DiagnosisTaskEventData, DiagnosticianReportEventData, PrincipleCandidateEventData, RuleEnforcedEventData, RuleHostEvaluatedEventData, RuleHostBlockedEventData, RuleHostRequireApprovalEventData, RuleHostAutoCorrectProposedEventData, RuleHostAutoCorrectAppliedEventData, RuntimePromptActivationsInjectedEventData, RuleHostUnhealthyEventData, RuleHostSkippedEventData, TrajectoryObservabilityFailureEventData, ToolCallStats, ErrorStats, EmpathyEventStats, HookStats, DailyStats, } from '@principles/core/runtime';
|
|
2
|
+
export { createEmptyDailyStats, } from '@principles/core/runtime/types/event-types';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { PersistenceAction, HygieneStats, } from '@principles/core/runtime
|
|
2
|
-
export { createEmptyHygieneStats, } from '@principles/core/runtime
|
|
1
|
+
export type { PersistenceAction, HygieneStats, } from '@principles/core/runtime';
|
|
2
|
+
export { createEmptyHygieneStats, } from '@principles/core/runtime';
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
* - Monitor principles deprecated (solidified into code/weights)
|
|
22
22
|
* - Track principle value ranking (pain prevented, adherence rate)
|
|
23
23
|
*/
|
|
24
|
-
import type { Principle as CorePrinciple } from '@principles/core/runtime
|
|
24
|
+
import type { Principle as CorePrinciple } from '@principles/core/runtime';
|
|
25
25
|
import type { PrincipleDetectorSpec } from '../core/evolution-types.js';
|
|
26
|
-
export type { PrinciplePriority, PrincipleScope, PrincipleEvaluability, RuleStatus, RuleType, ImplementationLifecycleState, ImplementationType, Rule, Implementation, PrincipleDependency, PrincipleValueMetrics, PrincipleEventType, PrincipleLifecycleEvent, PrincipleTreeStore, } from '@principles/core/runtime
|
|
26
|
+
export type { PrinciplePriority, PrincipleScope, PrincipleEvaluability, RuleStatus, RuleType, ImplementationLifecycleState, ImplementationType, Rule, Implementation, PrincipleDependency, PrincipleValueMetrics, PrincipleEventType, PrincipleLifecycleEvent, PrincipleTreeStore, } from '@principles/core/runtime';
|
|
27
27
|
export interface Principle extends CorePrinciple {
|
|
28
28
|
detectorMetadata?: PrincipleDetectorSpec;
|
|
29
29
|
}
|
|
@@ -131,6 +131,6 @@ export declare class WorkspaceResolutionError extends Error {
|
|
|
131
131
|
nextAction: string;
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
export declare function
|
|
134
|
+
export declare function resolveWorkspaceDirForRuntime(ctx: {
|
|
135
135
|
workspaceDir?: string;
|
|
136
136
|
}, api: OpenClawPluginApi | undefined, source: string): string;
|
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": "
|
|
5
|
+
"version": "3.0.1",
|
|
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": "
|
|
3
|
+
"version": "3.0.1",
|
|
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",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"compile-principles": "node scripts/compile-principles.mjs"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@principles/core": "^
|
|
80
|
-
"@principles/host-runtime": "^
|
|
79
|
+
"@principles/core": "^5.1.0",
|
|
80
|
+
"@principles/host-runtime": "^3.0.0",
|
|
81
81
|
"@types/better-sqlite3": "^9.6.0",
|
|
82
82
|
"@types/js-yaml": "^4.0.9",
|
|
83
83
|
"@types/micromatch": "^4.0.10",
|
|
@@ -109,5 +109,5 @@
|
|
|
109
109
|
"js-yaml": "^5.4.3",
|
|
110
110
|
"micromatch": "^4.0.8"
|
|
111
111
|
},
|
|
112
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "9656a64563e073c92aa8da0373ea96249de1a71b"
|
|
113
113
|
}
|