lumnisai 0.5.22 → 0.5.23

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.cjs CHANGED
@@ -3128,6 +3128,59 @@ class ResponsesResource {
3128
3128
  throw new ValidationError("maxCommentsPerPost must be between 1 and 100");
3129
3129
  }
3130
3130
  }
3131
+ _validateCompetitorRepEngagementParams(params) {
3132
+ const company = this._getParamValue(params, "company", "company");
3133
+ const competitors = this._getParamValue(params, "competitors", "competitors");
3134
+ const engagementTypes = this._getParamValue(
3135
+ params,
3136
+ "engagementTypes",
3137
+ "engagement_types"
3138
+ );
3139
+ const hasCompany = typeof company === "string" && company.trim().length > 0;
3140
+ const hasCompetitors = Array.isArray(competitors) && competitors.length > 0;
3141
+ if (hasCompany === hasCompetitors) {
3142
+ throw new ValidationError(
3143
+ "Provide exactly one of `company` or `competitors` for competitor_rep_engagement."
3144
+ );
3145
+ }
3146
+ if (engagementTypes !== void 0) {
3147
+ if (!Array.isArray(engagementTypes) || engagementTypes.length === 0) {
3148
+ throw new ValidationError("engagementTypes must contain at least one value");
3149
+ }
3150
+ const validTypes = ["reactor", "commenter"];
3151
+ for (const type of engagementTypes) {
3152
+ if (!validTypes.includes(type)) {
3153
+ throw new ValidationError(
3154
+ `Invalid engagementTypes value: ${String(type)}. Expected 'reactor' and/or 'commenter'.`
3155
+ );
3156
+ }
3157
+ }
3158
+ }
3159
+ const limit = this._getParamValue(params, "limit", "limit");
3160
+ if (limit !== void 0 && (limit < 1 || limit > 1e3)) {
3161
+ throw new ValidationError("limit must be between 1 and 1000 for competitor_rep_engagement");
3162
+ }
3163
+ const maxCompetitors = this._getParamValue(params, "maxCompetitors", "max_competitors");
3164
+ if (maxCompetitors !== void 0 && (maxCompetitors < 1 || maxCompetitors > 50)) {
3165
+ throw new ValidationError("maxCompetitors must be between 1 and 50");
3166
+ }
3167
+ const maxRepsPerCompetitor = this._getParamValue(
3168
+ params,
3169
+ "maxRepsPerCompetitor",
3170
+ "max_reps_per_competitor"
3171
+ );
3172
+ if (maxRepsPerCompetitor !== void 0 && (maxRepsPerCompetitor < 1 || maxRepsPerCompetitor > 100)) {
3173
+ throw new ValidationError("maxRepsPerCompetitor must be between 1 and 100");
3174
+ }
3175
+ const maxEngagementsPerRep = this._getParamValue(
3176
+ params,
3177
+ "maxEngagementsPerRep",
3178
+ "max_engagements_per_rep"
3179
+ );
3180
+ if (maxEngagementsPerRep !== void 0 && (maxEngagementsPerRep < 1 || maxEngagementsPerRep > 1e3)) {
3181
+ throw new ValidationError("maxEngagementsPerRep must be between 1 and 1000");
3182
+ }
3183
+ }
3131
3184
  _validateCriteriaParams(params, specializedAgent) {
3132
3185
  if (!params)
3133
3186
  return;
@@ -3228,6 +3281,8 @@ class ResponsesResource {
3228
3281
  }
3229
3282
  if (specializedAgent === "competitor_post_engagement")
3230
3283
  this._validateCompetitorPostEngagementParams(rawParams);
3284
+ if (specializedAgent === "competitor_rep_engagement")
3285
+ this._validateCompetitorRepEngagementParams(rawParams);
3231
3286
  }
