@principles/core 1.217.0 → 1.219.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 (93) hide show
  1. package/dist/runtime-v2/__tests__/architecture-regression.test.js +14 -2
  2. package/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
  3. package/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.js +28 -0
  4. package/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.js.map +1 -1
  5. package/dist/runtime-v2/__tests__/pain-to-principle-service.test.js +1 -0
  6. package/dist/runtime-v2/__tests__/pain-to-principle-service.test.js.map +1 -1
  7. package/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.js +240 -1
  8. package/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.js.map +1 -1
  9. package/dist/runtime-v2/activation/writers/rule-host-writer.d.ts.map +1 -1
  10. package/dist/runtime-v2/activation/writers/rule-host-writer.js +78 -1
  11. package/dist/runtime-v2/activation/writers/rule-host-writer.js.map +1 -1
  12. package/dist/runtime-v2/config/__tests__/internal-agent-names.test.d.ts +2 -0
  13. package/dist/runtime-v2/config/__tests__/internal-agent-names.test.d.ts.map +1 -0
  14. package/dist/runtime-v2/config/__tests__/internal-agent-names.test.js +15 -0
  15. package/dist/runtime-v2/config/__tests__/internal-agent-names.test.js.map +1 -0
  16. package/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.js +7 -0
  17. package/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.js.map +1 -1
  18. package/dist/runtime-v2/config/__tests__/pd-config-contract.test.js +1 -0
  19. package/dist/runtime-v2/config/__tests__/pd-config-contract.test.js.map +1 -1
  20. package/dist/runtime-v2/config/__tests__/pd-config-redaction-deep.test.js +1 -0
  21. package/dist/runtime-v2/config/__tests__/pd-config-redaction-deep.test.js.map +1 -1
  22. package/dist/runtime-v2/config/__tests__/pd-config-validation-edge-cases.test.js +1 -0
  23. package/dist/runtime-v2/config/__tests__/pd-config-validation-edge-cases.test.js.map +1 -1
  24. package/dist/runtime-v2/config/pd-config-defaults.d.ts.map +1 -1
  25. package/dist/runtime-v2/config/pd-config-defaults.js +1 -0
  26. package/dist/runtime-v2/config/pd-config-defaults.js.map +1 -1
  27. package/dist/runtime-v2/config/pd-config-types.d.ts +1 -1
  28. package/dist/runtime-v2/config/pd-config-types.d.ts.map +1 -1
  29. package/dist/runtime-v2/config/pd-config-types.js +1 -0
  30. package/dist/runtime-v2/config/pd-config-types.js.map +1 -1
  31. package/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
  32. package/dist/runtime-v2/feature-flags/feature-flag-contract.js +1 -0
  33. package/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
  34. package/dist/runtime-v2/index.d.ts +2 -0
  35. package/dist/runtime-v2/index.d.ts.map +1 -1
  36. package/dist/runtime-v2/index.js +2 -0
  37. package/dist/runtime-v2/index.js.map +1 -1
  38. package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder-v2.test.js +25 -0
  39. package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder-v2.test.js.map +1 -1
  40. package/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.js +139 -0
  41. package/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.js.map +1 -1
  42. package/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js +1 -0
  43. package/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js.map +1 -1
  44. package/dist/runtime-v2/internalization/artificer-output.d.ts +7 -0
  45. package/dist/runtime-v2/internalization/artificer-output.d.ts.map +1 -1
  46. package/dist/runtime-v2/internalization/artificer-output.js +22 -1
  47. package/dist/runtime-v2/internalization/artificer-output.js.map +1 -1
  48. package/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts.map +1 -1
  49. package/dist/runtime-v2/internalization/artificer-prompt-builder.js +2 -0
  50. package/dist/runtime-v2/internalization/artificer-prompt-builder.js.map +1 -1
  51. package/dist/runtime-v2/internalization/artificer-runner.d.ts.map +1 -1
  52. package/dist/runtime-v2/internalization/artificer-runner.js +13 -0
  53. package/dist/runtime-v2/internalization/artificer-runner.js.map +1 -1
  54. package/dist/runtime-v2/internalization/evaluator-runner.d.ts.map +1 -1
  55. package/dist/runtime-v2/internalization/evaluator-runner.js +7 -1
  56. package/dist/runtime-v2/internalization/evaluator-runner.js.map +1 -1
  57. package/dist/runtime-v2/signal-collector/__tests__/keyword-stage.test.d.ts +2 -0
  58. package/dist/runtime-v2/signal-collector/__tests__/keyword-stage.test.d.ts.map +1 -0
  59. package/dist/runtime-v2/signal-collector/__tests__/keyword-stage.test.js +39 -0
  60. package/dist/runtime-v2/signal-collector/__tests__/keyword-stage.test.js.map +1 -0
  61. package/dist/runtime-v2/signal-collector/__tests__/llm-stage.test.d.ts +2 -0
  62. package/dist/runtime-v2/signal-collector/__tests__/llm-stage.test.d.ts.map +1 -0
  63. package/dist/runtime-v2/signal-collector/__tests__/llm-stage.test.js +34 -0
  64. package/dist/runtime-v2/signal-collector/__tests__/llm-stage.test.js.map +1 -0
  65. package/dist/runtime-v2/signal-collector/__tests__/signal-collector.test.d.ts +2 -0
  66. package/dist/runtime-v2/signal-collector/__tests__/signal-collector.test.d.ts.map +1 -0
  67. package/dist/runtime-v2/signal-collector/__tests__/signal-collector.test.js +71 -0
  68. package/dist/runtime-v2/signal-collector/__tests__/signal-collector.test.js.map +1 -0
  69. package/dist/runtime-v2/signal-collector/__tests__/types.test.d.ts +2 -0
  70. package/dist/runtime-v2/signal-collector/__tests__/types.test.d.ts.map +1 -0
  71. package/dist/runtime-v2/signal-collector/__tests__/types.test.js +35 -0
  72. package/dist/runtime-v2/signal-collector/__tests__/types.test.js.map +1 -0
  73. package/dist/runtime-v2/signal-collector/index.d.ts +5 -0
  74. package/dist/runtime-v2/signal-collector/index.d.ts.map +1 -0
  75. package/dist/runtime-v2/signal-collector/index.js +5 -0
  76. package/dist/runtime-v2/signal-collector/index.js.map +1 -0
  77. package/dist/runtime-v2/signal-collector/keyword-stage.d.ts +20 -0
  78. package/dist/runtime-v2/signal-collector/keyword-stage.d.ts.map +1 -0
  79. package/dist/runtime-v2/signal-collector/keyword-stage.js +61 -0
  80. package/dist/runtime-v2/signal-collector/keyword-stage.js.map +1 -0
  81. package/dist/runtime-v2/signal-collector/llm-stage.d.ts +16 -0
  82. package/dist/runtime-v2/signal-collector/llm-stage.d.ts.map +1 -0
  83. package/dist/runtime-v2/signal-collector/llm-stage.js +34 -0
  84. package/dist/runtime-v2/signal-collector/llm-stage.js.map +1 -0
  85. package/dist/runtime-v2/signal-collector/signal-collector.d.ts +16 -0
  86. package/dist/runtime-v2/signal-collector/signal-collector.d.ts.map +1 -0
  87. package/dist/runtime-v2/signal-collector/signal-collector.js +71 -0
  88. package/dist/runtime-v2/signal-collector/signal-collector.js.map +1 -0
  89. package/dist/runtime-v2/signal-collector/types.d.ts +61 -0
  90. package/dist/runtime-v2/signal-collector/types.d.ts.map +1 -0
  91. package/dist/runtime-v2/signal-collector/types.js +45 -0
  92. package/dist/runtime-v2/signal-collector/types.js.map +1 -0
  93. package/package.json +1 -1
