@arizeai/phoenix-client 6.11.1 → 6.11.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arizeai/phoenix-client",
3
- "version": "6.11.1",
3
+ "version": "6.11.2",
4
4
  "description": "A client for the Phoenix API",
5
5
  "keywords": [
6
6
  "arize",
@@ -96,7 +96,7 @@
96
96
  },
97
97
  "dependencies": {
98
98
  "@arizeai/openinference-semantic-conventions": "^2.5.0",
99
- "@arizeai/openinference-vercel": "^2.7.8",
99
+ "@arizeai/openinference-vercel": "^2.8.1",
100
100
  "async": "^3.2.6",
101
101
  "openapi-fetch": "^0.17.0",
102
102
  "tiny-invariant": "^1.3.3",
@@ -105,16 +105,16 @@
105
105
  "@arizeai/phoenix-otel": "1.0.2"
106
106
  },
107
107
  "devDependencies": {
108
- "@ai-sdk/openai": "^3.0.73",
108
+ "@ai-sdk/openai": "^3.0.75",
109
109
  "@anthropic-ai/sdk": "^0.102.0",
110
110
  "@opentelemetry/api": "^1.9.1",
111
111
  "@opentelemetry/sdk-trace-node": "^2.8.0",
112
112
  "@types/async": "^3.2.25",
113
113
  "@types/node": "^25.9.4",
114
- "ai": "^6.0.208",
115
- "dotenv": "^16.4.7",
114
+ "ai": "^6.0.211",
115
+ "dotenv": "^16.6.1",
116
116
  "jest": "^29.7.0",
117
- "openai": "^6.44.0",
117
+ "openai": "^6.45.0",
118
118
  "openapi-typescript": "^7.13.0",
119
119
  "tsx": "^4.22.4",
120
120
  "vitest": "^4.1.9",
@@ -1307,7 +1307,24 @@ export interface paths {
1307
1307
  };
1308
1308
  get?: never;
1309
1309
  put?: never;
1310
- /** Run Server Agent */
1310
+ /**
1311
+ * Run Server Agent
1312
+ * @description Stream a chat turn from the GraphQL server agent.
1313
+ *
1314
+ * This is the endpoint the PXI CLI talks to directly (no pre-configured
1315
+ * agent record): it builds a fresh server agent per request from the
1316
+ * caller-supplied model and contexts, then streams the reply back as
1317
+ * Vercel-AI chunks.
1318
+ *
1319
+ * The request contexts gate capabilities — GraphQL mutations, web access,
1320
+ * and subagents — and mutations are refused for viewer users. When trace
1321
+ * recording is enabled (and permitted by system settings), the run is
1322
+ * traced; locally ingested traces are persisted to the agent's project
1323
+ * once the stream completes.
1324
+ *
1325
+ * Returns ``403`` if agents or the server agent are disabled, or if a
1326
+ * viewer requests mutations.
1327
+ */
1311
1328
  post: operations["run_server_agent_agents_server_sessions__session_id__chat_post"];
1312
1329
  delete?: never;
1313
1330
  options?: never;
@@ -28,22 +28,66 @@ import {
28
28
  import { currentRun, type RunState, type SuiteState } from "./state";
29
29
  import type { Annotation, KVMap } from "./types";
30
30
 
31
- function isFalsyFlag(value: string | undefined): boolean {
32
- const v = (value ?? "").toLowerCase();
31
+ export function isFalsyFlag(value: string | undefined): boolean {
32
+ // Tolerate surrounding whitespace and matching quotes that survive some
33
+ // shells and `.env` loaders (e.g. `PHOENIX_TEST_TRACKING="false"` or a value
34
+ // with a trailing newline). Without this, such a value reads as truthy and
35
+ // silently re-enables recording even though the user asked to disable it.
36
+ const v = (value ?? "")
37
+ .trim()
38
+ .replace(/^(['"])(.*)\1$/, "$2")
39
+ .trim()
40
+ .toLowerCase();
33
41
  return v === "false" || v === "0" || v === "off" || v === "no";
34
42
  }
35
43
 
44
+ /**
45
+ * Snapshot of `PHOENIX_TEST_TRACKING` as it was when this module first loaded.
46
+ *
47
+ * When the flag is exported on the command line (the documented `eval:offline`
48
+ * workflow), this captures the user's intent at process start and is immune to
49
+ * any later in-process mutation of `process.env` by a sibling suite or setup
50
+ * file. That mutation is what made tracking leak across suites in #13930: one
51
+ * suite flipped the env var and re-enabled recording for the others.
52
+ */
53
+ const trackingDisabledAtLoad = isFalsyFlag(process.env.PHOENIX_TEST_TRACKING);
54
+
55
+ /**
56
+ * Latches to `true` the first time tracking is observed disabled in this
57
+ * process. Recording is opt-out and shared process-wide, so a single falsy
58
+ * reading turns the whole run off and keeps it off — later suites cannot
59
+ * re-enable recording regardless of declaration or execution order.
60
+ */
61
+ let trackingLatchedOff = trackingDisabledAtLoad;
62
+
63
+ /**
64
+ * Reset the process-level tracking latch. Test-only seam so unit tests can
65
+ * exercise the enable/disable transitions in isolation; not part of the
66
+ * public API.
67
+ *
68
+ * @internal
69
+ */
70
+ export function __resetTrackingLatchForTests(): void {
71
+ trackingLatchedOff = isFalsyFlag(process.env.PHOENIX_TEST_TRACKING);
72
+ }
73
+
36
74
  /**
37
75
  * Decide whether tests should sync to Phoenix.
38
76
  *
39
77
  * Tracing is enabled by default. It can be disabled globally by setting
40
78
  * `PHOENIX_TEST_TRACKING=false`, or per suite via `SuiteConfig.dryRun`.
79
+ *
80
+ * The global disable is sticky for the lifetime of the process: once the flag
81
+ * is seen falsy — at load time or on any later call — tracking stays off for
82
+ * every suite. This keeps offline mode deterministic regardless of which
83
+ * suites are included in a run, or the order they execute in.
41
84
  */
42
85
  export function isTrackingEnabled(suite?: SuiteState): {
43
86
  enabled: boolean;
44
87
  reason?: string;
45
88
  } {
46
- if (isFalsyFlag(process.env.PHOENIX_TEST_TRACKING)) {
89
+ if (trackingLatchedOff || isFalsyFlag(process.env.PHOENIX_TEST_TRACKING)) {
90
+ trackingLatchedOff = true;
47
91
  return { enabled: false, reason: "PHOENIX_TEST_TRACKING is disabled" };
48
92
  }
49
93
  if (suite?.config.dryRun) {
@@ -478,6 +522,7 @@ export async function postExperimentRun(
478
522
  if (
479
523
  run.dryRun ||
480
524
  suite.trackingDisabled ||
525
+ !isTrackingEnabled(suite).enabled ||
481
526
  !suite.client ||
482
527
  !suite.experimentId
483
528
  ) {
@@ -524,7 +569,13 @@ export async function postAnnotation(
524
569
  runId: string | undefined,
525
570
  annotation: Annotation
526
571
  ): Promise<void> {
527
- if (suite.trackingDisabled || !suite.client || !runId) return;
572
+ if (
573
+ suite.trackingDisabled ||
574
+ !isTrackingEnabled(suite).enabled ||
575
+ !suite.client ||
576
+ !runId
577
+ )
578
+ return;
528
579
  const start = new Date();
529
580
  const end = new Date();
530
581
  try {