principles-disciple 1.42.0 → 1.44.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.
Files changed (83) hide show
  1. package/openclaw.plugin.json +1 -1
  2. package/package.json +1 -1
  3. package/src/commands/archive-impl.ts +5 -3
  4. package/src/commands/capabilities.ts +1 -1
  5. package/src/commands/context.ts +1 -0
  6. package/src/commands/disable-impl.ts +1 -1
  7. package/src/commands/evolution-status.ts +2 -2
  8. package/src/commands/export.ts +6 -6
  9. package/src/commands/nocturnal-train.ts +1 -1
  10. package/src/commands/principle-rollback.ts +1 -1
  11. package/src/commands/rollback.ts +0 -1
  12. package/src/commands/samples.ts +1 -1
  13. package/src/commands/thinking-os.ts +1 -0
  14. package/src/commands/workflow-debug.ts +1 -1
  15. package/src/core/adaptive-thresholds.ts +3 -3
  16. package/src/core/config.ts +2 -1
  17. package/src/core/dictionary.ts +1 -0
  18. package/src/core/event-log.ts +3 -3
  19. package/src/core/evolution-engine.ts +1 -1
  20. package/src/core/external-training-contract.ts +1 -1
  21. package/src/core/merge-gate-audit.ts +3 -3
  22. package/src/core/nocturnal-arbiter.ts +1 -1
  23. package/src/core/nocturnal-compliance.ts +28 -28
  24. package/src/core/nocturnal-executability.ts +1 -1
  25. package/src/core/nocturnal-reasoning-deriver.ts +4 -4
  26. package/src/core/nocturnal-rule-implementation-validator.ts +1 -1
  27. package/src/core/nocturnal-snapshot-contract.ts +1 -1
  28. package/src/core/pain-context-extractor.ts +2 -2
  29. package/src/core/path-resolver.ts +1 -0
  30. package/src/core/pd-task-reconciler.ts +1 -0
  31. package/src/core/pd-task-service.ts +1 -1
  32. package/src/core/pd-task-store.ts +1 -0
  33. package/src/core/principle-internalization/deprecated-readiness.ts +1 -1
  34. package/src/core/principle-internalization/principle-lifecycle-service.ts +1 -1
  35. package/src/core/principle-training-state.ts +2 -2
  36. package/src/core/principle-tree-migration.ts +1 -1
  37. package/src/core/profile.ts +1 -1
  38. package/src/core/promotion-gate.ts +0 -2
  39. package/src/core/replay-engine.ts +1 -0
  40. package/src/core/risk-calculator.ts +2 -1
  41. package/src/core/rule-host.ts +1 -1
  42. package/src/core/session-tracker.ts +1 -0
  43. package/src/core/shadow-observation-registry.ts +1 -1
  44. package/src/core/thinking-models.ts +1 -1
  45. package/src/core/thinking-os-parser.ts +1 -1
  46. package/src/core/trajectory.ts +2 -4
  47. package/src/core/workspace-context.ts +1 -1
  48. package/src/hooks/bash-risk.ts +2 -2
  49. package/src/hooks/edit-verification.ts +4 -4
  50. package/src/hooks/gate.ts +8 -8
  51. package/src/hooks/gfi-gate.ts +2 -2
  52. package/src/hooks/lifecycle-routing.ts +1 -1
  53. package/src/hooks/pain.ts +2 -2
  54. package/src/hooks/progressive-trust-gate.ts +3 -3
  55. package/src/hooks/prompt.ts +3 -5
  56. package/src/hooks/thinking-checkpoint.ts +1 -1
  57. package/src/index.ts +8 -8
  58. package/src/service/central-database.ts +3 -2
  59. package/src/service/central-health-service.ts +2 -1
  60. package/src/service/central-overview-service.ts +3 -2
  61. package/src/service/control-ui-query-service.ts +2 -2
  62. package/src/service/event-log-auditor.ts +2 -2
  63. package/src/service/evolution-query-service.ts +3 -3
  64. package/src/service/evolution-worker.ts +11 -18
  65. package/src/service/health-query-service.ts +11 -10
  66. package/src/service/monitoring-query-service.ts +4 -4
  67. package/src/service/nocturnal-runtime.ts +0 -3
  68. package/src/service/nocturnal-service.ts +8 -8
  69. package/src/service/nocturnal-target-selector.ts +2 -2
  70. package/src/service/queue-io.ts +5 -5
  71. package/src/service/runtime-summary-service.ts +1 -1
  72. package/src/service/sleep-cycle.ts +1 -1
  73. package/src/service/subagent-workflow/deep-reflect-workflow-manager.ts +1 -1
  74. package/src/service/subagent-workflow/empathy-observer-workflow-manager.ts +1 -0
  75. package/src/service/subagent-workflow/nocturnal-workflow-manager.ts +1 -1
  76. package/src/service/subagent-workflow/subagent-error-utils.ts +1 -1
  77. package/src/service/subagent-workflow/workflow-store.ts +3 -2
  78. package/src/service/workflow-watchdog.ts +1 -1
  79. package/src/tools/critique-prompt.ts +1 -1
  80. package/src/tools/model-index.ts +1 -1
  81. package/src/utils/file-lock.ts +1 -1
  82. package/src/utils/io.ts +1 -1
  83. package/src/utils/retry.ts +2 -2
