srpllm 1.2.4 → 1.2.6

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/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import cac from 'cac';
3
3
  import ansis from 'ansis';
4
- import { i as init, u as uninstall, P as version } from './shared/srpllm.Gqy7fdfo.mjs';
4
+ import { i as init, u as uninstall, P as version } from './shared/srpllm.CdyEHPvp.mjs';
5
5
  import 'node:child_process';
6
6
  import 'node:fs';
7
7
  import 'node:os';
package/dist/index.d.mts CHANGED
@@ -29,7 +29,7 @@ interface CodexApiConfig {
29
29
  }
30
30
  declare function getExistingCodexConfig(): CodexApiConfig | null;
31
31
  declare function writeCodexApiConfig(config: CodexApiConfig): void;
32
- declare function disableCodexWindowsSandbox(): void;
32
+ declare function enableCodexFullAccess(): void;
33
33
  declare function clearCodexApiConfig(): void;
34
34
  declare function displayCodexConfig(config: CodexApiConfig): void;
35
35
 
@@ -130,5 +130,5 @@ declare function getPlatform(): Platform;
130
130
  declare function isWindows(): boolean;
131
131
  declare function commandExists(command: string): Promise<boolean>;
132
132
 
133
- export { CLAUDE_DIR, CLAUDE_SETTINGS_FILE, CODEX_AUTH_FILE, CODEX_CONFIG_FILE, CODEX_DIR, CODE_TOOL_ALIASES, CODE_TOOL_LABELS, CODE_TOOL_TYPES, DEFAULT_CODE_TOOL_TYPE, MODEL_PREFIX, RELAY_PROVIDER_ID, RELAY_TOOL_TYPES, buildModelsChoices, clearClaudeApiConfig, clearCodexApiConfig, commandExists, detectInstalledVersion, disableCodexWindowsSandbox, displayClaudeConfig, displayCodexConfig, ensureClaudeDir, fetchModels, filterByPrefix, getExistingClaudeApiConfig, getExistingCodexConfig, getPlatform, init, installTool, isCliTool, isCodeToolType, isToolInstalled, isWindows, readClaudeSettings, readLocalConfig, resolveCodeToolType, selectInstallMethod, uninstall, uninstallTool, updateLocalConfig, writeClaudeApiConfig, writeCodexApiConfig, writeLocalConfig };
133
+ export { CLAUDE_DIR, CLAUDE_SETTINGS_FILE, CODEX_AUTH_FILE, CODEX_CONFIG_FILE, CODEX_DIR, CODE_TOOL_ALIASES, CODE_TOOL_LABELS, CODE_TOOL_TYPES, DEFAULT_CODE_TOOL_TYPE, MODEL_PREFIX, RELAY_PROVIDER_ID, RELAY_TOOL_TYPES, buildModelsChoices, clearClaudeApiConfig, clearCodexApiConfig, commandExists, detectInstalledVersion, displayClaudeConfig, displayCodexConfig, enableCodexFullAccess, ensureClaudeDir, fetchModels, filterByPrefix, getExistingClaudeApiConfig, getExistingCodexConfig, getPlatform, init, installTool, isCliTool, isCodeToolType, isToolInstalled, isWindows, readClaudeSettings, readLocalConfig, resolveCodeToolType, selectInstallMethod, uninstall, uninstallTool, updateLocalConfig, writeClaudeApiConfig, writeCodexApiConfig, writeLocalConfig };
134
134
  export type { ClaudeApiConfig, CodeToolType, CodexApiConfig, InstallMethod, LocalConfig, RelayToolType, RemoteModel };
package/dist/index.d.ts CHANGED
@@ -29,7 +29,7 @@ interface CodexApiConfig {
29
29
  }
30
30
  declare function getExistingCodexConfig(): CodexApiConfig | null;
31
31
  declare function writeCodexApiConfig(config: CodexApiConfig): void;
32
- declare function disableCodexWindowsSandbox(): void;
32
+ declare function enableCodexFullAccess(): void;
33
33
  declare function clearCodexApiConfig(): void;
34
34
  declare function displayCodexConfig(config: CodexApiConfig): void;
