poe-code 3.0.34 → 3.0.36

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
@@ -1113,6 +1113,18 @@ async function loadCredentials(options) {
1113
1113
  const document = await readCredentialsDocument(fs3, filePath);
1114
1114
  return typeof document.apiKey === "string" && document.apiKey.length > 0 ? document.apiKey : null;
1115
1115
  }
1116
+ async function deleteCredentials(options) {
1117
+ const { fs: fs3, filePath } = options;
1118
+ try {
1119
+ await fs3.unlink(filePath);
1120
+ return true;
1121
+ } catch (error2) {
1122
+ if (isNotFound(error2)) {
1123
+ return false;
1124
+ }
1125
+ throw error2;
1126
+ }
1127
+ }
1116
1128
  async function loadConfiguredServices(options) {
1117
1129
  const { fs: fs3, filePath } = options;
1118
1130
  const document = await readCredentialsDocument(fs3, filePath);
@@ -15078,7 +15090,7 @@ function createPromptLibrary() {
15078
15090
  return {
15079
15091
  loginApiKey: () => describe3({
15080
15092
  name: "apiKey",
15081
- message: "Enter your Poe API key (get one at https://poe.com/api_key)",
15093
+ message: "Enter your Poe API key (get one at https://poe.com/api/key)",
15082
15094
  type: "password"
15083
15095
  }),
15084
15096
  model: ({ label, defaultValue, choices }) => {
@@ -18830,8 +18842,8 @@ function registerLoginCommand(program, container) {
18830
18842
  configuredServices
18831
18843
  });
18832
18844
  resources.context.complete({
18833
- success: `Poe API key stored at ${container.env.credentialsPath}.`,
18834
- dry: `Dry run: would store Poe API key at ${container.env.credentialsPath}.`
18845
+ success: "Logged in.",
18846
+ dry: "Dry run: would save API key."
18835
18847
  });
18836
18848
  resources.context.finalize();
18837
18849
  } catch (error2) {
@@ -18909,52 +18921,9 @@ async function reconfigureServices(input) {
18909
18921
  }
18910
18922
  }
18911
18923
 
18912
- // src/cli/commands/install.ts
18924
+ // src/cli/commands/logout.ts
18925
+ init_credentials();
18913
18926
  init_shared();
18914
- function registerInstallCommand(program, container) {
18915
- const serviceNames = container.registry.list().filter((service) => typeof service.install === "function").map((service) => service.name);
18916
- const serviceDescription = `Agent to install${formatServiceList(serviceNames)}`;
18917
- return program.command("install").description("Install tooling for a configured agent.").argument(
18918
- "[agent]",
18919
- serviceDescription
18920
- ).action(async (service) => {
18921
- const resolved = await resolveServiceArgument(
18922
- program,
18923
- container,
18924
- service,
18925
- { action: "install" }
18926
- );
18927
- await executeInstall(program, container, resolved);
18928
- });
18929
- }
18930
- async function executeInstall(program, container, service) {
18931
- const adapter = resolveServiceAdapter(container, service);
18932
- const canonicalService = adapter.name;
18933
- const flags = resolveCommandFlags(program);
18934
- const resources = createExecutionResources(
18935
- container,
18936
- flags,
18937
- `install:${canonicalService}`
18938
- );
18939
- resources.logger.intro(`install ${canonicalService}`);
18940
- const providerContext = buildProviderContext(
18941
- container,
18942
- adapter,
18943
- resources
18944
- );
18945
- await container.registry.invoke(canonicalService, "install", async (entry) => {
18946
- if (!entry.install) {
18947
- throw new Error(`Agent "${canonicalService}" does not support install.`);
18948
- }
18949
- await entry.install(providerContext);
18950
- });
18951
- const dryMessage = canonicalService === "claude-code" ? `${adapter.label} install (dry run)` : `Dry run: would install ${adapter.label}.`;
18952
- resources.context.complete({
18953
- success: `Installed ${adapter.label}.`,
18954
- dry: dryMessage
18955
- });
18956
- resources.context.finalize();
18957
- }
18958
18927
 
18959
18928
  // src/cli/commands/unconfigure.ts
18960
18929
  init_credentials();
@@ -19087,6 +19056,94 @@ function formatUnconfigureMessages(service, label, unconfigured, _payload) {
19087
19056
  }
19088
19057
  }
19089
19058
 
19059
+ // src/cli/commands/logout.ts
19060
+ function registerLogoutCommand(program, container) {
19061
+ program.command("logout").description("Remove all Poe API configuration and stored credentials.").action(async () => {
19062
+ const flags = resolveCommandFlags(program);
19063
+ const resources = createExecutionResources(
19064
+ container,
19065
+ flags,
19066
+ "logout"
19067
+ );
19068
+ resources.logger.intro("logout");
19069
+ const configuredServices = await loadConfiguredServices({
19070
+ fs: container.fs,
19071
+ filePath: container.env.credentialsPath
19072
+ });
19073
+ for (const serviceName of Object.keys(configuredServices)) {
19074
+ const adapter = container.registry.get(serviceName);
19075
+ if (!adapter) {
19076
+ continue;
19077
+ }
19078
+ await executeUnconfigure(program, container, serviceName, {});
19079
+ }
19080
+ if (flags.dryRun) {
19081
+ resources.context.complete({
19082
+ success: "Logged out.",
19083
+ dry: `Dry run: would delete credentials at ${container.env.credentialsPath}.`
19084
+ });
19085
+ resources.context.finalize();
19086
+ return;
19087
+ }
19088
+ const deleted = await deleteCredentials({
19089
+ fs: container.fs,
19090
+ filePath: container.env.credentialsPath
19091
+ });
19092
+ resources.context.complete({
19093
+ success: deleted ? "Logged out." : "Already logged out.",
19094
+ dry: `Dry run: would delete credentials at ${container.env.credentialsPath}.`
19095
+ });
19096
+ resources.context.finalize();
19097
+ });
19098
+ }
19099
+
19100
+ // src/cli/commands/install.ts
19101
+ init_shared();
19102
+ function registerInstallCommand(program, container) {
19103
+ const serviceNames = container.registry.list().filter((service) => typeof service.install === "function").map((service) => service.name);
19104
+ const serviceDescription = `Agent to install${formatServiceList(serviceNames)}`;
19105
+ return program.command("install").description("Install tooling for a configured agent.").argument(
19106
+ "[agent]",
19107
+ serviceDescription
19108
+ ).action(async (service) => {
19109
+ const resolved = await resolveServiceArgument(
19110
+ program,
19111
+ container,
19112
+ service,
19113
+ { action: "install" }
19114
+ );
19115
+ await executeInstall(program, container, resolved);
19116
+ });
19117
+ }
19118
+ async function executeInstall(program, container, service) {
19119
+ const adapter = resolveServiceAdapter(container, service);
19120
+ const canonicalService = adapter.name;
19121
+ const flags = resolveCommandFlags(program);
19122
+ const resources = createExecutionResources(
19123
+ container,
19124
+ flags,
19125
+ `install:${canonicalService}`
19126
+ );
19127
+ resources.logger.intro(`install ${canonicalService}`);
19128
+ const providerContext = buildProviderContext(
19129
+ container,
19130
+ adapter,
19131
+ resources
19132
+ );
19133
+ await container.registry.invoke(canonicalService, "install", async (entry) => {
19134
+ if (!entry.install) {
19135
+ throw new Error(`Agent "${canonicalService}" does not support install.`);
19136
+ }
19137
+ await entry.install(providerContext);
19138
+ });
19139
+ const dryMessage = canonicalService === "claude-code" ? `${adapter.label} install (dry run)` : `Dry run: would install ${adapter.label}.`;
19140
+ resources.context.complete({
19141
+ success: `Installed ${adapter.label}.`,
19142
+ dry: dryMessage
19143
+ });
19144
+ resources.context.finalize();
19145
+ }
19146
+
19090
19147
  // src/cli/commands/test.ts
19091
19148
  init_shared();
19092
19149
  init_isolated_env();
@@ -32695,6 +32752,20 @@ async function toPreferredMediaContent(options) {
32695
32752
  });
