principles-disciple 1.48.0 → 1.49.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.
@@ -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.48.0",
5
+ "version": "1.49.0",
6
6
  "skills": [
7
7
  "./skills"
8
8
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "principles-disciple",
3
- "version": "1.48.0",
3
+ "version": "1.49.0",
4
4
  "description": "Native OpenClaw plugin for Principles Disciple",
5
5
  "type": "module",
6
6
  "main": "./dist/bundle.js",
@@ -1,8 +1,9 @@
1
1
  import type { OpenClawPluginApi } from '../openclaw-sdk.js';
2
2
  import { Type } from '@sinclair/typebox';
3
3
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
4
- import { buildPainFlag, writePainFlag } from '../core/pain.js';
4
+ import { buildPainFlag } from '../core/pain.js';
5
5
  import { resolveWorkspaceDirFromApi } from '../core/path-resolver.js';
6
+ import { TrajectoryRegistry } from '../core/trajectory.js';
6
7
  import * as fs from 'fs';
7
8
  import * as path from 'path';
8
9
  import { atomicWriteFileSync } from '../utils/io.js';
@@ -116,6 +117,29 @@ export function createWritePainFlagTool(api: OpenClawPluginApi) {
116
117
  }
117
118
 
118
119
  try {
120
+ // ── Record pain event to trajectory DB first (before flag file) ──
121
+ // This ensures we have a real AUTOINCREMENT ID that flows through
122
+ // the entire pain→principle→compile chain (painEventId propagation).
123
+ let painEventId: number | undefined;
124
+ try {
125
+ const trajectory = TrajectoryRegistry.get(workspaceDir);
126
+ painEventId = trajectory.recordPainEvent({
127
+ sessionId: sessionId || 'unknown',
128
+ source,
129
+ score,
130
+ reason,
131
+ severity: null,
132
+ origin: 'manual',
133
+ confidence: null,
134
+ text: undefined,
135
+ });
136
+ } catch (trajErr) {
137
+ // If trajectory write fails, log but continue — the pain flag
138
+ // itself is still valid and should be processed. The pain event
139
+ // ID simply won't be available for the compiler's exact matching.
140
+ api.logger?.warn?.(`[PD:write_pain_flag] Failed to record pain event to trajectory: ${String(trajErr)}`);
141
+ }
142
+
119
143
  // ── Build pain flag data (KV format) ──
120
144
  const painData = buildPainFlag({
121
145
  source,
@@ -123,6 +147,7 @@ export function createWritePainFlagTool(api: OpenClawPluginApi) {
123
147
  reason,
124
148
  session_id: sessionId,
125
149
  is_risky: isRisky,
150
+ pain_event_id: painEventId !== undefined ? String(painEventId) : undefined,
126
151
  });
127
152
 
128
153
  // ── Validate contract compliance ──