35
35
 
@@ -130,5 +130,5 @@ declare function getPlatform(): Platform;
130
130
  declare function isWindows(): boolean;
131
131
  declare function commandExists(command: string): Promise<boolean>;
132
132
 
133
- export { CLAUDE_DIR, CLAUDE_SETTINGS_FILE, CODEX_AUTH_FILE, CODEX_CONFIG_FILE, CODEX_DIR, CODE_TOOL_ALIASES, CODE_TOOL_LABELS, CODE_TOOL_TYPES, DEFAULT_CODE_TOOL_TYPE, MODEL_PREFIX, RELAY_PROVIDER_ID, RELAY_TOOL_TYPES, buildModelsChoices, clearClaudeApiConfig, clearCodexApiConfig, commandExists, detectInstalledVersion, disableCodexWindowsSandbox, displayClaudeConfig, displayCodexConfig, ensureClaudeDir, fetchModels, filterByPrefix, getExistingClaudeApiConfig, getExistingCodexConfig, getPlatform, init, installTool, isCliTool, isCodeToolType, isToolInstalled, isWindows, readClaudeSettings, readLocalConfig, resolveCodeToolType, selectInstallMethod, uninstall, uninstallTool, updateLocalConfig, writeClaudeApiConfig, writeCodexApiConfig, writeLocalConfig };
133
+ export { CLAUDE_DIR, CLAUDE_SETTINGS_FILE, CODEX_AUTH_FILE, CODEX_CONFIG_FILE, CODEX_DIR, CODE_TOOL_ALIASES, CODE_TOOL_LABELS, CODE_TOOL_TYPES, DEFAULT_CODE_TOOL_TYPE, MODEL_PREFIX, RELAY_PROVIDER_ID, RELAY_TOOL_TYPES, buildModelsChoices, clearClaudeApiConfig, clearCodexApiConfig, commandExists, detectInstalledVersion, displayClaudeConfig, displayCodexConfig, enableCodexFullAccess, ensureClaudeDir, fetchModels, filterByPrefix, getExistingClaudeApiConfig, getExistingCodexConfig, getPlatform, init, installTool, isCliTool, isCodeToolType, isToolInstalled, isWindows, readClaudeSettings, readLocalConfig, resolveCodeToolType, selectInstallMethod, uninstall, uninstallTool, updateLocalConfig, writeClaudeApiConfig, writeCodexApiConfig, writeLocalConfig };
134
134
  export type { ClaudeApiConfig, CodeToolType, CodexApiConfig, InstallMethod, LocalConfig, RelayToolType, RemoteModel };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { C as CLAUDE_DIR, b as CLAUDE_SETTINGS_FILE, f as CODEX_AUTH_FILE, e as CODEX_CONFIG_FILE, d as CODEX_DIR, j as CODE_TOOL_ALIASES, k as CODE_TOOL_LABELS, h as CODE_TOOL_TYPES, D as DEFAULT_CODE_TOOL_TYPE, M as MODEL_PREFIX, n as RELAY_PROVIDER_ID, R as RELAY_TOOL_TYPES, N as buildModelsChoices, s as clearClaudeApiConfig, z as clearCodexApiConfig, c as commandExists, E as detectInstalledVersion, y as disableCodexWindowsSandbox, t as displayClaudeConfig, A as displayCodexConfig, o as ensureClaudeDir, L as fetchModels, O as filterByPrefix, q as getExistingClaudeApiConfig, v as getExistingCodexConfig, g as getPlatform, i as init, G as installTool, m as isCliTool, l as isCodeToolType, B as isToolInstalled, a as isWindows, p as readClaudeSettings, I as readLocalConfig, r as resolveCodeToolType, F as selectInstallMethod, u as uninstall, H as uninstallTool, K as updateLocalConfig, w as writeClaudeApiConfig, x as writeCodexApiConfig, J as writeLocalConfig } from './shared/srpllm.Gqy7fdfo.mjs';
