@the_ro_show/agent-ads-sdk 0.13.0 → 0.13.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.
package/dist/index.mjs CHANGED
@@ -454,6 +454,60 @@ var AttentionMarketClient = class {
454
454
  const platform = params.platform || "web";
455
455
  const placementType = params.placement || "sponsored_suggestion";
456
456
  const taxonomy = params.suggestedCategory || this.inferTaxonomy(params.userMessage);
457
+ if (params.minQualityScore !== void 0) {
458
+ if (typeof params.minQualityScore !== "number" || params.minQualityScore < 0 || params.minQualityScore > 1) {
459
+ throw new Error("minQualityScore must be a number between 0.0 and 1.0");
460
+ }
461
+ }
462
+ if (params.allowedCategories !== void 0) {
463
+ if (!Array.isArray(params.allowedCategories)) {
464
+ throw new Error("allowedCategories must be an array");
465
+ }
466
+ if (params.allowedCategories.length === 0) {
467
+ throw new Error("allowedCategories cannot be empty (would block all ads). Use blockedCategories to exclude specific categories, or omit to allow all.");
468
+ }
469
+ for (const cat of params.allowedCategories) {
470
+ if (typeof cat !== "string" && typeof cat !== "number") {
471
+ throw new Error(`allowedCategories must contain strings or numbers, found: ${typeof cat}`);
472
+ }
473
+ }
474
+ }
475
+ if (params.blockedCategories !== void 0) {
476
+ if (!Array.isArray(params.blockedCategories)) {
477
+ throw new Error("blockedCategories must be an array");
478
+ }
479
+ for (const cat of params.blockedCategories) {
480
+ if (typeof cat !== "string" && typeof cat !== "number") {
481
+ throw new Error(`blockedCategories must contain strings or numbers, found: ${typeof cat}`);
482
+ }
483
+ }
484
+ if (params.allowedCategories && params.allowedCategories.length > 0) {
485
+ console.warn("[AttentionMarket] Both allowedCategories and blockedCategories specified. blockedCategories will be ignored.");
486
+ }
487
+ }
488
+ if (params.blockedAdvertisers !== void 0) {
489
+ if (!Array.isArray(params.blockedAdvertisers)) {
490
+ throw new Error("blockedAdvertisers must be an array");
491
+ }
492
+ for (const id of params.blockedAdvertisers) {
493
+ if (typeof id !== "string" || id.trim().length === 0) {
494
+ throw new Error("blockedAdvertisers must contain non-empty strings (advertiser IDs)");
495
+ }
496
+ }
497
+ }
498
+ if (params.minCPC !== void 0) {
499
+ if (typeof params.minCPC !== "number" || params.minCPC < 0) {
500
+ throw new Error("minCPC must be a non-negative number (cost-per-click in cents)");
501
+ }
502
+ }
503
+ if (params.minRelevanceScore !== void 0) {
504
+ if (typeof params.minRelevanceScore !== "number" || params.minRelevanceScore < 0 || params.minRelevanceScore > 1) {
505
+ throw new Error("minRelevanceScore must be a number between 0.0 and 1.0");
506
+ }
507
+ }
508
+ if (params.optimizeFor && params.optimizeFor !== "revenue" && params.optimizeFor !== "relevance") {
509
+ throw new Error('optimizeFor must be either "revenue" or "relevance"');
510
+ }
457
511
  const request = {
458
512
  request_id: generateUUID(),
459
513
  agent_id: this.agentId,
@@ -485,7 +539,11 @@ var AttentionMarketClient = class {
485
539
  ...params.minQualityScore !== void 0 && { minQualityScore: params.minQualityScore },
486
540
  ...params.allowedCategories && { allowedCategories: params.allowedCategories },
487
541
  ...params.blockedCategories && { blockedCategories: params.blockedCategories },
488
- ...params.blockedAdvertisers && { blockedAdvertisers: params.blockedAdvertisers }
542
+ ...params.blockedAdvertisers && { blockedAdvertisers: params.blockedAdvertisers },
543
+ // Developer controls (Phase 2: Revenue Optimization)
544
+ ...params.minCPC !== void 0 && { minCPC: params.minCPC },
545
+ ...params.minRelevanceScore !== void 0 && { minRelevanceScore: params.minRelevanceScore },
546
+ ...params.optimizeFor && { optimizeFor: params.optimizeFor }
489
547
  };
490
548
  const response = await this.decideRaw(request, options);
491
549
  if (response.status === "no_fill" || response.units.length === 0) {