@@ -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.42.0",
5
+ "version": "1.44.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.42.0",
3
+ "version": "1.44.0",
4
4
  "description": "Native OpenClaw plugin for Principles Disciple",
5
5
  "type": "module",
6
6
  "main": "./dist/bundle.js",
@@ -8,6 +8,8 @@
8
8
  * Used for permanent cleanup of implementations that are no longer relevant.
9
9
  */
10
10
 
11
+
12
+
11
13
  import { WorkspaceContext } from '../core/workspace-context.js';
12
14
  import { refreshPrincipleLifecycle } from '../core/principle-internalization/lifecycle-refresh.js';
13
15
  import {
@@ -52,14 +54,14 @@ export function handleArchiveImplCommand(ctx: PluginCommandContext): PluginComma
52
54
  // Subcommand: list
53
55
  if (subcommand === 'list') {
54
56
 
55
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
57
+
56
58
  return _handleListArchivable(stateDir, isZh);
57
59
  }
58
60
 
59
61
  // Archive by ID
60
62
  const targetId = subcommand;
61
63
 
62
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
64
+
63
65
  return _handleArchiveImpl(workspaceDir, stateDir, targetId, isZh);
64
66
  }
65
67
 
@@ -97,7 +99,7 @@ function _handleListArchivable(
97
99
  }
98
100
 
99
101
 
