create-principles-disciple 1.150.3 → 1.150.4

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 (248) hide show
  1. package/_release/product-identity.json +1 -1
  2. package/codex-adapter/dist/ingestion/admission.js +2 -0
  3. package/codex-adapter/dist/pd-hook.d.ts +7 -5
  4. package/codex-adapter/dist/pd-hook.js +18 -7
  5. package/codex-adapter/dist/tool-semantics.js +5 -1
  6. package/codex-adapter/dist/worker/workspace-worker.js +4 -2
  7. package/codex-adapter/package.json +1 -1
  8. package/console/dist/lib/utils.js +16 -1
  9. package/console/dist/web/assets/app.css +147 -46
  10. package/console/dist/web/assets/app.js +35 -32
  11. package/console/package.json +2 -0
  12. package/core/dist/runtime/activation-compatibility-read-model.d.ts.map +1 -1
  13. package/core/dist/runtime/activation-compatibility-read-model.js +2 -1
  14. package/core/dist/runtime/activation-compatibility-read-model.js.map +1 -1
  15. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.d.ts.map +1 -1
  16. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js +106 -19
  17. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js.map +1 -1
  18. package/core/dist/runtime/candidate-audit.d.ts.map +1 -1
  19. package/core/dist/runtime/candidate-audit.js +2 -1
  20. package/core/dist/runtime/candidate-audit.js.map +1 -1
  21. package/core/dist/runtime/config/pd-config-effective.d.ts.map +1 -1
  22. package/core/dist/runtime/config/pd-config-effective.js +2 -0
  23. package/core/dist/runtime/config/pd-config-effective.js.map +1 -1
  24. package/core/dist/runtime/config/pd-config-types.d.ts +52 -0
  25. package/core/dist/runtime/config/pd-config-types.d.ts.map +1 -1
  26. package/core/dist/runtime/config/pd-config-types.js.map +1 -1
  27. package/core/dist/runtime/config/pd-config-validate.d.ts.map +1 -1
  28. package/core/dist/runtime/config/pd-config-validate.js +134 -0
  29. package/core/dist/runtime/config/pd-config-validate.js.map +1 -1
  30. package/core/dist/runtime/feature-flags/feature-flag-contract.d.ts.map +1 -1
  31. package/core/dist/runtime/feature-flags/feature-flag-contract.js +8 -0
  32. package/core/dist/runtime/feature-flags/feature-flag-contract.js.map +1 -1
  33. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
  34. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js +24 -0
  35. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js.map +1 -1
  36. package/core/dist/runtime/index.d.ts +2 -0
  37. package/core/dist/runtime/index.d.ts.map +1 -1
  38. package/core/dist/runtime/index.js +2 -0
  39. package/core/dist/runtime/index.js.map +1 -1
  40. package/core/dist/runtime/internalization/rule-host-input-builder.d.ts +16 -0
  41. package/core/dist/runtime/internalization/rule-host-input-builder.d.ts.map +1 -1
  42. package/core/dist/runtime/internalization/rule-host-input-builder.js +18 -0
  43. package/core/dist/runtime/internalization/rule-host-input-builder.js.map +1 -1
  44. package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts +8 -0
  45. package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts.map +1 -1
  46. package/core/dist/runtime/internalization/split-diagnostician-runner.js +24 -2
  47. package/core/dist/runtime/internalization/split-diagnostician-runner.js.map +1 -1
  48. package/core/dist/runtime/internalization/tool-semantic-registry.d.ts +26 -0
  49. package/core/dist/runtime/internalization/tool-semantic-registry.d.ts.map +1 -1
  50. package/core/dist/runtime/internalization/tool-semantic-registry.js +55 -5
  51. package/core/dist/runtime/internalization/tool-semantic-registry.js.map +1 -1
  52. package/core/dist/runtime/internalization-chain-integrity-read-model.d.ts.map +1 -1
  53. package/core/dist/runtime/internalization-chain-integrity-read-model.js +2 -2
  54. package/core/dist/runtime/internalization-chain-integrity-read-model.js.map +1 -1
  55. package/core/dist/runtime/internalization-integrity-remediation.d.ts.map +1 -1
  56. package/core/dist/runtime/internalization-integrity-remediation.js +2 -2
  57. package/core/dist/runtime/internalization-integrity-remediation.js.map +1 -1
  58. package/core/dist/runtime/operator-health-read-model.d.ts.map +1 -1
  59. package/core/dist/runtime/operator-health-read-model.js +2 -2
  60. package/core/dist/runtime/operator-health-read-model.js.map +1 -1
  61. package/core/dist/runtime/pain-recall-read-model.d.ts.map +1 -1
  62. package/core/dist/runtime/pain-recall-read-model.js +4 -3
  63. package/core/dist/runtime/pain-recall-read-model.js.map +1 -1
  64. package/core/dist/runtime/pruning-read-model.d.ts.map +1 -1
  65. package/core/dist/runtime/pruning-read-model.js +3 -2
  66. package/core/dist/runtime/pruning-read-model.js.map +1 -1
  67. package/core/dist/runtime/risk/risk-calculator-policy.d.ts +12 -2
  68. package/core/dist/runtime/risk/risk-calculator-policy.d.ts.map +1 -1
  69. package/core/dist/runtime/risk/risk-calculator-policy.js +33 -22
  70. package/core/dist/runtime/risk/risk-calculator-policy.js.map +1 -1
  71. package/core/dist/runtime/schema-conformance-read-model.js +2 -2
  72. package/core/dist/runtime/schema-conformance-read-model.js.map +1 -1
  73. package/core/dist/runtime/store/sqlite-connection.d.ts +0 -5
  74. package/core/dist/runtime/store/sqlite-connection.d.ts.map +1 -1
  75. package/core/dist/runtime/store/sqlite-connection.js +4 -12
  76. package/core/dist/runtime/store/sqlite-connection.js.map +1 -1
  77. package/core/dist/runtime/store/storage-paths.d.ts +17 -0
  78. package/core/dist/runtime/store/storage-paths.d.ts.map +1 -0
  79. package/core/dist/runtime/store/storage-paths.js +52 -0
  80. package/core/dist/runtime/store/storage-paths.js.map +1 -0
  81. package/core/dist/runtime/trajectory-retention.d.ts +257 -0
  82. package/core/dist/runtime/trajectory-retention.d.ts.map +1 -0
  83. package/core/dist/runtime/trajectory-retention.js +598 -0
  84. package/core/dist/runtime/trajectory-retention.js.map +1 -0
  85. package/core/dist/trajectory-store.d.ts +9 -9
  86. package/core/dist/trajectory-store.d.ts.map +1 -1
  87. package/core/dist/trajectory-store.js +9 -12
  88. package/core/dist/trajectory-store.js.map +1 -1
  89. package/core/package.json +1 -1
  90. package/dist/installers/codex-host-installer.d.ts.map +1 -1
  91. package/dist/installers/codex-host-installer.js +92 -5
  92. package/dist/installers/codex-host-installer.js.map +1 -1
  93. package/dist/installers/mcp-binding-shape-mirror.d.ts +27 -0
  94. package/dist/installers/mcp-binding-shape-mirror.d.ts.map +1 -0
  95. package/dist/installers/mcp-binding-shape-mirror.js +105 -0
  96. package/dist/installers/mcp-binding-shape-mirror.js.map +1 -0
  97. package/dist/skill-catalog.d.ts +35 -0
  98. package/dist/skill-catalog.d.ts.map +1 -0
  99. package/dist/skill-catalog.js +85 -0
  100. package/dist/skill-catalog.js.map +1 -0
  101. package/dist/skill-delivery-parity.d.ts +22 -0
  102. package/dist/skill-delivery-parity.d.ts.map +1 -0
  103. package/dist/skill-delivery-parity.js +31 -0
  104. package/dist/skill-delivery-parity.js.map +1 -0
  105. package/host-runtime/dist/active-principle-prompt.d.ts +8 -0
  106. package/host-runtime/dist/active-principle-prompt.js +15 -5
  107. package/host-runtime/dist/adaptive-decision-protocol.d.ts +142 -0
  108. package/host-runtime/dist/adaptive-decision-protocol.js +190 -0
  109. package/host-runtime/dist/adaptive-priority-provider.d.ts +37 -13
  110. package/host-runtime/dist/adaptive-priority-provider.js +65 -62
  111. package/host-runtime/dist/adaptive-selection.d.ts +67 -64
  112. package/host-runtime/dist/adaptive-selection.js +215 -327
  113. package/host-runtime/dist/adaptive-skip-decision.d.ts +26 -14
  114. package/host-runtime/dist/adaptive-skip-decision.js +33 -29
  115. package/host-runtime/dist/codex-rule-context-provider.js +4 -1
  116. package/host-runtime/dist/governance-observation-store.d.ts +40 -1
  117. package/host-runtime/dist/governance-observation-store.js +188 -9
  118. package/host-runtime/dist/governance-signal-admission.d.ts +19 -3
  119. package/host-runtime/dist/governance-signal-admission.js +12 -4
  120. package/host-runtime/dist/host-tool-declaration.d.ts +18 -2
  121. package/host-runtime/dist/host-tool-declaration.js +67 -11
  122. package/host-runtime/dist/host-tool-semantic-resolver.d.ts +7 -0
  123. package/host-runtime/dist/host-tool-semantic-resolver.js +22 -2
  124. package/host-runtime/dist/index.d.ts +3 -0
  125. package/host-runtime/dist/index.js +14 -0
  126. package/host-runtime/dist/production-rulehost-gate.js +15 -3
  127. package/host-runtime/dist/trajectory-retention.d.ts +147 -0
  128. package/host-runtime/dist/trajectory-retention.js +907 -0
  129. package/host-runtime/package.json +1 -1
  130. package/install-layout/dist/index.d.ts +9 -2
  131. package/install-layout/dist/index.js +26 -9
  132. package/install-layout/dist/mcp-binding-contract.d.ts +91 -0
  133. package/install-layout/dist/mcp-binding-contract.js +230 -0
  134. package/install-layout/package.json +1 -1
  135. package/package.json +4 -4
  136. package/pd-cli/dist/commands/build-trajectory-evidence.d.ts.map +1 -1
  137. package/pd-cli/dist/commands/build-trajectory-evidence.js +17 -11
  138. package/pd-cli/dist/commands/build-trajectory-evidence.js.map +1 -1
  139. package/pd-cli/dist/commands/codex-reconcile.d.ts +7 -0
  140. package/pd-cli/dist/commands/codex-reconcile.d.ts.map +1 -1
  141. package/pd-cli/dist/commands/codex-reconcile.js +11 -2
  142. package/pd-cli/dist/commands/codex-reconcile.js.map +1 -1
  143. package/pd-cli/dist/commands/codex-worker.d.ts.map +1 -1
  144. package/pd-cli/dist/commands/codex-worker.js +35 -0
  145. package/pd-cli/dist/commands/codex-worker.js.map +1 -1
  146. package/pd-cli/dist/commands/command-helpers.d.ts +1 -1
  147. package/pd-cli/dist/commands/command-helpers.js +1 -1
  148. package/pd-cli/dist/commands/errors-list.d.ts +1 -1
  149. package/pd-cli/dist/commands/errors-list.js +1 -1
  150. package/pd-cli/dist/commands/health-mcp.d.ts +23 -1
  151. package/pd-cli/dist/commands/health-mcp.d.ts.map +1 -1
  152. package/pd-cli/dist/commands/health-mcp.js +81 -22
  153. package/pd-cli/dist/commands/health-mcp.js.map +1 -1
  154. package/pd-cli/dist/commands/health.d.ts +1 -1
  155. package/pd-cli/dist/commands/health.d.ts.map +1 -1
  156. package/pd-cli/dist/commands/health.js +12 -5
  157. package/pd-cli/dist/commands/health.js.map +1 -1
  158. package/pd-cli/dist/commands/principles-stats.d.ts +1 -1
  159. package/pd-cli/dist/commands/principles-stats.js +1 -1
  160. package/pd-cli/dist/commands/trajectory-retention.d.ts +23 -0
  161. package/pd-cli/dist/commands/trajectory-retention.d.ts.map +1 -0
  162. package/pd-cli/dist/commands/trajectory-retention.js +159 -0
  163. package/pd-cli/dist/commands/trajectory-retention.js.map +1 -0
  164. package/pd-cli/dist/commands/workbuddy-setup.d.ts +69 -0
  165. package/pd-cli/dist/commands/workbuddy-setup.d.ts.map +1 -0
  166. package/pd-cli/dist/commands/workbuddy-setup.js +379 -0
  167. package/pd-cli/dist/commands/workbuddy-setup.js.map +1 -0
  168. package/pd-cli/dist/commands/workbuddy-worker.d.ts.map +1 -1
  169. package/pd-cli/dist/commands/workbuddy-worker.js +42 -6
  170. package/pd-cli/dist/commands/workbuddy-worker.js.map +1 -1
  171. package/pd-cli/dist/index.d.ts +1 -7
  172. package/pd-cli/dist/index.d.ts.map +1 -1
  173. package/pd-cli/dist/index.js +15 -1201
  174. package/pd-cli/dist/index.js.map +1 -1
  175. package/pd-cli/dist/program.d.ts +17 -0
  176. package/pd-cli/dist/program.d.ts.map +1 -0
  177. package/pd-cli/dist/program.js +1263 -0
  178. package/pd-cli/dist/program.js.map +1 -0
  179. package/pd-cli/dist/services/delivery-surfaces.d.ts.map +1 -1
  180. package/pd-cli/dist/services/delivery-surfaces.js +7 -5
  181. package/pd-cli/dist/services/delivery-surfaces.js.map +1 -1
  182. package/pd-cli/dist/services/version-report.d.ts.map +1 -1
  183. package/pd-cli/dist/services/version-report.js +30 -4
  184. package/pd-cli/dist/services/version-report.js.map +1 -1
  185. package/pd-cli/package.json +1 -1
  186. package/pd-mcp-server/dist/version.d.ts +1 -1
  187. package/pd-mcp-server/dist/version.js +1 -1
  188. package/pd-mcp-server/package.json +3 -1
  189. package/plugin/dist/bundle.js +544 -494
  190. package/plugin/dist/constants/tools.d.ts +8 -1
  191. package/plugin/dist/core/trajectory-retention-trigger.d.ts +13 -0
  192. package/plugin/dist/core/trajectory.d.ts +14 -0
  193. package/plugin/dist/hooks/gate-block-helper.d.ts +17 -0
  194. package/plugin/dist/hooks/gate.d.ts +6 -1
  195. package/plugin/dist/host-runtime/openclaw-host-runtime.d.ts +1 -0
  196. package/plugin/dist/index.d.ts +5 -0
  197. package/plugin/dist/openclaw.plugin.json +1 -1
  198. package/plugin/dist/rulehost-evidence.js +29 -23
  199. package/plugin/dist/templates/langs/en/skills/pd-cli-operator/SKILL.md +16 -5
  200. package/plugin/dist/templates/langs/en/skills/pd-control/SKILL.md +7 -6
  201. package/plugin/dist/templates/langs/en/skills/pd-pain-signal/SKILL.md +141 -28
  202. package/plugin/dist/templates/langs/en/skills/pd-review/SKILL.md +15 -1
  203. package/plugin/dist/templates/langs/zh/skills/pd-cli-operator/SKILL.md +16 -5
  204. package/plugin/dist/templates/langs/zh/skills/pd-control/SKILL.md +7 -6
  205. package/plugin/dist/templates/langs/zh/skills/pd-pain-signal/SKILL.md +142 -29
  206. package/plugin/dist/templates/langs/zh/skills/pd-review/SKILL.md +15 -1
  207. package/plugin/openclaw.plugin.json +1 -1
  208. package/plugin/package.json +1 -1
  209. package/plugin/templates/langs/en/skills/pd-cli-operator/SKILL.md +16 -5
  210. package/plugin/templates/langs/en/skills/pd-control/SKILL.md +7 -6
  211. package/plugin/templates/langs/en/skills/pd-pain-signal/SKILL.md +141 -28
  212. package/plugin/templates/langs/en/skills/pd-review/SKILL.md +15 -1
  213. package/plugin/templates/langs/zh/skills/pd-cli-operator/SKILL.md +16 -5
  214. package/plugin/templates/langs/zh/skills/pd-control/SKILL.md +7 -6
  215. package/plugin/templates/langs/zh/skills/pd-pain-signal/SKILL.md +142 -29
  216. package/plugin/templates/langs/zh/skills/pd-review/SKILL.md +15 -1
  217. package/release-manager/dist/installers/codex-host-installer.js +92 -5
  218. package/release-manager/dist/installers/mcp-binding-shape-mirror.js +105 -0
  219. package/release-manager/package.json +1 -1
  220. package/workbuddy-adapter/dist/codec/input-decoder.d.ts +10 -0
  221. package/workbuddy-adapter/dist/codec/input-decoder.js +62 -5
  222. package/workbuddy-adapter/dist/host-adapter.js +1 -0
  223. package/workbuddy-adapter/dist/index.d.ts +1 -0
  224. package/workbuddy-adapter/dist/index.js +1 -0
  225. package/workbuddy-adapter/dist/ingestion/catch-up.d.ts +25 -0
  226. package/workbuddy-adapter/dist/ingestion/catch-up.js +161 -0
  227. package/workbuddy-adapter/dist/ingestion/encode-cwd.d.ts +6 -0
  228. package/workbuddy-adapter/dist/ingestion/encode-cwd.js +39 -0
  229. package/workbuddy-adapter/dist/ingestion/index.d.ts +13 -0
  230. package/workbuddy-adapter/dist/ingestion/index.js +13 -0
  231. package/workbuddy-adapter/dist/ingestion/ingestion.d.ts +46 -0
  232. package/workbuddy-adapter/dist/ingestion/ingestion.js +135 -0
  233. package/workbuddy-adapter/dist/ingestion/transcript-decoder.d.ts +70 -0
  234. package/workbuddy-adapter/dist/ingestion/transcript-decoder.js +554 -0
  235. package/workbuddy-adapter/dist/ingestion/transcript-path.d.ts +39 -0
  236. package/workbuddy-adapter/dist/ingestion/transcript-path.js +117 -0
  237. package/workbuddy-adapter/dist/ingestion/transcript-source.d.ts +15 -0
  238. package/workbuddy-adapter/dist/ingestion/transcript-source.js +152 -0
  239. package/workbuddy-adapter/dist/pd-hook.d.ts +8 -0
  240. package/workbuddy-adapter/dist/pd-hook.js +59 -2
  241. package/workbuddy-adapter/dist/worker/workspace-worker.d.ts +9 -0
  242. package/workbuddy-adapter/dist/worker/workspace-worker.js +46 -17
  243. package/workbuddy-adapter/package.json +1 -1
  244. package/workbuddy-adapter/plugin/hooks/hooks.json +11 -0
  245. package/workbuddy-adapter/plugin/skills/pd-cli-operator/SKILL.md +57 -19
  246. package/workbuddy-adapter/plugin/skills/pd-control/SKILL.md +21 -9
  247. package/workbuddy-adapter/plugin/skills/pd-pain-signal/SKILL.md +72 -61
  248. package/workbuddy-adapter/plugin/skills/pd-review/SKILL.md +27 -12
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "productVersion": "2.8.6",
4
- "sourceCommit": "1851ac671ffc4391a0e732af2bca991e199d483e"
4
+ "sourceCommit": "5c7389e72a6409efb00891327a63dfc01a2009cb"
5
5
  }
