@dugleelabs/copair 1.7.0 → 1.8.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/api.d.ts CHANGED
@@ -81,6 +81,10 @@ declare const ProviderConfigSchema: z.ZodObject<{
81
81
  }, z.core.$strip>>;
82
82
  timeout_ms: z.ZodOptional<z.ZodNumber>;
83
83
  }, z.core.$strip>;
84
+ declare const SmallModelsConfigSchema: z.ZodObject<{
85
+ model_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
86
+ max_tool_calls: z.ZodOptional<z.ZodNumber>;
87
+ }, z.core.$strip>;
84
88
  declare const CopairConfigSchema: z.ZodObject<{
85
89
  version: z.ZodNumber;
86
90
  default_model: z.ZodOptional<z.ZodString>;
@@ -172,9 +176,14 @@ declare const CopairConfigSchema: z.ZodObject<{
172
176
  web_search_timeout_ms: z.ZodDefault<z.ZodNumber>;
173
177
  provider_timeout_ms: z.ZodDefault<z.ZodNumber>;
174
178
  }, z.core.$strip>>;
179
+ small_models: z.ZodOptional<z.ZodObject<{
180
+ model_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
181
+ max_tool_calls: z.ZodOptional<z.ZodNumber>;
182
+ }, z.core.$strip>>;
175
183
  }, z.core.$strip>;
176
184
  type CopairConfig = z.infer<typeof CopairConfigSchema>;
177
185
  type ProviderConfig = z.infer<typeof ProviderConfigSchema>;
186
+ type SmallModelsConfig = z.infer<typeof SmallModelsConfigSchema>;
178
187
 
179
188
  type ProviderFactory = (config: ProviderConfig, model: string) => Provider;
180
189
  declare class ProviderRegistry {
@@ -348,9 +357,18 @@ interface AgentBridgeEvents {
348
357
  'thinking-stop': () => void;
349
358
  'turn-complete': () => void;
350
359
  'error': (message: string) => void;
351
- 'input-request': (respond: (input: string) => void) => void;
360
+ 'input-request': (prompt: string, respond: (input: string) => void) => void;
352
361
  'context-limit-warning': () => void;
353
362
  'context-limit-action': (respond: (action: 'compact' | 'abort') => void) => void;
363
+ 'task-complete': (data: {
364
+ summary: string;
365
+ }) => void;
366
+ 'max-turn-warning': (data: {
367
+ limit: number;
368
+ }) => void;
369
+ 'unclear-signal': (data: {
370
+ message: string;
371
+ }) => void;
354
372
  }
355
373
  type EventName = keyof AgentBridgeEvents;
356
374
  /**
@@ -712,8 +730,43 @@ declare class ConversationManager {
712
730
  static fromJSONL(data: string): Message[];
713
731
  }
714
732
 
733
+ interface ParsedToolCall {
734
+ id: string;
735
+ name: string;
736
+ arguments: string;
737
+ }
738
+ interface ToolCallFormatter {
739
+ readonly name: string;
740
+ readonly markupPattern: RegExp;
741
+ /** Opening tag for streaming suppression (e.g. `<tool_call>`). When set,
742
+ * the renderer buffers across chunks instead of applying a per-chunk regex. */
743
+ readonly openTag?: string;
744
+ readonly closeTag?: string;
745
+ /** When true, the streaming filter also suppresses all text that follows the
746
+ * first complete tool-call block in a response. Use for models that
747
+ * hallucinate post-tool text (e.g. "It seems there was an issue…"). */
748
+ readonly suppressAfterMatch?: boolean;
749
+ parse(text: string): {
750
+ toolCalls: ParsedToolCall[];
751
+ remainingText: string;
752
+ };
753
+ buildSystemPrompt(tools: ToolDefinition$1[]): string;
754
+ /** Return a minimal example tool call in this formatter's markup language. */
755
+ exampleCall(): string;
756
+ }
757
+
715
758
  type FormatName = 'dsml' | 'qwen-xml' | 'fenced-block';
716
759
 
760
+ declare class SmallModelHarness {
761
+ readonly isSmallModel: boolean;
762
+ private config;
763
+ constructor(modelId: string, config?: SmallModelsConfig, forceOverride?: boolean);
764
+ get maxToolCalls(): number;
765
+ getSystemPromptAddition(): string | null;
766
+ getPerTurnReminder(): string | null;
767
+ getFormatHint(formatter: ToolCallFormatter): string | null;
768
+ }
769
+
717
770
  interface AgentOptions {
718
771
  systemPrompt?: string;
719
772
  maxTokens?: number;
@@ -723,6 +776,7 @@ interface AgentOptions {
723
776
  pluginManager?: PluginManager;
724
777
  /** Fraction of maxTokens at which to warn about context limit (0–1, default 0.9). */
725
778
  contextLimitThresholdPct?: number;
779
+ harness?: SmallModelHarness;
726
780
  }
727
781
  declare class Agent {
728
782
  private provider;
@@ -736,6 +790,7 @@ declare class Agent {
736
790
  private formatter;
737
791
  private textFilter;
738
792
  private pluginManager?;
793
+ private harness?;
739
794
  constructor(provider: Provider, model: string, toolRegistry: ToolRegistry, executor: ToolExecutor, options?: AgentOptions);
740
795
  get model(): string;
741
796
  getConversation(): ConversationManager;
@@ -752,6 +807,8 @@ declare class Agent {
752
807
  /** Input tokens from the last API call — reflects actual context window usage. */
753
808
  lastInputTokens: number;
754
809
  }>;
810
+ /** Prompt the user for input and return their answer (used by ask_user intercept). */
811
+ private collectUserAnswer;
755
812
  /**
756
813
  * Detect whether the model likely hit its context limit this turn.
757
814
  * Two signals: