agent-control-plane-core 0.2.7 → 0.2.8
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/package.json +5 -1
- package/src/adapters/codex.mjs +11 -8
- package/types/adapters/codex.d.mts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-control-plane-core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Vendor-neutral control-plane contract for coding agents: a normalized ToolCallEvent/Verdict schema with per-agent adapters (Claude Code, Codex, Amp, Gemini CLI) and a conformance suite.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -93,11 +93,15 @@
|
|
|
93
93
|
"ruff format"
|
|
94
94
|
]
|
|
95
95
|
},
|
|
96
|
+
"dependencies": {
|
|
97
|
+
"semver": "^7.6.3"
|
|
98
|
+
},
|
|
96
99
|
"devDependencies": {
|
|
97
100
|
"@commitlint/cli": "^21.0.1",
|
|
98
101
|
"@commitlint/config-conventional": "^21.0.1",
|
|
99
102
|
"@eslint/js": "^9.13.0",
|
|
100
103
|
"@types/node": "^22.7.0",
|
|
104
|
+
"@types/semver": "^7.5.8",
|
|
101
105
|
"c8": "^10.1.2",
|
|
102
106
|
"eslint": "^9.13.0",
|
|
103
107
|
"fast-check": "^3.22.0",
|
package/src/adapters/codex.mjs
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
* the adapter must not pretend to enforce on an old Codex.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
import semver from "semver";
|
|
15
|
+
|
|
14
16
|
import {
|
|
15
17
|
EventKind,
|
|
16
18
|
Decision,
|
|
@@ -55,6 +57,9 @@ export const COVERAGE = Object.freeze({
|
|
|
55
57
|
/** Minimum Codex version whose hook can actually veto a tool call. */
|
|
56
58
|
export const MIN_ENFORCING_VERSION = Object.freeze([0, 135]);
|
|
57
59
|
|
|
60
|
+
/** {@link MIN_ENFORCING_VERSION} as the semver string the gate compares against. */
|
|
61
|
+
const MIN_ENFORCING_SEMVER = `${MIN_ENFORCING_VERSION[0]}.${MIN_ENFORCING_VERSION[1]}.0`;
|
|
62
|
+
|
|
58
63
|
// Both native events gate a tool call; PermissionRequest is the ask-tier veto.
|
|
59
64
|
const GATING_EVENTS = new Set(["PreToolUse", "PermissionRequest"]);
|
|
60
65
|
|
|
@@ -75,18 +80,16 @@ const CONSUMED = new Set([
|
|
|
75
80
|
|
|
76
81
|
/**
|
|
77
82
|
* True when `version` ("0.135.0") is at or above {@link MIN_ENFORCING_VERSION}.
|
|
78
|
-
*
|
|
83
|
+
* `semver.coerce` normalizes a patch/prerelease/build-tagged version to its
|
|
84
|
+
* release core; anything it can't coerce to a valid version (missing, empty,
|
|
85
|
+
* garbage) yields `null` and is treated as too old — fail closed to advisory.
|
|
79
86
|
* @param {unknown} version
|
|
80
87
|
* @returns {boolean}
|
|
81
88
|
*/
|
|
82
89
|
export function canEnforce(version) {
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (!Number.isInteger(major) || !Number.isInteger(minor)) return false;
|
|
87
|
-
if (major !== MIN_ENFORCING_VERSION[0])
|
|
88
|
-
return major > MIN_ENFORCING_VERSION[0];
|
|
89
|
-
return minor >= MIN_ENFORCING_VERSION[1];
|
|
90
|
+
const coerced = semver.coerce(asString(version, ""));
|
|
91
|
+
if (coerced === null) return false;
|
|
92
|
+
return semver.gte(coerced, MIN_ENFORCING_SEMVER);
|
|
90
93
|
}
|
|
91
94
|
|
|
92
95
|
/**
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* True when `version` ("0.135.0") is at or above {@link MIN_ENFORCING_VERSION}.
|
|
3
|
-
*
|
|
3
|
+
* `semver.coerce` normalizes a patch/prerelease/build-tagged version to its
|
|
4
|
+
* release core; anything it can't coerce to a valid version (missing, empty,
|
|
5
|
+
* garbage) yields `null` and is treated as too old — fail closed to advisory.
|
|
4
6
|
* @param {unknown} version
|
|
5
7
|
* @returns {boolean}
|
|
6
8
|
*/
|