Files
openclaw/src/plugin-sdk/agent-core.ts
Peter Steinberger dde90a345a refactor(plugin-sdk): narrow wildcard barrels to explicit used exports (#108440)
* refactor(plugin-sdk): narrow wildcard barrels to explicit used exports

* refactor(tools): delete dead tool-planning module exposed by barrel narrowing

* fix(plugin-sdk): restore deprecation tag on OpenClawSchemaType alias

* test(agents): drop test for deleted runtime proxy module

* refactor(tools): trim descriptor types to cache consumers

* refactor(deadcode): harvest exports orphaned by barrel narrowing

* refactor(deadcode): harvest exports orphaned by barrel narrowing (rest)

* fix(agents): restore sdk imports and test markers via public predicate

* fix(plugin-sdk): named type re-exports in plugin-entry; trim types barrel precisely

* chore(plugin-sdk): account unmasked deprecated provider types in budgets

* fix(plugins): name star-only type rows for dts bundling

* fix(plugins): restore host-hook surface; unexport internal api compositions

* fix(plugins): named type imports for api composition; restore needed source exports

* fix(plugins): knip-visible type imports for registry surfaces

* test: adapt tests to privatized media and command internals

* fix(qa-lab): re-export snapshot conversation type

* style: format sessions sdk imports

* fix(plugins): restore smoke entry export; pin budgets to exact actuals

* fix(plugins): canonical smoke-entry import; drop orphaned root shims

* fix(plugins): allowlist manifest probe, repoint qa web import, drop dead browser barrels

* fix(plugin-sdk): pin codex auth marker and scaffold provider type

* fix(qa-lab): keep web-facing model-selection shim within boundary rules

* fix(plugin-sdk): preserve merged contracts through narrowed barrels

* chore(plugin-sdk): pin post-rebase surface budgets
2026-07-16 00:45:23 -07:00

81 lines
2.5 KiB
TypeScript

// Agent core contracts define the minimal plugin-facing agent request and response shapes.
import {
Agent as CoreAgent,
type AgentOptions as CoreAgentOptions,
} from "../../packages/agent-core/src/agent.js";
import type { AgentCoreRuntimeDeps } from "../../packages/agent-core/src/runtime-deps.js";
import type { CompleteSimpleFn, StreamFn } from "../../packages/llm-core/src/index.js";
import { completeSimple, streamSimple } from "./llm.js";
/** Runtime adapter that lets the package agent-core use OpenClaw LLM helpers. */
export const openClawAgentCoreRuntime = {
completeSimple: completeSimple as unknown as CompleteSimpleFn,
streamSimple: streamSimple as unknown as StreamFn,
} satisfies AgentCoreRuntimeDeps;
/** Agent-core class preconfigured with OpenClaw runtime dependencies. */
export class Agent extends CoreAgent {
constructor(options: CoreAgentOptions = {}) {
super({ runtime: openClawAgentCoreRuntime, ...options });
}
}
// OpenClaw-owned reusable agent core
export { runAgentLoop } from "../../packages/agent-core/src/index.js";
// Documented proxy stream API stays until this entrypoint's announced
// public demotion window (registry: plugin-sdk-agent-core-public-demotion).
export { streamProxy } from "../agents/runtime/proxy.js";
export type { ProxyAssistantMessageEvent, ProxyStreamOptions } from "../agents/runtime/proxy.js";
export {
bashExecutionToText,
buildSessionContext,
calculateContextTokens,
collectEntriesForBranchSummaryFromBranches,
compact,
estimateContextTokens,
estimateTokens,
findCutPoint,
findTurnStartIndex,
generateBranchSummary,
generateSummary,
getLastAssistantUsage,
prepareBranchEntries,
prepareCompaction,
serializeConversation,
shouldCompact,
uuidv7,
BRANCH_SUMMARY_PREFIX,
BRANCH_SUMMARY_SUFFIX,
COMPACTION_SUMMARY_PREFIX,
COMPACTION_SUMMARY_SUFFIX,
DEFAULT_COMPACTION_SETTINGS,
} from "../../packages/agent-core/src/index.js";
export type {
AfterToolCallResult,
AgentEvent,
AgentMessage,
AfterToolCallContext,
AgentOptions,
AgentState,
AgentTool,
AgentToolProgress,
AgentToolResult,
AgentToolUpdateCallback,
BashExecutionMessage,
BranchPreparation,
BranchSummaryDetails,
BranchSummaryResult,
CompactionDetails,
CompactionPreparation,
CompactionResult,
CompactionSettings,
ContextUsageEstimate,
FileOperations,
Result,
SessionTreeEntry,
StreamFn,
ThinkingLevel,
ToolExecutionMode,
} from "../../packages/agent-core/src/index.js";
// Proxy utilities