create-principles-disciple 1.146.9 → 1.147.1
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 +1 -1
- package/codex-adapter/dist/ingestion/explicit-owner-statement.d.ts +6 -0
- package/codex-adapter/dist/ingestion/explicit-owner-statement.js +6 -0
- package/codex-adapter/dist/pd-hook.js +5 -2
- package/codex-adapter/dist/worker/workspace-worker.d.ts +13 -1
- package/codex-adapter/dist/worker/workspace-worker.js +26 -3
- package/codex-adapter/package.json +1 -1
- package/console/dist/shared/prompt-injection-contract.d.ts +1 -1
- package/console/dist/web/assets/app.js +31 -31
- package/core/dist/prompt-builder/size-guard.d.ts.map +1 -1
- package/core/dist/prompt-builder/size-guard.js +6 -1
- package/core/dist/prompt-builder/size-guard.js.map +1 -1
- package/core/dist/prompt-builder/types.d.ts +2 -1
- package/core/dist/prompt-builder/types.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.d.ts +12 -1
- package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.js +12 -1
- package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.js.map +1 -1
- package/core/dist/runtime-v2/activation/prompt-budget-policy.d.ts +42 -11
- package/core/dist/runtime-v2/activation/prompt-budget-policy.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/prompt-budget-policy.js +82 -30
- package/core/dist/runtime-v2/activation/prompt-budget-policy.js.map +1 -1
- package/core/dist/runtime-v2/adapter/pi-ai-catalog.d.ts.map +1 -1
- package/core/dist/runtime-v2/adapter/pi-ai-catalog.js +17 -5
- package/core/dist/runtime-v2/adapter/pi-ai-catalog.js.map +1 -1
- package/core/dist/runtime-v2/index.d.ts +2 -2
- package/core/dist/runtime-v2/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/index.js +1 -1
- package/core/dist/runtime-v2/index.js.map +1 -1
- package/core/dist/runtime-v2/intent/intent-friction-block.d.ts +2 -2
- package/core/dist/runtime-v2/intent/intent-friction-block.js +2 -2
- package/core/dist/runtime-v2/pain-ingress-payload.d.ts +13 -1
- package/core/dist/runtime-v2/pain-ingress-payload.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-ingress-payload.js +21 -2
- package/core/dist/runtime-v2/pain-ingress-payload.js.map +1 -1
- package/core/dist/runtime-v2/pain-ingress.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-ingress.js +3 -0
- package/core/dist/runtime-v2/pain-ingress.js.map +1 -1
- package/core/dist/runtime-v2/signal-collector/confidence-gate.d.ts +35 -0
- package/core/dist/runtime-v2/signal-collector/confidence-gate.d.ts.map +1 -0
- package/core/dist/runtime-v2/signal-collector/confidence-gate.js +48 -0
- package/core/dist/runtime-v2/signal-collector/confidence-gate.js.map +1 -0
- package/core/dist/runtime-v2/signal-collector/index.d.ts +1 -0
- package/core/dist/runtime-v2/signal-collector/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/signal-collector/index.js +1 -0
- package/core/dist/runtime-v2/signal-collector/index.js.map +1 -1
- package/core/dist/runtime-v2/signal-collector/keyword-stage.d.ts +4 -6
- package/core/dist/runtime-v2/signal-collector/keyword-stage.d.ts.map +1 -1
- package/core/dist/runtime-v2/signal-collector/keyword-stage.js +100 -9
- package/core/dist/runtime-v2/signal-collector/keyword-stage.js.map +1 -1
- package/core/dist/runtime-v2/store/context/sqlite-context-assembler.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/context/sqlite-context-assembler.js +8 -4
- package/core/dist/runtime-v2/store/context/sqlite-context-assembler.js.map +1 -1
- package/core/dist/runtime-v2/types/event-types.d.ts +2 -2
- package/core/dist/runtime-v2/types/event-types.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/event-types.js +1 -0
- package/core/dist/runtime-v2/types/event-types.js.map +1 -1
- package/core/package.json +1 -1
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +52 -1
- package/dist/installer.js.map +1 -1
- package/dist/installers/mcp-registration-conflict.d.ts +35 -0
- package/dist/installers/mcp-registration-conflict.d.ts.map +1 -0
- package/dist/installers/mcp-registration-conflict.js +559 -0
- package/dist/installers/mcp-registration-conflict.js.map +1 -0
- package/dist/installers/openclaw-host-installer.d.ts.map +1 -1
- package/dist/installers/openclaw-host-installer.js +20 -0
- package/dist/installers/openclaw-host-installer.js.map +1 -1
- package/dist/installers/workbuddy-host-installer.d.ts.map +1 -1
- package/dist/installers/workbuddy-host-installer.js +124 -2
- package/dist/installers/workbuddy-host-installer.js.map +1 -1
- package/dist/mcp-server-layout-compat.d.ts +18 -0
- package/dist/mcp-server-layout-compat.d.ts.map +1 -0
- package/dist/mcp-server-layout-compat.js +22 -0
- package/dist/mcp-server-layout-compat.js.map +1 -0
- package/host-runtime/dist/governance-signal-admission.d.ts +147 -4
- package/host-runtime/dist/governance-signal-admission.js +1065 -60
- package/host-runtime/dist/index.d.ts +2 -0
- package/host-runtime/dist/index.js +2 -0
- package/host-runtime/dist/prompt-injection-budget-observation.js +4 -2
- package/host-runtime/dist/signal-classifier.d.ts +46 -0
- package/host-runtime/dist/signal-classifier.js +167 -0
- package/host-runtime/dist/signal-stage2-cycle.d.ts +42 -0
- package/host-runtime/dist/signal-stage2-cycle.js +184 -0
- package/host-runtime/package.json +1 -1
- package/install-layout/dist/index.d.ts +15 -0
- package/install-layout/dist/index.js +10 -0
- package/install-layout/package.json +1 -1
- package/package.json +9 -7
- package/pd-cli/dist/commands/health-codex.d.ts.map +1 -1
- package/pd-cli/dist/commands/health-codex.js +12 -0
- package/pd-cli/dist/commands/health-codex.js.map +1 -1
- package/pd-cli/dist/commands/health-mcp.d.ts +74 -0
- package/pd-cli/dist/commands/health-mcp.d.ts.map +1 -0
- package/pd-cli/dist/commands/health-mcp.js +723 -0
- package/pd-cli/dist/commands/health-mcp.js.map +1 -0
- package/pd-cli/dist/commands/health.d.ts +2 -0
- package/pd-cli/dist/commands/health.d.ts.map +1 -1
- package/pd-cli/dist/commands/health.js +11 -6
- package/pd-cli/dist/commands/health.js.map +1 -1
- package/pd-cli/package.json +1 -1
- package/pd-mcp-server/dist/budget.d.ts +15 -0
- package/pd-mcp-server/dist/budget.js +19 -0
- package/pd-mcp-server/dist/deadline.d.ts +75 -0
- package/pd-mcp-server/dist/deadline.js +136 -0
- package/pd-mcp-server/dist/envelope.d.ts +52 -0
- package/pd-mcp-server/dist/envelope.js +63 -0
- package/pd-mcp-server/dist/index.d.ts +10 -0
- package/pd-mcp-server/dist/index.js +76 -0
- package/pd-mcp-server/dist/logging.d.ts +12 -0
- package/pd-mcp-server/dist/logging.js +42 -0
- package/pd-mcp-server/dist/server.d.ts +90 -0
- package/pd-mcp-server/dist/server.js +178 -0
- package/pd-mcp-server/dist/version.d.ts +13 -0
- package/pd-mcp-server/dist/version.js +13 -0
- package/pd-mcp-server/dist/workspace.d.ts +23 -0
- package/pd-mcp-server/dist/workspace.js +77 -0
- package/pd-mcp-server/package.json +49 -0
- package/plugin/dist/bundle.js +414 -412
- package/plugin/dist/core/mcp-binding.d.ts +41 -0
- package/plugin/dist/governance-audit.js +2 -2
- package/plugin/dist/index.d.ts +33 -0
- package/plugin/dist/openclaw.plugin.json +10 -1
- package/plugin/dist/utils/workspace-resolver.d.ts +17 -0
- package/plugin/openclaw.plugin.json +10 -1
- package/plugin/package.json +2 -1
- package/release-manager/dist/installer.js +52 -1
- package/release-manager/dist/installers/mcp-registration-conflict.js +559 -0
- package/release-manager/dist/installers/openclaw-host-installer.js +20 -0
- package/release-manager/dist/installers/workbuddy-host-installer.js +124 -2
- package/release-manager/dist/mcp-server-layout-compat.js +22 -0
- package/release-manager/package.json +7 -5
- package/workbuddy-adapter/dist/codec/input-decoder.js +3 -1
- package/workbuddy-adapter/dist/pd-hook.js +28 -5
- package/workbuddy-adapter/dist/worker/workspace-worker.d.ts +6 -1
- package/workbuddy-adapter/dist/worker/workspace-worker.js +24 -3
- package/workbuddy-adapter/package.json +1 -1
- package/workbuddy-adapter/plugin/.codebuddy-plugin/plugin.json +2 -2
- package/workbuddy-adapter/plugin/.mcp.json +10 -0
- package/workbuddy-adapter/plugin/mcp/launcher.cjs +347 -0
|
@@ -11,6 +11,12 @@ export type RecordOwnerStatementResult = {
|
|
|
11
11
|
* rollout to promote from). The receipt discloses it instead of failing.
|
|
12
12
|
*/
|
|
13
13
|
promotionDegraded?: string;
|
|
14
|
+
/**
|
|
15
|
+
* PainIngress warning when the Owner statement legitimately degraded
|
|
16
|
+
* (e.g. ingestion OFF → no persisted observation to use as behavior
|
|
17
|
+
* evidence). The Pain + task still exist; the receipt discloses the basis.
|
|
18
|
+
*/
|
|
19
|
+
ingressWarning?: string;
|
|
14
20
|
} | {
|
|
15
21
|
status: 'rejected';
|
|
16
22
|
reason: 'statement_empty' | 'statement_too_long' | 'transcript_unavailable' | 'lineage_invalid' | 'rate_limited' | 'continuation_failed';
|
|
@@ -84,6 +84,11 @@ export async function recordExplicitOwnerStatement(args) {
|
|
|
84
84
|
if (outcome.disposition === 'rate_limited') {
|
|
85
85
|
return { status: 'rejected', reason: 'rate_limited', nextAction: 'The per-root-session correction quota (5/hour) is exhausted; resubmit later — the statement was NOT recorded.' };
|
|
86
86
|
}
|
|
87
|
+
if (outcome.disposition !== 'admitted' && outcome.disposition !== 'already_admitted') {
|
|
88
|
+
// An explicit Owner statement bypasses keyword detection entirely, so it
|
|
89
|
+
// can never legitimately land in the Stage-2 review state machine.
|
|
90
|
+
return { status: 'rejected', reason: 'continuation_failed', nextAction: `unexpected admission disposition for an explicit statement: ${outcome.disposition}` };
|
|
91
|
+
}
|
|
87
92
|
// Promotion runs BEFORE the task enqueue (deliberate): the durable task is
|
|
88
93
|
// the receipt's hard guarantee, and promoting first closes the window in
|
|
89
94
|
// which the background worker could start the first diagnosis before the
|
|
@@ -126,5 +131,6 @@ export async function recordExplicitOwnerStatement(args) {
|
|
|
126
131
|
disposition: outcome.disposition === 'already_admitted' ? 'already_admitted' : 'admitted',
|
|
127
132
|
logicalObservationKey: candidate.logicalObservationKey,
|
|
128
133
|
...(promotionDegraded !== undefined ? { promotionDegraded } : {}),
|
|
134
|
+
...(ensured.ingressWarning !== undefined ? { ingressWarning: ensured.ingressWarning } : {}),
|
|
129
135
|
};
|
|
130
136
|
}
|
|
@@ -362,8 +362,11 @@ export async function processHookInvocation(rawStdin, _env = process.env, cwd =
|
|
|
362
362
|
const promotionNotice = receipt.promotionDegraded === 'conversation_ingestion_disabled'
|
|
363
363
|
? '会话证据提升已跳过:会话摄取未启用(按隐私边界未读取会话内容,也未写入会话观察)'
|
|
364
364
|
: `会话证据提升暂不可用:${receipt.promotionDegraded}`;
|
|
365
|
-
|
|
366
|
-
|
|
365
|
+
const ingressNotice = receipt.ingressWarning !== undefined
|
|
366
|
+
? `行为证据缺失,已按 Owner 陈述降级准入:${receipt.ingressWarning}`
|
|
367
|
+
: undefined;
|
|
368
|
+
explicitReceiptContext = `[PD] 已收到痛苦反馈(painId=${receipt.painId}, taskId=${receipt.taskId}${receipt.disposition === 'already_admitted' ? ', 重复提交已合并为同一信号' : ''})。后台将自动诊断;请在回复中如实转述本回执,不要声称仍在等待用户输入,也不要虚构诊断结论。${receipt.promotionDegraded !== undefined ? `(注意:${promotionNotice};诊断仍会基于你提交的陈述进行。)` : ''}${ingressNotice !== undefined ? `(注意:${ingressNotice};诊断仍会基于你提交的陈述进行。)` : ''}`;
|
|
369
|
+
explicitDiagnostics.push(diagnostic(`owner_statement_received:${receipt.painId}:${receipt.taskId}${receipt.promotionDegraded !== undefined ? `:promotion_degraded:${receipt.promotionDegraded}` : ''}${receipt.ingressWarning !== undefined ? `:ingress_degraded:${receipt.ingressWarning}` : ''}`, 'Durable enqueue complete; the workspace worker continues diagnosis in the background.'));
|
|
367
370
|
}
|
|
368
371
|
else {
|
|
369
372
|
explicitDiagnostics.push(diagnostic(`owner_statement_${receipt.reason}`, receipt.nextAction));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type InternalizationConsumerCycleOutcome, type ConsumerCycleLogger, type ReconcileGovernanceContinuationResult } from '@principles/host-runtime';
|
|
1
|
+
import { type InternalizationConsumerCycleOutcome, type ConsumerCycleLogger, type ReconcileGovernanceContinuationResult, type SignalLlmClassifier, type Stage2CorrectionCycleReport } from '@principles/host-runtime';
|
|
2
2
|
import { type CodexCatchUpResult } from '../ingestion/catch-up.js';
|
|
3
3
|
import type { TranscriptPort } from '../ingestion/transcript-decoder.js';
|
|
4
4
|
export type CodexWorkerMode = 'ready' | 'manual_action_required' | 'paused' | 'degraded';
|
|
@@ -34,6 +34,11 @@ export interface CodexWorkerCycleStepReport {
|
|
|
34
34
|
readonly reuseReviewRequiredCandidateIds?: readonly string[];
|
|
35
35
|
} | null;
|
|
36
36
|
readonly downstream: InternalizationConsumerCycleOutcome | null;
|
|
37
|
+
/**
|
|
38
|
+
* Phase B Stage-2 review step. Always the LAST step so it can never starve
|
|
39
|
+
* the Diagnostician (bounded to ≤2 candidates / ≤60s aggregate).
|
|
40
|
+
*/
|
|
41
|
+
readonly stage2?: Stage2CorrectionCycleReport;
|
|
37
42
|
}
|
|
38
43
|
export interface CodexWorkerCycleResult {
|
|
39
44
|
readonly workspaceDir: string;
|
|
@@ -53,6 +58,13 @@ export interface CodexWorkerCycleOptions {
|
|
|
53
58
|
readonly port?: TranscriptPort;
|
|
54
59
|
/** Cap on diagnostician candidates inspected per cycle (default 5). */
|
|
55
60
|
readonly diagnosticianCandidateLimit?: number;
|
|
61
|
+
/**
|
|
62
|
+
* Stage-2 classifier injection (tests). `undefined` = resolve the
|
|
63
|
+
* signalCollector profile from the workspace config; `null` = explicitly
|
|
64
|
+
* unavailable (candidates with a durable review result still settle).
|
|
65
|
+
*/
|
|
66
|
+
readonly stage2Classifier?: SignalLlmClassifier | null;
|
|
67
|
+
readonly stage2AggregateBudgetMs?: number;
|
|
56
68
|
}
|
|
57
69
|
export declare function readCodexWorkerLiveness(workspaceDir: string): Record<string, unknown> | null;
|
|
58
70
|
/**
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
import fs from 'node:fs';
|
|
29
29
|
import path from 'node:path';
|
|
30
30
|
import { computeFeatureFlagsFromConfig, createRuntimeStateHandle, createPainSignalBridge, isRetryWaitBackoffElapsed, PrincipleTreeLedgerAdapter, resolveDiagnosticianCapability, } from '@principles/core/runtime-v2';
|
|
31
|
-
import { createWorkspaceBehaviorEvidencePort, createCodexArtificerTrustedFactsPort, loadPdConfigForPlugin, loadFeatureFlagFromConfig, reconcileGovernanceContinuation, runInternalizationConsumerCycle, saveHostToolDeclaration, } from '@principles/host-runtime';
|
|
31
|
+
import { createWorkspaceBehaviorEvidencePort, createCodexArtificerTrustedFactsPort, loadPdConfigForPlugin, loadFeatureFlagFromConfig, reconcileGovernanceContinuation, runInternalizationConsumerCycle, runStage2CorrectionCycle, createSignalClassifierForWorkspace, saveHostToolDeclaration, } from '@principles/host-runtime';
|
|
32
32
|
import { catchUpCodexIngestion } from '../ingestion/catch-up.js';
|
|
33
33
|
import { CODEX_TOOL_SEMANTIC_MAPPINGS, CODEX_TOOL_SEMANTICS } from '../tool-semantics.js';
|
|
34
34
|
const WORKER_OWNER = 'companion-worker';
|
|
@@ -419,6 +419,28 @@ export async function runCodexWorkspaceWorkerCycle(options) {
|
|
|
419
419
|
// No hostToolCatalog: PD has not declared a Codex tool catalog; a wrong
|
|
420
420
|
// (OpenClaw) catalog would be worse than none (PRI-630 follow-up).
|
|
421
421
|
});
|
|
422
|
+
// Step 8 (SPEC v0.3.1 §2) — bounded Stage-2 correction review, ALWAYS last:
|
|
423
|
+
// the Diagnostician has already run, so this step cannot starve it. ≤2
|
|
424
|
+
// candidates, ≤60s aggregate, single 60s classification timeout.
|
|
425
|
+
const stage2Resolution = options.stage2Classifier === undefined
|
|
426
|
+
? createSignalClassifierForWorkspace(workspaceDir)
|
|
427
|
+
: null;
|
|
428
|
+
const stage2Classifier = options.stage2Classifier !== undefined
|
|
429
|
+
? options.stage2Classifier
|
|
430
|
+
: (stage2Resolution?.ok === true ? stage2Resolution.classifier : null);
|
|
431
|
+
const stage2ClassifierState = options.stage2Classifier === null
|
|
432
|
+
? 'disabled'
|
|
433
|
+
: stage2Classifier === null
|
|
434
|
+
? (stage2Resolution !== null && !stage2Resolution.ok && stage2Resolution.readiness === 'disabled' ? 'disabled' : 'unavailable')
|
|
435
|
+
: 'used';
|
|
436
|
+
const stage2 = await runStage2CorrectionCycle({
|
|
437
|
+
workspaceDir,
|
|
438
|
+
classifier: stage2Classifier,
|
|
439
|
+
classifierState: stage2ClassifierState,
|
|
440
|
+
...(options.stage2AggregateBudgetMs !== undefined ? { aggregateBudgetMs: options.stage2AggregateBudgetMs } : {}),
|
|
441
|
+
...(options.now !== undefined ? { now: options.now } : {}),
|
|
442
|
+
onEvent: emitEvent,
|
|
443
|
+
});
|
|
422
444
|
// Aggregated mode: degraded overrides all (review P1). Any component
|
|
423
445
|
// degrading — catch-up, reconciliation, diagnostician or downstream —
|
|
424
446
|
// surfaces the workspace as degraded, with the highest-priority reason.
|
|
@@ -429,7 +451,8 @@ export async function runCodexWorkspaceWorkerCycle(options) {
|
|
|
429
451
|
: diagnostician?.status === 'failed' && diagnostician.errorCategory !== 'lease_conflict' ? `diagnostician_failed:${diagnostician.message ?? 'max_attempts_exceeded'}`
|
|
430
452
|
: diagnostician?.status === 'degraded' ? `diagnostician_degraded:${diagnostician.message ?? 'unknown'}`
|
|
431
453
|
: downstream.skipReason === 'runtime_config_error' || downstream.skipReason === 'cycle_error' || downstream.skipReason === 'config_malformed' ? `downstream:${downstream.skipReason}`
|
|
432
|
-
:
|
|
454
|
+
: !stage2.ok ? `stage2:${stage2.reason ?? 'failed'}`
|
|
455
|
+
: undefined;
|
|
433
456
|
writeLiveness(workspaceDir, {
|
|
434
457
|
runningStage: null,
|
|
435
458
|
stageDeadline: null,
|
|
@@ -442,7 +465,7 @@ export async function runCodexWorkspaceWorkerCycle(options) {
|
|
|
442
465
|
...base,
|
|
443
466
|
mode: degradedReason !== undefined ? 'degraded' : 'ready',
|
|
444
467
|
...(degradedReason !== undefined ? { reason: degradedReason, nextAction: 'Inspect the Workspace .pd/config.yaml runtime profile and the per-step report above; the worker retries automatically on the next cycle.' } : {}),
|
|
445
|
-
report: { catchUp, reconcile, postProcessing, diagnostician, downstream },
|
|
468
|
+
report: { catchUp, reconcile, postProcessing, diagnostician, downstream, stage2 },
|
|
446
469
|
};
|
|
447
470
|
}
|
|
448
471
|
// Slice D (PRI-625): the mode authority moved to host-runtime so the CLI and
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principles/codex-adapter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Codex CLI host adapter for Principles Disciple — implements HostAdapter interface for OpenAI Codex CLI's stdin/stdout JSON hook model (ADR-0020).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
export type PromptInjectionTargetHostName = 'openclaw' | 'codex' | 'workbuddy';
|
|
16
16
|
export type PromptInjectionRouteName = 'legacy_trim' | 'shared_render';
|
|
17
17
|
export type PromptInjectionBudgetScopeName = 'selected_lines' | 'full_directive_context';
|
|
18
|
-
export type PromptBudgetCapacitySourceWire = 'operator_declared' | 'host_effective_window' | 'pi_catalog_exact' | 'legacy_fallback';
|
|
18
|
+
export type PromptBudgetCapacitySourceWire = 'operator_declared' | 'host_effective_window' | 'pi_catalog_exact' | 'pi_catalog_model_id' | 'legacy_fallback';
|
|
19
19
|
export type PromptBudgetCapacityStatusWire = 'confirmed' | 'unknown';
|
|
20
20
|
/**
|
|
21
21
|
* Bounded machine-readable fallback reason. Closed set mirroring the core
|