principles-disciple 1.156.0 → 1.157.0
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/core/thinking-models.d.ts +4 -18
- package/dist/core/thinking-models.js +1 -20
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/dist/core/evolution-migration.d.ts +0 -5
- package/dist/core/evolution-migration.js +0 -65
- package/dist/core/rule-host-helpers.d.ts +0 -8
- package/dist/core/rule-host-helpers.js +0 -7
- package/dist/core/rule-host-types.d.ts +0 -7
- package/dist/core/rule-host-types.js +0 -7
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* BUILTIN_PATTERNS (engine) → detection regexes per model id
|
|
11
11
|
* THINKING_MODELS (merged) → full definitions with patterns
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
interface ThinkingModelDefinition {
|
|
14
14
|
id: string;
|
|
15
15
|
name: string;
|
|
16
16
|
description: string;
|
|
@@ -18,11 +18,11 @@ export interface ThinkingModelDefinition {
|
|
|
18
18
|
patterns: RegExp[];
|
|
19
19
|
baselineScenarios: string[];
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
interface ThinkingModelMatch {
|
|
22
22
|
modelId: string;
|
|
23
23
|
matchedPattern: string;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
interface ThinkingScenarioContext {
|
|
26
26
|
recentToolCalls?: {
|
|
27
27
|
toolName: string;
|
|
28
28
|
outcome: 'success' | 'failure' | 'blocked';
|
|
@@ -51,20 +51,6 @@ export interface ThinkingScenarioContext {
|
|
|
51
51
|
* @param workspaceDir Optional. If provided, loads from that workspace's THINKING_OS.md.
|
|
52
52
|
*/
|
|
53
53
|
export declare function listThinkingModels(workspaceDir?: string): ThinkingModelDefinition[];
|
|
54
|
-
/**
|
|
55
|
-
* Clear the cached model definitions.
|
|
56
|
-
* Call this when THINKING_OS.md changes.
|
|
57
|
-
*/
|
|
58
|
-
export declare function clearThinkingModelCache(): void;
|
|
59
|
-
export declare function getThinkingModel(modelId: string, workspaceDir?: string): ThinkingModelDefinition | undefined;
|
|
60
54
|
export declare function detectThinkingModelMatches(text: string, workspaceDir?: string): ThinkingModelMatch[];
|
|
61
|
-
/**
|
|
62
|
-
* Get all model definitions for display purposes (no patterns).
|
|
63
|
-
*/
|
|
64
|
-
export declare function getThinkingModelDefinitions(workspaceDir?: string): {
|
|
65
|
-
modelId: string;
|
|
66
|
-
name: string;
|
|
67
|
-
description: string;
|
|
68
|
-
antiPattern?: string;
|
|
69
|
-
}[];
|
|
70
55
|
export declare function deriveThinkingScenarios(modelId: string, context: ThinkingScenarioContext): string[];
|
|
56
|
+
export {};
|
|
@@ -213,15 +213,7 @@ export function listThinkingModels(workspaceDir) {
|
|
|
213
213
|
_cachedWorkspace = cacheKey;
|
|
214
214
|
return models.slice();
|
|
215
215
|
}
|
|
216
|
-
|
|
217
|
-
* Clear the cached model definitions.
|
|
218
|
-
* Call this when THINKING_OS.md changes.
|
|
219
|
-
*/
|
|
220
|
-
export function clearThinkingModelCache() {
|
|
221
|
-
_cachedDefinitions = null;
|
|
222
|
-
_cachedWorkspace = null;
|
|
223
|
-
}
|
|
224
|
-
export function getThinkingModel(modelId, workspaceDir) {
|
|
216
|
+
function getThinkingModel(modelId, workspaceDir) {
|
|
225
217
|
const models = listThinkingModels(workspaceDir);
|
|
226
218
|
return models.find(m => m.id === modelId);
|
|
227
219
|
}
|
|
@@ -243,17 +235,6 @@ export function detectThinkingModelMatches(text, workspaceDir) {
|
|
|
243
235
|
}
|
|
244
236
|
return matches;
|
|
245
237
|
}
|
|
246
|
-
/**
|
|
247
|
-
* Get all model definitions for display purposes (no patterns).
|
|
248
|
-
*/
|
|
249
|
-
export function getThinkingModelDefinitions(workspaceDir) {
|
|
250
|
-
return listThinkingModels(workspaceDir).map(m => ({
|
|
251
|
-
modelId: m.id,
|
|
252
|
-
name: m.id + ': ' + m.name,
|
|
253
|
-
description: m.description,
|
|
254
|
-
antiPattern: m.antiPattern,
|
|
255
|
-
}));
|
|
256
|
-
}
|
|
257
238
|
export function deriveThinkingScenarios(modelId, context) {
|
|
258
239
|
const scenarios = new Set(getThinkingModel(modelId)?.baselineScenarios ?? []);
|
|
259
240
|
if ((context.recentToolCalls ?? []).some((call) => call.outcome === 'failure')) {
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "principles-disciple",
|
|
3
3
|
"name": "Principles Disciple",
|
|
4
4
|
"description": "Evolutionary programming agent framework with strategic guardrails and reflection loops.",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.157.0",
|
|
6
6
|
"activation": {
|
|
7
7
|
"onCapabilities": [
|
|
8
8
|
"hook"
|
package/package.json
CHANGED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import { stableContentHash } from './evolution-reducer.js';
|
|
4
|
-
import { SystemLogger } from './system-logger.js';
|
|
5
|
-
function appendEvent(streamPath, event) {
|
|
6
|
-
fs.appendFileSync(streamPath, `${JSON.stringify(event)}\n`, 'utf8');
|
|
7
|
-
}
|
|
8
|
-
function loadImportedHashes(streamPath, workspaceDir) {
|
|
9
|
-
if (!fs.existsSync(streamPath))
|
|
10
|
-
return new Set();
|
|
11
|
-
const raw = fs.readFileSync(streamPath, 'utf8').trim();
|
|
12
|
-
if (!raw)
|
|
13
|
-
return new Set();
|
|
14
|
-
const hashes = new Set();
|
|
15
|
-
for (const line of raw.split('\n')) {
|
|
16
|
-
try {
|
|
17
|
-
const event = JSON.parse(line);
|
|
18
|
-
if (event.type !== 'legacy_import')
|
|
19
|
-
continue;
|
|
20
|
-
const hash = event.data.contentHash;
|
|
21
|
-
if (typeof hash === 'string')
|
|
22
|
-
hashes.add(hash);
|
|
23
|
-
}
|
|
24
|
-
catch (e) {
|
|
25
|
-
SystemLogger.log(workspaceDir, 'MIGRATION_WARN', `skip malformed line: ${String(e)}`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return hashes;
|
|
29
|
-
}
|
|
30
|
-
export function migrateLegacyEvolutionData(workspaceDir) {
|
|
31
|
-
const streamPath = path.join(workspaceDir, 'memory', 'evolution.jsonl');
|
|
32
|
-
fs.mkdirSync(path.dirname(streamPath), { recursive: true });
|
|
33
|
-
const candidates = [
|
|
34
|
-
path.join(workspaceDir, 'memory', 'ISSUE_LOG.md'),
|
|
35
|
-
path.join(workspaceDir, 'memory', 'DECISIONS.md'),
|
|
36
|
-
path.join(workspaceDir, '.principles', 'PRINCIPLES.md'),
|
|
37
|
-
];
|
|
38
|
-
const existingHashes = loadImportedHashes(streamPath, workspaceDir);
|
|
39
|
-
let importedEvents = 0;
|
|
40
|
-
for (const sourceFile of candidates) {
|
|
41
|
-
if (!fs.existsSync(sourceFile)) {
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
const content = fs.readFileSync(sourceFile, 'utf8').trim();
|
|
45
|
-
if (!content) {
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
const contentHash = stableContentHash(`${sourceFile}:${content}`);
|
|
49
|
-
if (existingHashes.has(contentHash)) {
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
appendEvent(streamPath, {
|
|
53
|
-
ts: new Date().toISOString(),
|
|
54
|
-
type: 'legacy_import',
|
|
55
|
-
data: {
|
|
56
|
-
sourceFile: path.relative(workspaceDir, sourceFile),
|
|
57
|
-
content,
|
|
58
|
-
contentHash,
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
importedEvents += 1;
|
|
62
|
-
existingHashes.add(contentHash);
|
|
63
|
-
}
|
|
64
|
-
return { importedEvents, streamPath };
|
|
65
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rule Host Helpers — Re-exported from @principles/core (PRI-42)
|
|
3
|
-
*
|
|
4
|
-
* Canonical definitions moved to:
|
|
5
|
-
* packages/principles-core/src/runtime-v2/internalization/rule-host-helpers.ts
|
|
6
|
-
*/
|
|
7
|
-
export type { RuleHostHelpers } from '@principles/core/runtime-v2';
|
|
8
|
-
export { createRuleHostHelpers } from '@principles/core/runtime-v2';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rule Host Types — Re-exported from @principles/core (PRI-42)
|
|
3
|
-
*
|
|
4
|
-
* Canonical definitions moved to:
|
|
5
|
-
* packages/principles-core/src/runtime-v2/internalization/rule-host-contracts.ts
|
|
6
|
-
*/
|
|
7
|
-
export type { RuleHostInput, RuleHostDecision, RuleHostMeta, RuleHostResult, LoadedImplementation, } from '@principles/core/runtime-v2';
|