1
+ export { C as CLAUDE_DIR, b as CLAUDE_SETTINGS_FILE, f as CODEX_AUTH_FILE, e as CODEX_CONFIG_FILE, d as CODEX_DIR, j as CODE_TOOL_ALIASES, k as CODE_TOOL_LABELS, h as CODE_TOOL_TYPES, D as DEFAULT_CODE_TOOL_TYPE, M as MODEL_PREFIX, n as RELAY_PROVIDER_ID, R as RELAY_TOOL_TYPES, N as buildModelsChoices, s as clearClaudeApiConfig, z as clearCodexApiConfig, c as commandExists, E as detectInstalledVersion, t as displayClaudeConfig, A as displayCodexConfig, y as enableCodexFullAccess, o as ensureClaudeDir, L as fetchModels, O as filterByPrefix, q as getExistingClaudeApiConfig, v as getExistingCodexConfig, g as getPlatform, i as init, G as installTool, m as isCliTool, l as isCodeToolType, B as isToolInstalled, a as isWindows, p as readClaudeSettings, I as readLocalConfig, r as resolveCodeToolType, F as selectInstallMethod, u as uninstall, H as uninstallTool, K as updateLocalConfig, w as writeClaudeApiConfig, x as writeCodexApiConfig, J as writeLocalConfig } from './shared/srpllm.CdyEHPvp.mjs';
2
2
  import 'node:child_process';
3
3
  import 'node:fs';
4
4
  import 'node:os';
@@ -285,18 +285,39 @@ function writeCodexApiConfig(config) {
285
285
  auth.OPENAI_API_KEY = config.token;
286
286
  writeJson(CODEX_AUTH_FILE, auth);
287
287
  }
288
- function disableCodexWindowsSandbox() {
288
+ function applyCodexFullAccess(content) {
289
+ const settings = {
290
+ sandbox_mode: "danger-full-access",
291
+ approval_policy: "never"
292
+ };
293
+ const lines = content.split("\n");
294
+ let firstSection = lines.findIndex((line) => /^\s*\[[^\]]+\]/.test(line));
295
+ if (firstSection === -1)
296
+ firstSection = lines.length;
297
+ const seen = /* @__PURE__ */ new Set();
298
+ const processed = [];
299
+ for (const line of lines.slice(0, firstSection)) {
300
+ const match = line.match(/^\s*(sandbox_mode|approval_policy)\s*=/);
301
+ if (match) {
302
+ const key = match[1];
303
+ processed.push(`${key} = "${settings[key]}"`);
304
+ seen.add(key);
305
+ } else {
306
+ processed.push(line);
307
+ }
308
+ }
309
+ for (const key of Object.keys(settings)) {
310
+ if (!seen.has(key))
311
+ processed.push(`${key} = "${settings[key]}"`);
312
+ }
313
+ const result = [...processed, ...lines.slice(firstSection)].join("\n").replace(/\n{3,}/g, "\n\n").trimEnd();
314
+ return `${result}
315
+ `;
316
+ }
317
+ function enableCodexFullAccess() {
289
318
  if (!exists(CODEX_CONFIG_FILE))
290
319
  return;
291
- let content = readFileRaw(CODEX_CONFIG_FILE);
292
- if (content.includes('sandbox = "disabled"'))
293
- return;
294
- if (content.match(/^\[windows\]/m)) {
295
- content = content.replace(/^\[windows\]/m, '[windows]\nsandbox = "disabled"');
296
- } else {
297
- content += '\n[windows]\nsandbox = "disabled"\n';
298
- }
299
- writeFile(CODEX_CONFIG_FILE, content);
320
+ writeFile(CODEX_CONFIG_FILE, applyCodexFullAccess(readFileRaw(CODEX_CONFIG_FILE)));
300
321
  }
