@principles/core 1.174.0 → 1.176.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 (60) hide show
  1. package/dist/runtime-v2/__tests__/architecture-regression.test.js +39 -0
  2. package/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
  3. package/dist/runtime-v2/detection/__tests__/detection-funnel-policy.test.d.ts +13 -0
  4. package/dist/runtime-v2/detection/__tests__/detection-funnel-policy.test.d.ts.map +1 -0
  5. package/dist/runtime-v2/detection/__tests__/detection-funnel-policy.test.js +111 -0
  6. package/dist/runtime-v2/detection/__tests__/detection-funnel-policy.test.js.map +1 -0
  7. package/dist/runtime-v2/detection/detection-funnel-policy.d.ts +103 -0
  8. package/dist/runtime-v2/detection/detection-funnel-policy.d.ts.map +1 -0
  9. package/dist/runtime-v2/detection/detection-funnel-policy.js +135 -0
  10. package/dist/runtime-v2/detection/detection-funnel-policy.js.map +1 -0
  11. package/dist/runtime-v2/detection/index.d.ts +10 -0
  12. package/dist/runtime-v2/detection/index.d.ts.map +1 -0
  13. package/dist/runtime-v2/detection/index.js +9 -0
  14. package/dist/runtime-v2/detection/index.js.map +1 -0
  15. package/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.d.ts +12 -0
  16. package/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.d.ts.map +1 -0
  17. package/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.js +137 -0
  18. package/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.js.map +1 -0
  19. package/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.js +104 -1
  20. package/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.js.map +1 -1
  21. package/dist/runtime-v2/evidence-triage/index.d.ts +3 -0
  22. package/dist/runtime-v2/evidence-triage/index.d.ts.map +1 -1
  23. package/dist/runtime-v2/evidence-triage/index.js +3 -0
  24. package/dist/runtime-v2/evidence-triage/index.js.map +1 -1
  25. package/dist/runtime-v2/evidence-triage/observation-resolver.d.ts +107 -0
  26. package/dist/runtime-v2/evidence-triage/observation-resolver.d.ts.map +1 -0
  27. package/dist/runtime-v2/evidence-triage/observation-resolver.js +175 -0
  28. package/dist/runtime-v2/evidence-triage/observation-resolver.js.map +1 -0
  29. package/dist/runtime-v2/evidence-triage/triage-policy.d.ts +4 -0
  30. package/dist/runtime-v2/evidence-triage/triage-policy.d.ts.map +1 -1
  31. package/dist/runtime-v2/evidence-triage/triage-policy.js +66 -9
  32. package/dist/runtime-v2/evidence-triage/triage-policy.js.map +1 -1
  33. package/dist/runtime-v2/evidence-triage/types.d.ts +14 -0
  34. package/dist/runtime-v2/evidence-triage/types.d.ts.map +1 -1
  35. package/dist/runtime-v2/evidence-triage/types.js.map +1 -1
  36. package/dist/runtime-v2/index.d.ts +8 -4
  37. package/dist/runtime-v2/index.d.ts.map +1 -1
  38. package/dist/runtime-v2/index.js +4 -2
  39. package/dist/runtime-v2/index.js.map +1 -1
  40. package/dist/runtime-v2/pain-gate/__tests__/pain-diagnostic-gate-policy.test.d.ts +15 -0
  41. package/dist/runtime-v2/pain-gate/__tests__/pain-diagnostic-gate-policy.test.d.ts.map +1 -0
  42. package/dist/runtime-v2/pain-gate/__tests__/pain-diagnostic-gate-policy.test.js +179 -0
  43. package/dist/runtime-v2/pain-gate/__tests__/pain-diagnostic-gate-policy.test.js.map +1 -0
  44. package/dist/runtime-v2/pain-gate/index.d.ts +10 -0
  45. package/dist/runtime-v2/pain-gate/index.d.ts.map +1 -0
  46. package/dist/runtime-v2/pain-gate/index.js +9 -0
  47. package/dist/runtime-v2/pain-gate/index.js.map +1 -0
  48. package/dist/runtime-v2/pain-gate/pain-diagnostic-gate-policy.d.ts +110 -0
  49. package/dist/runtime-v2/pain-gate/pain-diagnostic-gate-policy.d.ts.map +1 -0
  50. package/dist/runtime-v2/pain-gate/pain-diagnostic-gate-policy.js +146 -0
  51. package/dist/runtime-v2/pain-gate/pain-diagnostic-gate-policy.js.map +1 -0
  52. package/dist/runtime-v2/types/event-types.d.ts +0 -27
  53. package/dist/runtime-v2/types/event-types.d.ts.map +1 -1
  54. package/dist/runtime-v2/types/event-types.js +2 -17
  55. package/dist/runtime-v2/types/event-types.js.map +1 -1
  56. package/dist/runtime-v2/types/index.d.ts +2 -2
  57. package/dist/runtime-v2/types/index.d.ts.map +1 -1
  58. package/dist/runtime-v2/types/index.js +3 -1
  59. package/dist/runtime-v2/types/index.js.map +1 -1
  60. package/package.json +1 -1
