@apo-ai/sdk 0.13.0 → 0.15.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/README.md CHANGED
@@ -250,8 +250,11 @@ For apo tasks the flow is built automatically from the run's trace
250
250
  projection — no extra wiring.
251
251
 
252
252
  **`t.judge(value, instruction)` — LLM-backed assertions.** Configure the judge
253
- with `runTask(dir, { judge: { model, apiKey?, baseURL? } })`, or set
254
- `OPENROUTER_MODEL`/`OPENAI_MODEL` for the CLI runtime. Judge verdicts use the
253
+ with `runTask(dir, { judge: { model, apiKey?, baseURL?, provider? } })`, or set
254
+ `OPENROUTER_MODEL`/`OPENAI_MODEL`/`ANTHROPIC_MODEL` for the CLI runtime. A bare
255
+ `claude-*` model id (or an Anthropic base URL) switches the call to the
256
+ Anthropic Messages wire, authenticated with `ANTHROPIC_API_KEY` or
257
+ `ANTHROPIC_AUTH_TOKEN`. Judge verdicts use the
255
258
  same recorder and result format as code assertions, including model, prompt,
256
259
  response, token usage, and latency metadata.
257
260
 
@@ -1,4 +1,4 @@
1
- import { A as AgentTaskTraceContext } from '../../tracing-FqFObrmt.js';
1
+ import { A as AgentTaskTraceContext } from '../../tracing-CEucJqQI.js';
2
2
 
3
3
  /**
4
4
  * Vercel AI SDK tracing integration for apo.
@@ -1,4 +1,4 @@
1
- import { A as AgentTaskTraceContext } from '../../tracing-FqFObrmt.js';
1
+ import { A as AgentTaskTraceContext } from '../../tracing-CEucJqQI.js';
2
2
 
3
3
  /**
4
4
  * Anthropic JS SDK tracing integration for apo.
@@ -2,8 +2,8 @@
2
2
  // Do not edit by hand — edit the src/ originals and rebuild.
3
3
  import {
4
4
  createApoAnthropic
5
- } from "../../chunk-X73JGMK3.js";
6
- import "../../chunk-JTWQD27M.js";
5
+ } from "../../chunk-4BQSCD6T.js";
6
+ import "../../chunk-JN7RHBTS.js";
7
7
  export {
8
8
  createApoAnthropic
9
9
  };
@@ -1,4 +1,4 @@
1
- import { A as AgentTaskTraceContext } from '../../tracing-FqFObrmt.js';
1
+ import { A as AgentTaskTraceContext } from '../../tracing-CEucJqQI.js';
2
2
 
3
3
  /**
4
4
  * OpenAI JS SDK tracing integration for apo.
@@ -56,6 +56,9 @@ interface OpenAIClientLike {
56
56
  chat: {
57
57
  completions: {
58
58
  create: (...args: any[]) => Promise<any>;
59
+ withRawResponse?: {
60
+ create: (...args: any[]) => Promise<any>;
61
+ };
59
62
  };
60
63
  };
61
64
  [key: string]: any;
@@ -2,8 +2,8 @@
2
2
  // Do not edit by hand — edit the src/ originals and rebuild.
3
3
  import {
4
4
  createApoOpenAI
5
- } from "../../chunk-A3UYQ7M4.js";
6
- import "../../chunk-JTWQD27M.js";
5
+ } from "../../chunk-NSMKSPBU.js";
6
+ import "../../chunk-JN7RHBTS.js";
7
7
  export {
8
8
  createApoOpenAI
9
9
  };
@@ -1,4 +1,4 @@
1
- import { A as AgentTaskTraceContext, a as AgentTaskTraceOptions } from '../tracing-FqFObrmt.js';
1
+ import { A as AgentTaskTraceContext, a as AgentTaskTraceOptions } from '../tracing-CEucJqQI.js';
2
2
  export { CreateApoTracerOptions, createApoTracer } from './integrations/ai-sdk.js';
3
3
  export { CreateApoOpenAIOptions, createApoOpenAI } from './integrations/openai.js';
4
4
  export { CreateApoAnthropicOptions, createApoAnthropic } from './integrations/anthropic.js';
@@ -83,6 +83,7 @@ interface TraceProjectionObservation {
83
83
  errorMessage?: string;
84
84
  input?: unknown;
85
85
  output?: unknown;
86
+ /** The model the caller requested (often a gateway alias). */
86
87
  model?: string;
87
88
  toolName?: string;
88
89
  toolParameters?: unknown;
@@ -615,6 +616,12 @@ type AssertionOutcome = "pass" | "fail" | "unsupported" | "error";
615
616
  type JudgeMetadata = {
616
617
  /** Model identifier, e.g. ``"deepseek/deepseek-v4.1-flash"``. */
617
618
  model?: string;
619
+ /**
620
+ * The model the provider reports as having served the judge call (the
621
+ * response's `model` field). Diverges from `model` when the judge's
622
+ * gateway fell back — judge spend and attribution key on this.
623
+ */
624
+ served_model?: string;
618
625
  /**
619
626
  * Which response contract elicited this judgment (#163): reasoning-first
620
627
  * (the default) or the legacy verdict-first (``pass`` before
@@ -1004,6 +1011,8 @@ declare function similarity(expected: string, threshold?: number): Matcher<unkno
1004
1011
  * LLM-as-judge call. Used by `t.judge(values, instruction)` to evaluate
1005
1012
  * deliverables against a natural-language rubric. Calls an OpenAI-compatible
1006
1013
  * endpoint (OpenRouter, OpenAI, etc.) via fetch and parses the verdict.
1014
+ * Anthropic-direct (`api.anthropic.com` Messages API) speaks its own wire —
1015
+ * see {@link resolveJudgeWire}.
1007
1016
  */
1008
1017
 
1009
1018
  /**
@@ -1294,6 +1303,13 @@ type JudgeConfig = {
1294
1303
  baseURL?: string;
1295
1304
  /** Override the API key (defaults to env). */
1296
1305
  apiKey?: string;
1306
+ /**
1307
+ * Force the Anthropic Messages wire (`api.anthropic.com/v1/messages`) for a
1308
+ * base URL whose hostname does not identify it — an Anthropic-protocol
1309
+ * gateway. Unset = auto-detection (Anthropic host, or a bare `claude-*`
1310
+ * model id); see `resolveJudgeWire` in judge.ts.
1311
+ */
1312
+ provider?: "anthropic";
1297
1313
  /**
1298
1314
  * Build a custom judge briefing from the threaded context (#161). The SDK
1299
1315
  * keeps ownership of the JSON response contract — see
@@ -1307,6 +1323,13 @@ type JudgeConfig = {
1307
1323
  * dual behavior (second judge as parallel, evidence-only shadow).
1308
1324
  */
1309
1325
  mode?: "cascade";
1326
+ /**
1327
+ * Sampling temperature for `t.judge` requests (not `t.agent`, whose session
1328
+ * stays at 0). Unset falls back to `APO_JUDGE_TEMPERATURE`, then `0`. Some
1329
+ * reasoning models recommend a non-zero value (DeepSeek: 0.6) to avoid
1330
+ * repetition at greedy decoding. Recorded on the check's judge metadata.
1331
+ */
1332
+ temperature?: number;
1310
1333
  };
1311
1334
  /**
1312
1335
  * What a check knows about its scope when it invokes the judge — the