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