lumnisai 0.5.37 → 0.5.38

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
@@ -3435,6 +3435,51 @@ class ResponsesResource {
3435
3435
  throw new ValidationError("excludeUrls must be an array of strings for engagement_expansion");
3436
3436
  }
3437
3437
  }
3438
+ _validateSinceDays(value, agent) {
3439
+ if (value === void 0)
3440
+ return;
3441
+ if (!Number.isInteger(value) || value < 1 || value > 3650) {
3442
+ throw new ValidationError(
3443
+ `sinceDays must be an integer between 1 and 3650 for ${agent}`
3444
+ );
3445
+ }
3446
+ }
3447
+ _validateCompanyIntelligenceParams(params) {
3448
+ const company = this._getParamValue(params, "company", "company");
3449
+ if (typeof company !== "string" || !company.trim()) {
3450
+ throw new ValidationError(
3451
+ "`company` is required for company_intelligence \u2014 give the company's domain. For a report on a person use the person_intelligence agent."
3452
+ );
3453
+ }
3454
+ this._validateSinceDays(
3455
+ this._getParamValue(params, "sinceDays", "since_days"),
3456
+ "company_intelligence"
3457
+ );
3458
+ const reader = this._getParamValue(params, "reader", "reader");
3459
+ if (reader !== void 0 && (typeof reader !== "string" || !reader.trim()))
3460
+ throw new ValidationError("reader must be a non-empty string for company_intelligence");
3461
+ const allowSpend = this._getParamValue(params, "allowSpend", "allow_spend");
3462
+ if (allowSpend !== void 0 && typeof allowSpend !== "boolean")
3463
+ throw new ValidationError("allowSpend must be a boolean for company_intelligence");
3464
+ }
3465
+ _validatePersonIntelligenceParams(params) {
3466
+ const linkedinUrl = this._getParamValue(params, "linkedinUrl", "linkedin_url");
3467
+ const personName = this._getParamValue(params, "personName", "person_name");
3468
+ const company = this._getParamValue(params, "company", "company");
3469
+ const hasUrl = typeof linkedinUrl === "string" && linkedinUrl.trim().length > 0;
3470
+ const hasName = typeof personName === "string" && personName.trim().length > 0;
3471
+ const hasCompany = typeof company === "string" && company.trim().length > 0;
3472
+ if (hasName && !hasUrl && !hasCompany) {
3473
+ throw new ValidationError(
3474
+ "`personName` needs `company` (the employer's domain) to resolve the right person \u2014 or give `linkedinUrl` instead."
3475
+ );
3476
+ }
3477
+ if (!hasUrl && !hasName) {
3478
+ throw new ValidationError(
3479
+ "Give a person for person_intelligence: `linkedinUrl`, or `personName` + `company`. For a report on a company use the company_intelligence agent."
3480
+ );
3481
+ }
3482
+ }
3438
3483
  _validateCriteriaParams(params, specializedAgent) {
3439
3484
  if (!params)
3440
3485
  return;
@@ -3550,6 +3595,10 @@ class ResponsesResource {
3550
3595
  this._validateContentIntelligenceParams(rawParams);
3551
3596
  if (specializedAgent === "engagement_expansion")
3552
3597
  this._validateEngagementExpansionParams(rawParams);
3598
+ if (specializedAgent === "company_intelligence")
3599
+ this._validateCompanyIntelligenceParams(rawParams);
3600
+ if (specializedAgent === "person_intelligence")
3601
+ this._validatePersonIntelligenceParams(rawParams);
3553
3602
  }
3554
3603
  _validateFileReference(uri) {
3555
3604
  if (uri.startsWith("artifact_"))
@@ -3569,7 +3618,7 @@ class ResponsesResource {
3569
3618
  "data"
3570
3619
  ];
3571
3620
  if (allowedSchemes.includes(parsed.protocol.replace(":", ""))) {
3572
- if ((parsed.protocol === "http:" || parsed.protocol === "https \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B:") && !parsed.hostname)
3621
+ if ((parsed.protocol === "http:" || parsed.protocol === "https:") && !parsed.hostname)
3573
3622
  throw new LocalFileNotSupportedError(uri);
3574
3623
  return;
3575
3624
  } else {
@@ -4080,6 +4129,101 @@ class ResponsesResource {
4080
4129
  request.specializedAgentParams = params;
4081
4130
  return this.create(request);
4082
4131
  }
4132
+ /** True when a person target reads as a LinkedIn profile URL rather than a name. */
4133
+ _looksLikeLinkedInUrl(value) {
4134
+ const target = value.trim().toLowerCase();
4135
+ return target.startsWith("http://") || target.startsWith("https://") || target.startsWith("www.linkedin.com/") || target.startsWith("linkedin.com/");
4136
+ }
4137
+ /**
4138
+ * Produce one deep intelligence report on a single company.
4139
+ *
4140
+ * The backend reads everything it can buy or fetch about the company — the
4141
+ * job-posting corpus with zero truncation, headcount and web-traffic series,
4142
+ * live careers boards and the careers page, executive LinkedIn posts and
4143
+ * company mentions, the employee roster, recent news and vendor enrichment —
4144
+ * prepares all of it in code, and has a writer model read it into a markdown
4145
+ * report. A second cheap call slices the same report into a display-block
4146
+ * envelope.
4147
+ *
4148
+ * Runs are long on a cold corpus (tens of minutes). `sinceDays` trades depth
4149
+ * for credits; omit it for the full posting history, which the report's
4150
+ * timelines and never-posted claims depend on. A posting fetch projected past
4151
+ * the per-run credit ceiling stops rather than spending — `allowSpend: true`
4152
+ * lets it through.
4153
+ *
4154
+ * @param company - The company's domain (the one it uses on LinkedIn when they
4155
+ * differ). A pasted URL is normalized server-side: `https://www.acme.com/about`
4156
+ * resolves to `acme.com`.
4157
+ * @param options - Requester context, register, posting window, and spend control.
4158
+ * @returns Response; poll with `get()`, read the report from `outputText` and
4159
+ * the envelope from `structuredResponse` as {@link CompanyIntelligenceOutput}.
4160
+ * See `src/types/company-intelligence.ts` for the full agent reference.
4161
+ */
4162
+ async companyIntelligence(company, options = {}) {
4163
+ if (typeof company !== "string" || !company.trim())
4164
+ throw new ValidationError("companyIntelligence requires a non-empty company domain");
4165
+ const params = { company: company.trim() };
4166
+ if (options.companyContext !== void 0)
4167
+ params.companyContext = options.companyContext;
4168
+ if (options.reader !== void 0)
4169
+ params.reader = options.reader;
4170
+ if (options.sinceDays !== void 0)
4171
+ params.sinceDays = options.sinceDays;
4172
+ if (options.allowSpend !== void 0)
4173
+ params.allowSpend = options.allowSpend;
4174
+ const prompt = options.prompt?.trim() || `Company intelligence report for ${company.trim()}`;
4175
+ return this.create({
4176
+ messages: [{ role: "user", content: prompt }],
4177
+ specializedAgent: "company_intelligence",
4178
+ specializedAgentParams: params
4179
+ });
4180
+ }
4181
+ /**
4182
+ * Produce one deep intelligence report on a single person.
4183
+ *
4184
+ * Two doors, chosen from `person`. Pass a **LinkedIn profile URL** and no name
4185
+ * is needed — it is read from the live profile. Pass a **full name** and
4186
+ * `options.company` (the employer's domain) is required to resolve the right
4187
+ * person. The backend reads their live profile, their posts and the engagement
4188
+ * on them, other platforms (X/Instagram) and their web presence, and grades
4189
+ * how much evidence it actually found so thin sections stay honest.
4190
+ *
4191
+ * @param person - A LinkedIn profile URL, or the person's full name.
4192
+ * @param options - `company` (employer domain — required with a name),
4193
+ * requester context, and an optional focus prompt.
4194
+ * @returns Response; poll with `get()`, read the report from `outputText` and
4195
+ * the envelope from `structuredResponse` as {@link PersonIntelligenceOutput}.
4196
+ * See `src/types/company-intelligence.ts` for the full agent reference.
4197
+ */
4198
+ async personIntelligence(person, options = {}) {
4199
+ if (typeof person !== "string" || !person.trim()) {
4200
+ throw new ValidationError(
4201
+ "personIntelligence requires a LinkedIn profile URL or a person name"
4202
+ );
4203
+ }
4204
+ const target = person.trim();
4205
+ const params = {};
4206
+ if (this._looksLikeLinkedInUrl(target)) {
4207
+ params.linkedinUrl = target;
4208
+ } else {
4209
+ if (typeof options.company !== "string" || !options.company.trim()) {
4210
+ throw new ValidationError(
4211
+ `personIntelligence needs \`company\` (the employer's domain) to resolve "${target}" \u2014 or pass the person's LinkedIn profile URL instead.`
4212
+ );
4213
+ }
4214
+ params.personName = target;
4215
+ }
4216
+ if (options.company !== void 0)
4217
+ params.company = options.company;
4218
+ if (options.companyContext !== void 0)
4219
+ params.companyContext = options.companyContext;
4220
+ const prompt = options.prompt?.trim() || `Person intelligence report for ${target}`;
4221
+ return this.create({
4222
+ messages: [{ role: "user", content: prompt }],
4223
+ specializedAgent: "person_intelligence",
4224
+ specializedAgentParams: params
4225
+ });
4226
+ }
4083
4227
  }
4084
4228
 
4085
4229
  class SequencesResource {