principles-disciple 3.1.1 → 3.1.3
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 +431 -431
- package/dist/hooks/adaptive-activation-config.d.ts +24 -2
- package/dist/hooks/adaptive-principle-resolution.d.ts +35 -0
- package/dist/host-runtime/openclaw-host-runtime.d.ts +3 -0
- package/dist/index.d.ts +14 -2
- package/dist/openclaw.plugin.json +5 -1
- package/openclaw.plugin.json +5 -1
- package/package.json +7 -7
|
@@ -4,5 +4,27 @@ export interface AdaptiveActivationConfig {
|
|
|
4
4
|
softTimeoutMs: number;
|
|
5
5
|
expiresAtMs: number;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* PRI-1140: alternative mapping identity resolved against the CURRENTLY
|
|
9
|
+
* authorized prompt activations at request time (revision-resilient: an Owner
|
|
10
|
+
* prompt-replacement deactivates the pinned activation, and the principle
|
|
11
|
+
* mapping keeps working without a config edit). Exactly one of the two
|
|
12
|
+
* variants is valid; the controlled-admission path keeps requiring the pinned
|
|
13
|
+
* variant because its manifest contract binds exact artifact identity.
|
|
14
|
+
*/
|
|
15
|
+
export interface AdaptivePrincipleActivationConfig {
|
|
16
|
+
principleId: string;
|
|
17
|
+
softTimeoutMs: number;
|
|
18
|
+
expiresAtMs: number;
|
|
19
|
+
}
|
|
20
|
+
export type AdaptiveActivationMapping = AdaptiveActivationConfig | AdaptivePrincipleActivationConfig;
|
|
21
|
+
export declare function isPrincipleIdentityMapping(mapping: AdaptiveActivationMapping): mapping is AdaptivePrincipleActivationConfig;
|
|
22
|
+
/**
|
|
23
|
+
* One explicit, workspace-scoped, expiring mapping; absent/invalid means
|
|
24
|
+
* ordinary Native. PRI-1140: the mapping identity is EITHER the pinned
|
|
25
|
+
* `{artifactId, activationId}` (existing semantics, byte-identical validation)
|
|
26
|
+
* OR `{principleId}` for current-authorized resolution — exactly one of the
|
|
27
|
+
* two; an ambiguous shape (both present, or neither complete) is invalid and
|
|
28
|
+
* fails closed rather than guessing an identity.
|
|
29
|
+
*/
|
|
30
|
+
export declare function readAdaptiveActivationConfig(pluginConfig: unknown, workspaceDir: string, now: number): AdaptiveActivationMapping | null;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRI-1140 — per-invocation memory of the adaptive principle resolution.
|
|
3
|
+
*
|
|
4
|
+
* `resolveAdaptivePriorityForHook` resolves a `{principleId}` mapping to the
|
|
5
|
+
* single currently-authorized activation at provider time (inside the shared
|
|
6
|
+
* runtime call). `handleBeforePromptBuild` needs the SAME resolved identity
|
|
7
|
+
* later in the same invocation — for the mid-flight mapping-change comparison
|
|
8
|
+
* and for the adaptive journal target. This module carries that identity
|
|
9
|
+
* across the two halves of one invocation, mirroring the bounded snapshot
|
|
10
|
+
* memory of `adaptive-config-identity.ts`:
|
|
11
|
+
*
|
|
12
|
+
* - keyed by the invocation's `hookInvocationId` (never by session or event —
|
|
13
|
+
* a replay or duplicate callback cannot consume another invocation's
|
|
14
|
+
* resolution);
|
|
15
|
+
* - consume-once: `take` removes the entry, so a second callback for the same
|
|
16
|
+
* invocation degrades to the safe native baseline exactly like a lost
|
|
17
|
+
* controlled-admission handoff;
|
|
18
|
+
* - bounded (capacity + TTL), never fabricated: a missing entry is
|
|
19
|
+
* `undefined`, not a guessed identity.
|
|
20
|
+
*
|
|
21
|
+
* This is per-round state ONLY. The Owner supplementary condition requires the
|
|
22
|
+
* target to be re-resolved every request, so nothing here survives beyond the
|
|
23
|
+
* invocation that produced it (the next prompt build resolves fresh).
|
|
24
|
+
*/
|
|
25
|
+
export interface AdaptivePrincipleResolution {
|
|
26
|
+
principleId: string;
|
|
27
|
+
artifactId: string;
|
|
28
|
+
activationId: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function rememberAdaptivePrincipleResolution(hookInvocationId: string, resolution: AdaptivePrincipleResolution): void;
|
|
31
|
+
/** Consume-once: the resolution belongs to exactly one post-selection half. */
|
|
32
|
+
export declare function takeAdaptivePrincipleResolution(hookInvocationId: string | undefined): AdaptivePrincipleResolution | undefined;
|
|
33
|
+
export declare function peekAdaptivePrincipleResolutionSizeForTest(): number;
|
|
34
|
+
/** Test-only reset for module-level state. */
|
|
35
|
+
export declare function resetAdaptivePrincipleResolutionForTest(): void;
|
|
@@ -15,12 +15,15 @@ export interface OpenClawHostRuntimeOptions {
|
|
|
15
15
|
adaptivePriorityProvider?(event: PluginHookBeforePromptBuildEvent, context: PluginHookAgentContext): {
|
|
16
16
|
artifactId: string;
|
|
17
17
|
activationId: string;
|
|
18
|
+
/** PRI-1140: true for principle-identity resolution (additive-only packing). */
|
|
19
|
+
additiveOnly?: boolean;
|
|
18
20
|
hookInvocationId?: string;
|
|
19
21
|
signal?: AbortSignal;
|
|
20
22
|
deadlineAt?: number;
|
|
21
23
|
} | undefined | Promise<{
|
|
22
24
|
artifactId: string;
|
|
23
25
|
activationId: string;
|
|
26
|
+
additiveOnly?: boolean;
|
|
24
27
|
hookInvocationId?: string;
|
|
25
28
|
signal?: AbortSignal;
|
|
26
29
|
deadlineAt?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -71,14 +71,26 @@ export declare function syncMcpBindingFromExplicitWorkspace(options: {
|
|
|
71
71
|
* The pre-selection half claims the operator admission (or begins a native
|
|
72
72
|
* delivery invocation) BEFORE the shared selector builds the prompt; the
|
|
73
73
|
* resulting priority is handed to `buildActivePrinciplePromptContext`.
|
|
74
|
+
*
|
|
75
|
+
* PRI-1140: a `{principleId}` mapping resolves to the AT MOST ONE currently
|
|
76
|
+
* authorized prompt activation of that principle at provider time (fresh per
|
|
77
|
+
* request — a revision that lands before the next prompt build is picked up
|
|
78
|
+
* without any config edit). The resolution is remembered for the SAME
|
|
79
|
+
* invocation's post-selection half and the priority is marked `additiveOnly`:
|
|
80
|
+
* the shared assembly may place the target first but must never squeeze out
|
|
81
|
+
* content the native baseline already assembled. Resolution failures fall
|
|
82
|
+
* closed to Native with a structured reason. The controlled-admission branch
|
|
83
|
+
* keeps requiring the pinned mapping (its manifest binds exact artifact
|
|
84
|
+
* identity) and the pinned mapping itself behaves byte-identically to before.
|
|
74
85
|
*/
|
|
75
|
-
export declare function resolveAdaptivePriorityForHook(event: PluginHookBeforePromptBuildEvent, context: PluginHookAgentContext, api: Parameters<typeof handleBeforePromptBuild>[1]['api']): {
|
|
86
|
+
export declare function resolveAdaptivePriorityForHook(event: PluginHookBeforePromptBuildEvent, context: PluginHookAgentContext, api: Parameters<typeof handleBeforePromptBuild>[1]['api']): Promise<{
|
|
76
87
|
artifactId: string;
|
|
77
88
|
activationId: string;
|
|
89
|
+
additiveOnly?: boolean;
|
|
78
90
|
hookInvocationId?: string;
|
|
79
91
|
signal?: AbortSignal;
|
|
80
92
|
deadlineAt?: number;
|
|
81
|
-
} | undefined
|
|
93
|
+
} | undefined>;
|
|
82
94
|
declare const plugin: {
|
|
83
95
|
name: string;
|
|
84
96
|
description: 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": "3.1.
|
|
5
|
+
"version": "3.1.3",
|
|
6
6
|
"activation": {
|
|
7
7
|
"onStartup": true,
|
|
8
8
|
"onCapabilities": [
|
|
@@ -46,6 +46,10 @@
|
|
|
46
46
|
"type": "string",
|
|
47
47
|
"minLength": 1
|
|
48
48
|
},
|
|
49
|
+
"principleId": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"minLength": 1
|
|
52
|
+
},
|
|
49
53
|
"expiresAt": {
|
|
50
54
|
"type": "string",
|
|
51
55
|
"format": "date-time"
|
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": "3.1.
|
|
5
|
+
"version": "3.1.3",
|
|
6
6
|
"activation": {
|
|
7
7
|
"onStartup": true,
|
|
8
8
|
"onCapabilities": [
|
|
@@ -46,6 +46,10 @@
|
|
|
46
46
|
"type": "string",
|
|
47
47
|
"minLength": 1
|
|
48
48
|
},
|
|
49
|
+
"principleId": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"minLength": 1
|
|
52
|
+
},
|
|
49
53
|
"expiresAt": {
|
|
50
54
|
"type": "string",
|
|
51
55
|
"format": "date-time"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "principles-disciple",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
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",
|
|
@@ -77,21 +77,21 @@
|
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@principles/core": "^6.0.0",
|
|
80
|
-
"@principles/host-runtime": "^3.1.
|
|
80
|
+
"@principles/host-runtime": "^3.1.1",
|
|
81
81
|
"@types/better-sqlite3": "^9.6.0",
|
|
82
82
|
"@types/js-yaml": "^4.0.9",
|
|
83
83
|
"@types/micromatch": "^4.0.10",
|
|
84
|
-
"@types/node": "^26.
|
|
84
|
+
"@types/node": "^26.6.6",
|
|
85
85
|
"@types/ws": "^8.18.2",
|
|
86
86
|
"@typescript-eslint/eslint-plugin": "^8.68.0",
|
|
87
87
|
"@typescript-eslint/parser": "^8.70.1",
|
|
88
88
|
"@vitest/coverage-v8": "^5.0.0",
|
|
89
89
|
"esbuild": "^0.28.2",
|
|
90
90
|
"eslint": "^10.8.1",
|
|
91
|
-
"jsdom": "^
|
|
91
|
+
"jsdom": "^31.0.0",
|
|
92
92
|
"typescript": "^7.0.2",
|
|
93
|
-
"vite": "^8.3.
|
|
94
|
-
"vitest": "^5.
|
|
93
|
+
"vite": "^8.3.6",
|
|
94
|
+
"vitest": "^5.1.0",
|
|
95
95
|
"ws": "^8.22.0"
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
@@ -109,5 +109,5 @@
|
|
|
109
109
|
"js-yaml": "^5.4.3",
|
|
110
110
|
"micromatch": "^4.0.8"
|
|
111
111
|
},
|
|
112
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "e7c7e6bba35aa7d691496cf126b195ea3a70fef9"
|
|
113
113
|
}
|