@modelprofile.com/flexharness 3.1.0 → 3.2.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/ts/errors.ts CHANGED
@@ -38,6 +38,13 @@ export class FlexHarnessSessionBusyError extends FlexHarnessError {
38
38
  }
39
39
  }
40
40
 
41
+ export class FlexHarnessQueueFullError extends FlexHarnessError {
42
+ constructor(message: string) {
43
+ super('FLEX_QUEUE_FULL', message);
44
+ this.name = 'FlexHarnessQueueFullError';
45
+ }
46
+ }
47
+
41
48
  export class FlexHarnessAbortError extends FlexHarnessError {
42
49
  constructor(message = 'The run was aborted.', options?: ErrorOptions) {
43
50
  super('FLEX_ABORTED', message, options);
package/ts/interfaces.ts CHANGED
@@ -157,6 +157,29 @@ export interface IFlexPromptOptions {
157
157
  maxSteps?: number;
158
158
  }
159
159
 
160
+ export type TFlexPromptQueueStatus =
161
+ | 'queued'
162
+ | 'starting'
163
+ | 'scheduled'
164
+ | 'running'
165
+ | 'completed'
166
+ | 'failed'
167
+ | 'cancelled';
168
+
169
+ export interface IFlexPromptQueueEntry {
170
+ queueId: string;
171
+ queueSequence: number;
172
+ scopeId: string;
173
+ sessionId: string;
174
+ status: TFlexPromptQueueStatus;
175
+ queuedAt: string;
176
+ runId?: string;
177
+ scheduleKey?: string;
178
+ startedAt?: string;
179
+ finishedAt?: string;
180
+ error?: IFlexErrorInfo;
181
+ }
182
+
160
183
  export interface IFlexPromptResult {
161
184
  runId: string;
162
185
  sessionId: string;
@@ -168,11 +191,15 @@ export interface IFlexPromptResult {
168
191
  steps: number;
169
192
  }
170
193
 
171
- export interface IFlexPromptAdmission {
172
- runId: string;
194
+ export interface IFlexPromptQueueAdmission {
195
+ queueId: string;
173
196
  completion: Promise<IFlexPromptResult>;
174
197
  }
175
198
 
199
+ export interface IFlexPromptAdmission extends IFlexPromptQueueAdmission {
200
+ runId: string;
201
+ }
202
+
176
203
  export interface IFlexSchedulePromptOptions extends IFlexPromptOptions {
177
204
  debounceMs?: number;
178
205
  }
@@ -366,6 +393,14 @@ export interface IFlexCallbackLimits {
366
393
  maxParts?: number;
367
394
  }
368
395
 
396
+ export interface IFlexPromptQueueLimits {
397
+ maxOutstandingPromptsPerSession?: number;
398
+ maxOutstandingBytesPerSession?: number;
399
+ maxPendingAdmissions?: number;
400
+ maxPendingAdmissionBytes?: number;
401
+ maxTerminalEntriesPerSession?: number;
402
+ }
403
+
369
404
  export type TFlexExternalErrorSource =
370
405
  | 'modelResolver'
371
406
  | 'toolProvider'
@@ -426,6 +461,7 @@ export interface IFlexHarnessOptions<TScope> {
426
461
  agentSessionPolicy?: IFlexAgentSessionPolicy;
427
462
  toolOutputLimits?: IFlexJsonLimits;
428
463
  callbackLimits?: IFlexCallbackLimits;
464
+ promptQueueLimits?: IFlexPromptQueueLimits;
429
465
  externalErrorProjector?: TFlexExternalErrorProjector;
430
466
  }
431
467
 
@@ -537,6 +573,13 @@ export interface IFlexRunFinishedEvent extends IFlexEventBase {
537
573
  readonly error?: IFlexErrorInfo;
538
574
  }
539
575
 
576
+ export interface IFlexPromptQueueEvent extends IFlexEventBase {
577
+ readonly type: 'prompt.queued' | 'prompt.started' | 'prompt.running' | 'prompt.finished';
578
+ readonly queueId: string;
579
+ readonly runId?: string;
580
+ readonly entry: IFlexPromptQueueEntry;
581
+ }
582
+
540
583
  export interface IFlexErrorInfo {
541
584
  name: string;
542
585
  message: string;
@@ -552,6 +595,7 @@ export type TFlexHarnessEvent =
552
595
  | IFlexPartChangedEvent
553
596
  | IFlexPermissionRequestedEvent
554
597
  | IFlexPermissionResolvedEvent
555
- | IFlexRunFinishedEvent;
598
+ | IFlexRunFinishedEvent
599
+ | IFlexPromptQueueEvent;
556
600
 
557
601
  export type TFlexHarnessEventListener = (event: TFlexHarnessEvent) => void;