modality-ai 0.2.0 → 0.2.1

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/index.js +94 -41
  2. package/package.json +5 -8
package/dist/index.js CHANGED
@@ -18664,7 +18664,7 @@ var require_stream = __commonJS((exports, module) => {
18664
18664
  Object.defineProperty(exports2, "__esModule", { value: true });
18665
18665
  var eventTargetShim = require_event_target_shim();
18666
18666
 
18667
- class AbortSignal extends eventTargetShim.EventTarget {
18667
+ class AbortSignal2 extends eventTargetShim.EventTarget {
18668
18668
  constructor() {
18669
18669
  super();
18670
18670
  throw TypeError("AbortSignal cannot be constructed directly");
@@ -18676,9 +18676,9 @@ var require_stream = __commonJS((exports, module) => {
18676
18676
  return aborted2;
18677
18677
  }
18678
18678
  }
18679
- eventTargetShim.defineEventAttribute(AbortSignal.prototype, "abort");
18679
+ eventTargetShim.defineEventAttribute(AbortSignal2.prototype, "abort");
18680
18680
  function createAbortSignal() {
18681
- let signal = Object.create(AbortSignal.prototype);
18681
+ let signal = Object.create(AbortSignal2.prototype);
18682
18682
  return eventTargetShim.EventTarget.call(signal), abortedFlags.set(signal, false), signal;
18683
18683
  }
18684
18684
  function abortSignal(signal) {
@@ -18687,9 +18687,9 @@ var require_stream = __commonJS((exports, module) => {
18687
18687
  abortedFlags.set(signal, true), signal.dispatchEvent({ type: "abort" });
18688
18688
  }
18689
18689
  var abortedFlags = new WeakMap;
18690
- Object.defineProperties(AbortSignal.prototype, { aborted: { enumerable: true } });
18690
+ Object.defineProperties(AbortSignal2.prototype, { aborted: { enumerable: true } });
18691
18691
  if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol")
18692
- Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, { configurable: true, value: "AbortSignal" });
18692
+ Object.defineProperty(AbortSignal2.prototype, Symbol.toStringTag, { configurable: true, value: "AbortSignal" });
18693
18693
 
18694
18694
  class AbortController2 {
18695
18695
  constructor() {
@@ -18713,14 +18713,14 @@ var require_stream = __commonJS((exports, module) => {
18713
18713
  if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol")
18714
18714
  Object.defineProperty(AbortController2.prototype, Symbol.toStringTag, { configurable: true, value: "AbortController" });
18715
18715
  exports2.AbortController = AbortController2;
18716
- exports2.AbortSignal = AbortSignal;
18716
+ exports2.AbortSignal = AbortSignal2;
18717
18717
  exports2.default = AbortController2;
18718
18718
  module2.exports = AbortController2;
18719
18719
  module2.exports.AbortController = module2.exports.default = AbortController2;
18720
- module2.exports.AbortSignal = AbortSignal;
18720
+ module2.exports.AbortSignal = AbortSignal2;
18721
18721
  });
18722
18722
  var require_util = __commonJS2((exports2, module2) => {
18723
- var bufferModule = (init_buffer(), __toCommonJS(exports_buffer)), { format: format2, inspect: inspect2 } = require_inspect(), { codes: { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE3 } } = require_errors(), { kResistStopPropagation, AggregateError: AggregateError2, SymbolDispose } = require_primordials(), AbortSignal = globalThis.AbortSignal || require_abort_controller().AbortSignal, AbortController2 = globalThis.AbortController || require_abort_controller().AbortController, AsyncFunction = Object.getPrototypeOf(async function() {}).constructor, Blob3 = globalThis.Blob || bufferModule.Blob, isBlob = typeof Blob3 < "u" ? function(b) {
18723
+ var bufferModule = (init_buffer(), __toCommonJS(exports_buffer)), { format: format2, inspect: inspect2 } = require_inspect(), { codes: { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE3 } } = require_errors(), { kResistStopPropagation, AggregateError: AggregateError2, SymbolDispose } = require_primordials(), AbortSignal2 = globalThis.AbortSignal || require_abort_controller().AbortSignal, AbortController2 = globalThis.AbortController || require_abort_controller().AbortController, AsyncFunction = Object.getPrototypeOf(async function() {}).constructor, Blob3 = globalThis.Blob || bufferModule.Blob, isBlob = typeof Blob3 < "u" ? function(b) {
18724
18724
  return b instanceof Blob3;
18725
18725
  } : function(b) {
18726
18726
  return false;
@@ -18774,7 +18774,7 @@ var require_stream = __commonJS((exports, module) => {
18774
18774
  var _removeEventListener;
18775
18775
  (_removeEventListener = removeEventListener) === null || _removeEventListener === undefined || _removeEventListener();
18776
18776
  } };
18777
- }, AbortSignalAny: AbortSignal.any || function(signals) {
18777
+ }, AbortSignalAny: AbortSignal2.any || function(signals) {
18778
18778
  if (signals.length === 1)
18779
18779
  return signals[0];
18780
18780
  let ac = new AbortController2, abort = () => ac.abort();
@@ -70738,7 +70738,7 @@ var RedBlackTreeSymbolKey = "effect/RedBlackTree", RedBlackTreeTypeId, redBlackT
70738
70738
  }
70739
70739
  }
70740
70740
  };
70741
- }, visitFull = (node, visit) => {
70741
+ }, visitFull = (node, visit2) => {
70742
70742
  let current = node;
70743
70743
  let stack = undefined;
70744
70744
  let done6 = false;
@@ -70747,7 +70747,7 @@ var RedBlackTreeSymbolKey = "effect/RedBlackTree", RedBlackTreeTypeId, redBlackT
70747
70747
  stack = make11(current, stack);
70748
70748
  current = current.left;
70749
70749
  } else if (stack != null) {
70750
- const value2 = visit(stack.value.key, stack.value.value);
70750
+ const value2 = visit2(stack.value.key, stack.value.value);
70751
70751
  if (isSome2(value2)) {
70752
70752
  return value2;
70753
70753
  }
@@ -70758,7 +70758,7 @@ var RedBlackTreeSymbolKey = "effect/RedBlackTree", RedBlackTreeTypeId, redBlackT
70758
70758
  }
70759
70759
  }
70760
70760
  return none2();
70761
- }, visitGreaterThanEqual = (node, min7, ord, visit) => {
70761
+ }, visitGreaterThanEqual = (node, min7, ord, visit2) => {
70762
70762
  let current = node;
70763
70763
  let stack = undefined;
70764
70764
  let done6 = false;
@@ -70772,7 +70772,7 @@ var RedBlackTreeSymbolKey = "effect/RedBlackTree", RedBlackTreeTypeId, redBlackT
70772
70772
  }
70773
70773
  } else if (stack !== undefined) {
70774
70774
  if (ord(min7, stack.value.key) <= 0) {
70775
- const value2 = visit(stack.value.key, stack.value.value);
70775
+ const value2 = visit2(stack.value.key, stack.value.value);
70776
70776
  if (isSome2(value2)) {
70777
70777
  return value2;
70778
70778
  }
@@ -70784,7 +70784,7 @@ var RedBlackTreeSymbolKey = "effect/RedBlackTree", RedBlackTreeTypeId, redBlackT
70784
70784
  }
70785
70785
  }
70786
70786
  return none2();
70787
- }, visitLessThan = (node, max7, ord, visit) => {
70787
+ }, visitLessThan = (node, max7, ord, visit2) => {
70788
70788
  let current = node;
70789
70789
  let stack = undefined;
70790
70790
  let done6 = false;
@@ -70793,7 +70793,7 @@ var RedBlackTreeSymbolKey = "effect/RedBlackTree", RedBlackTreeTypeId, redBlackT
70793
70793
  stack = make11(current, stack);
70794
70794
  current = current.left;
70795
70795
  } else if (stack !== undefined && ord(max7, stack.value.key) > 0) {
70796
- const value2 = visit(stack.value.key, stack.value.value);
70796
+ const value2 = visit2(stack.value.key, stack.value.value);
70797
70797
  if (isSome2(value2)) {
70798
70798
  return value2;
70799
70799
  }
@@ -70804,7 +70804,7 @@ var RedBlackTreeSymbolKey = "effect/RedBlackTree", RedBlackTreeTypeId, redBlackT
70804
70804
  }
70805
70805
  }
70806
70806
  return none2();
70807
- }, visitBetween = (node, min7, max7, ord, visit) => {
70807
+ }, visitBetween = (node, min7, max7, ord, visit2) => {
70808
70808
  let current = node;
70809
70809
  let stack = undefined;
70810
70810
  let done6 = false;
@@ -70818,7 +70818,7 @@ var RedBlackTreeSymbolKey = "effect/RedBlackTree", RedBlackTreeTypeId, redBlackT
70818
70818
  }
70819
70819
  } else if (stack !== undefined && ord(max7, stack.value.key) > 0) {
70820
70820
  if (ord(min7, stack.value.key) <= 0) {
70821
- const value2 = visit(stack.value.key, stack.value.value);
70821
+ const value2 = visit2(stack.value.key, stack.value.value);
70822
70822
  if (isSome2(value2)) {
70823
70823
  return value2;
70824
70824
  }
@@ -91617,9 +91617,9 @@ var init_Graph = __esm(() => {
91617
91617
  Walker = class Walker {
91618
91618
  [Symbol.iterator];
91619
91619
  visit;
91620
- constructor(visit) {
91621
- this.visit = visit;
91622
- this[Symbol.iterator] = visit((index, data) => [index, data])[Symbol.iterator];
91620
+ constructor(visit2) {
91621
+ this.visit = visit2;
91622
+ this[Symbol.iterator] = visit2((index, data) => [index, data])[Symbol.iterator];
91623
91623
  }
91624
91624
  };
91625
91625
  });
@@ -114945,7 +114945,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
114945
114945
  normalizedHeaders.set("user-agent", [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" "));
114946
114946
  return Object.fromEntries(normalizedHeaders.entries());
114947
114947
  }
114948
- var VERSION = "4.0.2";
114948
+ var VERSION = "4.0.4";
114949
114949
  var getOriginalFetch = () => globalThis.fetch;
114950
114950
  var getFromApi = async ({
114951
114951
  url: url2,
@@ -115118,24 +115118,40 @@ function secureJsonParse(text) {
115118
115118
  }
115119
115119
  }
115120
115120
  function addAdditionalPropertiesToJsonSchema(jsonSchema2) {
115121
- if (jsonSchema2.type === "object") {
115121
+ if (jsonSchema2.type === "object" || Array.isArray(jsonSchema2.type) && jsonSchema2.type.includes("object")) {
115122
115122
  jsonSchema2.additionalProperties = false;
115123
- const properties = jsonSchema2.properties;
115123
+ const { properties } = jsonSchema2;
115124
115124
  if (properties != null) {
115125
- for (const property in properties) {
115126
- properties[property] = addAdditionalPropertiesToJsonSchema(properties[property]);
115125
+ for (const key of Object.keys(properties)) {
115126
+ properties[key] = visit(properties[key]);
115127
115127
  }
115128
115128
  }
115129
115129
  }
115130
- if (jsonSchema2.type === "array" && jsonSchema2.items != null) {
115131
- if (Array.isArray(jsonSchema2.items)) {
115132
- jsonSchema2.items = jsonSchema2.items.map((item) => addAdditionalPropertiesToJsonSchema(item));
115133
- } else {
115134
- jsonSchema2.items = addAdditionalPropertiesToJsonSchema(jsonSchema2.items);
115130
+ if (jsonSchema2.items != null) {
115131
+ jsonSchema2.items = Array.isArray(jsonSchema2.items) ? jsonSchema2.items.map(visit) : visit(jsonSchema2.items);
115132
+ }
115133
+ if (jsonSchema2.anyOf != null) {
115134
+ jsonSchema2.anyOf = jsonSchema2.anyOf.map(visit);
115135
+ }
115136
+ if (jsonSchema2.allOf != null) {
115137
+ jsonSchema2.allOf = jsonSchema2.allOf.map(visit);
115138
+ }
115139
+ if (jsonSchema2.oneOf != null) {
115140
+ jsonSchema2.oneOf = jsonSchema2.oneOf.map(visit);
115141
+ }
115142
+ const { definitions } = jsonSchema2;
115143
+ if (definitions != null) {
115144
+ for (const key of Object.keys(definitions)) {
115145
+ definitions[key] = visit(definitions[key]);
115135
115146
  }
115136
115147
  }
115137
115148
  return jsonSchema2;
115138
115149
  }
115150
+ function visit(def) {
115151
+ if (typeof def === "boolean")
115152
+ return def;
115153
+ return addAdditionalPropertiesToJsonSchema(def);
115154
+ }
115139
115155
  var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
115140
115156
  var defaultOptions = {
115141
115157
  name: undefined,
@@ -116587,7 +116603,7 @@ async function* executeTool({
116587
116603
  }
116588
116604
 
116589
116605
  // node_modules/@ai-sdk/google/dist/index.mjs
116590
- var VERSION2 = "3.0.2";
116606
+ var VERSION2 = "3.0.5";
116591
116607
  var googleErrorDataSchema = lazySchema(() => zodSchema(exports_external.object({
116592
116608
  error: exports_external.object({
116593
116609
  code: exports_external.number().nullable(),
@@ -117091,7 +117107,7 @@ function prepareTools({
117091
117107
  ].some((id) => id === modelId);
117092
117108
  const isGemini2orNewer = modelId.includes("gemini-2") || modelId.includes("gemini-3") || isLatest;
117093
117109
  const supportsDynamicRetrieval = modelId.includes("gemini-1.5-flash") && !modelId.includes("-8b");
117094
- const supportsFileSearch = modelId.includes("gemini-2.5");
117110
+ const supportsFileSearch = modelId.includes("gemini-2.5") || modelId.includes("gemini-3");
117095
117111
  if (tools == null) {
117096
117112
  return { tools: undefined, toolConfig: undefined, toolWarnings };
117097
117113
  }
@@ -117164,7 +117180,7 @@ function prepareTools({
117164
117180
  toolWarnings.push({
117165
117181
  type: "unsupported",
117166
117182
  feature: `provider-defined tool ${tool2.id}`,
117167
- details: "The file search tool is only supported with Gemini 2.5 models."
117183
+ details: "The file search tool is only supported with Gemini 2.5 models and Gemini 3 models."
117168
117184
  });
117169
117185
  }
117170
117186
  break;
@@ -118766,6 +118782,8 @@ var GatewayImageModel = class {
118766
118782
  size,
118767
118783
  aspectRatio,
118768
118784
  seed,
118785
+ files,
118786
+ mask,
118769
118787
  providerOptions,
118770
118788
  headers,
118771
118789
  abortSignal
@@ -118786,7 +118804,11 @@ var GatewayImageModel = class {
118786
118804
  ...size && { size },
118787
118805
  ...aspectRatio && { aspectRatio },
118788
118806
  ...seed && { seed },
118789
- ...providerOptions && { providerOptions }
118807
+ ...providerOptions && { providerOptions },
118808
+ ...files && {
118809
+ files: files.map((file2) => maybeEncodeImageFile(file2))
118810
+ },
118811
+ ...mask && { mask: maybeEncodeImageFile(mask) }
118790
118812
  },
118791
118813
  successfulResponseHandler: createJsonResponseHandler(gatewayImageResponseSchema),
118792
118814
  failedResponseHandler: createJsonErrorResponseHandler({
@@ -118820,6 +118842,15 @@ var GatewayImageModel = class {
118820
118842
  };
118821
118843
  }
118822
118844
  };
118845
+ function maybeEncodeImageFile(file2) {
118846
+ if (file2.type === "file" && file2.data instanceof Uint8Array) {
118847
+ return {
118848
+ ...file2,
118849
+ data: convertUint8ArrayToBase64(file2.data)
118850
+ };
118851
+ }
118852
+ return file2;
118853
+ }
118823
118854
  var providerMetadataEntrySchema = exports_external.object({
118824
118855
  images: exports_external.array(exports_external.unknown()).optional()
118825
118856
  }).catchall(exports_external.unknown());
@@ -118835,7 +118866,7 @@ async function getVercelRequestId() {
118835
118866
  var _a82;
118836
118867
  return (_a82 = import_oidc.getContext().headers) == null ? undefined : _a82["x-vercel-id"];
118837
118868
  }
118838
- var VERSION3 = "3.0.5";
118869
+ var VERSION3 = "3.0.9";
118839
118870
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
118840
118871
  function createGatewayProvider(options = {}) {
118841
118872
  var _a82, _b82;
@@ -120239,7 +120270,7 @@ function detectMediaType({
120239
120270
  }
120240
120271
  return;
120241
120272
  }
120242
- var VERSION5 = "6.0.6";
120273
+ var VERSION5 = "6.0.14";
120243
120274
  var download = async ({ url: url2 }) => {
120244
120275
  var _a16;
120245
120276
  const urlText = url2.toString();
@@ -122507,6 +122538,26 @@ async function toResponseMessages({
122507
122538
  }
122508
122539
  return responseMessages;
122509
122540
  }
122541
+ function mergeAbortSignals(...signals) {
122542
+ const validSignals = signals.filter((signal) => signal != null);
122543
+ if (validSignals.length === 0) {
122544
+ return;
122545
+ }
122546
+ if (validSignals.length === 1) {
122547
+ return validSignals[0];
122548
+ }
122549
+ const controller = new AbortController;
122550
+ for (const signal of validSignals) {
122551
+ if (signal.aborted) {
122552
+ controller.abort(signal.reason);
122553
+ return controller.signal;
122554
+ }
122555
+ signal.addEventListener("abort", () => {
122556
+ controller.abort(signal.reason);
122557
+ }, { once: true });
122558
+ }
122559
+ return controller.signal;
122560
+ }
122510
122561
  var originalGenerateId = createIdGenerator({
122511
122562
  prefix: "aitxt",
122512
122563
  size: 24
@@ -122520,6 +122571,7 @@ async function generateText({
122520
122571
  messages,
122521
122572
  maxRetries: maxRetriesArg,
122522
122573
  abortSignal,
122574
+ timeout,
122523
122575
  headers,
122524
122576
  stopWhen = stepCountIs(1),
122525
122577
  experimental_output,
@@ -122543,9 +122595,10 @@ async function generateText({
122543
122595
  }) {
122544
122596
  const model = resolveLanguageModel(modelArg);
122545
122597
  const stopConditions = asArray(stopWhen);
122598
+ const mergedAbortSignal = mergeAbortSignals(abortSignal, timeout != null ? AbortSignal.timeout(timeout) : undefined);
122546
122599
  const { maxRetries, retry } = prepareRetries({
122547
122600
  maxRetries: maxRetriesArg,
122548
- abortSignal
122601
+ abortSignal: mergedAbortSignal
122549
122602
  });
122550
122603
  const callSettings = prepareCallSettings(settings);
122551
122604
  const headersWithUserAgent = withUserAgentSuffix(headers != null ? headers : {}, `ai/${VERSION5}`);
@@ -122593,7 +122646,7 @@ async function generateText({
122593
122646
  tracer,
122594
122647
  telemetry,
122595
122648
  messages: initialMessages,
122596
- abortSignal,
122649
+ abortSignal: mergedAbortSignal,
122597
122650
  experimental_context
122598
122651
  });
122599
122652
  const toolContent = [];
@@ -122726,7 +122779,7 @@ async function generateText({
122726
122779
  responseFormat: await (output == null ? undefined : output.responseFormat),
122727
122780
  prompt: promptMessages,
122728
122781
  providerOptions: stepProviderOptions,
122729
- abortSignal,
122782
+ abortSignal: mergedAbortSignal,
122730
122783
  headers: headersWithUserAgent
122731
122784
  });
122732
122785
  const responseData = {
@@ -122789,7 +122842,7 @@ async function generateText({
122789
122842
  input: toolCall.input,
122790
122843
  toolCallId: toolCall.toolCallId,
122791
122844
  messages: stepInputMessages,
122792
- abortSignal,
122845
+ abortSignal: mergedAbortSignal,
122793
122846
  experimental_context
122794
122847
  });
122795
122848
  }
@@ -122826,7 +122879,7 @@ async function generateText({
122826
122879
  tracer,
122827
122880
  telemetry,
122828
122881
  messages: stepInputMessages,
122829
- abortSignal,
122882
+ abortSignal: mergedAbortSignal,
122830
122883
  experimental_context
122831
122884
  }));
122832
122885
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.0",
2
+ "version": "0.2.1",
3
3
  "name": "modality-ai",
4
4
  "repository": {
5
5
  "type": "git",
@@ -12,15 +12,12 @@
12
12
  "license": "ISC",
13
13
  "peerDependencies": {
14
14
  "@modelcontextprotocol/sdk": "^1.25.1",
15
- "modality-mcp-kit": "^1.x"
15
+ "modality-mcp-kit": "^1.0.0"
16
16
  },
17
17
  "dependencies": {
18
- "@ai-sdk/google": "^3.0.2",
19
- "@valibot/to-json-schema": "^1.5.0",
20
- "ai": "^6.0.6",
21
- "effect": "^3.19.14",
22
- "ollama-ai-provider": "^1.2.0",
23
- "sury": "^11.0.0-alpha.4"
18
+ "@ai-sdk/google": "^3.0.5",
19
+ "ai": "^6.0.14",
20
+ "ollama-ai-provider": "^1.2.0"
24
21
  },
25
22
  "devDependencies": {
26
23
  "@types/bun": "^1.3.5",