@codelia/config 0.1.75 → 0.1.77

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/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 kousw
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE.
package/dist/index.cjs CHANGED
@@ -269,6 +269,34 @@ var parseSearchConfig = (value) => {
269
269
  local = candidate;
270
270
  }
271
271
  }
272
+ let xai;
273
+ if (isRecord(value.xai) && isRecord(value.xai.x_search)) {
274
+ const candidate = {};
275
+ if (typeof value.xai.x_search.enabled === "boolean") {
276
+ candidate.enabled = value.xai.x_search.enabled;
277
+ }
278
+ const allowedXHandles = pickStringArray(
279
+ value.xai.x_search.allowed_x_handles
280
+ );
281
+ if (allowedXHandles) candidate.allowed_x_handles = allowedXHandles;
282
+ const excludedXHandles = pickStringArray(
283
+ value.xai.x_search.excluded_x_handles
284
+ );
285
+ if (excludedXHandles) candidate.excluded_x_handles = excludedXHandles;
286
+ const fromDate = pickString(value.xai.x_search.from_date);
287
+ if (fromDate) candidate.from_date = fromDate;
288
+ const toDate = pickString(value.xai.x_search.to_date);
289
+ if (toDate) candidate.to_date = toDate;
290
+ if (typeof value.xai.x_search.enable_image_understanding === "boolean") {
291
+ candidate.enable_image_understanding = value.xai.x_search.enable_image_understanding;
292
+ }
293
+ if (typeof value.xai.x_search.enable_video_understanding === "boolean") {
294
+ candidate.enable_video_understanding = value.xai.x_search.enable_video_understanding;
295
+ }
296
+ if (Object.keys(candidate).length > 0) {
297
+ xai = { x_search: candidate };
298
+ }
299
+ }
272
300
  const result = {};
273
301
  if (mode) {
274
302
  result.mode = mode;
@@ -279,6 +307,9 @@ var parseSearchConfig = (value) => {
279
307
  if (local && Object.keys(local).length > 0) {
280
308
  result.local = local;
281
309
  }
310
+ if (xai) {
311
+ result.xai = xai;
312
+ }
282
313
  return Object.keys(result).length > 0 ? result : void 0;
283
314
  };
284
315
  var parseConfig = (value, sourceLabel) => {
@@ -445,6 +476,15 @@ var ConfigRegistry = class {
445
476
  ...nextSearch.local
446
477
  };
447
478
  }
479
+ if (nextSearch.xai) {
480
+ merged.search.xai ??= {};
481
+ if (nextSearch.xai.x_search) {
482
+ merged.search.xai.x_search = {
483
+ ...merged.search.xai.x_search ?? {},
484
+ ...nextSearch.xai.x_search
485
+ };
486
+ }
487
+ }
448
488
  }
449
489
  if (layer?.tui) {
450
490
  merged.tui = {
package/dist/index.d.cts CHANGED
@@ -82,6 +82,17 @@ type SearchConfig = {
82
82
  backend?: "ddg" | "brave";
83
83
  brave_api_key_env?: string;
84
84
  };
85
+ xai?: {
86
+ x_search?: {
87
+ enabled?: boolean;
88
+ allowed_x_handles?: string[];
89
+ excluded_x_handles?: string[];
90
+ from_date?: string;
91
+ to_date?: string;
92
+ enable_image_understanding?: boolean;
93
+ enable_video_understanding?: boolean;
94
+ };
95
+ };
85
96
  };
86
97
  type TuiConfig = {
87
98
  theme?: string;
package/dist/index.d.ts CHANGED
@@ -82,6 +82,17 @@ type SearchConfig = {
82
82
  backend?: "ddg" | "brave";
83
83
  brave_api_key_env?: string;
84
84
  };
85
+ xai?: {
86
+ x_search?: {
87
+ enabled?: boolean;
88
+ allowed_x_handles?: string[];
89
+ excluded_x_handles?: string[];
90
+ from_date?: string;
91
+ to_date?: string;
92
+ enable_image_understanding?: boolean;
93
+ enable_video_understanding?: boolean;
94
+ };
95
+ };
85
96
  };
86
97
  type TuiConfig = {
87
98
  theme?: string;
package/dist/index.js CHANGED
@@ -241,6 +241,34 @@ var parseSearchConfig = (value) => {
241
241
  local = candidate;
242
242
  }
243
243
  }
244
+ let xai;
245
+ if (isRecord(value.xai) && isRecord(value.xai.x_search)) {
246
+ const candidate = {};
247
+ if (typeof value.xai.x_search.enabled === "boolean") {
248
+ candidate.enabled = value.xai.x_search.enabled;
249
+ }
250
+ const allowedXHandles = pickStringArray(
251
+ value.xai.x_search.allowed_x_handles
252
+ );
253
+ if (allowedXHandles) candidate.allowed_x_handles = allowedXHandles;
254
+ const excludedXHandles = pickStringArray(
255
+ value.xai.x_search.excluded_x_handles
256
+ );
257
+ if (excludedXHandles) candidate.excluded_x_handles = excludedXHandles;
258
+ const fromDate = pickString(value.xai.x_search.from_date);
259
+ if (fromDate) candidate.from_date = fromDate;
260
+ const toDate = pickString(value.xai.x_search.to_date);
261
+ if (toDate) candidate.to_date = toDate;
262
+ if (typeof value.xai.x_search.enable_image_understanding === "boolean") {
263
+ candidate.enable_image_understanding = value.xai.x_search.enable_image_understanding;
264
+ }
265
+ if (typeof value.xai.x_search.enable_video_understanding === "boolean") {
266
+ candidate.enable_video_understanding = value.xai.x_search.enable_video_understanding;
267
+ }
268
+ if (Object.keys(candidate).length > 0) {
269
+ xai = { x_search: candidate };
270
+ }
271
+ }
244
272
  const result = {};
245
273
  if (mode) {
246
274
  result.mode = mode;
@@ -251,6 +279,9 @@ var parseSearchConfig = (value) => {
251
279
  if (local && Object.keys(local).length > 0) {
252
280
  result.local = local;
253
281
  }
282
+ if (xai) {
283
+ result.xai = xai;
284
+ }
254
285
  return Object.keys(result).length > 0 ? result : void 0;
255
286
  };
256
287
  var parseConfig = (value, sourceLabel) => {
@@ -417,6 +448,15 @@ var ConfigRegistry = class {
417
448
  ...nextSearch.local
418
449
  };
419
450
  }
451
+ if (nextSearch.xai) {
452
+ merged.search.xai ??= {};
453
+ if (nextSearch.xai.x_search) {
454
+ merged.search.xai.x_search = {
455
+ ...merged.search.xai.x_search ?? {},
456
+ ...nextSearch.xai.x_search
457
+ };
458
+ }
459
+ }
420
460
  }
421
461
  if (layer?.tui) {
422
462
  merged.tui = {
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@codelia/config",
3
- "version": "0.1.75",
3
+ "version": "0.1.77",
4
+ "license": "MIT",
4
5
  "type": "module",
5
6
  "files": [
6
7
  "dist"