create-principles-disciple 1.126.1 → 1.127.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 (108) hide show
  1. package/console/dist/server/config/pd-config-store.d.ts +6 -0
  2. package/console/dist/server/config/pd-config-store.js +37 -4
  3. package/console/dist/server/routes/config.js +1 -0
  4. package/console/dist/ui/utils/agent-metadata.js +6 -2
  5. package/console/dist/web/assets/app.js +7 -3
  6. package/core/dist/runtime-v2/__tests__/pain-ingress-persistence.test.d.ts +2 -0
  7. package/core/dist/runtime-v2/__tests__/pain-ingress-persistence.test.d.ts.map +1 -0
  8. package/core/dist/runtime-v2/__tests__/pain-ingress-persistence.test.js +276 -0
  9. package/core/dist/runtime-v2/__tests__/pain-ingress-persistence.test.js.map +1 -0
  10. package/core/dist/runtime-v2/__tests__/pain-ingress-shared-semantics.test.d.ts +2 -0
  11. package/core/dist/runtime-v2/__tests__/pain-ingress-shared-semantics.test.d.ts.map +1 -0
  12. package/core/dist/runtime-v2/__tests__/pain-ingress-shared-semantics.test.js +131 -0
  13. package/core/dist/runtime-v2/__tests__/pain-ingress-shared-semantics.test.js.map +1 -0
  14. package/core/dist/runtime-v2/__tests__/pain-outcome-convergence.test.d.ts +2 -0
  15. package/core/dist/runtime-v2/__tests__/pain-outcome-convergence.test.d.ts.map +1 -0
  16. package/core/dist/runtime-v2/__tests__/pain-outcome-convergence.test.js +126 -0
  17. package/core/dist/runtime-v2/__tests__/pain-outcome-convergence.test.js.map +1 -0
  18. package/core/dist/runtime-v2/__tests__/pain-signal-bridge-execute-pending.test.js +95 -0
  19. package/core/dist/runtime-v2/__tests__/pain-signal-bridge-execute-pending.test.js.map +1 -1
  20. package/core/dist/runtime-v2/__tests__/pain-signal-runtime-factory-edge-cases.test.js +4 -1
  21. package/core/dist/runtime-v2/__tests__/pain-signal-runtime-factory-edge-cases.test.js.map +1 -1
  22. package/core/dist/runtime-v2/__tests__/pri638-diagnostician-capability-characterization.test.d.ts +27 -0
  23. package/core/dist/runtime-v2/__tests__/pri638-diagnostician-capability-characterization.test.d.ts.map +1 -0
  24. package/core/dist/runtime-v2/__tests__/pri638-diagnostician-capability-characterization.test.js +449 -0
  25. package/core/dist/runtime-v2/__tests__/pri638-diagnostician-capability-characterization.test.js.map +1 -0
  26. package/core/dist/runtime-v2/__tests__/pri638-p1d-error-classification.test.d.ts +2 -0
  27. package/core/dist/runtime-v2/__tests__/pri638-p1d-error-classification.test.d.ts.map +1 -0
  28. package/core/dist/runtime-v2/__tests__/pri638-p1d-error-classification.test.js +116 -0
  29. package/core/dist/runtime-v2/__tests__/pri638-p1d-error-classification.test.js.map +1 -0
  30. package/core/dist/runtime-v2/config/__tests__/pd-config-pri638-cutover.test.d.ts +2 -0
  31. package/core/dist/runtime-v2/config/__tests__/pd-config-pri638-cutover.test.d.ts.map +1 -0
  32. package/core/dist/runtime-v2/config/__tests__/pd-config-pri638-cutover.test.js +99 -0
  33. package/core/dist/runtime-v2/config/__tests__/pd-config-pri638-cutover.test.js.map +1 -0
  34. package/core/dist/runtime-v2/config/pd-config-effective.d.ts.map +1 -1
  35. package/core/dist/runtime-v2/config/pd-config-effective.js +34 -0
  36. package/core/dist/runtime-v2/config/pd-config-effective.js.map +1 -1
  37. package/core/dist/runtime-v2/diagnostician-capability.d.ts +47 -0
  38. package/core/dist/runtime-v2/diagnostician-capability.d.ts.map +1 -0
  39. package/core/dist/runtime-v2/diagnostician-capability.js +53 -0
  40. package/core/dist/runtime-v2/diagnostician-capability.js.map +1 -0
  41. package/core/dist/runtime-v2/index.d.ts +10 -1
  42. package/core/dist/runtime-v2/index.d.ts.map +1 -1
  43. package/core/dist/runtime-v2/index.js +8 -0
  44. package/core/dist/runtime-v2/index.js.map +1 -1
  45. package/core/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js +18 -5
  46. package/core/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js.map +1 -1
  47. package/core/dist/runtime-v2/pain-ingress-payload.d.ts +207 -0
  48. package/core/dist/runtime-v2/pain-ingress-payload.d.ts.map +1 -0
  49. package/core/dist/runtime-v2/pain-ingress-payload.js +340 -0
  50. package/core/dist/runtime-v2/pain-ingress-payload.js.map +1 -0
  51. package/core/dist/runtime-v2/pain-ingress.d.ts +61 -0
  52. package/core/dist/runtime-v2/pain-ingress.d.ts.map +1 -0
  53. package/core/dist/runtime-v2/pain-ingress.js +163 -0
  54. package/core/dist/runtime-v2/pain-ingress.js.map +1 -0
  55. package/core/dist/runtime-v2/pain-signal-bridge.d.ts +64 -1
  56. package/core/dist/runtime-v2/pain-signal-bridge.d.ts.map +1 -1
  57. package/core/dist/runtime-v2/pain-signal-bridge.js +230 -8
  58. package/core/dist/runtime-v2/pain-signal-bridge.js.map +1 -1
  59. package/core/dist/runtime-v2/pain-signal-runtime-factory.d.ts +32 -12
  60. package/core/dist/runtime-v2/pain-signal-runtime-factory.d.ts.map +1 -1
  61. package/core/dist/runtime-v2/pain-signal-runtime-factory.js +113 -46
  62. package/core/dist/runtime-v2/pain-signal-runtime-factory.js.map +1 -1
  63. package/core/dist/runtime-v2/pain-to-principle-service.d.ts +15 -2
  64. package/core/dist/runtime-v2/pain-to-principle-service.d.ts.map +1 -1
  65. package/core/dist/runtime-v2/pain-to-principle-service.js +28 -0
  66. package/core/dist/runtime-v2/pain-to-principle-service.js.map +1 -1
  67. package/core/dist/runtime-v2/runner/runner-result.d.ts +6 -0
  68. package/core/dist/runtime-v2/runner/runner-result.d.ts.map +1 -1
  69. package/host-runtime/dist/index.d.ts +1 -0
  70. package/host-runtime/dist/index.js +3 -0
  71. package/host-runtime/dist/internalization-consumer-cycle.js +14 -0
  72. package/host-runtime/dist/pain-evidence-ingress.d.ts +16 -0
  73. package/host-runtime/dist/pain-evidence-ingress.js +15 -0
  74. package/package.json +2 -2
  75. package/pd-cli/dist/commands/build-trajectory-evidence.d.ts +25 -6
  76. package/pd-cli/dist/commands/build-trajectory-evidence.d.ts.map +1 -1
  77. package/pd-cli/dist/commands/build-trajectory-evidence.js +174 -114
  78. package/pd-cli/dist/commands/build-trajectory-evidence.js.map +1 -1
  79. package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
  80. package/pd-cli/dist/commands/diagnose.js +48 -27
  81. package/pd-cli/dist/commands/diagnose.js.map +1 -1
  82. package/pd-cli/dist/commands/pain-record.d.ts.map +1 -1
  83. package/pd-cli/dist/commands/pain-record.js +212 -17
  84. package/pd-cli/dist/commands/pain-record.js.map +1 -1
  85. package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
  86. package/pd-cli/dist/commands/pain-retry.js +43 -26
  87. package/pd-cli/dist/commands/pain-retry.js.map +1 -1
  88. package/pd-cli/dist/index.js +1 -1
  89. package/pd-cli/dist/index.js.map +1 -1
  90. package/plugin/dist/bundle.js +458 -456
  91. package/plugin/dist/governance-audit.js +155 -155
  92. package/plugin/dist/hooks/pain-ingress-adapter.d.ts +19 -0
  93. package/plugin/dist/hooks/trajectory-evidence.d.ts +32 -1
  94. package/plugin/dist/rulehost-evidence.js +164 -164
  95. package/plugin/dist/templates/langs/en/skills/pd-cli-operator/SKILL.md +11 -4
  96. package/plugin/dist/templates/langs/en/skills/pd-pain-signal/SKILL.md +36 -4
  97. package/plugin/dist/templates/langs/en/skills/pd-runtime-v2/SKILL.md +4 -1
  98. package/plugin/dist/templates/langs/zh/skills/pd-cli-operator/SKILL.md +9 -4
  99. package/plugin/dist/templates/langs/zh/skills/pd-pain-signal/SKILL.md +32 -4
  100. package/plugin/dist/templates/langs/zh/skills/pd-runtime-v2/SKILL.md +3 -1
  101. package/plugin/openclaw.plugin.json +1 -1
  102. package/plugin/package.json +1 -1
  103. package/plugin/templates/langs/en/skills/pd-cli-operator/SKILL.md +11 -4
  104. package/plugin/templates/langs/en/skills/pd-pain-signal/SKILL.md +36 -4
  105. package/plugin/templates/langs/en/skills/pd-runtime-v2/SKILL.md +4 -1
  106. package/plugin/templates/langs/zh/skills/pd-cli-operator/SKILL.md +9 -4
  107. package/plugin/templates/langs/zh/skills/pd-pain-signal/SKILL.md +32 -4
  108. package/plugin/templates/langs/zh/skills/pd-runtime-v2/SKILL.md +3 -1
