Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plugins/agent/composer/ui/Composer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ export function Composer(props: ComposerViewInput<JSX.Element>) {
hoverStyle={{ backgroundColor: C.actionHover }}
focusStyle={actionFocusStyle()}
activeStyle={{ backgroundColor: C.action }}
// Disabled, Send drops to the hover layer rather than fading its ink.
// Disabled, Send drops to the hover layer with muted ink for contrast.
disabledStyle={{ backgroundColor: stateLayer('hover') }}
>
<If
Expand All @@ -491,7 +491,7 @@ export function Composer(props: ComposerViewInput<JSX.Element>) {
<Icon
name={stopPrimary() ? 'stop' : continuationSource() !== null ? 'play' : 'send'}
size={composerToolbarIconSize}
color={primaryDisabled() && platform.idiom === 'terminal' ? C.muted : C.onAction}
color={primaryDisabled() ? C.muted : C.onAction}
/>
}
>
Expand Down
26 changes: 6 additions & 20 deletions plugins/settings/settings/ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -502,24 +502,15 @@ export const activate: UiModule<JSX.Element>['activate'] = (context) => {
{
titleIcon: () => (
<If
when={externalAgents.confirmation()}
else={
<If
when={
connections.editor() &&
['connection', 'advanced', 'model'].includes(connections.page())
}
>
<BrandIcon id={connections.editor()!.provider.identity.name} />
</If>
when={
connections.editor() &&
['connection', 'advanced', 'model'].includes(connections.page())
}
>
<BrandIcon agent id={externalAgents.confirmation()!.runtime} />
<BrandIcon id={connections.editor()!.provider.identity.name} />
</If>
),
title: () => {
if (externalAgents.confirmation()) return externalAgents.title();
if (connections.signInConfirmation()) return tr('ChatGPT sign-in');
const editor = connections.editor();
const model = connections.model();
switch (connections.page()) {
Expand All @@ -544,19 +535,14 @@ export const activate: UiModule<JSX.Element>['activate'] = (context) => {
}
},
action: () =>
connections.page() === 'connections' &&
!connections.signInConfirmation() &&
!externalAgents.confirmation()
connections.page() === 'connections'
? {
label: tr('Add connection'),
run: connections.newConnection,
disabled: connections.loading() || connections.openingProvider() !== null,
}
: null,
nested: () =>
connections.page() !== 'connections' ||
!!connections.signInConfirmation() ||
!!externalAgents.confirmation(),
nested: () => connections.page() !== 'connections',
navigation: modelsOwner.navigation,
back: modelsOwner.back,
revealTarget: (id) => (id === 'external-agents' && openExt.set(true), id),
Expand Down
5 changes: 3 additions & 2 deletions products/maka/workbench/app/Automations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,6 @@ function AutomationDetailPane(props: {
<ActionButton
label={tr('Run now')}
icon="play"
tone="primary"
disabled={
props.pending() || Boolean(summary().pendingFire) || !summary().approved
}
Expand Down Expand Up @@ -3138,6 +3137,8 @@ export function Automations(props: AutomationsProps) {
const showRightPane = () => editor() !== null || selectedSummary() !== null;
const showListColumn = () => !globalEmpty() && (split() || !showRightPane());
const showDetailColumn = () => globalEmpty() || split() || showRightPane();
const detailEmptyAction = () =>
showDetailColumn() && !editor() && !selectedSummary() && !loading() && counts().all === 0;

return (
<View
Expand All @@ -3153,7 +3154,7 @@ export function Automations(props: AutomationsProps) {
commands={props.commands}
browser={props.browserHeader()}
actions={
<If when={!editor() && !globalEmpty()}>
<If when={!editor() && !detailEmptyAction()}>
<ActionButton
label={tr('New automation')}
icon="plus"
Expand Down
12 changes: 8 additions & 4 deletions products/maka/workbench/app/ComposerToolbarSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { SettingsAnchor } from './SettingsAnchor';
import { Canvas, cleanup, signal, Text, View, type ViewRef } from 'nsh';
import { Canvas, cleanup, computed, signal, Text, View, type ViewRef } from 'nsh';
import {
composerToolbar,
createToolbarDragController,
Expand Down Expand Up @@ -179,12 +179,14 @@ export function ComposerToolbarSettings() {
});
};

const canReset = computed(() => !isDefaultComposerToolbarLayout(composerToolbar.layout()));

return (
<SettingsAnchor id="composer">
<SettingsSection
title={tr('Composer')}
trailing={
<If when={!isDefaultComposerToolbarLayout(composerToolbar.layout())}>
canReset() ? (
<SettingsButton
label={tr('Reset')}
tone="quiet"
Expand All @@ -193,7 +195,7 @@ export function ComposerToolbarSettings() {
composerToolbar.resetLayout();
}}
/>
</If>
) : undefined
}
>
<View
Expand Down Expand Up @@ -433,7 +435,9 @@ export function ComposerToolbarSettings() {
<SettingsAnchor id="role-picker">
<SettingsSwitch
label={tr('Role selector')}
description={tr('Show the Agent Role selector in the composer toolbar for new conversations.')}
description={tr(
'Show the Agent Role selector in the composer toolbar for new conversations.',
)}
checked={composerToolbar.rolePicker()}
onPress={() => composerToolbar.setRolePicker(!composerToolbar.rolePicker())}
/>
Expand Down
88 changes: 40 additions & 48 deletions products/maka/workbench/app/ConnectionSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ import {
SettingsBody,
SettingsButton,
SettingsConfirm,
SettingsConsentCheck,
SettingsDiscard,
SettingsLede,
SettingsProblem,
SettingsRow,
SettingsSearch,
SettingsSection,
SettingsSelect,
SettingsSwitch,
} from './SettingsPage';
import { sameValue } from '../../../../plugins/shared/value';

Expand All @@ -51,34 +51,35 @@ export function ConnectionSettings(props: {
}) {
const owner = props.owner;
return (
<If
when={!props.externalAgents?.confirmation()}
else={<ExternalAgentConfirmation owner={props.externalAgents!} />}
>
<If when={!owner.signInConfirmation()} else={<SignInRiskConfirmation owner={owner} />}>
<If when={owner.page() === 'connections'}>
<ConnectionList owner={owner} externalAgents={props.externalAgents} />
</If>
<If when={owner.page() === 'providers'}>
<ProviderPicker owner={owner} externalAgents={props.externalAgents} />
</If>
<If when={owner.page() === 'connection' && owner.editor()}>
<ConnectionForm settings={owner} externalAgents={props.externalAgents} />
</If>
<If when={owner.page() === 'advanced' && owner.editor()}>
<ConnectionAdvanced settings={owner} />
</If>
<If when={owner.page() === 'model' && owner.editor() && owner.model()}>
<ConnectionModel settings={owner} />
</If>
<>
<If when={owner.page() === 'connections'}>
<ConnectionList owner={owner} externalAgents={props.externalAgents} />
</If>
<If when={owner.page() === 'providers'}>
<ProviderPicker owner={owner} externalAgents={props.externalAgents} />
</If>
<If when={owner.page() === 'connection' && owner.editor()}>
<ConnectionForm settings={owner} externalAgents={props.externalAgents} />
</If>
<If when={owner.page() === 'advanced' && owner.editor()}>
<ConnectionAdvanced settings={owner} />
</If>
<If when={owner.page() === 'model' && owner.editor() && owner.model()}>
<ConnectionModel settings={owner} />
</If>
<If when={props.externalAgents?.confirmation() && !owner.discardTarget()}>
<ExternalAgentConfirmation owner={props.externalAgents!} />
</If>
<If when={owner.signInConfirmation() && !owner.discardTarget()}>
<SignInRiskConfirmation owner={owner} />
</If>
<If when={owner.confirmation() && !owner.discardTarget()}>
<Removal owner={owner} />
</If>
<If when={owner.discardTarget()}>
<Discard owner={owner} />
</If>
</If>
</>
);
}

Expand Down Expand Up @@ -320,33 +321,24 @@ function SignInRiskConfirmation(props: { owner: ModelSettingsOwner }) {
const ack = signal(false);
const submit = () =>
!o.editor()?.baseline || o.dirty() ? tr('Save and sign in') : tr('Sign in with ChatGPT');
const footer = (
<>
<SettingsButton
label={tr('Cancel')}
tone="quiet"
const provider = () => o.editor()?.provider.identity.name;
return (
<SettingsConfirm
title={tr('ChatGPT sign-in')}
titleIcon={provider() ? <BrandIcon id={provider()!} /> : undefined}
body={subscriptionRiskDetail()}
confirm={submit()}
confirmDisabled={!ack()}
disabled={dis()}
onConfirm={inputAction(o.confirmSignIn, o.action())}
onCancel={inputAction(o.cancelSignIn, o.action())}
>
<SettingsConsentCheck
label={tr('I understand the account risk')}
checked={ack()}
disabled={dis()}
onPress={inputAction(o.cancelSignIn, o.action())}
onChange={() => !dis() && ack.set(!ack())}
/>
<SettingsButton
label={submit()}
tone="primary"
disabled={dis() || !ack()}
onPress={inputAction(o.confirmSignIn, o.action())}
/>
</>
);
return (
<SettingsBody accessibilityLabel={tr('ChatGPT sign-in')} footer={footer}>
<SettingsLede>{subscriptionRiskDetail()}</SettingsLede>
<SettingsSection>
<SettingsSwitch
label={tr('I understand the account risk')}
checked={ack()}
disabled={dis()}
onPress={() => !dis() && ack.set(!ack())}
/>
</SettingsSection>
</SettingsBody>
</SettingsConfirm>
);
}
74 changes: 32 additions & 42 deletions products/maka/workbench/app/ExternalAgentSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@

import { SettingsAnchor } from './SettingsAnchor';
import { BrandIcon } from './BrandIcon';
import { inputAction } from 'nsh';
import { computed, inputAction } from 'nsh';
import type { AgentExternalRuntime } from '../../../../packages/plugin-sdk/src/generated/runtime';
import type { ExternalAgentSettingsOwner } from './externalAgentSettingsState';
import { InlineSkeletonLine, SettingsSkeleton } from './Loading';
import { tr } from './locale';
import { UsageLimits } from './UsageLimits';
import {
SettingsBody,
SettingsButton,
SettingsLede,
SettingsConfirm,
SettingsConsentCheck,
SettingsProblem,
SettingsSection,
SettingsSwitch,
Expand Down Expand Up @@ -102,6 +102,9 @@ export function ExternalAgentSection(props: {
)
: enabled;
};
const showRefresh = computed(
() => !props.runtimeId && owner.runtimes().some((runtime) => runtime.enabled),
);
return (
<>
<If when={filtered().length > 0}>
Expand All @@ -111,14 +114,14 @@ export function ExternalAgentSection(props: {
<SettingsSection
title={props.runtimeId ? undefined : tr('External agents')}
trailing={
<If when={!props.runtimeId && owner.runtimes().some((runtime) => runtime.enabled)}>
showRefresh() ? (
<SettingsButton
label={tr('Refresh')}
tone="quiet"
disabled={owner.disabled() || owner.checking()}
onPress={inputAction(owner.reload, owner.action())}
/>
</If>
) : undefined
}
>
<Each of={filtered()} key={(runtime) => runtime.id}>
Expand Down Expand Up @@ -184,43 +187,30 @@ export function ExternalAgentConfirmation(props: { owner: ExternalAgentSettingsO
const owner = props.owner;
const confirmation = () => owner.confirmation()!;
return (
<SettingsBody
accessibilityLabel={tr('External agent runtimes')}
footer={
<>
<SettingsButton
label={tr('Cancel')}
accessibilityLabel={tr('Cancel enabling external agents')}
tone="quiet"
disabled={owner.disabled()}
onPress={inputAction(owner.cancel, owner.action())}
/>
<SettingsButton
label={tr('Confirm permissions and enable')}
tone="primary"
disabled={owner.disabled() || !confirmation().acknowledged}
onPress={inputAction(owner.enable, owner.action())}
/>
</>
}
<SettingsConfirm
title={tr('Enable {name}', { name: confirmation().name })}
titleIcon={<BrandIcon agent id={confirmation().runtime} />}
body={tr(
'This agent runs in its native full-access mode. It can read and write files, run commands and access the network outside the Maka sandbox.',
)}
note={tr('Other Maka permissions stay unchanged.')}
confirm={tr('Confirm permissions and enable')}
confirmDisabled={!confirmation().acknowledged}
cancelAccessibilityLabel={tr('Cancel enabling external agents')}
disabled={owner.disabled()}
onConfirm={inputAction(owner.enable, owner.action())}
onCancel={inputAction(owner.cancel, owner.action())}
>
<SettingsLede>
{tr(
'This agent runs in its native full-access mode. It can read and write files, run commands and access the network outside the Maka sandbox.',
)}
</SettingsLede>
<SettingsSection note={tr('Other Maka permissions stay unchanged.')}>
<SettingsSwitch
label={tr('I understand and accept these permissions')}
accessibilityLabel={tr('I understand and accept the external agent permissions')}
checked={confirmation().acknowledged}
disabled={owner.disabled()}
onPress={inputAction(owner.acknowledge, {
...owner.action(),
value: !confirmation().acknowledged,
})}
/>
</SettingsSection>
</SettingsBody>
<SettingsConsentCheck
label={tr('I understand and accept these permissions')}
accessibilityLabel={tr('I understand and accept the external agent permissions')}
checked={confirmation().acknowledged}
disabled={owner.disabled()}
onChange={inputAction(owner.acknowledge, {
...owner.action(),
value: !confirmation().acknowledged,
})}
/>
</SettingsConfirm>
);
}
Loading