@principles/codex-adapter 0.9.0 → 0.10.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.
@@ -3,23 +3,25 @@
3
3
  * Slice A; ADR-0020 §11.2 + G1 probe report §9).
4
4
  *
5
5
  * The G1 contract baseline is: minimum supported Codex 0.148.0, verified
6
- * on-device at 0.150.1 and re-verified at 0.162.1 (PRI-953, 2026-10-13:
7
- * on-device probe against real codex-cli 0.162.1 — 125/125 captured hook
8
- * payloads decode, 8/8 real rollout transcripts ingest with only designed
9
- * unknown-record-type skips; sanitized fixtures:
10
- * tests/fixtures/g1-contract/hook-payloads/v0.162.1/ and
11
- * transcripts/v0.162.1-tool-final-turn.jsonl). The transcript itself carries
12
- * `session_meta.payload.cli_version`, which is the version signal available
13
- * inside a hook subprocess (hook payloads carry no version field — G1
14
- * fixture contract).
6
+ * on-device at 0.150.1, re-verified at 0.162.1 (PRI-953, 2026-10-13), and
7
+ * re-verified again at 0.167.0-alpha.4.1 (2026-11-13): the installed adapter
8
+ * decoded a real 4.4 MB rollout transcript (48 observations, including
9
+ * assistant turns) and a real Stop payload from that device, and the
10
+ * sanitized capture is pinned as
11
+ * tests/fixtures/g1-contract/transcripts/v0.167.0-alpha.4.1-tool-final-turn.jsonl.
12
+ * The transcript itself carries `session_meta.payload.cli_version`, which is
13
+ * the version signal available inside a hook subprocess (hook payloads carry
14
+ * no version field — G1 fixture contract).
15
15
  *
16
- * Older-than-minimum and newer-than-verified versions both degrade
17
- * explicitly; an unknown version must never silently guess record fields.
16
+ * Version comparison is on the core `MAJOR.MINOR.PATCH` triplet only:
17
+ * prerelease/build suffixes describe a distribution channel, not a different
18
+ * record contract, and the contract itself is pinned by the fixture probe.
19
+ * An unknown or malformed version must never silently guess record fields.
18
20
  * Adopting a newer Codex version requires re-running the contract probe and
19
21
  * refreshing the fixtures (G1 report §9 drift-detection boundary).
20
22
  */
21
23
  export declare const CODEX_INGESTION_MIN_VERSION = "0.148.0";
22
- export declare const CODEX_INGESTION_VERIFIED_VERSION = "0.162.1";
24
+ export declare const CODEX_INGESTION_VERIFIED_VERSION = "0.167.0";
23
25
  export type CodexVersionClassification = {
24
26
  status: 'supported';
25
27
  } | {
@@ -3,36 +3,35 @@
3
3
  * Slice A; ADR-0020 §11.2 + G1 probe report §9).
4
4
  *
5
5
  * The G1 contract baseline is: minimum supported Codex 0.148.0, verified
6
- * on-device at 0.150.1 and re-verified at 0.162.1 (PRI-953, 2026-10-13:
7
- * on-device probe against real codex-cli 0.162.1 — 125/125 captured hook
8
- * payloads decode, 8/8 real rollout transcripts ingest with only designed
9
- * unknown-record-type skips; sanitized fixtures:
10
- * tests/fixtures/g1-contract/hook-payloads/v0.162.1/ and
11
- * transcripts/v0.162.1-tool-final-turn.jsonl). The transcript itself carries
12
- * `session_meta.payload.cli_version`, which is the version signal available
13
- * inside a hook subprocess (hook payloads carry no version field — G1
14
- * fixture contract).
6
+ * on-device at 0.150.1, re-verified at 0.162.1 (PRI-953, 2026-10-13), and
7
+ * re-verified again at 0.167.0-alpha.4.1 (2026-11-13): the installed adapter
8
+ * decoded a real 4.4 MB rollout transcript (48 observations, including
9
+ * assistant turns) and a real Stop payload from that device, and the
10
+ * sanitized capture is pinned as
11
+ * tests/fixtures/g1-contract/transcripts/v0.167.0-alpha.4.1-tool-final-turn.jsonl.
12
+ * The transcript itself carries `session_meta.payload.cli_version`, which is
13
+ * the version signal available inside a hook subprocess (hook payloads carry
14
+ * no version field — G1 fixture contract).
15
15
  *
16
- * Older-than-minimum and newer-than-verified versions both degrade
17
- * explicitly; an unknown version must never silently guess record fields.
16
+ * Version comparison is on the core `MAJOR.MINOR.PATCH` triplet only:
17
+ * prerelease/build suffixes describe a distribution channel, not a different
18
+ * record contract, and the contract itself is pinned by the fixture probe.
19
+ * An unknown or malformed version must never silently guess record fields.
18
20
  * Adopting a newer Codex version requires re-running the contract probe and
19
21
  * refreshing the fixtures (G1 report §9 drift-detection boundary).
20
22
  */
21
23
  export const CODEX_INGESTION_MIN_VERSION = '0.148.0';
22
- export const CODEX_INGESTION_VERIFIED_VERSION = '0.162.1';
24
+ export const CODEX_INGESTION_VERIFIED_VERSION = '0.167.0';
23
25
  export const CODEX_VERSION_NEXT_ACTION = 'rerun the Codex contract probe / update supported fixtures (docs/architecture/CODEX_G1_CONTRACT_PROBE_REPORT.md §9)';