301
322
  function clearCodexApiConfig() {
302
323
  if (exists(CODEX_CONFIG_FILE)) {
@@ -332,15 +353,6 @@ function maskToken$1(token) {
332
353
  return `${token.slice(0, 4)}***${token.slice(-4)}`;
333
354
  }
334
355
 
335
- const codexConfig = {
336
- __proto__: null,
337
- clearCodexApiConfig: clearCodexApiConfig,
338
- disableCodexWindowsSandbox: disableCodexWindowsSandbox,
339
- displayCodexConfig: displayCodexConfig,
340
- getExistingCodexConfig: getExistingCodexConfig,
341
- writeCodexApiConfig: writeCodexApiConfig
342
- };
343
-
344
356
  function getPlatform() {
345
357
  const p = platform();
346
358
  if (p === "win32")
@@ -591,7 +603,7 @@ function filterByPrefix(models, prefix) {
591
603
  return models.filter((m) => m.id.toLowerCase().startsWith(p));
592
604
  }
593
605
 
594
- const version = "1.2.4";
606
+ const version = "1.2.6";
595
607
 
596
608
  function displayBanner(codeTool) {
597
609
  const tool = codeTool ? ` ${ansis.gray(`\xB7 ${CODE_TOOL_LABELS[codeTool]}`)}` : "";
@@ -742,6 +754,7 @@ async function configureClaudeCode(options, baseUrl, token, memory) {
742
754
  writeClaudeApiConfig(config);
743
755
  console.log(ansis.green("\n\u2714 Claude Code \u914D\u7F6E\u5B8C\u6210"));
744
756
  displayClaudeConfig(config);
757
+ console.log(ansis.yellow("\n \u2139 \u63D0\u793A\uFF1A\u542F\u52A8\u65F6\u9644\u52A0 --dangerously-skip-permissions \u53EF\u8DF3\u8FC7\u6743\u9650\u786E\u8BA4\u3001\u6388\u4E88\u5B8C\u5168\u6743\u9650"));
745
758
  updateLocalConfig({ claude: { model, opusModel, sonnetModel, haikuModel } });
746
759
  }
747
760
  async function configureCodex(options, baseUrl, token, memory) {
@@ -770,13 +783,13 @@ async function configureCodex(options, baseUrl, token, memory) {
770
783
  if (output.includes("WindowsApps")) {
771
784
  console.log(ansis.yellow("\n\u26A0 \u68C0\u6D4B\u5230\u4F60\u4F7F\u7528\u7684\u662F\u5FAE\u8F6F\u5546\u5E97\u7248\u7684 PowerShell (pwsh)"));
772
785
  console.log(ansis.gray(" \u8FD9\u4F1A\u5BFC\u81F4 Codex \u7684 Windows \u6C99\u76D2\u529F\u80FD\u51FA\u73B0 CreateProcessAsUserW failed: 5 \u6743\u9650\u9519\u8BEF\u3002"));
773
- const shouldDisable = options.skipPrompt ? true : await confirm("\u662F\u5426\u81EA\u52A8\u5728 Codex \u914D\u7F6E\u4E2D\u5173\u95ED\u6C99\u76D2\u529F\u80FD\u4EE5\u907F\u514D\u62A5\u9519\uFF1F", true);
774
- if (shouldDisable) {
775
- const { disableCodexWindowsSandbox } = await Promise.resolve().then(function () { return codexConfig; });
776
- disableCodexWindowsSandbox();
777
- console.log(ansis.green("\u2714 \u5DF2\u5728 Codex \u914D\u7F6E\u4E2D\u5173\u95ED\u6C99\u76D2\u529F\u80FD"));
786
+ const shouldApply = options.skipPrompt ? true : await confirm("\u662F\u5426\u81EA\u52A8\u5728 Codex \u914D\u7F6E\u4E2D\u6388\u4E88\u5B8C\u5168\u8BBF\u95EE\u6743\u9650\u5E76\u5173\u95ED\u5BA1\u6279\u4EE5\u907F\u514D\u62A5\u9519\uFF1F", true);
787
+ if (shouldApply) {
788
+ enableCodexFullAccess();
789
+ console.log(ansis.green("\u2714 \u5DF2\u6388\u4E88\u5B8C\u5168\u8BBF\u95EE\u6743\u9650\uFF08sandbox_mode = danger-full-access\uFF09\u5E76\u5173\u95ED\u5BA1\u6279\uFF08approval_policy = never\uFF09"));
790
+ console.log(ansis.gray(" \u2139 \u7B49\u4EF7\u4E8E --dangerously-bypass-approvals-and-sandbox\uFF0CCodex \u542F\u52A8\u540E\u5C06\u8FDB\u5165 YOLO \u6A21\u5F0F"));
778
791
  } else {
779
- console.log(ansis.yellow("\u2139 \u5DF2\u8DF3\u8FC7\uFF0C\u5982\u679C\u540E\u7EED\u8FD0\u884C\u62A5\u9519\uFF0C\u8BF7\u67E5\u9605\u6587\u6863\u6216\u624B\u52A8\u5173\u95ED\u6C99\u76D2"));
792
+ console.log(ansis.yellow("\u2139 \u5DF2\u8DF3\u8FC7\uFF0C\u82E5\u540E\u7EED\u8FD0\u884C\u62A5\u9519\uFF0C\u8BF7\u67E5\u9605\u6587\u6863\u6216\u624B\u52A8\u914D\u7F6E sandbox_mode / approval_policy"));
780
793
  }
781
794
  }
782
795
  } catch {
@@ -946,4 +959,4 @@ ${ansis.cyan("\u{1F389} \u6E05\u7406\u5B8C\u6210")}`);
946
959
  }
947
960
  }
948
961
 
949
- export { displayCodexConfig as A, isToolInstalled as B, CLAUDE_DIR as C, DEFAULT_CODE_TOOL_TYPE as D, detectInstalledVersion as E, selectInstallMethod as F, installTool as G, uninstallTool as H, readLocalConfig as I, writeLocalConfig as J, updateLocalConfig as K, fetchModels as L, MODEL_PREFIX as M, buildModelsChoices as N, filterByPrefix as O, version as P, RELAY_TOOL_TYPES as R, isWindows as a, CLAUDE_SETTINGS_FILE as b, commandExists as c, CODEX_DIR as d, CODEX_CONFIG_FILE as e, CODEX_AUTH_FILE as f, getPlatform as g, CODE_TOOL_TYPES as h, init as i, CODE_TOOL_ALIASES as j, CODE_TOOL_LABELS as k, isCodeToolType as l, isCliTool as m, RELAY_PROVIDER_ID as n, ensureClaudeDir as o, readClaudeSettings as p, getExistingClaudeApiConfig as q, resolveCodeToolType as r, clearClaudeApiConfig as s, displayClaudeConfig as t, uninstall as u, getExistingCodexConfig as v, writeClaudeApiConfig as w, writeCodexApiConfig as x, disableCodexWindowsSandbox as y, clearCodexApiConfig as z };
962
+ export { displayCodexConfig as A, isToolInstalled as B, CLAUDE_DIR as C, DEFAULT_CODE_TOOL_TYPE as D, detectInstalledVersion as E, selectInstallMethod as F, installTool as G, uninstallTool as H, readLocalConfig as I, writeLocalConfig as J, updateLocalConfig as K, fetchModels as L, MODEL_PREFIX as M, buildModelsChoices as N, filterByPrefix as O, version as P, RELAY_TOOL_TYPES as R, isWindows as a, CLAUDE_SETTINGS_FILE as b, commandExists as c, CODEX_DIR as d, CODEX_CONFIG_FILE as e, CODEX_AUTH_FILE as f, getPlatform as g, CODE_TOOL_TYPES as h, init as i, CODE_TOOL_ALIASES as j, CODE_TOOL_LABELS as k, isCodeToolType as l, isCliTool as m, RELAY_PROVIDER_ID as n, ensureClaudeDir as o, readClaudeSettings as p, getExistingClaudeApiConfig as q, resolveCodeToolType as r, clearClaudeApiConfig as s, displayClaudeConfig as t, uninstall as u, getExistingCodexConfig as v, writeClaudeApiConfig as w, writeCodexApiConfig as x, enableCodexFullAccess as y, clearCodexApiConfig as z };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srpllm",
3
3
  "type": "module",
4
- "version": "1.2.4",
4
+ "version": "1.2.6",
5
5
  "packageManager": "pnpm@10.17.1",
6
6
  "description": "SrP-LLM 中转站客户端一键配置工具:安装 Claude Code / Codex 并引导填写 base_url、api_token 与模型",
7
7
  "author": {