poe-code 3.0.111 → 3.0.113

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
@@ -16315,7 +16315,7 @@ function registerGenerateCommand(program, container) {
16315
16315
  const prompt = ensurePrompt(promptArg, { type: "text", isDefault: true });
16316
16316
  const opts = resolveGenerateOptions(this);
16317
16317
  const params = parseParams(normalizeParamList(opts.param));
16318
- const model = resolveModel2("text", opts, container.env.variables);
16318
+ const model = await resolveModel2("text", opts, container);
16319
16319
  if (flags.dryRun) {
16320
16320
  resources.logger.dryRun(
16321
16321
  `Dry run: would generate text with model ${model} and prompt (${prompt.length} chars)`
@@ -16346,7 +16346,7 @@ function registerGenerateCommand(program, container) {
16346
16346
  const prompt = ensurePrompt(promptArg, { type: "text", isDefault: false });
16347
16347
  const opts = resolveGenerateOptions(this);
16348
16348
  const params = parseParams(normalizeParamList(opts.param));
16349
- const model = resolveModel2("text", opts, container.env.variables);
16349
+ const model = await resolveModel2("text", opts, container);
16350
16350
  if (flags.dryRun) {
16351
16351
  resources.logger.dryRun(
16352
16352
  `Dry run: would generate text with model ${model} and prompt (${prompt.length} chars)`
@@ -16383,7 +16383,7 @@ function registerMediaSubcommand(generate2, program, container, type) {
16383
16383
  const prompt = ensurePrompt(promptArg, { type, isDefault: false });
16384
16384
  const opts = resolveGenerateOptions(this);
16385
16385
  const params = parseParams(normalizeParamList(opts.param));
16386
- const model = resolveModel2(type, opts, container.env.variables);
16386
+ const model = await resolveModel2(type, opts, container);
16387
16387
  if (flags.dryRun) {
16388
16388
  resources.logger.dryRun(
16389
16389
  `Dry run: would generate ${type} with model ${model} and prompt (${prompt.length} chars)`
@@ -16501,15 +16501,22 @@ function resolveApiBaseUrl(container) {
16501
16501
  }
16502
16502
  return container.env.poeApiBaseUrl;
16503
16503
  }
16504
- function resolveModel2(type, options, variables) {
16504
+ async function resolveModel2(type, options, container) {
16505
16505
  if (options.model) {
16506
16506
  return options.model;
16507
16507
  }
16508
16508
  const envKey = MODEL_ENV_KEYS2[type];
16509
- const envModel = normalizeEnvModel2(variables ? variables[envKey] : void 0);
16509
+ const envModel = normalizeEnvModel2(container.env.variables[envKey]);
16510
16510
  if (envModel) {
16511
16511
  return envModel;
16512
16512
  }
16513
+ const configModel = await loadAgentModel(
16514
+ { fs: container.fs, filePath: container.env.configPath },
16515
+ `generate-${type}`
16516
+ );
16517
+ if (configModel) {
16518
+ return configModel;
16519
+ }
16513
16520
  return DEFAULT_MODELS2[type];
16514
16521
  }
16515
16522
  function normalizeEnvModel2(value) {
@@ -16586,6 +16593,7 @@ var init_generate = __esm({
16586
16593
  init_client_instance();
16587
16594
  init_media_download();
16588
16595
  init_errors();
16596
+ init_src4();
16589
16597
  MODEL_ENV_KEYS2 = {
16590
16598
  text: "POE_TEXT_MODEL",
16591
16599
  image: "POE_IMAGE_MODEL",
@@ -39154,14 +39162,43 @@ function hasFeature(model, feature) {
39154
39162
  if (feature === "reasoning") return model.reasoning != null;
39155
39163
  return (model.supported_features ?? []).includes(feature);
39156
39164
  }
39165
+ function normalizeEndpoint(endpoint) {
39166
+ const trimmed = endpoint.trim().toLowerCase();
39167
+ return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
39168
+ }
39169
+ function preprocessModels(models) {
39170
+ const availableEndpoints = /* @__PURE__ */ new Set();
39171
+ const preprocessedModels = models.map((model) => {
39172
+ const normalizedSupportedEndpoints = (model.supported_endpoints ?? []).map(normalizeEndpoint);
39173
+ for (const endpoint of normalizedSupportedEndpoints) {
39174
+ availableEndpoints.add(endpoint);
39175
+ }
39176
+ return {
39177
+ ...model,
39178
+ normalized_supported_endpoints: normalizedSupportedEndpoints
39179
+ };
39180
+ });
39181
+ return {
39182
+ models: preprocessedModels,
39183
+ availableEndpoints: Array.from(availableEndpoints).sort()
39184
+ };
39185
+ }
39186
+ function toRawModel(model) {
39187
+ const { normalized_supported_endpoints, ...rawModel } = model;
39188
+ return rawModel;
39189
+ }
39190
+ function hasActiveFilters(options) {
39191
+ return options.provider !== void 0 || options.model !== void 0 || options.search !== void 0 || options.feature !== void 0 || options.endpoint !== void 0 || options.input !== void 0 || options.output !== void 0 || options.tools === true || options.since !== void 0;
39192
+ }
39157
39193
  function registerModelsCommand(program, container) {
39158
- program.command("models").description("List available Poe API models.").option("--provider <name>", "Filter by provider name").option("--model <name>", "Filter by exact model id").option("--search <term>", "Search model id and provider name").option("--feature <name>", "Filter by feature (tools, web_search, reasoning)").option("--input <modalities>", "Filter by input modalities (e.g. text,image)").option("--output <modalities>", "Filter by output modalities (e.g. text)").option("--tools", "Show only models with tool support").option("--since <duration>", "Show models added within duration (e.g. 7d, 2w, 3mo)").option("--view <name>", "Table view: capabilities, pricing, parameters, or raw", "capabilities").addHelpText("after", [
39194
+ program.command("models").description("List available Poe API models.").option("--provider <name>", "Filter by provider name").option("--model <name>", "Filter by exact model id").option("--search <term>", "Search model id and provider name").option("--feature <name>", "Filter by feature (tools, web_search, reasoning)").option("--endpoint <path>", "Filter by supported endpoint (e.g. /v1/responses)").option("--input <modalities>", "Filter by input modalities (e.g. text,image)").option("--output <modalities>", "Filter by output modalities (e.g. text)").option("--tools", "Show only models with tool support").option("--since <duration>", "Show models added within duration (e.g. 7d, 2w, 3mo)").option("--view <name>", "Table view: capabilities, pricing, parameters, or raw", "capabilities").addHelpText("after", [
39159
39195
  "",
39160
39196
  "Filters:",
39161
39197
  " --provider Substring match on provider/owner (e.g. anthropic, openai)",
39162
39198
  " --model Exact model id match (case-insensitive, e.g. gpt-5.2-codex)",
39163
39199
  " --search Substring match on model id and provider (e.g. sonnet, openai)",
39164
39200
  " --feature Exact match: tools, web_search, or reasoning",
39201
+ " --endpoint Exact supported endpoint match (e.g. /v1/responses)",
39165
39202
  " --input Comma-separated input modalities: text, image, audio, video",
39166
39203
  " --output Comma-separated output modalities: text, image, audio",
39167
39204
  " --tools Shorthand for --feature tools",
@@ -39176,6 +39213,7 @@ function registerModelsCommand(program, container) {
39176
39213
  "Examples:",
39177
39214
  " $ poe-code models --provider anthropic",
39178
39215
  " $ poe-code models --feature reasoning --since 3mo",
39216
+ " $ poe-code models --endpoint /v1/responses",
39179
39217
  " $ poe-code models --input image --view pricing",
39180
39218
  " $ poe-code models --search claude --view parameters",
39181
39219
  " $ poe-code models --model claude-opus-4.6 --view raw",
@@ -39222,9 +39260,9 @@ function registerModelsCommand(program, container) {
39222
39260
  }
39223
39261
  return await response.json();
39224
39262
  },
39225
- stopMessage: (r) => `${r.data.length} models`
39263
+ stopMessage: (r) => `${r.data.length} models fetched`
39226
39264
  });
39227
- const allModels = result.data;
39265
+ const { models: allModels, availableEndpoints } = preprocessModels(result.data);
39228
39266
  if (allModels.length === 0) {
39229
39267
  resources.logger.info("No models found.");
39230
39268
  return;
@@ -39252,6 +39290,18 @@ function registerModelsCommand(program, container) {
39252
39290
  const feature = commandOptions.feature.toLowerCase();
39253
39291
  filtered = filtered.filter((m) => hasFeature(m, feature));
39254
39292
  }
39293
+ if (commandOptions.endpoint) {
39294
+ const endpoint = normalizeEndpoint(commandOptions.endpoint);
39295
+ if (!availableEndpoints.includes(endpoint)) {
39296
+ const availableLabel = availableEndpoints.length > 0 ? availableEndpoints.join(", ") : "none";
39297
+ throw new ValidationError(
39298
+ `Unsupported endpoint "${endpoint}". Available endpoints: ${availableLabel}`
39299
+ );
39300
+ }
39301
+ filtered = filtered.filter(
39302
+ (m) => m.normalized_supported_endpoints.includes(endpoint)
39303
+ );
39304
+ }
39255
39305
  if (commandOptions.tools) {
39256
39306
  filtered = filtered.filter((m) => hasFeature(m, "tools"));
39257
39307
  }
@@ -39276,6 +39326,9 @@ function registerModelsCommand(program, container) {
39276
39326
  filtered = filtered.filter((m) => m.created >= cutoff);
39277
39327
  }
39278
39328
  }
39329
+ if (hasActiveFilters(commandOptions)) {
39330
+ resources.logger.info(`${filtered.length}/${allModels.length} models`);
39331
+ }
39279
39332
  if (filtered.length === 0) {
39280
39333
  resources.logger.info("No models match the given filters.");
39281
39334
  return;
@@ -39283,7 +39336,7 @@ function registerModelsCommand(program, container) {
39283
39336
  filtered.sort((a, b) => b.created - a.created);
39284
39337
  const theme = getTheme();
39285
39338
  if (commandOptions.view === "raw") {
39286
- resources.logger.info(yamlStringify(filtered));
39339
+ resources.logger.info(yamlStringify(filtered.map(toRawModel)));
39287
39340
  return;
39288
39341
  }
39289
39342
  let columns;
@@ -40012,7 +40065,7 @@ var init_package = __esm({
40012
40065
  "package.json"() {
40013
40066
  package_default = {
40014
40067
  name: "poe-code",
40015
- version: "3.0.111",
40068
+ version: "3.0.113",
40016
40069
  description: "CLI tool to configure Poe API for developer workflows.",
40017
40070
  type: "module",
40018
40071
  main: "./dist/index.js",
@@ -40175,26 +40228,6 @@ function formatHelpText(input) {
40175
40228
  args: "",
40176
40229
  description: "Remove all configuration"
40177
40230
  },
40178
- {
40179
- name: "utils config",
40180
- args: "",
40181
- description: "Show config file paths and usage hints"
40182
- },
40183
- {
40184
- name: "utils config show",
40185
- args: "",
40186
- description: "Show config inputs and resolved result"
40187
- },
40188
- {
40189
- name: "utils config init",
40190
- args: "",
40191
- description: "Create a project config file"
40192
- },
40193
- {
40194
- name: "utils config edit",
40195
- args: "",
40196
- description: "Open a config file in your editor"
40197
- },
40198
40231
  {
40199
40232
  name: "auth status",
40200
40233
  args: "",
@@ -40264,6 +40297,26 @@ function formatHelpText(input) {
40264
40297
  name: "usage list",
40265
40298
  args: "",
40266
40299
  description: "Display usage history"
40300
+ },
40301
+ {
40302
+ name: "utils config",
40303
+ args: "",
40304
+ description: "Show config file paths and usage hints"
40305
+ },
40306
+ {
40307
+ name: "utils config show",
40308
+ args: "",
40309
+ description: "Show config inputs and resolved result"
40310
+ },
40311
+ {
40312
+ name: "utils config init",
40313
+ args: "",
40314
+ description: "Create a project config file"
40315
+ },
40316
+ {
40317
+ name: "utils config edit",
40318
+ args: "",
40319
+ description: "Open a config file in your editor"
40267
40320
  }
40268
40321
  ];
40269
40322
  const nameWidth = Math.max(0, ...commandRows.map((row) => row.name.length));