24
- function isDigits(value) {
25
- return value.length > 0 && /^[0-9]+$/.test(value);
26
- }
26
+ /** `1.2.3`, optional `-prerelease` / `+build`; anything else is not a version signal we trust. */
27
+ const SEMVER_PATTERN = /^(\d+)\.(\d+)\.(\d+)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
27
28
  function parseSemver(value) {
28
- const parts = value.trim().split('.');
29
- if (parts.length < 3)
29
+ const match = SEMVER_PATTERN.exec(value.trim());
30
+ if (match === null)
30
31
  return null;
31
- const [major, minor, patch] = parts;
32
+ const [, major, minor, patch] = match;
32
33
  if (major === undefined || minor === undefined || patch === undefined)
33
34
  return null;
34
- if (!isDigits(major) || !isDigits(minor) || !isDigits(patch))
35
- return null;
36
35
  return { major: Number(major), minor: Number(minor), patch: Number(patch) };
37
36
  }
38
37
  function compareSemver(a, b) {
@@ -8,7 +8,7 @@
8
8
  * never fire on a real Codex event.
9
9
  *
10
10
  * EVIDENCE BOUND: this declaration contains only names with in-repo
11
- * evidence — the shipped hook matcher `Bash|apply_patch`
11
+ * evidence — the shipped hook matcher `Bash|apply_patch|pd_submit_pain`
12
12
  * (plugins/principles-disciple/hooks/hooks.json:5, locked by
13
13
  * packages/codex-adapter/tests/codex-plugin-bundle.test.ts:183 and used as
14
14
  * the installed-hook fixture in
@@ -17,6 +17,16 @@
17
17
  * Codex tool surface is tracked as PRI-657 — a wrong guess would be worse
18
18
  * than a gap (the reliability check rejects undeclared names, forcing
19
19
  * correct names).
20
+ *
21
+ * OG-4 DELIBERATE OMISSION (2026-11-13): the PreToolUse matcher now also
22
+ * routes `pd_submit_pain` (the shared MCP write tool) so the hook OBSERVES the
23
+ * call, but the name is intentionally NOT declared here. `CanonicalKind` is a
24
+ * file-mutation axis: `write` feeds `computeBehaviorFacts.writeCount` and
25
+ * disables the `'other' ⇒ facts incomplete` conservative guard. Declaring a
26
+ * ledger write as a file write would fabricate file-level facts, and the
27
+ * payload carries no target path. Until the enum grows a non-file mutation
28
+ * kind (or host-sampled events justify a mapping), it resolves to `'other'`,
29
+ * which the provider treats as an incomplete semantic view.
20
30
  */
21
31
  import { type ToolSemanticMappingV1, type ToolSemanticRegistry } from '@principles/core/runtime';
22
32
  export declare const CODEX_TOOL_SEMANTIC_MAPPINGS: readonly ToolSemanticMappingV1[];
@@ -8,7 +8,7 @@
8
8
  * never fire on a real Codex event.
9
9
  *
10
10
  * EVIDENCE BOUND: this declaration contains only names with in-repo
11
- * evidence — the shipped hook matcher `Bash|apply_patch`
11
+ * evidence — the shipped hook matcher `Bash|apply_patch|pd_submit_pain`
12
12
  * (plugins/principles-disciple/hooks/hooks.json:5, locked by
13
13
  * packages/codex-adapter/tests/codex-plugin-bundle.test.ts:183 and used as
14
14
  * the installed-hook fixture in
@@ -17,6 +17,16 @@
17
17
  * Codex tool surface is tracked as PRI-657 — a wrong guess would be worse
18
18
  * than a gap (the reliability check rejects undeclared names, forcing
19
19
  * correct names).
20
+ *
21
+ * OG-4 DELIBERATE OMISSION (2026-11-13): the PreToolUse matcher now also
22
+ * routes `pd_submit_pain` (the shared MCP write tool) so the hook OBSERVES the
23
+ * call, but the name is intentionally NOT declared here. `CanonicalKind` is a
24
+ * file-mutation axis: `write` feeds `computeBehaviorFacts.writeCount` and
25
+ * disables the `'other' ⇒ facts incomplete` conservative guard. Declaring a
26
+ * ledger write as a file write would fabricate file-level facts, and the
27
+ * payload carries no target path. Until the enum grows a non-file mutation
28
+ * kind (or host-sampled events justify a mapping), it resolves to `'other'`,
29
+ * which the provider treats as an incomplete semantic view.
20
30
  */
21
31
  import { buildToolSemanticRegistry } from '@principles/core/runtime';
22
32
  export const CODEX_TOOL_SEMANTIC_MAPPINGS = Object.freeze([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principles/codex-adapter",
3
- "version": "0.9.0",
3
+ "version": "0.10.1",
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",
@@ -33,8 +33,8 @@
33
33
  "lint": "eslint \"src/**/*.ts\""
34
34
  },
35
35
  "dependencies": {
36
- "@principles/core": "^7.5.0",
37
- "@principles/host-runtime": "^4.0.0",
36
+ "@principles/core": "^7.6.2",
37
+ "@principles/host-runtime": "^4.1.2",
38
38
  "@principles/install-layout": "^0.8.0"
39
39
  },
40
40
  "devDependencies": {
@@ -52,5 +52,5 @@
52
52
  "publishConfig": {
53
53
  "access": "public"
54
54
  },
55
- "gitHead": "95d49f9eae5bf499fc8e4f36fecb0ad5a490f05b"
55
+ "gitHead": "80b43dd1b98d261b580215cff8b815594606178c"
56
56
  }