codexui-android 0.1.106 → 0.1.108

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/index.html CHANGED
@@ -12,8 +12,8 @@
12
12
  <link rel="icon" type="image/png" sizes="192x192" href="/icons/pwa-192x192.png" />
13
13
  <link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png" />
14
14
  <title>Codex Web</title>
15
- <script type="module" crossorigin src="/assets/index-Dgv-diAL.js"></script>
16
- <link rel="stylesheet" crossorigin href="/assets/index-D3-QOh5C.css">
15
+ <script type="module" crossorigin src="/assets/index-DfEYiJAK.js"></script>
16
+ <link rel="stylesheet" crossorigin href="/assets/index-KQ_3KeZN.css">
17
17
  </head>
18
18
  <body class="bg-slate-950">
19
19
  <div id="app"></div>
package/dist-cli/index.js CHANGED
@@ -4203,6 +4203,13 @@ var CUSTOM_PROVIDER_ID = "custom-endpoint";
4203
4203
  var OPENCODE_ZEN_PROVIDER_ID = "opencode-zen";
4204
4204
  var OPENCODE_ZEN_BASE_URL = "https://opencode.ai/zen/v1";
4205
4205
  var OPENCODE_ZEN_DEFAULT_MODEL = "big-pickle";
4206
+ var OPENCODE_ZEN_FALLBACK_FREE_MODELS = [
4207
+ OPENCODE_ZEN_DEFAULT_MODEL,
4208
+ "minimax-m2.5-free",
4209
+ "hy3-preview-free",
4210
+ "nemotron-3-super-free",
4211
+ "trinity-large-preview-free"
4212
+ ];
4206
4213
  function createDefaultOpenCodeZenFreeModeState() {
4207
4214
  return {
4208
4215
  enabled: true,
@@ -4214,6 +4221,11 @@ function createDefaultOpenCodeZenFreeModeState() {
4214
4221
  providerKeys: {}
4215
4222
  };
4216
4223
  }
4224
+ function getOpenCodeZenFreeModelIds(modelIds) {
4225
+ const uniqueIds = modelIds.map((id) => id.trim()).filter((id, index, ids) => id.length > 0 && ids.indexOf(id) === index);
4226
+ const freeIds = uniqueIds.filter((id) => id.endsWith("-free") || id === OPENCODE_ZEN_DEFAULT_MODEL);
4227
+ return freeIds.length > 0 ? freeIds : OPENCODE_ZEN_FALLBACK_FREE_MODELS;
4228
+ }
4217
4229
  function shouldCreateDefaultFreeModeStateForMissingAuth(current, hasUsableCodexAuth) {
4218
4230
  return current == null && !hasUsableCodexAuth;
4219
4231
  }
@@ -4346,6 +4358,14 @@ function extractTextParts(value) {
4346
4358
  if (!Array.isArray(value)) return "";
4347
4359
  return value.map((part) => part && typeof part === "object" && typeof part.text === "string" ? part.text : "").filter((part) => part.length > 0).join("\n");
4348
4360
  }
4361
+ function buildReasoningOutputItem(reasoningContent) {
4362
+ return {
4363
+ type: "reasoning",
4364
+ id: `rs_${Date.now()}`,
4365
+ summary: [{ type: "summary_text", text: reasoningContent }],
4366
+ content: []
4367
+ };
4368
+ }
4349
4369
  function responsesInputToMessages(input, instructions) {
4350
4370
  const messages = [];
4351
4371
  let pendingReasoningContent = "";
@@ -4467,12 +4487,7 @@ function chatCompletionToResponsesFormat(chatResponse, model) {
4467
4487
  });
4468
4488
  }
4469
4489
  if (message.reasoning_content) {
4470
- output.push({
4471
- type: "reasoning",
4472
- id: `rs_${Date.now()}`,
4473
- summary: [],
4474
- content: [{ type: "reasoning_text", text: message.reasoning_content }]
4475
- });
4490
+ output.push(buildReasoningOutputItem(message.reasoning_content));
4476
4491
  }
4477
4492
  }
4478
4493
  const usage = chatResponse.usage;
