@principles/host-runtime 0.13.5 → 0.14.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.
@@ -78,6 +78,14 @@ export interface GovernanceCorrectionCandidate {
78
78
  * dedup still apply unchanged.
79
79
  */
80
80
  readonly explicitOwnerStatement?: boolean;
81
+ /**
82
+ * Provenance distinction for explicit Codex statements: the native
83
+ * `PD记录痛苦:` prefix (hook-read Owner text, the default) vs the
84
+ * agent-assisted no-prefix entry (`pd pain explicit`, model-transcribed
85
+ * Owner words bound to the host-written live turn context). Audit-only:
86
+ * admission, rate limit and idempotency are identical either way.
87
+ */
88
+ readonly explicitChannel?: 'codex_explicit_prefix' | 'codex_explicit_agent';
81
89
  }
82
90
  export interface GovernanceToolFailureCandidate {
83
91
  readonly kind: 'tool_failure';
@@ -395,7 +395,9 @@ function tryConsumeRateLimit({ db, rootSessionId, ruleVersion, now }) {
395
395
  }
396
396
  function insertCorrectionPain({ db, candidate, workspaceDir, painId, detection, nowIso }) {
397
397
  const reason = candidate.explicitOwnerStatement === true
398
- ? `${candidate.hostKind === 'workbuddy' ? 'WorkBuddy' : 'Codex'} explicit owner statement (PD记录痛苦 prefix)`
398
+ ? candidate.explicitChannel === 'codex_explicit_agent'
399
+ ? 'Codex explicit owner statement (agent-assisted, no prefix)'
400
+ : `${candidate.hostKind === 'workbuddy' ? 'WorkBuddy' : 'Codex'} explicit owner statement (PD记录痛苦 prefix)`
399
401
  : detection !== undefined && detection.matchedTerms.length > 0
400
402
  ? `User correction detected: ${detection.matchedTerms.join(', ')}`
401
403
  : 'User correction detected';
@@ -461,7 +463,7 @@ function taskSubmissionPayload(candidate, workspaceDir, details) {
461
463
  ...(candidate.explicitOwnerStatement === true
462
464
  ? { correctionEvidence: candidate.hostKind === 'workbuddy'
463
465
  ? { text: boundCorrectionEvidenceText({ text: candidate.text, classification: 'owner_statement', channel: 'workbuddy_explicit_prefix' }, workspaceDir).text, classification: 'owner_statement', channel: 'workbuddy_explicit_prefix' }
464
- : { text: sanitizeString(candidate.text, workspaceDir), classification: 'owner_statement', channel: 'codex_explicit_prefix' } }
466
+ : { text: sanitizeString(candidate.text, workspaceDir), classification: 'owner_statement', channel: candidate.explicitChannel === 'codex_explicit_agent' ? 'codex_explicit_agent' : 'codex_explicit_prefix' } }
465
467
  : {}),
466
468
  };
467
469
  return JSON.stringify(payload);
@@ -878,7 +880,7 @@ function isGovernanceTaskPayload(value) {
878
880
  const correctionEvidence = own(value, 'correctionEvidence');
879
881
  const hasOwnerStatement = isRecord(correctionEvidence)
880
882
  && own(correctionEvidence, 'classification') === 'owner_statement'
881
- && (own(correctionEvidence, 'channel') === 'codex_explicit_prefix' && hostKind === 'codex'
883
+ && ((own(correctionEvidence, 'channel') === 'codex_explicit_prefix' || own(correctionEvidence, 'channel') === 'codex_explicit_agent') && hostKind === 'codex'
882
884
  || own(correctionEvidence, 'channel') === 'workbuddy_explicit_prefix' && hostKind === 'workbuddy')
883
885
  && typeof own(correctionEvidence, 'text') === 'string'
884
886
  && own(correctionEvidence, 'text').length > 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principles/host-runtime",
3
- "version": "0.13.5",
3
+ "version": "0.14.0",
4
4
  "description": "Shared host-neutral orchestration for Principles Disciple MVP-Core hook paths.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -31,7 +31,7 @@
31
31
  "lint": "eslint \"src/**/*.ts\""
32
32
  },
33
33
  "dependencies": {
34
- "@principles/core": "^1.297.2",
34
+ "@principles/core": "^1.297.3",
35
35
  "@principles/install-layout": "^0.4.0",
36
36
  "better-sqlite3": "^13.0.3",
37
37
  "js-yaml": "^5.4.3"