lumnisai 0.5.49 → 0.5.50

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
@@ -1091,14 +1091,18 @@ class CrmResource {
1091
1091
  });
1092
1092
  }
1093
1093
  /**
1094
- * Grant a member the right to exclude against an owner's synced CRM ledger
1095
- * (all providers for that owner). Typically called by the FE on org join.
1094
+ * Grant a member access to an owner's CRM — every provider that owner has
1095
+ * synced. One grant serves both reads that name another owner: ledger
1096
+ * exclusion in search and campaigns, and `account_monitor`'s `crmUserId`.
1097
+ * Both users must be in the authenticated tenant; a self-grant is a no-op.
1098
+ * Typically called by the FE on org join.
1096
1099
  */
1097
1100
  async grantExclusionGrant(data) {
1098
1101
  return this.http.post("/crm/exclusion-grants", data);
1099
1102
  }
1100
1103
  /**
1101
- * Revoke a member's access to an owner's CRM exclusion ledger.
1104
+ * Revoke a member's access to an owner's CRM. Implicit access to their own
1105
+ * CRM cannot be revoked.
1102
1106
  */
1103
1107
  async revokeExclusionGrant(data) {
1104
1108
  return this.http.delete("/crm/exclusion-grants", {
@@ -1106,7 +1110,8 @@ class CrmResource {
1106
1110
  });
1107
1111
  }
1108
1112
  /**
1109
- * List CRM owners whose exclusion ledger a member may read (via grants).
1113
+ * List the CRM owners a member may read via grants. The member's own CRM is
1114
+ * implicit and is not listed.
1110
1115
  */
1111
1116
  async listExclusionGrants(memberUserId) {
1112
1117
  return this.http.get("/crm/exclusion-grants", {
@@ -3290,6 +3295,7 @@ const ACCOUNT_MONITOR_FIELDS = [
3290
3295
  ["signalDefinitions", "signal_definitions"],
3291
3296
  ["intentScoringInstructions", "intent_scoring_instructions"],
3292
3297
  ["history", "history"],
3298
+ ["crmUserId", "crm_user_id"],
3293
3299
  ["tier", "tier"]
3294
3300
  ];
3295
3301
  const ACCOUNT_MONITOR_FIELD_KEYS = new Set(ACCOUNT_MONITOR_FIELDS.flat());
@@ -3974,6 +3980,24 @@ class ResponsesResource {
3974
3980
  throw new ValidationError("intentScoringInstructions must be a string");
3975
3981
  this._validateAccountMonitorSignalDefinitions(params.signalDefinitions);
3976
3982
  }
3983
+ /**
3984
+ * `crmUserId` reads one tenant member's CRM, so the request has to name the
3985
+ * requester too: the backend refuses the pair without a top-level `userId`,
3986
+ * and reading anyone else's CRM also needs a CRM access grant
3987
+ * (`client.crm.grantExclusionGrant`). Reading your own is always allowed.
3988
+ */
3989
+ _validateAccountMonitorCrmAccess(params, request) {
3990
+ const crmUserId = params.crmUserId;
3991
+ if (crmUserId === void 0)
3992
+ return;
3993
+ if (typeof crmUserId !== "string" || !crmUserId.trim() || crmUserId.length > 255) {
3994
+ throw new ValidationError(
3995
+ "crmUserId must be the UUID or email of a CRM owner in the authenticated tenant (1-255 characters) for account_monitor"
3996
+ );
3997
+ }
3998
+ if (typeof request.userId !== "string" || !request.userId.trim())
3999
+ throw new ValidationError("userId is required when crmUserId is provided");
4000
+ }
3977
4001
  /** People are LinkedIn profile URLs; no employee discovery is ever implied. */
3978
4002
  _validateAccountMonitorProfiles(value, field) {
3979
4003
  if (!Array.isArray(value) || value.some((url) => typeof url !== "string" || !url.trim())) {
@@ -4379,7 +4403,9 @@ class ResponsesResource {
4379
4403
  this._validateFileReference(file.uri);
4380
4404
  }
4381
4405
  if (request.specializedAgent === "account_monitor") {
4382
- this._validateAccountMonitorParams(this._accountMonitorParams(request));
4406
+ const monitorParams = this._accountMonitorParams(request);
4407
+ this._validateAccountMonitorParams(monitorParams);
4408
+ this._validateAccountMonitorCrmAccess(monitorParams, request);
4383
4409
  return this.http.post("/responses", request);
4384
4410
  }
4385
4411
  this._validateSalesNavigatorRequest(request);
@@ -4462,7 +4488,7 @@ class ResponsesResource {
4462
4488
  * @param options - Optional search parameters
4463
4489
  * @param options.limit - Maximum number of results (1-100, default: 20)
4464
4490
  * @param options.dataSources - Specific data sources to use: ["PDL", "CORESIGNAL", "CRUST_DATA"]
4465
- * @param options.excludeCrmContacts - Exclude people in the acting user's synced CRM ledger; @default true (via request `options`)
4491
+ * @param options.excludeCrmContacts - Exclude people in the acting user's synced CRM ledger; @default false (via request `options`)
4466
4492
  * @param options.crmExclusionOwners - Granted owner ledgers to exclude against (user id or email)
4467
4493
  * @param options.crmNameCompanyMatch - Also exclude by exact name+company; @default true
4468
4494
  * @returns Response with structured_response containing:
@@ -4517,7 +4543,7 @@ class ResponsesResource {
4517
4543
  * @param options.excludeProfiles - LinkedIn URLs to exclude from results
4518
4544
  * @param options.excludePreviouslyContacted - Exclude previously contacted people
4519
4545
  * @param options.excludeNames - Names to exclude from results
4520
- * @param options.excludeCrmContacts - Exclude people in the acting user's synced CRM ledger; @default true
4546
+ * @param options.excludeCrmContacts - Exclude people in the acting user's synced CRM ledger; @default false
4521
4547
  * @param options.crmExclusionOwners - Granted owner ledgers to exclude against (user id or email)
4522
4548
  * @param options.crmNameCompanyMatch - Also exclude by exact name+company; @default true
4523
4549
  * @param options.salesNavigatorUrl - Sales Navigator people-search or people-list URL to use as the only discovery source
@@ -5112,8 +5138,14 @@ class ResponsesResource {
5112
5138
  * account, the period and `intentScoringInstructions` are what decide the
5113
5139
  * report.
5114
5140
  * @param options - The account, its period, and the explicit scopes to track.
5141
+ * @param options.crmUserId - CRM owner (UUID or email) whose connected CRM is
5142
+ * read for relationship context; requires `options.userId`, and another
5143
+ * member's CRM requires a CRM access grant. Omit for no CRM lookup.
5144
+ * @param options.userId - The acting user, sent as the request's top-level
5145
+ * `userId`. Required with `crmUserId`.
5115
5146
  * @returns Response; poll with `get()`, read `outputText` for the report and
5116
- * `structuredResponse` as {@link AccountMonitorOutput}.
5147
+ * `structuredResponse` as {@link AccountMonitorOutput}, whose `crmContext`
5148
+ * is present only when `crmUserId` was sent.
5117
5149
  *
5118
5150
  * @example
5119
5151
  * ```ts
@@ -5151,14 +5183,19 @@ class ResponsesResource {
5151
5183
  params.intentScoringInstructions = options.intentScoringInstructions;
5152
5184
  if (options.history !== void 0)
5153
5185
  params.history = options.history;
5186
+ if (options.crmUserId !== void 0)
5187
+ params.crmUserId = options.crmUserId;
5154
5188
  if (options.tier !== void 0)
5155
5189
  params.tier = options.tier;
5156
5190
  const prompt = query.trim() || `Account monitor report for ${options.account}`;
5157
- return this.create({
5191
+ const request = {
5158
5192
  messages: [{ role: "user", content: prompt }],
5159
5193
  specializedAgent: "account_monitor",
5160
5194
  specializedAgentParams: params
5161
- });
5195
+ };
5196
+ if (options.userId !== void 0)
5197
+ request.userId = options.userId;
5198
+ return this.create(request);
5162
5199
  }
5163
5200
  }
5164
5201