@tumnel/codex 0.1.4 → 0.1.5

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.js CHANGED
@@ -658,6 +658,11 @@ var questionRejectSchema = z2.object({
658
658
  requestId: z2.string().min(1).max(256),
659
659
  directory: directorySchema
660
660
  }).strict();
661
+ var CODEX_DEFAULT_MODEL_ID = "__codex_default__";
662
+ var CODEX_DEFAULT_MODEL_NAME = "Codex default";
663
+ function normalizeModelId(model) {
664
+ return model === CODEX_DEFAULT_MODEL_ID ? void 0 : model;
665
+ }
661
666
  var EventBus = class {
662
667
  queue = [];
663
668
  wake = null;
@@ -1091,7 +1096,7 @@ function createCodexAdapter(options) {
1091
1096
  }
1092
1097
  case "session.prompt": {
1093
1098
  const params = sessionPromptSchema.parse(rawParams);
1094
- const selectedModel = params.model ? params.model.providerID === "codex" ? params.model.modelID : (() => {
1099
+ const selectedModel = params.model ? params.model.providerID === "codex" ? normalizeModelId(params.model.modelID) : (() => {
1095
1100
  throw new Error(`Codex does not support provider ${params.model?.providerID}`);
1096
1101
  })() : void 0;
1097
1102
  let record = sessions.get(params.sessionId);
@@ -1126,17 +1131,18 @@ function createCodexAdapter(options) {
1126
1131
  }
1127
1132
  case "provider.list": {
1128
1133
  providerListSchema.parse(rawParams);
1129
- if (!config.model) return toSafeJson({ default: {}, providers: [] });
1134
+ const modelID = config.model ?? CODEX_DEFAULT_MODEL_ID;
1135
+ const modelName = config.model ?? CODEX_DEFAULT_MODEL_NAME;
1130
1136
  return toSafeJson({
1131
- default: { codex: config.model },
1137
+ default: { codex: modelID },
1132
1138
  providers: [
1133
1139
  {
1134
1140
  id: "codex",
1135
1141
  name: "Codex",
1136
1142
  models: [
1137
1143
  {
1138
- id: config.model,
1139
- name: config.model,
1144
+ id: modelID,
1145
+ name: modelName,
1140
1146
  attachment: false,
1141
1147
  reasoning: true,
1142
1148
  toolCall: true,