Skip to content

mnevadaf/vscode_agent_extension

Repository files navigation

Elastic Agent Chat VS Code Extension

A VS Code extension that provides a Claude Code style chat sidebar backed by Elastic Agent Builder Kibana APIs. image

Features

  • Dedicated chat sidebar view with:
    • Top bar with Past Conversations dropdown menu
    • Click-to-load previous conversations from the popout menu
    • Agent selector
    • Connector selector
    • New chat action (+ in top bar)
    • Open-in-new-tab command
  • Start and continue conversations with Agent Builder:
    • POST /api/agent_builder/converse
    • POST /api/agent_builder/converse/async (SSE streaming)
  • List agents and connectors:
    • GET /api/agent_builder/agents
    • GET /api/actions/connectors
  • Local file attachment from active editor file (text only for MVP)
  • Attach Selection from active editor with file + line range labeling
  • Mention File in Chat convenience command
  • Streaming output with incremental assistant updates and Stop support
  • Completed reasoning rendering when steps are returned
  • Optional assistant-proposed workspace file edits with explicit Apply confirmation
  • Host-injected prompt instructions so the assistant emits eac-file/eac-delete blocks for file-change requests
  • API key configuration via extension setting elasticAgentChat.apiKey
  • Redacted output logging in output channel Elastic Agent Chat

Requirements

  • VS Code 1.90+
  • Kibana / Elastic Agent Builder 9.2+
  • Kibana API key with sufficient privileges (read_agent_builder and connector access)
  • Attachment support on converse endpoints requires Kibana 9.3+ (API-level attachment fields were added in 9.3).

Configuration

Workspace settings under elasticAgentChat:

  • kibanaUrl (required)
  • apiKey (required)
  • spaceId (optional)
  • streamingEnabled (default: true)
  • visualizationsEnabled (default: true)
  • workspaceWriteEnabled (default: false)
  • maxAttachmentBytes (default: 204800)
  • maxTotalAttachmentBytes (default: 1048576)
  • binaryAttachmentPolicy (default: reject)
  • redactionRules (default: ["**/.env", "**/*key*"])
  • connectorFilterMode (all default, optional llm_only)
  • panelTitle (default: Elastic Agent Chat)

Example .vscode/settings.json:

{
  "elasticAgentChat.kibanaUrl": "https://my-kibana.example.com",
  "elasticAgentChat.spaceId": "default",
  "elasticAgentChat.streamingEnabled": true,
  "elasticAgentChat.workspaceWriteEnabled": true
}

Commands

  • Elastic Agent Chat: Open Panel
  • Elastic Agent Chat: Open In New Tab
  • Elastic Agent Chat: Open Settings
  • Elastic Agent Chat: Set Kibana API Key
  • Elastic Agent Chat: New Chat
  • Elastic Agent Chat: Attach Selection
  • Elastic Agent Chat: Mention File in Chat

Open Panel focuses the extension's sidebar view container (Elastic Agent Chat) in the Activity Bar. Use the + action in the chat header (or Open In New Tab) to open an editor-tab instance of Elastic Agent Chat. To place it on the right side like Claude Code, right-click the view title and choose Move View -> Secondary Side Bar.

Minimum required settings:

  • elasticAgentChat.kibanaUrl
  • elasticAgentChat.apiKey

Security Model

  • API key is read from extension settings (elasticAgentChat.apiKey) and is never sent to webview state.
  • API key is redacted in logs.
  • Attachments are disabled in untrusted workspaces.
  • Assistant workspace edits are disabled by default and require elasticAgentChat.workspaceWriteEnabled=true.
  • Assistant workspace edits always require explicit user confirmation in a modal prompt before apply.
  • Attachment redaction warnings are shown before upload when path matches configured patterns.

Assistant Workspace Edit Blocks

When elasticAgentChat.workspaceWriteEnabled is enabled, assistant messages can include one or more edit blocks. Each assistant message that includes valid blocks shows an Apply edits button.

Supported formats:

```eac-file path=src/example.ts
export const example = true;
```

```eac-delete path=src/old.ts
```

Or JSON:

```eac-workspace-edits
{
  "edits": [
    { "action": "write", "path": "src/new.ts", "content": "export const x = 1;\n" },
    { "action": "delete", "path": "src/unused.ts" }
  ]
}
```

Inline visualization block (for chat preview rendering):

```eac-viz title="Example chart" type=bar
{
  "rows": [
    { "label": "A", "value": 10 },
    { "label": "B", "value": 7 }
  ]
}
```

Development

Install dependencies:

npm install

Build extension + webview:

npm run build

Watch mode:

npm run watch

Typecheck:

npm run typecheck

Run tests:

npm run test

CI/CD and Releases

  • Every push and pull request runs CI for typecheck, test, and build.
  • Every pushed commit also generates a VSIX artifact (dist/elastic-agent-chat.vsix) in the workflow run artifacts.
  • Pushing a tag like v0.1.0 triggers a release workflow that:
    • verifies the tag matches package.json version
    • reruns CI checks
    • packages dist/elastic-agent-chat.vsix
    • creates a GitHub Release with the VSIX attached for download/install in VS Code

Release flow:

npm version patch
git push --follow-tags

Troubleshooting

  • 401 Unauthorized
    • Re-run Elastic Agent Chat: Set Kibana API Key.
  • 403 Forbidden
    • Check Kibana privileges (read_agent_builder) and connector permissions.
  • 404 Not Found
    • Verify kibanaUrl and spaceId values.
  • 413 Payload Too Large
    • Reduce attachment size or count.
  • 400 Bad Request while using attachments
    • Verify Kibana is 9.3+ and that Agent Builder converse attachments are supported in your deployment.
  • No agents/connectors listed
    • Validate Kibana URL, API key, and space prefix.

Supported Endpoint Set (MVP)

  • GET /api/agent_builder/agents
  • GET /api/actions/connectors
  • POST /api/agent_builder/converse
  • POST /api/agent_builder/converse/async
  • Endpoint reference: Kibana Agent Builder API docs

Notes

  • MVP stores only current conversation in workspace state.
  • Local conversation history is stored in workspace state and selectable from the Past Conversations list.
  • Server-side persistent conversation attachments and diff approval workflow are intentionally deferred.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors