docs: document core agent tool tests

This commit is contained in:
Peter Steinberger
2026-06-04 16:37:10 -04:00
parent 5c71f2190b
commit d5ce1edf7e
4 changed files with 18 additions and 0 deletions
+4
View File
@@ -1,3 +1,5 @@
// Message tool tests cover channel action discovery, secret scoping, and
// outbound message execution context.
import { Type } from "typebox";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import type { ChannelMessageAdapterShape } from "../../channels/message/types.js";
@@ -144,6 +146,8 @@ function latestSecretResolveCall(): {
if (!call) {
throw new Error("expected secret resolution call");
}
// Secret resolution is scoped to the active channel/account; tests inspect
// the exact target set to avoid broad credential reads.
return call[0] as {
allowedPaths?: Set<string>;
config?: unknown;
@@ -1,3 +1,5 @@
// skill_workshop tests cover proposal creation/revision/listing without
// applying generated skills to the workspace.
import fs from "node:fs/promises";
import path from "node:path";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
@@ -63,6 +65,8 @@ describe("skill_workshop tool", () => {
});
it("creates pending skill proposals without applying them", async () => {
// Creation writes reviewable proposal artifacts under state, not live skill
// files in the workspace.
const workspaceDir = await tempDirs.make("openclaw-skill-workshop-tool-");
const tool = createSkillWorkshopTool({
workspaceDir,
+4
View File
@@ -1,8 +1,12 @@
// Subagents tool tests cover requester-scoped listing guidance and numeric
// status-window validation.
import { describe, expect, it } from "vitest";
import { createSubagentsTool } from "./subagents-tool.js";
describe("subagents tool", () => {
it("does not advertise sessions_yield as unconditionally available", () => {
// sessions_yield is context-dependent; the model-facing description should
// not promise it exists in every runtime.
const tool = createSubagentsTool();
expect(tool.description).toBe(
@@ -1,3 +1,5 @@
// Transcripts tool tests cover manual imports, live provider lifecycle, summary
// artifacts, and date-qualified session selectors.
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
@@ -101,6 +103,8 @@ describe("transcripts tool", () => {
});
it("bounds summary input while retaining the full transcript", async () => {
// Summary generation uses a bounded utterance window, but the durable JSONL
// transcript must retain every utterance.
const stateDir = await makeStateDir();
const { tool } = await createHarness(stateDir, { maxUtterances: 1 });
@@ -159,6 +163,8 @@ describe("transcripts tool", () => {
});
it("stops date-qualified active sessions with the canonical provider session id", async () => {
// Date-qualified selectors disambiguate storage paths; providers still own
// the original session id.
const stateDir = await makeStateDir();
const start = vi.fn(async (request) => {
await request.onUtterance({