@@ -0,0 +1,71 @@
1
+ import { scanKeywords } from './keyword-stage.js';
2
+ const MAX_EXCERPT = 200;
3
+ export function buildEvidence(text, detectedAt) {
4
+ const excerpt = text.length > MAX_EXCERPT ? text.slice(0, MAX_EXCERPT) : text;
5
+ return { excerpt, detectedAt };
6
+ }
7
+ /**
8
+ * 同步阶段(prompt hook 内调用,绝不阻塞):Stage1 关键词快扫。
9
+ * - high 精度命中 → 直接返回 final output(needsLlmConfirmation=false)
10
+ * - ambiguous / 未命中 → 返回 pending output(needsLlmConfirmation 取决于 enableLlmStage)
11
+ * 由 plugin 层异步调 mapLlmResultToOutput 完成 Stage2。
12
+ *
13
+ * 注意:这个函数不调 LLM。LLM 在 plugin 层。
14
+ */
15
+ // eslint-disable-next-line @typescript-eslint/max-params -- positional API for plugin-layer call sites (text, sessionId, store, config)
16
+ export function collectSync(text, sessionId, store, config, detectedAt) {
17
+ void sessionId;
18
+ const scan = scanKeywords(text, store);
19
+ const evidence = buildEvidence(text, detectedAt);
20
+ if (scan.matched && scan.matchedPrecision === 'high' && scan.suggestedType) {
21
+ return {
22
+ isSignal: true,
23
+ type: scan.suggestedType,
24
+ strength: scan.suggestedType === 'correction' ? 'STRONG' : 'WEAK',
25
+ matchedTerms: scan.matchedTerms,
26
+ matchedPrecision: 'high',
27
+ detectionSource: 'keyword',
28
+ needsLlmConfirmation: false,
29
+ evidence,
30
+ };
31
+ }
32
+ // CodeRabbit #12: LLM 阶段关闭时,needsLlmConfirmation 应为 false(不会发生二阶段确认)
33
+ return {
34
+ isSignal: false,
35
+ type: null,
36
+ strength: null,
37
+ matchedTerms: scan.matchedTerms,
38
+ matchedPrecision: scan.matchedPrecision,
39
+ detectionSource: 'none',
40
+ needsLlmConfirmation: config.enableLlmStage,
41
+ evidence,
42
+ };
43
+ }
44
+ /**
45
+ * Stage2(异步,plugin 层拿到 LLM 结果后调用):把 LLM 分类映射成 final output。
46
+ */
47
+ // eslint-disable-next-line @typescript-eslint/max-params -- positional API: (llm, text, sessionId, config)
48
+ export function mapLlmResultToOutput(llm, text, _sessionId, _config, detectedAt) {
49
+ void _sessionId;
50
+ void _config;
51
+ const evidence = buildEvidence(text, detectedAt);
52
+ if (!llm.is_feedback || llm.type === 'none') {
53
+ return {
54
+ isSignal: false, type: null, strength: null, matchedTerms: [],
55
+ matchedPrecision: null, detectionSource: 'llm', needsLlmConfirmation: false,
56
+ llmReason: llm.reason, evidence,
57
+ };
58
+ }
59
+ return {
60
+ isSignal: true,
61
+ type: llm.type,
62
+ strength: llm.type === 'correction' ? 'STRONG' : 'WEAK',
63
+ matchedTerms: [],
64
+ matchedPrecision: null,
65
+ detectionSource: 'llm',
66
+ needsLlmConfirmation: false,
67
+ llmReason: llm.reason,
68
+ evidence,
69
+ };
70
+ }
71
+ //# sourceMappingURL=signal-collector.js.map
@@ -0,0 +1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word {
4
+ term: string;
5
+ category: KeywordCategory;
6
+ weight: number;
7
+ precision: 'high' | 'ambiguous';
8
+ source: TermSource;
9
+ }
10
+ export interface UnifiedKeywordStore {
11
+ version: number;
12
+ terms: Record<string, UnifiedKeyword>;
13
+ }
14
+ export interface PendingTerm {
15
+ term: string;
16
+ suggestedCategory: KeywordCategory;
17
+ suggestedPrecision: 'high' | 'ambiguous';
18
+ reason: string;
19
+ discoveredAt: string;
20
+ source: 'llm_candidate';
21
+ }
22
+ export interface PendingTermStore {
23
+ version: number;
24
+ terms: PendingTerm[];
25
+ }
26
+ export interface SignalCollectorConfig {
27
+ enableLlmStage: boolean;
28
+ llmTimeoutMs: number;
29
+ promptTemplate: string;
30
+ strongPainScore: number;
31
+ strongRateLimitPerHour: number;
32
+ }
33
+ export type SignalStrength = 'STRONG' | 'WEAK';
34
+ export type DetectionSource = 'keyword' | 'llm' | 'none';
35
+ export type MatchedPrecision = 'high' | 'ambiguous' | null;
36
+ export interface SignalEvidence {
37
+ excerpt: string;
38
+ detectedAt: string;
39
+ }
40
+ export interface SignalCollectorOutput {
41
+ isSignal: boolean;
42
+ type: 'correction' | 'empathy' | null;
43
+ strength: SignalStrength | null;
44
+ matchedTerms: string[];
45
+ matchedPrecision: MatchedPrecision;
46
+ detectionSource: DetectionSource;
47
+ needsLlmConfirmation: boolean;
48
+ llmReason?: string;
49
+ evidence: SignalEvidence;
50
+ }
51
+ export declare const SignalCollectorOutputSchema: {
52
+ validate(value: unknown): value is SignalCollectorOutput;
53
+ };
54
+ export interface LlmClassificationResult {
55
+ is_feedback: boolean;
56
+ type: 'correction' | 'empathy' | 'none';
57
+ confidence: number;
58
+ reason: string;
59
+ }
60
+ export declare function validateLlmClassification(value: unknown): value is LlmClassificationResult;
61
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/signal-collector/types.ts"],"names":[],"mappings":"AAEA,MAAM,MA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qBAAqB;IACpC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI,CAAC;IACtC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;IAChC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,eAAe,EAAE,eAAe,CAAC;IACjC,oBAAoB,EAAE,OAAO,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,cAAc,CAAC;CAC1B;AAID,eAAO,MAAM,2BAA2B;oBACtB,OAAO,GAAG,KAAK,IAAI,qBAAqB;CAgBzD,CAAC;AAIF,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,YAAY,GAAG,SAAS,GAAG,MAAM,CAAC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,uBAAuB,CAQ1F"}
@@ -0,0 +1,45 @@
1
+ // ── Unified Keyword Store (合并后的统一词库,纯数据) ──
2
+ // ── TypeBox Schema (用于校验, ERR-001 防御) ──
3
+ export const SignalCollectorOutputSchema = {
4
+ validate(value) {
5
+ if (typeof value !== 'object' || value === null)
6
+ return false;
7
+ const v = value;
8
+ if (typeof v.isSignal !== 'boolean')
9
+ return false;
10
+ if (v.type !== null && v.type !== 'correction' && v.type !== 'empathy')
11
+ return false;
12
+ if (v.strength !== null && v.strength !== 'STRONG' && v.strength !== 'WEAK')
13
+ return false;
14
+ if (!Array.isArray(v.matchedTerms))
15
+ return false;
16
+ if (v.matchedPrecision !== null && v.matchedPrecision !== 'high' && v.matchedPrecision !== 'ambiguous')
17
+ return false;
18
+ if (v.detectionSource !== 'keyword' && v.detectionSource !== 'llm' && v.detectionSource !== 'none')
19
+ return false;
20
+ if (typeof v.needsLlmConfirmation !== 'boolean')
21
+ return false;
22
+ const ev = v.evidence;
23
+ if (typeof ev !== 'object' || ev === null)
24
+ return false;
25
+ const e = ev;
26
+ if (typeof e.excerpt !== 'string' || typeof e.detectedAt !== 'string')
27
+ return false;
28
+ return true;
29
+ },
30
+ };
31
+ export function validateLlmClassification(value) {
32
+ if (typeof value !== 'object' || value === null)
33
+ return false;
34
+ const v = value;
35
+ if (typeof v.is_feedback !== 'boolean')
36
+ return false;
37
+ if (v.type !== 'correction' && v.type !== 'empathy' && v.type !== 'none')
38
+ return false;
39
+ if (typeof v.confidence !== 'number' || v.confidence < 0 || v.confidence > 1)
40
+ return false;
41
+ if (typeof v.reason !== 'string')
42
+ return false;
43
+ return true;
44
+ }
45
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runtime-v2/signal-collector/types.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAiE7C,0CAA0C;AAE1C,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,QAAQ,CAAC,KAAc;QACrB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QAC9D,MAAM,CAAC,GAAG,KAAgC,CAAC;QAC3C,IAAI,OAAO,CAAC,CAAC,QAAQ,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QAClD,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,YAAY,IAAI,CAAC,CAAC,IAAI,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QACrF,IAAI,CAAC,CAAC,QAAQ,KAAK,IAAI,IAAI,CAAC,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,CAAC,QAAQ,KAAK,MAAM;YAAE,OAAO,KAAK,CAAC;QAC1F,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC;YAAE,OAAO,KAA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AI,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC/C,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principles/core",
3
- "version": "1.217.0",
3
+ "version": "1.219.0",
4
4
  "description": "Universal Evolution SDK - framework-agnostic pain signal capture and principle injection",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",