@unblocklabs/unblock-codex-prompt 0.7.1 → 0.7.2

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/adapter.js CHANGED
@@ -31,6 +31,20 @@ const SPLIT_PERSONA_CONTEXT_HASHES = {
31
31
  buildCodexThreadConfiguration: "f485f775aef22bbc670f2beeb6a6742a9f371736f464cd03fd070812c95aecc2",
32
32
  splitCodexExtraSystemPrompt: "3c7c1f37252269c00218f7cbd4c21425a9d81014429dbd6b00f9252b6ea097a0",
33
33
  };
34
+ // 2026.11.12 extracts OpenClaw's generic instructions into resolveCodexOpenClawBaseInstructions
35
+ // and placeCodexBaseInstructions, which runs after buildCodexThreadConfiguration in thread/start
36
+ // and thread/resume and would otherwise prepend OpenClaw's base into <thread_policy> whenever
37
+ // config.toml authors model_instructions_file.
38
+ const BASE_PLACEMENT_CONTEXT_HASHES = {
39
+ ...SPLIT_PERSONA_CONTEXT_HASHES,
40
+ buildDeveloperInstructions: "cff5a99457b10ff641b86e755e633eec23589faf7f152b7fae25ea9cd15f70e1",
41
+ buildCodexWorkspaceBootstrapContext: "9a4d4e6fb2f12d300e02cafd280c9b71f7f38d18a1b519416551d9f7cf856897",
42
+ renderCodexSkillsInstructions: "36a5ef969f1978910d741cc8cecbea3f6aa720a9cec320d9a840810b634cb02b",
43
+ prepareCodexAttemptContext: "ef2bccce22612863e95e6cd928b3695927becb25daefcbd84c4e5894a2064360",
44
+ buildCodexThreadConfiguration: "a03018bee49d0aa23a9d2c8cea21fcbf66f93a45e6379fbe0d55989680874603",
45
+ resolveCodexOpenClawBaseInstructions: "159dc3d22aebcc99a19d41d4c992be9d1de295a5e647effc7c43aa2a636df7df",
46
+ placeCodexBaseInstructions: "6bc14dbf1910f21cb09faf27f3a9ddfa720cd38168d9ccbe2c67ab47e581d22b",
47
+ };
34
48
  function receiptPath(agentDir) { return join(agentDir, "codex-home", ".unblock-codex-prompt-adapter.json"); }
35
49
  function receiptFiles(receipt) {
36
50
  if (receipt.schema === 2)
@@ -159,12 +173,20 @@ export function patchAdapterSources(sources, agentDir, agentId) {
159
173
  throw new Error(`Unsupported Codex context layout; live agent context requires @openclaw/codex >=${MINIMUM_OPENCLAW}`);
160
174
  }
161
175
  const workspace = find("buildCodexWorkspaceBootstrapContext");
162
- const splitPersona = sha256(sources[workspace.bundle].slice(workspace.node.start, workspace.node.end)) === SPLIT_PERSONA_CONTEXT_HASHES.buildCodexWorkspaceBootstrapContext;
176
+ const workspaceHash = sha256(sources[workspace.bundle].slice(workspace.node.start, workspace.node.end));
177
+ const layout = workspaceHash === BASE_PLACEMENT_CONTEXT_HASHES.buildCodexWorkspaceBootstrapContext
178
+ ? "basePlacement"
179
+ : workspaceHash === SPLIT_PERSONA_CONTEXT_HASHES.buildCodexWorkspaceBootstrapContext
180
+ ? "splitPersona"
181
+ : "refreshable";
163
182
  const prefix = bridgePrefix(agentDir, agentId);
164
- return patchOperationalAdapter(patchRefreshableAdapter(sources, find, prefix, splitPersona), prefix, splitPersona);
183
+ return patchOperationalAdapter(patchRefreshableAdapter(sources, find, prefix, layout), prefix, layout);
165
184
  }
