create-principles-disciple 1.93.0 → 1.94.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/console/dist/server/config/pd-config-store.d.ts +7 -1
- package/console/dist/server/config/pd-config-store.js +11 -1
- package/console/dist/server/index.js +10 -6
- package/console/dist/server/models/ApprovalsConsoleModel.js +4 -12
- package/console/dist/server/routes/feedback-reports.js +1 -1
- package/core/dist/index.d.ts +2 -2
- package/core/dist/index.d.ts.map +1 -1
- package/core/dist/index.js +1 -1
- package/core/dist/index.js.map +1 -1
- package/core/dist/prompt-builder/__tests__/model-config.test.d.ts +2 -0
- package/core/dist/prompt-builder/__tests__/model-config.test.d.ts.map +1 -0
- package/core/dist/prompt-builder/__tests__/model-config.test.js +158 -0
- package/core/dist/prompt-builder/__tests__/model-config.test.js.map +1 -0
- package/core/dist/prompt-builder/__tests__/xml-escape.test.d.ts +2 -0
- package/core/dist/prompt-builder/__tests__/xml-escape.test.d.ts.map +1 -0
- package/core/dist/prompt-builder/__tests__/xml-escape.test.js +42 -0
- package/core/dist/prompt-builder/__tests__/xml-escape.test.js.map +1 -0
- package/core/dist/prompt-builder/index.d.ts +3 -0
- package/core/dist/prompt-builder/index.d.ts.map +1 -1
- package/core/dist/prompt-builder/index.js +2 -0
- package/core/dist/prompt-builder/index.js.map +1 -1
- package/core/dist/prompt-builder/model-config.d.ts +42 -0
- package/core/dist/prompt-builder/model-config.d.ts.map +1 -0
- package/core/dist/prompt-builder/model-config.js +84 -0
- package/core/dist/prompt-builder/model-config.js.map +1 -0
- package/core/dist/prompt-builder/xml-escape.d.ts +12 -0
- package/core/dist/prompt-builder/xml-escape.d.ts.map +1 -0
- package/core/dist/prompt-builder/xml-escape.js +19 -0
- package/core/dist/prompt-builder/xml-escape.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/architecture-regression.test.js +87 -16
- package/core/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.js +395 -0
- package/core/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.js.map +1 -0
- package/core/dist/runtime-v2/bridge-result-shaper.d.ts +53 -0
- package/core/dist/runtime-v2/bridge-result-shaper.d.ts.map +1 -0
- package/core/dist/runtime-v2/bridge-result-shaper.js +117 -0
- package/core/dist/runtime-v2/bridge-result-shaper.js.map +1 -0
- package/core/dist/runtime-v2/detection/__tests__/detection-funnel-policy.test.d.ts +13 -0
- package/core/dist/runtime-v2/detection/__tests__/detection-funnel-policy.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/detection/__tests__/detection-funnel-policy.test.js +111 -0
- package/core/dist/runtime-v2/detection/__tests__/detection-funnel-policy.test.js.map +1 -0
- package/core/dist/runtime-v2/detection/detection-funnel-policy.d.ts +103 -0
- package/core/dist/runtime-v2/detection/detection-funnel-policy.d.ts.map +1 -0
- package/core/dist/runtime-v2/detection/detection-funnel-policy.js +135 -0
- package/core/dist/runtime-v2/detection/detection-funnel-policy.js.map +1 -0
- package/core/dist/runtime-v2/detection/index.d.ts +10 -0
- package/core/dist/runtime-v2/detection/index.d.ts.map +1 -0
- package/core/dist/runtime-v2/detection/index.js +9 -0
- package/core/dist/runtime-v2/detection/index.js.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.d.ts +12 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.js +181 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.js.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.js +104 -1
- package/core/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.js.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/index.d.ts +3 -0
- package/core/dist/runtime-v2/evidence-triage/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/index.js +3 -0
- package/core/dist/runtime-v2/evidence-triage/index.js.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/observation-resolver.d.ts +128 -0
- package/core/dist/runtime-v2/evidence-triage/observation-resolver.d.ts.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/observation-resolver.js +203 -0
- package/core/dist/runtime-v2/evidence-triage/observation-resolver.js.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/triage-policy.d.ts +4 -0
- package/core/dist/runtime-v2/evidence-triage/triage-policy.d.ts.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/triage-policy.js +66 -9
- package/core/dist/runtime-v2/evidence-triage/triage-policy.js.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/types.d.ts +14 -0
- package/core/dist/runtime-v2/evidence-triage/types.d.ts.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/types.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js +33 -4
- package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js +9 -2
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
- package/core/dist/runtime-v2/feedback/__tests__/redact-sensitive.test.d.ts +15 -0
- package/core/dist/runtime-v2/feedback/__tests__/redact-sensitive.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/feedback/__tests__/redact-sensitive.test.js +450 -0
- package/core/dist/runtime-v2/feedback/__tests__/redact-sensitive.test.js.map +1 -0
- package/core/dist/runtime-v2/feedback/__tests__/render-github-url.test.d.ts +13 -0
- package/core/dist/runtime-v2/feedback/__tests__/render-github-url.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/feedback/__tests__/render-github-url.test.js +243 -0
- package/core/dist/runtime-v2/feedback/__tests__/render-github-url.test.js.map +1 -0
- package/core/dist/runtime-v2/feedback/__tests__/safe-stringify.test.d.ts +12 -0
- package/core/dist/runtime-v2/feedback/__tests__/safe-stringify.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/feedback/__tests__/safe-stringify.test.js +172 -0
- package/core/dist/runtime-v2/feedback/__tests__/safe-stringify.test.js.map +1 -0
- package/core/dist/runtime-v2/index.d.ts +8 -4
- package/core/dist/runtime-v2/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/index.js +4 -2
- package/core/dist/runtime-v2/index.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/c2-live-runner-chain.test.d.ts +2 -0
- package/core/dist/runtime-v2/internalization/__tests__/c2-live-runner-chain.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/c2-live-runner-chain.test.js +306 -0
- package/core/dist/runtime-v2/internalization/__tests__/c2-live-runner-chain.test.js.map +1 -0
- package/core/dist/runtime-v2/internalization/index.d.ts +0 -16
- package/core/dist/runtime-v2/internalization/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/index.js +0 -8
- package/core/dist/runtime-v2/internalization/index.js.map +1 -1
- package/core/dist/runtime-v2/pain-gate/__tests__/pain-diagnostic-gate-policy.test.d.ts +15 -0
- package/core/dist/runtime-v2/pain-gate/__tests__/pain-diagnostic-gate-policy.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/pain-gate/__tests__/pain-diagnostic-gate-policy.test.js +179 -0
- package/core/dist/runtime-v2/pain-gate/__tests__/pain-diagnostic-gate-policy.test.js.map +1 -0
- package/core/dist/runtime-v2/pain-gate/index.d.ts +10 -0
- package/core/dist/runtime-v2/pain-gate/index.d.ts.map +1 -0
- package/core/dist/runtime-v2/pain-gate/index.js +9 -0
- package/core/dist/runtime-v2/pain-gate/index.js.map +1 -0
- package/core/dist/runtime-v2/pain-gate/pain-diagnostic-gate-policy.d.ts +121 -0
- package/core/dist/runtime-v2/pain-gate/pain-diagnostic-gate-policy.d.ts.map +1 -0
- package/core/dist/runtime-v2/pain-gate/pain-diagnostic-gate-policy.js +157 -0
- package/core/dist/runtime-v2/pain-gate/pain-diagnostic-gate-policy.js.map +1 -0
- package/core/dist/runtime-v2/pain-signal-bridge.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-signal-bridge.js +14 -88
- package/core/dist/runtime-v2/pain-signal-bridge.js.map +1 -1
- package/core/dist/runtime-v2/pain-signal-observability.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-signal-observability.js +15 -5
- package/core/dist/runtime-v2/pain-signal-observability.js.map +1 -1
- package/core/dist/runtime-v2/types/event-types.d.ts +0 -27
- package/core/dist/runtime-v2/types/event-types.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/event-types.js +2 -17
- package/core/dist/runtime-v2/types/event-types.js.map +1 -1
- package/core/dist/runtime-v2/types/index.d.ts +2 -2
- package/core/dist/runtime-v2/types/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/index.js +3 -1
- package/core/dist/runtime-v2/types/index.js.map +1 -1
- package/core/dist/runtime-v2/types/pain-signal.d.ts +2 -2
- package/core/dist/runtime-v2/types/pain-signal.js +2 -2
- package/dist/mvp-config.d.ts +0 -10
- package/dist/mvp-config.d.ts.map +1 -1
- package/dist/mvp-config.js +0 -65
- package/dist/mvp-config.js.map +1 -1
- package/package.json +1 -1
- package/pd-cli/dist/commands/mvp-smoke.js +1 -1
- package/pd-cli/dist/commands/mvp-smoke.js.map +1 -1
- package/pd-cli/dist/commands/rulecode.js +1 -1
- package/pd-cli/dist/commands/rulecode.js.map +1 -1
- package/pd-cli/dist/commands/runtime-canary.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-canary.js +10 -11
- package/pd-cli/dist/commands/runtime-canary.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-queue.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-queue.js +13 -16
- package/pd-cli/dist/commands/runtime-internalization-queue.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.js +3 -0
- package/pd-cli/dist/commands/runtime-internalization-run-once.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.js +61 -7
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.js.map +1 -1
- package/pd-cli/dist/commands/runtime.js +1 -1
- package/pd-cli/dist/commands/runtime.js.map +1 -1
- package/pd-cli/dist/index.js +67 -34
- package/pd-cli/dist/index.js.map +1 -1
- package/pd-cli/dist/services/__tests__/rulehost-readiness.test.d.ts +2 -0
- package/pd-cli/dist/services/__tests__/rulehost-readiness.test.d.ts.map +1 -0
- package/pd-cli/dist/services/__tests__/rulehost-readiness.test.js +314 -0
- package/pd-cli/dist/services/__tests__/rulehost-readiness.test.js.map +1 -0
- package/pd-cli/dist/services/__tests__/runtime-adapter-resolver.test.js +20 -12
- package/pd-cli/dist/services/__tests__/runtime-adapter-resolver.test.js.map +1 -1
- package/pd-cli/dist/services/rulehost-readiness.d.ts +62 -0
- package/pd-cli/dist/services/rulehost-readiness.d.ts.map +1 -0
- package/pd-cli/dist/services/rulehost-readiness.js +214 -0
- package/pd-cli/dist/services/rulehost-readiness.js.map +1 -0
- package/pd-cli/dist/services/runtime-adapter-resolver.d.ts +1 -1
- package/pd-cli/dist/services/runtime-adapter-resolver.js +3 -3
- package/pd-cli/dist/services/runtime-adapter-resolver.js.map +1 -1
- package/plugin/dist/commands/evolution-status.js +0 -2
- package/plugin/dist/core/detection-funnel.d.ts +25 -11
- package/plugin/dist/core/detection-funnel.js +32 -80
- package/plugin/dist/core/event-log.d.ts +1 -3
- package/plugin/dist/core/event-log.js +10 -21
- package/plugin/dist/core/evolution-reducer.d.ts +0 -8
- package/plugin/dist/core/evolution-reducer.js +9 -19
- package/plugin/dist/core/pain-diagnostic-gate.d.ts +37 -28
- package/plugin/dist/core/pain-diagnostic-gate.js +53 -89
- package/plugin/dist/core/pain.d.ts +0 -63
- package/plugin/dist/core/pain.js +0 -167
- package/plugin/dist/core/paths.d.ts +0 -1
- package/plugin/dist/core/paths.js +2 -1
- package/plugin/dist/core/schema/migrations/001-init-trajectory.js +3 -6
- package/plugin/dist/core/schema/schema-definitions.js +4 -9
- package/plugin/dist/core/trajectory.d.ts +0 -16
- package/plugin/dist/core/trajectory.js +9 -60
- package/plugin/dist/hooks/after-tool-call-helpers.d.ts +4 -1
- package/plugin/dist/hooks/after-tool-call-helpers.js +13 -17
- package/plugin/dist/hooks/gate-block-helper.js +57 -17
- package/plugin/dist/hooks/lifecycle.js +3 -6
- package/plugin/dist/hooks/llm.js +66 -26
- package/plugin/dist/hooks/pain.d.ts +3 -1
- package/plugin/dist/hooks/pain.js +119 -49
- package/plugin/dist/hooks/prompt-helpers.d.ts +87 -0
- package/plugin/dist/hooks/prompt-helpers.js +251 -0
- package/plugin/dist/hooks/prompt-types.d.ts +66 -0
- package/plugin/dist/hooks/prompt-types.js +12 -0
- package/plugin/dist/hooks/prompt.d.ts +7 -38
- package/plugin/dist/hooks/prompt.js +361 -325
- package/plugin/dist/hooks/raw-observation-adapter.d.ts +9 -50
- package/plugin/dist/hooks/raw-observation-adapter.js +9 -164
- package/plugin/dist/hooks/raw-observation-types.d.ts +6 -57
- package/plugin/dist/hooks/raw-observation-types.js +5 -9
- package/plugin/dist/hooks/triage-adapter.js +6 -26
- package/plugin/dist/hooks/trigger-cooldown-tracker.d.ts +12 -0
- package/plugin/dist/hooks/trigger-cooldown-tracker.js +25 -0
- package/plugin/dist/service/evolution-worker.js +6 -64
- package/plugin/dist/service/runtime-summary-service.d.ts +0 -2
- package/plugin/dist/service/runtime-summary-service.js +0 -4
- package/plugin/dist/types/event-types.d.ts +1 -1
- package/plugin/scripts/sync-plugin.mjs +33 -22
- package/plugin/scripts/validate-live-path.ts +0 -18
- package/plugin/templates/langs/en/skills/pd-cli-operator/SKILL.md +20 -11
- package/plugin/templates/langs/en/skills/pd-runtime-v2/SKILL.md +10 -0
- package/plugin/templates/langs/zh/skills/pd-cli-operator/SKILL.md +20 -11
- package/plugin/templates/langs/zh/skills/pd-runtime-v2/SKILL.md +10 -0
- package/console/dist/server/config/feature-flags.d.ts +0 -25
- package/console/dist/server/config/feature-flags.js +0 -101
- package/pd-cli/dist/commands/central-sync.d.ts +0 -10
- package/pd-cli/dist/commands/central-sync.d.ts.map +0 -1
- package/pd-cli/dist/commands/central-sync.js +0 -32
- package/pd-cli/dist/commands/central-sync.js.map +0 -1
- package/pd-cli/dist/services/feature-flag-loader.d.ts +0 -6
- package/pd-cli/dist/services/feature-flag-loader.d.ts.map +0 -1
- package/pd-cli/dist/services/feature-flag-loader.js +0 -53
- package/pd-cli/dist/services/feature-flag-loader.js.map +0 -1
- package/plugin/dist/core/observability.d.ts +0 -40
- package/plugin/dist/core/observability.js +0 -164
- package/plugin/dist/hooks/subagent.d.ts +0 -9
- package/plugin/dist/hooks/subagent.js +0 -122
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escape special XML characters in a string.
|
|
3
|
+
*
|
|
4
|
+
* Pure logic — no I/O, no side effects.
|
|
5
|
+
*
|
|
6
|
+
* Used by prompt injection to safely embed user/principle text into XML-style
|
|
7
|
+
* prompt markers (e.g. `<directive id="...">...</directive>`). Also accepted
|
|
8
|
+
* as a callback by `trimToBudget` and `renderPrinciplesToDirectives` in
|
|
9
|
+
* `runtime-v2/activation/prompt-activation-reader-contract.ts`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function escapeXml(input: string): string;
|
|
12
|
+
//# sourceMappingURL=xml-escape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-escape.d.ts","sourceRoot":"","sources":["../../src/prompt-builder/xml-escape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO/C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escape special XML characters in a string.
|
|
3
|
+
*
|
|
4
|
+
* Pure logic — no I/O, no side effects.
|
|
5
|
+
*
|
|
6
|
+
* Used by prompt injection to safely embed user/principle text into XML-style
|
|
7
|
+
* prompt markers (e.g. `<directive id="...">...</directive>`). Also accepted
|
|
8
|
+
* as a callback by `trimToBudget` and `renderPrinciplesToDirectives` in
|
|
9
|
+
* `runtime-v2/activation/prompt-activation-reader-contract.ts`.
|
|
10
|
+
*/
|
|
11
|
+
export function escapeXml(input) {
|
|
12
|
+
return input
|
|
13
|
+
.replace(/&/g, '&')
|
|
14
|
+
.replace(/</g, '<')
|
|
15
|
+
.replace(/>/g, '>')
|
|
16
|
+
.replace(/"/g, '"')
|
|
17
|
+
.replace(/'/g, ''');
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=xml-escape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-escape.js","sourceRoot":"","sources":["../../src/prompt-builder/xml-escape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,KAAK;SACT,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -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');
|
|
@@ -1598,6 +1637,16 @@ describe('PRI-75/PRI-74/PRI-81 prompt-builder core boundary', () => {
|
|
|
1598
1637
|
// Must NOT have the old multi-line fallback block with attitudeDirective interpolation
|
|
1599
1638
|
expect(src).not.toMatch(/## 【CONTEXT SECTIONS】\n\n\[WARNING: Context sections stripped/);
|
|
1600
1639
|
});
|
|
1640
|
+
it('plugin prompt-helpers.ts imports escapeXml from core, not reimplemented', async () => {
|
|
1641
|
+
const { readFileSync } = await import('node:fs');
|
|
1642
|
+
const { resolve } = await import('node:path');
|
|
1643
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/hooks/prompt-helpers.ts'), 'utf-8');
|
|
1644
|
+
// Must import escapeXml from core
|
|
1645
|
+
expect(src).toContain('@principles/core/prompt-builder');
|
|
1646
|
+
expect(src).toMatch(/import\s*\{[^}]*escapeXml[^}]*\}\s*from\s*['"]@principles\/core\/prompt-builder['"]/);
|
|
1647
|
+
// Must NOT reimplement escapeXml inline
|
|
1648
|
+
expect(src).not.toMatch(/\b(function\s+escapeXml\s*\(|const\s+escapeXml\s*=\s*(?:async\s*)?(?:\([^)]*\)|[a-zA-Z_$][\w$]*)\s*=>)/);
|
|
1649
|
+
});
|
|
1601
1650
|
it('plugin empathy-keyword-matcher.ts is a thin adapter (re-exports from core)', async () => {
|
|
1602
1651
|
const { readFileSync } = await import('node:fs');
|
|
1603
1652
|
const { resolve } = await import('node:path');
|
|
@@ -1755,6 +1804,19 @@ describe('PRI-111 ArtificerRunner boundary', () => {
|
|
|
1755
1804
|
expect(src).toContain('ArtificerRuleOutputSchema');
|
|
1756
1805
|
});
|
|
1757
1806
|
});
|
|
1807
|
+
// ── PRI-458: PhilosopherRunner barrel boundary (MVP-Quiet) ─────────────────────
|
|
1808
|
+
describe('PRI-458 PhilosopherRunner barrel boundary', () => {
|
|
1809
|
+
it('BARREL_EXPORTS: internalization/index.ts does NOT export PhilosopherRunner (PRI-458 MVP-Quiet)', async () => {
|
|
1810
|
+
// PRI-458: PhilosopherRunner is de-surfaced from the internal barrel (MVP-Quiet).
|
|
1811
|
+
// It remains in runtime-v2/index.ts (public barrel) because rulehost-pipeline-runner.ts
|
|
1812
|
+
// imports it from there (EP-02 exception).
|
|
1813
|
+
const { readFileSync } = await import('node:fs');
|
|
1814
|
+
const { resolve } = await import('node:path');
|
|
1815
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'index.ts'), 'utf-8');
|
|
1816
|
+
expect(src).not.toContain("from './philosopher-runner.js'");
|
|
1817
|
+
expect(src).not.toContain("from './philosopher-output.js'");
|
|
1818
|
+
});
|
|
1819
|
+
});
|
|
1758
1820
|
// ── PRI-EVAL: EvaluatorRunner boundary guards ──────────────────────────────────
|
|
1759
1821
|
describe('PRI-EVAL EvaluatorRunner boundary', () => {
|
|
1760
1822
|
it('evaluator source files exist in internalization directory', async () => {
|
|
@@ -1795,13 +1857,17 @@ describe('PRI-EVAL EvaluatorRunner boundary', () => {
|
|
|
1795
1857
|
expect(src).not.toContain('node:fs');
|
|
1796
1858
|
expect(src).not.toContain('node:cron');
|
|
1797
1859
|
});
|
|
1798
|
-
it('BARREL_EXPORTS: internalization/index.ts
|
|
1860
|
+
it('BARREL_EXPORTS: internalization/index.ts does NOT export EvaluatorRunner (PRI-458 MVP-Quiet)', async () => {
|
|
1861
|
+
// PRI-458: EvaluatorRunner is de-surfaced from the internal barrel (MVP-Quiet).
|
|
1862
|
+
// It remains in runtime-v2/index.ts (public barrel) because rulehost-pipeline-runner.ts
|
|
1863
|
+
// imports it from there (EP-02 exception). These negative assertions lock the boundary:
|
|
1864
|
+
// if someone re-aggregates the evaluator exports into this barrel, the test will fail.
|
|
1799
1865
|
const { readFileSync } = await import('node:fs');
|
|
1800
1866
|
const { resolve } = await import('node:path');
|
|
1801
1867
|
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'index.ts'), 'utf-8');
|
|
1802
|
-
expect(src).toContain('
|
|
1803
|
-
expect(src).toContain('
|
|
1804
|
-
expect(src).toContain('
|
|
1868
|
+
expect(src).not.toContain("from './evaluator-runner.js'");
|
|
1869
|
+
expect(src).not.toContain("from './evaluator-output.js'");
|
|
1870
|
+
expect(src).not.toContain("from './evaluator-prompt-builder.js'");
|
|
1805
1871
|
});
|
|
1806
1872
|
it('SCHEMA_REGISTRY: pi-ai-runtime-adapter.ts registers evaluator-output-v1 schema', async () => {
|
|
1807
1873
|
const { readFileSync } = await import('node:fs');
|
|
@@ -1851,13 +1917,16 @@ describe('PRI-RR RolloutReviewerRunner boundary', () => {
|
|
|
1851
1917
|
expect(src).not.toContain('node:fs');
|
|
1852
1918
|
expect(src).not.toContain('node:cron');
|
|
1853
1919
|
});
|
|
1854
|
-
it('BARREL_EXPORTS: internalization/index.ts
|
|
1920
|
+
it('BARREL_EXPORTS: internalization/index.ts does NOT export RolloutReviewerRunner (PRI-458 MVP-Quiet)', async () => {
|
|
1921
|
+
// PRI-458: RolloutReviewerRunner is de-surfaced from the internal barrel (MVP-Quiet).
|
|
1922
|
+
// It remains in runtime-v2/index.ts (public barrel) because runtime-internalization-run-once.ts
|
|
1923
|
+
// imports it from there and package.json has no deep import path available (EP-02 exception).
|
|
1855
1924
|
const { readFileSync } = await import('node:fs');
|
|
1856
1925
|
const { resolve } = await import('node:path');
|
|
1857
1926
|
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'index.ts'), 'utf-8');
|
|
1858
|
-
expect(src).toContain('
|
|
1859
|
-
expect(src).toContain('
|
|
1860
|
-
expect(src).toContain('
|
|
1927
|
+
expect(src).not.toContain("from './rollout-reviewer-runner.js'");
|
|
1928
|
+
expect(src).not.toContain("from './rollout-reviewer-output.js'");
|
|
1929
|
+
expect(src).not.toContain("from './rollout-reviewer-prompt-builder.js'");
|
|
1861
1930
|
});
|
|
1862
1931
|
it('SCHEMA_REGISTRY: pi-ai-runtime-adapter.ts registers rollout-reviewer-output-v1 schema', async () => {
|
|
1863
1932
|
const { readFileSync } = await import('node:fs');
|
|
@@ -2127,12 +2196,14 @@ describe('PRI-117 Nocturnal god-class freeze', () => {
|
|
|
2127
2196
|
expect(src).not.toContain('invokeStubScribe');
|
|
2128
2197
|
}
|
|
2129
2198
|
});
|
|
2130
|
-
it('RUNTIME_V2_USES_PEER_RUNNERS: DreamerRunner/
|
|
2199
|
+
it('RUNTIME_V2_USES_PEER_RUNNERS: DreamerRunner/ScribeRunner/ArtificerRunner are the canonical MVP-Core entry points', async () => {
|
|
2200
|
+
// PRI-458: narrowed to MVP-Core runners only. PhilosopherRunner (MVP-Quiet)
|
|
2201
|
+
// remains in runtime-v2/index.ts for rulehost-pipeline-runner.ts compatibility
|
|
2202
|
+
// but is no longer asserted as a canonical entry point.
|
|
2131
2203
|
const { readFileSync } = await import('node:fs');
|
|
2132
2204
|
const { resolve } = await import('node:path');
|
|
2133
2205
|
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2134
2206
|
expect(src).toContain('DreamerRunner');
|
|
2135
|
-
expect(src).toContain('PhilosopherRunner');
|
|
2136
2207
|
expect(src).toContain('ScribeRunner');
|
|
2137
2208
|
expect(src).toContain('ArtificerRunner');
|
|
2138
2209
|
});
|
|
@@ -2878,7 +2949,7 @@ describe('PRI-225: No unsafe type assertions on untrusted metadata arrays', () =
|
|
|
2878
2949
|
// ── PRI-239: Feature flag registry architecture boundary ──────────────────
|
|
2879
2950
|
//
|
|
2880
2951
|
// Core: packages/principles-core/src/runtime-v2/feature-flags/feature-flag-contract.ts
|
|
2881
|
-
// I/O Loader: packages/pd-cli/src/services/feature-flag-loader.ts
|
|
2952
|
+
// I/O Loader: packages/pd-cli/src/services/pd-config-loader.ts (PRI-460: replaced feature-flag-loader.ts)
|
|
2882
2953
|
// CLI Command: packages/pd-cli/src/commands/runtime-features.ts
|
|
2883
2954
|
// Consumption: packages/pd-cli/src/commands/runtime-canary.ts (GFI check)
|
|
2884
2955
|
describe('PRI-239: Feature flag registry architecture boundary', () => {
|
|
@@ -2900,10 +2971,10 @@ describe('PRI-239: Feature flag registry architecture boundary', () => {
|
|
|
2900
2971
|
expect(src).not.toContain('InternalizationOrchestrator');
|
|
2901
2972
|
expect(src).not.toContain('SqliteConnection');
|
|
2902
2973
|
});
|
|
2903
|
-
it('IO_LOADER_OUTSIDE_CORE: I/O loader exists at pd-cli/src/services/
|
|
2974
|
+
it('IO_LOADER_OUTSIDE_CORE: I/O loader exists at pd-cli/src/services/pd-config-loader.ts', async () => {
|
|
2904
2975
|
const { existsSync } = await import('node:fs');
|
|
2905
2976
|
const { resolve } = await import('node:path');
|
|
2906
|
-
expect(existsSync(resolve(__dirname, '../../../../pd-cli/src/services/
|
|
2977
|
+
expect(existsSync(resolve(__dirname, '../../../../pd-cli/src/services/pd-config-loader.ts'))).toBe(true);
|
|
2907
2978
|
});
|
|
2908
2979
|
it('CLI_COMMAND_OUTSIDE_CORE: CLI command exists at pd-cli/src/commands/runtime-features.ts', async () => {
|
|
2909
2980
|
const { existsSync } = await import('node:fs');
|
|
@@ -2918,12 +2989,12 @@ describe('PRI-239: Feature flag registry architecture boundary', () => {
|
|
|
2918
2989
|
expect(src).not.toContain('nocturnal-arbiter');
|
|
2919
2990
|
expect(src).not.toContain('nocturnal-service');
|
|
2920
2991
|
});
|
|
2921
|
-
it('CONSUMPTION_WIRED: runtime-canary.ts imports
|
|
2992
|
+
it('CONSUMPTION_WIRED: runtime-canary.ts imports canonical PD config loader', async () => {
|
|
2922
2993
|
const { readFileSync } = await import('node:fs');
|
|
2923
2994
|
const { resolve } = await import('node:path');
|
|
2924
2995
|
const src = readFileSync(resolve(__dirname, '../../../../pd-cli/src/commands/runtime-canary.ts'), 'utf-8');
|
|
2925
|
-
expect(src).toContain('
|
|
2926
|
-
expect(src).toContain('
|
|
2996
|
+
expect(src).toContain('pd-config-loader');
|
|
2997
|
+
expect(src).toContain('loadPdConfig');
|
|
2927
2998
|
});
|
|
2928
2999
|
});
|
|
2929
3000
|
describe('PRI-304: PD-Owned Config Contract barrel exports and purity', () => {
|