diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index f95b5ae..8f0df99 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -18,3 +18,7 @@ jobs: - run: npm run check - run: npm test - run: npm run package:vsix -- "$RUNNER_TEMP/agentextension.vsix" + - name: Test the packaged extension + run: | + unzip -q "$RUNNER_TEMP/agentextension.vsix" -d "$RUNNER_TEMP/agentextension-package" + AGENTEXTENSION_TEST_PACKAGED_PATH="$RUNNER_TEMP/agentextension-package/extension" node --test test/managed-vsix.test.js diff --git a/README.md b/README.md index 096a645..4726251 100644 --- a/README.md +++ b/README.md @@ -4,33 +4,42 @@ AgentExtension is a VS Code coding agent for local TrueForge. It can edit a sele **Starting point** · From scratch. The project started with this repository's MIT license. -## Set up +## Install and connect a model -1. Install Node.js 22.14 or later and VS Code 1.101 or later. [VS Code runtime requirements](https://code.visualstudio.com/updates/v1_101) -2. Run `npm ci` in this repository. -3. Start TrueForge in a separate terminal. Keep it bound to the loopback address. The allowlist lets TrueForge reach the extension's temporary editor connector. +1. Download the VSIX with `darwin-arm64` in its name from **Assets** on the [latest GitHub release](https://github.com/LiteralKrishu/AgentExtension/releases/latest). It runs on Apple Silicon. For another platform, follow [the build instructions](#develop-or-build-the-vsix). +2. In VS Code 1.101 or later, run **Extensions: Install from VSIX** and select the downloaded file. +3. Open a trusted workspace folder. Open **AgentExtension** in the activity bar and select **Connect model**. +4. Choose one connection. - ```sh - HOST=127.0.0.1 OUTBOUND_URL_ALLOWED_HOSTS='["127.0.0.1"]' \ - npx --yes @truefoundry/trueforge@0.184.2 - ``` + - **OpenAI.** Paste an OpenAI API key with access to GPT-4.1 mini. This is the default model. [Model requirements](https://developers.openai.com/api/docs/models/gpt-4.1-mini) + - **OpenAI-compatible API.** Enter the API URL. Add a key if the provider requires one. Select a model that supports tool calls, or enter its model ID. For LM Studio or Ollama, start the local model server first. + - **Existing TrueForge server.** Enter its local URL and select one of its configured models. You can continue to use **AgentExtension: Server URL**, **Model**, and **Fallback Model** in VS Code Settings for that connection. -4. Open TrueForge at `http://127.0.0.1:8790`. Under **Settings → Models**, add a catalog provider or an OpenAI-compatible endpoint. The [example manifest](trueforge/model.example.json) shows the fields for a local model. Set any credentials in TrueForge. -5. Open this repository in VS Code. Run **Run AgentExtension** from **Run and Debug**. Open the target repository in the Extension Development Host. -6. In the host window, set **AgentExtension: Model** to the full name from TrueForge, such as `local-lm-studio/qwen`. Set **AgentExtension: Fallback Model** to a second configured model if you want automatic fallback. +5. Describe a task and select **Run agent**. Review the proposed changes in VS Code. -The extension loads the checked-in agent definition when it creates a session. Use a configured TrueForge chat model with a compatible tool-call template. [Agent definition](trueforge/agent.json) · [TrueForge model setup](https://trueforge.dev/models) +The VSIX includes Node.js and TrueForge. VS Code stores the API key in its credential store. The bundled server starts when you connect a model or start your first run in a new window. It runs on a private local port for that window. After you close the window, **Resume** can recover the editor checkpoint and start a new model session. Scheduled reports that run while VS Code is closed require an existing TrueForge server. -You can also install the packaged extension with **Extensions: Install from VSIX** and use it in a normal VS Code window. +## Develop or build the VSIX -Run `npm run package:vsix` to build the bundled VSIX. Pass an output path after `--` to choose where to save it. +Install an official Node.js distribution, version 22.15 or later, and run `npm ci`. Run `npm run package:vsix` on the target platform to build its package. The default filename includes the operating system and processor. Pass an output path after `--` to choose where to save the file. On macOS, the build uses the Xcode Command Line Tools to compile the optional desktop helper. + +For source debugging, use **Run AgentExtension** from **Run and Debug**. The source host connects to a separately started TrueForge server. Keep it on the loopback address so it can reach the temporary editor connector. + +```sh +HOST=127.0.0.1 OUTBOUND_URL_ALLOWED_HOSTS='["127.0.0.1"]' \ + npx --yes @truefoundry/trueforge@0.184.2 +``` + +Open TrueForge at `http://127.0.0.1:8790` and add a model under **Settings → Models**. In the Extension Development Host, select **Connect model → Existing TrueForge server**. [Example model manifest](trueforge/model.example.json) · [Agent definition](trueforge/agent.json) ## Use the extension - **Inline edit.** Select code. Press **Cmd+Alt+I** on macOS or **Ctrl+Alt+I** on Windows or Linux. Enter an instruction. The first hunk opens in a native VS Code diff. - **Agent mode.** Open **AgentExtension** in the activity bar. Describe a task in the prompt at the bottom of the panel. Select **Run agent** or press **Enter** to start. Press **Shift+Enter** to add a line. Use the model link below the prompt to open model settings. -- **Add context.** Select **@ Context** to choose a workspace file or enter a symbol name. You can also type `@file:src/path.py` or `@symbol:my_function`. Put a path with spaces in quotes. -- **Workspace controls.** Open **Workspace** to manage skills, notes, instructions, connectors, plugins, access rules, and scheduled reports. Use the same menu to open saved reports, export the audit log, or start a working-tree review. +- **Add context.** Select **+ Context** to add a file or symbol, choose skills, or review workspace instructions. You can also type `@file:src/path.py` or `@symbol:my_function`. Put a path with spaces in quotes. +- **Configure tools.** Select **Tools** beside the prompt to manage plugins, connectors, accounts, browser and computer access, or permission rules. +- **Run a workflow.** Type `/` in an empty prompt or select the **/** button. Search for a workflow from an enabled plugin, such as `/example-team:inspect`. You can also find shortcuts for skills, notes, and working-tree review. +- **More actions.** Open **⋯** at the top of the panel for notes, scheduled reports, saved reports, sharing, and audit export. - **Run details.** Expand **Run details** below the run to see context sources, permission decisions, tool activity, verification, and worker findings. Cancel, revoke, and stop controls stay near the prompt while they are available. - **Interrupted runs.** Select **Resume** to restore an agent or inline draft. The extension reconnects to the original TrueForge session when it can confirm the previous turn ended and the old editor connection closed. Otherwise it starts a new session. Inline recovery preserves the selection and independent file edits. Use **Review conflicts** to preview overlapping changes and choose what to stage. If the selection boundaries are ambiguous, select the current code to start a new inline edit. The plan, hunk review, commands, and connector calls that require approval need a fresh decision. Applying or discarding the draft clears the checkpoint. - **Questions.** The agent can pause to ask a question with up to five options. The panel shows it under **Question from the agent**. Choose an option, type an answer, or select **Skip question**. Answers are sent as your input and do not approve any action. A run can ask up to five questions. Answered questions do not count toward the run's limit of 12 approval pauses. If the agent ends a turn with a plain-text question and nothing is staged, the extension asks it once to use the question panel or continue. A scheduled report can save a question for later review. @@ -43,12 +52,12 @@ Run `npm run package:vsix` to build the bundled VSIX. Pass an output path after - **Save and undo.** Apply edits existing files in editor buffers. Use **Save All** if Auto Save is off. New files are created at apply time. **Undo last apply** reverts the last batch if the current text still matches it. Save reverted buffers if needed. - **Cancel.** Select **Cancel run** in the panel or click the TrueForge status item. The extension discards the run's drafts. Use **Discard draft** to clear a completed review before apply. - **Permissions.** Expand **Permissions and decisions** to inspect the current workspace scope and recent decisions. Select **Revoke run access** to cancel the run and invalidate its grants. The **AgentExtension permissions** output channel keeps a local decision log with hashed targets. It does not log source text, command arguments, or connector credentials. -- **Skills.** Select **Choose skills** to enable text workflows for this workspace. The extension includes `focused-change`. Add local roots in **AgentExtension: Skill Roots**. Each root contains `skill-name/SKILL.md` folders. With **AgentExtension: Automatic Skills** on, the agent can match up to two skills at run start. During the run it can list eligible skill names and descriptions and request a workflow. Matching and requests share a 12,000-character budget. The run allows up to three active skills and 24,000 body characters across all sources. Skills with `disable-model-invocation: true` or `allow_implicit_invocation: false` require manual selection. The panel marks matched and requested skills, and **Context sources** records when text enters the run. +- **Skills.** Select **+ Context → Skills** to enable text workflows for this workspace. The extension includes `focused-change`. Add local roots in **AgentExtension: Skill Roots**. Each root contains `skill-name/SKILL.md` folders. With **AgentExtension: Automatic Skills** on, the agent can match up to two skills at run start. During the run it can list eligible skill names and descriptions and request a workflow. Matching and requests share a 12,000-character budget. The run allows up to three active skills and 24,000 body characters across all sources. Skills with `disable-model-invocation: true` or `allow_implicit_invocation: false` require manual selection. The panel marks matched and requested skills, and **Context sources** records when text enters the run. - **Context.** Expand **Context sources** to see the instruction, request, selection, skill, repository, memory, and tool-result entries recorded during the run. Each entry shows its origin, trust label, reason, and character count. After a main-thread compaction, entries show whether the extension recorded them before or after that event. Retained source IDs are unavailable. - **Notes.** Open **Notes** and type to search by full note text, scope, or cited file. Workspace notes enter future runs for that workspace. User preferences enter runs in every workspace. To free space, select **Summarize workspace notes** or **Summarize user preferences**. Select at least two entries, write a shorter summary, and review it before replacing the originals. You can also add, edit, or remove a note and open its source. Notes persist in extension storage and support opt-in [private sync](#sync-personal-preferences-and-workspace-notes). Keep credentials out of notes. - **Suggested notes.** During a run, the agent can call `suggest_note` to propose a workspace note or user preference. It can cite up to five workspace files. Suggestions are kept in a separate list and never sent to a model. The panel shows how many are waiting for review. Choose **Review suggested notes** to save, edit and save, or discard each one. A run can make at most three suggestions, and at most 20 can wait for review. A rule that denies `memory.suggest` removes the tool. -- **MCP connectors.** Configure a server, account label, and tools with exact targets. Select **Choose connectors** to enable it for this workspace. Use **Connector credential** to set a bearer token or sign in with OAuth. Every write requires a separate editor approval. -- **Plugins.** Select **Manage plugins** to enable a bundled, configured, or imported plugin. Review its version, publisher label, capabilities, source, and content digest. Enablement is saved for this workspace. A changed version, file, or referenced connector configuration requires approval again. Clear its checkbox to disable it. [Share packages and run workflows](#plugin-packages-and-workflows) +- **MCP connectors.** Open **Tools → Connector settings** to configure a server, account label, and tools with exact targets. Select **Tools → Connectors** to enable it for this workspace. Use **Tools → Connector accounts** to set a bearer token or sign in with OAuth. Every write requires a separate editor approval. +- **Plugins.** Select **Tools → Plugins** to enable a bundled, configured, or imported plugin. Review its version, publisher label, capabilities, source, and content digest. Enablement is saved for this workspace. A changed version, file, or referenced connector configuration requires approval again. Clear its checkbox to disable it. [Share packages and run workflows](#plugin-packages-and-workflows) - **Subagents.** With `review-team` enabled, ask the agent to research relevant repository files or review its draft. Under **Research and review workers**, open a task to see its source ranges, findings, state, and TrueForge session link. Diff reports become stale when the draft or accepted hunk selection changes. Findings are advice. Apply still requires your hunk decisions. - **Fix workers.** Enable the bundled `fix-team` plugin to add three workers. `diagnose_failure` explains the latest failed check from its output and the files it cites. `propose_worker_edits` drafts edits to named files in a separate draft. The agent must merge those edits with `merge_worker_edits`. A merge is refused if the draft changed after the worker started or if an edit overlaps a change the agent already staged. Merged edits appear in hunk review like any other change. The plugin also defines a custom `docs-check` reviewer. - **Browser inspection.** Add exact origins in **AgentExtension: Browser Origins**. Select **Browser access**, choose the origins, then choose observation or requests for actions. The extension starts a separate Chrome profile. It can read a page, list controls, and capture a small screenshot. Each click, text fill, upload, and outgoing write request needs approval. @@ -68,9 +77,11 @@ Browser and computer selections also last for the extension-host session. Each r ## Plugin packages and workflows 1. To share a plugin from a configured plugin root, run **AgentExtension: Export Plugin Package** from the Command Palette. Select the plugin and save the `.agentextension-plugin.json` file to a shared folder or send the file to the recipient. -2. On the receiving editor, select **Workspace → Import plugin** in the Agent panel. Open the package and review the publisher label, version, capabilities, and content digest. Select **Import plugin**. -3. Select **Manage plugins** and approve the exact version for this workspace. To upgrade a plugin, import the new package and approve its version again. -4. Select **Run plugin workflow**, then choose a workflow. Review or edit the prompt before you start. Planning workflows wait for the usual plan approval. Runs use the same access and change review as other agent runs. +2. In the receiving editor, select **Tools → Import plugin package**. Open the package and review the publisher label, version, capabilities, and content digest. Select **Import plugin**. +3. Select the plugin in the picker that opens and approve its version for this workspace. You can return to **Tools → Plugins** to change the selection. To upgrade a plugin, import the new package and approve its version again. +4. Type `/` in an empty prompt and choose a workflow. Review or edit its prompt before you start. Planning workflows wait for plan approval. Runs use the same access and change review as other agent runs. + +The bundled plugins add `/review-team:research` and `/fix-team:fix-check` after you enable them. Add your question or the failing check to the workflow prompt. The package uses the `agentextension-plugin/1` JSON format. It contains a manifest, declared skills, and text resources. The extension validates the package before making it available for approval. An invalid or cancelled import leaves the current version available. Use a unique plugin ID for packages. An installed package ID must differ from IDs in the bundled and configured plugin folders on the receiving editor. A publisher label comes from the manifest. @@ -384,7 +395,7 @@ Load the file with `launchctl bootstrap "gui/$(id -u)" "$HOME/Library/LaunchAgen ## Local plugin setup -Add parent folders to **AgentExtension: Plugin Roots**. Each child folder must contain `plugin.json`. Copy a plugin into a folder, then use **Manage plugins** to review and enable it. +Add parent folders to **AgentExtension: Plugin Roots**. Each child folder must contain `plugin.json`. Copy a plugin into a folder, then use **Tools → Plugins** to review and enable it. The bundled manifest provides a working example: @@ -439,7 +450,7 @@ Select or load the skill in an interactive run. Each call shows the script path, ### Built-in plugin hooks -Add the hook IDs to the manifest's `hooks` array and include `hook.run` in `capabilities`. **Manage plugins** shows each hook and its event before approval. +Add the hook IDs to the manifest's `hooks` array and include `hook.run` in `capabilities`. **Tools → Plugins** shows each hook and its event before approval. - `reject-conflict-markers` runs before **Apply**. It scans accepted hunk text only. It blocks apply if it finds possible conflict markers or exceeds 64 accepted hunks or 64,000 characters. - `record-check-result` runs after an isolated check returns. It records the outcome and draft revision in the saved run report. diff --git a/media/panel.css b/media/panel.css index dd62352..d48ea1f 100644 --- a/media/panel.css +++ b/media/panel.css @@ -24,7 +24,7 @@ section { display: grid; gap: 8px; min-width: 0; } .hint:empty { display: none; } .panel { display: flex; flex-direction: column; height: 100%; } -.toolbar, .run-status, .workspace, .composer-area { flex: none; } +.toolbar, .run-status, .composer-area { flex: none; } .toolbar { display: flex; align-items: center; @@ -39,18 +39,7 @@ section { display: grid; gap: 8px; min-width: 0; } .phase[data-phase="idle"], .phase[data-phase="cancelled"] { color: var(--muted); } .phase[data-phase="running"] { color: var(--vscode-progressBar-background); } .phase[data-phase="error"] { color: var(--vscode-errorForeground); } -#workspace-toggle span { display: inline-block; } -#workspace-toggle[aria-expanded="true"] span { transform: rotate(180deg); } -.workspace { - display: grid; - gap: 12px; - max-height: 42%; - overflow: auto; - padding: 12px; - border-bottom: 1px solid var(--line); - background: var(--vscode-editorWidget-background, var(--surface)); -} -.workspace section + section { padding-top: 10px; border-top: 1px solid var(--line); } +#more-actions { min-width: 28px; font-size: 16px; line-height: 1; } .run-status { max-height: 20%; overflow: auto; @@ -129,6 +118,7 @@ textarea::placeholder { color: var(--vscode-input-placeholderForeground); } gap: 5px 8px; } .composer-actions { padding: 4px 5px 5px; } +#slash-picker { min-width: 26px; } .run-actions { margin-left: auto; } .composer-meta { font-size: .88em; } #model-settings { min-width: 0; max-width: 100%; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } @@ -150,7 +140,6 @@ textarea::placeholder { color: var(--vscode-input-placeholderForeground); } box-shadow: 0 2px 8px var(--vscode-widget-shadow); } .context-options button { text-align: left; } -.context-options p { padding: 4px 7px; } button, .quiet { cursor: pointer; diff --git a/media/panel.js b/media/panel.js index 9db2c50..005d760 100644 --- a/media/panel.js +++ b/media/panel.js @@ -5,27 +5,16 @@ const send = (type, fields = {}) => vscode.postMessage({ type, ...fields }); const prompt = byId('prompt'); const form = byId('form'); -const workspace = byId('workspace'); -const workspaceToggle = byId('workspace-toggle'); const contextMenu = byId('add-context'); const stream = byId('stream'); const phaseLabels = { idle: 'Ready', running: 'Running', question: 'Answer needed', plan: 'Plan to review', review: 'Changes to review', ready: 'Ready to apply', done: 'Complete', applied: 'Applied', error: 'Error', cancelled: 'Cancelled' }; -function showWorkspace(open) { - workspace.hidden = !open; - workspaceToggle.setAttribute('aria-expanded', String(open)); -} - -workspaceToggle.addEventListener('click', () => showWorkspace(workspace.hidden)); document.addEventListener('keydown', event => { if (event.key !== 'Escape') return; if (contextMenu.open) { contextMenu.open = false; contextMenu.querySelector('summary').focus(); - } else if (!workspace.hidden) { - showWorkspace(false); - workspaceToggle.focus(); } }); document.addEventListener('click', event => { @@ -58,20 +47,34 @@ byId('attach-symbol').addEventListener('click', () => { prompt.value = vscode.getState()?.prompt ?? ''; prompt.addEventListener('input', () => vscode.setState({ prompt: prompt.value })); prompt.addEventListener('keydown', event => { - if (event.key !== 'Enter' || event.shiftKey || event.isComposing || event.keyCode === 229) return; + if (event.isComposing || event.keyCode === 229) return; + if (event.key === '/' && !prompt.value && !event.metaKey && !event.ctrlKey && !event.altKey && !byId('slash-picker').disabled) { + event.preventDefault(); + if (!event.repeat) send('slash-commands'); + return; + } + if (event.key !== 'Enter' || event.shiftKey) return; event.preventDefault(); if (!event.repeat && !byId('run').disabled) form.requestSubmit(byId('run')); }); form.addEventListener('submit', event => { event.preventDefault(); if (!prompt.value.trim() || byId('run').disabled) return; - showWorkspace(false); contextMenu.open = false; send('run', { prompt: prompt.value, planFirst: event.submitter?.id === 'plan-first' }); }); -for (const id of ['cancel', 'session', 'approve-plan', 'continue', 'apply', 'check-accepted', 'undo', 'select-skills', 'revoke', 'memory', 'connectors', 'connector-token', 'plugins', 'import-plugin', 'plugin-workflow', 'browser-access', 'computer-access', 'stop-surfaces', 'run-report', 'schedules', 'scheduled-questions', 'policy', 'instructions', 'export-audit', 'resume-run', 'review-conflicts', 'discard-checkpoint', 'review-git', 'model-settings']) { +for (const id of ['cancel', 'session', 'approve-plan', 'continue', 'apply', 'check-accepted', 'undo', 'revoke', 'stop-surfaces', 'scheduled-questions', 'resume-run', 'review-conflicts', 'discard-checkpoint', 'model-settings', 'more-actions']) { byId(id).addEventListener('click', () => send(id)); } +for (const id of ['select-skills', 'instructions']) { + byId(id).addEventListener('click', () => { + contextMenu.open = false; + send(id); + }); +} +byId('tool-picker').addEventListener('click', () => send('tools')); +byId('slash-picker').addEventListener('click', () => send('slash-commands')); +byId('setup-model').addEventListener('click', () => send('model-settings')); function element(tag, text, className) { const node = document.createElement(tag); @@ -253,22 +256,13 @@ window.addEventListener('message', ({ data }) => { lastPhase = state.phase; lastRequest = state.request; const busy = ['running', 'plan', 'review', 'question'].includes(state.phase); - const canRun = !busy && state.phase !== 'ready' && !state.applying && !state.scheduledRunning; - byId('surface-scope').textContent = state.surfaceScope || 'Browser and computer access off.'; - byId('browser-access').disabled = byId('computer-access').disabled = busy || state.phase === 'ready' || state.applying; + const canRun = !busy && state.phase !== 'ready' && !state.applying && !state.scheduledRunning && !state.configuringModel; byId('stop-surfaces').hidden = !state.surfacesActive && !state.surfaceScope; - byId('run-report').disabled = state.applying; - byId('review-git').disabled = busy || state.phase === 'ready' || state.applying || Boolean(state.scheduledRunning); - byId('schedule-summary').textContent = state.scheduleSummary || 'No scheduled reports.'; const pendingQuestions = state.pendingScheduleQuestions ?? 0; byId('scheduled-question-inbox').hidden = !pendingQuestions; byId('scheduled-question-summary').textContent = `${pendingQuestions} scheduled question${pendingQuestions === 1 ? '' : 's'} waiting.`; byId('scheduled-questions').disabled = !canRun; - byId('policy-summary').textContent = state.policySummary || 'Every protected action asks first.'; - byId('memory-summary').textContent = state.memorySummary || ''; - byId('instruction-summary').textContent = state.instructionSummary || 'No instruction profiles in use.'; - byId('instructions').disabled = busy || state.phase === 'ready' || state.applying; - byId('schedules').disabled = state.applying || Boolean(state.scheduledRunning); + for (const id of ['tool-picker', 'slash-picker', 'instructions', 'select-skills']) byId(id).disabled = !canRun; byId('surface-activity').hidden = !state.surfaceEvents?.length; byId('surface-events').replaceChildren(...(state.surfaceEvents ?? []).map(event => element('li', `${event.kind} · ${event.status}`))); byId('welcome').hidden = state.phase !== 'idle' || Boolean(state.checkpoint || state.scheduledRunning); @@ -276,7 +270,8 @@ window.addEventListener('message', ({ data }) => { byId('request-card').hidden = !state.request; if (requestChanged) byId('request').textContent = state.request ?? ''; const setupNeeded = state.phase === 'idle' && !state.model; - byId('welcome-hint').textContent = setupNeeded ? 'Configure a TrueForge model below to start your first run.' + byId('welcome-title').textContent = setupNeeded ? 'Connect a model to get started' : 'What would you like to change?'; + byId('welcome-hint').textContent = setupNeeded ? 'Use an API key, a local model, or an existing TrueForge server.' : 'Describe a task below. You can review the proposed edits before applying them.'; byId('phase').textContent = state.scheduledRunning ? 'Scheduled report' : setupNeeded ? 'Setup needed' : phaseLabels[state.phase] ?? state.phase; byId('phase').dataset.phase = state.phase; @@ -286,14 +281,20 @@ window.addEventListener('message', ({ data }) => { if (status.textContent !== (state.status ?? '')) status.textContent = state.status ?? ''; byId('usage').hidden = !state.usage; byId('usage').textContent = state.usage ? `Usage: ${state.usage} · Estimated cost ${state.usageCost ?? 'Unreported'}` : ''; - byId('run').disabled = byId('plan-first').disabled = !canRun; + byId('run').disabled = byId('plan-first').disabled = !canRun || !state.model; byId('cancel').hidden = !busy && state.phase !== 'ready' && !state.scheduledRunning; byId('cancel').textContent = state.validatingApply ? 'Cancel validation' : state.checkingAccepted ? 'Cancel check' : state.phase === 'ready' ? 'Discard draft' : 'Cancel run'; - byId('run').hidden = byId('plan-first').hidden = !byId('cancel').hidden; + byId('run').hidden = byId('plan-first').hidden = !byId('cancel').hidden || !state.model; + const setupModel = byId('setup-model'); + setupModel.hidden = Boolean(state.model) || !byId('cancel').hidden; + setupModel.disabled = !canRun; + setupModel.textContent = state.configuringModel ? 'Connecting…' : 'Connect model'; const modelSettings = byId('model-settings'); - modelSettings.textContent = state.model || 'Configure model'; - modelSettings.title = state.model ? `Model settings · ${state.model}` : 'Open model settings'; + modelSettings.hidden = !state.model; + modelSettings.disabled = busy || state.applying || Boolean(state.scheduledRunning || state.configuringModel); + modelSettings.textContent = state.configuringModel ? 'Connecting…' : state.model || 'Connect model'; + modelSettings.title = state.model ? `Change model · ${state.model}` : 'Connect a model'; modelSettings.setAttribute('aria-label', modelSettings.title); byId('session').hidden = !state.session; byId('history').hidden = !state.undo; @@ -302,12 +303,6 @@ window.addEventListener('message', ({ data }) => { const response = byId('response'); const responseChanged = response.textContent !== state.text; if (responseChanged) response.textContent = state.text; - byId('select-skills').disabled = busy || state.phase === 'ready' || state.applying; - for (const id of ['memory', 'connectors', 'connector-token', 'plugins', 'import-plugin', 'plugin-workflow']) byId(id).disabled = busy || state.phase === 'ready' || state.applying; - byId('plugin-summary').textContent = state.plugins?.length - ? `Enabled plugins: ${state.plugins.map(plugin => `${plugin.id} ${plugin.version} · ${plugin.digest.slice(0, 12)}`).join(', ')}` : 'No plugins enabled.'; - byId('connector-summary').textContent = state.connectors?.length ? `Enabled connectors: ${state.connectors.join(', ')}` : 'No connectors enabled.'; - byId('skill-summary').textContent = state.skills?.length ? `Selected skills: ${state.skills.join(', ')}` : 'No skills selected.'; byId('revoke').hidden = !busy || state.permissions?.closed; byId('safety-actions').hidden = byId('revoke').hidden && byId('stop-surfaces').hidden; byId('permissions').hidden = !state.permissions; diff --git a/package-lock.json b/package-lock.json index 1ca0d17..a3109a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "agentextension", - "version": "0.6.1", + "version": "0.7.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "agentextension", - "version": "0.6.1", + "version": "0.7.0", "license": "MIT", "dependencies": { "@modelcontextprotocol/sdk": "1.32.1", diff --git a/package.json b/package.json index 9e076f8..cd794f5 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "agentextension", "displayName": "AgentExtension", "description": "Reviewable coding changes in VS Code, powered by local TrueForge.", - "version": "0.6.1", + "version": "0.7.0", "publisher": "LiteralKrishu", "license": "MIT", "repository": { @@ -37,6 +37,22 @@ "command": "agentextension.open", "title": "AgentExtension: Open Agent Panel" }, + { + "command": "agentextension.configureModel", + "title": "AgentExtension: Connect Model" + }, + { + "command": "agentextension.tools", + "title": "AgentExtension: Configure Tools" + }, + { + "command": "agentextension.slashCommands", + "title": "AgentExtension: Show Slash Commands" + }, + { + "command": "agentextension.managePlugins", + "title": "AgentExtension: Manage Plugins" + }, { "command": "agentextension.reviewGit", "title": "AgentExtension: Review Working-Tree Changes" @@ -292,7 +308,7 @@ "default": [], "maxItems": 7, "scope": "machine", - "description": "Approved local folders containing plugin directories with plugin.json. Installation does not enable a plugin. Review its version, content digest and capabilities in Manage plugins." + "description": "Approved local folders containing plugin directories with plugin.json. Review and enable a plugin's version, content digest, and capabilities under Tools → Plugins." }, "agentextension.browserOrigins": { "type": "array", diff --git a/plugins/fix-team/plugin.json b/plugins/fix-team/plugin.json index a78b5b4..3567866 100644 --- a/plugins/fix-team/plugin.json +++ b/plugins/fix-team/plugin.json @@ -2,10 +2,18 @@ "schemaVersion": 1, "id": "fix-team", "publisher": "LiteralKrishu", - "version": "1.0.0", + "version": "1.1.0", "description": "Diagnose a failed check and draft a contained fix for parent review.", "skills": ["fix-workflow"], "workers": ["test-diagnosis", "edit-proposal"], + "workflows": [ + { + "id": "fix-check", + "title": "Diagnose and fix a failing check", + "prompt": "Investigate the failing check I describe. Use the diagnosis and edit-proposal workers when applicable. Propose the smallest fix and show the draft and verification for review.", + "planFirst": true + } + ], "roles": [ { "name": "docs-check", diff --git a/plugins/review-team/plugin.json b/plugins/review-team/plugin.json index 0eefbfa..9c29d54 100644 --- a/plugins/review-team/plugin.json +++ b/plugins/review-team/plugin.json @@ -2,10 +2,17 @@ "schemaVersion": 1, "id": "review-team", "publisher": "LiteralKrishu", - "version": "1.0.0", + "version": "1.1.0", "description": "Research relevant repository excerpts and review a draft with bounded, read-only workers.", "skills": ["review-workflow"], "workers": ["repository-research", "diff-review"], + "workflows": [ + { + "id": "research", + "title": "Research a repository question", + "prompt": "Use the repository research worker to investigate my question. Cite file paths and line numbers and identify any gaps in the evidence. Do not change files." + } + ], "connectors": [], "capabilities": ["skill.read", "worker.research", "worker.review"] } diff --git a/scripts/package-vsix.cjs b/scripts/package-vsix.cjs index 062918b..8705cfd 100644 --- a/scripts/package-vsix.cjs +++ b/scripts/package-vsix.cjs @@ -10,6 +10,36 @@ const manifest = require('../package.json'); const root = path.resolve(__dirname, '..'); const runtimeDependencies = ['@truefoundry/trueforge-sdk', 'playwright-core']; const main = './src/extension.bundle.cjs'; +const target = `${process.platform}-${process.arch}`; + +async function stageRuntime(staging) { + if (!require('node:module').registerHooks) throw new Error('Build the VSIX with Node.js 22.15 or later.'); + const server = path.join(root, 'trueforge', 'server'); + const npm = process.env.npm_execpath; + if (!npm) throw new Error('Run npm run package:vsix to build the VSIX.'); + // The locked packages include SQLite prebuilds. A package build needs no compiler for the server. + execFileSync(process.execPath, [npm, 'ci', '--omit=dev', '--ignore-scripts', '--no-audit', '--no-fund'], { + cwd: server, stdio: 'inherit', + }); + const runtime = path.join(staging, 'trueforge', 'runtime'); + await fs.mkdir(runtime, { recursive: true }); + const node = path.join(runtime, process.platform === 'win32' ? 'node.exe' : 'node'); + const bin = path.dirname(process.execPath); + const license = [path.join(bin, '..', 'LICENSE'), path.join(bin, 'LICENSE')].find(existsSync); + if (!license) throw new Error('Build with an official Node.js distribution that includes its LICENSE file.'); + await Promise.all([ + fs.copyFile(process.execPath, node), + fs.copyFile(license, path.join(runtime, 'NODE-LICENSE')), + fs.copyFile(path.join(server, 'launch.cjs'), path.join(runtime, 'launch.cjs')), + fs.cp(path.join(server, 'node_modules'), path.join(runtime, 'node_modules'), { + recursive: true, + filter: source => !source.endsWith('.map') && path.basename(source) !== '.bin' + && source !== path.join(server, 'node_modules', '@truefoundry', 'trueforge', 'dist', '_frontend'), + }), + ]); + await fs.chmod(node, 0o755); + execFileSync(node, ['-e', 'new (require("better-sqlite3"))(":memory:").close()'], { cwd: runtime }); +} // The macOS helper is never committed. Each package compiles it from native/desktop.swift so the shipped // binary always matches reviewed source. Elsewhere the package omits it and native app access is unavailable. @@ -27,10 +57,12 @@ async function packageExtension(output) { const withHelper = buildHelper(); const staging = await fs.mkdtemp(path.join(await fs.realpath(os.tmpdir()), 'agentextension-vsix-')); try { - const assets = ['.vscodeignore', 'LICENSE', 'README.md', 'docs', 'media', 'native', 'plugins', 'skills', 'trueforge', + const assets = ['.vscodeignore', 'LICENSE', 'README.md', 'docs', 'media', 'native', 'plugins', 'skills', + 'trueforge/agent.json', 'trueforge/model.example.json', 'src/retrieval.js', 'src/context.js', ...runtimeDependencies.map(name => `node_modules/${name}`)]; await Promise.all(assets.map(file => fs.cp(path.join(root, file), path.join(staging, file), { recursive: true, filter: source => source !== helper || (withHelper && existsSync(helper)) }))); + await stageRuntime(staging); const packaged = { ...manifest, main, dependencies: Object.fromEntries(runtimeDependencies.map(name => [name, manifest.dependencies[name]])) }; delete packaged.devDependencies; @@ -49,13 +81,13 @@ async function packageExtension(output) { // VS Code supplies its API. Retrieval starts a worker from its own file. external: ['vscode', './retrieval', ...runtimeDependencies], }); - await createVSIX({ cwd: staging, packagePath: output }); + await createVSIX({ cwd: staging, packagePath: output, target }); } finally { await fs.rm(staging, { recursive: true, force: true }); } } -const output = path.resolve(process.argv[2] ?? `${manifest.name}-${manifest.version}.vsix`); +const output = path.resolve(process.argv[2] ?? `${manifest.name}-${manifest.version}-${target}.vsix`); packageExtension(output).catch(error => { console.error(error.message); process.exitCode = 1; diff --git a/src/extension.js b/src/extension.js index 36cb924..4645ee2 100644 --- a/src/extension.js +++ b/src/extension.js @@ -9,6 +9,8 @@ const { Retrieval } = require('./retrieval'); const { editorContext, workspaceFile } = require('./editor-context'); const { changedPaths, readChanges } = require('./git-review'); const { runForge, approve } = require('./forge'); +const { ManagedForge, MODEL_SECRET, MANAGED_MODEL, readProfile } = require('./managed-forge'); +const { configureModel, DEFAULT_SERVER } = require('./model-setup'); const { applyWorkspaceChanges } = require('./apply'); const { PermissionBroker } = require('./permissions'); const { SkillRegistry } = require('./skills'); @@ -70,33 +72,13 @@ class Panel {
Ready - +
-
-

What would you like to change?

+

What would you like to change?

Describe a task below. You can review the proposed edits before applying them.