lumnisai 0.5.44 → 0.5.45
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 +240 -22
- package/dist/index.d.cts +465 -9
- package/dist/index.d.mts +465 -9
- package/dist/index.d.ts +465 -9
- package/dist/index.mjs +240 -22
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3225,6 +3225,31 @@ class PeopleResource {
|
|
|
3225
3225
|
}
|
|
3226
3226
|
}
|
|
3227
3227
|
|
|
3228
|
+
const DATE_RANGES = [
|
|
3229
|
+
"past-24h",
|
|
3230
|
+
"past-week",
|
|
3231
|
+
"past-2-weeks",
|
|
3232
|
+
"past-3-weeks",
|
|
3233
|
+
"past-month",
|
|
3234
|
+
"past-quarter",
|
|
3235
|
+
"past-6-months",
|
|
3236
|
+
"past-year",
|
|
3237
|
+
"past-2-years",
|
|
3238
|
+
"past-3-years"
|
|
3239
|
+
];
|
|
3240
|
+
const SIGNAL_TYPES = [
|
|
3241
|
+
"hiring",
|
|
3242
|
+
"engagement",
|
|
3243
|
+
"recently_joined",
|
|
3244
|
+
"funding",
|
|
3245
|
+
"events"
|
|
3246
|
+
];
|
|
3247
|
+
const DISABLED_SIGNAL_TYPES = ["competitor_tools", "web_traffic"];
|
|
3248
|
+
const ENGAGEMENT_ACTIVITIES = [
|
|
3249
|
+
"reactions",
|
|
3250
|
+
"comments",
|
|
3251
|
+
"authored_posts"
|
|
3252
|
+
];
|
|
3228
3253
|
class ResponsesResource {
|
|
3229
3254
|
constructor(http) {
|
|
3230
3255
|
this.http = http;
|
|
@@ -3372,6 +3397,154 @@ class ResponsesResource {
|
|
|
3372
3397
|
throw new ValidationError("maxCommentsPerPost must be between 1 and 100");
|
|
3373
3398
|
}
|
|
3374
3399
|
}
|
|
3400
|
+
_validateDateRange(value, field) {
|
|
3401
|
+
if (value === void 0 || value === null)
|
|
3402
|
+
return;
|
|
3403
|
+
if (typeof value !== "string" || !DATE_RANGES.includes(value)) {
|
|
3404
|
+
throw new ValidationError(
|
|
3405
|
+
`Invalid ${field} value: ${String(value)}. Choose from: ${DATE_RANGES.join(", ")}.`
|
|
3406
|
+
);
|
|
3407
|
+
}
|
|
3408
|
+
}
|
|
3409
|
+
/** Company targets are compared the way the backend compares them: trimmed, case-folded, no trailing slash. */
|
|
3410
|
+
_targetCompanyKey(value) {
|
|
3411
|
+
return value.trim().toLowerCase().replace(/\/+$/, "");
|
|
3412
|
+
}
|
|
3413
|
+
_validateEngagementSettings(settings) {
|
|
3414
|
+
const activities = this._getParamValue(settings, "activities", "activities");
|
|
3415
|
+
if (activities !== void 0 && activities !== null) {
|
|
3416
|
+
if (!Array.isArray(activities) || activities.length === 0)
|
|
3417
|
+
throw new ValidationError("engagement settings.activities cannot be empty");
|
|
3418
|
+
for (const activity of activities) {
|
|
3419
|
+
if (typeof activity !== "string" || !ENGAGEMENT_ACTIVITIES.includes(activity)) {
|
|
3420
|
+
throw new ValidationError(
|
|
3421
|
+
`Invalid engagement activity: ${String(activity)}. Choose from: ${ENGAGEMENT_ACTIVITIES.join(", ")}.`
|
|
3422
|
+
);
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
if (new Set(activities).size !== activities.length)
|
|
3426
|
+
throw new ValidationError("engagement settings.activities must not contain duplicates");
|
|
3427
|
+
}
|
|
3428
|
+
const targetCompanies = this._getParamValue(
|
|
3429
|
+
settings,
|
|
3430
|
+
"targetCompanies",
|
|
3431
|
+
"target_companies"
|
|
3432
|
+
);
|
|
3433
|
+
if (targetCompanies !== void 0 && targetCompanies !== null) {
|
|
3434
|
+
if (!Array.isArray(targetCompanies) || targetCompanies.length === 0 || targetCompanies.some((company) => typeof company !== "string" || !company.trim())) {
|
|
3435
|
+
throw new ValidationError(
|
|
3436
|
+
"engagement settings.targetCompanies must contain at least one non-empty company name, domain, or LinkedIn company URL"
|
|
3437
|
+
);
|
|
3438
|
+
}
|
|
3439
|
+
const keys = targetCompanies.map((company) => this._targetCompanyKey(company));
|
|
3440
|
+
if (new Set(keys).size !== keys.length)
|
|
3441
|
+
throw new ValidationError("engagement settings.targetCompanies must not contain duplicates");
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
_validateSignalSettings(name, settings) {
|
|
3445
|
+
if (settings === void 0 || settings === null)
|
|
3446
|
+
return;
|
|
3447
|
+
if (!this._isPlainObject(settings))
|
|
3448
|
+
throw new ValidationError(`signalDefinitions '${name}' settings must be an object`);
|
|
3449
|
+
const allowed = name === "engagement" ? ["dateRange", "date_range", "activities", "targetCompanies", "target_companies"] : ["dateRange", "date_range"];
|
|
3450
|
+
for (const key of Object.keys(settings)) {
|
|
3451
|
+
if (!allowed.includes(key)) {
|
|
3452
|
+
throw new ValidationError(
|
|
3453
|
+
`Unknown setting '${key}' for the '${name}' signal. Supported settings: ${allowed.filter((setting) => !setting.includes("_")).join(", ")}.`
|
|
3454
|
+
);
|
|
3455
|
+
}
|
|
3456
|
+
}
|
|
3457
|
+
this._validateDateRange(
|
|
3458
|
+
this._getParamValue(settings, "dateRange", "date_range"),
|
|
3459
|
+
`signalDefinitions '${name}' settings.dateRange`
|
|
3460
|
+
);
|
|
3461
|
+
if (name === "engagement")
|
|
3462
|
+
this._validateEngagementSettings(settings);
|
|
3463
|
+
}
|
|
3464
|
+
/**
|
|
3465
|
+
* Validate the one manual signal-enrichment input before anything paid runs.
|
|
3466
|
+
* Mirrors the backend registry: object entries only, known enabled names, no
|
|
3467
|
+
* duplicates, no unknown settings.
|
|
3468
|
+
*/
|
|
3469
|
+
_validateSignalDefinitions(value) {
|
|
3470
|
+
if (value === void 0 || value === null)
|
|
3471
|
+
return;
|
|
3472
|
+
if (!Array.isArray(value))
|
|
3473
|
+
throw new ValidationError("signalDefinitions must be an array");
|
|
3474
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3475
|
+
for (const entry of value) {
|
|
3476
|
+
if (!this._isPlainObject(entry)) {
|
|
3477
|
+
throw new ValidationError(
|
|
3478
|
+
`Each signalDefinitions entry must be an object like { name: 'hiring', settings: { dateRange: 'past-month' } }`
|
|
3479
|
+
);
|
|
3480
|
+
}
|
|
3481
|
+
const rawName = this._getParamValue(entry, "name", "name");
|
|
3482
|
+
const name = typeof rawName === "string" ? rawName.trim().toLowerCase() : rawName;
|
|
3483
|
+
if (typeof name !== "string" || !name)
|
|
3484
|
+
throw new ValidationError("Each signalDefinitions entry requires a signal name");
|
|
3485
|
+
if (DISABLED_SIGNAL_TYPES.includes(name)) {
|
|
3486
|
+
throw new ValidationError(
|
|
3487
|
+
`The '${name}' signal is temporarily disabled because of company-record cost. Choose from the enabled signals: ${SIGNAL_TYPES.join(", ")}.`
|
|
3488
|
+
);
|
|
3489
|
+
}
|
|
3490
|
+
if (!SIGNAL_TYPES.includes(name)) {
|
|
3491
|
+
throw new ValidationError(
|
|
3492
|
+
`'${name}' is not a signal we know. Choose from: ${SIGNAL_TYPES.join(", ")}.`
|
|
3493
|
+
);
|
|
3494
|
+
}
|
|
3495
|
+
if (seen.has(name)) {
|
|
3496
|
+
throw new ValidationError(
|
|
3497
|
+
`The '${name}' signal appears more than once in signalDefinitions \u2014 send each signal once.`
|
|
3498
|
+
);
|
|
3499
|
+
}
|
|
3500
|
+
seen.add(name);
|
|
3501
|
+
for (const key of Object.keys(entry)) {
|
|
3502
|
+
if (key !== "name" && key !== "settings") {
|
|
3503
|
+
throw new ValidationError(
|
|
3504
|
+
`Unknown signalDefinitions field '${key}'. Each entry accepts only name and settings.`
|
|
3505
|
+
);
|
|
3506
|
+
}
|
|
3507
|
+
}
|
|
3508
|
+
this._validateSignalSettings(
|
|
3509
|
+
name,
|
|
3510
|
+
this._getParamValue(entry, "settings", "settings")
|
|
3511
|
+
);
|
|
3512
|
+
}
|
|
3513
|
+
}
|
|
3514
|
+
/**
|
|
3515
|
+
* Validate the signal-enrichment, automatic-selection and intent-scoring
|
|
3516
|
+
* params. These apply to every people agent, so they are checked on the
|
|
3517
|
+
* request rather than per agent.
|
|
3518
|
+
*/
|
|
3519
|
+
_validateSignalParams(params) {
|
|
3520
|
+
this._validateSignalDefinitions(
|
|
3521
|
+
this._getParamValue(params, "signalDefinitions", "signal_definitions")
|
|
3522
|
+
);
|
|
3523
|
+
for (const [camel, snake] of [
|
|
3524
|
+
["autoSelectLane", "auto_select_lane"],
|
|
3525
|
+
["autoSelectSignals", "auto_select_signals"]
|
|
3526
|
+
]) {
|
|
3527
|
+
const value = this._getParamValue(params, camel, snake);
|
|
3528
|
+
if (value !== void 0 && value !== null && typeof value !== "boolean")
|
|
3529
|
+
throw new ValidationError(`${camel} must be true or false`);
|
|
3530
|
+
}
|
|
3531
|
+
const intentScoringInstructions = this._getParamValue(
|
|
3532
|
+
params,
|
|
3533
|
+
"intentScoringInstructions",
|
|
3534
|
+
"intent_scoring_instructions"
|
|
3535
|
+
);
|
|
3536
|
+
if (intentScoringInstructions !== void 0 && intentScoringInstructions !== null && typeof intentScoringInstructions !== "string") {
|
|
3537
|
+
throw new ValidationError("intentScoringInstructions must be a string");
|
|
3538
|
+
}
|
|
3539
|
+
this._validateDateRange(
|
|
3540
|
+
this._getParamValue(params, "jobSignalDateRange", "job_signal_date_range"),
|
|
3541
|
+
"jobSignalDateRange"
|
|
3542
|
+
);
|
|
3543
|
+
this._validateDateRange(
|
|
3544
|
+
this._getParamValue(params, "postsDateRange", "posts_date_range"),
|
|
3545
|
+
"postsDateRange"
|
|
3546
|
+
);
|
|
3547
|
+
}
|
|
3375
3548
|
_validateCompetitorRepEngagementParams(params) {
|
|
3376
3549
|
const company = this._getParamValue(params, "company", "company");
|
|
3377
3550
|
const competitors = this._getParamValue(params, "competitors", "competitors");
|
|
@@ -3505,25 +3678,10 @@ class ResponsesResource {
|
|
|
3505
3678
|
}
|
|
3506
3679
|
}
|
|
3507
3680
|
}
|
|
3508
|
-
|
|
3509
|
-
params,
|
|
3510
|
-
"postsDateRange"
|
|
3511
|
-
|
|
3512
|
-
);
|
|
3513
|
-
if (postsDateRange !== void 0) {
|
|
3514
|
-
const validRanges = [
|
|
3515
|
-
"past-24h",
|
|
3516
|
-
"past-week",
|
|
3517
|
-
"past-month",
|
|
3518
|
-
"past-quarter",
|
|
3519
|
-
"past-6-months",
|
|
3520
|
-
"past-year",
|
|
3521
|
-
"past-2-years",
|
|
3522
|
-
"past-3-years"
|
|
3523
|
-
];
|
|
3524
|
-
if (!validRanges.includes(postsDateRange))
|
|
3525
|
-
throw new ValidationError(`Invalid postsDateRange value: ${String(postsDateRange)}`);
|
|
3526
|
-
}
|
|
3681
|
+
this._validateDateRange(
|
|
3682
|
+
this._getParamValue(params, "postsDateRange", "posts_date_range"),
|
|
3683
|
+
"postsDateRange"
|
|
3684
|
+
);
|
|
3527
3685
|
for (const [camel, snake, maximum] of [
|
|
3528
3686
|
["limit", "limit", 1e3],
|
|
3529
3687
|
["maxReactorsPerPost", "max_reactors_per_post", 5e3],
|
|
@@ -3596,6 +3754,25 @@ class ResponsesResource {
|
|
|
3596
3754
|
);
|
|
3597
3755
|
}
|
|
3598
3756
|
}
|
|
3757
|
+
/**
|
|
3758
|
+
* Every place a caller may put specialized-agent params: the dedicated field
|
|
3759
|
+
* and the legacy nested copy inside `options`. Both are validated so a nested
|
|
3760
|
+
* request cannot smuggle an unknown signal past the SDK.
|
|
3761
|
+
*/
|
|
3762
|
+
_specializedParamSources(request) {
|
|
3763
|
+
const sources = [];
|
|
3764
|
+
if (this._isPlainObject(request.specializedAgentParams))
|
|
3765
|
+
sources.push(request.specializedAgentParams);
|
|
3766
|
+
const requestOptions = request.options;
|
|
3767
|
+
const nested = requestOptions ? this._getParamValue(
|
|
3768
|
+
requestOptions,
|
|
3769
|
+
"specializedAgentParams",
|
|
3770
|
+
"specialized_agent_params"
|
|
3771
|
+
) : void 0;
|
|
3772
|
+
if (this._isPlainObject(nested))
|
|
3773
|
+
sources.push(nested);
|
|
3774
|
+
return sources;
|
|
3775
|
+
}
|
|
3599
3776
|
_validateSalesNavigatorRequest(request) {
|
|
3600
3777
|
const directParams = request.specializedAgentParams;
|
|
3601
3778
|
const directUrl = directParams ? this._getParamValue(directParams, "salesNavigatorUrl", "sales_navigator_url") : void 0;
|
|
@@ -3647,6 +3824,11 @@ class ResponsesResource {
|
|
|
3647
3824
|
"salesNavigatorUrl must be a Sales Navigator people-search or people-list URL"
|
|
3648
3825
|
);
|
|
3649
3826
|
}
|
|
3827
|
+
const autoSelectLane = this._specializedParamSources(request).some(
|
|
3828
|
+
(params) => this._getParamValue(params, "autoSelectLane", "auto_select_lane") === true
|
|
3829
|
+
);
|
|
3830
|
+
if (autoSelectLane)
|
|
3831
|
+
return;
|
|
3650
3832
|
if (typeof request.userId !== "string" || !request.userId.trim())
|
|
3651
3833
|
throw new ValidationError("userId is required when salesNavigatorUrl is provided");
|
|
3652
3834
|
}
|
|
@@ -3813,6 +3995,8 @@ class ResponsesResource {
|
|
|
3813
3995
|
this._validateFileReference(file.uri);
|
|
3814
3996
|
}
|
|
3815
3997
|
this._validateSalesNavigatorRequest(request);
|
|
3998
|
+
for (const params of this._specializedParamSources(request))
|
|
3999
|
+
this._validateSignalParams(params);
|
|
3816
4000
|
if (request.specializedAgentParams)
|
|
3817
4001
|
this._validateCriteriaParams(request.specializedAgentParams, request.specializedAgent);
|
|
3818
4002
|
return this.http.post("/responses", request);
|
|
@@ -3956,10 +4140,16 @@ class ResponsesResource {
|
|
|
3956
4140
|
* @param options.deepValidationBackfillBelowCriteria - Pad with criteria-failed candidates when under count; @default true
|
|
3957
4141
|
* @param options.enrichEngagementHistory - Add recent LinkedIn engagement evidence before validation; forced off for Sales Navigator V1
|
|
3958
4142
|
* @param options.deepSearchCriteriaModel - Override criteria decomposition model (e.g. 'openai:gpt-5.4')
|
|
4143
|
+
* @param options.jobSignalDateRange - Posting window for the standalone job-signal lane; omit for the planner's 90-365 days
|
|
4144
|
+
* @param options.signalDefinitions - Signal enrichments to run on fast-filter survivors before validation; omit or `[]` for none
|
|
4145
|
+
* @param options.autoSelectLane - Let the backend choose the discovery lane; ignores the manual lane controls; @default false
|
|
4146
|
+
* @param options.autoSelectSignals - Let the backend choose the signals; ignores `signalDefinitions`; @default false
|
|
4147
|
+
* @param options.intentScoringInstructions - Plain-English direction for every intent-scoring stage (never changes fit or filtering)
|
|
3959
4148
|
* @returns Response with structured_response containing:
|
|
3960
|
-
* - candidates: Validated and scored candidates
|
|
4149
|
+
* - candidates: Validated and scored candidates, each with `signalEvidence` for the selected signals
|
|
3961
4150
|
* - criteria: Generated/reused criteria definitions and classification
|
|
3962
|
-
* - searchStats: Search execution statistics
|
|
4151
|
+
* - searchStats: Search execution statistics, including `enrichment` and `signalFunnel`
|
|
4152
|
+
* - autoSearchSelection: What automatic selection applied, when either auto flag ran
|
|
3963
4153
|
*/
|
|
3964
4154
|
async deepPeopleSearch(query, options) {
|
|
3965
4155
|
const request = {
|
|
@@ -4041,7 +4231,17 @@ class ResponsesResource {
|
|
|
4041
4231
|
params.enrichEngagementHistory = options.enrichEngagementHistory;
|
|
4042
4232
|
if (options.deepSearchCriteriaModel)
|
|
4043
4233
|
params.deepSearchCriteriaModel = options.deepSearchCriteriaModel;
|
|
4044
|
-
if (options.
|
|
4234
|
+
if (options.jobSignalDateRange !== void 0)
|
|
4235
|
+
params.jobSignalDateRange = options.jobSignalDateRange;
|
|
4236
|
+
if (options.signalDefinitions !== void 0)
|
|
4237
|
+
params.signalDefinitions = options.signalDefinitions;
|
|
4238
|
+
if (options.autoSelectLane !== void 0)
|
|
4239
|
+
params.autoSelectLane = options.autoSelectLane;
|
|
4240
|
+
if (options.autoSelectSignals !== void 0)
|
|
4241
|
+
params.autoSelectSignals = options.autoSelectSignals;
|
|
4242
|
+
if (options.intentScoringInstructions !== void 0)
|
|
4243
|
+
params.intentScoringInstructions = options.intentScoringInstructions;
|
|
4244
|
+
if (options.salesNavigatorUrl !== void 0 && options.autoSelectLane !== true) {
|
|
4045
4245
|
params.searchProfiles = false;
|
|
4046
4246
|
params.searchPosts = false;
|
|
4047
4247
|
params.searchConnections = false;
|
|
@@ -4104,6 +4304,8 @@ class ResponsesResource {
|
|
|
4104
4304
|
request.specializedAgentParams.addAndRunCriterion = options.addAndRunCriterion;
|
|
4105
4305
|
if (options.deepSearchCriteriaModel)
|
|
4106
4306
|
request.specializedAgentParams.deepSearchCriteriaModel = options.deepSearchCriteriaModel;
|
|
4307
|
+
if (options.intentScoringInstructions !== void 0)
|
|
4308
|
+
request.specializedAgentParams.intentScoringInstructions = options.intentScoringInstructions;
|
|
4107
4309
|
}
|
|
4108
4310
|
return this.create(request);
|
|
4109
4311
|
}
|
|
@@ -4183,6 +4385,10 @@ class ResponsesResource {
|
|
|
4183
4385
|
if (options?.deepValidationUseRelevanceReranker !== void 0) {
|
|
4184
4386
|
params.deepValidationUseRelevanceReranker = options.deepValidationUseRelevanceReranker;
|
|
4185
4387
|
}
|
|
4388
|
+
if (options.signalDefinitions !== void 0)
|
|
4389
|
+
params.signalDefinitions = options.signalDefinitions;
|
|
4390
|
+
if (options.intentScoringInstructions !== void 0)
|
|
4391
|
+
params.intentScoringInstructions = options.intentScoringInstructions;
|
|
4186
4392
|
return this.create({
|
|
4187
4393
|
messages: [{ role: "user", content: query }],
|
|
4188
4394
|
specializedAgent: "engagement_expansion",
|
|
@@ -4229,6 +4435,10 @@ class ResponsesResource {
|
|
|
4229
4435
|
params.excludeUrls = options.excludeUrls;
|
|
4230
4436
|
if (options.limit !== void 0)
|
|
4231
4437
|
params.limit = options.limit;
|
|
4438
|
+
if (options.signalDefinitions !== void 0)
|
|
4439
|
+
params.signalDefinitions = options.signalDefinitions;
|
|
4440
|
+
if (options.intentScoringInstructions !== void 0)
|
|
4441
|
+
params.intentScoringInstructions = options.intentScoringInstructions;
|
|
4232
4442
|
return this.create({
|
|
4233
4443
|
messages: [{ role: "user", content: query }],
|
|
4234
4444
|
specializedAgent: "influencer_engagement",
|
|
@@ -4300,6 +4510,10 @@ class ResponsesResource {
|
|
|
4300
4510
|
params.maxReactorsPerPost = options.maxReactorsPerPost;
|
|
4301
4511
|
if (options.maxCommentsPerPost !== void 0)
|
|
4302
4512
|
params.maxCommentsPerPost = options.maxCommentsPerPost;
|
|
4513
|
+
if (options.signalDefinitions !== void 0)
|
|
4514
|
+
params.signalDefinitions = options.signalDefinitions;
|
|
4515
|
+
if (options.intentScoringInstructions !== void 0)
|
|
4516
|
+
params.intentScoringInstructions = options.intentScoringInstructions;
|
|
4303
4517
|
request.specializedAgentParams = params;
|
|
4304
4518
|
return this.create(request);
|
|
4305
4519
|
}
|
|
@@ -4366,6 +4580,10 @@ class ResponsesResource {
|
|
|
4366
4580
|
params.maxCompetitors = options.maxCompetitors;
|
|
4367
4581
|
if (options.thoroughEnrichment !== void 0)
|
|
4368
4582
|
params.thoroughEnrichment = options.thoroughEnrichment;
|
|
4583
|
+
if (options.signalDefinitions !== void 0)
|
|
4584
|
+
params.signalDefinitions = options.signalDefinitions;
|
|
4585
|
+
if (options.intentScoringInstructions !== void 0)
|
|
4586
|
+
params.intentScoringInstructions = options.intentScoringInstructions;
|
|
4369
4587
|
request.specializedAgentParams = params;
|
|
4370
4588
|
return this.create(request);
|
|
4371
4589
|
}
|