@claritylabs/cl-sdk 1.3.1 → 1.3.2

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/README.md CHANGED
@@ -137,7 +137,7 @@ If your callback ignores those fields, the model will only see the text prompt.
137
137
 
138
138
  ## Model routing metadata
139
139
 
140
- Every SDK model callback may receive `taskKind`, `budgetDiagnostics`, and `trace`. Hosts can use these provider-agnostic fields for cheap-first routing, fallback, and telemetry without the SDK hardcoding model names. Example task kinds include `extraction_classify`, `extraction_focused`, `extraction_review`, `query_reason`, `application_extract_fields`, and `pce_impact_analysis`. `budgetDiagnostics` includes the resolved max-token budget and truncation-risk warnings for the current subtask. `trace` identifies the current extractor, page range, format batch, or source-backed call so host logs can show what was being generated instead of a generic model-call label.
140
+ Every SDK model callback may receive `taskKind`, `budgetDiagnostics`, and `trace`. Hosts can use these provider-agnostic fields for cheap-first routing, fallback, and telemetry without the SDK hardcoding model names. Example task kinds include `extraction_classify`, `extraction_focused`, `extraction_review`, `query_reason`, `application_extract_fields`, and `pce_impact_analysis`. `budgetDiagnostics` includes the resolved output-token cap, the lower preferred task budget, and truncation-risk warnings for the current subtask. When model capabilities include `maxOutputTokens`, the SDK uses that model maximum as the request cap instead of treating low task preferences as hard limits. `trace` identifies the current extractor, page range, format batch, or source-backed call so host logs can show what was being generated instead of a generic model-call label.
141
141
 
142
142
  ## Bounded Agentic Workflows
143
143
 
package/dist/index.d.mts CHANGED
@@ -41,6 +41,7 @@ interface ModelBudgetResolution {
41
41
  taskKind: ModelTaskKind;
42
42
  maxTokens: number;
43
43
  hintTokens: number;
44
+ preferredOutputTokens?: number;
44
45
  modelMaxOutputTokens?: number;
45
46
  hardMaxOutputTokens?: number;
46
47
  estimatedInputTokens?: number;
package/dist/index.d.ts CHANGED
@@ -41,6 +41,7 @@ interface ModelBudgetResolution {
41
41
  taskKind: ModelTaskKind;
42
42
  maxTokens: number;
43
43
  hintTokens: number;
44
+ preferredOutputTokens?: number;
44
45
  modelMaxOutputTokens?: number;
45
46
  hardMaxOutputTokens?: number;
46
47
  estimatedInputTokens?: number;
package/dist/index.js CHANGED
@@ -559,7 +559,8 @@ function resolveModelBudget(params) {
559
559
  const schemaTokens = estimateTokens(params.schemaSizeBytes) ?? 0;
560
560
  const expectedListLength = positiveInteger(params.expectedListLength) ?? 0;
561
561
  const warnings = [];
562
- let maxTokens = constrainedPreference ?? taskCapability ?? longListCapability ?? defaultCapability ?? hintTokens;
562
+ const preferredOutputTokens = constrainedPreference ?? taskCapability ?? longListCapability ?? defaultCapability ?? hintTokens;
563
+ let maxTokens = hardMaxOutputTokens ?? modelMaxOutputTokens ?? preferredOutputTokens;
563
564
  if (minOutputTokens) {
564
565
  maxTokens = Math.max(maxTokens, minOutputTokens);
565
566
  }
@@ -588,6 +589,7 @@ function resolveModelBudget(params) {
588
589
  taskKind,
589
590
  maxTokens,
590
591
  hintTokens,
592
+ preferredOutputTokens,
591
593
  modelMaxOutputTokens,
592
594
  hardMaxOutputTokens,
593
595
  estimatedInputTokens,