@@ -195,6 +195,12 @@ const REQUIRED_SOURCE_FILES = [
195
195
  'activation/approval-completion-service.ts',
196
196
  // PRI-431: L2 principle reader (pure logic, extracted from pd-cli + plugin duplicates)
197
197
  'build-l2-principle-reader.ts',
198
+ // PRI-446: pure logic migrated from openclaw-plugin into core
199
+ 'evidence-triage/observation-resolver.ts',
200
+ 'pain-gate/pain-diagnostic-gate-policy.ts',
201
+ 'pain-gate/index.ts',
202
+ 'detection/detection-funnel-policy.ts',
203
+ 'detection/index.ts',
198
204
  ];
199
205
  // ── PRI-212: Plugin core anti-growth guard ────────────────────────────────────
200
206
  //
@@ -247,6 +253,9 @@ const KNOWN_PLUGIN_CORE_FILES = new Set([
247
253
  'schema/migration-runner.ts',
248
254
  'rule-host.ts',
249
255
  'principle-training-state.ts',
256
+ // PRI-446: now a thin adapter delegating pure decision logic to
257
+ // runtime-v2/pain-gate/pain-diagnostic-gate-policy.ts. Kept here because it
258
+ // owns the cooldown Map + SystemLogger + Date.now side effects.
250
259
  'pain-diagnostic-gate.ts',
251
260
  'hygiene/tracker.ts',
252
261
  'schema/migrations/002-init-central.ts',
@@ -289,6 +298,9 @@ const KNOWN_PLUGIN_CORE_FILES = new Set([
289
298
  'dictionary.ts',
290
299
  'thinking-os-parser.ts',
291
300
  'system-logger.ts',
301
+ // PRI-446: now a thin shell wiring DetectionFunnelCore (core runtime-v2/detection)
302
+ // with crypto.createHash + PainDictionary. Kept here because it owns the
303
+ // crypto + dictionary I/O boundary.
292
304
  'detection-funnel.ts',
293
305
  'risk-calculator.ts',
294
306
  'migration.ts',
@@ -361,6 +373,9 @@ describe('PRI-212 plugin core anti-growth guard', () => {
361
373
  // model-training-registry.ts, model-deployment-registry.ts,
362
374
  // shadow-observation-registry.ts (98 → 93)
363
375
  // PRI-449: Removed external-training-contract.ts (93 → 92)
376
+ // PRI-446: pain-diagnostic-gate.ts and detection-funnel.ts remain at 92 —
377
+ // they are now thin adapters delegating pure logic to core, but still live
378
+ // in plugin src/core/ and own I/O side effects, so they stay classified.
364
379
  expect(KNOWN_PLUGIN_CORE_FILES.size).toBe(92);
365
380
  });
366
381
  });
@@ -597,6 +612,30 @@ describe('PRI-42 internalization boundary', () => {
597
612
  expect(src).not.toContain('../../../openclaw-plugin');
598
613
  }
599
614
  });
615
+ it('PRI-446: pain-gate has zero openclaw-plugin imports', async () => {
616
+ const { existsSync, readdirSync, readFileSync } = await import('node:fs');
617
+ const { resolve, join } = await import('node:path');
618
+ const dir = resolve(__dirname, '..', 'pain-gate');
619
+ expect(existsSync(dir)).toBe(true);
620
+ const files = readdirSync(dir).filter((f) => f.endsWith('.ts') && !f.endsWith('.test.ts'));
621
+ for (const file of files) {
622
+ const src = readFileSync(join(dir, file), 'utf-8');
623
+ expect(src).not.toContain('openclaw-plugin');
624
+ expect(src).not.toContain('../../../openclaw-plugin');
625
+ }
626
+ });
627
+ it('PRI-446: detection has zero openclaw-plugin imports', async () => {
628
+ const { existsSync, readdirSync, readFileSync } = await import('node:fs');
629
+ const { resolve, join } = await import('node:path');
630
+ const dir = resolve(__dirname, '..', 'detection');
631
+ expect(existsSync(dir)).toBe(true);
632
+ const files = readdirSync(dir).filter((f) => f.endsWith('.ts') && !f.endsWith('.test.ts'));
633
+ for (const file of files) {
634
+ const src = readFileSync(join(dir, file), 'utf-8');
635
+ expect(src).not.toContain('openclaw-plugin');
636
+ expect(src).not.toContain('../../../openclaw-plugin');
637
+ }
638
+ });
600
639
  it('plugin does not re-define RuleHost contract types locally', async () => {
601
640
  const { existsSync, readFileSync } = await import('node:fs');
602
641
  const { resolve } = await import('node:path');