32696
32753
  return content;
32697
32754
  }
32755
+ if (format === "markdown_instructions") {
32756
+ if (!options.response.url) {
32757
+ throw new Error(
32758
+ `markdown_instructions output requires a URL for ${options.mediaType}. Model response did not include a URL.`
32759
+ );
32760
+ }
32761
+ content.push({
32762
+ type: "text",
32763
+ text: `Render this image as markdown image tag in the chat
32764
+
32765
+ image_url: ${options.response.url}`
32766
+ });
32767
+ return content;
32768
+ }
32698
32769
  if (format === "url") {
32699
32770
  if (options.response.url) {
32700
32771
  content.push({ type: "text", text: options.response.url });
@@ -32856,20 +32927,23 @@ function parseMcpOutputFormatPreferences(value) {
32856
32927
  const normalized = raw.trim().toLowerCase();
32857
32928
  if (normalized.length === 0) {
32858
32929
  throw new ValidationError(
32859
- `Invalid --output-format: empty entry in "${value}". Use "url", "base64", "markdown", or a comma-separated list like "base64,url".`
32930
+ `Invalid --output-format: empty entry in "${value}". Use "url", "base64", "markdown", "markdown_instructions", or a comma-separated list like "base64,url".`
32860
32931
  );
32861
32932
  }
32862
- if (normalized !== "url" && normalized !== "base64" && normalized !== "markdown") {
32933
+ if (normalized !== "url" && normalized !== "base64" && normalized !== "markdown" && normalized !== "markdown_instructions") {
32863
32934
  throw new ValidationError(
32864
- `Invalid --output-format entry "${raw.trim()}". Expected "url", "base64", or "markdown".`
32935
+ `Invalid --output-format entry "${raw.trim()}". Expected "url", "base64", "markdown", or "markdown_instructions".`
32865
32936
  );
32866
32937
  }
32867
32938
  preferences.push(normalized);
32868
32939
  }
32869
- if (preferences.includes("markdown") && preferences.length > 1) {
32870
- throw new ValidationError(
32871
- "markdown output format cannot be combined with other formats. Use markdown alone or choose a different format combination."
32872
- );
32940
+ const standaloneFormats = ["markdown", "markdown_instructions"];
32941
+ for (const standalone of standaloneFormats) {
32942
+ if (preferences.includes(standalone) && preferences.length > 1) {
32943
+ throw new ValidationError(
32944
+ `${standalone} output format cannot be combined with other formats. Use ${standalone} alone or choose a different format combination.`
32945
+ );
32946
+ }
32873
32947
  }
32874
32948
  return preferences;
32875
32949
  }
@@ -33045,7 +33119,7 @@ var agentMcpConfigs = {
33045
33119
  configKey: "mcpServers",
33046
33120
  format: "json",
33047
33121
  shape: "standard",
33048
- mcpOutputFormat: "markdown"
33122
+ mcpOutputFormat: "markdown_instructions"
33049
33123
  },
33050
33124
  codex: {
33051
33125
  configFile: "~/.codex/config.toml",
@@ -33291,6 +33365,15 @@ function registerMcpCommand(program, container) {
33291
33365
  mcp.command("configure [agent]").description("Configure MCP client to use poe-code").option("-y, --yes", "Skip prompt, use claude-code").action(async (agentArg, options) => {
33292
33366
  const flags = resolveCommandFlags(program);
33293
33367
  const resources = createExecutionResources(container, flags, "mcp");
33368
+ const existingKey = await loadCredentials({
33369
+ fs: container.fs,
33370
+ filePath: container.env.credentialsPath
33371
+ });
33372
+ if (!existingKey) {
33373
+ resources.logger.intro("login");
33374
+ await container.options.resolveApiKey({ dryRun: flags.dryRun });
33375
+ resources.logger.success("Logged in.");
33376
+ }
33294
33377
  let agent = agentArg;
33295
33378
  if (!agent) {
33296
33379
  if (options.yes) {
@@ -36230,7 +36313,7 @@ function registerModelsCommand(program, container) {
36230
36313
  // package.json
36231
36314
  var package_default = {
36232
36315
  name: "poe-code",
36233
- version: "3.0.34",
36316
+ version: "3.0.36",
36234
36317
  description: "CLI tool to configure Poe API for developer workflows.",
36235
36318
  type: "module",
36236
36319
  workspaces: [
@@ -36364,6 +36447,11 @@ function formatHelpText(input) {
36364
36447
  args: "<agent>",
36365
36448
  description: "Remove a previously applied configuration"
36366
36449
  },
36450
+ {
36451
+ name: "logout",
36452
+ args: "",
36453
+ description: "Remove all configuration and stored credentials"
36454
+ },
36367
36455
  {
36368
36456
  name: "spawn",
36369
36457
  args: "<agent> [prompt]",
@@ -36550,6 +36638,7 @@ function bootstrapProgram(container) {
36550
36638
  registerTestCommand(program, container);
36551
36639
  registerUnconfigureCommand(program, container);
36552
36640
  registerLoginCommand(program, container);
36641
+ registerLogoutCommand(program, container);
36553
36642
  registerMcpCommand(program, container);
36554
36643
  registerSkillCommand(program, container);
36555
36644
  registerRalphCommand(program, container);