fix: align tool definition adapter
This commit is contained in:
@@ -153,21 +153,21 @@ user. This keeps the attack surface small, but it means:
|
|||||||
|
|
||||||
If you want a more full-featured container, use these opt-in knobs:
|
If you want a more full-featured container, use these opt-in knobs:
|
||||||
|
|
||||||
1) **Persist `/home/node`** so browser downloads and tool caches survive:
|
1. **Persist `/home/node`** so browser downloads and tool caches survive:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export OPENCLAW_HOME_VOLUME="openclaw_home"
|
export OPENCLAW_HOME_VOLUME="openclaw_home"
|
||||||
./docker-setup.sh
|
./docker-setup.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
2) **Bake system deps into the image** (repeatable + persistent):
|
2. **Bake system deps into the image** (repeatable + persistent):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export OPENCLAW_DOCKER_APT_PACKAGES="git curl jq"
|
export OPENCLAW_DOCKER_APT_PACKAGES="git curl jq"
|
||||||
./docker-setup.sh
|
./docker-setup.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
3) **Install Playwright browsers without `npx`** (avoids npm override conflicts):
|
3. **Install Playwright browsers without `npx`** (avoids npm override conflicts):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker compose run --rm openclaw-cli \
|
docker compose run --rm openclaw-cli \
|
||||||
@@ -177,7 +177,7 @@ docker compose run --rm openclaw-cli \
|
|||||||
If you need Playwright to install system deps, rebuild the image with
|
If you need Playwright to install system deps, rebuild the image with
|
||||||
`OPENCLAW_DOCKER_APT_PACKAGES` instead of using `--with-deps` at runtime.
|
`OPENCLAW_DOCKER_APT_PACKAGES` instead of using `--with-deps` at runtime.
|
||||||
|
|
||||||
4) **Persist Playwright browser downloads**:
|
4. **Persist Playwright browser downloads**:
|
||||||
|
|
||||||
- Set `PLAYWRIGHT_BROWSERS_PATH=/home/node/.cache/ms-playwright` in
|
- Set `PLAYWRIGHT_BROWSERS_PATH=/home/node/.cache/ms-playwright` in
|
||||||
`docker-compose.yml`.
|
`docker-compose.yml`.
|
||||||
|
|||||||
@@ -256,9 +256,9 @@ describe("msteams attachments", () => {
|
|||||||
const fetchMock = vi.fn(async (_url: string, opts?: RequestInit) => {
|
const fetchMock = vi.fn(async (_url: string, opts?: RequestInit) => {
|
||||||
const hasAuth = Boolean(
|
const hasAuth = Boolean(
|
||||||
opts &&
|
opts &&
|
||||||
typeof opts === "object" &&
|
typeof opts === "object" &&
|
||||||
"headers" in opts &&
|
"headers" in opts &&
|
||||||
(opts.headers as Record<string, string>)?.Authorization,
|
(opts.headers as Record<string, string>)?.Authorization,
|
||||||
);
|
);
|
||||||
if (!hasAuth) {
|
if (!hasAuth) {
|
||||||
return new Response("forbidden", { status: 403 });
|
return new Response("forbidden", { status: 403 });
|
||||||
|
|||||||
@@ -101,10 +101,10 @@ const _readSessionMessages = async (sessionFile: string) => {
|
|||||||
describe("createSystemPromptOverride", () => {
|
describe("createSystemPromptOverride", () => {
|
||||||
it("returns the override prompt trimmed", () => {
|
it("returns the override prompt trimmed", () => {
|
||||||
const override = createSystemPromptOverride("OVERRIDE");
|
const override = createSystemPromptOverride("OVERRIDE");
|
||||||
expect(override).toBe("OVERRIDE");
|
expect(override()).toBe("OVERRIDE");
|
||||||
});
|
});
|
||||||
it("returns an empty string for blank overrides", () => {
|
it("returns an empty string for blank overrides", () => {
|
||||||
const override = createSystemPromptOverride(" \n ");
|
const override = createSystemPromptOverride(" \n ");
|
||||||
expect(override).toBe("");
|
expect(override()).toBe("");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ export function toToolDefinitions(tools: AnyAgentTool[]): ToolDefinition[] {
|
|||||||
execute: async (
|
execute: async (
|
||||||
toolCallId,
|
toolCallId,
|
||||||
params,
|
params,
|
||||||
signal: AbortSignal | undefined,
|
|
||||||
onUpdate: AgentToolUpdateCallback<unknown> | undefined,
|
onUpdate: AgentToolUpdateCallback<unknown> | undefined,
|
||||||
_ctx,
|
_ctx,
|
||||||
|
signal?: AbortSignal,
|
||||||
): Promise<AgentToolResult<unknown>> => {
|
): Promise<AgentToolResult<unknown>> => {
|
||||||
try {
|
try {
|
||||||
return await tool.execute(toolCallId, params, signal, onUpdate);
|
return await tool.execute(toolCallId, params, signal, onUpdate);
|
||||||
@@ -91,9 +91,9 @@ export function toClientToolDefinitions(
|
|||||||
execute: async (
|
execute: async (
|
||||||
toolCallId,
|
toolCallId,
|
||||||
params,
|
params,
|
||||||
_signal: AbortSignal | undefined,
|
|
||||||
_onUpdate: AgentToolUpdateCallback<unknown> | undefined,
|
_onUpdate: AgentToolUpdateCallback<unknown> | undefined,
|
||||||
_ctx,
|
_ctx,
|
||||||
|
_signal?: AbortSignal,
|
||||||
): Promise<AgentToolResult<unknown>> => {
|
): Promise<AgentToolResult<unknown>> => {
|
||||||
const outcome = await runBeforeToolCallHook({
|
const outcome = await runBeforeToolCallHook({
|
||||||
toolName: func.name,
|
toolName: func.name,
|
||||||
|
|||||||
Reference in New Issue
Block a user