docs: document transcript tool tests · openclaw/openclaw@01eefa7
steipete
·
2026-06-05
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Tool image logging tests cover diagnostic context emitted while sanitizing |
| 2 | +// oversized or transformed image payloads. |
1 | 3 | import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; |
2 | 4 | import { createSolidPngBuffer } from "../../test/helpers/image-fixtures.js"; |
3 | 5 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Tool search tests cover catalog compaction, scoped tool lookup, raw fallback |
| 2 | +// tools, hooks, abort wrapping, and transcript projection. |
1 | 3 | import { afterEach, describe, expect, it, vi } from "vitest"; |
2 | 4 | import { setPluginToolMeta } from "../plugins/tools.js"; |
3 | 5 | import { wrapToolWithAbortSignal } from "./agent-tools.abort.js"; |
@@ -159,6 +161,8 @@ describe("Tool Search", () => {
|
159 | 161 | }); |
160 | 162 | |
161 | 163 | it("scopes catalogs by run id when attempts share a session", async () => { |
| 164 | +// Overlapping run attempts can share a session id; run-scoped catalogs keep |
| 165 | +// one attempt from calling tools only exposed to another. |
162 | 166 | const runATool = pluginTool("fake_run_a", "Tool visible only to run A"); |
163 | 167 | const runBTool = pluginTool("fake_run_b", "Tool visible only to run B"); |
164 | 168 | const config = { |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Transcript redaction tests cover structured and text transcript fields so |
| 2 | +// secrets do not persist in logs or replay artifacts. |
1 | 3 | import type { AgentMessage } from "openclaw/plugin-sdk/agent-core"; |
2 | 4 | import { describe, expect, it } from "vitest"; |
3 | 5 | import type { OpenClawConfig } from "../config/types.openclaw.js"; |
4 | 6 | import { redactTranscriptMessage } from "./transcript-redact.js"; |
5 | 7 | |
6 | | -/** Typed accessor for `content` on AgentMessage. |
7 | | - * AgentMessage is a union that includes custom message types (e.g. BashExecutionMessage) |
8 | | - * which have no `content` field. Direct `.content` access fails tsgo's strict union check. |
9 | | - */ |
| 8 | +// AgentMessage includes custom message types without content; this accessor |
| 9 | +// keeps strict union checks local to the redaction fixtures. |
10 | 10 | function msgContent(msg: AgentMessage): unknown { |
11 | 11 | return (msg as unknown as { content: unknown }).content; |
12 | 12 | } |
@@ -226,6 +226,8 @@ describe("redactTranscriptMessage", () => {
|
226 | 226 | }); |
227 | 227 | |
228 | 228 | it("redacts circular structured payloads without throwing", () => { |
| 229 | +// Redaction walks arbitrary tool payloads, so circular structures must be |
| 230 | +// replaced instead of recursing forever or throwing. |
229 | 231 | const details: Record<string, unknown> = { |
230 | 232 | apiKey: "plainsecretvalue123", |
231 | 233 | }; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Transport params runtime-contract tests cover default extra params and |
| 2 | +// provider transport patching for embedded OpenClaw/OpenAI execution paths. |
1 | 3 | import type { StreamFn } from "openclaw/plugin-sdk/agent-core"; |
2 | 4 | import type { Context, Model } from "openclaw/plugin-sdk/llm"; |
3 | 5 | import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; |
@@ -122,6 +124,8 @@ describe("transport params runtime contract (embedded OpenClaw/OpenAI path)", ()
|
122 | 124 | }); |
123 | 125 | |
124 | 126 | it("composes provider preparation before transport patch resolution", () => { |
| 127 | +// Provider preparation can rewrite transport context; transport-specific |
| 128 | +// patches must see that prepared context before final payload mutation. |
125 | 129 | const resolveProviderExtraParamsForTransport = vi.fn((_params: unknown) => ({ |
126 | 130 | patch: { |
127 | 131 | parallel_tool_calls: false, |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Video generation task-status tests cover active background task detection and |
| 2 | +// prompt/status text that prevents duplicate media generation requests. |
1 | 3 | import { beforeEach, describe, expect, it, vi } from "vitest"; |
2 | 4 | import { resetRecentMediaGenerationDuplicateGuardsForTests } from "./media-generation-task-status-shared.js"; |
3 | 5 | import { |
@@ -81,6 +83,8 @@ describe("video generation task status", () => {
|
81 | 83 | }); |
82 | 84 | |
83 | 85 | it("prefers a running task over queued session siblings", () => { |
| 86 | +// Running work should suppress duplicate generation even when older queued |
| 87 | +// siblings still exist for the same session owner. |
84 | 88 | taskRuntimeInternalMocks.listTasksForOwnerKey.mockReturnValue([ |
85 | 89 | { |
86 | 90 | taskId: "task-queued", |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// xAI live tests verify Grok completions, tool payload wrapping, and Grok web |
| 2 | +// search against the real provider when live credentials are enabled. |
1 | 3 | import { completeSimple, type Model, streamSimple } from "openclaw/plugin-sdk/llm"; |
2 | 4 | import { Type } from "typebox"; |
3 | 5 | import { describe, expect, it } from "vitest"; |
@@ -65,6 +67,8 @@ function requireLiveValue<T>(value: T | null | undefined, label: string): T {
|
65 | 67 | } |
66 | 68 | |
67 | 69 | async function runXaiLiveCase(label: string, run: () => Promise<void>): Promise<void> { |
| 70 | +// Live provider behavior can drift on billing/capacity; those environment |
| 71 | +// failures are skipped while real contract failures still throw. |
68 | 72 | try { |
69 | 73 | await run(); |
70 | 74 | } catch (error) { |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Z.ai live tests verify GLM completions against the real provider when live |
| 2 | +// credentials and live-test flags are enabled. |
1 | 3 | import { completeSimple, type Model } from "openclaw/plugin-sdk/llm"; |
2 | 4 | import { describe, expect, it } from "vitest"; |
3 | 5 | import { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。