@iblai/iblai-js 2.43.0 → 2.45.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/data-layer/playwright/edit-agent-category-helpers.d.ts +13 -0
- package/dist/data-layer/playwright/human-support-tab-helpers.d.ts +2 -2
- package/dist/data-layer/playwright/privacy-tab-helpers.d.ts +7 -4
- package/dist/data-layer/playwright/spend-limits-helpers.d.ts +7 -4
- package/dist/playwright/index.cjs +55 -15
- package/dist/playwright/index.cjs.map +1 -1
- package/dist/playwright/index.d.ts +16 -10
- package/dist/playwright/index.esm.js +55 -15
- package/dist/playwright/index.esm.js.map +1 -1
- package/dist/playwright/playwright/edit-agent-category-helpers.d.ts +13 -0
- package/dist/playwright/playwright/human-support-tab-helpers.d.ts +2 -2
- package/dist/playwright/playwright/privacy-tab-helpers.d.ts +7 -4
- package/dist/playwright/playwright/spend-limits-helpers.d.ts +7 -4
- package/dist/security/playwright/edit-agent-category-helpers.d.ts +13 -0
- package/dist/security/playwright/human-support-tab-helpers.d.ts +2 -2
- package/dist/security/playwright/privacy-tab-helpers.d.ts +7 -4
- package/dist/security/playwright/spend-limits-helpers.d.ts +7 -4
- package/dist/web-containers/playwright/edit-agent-category-helpers.d.ts +13 -0
- package/dist/web-containers/playwright/human-support-tab-helpers.d.ts +2 -2
- package/dist/web-containers/playwright/privacy-tab-helpers.d.ts +7 -4
- package/dist/web-containers/playwright/spend-limits-helpers.d.ts +7 -4
- package/dist/web-containers/source/admin/tabs/applications/applications-tab.js +5 -2
- package/dist/web-containers/source/admin/tabs/applications/applications-tab.js.map +1 -1
- package/dist/web-containers/source/applications/applications-tab.js +5 -2
- package/dist/web-containers/source/applications/applications-tab.js.map +1 -1
- package/dist/web-containers/source/applications-tab.js +5 -2
- package/dist/web-containers/source/applications-tab.js.map +1 -1
- package/dist/web-containers/source/approvals-mode-button.js +177 -0
- package/dist/web-containers/source/approvals-mode-button.js.map +1 -0
- package/dist/web-containers/source/capabilities-sub-tab.js +1 -1
- package/dist/web-containers/source/capabilities-sub-tab.js.map +1 -1
- package/dist/web-containers/source/chat/chat-host-context.js.map +1 -1
- package/dist/web-containers/source/chat/code-permission-card.js +39 -2
- package/dist/web-containers/source/chat/code-permission-card.js.map +1 -1
- package/dist/web-containers/source/chat-host-context.js.map +1 -1
- package/dist/web-containers/source/chat-input-form/approvals-mode-button.js +177 -0
- package/dist/web-containers/source/chat-input-form/approvals-mode-button.js.map +1 -0
- package/dist/web-containers/source/chat-input-form/composer-canvas-pill.js +30 -0
- package/dist/web-containers/source/chat-input-form/composer-canvas-pill.js.map +1 -0
- package/dist/web-containers/source/chat-input-form/composer-model-chip.js +23 -0
- package/dist/web-containers/source/chat-input-form/composer-model-chip.js.map +1 -0
- package/dist/web-containers/source/chat-input-form/composer-plus-menu.js +3 -3
- package/dist/web-containers/source/chat-input-form/composer-plus-menu.js.map +1 -1
- package/dist/web-containers/source/chat-input-form/composer-tool-row.js +91 -0
- package/dist/web-containers/source/chat-input-form/composer-tool-row.js.map +1 -0
- package/dist/web-containers/source/chat-input-form/cowork-control.js +7 -4
- package/dist/web-containers/source/chat-input-form/cowork-control.js.map +1 -1
- package/dist/web-containers/source/chat-input-form.js +8 -30
- package/dist/web-containers/source/chat-input-form.js.map +1 -1
- package/dist/web-containers/source/claw-sandbox/sandbox-config.js +1 -3
- package/dist/web-containers/source/claw-sandbox/sandbox-config.js.map +1 -1
- package/dist/web-containers/source/claw-sandbox/sandbox-kind-row.js +12 -0
- package/dist/web-containers/source/claw-sandbox/sandbox-kind-row.js.map +1 -0
- package/dist/web-containers/source/code-permission-card.js +39 -2
- package/dist/web-containers/source/code-permission-card.js.map +1 -1
- package/dist/web-containers/source/components/chat/chat-host-context.js.map +1 -1
- package/dist/web-containers/source/components/chat/code-permission-card.js +39 -2
- package/dist/web-containers/source/components/chat/code-permission-card.js.map +1 -1
- package/dist/web-containers/source/components/chat-input-form/approvals-mode-button.js +177 -0
- package/dist/web-containers/source/components/chat-input-form/approvals-mode-button.js.map +1 -0
- package/dist/web-containers/source/components/chat-input-form/composer-canvas-pill.js +30 -0
- package/dist/web-containers/source/components/chat-input-form/composer-canvas-pill.js.map +1 -0
- package/dist/web-containers/source/components/chat-input-form/composer-model-chip.js +23 -0
- package/dist/web-containers/source/components/chat-input-form/composer-model-chip.js.map +1 -0
- package/dist/web-containers/source/components/chat-input-form/composer-plus-menu.js +3 -3
- package/dist/web-containers/source/components/chat-input-form/composer-plus-menu.js.map +1 -1
- package/dist/web-containers/source/components/chat-input-form/composer-tool-row.js +91 -0
- package/dist/web-containers/source/components/chat-input-form/composer-tool-row.js.map +1 -0
- package/dist/web-containers/source/components/chat-input-form/cowork-control.js +7 -4
- package/dist/web-containers/source/components/chat-input-form/cowork-control.js.map +1 -1
- package/dist/web-containers/source/components/chat-input-form.js +8 -30
- package/dist/web-containers/source/components/chat-input-form.js.map +1 -1
- package/dist/web-containers/source/components/claw-sandbox/sandbox-config.js +1 -3
- package/dist/web-containers/source/components/claw-sandbox/sandbox-config.js.map +1 -1
- package/dist/web-containers/source/components/claw-sandbox/sandbox-kind-row.js +12 -0
- package/dist/web-containers/source/components/claw-sandbox/sandbox-kind-row.js.map +1 -0
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/llm-tab/labels.js +12 -0
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/llm-tab/labels.js.map +1 -1
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/llm-tab/llm-provider-modal.js +46 -32
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/llm-tab/llm-provider-modal.js.map +1 -1
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/llm-tab.js +34 -6
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/llm-tab.js.map +1 -1
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/settings-tab/capabilities-sub-tab.js +1 -1
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/settings-tab/capabilities-sub-tab.js.map +1 -1
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/settings-tab/labels.js +1 -9
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/settings-tab/labels.js.map +1 -1
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/settings-tab/use-edit-mentor-settings.js +4 -8
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/settings-tab/use-edit-mentor-settings.js.map +1 -1
- package/dist/web-containers/source/components/profile/admin/tabs/applications/applications-tab.js +5 -2
- package/dist/web-containers/source/components/profile/admin/tabs/applications/applications-tab.js.map +1 -1
- package/dist/web-containers/source/components/profile/users-models/index.js +192 -0
- package/dist/web-containers/source/components/profile/users-models/index.js.map +1 -0
- package/dist/web-containers/source/components/profile/users-models/llm-access.js +206 -0
- package/dist/web-containers/source/components/profile/users-models/llm-access.js.map +1 -0
- package/dist/web-containers/source/composer-canvas-pill.js +30 -0
- package/dist/web-containers/source/composer-canvas-pill.js.map +1 -0
- package/dist/web-containers/source/composer-model-chip.js +23 -0
- package/dist/web-containers/source/composer-model-chip.js.map +1 -0
- package/dist/web-containers/source/composer-plus-menu.js +3 -3
- package/dist/web-containers/source/composer-plus-menu.js.map +1 -1
- package/dist/web-containers/source/composer-tool-row.js +91 -0
- package/dist/web-containers/source/composer-tool-row.js.map +1 -0
- package/dist/web-containers/source/cowork-control.js +7 -4
- package/dist/web-containers/source/cowork-control.js.map +1 -1
- package/dist/web-containers/source/edit-mentor-modal/tabs/llm-tab/labels.js +12 -0
- package/dist/web-containers/source/edit-mentor-modal/tabs/llm-tab/labels.js.map +1 -1
- package/dist/web-containers/source/edit-mentor-modal/tabs/llm-tab/llm-provider-modal.js +46 -32
- package/dist/web-containers/source/edit-mentor-modal/tabs/llm-tab/llm-provider-modal.js.map +1 -1
- package/dist/web-containers/source/edit-mentor-modal/tabs/llm-tab.js +34 -6
- package/dist/web-containers/source/edit-mentor-modal/tabs/llm-tab.js.map +1 -1
- package/dist/web-containers/source/edit-mentor-modal/tabs/settings-tab/capabilities-sub-tab.js +1 -1
- package/dist/web-containers/source/edit-mentor-modal/tabs/settings-tab/capabilities-sub-tab.js.map +1 -1
- package/dist/web-containers/source/edit-mentor-modal/tabs/settings-tab/labels.js +1 -9
- package/dist/web-containers/source/edit-mentor-modal/tabs/settings-tab/labels.js.map +1 -1
- package/dist/web-containers/source/edit-mentor-modal/tabs/settings-tab/use-edit-mentor-settings.js +4 -8
- package/dist/web-containers/source/edit-mentor-modal/tabs/settings-tab/use-edit-mentor-settings.js.map +1 -1
- package/dist/web-containers/source/en.json.js +50 -9
- package/dist/web-containers/source/en.json.js.map +1 -1
- package/dist/web-containers/source/es.json.js +49 -8
- package/dist/web-containers/source/es.json.js.map +1 -1
- package/dist/web-containers/source/fr.json.js +49 -8
- package/dist/web-containers/source/fr.json.js.map +1 -1
- package/dist/web-containers/source/i18n/messages/en.json.js +50 -9
- package/dist/web-containers/source/i18n/messages/en.json.js.map +1 -1
- package/dist/web-containers/source/i18n/messages/es.json.js +49 -8
- package/dist/web-containers/source/i18n/messages/es.json.js.map +1 -1
- package/dist/web-containers/source/i18n/messages/fr.json.js +49 -8
- package/dist/web-containers/source/i18n/messages/fr.json.js.map +1 -1
- package/dist/web-containers/source/i18n/messages/zh.json.js +49 -8
- package/dist/web-containers/source/i18n/messages/zh.json.js.map +1 -1
- package/dist/web-containers/source/labels.js +289 -23
- package/dist/web-containers/source/labels.js.map +1 -1
- package/dist/web-containers/source/llm-access.js +206 -0
- package/dist/web-containers/source/llm-access.js.map +1 -0
- package/dist/web-containers/source/llm-provider-modal.js +46 -32
- package/dist/web-containers/source/llm-provider-modal.js.map +1 -1
- package/dist/web-containers/source/llm-tab/labels.js +12 -0
- package/dist/web-containers/source/llm-tab/labels.js.map +1 -1
- package/dist/web-containers/source/llm-tab/llm-provider-modal.js +46 -32
- package/dist/web-containers/source/llm-tab/llm-provider-modal.js.map +1 -1
- package/dist/web-containers/source/llm-tab.js +34 -6
- package/dist/web-containers/source/llm-tab.js.map +1 -1
- package/dist/web-containers/source/messages/en.json.js +50 -9
- package/dist/web-containers/source/messages/en.json.js.map +1 -1
- package/dist/web-containers/source/messages/es.json.js +49 -8
- package/dist/web-containers/source/messages/es.json.js.map +1 -1
- package/dist/web-containers/source/messages/fr.json.js +49 -8
- package/dist/web-containers/source/messages/fr.json.js.map +1 -1
- package/dist/web-containers/source/messages/zh.json.js +49 -8
- package/dist/web-containers/source/messages/zh.json.js.map +1 -1
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/llm-tab/labels.js +12 -0
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/llm-tab/labels.js.map +1 -1
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/llm-tab/llm-provider-modal.js +46 -32
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/llm-tab/llm-provider-modal.js.map +1 -1
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/llm-tab.js +34 -6
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/llm-tab.js.map +1 -1
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/settings-tab/capabilities-sub-tab.js +1 -1
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/settings-tab/capabilities-sub-tab.js.map +1 -1
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/settings-tab/labels.js +1 -9
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/settings-tab/labels.js.map +1 -1
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/settings-tab/use-edit-mentor-settings.js +4 -8
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/settings-tab/use-edit-mentor-settings.js.map +1 -1
- package/dist/web-containers/source/next/index.js +2 -0
- package/dist/web-containers/source/next/index.js.map +1 -1
- package/dist/web-containers/source/profile/admin/tabs/applications/applications-tab.js +5 -2
- package/dist/web-containers/source/profile/admin/tabs/applications/applications-tab.js.map +1 -1
- package/dist/web-containers/source/profile/users-models/index.js +192 -0
- package/dist/web-containers/source/profile/users-models/index.js.map +1 -0
- package/dist/web-containers/source/profile/users-models/llm-access.js +206 -0
- package/dist/web-containers/source/profile/users-models/llm-access.js.map +1 -0
- package/dist/web-containers/source/sandbox-config.js +1 -3
- package/dist/web-containers/source/sandbox-config.js.map +1 -1
- package/dist/web-containers/source/sandbox-kind-row.js +12 -0
- package/dist/web-containers/source/sandbox-kind-row.js.map +1 -0
- package/dist/web-containers/source/settings-tab/capabilities-sub-tab.js +1 -1
- package/dist/web-containers/source/settings-tab/capabilities-sub-tab.js.map +1 -1
- package/dist/web-containers/source/settings-tab/labels.js +1 -9
- package/dist/web-containers/source/settings-tab/labels.js.map +1 -1
- package/dist/web-containers/source/settings-tab/use-edit-mentor-settings.js +4 -8
- package/dist/web-containers/source/settings-tab/use-edit-mentor-settings.js.map +1 -1
- package/dist/web-containers/source/tabs/applications/applications-tab.js +5 -2
- package/dist/web-containers/source/tabs/applications/applications-tab.js.map +1 -1
- package/dist/web-containers/source/tabs/llm-tab/labels.js +12 -0
- package/dist/web-containers/source/tabs/llm-tab/labels.js.map +1 -1
- package/dist/web-containers/source/tabs/llm-tab/llm-provider-modal.js +46 -32
- package/dist/web-containers/source/tabs/llm-tab/llm-provider-modal.js.map +1 -1
- package/dist/web-containers/source/tabs/llm-tab.js +34 -6
- package/dist/web-containers/source/tabs/llm-tab.js.map +1 -1
- package/dist/web-containers/source/tabs/settings-tab/capabilities-sub-tab.js +1 -1
- package/dist/web-containers/source/tabs/settings-tab/capabilities-sub-tab.js.map +1 -1
- package/dist/web-containers/source/tabs/settings-tab/labels.js +1 -9
- package/dist/web-containers/source/tabs/settings-tab/labels.js.map +1 -1
- package/dist/web-containers/source/tabs/settings-tab/use-edit-mentor-settings.js +4 -8
- package/dist/web-containers/source/tabs/settings-tab/use-edit-mentor-settings.js.map +1 -1
- package/dist/web-containers/source/tsconfig.tsbuildinfo +1 -1
- package/dist/web-containers/source/use-edit-mentor-settings.js +4 -8
- package/dist/web-containers/source/use-edit-mentor-settings.js.map +1 -1
- package/dist/web-containers/source/users-models/index.js +192 -0
- package/dist/web-containers/source/users-models/index.js.map +1 -0
- package/dist/web-containers/source/users-models/llm-access.js +206 -0
- package/dist/web-containers/source/users-models/llm-access.js.map +1 -0
- package/dist/web-containers/source/web-containers/tsconfig.tsbuildinfo +1 -1
- package/dist/web-containers/source/zh.json.js +49 -8
- package/dist/web-containers/source/zh.json.js.map +1 -1
- package/dist/web-utils/playwright/edit-agent-category-helpers.d.ts +13 -0
- package/dist/web-utils/playwright/human-support-tab-helpers.d.ts +2 -2
- package/dist/web-utils/playwright/privacy-tab-helpers.d.ts +7 -4
- package/dist/web-utils/playwright/spend-limits-helpers.d.ts +7 -4
- package/package.json +5 -5
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useRef, useSyncExternalStore, useEffect } from 'react';
|
|
3
|
+
import { useChatT } from '../chat/chat-host-context.js';
|
|
4
|
+
import { Popover, PopoverTrigger, PopoverContent } from '../ui/popover.js';
|
|
5
|
+
import Zap from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/zap.js';
|
|
6
|
+
import Hand from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/hand.js';
|
|
7
|
+
import Check from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/check.js';
|
|
8
|
+
|
|
9
|
+
const PERMISSION_MODES = ['manual', 'auto'];
|
|
10
|
+
const PERMISSION_MODE_ICONS = {
|
|
11
|
+
manual: Hand,
|
|
12
|
+
auto: Zap,
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* One approval-mode store per call, so each surface that has its own mode
|
|
16
|
+
* (Code today, Cowork later) keeps its own.
|
|
17
|
+
*/
|
|
18
|
+
function createApprovalModeStore() {
|
|
19
|
+
// `picks` and `seeds` count the user's choices and the profile's mode taking
|
|
20
|
+
// effect, so a read that started before either never overwrites it. Seeded to
|
|
21
|
+
// Ask Me, NOT the saved default: until the desktop answers, claiming Automatic
|
|
22
|
+
// would tell a user who chose Ask Me that Code may act unasked.
|
|
23
|
+
let approvalMode = 'manual';
|
|
24
|
+
let picks = 0;
|
|
25
|
+
let seeds = 0;
|
|
26
|
+
// Code pills that currently offer the approvals button. Counted, not flagged:
|
|
27
|
+
// the canvas split mounts a composer, and so a pill, on each side.
|
|
28
|
+
let offers = 0;
|
|
29
|
+
const subscribers = new Set();
|
|
30
|
+
function notifySubscribers() {
|
|
31
|
+
subscribers.forEach((notify) => notify());
|
|
32
|
+
}
|
|
33
|
+
function publish(mode) {
|
|
34
|
+
approvalMode = mode;
|
|
35
|
+
notifySubscribers();
|
|
36
|
+
}
|
|
37
|
+
function subscribe(notify) {
|
|
38
|
+
subscribers.add(notify);
|
|
39
|
+
return () => {
|
|
40
|
+
subscribers.delete(notify);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function useApprovalMode() {
|
|
44
|
+
return useSyncExternalStore(subscribe, () => approvalMode, () => 'manual');
|
|
45
|
+
}
|
|
46
|
+
function useOfferApprovals(offer) {
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (!offer)
|
|
49
|
+
return;
|
|
50
|
+
offers += 1;
|
|
51
|
+
notifySubscribers();
|
|
52
|
+
return () => {
|
|
53
|
+
offers -= 1;
|
|
54
|
+
notifySubscribers();
|
|
55
|
+
};
|
|
56
|
+
}, [offer]);
|
|
57
|
+
}
|
|
58
|
+
/** Whether any Code pill on screen offers the approvals button. */
|
|
59
|
+
function useApprovalsOffered() {
|
|
60
|
+
return useSyncExternalStore(subscribe, () => offers > 0, () => false);
|
|
61
|
+
}
|
|
62
|
+
function setApprovalMode(mode) {
|
|
63
|
+
picks += 1;
|
|
64
|
+
publish(mode);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Show a chosen mode at once and save it on the desktop. A failed save puts
|
|
68
|
+
* back the mode the desktop still enforces (a newer pick is kept), reports it,
|
|
69
|
+
* asks `reread` (the mode put back may be the placeholder) and resolves `false`.
|
|
70
|
+
*/
|
|
71
|
+
async function applyApprovalMode(mode, save, onFailure, reread) {
|
|
72
|
+
const previous = approvalMode;
|
|
73
|
+
setApprovalMode(mode);
|
|
74
|
+
try {
|
|
75
|
+
await save(mode);
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
if (approvalMode === mode) {
|
|
80
|
+
setApprovalMode(previous);
|
|
81
|
+
if (reread)
|
|
82
|
+
void loadApprovalMode(reread);
|
|
83
|
+
}
|
|
84
|
+
onFailure(error);
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Show the mode the desktop has saved. Anything but `"auto"` is Ask Me: an
|
|
90
|
+
* older desktop answers null when nothing was chosen, and one older still has
|
|
91
|
+
* no such command — both ask at every step.
|
|
92
|
+
*/
|
|
93
|
+
async function loadApprovalMode(read) {
|
|
94
|
+
const picksBefore = picks;
|
|
95
|
+
const seedsBefore = seeds;
|
|
96
|
+
const saved = await read().catch(() => null);
|
|
97
|
+
if (picks === picksBefore && seeds === seedsBefore) {
|
|
98
|
+
publish(saved === 'auto' ? 'auto' : 'manual');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Show the mode the desktop reports in force after offering it the profile's
|
|
103
|
+
* copy; only a real answer is shown. Never offered once the user has picked:
|
|
104
|
+
* the desktop may run the seed ahead of that pick's save.
|
|
105
|
+
*/
|
|
106
|
+
async function seedApprovalMode(seed) {
|
|
107
|
+
if (picks > 0)
|
|
108
|
+
return;
|
|
109
|
+
const inForce = await seed().catch(() => undefined);
|
|
110
|
+
if (picks > 0 || (inForce !== 'auto' && inForce !== 'manual'))
|
|
111
|
+
return;
|
|
112
|
+
seeds += 1;
|
|
113
|
+
publish(inForce);
|
|
114
|
+
}
|
|
115
|
+
/** Test support only: the mode outlives every component by design. */
|
|
116
|
+
function resetApprovalModeForTests() {
|
|
117
|
+
picks = 0;
|
|
118
|
+
seeds = 0;
|
|
119
|
+
publish('manual');
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
useApprovalMode,
|
|
123
|
+
setApprovalMode,
|
|
124
|
+
applyApprovalMode,
|
|
125
|
+
loadApprovalMode,
|
|
126
|
+
seedApprovalMode,
|
|
127
|
+
useOfferApprovals,
|
|
128
|
+
useApprovalsOffered,
|
|
129
|
+
resetApprovalModeForTests,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Code's approval mode: an icon that widens to the mode's name and opens the
|
|
134
|
+
* choice. It grows over the tool row, not into it, so the row never re-fits its
|
|
135
|
+
* pills on hover; the delay keeps a passing pointer from widening it.
|
|
136
|
+
*/
|
|
137
|
+
function ApprovalsModeButton({ mode, onChange, labels }) {
|
|
138
|
+
var _a;
|
|
139
|
+
const t = useChatT();
|
|
140
|
+
const [open, setOpen] = useState(false);
|
|
141
|
+
const menuRef = useRef(null);
|
|
142
|
+
const Icon = PERMISSION_MODE_ICONS[mode];
|
|
143
|
+
const name = (m) => {
|
|
144
|
+
var _a, _b;
|
|
145
|
+
return m === 'auto'
|
|
146
|
+
? ((_a = labels === null || labels === void 0 ? void 0 : labels.permissionModeAuto) !== null && _a !== void 0 ? _a : t('chat.chatInputFormApprovalsModeButton.permissionModeAuto'))
|
|
147
|
+
: ((_b = labels === null || labels === void 0 ? void 0 : labels.permissionModeManual) !== null && _b !== void 0 ? _b : t('chat.chatInputFormApprovalsModeButton.permissionModeManual'));
|
|
148
|
+
};
|
|
149
|
+
const hint = (m) => {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
return m === 'auto'
|
|
152
|
+
? ((_a = labels === null || labels === void 0 ? void 0 : labels.permissionModeAutoHint) !== null && _a !== void 0 ? _a : t('chat.chatInputFormApprovalsModeButton.permissionModeAutoHint'))
|
|
153
|
+
: ((_b = labels === null || labels === void 0 ? void 0 : labels.permissionModeManualHint) !== null && _b !== void 0 ? _b : t('chat.chatInputFormApprovalsModeButton.permissionModeManualHint'));
|
|
154
|
+
};
|
|
155
|
+
const heading = (_a = labels === null || labels === void 0 ? void 0 : labels.permissionModeLabel) !== null && _a !== void 0 ? _a : t('chat.chatInputFormApprovalsModeButton.permissionModeLabel');
|
|
156
|
+
const ariaLabel = (labels === null || labels === void 0 ? void 0 : labels.approvalsAria)
|
|
157
|
+
? labels.approvalsAria(name(mode))
|
|
158
|
+
: t('chat.chatInputFormApprovalsModeButton.approvalsAria', { mode: name(mode) });
|
|
159
|
+
return (jsxs(Popover, { open: open, onOpenChange: setOpen, children: [jsx("span", { className: "relative flex h-8 w-8 shrink-0", children: jsx(PopoverTrigger, { asChild: true, children: jsxs("button", { type: "button", "data-testid": "code-approvals-button", "aria-label": ariaLabel, className: "group absolute top-0 right-0 z-10 flex h-8 cursor-pointer items-center rounded-lg border border-transparent px-[7px] text-sm font-medium text-[#38A1E5] transition-colors duration-200 hover:border-[#D0E0FF] hover:bg-[#F5F8FF] hover:delay-150 focus-visible:border-[#D0E0FF] focus-visible:bg-[#F5F8FF] focus-visible:outline-none data-[state=open]:border-[#D0E0FF] data-[state=open]:bg-[#F5F8FF]", children: [jsx(Icon, { className: "size-4 shrink-0", "aria-hidden": "true" }), jsx("span", { className: "max-w-0 overflow-hidden whitespace-nowrap opacity-0 transition-all duration-200 ease-out group-hover:ml-1.5 group-hover:max-w-28 group-hover:opacity-100 group-hover:delay-150 group-focus-visible:ml-1.5 group-focus-visible:max-w-28 group-focus-visible:opacity-100 group-data-[state=open]:ml-1.5 group-data-[state=open]:max-w-28 group-data-[state=open]:opacity-100", children: name(mode) })] }) }) }), jsxs(PopoverContent, { ref: menuRef, side: "top", align: "end", collisionPadding: 8, tabIndex: -1, "aria-label": heading,
|
|
160
|
+
// Radix focuses the first option on open, ringing "Ask Me" whichever
|
|
161
|
+
// mode is on; the menu takes focus instead, so Tab still reaches both.
|
|
162
|
+
onOpenAutoFocus: (event) => {
|
|
163
|
+
var _a;
|
|
164
|
+
event.preventDefault();
|
|
165
|
+
(_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
166
|
+
}, className: "w-72 max-w-[calc(100vw-2rem)] rounded-lg border border-gray-200 bg-white p-1.5 shadow-xl outline-none", children: [jsx("div", { className: "px-2 pt-1 pb-1.5 text-xs font-medium text-gray-500", children: heading }), jsx("div", { role: "radiogroup", "aria-label": heading, className: "flex flex-col gap-0.5", children: PERMISSION_MODES.map((m) => {
|
|
167
|
+
const ModeIcon = PERMISSION_MODE_ICONS[m];
|
|
168
|
+
const selected = m === mode;
|
|
169
|
+
return (jsxs("button", { type: "button", role: "radio", "aria-checked": selected, "data-testid": `code-approvals-option-${m}`, onClick: () => {
|
|
170
|
+
onChange(m);
|
|
171
|
+
setOpen(false);
|
|
172
|
+
}, className: `flex w-full cursor-pointer items-start gap-2.5 rounded-md px-2 py-2 text-left transition-colors ${selected ? 'bg-[#F5F8FF]' : 'hover:bg-gray-50'}`, children: [jsx(ModeIcon, { className: `mt-0.5 h-4 w-4 shrink-0 ${selected ? 'text-[#38A1E5]' : 'text-gray-500'}`, "aria-hidden": "true" }), jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [jsx("span", { className: `text-sm font-medium ${selected ? 'text-[#38A1E5]' : 'text-gray-900'}`, children: name(m) }), jsx("span", { className: "text-xs text-gray-500", children: hint(m) })] }), selected && (jsx(Check, { className: "mt-0.5 h-4 w-4 shrink-0 text-[#38A1E5]", "aria-hidden": "true" }))] }, m));
|
|
173
|
+
}) })] })] }));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export { ApprovalsModeButton, PERMISSION_MODES, PERMISSION_MODE_ICONS, createApprovalModeStore };
|
|
177
|
+
//# sourceMappingURL=approvals-mode-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approvals-mode-button.js","sources":["../../../../../../../src/components/chat-input-form/approvals-mode-button.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;MASa,gBAAgB,GAA8B,CAAC,QAAQ,EAAE,MAAM;AAErE,MAAM,qBAAqB,GAAuC;AACvE,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,IAAI,EAAE,GAAG;;AAGX;;;AAGG;SACa,uBAAuB,GAAA;;;;;IAKrC,IAAI,YAAY,GAAmB,QAAQ;IAC3C,IAAI,KAAK,GAAG,CAAC;IACb,IAAI,KAAK,GAAG,CAAC;;;IAGb,IAAI,MAAM,GAAG,CAAC;AACd,IAAA,MAAM,WAAW,GAAG,IAAI,GAAG,EAAc;AAEzC,IAAA,SAAS,iBAAiB,GAAA;QACxB,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;IAC3C;IAEA,SAAS,OAAO,CAAC,IAAoB,EAAA;QACnC,YAAY,GAAG,IAAI;AACnB,QAAA,iBAAiB,EAAE;IACrB;IAEA,SAAS,SAAS,CAAC,MAAkB,EAAA;AACnC,QAAA,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC;AACvB,QAAA,OAAO,MAAK;AACV,YAAA,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;AAC5B,QAAA,CAAC;IACH;AAEA,IAAA,SAAS,eAAe,GAAA;AACtB,QAAA,OAAO,oBAAoB,CACzB,SAAS,EACT,MAAM,YAAY,EAClB,MAAM,QAAQ,CACf;IACH;IAEA,SAAS,iBAAiB,CAAC,KAAc,EAAA;QACvC,SAAS,CAAC,MAAK;AACb,YAAA,IAAI,CAAC,KAAK;gBAAE;YACZ,MAAM,IAAI,CAAC;AACX,YAAA,iBAAiB,EAAE;AACnB,YAAA,OAAO,MAAK;gBACV,MAAM,IAAI,CAAC;AACX,gBAAA,iBAAiB,EAAE;AACrB,YAAA,CAAC;AACH,QAAA,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACb;;A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EAAA,QAAA,EAAA,CAEFC,IAAC,QAAQ,EAAA,EACP,SAAS,EAAE,CAAA,wBAAA,EACT,QAAQ,GAAG,gBAAgB,GAAG,eAChC,EAAE,EAAA,aAAA,EACU,MAAM,GAClB,EACFD,IAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,sCAAsC,aACpDC,GAAA,CAAA,MAAA,EAAA,EACE,SAAS,EAAE,CAAA,oBAAA,EACT,QAAQ,GAAG,gBAAgB,GAAG,eAChC,EAAE,EAAA,QAAA,EAED,IAAI,CAAC,CAAC,CAAC,GACH,EACPA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,uBAAuB,YAAE,IAAI,CAAC,CAAC,CAAC,EAAA,CAAQ,IACnD,EACN,QAAQ,KACPA,GAAA,CAAC,KAAK,EAAA,EAAC,SAAS,EAAC,wCAAwC,EAAA,aAAA,EAAa,MAAM,EAAA,CAAG,CAChF,KA/BI,CAAC,CAgCC;AAEb,wBAAA,CAAC,CAAC,EAAA,CACE,CAAA,EAAA,CACS,CAAA,EAAA,CACT;AAEd;;;;"}
|
|
@@ -33,7 +33,7 @@ function CapabilitiesSubTab({ form, labels, mentor, isDisabled }) {
|
|
|
33
33
|
// field-permission map, and `WithFormPermissions` HIDES a control
|
|
34
34
|
// whose key is missing on an RBAC tenant. The Voice tab treats the
|
|
35
35
|
// same field the same way.
|
|
36
|
-
jsx(CapabilityMatrixSwitch, { form: form, name: "show_voice_call", label: labels.fields.showVoiceCall.label, isDisabled: isDisabled }), embedWidget: jsx(CapabilityMatrixSwitch, { form: form, name: "embed_show_voice_call", label: labels.fields.embedShowVoiceCall.label, isDisabled: isDisabled }) })] })] }), jsxs("div", { className: "rounded-lg border border-gray-200 bg-gray-50 px-4 py-3", "data-testid": "capabilities-global-settings-banner", children: [jsx("h4", { className: "text-sm font-medium text-gray-900", children: labels.sections.globalSettings }), jsx("p", { className: "mt-1 text-xs text-gray-600", children: labels.notes.globalSettings })] }), jsxs("div", { className: "space-y-4", children: [jsxs("div", { className: "space-y-3", children: [jsx("h4", { className: "text-xs font-semibold tracking-wide text-gray-500 uppercase", children: labels.sections.chatExperience }), jsx(SettingToggleField, { form: form, name: "show_reasoning", label: labels.fields.showReasoning.label, tooltip: labels.fields.showReasoning.tooltip, tooltipAriaLabel: t('tabsSettingsTab.showReasoningTooltipAriaLabel'), isDisabled: isDisabled, alignToMatrix: true }), jsx(SettingToggleField, { form: form, name: "enable_multi_query_rag", label: labels.fields.enhancedDocRetrieval.label, tooltip: labels.fields.enhancedDocRetrieval.tooltip, tooltipAriaLabel: t('tabsSettingsTab.enhancedDocRetrievalTooltipAriaLabel'), isDisabled: isDisabled, permissionName: "enable_multi_query_rag", fieldPermissions: fieldPermissions, enableRBAC: enableRBAC, alignToMatrix: true }), jsx(SettingToggleField, { form: form, name: "
|
|
36
|
+
jsx(CapabilityMatrixSwitch, { form: form, name: "show_voice_call", label: labels.fields.showVoiceCall.label, isDisabled: isDisabled }), embedWidget: jsx(CapabilityMatrixSwitch, { form: form, name: "embed_show_voice_call", label: labels.fields.embedShowVoiceCall.label, isDisabled: isDisabled }) })] })] }), jsxs("div", { className: "rounded-lg border border-gray-200 bg-gray-50 px-4 py-3", "data-testid": "capabilities-global-settings-banner", children: [jsx("h4", { className: "text-sm font-medium text-gray-900", children: labels.sections.globalSettings }), jsx("p", { className: "mt-1 text-xs text-gray-600", children: labels.notes.globalSettings })] }), jsxs("div", { className: "space-y-4", children: [jsxs("div", { className: "space-y-3", children: [jsx("h4", { className: "text-xs font-semibold tracking-wide text-gray-500 uppercase", children: labels.sections.chatExperience }), jsx(SettingToggleField, { form: form, name: "show_reasoning", label: labels.fields.showReasoning.label, tooltip: labels.fields.showReasoning.tooltip, tooltipAriaLabel: t('tabsSettingsTab.showReasoningTooltipAriaLabel'), isDisabled: isDisabled, alignToMatrix: true }), jsx(SettingToggleField, { form: form, name: "enable_multi_query_rag", label: labels.fields.enhancedDocRetrieval.label, tooltip: labels.fields.enhancedDocRetrieval.tooltip, tooltipAriaLabel: t('tabsSettingsTab.enhancedDocRetrievalTooltipAriaLabel'), isDisabled: isDisabled, permissionName: "enable_multi_query_rag", fieldPermissions: fieldPermissions, enableRBAC: enableRBAC, alignToMatrix: true }), jsx(SettingToggleField, { form: form, name: "show_last_conversation", label: labels.fields.showLastConversation.label, tooltip: labels.fields.showLastConversation.tooltip, tooltipAriaLabel: t('tabsSettingsTab.showLastConversationTooltipAriaLabel'), isDisabled: isDisabled, permissionName: "show_last_conversation", fieldPermissions: fieldPermissions, enableRBAC: enableRBAC, testId: "settings-show-last-conversation-switch", alignToMatrix: true }), jsx(SettingToggleField, { form: form, name: "use_function_calling_for_rag", label: labels.fields.smartDocRetrieval.label, tooltip: labels.fields.smartDocRetrieval.tooltip, tooltipAriaLabel: t('tabsSettingsTab.smartDocRetrievalTooltipAriaLabel'), isDisabled: isDisabled, testId: "settings-use-function-calling-for-rag-switch", alignToMatrix: true }), jsx(SettingToggleField, { form: form, name: "enable_prompt_caching", label: labels.fields.promptCaching.label, tooltip: labels.fields.promptCaching.tooltip, tooltipAriaLabel: t('tabsSettingsTab.promptCachingTooltipAriaLabel'), isDisabled: isDisabled, permissionName: "enable_prompt_caching", fieldPermissions: fieldPermissions, enableRBAC: enableRBAC, alignToMatrix: true })] }), jsxs("div", { className: "space-y-3", children: [jsx("h4", { className: "text-xs font-semibold tracking-wide text-gray-500 uppercase", children: labels.sections.advanced }), jsx(SettingToggleField, { form: form, name: "forkable", label: labels.fields.allowCopies.label, tooltip: labels.fields.allowCopies.tooltip, tooltipAriaLabel: t('tabsSettingsTab.allowCopiesTooltipAriaLabel'), isDisabled: isDisabled, alignToMatrix: true }), jsx(SettingToggleField, { form: form, name: "show_explore_mentors", label: labels.fields.showExploreMentors.label, tooltip: labels.fields.showExploreMentors.tooltip, tooltipAriaLabel: t('tabsSettingsTab.showExploreMentorsTooltipAriaLabel'), isDisabled: isDisabled, permissionName: "show_explore_mentors", fieldPermissions: fieldPermissions, enableRBAC: enableRBAC, testId: "settings-show-explore-mentors-switch", alignToMatrix: true })] })] })] }));
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export { CapabilitiesSubTab };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities-sub-tab.js","sources":["../../../../../../../../../../src/components/modals/edit-mentor-modal/tabs/settings-tab/capabilities-sub-tab.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AAiBA;;;;;;;;;AASG;AACG,SAAU,kBAAkB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAA2B,EAAA;AAC9F,IAAA,MAAM,CAAC,GAAG,IAAI,EAAE;AAChB,IAAA,MAAM,EAAE,UAAU,EAAE,GAAG,gBAAgB,EAAE;AACzC,IAAA,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,MAAM,CAAC;IAEpD,QACEA,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,WAAW,aAExBA,IAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAC,wDAAwD,EAAA,aAAA,EACtD,iCAAiC,aAE7CC,GAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,mCAAmC,EAAA,QAAA,EAAE,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAA,CAAM,EACnFA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,4BAA4B,EAAA,QAAA,EAAE,MAAM,CAAC,KAAK,CAAC,UAAU,EAAA,CAAK,CAAA,EAAA,CACnE,EAEND,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,WAAW,aACxBC,GAAA,CAAC,sBAAsB,EAAA,EACrB,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,cAAc,EACvC,SAAS,EAAE;AACT,4BAAA,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,SAAS;AAChC,4BAAA,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS;AAC/B,4BA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K,EAC1C,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,EAC9C,gBAAgB,EAAE,CAAC,CAAC,iDAAiD,CAAC,EACtE,cAAc,EAAE,MAAM,CAAC,QAAQ,CAAC,SAAS,EACzC,gBAAgB,EAAE,MAAM,CAAC,QAAQ,CAAC,WAAW,EAC7C,MAAM,EAAC,oCAAoC,EAC3C,SAAS,EACPA,GAAA,CAAC,sBAAsB,EAAA,EACrB,IAAI,EAAE,IAAI,EACV,IAAI,EAAC,mBAAmB,EACxB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,KAAK,EAC1C,UAAU,EAAE,UAAU,EACtB,cAAc,EAAC,mBAAmB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,UAAU,GACtB,EAEJ,WAAW,EACTA,GAAA,CAAC,sBAAsB,EAAA,EACrB,IAAI,EAAE,IAAI,EACV,IAAI,EAAC,yBAAyB,EAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAC/C,UAAU,EAAE,UAAU,EAAA,CACtB,EAAA,CAEJ,EAEFA,GAAA,CAAC,mBAAmB,EAAA,EAClB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,EACxC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,EAC5C,gBAAgB,EAAE,CAAC,CAAC,+CAA+C,CAAC,EACpE,cAAc,EAAE,MAAM,CAAC,QAAQ,CAAC,SAAS,EACzC,gBAAgB,EAAE,MAAM,CAAC,QAAQ,CAAC,WAAW,EAC7C,MAAM,EAAC,kCAAkC,EACzC,SAAS;;;;;
|
|
1
|
+
{"version":3,"file":"capabilities-sub-tab.js","sources":["../../../../../../../../../../src/components/modals/edit-mentor-modal/tabs/settings-tab/capabilities-sub-tab.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AAiBA;;;;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,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,WAAW,EAAA,QAAA,EAAA,CACxBC,GAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,6DAA6D,EAAA,QAAA,EACxE,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAA,CACtB,EAELA,GAAA,CAAC,kBAAkB,EAAA,EACjB,IAAI,EAAE,IAAI,EACV,IAAI,EAAC,UAAU,EACf,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,EACtC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAC1C,gBAAgB,EAAE,CAAC,CAAC,6CAA6C,CAAC,EAClE,UAAU,EAAE,UAAU,EACtB,aAAa,EAAA,IAAA,EAAA,CACb,EAEFA,GAAA,CAAC,kBAAkB,EAAA,EACjB,IAAI,EAAE,IAAI,EACV,IAAI,EAAC,sBAAsB,EAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAC7C,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,OAAO,EACjD,gBAAgB,EAAE,CAAC,CAAC,oDAAoD,CAAC,EACzE,UAAU,EAAE,UAAU,EACtB,cAAc,EAAC,sBAAsB,EACrC,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAC,sCAAsC,EAC7C,aAAa,EAAA,IAAA,EAAA,CACb,CAAA,EAAA,CACE,CAAA,EAAA,CACF,CAAA,EAAA,CACF;AAEV;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-host-context.js","sources":["../../../../../../../src/components/chat/chat-host-context.tsx"],"sourcesContent":[null],"names":["_jsx","ChatMarkdown"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"chat-host-context.js","sources":["../../../../../../../src/components/chat/chat-host-context.tsx"],"sourcesContent":[null],"names":["_jsx","ChatMarkdown"],"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C,IAAI,CAAC,CACP;AACH;AAEA;;;AAGG;SACa,eAAe,GAAA;;AAC7B,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE;IAChC,OAAO,CAAA,EAAA,GAAA,MAAM,KAAA,IAAA,IAAN,MAAM,KAAA,MAAA,GAAA,MAAA,GAAN,MAAM,CAAE,iBAAiB,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAIC,QAAY;AAClD;;;;"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useSyncExternalStore } from 'react';
|
|
3
|
-
import { useChatT } from './chat-host-context.js';
|
|
3
|
+
import { useChatT, useChatHost } from './chat-host-context.js';
|
|
4
|
+
import { toast } from 'sonner';
|
|
4
5
|
import { Button } from './ui/button.js';
|
|
5
6
|
import { describeStep, mergeToolCall, safeDetail, stepSentence } from './code-activity.js';
|
|
6
7
|
import ShieldCheck from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/shield-check.js';
|
|
8
|
+
import Zap from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/zap.js';
|
|
7
9
|
|
|
8
10
|
function isTauriApp() {
|
|
9
11
|
return typeof window !== 'undefined' && '__TAURI__' in window;
|
|
@@ -115,10 +117,15 @@ function legacyToolCall(request) {
|
|
|
115
117
|
locations: value === null || value === void 0 ? void 0 : value.split(/\s+/).map((path) => ({ path })),
|
|
116
118
|
};
|
|
117
119
|
}
|
|
120
|
+
// Past this the card's action is allowed without waiting, well before the desktop
|
|
121
|
+
// gives up on it (180s). Not a failure: a live Codex session can take this long.
|
|
122
|
+
const SWITCH_TO_AUTOMATIC_TIMEOUT_MS = 10000;
|
|
118
123
|
function CodePermissionCards({ generationId, }) {
|
|
124
|
+
var _a;
|
|
119
125
|
const all = useCodePermissionRequests();
|
|
120
126
|
const requests = all.filter((r) => r.generation_id === generationId);
|
|
121
127
|
const t = useChatT();
|
|
128
|
+
const onSwitchToAutomatic = (_a = useChatHost().config) === null || _a === void 0 ? void 0 : _a.onSwitchToAutomatic;
|
|
122
129
|
const answer = async (request, optionId) => {
|
|
123
130
|
// Drop it first: the answer is one-way and a second click would resolve an id
|
|
124
131
|
// Rust has already forgotten.
|
|
@@ -138,6 +145,32 @@ function CodePermissionCards({ generationId, }) {
|
|
|
138
145
|
console.error('[code-permission] respond failed', e);
|
|
139
146
|
}
|
|
140
147
|
};
|
|
148
|
+
// Automatic is saved BEFORE this card is answered: in the desktop app saving it
|
|
149
|
+
// answers every waiting card, this one included. The action is allowed whatever the
|
|
150
|
+
// save does — the card is already gone, so nothing else would answer it.
|
|
151
|
+
const switchToAutomatic = onSwitchToAutomatic &&
|
|
152
|
+
(async (request) => {
|
|
153
|
+
drop(request.request_id);
|
|
154
|
+
const saving = new Promise((resolve) => resolve(onSwitchToAutomatic())).then((saved) => {
|
|
155
|
+
if (saved === false)
|
|
156
|
+
toast.error(t('chat.chatCodePermissionCard.switchToAutomaticFailed'));
|
|
157
|
+
}, (e) => {
|
|
158
|
+
console.error('[code-permission] could not switch to Automatic', e);
|
|
159
|
+
toast.error(t('chat.chatCodePermissionCard.switchToAutomaticFailed'));
|
|
160
|
+
});
|
|
161
|
+
let timer;
|
|
162
|
+
await Promise.race([
|
|
163
|
+
saving,
|
|
164
|
+
new Promise((resolve) => {
|
|
165
|
+
timer = setTimeout(() => {
|
|
166
|
+
console.error('[code-permission] switching to Automatic is taking too long');
|
|
167
|
+
resolve();
|
|
168
|
+
}, SWITCH_TO_AUTOMATIC_TIMEOUT_MS);
|
|
169
|
+
}),
|
|
170
|
+
]);
|
|
171
|
+
clearTimeout(timer);
|
|
172
|
+
await answer(request, request.allow_option_id);
|
|
173
|
+
});
|
|
141
174
|
return (
|
|
142
175
|
// Mounted empty for the whole turn, so the first card is a mutation screen
|
|
143
176
|
// readers announce rather than content they never see arrive.
|
|
@@ -152,13 +185,17 @@ function CodePermissionCards({ generationId, }) {
|
|
|
152
185
|
// A Browse run (own responder) keeps its own title; anything else described gets a sentence.
|
|
153
186
|
const named = !request.respond && step.action !== 'other';
|
|
154
187
|
const shown = (_c = safeDetail((_b = request.command) !== null && _b !== void 0 ? _b : undefined)) !== null && _c !== void 0 ? _c : (named ? step.details : undefined);
|
|
188
|
+
// Code prompts only: a Browse run follows Cowork's own Approvals setting,
|
|
189
|
+
// and a prompt with nothing to allow can't be approved.
|
|
190
|
+
const canSwitch = !!switchToAutomatic && !request.respond && !!request.allow_option_id;
|
|
191
|
+
const automaticHintId = `code-permission-automatic-hint-${request.request_id}`;
|
|
155
192
|
return (jsxs("div", { children: [jsxs("div", { className: "flex flex-wrap items-center gap-1.5 text-gray-600 dark:text-gray-300", children: [jsx(ShieldCheck, { className: "h-3 w-3 shrink-0 text-gray-400" }), jsx("span", { className: "font-medium", children: t('chat.chatCodePermissionCard.title') })] }), jsx("div", { className: "mt-0.5 ml-[18px] text-gray-400 dark:text-gray-500", children: named
|
|
156
193
|
? stepSentence(t, step, 'want')
|
|
157
194
|
: safeDetail((_d = request.title) !== null && _d !== void 0 ? _d : undefined) ||
|
|
158
195
|
t('chat.chatCodePermissionCard.unnamedAction') }), shown && (
|
|
159
196
|
// bg-gray-200 is what the bubble already uses for inline code and pre
|
|
160
197
|
// blocks, so the command sits on the same surface as the reply's own.
|
|
161
|
-
jsx("code", { className: "mt-1 ml-[18px] block rounded bg-gray-200 px-1.5 py-1 font-mono break-all whitespace-pre-wrap text-gray-700", children: shown })), jsxs("div", { className: "mt-2 ml-[18px] flex items-center gap-2", children: [jsx(Button, { size: "sm", type: "button", className: "ibl-button-primary h-7 text-xs", onClick: () => answer(request, request.allow_option_id), children: t('chat.chatCodePermissionCard.allow') }), jsx(Button, { variant: "outline", size: "sm", type: "button", className: "h-7 text-xs", onClick: () => answer(request, request.reject_option_id), children: t('chat.chatCodePermissionCard.deny') })] })] }, request.request_id));
|
|
198
|
+
jsx("code", { className: "mt-1 ml-[18px] block rounded bg-gray-200 px-1.5 py-1 font-mono break-all whitespace-pre-wrap text-gray-700", children: shown })), jsxs("div", { className: "mt-2 ml-[18px] flex flex-wrap items-center gap-2", children: [jsx(Button, { size: "sm", type: "button", className: "ibl-button-primary h-7 text-xs", onClick: () => answer(request, request.allow_option_id), children: t('chat.chatCodePermissionCard.allow') }), jsx(Button, { variant: "outline", size: "sm", type: "button", className: "h-7 text-xs", onClick: () => answer(request, request.reject_option_id), children: t('chat.chatCodePermissionCard.deny') }), canSwitch && (jsxs(Button, { variant: "ghost", size: "sm", type: "button", "data-testid": "code-permission-switch-to-automatic", "aria-describedby": automaticHintId, className: "h-7 gap-1 text-xs text-[#38A1E5] hover:bg-[#F5F8FF] hover:text-[#38A1E5]", onClick: () => void (switchToAutomatic === null || switchToAutomatic === void 0 ? void 0 : switchToAutomatic(request)), children: [jsx(Zap, { className: "h-3 w-3", "aria-hidden": "true" }), t('chat.chatCodePermissionCard.switchToAutomatic')] }))] }), canSwitch && (jsx("p", { id: automaticHintId, "data-testid": "code-permission-automatic-hint", className: "mt-1 ml-[18px] text-gray-500 dark:text-gray-400", children: t('chat.chatCodePermissionCard.switchToAutomaticHint') }))] }, request.request_id));
|
|
162
199
|
}) })) }));
|
|
163
200
|
}
|
|
164
201
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-permission-card.js","sources":["../../../../../../../src/components/chat/code-permission-card.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs"],"mappings":"
|
|
1
|
+
{"version":3,"file":"code-permission-card.js","sources":["../../../../../../../src/components/chat/code-permission-card.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;AAgEA,SAAS,UAAU,GAAA;IACjB,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,WAAW,IAAI,MAAM;AAC/D;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,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BAC/B,eAAe,EACjC,SAAS,EAAC,0EAA0E,EACpF,OAAO,EAAE,MAAM,MAAK,iBAAiB,KAAA,IAAA,IAAjB,iBAAiB,KAAA,MAAA,GAAA,MAAA,GAAjB,iBAAiB,CAAG,OAAO,CAAC,CAAA,EAAA,QAAA,EAAA,CAEhDD,GAAA,CAAC,GAAG,EAAA,EAAC,SAAS,EAAC,SAAS,iBAAa,MAAM,EAAA,CAAG,EAC7C,CAAC,CAAC,+CAA+C,CAAC,IAC5C,CACV,CAAA,EAAA,CACG,EAGL,SAAS,KACRA,GAAA,CAAA,GAAA,EAAA,EACE,EAAE,EAAE,eAAe,iBACP,gCAAgC,EAC5C,SAAS,EAAC,iDAAiD,YAE1D,CAAC,CAAC,mDAAmD,CAAC,EAAA,CACrD,CACL,CAAA,EAAA,EAnEO,OAAO,CAAC,UAAU,CAoEtB;AAEV,YAAA,CAAC,CAAC,EAAA,CACE,CACP,EAAA,CACG;AAEV;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-host-context.js","sources":["../../../../../../../src/components/chat/chat-host-context.tsx"],"sourcesContent":[null],"names":["_jsx","ChatMarkdown"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"chat-host-context.js","sources":["../../../../../../../src/components/chat/chat-host-context.tsx"],"sourcesContent":[null],"names":["_jsx","ChatMarkdown"],"mappings":";;;;;;AAuQO,MAAM,qBAAqB,GAA2B;AAC3D,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,OAAO,EAAE,IAAI;AACb,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,gBAAgB,EAAE,IAAI;AACtB,IAAA,MAAM,EAAE,IAAI;;AAGR,SA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State, useRef, useSyncExternalStore, useEffect } from 'react';
|
|
3
|
+
import { useChatT } from '../chat/chat-host-context.js';
|
|
4
|
+
import { Popover, PopoverTrigger, PopoverContent } from '../ui/popover.js';
|
|
5
|
+
import Zap from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/zap.js';
|
|
6
|
+
import Hand from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/hand.js';
|
|
7
|
+
import Check from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/check.js';
|
|
8
|
+
|
|
9
|
+
const PERMISSION_MODES = ['manual', 'auto'];
|
|
10
|
+
const PERMISSION_MODE_ICONS = {
|
|
11
|
+
manual: Hand,
|
|
12
|
+
auto: Zap,
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* One approval-mode store per call, so each surface that has its own mode
|
|
16
|
+
* (Code today, Cowork later) keeps its own.
|
|
17
|
+
*/
|
|
18
|
+
function createApprovalModeStore() {
|
|
19
|
+
// `picks` and `seeds` count the user's choices and the profile's mode taking
|
|
20
|
+
// effect, so a read that started before either never overwrites it. Seeded to
|
|
21
|
+
// Ask Me, NOT the saved default: until the desktop answers, claiming Automatic
|
|
22
|
+
// would tell a user who chose Ask Me that Code may act unasked.
|
|
23
|
+
let approvalMode = 'manual';
|
|
24
|
+
let picks = 0;
|
|
25
|
+
let seeds = 0;
|
|
26
|
+
// Code pills that currently offer the approvals button. Counted, not flagged:
|
|
27
|
+
// the canvas split mounts a composer, and so a pill, on each side.
|
|
28
|
+
let offers = 0;
|
|
29
|
+
const subscribers = new Set();
|
|
30
|
+
function notifySubscribers() {
|
|
31
|
+
subscribers.forEach((notify) => notify());
|
|
32
|
+
}
|
|
33
|
+
function publish(mode) {
|
|
34
|
+
approvalMode = mode;
|
|
35
|
+
notifySubscribers();
|
|
36
|
+
}
|
|
37
|
+
function subscribe(notify) {
|
|
38
|
+
subscribers.add(notify);
|
|
39
|
+
return () => {
|
|
40
|
+
subscribers.delete(notify);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function useApprovalMode() {
|
|
44
|
+
return useSyncExternalStore(subscribe, () => approvalMode, () => 'manual');
|
|
45
|
+
}
|
|
46
|
+
function useOfferApprovals(offer) {
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (!offer)
|
|
49
|
+
return;
|
|
50
|
+
offers += 1;
|
|
51
|
+
notifySubscribers();
|
|
52
|
+
return () => {
|
|
53
|
+
offers -= 1;
|
|
54
|
+
notifySubscribers();
|
|
55
|
+
};
|
|
56
|
+
}, [offer]);
|
|
57
|
+
}
|
|
58
|
+
/** Whether any Code pill on screen offers the approvals button. */
|
|
59
|
+
function useApprovalsOffered() {
|
|
60
|
+
return useSyncExternalStore(subscribe, () => offers > 0, () => false);
|
|
61
|
+
}
|
|
62
|
+
function setApprovalMode(mode) {
|
|
63
|
+
picks += 1;
|
|
64
|
+
publish(mode);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Show a chosen mode at once and save it on the desktop. A failed save puts
|
|
68
|
+
* back the mode the desktop still enforces (a newer pick is kept), reports it,
|
|
69
|
+
* asks `reread` (the mode put back may be the placeholder) and resolves `false`.
|
|
70
|
+
*/
|
|
71
|
+
async function applyApprovalMode(mode, save, onFailure, reread) {
|
|
72
|
+
const previous = approvalMode;
|
|
73
|
+
setApprovalMode(mode);
|
|
74
|
+
try {
|
|
75
|
+
await save(mode);
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
if (approvalMode === mode) {
|
|
80
|
+
setApprovalMode(previous);
|
|
81
|
+
if (reread)
|
|
82
|
+
void loadApprovalMode(reread);
|
|
83
|
+
}
|
|
84
|
+
onFailure(error);
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Show the mode the desktop has saved. Anything but `"auto"` is Ask Me: an
|
|
90
|
+
* older desktop answers null when nothing was chosen, and one older still has
|
|
91
|
+
* no such command — both ask at every step.
|
|
92
|
+
*/
|
|
93
|
+
async function loadApprovalMode(read) {
|
|
94
|
+
const picksBefore = picks;
|
|
95
|
+
const seedsBefore = seeds;
|
|
96
|
+
const saved = await read().catch(() => null);
|
|
97
|
+
if (picks === picksBefore && seeds === seedsBefore) {
|
|
98
|
+
publish(saved === 'auto' ? 'auto' : 'manual');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Show the mode the desktop reports in force after offering it the profile's
|
|
103
|
+
* copy; only a real answer is shown. Never offered once the user has picked:
|
|
104
|
+
* the desktop may run the seed ahead of that pick's save.
|
|
105
|
+
*/
|
|
106
|
+
async function seedApprovalMode(seed) {
|
|
107
|
+
if (picks > 0)
|
|
108
|
+
return;
|
|
109
|
+
const inForce = await seed().catch(() => undefined);
|
|
110
|
+
if (picks > 0 || (inForce !== 'auto' && inForce !== 'manual'))
|
|
111
|
+
return;
|
|
112
|
+
seeds += 1;
|
|
113
|
+
publish(inForce);
|
|
114
|
+
}
|
|
115
|
+
/** Test support only: the mode outlives every component by design. */
|
|
116
|
+
function resetApprovalModeForTests() {
|
|
117
|
+
picks = 0;
|
|
118
|
+
seeds = 0;
|
|
119
|
+
publish('manual');
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
useApprovalMode,
|
|
123
|
+
setApprovalMode,
|
|
124
|
+
applyApprovalMode,
|
|
125
|
+
loadApprovalMode,
|
|
126
|
+
seedApprovalMode,
|
|
127
|
+
useOfferApprovals,
|
|
128
|
+
useApprovalsOffered,
|
|
129
|
+
resetApprovalModeForTests,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Code's approval mode: an icon that widens to the mode's name and opens the
|
|
134
|
+
* choice. It grows over the tool row, not into it, so the row never re-fits its
|
|
135
|
+
* pills on hover; the delay keeps a passing pointer from widening it.
|
|
136
|
+
*/
|
|
137
|
+
function ApprovalsModeButton({ mode, onChange, labels }) {
|
|
138
|
+
var _a;
|
|
139
|
+
const t = useChatT();
|
|
140
|
+
const [open, setOpen] = useState(false);
|
|
141
|
+
const menuRef = useRef(null);
|
|
142
|
+
const Icon = PERMISSION_MODE_ICONS[mode];
|
|
143
|
+
const name = (m) => {
|
|
144
|
+
var _a, _b;
|
|
145
|
+
return m === 'auto'
|
|
146
|
+
? ((_a = labels === null || labels === void 0 ? void 0 : labels.permissionModeAuto) !== null && _a !== void 0 ? _a : t('chat.chatInputFormApprovalsModeButton.permissionModeAuto'))
|
|
147
|
+
: ((_b = labels === null || labels === void 0 ? void 0 : labels.permissionModeManual) !== null && _b !== void 0 ? _b : t('chat.chatInputFormApprovalsModeButton.permissionModeManual'));
|
|
148
|
+
};
|
|
149
|
+
const hint = (m) => {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
return m === 'auto'
|
|
152
|
+
? ((_a = labels === null || labels === void 0 ? void 0 : labels.permissionModeAutoHint) !== null && _a !== void 0 ? _a : t('chat.chatInputFormApprovalsModeButton.permissionModeAutoHint'))
|
|
153
|
+
: ((_b = labels === null || labels === void 0 ? void 0 : labels.permissionModeManualHint) !== null && _b !== void 0 ? _b : t('chat.chatInputFormApprovalsModeButton.permissionModeManualHint'));
|
|
154
|
+
};
|
|
155
|
+
const heading = (_a = labels === null || labels === void 0 ? void 0 : labels.permissionModeLabel) !== null && _a !== void 0 ? _a : t('chat.chatInputFormApprovalsModeButton.permissionModeLabel');
|
|
156
|
+
const ariaLabel = (labels === null || labels === void 0 ? void 0 : labels.approvalsAria)
|
|
157
|
+
? labels.approvalsAria(name(mode))
|
|
158
|
+
: t('chat.chatInputFormApprovalsModeButton.approvalsAria', { mode: name(mode) });
|
|
159
|
+
return (jsxs(Popover, { open: open, onOpenChange: setOpen, children: [jsx("span", { className: "relative flex h-8 w-8 shrink-0", children: jsx(PopoverTrigger, { asChild: true, children: jsxs("button", { type: "button", "data-testid": "code-approvals-button", "aria-label": ariaLabel, className: "group absolute top-0 right-0 z-10 flex h-8 cursor-pointer items-center rounded-lg border border-transparent px-[7px] text-sm font-medium text-[#38A1E5] transition-colors duration-200 hover:border-[#D0E0FF] hover:bg-[#F5F8FF] hover:delay-150 focus-visible:border-[#D0E0FF] focus-visible:bg-[#F5F8FF] focus-visible:outline-none data-[state=open]:border-[#D0E0FF] data-[state=open]:bg-[#F5F8FF]", children: [jsx(Icon, { className: "size-4 shrink-0", "aria-hidden": "true" }), jsx("span", { className: "max-w-0 overflow-hidden whitespace-nowrap opacity-0 transition-all duration-200 ease-out group-hover:ml-1.5 group-hover:max-w-28 group-hover:opacity-100 group-hover:delay-150 group-focus-visible:ml-1.5 group-focus-visible:max-w-28 group-focus-visible:opacity-100 group-data-[state=open]:ml-1.5 group-data-[state=open]:max-w-28 group-data-[state=open]:opacity-100", children: name(mode) })] }) }) }), jsxs(PopoverContent, { ref: menuRef, side: "top", align: "end", collisionPadding: 8, tabIndex: -1, "aria-label": heading,
|
|
160
|
+
// Radix focuses the first option on open, ringing "Ask Me" whichever
|
|
161
|
+
// mode is on; the menu takes focus instead, so Tab still reaches both.
|
|
162
|
+
onOpenAutoFocus: (event) => {
|
|
163
|
+
var _a;
|
|
164
|
+
event.preventDefault();
|
|
165
|
+
(_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
166
|
+
}, className: "w-72 max-w-[calc(100vw-2rem)] rounded-lg border border-gray-200 bg-white p-1.5 shadow-xl outline-none", children: [jsx("div", { className: "px-2 pt-1 pb-1.5 text-xs font-medium text-gray-500", children: heading }), jsx("div", { role: "radiogroup", "aria-label": heading, className: "flex flex-col gap-0.5", children: PERMISSION_MODES.map((m) => {
|
|
167
|
+
const ModeIcon = PERMISSION_MODE_ICONS[m];
|
|
168
|
+
const selected = m === mode;
|
|
169
|
+
return (jsxs("button", { type: "button", role: "radio", "aria-checked": selected, "data-testid": `code-approvals-option-${m}`, onClick: () => {
|
|
170
|
+
onChange(m);
|
|
171
|
+
setOpen(false);
|
|
172
|
+
}, className: `flex w-full cursor-pointer items-start gap-2.5 rounded-md px-2 py-2 text-left transition-colors ${selected ? 'bg-[#F5F8FF]' : 'hover:bg-gray-50'}`, children: [jsx(ModeIcon, { className: `mt-0.5 h-4 w-4 shrink-0 ${selected ? 'text-[#38A1E5]' : 'text-gray-500'}`, "aria-hidden": "true" }), jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [jsx("span", { className: `text-sm font-medium ${selected ? 'text-[#38A1E5]' : 'text-gray-900'}`, children: name(m) }), jsx("span", { className: "text-xs text-gray-500", children: hint(m) })] }), selected && (jsx(Check, { className: "mt-0.5 h-4 w-4 shrink-0 text-[#38A1E5]", "aria-hidden": "true" }))] }, m));
|
|
173
|
+
}) })] })] }));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export { ApprovalsModeButton, PERMISSION_MODES, PERMISSION_MODE_ICONS, createApprovalModeStore };
|
|
177
|
+
//# sourceMappingURL=approvals-mode-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approvals-mode-button.js","sources":["../../../../../../../src/components/chat-input-form/approvals-mode-button.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;MASa,gBAAgB,GAA8B,CAAC,QAAQ,EAAE,MAAM;AAErE,MAAM,qBAAqB,GAAuC;AACvE,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,IAAI,EAAE,GAAG;;AAGX;;;AAGG;SACa,uBAAuB,GAAA;;;;;IAKrC,IAAI,YAAY,GAAmB,QAAQ;IAC3C,IAAI,KAAK,GAAG,CAAC;IACb,IAAI,KAAK,GAAG,CAAC;;;IAGb,IAAI,MAAM,GAAG,CAAC;AACd,IAAA,MAAM,WAAW,GAAG,IAAI,GAAG,EAAc;AAEzC,IAAA,SAAS,iBAAiB,GAAA;QACxB,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,M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