principles-disciple 2.7.1 → 3.0.2
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 +487 -490
- package/dist/core/event-log.d.ts +8 -1
- package/dist/core/signal-collector-host.d.ts +27 -7
- package/dist/governance-audit.js +2 -2
- package/dist/hooks/llm-input-presence.d.ts +42 -0
- package/dist/hooks/prompt-presence-expectations.d.ts +74 -0
- package/dist/hooks/prompt-presence-lite.d.ts +53 -0
- package/dist/hooks/prompt-presence-measure.d.mts +1 -0
- package/dist/hooks/prompt-presence-registry.d.ts +150 -0
- package/dist/hooks/prompt.d.ts +40 -0
- package/dist/host-runtime/openclaw-host-runtime.d.ts +24 -1
- package/dist/index.d.ts +16 -9
- package/dist/openclaw-sdk.d.ts +33 -0
- package/dist/openclaw.plugin.json +1 -1
- package/dist/types/event-types.d.ts +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRI-1150 Path A minimal presence checker (design v2 §5).
|
|
3
|
+
*
|
|
4
|
+
* The Path A observation is the host-assembled system prompt delivered by the
|
|
5
|
+
* official `llm_input` hook as a SINGLE string — so this checker needs only
|
|
6
|
+
* full-body containment over that one text. It deliberately does NOT port the
|
|
7
|
+
* transport checker's parts/multi-message machinery.
|
|
8
|
+
*
|
|
9
|
+
* Three mutually exclusive outcomes per expectation: full_hit /
|
|
10
|
+
* checked_missing / unknown (always with a reason). An empty body, a truncated
|
|
11
|
+
* fragment, an over-limit body, an unreadable observation or an internal
|
|
12
|
+
* failure can never be reported as a hit, and none of them — nor a missing
|
|
13
|
+
* snapshot — may be read as "no principle was injected".
|
|
14
|
+
*/
|
|
15
|
+
import type { RegisteredExpectation } from './prompt-presence-registry.js';
|
|
16
|
+
export declare const PRESENCE_LITE_LIMITS: {
|
|
17
|
+
/** Per-body containment input ceiling (UTF-16 chars; host-runtime caps sets far below this). */
|
|
18
|
+
readonly MAX_BODY_CHARS: number;
|
|
19
|
+
/** Observed system-prompt scan ceiling. */
|
|
20
|
+
readonly MAX_OBSERVATION_CHARS: number;
|
|
21
|
+
/** Result entries carried per event (bounded output). */
|
|
22
|
+
readonly MAX_RESULTS: 64;
|
|
23
|
+
};
|
|
24
|
+
export type PresenceLiteOutcome = 'full_hit' | 'checked_missing' | 'unknown';
|
|
25
|
+
export type PresenceLiteReason = 'assembly_truncated' | 'body_over_limit' | 'invalid_body' | 'observation_over_limit' | 'unparseable_observation' | 'check_failed';
|
|
26
|
+
export interface PresenceLiteResult {
|
|
27
|
+
activationId: string;
|
|
28
|
+
outcome: PresenceLiteOutcome;
|
|
29
|
+
reason?: PresenceLiteReason;
|
|
30
|
+
actualBodyChars?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface PresenceLiteCheck {
|
|
33
|
+
checked: boolean;
|
|
34
|
+
reason?: PresenceLiteReason;
|
|
35
|
+
results: PresenceLiteResult[];
|
|
36
|
+
observationChars: number;
|
|
37
|
+
/** Set when outcome=unknown came from an internal exception (check_failed). */
|
|
38
|
+
checkFailedReason?: string;
|
|
39
|
+
limitsExceeded?: {
|
|
40
|
+
observationChars?: number;
|
|
41
|
+
bodyChars?: number;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Pure containment check over one observed text. Never throws; internal
|
|
46
|
+
* failures surface as unknown:check_failed (callers additionally wrap the
|
|
47
|
+
* invocation so a checker bug can never break the hook).
|
|
48
|
+
*/
|
|
49
|
+
export declare function checkAssemblyPresence(params: {
|
|
50
|
+
observedText: unknown;
|
|
51
|
+
expectations: readonly RegisteredExpectation[] | undefined;
|
|
52
|
+
limits?: typeof PRESENCE_LITE_LIMITS;
|
|
53
|
+
}): PresenceLiteCheck;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRI-1150 Path A: in-memory registry of frozen assembly snapshots for prompt
|
|
3
|
+
* presence forensics (design v2 §4, as amended by the owner's three revision
|
|
4
|
+
* constraints).
|
|
5
|
+
*
|
|
6
|
+
* Guarantees and honest limits:
|
|
7
|
+
* - Fully bounded: registry keys, snapshots per key, total snapshots, total
|
|
8
|
+
* body bytes and snapshot TTL are internal constants below; every eviction
|
|
9
|
+
* or expiry is counted and DEGRADES BINDING (history loss), never silently.
|
|
10
|
+
* - History loss is sticky for a key: once any snapshot of a key is dropped
|
|
11
|
+
* (TTL or capacity) the key can never regain unique-binding qualification —
|
|
12
|
+
* not by re-registration, not by remaining the only survivor. A bounded
|
|
13
|
+
* lossy-key marker set persists the fact after its entry is gone; it is NOT
|
|
14
|
+
* an unbounded tombstone table.
|
|
15
|
+
* - Late/duplicate/out-of-order llm_input callbacks are evaluated against the
|
|
16
|
+
* CURRENT live set under the same verdict rules; ordering is never assumed.
|
|
17
|
+
* - PD-internal assemblySeq numbers are diagnostic only; the official host
|
|
18
|
+
* event carries no assembly identity and none is claimed.
|
|
19
|
+
* - Memory only. Nothing here is persisted, logged or emitted with body text.
|
|
20
|
+
*/
|
|
21
|
+
/** Central bound constants (single authority; all limits observable via verdicts). */
|
|
22
|
+
export declare const PRESENCE_REGISTRY_LIMITS: {
|
|
23
|
+
/** Distinct runId+sessionId keys kept at once. Chosen above any plausible concurrent-run count on one host. */
|
|
24
|
+
readonly MAX_KEYS: 64;
|
|
25
|
+
/** Prompt builds (tool loops, compaction retries) retained per run. */
|
|
26
|
+
readonly MAX_SNAPSHOTS_PER_KEY: 8;
|
|
27
|
+
/** Global snapshot ceiling across all keys. */
|
|
28
|
+
readonly MAX_TOTAL_SNAPSHOTS: 128;
|
|
29
|
+
/** Aggregate bodyText bytes across the whole registry. */
|
|
30
|
+
readonly MAX_TOTAL_BODY_BYTES: number;
|
|
31
|
+
/** Snapshots older than this are expired (history loss — see below). */
|
|
32
|
+
readonly SNAPSHOT_TTL_MS: number;
|
|
33
|
+
/** Per-snapshot body-bytes ceiling; larger sets register as degraded. */
|
|
34
|
+
readonly MAX_SNAPSHOT_BODY_BYTES: number;
|
|
35
|
+
};
|
|
36
|
+
export interface RegisteredExpectation {
|
|
37
|
+
activationId: string;
|
|
38
|
+
bodyText: string;
|
|
39
|
+
bodyChars: number;
|
|
40
|
+
bodyComplete: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface PresenceSnapshot {
|
|
43
|
+
/** PD-internal per-key monotonic ordinal. Diagnostic only — the host event carries no assembly identity and none is claimed. */
|
|
44
|
+
assemblySeq: number;
|
|
45
|
+
frozenAtMs: number;
|
|
46
|
+
expectations: readonly RegisteredExpectation[];
|
|
47
|
+
/** Host-runtime-side overflow reported with this assembly (entries dropped at its own cap). */
|
|
48
|
+
overflowCount: number;
|
|
49
|
+
bodyBytes: number;
|
|
50
|
+
/**
|
|
51
|
+
* PRI-1150 review: present when this snapshot was registered DEGRADED —
|
|
52
|
+
* its expectation set exceeded the per-snapshot body cap, so the frozen
|
|
53
|
+
* set is empty and the observation can only be unknown:snapshot_over_limit.
|
|
54
|
+
* Distinguishes "over-limit" from "nothing injected" (empty_snapshot).
|
|
55
|
+
*/
|
|
56
|
+
degradedReason?: 'snapshot_over_limit';
|
|
57
|
+
/** Why this snapshot's expectation set is empty/degraded (design revision: distinct sources). */
|
|
58
|
+
emptyKind?: 'none_injected' | 'shared_field_absent' | 'target_removed_by_fallback' | 'generation_failed';
|
|
59
|
+
/** Canonical workspace identity this snapshot belongs to (existing path.resolve mechanism). */
|
|
60
|
+
workspaceId: string;
|
|
61
|
+
}
|
|
62
|
+
export type BindingStatus = 'no_key' | 'history_incomplete' | 'expired' | 'unique' | 'ambiguous' | 'empty_snapshot';
|
|
63
|
+
export type BindingVerdict = {
|
|
64
|
+
status: 'no_key';
|
|
65
|
+
} | {
|
|
66
|
+
status: 'history_incomplete';
|
|
67
|
+
} | {
|
|
68
|
+
status: 'expired';
|
|
69
|
+
} | {
|
|
70
|
+
status: 'empty_snapshot';
|
|
71
|
+
snapshot: PresenceSnapshot;
|
|
72
|
+
} | {
|
|
73
|
+
status: 'unique';
|
|
74
|
+
snapshot: PresenceSnapshot;
|
|
75
|
+
} | {
|
|
76
|
+
status: 'ambiguous';
|
|
77
|
+
liveSnapshots: number;
|
|
78
|
+
};
|
|
79
|
+
export declare class PromptPresenceRegistry {
|
|
80
|
+
private readonly now;
|
|
81
|
+
private readonly entries;
|
|
82
|
+
private totalSnapshots;
|
|
83
|
+
private totalBodyBytes;
|
|
84
|
+
private evictedCount;
|
|
85
|
+
private expiredCount;
|
|
86
|
+
/**
|
|
87
|
+
* PRI-1150 review (D2/D2b resolution, owner round-9 amendments): whole-key
|
|
88
|
+
* evictions keep a SCAR entry (snapshots=[], historyComplete=false) bounded
|
|
89
|
+
* by MAX_KEYS — the entry itself IS the loss marker; no tombstone table.
|
|
90
|
+
* When scars overflow (heavy churn beyond MAX_KEYS keys), the OLDEST scar is
|
|
91
|
+
* evicted: the registry then enters CAPACITY-EXHAUSTED mode (sticky, process
|
|
92
|
+
* scope) — entries created afterwards cannot prove candidate-history
|
|
93
|
+
* completeness, so they NEVER resolve unique (owner round-9 §一: no unique
|
|
94
|
+
* without provable complete history; degradation is process-scope, sticky
|
|
95
|
+
* until restart, and observable via stats). Entries that already held
|
|
96
|
+
* snapshots before exhaustion keep their provable continuity.
|
|
97
|
+
*/
|
|
98
|
+
private scarEvictions;
|
|
99
|
+
/** Sticky: true once any scar had to be evicted (bounded observation window begun). */
|
|
100
|
+
private capacityExhausted;
|
|
101
|
+
constructor(now?: () => number);
|
|
102
|
+
/** Observable counters (for events/diagnostics; no body content). */
|
|
103
|
+
stats(): {
|
|
104
|
+
keys: number;
|
|
105
|
+
snapshots: number;
|
|
106
|
+
totalBodyBytes: number;
|
|
107
|
+
evictedCount: number;
|
|
108
|
+
expiredCount: number;
|
|
109
|
+
scars: number;
|
|
110
|
+
scarEvictions: number;
|
|
111
|
+
capacityExhausted: boolean;
|
|
112
|
+
};
|
|
113
|
+
private keyOf;
|
|
114
|
+
private workspaceIdOf;
|
|
115
|
+
/** Drops TTL-expired snapshots; returns true when any expired (history loss). */
|
|
116
|
+
private sweepExpiredLocked;
|
|
117
|
+
/**
|
|
118
|
+
* PRI-1150 review (D2/D2b): whole-key evictions leave a bounded SCAR ENTRY
|
|
119
|
+
* (snapshots=[], historyComplete=false) — the entry itself carries the loss
|
|
120
|
+
* fact. Scar entries are bounded by MAX_KEYS; overflowing scars increment
|
|
121
|
+
* scarEvictions, flip the registry into CAPACITY-EXHAUSTED mode (sticky),
|
|
122
|
+
* and the affected keys become indistinguishable from brand-new keys —
|
|
123
|
+
* which post-exhaustion resolve conservatively (never unique).
|
|
124
|
+
*/
|
|
125
|
+
private pushScar;
|
|
126
|
+
/** Drops whole oldest entries / oldest snapshots until the global caps hold. */
|
|
127
|
+
private enforceGlobalCapsLocked;
|
|
128
|
+
registerAssemblySnapshot(params: {
|
|
129
|
+
runId: string;
|
|
130
|
+
sessionId: string;
|
|
131
|
+
expectations: readonly RegisteredExpectation[];
|
|
132
|
+
overflowCount?: number;
|
|
133
|
+
/** Canonical workspace identity (existing path.resolve mechanism); scopes the key. */
|
|
134
|
+
workspaceDir?: string;
|
|
135
|
+
/** Why this assembly's expectation set is empty/degraded (distinct sources, design revision). */
|
|
136
|
+
emptyKind?: PresenceSnapshot['emptyKind'];
|
|
137
|
+
}): {
|
|
138
|
+
registered: boolean;
|
|
139
|
+
degradedReason?: 'snapshot_over_limit';
|
|
140
|
+
assemblySeq?: number;
|
|
141
|
+
};
|
|
142
|
+
resolveBinding(params: {
|
|
143
|
+
runId: string;
|
|
144
|
+
sessionId: string;
|
|
145
|
+
workspaceDir?: string;
|
|
146
|
+
}): BindingVerdict;
|
|
147
|
+
/** Test/diagnostic reset (per-workspace isolation); never called in production paths. */
|
|
148
|
+
resetForTest(): void;
|
|
149
|
+
}
|
|
150
|
+
export declare function getPromptPresenceRegistry(): PromptPresenceRegistry;
|
package/dist/hooks/prompt.d.ts
CHANGED
|
@@ -28,6 +28,46 @@ export declare function beginAdaptivePromptInvocation(ctx: PluginHookAgentContex
|
|
|
28
28
|
artifactId: string;
|
|
29
29
|
activationId: string;
|
|
30
30
|
}, runtimeMode: string, hookInvocationId?: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* PRI-1137 PRE-SELECTION phase for the OpenClaw shared prompt route.
|
|
33
|
+
*
|
|
34
|
+
* The shared runtime must know the session round BEFORE it selects principles
|
|
35
|
+
* (`buildActivePrinciplePromptContext` → roundKey), but OpenClaw's user-turn
|
|
36
|
+
* record is written by `SignalCollectorHost.detectSync`, which the plugin
|
|
37
|
+
* previously ran inside `handleBeforePromptBuild` — i.e. AFTER the shared
|
|
38
|
+
* selection. Calling `nextSessionTurnOrdinal` before that write would read a
|
|
39
|
+
* PREVIOUS round and shift the rotation by one turn.
|
|
40
|
+
*
|
|
41
|
+
* So the plugin preparation is split in two halves that share ONE write:
|
|
42
|
+
* - pre-selection (this function): signal collection + user_turns write,
|
|
43
|
+
* then read the trusted ordinal;
|
|
44
|
+
* - post-selection (`handleBeforePromptBuild`): skips signal collection for
|
|
45
|
+
* an event already claimed here and assembles the host context.
|
|
46
|
+
*
|
|
47
|
+
* The returned ordinal is exactly `max(turn_index) + 1` AFTER this turn is
|
|
48
|
+
* persisted — the same derivation the former plugin-local route used, so the
|
|
49
|
+
* two routes agreed turn-for-turn. No unconditional `+1` offset is applied
|
|
50
|
+
* anywhere.
|
|
51
|
+
*
|
|
52
|
+
* PRI-1137 final review P1-3 — a round key is returned ONLY when this
|
|
53
|
+
* invocation has a real, persisted round of its own:
|
|
54
|
+
* - a run already claimed here reuses ITS OWN persisted ordinal (never the
|
|
55
|
+
* global counter, which a concurrent run's write may have advanced);
|
|
56
|
+
* - a fresh user-interaction write that reports `user_turn_persisted`
|
|
57
|
+
* claims the ordinal it just produced;
|
|
58
|
+
* - EVERYTHING ELSE — no sessionId, no resolvable user message, a message
|
|
59
|
+
* resolution failure, a non-interactive trigger (heartbeat/cron), an
|
|
60
|
+
* agent-to-agent message, a write that did not persist, an unreadable
|
|
61
|
+
* trajectory DB, a non-integer ordinal — returns `undefined` and the
|
|
62
|
+
* selection degrades to `legacy_fifo_prefix_v1`. Previously a write-free
|
|
63
|
+
* invocation still read the global ordinal and claimed fair rotation on a
|
|
64
|
+
* round it never recorded (a heartbeat could re-present the last window
|
|
65
|
+
* as a fresh fair rotation, and an empty session yielded a fabricated
|
|
66
|
+
* round 1). A constant round is never fabricated.
|
|
67
|
+
*/
|
|
68
|
+
export declare function prepareOpenClawPromptRound(event: PluginHookBeforePromptBuildEvent, ctx: PluginHookAgentContext & {
|
|
69
|
+
api?: PromptHookApi;
|
|
70
|
+
}): number | undefined;
|
|
31
71
|
export declare function handleBeforePromptBuild(event: PluginHookBeforePromptBuildEvent, ctx: PluginHookAgentContext & {
|
|
32
72
|
api?: PromptHookApi;
|
|
33
73
|
}, sharedActivePrinciplePrompt?: ActivePrinciplePromptResult): Promise<PluginHookBeforePromptBuildResult | void>;
|
|
@@ -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,6 +65,20 @@ 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;
|
package/dist/openclaw-sdk.d.ts
CHANGED
|
@@ -193,12 +193,45 @@ export interface PluginHookBeforePromptBuildEvent {
|
|
|
193
193
|
currentUserMessageId?: string;
|
|
194
194
|
messages: unknown[];
|
|
195
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* PRI-1150: local mirror of the official llm_input observation contract
|
|
198
|
+
* (release/2026.11.1 `PluginHookLlmInputEvent`). systemPrompt is the FULL
|
|
199
|
+
* assembled system-prompt text (post-guard/post-fallback); historyMessages is
|
|
200
|
+
* the host's isolated snapshot. Read-only observation surface.
|
|
201
|
+
*/
|
|
202
|
+
export interface PluginHookLlmInputEvent {
|
|
203
|
+
runId: string;
|
|
204
|
+
sessionId: string;
|
|
205
|
+
provider: string;
|
|
206
|
+
model: string;
|
|
207
|
+
systemPrompt?: string;
|
|
208
|
+
prompt: string;
|
|
209
|
+
historyMessages: unknown[];
|
|
210
|
+
imagesCount: number;
|
|
211
|
+
tools?: unknown[];
|
|
212
|
+
}
|
|
196
213
|
export interface PluginHookBeforePromptBuildResult {
|
|
197
214
|
systemPrompt?: string;
|
|
198
215
|
prependContext?: string;
|
|
199
216
|
appendContext?: string;
|
|
200
217
|
prependSystemContext?: string;
|
|
201
218
|
appendSystemContext?: string;
|
|
219
|
+
/**
|
|
220
|
+
* Frozen forensic expectation set for this prompt build (prompt presence check).
|
|
221
|
+
* Frozen AFTER the size guard, authorization, timeout and budget fallbacks;
|
|
222
|
+
* bodyComplete=false marks a truncated fragment (never yields a full_hit);
|
|
223
|
+
* activations removed by a fallback are excluded entirely. Memory-only; host
|
|
224
|
+
* passes it to the wire checkpoint.
|
|
225
|
+
*/
|
|
226
|
+
injectedExpectations?: {
|
|
227
|
+
activationId: string;
|
|
228
|
+
revision: number | string;
|
|
229
|
+
bodyText: string;
|
|
230
|
+
bodyChars: number;
|
|
231
|
+
bodyComplete: boolean;
|
|
232
|
+
}[];
|
|
233
|
+
/** Entries dropped by this hook's own collection cap; visibility fact. */
|
|
234
|
+
injectedExpectationsOverflow?: number;
|
|
202
235
|
}
|
|
203
236
|
export interface PluginHookBeforeToolCallEvent {
|
|
204
237
|
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.2",
|
|
6
6
|
"activation": {
|
|
7
7
|
"onStartup": true,
|
|
8
8
|
"onCapabilities": [
|
|
@@ -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, RuntimePromptActivationsInjectedEventData, RuleHostUnhealthyEventData, RuleHostSkippedEventData, TrajectoryObservabilityFailureEventData, ToolCallStats, ErrorStats, EmpathyEventStats, HookStats, DailyStats, } 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, PromptPresenceObservedEventData, RuleHostUnhealthyEventData, RuleHostSkippedEventData, TrajectoryObservabilityFailureEventData, ToolCallStats, ErrorStats, EmpathyEventStats, HookStats, DailyStats, } from '@principles/core/runtime';
|
|
2
2
|
export { createEmptyDailyStats, } from '@principles/core/runtime/types/event-types';
|
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.2",
|
|
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.2",
|
|
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": "^5.
|
|
80
|
-
"@principles/host-runtime": "^
|
|
79
|
+
"@principles/core": "^5.1.1",
|
|
80
|
+
"@principles/host-runtime": "^3.0.3",
|
|
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": "17c7d5c83b78aa03a040807fdfbdcf973371330c"
|
|
113
113
|
}
|