@chainfuse/ai-tools 1.1.8 → 1.1.10

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.
@@ -1,4 +1,6 @@
1
- import { BufferHelpers, CryptoHelpers, Helpers } from '@chainfuse/helpers';
1
+ import { BufferHelpers } from '@chainfuse/helpers/buffers';
2
+ import { Helpers } from '@chainfuse/helpers/common';
3
+ import { CryptoHelpers } from '@chainfuse/helpers/crypto';
2
4
  import * as z from 'zod/mini';
3
5
  import { AiBase } from '../base.mjs';
4
6
  export class AiRawProviders extends AiBase {
@@ -462,16 +464,20 @@ export class AiRawProviders extends AiBase {
462
464
  }
463
465
  else {
464
466
  // Run domain through ZT policies
465
- const doh = await import('@chainfuse/helpers').then(({ DnsHelpers }) => new DnsHelpers(new URL('dns-query', `https://${this.config.providers.custom?.dohId}.cloudflare-gateway.com`)));
466
- const aCheck = doh.query(customProviderUrl.hostname, 'A', undefined, undefined, 2 * 1000);
467
- const aaaaCheck = doh.query(customProviderUrl.hostname, 'AAAA', undefined, undefined, 2 * 1000);
467
+ const { aCheck, aaaaCheck } = await import('@chainfuse/helpers/dns').then(({ DnsHelpers, DNSRecordType }) => {
468
+ const doh = new DnsHelpers({ nameservers: [`https://${this.config.providers.custom?.dohId}.cloudflare-gateway.com/dns-query`] }, undefined, this.config.backgroundContext);
469
+ return {
470
+ aCheck: doh.query({ questions: [{ hostname: customProviderUrl.hostname, recordType: DNSRecordType['A (IPv4 Address)'] }], timeout: 2 * 1000 }),
471
+ aaaaCheck: doh.query({ questions: [{ hostname: customProviderUrl.hostname, recordType: DNSRecordType['AAAA (IPv6 Address)'] }], timeout: 2 * 1000 }),
472
+ };
473
+ });
468
474
  return Promise.allSettled([aCheck, aaaaCheck]).then((checks) => {
469
475
  const fulfulledChecks = checks.filter((check) => check.status === 'fulfilled');
470
476
  /**
471
477
  * Blocked domains return 0.0.0.0 or :: as the answer
472
478
  * @link https://developers.cloudflare.com/cloudflare-one/policies/gateway/block-page/
473
479
  */
474
- if (fulfulledChecks.length > 0 && fulfulledChecks.some((obj) => 'Answer' in obj.value && Array.isArray(obj.value.Answer) && obj.value.Answer.some((answer) => answer.data !== '0.0.0.0' && answer.data !== '::'))) {
480
+ if (fulfulledChecks.length > 0 && fulfulledChecks.some((obj) => 'answers' in obj.value && Array.isArray(obj.value.answers) && obj.value.answers.some((answer) => 'data' in answer && answer.data !== '0.0.0.0' && answer.data !== '::'))) {
475
481
  // ZT Pass, perform the calls
476
482
  return import('@ai-sdk/openai-compatible').then(async ({ createOpenAICompatible }) => createOpenAICompatible({
477
483
  baseURL: customProviderUrl.toString(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainfuse/ai-tools",
3
- "version": "1.1.8",
3
+ "version": "1.1.10",
4
4
  "description": "",
5
5
  "author": "ChainFuse",
6
6
  "homepage": "https://github.com/ChainFuse/packages/tree/main/packages/ai-tools#readme",
@@ -54,17 +54,17 @@
54
54
  "@ai-sdk/openai": "^2.0.71",
55
55
  "@ai-sdk/openai-compatible": "^1.0.30",
56
56
  "@ai-sdk/provider": "^2.0.1",
57
- "@chainfuse/helpers": "^4.2.12",
58
- "@chainfuse/types": "^4.2.6",
57
+ "@chainfuse/helpers": "^4.3.0",
58
+ "@chainfuse/types": "^4.2.7",
59
59
  "ai": "^5.0.121",
60
60
  "chalk": "^5.6.2",
61
61
  "haversine-distance": "^1.2.4",
62
62
  "workers-ai-provider": "^2.0.2",
63
- "zod": "^4.3.5"
63
+ "zod": "^4.3.6"
64
64
  },
65
65
  "devDependencies": {
66
- "@cloudflare/workers-types": "^4.20260113.0",
66
+ "@cloudflare/workers-types": "^4.20260128.0",
67
67
  "openai": "^6.16.0"
68
68
  },
69
- "gitHead": "1dc070ea9e67142dcd08f41fbc16ddc1a17662df"
69
+ "gitHead": "3a294f5b789b6beedafb3aa9925a797c26fdc00a"
70
70
  }