@bitkyc08/opencodex 2.7.3 → 2.7.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.
@@ -16,7 +16,7 @@
16
16
  } catch (e) {}
17
17
  })();
18
18
  </script>
19
- <script type="module" crossorigin src="/assets/index-DT4C-vKW.js"></script>
19
+ <script type="module" crossorigin src="/assets/index-66dPs6l_.js"></script>
20
20
  <link rel="stylesheet" crossorigin href="/assets/index-D7o1qwy-.css">
21
21
  </head>
22
22
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitkyc08/opencodex",
3
- "version": "2.7.3",
3
+ "version": "2.7.4",
4
4
  "description": "Universal provider proxy for OpenAI Codex — use any LLM with Codex CLI/App/SDK",
5
5
  "type": "module",
6
6
  "main": "./bin/package-main.mjs",
package/src/cli/debug.ts CHANGED
@@ -2,7 +2,7 @@ import { findLiveProxy, probeHostname } from "../server/proxy-liveness";
2
2
  import { DEBUG_ENV, type DebugSettingsView } from "../lib/debug-settings";
3
3
  import { runningProxyUpdateHeaders } from "../oauth/login-cli";
4
4
 
5
- type DebugScope = "provider" | "usage";
5
+ type DebugScope = "provider" | "usage" | "injection";
6
6
 
7
7
  async function requireLiveProxy() {
8
8
  const live = await findLiveProxy();
@@ -50,10 +50,14 @@ function printScopeStatus(scope: DebugScope, view: DebugSettingsView): void {
50
50
  console.log(`Provider debug: ${view.enabled ? "ON" : "off"}`);
51
51
  console.log(` env=${view.env.debug ? "on" : "off"}, runtime=${view.runtimeOverride.debug === undefined ? "env/default" : view.runtimeOverride.debug ? "on" : "off"}`);
52
52
  console.log(" Tail: ocx debug provider logs [-f]");
53
- } else {
53
+ } else if (scope === "usage") {
54
54
  console.log(`Usage debug: ${view.usage ? "ON" : "off"}`);
55
55
  console.log(` env=${view.env.usage ? "on" : "off"}, runtime=${view.runtimeOverride.usage === undefined ? "env/default" : view.runtimeOverride.usage ? "on" : "off"}`);
56
56
  console.log(" Tail: ocx debug usage logs [-f] (via running proxy API)");
57
+ } else {
58
+ console.log(`Injection debug: ${view.injection ? "ON" : "off"}`);
59
+ console.log(` env=${view.env.injection ? "on" : "off"}, runtime=${view.runtimeOverride.injection === undefined ? "env/default" : view.runtimeOverride.injection ? "on" : "off"}`);
60
+ console.log(" Lines appear on the proxy console when multi-agent guidance is injected.");
57
61
  }
58
62
  }
59
63
 
@@ -138,7 +142,7 @@ async function handleScopeCommand(scope: DebugScope, actionArgv: string[]): Prom
138
142
 
139
143
  if (action === "on" || action === "off") {
140
144
  const enabled = action === "on";
141
- const body = scope === "provider" ? { debug: enabled } : { usage: enabled };
145
+ const body = scope === "provider" ? { debug: enabled } : scope === "usage" ? { usage: enabled } : { injection: enabled };
142
146
  printScopeStatus(scope, await putDebugSettings(body));
143
147
  console.log(`\n${scope} debug is now ${enabled ? "enabled" : "disabled"}.`);
144
148
  return;
@@ -150,20 +154,26 @@ async function handleScopeCommand(scope: DebugScope, actionArgv: string[]): Prom
150
154
  }
151
155
 
152
156
  if (action === "reset") {
153
- const resetKey = scope === "provider" ? "provider" : "usage";
157
+ const resetKey = scope === "provider" ? "provider" : scope;
154
158
  printScopeStatus(scope, await putDebugSettings({ reset: resetKey }));
155
159
  console.log(`\nRuntime override cleared for ${scope}; effective value follows env again.`);
156
160
  return;
157
161
  }
158
162
 
159
163
  if (action === "logs") {
164
+ if (scope === "injection") {
165
+ console.error("Injection debug has no buffered log stream; lines print on the proxy console.");
166
+ process.exit(1);
167
+ }
160
168
  const follow = actionArgv.slice(1).some(arg => arg === "-f" || arg === "--follow");
161
169
  if (scope === "provider") await printProviderLogs(follow);
162
170
  else await printUsageLogs(follow);
163
171
  return;
164
172
  }
165
173
 