@@ -4538,12 +4553,7 @@ function forwardStreamingTextResponse(upstreamRes, res, model) {
4538
4553
  const messageItem = { type: "message", role: "assistant", content: [{ type: "output_text", text: fullText }], status: "completed" };
4539
4554
  const output = [messageItem];
4540
4555
  if (fullReasoningText) {
4541
- output.push({
4542
- type: "reasoning",
4543
- id: `rs_${Date.now()}`,
4544
- summary: [],
4545
- content: [{ type: "reasoning_text", text: fullReasoningText }]
4546
- });
4556
+ output.push(buildReasoningOutputItem(fullReasoningText));
4547
4557
  }
4548
4558
  res.write(`data: {"type":"response.output_text.done","output_index":0,"content_index":0,"text":"${escapedFull}"}
4549
4559
 
@@ -9281,10 +9291,11 @@ async function buildThreadSearchIndex(appServer) {
9281
9291
  const docsById = new Map(docs.map((doc) => [doc.id, doc]));
9282
9292
  return { docsById };
9283
9293
  }
9284
- function createCodexBridgeMiddleware() {
9294
+ function createCodexBridgeMiddleware(options = {}) {
9285
9295
  const { appServer, terminalManager, methodCatalog, telegramBridge, backendQueueProcessor } = getSharedBridgeState();
9286
9296
  let threadSearchIndex = null;
9287
9297
  let threadSearchIndexPromise = null;
9298
+ let backgroundServicesStarted = false;
9288
9299
  async function getThreadSearchIndex() {
9289
9300
  if (threadSearchIndex) return threadSearchIndex;
9290
9301
  if (!threadSearchIndexPromise) {
@@ -9297,14 +9308,21 @@ function createCodexBridgeMiddleware() {
9297
9308
  }
9298
9309
  return threadSearchIndexPromise;
9299
9310
  }
9300
- void initializeSkillsSyncOnStartup(appServer);
9301
- void readTelegramBridgeConfig().then((config) => {
9302
- if (!config.botToken) return;
9303
- telegramBridge.configureToken(config.botToken);
9304
- telegramBridge.configureAllowedUserIds(config.allowedUserIds);
9305
- telegramBridge.start();
9306
- }).catch(() => {
9307
- });
9311
+ function startBackgroundServices() {
9312
+ if (backgroundServicesStarted) return;
9313
+ backgroundServicesStarted = true;
9314
+ void initializeSkillsSyncOnStartup(appServer);
9315
+ void readTelegramBridgeConfig().then((config) => {
9316
+ if (!config.botToken) return;
9317
+ telegramBridge.configureToken(config.botToken);
9318
+ telegramBridge.configureAllowedUserIds(config.allowedUserIds);
9319
+ telegramBridge.start();
9320
+ }).catch(() => {
9321
+ });
9322
+ }
9323
+ if (options.startBackgroundServices !== false) {
9324
+ startBackgroundServices();
9325
+ }
9308
9326
  const middleware = async (req, res, next) => {
9309
9327
  const requestStartNs = process.hrtime.bigint();
9310
9328
  const rawUrl = req.url ?? "";
@@ -9395,7 +9413,11 @@ function createCodexBridgeMiddleware() {
9395
9413
  }
9396
9414
  if (url.pathname.startsWith("/codex-api/free-mode")) {
9397
9415
  let readFreeModeState2 = function() {
9398
- return ensureDefaultFreeModeStateForMissingAuthSync(statePath) ?? { enabled: false, apiKey: null, model: FREE_MODE_DEFAULT_MODEL };
9416
+ const state = ensureDefaultFreeModeStateForMissingAuthSync(statePath) ?? { enabled: false, apiKey: null, model: FREE_MODE_DEFAULT_MODEL };
9417
+ if (state.provider === "opencode-zen" && !state.model?.trim()) {
9418
+ return { ...state, model: OPENCODE_ZEN_DEFAULT_MODEL };
9419
+ }
9420
+ return state;
9399
9421
  };
9400
9422
  var readFreeModeState = readFreeModeState2;
9401
9423
  const statePath = join6(getCodexHomeDir3(), FREE_MODE_STATE_FILE);
@@ -9547,7 +9569,7 @@ function createCodexBridgeMiddleware() {
9547
9569
  if (resolvedKey) {
9548
9570
  prevKeys[providerType] = resolvedKey;
9549
9571
  }
9550
- const resolvedModel = providerType === "openrouter" ? current.model || FREE_MODE_DEFAULT_MODEL : providerType === "custom" ? await fetchCustomEndpointDefaultModel(baseUrl, resolvedKey) : "";
9572
+ const resolvedModel = providerType === "openrouter" ? current.model || FREE_MODE_DEFAULT_MODEL : providerType === "custom" ? await fetchCustomEndpointDefaultModel(baseUrl, resolvedKey) : OPENCODE_ZEN_DEFAULT_MODEL;
9551
9573
  const state = {
9552
9574
  enabled: true,
9553
9575
  apiKey: resolvedKey,
@@ -9996,21 +10018,28 @@ function createCodexBridgeMiddleware() {
9996
10018
  try {
9997
10019
  const modelsUrl = "https://opencode.ai/zen/v1/models";
9998
10020
  const headers = {};
9999
- if (fmState.apiKey && fmState.apiKey !== "dummy") {
10021
+ const hasZenApiKey = Boolean(fmState.apiKey && fmState.apiKey !== "dummy");
10022
+ if (hasZenApiKey) {
10000
10023
  headers["Authorization"] = `Bearer ${fmState.apiKey}`;
10001
10024
  }
10002
10025
  const resp = await fetch(modelsUrl, { headers, signal: AbortSignal.timeout(8e3) });
10003
10026
  if (resp.ok) {
10004
10027
  const json = await resp.json();
10005
10028
  const allIds = (json.data ?? []).map((m) => m.id).filter(Boolean);
10006
- const freeIds = allIds.filter((id) => id.endsWith("-free") || id === "big-pickle");
10007
- const paidIds = allIds.filter((id) => !id.endsWith("-free") && id !== "big-pickle");
10008
- setJson4(res, 200, { data: [...freeIds, ...paidIds], exclusive: true, source: "opencode-zen" });
10029
+ setJson4(res, 200, {
10030
+ data: getOpenCodeZenFreeModelIds(allIds),
10031
+ exclusive: true,
10032
+ source: "opencode-zen"
10033
+ });
10009
10034
  return;
10010
10035
  }
10011
10036
  } catch {
10012
10037
  }
10013
- setJson4(res, 200, { data: ["big-pickle", "minimax-m2.5-free", "nemotron-3-super-free", "trinity-large-preview-free"], exclusive: true, source: "opencode-zen" });
10038
+ setJson4(res, 200, {
10039
+ data: getOpenCodeZenFreeModelIds([]),
10040
+ exclusive: true,
10041
+ source: "opencode-zen"
10042
+ });
10014
10043
  return;
10015
10044
  }
10016
10045
  if (fmState.provider === "custom" && fmState.customBaseUrl) {
@@ -10313,7 +10342,7 @@ function createCodexBridgeMiddleware() {
10313
10342
  if (currentBranch && !branchActivityByName.has(currentBranch)) {
10314
10343
  branchActivityByName.set(currentBranch, { timestamp: Number.MAX_SAFE_INTEGER, isRemote: false });
10315
10344
  }
10316
- const options = Array.from(branchActivityByName.entries()).map(([value, metadata]) => ({
10345
+ const options2 = Array.from(branchActivityByName.entries()).map(([value, metadata]) => ({
10317
10346
  value,
10318
10347
  label: value,
10319
10348
  isCurrent: value === currentBranch,
@@ -10327,7 +10356,7 @@ function createCodexBridgeMiddleware() {
10327
10356
  setJson4(res, 200, {
10328
10357
  data: {
10329
10358
  ...state,
10330
- options
10359
+ options: options2
10331
10360
  }
10332
10361
  });
10333
10362
  } catch (error) {
@@ -10884,6 +10913,7 @@ data: ${JSON.stringify({ ok: true })}
10884
10913
  backendQueueProcessor.dispose();
10885
10914
  appServer.dispose();
10886
10915
  };
10916
+ middleware.startBackgroundServices = startBackgroundServices;
10887
10917
  middleware.subscribeNotifications = (listener) => {
10888
10918
  const unsubscribeAppServer = appServer.onNotification((notification) => {
10889
10919
  listener({
@@ -11585,7 +11615,9 @@ function readWildcardPathParam(value) {
11585
11615
  }
11586
11616
  function createServer(options = {}) {
11587
11617
  const app = express();
11588
- const bridge = createCodexBridgeMiddleware();
11618
+ const bridge = createCodexBridgeMiddleware({
11619
+ startBackgroundServices: options.deferBridgeBackgroundServices !== true
11620
+ });
11589
11621
  const authSession = options.password ? createAuthSession(options.password) : null;
11590
11622
  if (authSession) {
11591
11623
  app.use(authSession.middleware);
@@ -11731,6 +11763,7 @@ function createServer(options = {}) {
11731
11763
  return {
11732
11764
  app,
11733
11765
  dispose: () => bridge.dispose(),
11766
+ startBridgeBackgroundServices: () => bridge.startBackgroundServices(),
11734
11767
  attachWebSocket: (server) => {
11735
11768
  const wss = new WebSocketServer({ noServer: true });
11736
11769
  server.on("upgrade", (req, socket, head) => {
@@ -12210,11 +12243,15 @@ async function startServer(options) {
12210
12243
  const passwordResolution = resolvePassword(options.password);
12211
12244
  const password = passwordResolution.password;
12212
12245
  const generatedPasswordPath = password && passwordResolution.generated ? await persistGeneratedPassword(password) : null;
12213
- const { app, dispose, attachWebSocket } = createServer({ password });
12246
+ const { app, dispose, attachWebSocket, startBridgeBackgroundServices } = createServer({
12247
+ password,
12248
+ deferBridgeBackgroundServices: true
12249
+ });
12214
12250
  const server = createServer2(app);
12215
12251
  attachWebSocket(server);
12216
12252
  const port = await listenWithFallback(server, requestedPort);
12217
12253
  process.env.CODEXUI_SERVER_PORT = String(port);
12254
+ startBridgeBackgroundServices();
12218
12255
  let tunnelChild = null;
12219
12256
  let tunnelUrl = null;
12220
12257
  if (options.tunnel) {