@principles/codex-adapter 0.5.8 → 0.5.10
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/dist/codec/input-decoder.js +11 -3
- package/package.json +3 -3
|
@@ -59,10 +59,15 @@ function validateCommon(raw, needsTurn) {
|
|
|
59
59
|
const sessionId = requiredString(raw, 'session_id');
|
|
60
60
|
requiredNullableString(raw, 'transcript_path');
|
|
61
61
|
const workspaceDir = requiredString(raw, 'cwd');
|
|
62
|
-
|
|
62
|
+
// SPEC-PD-MODEL-AWARE-PROMPT-BUDGET-001: keep the VALIDATED model identity
|
|
63
|
+
// (was: checked then discarded). It is an identity string only — never a
|
|
64
|
+
// capacity; the budget resolver turns it into a budget via the installed
|
|
65
|
+
// catalog, falling back to the fixed budget on unknown/ambiguous ids. It
|
|
66
|
+
// must not block the hook or leak into tool allow/deny decisions.
|
|
67
|
+
const modelId = requiredString(raw, 'model');
|
|
63
68
|
requiredString(raw, 'permission_mode');
|
|
64
69
|
const turnId = needsTurn ? requiredString(raw, 'turn_id') : undefined;
|
|
65
|
-
return { workspaceDir, sessionId, ...(turnId ? { turnId } : {}) };
|
|
70
|
+
return { base: { workspaceDir, sessionId, ...(turnId ? { turnId } : {}) }, modelId };
|
|
66
71
|
}
|
|
67
72
|
export function decodeCodexInput(raw) {
|
|
68
73
|
if (!isRecord(raw))
|
|
@@ -71,7 +76,10 @@ export function decodeCodexInput(raw) {
|
|
|
71
76
|
const kind = EVENT_KINDS.get(eventName);
|
|
72
77
|
if (!kind)
|
|
73
78
|
throw new CodexDecoderError(`unknown hook_event_name "${eventName}"`, 'Configure only PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, or Stop.');
|
|
74
|
-
const
|
|
79
|
+
const { base, modelId } = validateCommon(raw, kind !== 'session_start');
|
|
80
|
+
// Model identity rides every event context under modelContext (budget
|
|
81
|
+
// resolution happens on the prompt path; other paths carry it harmlessly).
|
|
82
|
+
const common = { ...base, modelContext: { modelId } };
|
|
75
83
|
let context;
|
|
76
84
|
let rawPayload = raw;
|
|
77
85
|
if (kind === 'before_tool_call' || kind === 'after_tool_call') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principles/codex-adapter",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.10",
|
|
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": "^1.
|
|
37
|
-
"@principles/host-runtime": "^0.
|
|
36
|
+
"@principles/core": "^1.295.0",
|
|
37
|
+
"@principles/host-runtime": "^0.12.0",
|
|
38
38
|
"@principles/install-layout": "^0.4.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|