@aparte/core 0.2.0-alpha.0 → 0.3.0-alpha.0

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.
@@ -1267,6 +1267,15 @@ class AparteConfigClass {
1267
1267
  this._locale = locale;
1268
1268
  this._notify();
1269
1269
  }
1270
+ /**
1271
+ * Restore the built-in English locale (the same `DEFAULT_LOCALE` core ships
1272
+ * with). Counterpart of {@link setLocale} for language toggles — avoids
1273
+ * having to import `DEFAULT_LOCALE` yourself.
1274
+ */
1275
+ resetLocale() {
1276
+ this._locale = DEFAULT_LOCALE;
1277
+ this._notify();
1278
+ }
1270
1279
  /**
1271
1280
  * Get the current locale
1272
1281
  */
@@ -1480,7 +1489,12 @@ class AparteConfigClass {
1480
1489
  const provider = this._aiProviders.get(defaultProvider);
1481
1490
  if (!provider) return void 0;
1482
1491
  const models = provider.getModels();
1483
- if (models instanceof Promise) return void 0;
1492
+ if (models instanceof Promise) {
1493
+ console.warn(
1494
+ `[AparteConfig] Provider "${defaultProvider}".getModels() returned a Promise — it is ignored here, so model capabilities (e.g. function_calling) resolve to none and tools are disabled. getModels() must return the list synchronously; implement fetchModels() for async fetching.`
1495
+ );
1496
+ return void 0;
1497
+ }
1484
1498
  return models.find((m) => m.id === defaultModel);
1485
1499
  }
1486
1500
  // ─────────────────────────────────────────────────────────────────────────
@@ -4918,7 +4932,7 @@ ${summary}`,
4918
4932
  try {
4919
4933
  authConfig = await this._resolveAuth(providerId);
4920
4934
  const rawFiles = Array.isArray(event.detail?.files) ? event.detail.files : [];
4921
- const filesToInject = this.options.rawFileInject === "none" ? [] : this.options.rawFileInject === "images-only" ? rawFiles.filter((f) => f.type.startsWith("image/")) : rawFiles;
4935
+ const filesToInject = this._selectFilesToInject(rawFiles);
4922
4936
  const contentParts = filesToInject.length > 0 ? await this._filesToContentParts(filesToInject) : [];
4923
4937
  messages = this._buildMessages(content, targetElement, contentParts.length > 0 ? contentParts : void 0);
4924
4938
  } catch (error) {
@@ -4976,6 +4990,19 @@ ${summary}`,
4976
4990
  if (!message.segments) return "";
4977
4991
  return message.segments.filter((s) => s.type === "text" || s.type === "code").map((s) => s.content ?? "").join("\n").trim();
4978
4992
  }
4993
+ /**
4994
+ * Which of the send's pending files get inlined into the request: the
4995
+ * `rawFileInject` mode first —
4996
+ * 'none' → nothing inline (RAG handles all file types),
4997
+ * 'images-only' → images inline, text/docs to the app layer,
4998
+ * 'all' (default) → images + text files inline —
4999
+ * then the optional per-file `fileInjectFilter` veto.
5000
+ */
5001
+ _selectFilesToInject(rawFiles) {
5002
+ const byMode = this.options.rawFileInject === "none" ? [] : this.options.rawFileInject === "images-only" ? rawFiles.filter((f) => f.type.startsWith("image/")) : rawFiles;
5003
+ const filter = this.options.fileInjectFilter;
5004
+ return filter ? byMode.filter((f) => filter(f)) : byMode;
5005
+ }
4979
5006
  /**
4980
5007
  * Convert an array of File objects to AparteContentPart[].
4981
5008
  * - Images → AparteImagePart (base64 data URL)
@@ -6291,4 +6318,4 @@ export {
6291
6318
  getSegmentRenderer as y,
6292
6319
  isFormatAdapter as z
6293
6320
  };
6294
- //# sourceMappingURL=index-D89k-n2Q.js.map
6321
+ //# sourceMappingURL=index-CW2BCAqn.js.map