Files
openclaw/extensions/llm-task/index.ts
Peter Steinberger d92b3b5cc2 refactor: unify OpenAI provider identity
Refactor OpenAI provider identity so OpenAI remains the canonical provider for API-key and OAuth-backed flows while legacy openai-codex state is doctor/migration-only.

Keeps OpenAI Codex Responses as an API/transport class rather than a provider identity, moves auth aliases through providerAuthAliases, updates doctor repair sequencing for old auth/profile state, and refreshes tests/docs around the canonical OpenAI behavior.
2026-05-30 11:48:41 +02:00

34 lines
1.2 KiB
TypeScript

import { optionalPositiveIntegerSchema } from "openclaw/plugin-sdk/channel-actions";
import { defineToolPlugin } from "openclaw/plugin-sdk/tool-plugin";
import { Type } from "typebox";
import type { AnyAgentTool } from "./api.js";
import { createLlmTaskTool, llmTaskToolDefinition } from "./src/llm-task-tool.js";
export default defineToolPlugin({
id: "llm-task",
name: "LLM Task",
description: "Generic JSON-only LLM tool for structured tasks callable from workflows.",
configSchema: Type.Object(
{
defaultProvider: Type.Optional(Type.String()),
defaultModel: Type.Optional(Type.String()),
defaultAuthProfileId: Type.Optional(Type.String()),
allowedModels: Type.Optional(
Type.Array(Type.String(), {
description: "Allowlist of provider/model keys like openai/gpt-5.5.",
}),
),
maxTokens: optionalPositiveIntegerSchema(),
timeoutMs: optionalPositiveIntegerSchema(),
},
{ additionalProperties: false },
),
tools: (tool) => [
tool({
...llmTaskToolDefinition,
optional: true,
factory: ({ api }) => createLlmTaskTool(api) as unknown as AnyAgentTool,
}),
],
});