166
- function patchRefreshableAdapter(sources, find, prefix, splitPersona) {
167
- for (const [name, expected] of Object.entries(splitPersona ? SPLIT_PERSONA_CONTEXT_HASHES : REFRESHABLE_CONTEXT_HASHES)) {
185
+ function patchRefreshableAdapter(sources, find, prefix, layout) {
186
+ const splitPersona = layout !== "refreshable";
187
+ const basePlacement = layout === "basePlacement";
188
+ const expectedHashes = basePlacement ? BASE_PLACEMENT_CONTEXT_HASHES : splitPersona ? SPLIT_PERSONA_CONTEXT_HASHES : REFRESHABLE_CONTEXT_HASHES;
189
+ for (const [name, expected] of Object.entries(expectedHashes)) {
168
190
  const { node, bundle } = find(name);
169
191
  if (sha256(sources[bundle].slice(node.start, node.end)) !== expected) {
170
192
  throw new Error("Unsupported Codex context assembly: " + name + "; review the changed upstream function before syncing");
@@ -181,7 +203,7 @@ function patchRefreshableAdapter(sources, find, prefix, splitPersona) {
181
203
  // turn with the new base; Codex keeps base instructions out of history and compaction. The
182
204
  // model_instructions_file pointer to the same file remains the fallback.
183
205
  const threadWrapper = `function buildCodexThreadConfiguration(params, options) {
184
- const base = unblockBaseInstructions(params, options);
206
+ const base = ${basePlacement ? "isCodexRingZeroThread(params, options?.hostSystemAgentActive) ? null : " : ""}unblockBaseInstructions(params, options);
185
207
  const request = unblockOriginalThreadConfiguration(params, options);
186
208
  return base === null ? request : { ...request, baseInstructions: base };
187
209
  }
@@ -231,6 +253,32 @@ function patchRefreshableAdapter(sources, find, prefix, splitPersona) {
231
253
  { bundle: workspace.bundle, start: workspace.node.start, end: workspace.node.end, text: wrapper + originalWorkspace },
232
254
  { bundle: thread.bundle, start: thread.node.start, end: thread.node.end, text: threadWrapper + originalThread },
233
255
  ];
256
+ if (basePlacement) {
257
+ const resolveBase = find("resolveCodexOpenClawBaseInstructions");
258
+ const originalResolveBase = sources[resolveBase.bundle].slice(resolveBase.node.start, resolveBase.node.end)
259
+ .replace("function resolveCodexOpenClawBaseInstructions(", "function unblockOriginalResolveCodexOpenClawBaseInstructions(");
260
+ const resolveBaseWrapper = `function resolveCodexOpenClawBaseInstructions(params, options) {
261
+ if (unblockFrozenPolicy(params) !== null) return void 0;
262
+ return unblockOriginalResolveCodexOpenClawBaseInstructions(params, options);
263
+ }
264
+ `;
265
+ const placeBase = find("placeCodexBaseInstructions");
266
+ const originalPlaceBase = sources[placeBase.bundle].slice(placeBase.node.start, placeBase.node.end)
267
+ .replace("function placeCodexBaseInstructions(", "function unblockOriginalPlaceCodexBaseInstructions(");
268
+ const placeBaseWrapper = `function placeCodexBaseInstructions(params, options, developerInstructions, ringZero) {
269
+ if (isCodexRingZeroThread(params, options.hostSystemAgentActive)) {
270
+ return unblockOriginalPlaceCodexBaseInstructions(params, options, developerInstructions, ringZero);
271
+ }
272
+ const base = unblockBaseInstructions(params, options);
273
+ if (base === null) return unblockOriginalPlaceCodexBaseInstructions(params, options, developerInstructions, ringZero);
274
+ return {
275
+ baseInstructions: base,
276
+ developerInstructions: renderCodexThreadPolicy(developerInstructions),
277
+ };
278
+ }
279
+ `;
280
+ edits.push({ bundle: resolveBase.bundle, start: resolveBase.node.start, end: resolveBase.node.end, text: resolveBaseWrapper + originalResolveBase }, { bundle: placeBase.bundle, start: placeBase.node.start, end: placeBase.node.end, text: placeBaseWrapper + originalPlaceBase });
281
+ }
234
282
  return sources.map((source, bundle) => {
235
283
  const selected = edits.filter(edit => edit.bundle === bundle).sort((a, b) => b.start - a.start);
236
284
  for (const edit of selected)
@@ -244,11 +292,17 @@ const OPERATIONAL_HASHES = {
244
292
  resumeExistingCodexThread: "1b8d4038ee162b276095d9f3e1ad771f33c7cd794c47fb5088783dae9e7c1494",
245
293
  refreshCodexThreadPolicy: "69d6e9903896c77e71542957dbadddaca5d3cbb4d7cd56b8ff0de2a5ca42b995",
246
294
  };
247
- function patchOperationalAdapter(sources, prefix, splitPersona) {
295
+ function patchOperationalAdapter(sources, prefix, layout) {
296
+ const splitPersona = layout !== "refreshable";
297
+ const basePlacement = layout === "basePlacement";
248
298
  const functionsByBundle = sources.map(source => parse(source, { ecmaVersion: "latest", sourceType: "module" }).body
249
299
  .filter(node => node.type === "FunctionDeclaration"));
250
300
  const names = functionsByBundle.flat().map(node => node.id?.name);
251
- const hashes = splitPersona ? { ...OPERATIONAL_HASHES,
301
+ const hashes = basePlacement ? { ...OPERATIONAL_HASHES,
302
+ buildTurnStartParams: "734558ecc9adf1193ea338a848d032140a36a5a64cc4f8461a988b7c02771e1a",
303
+ resumeExistingCodexThread: "3632b8872027a4aaed62ba1eb8a9f9f45a6b5b72d78e49fddc4dca06d44ec042",
304
+ refreshCodexThreadPolicy: "1d4b982cf47ec9ea6f09a6d90d3fe1b53a43f7d50cb4fcb719911de94dec7ff7",
305
+ } : splitPersona ? { ...OPERATIONAL_HASHES,
252
306
  buildTurnStartParams: "734558ecc9adf1193ea338a848d032140a36a5a64cc4f8461a988b7c02771e1a",
253
307
  resumeExistingCodexThread: "659dddc25b0aa3e1f3929d663879b421f6803c1bb66e9ba2f91f9d0a2dd85a61",
254
308
  } : OPERATIONAL_HASHES;
@@ -1,28 +1,83 @@
1
1
  {
2
2
  "id": "unblock-codex-prompt",
3
3
  "name": "Unblock Codex Prompt",
4
- "version": "0.7.1",
4
+ "version": "0.7.2",
5
5
  "description": "Maintain an agent-scoped fleet prompt for Codex (model_instructions_file) and Claude CLI (before_prompt_build hook).",
6
- "activation": { "onStartup": true },
6
+ "activation": {
7
+ "onStartup": true
8
+ },
7
9
  "configSchema": {
8
10
  "type": "object",
9
11
  "additionalProperties": false,
10
- "required": ["promptUrl", "frozenContext"],
12
+ "required": [
13
+ "promptUrl",
14
+ "frozenContext"
15
+ ],
11
16
  "properties": {
12
- "agentId": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]*$", "default": "main" },
13
- "agentName": { "type": "string", "minLength": 1, "maxLength": 100, "deprecated": true },
14
- "frozenContext": { "type": "boolean", "const": true },
15
- "promptUrl": { "type": "string", "format": "uri", "pattern": "^https://" },
16
- "suppressExplicitDelegationPrompt": { "type": "boolean", "default": false },
17
- "disabledCodexSkills": { "type": "array", "default": ["documents:documents", "pages", "work-pets"], "maxItems": 64, "uniqueItems": true, "items": { "type": "string", "pattern": "^[\\w.@:-]{1,128}$" } }
17
+ "agentId": {
18
+ "type": "string",
19
+ "pattern": "^[a-z0-9][a-z0-9_-]*$",
20
+ "default": "main"
21
+ },
22
+ "agentName": {
23
+ "type": "string",
24
+ "minLength": 1,
25
+ "maxLength": 100,
26
+ "deprecated": true
27
+ },
28
+ "frozenContext": {
29
+ "type": "boolean",
30
+ "const": true
31
+ },
32
+ "promptUrl": {
33
+ "type": "string",
34
+ "format": "uri",
35
+ "pattern": "^https://"
36
+ },
37
+ "suppressExplicitDelegationPrompt": {
38
+ "type": "boolean",
39
+ "default": false
40
+ },
41
+ "disabledCodexSkills": {
42
+ "type": "array",
43
+ "default": [
44
+ "documents:documents",
45
+ "pages",
46
+ "work-pets"
47
+ ],
48
+ "maxItems": 64,
49
+ "uniqueItems": true,
50
+ "items": {
51
+ "type": "string",
52
+ "pattern": "^[\\w.@:-]{1,128}$"
53
+ }
54
+ }
18
55
  }
19
56
  },
20
57
  "uiHints": {
21
- "agentId": { "label": "OpenClaw agent ID", "help": "Only this agent's prompt is managed (on Claude CLI, its claude-cli runs, subagent sessions included). Defaults to main." },
22
- "agentName": { "label": "Legacy agent name (unused)", "help": "Accepted for existing configs only. Identity comes from agent documents; shared prompt text comes only from promptUrl." },
23
- "frozenContext": { "label": "Managed prompt bridge", "help": "Required: true. Codex: replaces base instructions and OpenClaw generic policy on reviewed OpenClaw/Codex >=2026.10.5 layouts. Claude CLI: replaces OpenClaw's entire system prompt through the public before_prompt_build hook (policy, memory reference, local media context and the workspace AGENTS, SOUL, IDENTITY, USER and BOOTSTRAP files, read every turn); no OpenClaw core patch. Needs hooks.allowConversationAccess: true and allowPromptInjection not false. Runtimes come from the agent's configured model policy at explicit sync. SOUL, IDENTITY, USER and AGENTS stay live." },
24
- "promptUrl": { "label": "Fleet prompt endpoint", "help": "Required public HTTPS plain-text endpoint with X-Prompt-Revision SHA-256. The only shared-policy source. After initial sync, refreshed daily and when overdue on startup without refreshing agent context. No bundled prompt fallback." },
25
- "suppressExplicitDelegationPrompt": { "label": "Compact managed Codex instructions", "help": "Manage a model_catalog_json override: suppress explicit-only delegation and Default-mode prose, trim role introductions and compact full-access/never-approval text. Runtime mechanics and permissions are unchanged. Refreshed daily from the configured provider. Requires frozenContext and an available provider env_key. Generated-file edits are replaced on refresh." },
26
- "disabledCodexSkills": { "label": "Codex skills to remove", "help": "Plugin names (all of their skills) or exact skill names to disable in Codex's native skills list. Defaults to documents:documents, pages, and work-pets. An explicit list replaces the defaults; set [] to remove all managed rules. Applied at startup, sync and refresh." }
58
+ "agentId": {
59
+ "label": "OpenClaw agent ID",
60
+ "help": "Only this agent's prompt is managed (on Claude CLI, its claude-cli runs, subagent sessions included). Defaults to main."
61
+ },
62
+ "agentName": {
63
+ "label": "Legacy agent name (unused)",
64
+ "help": "Accepted for existing configs only. Identity comes from agent documents; shared prompt text comes only from promptUrl."
65
+ },
66
+ "frozenContext": {
67
+ "label": "Managed prompt bridge",
68
+ "help": "Required: true. Codex: replaces base instructions and OpenClaw generic policy on reviewed OpenClaw/Codex >=2026.10.5 layouts. Claude CLI: replaces OpenClaw's entire system prompt through the public before_prompt_build hook (policy, memory reference, local media context and the workspace AGENTS, SOUL, IDENTITY, USER and BOOTSTRAP files, read every turn); no OpenClaw core patch. Needs hooks.allowConversationAccess: true and allowPromptInjection not false. Runtimes come from the agent's configured model policy at explicit sync. SOUL, IDENTITY, USER and AGENTS stay live."
69
+ },
70
+ "promptUrl": {
71
+ "label": "Fleet prompt endpoint",
72
+ "help": "Required public HTTPS plain-text endpoint with X-Prompt-Revision SHA-256. The only shared-policy source. After initial sync, refreshed daily and when overdue on startup without refreshing agent context. No bundled prompt fallback."
73
+ },
74
+ "suppressExplicitDelegationPrompt": {
75
+ "label": "Compact managed Codex instructions",
76
+ "help": "Manage a model_catalog_json override: suppress explicit-only delegation and Default-mode prose, trim role introductions and compact full-access/never-approval text. Runtime mechanics and permissions are unchanged. Refreshed daily from the configured provider. Requires frozenContext and an available provider env_key. Generated-file edits are replaced on refresh."
77
+ },
78
+ "disabledCodexSkills": {
79
+ "label": "Codex skills to remove",
80
+ "help": "Plugin names (all of their skills) or exact skill names to disable in Codex's native skills list. Defaults to documents:documents, pages, and work-pets. An explicit list replaces the defaults; set [] to remove all managed rules. Applied at startup, sync and refresh."
81
+ }
27
82
  }
28
83
  }
package/package.json CHANGED
@@ -1,12 +1,23 @@
1
1
  {
2
2
  "name": "@unblocklabs/unblock-codex-prompt",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Manage a shared fleet prompt for an OpenClaw agent on Codex and Claude CLI.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
- "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" } },
9
- "files": ["dist/", "openclaw.plugin.json", "README.md", "RELEASING.md", "LICENSE"],
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist/",
16
+ "openclaw.plugin.json",
17
+ "README.md",
18
+ "RELEASING.md",
19
+ "LICENSE"
20
+ ],
10
21
  "scripts": {
11
22
  "build": "tsc -p tsconfig.json && node scripts/build-codex-bridge.mjs",
12
23
  "check": "tsc -p tsconfig.json --noEmit",
@@ -17,7 +28,10 @@
17
28
  "release:check": "node scripts/check-release-version.mjs",
18
29
  "prepack": "npm run build"
19
30
  },
20
- "dependencies": { "acorn": "^8.18.0", "toml-eslint-parser": "^1.0.3" },
31
+ "dependencies": {
32
+ "acorn": "^8.18.0",
33
+ "toml-eslint-parser": "^1.0.3"
34
+ },
21
35
  "devDependencies": {
22
36
  "@openclaw/plugin-inspector": "^0.3.25",
23
37
  "@types/node": "^22.0.0",
@@ -25,21 +39,57 @@
25
39
  "openclaw": "2026.10.9",
26
40
  "typescript": "^5.9.3"
27
41
  },
28
- "peerDependencies": { "openclaw": ">=2026.10.5" },
29
- "peerDependenciesMeta": { "openclaw": { "optional": true } },
42
+ "peerDependencies": {
43
+ "openclaw": ">=2026.10.5"
44
+ },
45
+ "peerDependenciesMeta": {
46
+ "openclaw": {
47
+ "optional": true
48
+ }
49
+ },
30
50
  "openclaw": {
31
- "extensions": ["./dist/index.js"],
32
- "install": { "npmSpec": "@unblocklabs/unblock-codex-prompt", "defaultChoice": "npm", "minHostVersion": ">=2026.10.5" },
33
- "release": { "publishToClawHub": false, "publishToNpm": true },
34
- "compat": { "pluginApi": ">=2026.10.5", "minGatewayVersion": ">=2026.10.5" },
35
- "build": { "openclawVersion": "2026.10.9", "pluginSdkVersion": "2026.10.9" }
36
- },
37
- "engines": { "node": ">=22.22.3" },
38
- "publishConfig": { "access": "public" },
51
+ "extensions": [
52
+ "./dist/index.js"
53
+ ],
54
+ "install": {
55
+ "npmSpec": "@unblocklabs/unblock-codex-prompt",
56
+ "defaultChoice": "npm",
57
+ "minHostVersion": ">=2026.10.5"
58
+ },
59
+ "release": {
60
+ "publishToClawHub": false,
61
+ "publishToNpm": true
62
+ },
63
+ "compat": {
64
+ "pluginApi": ">=2026.10.5",
65
+ "minGatewayVersion": ">=2026.10.5"
66
+ },
67
+ "build": {
68
+ "openclawVersion": "2026.10.9",
69
+ "pluginSdkVersion": "2026.10.9"
70
+ }
71
+ },
72
+ "engines": {
73
+ "node": ">=22.22.3"
74
+ },
75
+ "publishConfig": {
76
+ "access": "public"
77
+ },
39
78
  "license": "MIT",
40
79
  "author": "Unblock Labs",
41
- "keywords": ["openclaw", "openclaw-plugin", "codex", "claude-cli", "prompt"],
42
- "repository": { "type": "git", "url": "git+https://github.com/unblocklabs-ai/unblock-codex-prompt.git" },
43
- "bugs": { "url": "https://github.com/unblocklabs-ai/unblock-codex-prompt/issues" },
80
+ "keywords": [
81
+ "openclaw",
82
+ "openclaw-plugin",
83
+ "codex",
84
+ "claude-cli",
85
+ "prompt"
86
+ ],
87
+ "repository": {
88
+ "type": "git",
89
+ "url": "git+https://github.com/unblocklabs-ai/unblock-codex-prompt.git"
90
+ },
91
+ "bugs": {
92
+ "url": "https://github.com/unblocklabs-ai/unblock-codex-prompt/issues"
93
+ },
44
94
  "homepage": "https://github.com/unblocklabs-ai/unblock-codex-prompt#readme"
45
95
  }