@hongymagic/q 2026.306.0 → 2026.306.1-next.3e2fb1d

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.
Files changed (2) hide show
  1. package/dist/q.js +136 -25
  2. package/package.json +10 -10
package/dist/q.js CHANGED
@@ -14641,7 +14641,7 @@ import { parseArgs } from "node:util";
14641
14641
  // package.json
14642
14642
  var package_default = {
14643
14643
  name: "@hongymagic/q",
14644
- version: "2026.306.0",
14644
+ version: "2026.306.1-next.3e2fb1d",
14645
14645
  description: "Quick AI answers from the command line",
14646
14646
  main: "dist/q.js",
14647
14647
  type: "module",
@@ -14691,21 +14691,21 @@ var package_default = {
14691
14691
  "release:dry": "bun run scripts/release.ts --dry-run"
14692
14692
  },
14693
14693
  dependencies: {
14694
- "@ai-sdk/amazon-bedrock": "4.0.75",
14695
- "@ai-sdk/anthropic": "3.0.56",
14696
- "@ai-sdk/azure": "3.0.40",
14697
- "@ai-sdk/google": "3.0.40",
14698
- "@ai-sdk/groq": "3.0.27",
14699
- "@ai-sdk/openai": "3.0.39",
14700
- "@ai-sdk/openai-compatible": "2.0.33",
14694
+ "@ai-sdk/amazon-bedrock": "4.0.77",
14695
+ "@ai-sdk/anthropic": "3.0.58",
14696
+ "@ai-sdk/azure": "3.0.42",
14697
+ "@ai-sdk/google": "3.0.43",
14698
+ "@ai-sdk/groq": "3.0.29",
14699
+ "@ai-sdk/openai": "3.0.41",
14700
+ "@ai-sdk/openai-compatible": "2.0.35",
14701
14701
  "@t3-oss/env-core": "0.13.10",
14702
- ai: "6.0.114",
14702
+ ai: "6.0.116",
14703
14703
  clipboardy: "5.3.1",
14704
14704
  "ollama-ai-provider-v2": "3.3.1",
14705
14705
  zod: "4.3.6"
14706
14706
  },
14707
14707
  devDependencies: {
14708
- "@biomejs/biome": "2.4.5",
14708
+ "@biomejs/biome": "2.4.6",
14709
14709
  "@types/bun": "1.3.10",
14710
14710
  "@vitest/coverage-v8": "4.0.18",
14711
14711
  lefthook: "2.1.2",
@@ -33569,8 +33569,114 @@ async function readResponseWithSizeLimit({
33569
33569
  }
33570
33570
  return result;
33571
33571
  }
33572
+ function validateDownloadUrl(url2) {
33573
+ let parsed;
33574
+ try {
33575
+ parsed = new URL(url2);
33576
+ } catch (e) {
33577
+ throw new DownloadError({
33578
+ url: url2,
33579
+ message: `Invalid URL: ${url2}`
33580
+ });
33581
+ }
33582
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
33583
+ throw new DownloadError({
33584
+ url: url2,
33585
+ message: `URL scheme must be http or https, got ${parsed.protocol}`
33586
+ });
33587
+ }
33588
+ const hostname3 = parsed.hostname;
33589
+ if (!hostname3) {
33590
+ throw new DownloadError({
33591
+ url: url2,
33592
+ message: `URL must have a hostname`
33593
+ });
33594
+ }
33595
+ if (hostname3 === "localhost" || hostname3.endsWith(".local") || hostname3.endsWith(".localhost")) {
33596
+ throw new DownloadError({
33597
+ url: url2,
33598
+ message: `URL with hostname ${hostname3} is not allowed`
33599
+ });
33600
+ }
33601
+ if (hostname3.startsWith("[") && hostname3.endsWith("]")) {
33602
+ const ipv63 = hostname3.slice(1, -1);
33603
+ if (isPrivateIPv6(ipv63)) {
33604
+ throw new DownloadError({
33605
+ url: url2,
33606
+ message: `URL with IPv6 address ${hostname3} is not allowed`
33607
+ });
33608
+ }
33609
+ return;
33610
+ }
33611
+ if (isIPv4(hostname3)) {
33612
+ if (isPrivateIPv4(hostname3)) {
33613
+ throw new DownloadError({
33614
+ url: url2,
33615
+ message: `URL with IP address ${hostname3} is not allowed`
33616
+ });
33617
+ }
33618
+ return;
33619
+ }
33620
+ }
33621
+ function isIPv4(hostname3) {
33622
+ const parts = hostname3.split(".");
33623
+ if (parts.length !== 4)
33624
+ return false;
33625
+ return parts.every((part) => {
33626
+ const num = Number(part);
33627
+ return Number.isInteger(num) && num >= 0 && num <= 255 && String(num) === part;
33628
+ });
33629
+ }
33630
+ function isPrivateIPv4(ip) {
33631
+ const parts = ip.split(".").map(Number);
33632
+ const [a, b] = parts;
33633
+ if (a === 0)
33634
+ return true;
33635
+ if (a === 10)
33636
+ return true;
33637
+ if (a === 127)
33638
+ return true;
33639
+ if (a === 169 && b === 254)
33640
+ return true;
33641
+ if (a === 172 && b >= 16 && b <= 31)
33642
+ return true;
33643
+ if (a === 192 && b === 168)
33644
+ return true;
33645
+ return false;
33646
+ }
33647
+ function isPrivateIPv6(ip) {
33648
+ const normalized = ip.toLowerCase();
33649
+ if (normalized === "::1")
33650
+ return true;
33651
+ if (normalized === "::")
33652
+ return true;
33653
+ if (normalized.startsWith("::ffff:")) {
33654
+ const mappedPart = normalized.slice(7);
33655
+ if (isIPv4(mappedPart)) {
33656
+ return isPrivateIPv4(mappedPart);
33657
+ }
33658
+ const hexParts = mappedPart.split(":");
33659
+ if (hexParts.length === 2) {
33660
+ const high = parseInt(hexParts[0], 16);
33661
+ const low = parseInt(hexParts[1], 16);
33662
+ if (!isNaN(high) && !isNaN(low)) {
33663
+ const a = high >> 8 & 255;
33664
+ const b = high & 255;
33665
+ const c = low >> 8 & 255;
33666
+ const d = low & 255;
33667
+ return isPrivateIPv4(`${a}.${b}.${c}.${d}`);
33668
+ }
33669
+ }
33670
+ }
33671
+ if (normalized.startsWith("fc") || normalized.startsWith("fd"))
33672
+ return true;
33673
+ if (normalized.startsWith("fe80"))
33674
+ return true;
33675
+ return false;
33676
+ }
33572
33677
  async function downloadBlob(url2, options) {
33573
33678
  var _a23, _b22;
33679
+ validateDownloadUrl(url2);
33574
33680
  try {
33575
33681
  const response = await fetch(url2, {
33576
33682
  signal: options == null ? undefined : options.abortSignal
@@ -33731,7 +33837,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
33731
33837
  normalizedHeaders.set("user-agent", [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" "));
33732
33838
  return Object.fromEntries(normalizedHeaders.entries());
33733
33839
  }
33734
- var VERSION2 = "4.0.17";
33840
+ var VERSION2 = "4.0.19";
33735
33841
  var getOriginalFetch = () => globalThis.fetch;
33736
33842
  var getFromApi = async ({
33737
33843
  url: url2,
@@ -33902,8 +34008,8 @@ function mediaTypeToExtension(mediaType) {
33902
34008
  "x-m4a": "m4a"
33903
34009
  }[subtype]) != null ? _a23 : subtype;
33904
34010
  }
33905
- var suspectProtoRx = /"__proto__"\s*:/;
33906
- var suspectConstructorRx = /"constructor"\s*:/;
34011
+ var suspectProtoRx = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/;
34012
+ var suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
33907
34013
  function _parse2(text) {
33908
34014
  const obj = JSON.parse(text);
33909
34015
  if (obj === null || typeof obj !== "object") {
@@ -33923,7 +34029,7 @@ function filter(obj) {
33923
34029
  if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
33924
34030
  throw new SyntaxError("Object contains forbidden prototype property");
33925
34031
  }
33926
- if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
34032
+ if (Object.prototype.hasOwnProperty.call(node, "constructor") && node.constructor !== null && typeof node.constructor === "object" && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
33927
34033
  throw new SyntaxError("Object contains forbidden prototype property");
33928
34034
  }
33929
34035
  for (const key in node) {
@@ -35499,7 +35605,7 @@ async function* executeTool({
35499
35605
  }
35500
35606
 
35501
35607
  // node_modules/@ai-sdk/anthropic/dist/index.mjs
35502
- var VERSION3 = "3.0.56";
35608
+ var VERSION3 = "3.0.58";
35503
35609
  var anthropicErrorDataSchema = lazySchema(() => zodSchema(exports_external.object({
35504
35610
  type: exports_external.literal("error"),
35505
35611
  error: exports_external.object({
@@ -36500,6 +36606,7 @@ async function prepareTools({
36500
36606
  canCache: true
36501
36607
  });
36502
36608
  const anthropicOptions = (_a16 = tool2.providerOptions) == null ? undefined : _a16.anthropic;
36609
+ const eagerInputStreaming = anthropicOptions == null ? undefined : anthropicOptions.eagerInputStreaming;
36503
36610
  const deferLoading = anthropicOptions == null ? undefined : anthropicOptions.deferLoading;
36504
36611
  const allowedCallers = anthropicOptions == null ? undefined : anthropicOptions.allowedCallers;
36505
36612
  anthropicTools2.push({
@@ -36507,6 +36614,7 @@ async function prepareTools({
36507
36614
  description: tool2.description,
36508
36615
  input_schema: tool2.inputSchema,
36509
36616
  cache_control: cacheControl,
36617
+ ...eagerInputStreaming ? { eager_input_streaming: true } : {},
36510
36618
  ...supportsStructuredOutput === true && tool2.strict != null ? { strict: tool2.strict } : {},
36511
36619
  ...deferLoading != null ? { defer_loading: deferLoading } : {},
36512
36620
  ...allowedCallers != null ? { allowed_callers: allowedCallers } : {},
@@ -45220,7 +45328,7 @@ var azureOpenaiTools = {
45220
45328
  imageGeneration,
45221
45329
  webSearchPreview
45222
45330
  };
45223
- var VERSION4 = "3.0.40";
45331
+ var VERSION4 = "3.0.42";
45224
45332
  function createAzure(options = {}) {
45225
45333
  var _a16;
45226
45334
  const getHeaders = () => {
@@ -46332,6 +46440,7 @@ async function prepareTools2({
46332
46440
  canCache: true
46333
46441
  });
46334
46442
  const anthropicOptions = (_a16 = tool2.providerOptions) == null ? undefined : _a16.anthropic;
46443
+ const eagerInputStreaming = anthropicOptions == null ? undefined : anthropicOptions.eagerInputStreaming;
46335
46444
  const deferLoading = anthropicOptions == null ? undefined : anthropicOptions.deferLoading;
46336
46445
  const allowedCallers = anthropicOptions == null ? undefined : anthropicOptions.allowedCallers;
46337
46446
  anthropicTools2.push({
@@ -46339,6 +46448,7 @@ async function prepareTools2({
46339
46448
  description: tool2.description,
46340
46449
  input_schema: tool2.inputSchema,
46341
46450
  cache_control: cacheControl,
46451
+ ...eagerInputStreaming ? { eager_input_streaming: true } : {},
46342
46452
  ...supportsStructuredOutput === true && tool2.strict != null ? { strict: tool2.strict } : {},
46343
46453
  ...deferLoading != null ? { defer_loading: deferLoading } : {},
46344
46454
  ...allowedCallers != null ? { allowed_callers: allowedCallers } : {},
@@ -49371,7 +49481,7 @@ var bedrockImageResponseSchema = exports_external.object({
49371
49481
  details: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
49372
49482
  preview: exports_external.unknown().optional()
49373
49483
  });
49374
- var VERSION5 = "4.0.75";
49484
+ var VERSION5 = "4.0.77";
49375
49485
  function createSigV4FetchFunction(getCredentials, fetch2 = globalThis.fetch) {
49376
49486
  return async (input, init) => {
49377
49487
  var _a16, _b16;
@@ -49667,7 +49777,7 @@ function createBedrockProvider(config2, providerName) {
49667
49777
  }
49668
49778
 
49669
49779
  // node_modules/@ai-sdk/google/dist/index.mjs
49670
- var VERSION6 = "3.0.40";
49780
+ var VERSION6 = "3.0.43";
49671
49781
  var googleErrorDataSchema = lazySchema(() => zodSchema(exports_external.object({
49672
49782
  error: exports_external.object({
49673
49783
  code: exports_external.number().nullable(),
@@ -49973,8 +50083,8 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
49973
50083
  contents.push({
49974
50084
  role: "model",
49975
50085
  parts: content.map((part) => {
49976
- var _a23, _b22, _c2;
49977
- const providerOpts = (_c2 = (_a23 = part.providerOptions) == null ? undefined : _a23[providerOptionsName]) != null ? _c2 : providerOptionsName !== "google" ? (_b22 = part.providerOptions) == null ? undefined : _b22.google : undefined;
50086
+ var _a23, _b22, _c2, _d;
50087
+ const providerOpts = (_d = (_a23 = part.providerOptions) == null ? undefined : _a23[providerOptionsName]) != null ? _d : providerOptionsName !== "google" ? (_b22 = part.providerOptions) == null ? undefined : _b22.google : (_c2 = part.providerOptions) == null ? undefined : _c2.vertex;
49978
50088
  const thoughtSignature = (providerOpts == null ? undefined : providerOpts.thoughtSignature) != null ? String(providerOpts.thoughtSignature) : undefined;
49979
50089
  switch (part.type) {
49980
50090
  case "text": {
@@ -52528,7 +52638,7 @@ var browserSearch = createProviderToolFactory({
52528
52638
  var groqTools = {
52529
52639
  browserSearch
52530
52640
  };
52531
- var VERSION7 = "3.0.27";
52641
+ var VERSION7 = "3.0.29";
52532
52642
  function createGroq(options = {}) {
52533
52643
  var _a16;
52534
52644
  const baseURL = (_a16 = withoutTrailingSlash(options.baseURL)) != null ? _a16 : "https://api.groq.com/openai/v1";
@@ -60921,7 +61031,7 @@ var OpenAITranscriptionModel2 = class {
60921
61031
  };
60922
61032
  }
60923
61033
  };
60924
- var VERSION9 = "3.0.39";
61034
+ var VERSION9 = "3.0.41";
60925
61035
  function createOpenAI(options = {}) {
60926
61036
  var _a16, _b16;
60927
61037
  const baseURL = (_a16 = withoutTrailingSlash(loadOptionalSetting({
@@ -62469,7 +62579,7 @@ async function fileToBlob3(file2) {
62469
62579
  function toCamelCase(str) {
62470
62580
  return str.replace(/[_-]([a-z])/g, (g) => g[1].toUpperCase());
62471
62581
  }
62472
- var VERSION10 = "2.0.33";
62582
+ var VERSION10 = "2.0.35";
62473
62583
  function createOpenAICompatible(options) {
62474
62584
  const baseURL = withoutTrailingSlash(options.baseURL);
62475
62585
  const providerName = options.name;
@@ -63760,7 +63870,7 @@ async function getVercelRequestId() {
63760
63870
  var _a92;
63761
63871
  return (_a92 = import_oidc.getContext().headers) == null ? undefined : _a92["x-vercel-id"];
63762
63872
  }
63763
- var VERSION11 = "3.0.64";
63873
+ var VERSION11 = "3.0.66";
63764
63874
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
63765
63875
  function createGatewayProvider(options = {}) {
63766
63876
  var _a92, _b92;
@@ -64508,7 +64618,7 @@ function detectMediaType({
64508
64618
  }
64509
64619
  return;
64510
64620
  }
64511
- var VERSION12 = "6.0.114";
64621
+ var VERSION12 = "6.0.116";
64512
64622
  var download = async ({
64513
64623
  url: url2,
64514
64624
  maxBytes,
@@ -64516,6 +64626,7 @@ var download = async ({
64516
64626
  }) => {
64517
64627
  var _a21;
64518
64628
  const urlText = url2.toString();
64629
+ validateDownloadUrl(urlText);
64519
64630
  try {
64520
64631
  const response = await fetch(urlText, {
64521
64632
  headers: withUserAgentSuffix({}, `ai-sdk/${VERSION12}`, getRuntimeEnvironmentUserAgent()),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hongymagic/q",
3
- "version": "2026.306.0",
3
+ "version": "2026.306.1-next.3e2fb1d",
4
4
  "description": "Quick AI answers from the command line",
5
5
  "main": "dist/q.js",
6
6
  "type": "module",
@@ -50,21 +50,21 @@
50
50
  "release:dry": "bun run scripts/release.ts --dry-run"
51
51
  },
52
52
  "dependencies": {
53
- "@ai-sdk/amazon-bedrock": "4.0.75",
54
- "@ai-sdk/anthropic": "3.0.56",
55
- "@ai-sdk/azure": "3.0.40",
56
- "@ai-sdk/google": "3.0.40",
57
- "@ai-sdk/groq": "3.0.27",
58
- "@ai-sdk/openai": "3.0.39",
59
- "@ai-sdk/openai-compatible": "2.0.33",
53
+ "@ai-sdk/amazon-bedrock": "4.0.77",
54
+ "@ai-sdk/anthropic": "3.0.58",
55
+ "@ai-sdk/azure": "3.0.42",
56
+ "@ai-sdk/google": "3.0.43",
57
+ "@ai-sdk/groq": "3.0.29",
58
+ "@ai-sdk/openai": "3.0.41",
59
+ "@ai-sdk/openai-compatible": "2.0.35",
60
60
  "@t3-oss/env-core": "0.13.10",
61
- "ai": "6.0.114",
61
+ "ai": "6.0.116",
62
62
  "clipboardy": "5.3.1",
63
63
  "ollama-ai-provider-v2": "3.3.1",
64
64
  "zod": "4.3.6"
65
65
  },
66
66
  "devDependencies": {
67
- "@biomejs/biome": "2.4.5",
67
+ "@biomejs/biome": "2.4.6",
68
68
  "@types/bun": "1.3.10",
69
69
  "@vitest/coverage-v8": "4.0.18",
70
70
  "lefthook": "2.1.2",