create-principles-disciple 1.145.6 → 1.145.7
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/_release/product-identity.json +2 -2
- package/console/dist/server/models/CodexGovernanceHealthModel.d.ts +39 -2
- package/console/dist/server/models/CodexGovernanceHealthModel.js +228 -29
- package/core/dist/runtime-v2/adapter/artificer-l2-adapter.d.ts.map +1 -1
- package/core/dist/runtime-v2/adapter/artificer-l2-adapter.js +28 -9
- package/core/dist/runtime-v2/adapter/artificer-l2-adapter.js.map +1 -1
- package/core/dist/runtime-v2/adapter/l2-agent-loop-adapter.d.ts.map +1 -1
- package/core/dist/runtime-v2/adapter/l2-agent-loop-adapter.js +29 -9
- package/core/dist/runtime-v2/adapter/l2-agent-loop-adapter.js.map +1 -1
- package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.d.ts +6 -0
- package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.d.ts.map +1 -1
- package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.js +105 -1
- package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.js.map +1 -1
- package/core/dist/runtime-v2/index.d.ts +6 -2
- package/core/dist/runtime-v2/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/index.js +3 -1
- package/core/dist/runtime-v2/index.js.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-intent-preflight.d.ts +154 -0
- package/core/dist/runtime-v2/internalization/artificer-intent-preflight.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/artificer-intent-preflight.js +686 -0
- package/core/dist/runtime-v2/internalization/artificer-intent-preflight.js.map +1 -0
- package/core/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts +21 -3
- package/core/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-prompt-builder.js +48 -5
- package/core/dist/runtime-v2/internalization/artificer-prompt-builder.js.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-runner.d.ts +17 -0
- package/core/dist/runtime-v2/internalization/artificer-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-runner.js +45 -2
- package/core/dist/runtime-v2/internalization/artificer-runner.js.map +1 -1
- package/core/dist/runtime-v2/internalization/behavior-example-pack.d.ts +0 -19
- package/core/dist/runtime-v2/internalization/behavior-example-pack.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/behavior-example-pack.js +31 -0
- package/core/dist/runtime-v2/internalization/behavior-example-pack.js.map +1 -1
- package/core/dist/runtime-v2/internalization/intent-contract.d.ts +31 -0
- package/core/dist/runtime-v2/internalization/intent-contract.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/intent-contract.js +42 -0
- package/core/dist/runtime-v2/internalization/intent-contract.js.map +1 -1
- package/core/dist/runtime-v2/internalization/peer-runner-contracts.d.ts +14 -1
- package/core/dist/runtime-v2/internalization/peer-runner-contracts.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/peer-runner-contracts.js.map +1 -1
- package/core/dist/runtime-v2/internalization/pitask-metadata.d.ts +64 -0
- package/core/dist/runtime-v2/internalization/pitask-metadata.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/pitask-metadata.js +84 -0
- package/core/dist/runtime-v2/internalization/pitask-metadata.js.map +1 -1
- package/core/dist/runtime-v2/internalization/scribe-output.d.ts +13 -1
- package/core/dist/runtime-v2/internalization/scribe-output.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/scribe-output.js +13 -1
- package/core/dist/runtime-v2/internalization/scribe-output.js.map +1 -1
- package/core/dist/runtime-v2/internalization/scribe-prompt-builder.d.ts +15 -1
- package/core/dist/runtime-v2/internalization/scribe-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/scribe-prompt-builder.js +29 -1
- package/core/dist/runtime-v2/internalization/scribe-prompt-builder.js.map +1 -1
- package/core/dist/runtime-v2/tools/agent-tool-contract.d.ts +2 -1
- package/core/dist/runtime-v2/tools/agent-tool-contract.d.ts.map +1 -1
- package/core/dist/runtime-v2/tools/agent-tool-contract.js +1 -1
- package/core/dist/runtime-v2/tools/agent-tool-contract.js.map +1 -1
- package/core/dist/runtime-v2/tools/artificer-l2-tool-contract.d.ts +1 -1
- package/core/dist/telemetry-event.d.ts +4 -2
- package/core/dist/telemetry-event.d.ts.map +1 -1
- package/core/dist/telemetry-event.js +12 -0
- package/core/dist/telemetry-event.js.map +1 -1
- package/core/package.json +3 -3
- package/host-runtime/dist/internalization-consumer-cycle.d.ts +10 -1
- package/host-runtime/dist/internalization-consumer-cycle.js +85 -4
- package/host-runtime/dist/production-rulehost-gate.js +40 -3
- package/host-runtime/package.json +1 -1
- package/package.json +1 -1
- package/plugin/dist/bundle.js +655 -781
- package/plugin/dist/openclaw.plugin.json +1 -1
- package/plugin/dist/rulehost-evidence.js +27 -27
- package/release-manager/package.json +1 -1
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
import { createRuntimeStateHandle, InternalizationOrchestrator, DreamerRunner, PhilosopherRunner, ScribeRunner, ArtificerRunner, buildArtificerHostSemanticContext, EvaluatorRunner, RolloutReviewerRunner, DefaultDreamerValidator, DefaultPhilosopherValidator, DefaultScribeValidator, DefaultArtificerValidator, DefaultEvaluatorValidator, DefaultRolloutReviewerValidator, PiAiRuntimeAdapter, L2AgentLoopAdapter, ArtificerL2Adapter, buildL2PrincipleReaderFromLedger, OpenClawCliRuntimeAdapter, storeEmitter, createProductionGateDeps, resolveRuntimeConfigFromPdConfig, resolveRuntimeConfigForAgent, AGENT_NAME_FOR_TASK_KIND, isRuntimeConfigError, computeConsumerDecision, FULL_CHAIN_CONSUMER_RUNNER_KINDS, DEFAULT_CONSUMER_RUNNER_KINDS, InternalizationQueueReadModel, MVP_CORE_TASK_KINDS, SqliteConnection, SqliteReconciliationCursorStore, SUCCEEDED_TRANSITIONS_SCOPE, PrincipleTreeLedgerAdapter,
|
|
24
24
|
// PRI-714: resolve outputLanguage from the same effective config the
|
|
25
25
|
// runners already receive (EP-07: canonical resolved value, not raw input).
|
|
26
|
-
resolveOutputLanguage, hydratePITaskRecord, preflightArtificerOwnerEvidence, } from '@principles/core/runtime-v2';
|
|
26
|
+
resolveOutputLanguage, hydratePITaskRecord, preflightArtificerOwnerEvidence, preflightArtificerIntentBasis, consumeSourceFaultBackoffSkip, advanceSourceFaultBackoff, } from '@principles/core/runtime-v2';
|
|
27
27
|
import { loadLedger } from '@principles/core/principle-tree-ledger';
|
|
28
28
|
import { loadPdConfigForPlugin, loadFeatureFlagFromConfig } from './pd-config.js';
|
|
29
29
|
import { createEvaluatorRepairDeps, createRolloutGovernanceDeps } from './internalization-consumer-governance.js';
|
|
@@ -384,6 +384,21 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
|
384
384
|
preflightSkipReason = 'code_rule_capability_disabled';
|
|
385
385
|
continue;
|
|
386
386
|
}
|
|
387
|
+
// SPEC-RULECODE-QUALITY-001 §9 (Q21): a pending source-fault backoff
|
|
388
|
+
// consumes one skip cycle per encounter — the task stays pending,
|
|
389
|
+
// zero model cost, and the technical retry happens only after the
|
|
390
|
+
// bounded 1-then-2-cycle backoff elapses (restart-durable).
|
|
391
|
+
if (await consumeSourceFaultBackoffSkip(candidate.taskId, leasedPiTask, stateManager)) {
|
|
392
|
+
const backoffInfo = JSON.stringify({
|
|
393
|
+
reason: 'source_fault_backoff_skip',
|
|
394
|
+
taskId: candidate.taskId,
|
|
395
|
+
nextAction: 'Transient source fault backoff in effect; the task retries automatically at zero model cost.',
|
|
396
|
+
});
|
|
397
|
+
emitEvent('INTERNALIZATION_CONSUMER_SKIP', backoffInfo);
|
|
398
|
+
logger.info(`[PD:${logLabel}] Artificer task ${candidate.taskId} skipped this cycle: source-fault backoff.`);
|
|
399
|
+
preflightSkipReason = 'source_fault_backoff_skip';
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
387
402
|
artificerEvidence = await preflightArtificerOwnerEvidence({
|
|
388
403
|
taskId: candidate.taskId,
|
|
389
404
|
piTask: leasedPiTask,
|
|
@@ -415,16 +430,21 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
|
415
430
|
// assembly at zero model cost), the runner is never constructed,
|
|
416
431
|
// and the preflight already emitted the structured degradation
|
|
417
432
|
// telemetry (reason=evidence_source_error, reviewPersisted=false).
|
|
433
|
+
// SPEC-RULECODE-QUALITY-001 §9 (Q21/Q22): the transient fault now
|
|
434
|
+
// advances the SHARED bounded source-fault backoff (restart-
|
|
435
|
+
// durable counter; 3rd consecutive fault ends auto-retry in a
|
|
436
|
+
// source_fault_persistent review terminal — never an Owner label).
|
|
437
|
+
const persistentFault = await advanceSourceFaultBackoff({ taskId: candidate.taskId, piTask: leasedPiTask, stateManager }, `evidence source error: ${artificerEvidence.detail ?? 'trajectory store I/O fault'}`);
|
|
418
438
|
const storageInfo = JSON.stringify({
|
|
419
|
-
reason: 'evidence_source_error',
|
|
439
|
+
reason: persistentFault ? 'source_fault_persistent' : 'evidence_source_error',
|
|
420
440
|
taskId: candidate.taskId,
|
|
421
441
|
taskKind: candidate.taskKind,
|
|
422
442
|
nextAction: artificerEvidence.nextAction,
|
|
423
443
|
...(artificerEvidence.detail !== undefined ? { detail: artificerEvidence.detail } : {}),
|
|
424
444
|
});
|
|
425
445
|
emitEvent('INTERNALIZATION_CONSUMER_SKIP', storageInfo);
|
|
426
|
-
logger.warn(`[PD:${logLabel}] Artificer task ${candidate.taskId} skipped: evidence source error (storage fault preserved; task stays wake-eligible).`);
|
|
427
|
-
preflightSkipReason = 'evidence_source_error';
|
|
446
|
+
logger.warn(`[PD:${logLabel}] Artificer task ${candidate.taskId} skipped: evidence source error (storage fault preserved; task stays wake-eligible${persistentFault ? '; auto-retry ended after repeated faults' : ''}).`);
|
|
447
|
+
preflightSkipReason = persistentFault ? 'source_fault_persistent' : 'evidence_source_error';
|
|
428
448
|
continue;
|
|
429
449
|
}
|
|
430
450
|
if (artificerEvidence.decision === 'blocked') {
|
|
@@ -444,6 +464,61 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
|
444
464
|
preflightSkipReason = 'artificer_blocked_on_owner_evidence';
|
|
445
465
|
continue;
|
|
446
466
|
}
|
|
467
|
+
// SPEC-RULECODE-QUALITY-001 A1 (Q01/Q20): intent-basis preflight —
|
|
468
|
+
// evidence-ready is necessary but NOT sufficient. The scribe
|
|
469
|
+
// artifact must carry a valid intentContract AND machine-readable
|
|
470
|
+
// executionConditions, and every declared required trusted fact
|
|
471
|
+
// must be resolvable through ports.trustedFacts. Any stop verdict
|
|
472
|
+
// moves the task to needs_human_review with a stable reasonCode
|
|
473
|
+
// and the runner is NEVER constructed (zero generation calls).
|
|
474
|
+
// The gate re-derives from the scribe artifact every run — a
|
|
475
|
+
// stored verification record is never a pass token.
|
|
476
|
+
const intentBasis = await preflightArtificerIntentBasis({
|
|
477
|
+
taskId: candidate.taskId,
|
|
478
|
+
piTask: leasedPiTask,
|
|
479
|
+
owner,
|
|
480
|
+
workspaceDir,
|
|
481
|
+
stateManager,
|
|
482
|
+
eventEmitter: workspaceEmitter,
|
|
483
|
+
...(ports.trustedFacts !== undefined ? { trustedFacts: ports.trustedFacts } : {}),
|
|
484
|
+
});
|
|
485
|
+
if (intentBasis.decision === 'source_error') {
|
|
486
|
+
// Q21: transient artifact-store fault — the preflight already
|
|
487
|
+
// advanced the shared bounded backoff; task stays wake-eligible.
|
|
488
|
+
emitEvent('INTERNALIZATION_CONSUMER_SKIP', JSON.stringify({
|
|
489
|
+
reason: 'intent_source_error',
|
|
490
|
+
taskId: candidate.taskId,
|
|
491
|
+
nextAction: intentBasis.nextAction,
|
|
492
|
+
detail: intentBasis.detail,
|
|
493
|
+
}));
|
|
494
|
+
logger.warn(`[PD:${logLabel}] Artificer task ${candidate.taskId} skipped: intent-basis source error (transient; bounded backoff applies).`);
|
|
495
|
+
preflightSkipReason = 'intent_source_error';
|
|
496
|
+
continue;
|
|
497
|
+
}
|
|
498
|
+
if (intentBasis.decision === 'source_fault_persistent') {
|
|
499
|
+
emitEvent('INTERNALIZATION_CONSUMER_INTENT_BLOCKED', JSON.stringify({
|
|
500
|
+
taskId: candidate.taskId,
|
|
501
|
+
reasonCode: intentBasis.reasonCode,
|
|
502
|
+
nextAction: intentBasis.nextAction,
|
|
503
|
+
detail: intentBasis.detail,
|
|
504
|
+
reviewPersisted: intentBasis.reviewPersisted,
|
|
505
|
+
}));
|
|
506
|
+
logger.warn(`[PD:${logLabel}] Artificer task ${candidate.taskId} blocked: repeated source faults ended auto-retry (${intentBasis.reasonCode}).`);
|
|
507
|
+
preflightSkipReason = 'source_fault_persistent';
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
510
|
+
if (intentBasis.decision === 'blocked') {
|
|
511
|
+
emitEvent('INTERNALIZATION_CONSUMER_INTENT_BLOCKED', JSON.stringify({
|
|
512
|
+
taskId: candidate.taskId,
|
|
513
|
+
reasonCode: intentBasis.reasonCode,
|
|
514
|
+
nextAction: intentBasis.nextAction,
|
|
515
|
+
detail: intentBasis.detail,
|
|
516
|
+
reviewPersisted: intentBasis.reviewPersisted,
|
|
517
|
+
}));
|
|
518
|
+
logger.warn(`[PD:${logLabel}] Artificer task ${candidate.taskId} blocked on intent basis (${intentBasis.reasonCode}, reviewPersisted=${intentBasis.reviewPersisted}).`);
|
|
519
|
+
preflightSkipReason = 'artificer_blocked_on_intent_basis';
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
447
522
|
}
|
|
448
523
|
}
|
|
449
524
|
wakeResult = candidate;
|
|
@@ -643,6 +718,12 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
|
643
718
|
...(artificerEvidence !== null && artificerEvidence.decision === 'ready'
|
|
644
719
|
? { behaviorExamplePack: artificerEvidence.pack }
|
|
645
720
|
: {}),
|
|
721
|
+
// SPEC-RULECODE-QUALITY-001 A1 (Owner review P2): the SAME
|
|
722
|
+
// trusted-facts port the intent preflight used must ride into the
|
|
723
|
+
// runner so the defensive mirror sees the same fact resolutions —
|
|
724
|
+
// without this, a port-resolved task would pass the entry gate and
|
|
725
|
+
// then be refused by the runner's "provider absent" guard.
|
|
726
|
+
...(ports.trustedFacts !== undefined ? { trustedFacts: ports.trustedFacts } : {}),
|
|
646
727
|
},
|
|
647
728
|
// PRI-741: thread the host semantic projection into generation.
|
|
648
729
|
{ ...runnerOptions, ...(artificerHostSemanticContext !== undefined ? { hostSemanticContext: artificerHostSemanticContext } : {}) });
|
|
@@ -85,6 +85,13 @@ export function createProductionRuleHostGate(options = {}) {
|
|
|
85
85
|
if (action.normalizedPath === null)
|
|
86
86
|
return { decision: 'allow', source: event.source, metadata: { evaluatedLiveRules: 0 } };
|
|
87
87
|
let context;
|
|
88
|
+
/**
|
|
89
|
+
* SPEC-RULECODE-QUALITY-001 A3 (Q10): the precise reason a v2 rule is
|
|
90
|
+
* suspended — carried into the skip warning so each fault kind (absent /
|
|
91
|
+
* undefined / invalid / failed / unavailable) is distinguishable in host
|
|
92
|
+
* telemetry instead of merging into one opaque 'unavailable'.
|
|
93
|
+
*/
|
|
94
|
+
let contextFault;
|
|
88
95
|
let enrichment = { currentGfi: 0, epTier: 0, bashRisk: 'unknown' };
|
|
89
96
|
const request = {
|
|
90
97
|
workspaceDir: event.context.workspaceDir, sessionId: event.context.sessionId,
|
|
@@ -110,6 +117,7 @@ export function createProductionRuleHostGate(options = {}) {
|
|
|
110
117
|
const candidate = await withinGateDeadline(options.ruleContextProvider(request), startedAt);
|
|
111
118
|
if (candidate === undefined) {
|
|
112
119
|
context = undefined;
|
|
120
|
+
contextFault = 'provider_returned_undefined';
|
|
113
121
|
}
|
|
114
122
|
else {
|
|
115
123
|
const validation = validateRuleContextV2(candidate);
|
|
@@ -117,18 +125,27 @@ export function createProductionRuleHostGate(options = {}) {
|
|
|
117
125
|
context = candidate;
|
|
118
126
|
else {
|
|
119
127
|
context = UNAVAILABLE_RULE_CONTEXT;
|
|
128
|
+
contextFault = 'provider_invalid';
|
|
120
129
|
addWarning(warnings, `rule_context_invalid: ${validation.errors.join('; ')}`, 'repair the host context provider');
|
|
121
130
|
}
|
|
122
131
|
}
|
|
123
132
|
}
|
|
124
133
|
catch (error) {
|
|
125
134
|
context = UNAVAILABLE_RULE_CONTEXT;
|
|
135
|
+
contextFault = 'provider_failed';
|
|
126
136
|
addWarning(warnings, `rule_context_provider_failed: ${error instanceof Error ? error.message : String(error)}`, 'inspect the host context provider and retry');
|
|
127
137
|
}
|
|
128
138
|
}
|
|
139
|
+
else {
|
|
140
|
+
contextFault = 'provider_absent';
|
|
141
|
+
}
|
|
129
142
|
const dbPath = path.join(event.context.workspaceDir, '.pd', 'state.db');
|
|
130
143
|
if (remainingGateMs(startedAt) <= 0) {
|
|
131
|
-
|
|
144
|
+
// SPEC-RULECODE-QUALITY-001 Q24: a deadline-exhausted allow must be
|
|
145
|
+
// observable as "no rule executed" (evaluatedLiveRules=0), never read
|
|
146
|
+
// as successful governance — isolated probe finding (the early return
|
|
147
|
+
// previously carried no evaluation facts at all).
|
|
148
|
+
return { decision: 'allow', source: event.source, warnings: [boundedWarning('gate_deadline_exceeded', 'inspect host context providers and active RuleCode resource use')], metadata: { evaluatedLiveRules: 0 } };
|
|
132
149
|
}
|
|
133
150
|
if (!fs.existsSync(dbPath)) {
|
|
134
151
|
// Security audit run-1 (gate-failopen-allow-on-state-corruption):
|
|
@@ -308,8 +325,28 @@ export function createProductionRuleHostGate(options = {}) {
|
|
|
308
325
|
addWarning(warnings, `unsupported_context_version: ${String(content.requiresContextVersion)}`, 'regenerate the rule artifact for context version 2');
|
|
309
326
|
continue;
|
|
310
327
|
}
|
|
311
|
-
|
|
312
|
-
|
|
328
|
+
// SPEC-RULECODE-QUALITY-001 A3 / §7.1 (Q10): MANDATORY runtime
|
|
329
|
+
// suspension of context-dependent rules. A v2 rule may only
|
|
330
|
+
// execute when the provider resolved a schema-valid context
|
|
331
|
+
// whose history.status is 'available'. The old check (`!context`)
|
|
332
|
+
// let the truthy UNAVAILABLE_RULE_CONTEXT sentinel (provider
|
|
333
|
+
// invalid/thrown) and schema-valid unavailable contexts through,
|
|
334
|
+
// so a v2 rule without its own self-protection still executed on
|
|
335
|
+
// untrusted input. Skipping happens per-call, per-rule — healthy
|
|
336
|
+
// sibling rules (v1 or well-fed v2) keep evaluating, and no
|
|
337
|
+
// governance state changes. Intentional behavior change vs the
|
|
338
|
+
// pre-fix "legal unavailable still executed" path.
|
|
339
|
+
if (context === undefined || context.history.status !== 'available') {
|
|
340
|
+
// Reference identity against the frozen sentinel distinguishes
|
|
341
|
+
// "the provider faulted" from "the provider legitimately
|
|
342
|
+
// declared history unavailable" (same wire shape, different
|
|
343
|
+
// fault class — Q10 asserts them separately).
|
|
344
|
+
const fault = context === undefined
|
|
345
|
+
? (contextFault ?? 'provider_absent')
|
|
346
|
+
: context === UNAVAILABLE_RULE_CONTEXT
|
|
347
|
+
? (contextFault ?? 'provider_invalid')
|
|
348
|
+
: 'history_unavailable';
|
|
349
|
+
addWarning(warnings, `rule_context_v2_unavailable: ${fault} (activation=${activationId})`, 'enable and wire the host rule context provider, or regenerate the rule without context dependence');
|
|
313
350
|
continue;
|
|
314
351
|
}
|
|
315
352
|
}
|