@iblai/iblai-js 2.31.0 → 2.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.
@@ -5,8 +5,8 @@ import { Locator, Page } from '@playwright/test';
5
5
  * Three surfaces, three groups of helpers:
6
6
  *
7
7
  * 1. **Header toggle** — the nav-bar `ChatPrivacyToggle` (`<HatGlasses />`
8
- * icon-button that morphs into the "Private Mode" pill).
9
- * 2. **User profile** — the "Private Mode" tab in `UserProfileModal`
8
+ * icon-button that morphs into the "Incognito" pill).
9
+ * 2. **User profile** — the "Privacy" tab in `UserProfileModal`
10
10
  * (three radio-card options: Normal / Anonymized / Disabled).
11
11
  * 3. **Tenant admin** — the "Allow users to control chat privacy" row in
12
12
  * the Advanced settings tab (`<Switch>`).
@@ -20,21 +20,21 @@ import { Locator, Page } from '@playwright/test';
20
20
  export declare const CHAT_PRIVACY_LABELS: {
21
21
  readonly toggle: {
22
22
  /** Title of the mid-session confirmation dialog. */
23
- readonly dialogTitle: "Enable Private Mode for this chat?";
23
+ readonly dialogTitle: "Enable Incognito for this chat?";
24
24
  /** Label on the dialog's confirm button (matches both idle + busy state via regex). */
25
25
  readonly dialogConfirm: RegExp;
26
26
  };
27
27
  readonly profileTab: {
28
- /** Tab name in the user profile modal sidebar. */
29
- readonly tabName: "Private Mode";
28
+ /** Rail entry in the user profile modal (the feature inside is called Incognito). */
29
+ readonly tabName: "Privacy";
30
30
  /** Section heading inside the tab body. */
31
- readonly sectionHeading: "Default Private Mode";
31
+ readonly sectionHeading: "Default Incognito Setting";
32
32
  /** Label text on each radio card. Kept in case the test wants to assert
33
33
  * copy explicitly — the click + read paths use the testid instead. */
34
34
  readonly cards: {
35
35
  readonly normal: "Normal";
36
36
  readonly anonymized: "Anonymized";
37
- readonly disabled: "Disabled";
37
+ readonly disabled: "Incognito";
38
38
  };
39
39
  };
40
40
  readonly tenantToggle: {
@@ -73,10 +73,12 @@ export declare function expectChatPrivacySource(scope: Page | Locator, source: C
73
73
  */
74
74
  export declare function expectChatPrivacyLocked(scope: Page | Locator, locked: boolean): Promise<void>;
75
75
  /**
76
- * Click the toggle. Covers two scenarios:
77
- * - Off → on (with no user messages) → starts a fresh private session.
78
- * - On (user-initiated, no user messages) → starts a fresh normal session.
79
- * Use `confirmEnableChatPrivacyMidSession` for the mid-conversation flow.
76
+ * Click the toggle. Covers the no-dialog transitions:
77
+ * - Off → on (no user messages) → starts a fresh private session.
78
+ * - On → off (no user messages) → starts a fresh normal session.
79
+ * - On → off (user messages sent) → resumes history on the same session;
80
+ * `turnOffChatPrivacyMidSession` wraps this with the state assertion.
81
+ * Use `confirmEnableChatPrivacyMidSession` for the mid-conversation enable.
80
82
  */
81
83
  export declare function clickChatPrivacyToggle(scope: Page | Locator): Promise<void>;
82
84
  /** Locator for the AlertDialog content that the mid-session enable opens. */
@@ -85,15 +87,28 @@ export declare function expectChatPrivacyConfirmDialogOpen(scope: Page | Locator
85
87
  /**
86
88
  * Mid-conversation enable flow:
87
89
  * 1. Click the toggle (opens the confirm dialog).
88
- * 2. Click the "Enable Private Mode" action.
89
- * The session-level disable-chathistory POST is one-way per spec; the
90
- * helper resolves once the dialog closes after a successful confirm.
90
+ * 2. Click the "Enable Incognito" action.
91
+ * Waits for any in-flight reply first (the toggle is `aria-disabled`
92
+ * meanwhile). Earlier messages stay in history and the flip is reversible
93
+ * (see `turnOffChatPrivacyMidSession`); the helper resolves once the dialog
94
+ * closes — which it also does when the backend refuses.
91
95
  */
92
96
  export declare function confirmEnableChatPrivacyMidSession(scope: Page | Locator): Promise<void>;
97
+ /**
98
+ * Mid-conversation turn-off: with Incognito on and user messages sent, one
99
+ * click POSTs `disable_chathistory: false` on the same session — no dialog —
100
+ * and history resumes. Resolves once the backend accepted the flip and the
101
+ * effective mode refetched; fails with the response status when it refuses.
102
+ * The toggle flips to `off` optimistically before the answer, so `data-state`
103
+ * alone proves nothing. It unmounts after a successful off on an agent with
104
+ * Never Incognito; that counts as off. A conversation that started in
105
+ * Incognito never gets here: its toggle is locked on.
106
+ */
107
+ export declare function turnOffChatPrivacyMidSession(scope: Page | Locator): Promise<void>;
93
108
  /** Cancel the confirm dialog without enabling. */
94
109
  export declare function cancelEnableChatPrivacyMidSession(scope: Page | Locator): Promise<void>;
95
110
  /**
96
- * Switch to the Private Mode tab inside the user profile modal. Assumes
111
+ * Switch to the Privacy tab inside the user profile modal. Assumes
97
112
  * the modal is already open. The tab only appears when the tenant has
98
113
  * `allow_user_chat_privacy_control` on, so a `false` return from
99
114
  * `isPrivateModeTabVisible` is a meaningful state, not an error.
@@ -27,7 +27,7 @@ export { getCurrentTenantShowPaywall, creditBalanceTrigger, creditBalancePanel,
27
27
  export type { CreditBalancePlan } from './credit-balance-helpers';
28
28
  export { PRIVACY_LABELS, isPrivacyTabVisible, switchToPrivacyTab, expectPrivacyFieldsHidden, expectPrivacyFieldsVisible, selectPrivacyAction, setBlockMessage, getEntityChip, setEntitySelected, expectEntitySelected, getOutputFilterSwitch, setOutputFilterEnabled, expectOutputFilterEnabled, } from './privacy-tab-helpers';
29
29
  export type { PrivacyAction, PrivacyEntity } from './privacy-tab-helpers';
30
- export { CHAT_PRIVACY_LABELS, getChatPrivacyToggle, expectChatPrivacyToggleVisible, expectChatPrivacyState, expectChatPrivacySource, expectChatPrivacyLocked, clickChatPrivacyToggle, getChatPrivacyConfirmDialog, expectChatPrivacyConfirmDialogOpen, confirmEnableChatPrivacyMidSession, cancelEnableChatPrivacyMidSession, isPrivateModeTabVisible, switchToPrivateModeTab, getPrivateModeCard, selectPrivateMode, expectPrivateModeSelected, expectPrivateModeTabReady, getTenantChatPrivacySwitch, getTenantChatPrivacyRow, expectTenantChatPrivacyVisible, expectTenantChatPrivacyEnabled, setTenantChatPrivacyEnabled, } from './chat-privacy-helpers';
30
+ export { CHAT_PRIVACY_LABELS, getChatPrivacyToggle, expectChatPrivacyToggleVisible, expectChatPrivacyState, expectChatPrivacySource, expectChatPrivacyLocked, clickChatPrivacyToggle, getChatPrivacyConfirmDialog, expectChatPrivacyConfirmDialogOpen, confirmEnableChatPrivacyMidSession, turnOffChatPrivacyMidSession, cancelEnableChatPrivacyMidSession, isPrivateModeTabVisible, switchToPrivateModeTab, getPrivateModeCard, selectPrivateMode, expectPrivateModeSelected, expectPrivateModeTabReady, getTenantChatPrivacySwitch, getTenantChatPrivacyRow, expectTenantChatPrivacyVisible, expectTenantChatPrivacyEnabled, setTenantChatPrivacyEnabled, } from './chat-privacy-helpers';
31
31
  export type { ChatPrivacyMode, ChatPrivacySource, ChatPrivacyToggleState, } from './chat-privacy-helpers';
32
32
  export { VOICE_LABELS, isVoiceTabVisible, switchToVoiceTab, switchToVoiceSubTab, getVoiceProviderCard, selectVoiceProvider, expectVoiceProviderSelected, openMentorVoicePicker, openCallConfigVoicePicker, previewMentorVoiceInline, previewCallConfigVoiceInline, expectMentorVoiceTriggerShows, expectCallConfigVoiceTriggerShows, searchVoices, getVoiceRow, expectVoiceVisible, selectVoice, previewVoice, openVoiceInstructionsEditor, setVoiceInstructions, expectVoiceInstructionsValue, applyVoiceInstructionsPreset, saveVoiceSettings, getCallConfigForm, expectCallConfigVisible, selectCallMode, setCallLanguage, selectLlmProvider, selectTtsProvider, selectSttProvider, expectTtsSelectDisabled, expectSttSelectDisabled, setUseFunctionCallingEnabled, setEnableVideo, saveCallConfig, resetCallConfig, } from './voice-tab-helpers';
33
33
  export type { VoiceProvider, VoiceInstructionsPreset, CallMode, TtsProvider, SttProvider, LlmProvider, } from './voice-tab-helpers';
@@ -4069,8 +4069,8 @@ async function expectOutputFilterEnabled(scope, enabled) {
4069
4069
  * Three surfaces, three groups of helpers:
4070
4070
  *
4071
4071
  * 1. **Header toggle** — the nav-bar `ChatPrivacyToggle` (`<HatGlasses />`
4072
- * icon-button that morphs into the "Private Mode" pill).
4073
- * 2. **User profile** — the "Private Mode" tab in `UserProfileModal`
4072
+ * icon-button that morphs into the "Incognito" pill).
4073
+ * 2. **User profile** — the "Privacy" tab in `UserProfileModal`
4074
4074
  * (three radio-card options: Normal / Anonymized / Disabled).
4075
4075
  * 3. **Tenant admin** — the "Allow users to control chat privacy" row in
4076
4076
  * the Advanced settings tab (`<Switch>`).
@@ -4084,21 +4084,21 @@ async function expectOutputFilterEnabled(scope, enabled) {
4084
4084
  const CHAT_PRIVACY_LABELS = {
4085
4085
  toggle: {
4086
4086
  /** Title of the mid-session confirmation dialog. */
4087
- dialogTitle: 'Enable Private Mode for this chat?',
4087
+ dialogTitle: 'Enable Incognito for this chat?',
4088
4088
  /** Label on the dialog's confirm button (matches both idle + busy state via regex). */
4089
- dialogConfirm: /Enable Private Mode|Enabling…/,
4089
+ dialogConfirm: /Enable Incognito|Enabling…/,
4090
4090
  },
4091
4091
  profileTab: {
4092
- /** Tab name in the user profile modal sidebar. */
4093
- tabName: 'Private Mode',
4092
+ /** Rail entry in the user profile modal (the feature inside is called Incognito). */
4093
+ tabName: 'Privacy',
4094
4094
  /** Section heading inside the tab body. */
4095
- sectionHeading: 'Default Private Mode',
4095
+ sectionHeading: 'Default Incognito Setting',
4096
4096
  /** Label text on each radio card. Kept in case the test wants to assert
4097
4097
  * copy explicitly — the click + read paths use the testid instead. */
4098
4098
  cards: {
4099
4099
  normal: 'Normal',
4100
4100
  anonymized: 'Anonymized',
4101
- disabled: 'Disabled',
4101
+ disabled: 'Incognito',
4102
4102
  },
4103
4103
  },
4104
4104
  tenantToggle: {
@@ -4164,10 +4164,12 @@ async function expectChatPrivacyLocked(scope, locked) {
4164
4164
  }
4165
4165
  }
4166
4166
  /**
4167
- * Click the toggle. Covers two scenarios:
4168
- * - Off → on (with no user messages) → starts a fresh private session.
4169
- * - On (user-initiated, no user messages) → starts a fresh normal session.
4170
- * Use `confirmEnableChatPrivacyMidSession` for the mid-conversation flow.
4167
+ * Click the toggle. Covers the no-dialog transitions:
4168
+ * - Off → on (no user messages) → starts a fresh private session.
4169
+ * - On → off (no user messages) → starts a fresh normal session.
4170
+ * - On → off (user messages sent) → resumes history on the same session;
4171
+ * `turnOffChatPrivacyMidSession` wraps this with the state assertion.
4172
+ * Use `confirmEnableChatPrivacyMidSession` for the mid-conversation enable.
4171
4173
  */
4172
4174
  async function clickChatPrivacyToggle(scope) {
4173
4175
  const toggle = getChatPrivacyToggle(scope);
@@ -4191,11 +4193,18 @@ async function expectChatPrivacyConfirmDialogOpen(scope, open) {
4191
4193
  /**
4192
4194
  * Mid-conversation enable flow:
4193
4195
  * 1. Click the toggle (opens the confirm dialog).
4194
- * 2. Click the "Enable Private Mode" action.
4195
- * The session-level disable-chathistory POST is one-way per spec; the
4196
- * helper resolves once the dialog closes after a successful confirm.
4196
+ * 2. Click the "Enable Incognito" action.
4197
+ * Waits for any in-flight reply first (the toggle is `aria-disabled`
4198
+ * meanwhile). Earlier messages stay in history and the flip is reversible
4199
+ * (see `turnOffChatPrivacyMidSession`); the helper resolves once the dialog
4200
+ * closes — which it also does when the backend refuses.
4197
4201
  */
4198
4202
  async function confirmEnableChatPrivacyMidSession(scope) {
4203
+ // The toggle is aria-disabled while a reply is in flight (an enable before
4204
+ // the first turn is saved would drop the conversation from history).
4205
+ await test$1.expect(getChatPrivacyToggle(scope)).not.toHaveAttribute('aria-disabled', 'true', {
4206
+ timeout: 120000,
4207
+ });
4199
4208
  await clickChatPrivacyToggle(scope);
4200
4209
  const page = asPage$7(scope);
4201
4210
  await expectChatPrivacyConfirmDialogOpen(page, true);
@@ -4204,7 +4213,38 @@ async function confirmEnableChatPrivacyMidSession(scope) {
4204
4213
  await test$1.expect(action).toBeEnabled({ timeout: 10000 });
4205
4214
  await action.click();
4206
4215
  await expectChatPrivacyConfirmDialogOpen(page, false);
4207
- logger.info('Confirmed mid-session Private Mode enable');
4216
+ logger.info('Confirmed mid-session Incognito enable');
4217
+ }
4218
+ /**
4219
+ * Mid-conversation turn-off: with Incognito on and user messages sent, one
4220
+ * click POSTs `disable_chathistory: false` on the same session — no dialog —
4221
+ * and history resumes. Resolves once the backend accepted the flip and the
4222
+ * effective mode refetched; fails with the response status when it refuses.
4223
+ * The toggle flips to `off` optimistically before the answer, so `data-state`
4224
+ * alone proves nothing. It unmounts after a successful off on an agent with
4225
+ * Never Incognito; that counts as off. A conversation that started in
4226
+ * Incognito never gets here: its toggle is locked on.
4227
+ */
4228
+ async function turnOffChatPrivacyMidSession(scope) {
4229
+ const page = asPage$7(scope);
4230
+ const toggle = getChatPrivacyToggle(scope);
4231
+ await test$1.expect(toggle).not.toHaveAttribute('aria-disabled', 'true', { timeout: 120000 });
4232
+ const flip = page.waitForResponse((r) => {
4233
+ var _a;
4234
+ return r.request().method() === 'POST' &&
4235
+ r.url().includes('/disable-chathistory/') &&
4236
+ ((_a = r.request().postDataJSON()) === null || _a === void 0 ? void 0 : _a.disable_chathistory) === false;
4237
+ }, { timeout: 30000 });
4238
+ await clickChatPrivacyToggle(scope);
4239
+ const response = await flip;
4240
+ test$1.expect(response.status(), 'disable-chathistory false was refused').toBe(200);
4241
+ await test$1.expect(async () => {
4242
+ if ((await toggle.count()) === 0)
4243
+ return;
4244
+ await test$1.expect(toggle).toHaveAttribute('data-state', 'off', { timeout: 1000 });
4245
+ await test$1.expect(toggle).not.toHaveAttribute('data-source', 'session', { timeout: 1000 });
4246
+ }).toPass({ timeout: 30000 });
4247
+ logger.info('Turned Incognito off mid-session');
4208
4248
  }
4209
4249
  /** Cancel the confirm dialog without enabling. */
4210
4250
  async function cancelEnableChatPrivacyMidSession(scope) {
@@ -4213,13 +4253,13 @@ async function cancelEnableChatPrivacyMidSession(scope) {
4213
4253
  await test$1.expect(cancel).toBeVisible({ timeout: 10000 });
4214
4254
  await cancel.click();
4215
4255
  await expectChatPrivacyConfirmDialogOpen(page, false);
4216
- logger.info('Cancelled mid-session Private Mode dialog');
4256
+ logger.info('Cancelled mid-session Incognito dialog');
4217
4257
  }
4218
4258
  // ──────────────────────────────────────────────────────────────────────
4219
- // 2. User profile — Private Mode tab
4259
+ // 2. User profile — Privacy tab
4220
4260
  // ──────────────────────────────────────────────────────────────────────
4221
4261
  /**
4222
- * Switch to the Private Mode tab inside the user profile modal. Assumes
4262
+ * Switch to the Privacy tab inside the user profile modal. Assumes
4223
4263
  * the modal is already open. The tab only appears when the tenant has
4224
4264
  * `allow_user_chat_privacy_control` on, so a `false` return from
4225
4265
  * `isPrivateModeTabVisible` is a meaningful state, not an error.
@@ -4245,7 +4285,7 @@ async function switchToPrivateModeTab(page) {
4245
4285
  await test$1.expect(tab).toBeVisible({ timeout: 10000 });
4246
4286
  await tab.click();
4247
4287
  await test$1.expect(page.getByTestId('chat-privacy-tab-body')).toBeVisible({ timeout: 10000 });
4248
- logger.info('Switched to Private Mode tab');
4288
+ logger.info('Switched to Privacy tab');
4249
4289
  }
4250
4290
  /** Locator for one of the three radio cards. */
4251
4291
  function getPrivateModeCard(scope, mode) {
@@ -4262,7 +4302,7 @@ async function selectPrivateMode(scope, mode) {
4262
4302
  await test$1.expect(card).toBeEnabled({ timeout: 10000 });
4263
4303
  await card.click();
4264
4304
  await test$1.expect(card).toHaveAttribute('aria-pressed', 'true', { timeout: 10000 });
4265
- logger.info(`Selected Private Mode "${mode}"`);
4305
+ logger.info(`Selected Incognito "${mode}"`);
4266
4306
  }
4267
4307
  /** Assert which mode is currently selected. Uses `aria-pressed` + `data-state`. */
4268
4308
  async function expectPrivateModeSelected(scope, mode) {
@@ -9307,6 +9347,7 @@ exports.toggleSandboxKind = toggleSandboxKind;
9307
9347
  exports.toggleSkill = toggleSkill;
9308
9348
  exports.toggleUserMemoryAdminSetting = toggleUserMemoryAdminSetting;
9309
9349
  exports.toolFields = toolFields;
9350
+ exports.turnOffChatPrivacyMidSession = turnOffChatPrivacyMidSession;
9310
9351
  exports.uploadAssetResource = uploadAssetResource;
9311
9352
  exports.uploadQaCsv = uploadQaCsv;
9312
9353
  exports.userSpendLimitRow = userSpendLimitRow;