166
- console.error(`Usage: ocx debug ${scope} on|off|status|reset|logs [-f]`);
174
+ console.error(scope === "injection"
175
+ ? "Usage: ocx debug injection on|off|status|reset"
176
+ : `Usage: ocx debug ${scope} on|off|status|reset|logs [-f]`);
167
177
  process.exit(1);
168
178
  }
169
179
 
@@ -172,16 +182,18 @@ function printTopLevelHelp(): void {
172
182
  console.log("");
173
183
  console.log(" ocx debug provider on|off|status|reset|logs [-f]");
174
184
  console.log(" ocx debug usage on|off|status|reset|logs [-f]");
185
+ console.log(" ocx debug injection on|off|status|reset");
175
186
  console.log("");
176
187
  console.log("Env defaults on start:");
177
188
  console.log(" provider → OCX_DEBUG=1 (legacy OCX_DEBUG_FRAMES still works)");
178
189
  console.log(` usage → ${DEBUG_ENV.usage}=1`);
190
+ console.log(` injection→ ${DEBUG_ENV.injection}=1`);
179
191
  }
180
192
 
181
193
  export async function handleDebugCommand(argv: string[]): Promise<void> {
182
194
  const sub = (argv[0] ?? "").trim().toLowerCase();
183
195
 
184
- if (sub === "provider" || sub === "usage") {
196
+ if (sub === "provider" || sub === "usage" || sub === "injection") {
185
197
  await handleScopeCommand(sub, argv.slice(1));
186
198
  return;
187
199
  }
@@ -192,6 +204,7 @@ export async function handleDebugCommand(argv: string[]): Promise<void> {
192
204
  console.log("Proxy is not running — env defaults for the next start:");
193
205
  console.log(` provider → OCX_DEBUG = ${envDebugEnabled() ? "on" : "off"}`);
194
206
  console.log(` usage → ${DEBUG_ENV.usage} = ${process.env[DEBUG_ENV.usage] === "1" ? "on" : "off"}`);
207
+ console.log(` injection→ ${DEBUG_ENV.injection} = ${process.env[DEBUG_ENV.injection] === "1" ? "on" : "off"}`);
195
208
  console.log("");
196
209
  }
197
210
  printTopLevelHelp();
@@ -2,12 +2,15 @@
2
2
  * Runtime-controllable debug flags.
3
3
  * Provider debug: `ocx debug provider on|off|status|reset|logs [-f]` (or OCX_DEBUG=1 on start).
4
4
  * Usage capture: `ocx debug usage on|off|status|reset|logs [-f]` (or OPENCODEX_USAGE_DEBUG=1).
5
+ * Injection log: `ocx debug injection on|off|status|reset` (or OCX_INJECTION_DEBUG=1) —
6
+ * multi-agent guidance-injection console lines, default OFF.
5
7
  * `/api/debug` and `ocx debug` override env defaults without restart.
6
8
  */
7
9
 
8
10
  export const DEBUG_ENV = {
9
11
  debug: "OCX_DEBUG",
10
12
  usage: "OPENCODEX_USAGE_DEBUG",
13
+ injection: "OCX_INJECTION_DEBUG",
11
14
  } as const;
12
15
 
13
16
  /** Legacy env var that still enables provider debug logging. */
@@ -18,6 +21,7 @@ export type DebugFlag = keyof typeof DEBUG_ENV;
18
21
  export interface DebugSettingsView {
19
22
  enabled: boolean;
20
23
  usage: boolean;
24
+ injection: boolean;
21
25
  runtimeOverride: Partial<Record<DebugFlag, boolean>>;
22
26
  env: Record<DebugFlag, boolean>;
23
27
  }
@@ -47,20 +51,28 @@ export function isUsageDebugEnabled(): boolean {
47
51
  return envFlag(DEBUG_ENV.usage);
48
52
  }
49
53
 
54
+ /** Multi-agent guidance-injection log lines (default OFF; GUI checkbox / API / CLI). */
55
+ export function isInjectionDebugEnabled(): boolean {
56
+ if (runtimeOverride.injection !== undefined) return runtimeOverride.injection;
57
+ return envFlag(DEBUG_ENV.injection);
58
+ }
59
+
50
60
  export function getDebugSettings(): DebugSettingsView {
51
61
  return {
52
62
  enabled: isDebugEnabled(),
53
63
  usage: isUsageDebugEnabled(),
64
+ injection: isInjectionDebugEnabled(),
54
65
  runtimeOverride: { ...runtimeOverride },
55
66
  env: {
56
67
  debug: envFlag(DEBUG_ENV.debug) || legacyDebugEnvEnabled(),
57
68
  usage: envFlag(DEBUG_ENV.usage),
69
+ injection: envFlag(DEBUG_ENV.injection),
58
70
  },
59
71
  };
60
72
  }
61
73
 
62
74
  export function setDebugSettings(partial: Partial<Record<DebugFlag, boolean>>): DebugSettingsView {
63
- for (const key of ["debug", "usage"] as const) {
75
+ for (const key of ["debug", "usage", "injection"] as const) {
64
76
  if (partial[key] !== undefined) runtimeOverride[key] = partial[key];
65
77
  }
66
78
  return getDebugSettings();
@@ -72,7 +84,7 @@ export function clearDebugSetting(flag: DebugFlag): DebugSettingsView {
72
84
  }
73
85
 
74
86
  export function clearDebugSettings(): DebugSettingsView {
75
- for (const key of ["debug", "usage"] as const) {
87
+ for (const key of ["debug", "usage", "injection"] as const) {
76
88
  delete runtimeOverride[key];
77
89
  }
78
90
  return getDebugSettings();
@@ -208,19 +208,20 @@ export async function handleManagementAPI(req: Request, url: URL, config: OcxCon
208
208
  }
209
209
 
210
210
  if (url.pathname === "/api/debug" && req.method === "PUT") {
211
- let body: { debug?: unknown; usage?: unknown; reset?: unknown };
211
+ let body: { debug?: unknown; usage?: unknown; injection?: unknown; reset?: unknown };
212
212
  try { body = await req.json(); } catch { return jsonResponse({ error: "invalid JSON body" }, 400); }
213
213
  if (body.reset === true) return jsonResponse(clearDebugSettings());
214
214
  if (body.reset === "debug" || body.reset === "provider") return jsonResponse(clearDebugSetting("debug"));
215
215
  if (body.reset === "usage") return jsonResponse(clearDebugSetting("usage"));
216
+ if (body.reset === "injection") return jsonResponse(clearDebugSetting("injection"));
216
217
  const partial: Partial<Record<DebugFlag, boolean>> = {};
217
- for (const key of ["debug", "usage"] as const) {
218
+ for (const key of ["debug", "usage", "injection"] as const) {
218
219
  if (body[key] === undefined) continue;
219
220
  if (typeof body[key] !== "boolean") return jsonResponse({ error: `${key} must be a boolean` }, 400);
220
221
  partial[key] = body[key];
221
222
  }
222
223
  if (Object.keys(partial).length === 0) {
223
- return jsonResponse({ error: "provide debug/usage booleans or reset:true" }, 400);
224
+ return jsonResponse({ error: "provide debug/usage/injection booleans or reset:true" }, 400);
224
225
  }
225
226
  return jsonResponse(setDebugSettings(partial));
226
227
  }
@@ -9,6 +9,7 @@ import { buildCompactV1Output, COMPACT_PROMPT, decodeCompactionSummary, extractC
9
9
  import { FORWARD_HEADERS } from "../adapters/openai-responses";
10
10
  import { expandPreviousResponseInput, previousResponseConversationId, rememberResponseState } from "../responses/state";
11
11
  import { routeModel } from "../router";
12
+ import { isInjectionDebugEnabled } from "../lib/debug-settings";
12
13
  import { modelInList, namespacedToolName } from "../types";
13
14
  import type { AdapterEvent, OcxConfig, OcxParsedRequest, OcxProviderConfig } from "../types";
14
15
  import {
@@ -463,8 +464,8 @@ export async function handleResponses(
463
464
  const guidance = await multiAgentGuidanceText(parsed, config.injectionModel, config.injectionEffort, config.subagentModels, config.injectionPrompt);
464
465
  if (guidance) {
465
466
  injectDeveloperMessage(parsed, guidance);
466
- console.log(`[opencodex] ${route.modelId}: multi-agent guidance injected (surface=${collabSurface(parsed)}, ${guidance.length} chars)`);
467
- } else if (collabSurface(parsed) !== null) {
467
+ if (isInjectionDebugEnabled()) console.log(`[opencodex] ${route.modelId}: multi-agent guidance injected (surface=${collabSurface(parsed)}, ${guidance.length} chars)`);
468
+ } else if (isInjectionDebugEnabled() && collabSurface(parsed) !== null) {
468
469
  console.log(`[opencodex] ${route.modelId}: collab surface=${collabSurface(parsed)}, guidance silent (effort=${parsed.options.reasoning ?? "unset"}, injectionModel=${config.injectionModel ?? "unset"})`);
469
470
  }
470
471
  }