docs: document core agent tool tests · openclaw/openclaw@d5ce1ed
steipete
·
2026-06-05
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Message tool tests cover channel action discovery, secret scoping, and |
| 2 | +// outbound message execution context. |
1 | 3 | import { Type } from "typebox"; |
2 | 4 | import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; |
3 | 5 | import type { ChannelMessageAdapterShape } from "../../channels/message/types.js"; |
@@ -144,6 +146,8 @@ function latestSecretResolveCall(): {
|
144 | 146 | if (!call) { |
145 | 147 | throw new Error("expected secret resolution call"); |
146 | 148 | } |
| 149 | +// Secret resolution is scoped to the active channel/account; tests inspect |
| 150 | +// the exact target set to avoid broad credential reads. |
147 | 151 | return call[0] as { |
148 | 152 | allowedPaths?: Set<string>; |
149 | 153 | config?: unknown; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// skill_workshop tests cover proposal creation/revision/listing without |
| 2 | +// applying generated skills to the workspace. |
1 | 3 | import fs from "node:fs/promises"; |
2 | 4 | import path from "node:path"; |
3 | 5 | import { afterEach, beforeEach, describe, expect, it } from "vitest"; |
@@ -63,6 +65,8 @@ describe("skill_workshop tool", () => {
|
63 | 65 | }); |
64 | 66 | |
65 | 67 | it("creates pending skill proposals without applying them", async () => { |
| 68 | +// Creation writes reviewable proposal artifacts under state, not live skill |
| 69 | +// files in the workspace. |
66 | 70 | const workspaceDir = await tempDirs.make("openclaw-skill-workshop-tool-"); |
67 | 71 | const tool = createSkillWorkshopTool({ |
68 | 72 | workspaceDir, |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Subagents tool tests cover requester-scoped listing guidance and numeric |
| 2 | +// status-window validation. |
1 | 3 | import { describe, expect, it } from "vitest"; |
2 | 4 | import { createSubagentsTool } from "./subagents-tool.js"; |
3 | 5 | |
4 | 6 | describe("subagents tool", () => { |
5 | 7 | it("does not advertise sessions_yield as unconditionally available", () => { |
| 8 | +// sessions_yield is context-dependent; the model-facing description should |
| 9 | +// not promise it exists in every runtime. |
6 | 10 | const tool = createSubagentsTool(); |
7 | 11 | |
8 | 12 | expect(tool.description).toBe( |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Transcripts tool tests cover manual imports, live provider lifecycle, summary |
| 2 | +// artifacts, and date-qualified session selectors. |
1 | 3 | import fs from "node:fs/promises"; |
2 | 4 | import os from "node:os"; |
3 | 5 | import path from "node:path"; |
@@ -101,6 +103,8 @@ describe("transcripts tool", () => {
|
101 | 103 | }); |
102 | 104 | |
103 | 105 | it("bounds summary input while retaining the full transcript", async () => { |
| 106 | +// Summary generation uses a bounded utterance window, but the durable JSONL |
| 107 | +// transcript must retain every utterance. |
104 | 108 | const stateDir = await makeStateDir(); |
105 | 109 | const { tool } = await createHarness(stateDir, { maxUtterances: 1 }); |
106 | 110 | |
@@ -159,6 +163,8 @@ describe("transcripts tool", () => {
|
159 | 163 | }); |
160 | 164 | |
161 | 165 | it("stops date-qualified active sessions with the canonical provider session id", async () => { |
| 166 | +// Date-qualified selectors disambiguate storage paths; providers still own |
| 167 | +// the original session id. |
162 | 168 | const stateDir = await makeStateDir(); |
163 | 169 | const start = vi.fn(async (request) => { |
164 | 170 | await request.onUtterance({ |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。