@moxxy/cli 0.3.1 → 0.3.3

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/bin.js CHANGED
@@ -95773,6 +95773,12 @@ function toAnthropicBlock(block) {
95773
95773
  type: "image",
95774
95774
  source: { type: "base64", media_type: block.mediaType, data: block.data }
95775
95775
  };
95776
+ case "document":
95777
+ return {
95778
+ type: "document",
95779
+ source: { type: "base64", media_type: block.mediaType, data: block.data },
95780
+ ...block.name ? { title: block.name } : {}
95781
+ };
95776
95782
  case "audio":
95777
95783
  return {
95778
95784
  type: "text",
@@ -95794,9 +95800,9 @@ function toAnthropicTools(tools, opts = {}) {
95794
95800
 
95795
95801
  // ../plugin-provider-anthropic/dist/provider.js
95796
95802
  var anthropicModels = [
95797
- { id: "claude-opus-4-7", contextWindow: 8e5, maxOutputTokens: 8e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
95798
- { id: "claude-sonnet-4-6", contextWindow: 2e5, maxOutputTokens: 8e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
95799
- { id: "claude-haiku-4-5-20251001", contextWindow: 2e5, maxOutputTokens: 8e3, supportsTools: true, supportsStreaming: true, supportsImages: true }
95803
+ { id: "claude-opus-4-7", contextWindow: 8e5, maxOutputTokens: 8e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
95804
+ { id: "claude-sonnet-4-6", contextWindow: 2e5, maxOutputTokens: 8e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
95805
+ { id: "claude-haiku-4-5-20251001", contextWindow: 2e5, maxOutputTokens: 8e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true }
95800
95806
  ];
95801
95807
  var AnthropicProvider = class {
95802
95808
  name = "anthropic";
@@ -102255,8 +102261,8 @@ function toOpenAIMessages(messages) {
102255
102261
  continue;
102256
102262
  }
102257
102263
  if (msg.role === "user") {
102258
- const hasImage = msg.content.some((c2) => c2.type === "image");
102259
- if (hasImage) {
102264
+ const hasRichPart = msg.content.some((c2) => c2.type === "image" || c2.type === "document");
102265
+ if (hasRichPart) {
102260
102266
  const parts = [];
102261
102267
  for (const c2 of msg.content) {
102262
102268
  if (c2.type === "text") {
@@ -102266,6 +102272,14 @@ function toOpenAIMessages(messages) {
102266
102272
  type: "image_url",
102267
102273
  image_url: { url: `data:${c2.mediaType};base64,${c2.data}` }
102268
102274
  });
102275
+ } else if (c2.type === "document") {
102276
+ parts.push({
102277
+ type: "file",
102278
+ file: {
102279
+ ...c2.name ? { filename: c2.name } : {},
102280
+ file_data: `data:${c2.mediaType};base64,${c2.data}`
102281
+ }
102282
+ });
102269
102283
  }
102270
102284
  }
102271
102285
  out.push({ role: "user", content: parts });
@@ -102317,24 +102331,24 @@ function toOpenAITools(tools) {
102317
102331
  // ../plugin-provider-openai/dist/provider.js
102318
102332
  var openAIModels = [
102319
102333
  // GPT-5.5 family (released April 23, 2026): newest frontier class.
102320
- { id: "gpt-5.5", contextWindow: 105e4, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
102321
- { id: "gpt-5.5-pro", contextWindow: 105e4, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
102334
+ { id: "gpt-5.5", contextWindow: 105e4, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
102335
+ { id: "gpt-5.5-pro", contextWindow: 105e4, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
102322
102336
  // GPT-5.4 family: cheaper general-purpose tier; -mini and -nano are the
102323
102337
  // new sweet-spot defaults for high-volume agentic workloads.
102324
- { id: "gpt-5.4", contextWindow: 1e6, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
102325
- { id: "gpt-5.4-pro", contextWindow: 1e6, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
102326
- { id: "gpt-5.4-mini", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
102327
- { id: "gpt-5.4-nano", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
102338
+ { id: "gpt-5.4", contextWindow: 1e6, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
102339
+ { id: "gpt-5.4-pro", contextWindow: 1e6, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
102340
+ { id: "gpt-5.4-mini", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
102341
+ { id: "gpt-5.4-nano", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
102328
102342
  // GPT-5.3-Codex: agentic coding specialist. Vision-capable.
102329
- { id: "gpt-5.3-codex", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
102343
+ { id: "gpt-5.3-codex", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
102330
102344
  // GPT-5.2 and GPT-5: prior reasoning models, configurable effort.
102331
- { id: "gpt-5.2", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
102332
- { id: "gpt-5", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
102345
+ { id: "gpt-5.2", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
102346
+ { id: "gpt-5", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
102333
102347
  // GPT-4 family: kept for explicit-pin use cases.
102334
- // 4.1 is text-only; 4o/4o-mini/4-turbo are vision-capable.
102348
+ // 4.1 is text-only; 4o/4o-mini are vision + document capable; 4-turbo predates file inputs.
102335
102349
  { id: "gpt-4.1", contextWindow: 1e6, maxOutputTokens: 32768, supportsTools: true, supportsStreaming: true },
102336
- { id: "gpt-4o", contextWindow: 128e3, maxOutputTokens: 16384, supportsTools: true, supportsStreaming: true, supportsImages: true },
102337
- { id: "gpt-4o-mini", contextWindow: 128e3, maxOutputTokens: 16384, supportsTools: true, supportsStreaming: true, supportsImages: true },
102350
+ { id: "gpt-4o", contextWindow: 128e3, maxOutputTokens: 16384, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
102351
+ { id: "gpt-4o-mini", contextWindow: 128e3, maxOutputTokens: 16384, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
102338
102352
  { id: "gpt-4-turbo", contextWindow: 128e3, maxOutputTokens: 4096, supportsTools: true, supportsStreaming: true, supportsImages: true }
102339
102353
  ];
102340
102354
  var OpenAIProvider = class {
@@ -102514,24 +102528,35 @@ var openaiPlugin = definePlugin({
102514
102528
  // ../plugin-oauth/dist/oauth/browser-flow.js
102515
102529
  init_pkce();
102516
102530
  async function openInBrowser(url2) {
102517
- const { cmd, args } = chooseOpener(url2);
102531
+ const { cmd, args, verbatim } = browserOpenCommand(url2);
102518
102532
  await new Promise((resolve12, reject) => {
102519
- const child = spawn(cmd, args, { stdio: "ignore", detached: true });
102533
+ const child = spawn(cmd, args, {
102534
+ stdio: "ignore",
102535
+ detached: true,
102536
+ // Windows only: keep cmd.exe from re-quoting our already-quoted URL,
102537
+ // which would otherwise break the `&` escaping (see below).
102538
+ ...verbatim ? { windowsVerbatimArguments: true } : {}
102539
+ });
102520
102540
  child.once("error", reject);
102521
102541
  child.unref();
102522
102542
  setTimeout(resolve12, 50);
102523
102543
  });
102524
102544
  }
102525
- function chooseOpener(url2) {
102526
- if (process.platform === "darwin")
102545
+ function browserOpenCommand(url2, platform2 = process.platform) {
102546
+ if (platform2 === "darwin")
102527
102547
  return { cmd: "open", args: [url2] };
102528
- if (process.platform === "win32")
102529
- return { cmd: "cmd", args: ["/c", "start", '""', url2] };
102548
+ if (platform2 === "win32") {
102549
+ return {
102550
+ cmd: process.env.ComSpec || "cmd.exe",
102551
+ args: ["/c", "start", '""', `"${url2}"`],
102552
+ verbatim: true
102553
+ };
102554
+ }
102530
102555
  return { cmd: "xdg-open", args: [url2] };
102531
102556
  }
102532
102557
  function waitForCallback(opts) {
102533
102558
  return new Promise((resolve12, reject) => {
102534
- let server = null;
102559
+ const servers = [];
102535
102560
  let settled = false;
102536
102561
  const settle = (fn) => {
102537
102562
  if (settled)
@@ -102539,8 +102564,8 @@ function waitForCallback(opts) {
102539
102564
  settled = true;
102540
102565
  clearTimeout(timer);
102541
102566
  opts.signal?.removeEventListener("abort", onAbort);
102542
- if (server)
102543
- server.close();
102567
+ for (const s2 of servers)
102568
+ s2.close();
102544
102569
  fn();
102545
102570
  };
102546
102571
  const timer = setTimeout(() => {
@@ -102559,7 +102584,7 @@ function waitForCallback(opts) {
102559
102584
  })));
102560
102585
  };
102561
102586
  opts.signal?.addEventListener("abort", onAbort, { once: true });
102562
- server = createServer((req, res) => {
102587
+ const handleRequest = (req, res) => {
102563
102588
  const url2 = new URL(req.url ?? "/", `http://localhost:${opts.port}`);
102564
102589
  if (url2.pathname !== opts.path) {
102565
102590
  res.writeHead(404, { "Content-Type": "text/plain" });
@@ -102607,13 +102632,10 @@ function waitForCallback(opts) {
102607
102632
  }
102608
102633
  res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
102609
102634
  res.end(htmlPage("Authorized", "You can close this window \u2014 moxxy received the token."));
102610
- clearTimeout(timer);
102611
102635
  settle(() => resolve12(code));
102612
- });
102613
- server.on("error", (e3) => {
102614
- clearTimeout(timer);
102615
- const code = e3.code;
102616
- if (code === "EADDRINUSE") {
102636
+ };
102637
+ const onFatalError = (e3) => {
102638
+ if (e3.code === "EADDRINUSE") {
102617
102639
  settle(() => reject(new MoxxyError({
102618
102640
  code: "OAUTH_FLOW_PORT_BUSY",
102619
102641
  message: `OAuth callback port ${opts.port} is already in use.`,
@@ -102627,8 +102649,15 @@ function waitForCallback(opts) {
102627
102649
  code: "INTERNAL",
102628
102650
  message: `OAuth callback server failed: ${e3.message}`
102629
102651
  })));
102630
- });
102631
- server.listen(opts.port, "127.0.0.1");
102652
+ };
102653
+ const v4 = createServer(handleRequest);
102654
+ v4.on("error", onFatalError);
102655
+ v4.listen(opts.port, "127.0.0.1");
102656
+ servers.push(v4);
102657
+ const v6 = createServer(handleRequest);
102658
+ v6.on("error", () => void 0);
102659
+ v6.listen(opts.port, "::1");
102660
+ servers.push(v6);
102632
102661
  });
102633
102662
  }
102634
102663
  function htmlPage(title, body) {
@@ -103523,12 +103552,12 @@ async function refreshTokens(refreshToken, fetchImpl = fetch) {
103523
103552
 
103524
103553
  // ../plugin-provider-openai-codex/dist/models.js
103525
103554
  var codexModels = [
103526
- { id: "gpt-5.5", contextWindow: 1e6, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
103527
- { id: "gpt-5.4", contextWindow: 1e6, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
103528
- { id: "gpt-5.4-mini", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
103529
- { id: "gpt-5.3-codex", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
103530
- { id: "gpt-5.3-codex-spark", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
103531
- { id: "gpt-5.2", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true }
103555
+ { id: "gpt-5.5", contextWindow: 1e6, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
103556
+ { id: "gpt-5.4", contextWindow: 1e6, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
103557
+ { id: "gpt-5.4-mini", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
103558
+ { id: "gpt-5.3-codex", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
103559
+ { id: "gpt-5.3-codex-spark", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
103560
+ { id: "gpt-5.2", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true }
103532
103561
  ];
103533
103562
  var DEFAULT_CODEX_MODEL = "gpt-5.3-codex";
103534
103563
  function contentBlocksToInputText(role, blocks) {
@@ -103538,6 +103567,12 @@ function contentBlocksToInputText(role, blocks) {
103538
103567
  out.push({ type: "input_text", text: block.text });
103539
103568
  } else if (block.type === "image") {
103540
103569
  out.push({ type: "input_image", image_url: `data:${block.mediaType};base64,${block.data}` });
103570
+ } else if (block.type === "document") {
103571
+ out.push({
103572
+ type: "input_file",
103573
+ ...block.name ? { filename: block.name } : {},
103574
+ file_data: `data:${block.mediaType};base64,${block.data}`
103575
+ });
103541
103576
  }
103542
103577
  }
103543
103578
  return out;
@@ -119530,13 +119565,17 @@ async function reclaimStaleSocket(socketPath) {
119530
119565
  }
119531
119566
  }
119532
119567
  }
119568
+ function platformSocket(name, posixPath, platform2 = process.platform) {
119569
+ if (platform2 === "win32") {
119570
+ return `\\\\.\\pipe\\moxxy-${name.replace(/[^A-Za-z0-9_-]/g, "_")}`;
119571
+ }
119572
+ return posixPath;
119573
+ }
119533
119574
  function runnerSocketPath() {
119534
119575
  const override = process.env.MOXXY_RUNNER_SOCKET;
119535
119576
  if (override)
119536
119577
  return override;
119537
- if (process.platform === "win32")
119538
- return "\\\\.\\pipe\\moxxy-serve";
119539
- return path3__default.join(os5__default.homedir(), ".moxxy", "serve.sock");
119578
+ return platformSocket("serve", path3__default.join(os5__default.homedir(), ".moxxy", "serve.sock"));
119540
119579
  }
119541
119580
  function isRunnerUp(socketPath = runnerSocketPath()) {
119542
119581
  return new Promise((resolve12) => {
@@ -119813,6 +119852,7 @@ var RunnerServer = class {
119813
119852
  if (def)
119814
119853
  this.session.providers.replace(def);
119815
119854
  this.session.providers.setActive(name, cfg);
119855
+ void savePreferences({ providerName: name });
119816
119856
  this.broadcastInfo();
119817
119857
  return {};
119818
119858
  }