@@ -43,6 +43,12 @@ export interface AgentBindingUpdateResultOk {
43
43
  agent: InternalAgentName;
44
44
  runtimeProfile: string;
45
45
  enabled: boolean;
46
+ /**
47
+ * PRI-638 (reviewer P1): set when the write retired a conflicting legacy
48
+ * `diagnostician_split_pipeline=false` override so the canonical toggle is
49
+ * authoritative after reload.
50
+ */
51
+ warning?: string;
46
52
  }
47
53
  export interface AgentBindingUpdateResultErr {
48
54
  ok: false;
@@ -298,19 +298,30 @@ export function updateAgentBinding(workspaceDir, agentName, payload) {
298
298
  else {
299
299
  rawConfig = {};
300
300
  }
301
+ // PRI-638 (reviewer P1 #2): rebuild only what the Owner explicitly changed.
302
+ // Untouched agents keep their RAW binding from the config file verbatim.
303
+ // Defaults / inheritance resolution / compatibility transforms (e.g. the
304
+ // legacy split=false shim folding effective diagnostician to false) belong
305
+ // to the resolver — materializing them back into config would turn the
306
+ // documented read-time cutover into an implicit persistent migration.
307
+ const rawInternalAgents = isRecord(rawConfig.internalAgents) ? rawConfig.internalAgents : {};
308
+ const rawAgents = isRecord(rawInternalAgents.agents) ? rawInternalAgents.agents : {};
301
309
  // Update only the agent binding section
302
310
  const agentsMap = {};
303
311
  for (const name of INTERNAL_AGENT_NAMES) {
304
- const existing = effective.config.internalAgents.agents[name];
305
312
  if (name === agentName) {
306
313
  agentsMap[name] = { enabled, runtimeProfile };
314
+ continue;
307
315
  }
308
- else if (existing) {
316
+ const rawEntry = rawAgents[name];
317
+ if (isRecord(rawEntry) && typeof rawEntry.enabled === 'boolean') {
309
318
  agentsMap[name] = {
310
- enabled: existing.enabled,
311
- ...(existing.runtimeProfile ? { runtimeProfile: existing.runtimeProfile } : {}),
319
+ enabled: rawEntry.enabled,
320
+ ...(typeof rawEntry.runtimeProfile === 'string' ? { runtimeProfile: rawEntry.runtimeProfile } : {}),
312
321
  };
313
322
  }
323
+ // Agent absent from raw config → keep it absent (defaults belong to the
324
+ // resolver, never snapshot into config).
314
325
  }
315
326
  // Merge: start from raw config, overlay known sections, update internalAgents.agents.
316
327
  // PRI-637: preserve the file's own `features:` section instead of re-writing
@@ -328,6 +339,22 @@ export function updateAgentBinding(workspaceDir, agentName, payload) {
328
339
  },
329
340
  ui: { ...effective.config.ui },
330
341
  };
342
+ // PRI-638 (reviewer P1 #1): an explicit Owner write to the canonical
343
+ // Diagnostician binding supersedes the legacy compatibility override. While
344
+ // `diagnostician_split_pipeline=false` remains in the raw features section,
345
+ // the read-time shim folds the effective binding back to disabled — a
346
+ // Console ON toggle would otherwise return success while a reload silently
347
+ // disables the agent again. Retire the conflicting legacy override in the
348
+ // SAME atomic write; no new authority, DB or migration subsystem is added.
349
+ let retiredLegacySplit = false;
350
+ if (agentName === 'diagnostician') {
351
+ const features = isRecord(updatedConfig.features) ? updatedConfig.features : {};
352
+ const legacySplit = isRecord(features) ? features.diagnostician_split_pipeline : undefined;
353
+ if (isRecord(legacySplit) && legacySplit.enabled === false) {
354
+ delete features.diagnostician_split_pipeline;
355
+ retiredLegacySplit = true;
356
+ }
357
+ }
331
358
  // 7. Validate the updated config before writing
332
359
  const validation = validatePdConfig(updatedConfig);
333
360
  if (!validation.ok) {
@@ -345,6 +372,12 @@ export function updateAgentBinding(workspaceDir, agentName, payload) {
345
372
  agent: agentName,
346
373
  runtimeProfile,
347
374
  enabled,
375
+ ...(retiredLegacySplit
376
+ ? {
377
+ warning: 'Retired the conflicting legacy diagnostician_split_pipeline=false override so the canonical ' +
378
+ 'Diagnostician toggle is authoritative after reload.',
379
+ }
380
+ : {}),
348
381
  };
349
382
  }
350
383
  export function updateDefaultRuntime(workspaceDir, payload) {
@@ -141,6 +141,7 @@ export async function handleConfigRoute(req, res, ctx) {
141
141
  agent: result.agent,
142
142
  runtimeProfile: result.runtimeProfile,
143
143
  enabled: result.enabled,
144
+ ...(result.warning !== undefined ? { warning: result.warning } : {}),
144
145
  });
145
146
  return;
146
147
  }
@@ -81,13 +81,17 @@ export const AGENT_METADATA = {
81
81
  techDetailZh: {
82
82
  '输入': '`DiagnosticianContextPayload`(pain 信号上下文)',
83
83
  '输出': '`DiagnosticianOutputV1` · rootCause / violatedPrinciples / recommendations[] / confidence',
84
- '编排': '由 `PainSignalBridge` 触发;`diagnostician_split_pipeline` flag 控制单体 vs 3 段拆分',
84
+ // PRI-638: the split flag no longer selects an implementation nor
85
+ // disables anything — the capability switch is the agent binding here.
86
+ '编排': '由 `PainSignalBridge` 触发;开关 = 本页面的代理启用开关(`internalAgents.agents.diagnostician.enabled`)',
85
87
  '阶段': '`diag_rootcause` → `diag_distiller` → `diag_router`',
86
88
  },
87
89
  techDetailEn: {
88
90
  'Input': '`DiagnosticianContextPayload` (pain signal context)',
89
91
  'Output': '`DiagnosticianOutputV1` · rootCause / violatedPrinciples / recommendations[] / confidence',
90
- 'Orchestration': 'Triggered by `PainSignalBridge`; `diagnostician_split_pipeline` flag controls monolithic vs 3-stage split',
92
+ // PRI-638: the split flag no longer selects an implementation nor
93
+ // disables anything — the capability switch is the agent binding here.
94
+ 'Orchestration': 'Triggered by `PainSignalBridge`; switch = this agent\'s enable toggle (`internalAgents.agents.diagnostician.enabled`)',
91
95
  'Stages': '`diag_rootcause` → `diag_distiller` → `diag_router`',
92
96
  },
93
97
  isCore: true,