Files
openclaw/extensions/tinyfish/index.test.ts
Simantak Dabhade b880118d2d feat: add TinyFish as bundled browser automation plugin (#58645)
* feat: add TinyFish as bundled browser automation plugin

Add a default-off bundled `tinyfish` plugin with one tool
(`tinyfish_automation`) for hosted browser automation of complex public
web workflows. Follows the existing plugin architecture pattern.

- Plugin entry, manifest with contracts, config schema, SecretRef support
- SSE stream parser with COMPLETE-terminal, SSRF guards, credential rejection
- Bundled skill with escalation guidance (web_fetch -> web_search -> tinyfish -> browser)
- Docs page, labeler rule, glossary entry, changelog entry
- 21 tests covering request serialization, auth, security, streaming, and error paths

Closes #41300

* plugins: address review feedback and regenerate baselines

- Split API_INTEGRATION into TINYFISH_API_INTEGRATION and CLIENT_SOURCE
  for semantic clarity (Greptile P2)
- Wrap post-finally parseEventBlock in try/catch so trailing malformed
  data does not mask "stream ended before COMPLETE" error (Greptile P2)
- Regenerate config-baseline and plugin-sdk-api-baseline for new plugin

---------

Co-authored-by: Simantak Dabhade <simantak@mac.local>
2026-04-02 01:46:05 -04:00

50 lines
1.4 KiB
TypeScript

import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
import { describe, expect, it, vi } from "vitest";
import plugin from "./index.js";
describe("tinyfish plugin registration", () => {
it("registers only the tinyfish_automation tool", () => {
const registerTool = vi.fn();
const api = {
id: "tinyfish",
name: "TinyFish",
description: "TinyFish",
source: "test",
registrationMode: "full",
config: {},
pluginConfig: {},
runtime: {} as never,
logger: { info() {}, warn() {}, error() {} },
registerTool,
registerHook() {},
registerHttpRoute() {},
registerChannel() {},
registerGatewayMethod() {},
registerCli() {},
registerService() {},
registerProvider() {},
registerSpeechProvider() {},
registerMediaUnderstandingProvider() {},
registerImageGenerationProvider() {},
registerWebSearchProvider() {},
registerInteractiveHandler() {},
registerCommand() {},
registerContextEngine() {},
registerMemoryPromptSection() {},
resolvePath(input: string) {
return input;
},
onConversationBindingResolved() {},
on() {},
} as unknown as OpenClawPluginApi;
plugin.register?.(api);
expect(registerTool).toHaveBeenCalledTimes(1);
expect(registerTool.mock.calls[0]?.[0]).toMatchObject({
name: "tinyfish_automation",
});
});
});