100
- // eslint-disable-next-line @typescript-eslint/max-params
102
+
101
103
  function _handleArchiveImpl(
102
104
  workspaceDir: string,
103
105
  stateDir: string,
@@ -14,7 +14,7 @@ const TOOLS_TO_SCAN = [
14
14
  { name: 'shellcheck', cmd: ['shellcheck', '--version'] },
15
15
  ];
16
16
 
17
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Reason: third-party API execSync returns dynamic output - type structure unknown at call site
17
+
18
18
  function scanEnvironment(wctx: WorkspaceContext): any {
19
19
  const tools: Record<string, { available: boolean; version?: string }> = {};
20
20
 
@@ -1,3 +1,4 @@
1
+
1
2
  import * as fs from 'fs';
2
3
  import * as path from 'path';
3
4
  import type { PluginCommandContext, PluginCommandResult } from '../openclaw-sdk.js';
@@ -70,7 +70,7 @@ function _handleListActive(
70
70
  }
71
71
 
72
72
 
73
- // eslint-disable-next-line @typescript-eslint/max-params -- complexity 15, refactor candidate
73
+
74
74
  function _handleDisableImpl(
75
75
  workspaceDir: string,
76
76
  stateDir: string,
@@ -46,7 +46,7 @@ function formatRouteRecommendations(
46
46
  }
47
47
 
48
48
 
49
- // eslint-disable-next-line @typescript-eslint/max-params -- complexity 15, refactor candidate
49
+
50
50
  function buildEnglishOutput(
51
51
  workspaceDir: string,
52
52
  sessionId: string | null,
@@ -99,7 +99,7 @@ function buildEnglishOutput(
99
99
  }
100
100
 
101
101
 
102
- // eslint-disable-next-line @typescript-eslint/max-params -- complexity 15, refactor candidate
102
+
103
103
  function buildChineseOutput(
104
104
  workspaceDir: string,
105
105
  sessionId: string | null,
@@ -46,12 +46,12 @@ export function handleExportCommand(ctx: PluginCommandContext): PluginCommandRes
46
46
 
47
47
  return {
48
48
  text: zh
49
- ? `已导出 ORPO 决策点样本到 ${result.manifest!.exportPath},` + // eslint-disable-line @typescript-eslint/no-non-null-assertion -- Reason: caller guarantees manifest exists via success check
50
- `共 ${result.manifest!.sampleCount} 条,模型家族: ${result.manifest!.targetModelFamily},` + // eslint-disable-line @typescript-eslint/no-non-null-assertion -- Reason: caller guarantees manifest exists via success check
51
- `数据集指纹: ${result.manifest!.datasetFingerprint.substring(0, 16)}...` // eslint-disable-line @typescript-eslint/no-non-null-assertion -- Reason: caller guarantees manifest exists via success check
52
- : `Exported ORPO decision-point samples to ${result.manifest!.exportPath}, ` + // eslint-disable-line @typescript-eslint/no-non-null-assertion -- Reason: caller guarantees manifest exists via success check
53
- `${result.manifest!.sampleCount} samples, target: ${result.manifest!.targetModelFamily}, ` + // eslint-disable-line @typescript-eslint/no-non-null-assertion -- Reason: caller guarantees manifest exists via success check
54
- `dataset fingerprint: ${result.manifest!.datasetFingerprint.substring(0, 16)}...`, // eslint-disable-line @typescript-eslint/no-non-null-assertion -- Reason: caller guarantees manifest exists via success check
49
+ ? `已导出 ORPO 决策点样本到 ${result.manifest!.exportPath},` +
50
+ `共 ${result.manifest!.sampleCount} 条,模型家族: ${result.manifest!.targetModelFamily},` +
51
+ `数据集指纹: ${result.manifest!.datasetFingerprint.substring(0, 16)}...`
52
+ : `Exported ORPO decision-point samples to ${result.manifest!.exportPath}, ` +
53
+ `${result.manifest!.sampleCount} samples, target: ${result.manifest!.targetModelFamily}, ` +
54
+ `dataset fingerprint: ${result.manifest!.datasetFingerprint.substring(0, 16)}...`,
55
55
  };
56
56
  }
57
57
 
@@ -538,7 +538,7 @@ Next steps:
538
538
  }
539
539
  }
540
540
 
541
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Reason: JSON.parse returns dynamic JSON - type unknown at parse time, narrowed via type narrowing below
541
+
542
542
  let result: any;
543
543
  try {
544
544
  result = JSON.parse(resultJson);
@@ -1,7 +1,7 @@
1
1
  import { WorkspaceContext } from '../core/workspace-context.js';
2
2
  import type { PluginCommandContext } from '../openclaw-sdk.js';
3
3
 
4
- // eslint-disable-next-line complexity -- complexity 13, refactor candidate
4
+
5
5
  export function handlePrincipleRollbackCommand(ctx: PluginCommandContext): { text: string } {
6
6
  const workspaceDir = (ctx.config?.workspaceDir as string) || process.cwd();
7
7
  const argText = (ctx.args || '').trim();
@@ -55,7 +55,6 @@ Usage:
55
55
 
56
56
  let eventId: string | null;
57
57
 
58
- const _triggerMethod = 'user_command' as const;
59
58
 
60
59
  if (args === 'last') {
61
60
  // Find the last empathy event in current session
@@ -30,7 +30,7 @@ export function handleSamplesCommand(ctx: PluginCommandContext): PluginCommandRe
30
30
  const normalizedDecision = decision === 'approve' ? 'approved' : 'rejected';
31
31
  const note = noteParts.join(' ').trim();
32
32
 
33
- // eslint-disable-next-line @typescript-eslint/init-declarations
33
+
34
34
  let record;
35
35
  try {
36
36
  record = wctx.trajectory.reviewCorrectionSample(sampleId, normalizedDecision, note);
@@ -1,3 +1,4 @@
1
+
1
2
  import * as fs from 'fs';
2
3
  import type { PluginCommandContext, PluginCommandResult } from '../openclaw-sdk.js';
3
4
  import { WorkspaceContext } from '../core/workspace-context.js';
@@ -21,7 +21,7 @@ function formatState(state: string): string {
21
21
  }
22
22
 
23
23
 
24
- // eslint-disable-next-line @typescript-eslint/max-params
24
+
25
25
  function buildOutput(
26
26
  workflowId: string,
27
27
  summary: ReturnType<InstanceType<typeof WorkflowStore>['getWorkflow']>,
@@ -441,7 +441,7 @@ export function adjustThresholdsFromSignals(
441
441
  currentThresholds.principleAlignmentMin + adjustment,
442
442
  `High arbiter reject rate (${signals.arbiterRejectRate.toFixed(2)}) → tightening alignment threshold`
443
443
  );
444
- if (result.changed && (!bestResult.changed || ((result.newValue! - result.oldValue!) > 0))) { // eslint-disable-line @typescript-eslint/no-non-null-assertion -- Reason: changed flag guarantees newValue/oldValue are defined
444
+ if (result.changed && (!bestResult.changed || ((result.newValue! - result.oldValue!) > 0))) {
445
445
  bestResult = result;
446
446
  }
447
447
  }
@@ -455,7 +455,7 @@ export function adjustThresholdsFromSignals(
455
455
  currentThresholds.executabilityMin + adjustment,
456
456
  `High executability reject rate (${signals.executabilityRejectRate.toFixed(2)}) → tightening executability threshold`
457
457
  );
458
- if (result.changed && (!bestResult.changed || ((result.newValue! - result.oldValue!) > 0))) { // eslint-disable-line @typescript-eslint/no-non-null-assertion -- Reason: changed flag guarantees newValue/oldValue are defined
458
+ if (result.changed && (!bestResult.changed || ((result.newValue! - result.oldValue!) > 0))) {
459
459
  bestResult = result;
460
460
  }
461
461
  }
@@ -469,7 +469,7 @@ export function adjustThresholdsFromSignals(
469
469
  Math.max(currentThresholds.aggregateMin - reward, THRESHOLD_MIN),
470
470
  `Positive quality delta (${signals.qualityDelta.toFixed(2)}) → rewarding with slightly lower aggregate threshold`
471
471
  );
472
- if (result.changed && (!bestResult.changed || ((result.oldValue! - result.newValue!) > 0))) { // eslint-disable-line @typescript-eslint/no-non-null-assertion -- Reason: changed flag guarantees newValue/oldValue are defined
472
+ if (result.changed && (!bestResult.changed || ((result.oldValue! - result.newValue!) > 0))) {
473
473
  bestResult = result;
474
474
  }
475
475
  }
@@ -1,3 +1,4 @@
1
+
1
2
  import * as fs from 'fs';
2
3
  import * as path from 'path';
3
4
  import { atomicWriteFileSync } from '../utils/io.js';
@@ -265,7 +266,7 @@ export class PainConfig {
265
266
  }
266
267
  }
267
268
 
268
- /* eslint-disable @typescript-eslint/no-explicit-any */
269
+
269
270
  // Reason: deepMerge handles arbitrary nested object structures where static typing cannot precisely capture recursive object shapes
270
271
  private deepMerge(target: any, source: any): any {
271
272
  const output = { ...target };
@@ -1,3 +1,4 @@
1
+
1
2
  import * as fs from 'fs';
2
3
  import * as path from 'path';
3
4
  import { atomicWriteFileSync } from '../utils/io.js';
@@ -1,4 +1,4 @@
1
- /* eslint-disable max-lines */
1
+
2
2
  import * as fs from 'fs';
3
3
  import * as path from 'path';
4
4
  import type {
@@ -221,7 +221,7 @@ export class EventLog {
221
221
  }
222
222
  }
223
223
 
224
- /* eslint-disable complexity */
224
+
225
225
  private updateStats(entry: EventLogEntry): void {
226
226
  let stats = this.statsCache.get(entry.date);
227
227
  if (!stats) {
@@ -500,7 +500,7 @@ export class EventLog {
500
500
  /**
501
501
  * Aggregate empathy stats for a specific session.
502
502
  */
503
- /* eslint-disable complexity */
503
+
504
504
  private aggregateSessionEmpathy(sessionId: string, result: EmpathyEventStats): void {
505
505
  for (const entry of this.getMergedEvents()) {
506
506
  if (entry.sessionId === sessionId && entry.type === 'pain_signal') {
@@ -557,7 +557,7 @@ export function getEvolutionEngine(workspaceDir: string): EvolutionEngine {
557
557
  if (!_instances.has(resolved)) {
558
558
  _instances.set(resolved, new EvolutionEngine(resolved));
559
559
  }
560
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- Reason: set() above guarantees get() returns non-null
560
+
561
561
  return _instances.get(resolved)!;
562
562
  }
563
563
 
@@ -405,7 +405,7 @@ export function computeConfigFingerprint(config: Partial<TrainingHyperparameters
405
405
  */
406
406
  export function computeDatasetFingerprint(exportPath: string, sampleCount: number): string {
407
407
 
408
- // eslint-disable-next-line @typescript-eslint/init-declarations
408
+
409
409
  let contentHash: string;
410
410
  try {
411
411
  const content = fs.readFileSync(exportPath, 'utf-8');
@@ -342,7 +342,7 @@ function hasValidEvidenceSummary(parsed: unknown): boolean {
342
342
  * Validate a single replay report file and return its category.
343
343
  */
344
344
  function validateSingleReplayReport(reportPath: string): ReplayValidationCategory {
345
- // eslint-disable-next-line @typescript-eslint/init-declarations
345
+
346
346
  let rawContent: string;
347
347
  try {
348
348
  rawContent = fs.readFileSync(reportPath, 'utf-8');
@@ -350,7 +350,7 @@ function validateSingleReplayReport(reportPath: string): ReplayValidationCategor
350
350
  return 'io_error';
351
351
  }
352
352
 
353
- // eslint-disable-next-line @typescript-eslint/init-declarations
353
+
354
354
  let parsed: unknown;
355
355
  try {
356
356
  parsed = JSON.parse(rawContent);
@@ -366,7 +366,7 @@ function validateSingleReplayReport(reportPath: string): ReplayValidationCategor
366
366
  return 'missing_evidence_summary';
367
367
  }
368
368
 
369
- // eslint-disable-next-line @typescript-eslint/prefer-destructuring
369
+
370
370
  const evidenceSummary = parsed.evidenceSummary;
371
371
  if (parsed.overallDecision === 'pass' && evidenceSummary.totalSamples === 0) {
372
372
  return 'unsupported_pass';
@@ -694,7 +694,7 @@ export function parseAndValidateArtifact(
694
694
  ): ArbiterResult {
695
695
  // Step 1: Parse JSON
696
696
 
697
- // eslint-disable-next-line @typescript-eslint/init-declarations
697
+
698
698
  let parsed: unknown;
699
699
  try {
700
700
  parsed = JSON.parse(jsonString);
@@ -242,31 +242,31 @@ export function detectOpportunity(principleId: string, session: SessionEvents):
242
242
 
243
243
  switch (principleId) {
244
244
  case 'T-01':
245
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
245
+
246
246
  return detectT01Opportunity(session);
247
247
  case 'T-02':
248
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
248
+
249
249
  return detectT02Opportunity(session);
250
250
  case 'T-03':
251
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
251
+
252
252
  return detectT03Opportunity(session);
253
253
  case 'T-04':
254
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
254
+
255
255
  return detectT04Opportunity(session);
256
256
  case 'T-05':
257
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
257
+
258
258
  return detectT05Opportunity(session);
259
259
  case 'T-06':
260
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
260
+
261
261
  return detectT06Opportunity(session);
262
262
  case 'T-07':
263
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
263
+
264
264
  return detectT07Opportunity(session);
265
265
  case 'T-08':
266
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
266
+
267
267
  return detectT08Opportunity(session);
268
268
  case 'T-09':
269
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
269
+
270
270
  return detectT09Opportunity(session);
271
271
  default:
272
272
  return { applicable: false, reason: `Unknown principle: ${principleId}` };
@@ -384,7 +384,7 @@ function detectT05Opportunity(session: SessionEvents): OpportunityMatch {
384
384
  if (RISKY_TOOLS.has(call.toolName)) return true;
385
385
  // Check bash for dangerous patterns
386
386
  if (call.toolName === 'bash' && call.errorMessage) {
387
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- Reason: call.errorMessage guard above ensures truthiness
387
+
388
388
  return DANGEROUS_BASH_PATTERNS.some((p) => p.test(call.errorMessage!));
389
389
  }
390
390
  return false;
@@ -432,7 +432,7 @@ function detectT06Opportunity(session: SessionEvents): OpportunityMatch {
432
432
  function detectT07Opportunity(session: SessionEvents): OpportunityMatch {
433
433
  const filePaths = session.toolCalls
434
434
  .filter((call) => call.filePath !== undefined)
435
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- Reason: filter ensures filePath is defined
435
+
436
436
  .map((call) => normalizePathPosix(call.filePath!));
437
437
  const uniqueFiles = new Set(filePaths);
438
438
  if (uniqueFiles.size >= 3) {
@@ -478,7 +478,7 @@ function detectT09Opportunity(session: SessionEvents): OpportunityMatch {
478
478
  const uniqueFiles = new Set(
479
479
  session.toolCalls
480
480
  .filter((call) => call.filePath !== undefined)
481
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- Reason: filter ensures filePath is defined
481
+
482
482
  .map((call) => normalizePathPosix(call.filePath!))
483
483
  );
484
484
  const hasComplexity = toolCallCount >= 5 || uniqueFiles.size >= 3;
@@ -550,31 +550,31 @@ export function detectViolation(principleId: string, session: SessionEvents): Vi
550
550
 
551
551
  switch (principleId) {
552
552
  case 'T-01':
553
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
553
+
554
554
  return detectT01Violation(session);
555
555
  case 'T-02':
556
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
556
+
557
557
  return detectT02Violation(session);
558
558
  case 'T-03':
559
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
559
+
560
560
  return detectT03Violation(session);
561
561
  case 'T-04':
562
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
562
+
563
563
  return detectT04Violation(session);
564
564
  case 'T-05':
565
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
565
+
566
566
  return detectT05Violation(session);
567
567
  case 'T-06':
568
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
568
+
569
569
  return detectT06Violation(session);
570
570
  case 'T-07':
571
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
571
+
572
572
  return detectT07Violation(session);
573
573
  case 'T-08':
574
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
574
+
575
575
  return detectT08Violation(session);
576
576
  case 'T-09':
577
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
577
+
578
578
  return detectT09Violation(session);
579
579
  default:
580
580
  console.warn(`[PD:Compliance] Unknown principle ID: ${principleId} — treating as no violation. Check for typos (P-001 vs P_001).`);
@@ -592,7 +592,7 @@ function detectT01Violation(session: SessionEvents): ViolationMatch {
592
592
  const readFiles = new Set(
593
593
  session.toolCalls
594
594
  .filter((call) => READ_TOOLS.has(call.toolName) && call.filePath !== undefined)
595
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- Reason: filter ensures filePath is defined
595
+
596
596
  .map((call) => normalizePathPosix(call.filePath!))
597
597
  );
598
598
 
@@ -786,7 +786,7 @@ function detectT07Violation(session: SessionEvents): ViolationMatch {
786
786
  const modifiedFiles = new Set(
787
787
  session.toolCalls
788
788
  .filter((call) => EDIT_TOOLS.has(call.toolName) && call.filePath !== undefined)
789
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- Reason: filter ensures filePath is defined
789
+
790
790
  .map((call) => normalizePathPosix(call.filePath!))
791
791
  );
792
792
 
@@ -843,7 +843,7 @@ function detectT09Violation(session: SessionEvents): ViolationMatch {
843
843
  const uniqueFiles = new Set(
844
844
  session.toolCalls
845
845
  .filter((call) => call.filePath !== undefined)
846
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- Reason: filter ensures filePath is defined
846
+
847
847
  .map((call) => normalizePathPosix(call.filePath!))
848
848
  );
849
849
 
@@ -933,11 +933,11 @@ export function computeCompliance(
933
933
  : 0;
934
934
 
935
935
  // Compute violationTrend using windows
936
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
936
+
937
937
  const violationTrend = computeViolationTrend(applicableSessions, windowSize);
938
938
 
939
939
  // Build explanation
940
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
940
+
941
941
  const explanation = buildExplanation(
942
942
  principleId,
943
943
  applicableOpportunityCount,
@@ -1009,7 +1009,7 @@ function computeViolationTrend(
1009
1009
  * Builds a human-readable explanation for the compliance result.
1010
1010
  */
1011
1011
 
1012
- // eslint-disable-next-line @typescript-eslint/max-params
1012
+
1013
1013
  function buildExplanation(
1014
1014
  principleId: string,
1015
1015
  applicableOpportunityCount: number,
@@ -1086,7 +1086,7 @@ export function groupEventsIntoSessions(events: RawEventEntry[]): Map<string, Se
1086
1086
  });
1087
1087
  }
1088
1088
 
1089
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- Reason: set() above guarantees get() returns non-null
1089
+
1090
1090
  const session = sessionMap.get(sessionId)!;
1091
1091
 
1092
1092
  switch (event.type) {
@@ -278,7 +278,7 @@ function isTooGeneric(text: string): boolean {
278
278
  * @param artifact - The validated artifact from arbiter (passed = true)
279
279
  * @returns ExecutabilityResult
280
280
  */
281
- // eslint-disable-next-line complexity -- complexity 14, refactor candidate
281
+
282
282
  export function validateExecutability(artifact: {
283
283
  badDecision: string;
284
284
  betterDecision: string;
@@ -144,7 +144,7 @@ export function deriveReasoningChain(assistantTurns: NocturnalAssistantTurn[]):
144
144
  // Without thinking tags we cannot extract a genuine reasoning trace, so
145
145
  // we fall back to 'low' rather than misleading the downstream pipeline
146
146
  // with activation derived from non-thinking patterns in the response text.
147
- // eslint-disable-next-line @typescript-eslint/init-declarations
147
+
148
148
  let confidenceSignal: "high" | "medium" | "low";
149
149
  if (thinkingContent.length === 0) {
150
150
  confidenceSignal = 'low';
@@ -213,7 +213,7 @@ export function deriveDecisionPoints(
213
213
 
214
214
  // Binary search: find rightmost assistant turn with createdAt < tcTime
215
215
  const findBeforeTurn = (tcTime: number): NocturnalAssistantTurn | undefined => {
216
- // eslint-disable-next-line @typescript-eslint/init-declarations
216
+
217
217
  let lo = 0, hi = sortedTurns.length - 1, result: NocturnalAssistantTurn | undefined;
218
218
  while (lo <= hi) {
219
219
  const mid = (lo + hi) >>> 1;
@@ -236,9 +236,9 @@ export function deriveDecisionPoints(
236
236
  : '';
237
237
 
238
238
  // On failure, find next assistant turn after tool call
239
- // eslint-disable-next-line @typescript-eslint/init-declarations
239
+
240
240
  let afterReflection: string | undefined;
241
- // eslint-disable-next-line @typescript-eslint/init-declarations
241
+
242
242
  let confidenceDelta: number | undefined;
243
243
 
244
244
  if (tc.outcome === 'failure') {
@@ -85,7 +85,7 @@ function extractHelperUsage(sourceCode: string): string[] {
85
85
  );
86
86
  }
87
87
 
88
- // eslint-disable-next-line complexity -- complexity 11, slightly over threshold
88
+
89
89
  function validateMeta(meta: unknown): RuleImplementationValidationFailure[] {
90
90
  if (!meta || typeof meta !== 'object') {
91
91
  return [
@@ -53,7 +53,7 @@ export function validateNocturnalSnapshotIngress(
53
53
  }
54
54
  }
55
55
 
56
- // eslint-disable-next-line @typescript-eslint/prefer-destructuring
56
+
57
57
  const stats = value.stats;
58
58
  if (!isObjectRecord(stats)) {
59
59
  reasons.push('snapshot.stats must be an object');
@@ -54,7 +54,7 @@ async function safeTail(filePath: string): Promise<string[]> {
54
54
  try {
55
55
  // Check existence and stats asynchronously
56
56
 
57
- // eslint-disable-next-line @typescript-eslint/init-declarations
57
+
58
58
  let stat: fs.Stats;
59
59
  try {
60
60
  stat = await fsPromises.stat(filePath);
@@ -237,7 +237,7 @@ export async function extractRecentConversation(
237
237
  /**
238
238
  * Extracts failed tool call context with argument correlation.
239
239
  */
240
- // eslint-disable-next-line @typescript-eslint/max-params
240
+
241
241
  export async function extractFailedToolContext(
242
242
  sessionId: string,
243
243
  agentId: string,
@@ -1,3 +1,4 @@
1
+
1
2
  import * as path from 'path';
2
3
  import * as os from 'os';
3
4
  import * as fs from 'fs';
@@ -1,3 +1,4 @@
1
+
1
2
  import * as fs from 'fs';
2
3
  import * as path from 'path';
3
4
  import * as os from 'os';
@@ -4,7 +4,7 @@ import { reconcilePDTasks } from './pd-task-reconciler.js';
4
4
  export const PDTaskService: OpenClawPluginService = {
5
5
  id: 'principles-disciple-task-manager',
6
6
 
7
- // eslint-disable-next-line complexity -- complexity 14, refactor candidate
7
+
8
8
  async start(ctx: OpenClawPluginServiceContext): Promise<void> {
9
9
  const {workspaceDir} = ctx;
10
10
  if (!workspaceDir) {
@@ -1,3 +1,4 @@
1
+
1
2
  import * as fs from 'fs';
2
3
  import * as path from 'path';
3
4
  import type { PDTaskSpec } from './pd-task-types.js';
@@ -65,7 +65,7 @@ export function assessDeprecatedReadiness(
65
65
  );
66
66
 
67
67
 
68
- // eslint-disable-next-line @typescript-eslint/init-declarations
68
+
69
69
  let status: DeprecatedReadinessStatus;
70
70
  if (blockingReasons.length === 0 && stableCoverageRatio === 1) {
71
71
  status = 'ready';
@@ -38,7 +38,7 @@ export interface PrincipleLifecycleAssessment {
38
38
  routeRecommendation: InternalizationRouteRecommendation;
39
39
  }
40
40
 
41
- // eslint-disable-next-line complexity -- complexity 15, refactor candidate
41
+
42
42
  function createValueMetrics(
43
43
  principle: PrincipleLifecycleEvidence,
44
44
  adherence: PrincipleAdherenceResult,
@@ -63,7 +63,7 @@ export function createDefaultPrincipleState(principleId: string): PrincipleTrain
63
63
 
64
64
  export function loadStore(stateDir: string): PrincipleTrainingStore {
65
65
 
66
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
66
+
67
67
  return ledgerTrainingStore(stateDir);
68
68
  }
69
69
 
@@ -77,7 +77,7 @@ export function saveStore(stateDir: string, store: PrincipleTrainingStore): void
77
77
 
78
78
  export async function loadStoreAsync(stateDir: string): Promise<PrincipleTrainingStore> {
79
79
 
80
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
80
+
81
81
  return ledgerTrainingStore(stateDir);
82
82
  }
83
83
 
@@ -50,7 +50,7 @@ function trainingStateToTreePrinciple(
50
50
  text: `Principle ${principleId}`, // Minimal text, will be enriched from PRINCIPLES.md if available
51
51
  triggerPattern: '', // Unknown from legacy data
52
52
  action: '', // Unknown from legacy data
53
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
53
+
54
54
  status: mapInternalizationStatusToPrincipleStatus(state.internalizationStatus),
55
55
  priority: 'P1', // Default priority
56
56
  scope: 'general',
@@ -57,7 +57,7 @@ export const PROFILE_DEFAULTS = {
57
57
  custom_guards: [] as { pattern: string; message: string; severity: string }[],
58
58
  };
59
59
 
60
- /* eslint-disable @typescript-eslint/no-explicit-any */
60
+
61
61
  // Reason: normalizeProfile handles arbitrary JSON profile shapes where static typing cannot capture runtime field existence
62
62
  export function normalizeProfile(rawProfile: any): any {
63
63
  const defaults = JSON.parse(JSON.stringify(PROFILE_DEFAULTS));