theclawbay 0.3.18 → 0.3.19

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.
@@ -25,7 +25,17 @@ const DEFAULT_CODEX_MODEL = "gpt-5.4";
25
25
  const DEFAULT_OPENCLAW_MODEL = "gpt-5.4";
26
26
  const DEFAULT_KILO_MODEL = "gpt-5.4";
27
27
  const DEFAULT_TRAE_MODEL = "gpt-5.4";
28
- const DEFAULT_MODELS = ["gpt-5.4", "gpt-5.3-codex", "gpt-5.3-codex-spark", "gpt-5.2-codex", "gpt-5.1-codex"];
28
+ const DEFAULT_MODELS = [
29
+ "gpt-5.4",
30
+ "gpt-5.3-codex",
31
+ "gpt-5.3-codex-spark",
32
+ "gpt-5.2-codex",
33
+ "gpt-5.2",
34
+ "gpt-5.1-codex-max",
35
+ "gpt-5.1-codex-mini",
36
+ "gpt-5.1-codex",
37
+ "gpt-5.1",
38
+ ];
29
39
  const PREFERRED_MODELS = [
30
40
  "gpt-5.4",
31
41
  "gpt-5.4-codex",
@@ -42,9 +52,11 @@ const MODEL_DISPLAY_NAMES = {
42
52
  "gpt-5.3-codex": "GPT-5.3 Codex",
43
53
  "gpt-5.3-codex-spark": "GPT-5.3 Codex Spark",
44
54
  "gpt-5.2-codex": "GPT-5.2 Codex",
55
+ "gpt-5.2": "GPT-5.2",
45
56
  "gpt-5.1-codex-max": "GPT-5.1 Codex Max",
46
57
  "gpt-5.1-codex-mini": "GPT-5.1 Codex Mini",
47
58
  "gpt-5.1-codex": "GPT-5.1 Codex",
59
+ "gpt-5.1": "GPT-5.1",
48
60
  };
49
61
  const ENV_KEY_NAME = "CODEX_LB_API_KEY";
50
62
  const ENV_FILE = node_path_1.default.join(node_os_1.default.homedir(), ".config", "theclawbay", "env");
@@ -61,6 +73,8 @@ const TRAE_PATCH_MARKER = "theclawbay-trae-patch";
61
73
  const TRAE_BUNDLE_BACKUP_SUFFIX = ".theclawbay-managed-backup";
62
74
  const TRAE_TARGET_FUNCTION_START = "async setOriginModelListMapAndCache(e,t=!0){";
63
75
  const TRAE_TARGET_FUNCTION_END = "}async refreshModelListConfig";
76
+ const TRAE_REQUEST_MODEL_INFO_START = "createChatRequestModelInfo(e,t,r,i){";
77
+ const TRAE_REQUEST_MODEL_INFO_END = "}getCurrentAgent(){";
64
78
  function trimTrailingSlash(value) {
65
79
  return value.replace(/\/+$/g, "");
66
80
  }
@@ -632,6 +646,9 @@ function traePatchSnippet(params) {
632
646
  const proxyBaseUrl = `${trimTrailingSlash(params.backendUrl)}/api/codex-auth/v1/proxy/v1`;
633
647
  return `async setOriginModelListMapAndCache(e,t=!0){let{userProfile:r}=this.credentialStore.getState(),i=r?.scope!==v9.BYTEDANCE,n={},o=${JSON.stringify(patchedModels)};Object.keys(e).forEach(t=>{let r=[...(e[t]||[])],s=r[0]&&"object"==typeof r[0]?r[0]:null;if([Mh.Builder,Mh.SoloCoder].includes(t)&&s){let a=o.map((e,l)=>{let o={...s};return o.id=${JSON.stringify(TRAE_PATCH_MARKER)}+"-"+t+"-"+e.id,o.name=e.id,o.display_name="TheClawBay "+e.name,o.provider="openrouter",o.icon={dark:"https://theclawbay.com/favicon.ico",light:"https://theclawbay.com/favicon.ico"},o.ak=${JSON.stringify(params.apiKey)},o.base_url=${JSON.stringify(proxyBaseUrl)},o.is_custom_base_url=!0,o.custom_model_id=${JSON.stringify(TRAE_PATCH_MARKER)}+"-"+e.id,o.selectable=!0,o.status=!0,o.is_default=0===l,o.config_source=s.config_source,o.model_type=s.model_type??"chat_model",o.builder=s.builder??null,o.client_connect=!0,o.multimodal=!1!==s.multimodal,o.tags=Array.isArray(s.tags)?s.tags:[],o.auth_type="number"==typeof s.auth_type?s.auth_type:0,o.region=s.region??null,o.max_turns=s.max_turns??{default:50,max:50},o.context_window_size=s.context_window_size??{max:[128000],default:64000},o.features=s.features??{memory:{enable:!1},cost:{enable:!1,data:{manual_usage:0}},multimodal:{enable:!0},context_windows:{enable:!0,data:{dev_context:64000,max_context:128000,max_context_list:[128000],dev_turns:50,max_turns:50}}},o.commercial_info=s.commercial_info??{manual_usage:0,info:""},o.saas_usage=s.saas_usage??{max:0,default:null},o});n[t]=a;return}!i&&[Mh.SoloCoder,Mh.UIBuilder].includes(t)?n[t]=r?.filter(e=>e.config_source!==MK.Personal)||[]:n[t]=r}),this._modelStore.actions.setOriginModelListMap(n),t&&this._modelStorageService.storeModelListMap(n),this._logService.info("[ModelService.setOriginModelListMapAndCache] officialModels",Object.entries(n).map(([e,t])=>({scene:e,models:(t||[]).map(e=>e.display_name||e.name)})))}`;
634
648
  }
649
+ function traeRequestModelInfoPatchSnippet() {
650
+ return `createChatRequestModelInfo(e,t,r,i){let n,o;let a=t||this.sessionStore.getState().currentAgent;if(a?.type===SL.DSLAgent&&a.dsl_agent_model_config)try{let e=JSON.parse(a.dsl_agent_model_config);return{provider:e.provider||"",config_name:e.model_name||"",display_model_name:e.config_name||e.model_name,is_preset:!0,config_source:MK.Trae,use_remote_service:!0,multimodal:!1,context_window_size:e.max_tokens,ak:"",base_url:"",region:void 0,sk:"",auth_type:0}}catch(e){console.error("Failed to parse dsl_agent_model_config:",e)}let s=this.modelStore.actions.getDefaultModelByAgentType(a?.type);if(i){let e=this.sessionRelationStore.getSessionAgentType(i);e&&(n=this.sessionRelationStore.getSessionModel(i,e))}n||(n=s),o=r?this.modelStore.actions.getModelListByAgentType(a?.type).find(e=>e.name===r||e.config_name===r)||s||n:e===xC.InlineChat?s:n;let l=o?.name||r||"",u={provider:o?.provider||"",config_name:l,display_model_name:o?.display_name,multimodal:o?.multimodal===!0,ak:o?.ak||"",use_remote_service:!o?.client_connect,is_preset:o?.config_source===MK.Trae,config_source:o?.config_source??MK.Personal,base_url:o?.base_url||"",context_window_size:o?.selected_max_context_window_size,region:o?.region,sk:o?.sk||"",auth_type:o?.auth_type||0};if(o?.custom_model_id?.startsWith(${JSON.stringify(TRAE_PATCH_MARKER)})||o?.base_url?.includes("/api/codex-auth/v1/proxy/v1"))u={...u,use_remote_service:!1,is_preset:!1,config_source:MK.Personal,base_url:o?.base_url||u.base_url,ak:o?.ak||u.ak,region:o?.region??u.region,sk:o?.sk||u.sk,auth_type:o?.auth_type||u.auth_type};let d=this.configurationService.getConfiguration("ai_assistant.request.aws_session_token")||void 0;return d&&(u.session_token=d),u}`;
651
+ }
635
652
  async function patchTraeBundle(params) {
636
653
  const bundlePath = traeBundlePath();
637
654
  if (!bundlePath)
@@ -652,10 +669,12 @@ async function patchTraeBundle(params) {
652
669
  }
653
670
  const functionStart = baseSource.indexOf(TRAE_TARGET_FUNCTION_START);
654
671
  const functionEnd = functionStart >= 0 ? baseSource.indexOf(TRAE_TARGET_FUNCTION_END, functionStart) : -1;
655
- if (functionStart < 0 || functionEnd < 0) {
672
+ const requestModelInfoStart = baseSource.indexOf(TRAE_REQUEST_MODEL_INFO_START);
673
+ const requestModelInfoEnd = requestModelInfoStart >= 0 ? baseSource.indexOf(TRAE_REQUEST_MODEL_INFO_END, requestModelInfoStart) : -1;
674
+ if (functionStart < 0 || functionEnd < 0 || requestModelInfoStart < 0 || requestModelInfoEnd < 0) {
656
675
  throw new Error("Unsupported Trae build for experimental The Claw Bay patching.");
657
676
  }
658
- const next = baseSource.slice(0, functionStart) +
677
+ const withModelListPatch = baseSource.slice(0, functionStart) +
659
678
  traePatchSnippet({
660
679
  backendUrl: params.backendUrl,
661
680
  apiKey: params.apiKey,
@@ -663,6 +682,9 @@ async function patchTraeBundle(params) {
663
682
  models: params.models,
664
683
  }) +
665
684
  baseSource.slice(functionEnd + 1);
685
+ const next = withModelListPatch.slice(0, requestModelInfoStart) +
686
+ traeRequestModelInfoPatchSnippet() +
687
+ withModelListPatch.slice(requestModelInfoEnd);
666
688
  await promises_1.default.writeFile(bundlePath, next, "utf8");
667
689
  return bundlePath;
668
690
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "theclawbay",
3
- "version": "0.3.18",
3
+ "version": "0.3.19",
4
4
  "description": "CLI for connecting Codex, OpenClaw, OpenCode, Kilo, and experimental Trae to The Claw Bay.",
5
5
  "license": "MIT",
6
6
  "bin": {