@gravity-rail/cli 0.32.0 → 0.33.0

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/gr.js CHANGED
@@ -3230,7 +3230,7 @@ var init_libphonenumber_js = __esm({
3230
3230
  }
3231
3231
  });
3232
3232
 
3233
- // ../sdk/dist/chunk-N446FGCT.js
3233
+ // ../sdk/dist/chunk-WDYHAQDY.js
3234
3234
  function sanitizePhoneForBackend(phoneNumber) {
3235
3235
  try {
3236
3236
  let parsed = parsePhoneNumber4(phoneNumber);
@@ -3550,7 +3550,6 @@ function bindChatsMethods(target, chats) {
3550
3550
  target.getChatModelOverride = chats.getChatModelOverride.bind(chats);
3551
3551
  target.updateChatModelOverride = chats.updateChatModelOverride.bind(chats);
3552
3552
  target.updateChatMute = chats.updateChatMute.bind(chats);
3553
- target.updateChatNeedsResponse = chats.updateChatNeedsResponse.bind(chats);
3554
3553
  target.summarizeChat = chats.summarizeChat.bind(chats);
3555
3554
  target.getChatMessages = chats.getChatMessages.bind(chats);
3556
3555
  target.getChildThreadMessages = chats.getChildThreadMessages.bind(chats);
@@ -3605,19 +3604,24 @@ function bindActivityMethods(target, activity) {
3605
3604
  target.queryActivityLatestSubjects = activity.queryActivityLatestSubjects.bind(activity);
3606
3605
  target.queryActivityOpenItems = activity.queryActivityOpenItems.bind(activity);
3607
3606
  target.queryActivityOneView = activity.queryActivityOneView.bind(activity);
3607
+ target.queryActivityDigest = activity.queryActivityDigest.bind(activity);
3608
3608
  target.getActivityCounts = activity.getActivityCounts.bind(activity);
3609
3609
  target.getActivityCapabilities = activity.getActivityCapabilities.bind(activity);
3610
3610
  target.queryOrgActivity = activity.queryOrgActivity.bind(activity);
3611
3611
  target.queryOrgActivityLatestSubjects = activity.queryOrgActivityLatestSubjects.bind(activity);
3612
3612
  target.queryOrgActivityOpenItems = activity.queryOrgActivityOpenItems.bind(activity);
3613
3613
  target.queryOrgActivityOneView = activity.queryOrgActivityOneView.bind(activity);
3614
+ target.queryOrgActivityDigest = activity.queryOrgActivityDigest.bind(activity);
3614
3615
  target.getOrgActivityCounts = activity.getOrgActivityCounts.bind(activity);
3615
3616
  target.queryWorkspaceActivity = activity.queryWorkspaceActivity.bind(activity);
3616
3617
  target.queryWorkspaceActivityLatestSubjects = activity.queryWorkspaceActivityLatestSubjects.bind(activity);
3617
3618
  target.queryWorkspaceActivityOpenItems = activity.queryWorkspaceActivityOpenItems.bind(activity);
3618
3619
  target.queryWorkspaceActivityOneView = activity.queryWorkspaceActivityOneView.bind(activity);
3620
+ target.queryWorkspaceActivityDigest = activity.queryWorkspaceActivityDigest.bind(activity);
3619
3621
  target.getWorkspaceActivityCounts = activity.getWorkspaceActivityCounts.bind(activity);
3620
3622
  target.resolveEntityRefs = activity.resolveEntityRefs.bind(activity);
3623
+ target.resolveOrgEntityRefs = activity.resolveOrgEntityRefs.bind(activity);
3624
+ target.resolveAccountEntityRefs = activity.resolveAccountEntityRefs.bind(activity);
3621
3625
  }
3622
3626
  function bindMotdMethods(target, motd) {
3623
3627
  target.getMotd = motd.getMotd.bind(motd);
@@ -3689,6 +3693,7 @@ function bindMembersMethods(target, members) {
3689
3693
  target.updateCurrentMember = members.updateCurrentMember.bind(members);
3690
3694
  target.getWorkspaceMembers = members.getWorkspaceMembers.bind(members);
3691
3695
  target.getWorkspaceMember = members.getWorkspaceMember.bind(members);
3696
+ target.getOrgWorkspaceMember = members.getOrgWorkspaceMember.bind(members);
3692
3697
  target.createWorkspaceMember = members.createWorkspaceMember.bind(members);
3693
3698
  target.updateMember = members.updateMember.bind(members);
3694
3699
  target.deleteMember = members.deleteMember.bind(members);
@@ -4602,8 +4607,8 @@ function getRevisionState(workflow, revision) {
4602
4607
  };
4603
4608
  }
4604
4609
  var AbilitiesApi, AccessGrantsApi, AgentTasksApi, AgentsApi, AIModelsApi, ApiKeysApi, AppsApi, AssignmentsApi, VoiceApi, AuthApi, BuildersApi, CalendarsApi, CallsApi, CELApi, ChatsApi, ConfluenceApi, CustomToolkitsApi, DataTypesApi, DiscordBotsApi, SlackAppsApi, EventsApi, FeaturesApi, FhirConnectionsApi, InboundFaxStatus, DocumoFaxApi, HealthieApi, FilesApi, InboxesApi, InquiriesApi, AppConnectionsApi, McpServersApi, MemberImportValidationError, MembersApi, MondayIntegrationApi, NotificationRulesApi, OperatorApi, OrgApi, OAuthConnectionsApi, OAuthApi, PhoneNumbersApi, PronunciationsApi, PromptsApi, PersonasApi, QueriesApi, QualificationsApi, ReportsApi, SalesforceApi, ConnectionSyncApi, HubspotApi, SitesApi, SubscriptionsApi, SupportRequestsApi, CustomersApi, ResellersApi, SupervisorsApi, TasksApi, TemplatesApi, ToolkitsApi, JourneysApi, WorkflowsApi, WorkflowNotesApi, EventRuleObjectType, EventRuleEventType, EventRuleActionType, DriverMode, WorkspaceInvitationsApi, WorkspacesApi, DashboardsApi, DevicesApi, TeamsAppsApi, ExperimentsApi, PatientSyncConnectionsApi, ActivityApi, MotdApi, InterventionRequestsApi, MetricsApi, ProjectsApi, TrackedLinksApi, WORKSPACE_METHOD_NAMES, WORKSPACE_METHOD_NAME_SET, GravityRailClient, WIDGET_SLUGS, CHAT_TYPES, BUILTIN_ASSISTANT_CHAT_TYPES, MEMBER_AGENT_CHAT_TYPES, ActivityGrain, ActivityGroupBy, ActivityOpenItemOrder, ActivityWindowBasis;
4605
- var init_chunk_N446FGCT = __esm({
4606
- "../sdk/dist/chunk-N446FGCT.js"() {
4610
+ var init_chunk_WDYHAQDY = __esm({
4611
+ "../sdk/dist/chunk-WDYHAQDY.js"() {
4607
4612
  init_chunk_P2E6LU7I();
4608
4613
  init_libphonenumber_js();
4609
4614
  AbilitiesApi = class extends BaseApiClient {
@@ -6120,22 +6125,12 @@ var init_chunk_N446FGCT = __esm({
6120
6125
  });
6121
6126
  }
6122
6127
  /** Update the mute status of a chat. */
6123
- async updateChatMute(wid, id, muted) {
6128
+ async updateChatMute(wid, id, muted, muteReason, muteExpiresOnInbound) {
6124
6129
  return this.fetch(`w/${wid}/chats/${id}/mute`, {
6125
6130
  method: "PUT",
6126
- body: JSON.stringify({ muted })
6131
+ body: JSON.stringify({ muted, muteReason, muteExpiresOnInbound })
6127
6132
  });
6128
6133
  }
6129
- /** Update the needs-response flag on a chat. */
6130
- async updateChatNeedsResponse(wid, id, needsResponse) {
6131
- return this.fetch(
6132
- `w/${wid}/chats/${id}/needs-response`,
6133
- {
6134
- method: "PUT",
6135
- body: JSON.stringify({ needsResponse })
6136
- }
6137
- );
6138
- }
6139
6134
  /** Generate an AI summary for a chat, optionally updating its labels. */
6140
6135
  async summarizeChat(wid, id, updateLabels) {
6141
6136
  const params = new URLSearchParams();
@@ -8465,6 +8460,19 @@ var init_chunk_N446FGCT = __esm({
8465
8460
  async getWorkspaceMember(wid, memberId) {
8466
8461
  return this.fetch(`w/${wid}/members/${memberId}`);
8467
8462
  }
8463
+ /**
8464
+ * Get one member of an org's workspace, under `org:read`.
8465
+ *
8466
+ * The same record and the same shape as `getWorkspaceMember`, for a reader
8467
+ * whose authority is the org rather than a member row in that workspace —
8468
+ * an org Activity pane opening a member it just listed. A workspace outside
8469
+ * the org is a 404, indistinguishable from a member id that does not exist.
8470
+ */
8471
+ async getOrgWorkspaceMember(orgUuid, workspaceUuid, memberId) {
8472
+ return this.fetch(
8473
+ `o/${orgUuid}/activity/workspaces/${workspaceUuid}/members/${memberId}`
8474
+ );
8475
+ }
8468
8476
  /** Create a new workspace member. */
8469
8477
  async createWorkspaceMember(wid, data) {
8470
8478
  return this.fetch(`w/${wid}/members`, {
@@ -13609,6 +13617,39 @@ var init_chunk_N446FGCT = __esm({
13609
13617
  body: JSON.stringify(request)
13610
13618
  });
13611
13619
  }
13620
+ /**
13621
+ * The specifics behind a page of aggregate lines, in one round trip.
13622
+ *
13623
+ * Each entry of `request.lines` is an aggregate line's **own server-issued
13624
+ * drill**, POSTed back verbatim, and the response is positional with it — so
13625
+ * a caller maps groups back to rows without inventing a key and without a
13626
+ * second expression of the slice that could drift from the count above it.
13627
+ *
13628
+ * Aggregate-shaped, never row-level: counts per PHI-silent key. A digest the
13629
+ * server could not finish comes back with `complete: false` and no groups,
13630
+ * which a client renders as the plain count phrase rather than as a slice
13631
+ * presented as the whole.
13632
+ */
13633
+ async queryActivityDigest(request) {
13634
+ return this.fetch("activity/digest", {
13635
+ method: "POST",
13636
+ body: JSON.stringify(request)
13637
+ });
13638
+ }
13639
+ /** The org mount's digest. */
13640
+ async queryOrgActivityDigest(orgUuid, request) {
13641
+ return this.fetch(`o/${orgUuid}/activity/digest`, {
13642
+ method: "POST",
13643
+ body: JSON.stringify(request)
13644
+ });
13645
+ }
13646
+ /** The workspace mount's digest. */
13647
+ async queryWorkspaceActivityDigest(workspaceUuid, request) {
13648
+ return this.fetch(`w/${workspaceUuid}/activity/digest`, {
13649
+ method: "POST",
13650
+ body: JSON.stringify(request)
13651
+ });
13652
+ }
13612
13653
  /** The workspace mount. The request's own member session carries its scopes. */
13613
13654
  async queryWorkspaceActivity(workspaceUuid, request) {
13614
13655
  return this.fetch(`w/${workspaceUuid}/activity/query`, {
@@ -13670,6 +13711,49 @@ var init_chunk_N446FGCT = __esm({
13670
13711
  body: JSON.stringify(request)
13671
13712
  });
13672
13713
  }
13714
+ /**
13715
+ * Hydrate a page of typed refs spanning an org's workspaces, in one round
13716
+ * trip. `org:info` is the gate; what it buys differs per workspace, and the
13717
+ * server decides — an `org:read` holder reads every workspace in the org,
13718
+ * an `org:info` holder the ones they belong to.
13719
+ *
13720
+ * The request groups refs by workspace because the same UUID under two
13721
+ * workspaces is two entities. A group naming a workspace this caller cannot
13722
+ * reach comes back entirely `unresolved` — the same answer a denied ref
13723
+ * gets, never an error.
13724
+ *
13725
+ * Caps: at most 500 refs and 25 workspaces across the whole request, and a
13726
+ * workspace may be named at most once in it. Each answered group carries the
13727
+ * same per-entry contract as the workspace mount: every requested ref comes
13728
+ * back, with a marker status rather than an omission.
13729
+ *
13730
+ * PHI: resolved labels are member-identifying data. They belong in the UI
13731
+ * and nowhere else — never a log line, never an error message.
13732
+ */
13733
+ async resolveOrgEntityRefs(orgUuid, request) {
13734
+ return this.fetch(`o/${orgUuid}/activity/entity-refs/resolve`, {
13735
+ method: "POST",
13736
+ body: JSON.stringify(request)
13737
+ });
13738
+ }
13739
+ /**
13740
+ * Hydrate a page of typed refs spanning the caller's whole estate.
13741
+ *
13742
+ * The same grouped body as the org mount, and the same rule that the server
13743
+ * chooses each group's authority: a workspace the caller belongs to resolves
13744
+ * under their own member row, and a workspace they reach by holding
13745
+ * `org:read` on its org resolves under that. A client never states which,
13746
+ * because stating it would mean carrying a copy of the policy.
13747
+ *
13748
+ * PHI: resolved labels are member-identifying data. They belong in the UI
13749
+ * and nowhere else — never a log line, never an error message.
13750
+ */
13751
+ async resolveAccountEntityRefs(request) {
13752
+ return this.fetch(`activity/entity-refs/resolve`, {
13753
+ method: "POST",
13754
+ body: JSON.stringify(request)
13755
+ });
13756
+ }
13673
13757
  };
13674
13758
  MotdApi = class extends BaseApiClient {
13675
13759
  /**
@@ -14314,6 +14398,7 @@ var init_chunk_N446FGCT = __esm({
14314
14398
  "queryWorkspaceActivityLatestSubjects",
14315
14399
  "queryWorkspaceActivityOpenItems",
14316
14400
  "queryWorkspaceActivityOneView",
14401
+ "queryWorkspaceActivityDigest",
14317
14402
  "registerDiscordSlashCommands",
14318
14403
  "reopenWorkspaceSupportRequest",
14319
14404
  "resolveEntityRefs",
@@ -14684,7 +14769,6 @@ var init_chunk_N446FGCT = __esm({
14684
14769
  "updateChatLabel",
14685
14770
  "updateChatModelOverride",
14686
14771
  "updateChatMute",
14687
- "updateChatNeedsResponse",
14688
14772
  "updateClientWorkspace",
14689
14773
  "updateConnection",
14690
14774
  "updateConnectionSyncConfig",
@@ -14813,7 +14897,6 @@ var init_chunk_N446FGCT = __esm({
14813
14897
  getChatModelOverride;
14814
14898
  updateChatModelOverride;
14815
14899
  updateChatMute;
14816
- updateChatNeedsResponse;
14817
14900
  summarizeChat;
14818
14901
  getChatMessages;
14819
14902
  getChildThreadMessages;
@@ -14899,6 +14982,9 @@ var init_chunk_N446FGCT = __esm({
14899
14982
  updateCurrentMember;
14900
14983
  getWorkspaceMembers;
14901
14984
  getWorkspaceMember;
14985
+ // Org-scoped, so deliberately absent from WORKSPACE_METHOD_NAMES: that proxy
14986
+ // passes a workspace uuid as the first argument.
14987
+ getOrgWorkspaceMember;
14902
14988
  createWorkspaceMember;
14903
14989
  updateMember;
14904
14990
  deleteMember;
@@ -15020,20 +15106,26 @@ var init_chunk_N446FGCT = __esm({
15020
15106
  queryActivityLatestSubjects;
15021
15107
  queryActivityOpenItems;
15022
15108
  queryActivityOneView;
15109
+ queryActivityDigest;
15023
15110
  getActivityCounts;
15024
15111
  getActivityCapabilities;
15025
15112
  queryOrgActivity;
15026
15113
  queryOrgActivityLatestSubjects;
15027
15114
  queryOrgActivityOpenItems;
15028
15115
  queryOrgActivityOneView;
15116
+ queryOrgActivityDigest;
15029
15117
  getOrgActivityCounts;
15030
15118
  queryWorkspaceActivity;
15031
15119
  queryWorkspaceActivityLatestSubjects;
15032
15120
  queryWorkspaceActivityOpenItems;
15033
15121
  queryWorkspaceActivityOneView;
15122
+ queryWorkspaceActivityDigest;
15034
15123
  getWorkspaceActivityCounts;
15035
- // Hydration: typed refs in, display summaries out, one round trip.
15124
+ // Hydration: typed refs in, display summaries out, one round trip. The org
15125
+ // variant carries several workspaces' groups in that one trip.
15036
15126
  resolveEntityRefs;
15127
+ resolveOrgEntityRefs;
15128
+ resolveAccountEntityRefs;
15037
15129
  // MOTD API
15038
15130
  getMotd;
15039
15131
  // Tracked Links analytics (#10934)
@@ -16092,7 +16184,7 @@ var init_chunk_HRUMZ46V = __esm({
16092
16184
  var SEARCHABLE_EVENT_RULE_SOURCE_FIELDS, ActivityEventType, EntityKind;
16093
16185
  var init_dist = __esm({
16094
16186
  "../sdk/dist/index.js"() {
16095
- init_chunk_N446FGCT();
16187
+ init_chunk_WDYHAQDY();
16096
16188
  init_chunk_HRUMZ46V();
16097
16189
  init_chunk_P2E6LU7I();
16098
16190
  SEARCHABLE_EVENT_RULE_SOURCE_FIELDS = [
@@ -16125,6 +16217,7 @@ var init_dist = __esm({
16125
16217
  chatstarted: "chat.started",
16126
16218
  chatawaiting_human: "chat.awaiting_human",
16127
16219
  chathuman_replied: "chat.human_replied",
16220
+ chatcall_ended: "chat.call_ended",
16128
16221
  escalationopened: "escalation.opened",
16129
16222
  escalationresolved: "escalation.resolved",
16130
16223
  callstarted: "call.started",
@@ -30938,12 +31031,81 @@ var ActivityRefResolver = class {
30938
31031
  forWorkspace.set(`${ref.kind}|${ref.uuid}`, ref);
30939
31032
  byWorkspace.set(ref.workspaceUuid, forWorkspace);
30940
31033
  }
31034
+ const groups = [...byWorkspace].map(
31035
+ ([workspaceUuid, wanted]) => [workspaceUuid, [...wanted.values()]]
31036
+ );
31037
+ if (this.options.orgUuid) {
31038
+ await this.primeOrg(this.options.orgUuid, groups);
31039
+ return;
31040
+ }
30941
31041
  await Promise.all(
30942
- [...byWorkspace].map(
30943
- ([workspaceUuid, wanted]) => this.primeWorkspace(workspaceUuid, [...wanted.values()])
30944
- )
31042
+ groups.map(([workspaceUuid, wanted]) => this.primeWorkspace(workspaceUuid, wanted))
30945
31043
  );
30946
31044
  }
31045
+ /**
31046
+ * One org call per chunk, each carrying whole workspace groups.
31047
+ *
31048
+ * The server's cap is over the whole request rather than per workspace, and
31049
+ * it accepts each workspace at most once per request — so a group larger
31050
+ * than the cap is split across requests, and smaller groups ride together
31051
+ * until the next one would not fit.
31052
+ */
31053
+ async primeOrg(orgUuid, groups) {
31054
+ const chunks = [];
31055
+ let current = [];
31056
+ let size = 0;
31057
+ for (const [workspaceUuid, refs] of groups) {
31058
+ for (let start = 0; start < refs.length; start += MAX_REFS_PER_BATCH) {
31059
+ const slice = refs.slice(start, start + MAX_REFS_PER_BATCH);
31060
+ if (size + slice.length > MAX_REFS_PER_BATCH && current.length > 0) {
31061
+ chunks.push(current);
31062
+ current = [];
31063
+ size = 0;
31064
+ }
31065
+ current.push([workspaceUuid, slice]);
31066
+ size += slice.length;
31067
+ }
31068
+ }
31069
+ if (current.length > 0) chunks.push(current);
31070
+ for (const chunk of chunks) {
31071
+ const key = `org:${orgUuid}|${chunk.map(
31072
+ ([workspaceUuid, refs]) => `${workspaceUuid}:${refs.map((ref) => `${ref.kind}|${ref.uuid}`).sort().join(",")}`
31073
+ ).sort().join(";")}`;
31074
+ const pending = this.inFlight.get(key) ?? this.fetchOrgChunk(orgUuid, chunk, key);
31075
+ this.inFlight.set(key, pending);
31076
+ await pending;
31077
+ }
31078
+ }
31079
+ /** One org batch call, seeded into the same per-ref cache. */
31080
+ async fetchOrgChunk(orgUuid, chunk, key) {
31081
+ try {
31082
+ this.fetches += 1;
31083
+ const response = await this.client.resolveOrgEntityRefs(orgUuid, {
31084
+ workspaces: chunk.map(([workspaceUuid, refs]) => ({
31085
+ workspaceUuid,
31086
+ refs: refs.map((ref) => ({ kind: ref.kind, uuid: ref.uuid }))
31087
+ }))
31088
+ });
31089
+ const answered = new Map(
31090
+ response.workspaces.map((group) => [
31091
+ group.workspaceUuid,
31092
+ new Map(group.refs.map((entry) => [`${entry.kind}|${entry.uuid}`, entry]))
31093
+ ])
31094
+ );
31095
+ for (const [workspaceUuid, refs] of chunk) {
31096
+ const byKey = answered.get(workspaceUuid);
31097
+ if (!byKey) continue;
31098
+ for (const ref of refs) {
31099
+ const entry = byKey.get(`${ref.kind}|${ref.uuid}`);
31100
+ if (!entry) continue;
31101
+ const resolution = batchResolution(ref, entry);
31102
+ if (resolution) this.cache.set(this.cacheKey(ref), Promise.resolve(resolution));
31103
+ }
31104
+ }
31105
+ } catch {
31106
+ this.inFlight.delete(key);
31107
+ }
31108
+ }
30947
31109
  async primeWorkspace(workspaceUuid, refs) {
30948
31110
  for (let start = 0; start < refs.length; start += MAX_REFS_PER_BATCH) {
30949
31111
  const chunk = refs.slice(start, start + MAX_REFS_PER_BATCH);
@@ -31198,8 +31360,10 @@ function globalFlags(ctx) {
31198
31360
  return flags;
31199
31361
  }
31200
31362
  function resolverFor(hctx) {
31363
+ const mount = resolveActivityMount(hctx.args);
31201
31364
  return new ActivityRefResolver(requireAuth(hctx.ctx).apiClient, {
31202
- bare: hctx.args.ids === true
31365
+ bare: hctx.args.ids === true,
31366
+ orgUuid: mount.kind === "org" ? mount.uuid : void 0
31203
31367
  });
31204
31368
  }
31205
31369
  function isAggregate(response) {
@@ -42866,7 +43030,7 @@ init_concierge_api();
42866
43030
 
42867
43031
  // package.json
42868
43032
  var package_default = {
42869
- version: "0.32.0"};
43033
+ version: "0.33.0"};
42870
43034
 
42871
43035
  // src/gr.ts
42872
43036
  var VERSION = package_default.version;