@modelprofile.com/flexharness-agent 10.13.0 → 10.14.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_ts_agent/classes.sessionengine.d.ts +7 -0
- package/dist_ts_agent/classes.sessionengine.js +55 -5
- package/dist_ts_agent/index.d.ts +1 -1
- package/dist_ts_agent/index.js +1 -1
- package/dist_ts_agent/plugins.d.ts +5 -5
- package/dist_ts_agent/plugins.js +5 -5
- package/dist_ts_agent/smartagent.context.js +19 -19
- package/dist_ts_agent/smartagent.interfaces.d.ts +28 -7
- package/dist_ts_agent/smartagent.interfaces.js +1 -1
- package/package.json +2 -2
- package/readme.md +3 -2
- package/ts_agent/classes.sessionengine.ts +66 -7
- package/ts_agent/index.ts +2 -0
- package/ts_agent/plugins.ts +9 -2
- package/ts_agent/readme.md +3 -2
- package/ts_agent/smartagent.context.ts +17 -20
- package/ts_agent/smartagent.interfaces.ts +24 -4
|
@@ -108,16 +108,29 @@ export type TAgentModelCallUsage =
|
|
|
108
108
|
/** Receives the usage outcome of each model call. Must not throw. */
|
|
109
109
|
export type TAgentModelCallUsageReporter = (call: TAgentModelCallUsage) => void;
|
|
110
110
|
|
|
111
|
+
/** A model call's usage as the session delivers it: a reported call also states its cache hit ratio. */
|
|
112
|
+
export type TAgentObservedModelCallUsage =
|
|
113
|
+
| (Extract<TAgentModelCallUsage, { status: 'reported' }> & {
|
|
114
|
+
/**
|
|
115
|
+
* The share of the call's input the provider read from its prompt cache:
|
|
116
|
+
* `usage.cacheReadTokens / usage.inputTokens`, 0 for a call without input tokens.
|
|
117
|
+
*/
|
|
118
|
+
cacheHitRatio: number;
|
|
119
|
+
})
|
|
120
|
+
| Extract<TAgentModelCallUsage, { status: 'unreported' }>;
|
|
121
|
+
|
|
122
|
+
/** Where a call's usage belongs: a generation's model step, or a compaction. */
|
|
123
|
+
export type TAgentModelCallUsageSource =
|
|
124
|
+
| { source: 'generation'; generationId: string }
|
|
125
|
+
| { source: 'compaction'; generationId?: string };
|
|
126
|
+
|
|
111
127
|
/**
|
|
112
128
|
* The usage outcome of one model call of a session, reported once per call through `onUsage`.
|
|
113
129
|
* `source: 'generation'`: a model step of the generation `generationId`.
|
|
114
130
|
* `source: 'compaction'`: a model call of a context compaction. `generationId` names the generation
|
|
115
131
|
* whose context overflow caused it; it is absent for `compact()` and event retention.
|
|
116
132
|
*/
|
|
117
|
-
export type TAgentModelCallUsageEvent =
|
|
118
|
-
| { source: 'generation'; generationId: string }
|
|
119
|
-
| { source: 'compaction'; generationId?: string }
|
|
120
|
-
);
|
|
133
|
+
export type TAgentModelCallUsageEvent = TAgentObservedModelCallUsage & TAgentModelCallUsageSource;
|
|
121
134
|
|
|
122
135
|
export interface IAgentContextOverflowInvocationOptions {
|
|
123
136
|
abortSignal?: AbortSignal;
|
|
@@ -151,6 +164,13 @@ export interface IAgentContextCompactionOptions {
|
|
|
151
164
|
* applied. Send the compaction's model call with them.
|
|
152
165
|
*/
|
|
153
166
|
providerOptions?: ProviderOptions;
|
|
167
|
+
/**
|
|
168
|
+
* The tools the served generation's turns are sent with, on a `context-budget` compaction whose
|
|
169
|
+
* provider caches the prefix. Send the compaction's model call with their definitions, so it
|
|
170
|
+
* repeats the turns' cached prefix; it never runs them. A `context-overflow` compaction carries
|
|
171
|
+
* none: its summary needs the room they take.
|
|
172
|
+
*/
|
|
173
|
+
tools?: ToolSet;
|
|
154
174
|
/**
|
|
155
175
|
* Reports the usage of each model call the compactor makes, into the session's `onUsage` as
|
|
156
176
|
* `source: 'compaction'`. The session always supplies it. Report every call before the returned
|