refactor(plugin-sdk): add simple completion runtime entrypoint

This commit is contained in:
Peter Steinberger
2026-04-06 16:27:23 +01:00
parent 7785dc21e6
commit de20d3a024
7 changed files with 19 additions and 7 deletions

View File

@@ -1,2 +1,2 @@
23bfae10a189a7d0548bc7213a9180841bbb1125e97ce1d2d0b7a765773a92fd plugin-sdk-api-baseline.json
6c64b352b19368015c867b4c16225d676110544943497238c2f78602ad2fb519 plugin-sdk-api-baseline.jsonl
9883b1242051e830bafa7035351c9a2dd0fb84f81be28d7b5be2b69a1179e519 plugin-sdk-api-baseline.json
43dd28ba4502b207413d00471ea2e4ae5cf644922ab153387fa4bf99e540e6d1 plugin-sdk-api-baseline.jsonl

View File

@@ -1,5 +1,5 @@
import * as agentRuntimeModule from "openclaw/plugin-sdk/agent-runtime";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import * as agentRuntimeModule from "openclaw/plugin-sdk/simple-completion-runtime";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
const completeWithPreparedSimpleCompletionModelMock =

View File

@@ -1,10 +1,10 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
import {
completeWithPreparedSimpleCompletionModel,
extractAssistantText,
prepareSimpleCompletionModelForAgent,
} from "openclaw/plugin-sdk/agent-runtime";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
} from "openclaw/plugin-sdk/simple-completion-runtime";
const DEFAULT_THREAD_TITLE_TIMEOUT_MS = 10_000;
const MAX_THREAD_TITLE_SOURCE_CHARS = 600;

View File

@@ -247,6 +247,10 @@
"types": "./dist/plugin-sdk/agent-runtime.d.ts",
"default": "./dist/plugin-sdk/agent-runtime.js"
},
"./plugin-sdk/simple-completion-runtime": {
"types": "./dist/plugin-sdk/simple-completion-runtime.d.ts",
"default": "./dist/plugin-sdk/simple-completion-runtime.js"
},
"./plugin-sdk/speech-core": {
"types": "./dist/plugin-sdk/speech-core.d.ts",
"default": "./dist/plugin-sdk/speech-core.js"

View File

@@ -51,6 +51,7 @@
"text-runtime",
"text-chunking",
"agent-runtime",
"simple-completion-runtime",
"speech-core",
"plugin-runtime",
"security-runtime",

View File

@@ -26,6 +26,11 @@ type CompletionRuntimeCredential = {
type AllowedMissingApiKeyMode = ResolvedProviderAuth["mode"];
export type SimpleCompletionModelOptions = {
maxTokens?: number;
signal?: AbortSignal;
};
export type PreparedSimpleCompletionModel =
| {
model: Model<Api>;
@@ -236,7 +241,7 @@ export async function completeWithPreparedSimpleCompletionModel(params: {
model: Model<Api>;
auth: ResolvedProviderAuth;
context: Parameters<typeof complete>[1];
options?: Omit<Parameters<typeof complete>[2], "apiKey">;
options?: SimpleCompletionModelOptions;
}) {
return await complete(params.model, params.context, {
...params.options,

View File

@@ -0,0 +1,2 @@
export * from "../agents/simple-completion-runtime.js";
export { extractAssistantText } from "../agents/pi-embedded-utils.js";