3232
3287
  _validateFileReference(uri) {
3233
3288
  if (uri.startsWith("artifact_"))
@@ -3563,6 +3618,70 @@ class ResponsesResource {
3563
3618
  request.specializedAgentParams = params;
3564
3619
  return this.create(request);
3565
3620
  }
3621
+ /**
3622
+ * Find a competitor's sales reps and surface the AUTHORS of the LinkedIn posts
3623
+ * those reps engage with — i.e. the prospects the competitor is actively
3624
+ * selling to. The INVERSE of {@link competitorPostEngagement}.
3625
+ *
3626
+ * **Discovery mode** — pass `company`: ReAct discovers competitors, then crawls
3627
+ * each one's reps and harvests their outgoing engagement.
3628
+ *
3629
+ * **Explicit mode** — pass `competitors`: skips discovery, uses your list.
3630
+ *
3631
+ * Requires `FIBER_API_KEY` + `CRUSTDATA_API_KEY`.
3632
+ *
3633
+ * @param query - Persona prompt for the prospect-authors (e.g. "VP Eng at AI-native startups…")
3634
+ * @param options - Exactly one of `company` or `competitors` is required
3635
+ * @returns Response; poll with `get()` then read `structuredResponse` as
3636
+ * {@link CompetitorRepEngagementOutput}. See `src/types/competitor-rep-engagement.ts`
3637
+ * for the full agent reference (pipeline, API keys, engagementData shape).
3638
+ */
3639
+ async competitorRepEngagement(query, options) {
3640
+ const hasCompany = typeof options.company === "string" && options.company.trim().length > 0;
3641
+ const hasCompetitors = Array.isArray(options.competitors) && options.competitors.length > 0;
3642
+ if (hasCompany === hasCompetitors) {
3643
+ throw new ValidationError(
3644
+ "Provide exactly one of `company` or `competitors` for competitorRepEngagement."
3645
+ );
3646
+ }
3647
+ const request = {
3648
+ messages: [{ role: "user", content: query }],
3649
+ specializedAgent: "competitor_rep_engagement"
3650
+ };
3651
+ const params = {};
3652
+ if (options.company)
3653
+ params.company = options.company;
3654
+ if (options.competitors)
3655
+ params.competitors = options.competitors;
3656
+ if (options.companyContext)
3657
+ params.companyContext = options.companyContext;
3658
+ if (options.companyExamples)
3659
+ params.companyExamples = options.companyExamples;
3660
+ if (options.limit !== void 0)
3661
+ params.limit = options.limit;
3662
+ if (options.postsDateRange)
3663
+ params.postsDateRange = options.postsDateRange;
3664
+ if (options.engagementTypes)
3665
+ params.engagementTypes = options.engagementTypes;
3666
+ if (options.repTitles)
3667
+ params.repTitles = options.repTitles;
3668
+ if (options.maxRepsPerCompetitor !== void 0)
3669
+ params.maxRepsPerCompetitor = options.maxRepsPerCompetitor;
3670
+ if (options.maxEngagementsPerRep !== void 0)
3671
+ params.maxEngagementsPerRep = options.maxEngagementsPerRep;
3672
+ if (options.restrictEngagementToTenure !== void 0)
3673
+ params.restrictEngagementToTenure = options.restrictEngagementToTenure;
3674
+ if (options.excludeCompetitorEmployees !== void 0)
3675
+ params.excludeCompetitorEmployees = options.excludeCompetitorEmployees;
3676
+ if (options.expandExclusionViaDiscovery !== void 0)
3677
+ params.expandExclusionViaDiscovery = options.expandExclusionViaDiscovery;
3678
+ if (options.maxCompetitors !== void 0)
3679
+ params.maxCompetitors = options.maxCompetitors;
3680
+ if (options.thoroughEnrichment !== void 0)
3681
+ params.thoroughEnrichment = options.thoroughEnrichment;
3682
+ request.specializedAgentParams = params;
3683
+ return this.create(request);
3684
+ }
3566
3685
  }
3567
3686
 
3568
3687
  class SequencesResource {