-
Notifications
You must be signed in to change notification settings - Fork 39.1k
Bonian agent #309226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bonian agent #309226
Changes from 2 commits
94eccf9
286c506
6913213
76cdf32
dec5cf6
aa6d4d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| .monaco-input-toolbar { | ||
| padding: 8px; | ||
| border-bottom: 1px solid var(--vscode-input-border); | ||
| background: var(--vscode-editor-background); | ||
| } | ||
|
|
||
| .monaco-input-toolbar .monaco-button { | ||
| background: var(--vscode-button-background); | ||
| color: var(--vscode-button-foreground); | ||
| border: 1px solid var(--vscode-button-border, transparent); | ||
| padding: 6px 12px; | ||
| border-radius: 3px; | ||
| font-size: 13px; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .monaco-input-toolbar .monaco-button:hover { | ||
| background: var(--vscode-button-hoverBackground); | ||
| } | ||
|
|
||
| .monaco-input-toolbar .monaco-button.primary { | ||
| background: var(--vscode-button-background); | ||
| color: var(--vscode-button-foreground); | ||
| } | ||
|
|
||
| .monaco-input-toolbar .monaco-button.primary:hover { | ||
| background: var(--vscode-button-hoverBackground); | ||
| } | ||
|
|
||
| .monaco-input-container { | ||
| flex: 1; | ||
| min-height: 300px; | ||
| border: 1px solid var(--vscode-input-border); | ||
| border-radius: 4px; | ||
| margin: 8px; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| import './media/monacoInput.css'; | ||
| import * as nls from '../../../../nls.js'; | ||
| import { Registry } from '../../../../platform/registry/common/platform.js'; | ||
| import { Extensions as ViewExtensions, IViewsRegistry } from '../../../common/views.js'; | ||
| import { MonacoInputViewPane } from './monacoInputView.js'; | ||
| import { SyncDescriptor } from '../../../../platform/instantiation/common/descriptors.js'; | ||
| import { ViewPaneContainer } from '../../../browser/parts/views/viewPaneContainer.js'; | ||
| import { Extensions as ViewContainerExtensions, IViewContainersRegistry, ViewContainerLocation } from '../../../common/views.js'; | ||
| import { Codicon } from '../../../../base/common/codicons.js'; | ||
| import { Action2, MenuId, registerAction2 } from '../../../../platform/actions/common/actions.js'; | ||
| import { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js'; | ||
| import { ServicesAccessor } from '../../../../platform/instantiation/common/instantiation.js'; | ||
| import { IViewsService } from '../../../services/views/common/viewsService.js'; | ||
|
|
||
| // Register the view container for auxiliary bar | ||
| const VIEW_CONTAINER_ID = 'workbench.view.monacoInputContainer'; | ||
|
|
||
| const viewsRegistry = Registry.as<IViewsRegistry>(ViewExtensions.ViewsRegistry); | ||
| const viewContainerRegistry = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry); | ||
|
|
||
| // Register view container in auxiliary bar (secondary sidebar) | ||
| const viewContainer = viewContainerRegistry.registerViewContainer({ | ||
| id: VIEW_CONTAINER_ID, | ||
| title: { value: nls.localize('monacoInputContainer', "Monaco Input"), original: 'Monaco Input' }, | ||
| ctorDescriptor: new SyncDescriptor( | ||
| ViewPaneContainer, | ||
| [VIEW_CONTAINER_ID, { mergeViewWithContainerWhenSingleView: true }] | ||
| ), | ||
| hideIfEmpty: true, | ||
| icon: Codicon.edit, | ||
| order: 5 | ||
| }, ViewContainerLocation.AuxiliaryBar); | ||
|
|
||
| // Register the view in the container | ||
| viewsRegistry.registerViews([{ | ||
| id: MonacoInputViewPane.ID, | ||
| name: { value: MonacoInputViewPane.TITLE, original: 'Monaco Input' }, | ||
| ctorDescriptor: new SyncDescriptor(MonacoInputViewPane), | ||
| canToggleVisibility: true, | ||
| canMoveView: true, | ||
| containerIcon: Codicon.edit, | ||
| order: 100, | ||
| when: undefined | ||
| }], viewContainer); | ||
|
|
||
| // Register button commands | ||
| registerAction2(class ClearMonacoInputAction extends Action2 { | ||
| constructor() { | ||
| super({ | ||
| id: 'monacoInput.clear', | ||
| title: { value: nls.localize('monacoInput.clear', "Clear Input"), original: 'Clear Input' }, | ||
| icon: Codicon.clearAll, | ||
| menu: { | ||
| id: MenuId.ViewTitle, | ||
| when: ContextKeyExpr.equals('view', MonacoInputViewPane.ID), | ||
| group: 'navigation', | ||
| order: 1 | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| async run(accessor: ServicesAccessor): Promise<void> { | ||
| const viewsService = accessor.get(IViewsService); | ||
| const view = viewsService.getActiveViewWithId(MonacoInputViewPane.ID) as MonacoInputViewPane | null; | ||
|
|
||
| if (view) { | ||
| view.clearContent(); | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| registerAction2(class SaveMonacoInputAction extends Action2 { | ||
| constructor() { | ||
| super({ | ||
| id: 'monacoInput.save', | ||
| title: { value: nls.localize('monacoInput.save', "Save Content"), original: 'Save Content' }, | ||
| icon: Codicon.save, | ||
| menu: { | ||
| id: MenuId.ViewTitle, | ||
| when: ContextKeyExpr.equals('view', MonacoInputViewPane.ID), | ||
| group: 'navigation', | ||
| order: 2 | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| async run(accessor: ServicesAccessor): Promise<void> { | ||
| const viewsService = accessor.get(IViewsService); | ||
| const view = viewsService.getActiveViewWithId(MonacoInputViewPane.ID) as MonacoInputViewPane | null; | ||
|
|
||
| if (view) { | ||
| const content = view.getValue(); | ||
| // Here you would implement save logic | ||
| console.log('Saving content:', content); | ||
| } | ||
| } | ||
| }); | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,158 @@ | ||||||||||||||
| import * as dom from '../../../../base/browser/dom.js'; | ||||||||||||||
| import { CodeEditorWidget } from '../../../../editor/browser/widget/codeEditor/codeEditorWidget.js'; | ||||||||||||||
| import { ICodeEditor } from '../../../../editor/browser/editorBrowser.js'; | ||||||||||||||
|
Comment on lines
+1
to
+3
|
||||||||||||||
| import { IEditorOptions } from '../../../../editor/common/config/editorOptions.js'; | ||||||||||||||
| import { ITextModel } from '../../../../editor/common/model.js'; | ||||||||||||||
| import { ILanguageService } from '../../../../editor/common/languages/language.js'; | ||||||||||||||
| import { IModelService } from '../../../../editor/common/services/model.js'; | ||||||||||||||
| import * as nls from '../../../../nls.js'; | ||||||||||||||
| import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js'; | ||||||||||||||
| import { IContextMenuService } from '../../../../platform/contextview/browser/contextView.js'; | ||||||||||||||
| import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js'; | ||||||||||||||
| import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js'; | ||||||||||||||
| import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js'; | ||||||||||||||
| import { IOpenerService } from '../../../../platform/opener/common/opener.js'; | ||||||||||||||
| import { IThemeService } from '../../../../platform/theme/common/themeService.js'; | ||||||||||||||
| import { IViewPaneOptions, ViewPane } from '../../../browser/parts/views/viewPane.js'; | ||||||||||||||
| import { IViewDescriptorService } from '../../../common/views.js'; | ||||||||||||||
| import { IHoverService } from '../../../../platform/hover/browser/hover.js'; | ||||||||||||||
| import { URI } from '../../../../base/common/uri.js'; | ||||||||||||||
| import { ICommandService } from '../../../../platform/commands/common/commands.js'; | ||||||||||||||
|
|
||||||||||||||
| export class MonacoInputViewPane extends ViewPane { | ||||||||||||||
| static readonly ID = 'workbench.views.monacoInput'; | ||||||||||||||
| static readonly TITLE = nls.localize('monacoInput', "Monaco Input"); | ||||||||||||||
|
|
||||||||||||||
| private _editor: ICodeEditor | undefined; | ||||||||||||||
| private _editorContainer: HTMLElement | undefined; | ||||||||||||||
| private _textModel: ITextModel | undefined; | ||||||||||||||
|
|
||||||||||||||
| constructor( | ||||||||||||||
| options: IViewPaneOptions, | ||||||||||||||
| @IKeybindingService keybindingService: IKeybindingService, | ||||||||||||||
| @IContextMenuService contextMenuService: IContextMenuService, | ||||||||||||||
| @IConfigurationService configurationService: IConfigurationService, | ||||||||||||||
| @IContextKeyService protected override readonly contextKeyService: IContextKeyService, | ||||||||||||||
| @IViewDescriptorService viewDescriptorService: IViewDescriptorService, | ||||||||||||||
| @IInstantiationService protected override readonly instantiationService: IInstantiationService, | ||||||||||||||
| @IOpenerService openerService: IOpenerService, | ||||||||||||||
| @IThemeService themeService: IThemeService, | ||||||||||||||
| @IHoverService hoverService: IHoverService, | ||||||||||||||
| @IModelService private readonly modelService: IModelService, | ||||||||||||||
| @ILanguageService private readonly languageService: ILanguageService, | ||||||||||||||
| @ICommandService private readonly commandService: ICommandService, | ||||||||||||||
| ) { | ||||||||||||||
| super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, hoverService); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| protected override renderBody(container: HTMLElement): void { | ||||||||||||||
| super.renderBody(container); | ||||||||||||||
|
|
||||||||||||||
| // Create toolbar with run button | ||||||||||||||
| const toolbar = dom.$('.monaco-input-toolbar'); | ||||||||||||||
| const runButton = dom.$('button.monaco-button.primary', { | ||||||||||||||
| type: 'button', | ||||||||||||||
| title: 'Run Python Code' | ||||||||||||||
| }); | ||||||||||||||
| runButton.textContent = '🐍 Run Python'; | ||||||||||||||
|
Comment on lines
+55
to
+57
|
||||||||||||||
| title: 'Run Python Code' | |
| }); | |
| runButton.textContent = '🐍 Run Python'; | |
| title: nls.localize('monacoInput.runPythonButtonTitle', "Run Python") | |
| }); | |
| runButton.textContent = nls.localize('monacoInput.runPythonButtonLabel', "Run Python"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add soon
Copilot
AI
Apr 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
runPython() builds a shell script by interpolating arbitrary editor content into a heredoc and sends it to the terminal. This is not cross-platform (/tmp, clear, python3) and is vulnerable to heredoc breakouts (e.g. code containing EOF) causing unintended shell execution. Please rework to a safe, OS-agnostic approach (e.g. write via IFileService to a temp location from VS Code services, properly quote paths, and execute Python via a dedicated task/terminal API rather than injecting raw shell).
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -207,6 +207,9 @@ import './contrib/chat/browser/chat.contribution.js'; | |||||||||
| import './contrib/inlineChat/browser/inlineChat.contribution.js'; | ||||||||||
| import './contrib/mcp/browser/mcp.contribution.js'; | ||||||||||
|
|
||||||||||
| // Monaco Input | ||||||||||
| import './contrib/monacoInput/browser/monacoInput.contribution.js'; | ||||||||||
|
|
||||||||||
| // Interactive | ||||||||||
| import './contrib/interactive/browser/interactive.contribution.js'; | ||||||||||
|
||||||||||
| import './contrib/interactive/browser/interactive.contribution.js'; | |
| if (globalThis.vscodeExperimentalInteractiveContribution === true) { | |
| void import('./contrib/interactive/browser/interactive.contribution.js'); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Save action currently only logs to the developer console. In product code this should either implement actual save behavior (e.g. save to a user-chosen file / workspace file via
IFileService) or be removed until implemented.