@@ -87,6 +87,8 @@ export async function runGovernanceAdmission(args) {
87
87
  workspaceDir,
88
88
  logicalObservationKey: outcome.logicalObservationKey,
89
89
  canonicalPainId: outcome.canonicalPainId,
90
+ codexConversationIngestionEnabled: true,
91
+ // Legacy alias: an older installed host-runtime reads only this name.
90
92
  conversationIngestionEnabled: true,
91
93
  });
92
94
  if (!cont.ok) {
@@ -23,19 +23,21 @@ export declare const CODEX_HOOK_TIMEOUT_MS = 5000;
23
23
  /** Reserved for Native packing, encoding and stdout after Adaptive is cut off. */
24
24
  export declare const CODEX_NATIVE_RESERVE_MS = 800;
25
25
  export declare const CODEX_ADAPTIVE_BUDGET_MS: number;
26
+ /** Maximum from sending a scoring request to validating its full response. */
27
+ export declare const CODEX_ADAPTIVE_DECISION_MS: 2000;
26
28
  export interface PdHookDeps {
27
29
  /** Test seam: replace the outbound transport without bypassing the hook entry. */
28
30
  readonly fetchImpl?: typeof fetch;
29
31
  readonly now?: () => number;
30
- readonly firstByteTimeoutMs?: number;
31
- readonly generationTimeoutMs?: number;
32
+ readonly requestTimeoutMs?: number;
32
33
  /** Test seam: effective adaptive budget inside the host hook window. */
33
34
  readonly hookBudgetMs?: number;
34
35
  /**
35
- * PRI-1181: remaining-budget floor for the pre-selection skip gate. Defaults
36
- * to the measured minimum; 0 keeps a cancellation scenario sending.
36
+ * PRI-1182: remaining-budget floor for the pre-selection skip gate. Defaults
37
+ * to the request's minimum executable envelope; 0 keeps a cancellation
38
+ * scenario sending.
37
39
  */
38
- readonly minRemainingBudgetMs?: number;
40
+ readonly minExecutableBudgetMs?: number;
39
41
  }
40
42
  export declare function processHookInvocation(rawStdin: string, _env?: EnvMap, cwd?: string, deps?: PdHookDeps): Promise<PdHookResult>;
41
43
  export {};
@@ -5,7 +5,7 @@ import path from 'node:path';
5
5
  import process from 'node:process';
6
6
  import { pathToFileURL, fileURLToPath } from 'node:url';
7
7
  import { appendEventLogLine, redactTelemetryString, isRuleHostEvaluatedEventData } from '@principles/core/runtime';
8
- import { createAdaptivePriorityProviderForConfig, createCodexRuleContextProvider, createProductionHostRuntime, loadPdConfigForPlugin, resolveHostToolSemanticsForHook, resolveNearestPdWorkspace } from '@principles/host-runtime';
8
+ import { ADAPTIVE_SELECTION_LIMITS, createAdaptivePriorityProviderForConfig, createCodexRuleContextProvider, createProductionHostRuntime, loadPdConfigForPlugin, resolveHostToolSemanticsForHook, resolveNearestPdWorkspace } from '@principles/host-runtime';
9
9
  import { CODEX_TOOL_SEMANTIC_MAPPINGS, CODEX_TOOL_SEMANTICS } from './tool-semantics.js';
10
10
  import { computeFeatureFlagsFromConfig } from '@principles/core/runtime';
11
11
  import { CodexHooksHostAdapter } from './host-adapter.js';
@@ -38,7 +38,15 @@ function adaptiveSelectionDiagnostic(line) {
38
38
  ? 'skipped'
39
39
  : 'degraded';
40
40
  const failures = line.failures.length > 0 ? line.failures.join('|') : 'none';
41
- return `[PD] status=${status} reason=adaptive_selection_${line.status}:${line.reason} stage=${line.stage} sends=${line.sends} firstByteAt=${line.firstByteAt ?? 'unknown'} generationEndedAt=${line.generationEndedAt ?? 'unknown'} cancelledAt=${line.cancelledAt ?? 'unknown'} httpStatus=${line.httpStatus ?? 'unknown'} finishReason=${line.finishReason} failures=${failures}`
41
+ // rc-8: bounded score projection — ids are `c1..cN` / `insufficient_context`,
42
+ // never prompt text, and at most 16 entries reach the line.
43
+ const scores = line.decision === null
44
+ ? 'none'
45
+ : Object.entries(line.decision.scores).slice(0, 16).map(([id, value]) => `${id}=${value}`).join(',');
46
+ const decision = line.decision === null
47
+ ? 'unknown'
48
+ : `${line.decision.status}:${line.decision.reason}:${line.decision.ref ?? 'none'}`;
49
+ return `[PD] status=${status} reason=adaptive_selection_${line.status}:${line.reason} stage=${line.stage} sends=${line.sends} requestSentAt=${line.requestSentAt ?? 'unknown'} firstByteAt=${line.firstByteAt ?? 'unknown'} generationEndedAt=${line.generationEndedAt ?? 'unknown'} validatedAt=${line.validatedAt ?? 'unknown'} cancelledAt=${line.cancelledAt ?? 'unknown'} httpStatus=${line.httpStatus ?? 'unknown'} finishReason=${line.finishReason} modelObserved=${line.modelObserved ?? 'unknown'} providerObserved=${line.providerObserved ?? 'absent'} decision=${decision} scores=${scores} failures=${failures}`
42
50
  .replace(/\s+/g, ' ')
43
51
  .trim()
44
52
  .slice(0, MAX_DIAGNOSTIC * 2);
@@ -222,6 +230,8 @@ export const CODEX_HOOK_TIMEOUT_MS = 5_000;
222
230
  /** Reserved for Native packing, encoding and stdout after Adaptive is cut off. */
223
231
  export const CODEX_NATIVE_RESERVE_MS = 800;
224
232
  export const CODEX_ADAPTIVE_BUDGET_MS = CODEX_HOOK_TIMEOUT_MS - CODEX_NATIVE_RESERVE_MS;
233
+ /** Maximum from sending a scoring request to validating its full response. */
234
+ export const CODEX_ADAPTIVE_DECISION_MS = ADAPTIVE_SELECTION_LIMITS.requestTimeoutMs;
225
235
  // stdin, env and cwd are the host CLI contract; `deps` is the optional transport
226
236
  // seam that lets integration tests drive the real entry point without a network.
227
237
  // eslint-disable-next-line @typescript-eslint/max-params
@@ -431,9 +441,8 @@ export async function processHookInvocation(rawStdin, _env = process.env, cwd =
431
441
  env: _env,
432
442
  ...(deps.fetchImpl ? { fetchImpl: deps.fetchImpl } : {}),
433
443
  ...(deps.now ? { now: deps.now } : {}),
434
- ...(deps.firstByteTimeoutMs !== undefined ? { firstByteTimeoutMs: deps.firstByteTimeoutMs } : {}),
435
- ...(deps.generationTimeoutMs !== undefined ? { generationTimeoutMs: deps.generationTimeoutMs } : {}),
436
- ...(deps.minRemainingBudgetMs !== undefined ? { minRemainingBudgetMs: deps.minRemainingBudgetMs } : {}),
444
+ requestTimeoutMs: deps.requestTimeoutMs ?? CODEX_ADAPTIVE_DECISION_MS,
445
+ ...(deps.minExecutableBudgetMs !== undefined ? { minExecutableBudgetMs: deps.minExecutableBudgetMs } : {}),
437
446
  outerDeadlineAt: adaptiveDeadlineAt,
438
447
  onDiagnostic: (line) => { adaptiveDiagnostics.push(adaptiveSelectionDiagnostic(line)); },
439
448
  });
@@ -458,13 +467,15 @@ export async function processHookInvocation(rawStdin, _env = process.env, cwd =
458
467
  ? toolSemanticsResolution.registry
459
468
  : CODEX_TOOL_SEMANTICS;
460
469
  const toolSemanticsDiagnostics = toolSemanticsResolution.ok
461
- ? []
470
+ // ADR-0030: a legacy persisted declaration still loads (degraded to
471
+ // defaults) and must be visible on stderr (rc-9).
472
+ ? toolSemanticsResolution.warnings.map((warning) => diagnostic(warning, 're-run this host so it refreshes its persisted tool declaration'))
462
473
  : [diagnostic(toolSemanticsResolution.reason, toolSemanticsResolution.nextAction)];
463
474
  const result = await createProductionHostRuntime({
464
475
  projectDir: requestedCwd,
465
476
  hostKind: 'codex',
466
477
  toolSemantics,
467
- ...(adaptivePriorityProvider ? { adaptivePriorityProvider } : {}),
478
+ ...(adaptivePriorityProvider ? { adaptiveGapProvider: adaptivePriorityProvider } : {}),
468
479
  ruleContextProvider: createCodexRuleContextProvider({
469
480
  workspaceDir: resolution.workspaceDir,
470
481
  projectDir: requestedCwd,
@@ -21,7 +21,11 @@
21
21
  import { buildToolSemanticRegistry } from '@principles/core/runtime';
22
22
  export const CODEX_TOOL_SEMANTIC_MAPPINGS = Object.freeze([
23
23
  { rawToolName: 'Bash', canonicalKind: 'execute' },
24
- { rawToolName: 'apply_patch', canonicalKind: 'write' },
24
+ // ADR-0030: apply_patch writes a `*** Begin Patch` envelope. The design gate
25
+ // must parse those file headers to know the target paths, and that encoding
26
+ // is not expressible via canonicalKind — declare it instead of matching the
27
+ // raw name downstream.
28
+ { rawToolName: 'apply_patch', canonicalKind: 'write', writePayloadFormat: 'file-header-patch' },
25
29
  ]);
26
30
  const built = buildToolSemanticRegistry(CODEX_TOOL_SEMANTIC_MAPPINGS);
27
31
  if (!built.ok) {
@@ -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, pickDiagnosticianCandidate, PrincipleTreeLedgerAdapter, resolveDiagnosticianCapability, } from '@principles/core/runtime';
31
- import { createWorkspaceBehaviorEvidencePort, createCodexArtificerTrustedFactsPort, loadPdConfigForPlugin, loadFeatureFlagFromConfig, reconcileGovernanceContinuation, runInternalizationConsumerCycle, runStage2CorrectionCycle, createSignalClassifierForWorkspace, saveHostToolDeclaration, } from '@principles/host-runtime';
31
+ import { createWorkspaceBehaviorEvidencePort, createCodexArtificerTrustedFactsPort, loadPdConfigForPlugin, loadFeatureFlagFromConfig, reconcileGovernanceContinuation, runInternalizationConsumerCycle, runStage2CorrectionCycle, createSignalClassifierForWorkspace, saveHostToolDeclaration, HOST_TOOL_DECLARATION_VERSION, } 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';
@@ -179,6 +179,8 @@ export async function runCodexWorkspaceWorkerCycle(options) {
179
179
  // Step 3 — Slice B idempotent reconciliation (always runs; creates no LLM work).
180
180
  const reconcile = await reconcileGovernanceContinuation({
181
181
  workspaceDir,
182
+ codexConversationIngestionEnabled: flags.codex_conversation_ingestion?.enabled === true,
183
+ // Legacy alias for an older installed host-runtime (P2 review).
182
184
  conversationIngestionEnabled: flags.codex_conversation_ingestion?.enabled === true,
183
185
  });
184
186
  // Steps 4–6 — execution authority: internalization_auto_consumer.
@@ -355,7 +357,7 @@ export async function runCodexWorkspaceWorkerCycle(options) {
355
357
  // for host-neutral consumers) and thread the registry into the cycle so
356
358
  // activation-gate replay resolves Codex tool semantics (Bash, not bash).
357
359
  const declared = saveHostToolDeclaration(workspaceDir, {
358
- version: 1,
360
+ version: HOST_TOOL_DECLARATION_VERSION,
359
361
  hostKind: 'codex',
360
362
  mappings: CODEX_TOOL_SEMANTIC_MAPPINGS,
361
363
  declaredAt: new Date().toISOString(),
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principles/codex-adapter",
3
- "version": "0.8.11",
3
+ "version": "0.8.12",
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",
@@ -1,5 +1,20 @@
1
1
  import { clsx } from "clsx";
2
- import { twMerge } from "tailwind-merge";
2
+ import { extendTailwindMerge } from "tailwind-merge";
3
+ /**
4
+ * The §3.1 type scale is declared as `--text-*` theme tokens, so the generated
5
+ * utilities (`text-body`, `text-caption`, …) are font sizes. tailwind-merge
6
+ * cannot tell a custom token apart from a colour utility (`text-ink`), which
7
+ * makes `cn()` silently drop one of the two. Register the scale explicitly.
8
+ */
9
+ const twMerge = extendTailwindMerge({
10
+ extend: {
11
+ classGroups: {
12
+ "font-size": [
13
+ { text: ["display", "title", "subtitle", "body", "reading", "caption", "eyebrow"] },
14
+ ],
15
+ },
16
+ },
17
+ });
3
18
  export function cn(...inputs) {
4
19
  return twMerge(clsx(inputs));
5
20
  }
@@ -101,6 +101,20 @@
101
101
  --color-border: var(--color-line);
102
102
  --color-input: var(--color-line);
103
103
  --color-ring: var(--color-gov);
104
+ --text-display: 28px;
105
+ --text-display--line-height: 36px;
106
+ --text-title: 20px;
107
+ --text-title--line-height: 28px;
108
+ --text-subtitle: 16px;
109
+ --text-subtitle--line-height: 24px;
110
+ --text-body: 14px;
111
+ --text-body--line-height: 22px;
112
+ --text-reading: 16px;
113
+ --text-reading--line-height: 26px;
114
+ --text-caption: 12px;
115
+ --text-caption--line-height: 18px;
116
+ --text-eyebrow: 11px;
117
+ --text-eyebrow--line-height: 16px;
104
118
  --shadow-card: 0 18px 48px rgba(31, 41, 51, .08);
105
119
  --shadow-ring: 0 0 0 3px color-mix(in srgb, #1e3a5f 18%, transparent);
106
120
  @supports (color: color-mix(in lab, red, red)) {
@@ -302,6 +316,9 @@
302
316
  .static {
303
317
  position: static;
304
318
  }
319
+ .sticky {
320
+ position: sticky;
321
+ }
305
322
  .inset-0 {
306
323
  inset: 0px;
307
324
  }
@@ -377,6 +394,9 @@
377
394
  .z-50 {
378
395
  z-index: 50;
379
396
  }
397
+ .col-span-2 {
398
+ grid-column: span 2 / span 2;
399
+ }
380
400
  .container {
381
401
  width: 100%;
382
402
  @media (width >= 40rem) {
@@ -695,6 +715,9 @@
695
715
  .min-h-0 {
696
716
  min-height: 0px;
697
717
  }
718
+ .min-h-8 {
719
+ min-height: calc(var(--spacing) * 8);
720
+ }
698
721
  .min-h-20 {
699
722
  min-height: calc(var(--spacing) * 20);
700
723
  }
@@ -970,6 +993,9 @@
970
993
  .scroll-mt-4 {
971
994
  scroll-margin-top: calc(var(--spacing) * 4);
972
995
  }
996
+ .\[scroll-padding-bottom\:13rem\] {
997
+ scroll-padding-bottom: 13rem;
998
+ }
973
999
  .list-disc {
974
1000
  list-style-type: disc;
975
1001
  }
@@ -982,11 +1008,11 @@
982
1008
  .grid-cols-5 {
983
1009
  grid-template-columns: repeat(5, minmax(0, 1fr));
984
1010
  }
985
- .grid-cols-\[1fr_24px_1fr_24px_1fr_24px_1fr\] {
986
- grid-template-columns: 1fr 24px 1fr 24px 1fr 24px 1fr;
1011
+ .grid-cols-\[12px_minmax\(0\,1fr\)\] {
1012
+ grid-template-columns: 12px minmax(0,1fr);
987
1013
  }
988
- .grid-cols-\[12px_1fr_84px_1fr_1fr_1fr_auto\] {
989
- grid-template-columns: 12px 1fr 84px 1fr 1fr 1fr auto;
1014
+ .grid-cols-\[12px_minmax\(150px\,1fr\)_84px_1fr_1fr_1fr_auto\] {
1015
+ grid-template-columns: 12px minmax(150px,1fr) 84px 1fr 1fr 1fr auto;
990
1016
  }
991
1017
  .grid-cols-\[72px_1fr\] {
992
1018
  grid-template-columns: 72px 1fr;
@@ -1138,6 +1164,10 @@
1138
1164
  margin-block-start: calc(14px * var(--tw-space-y-reverse));
1139
1165
  margin-block-end: calc(14px * calc(1 - var(--tw-space-y-reverse)));
1140
1166
  }
1167
+ .gap-x-2 {
1168
+ -moz-column-gap: calc(var(--spacing) * 2);
1169
+ column-gap: calc(var(--spacing) * 2);
1170
+ }
1141
1171
  .gap-x-3 {
1142
1172
  -moz-column-gap: calc(var(--spacing) * 3);
1143
1173
  column-gap: calc(var(--spacing) * 3);
@@ -1150,6 +1180,10 @@
1150
1180
  -moz-column-gap: calc(var(--spacing) * 6);
1151
1181
  column-gap: calc(var(--spacing) * 6);
1152
1182
  }
1183
+ .gap-x-\[8px\] {
1184
+ -moz-column-gap: 8px;
1185
+ column-gap: 8px;
1186
+ }
1153
1187
  .gap-x-\[14px\] {
1154
1188
  -moz-column-gap: 14px;
1155
1189
  column-gap: 14px;
@@ -1774,6 +1808,12 @@
1774
1808
  .bg-paper-2 {
1775
1809
  background-color: var(--color-paper-2);
1776
1810
  }
1811
+ .bg-paper\/95 {
1812
+ background-color: color-mix(in srgb, #f7f3ea 95%, transparent);
1813
+ @supports (color: color-mix(in lab, red, red)) {
1814
+ background-color: color-mix(in oklab, var(--color-paper) 95%, transparent);
1815
+ }
1816
+ }
1777
1817
  .bg-popover {
1778
1818
  background-color: var(--color-popover);
1779
1819
  }
@@ -1879,6 +1919,9 @@
1879
1919
  .p-8 {
1880
1920
  padding: calc(var(--spacing) * 8);
1881
1921
  }
1922
+ .p-\[13px\] {
1923
+ padding: 13px;
1924
+ }
1882
1925
  .px-0 {
1883
1926
  padding-inline: 0px;
1884
1927
  }
@@ -2062,9 +2105,15 @@
2062
2105
  .pb-2\.5 {
2063
2106
  padding-bottom: calc(var(--spacing) * 2.5);
2064
2107
  }
2108
+ .pb-3 {
2109
+ padding-bottom: calc(var(--spacing) * 3);
2110
+ }
2065
2111
  .pb-4 {
2066
2112
  padding-bottom: calc(var(--spacing) * 4);
2067
2113
  }
2114
+ .pb-40 {
2115
+ padding-bottom: calc(var(--spacing) * 40);
2116
+ }
2068
2117
  .pb-\[12px\] {
2069
2118
  padding-bottom: 12px;
2070
2119
  }
@@ -2118,72 +2167,58 @@
2118
2167
  font-size: var(--text-base);
2119
2168
  line-height: var(--tw-leading, var(--text-base--line-height));
2120
2169
  }
2170
+ .text-body {
2171
+ font-size: var(--text-body);
2172
+ line-height: var(--tw-leading, var(--text-body--line-height));
2173
+ }
2174
+ .text-caption {
2175
+ font-size: var(--text-caption);
2176
+ line-height: var(--tw-leading, var(--text-caption--line-height));
2177
+ }
2178
+ .text-display {
2179
+ font-size: var(--text-display);
2180
+ line-height: var(--tw-leading, var(--text-display--line-height));
2181
+ }
2182
+ .text-eyebrow {
2183
+ font-size: var(--text-eyebrow);
2184
+ line-height: var(--tw-leading, var(--text-eyebrow--line-height));
2185
+ }
2121
2186
  .text-lg {
2122
2187
  font-size: var(--text-lg);
2123
2188
  line-height: var(--tw-leading, var(--text-lg--line-height));
2124
2189
  }
2190
+ .text-reading {
2191
+ font-size: var(--text-reading);
2192
+ line-height: var(--tw-leading, var(--text-reading--line-height));
2193
+ }
2125
2194
  .text-sm {
2126
2195
  font-size: var(--text-sm);
2127
2196
  line-height: var(--tw-leading, var(--text-sm--line-height));
2128
2197
  }
2198
+ .text-subtitle {
2199
+ font-size: var(--text-subtitle);
2200
+ line-height: var(--tw-leading, var(--text-subtitle--line-height));
2201
+ }
2202
+ .text-title {
2203
+ font-size: var(--text-title);
2204
+ line-height: var(--tw-leading, var(--text-title--line-height));
2205
+ }
2129
2206
  .text-xs {
2130
2207
  font-size: var(--text-xs);
2131
2208
  line-height: var(--tw-leading, var(--text-xs--line-height));
2132
2209
  }
2133
- .text-\[9\.5px\] {
2134
- font-size: 9.5px;
2135
- }
2136
- .text-\[9px\] {
2137
- font-size: 9px;
2138
- }
2139
- .text-\[10\.5px\] {
2140
- font-size: 10.5px;
2141
- }
2142
- .text-\[10px\] {
2143
- font-size: 10px;
2144
- }
2145
- .text-\[11\.5px\] {
2146
- font-size: 11.5px;
2147
- }
2148
2210
  .text-\[11px\] {
2149
2211
  font-size: 11px;
2150
2212
  }
2151
- .text-\[12\.5px\] {
2152
- font-size: 12.5px;
2153
- }
2154
2213
  .text-\[12px\] {
2155
2214
  font-size: 12px;
2156
2215
  }
2157
2216
  .text-\[13\.5px\] {
2158
2217
  font-size: 13.5px;
2159
2218
  }
2160
- .text-\[13px\] {
2161
- font-size: 13px;
2162
- }
2163
2219
  .text-\[14px\] {
2164
2220
  font-size: 14px;
2165
2221
  }
2166
- .text-\[15px\] {
2167
- font-size: 15px;
2168
- }
2169
- .text-\[16px\] {
2170
- font-size: 16px;
2171
- }
2172
- .text-\[17px\] {
2173
- font-size: 17px;
2174
- }
2175
- .text-\[18px\] {
2176
- font-size: 18px;
2177
- }
2178
- .text-\[20px\] {
2179
- font-size: 20px;
2180
- }
2181
- .text-\[22px\] {
2182
- font-size: 22px;
2183
- }
2184
- .text-\[29px\] {
2185
- font-size: 29px;
2186
- }
2187
2222
  .leading-\[1\.4\] {
2188
2223
  --tw-leading: 1.4;
2189
2224
  line-height: 1.4;
@@ -2303,6 +2338,9 @@
2303
2338
  .whitespace-pre-wrap {
2304
2339
  white-space: pre-wrap;
2305
2340
  }
2341
+ .text-\[Npx\] {
2342
+ color: Npx;
2343
+ }
2306
2344
  .text-amber {
2307
2345
  color: var(--color-amber);
2308
2346
  }
@@ -2512,6 +2550,10 @@
2512
2550
  .filter {
2513
2551
  filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);
2514
2552
  }
2553
+ .backdrop-blur {
2554
+ --tw-backdrop-blur: blur(8px);
2555
+ backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);
2556
+ }
2515
2557
  .backdrop-blur-sm {
2516
2558
  --tw-backdrop-blur: blur(var(--blur-sm));
2517
2559
  backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);
@@ -3063,9 +3105,24 @@
3063
3105
  }
3064
3106
  }
3065
3107
  @media (width >= 48rem) {
3108
+ .md\:col-span-1 {
3109
+ grid-column: span 1 / span 1;
3110
+ }
3111
+ .md\:block {
3112
+ display: block;
3113
+ }
3114
+ .md\:grid {
3115
+ display: grid;
3116
+ }
3117
+ .md\:hidden {
3118
+ display: none;
3119
+ }
3066
3120
  .md\:w-48 {
3067
3121
  width: calc(var(--spacing) * 48);
3068
3122
  }
3123
+ .md\:rotate-0 {
3124
+ rotate: 0deg;
3125
+ }
3069
3126
  .md\:grid-cols-2 {
3070
3127
  grid-template-columns: repeat(2, minmax(0, 1fr));
3071
3128
  }
@@ -3075,14 +3132,55 @@
3075
3132
  .md\:grid-cols-5 {
3076
3133
  grid-template-columns: repeat(5, minmax(0, 1fr));
3077
3134
  }
3135
+ .md\:grid-cols-\[1fr_24px_1fr_24px_1fr_24px_1fr\] {
3136
+ grid-template-columns: 1fr 24px 1fr 24px 1fr 24px 1fr;
3137
+ }
3138
+ .md\:grid-cols-\[12px_minmax\(150px\,1fr\)_84px_1fr_1fr_1fr_auto\] {
3139
+ grid-template-columns: 12px minmax(150px,1fr) 84px 1fr 1fr 1fr auto;
3140
+ }
3141
+ .md\:grid-cols-\[auto_minmax\(0\,1fr\)_minmax\(0\,1fr\)_auto_minmax\(0\,1fr\)_auto_minmax\(0\,1fr\)_auto_auto\] {
3142
+ grid-template-columns: auto minmax(0,1fr) minmax(0,1fr) auto minmax(0,1fr) auto minmax(0,1fr) auto auto;
3143
+ }
3078
3144
  .md\:flex-row {
3079
3145
  flex-direction: row;
3080
3146
  }
3147
+ .md\:items-center {
3148
+ align-items: center;
3149
+ }
3081
3150
  .md\:items-start {
3082
3151
  align-items: flex-start;
3083
3152
  }
3153
+ .md\:justify-end {
3154
+ justify-content: flex-end;
3155
+ }
3156
+ .md\:gap-3 {
3157
+ gap: calc(var(--spacing) * 3);
3158
+ }
3159
+ .md\:gap-\[10px\] {
3160
+ gap: 10px;
3161
+ }
3162
+ .md\:truncate {
3163
+ overflow: hidden;
3164
+ text-overflow: ellipsis;
3165
+ white-space: nowrap;
3166
+ }
3167
+ .md\:px-\[16px\] {
3168
+ padding-inline: 16px;
3169
+ }
3170
+ .md\:py-2 {
3171
+ padding-block: calc(var(--spacing) * 2);
3172
+ }
3173
+ .md\:text-center {
3174
+ text-align: center;
3175
+ }
3176
+ .md\:whitespace-nowrap {
3177
+ white-space: nowrap;
3178
+ }
3084
3179
  }
3085
3180
  @media (width >= 64rem) {
3181
+ .lg\:left-\[256px\] {
3182
+ left: 256px;
3183
+ }
3086
3184
  .lg\:col-span-2 {
3087
3185
  grid-column: span 2 / span 2;
3088
3186
  }
@@ -3591,6 +3689,9 @@
3591
3689
  padding-top: 0;
3592
3690
  padding-left: 28px;
3593
3691
  }
3692
+ .owner-workbench:has(.owner-work-approval) .owner-work-list {
3693
+ padding-bottom: 9rem;
3694
+ }
3594
3695
  }
3595
3696
  @property --tw-translate-x {
3596
3697
  syntax: "*";