mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 17:40:44 +00:00
refactor: tighten plugin runtime sdk boundaries
This commit is contained in:
@@ -62,7 +62,18 @@ Internal OpenClaw runtime code has the same direction: load config once at the C
|
||||
const identity = api.runtime.agent.resolveAgentIdentity(cfg);
|
||||
|
||||
// Get default thinking level
|
||||
const thinking = api.runtime.agent.resolveThinkingDefault(cfg, provider, model);
|
||||
const thinking = api.runtime.agent.resolveThinkingDefault({
|
||||
cfg,
|
||||
provider,
|
||||
model,
|
||||
});
|
||||
|
||||
// Validate a user-provided thinking level against the active provider profile
|
||||
const policy = api.runtime.agent.resolveThinkingPolicy({ provider, model });
|
||||
const level = api.runtime.agent.normalizeThinkingLevel("extra high");
|
||||
if (level && policy.levels.some((entry) => entry.id === level)) {
|
||||
// pass level to an embedded run
|
||||
}
|
||||
|
||||
// Get agent timeout
|
||||
const timeoutMs = api.runtime.agent.resolveAgentTimeoutMs(cfg);
|
||||
@@ -86,6 +97,10 @@ Internal OpenClaw runtime code has the same direction: load config once at the C
|
||||
|
||||
`runEmbeddedPiAgent(...)` remains as a compatibility alias.
|
||||
|
||||
`resolveThinkingPolicy(...)` returns the provider/model's supported thinking levels and optional default. Provider plugins own the model-specific profile through their thinking hooks, so tool plugins should call this runtime helper instead of importing or duplicating provider lists.
|
||||
|
||||
`normalizeThinkingLevel(...)` converts user text such as `on`, `x-high`, or `extra high` to the canonical stored level before checking it against the resolved policy.
|
||||
|
||||
**Session store helpers** are under `api.runtime.agent.session`:
|
||||
|
||||
```typescript
|
||||
|
||||
Reference in New Issue
Block a user