@noetaris/harness-types 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +17 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -49,11 +49,24 @@ interface ToolCall {
|
|
|
49
49
|
*
|
|
50
50
|
* `text` may be empty when `stopReason` is `'tool_use'`.
|
|
51
51
|
* `toolCalls` is empty when `stopReason` is `'end'` or `'max_tokens'`.
|
|
52
|
+
* `usage` is always present — all adapters must populate it.
|
|
52
53
|
*/
|
|
53
54
|
interface LLMResponse {
|
|
54
55
|
text: string;
|
|
55
56
|
toolCalls: ToolCall[];
|
|
56
57
|
stopReason: 'end' | 'tool_use' | 'max_tokens';
|
|
58
|
+
usage: {
|
|
59
|
+
/** Number of input tokens consumed by this call. */
|
|
60
|
+
inputTokens: number;
|
|
61
|
+
/** Number of output tokens generated by this call. */
|
|
62
|
+
outputTokens: number;
|
|
63
|
+
/**
|
|
64
|
+
* The model's total context window capacity in tokens.
|
|
65
|
+
* Present only when the adapter can determine it.
|
|
66
|
+
* Absent when the adapter cannot determine capacity.
|
|
67
|
+
*/
|
|
68
|
+
contextWindowSize?: number;
|
|
69
|
+
};
|
|
57
70
|
}
|
|
58
71
|
/**
|
|
59
72
|
* Payload emitted by LLM adapters as an `"llm.request"` observer event,
|
|
@@ -70,11 +83,13 @@ interface LLMRequestEvent {
|
|
|
70
83
|
tools?: unknown;
|
|
71
84
|
}
|
|
72
85
|
/**
|
|
73
|
-
* Token-usage payload emitted by LLM adapters as an `llm.response` observer event.
|
|
86
|
+
* Token-usage payload emitted by LLM adapters as an `"llm.response"` observer event.
|
|
74
87
|
*
|
|
75
88
|
* Adapters that cannot report real token counts (e.g. mock adapters) emit `{ input: 0, output: 0 }`.
|
|
76
89
|
*
|
|
77
90
|
* `output` is opt-in — it may contain sensitive data; adapters default to omitting it.
|
|
91
|
+
* `contextWindowSize` mirrors `LLMResponse.usage.contextWindowSize` — present when the
|
|
92
|
+
* adapter can determine it; absent otherwise.
|
|
78
93
|
*/
|
|
79
94
|
interface LLMUsageEvent {
|
|
80
95
|
tokens: {
|
|
@@ -85,6 +100,7 @@ interface LLMUsageEvent {
|
|
|
85
100
|
stopReason: LLMResponse['stopReason'];
|
|
86
101
|
providerName: string;
|
|
87
102
|
output?: unknown;
|
|
103
|
+
contextWindowSize?: number;
|
|
88
104
|
}
|
|
89
105
|
/**
|
|
90
106
|
* Payload emitted on `"tool.call"` before a tool is dispatched.
|