@principles/pd-cli 1.152.6 → 1.152.8
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/dist/commands/__tests__/runtime-probe-config.test.js +2 -1
- package/dist/commands/__tests__/runtime-probe-config.test.js.map +1 -1
- package/dist/commands/__tests__/version.test.js +104 -0
- package/dist/commands/__tests__/version.test.js.map +1 -1
- package/dist/commands/diagnose.d.ts.map +1 -1
- package/dist/commands/diagnose.js +3 -6
- package/dist/commands/diagnose.js.map +1 -1
- package/dist/commands/pain-retry.d.ts.map +1 -1
- package/dist/commands/pain-retry.js +3 -6
- package/dist/commands/pain-retry.js.map +1 -1
- package/dist/commands/runtime-activation.d.ts.map +1 -1
- package/dist/commands/runtime-activation.js +9 -3
- package/dist/commands/runtime-activation.js.map +1 -1
- package/dist/commands/runtime-init.d.ts.map +1 -1
- package/dist/commands/runtime-init.js +4 -6
- package/dist/commands/runtime-init.js.map +1 -1
- package/dist/commands/runtime-internalization-run-once.d.ts.map +1 -1
- package/dist/commands/runtime-internalization-run-once.js +5 -11
- package/dist/commands/runtime-internalization-run-once.js.map +1 -1
- package/dist/commands/runtime-internalization-run-rulehost.d.ts +14 -0
- package/dist/commands/runtime-internalization-run-rulehost.d.ts.map +1 -1
- package/dist/commands/runtime-internalization-run-rulehost.js +67 -15
- package/dist/commands/runtime-internalization-run-rulehost.js.map +1 -1
- package/dist/index.js +0 -12
- package/dist/index.js.map +1 -1
- package/dist/services/__tests__/rulehost-readiness.test.js +0 -3
- package/dist/services/__tests__/rulehost-readiness.test.js.map +1 -1
- package/dist/services/pain-flood-simulation-runner.d.ts.map +1 -1
- package/dist/services/pain-flood-simulation-runner.js +0 -4
- package/dist/services/pain-flood-simulation-runner.js.map +1 -1
- package/dist/services/rulehost-pipeline-runner.d.ts +90 -21
- package/dist/services/rulehost-pipeline-runner.d.ts.map +1 -1
- package/dist/services/rulehost-pipeline-runner.js +328 -24
- package/dist/services/rulehost-pipeline-runner.js.map +1 -1
- package/dist/services/synthetic-baseline-runner.d.ts.map +1 -1
- package/dist/services/synthetic-baseline-runner.js +0 -4
- package/dist/services/synthetic-baseline-runner.js.map +1 -1
- package/dist/services/version-report.d.ts +16 -0
- package/dist/services/version-report.d.ts.map +1 -1
- package/dist/services/version-report.js +37 -2
- package/dist/services/version-report.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/__tests__/runtime-probe-config.test.ts +2 -1
- package/src/commands/__tests__/version.test.ts +110 -0
- package/src/commands/diagnose.ts +3 -6
- package/src/commands/pain-retry.ts +3 -6
- package/src/commands/runtime-activation.ts +9 -3
- package/src/commands/runtime-init.ts +4 -6
- package/src/commands/runtime-internalization-run-once.ts +5 -11
- package/src/commands/runtime-internalization-run-rulehost.ts +69 -15
- package/src/index.ts +0 -13
- package/src/services/__tests__/rulehost-readiness.test.ts +0 -3
- package/src/services/pain-flood-simulation-runner.ts +0 -4
- package/src/services/rulehost-pipeline-runner.ts +368 -35
- package/src/services/synthetic-baseline-runner.ts +0 -4
- package/src/services/version-report.ts +52 -2
- package/tests/commands/config-doctor.test.ts +0 -2
- package/tests/commands/pain-evidence.test.ts +1 -1
- package/tests/commands/run-rulehost-handler.test.ts +43 -0
- package/tests/commands/runtime-features.test.ts +0 -1
- package/tests/commands/runtime-internalization-run-once-language.test.ts +0 -1
- package/tests/e2e/cross-package-acceptance.test.ts +13 -3
- package/tests/services/pd-config-loader.test.ts +0 -1
- package/tests/services/rulehost-pipeline-runner.test.ts +378 -12
- package/dist/commands/runtime-internalization-context-trace.d.ts +0 -25
- package/dist/commands/runtime-internalization-context-trace.d.ts.map +0 -1
- package/dist/commands/runtime-internalization-context-trace.js +0 -374
- package/dist/commands/runtime-internalization-context-trace.js.map +0 -1
- package/src/commands/runtime-internalization-context-trace.ts +0 -445
- package/tests/bdd/context-trace.steps.ts +0 -229
- package/tests/commands/runtime-internalization-context-trace.test.ts +0 -110
|
@@ -297,13 +297,42 @@ function resolveRunRuleHostRuntime(
|
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
-
|
|
300
|
+
/**
|
|
301
|
+
* Owner Decision Experience v1 review fix (Codex P1): derive the PUBLICATION
|
|
302
|
+
* outcome from the pipeline result. The generation can fully succeed while the
|
|
303
|
+
* governance publication (approval enqueue) is REFUSED by the Phase A identity
|
|
304
|
+
* boundary — that state must never be presented as "waiting for owner review".
|
|
305
|
+
* Exported pure so the CLI output contract is testable without spawning the
|
|
306
|
+
* command (cli-7).
|
|
307
|
+
*/
|
|
308
|
+
export function describePublicationOutcome(result: RuleHostPipelineResult): {
|
|
309
|
+
blocked: boolean;
|
|
310
|
+
nextAction: string;
|
|
311
|
+
} {
|
|
312
|
+
const identityBlocked = result.decision === 'candidate_ready_for_owner_review'
|
|
313
|
+
&& result.approvalId === null
|
|
314
|
+
&& (result.degradationReason ?? '').includes('identity_binding_unverified');
|
|
315
|
+
if (identityBlocked) {
|
|
316
|
+
return {
|
|
317
|
+
blocked: true,
|
|
318
|
+
nextAction: 'Identity binding could not be verified, so the artifact was NOT enqueued for Owner review. Artifacts are preserved; repair the ledger identity for this candidate and re-run this pipeline to publish.',
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
return { blocked: false, nextAction: '' };
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export function formatTextOutput(result: RuleHostPipelineResult): string {
|
|
301
325
|
const lines: string[] = [];
|
|
302
326
|
const isReady = result.decision === 'candidate_ready_for_owner_review';
|
|
303
|
-
|
|
327
|
+
// Owner Decision Experience v1 review fix (Codex P1): an identity-gated
|
|
328
|
+
// refusal keeps the service decision but did NOT enqueue an approval —
|
|
329
|
+
// reporting it as plain success ("WAITING for owner review") lied to the
|
|
330
|
+
// operator. The publication outcome is derived explicitly and reported.
|
|
331
|
+
const publication = describePublicationOutcome(result);
|
|
332
|
+
const icon = publication.blocked ? '⚠' : isReady ? '✓' : result.decision === 'text_principle_only' ? '⚠' : '✗';
|
|
304
333
|
lines.push('RuleHost Pipeline (PRI-429)');
|
|
305
334
|
lines.push(`pain: ${result.painId}`);
|
|
306
|
-
lines.push(`OVERALL: ${icon} ${result.decision.toUpperCase()}`);
|
|
335
|
+
lines.push(`OVERALL: ${icon} ${result.decision.toUpperCase()}${publication.blocked ? ' (PUBLICATION REFUSED)' : ''}`);
|
|
307
336
|
lines.push('');
|
|
308
337
|
|
|
309
338
|
for (const stage of result.stages) {
|
|
@@ -314,15 +343,25 @@ function formatTextOutput(result: RuleHostPipelineResult): string {
|
|
|
314
343
|
lines.push('');
|
|
315
344
|
lines.push(`ruleArtifactId: ${result.ruleArtifactId ?? '(none)'}`);
|
|
316
345
|
lines.push(`principleArtifactId: ${result.principleArtifactId ?? '(none)'}`);
|
|
346
|
+
if (result.approvalId) {
|
|
347
|
+
lines.push(`approvalId: ${result.approvalId}`);
|
|
348
|
+
}
|
|
317
349
|
if (result.degradationReason) {
|
|
318
350
|
lines.push(`degradationReason: ${result.degradationReason}`);
|
|
319
351
|
}
|
|
320
|
-
if (
|
|
352
|
+
if (publication.blocked) {
|
|
353
|
+
lines.push('');
|
|
354
|
+
lines.push(`Next: ${publication.nextAction}`);
|
|
355
|
+
} else if (result.decision === 'candidate_ready_for_owner_review') {
|
|
321
356
|
lines.push('');
|
|
322
357
|
lines.push('Next: the rule artifact is validated and WAITING for owner review. This is NOT owner approval.');
|
|
323
358
|
} else if (result.decision === 'text_principle_only') {
|
|
324
359
|
lines.push('');
|
|
325
|
-
|
|
360
|
+
if (result.approvalId) {
|
|
361
|
+
lines.push(`Next: code-rule capability is OFF. Text principle enqueued for Owner review in the approval queue (${result.approvalId}). Approve it in the Console.`);
|
|
362
|
+
} else {
|
|
363
|
+
lines.push('Next: code-rule capability is OFF and the text principle could NOT be enqueued. Check degradationReason.');
|
|
364
|
+
}
|
|
326
365
|
} else {
|
|
327
366
|
lines.push('');
|
|
328
367
|
lines.push('Next: generation rejected. Check degradationReason. Principle artifact may still exist for prompt-channel fallback.');
|
|
@@ -517,12 +556,14 @@ export async function handleRunRuleHost(opts: RunRuleHostOptions): Promise<void>
|
|
|
517
556
|
return;
|
|
518
557
|
}
|
|
519
558
|
if (opts.confirm) {
|
|
520
|
-
// Lazy import: avoids loading `principles-disciple` at module init
|
|
521
|
-
// `pd --version` (and the create-principles-disciple smoke
|
|
522
|
-
// this file statically via index.ts
|
|
523
|
-
//
|
|
524
|
-
// `
|
|
525
|
-
//
|
|
559
|
+
// Lazy import: avoids loading `principles-disciple` at module init
|
|
560
|
+
// time. `pd --version` (and the create-principles-disciple smoke
|
|
561
|
+
// test) loads this file statically via index.ts; a static import
|
|
562
|
+
// would pull the plugin package into every pd startup even when
|
|
563
|
+
// `--confirm` is never used. Both install layouts resolve the
|
|
564
|
+
// package via a `pd-cli/node_modules/principles-disciple` link
|
|
565
|
+
// (release: installer.ts syncPdCli; local dev: sync-plugin.mjs,
|
|
566
|
+
// PRI-808).
|
|
526
567
|
const { BehaviorExamplePackAssembler, RuleHostEvidenceRegistry } = await import('principles-disciple/rulehost-evidence');
|
|
527
568
|
try {
|
|
528
569
|
const assembler = new BehaviorExamplePackAssembler({ workspaceDir, stateDir: path.join(workspaceDir, '.state') });
|
|
@@ -631,16 +672,29 @@ export async function handleRunRuleHost(opts: RunRuleHostOptions): Promise<void>
|
|
|
631
672
|
}
|
|
632
673
|
|
|
633
674
|
// ── Output ──
|
|
675
|
+
// Owner Decision Experience v1 review fix (Codex P1): an identity-gated
|
|
676
|
+
// refusal is a degraded outcome — the JSON carries the structured
|
|
677
|
+
// reason/nextAction (cli-6) and the exit code is non-zero so automation
|
|
678
|
+
// does not treat an unpublishable artifact as a fully successful run.
|
|
679
|
+
const publication = describePublicationOutcome(result);
|
|
634
680
|
if (opts.json) {
|
|
635
681
|
// Exactly one parseable JSON object on stdout (CLI gate rule 1).
|
|
636
682
|
// CLI gate rule 6: degraded/refused results include structured reason + nextAction.
|
|
637
683
|
const output = result.decision === 'candidate_ready_for_owner_review'
|
|
638
|
-
? {
|
|
684
|
+
? {
|
|
685
|
+
status: 'candidate_ready_for_owner_review',
|
|
686
|
+
...result,
|
|
687
|
+
...(publication.blocked
|
|
688
|
+
? { publicationRefused: true, nextAction: publication.nextAction }
|
|
689
|
+
: {}),
|
|
690
|
+
}
|
|
639
691
|
: {
|
|
640
692
|
status: result.decision,
|
|
641
693
|
...result,
|
|
642
694
|
nextAction: result.decision === 'text_principle_only'
|
|
643
|
-
?
|
|
695
|
+
? (result.approvalId
|
|
696
|
+
? `code-rule capability OFF; text principle enqueued for Owner review (${result.approvalId}). Approve it in the Console.`
|
|
697
|
+
: 'code-rule capability OFF and approval enqueue failed; check degradationReason for the manual enqueue command.')
|
|
644
698
|
: 'Check degradationReason; principle artifact may still exist for prompt-channel fallback.',
|
|
645
699
|
};
|
|
646
700
|
process.stdout.write(JSON.stringify(output) + '\n');
|
|
@@ -648,8 +702,8 @@ export async function handleRunRuleHost(opts: RunRuleHostOptions): Promise<void>
|
|
|
648
702
|
process.stdout.write(formatTextOutput(result) + '\n');
|
|
649
703
|
}
|
|
650
704
|
|
|
651
|
-
// exit 1 when
|
|
652
|
-
if (result.decision !== 'candidate_ready_for_owner_review') {
|
|
705
|
+
// exit 1 when the run did not fully succeed (not ready, or publication refused).
|
|
706
|
+
if (result.decision !== 'candidate_ready_for_owner_review' || publication.blocked) {
|
|
653
707
|
process.exitCode = 1;
|
|
654
708
|
}
|
|
655
709
|
}
|
package/src/index.ts
CHANGED
|
@@ -46,7 +46,6 @@ import { handleRuntimePainFlood } from './commands/runtime-pain-flood-simulation
|
|
|
46
46
|
import { handleRuntimeInternalizationIntegrity } from './commands/runtime-internalization-integrity.js';
|
|
47
47
|
import { handleRuntimeInternalizationIntegrityRepair } from './commands/runtime-internalization-integrity-repair.js';
|
|
48
48
|
import { handleRuntimeInternalizationEnqueueSuccessors } from './commands/runtime-internalization-enqueue-successors.js';
|
|
49
|
-
import { handleRuntimeInternalizationContextTrace } from './commands/runtime-internalization-context-trace.js';
|
|
50
49
|
import { handleRuntimeDiagnosticsExport } from './commands/runtime-diagnostics-export.js';
|
|
51
50
|
import { registerRuntimeCompatibilityScanCommand } from './commands/runtime-compatibility-scan.js';
|
|
52
51
|
import { handleRuntimeRecoverySweep } from './commands/runtime-recovery.js';
|
|
@@ -803,18 +802,6 @@ internalizationCmd
|
|
|
803
802
|
await handleRuntimeInternalizationEnqueueSuccessors({ workspace: opts.workspace, dryRun: opts.dryRun, confirm: opts.confirm, json: opts.json });
|
|
804
803
|
});
|
|
805
804
|
|
|
806
|
-
// Layer 3 (design §6.7, PR 5): read-only context-trace command.
|
|
807
|
-
internalizationCmd
|
|
808
|
-
.command('context-trace')
|
|
809
|
-
.description('Trace the internalization context chain: summaries, three-segment diagnosis, truncations, degradations')
|
|
810
|
-
.requiredOption('-t, --task <taskId>', 'Task ID to trace')
|
|
811
|
-
.option('-a, --artifact <artifactId>', 'Specific artifact ID to start from')
|
|
812
|
-
.option('-w, --workspace <path>', 'Workspace directory')
|
|
813
|
-
.option('--json', 'Output raw JSON (default)')
|
|
814
|
-
.action(async (opts) => {
|
|
815
|
-
await handleRuntimeInternalizationContextTrace({ workspace: opts.workspace, task: opts.task, artifact: opts.artifact, json: opts.json });
|
|
816
|
-
});
|
|
817
|
-
|
|
818
805
|
const activationCmd = runtimeCmd
|
|
819
806
|
.command('activation', { hidden: true })
|
|
820
807
|
.description('Activation dispatch operations (hidden — use pd activation for list/deactivate)');
|
|
@@ -89,7 +89,6 @@ function writeConfig(workspaceDir: string, opts: ConfigOptions = {}): void {
|
|
|
89
89
|
evaluator: { enabled: agentEnabled.evaluator, runtimeProfile: profileId },
|
|
90
90
|
rolloutReviewer: { enabled: false, runtimeProfile: profileId },
|
|
91
91
|
correctionObserver: { enabled: false, runtimeProfile: profileId },
|
|
92
|
-
empathyObserver: { enabled: false, runtimeProfile: profileId },
|
|
93
92
|
},
|
|
94
93
|
},
|
|
95
94
|
ui: { diagnostics: { mode: 'simple' } },
|
|
@@ -128,7 +127,6 @@ function writeDefaultInstalledConfig(workspaceDir: string): void {
|
|
|
128
127
|
evaluator: { enabled: false, runtimeProfile: 'openclaw.default' },
|
|
129
128
|
rolloutReviewer: { enabled: false, runtimeProfile: 'openclaw.default' },
|
|
130
129
|
correctionObserver: { enabled: false, runtimeProfile: 'openclaw.default' },
|
|
131
|
-
empathyObserver: { enabled: false, runtimeProfile: 'openclaw.default' },
|
|
132
130
|
},
|
|
133
131
|
},
|
|
134
132
|
ui: { diagnostics: { mode: 'simple' } },
|
|
@@ -278,7 +276,6 @@ describe('resolveRuleHostReadiness', () => {
|
|
|
278
276
|
evaluator: { enabled: true, runtimeProfile: 'pi-ai.main' },
|
|
279
277
|
rolloutReviewer: { enabled: false, runtimeProfile: 'pi-ai.main' },
|
|
280
278
|
correctionObserver: { enabled: false, runtimeProfile: 'pi-ai.main' },
|
|
281
|
-
empathyObserver: { enabled: false, runtimeProfile: 'pi-ai.main' },
|
|
282
279
|
},
|
|
283
280
|
},
|
|
284
281
|
ui: { diagnostics: { mode: 'simple' } },
|
|
@@ -18,7 +18,6 @@ import { PainSignalBridge } from '@principles/core/runtime-v2';
|
|
|
18
18
|
import { CandidateIntakeService } from '@principles/core/runtime-v2';
|
|
19
19
|
import { PrincipleTreeLedgerAdapter } from '@principles/core/runtime-v2';
|
|
20
20
|
import { makeDeterministicDiagnosticianOutput } from '@principles/core/runtime-v2';
|
|
21
|
-
import { contentHashFn } from './rulehost-pipeline-runner.js';
|
|
22
21
|
import type {
|
|
23
22
|
PainFloodSimulationSummary,
|
|
24
23
|
PainFloodStage,
|
|
@@ -252,7 +251,6 @@ export async function runPainFloodSimulation(opts: PainFloodSimulationRunnerOpti
|
|
|
252
251
|
artifactStore: stateManager.piArtifactStore,
|
|
253
252
|
validator: new DefaultDiagRootCauseValidator(),
|
|
254
253
|
contextAssembler,
|
|
255
|
-
contentHashFn,
|
|
256
254
|
},
|
|
257
255
|
{
|
|
258
256
|
owner: 'pain-flood-simulation',
|
|
@@ -269,7 +267,6 @@ export async function runPainFloodSimulation(opts: PainFloodSimulationRunnerOpti
|
|
|
269
267
|
eventEmitter,
|
|
270
268
|
artifactStore: stateManager.piArtifactStore,
|
|
271
269
|
validator: new DefaultDiagDistillerValidator(),
|
|
272
|
-
contentHashFn,
|
|
273
270
|
},
|
|
274
271
|
{
|
|
275
272
|
owner: 'pain-flood-simulation',
|
|
@@ -286,7 +283,6 @@ export async function runPainFloodSimulation(opts: PainFloodSimulationRunnerOpti
|
|
|
286
283
|
eventEmitter,
|
|
287
284
|
artifactStore: stateManager.piArtifactStore,
|
|
288
285
|
committer,
|
|
289
|
-
contentHashFn,
|
|
290
286
|
},
|
|
291
287
|
{
|
|
292
288
|
owner: 'pain-flood-simulation',
|