mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 18:03:50 +00:00
Refactor JavaScript REPL tool description with consistent pattern
Clean up and restructure JavaScript REPL description following consistent pattern: - Purpose section - When to Use section - Environment section - Common Libraries section - Important Notes section - Example section Removed buildJavaScriptReplDescription() function - no longer dynamically injecting runtime provider docs into tool description (will move to system prompt). Changes: - Replace JAVASCRIPT_REPL_BASE_DESCRIPTION with JAVASCRIPT_REPL_DESCRIPTION - Remove JAVASCRIPT_REPL_CHART_EXAMPLE and JAVASCRIPT_REPL_FOOTER - Remove buildJavaScriptReplDescription() function - Update javascript-repl tool to use static description - Simpler, more scannable structure with clear hierarchy
This commit is contained in:
parent
3337953b2a
commit
2756f2a974
2 changed files with 30 additions and 65 deletions
|
|
@ -5,7 +5,7 @@ import { createRef, ref } from "lit/directives/ref.js";
|
|||
import { Code } from "lucide";
|
||||
import { type SandboxFile, SandboxIframe, type SandboxResult } from "../components/SandboxedIframe.js";
|
||||
import type { SandboxRuntimeProvider } from "../components/sandbox/SandboxRuntimeProvider.js";
|
||||
import { buildJavaScriptReplDescription } from "../prompts/tool-prompts.js";
|
||||
import { JAVASCRIPT_REPL_DESCRIPTION } from "../prompts/tool-prompts.js";
|
||||
import type { Attachment } from "../utils/attachment-utils.js";
|
||||
import { registerToolRenderer, renderCollapsibleHeader, renderHeader } from "./renderer-registry.js";
|
||||
import type { ToolRenderer } from "./types.js";
|
||||
|
|
@ -132,16 +132,7 @@ export function createJavaScriptReplTool(): AgentTool<typeof javascriptReplSchem
|
|||
name: "javascript_repl",
|
||||
runtimeProvidersFactory: () => [], // default to empty array
|
||||
sandboxUrlProvider: undefined, // optional, for browser extensions
|
||||
get description() {
|
||||
// Get dynamic provider descriptions
|
||||
const providers = this.runtimeProvidersFactory?.() || [];
|
||||
const providerDocs = providers
|
||||
.map((p) => p.getDescription?.())
|
||||
.filter(Boolean)
|
||||
.join("\n");
|
||||
|
||||
return buildJavaScriptReplDescription(providerDocs || undefined);
|
||||
},
|
||||
description: JAVASCRIPT_REPL_DESCRIPTION,
|
||||
parameters: javascriptReplSchema,
|
||||
execute: async function (_toolCallId: string, args: Static<typeof javascriptReplSchema>, signal?: AbortSignal) {
|
||||
const result = await executeJavaScript(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue