principles-disciple 1.201.0 → 1.202.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/bundle.js +166 -166
- package/dist/commands/archive-impl.d.ts +18 -0
- package/dist/commands/capabilities.d.ts +3 -0
- package/dist/commands/context.d.ts +5 -0
- package/dist/commands/disable-impl.d.ts +22 -0
- package/dist/commands/evolution-status.d.ts +4 -0
- package/dist/commands/export.d.ts +2 -0
- package/dist/commands/focus.d.ts +14 -0
- package/dist/commands/pain.d.ts +6 -0
- package/dist/commands/principle-rollback.d.ts +4 -0
- package/dist/commands/promote-impl.d.ts +22 -0
- package/dist/commands/rollback-impl.d.ts +32 -0
- package/dist/commands/rollback.d.ts +19 -0
- package/dist/commands/samples.d.ts +2 -0
- package/dist/commands/strategy.d.ts +2 -0
- package/dist/commands/thinking-os.d.ts +2 -0
- package/dist/commands/workflow-debug.d.ts +4 -0
- package/dist/config/defaults/runtime.d.ts +58 -0
- package/dist/config/errors.d.ts +86 -0
- package/dist/config/index.d.ts +7 -0
- package/dist/constants/tools.d.ts +17 -0
- package/dist/core/__tests__/focus-history.test.d.ts +1 -0
- package/dist/core/behavior-example-pack-assembler.d.ts +38 -0
- package/dist/core/bootstrap-rules.d.ts +50 -0
- package/dist/core/code-implementation-storage.d.ts +71 -0
- package/dist/core/config-health.d.ts +17 -0
- package/dist/core/config-service.d.ts +15 -0
- package/dist/core/config.d.ts +111 -0
- package/dist/core/control-ui-db.d.ts +117 -0
- package/dist/core/correction-cue-learner.d.ts +33 -0
- package/dist/core/correction-types.d.ts +3 -0
- package/dist/core/detection-funnel.d.ts +47 -0
- package/dist/core/detection-service.d.ts +15 -0
- package/dist/core/dictionary-service.d.ts +15 -0
- package/dist/core/dictionary.d.ts +38 -0
- package/dist/core/empathy-keyword-matcher.d.ts +5 -0
- package/dist/core/empathy-types.d.ts +2 -0
- package/dist/core/event-log.d.ts +98 -0
- package/dist/core/evolution-engine.d.ts +119 -0
- package/dist/core/evolution-logger.d.ts +137 -0
- package/dist/core/evolution-reducer.d.ts +116 -0
- package/dist/core/evolution-types.d.ts +50 -0
- package/dist/core/file-store.d.ts +41 -0
- package/dist/core/focus-history.d.ts +50 -0
- package/dist/core/hygiene/tracker.d.ts +22 -0
- package/dist/core/init.d.ts +30 -0
- package/dist/core/intent-doc-reader-adapter.d.ts +36 -0
- package/dist/core/intent-doc-reader.d.ts +89 -0
- package/dist/core/migration.d.ts +6 -0
- package/dist/core/pain-diagnostic-gate.d.ts +45 -0
- package/dist/core/pain.d.ts +24 -0
- package/dist/core/path-resolver.d.ts +60 -0
- package/dist/core/paths.d.ts +59 -0
- package/dist/core/pd-config-loader.d.ts +96 -0
- package/dist/core/pd-task-reconciler.d.ts +89 -0
- package/dist/core/pd-task-service.d.ts +2 -0
- package/dist/core/pd-task-store.d.ts +5 -0
- package/dist/core/pd-task-types.d.ts +8 -0
- package/dist/core/principle-compiler/__tests__/compiler-replay-gate.test.d.ts +1 -0
- package/dist/core/principle-compiler/code-validator.d.ts +14 -0
- package/dist/core/principle-compiler/compiler.d.ts +45 -0
- package/dist/core/principle-compiler/index.d.ts +12 -0
- package/dist/core/principle-compiler/ledger-registrar.d.ts +28 -0
- package/dist/core/principle-compiler/template-generator.d.ts +7 -0
- package/dist/core/principle-injection.d.ts +10 -0
- package/dist/core/principle-internalization/filesystem-lifecycle-datasource.d.ts +15 -0
- package/dist/core/principle-internalization/lifecycle-read-model.d.ts +17 -0
- package/dist/core/principle-internalization/lifecycle-refresh.d.ts +2 -0
- package/dist/core/principle-internalization/principle-lifecycle-service.d.ts +28 -0
- package/dist/core/principle-training-state.d.ts +47 -0
- package/dist/core/principle-tree-ledger.d.ts +30 -0
- package/dist/core/profile.d.ts +62 -0
- package/dist/core/reflection/reflection-context.d.ts +31 -0
- package/dist/core/replay-engine.d.ts +12 -0
- package/dist/core/rule-context-assembler.d.ts +45 -0
- package/dist/core/rule-host.d.ts +178 -0
- package/dist/core/rule-implementation-runtime.d.ts +18 -0
- package/dist/core/runtime-v2-prompt-activation-reader.d.ts +22 -0
- package/dist/core/session-tracker.d.ts +119 -0
- package/dist/core/signal-collector-host.d.ts +113 -0
- package/dist/core/system-logger.d.ts +24 -0
- package/dist/core/thinking-models.d.ts +25 -0
- package/dist/core/thinking-os-parser.d.ts +35 -0
- package/dist/core/trajectory-types.d.ts +247 -0
- package/dist/core/trajectory.d.ts +279 -0
- package/dist/core/workflow-funnel-loader.d.ts +72 -0
- package/dist/core/workspace-context.d.ts +114 -0
- package/dist/core/workspace-dir-validation.d.ts +11 -0
- package/dist/core/workspace-guidance-migrator.d.ts +12 -0
- package/dist/hooks/after-tool-call-helpers.d.ts +97 -0
- package/dist/hooks/after-tool-call-types.d.ts +86 -0
- package/dist/hooks/gate-block-helper.d.ts +44 -0
- package/dist/hooks/gate.d.ts +16 -0
- package/dist/hooks/lifecycle.d.ts +5 -0
- package/dist/hooks/llm.d.ts +21 -0
- package/dist/hooks/message-sanitize.d.ts +24 -0
- package/dist/hooks/pain.d.ts +35 -0
- package/dist/hooks/prompt-helpers.d.ts +105 -0
- package/dist/hooks/prompt-types.d.ts +74 -0
- package/dist/hooks/prompt.d.ts +22 -0
- package/dist/hooks/raw-observation-adapter.d.ts +16 -0
- package/dist/hooks/raw-observation-types.d.ts +11 -0
- package/dist/hooks/trajectory-collector.d.ts +41 -0
- package/dist/hooks/trajectory-evidence.d.ts +11 -0
- package/dist/hooks/triage-adapter.d.ts +58 -0
- package/dist/hooks/trigger-cooldown-tracker.d.ts +42 -0
- package/dist/i18n/commands.d.ts +26 -0
- package/dist/index.d.ts +52 -0
- package/dist/openclaw-sdk.d.ts +338 -0
- package/dist/openclaw.plugin.json +1 -1
- package/dist/rulehost-evidence.d.ts +4 -0
- package/dist/service/correction-observer-service.d.ts +19 -0
- package/dist/service/evolution-dedup.d.ts +27 -0
- package/dist/service/evolution-worker.d.ts +105 -0
- package/dist/service/internalization-auto-consumer-service.d.ts +8 -0
- package/dist/service/keyword-optimization-service.d.ts +44 -0
- package/dist/service/phase3-input-filter.d.ts +73 -0
- package/dist/service/queue-io.d.ts +30 -0
- package/dist/service/queue-migration.d.ts +84 -0
- package/dist/service/runtime-summary-service.d.ts +156 -0
- package/dist/service/subagent-workflow/subagent-error-utils.d.ts +8 -0
- package/dist/service/subagent-workflow/types.d.ts +264 -0
- package/dist/service/subagent-workflow/workflow-store.d.ts +44 -0
- package/dist/service/trajectory-service.d.ts +2 -0
- package/dist/service/workflow-watchdog.d.ts +23 -0
- package/dist/types/event-types.d.ts +2 -0
- package/dist/types/hygiene-types.d.ts +2 -0
- package/dist/types/principle-tree-schema.d.ts +29 -0
- package/dist/types/queue.d.ts +2 -0
- package/dist/types/runtime-summary.d.ts +1 -0
- package/dist/types.d.ts +13 -0
- package/dist/utils/file-lock.d.ts +68 -0
- package/dist/utils/hashing.d.ts +9 -0
- package/dist/utils/io.d.ts +11 -0
- package/dist/utils/node-vm-polyfill.d.ts +9 -0
- package/dist/utils/retry.d.ts +210 -0
- package/dist/utils/session-key.d.ts +10 -0
- package/dist/utils/workspace-resolver.d.ts +82 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { PD_FILES } from './paths.js';
|
|
2
|
+
import type { PainConfig } from './config.js';
|
|
3
|
+
import type { EventLog } from './event-log.js';
|
|
4
|
+
import type { PainDictionary } from './dictionary.js';
|
|
5
|
+
import { HygieneTracker } from './hygiene/tracker.js';
|
|
6
|
+
import { EvolutionReducerImpl } from './evolution-reducer.js';
|
|
7
|
+
import type { TrajectoryDatabase } from './trajectory.js';
|
|
8
|
+
import { PrincipleLifecycleService } from './principle-internalization/principle-lifecycle-service.js';
|
|
9
|
+
import { type PrincipleSubtree, type LedgerPrinciple, type PrincipleValueMetrics } from './principle-tree-ledger.js';
|
|
10
|
+
import type { Principle as ActivePrinciple } from './evolution-types.js';
|
|
11
|
+
import { RuleHost } from './rule-host.js';
|
|
12
|
+
import type { RuleHostLogger } from './rule-host.js';
|
|
13
|
+
interface PrincipleTreeLedgerAccessor {
|
|
14
|
+
getPrincipleSubtree(_principleId: string): PrincipleSubtree | undefined;
|
|
15
|
+
updatePrinciple(_principleId: string, updates: Partial<LedgerPrinciple>): LedgerPrinciple;
|
|
16
|
+
updatePrincipleValueMetrics(principleId: string, _metrics: PrincipleValueMetrics): PrincipleValueMetrics;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* WorkspaceContext - Centralized management of workspace-specific paths and services.
|
|
20
|
+
* Implements a cached singleton pattern per workspace directory.
|
|
21
|
+
*/
|
|
22
|
+
export declare class WorkspaceContext {
|
|
23
|
+
private static readonly instances;
|
|
24
|
+
private static readonly pathResolver;
|
|
25
|
+
readonly workspaceDir: string;
|
|
26
|
+
readonly stateDir: string;
|
|
27
|
+
private _config?;
|
|
28
|
+
private _eventLog?;
|
|
29
|
+
private _dictionary?;
|
|
30
|
+
private _hygiene?;
|
|
31
|
+
private _evolutionReducer?;
|
|
32
|
+
private _trajectory?;
|
|
33
|
+
private _principleTreeLedger?;
|
|
34
|
+
private _principleLifecycle?;
|
|
35
|
+
private _ruleHost?;
|
|
36
|
+
private constructor();
|
|
37
|
+
/**
|
|
38
|
+
* Governance configuration for this workspace.
|
|
39
|
+
*/
|
|
40
|
+
get config(): PainConfig;
|
|
41
|
+
/**
|
|
42
|
+
* Event logging service for this workspace.
|
|
43
|
+
*/
|
|
44
|
+
get eventLog(): EventLog;
|
|
45
|
+
/**
|
|
46
|
+
* Pain dictionary service for this workspace.
|
|
47
|
+
*/
|
|
48
|
+
get dictionary(): PainDictionary;
|
|
49
|
+
/**
|
|
50
|
+
* Hygiene tracking service for this workspace.
|
|
51
|
+
*/
|
|
52
|
+
get hygiene(): HygieneTracker;
|
|
53
|
+
/**
|
|
54
|
+
* Evolution reducer singleton for this workspace.
|
|
55
|
+
*/
|
|
56
|
+
get evolutionReducer(): EvolutionReducerImpl;
|
|
57
|
+
/**
|
|
58
|
+
* Trajectory database for analytics and sample curation.
|
|
59
|
+
*/
|
|
60
|
+
get trajectory(): TrajectoryDatabase;
|
|
61
|
+
getRuleHost(logger: RuleHostLogger): RuleHost;
|
|
62
|
+
/**
|
|
63
|
+
* Locked ledger access for principle tree reads and metric writes in this workspace.
|
|
64
|
+
*/
|
|
65
|
+
get principleTreeLedger(): PrincipleTreeLedgerAccessor;
|
|
66
|
+
/**
|
|
67
|
+
* Phase 15 lifecycle/read-model surface for metrics, assessments, and route recommendations.
|
|
68
|
+
*/
|
|
69
|
+
get principleLifecycle(): PrincipleLifecycleService;
|
|
70
|
+
/**
|
|
71
|
+
* Retrieve active Principle -> Rule -> Implementation subtrees without bypassing reducer authority.
|
|
72
|
+
*/
|
|
73
|
+
getActivePrincipleSubtrees(): {
|
|
74
|
+
principle: ActivePrinciple;
|
|
75
|
+
subtree: PrincipleSubtree;
|
|
76
|
+
}[];
|
|
77
|
+
private getTrajectoryOptions;
|
|
78
|
+
/**
|
|
79
|
+
* Creates or retrieves a WorkspaceContext instance from an OpenClaw hook context.
|
|
80
|
+
* Uses PathResolver to handle path normalization and fallback logic.
|
|
81
|
+
* @throws Error if workspaceDir is missing and no fallback available.
|
|
82
|
+
*/
|
|
83
|
+
static fromHookContext(ctx: any): WorkspaceContext;
|
|
84
|
+
/**
|
|
85
|
+
* Creates a WorkspaceContext requiring explicit workspaceDir.
|
|
86
|
+
* For Runtime V2 entrypoints where implicit PathResolver fallback is unacceptable.
|
|
87
|
+
* @throws Error if workspaceDir is not provided in the context.
|
|
88
|
+
*/
|
|
89
|
+
static fromHookContextExplicit(ctx: {
|
|
90
|
+
workspaceDir?: string;
|
|
91
|
+
logger?: {
|
|
92
|
+
error?: (...args: unknown[]) => void;
|
|
93
|
+
warn?: (...args: unknown[]) => void;
|
|
94
|
+
info?: (...args: unknown[]) => void;
|
|
95
|
+
};
|
|
96
|
+
}): WorkspaceContext;
|
|
97
|
+
/**
|
|
98
|
+
* Resolves a PD file path within the workspace.
|
|
99
|
+
*/
|
|
100
|
+
resolve(fileKey: keyof typeof PD_FILES): string;
|
|
101
|
+
/**
|
|
102
|
+
* Resets internal caches for services and paths.
|
|
103
|
+
*/
|
|
104
|
+
invalidate(): void;
|
|
105
|
+
/**
|
|
106
|
+
* Removes a workspace from the cache.
|
|
107
|
+
*/
|
|
108
|
+
static dispose(workspaceDir: string): void;
|
|
109
|
+
/**
|
|
110
|
+
* Clears the instance cache (primarily for testing).
|
|
111
|
+
*/
|
|
112
|
+
static clearCache(): void;
|
|
113
|
+
}
|
|
114
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkspaceDir Validation Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module only validates candidate workspace directories. Runtime hook
|
|
5
|
+
* resolution policy lives at the I/O boundary in utils/workspace-resolver.ts.
|
|
6
|
+
*/
|
|
7
|
+
export interface WorkspaceResolutionContext {
|
|
8
|
+
workspaceDir?: string;
|
|
9
|
+
agentId?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function validateWorkspaceDir(dir: string | undefined): string | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OpenClawPluginApi } from '../openclaw-sdk.js';
|
|
2
|
+
interface MigrationError {
|
|
3
|
+
file: string;
|
|
4
|
+
error: string;
|
|
5
|
+
}
|
|
6
|
+
export interface MigrationResult {
|
|
7
|
+
migratedFiles: string[];
|
|
8
|
+
skippedFiles: string[];
|
|
9
|
+
errors: MigrationError[];
|
|
10
|
+
}
|
|
11
|
+
export declare function migrateStaleWorkspaceGuidance(api: OpenClawPluginApi, workspaceDir: string): MigrationResult;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* After-Tool-Call Decomposition Helpers — PRI-326
|
|
3
|
+
*
|
|
4
|
+
* Extracted functions from handleAfterToolCall that implement
|
|
5
|
+
* individual pipeline stages. Each function has a focused responsibility.
|
|
6
|
+
*
|
|
7
|
+
* Pipeline order: classify → record → triage → gate → emit
|
|
8
|
+
*
|
|
9
|
+
* ERR checklist:
|
|
10
|
+
* - ERR-001: No `as` casts on untrusted runtime values.
|
|
11
|
+
* - ERR-002: Every skip/rejection includes structured reason + nextAction.
|
|
12
|
+
* - EP-01: Runtime values validated before use.
|
|
13
|
+
* - EP-03: No silent failures — every path is logged or structured.
|
|
14
|
+
*/
|
|
15
|
+
import { normalizeProfile } from '../core/profile.js';
|
|
16
|
+
import { type SessionState } from '../core/session-tracker.js';
|
|
17
|
+
import { WorkspaceContext } from '../core/workspace-context.js';
|
|
18
|
+
import type { PluginHookAfterToolCallEvent } from '../openclaw-sdk.js';
|
|
19
|
+
import type { ToolCallOutcome, ToolCallObservation, PainAdmissionDecision } from './after-tool-call-types.js';
|
|
20
|
+
/**
|
|
21
|
+
* Extract a preview string from tool call result for diagnostic evidence.
|
|
22
|
+
* Pure function — no I/O, no side effects. ERR-001 / ERR-014 compliant.
|
|
23
|
+
*/
|
|
24
|
+
export declare function extractToolResultPreview(result: unknown): string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Classify the outcome of a tool call event.
|
|
27
|
+
*
|
|
28
|
+
* Pure function — no I/O, no side effects.
|
|
29
|
+
* Extracts exitCode logic, determines failure/success, classifies failure source.
|
|
30
|
+
*/
|
|
31
|
+
export declare function classifyToolCallOutcome(event: PluginHookAfterToolCallEvent): ToolCallOutcome;
|
|
32
|
+
/**
|
|
33
|
+
* Build a normalized observation from the tool call event and workspace context.
|
|
34
|
+
*
|
|
35
|
+
* Combines file path normalization, risk classification, and error analysis.
|
|
36
|
+
* The profile parameter is passed in (loaded once at function scope).
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildToolCallObservation(event: PluginHookAfterToolCallEvent, outcome: ToolCallOutcome, workspaceDir: string, profile: ReturnType<typeof normalizeProfile>): ToolCallObservation;
|
|
39
|
+
/**
|
|
40
|
+
* Handle friction tracking for a tool failure.
|
|
41
|
+
*
|
|
42
|
+
* Updates GFI, records to event log and trajectory.
|
|
43
|
+
* Returns the updated session state and friction info.
|
|
44
|
+
*/
|
|
45
|
+
export declare function handleFrictionTrackingForFailure(sessionId: string, event: PluginHookAfterToolCallEvent, outcome: ToolCallOutcome, observation: ToolCallObservation, gfiBefore: number, workspaceDir: string, config: {
|
|
46
|
+
get: (key: string) => unknown;
|
|
47
|
+
}, wctx: WorkspaceContext): SessionState;
|
|
48
|
+
/**
|
|
49
|
+
* Handle friction relief and recording for a tool success.
|
|
50
|
+
*
|
|
51
|
+
* Relieves both tool_failure and dispatch_error GFI sources proportionally.
|
|
52
|
+
*/
|
|
53
|
+
export declare function handleFrictionTrackingForSuccess(sessionId: string, event: PluginHookAfterToolCallEvent, outcome: ToolCallOutcome, observation: ToolCallObservation, gfiBefore: number, workspaceDir: string, wctx: WorkspaceContext): SessionState;
|
|
54
|
+
/**
|
|
55
|
+
* Record hygiene tracking for memory/plan persistence actions on success.
|
|
56
|
+
*/
|
|
57
|
+
export declare function recordHygieneTracking(event: PluginHookAfterToolCallEvent, observation: ToolCallObservation, wctx: WorkspaceContext): void;
|
|
58
|
+
/**
|
|
59
|
+
* Record probation feedback for injected probation IDs.
|
|
60
|
+
*
|
|
61
|
+
* On success: positive feedback for matching principles.
|
|
62
|
+
* On failure: negative feedback for matching principles.
|
|
63
|
+
*/
|
|
64
|
+
export declare function handleProbationFeedback(sessionId: string, toolName: string, workspaceDir: string, wctx: WorkspaceContext, isSuccess: boolean): void;
|
|
65
|
+
/**
|
|
66
|
+
* Evaluate whether a tool failure should trigger pain diagnosis.
|
|
67
|
+
*
|
|
68
|
+
* PRI-363: Single-gate architecture — only TriggerController decides.
|
|
69
|
+
*
|
|
70
|
+
* Combines:
|
|
71
|
+
* 1. Write-tool check — only write tools on failures enter this path
|
|
72
|
+
* 2. PEAT-B1 triage — evidence triage (always enabled now)
|
|
73
|
+
* 3. PEAT-B2 trigger controller — single source of truth for task creation
|
|
74
|
+
* 4. Cooldown tracking — plugin layer owns this state
|
|
75
|
+
*
|
|
76
|
+
* Returns a structured decision with reason and stage.
|
|
77
|
+
*/
|
|
78
|
+
export declare function evaluatePainAdmissionForToolCall(event: PluginHookAfterToolCallEvent, observation: ToolCallObservation, outcome: ToolCallOutcome, latestFailureState: SessionState | undefined, sessionState: SessionState | undefined, sessionId: string, workspaceDir: string, _config: {
|
|
79
|
+
get: (key: string) => unknown;
|
|
80
|
+
}): PainAdmissionDecision;
|
|
81
|
+
/**
|
|
82
|
+
* Emit pain signal after admission.
|
|
83
|
+
*
|
|
84
|
+
* Records to trajectory, event log, evolution logger, principle value tracker,
|
|
85
|
+
* and emits the pain_detected event.
|
|
86
|
+
*
|
|
87
|
+
* Only called when the admission decision is 'admitted'.
|
|
88
|
+
*/
|
|
89
|
+
export declare function emitPainIfAdmitted(wctx: WorkspaceContext, event: PluginHookAfterToolCallEvent, observation: ToolCallObservation, outcome: ToolCallOutcome, admission: PainAdmissionDecision, sessionId: string, agentId: string | undefined, workspaceDir: string, emitPainDetectedEvent: (wctx: WorkspaceContext, event: import('../core/evolution-types.js').EvolutionLoopEvent, options?: {
|
|
90
|
+
recordObservability?: boolean;
|
|
91
|
+
}) => Promise<void>): void;
|
|
92
|
+
export { buildTrajectoryEvidence } from './trajectory-evidence.js';
|
|
93
|
+
/**
|
|
94
|
+
* Reset trigger cooldown state (for tests).
|
|
95
|
+
* PRI-454: Delegates to shared cooldown Map reset.
|
|
96
|
+
*/
|
|
97
|
+
export declare function resetTriggerCooldownForTest(): void;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* After-Tool-Call Decomposition Types — PRI-326
|
|
3
|
+
*
|
|
4
|
+
* Shared types for the decomposed handleAfterToolCall pipeline.
|
|
5
|
+
* These types make the pipeline stages explicit without introducing
|
|
6
|
+
* the larger RawObservation/PainEpisode/PainEvidence architecture.
|
|
7
|
+
*
|
|
8
|
+
* ERR checklist:
|
|
9
|
+
* - ERR-001: No `as` casts in this file; these are type definitions only.
|
|
10
|
+
* - ERR-002: Every decision/result carries structured reason + nextAction.
|
|
11
|
+
* - EP-01: These types document boundaries, not runtime validation targets.
|
|
12
|
+
*/
|
|
13
|
+
import type { SessionState } from '../core/session-tracker.js';
|
|
14
|
+
/**
|
|
15
|
+
* Result of classifying what happened in a tool call event.
|
|
16
|
+
*
|
|
17
|
+
* Pure extraction — no I/O, no side effects.
|
|
18
|
+
*/
|
|
19
|
+
export interface ToolCallOutcome {
|
|
20
|
+
/** Whether the tool call is considered a failure */
|
|
21
|
+
readonly isFailure: boolean;
|
|
22
|
+
/** Resolved exit code (numeric, 0 if success/absent) */
|
|
23
|
+
readonly exitCode: number;
|
|
24
|
+
/** For failures: classified as 'tool_failure' or 'dispatch_error' */
|
|
25
|
+
readonly failureSource: 'tool_failure' | 'dispatch_error' | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Normalized observation built from the tool call event and context.
|
|
29
|
+
*
|
|
30
|
+
* Used by friction tracking, event recording, and pain admission.
|
|
31
|
+
* Constructed after classification, before any I/O.
|
|
32
|
+
*/
|
|
33
|
+
export interface ToolCallObservation {
|
|
34
|
+
/** Tool parameters (typed subset) */
|
|
35
|
+
readonly params: {
|
|
36
|
+
readonly filePath?: string;
|
|
37
|
+
readonly content?: string;
|
|
38
|
+
readonly text?: string;
|
|
39
|
+
readonly newString?: string;
|
|
40
|
+
readonly query?: string;
|
|
41
|
+
readonly input?: string;
|
|
42
|
+
readonly arguments?: string;
|
|
43
|
+
};
|
|
44
|
+
/** File path relative to workspace */
|
|
45
|
+
readonly relPath: string;
|
|
46
|
+
/** Whether the file path is in the risk set */
|
|
47
|
+
readonly isRisk: boolean;
|
|
48
|
+
/** Error type classification string */
|
|
49
|
+
readonly errorType: string;
|
|
50
|
+
/** Denoised, hashed error identifier */
|
|
51
|
+
readonly errorHash: string;
|
|
52
|
+
/** Error text for logging */
|
|
53
|
+
readonly errorText: string;
|
|
54
|
+
/** Pain score (only meaningful for write-tool failures on risky paths) */
|
|
55
|
+
readonly painScore: number;
|
|
56
|
+
/** Trace ID for this observation chain */
|
|
57
|
+
readonly traceId: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Result of evaluating whether a tool failure should trigger pain diagnosis.
|
|
61
|
+
*
|
|
62
|
+
* Encapsulates the single-gate trigger controller decision.
|
|
63
|
+
*/
|
|
64
|
+
export interface PainAdmissionDecision {
|
|
65
|
+
/** Whether the tool failure should proceed to pain emission */
|
|
66
|
+
readonly admitted: boolean;
|
|
67
|
+
/** The admission stage that made the decision */
|
|
68
|
+
readonly stage: 'not_applicable' | 'trigger_admitted' | 'trigger_rejected';
|
|
69
|
+
/** Human-readable reason for the decision */
|
|
70
|
+
readonly reason: string;
|
|
71
|
+
/** Detail about the decision */
|
|
72
|
+
readonly detail: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Result of friction tracking for a tool call.
|
|
76
|
+
*/
|
|
77
|
+
export interface FrictionUpdateResult {
|
|
78
|
+
/** GFI before this update */
|
|
79
|
+
readonly gfiBefore: number;
|
|
80
|
+
/** GFI after this update */
|
|
81
|
+
readonly gfiAfter: number;
|
|
82
|
+
/** Updated session state (if failure) */
|
|
83
|
+
readonly sessionState: SessionState | undefined;
|
|
84
|
+
/** The error hash used for tracking */
|
|
85
|
+
readonly errorHash: string;
|
|
86
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gate Block Helper - Single Authoritative Block Persistence
|
|
3
|
+
*
|
|
4
|
+
* PURPOSE: Provide ONE authoritative implementation for gate block persistence.
|
|
5
|
+
*
|
|
6
|
+
* All gate sources (rule-host) must use this
|
|
7
|
+
* helper to ensure consistent block tracking, event logging, and retry behavior.
|
|
8
|
+
*
|
|
9
|
+
* This eliminates the "multi-truth source" problem where different modules
|
|
10
|
+
* had their own block persistence implementations.
|
|
11
|
+
*/
|
|
12
|
+
import type { WorkspaceContext } from '../core/workspace-context.js';
|
|
13
|
+
import type { PluginHookBeforeToolCallResult } from '../openclaw-sdk.js';
|
|
14
|
+
/**
|
|
15
|
+
* Block context containing all information needed for block persistence
|
|
16
|
+
*/
|
|
17
|
+
export interface BlockContext {
|
|
18
|
+
filePath: string;
|
|
19
|
+
reason: string;
|
|
20
|
+
toolName: string;
|
|
21
|
+
sessionId?: string;
|
|
22
|
+
/** Source module that triggered the block (for audit trail) */
|
|
23
|
+
blockSource?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Single authoritative block helper.
|
|
27
|
+
*
|
|
28
|
+
* Responsibilities:
|
|
29
|
+
* 1. Call trackBlock() for session-level GFI tracking
|
|
30
|
+
* 2. Record to EventLog for operator visibility
|
|
31
|
+
* 3. Record to trajectory for analytics
|
|
32
|
+
* 4. Handle retry logic for trajectory persistence failures
|
|
33
|
+
* 5. Generate consistent operator-facing block message
|
|
34
|
+
*
|
|
35
|
+
* @param wctx - Workspace context
|
|
36
|
+
* @param blockCtx - Block context with file, reason, tool info
|
|
37
|
+
* @param logger - Logger instance
|
|
38
|
+
* @returns PluginHookBeforeToolCallResult with block=true
|
|
39
|
+
*/
|
|
40
|
+
export declare function recordGateBlockAndReturn(wctx: WorkspaceContext, blockCtx: BlockContext, logger: {
|
|
41
|
+
warn?: (_message: string) => void;
|
|
42
|
+
error?: (_message: string) => void;
|
|
43
|
+
info?: (_message: string) => void;
|
|
44
|
+
}): PluginHookBeforeToolCallResult;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security Gate Hook - Rule Host Only
|
|
3
|
+
*
|
|
4
|
+
* This is the SINGLE AUTHORITATIVE orchestration path.
|
|
5
|
+
* All blocking logic is now dynamic via Rule Host — no hardcoded gates remain.
|
|
6
|
+
*
|
|
7
|
+
* Flow:
|
|
8
|
+
* 1. Early Return: Skip if not write/bash/agent tool or no workspace
|
|
9
|
+
* 2. Rule Host: Dynamic principle-based evaluation (sole gate)
|
|
10
|
+
*/
|
|
11
|
+
import type { PluginHookBeforeToolCallEvent, PluginHookToolContext, PluginHookBeforeToolCallResult, PluginLogger } from '../openclaw-sdk.js';
|
|
12
|
+
export declare function handleBeforeToolCall(event: PluginHookBeforeToolCallEvent, ctx: PluginHookToolContext & {
|
|
13
|
+
workspaceDir?: string;
|
|
14
|
+
pluginConfig?: Record<string, unknown>;
|
|
15
|
+
logger?: Partial<PluginLogger>;
|
|
16
|
+
}): PluginHookBeforeToolCallResult | void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PluginHookBeforeResetEvent, PluginHookBeforeCompactionEvent, PluginHookAfterCompactionEvent, PluginHookAgentContext } from '../openclaw-sdk.js';
|
|
2
|
+
export declare function handleBeforeReset(event: PluginHookBeforeResetEvent, ctx: PluginHookAgentContext): Promise<void>;
|
|
3
|
+
export declare function extractPainFromSessionFile(sessionFile: string, ctx: PluginHookAgentContext): Promise<void>;
|
|
4
|
+
export declare function handleBeforeCompaction(event: PluginHookBeforeCompactionEvent, ctx: PluginHookAgentContext): Promise<void>;
|
|
5
|
+
export declare function handleAfterCompaction(event: PluginHookAfterCompactionEvent, ctx: PluginHookAgentContext): Promise<void>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PluginHookLlmOutputEvent, PluginHookAgentContext } from '../openclaw-sdk.js';
|
|
2
|
+
export interface EmpathySignal {
|
|
3
|
+
detected: boolean;
|
|
4
|
+
severity: 'mild' | 'moderate' | 'severe';
|
|
5
|
+
confidence: number;
|
|
6
|
+
reason?: string;
|
|
7
|
+
mode?: 'structured' | 'legacy_tag';
|
|
8
|
+
}
|
|
9
|
+
export declare function extractEmpathySignal(text: string): EmpathySignal;
|
|
10
|
+
export declare function isEmpathyAuditPayload(text: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Extract enhanced fields from lastAssistant (complete AssistantMessage) in hook payload.
|
|
13
|
+
* Pure function — no I/O, no side effects. ERR-001 compliant.
|
|
14
|
+
*/
|
|
15
|
+
export declare function extractAssistantEnhancedFields(lastAssistant: unknown): {
|
|
16
|
+
stopReason: string | null;
|
|
17
|
+
thinkingBlocksCount: number | null;
|
|
18
|
+
};
|
|
19
|
+
export declare function handleLlmOutput(event: PluginHookLlmOutputEvent, ctx: PluginHookAgentContext & {
|
|
20
|
+
workspaceDir?: string;
|
|
21
|
+
}): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { PluginHookBeforeMessageWriteEvent, PluginHookBeforeMessageWriteResult } from '../openclaw-sdk.js';
|
|
2
|
+
import { convergePath, MAX_EVIDENCE_VALUE_CHARS } from '@principles/core/runtime-v2';
|
|
3
|
+
export { MAX_EVIDENCE_VALUE_CHARS, convergePath };
|
|
4
|
+
/**
|
|
5
|
+
* Sanitize a single string value for evidence storage.
|
|
6
|
+
* Delegates to core sanitizer with optional workspaceDir for path convergence.
|
|
7
|
+
*/
|
|
8
|
+
export declare function sanitizeForEvidence(value: unknown, workspaceDir?: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Recursively sanitize any value for evidence storage.
|
|
11
|
+
* Delegates to core sanitizer.
|
|
12
|
+
*/
|
|
13
|
+
export declare function sanitizeValueForEvidence(value: unknown, workspaceDir?: string): unknown;
|
|
14
|
+
/**
|
|
15
|
+
* Sanitize tool-call params for evidence/trajectory storage.
|
|
16
|
+
* Delegates to core sanitizer — accepts unknown, runtime-validates.
|
|
17
|
+
*
|
|
18
|
+
* ERR-001: no `as` casts on input
|
|
19
|
+
* ERR-055: ANY-segment sensitive field matching
|
|
20
|
+
* ERR-056: token redaction on ALL strings via recursive sanitizeValue
|
|
21
|
+
*/
|
|
22
|
+
export declare function sanitizeToolParamsForEvidence(params: unknown, workspaceDir?: string): Record<string, unknown>;
|
|
23
|
+
export declare function sanitizeAssistantText(text: string): string;
|
|
24
|
+
export declare function handleBeforeMessageWrite(event: PluginHookBeforeMessageWriteEvent): PluginHookBeforeMessageWriteResult | void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pain Hook — PRI-326 decomposed
|
|
3
|
+
*
|
|
4
|
+
* After-tool-call hook that captures tool failures and emits pain signals.
|
|
5
|
+
*
|
|
6
|
+
* Pipeline stages (delegated to after-tool-call-helpers):
|
|
7
|
+
* 1. classifyToolCallOutcome — determine failure/success + source
|
|
8
|
+
* 2. buildToolCallObservation — normalize event into observation
|
|
9
|
+
* 3. handleFrictionTracking — GFI, event log, trajectory recording
|
|
10
|
+
* 4. handleProbationFeedback — probation attribution + cleanup
|
|
11
|
+
* 5. evaluatePainAdmission — triage + gate evaluation
|
|
12
|
+
* 6. emitPainIfAdmitted — pain signal emission
|
|
13
|
+
*
|
|
14
|
+
* The manual pain path (toolName === 'pain') remains inline because it
|
|
15
|
+
* has a different control flow (early return, no triage, no gate on cooldown).
|
|
16
|
+
*/
|
|
17
|
+
import { WorkspaceContext } from '../core/workspace-context.js';
|
|
18
|
+
import type { EvolutionLoopEvent } from '../core/evolution-types.js';
|
|
19
|
+
import type { PluginHookAfterToolCallEvent, PluginHookToolContext, OpenClawPluginApi } from '../openclaw-sdk.js';
|
|
20
|
+
import { buildTrajectoryEvidence } from './trajectory-evidence.js';
|
|
21
|
+
export { buildTrajectoryEvidence };
|
|
22
|
+
export declare function emitPainDetectedEvent(wctx: WorkspaceContext, event: EvolutionLoopEvent, options?: {
|
|
23
|
+
recordObservability?: boolean;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Handle after_tool_call hook — decomposed into pipeline stages.
|
|
27
|
+
*
|
|
28
|
+
* Pipeline: classify → record → triage → gate → emit
|
|
29
|
+
*
|
|
30
|
+
* Manual pain (toolName === 'pain') is handled inline with early return.
|
|
31
|
+
*/
|
|
32
|
+
export declare function handleAfterToolCall(event: PluginHookAfterToolCallEvent, ctx: PluginHookToolContext & {
|
|
33
|
+
workspaceDir?: string;
|
|
34
|
+
pluginConfig?: Record<string, unknown>;
|
|
35
|
+
}, api?: OpenClawPluginApi): void;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure-logic helpers for prompt assembly.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from hooks/prompt.ts per PRI-444. These functions contain NO I/O
|
|
5
|
+
* and NO side effects — they are independently unit-testable.
|
|
6
|
+
*
|
|
7
|
+
* I/O helpers (cachedReadFile, loadContextInjectionConfig, resolveEmpathyObserver)
|
|
8
|
+
* remain in prompt.ts because they depend on module-level cache state and fs.
|
|
9
|
+
*
|
|
10
|
+
* Pattern follows after-tool-call-helpers.ts (PRI-326): plugin-internal
|
|
11
|
+
* decomposition + core pure-function reuse.
|
|
12
|
+
*
|
|
13
|
+
* ERR checklist:
|
|
14
|
+
* EP-01: All unknown inputs use typeof/Object.hasOwn guards, never `as`
|
|
15
|
+
* EP-03: Pure functions never swallow errors; invalid input returns empty string
|
|
16
|
+
* EP-09: Pure functions are independently unit-testable without mocks
|
|
17
|
+
*/
|
|
18
|
+
import type { ExtractedUserMessage, CorePrincipleEntry, EvolutionPrincipleEntry, AppendSystemContextParts } from './prompt-types.js';
|
|
19
|
+
/**
|
|
20
|
+
* Extract the actual user message from the raw prompt text.
|
|
21
|
+
*
|
|
22
|
+
* The prompt may contain:
|
|
23
|
+
* - Boot check messages (system-generated, return empty)
|
|
24
|
+
* - Feishu wrapper format 1: "Sender (untrusted metadata): ```json {...}``` text"
|
|
25
|
+
* - Feishu wrapper format 2: "Conversation info (untrusted metadata): ```json {...}``` text"
|
|
26
|
+
* - Clean user message text
|
|
27
|
+
*
|
|
28
|
+
* Also detects empathy observer output (to prevent recursive spawn) and
|
|
29
|
+
* agent-to-agent messages (to skip empathy evaluation).
|
|
30
|
+
*
|
|
31
|
+
* Pure logic — no I/O, no side effects.
|
|
32
|
+
*/
|
|
33
|
+
export declare function extractUserMessageFromPrompt(prompt: string, sessionId: string | undefined): ExtractedUserMessage;
|
|
34
|
+
/**
|
|
35
|
+
* Build the minimal Agent Identity section for prependSystemContext.
|
|
36
|
+
*
|
|
37
|
+
* EvolutionWorker-era INTERNAL SYSTEM LAYOUT removed per PRI-294.
|
|
38
|
+
* The EVOLUTION_WORKER PathResolver key and system layout reference are
|
|
39
|
+
* not MVP-Core; agents discover what they need via tool calls.
|
|
40
|
+
*
|
|
41
|
+
* Pure logic — returns a constant string.
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildAgentIdentity(): string;
|
|
44
|
+
/**
|
|
45
|
+
* Build the empathy output restriction constraint text.
|
|
46
|
+
*
|
|
47
|
+
* Pure logic — returns a constant string.
|
|
48
|
+
*/
|
|
49
|
+
export declare function buildEmpathySilenceConstraint(): string;
|
|
50
|
+
/**
|
|
51
|
+
* Wrap heartbeat checklist content in XML tags.
|
|
52
|
+
*
|
|
53
|
+
* Pure logic — no I/O, no side effects.
|
|
54
|
+
*/
|
|
55
|
+
export declare function assembleHeartbeatChecklist(content: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Format core principles into prompt-ready text.
|
|
58
|
+
*
|
|
59
|
+
* Pure logic — uses escapeXml for safe XML embedding.
|
|
60
|
+
*
|
|
61
|
+
* @param principles Active principles from evolution reducer
|
|
62
|
+
* @returns Formatted lines (empty string if no principles)
|
|
63
|
+
*/
|
|
64
|
+
export declare function formatCorePrinciples(principles: CorePrincipleEntry[]): string;
|
|
65
|
+
/**
|
|
66
|
+
* Format evolution principles (active + probation) into prompt-ready text.
|
|
67
|
+
*
|
|
68
|
+
* Pure logic — uses escapeXml for safe XML embedding.
|
|
69
|
+
*
|
|
70
|
+
* @param active Active principles (high priority)
|
|
71
|
+
* @param probation Probation principles (contextual, caution)
|
|
72
|
+
* @returns Formatted lines (empty string if no principles)
|
|
73
|
+
*/
|
|
74
|
+
export declare function formatEvolutionPrinciples(active: EvolutionPrincipleEntry[], probation: EvolutionPrincipleEntry[]): string;
|
|
75
|
+
/**
|
|
76
|
+
* Assemble appendSystemContext from ordered parts.
|
|
77
|
+
*
|
|
78
|
+
* Content order (most important last):
|
|
79
|
+
* behavioral_constraints → project_context → intent_block → working_memory →
|
|
80
|
+
* thinking_os → evolution_principles → core_principles
|
|
81
|
+
*
|
|
82
|
+
* PRI-467: intent_block (INTENT.md reference) sits after project_context
|
|
83
|
+
* (stable reference data, lower priority than principles) and before
|
|
84
|
+
* working_memory (volatile per-session state).
|
|
85
|
+
*
|
|
86
|
+
* Pure logic — string assembly only, no I/O.
|
|
87
|
+
*
|
|
88
|
+
* @param parts Ordered content parts (empty/undefined parts are skipped)
|
|
89
|
+
* @returns Assembled appendSystemContext (empty string if no parts)
|
|
90
|
+
*/
|
|
91
|
+
export declare function assembleAppendSystemContext(parts: AppendSystemContextParts): string;
|
|
92
|
+
/**
|
|
93
|
+
* Extracts short, distinct keyword phrases from an EmpathyObserver reason string.
|
|
94
|
+
*
|
|
95
|
+
* Used to feed newly detected expressions back into the keyword store, so the
|
|
96
|
+
* keyword-based fast path can catch them on future turns without re-running
|
|
97
|
+
* the more expensive observer.
|
|
98
|
+
*
|
|
99
|
+
* Pure function — no I/O, no side effects. Fully unit-testable.
|
|
100
|
+
*
|
|
101
|
+
* @param reason - observer's reason string (e.g., "用户表达了强烈的挫败感,提到反复尝试失败")
|
|
102
|
+
* @param lang - UI locale for minimum length threshold (zh=2 chars, en=3 chars)
|
|
103
|
+
* @returns deduplicated array of up to 3 candidate phrases
|
|
104
|
+
*/
|
|
105
|
+
export declare function extractPhrasesFromReason(reason: string, lang: 'zh' | 'en'): string[];
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for prompt assembly.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from hooks/prompt.ts per PRI-444 to enable independent testing
|
|
5
|
+
* of pure-logic helpers without importing the full hook module.
|
|
6
|
+
*
|
|
7
|
+
* ERR checklist:
|
|
8
|
+
* EP-01: All unknown inputs use typeof/Object.hasOwn guards, never `as`
|
|
9
|
+
* EP-03: Pure functions never swallow errors silently
|
|
10
|
+
* EP-09: Pure functions are independently unit-testable without mocks
|
|
11
|
+
*/
|
|
12
|
+
import type { PluginLogger, OpenClawPluginApi } from '../openclaw-sdk.js';
|
|
13
|
+
/** Cached file entry for TTL-based file reading. */
|
|
14
|
+
export interface CachedFile {
|
|
15
|
+
content: string;
|
|
16
|
+
mtime: number;
|
|
17
|
+
loadedAt: number;
|
|
18
|
+
}
|
|
19
|
+
/** Per-workspace empathy session state. */
|
|
20
|
+
export interface EmpathySessionState {
|
|
21
|
+
turnCounter: number;
|
|
22
|
+
keywordCache: {
|
|
23
|
+
store: unknown;
|
|
24
|
+
lang: string;
|
|
25
|
+
} | null;
|
|
26
|
+
}
|
|
27
|
+
/** API surface exposed to the prompt hook by the plugin runtime. */
|
|
28
|
+
export interface PromptHookApi {
|
|
29
|
+
config?: {
|
|
30
|
+
empathy_engine?: {
|
|
31
|
+
enabled?: boolean;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
runtime: OpenClawPluginApi['runtime'];
|
|
35
|
+
logger: PluginLogger;
|
|
36
|
+
}
|
|
37
|
+
/** Result of extracting the user message from the raw prompt text. */
|
|
38
|
+
export interface ExtractedUserMessage {
|
|
39
|
+
/** Cleaned user message (empty string for boot checks). */
|
|
40
|
+
message: string;
|
|
41
|
+
/** True if the message appears to be from another agent (skip empathy). */
|
|
42
|
+
isAgentToAgent: boolean;
|
|
43
|
+
/** True if the message looks like empathy observer output (prevent recursion). */
|
|
44
|
+
isEmpathyPrompt: boolean;
|
|
45
|
+
}
|
|
46
|
+
/** Input for formatting core principles into prompt text. */
|
|
47
|
+
export interface CorePrincipleEntry {
|
|
48
|
+
id: string;
|
|
49
|
+
text: string;
|
|
50
|
+
}
|
|
51
|
+
/** Input for formatting evolution principles (active + probation). */
|
|
52
|
+
export interface EvolutionPrincipleEntry extends CorePrincipleEntry {
|
|
53
|
+
}
|
|
54
|
+
/** Parts assembled into appendSystemContext. Order = priority (low → high). */
|
|
55
|
+
export interface AppendSystemContextParts {
|
|
56
|
+
behavioralConstraints?: string;
|
|
57
|
+
projectContext?: string;
|
|
58
|
+
/**
|
|
59
|
+
* PRI-467: Intent Engineering friction block. Bounded + escaped INTENT.md
|
|
60
|
+
* reference. Positioned after projectContext (stable reference data, lower
|
|
61
|
+
* priority than principles) and before workingMemory (volatile per-session
|
|
62
|
+
* state). Only populated when intent_engineering flag is on and INTENT.md
|
|
63
|
+
* is valid.
|
|
64
|
+
*/
|
|
65
|
+
intentBlock?: string;
|
|
66
|
+
workingMemory?: string;
|
|
67
|
+
thinkingOs?: string;
|
|
68
|
+
evolutionPrinciples?: string;
|
|
69
|
+
corePrinciples?: string;
|
|
70
|
+
}
|
|
71
|
+
/** Input for the heartbeat checklist wrapper. */
|
|
72
|
+
export interface HeartbeatChecklistInput {
|
|
73
|
+
content: string;
|
|
74
|
+
}
|