refactor(agents): narrow runner harness helper types · openclaw/openclaw@cbf6f00
vincentkoc
·
2026-06-17
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -12,7 +12,7 @@ import type { FailoverReason } from "../../embedded-agent-helpers.js";
|
12 | 12 | import { log } from "../logger.js"; |
13 | 13 | |
14 | 14 | /** Structured fields emitted whenever embedded run failover chooses an action. */ |
15 | | -export type FailoverDecisionLoggerInput = { |
| 15 | +type FailoverDecisionLoggerInput = { |
16 | 16 | stage: "prompt" | "assistant"; |
17 | 17 | decision: "rotate_profile" | "fallback_model" | "surface_error"; |
18 | 18 | runId?: string; |
@@ -31,7 +31,7 @@ export type FailoverDecisionLoggerInput = {
|
31 | 31 | }; |
32 | 32 | |
33 | 33 | /** Stable context captured before a concrete failover decision is known. */ |
34 | | -export type FailoverDecisionLoggerBase = Omit<FailoverDecisionLoggerInput, "decision" | "status">; |
| 34 | +type FailoverDecisionLoggerBase = Omit<FailoverDecisionLoggerInput, "decision" | "status">; |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Derives timeout failure reasons for logs that were built from timeout state |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -84,15 +84,15 @@ export type TraceAttempt = {
|
84 | 84 | status?: number; |
85 | 85 | }; |
86 | 86 | |
87 | | -export type ExecutionTrace = { |
| 87 | +type ExecutionTrace = { |
88 | 88 | winnerProvider?: string; |
89 | 89 | winnerModel?: string; |
90 | 90 | attempts?: TraceAttempt[]; |
91 | 91 | fallbackUsed?: boolean; |
92 | 92 | runner?: "embedded" | "cli"; |
93 | 93 | }; |
94 | 94 | |
95 | | -export type RequestShapingTrace = { |
| 95 | +type RequestShapingTrace = { |
96 | 96 | authMode?: string; |
97 | 97 | thinking?: string; |
98 | 98 | reasoning?: string; |
@@ -102,7 +102,7 @@ export type RequestShapingTrace = {
|
102 | 102 | blockStreaming?: string; |
103 | 103 | }; |
104 | 104 | |
105 | | -export type PromptSegmentTrace = { |
| 105 | +type PromptSegmentTrace = { |
106 | 106 | key: string; |
107 | 107 | chars: number; |
108 | 108 | }; |
@@ -114,13 +114,13 @@ export type ToolSummaryTrace = {
|
114 | 114 | totalToolTimeMs?: number; |
115 | 115 | }; |
116 | 116 | |
117 | | -export type CompletionTrace = { |
| 117 | +type CompletionTrace = { |
118 | 118 | finishReason?: string; |
119 | 119 | stopReason?: string; |
120 | 120 | refusal?: boolean; |
121 | 121 | }; |
122 | 122 | |
123 | | -export type ContextManagementTrace = { |
| 123 | +type ContextManagementTrace = { |
124 | 124 | sessionCompactions?: number; |
125 | 125 | lastTurnCompactions?: number; |
126 | 126 | preflightCompactionApplied?: boolean; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -145,7 +145,7 @@ export async function awaitAgentHarnessAgentEndHook(params: {
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** Normalized before-finalize hook decision consumed by harness loops. */ |
148 | | -export type AgentHarnessBeforeAgentFinalizeOutcome = |
| 148 | +type AgentHarnessBeforeAgentFinalizeOutcome = |
149 | 149 | | { action: "continue" } |
150 | 150 | | { action: "revise"; reason: string } |
151 | 151 | | { action: "finalize"; reason?: string }; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -18,7 +18,7 @@ import { buildAgentHookContext, type AgentHarnessHookContext } from "./hook-cont
|
18 | 18 | const log = createSubsystemLogger("agents/harness"); |
19 | 19 | |
20 | 20 | /** Prompt/developer-instruction pair after harness prompt-build hooks run. */ |
21 | | -export type AgentHarnessPromptBuildResult = { |
| 21 | +type AgentHarnessPromptBuildResult = { |
22 | 22 | prompt: string; |
23 | 23 | developerInstructions: string; |
24 | 24 | }; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -83,7 +83,7 @@ export type AgentHarnessDeliveryDefaults = {
|
83 | 83 | sourceVisibleReplies?: "automatic" | "message_tool"; |
84 | 84 | }; |
85 | 85 | |
86 | | -export type AgentHarnessRunCapability = { |
| 86 | +type AgentHarnessRunCapability = { |
87 | 87 | id: string; |
88 | 88 | label: string; |
89 | 89 | pluginId?: string; |
@@ -98,22 +98,22 @@ export type AgentHarnessRunCapability = {
|
98 | 98 | runAttempt(params: AgentHarnessAttemptParams): Promise<AgentHarnessAttemptResult>; |
99 | 99 | }; |
100 | 100 | |
101 | | -export type AgentHarnessSideQuestionCapability = { |
| 101 | +type AgentHarnessSideQuestionCapability = { |
102 | 102 | runSideQuestion?(params: AgentHarnessSideQuestionParams): Promise<AgentHarnessSideQuestionResult>; |
103 | 103 | }; |
104 | 104 | |
105 | | -export type AgentHarnessClassificationCapability = { |
| 105 | +type AgentHarnessClassificationCapability = { |
106 | 106 | classify?( |
107 | 107 | result: AgentHarnessAttemptResult, |
108 | 108 | ctx: AgentHarnessAttemptParams, |
109 | 109 | ): AgentHarnessResultClassification | undefined; |
110 | 110 | }; |
111 | 111 | |
112 | | -export type AgentHarnessCompactionCapability = { |
| 112 | +type AgentHarnessCompactionCapability = { |
113 | 113 | compact?(params: AgentHarnessCompactParams): Promise<AgentHarnessCompactResult | undefined>; |
114 | 114 | }; |
115 | 115 | |
116 | | -export type AgentHarnessSessionLifecycleCapability = { |
| 116 | +type AgentHarnessSessionLifecycleCapability = { |
117 | 117 | reset?(params: AgentHarnessResetParams): Promise<void> | void; |
118 | 118 | dispose?(): Promise<void> | void; |
119 | 119 | }; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。