braintrust 1.0.0-rc.2 → 1.0.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
@@ -2,13 +2,11 @@ An isomorphic JS library for logging data to Braintrust.
2
2
 
3
3
  ## Version information
4
4
 
5
- This SDK has two active version lines:
5
+ **1.x** is the current stable release with improved ESM support. OpenTelemetry integration is available via the separate [`@braintrust/otel`](https://www.npmjs.com/package/@braintrust/otel) package.
6
6
 
7
- - **1.x** (developed on the `js-1.x` branch): The latest major release with improved ESM support. OpenTelemetry integration is now available via the separate [`@braintrust/otel`](https://www.npmjs.com/package/@braintrust/otel) package.
7
+ ### Upgrading from 0.x
8
8
 
9
- - **0.4.x** (developed on the `main` branch): The previous version line, available for backward compatibility. Once 1.x is stable, it will be promoted to the `main` branch.
10
-
11
- **Recommendation**: Use the latest 1.x release. If you encounter any issues, please reach out to [support@braintrust.dev](mailto:support@braintrust.dev).
9
+ If you're on version **0.4.10 or earlier**, we recommend upgrading to **1.x**. See the [TypeScript SDK upgrade guide](https://www.braintrust.dev/docs/reference/sdks/typescript-upgrade-guide) for migration instructions.
12
10
 
13
11
  ### Quickstart
14
12
 
@@ -7982,6 +7982,8 @@ declare class LazyValue<T> {
7982
7982
  get hasSucceeded(): boolean;
7983
7983
  }
7984
7984
 
7985
+ /// <reference lib="dom" />
7986
+
7985
7987
  interface ContextParentSpanIds {
7986
7988
  rootSpanId: string;
7987
7989
  spanParents: string[];
@@ -7982,6 +7982,8 @@ declare class LazyValue<T> {
7982
7982
  get hasSucceeded(): boolean;
7983
7983
  }
7984
7984
 
7985
+ /// <reference lib="dom" />
7986
+
7985
7987
  interface ContextParentSpanIds {
7986
7988
  rootSpanId: string;
7987
7989
  spanParents: string[];
package/dev/dist/index.js CHANGED
@@ -3483,6 +3483,12 @@ function getMustacheVars(prompt) {
3483
3483
  var BRAINTRUST_ATTACHMENT = BraintrustAttachmentReference.shape.type.value;
3484
3484
  var EXTERNAL_ATTACHMENT = ExternalAttachmentReference.shape.type.value;
3485
3485
  var BRAINTRUST_PARAMS = Object.keys(BraintrustModelParams.shape);
3486
+ var LoginInvalidOrgError = class extends Error {
3487
+ constructor(message) {
3488
+ super(message);
3489
+ this.message = message;
3490
+ }
3491
+ };
3486
3492
  var REDACTION_FIELDS = [
3487
3493
  "input",
3488
3494
  "output",
@@ -5652,7 +5658,9 @@ function withParent(parent, callback, state = void 0) {
5652
5658
  }
5653
5659
  function _saveOrgInfo(state, org_info, org_name) {
5654
5660
  if (org_info.length === 0) {
5655
- throw new Error("This user is not part of any organizations.");
5661
+ throw new LoginInvalidOrgError(
5662
+ "This user is not part of any organizations."
5663
+ );
5656
5664
  }
5657
5665
  for (const org of org_info) {
5658
5666
  if (org_name === void 0 || org.name === org_name) {
@@ -5665,7 +5673,7 @@ function _saveOrgInfo(state, org_info, org_name) {
5665
5673
  }
5666
5674
  }
5667
5675
  if (state.orgId === void 0) {
5668
- throw new Error(
5676
+ throw new LoginInvalidOrgError(
5669
5677
  `Organization ${org_name} not found. Must be one of ${org_info.map((x) => x.name).join(", ")}`
5670
5678
  );
5671
5679
  }
@@ -7259,7 +7267,7 @@ function configureNode() {
7259
7267
  var _express = require('express'); var _express2 = _interopRequireDefault(_express);
7260
7268
  var _cors = require('cors'); var _cors2 = _interopRequireDefault(_cors);
7261
7269
 
7262
- // ../../node_modules/.pnpm/async@3.2.5/node_modules/async/dist/async.mjs
7270
+ // ../node_modules/async/dist/async.mjs
7263
7271
  function initialParams(fn) {
7264
7272
  return function(...args) {
7265
7273
  var callback = args.pop();
@@ -7384,7 +7392,6 @@ function isArrayLike(value) {
7384
7392
  return value && typeof value.length === "number" && value.length >= 0 && value.length % 1 === 0;
7385
7393
  }
7386
7394
  var breakLoop = {};
7387
- var breakLoop$1 = breakLoop;
7388
7395
  function once(fn) {
7389
7396
  function wrapper(...args) {
7390
7397
  if (fn === null) return;
@@ -7476,7 +7483,7 @@ function asyncEachOfLimit(generator, limit, iteratee, callback) {
7476
7483
  canceled = true;
7477
7484
  return;
7478
7485
  }
7479
- if (result === breakLoop$1 || done && running <= 0) {
7486
+ if (result === breakLoop || done && running <= 0) {
7480
7487
  done = true;
7481
7488
  return callback(null);
7482
7489
  }
@@ -7519,7 +7526,7 @@ var eachOfLimit$2 = (limit) => {
7519
7526
  } else if (err === false) {
7520
7527
  done = true;
7521
7528
  canceled = true;
7522
- } else if (value === breakLoop$1 || done && running <= 0) {
7529
+ } else if (value === breakLoop || done && running <= 0) {
7523
7530
  done = true;
7524
7531
  return callback(null);
7525
7532
  } else if (!looping) {
@@ -7562,7 +7569,7 @@ function eachOfArrayLike(coll, iteratee, callback) {
7562
7569
  if (canceled === true) return;
7563
7570
  if (err) {
7564
7571
  callback(err);
7565
- } else if (++completed === length || value === breakLoop$1) {
7572
+ } else if (++completed === length || value === breakLoop) {
7566
7573
  callback(null);
7567
7574
  }
7568
7575
  }
@@ -7958,7 +7965,7 @@ function _createTester(check, getResult) {
7958
7965
  if (check(result) && !testResult) {
7959
7966
  testPassed = true;
7960
7967
  testResult = getResult(true, value);
7961
- return callback(null, breakLoop$1);
7968
+ return callback(null, breakLoop);
7962
7969
  }
7963
7970
  callback();
7964
7971
  });
@@ -8299,7 +8306,6 @@ var waterfall$1 = awaitify(waterfall);
8299
8306
  // src/framework.ts
8300
8307
  var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
8301
8308
  var _boxen = require('boxen'); var _boxen2 = _interopRequireDefault(_boxen);
8302
- var _terminallink = require('terminal-link'); var _terminallink2 = _interopRequireDefault(_terminallink);
8303
8309
  var _pluralize = require('pluralize'); var _pluralize2 = _interopRequireDefault(_pluralize);
8304
8310
  var _clitable3 = require('cli-table3'); var _clitable32 = _interopRequireDefault(_clitable3);
8305
8311
 
@@ -8984,11 +8990,11 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
8984
8990
  }
8985
8991
  if (Array.isArray(resolvedDataResult) || isIterable(resolvedDataResult)) {
8986
8992
  const iterable = resolvedDataResult;
8987
- return async function* () {
8993
+ return (async function* () {
8988
8994
  for (const datum of iterable) {
8989
8995
  yield datum;
8990
8996
  }
8991
- }();
8997
+ })();
8992
8998
  }
8993
8999
  throw new Error(
8994
9000
  "Evaluator data must be an array, iterable, or async iterable"
@@ -9502,11 +9508,7 @@ function formatExperimentSummary(summary) {
9502
9508
  tableParts.push(combinedTable.toString());
9503
9509
  }
9504
9510
  const content = [comparisonLine, ...tableParts].filter(Boolean).join("\n");
9505
- const footer = summary.experimentUrl ? _terminallink2.default.call(void 0,
9506
- `View results for ${summary.experimentName}`,
9507
- summary.experimentUrl,
9508
- { fallback: () => `See results at ${summary.experimentUrl}` }
9509
- ) : "";
9511
+ const footer = summary.experimentUrl ? `See results at ${summary.experimentUrl}` : "";
9510
9512
  const boxContent = [content, footer].filter(Boolean).join("\n\n");
9511
9513
  return "\n" + _boxen2.default.call(void 0, boxContent, {
9512
9514
  title: _chalk2.default.gray("Experiment summary"),
@@ -3483,6 +3483,12 @@ function getMustacheVars(prompt) {
3483
3483
  var BRAINTRUST_ATTACHMENT = BraintrustAttachmentReference.shape.type.value;
3484
3484
  var EXTERNAL_ATTACHMENT = ExternalAttachmentReference.shape.type.value;
3485
3485
  var BRAINTRUST_PARAMS = Object.keys(BraintrustModelParams.shape);
3486
+ var LoginInvalidOrgError = class extends Error {
3487
+ constructor(message) {
3488
+ super(message);
3489
+ this.message = message;
3490
+ }
3491
+ };
3486
3492
  var REDACTION_FIELDS = [
3487
3493
  "input",
3488
3494
  "output",
@@ -5652,7 +5658,9 @@ function withParent(parent, callback, state = void 0) {
5652
5658
  }
5653
5659
  function _saveOrgInfo(state, org_info, org_name) {
5654
5660
  if (org_info.length === 0) {
5655
- throw new Error("This user is not part of any organizations.");
5661
+ throw new LoginInvalidOrgError(
5662
+ "This user is not part of any organizations."
5663
+ );
5656
5664
  }
5657
5665
  for (const org of org_info) {
5658
5666
  if (org_name === void 0 || org.name === org_name) {
@@ -5665,7 +5673,7 @@ function _saveOrgInfo(state, org_info, org_name) {
5665
5673
  }
5666
5674
  }
5667
5675
  if (state.orgId === void 0) {
5668
- throw new Error(
5676
+ throw new LoginInvalidOrgError(
5669
5677
  `Organization ${org_name} not found. Must be one of ${org_info.map((x) => x.name).join(", ")}`
5670
5678
  );
5671
5679
  }
@@ -7259,7 +7267,7 @@ function configureNode() {
7259
7267
  import express from "express";
7260
7268
  import cors from "cors";
7261
7269
 
7262
- // ../../node_modules/.pnpm/async@3.2.5/node_modules/async/dist/async.mjs
7270
+ // ../node_modules/async/dist/async.mjs
7263
7271
  function initialParams(fn) {
7264
7272
  return function(...args) {
7265
7273
  var callback = args.pop();
@@ -7384,7 +7392,6 @@ function isArrayLike(value) {
7384
7392
  return value && typeof value.length === "number" && value.length >= 0 && value.length % 1 === 0;
7385
7393
  }
7386
7394
  var breakLoop = {};
7387
- var breakLoop$1 = breakLoop;
7388
7395
  function once(fn) {
7389
7396
  function wrapper(...args) {
7390
7397
  if (fn === null) return;
@@ -7476,7 +7483,7 @@ function asyncEachOfLimit(generator, limit, iteratee, callback) {
7476
7483
  canceled = true;
7477
7484
  return;
7478
7485
  }
7479
- if (result === breakLoop$1 || done && running <= 0) {
7486
+ if (result === breakLoop || done && running <= 0) {
7480
7487
  done = true;
7481
7488
  return callback(null);
7482
7489
  }
@@ -7519,7 +7526,7 @@ var eachOfLimit$2 = (limit) => {
7519
7526
  } else if (err === false) {
7520
7527
  done = true;
7521
7528
  canceled = true;
7522
- } else if (value === breakLoop$1 || done && running <= 0) {
7529
+ } else if (value === breakLoop || done && running <= 0) {
7523
7530
  done = true;
7524
7531
  return callback(null);
7525
7532
  } else if (!looping) {
@@ -7562,7 +7569,7 @@ function eachOfArrayLike(coll, iteratee, callback) {
7562
7569
  if (canceled === true) return;
7563
7570
  if (err) {
7564
7571
  callback(err);
7565
- } else if (++completed === length || value === breakLoop$1) {
7572
+ } else if (++completed === length || value === breakLoop) {
7566
7573
  callback(null);
7567
7574
  }
7568
7575
  }
@@ -7958,7 +7965,7 @@ function _createTester(check, getResult) {
7958
7965
  if (check(result) && !testResult) {
7959
7966
  testPassed = true;
7960
7967
  testResult = getResult(true, value);
7961
- return callback(null, breakLoop$1);
7968
+ return callback(null, breakLoop);
7962
7969
  }
7963
7970
  callback();
7964
7971
  });
@@ -8299,7 +8306,6 @@ var waterfall$1 = awaitify(waterfall);
8299
8306
  // src/framework.ts
8300
8307
  import chalk2 from "chalk";
8301
8308
  import boxen from "boxen";
8302
- import terminalLink from "terminal-link";
8303
8309
  import pluralize from "pluralize";
8304
8310
  import Table from "cli-table3";
8305
8311
 
@@ -8984,11 +8990,11 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
8984
8990
  }
8985
8991
  if (Array.isArray(resolvedDataResult) || isIterable(resolvedDataResult)) {
8986
8992
  const iterable = resolvedDataResult;
8987
- return async function* () {
8993
+ return (async function* () {
8988
8994
  for (const datum of iterable) {
8989
8995
  yield datum;
8990
8996
  }
8991
- }();
8997
+ })();
8992
8998
  }
8993
8999
  throw new Error(
8994
9000
  "Evaluator data must be an array, iterable, or async iterable"
@@ -9502,11 +9508,7 @@ function formatExperimentSummary(summary) {
9502
9508
  tableParts.push(combinedTable.toString());
9503
9509
  }
9504
9510
  const content = [comparisonLine, ...tableParts].filter(Boolean).join("\n");
9505
- const footer = summary.experimentUrl ? terminalLink(
9506
- `View results for ${summary.experimentName}`,
9507
- summary.experimentUrl,
9508
- { fallback: () => `See results at ${summary.experimentUrl}` }
9509
- ) : "";
9511
+ const footer = summary.experimentUrl ? `See results at ${summary.experimentUrl}` : "";
9510
9512
  const boxContent = [content, footer].filter(Boolean).join("\n\n");
9511
9513
  return "\n" + boxen(boxContent, {
9512
9514
  title: chalk2.gray("Experiment summary"),
@@ -15464,10 +15464,16 @@ declare class PromptCache {
15464
15464
  set(key: PromptKey, value: Prompt): Promise<void>;
15465
15465
  }
15466
15466
 
15467
+ /// <reference lib="dom" />
15468
+
15467
15469
  interface ContextParentSpanIds {
15468
15470
  rootSpanId: string;
15469
15471
  spanParents: string[];
15470
15472
  }
15473
+ declare class LoginInvalidOrgError extends Error {
15474
+ message: string;
15475
+ constructor(message: string);
15476
+ }
15471
15477
  type SetCurrentArg = {
15472
15478
  setCurrent?: boolean;
15473
15479
  };
@@ -28757,6 +28763,8 @@ type braintrust_LogFeedbackFullArgs = LogFeedbackFullArgs;
28757
28763
  type braintrust_LogOptions<IsAsyncFlush> = LogOptions<IsAsyncFlush>;
28758
28764
  type braintrust_Logger<IsAsyncFlush extends boolean> = Logger<IsAsyncFlush>;
28759
28765
  declare const braintrust_Logger: typeof Logger;
28766
+ type braintrust_LoginInvalidOrgError = LoginInvalidOrgError;
28767
+ declare const braintrust_LoginInvalidOrgError: typeof LoginInvalidOrgError;
28760
28768
  type braintrust_LoginOptions = LoginOptions;
28761
28769
  type braintrust_MetricSummary = MetricSummary;
28762
28770
  declare const braintrust_NOOP_SPAN: typeof NOOP_SPAN;
@@ -28844,7 +28852,7 @@ declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
28844
28852
  declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
28845
28853
  declare const braintrust_wrapTraced: typeof wrapTraced;
28846
28854
  declare namespace braintrust {
28847
- export { type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, braintrust_AttachmentReference as AttachmentReference, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustMiddleware as BraintrustMiddleware, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, type braintrust_CommentEvent as CommentEvent, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, braintrust_ContextManager as ContextManager, type braintrust_ContextParentSpanIds as ContextParentSpanIds, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetRecord as DatasetRecord, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, braintrust_ERR_PERMALINK as ERR_PERMALINK, type braintrust_EndSpanArgs as EndSpanArgs, type braintrust_EvalCase as EvalCase, type braintrust_EvalParameterSerializedSchema as EvalParameterSerializedSchema, type braintrust_EvalParameters as EvalParameters, type braintrust_EvaluatorDefinition as EvaluatorDefinition, type braintrust_EvaluatorDefinitions as EvaluatorDefinitions, type braintrust_EvaluatorManifest as EvaluatorManifest, braintrust_Experiment as Experiment, type braintrust_ExperimentLogFullArgs as ExperimentLogFullArgs, type braintrust_ExperimentLogPartialArgs as ExperimentLogPartialArgs, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_ExternalAttachment as ExternalAttachment, type braintrust_ExternalAttachmentParams as ExternalAttachmentParams, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitDatasetOptions as FullInitDatasetOptions, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, braintrust_IDGenerator as IDGenerator, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, type braintrust_IdField as IdField, type braintrust_InitDatasetOptions as InitDatasetOptions, type braintrust_InitLoggerOptions as InitLoggerOptions, type braintrust_InitOptions as InitOptions, type braintrust_InputField as InputField, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_JSONAttachment as JSONAttachment, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, type braintrust_LoadPromptOptions as LoadPromptOptions, type braintrust_LogCommentFullArgs as LogCommentFullArgs, type braintrust_LogFeedbackFullArgs as LogFeedbackFullArgs, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NOOP_SPAN_PERMALINK as NOOP_SPAN_PERMALINK, braintrust_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, type braintrust_OtherExperimentLogFields as OtherExperimentLogFields, type braintrust_ParentExperimentIds as ParentExperimentIds, type braintrust_ParentProjectLogIds as ParentProjectLogIds, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyAttachment as ReadonlyAttachment, braintrust_ReadonlyExperiment as ReadonlyExperiment, type braintrust_ScoreSummary as ScoreSummary, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type braintrust_Span as Span, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_TestBackgroundLogger as TestBackgroundLogger, braintrust_UUIDGenerator as UUIDGenerator, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__exportsForTestingOnly as _exportsForTestingOnly, braintrust__internalGetGlobalState as _internalGetGlobalState, braintrust__internalSetInitialState as _internalSetInitialState, braintrust_braintrustStreamChunkSchema as braintrustStreamChunkSchema, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_deepCopyEvent as deepCopyEvent, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_evaluatorDefinitionSchema as evaluatorDefinitionSchema, braintrust_evaluatorDefinitionsSchema as evaluatorDefinitionsSchema, braintrust_flush as flush, braintrust_getContextManager as getContextManager, braintrust_getIdGenerator as getIdGenerator, braintrust_getPromptVersions as getPromptVersions, braintrust_getSpanParentObject as getSpanParentObject, graphFramework as graph, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, braintrust_initFunction as initFunction, braintrust_initLogger as initLogger, braintrust_invoke as invoke, braintrust_loadPrompt as loadPrompt, braintrust_log as log, braintrust_logError as logError, braintrust_login as login, braintrust_loginToState as loginToState, braintrust_newId as newId, braintrust_parseCachedHeader as parseCachedHeader, braintrust_permalink as permalink, braintrust_renderMessage as renderMessage, braintrust_renderPromptParams as renderPromptParams, braintrust_setFetch as setFetch, braintrust_setMaskingFunction as setMaskingFunction, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, braintrust_traceable as traceable, braintrust_traced as traced, braintrust_updateSpan as updateSpan, braintrust_withCurrent as withCurrent, braintrust_withDataset as withDataset, braintrust_withExperiment as withExperiment, braintrust_withLogger as withLogger, braintrust_withParent as withParent, braintrust_wrapAISDK as wrapAISDK, braintrust_wrapAnthropic as wrapAnthropic, braintrust_wrapClaudeAgentSDK as wrapClaudeAgentSDK, braintrust_wrapGoogleGenAI as wrapGoogleGenAI, braintrust_wrapMastraAgent as wrapMastraAgent, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
28855
+ export { type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, braintrust_AttachmentReference as AttachmentReference, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustMiddleware as BraintrustMiddleware, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, type braintrust_CommentEvent as CommentEvent, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, braintrust_ContextManager as ContextManager, type braintrust_ContextParentSpanIds as ContextParentSpanIds, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetRecord as DatasetRecord, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, braintrust_ERR_PERMALINK as ERR_PERMALINK, type braintrust_EndSpanArgs as EndSpanArgs, type braintrust_EvalCase as EvalCase, type braintrust_EvalParameterSerializedSchema as EvalParameterSerializedSchema, type braintrust_EvalParameters as EvalParameters, type braintrust_EvaluatorDefinition as EvaluatorDefinition, type braintrust_EvaluatorDefinitions as EvaluatorDefinitions, type braintrust_EvaluatorManifest as EvaluatorManifest, braintrust_Experiment as Experiment, type braintrust_ExperimentLogFullArgs as ExperimentLogFullArgs, type braintrust_ExperimentLogPartialArgs as ExperimentLogPartialArgs, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_ExternalAttachment as ExternalAttachment, type braintrust_ExternalAttachmentParams as ExternalAttachmentParams, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitDatasetOptions as FullInitDatasetOptions, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, braintrust_IDGenerator as IDGenerator, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, type braintrust_IdField as IdField, type braintrust_InitDatasetOptions as InitDatasetOptions, type braintrust_InitLoggerOptions as InitLoggerOptions, type braintrust_InitOptions as InitOptions, type braintrust_InputField as InputField, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_JSONAttachment as JSONAttachment, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, type braintrust_LoadPromptOptions as LoadPromptOptions, type braintrust_LogCommentFullArgs as LogCommentFullArgs, type braintrust_LogFeedbackFullArgs as LogFeedbackFullArgs, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, braintrust_LoginInvalidOrgError as LoginInvalidOrgError, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NOOP_SPAN_PERMALINK as NOOP_SPAN_PERMALINK, braintrust_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, type braintrust_OtherExperimentLogFields as OtherExperimentLogFields, type braintrust_ParentExperimentIds as ParentExperimentIds, type braintrust_ParentProjectLogIds as ParentProjectLogIds, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyAttachment as ReadonlyAttachment, braintrust_ReadonlyExperiment as ReadonlyExperiment, type braintrust_ScoreSummary as ScoreSummary, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type braintrust_Span as Span, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_TestBackgroundLogger as TestBackgroundLogger, braintrust_UUIDGenerator as UUIDGenerator, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__exportsForTestingOnly as _exportsForTestingOnly, braintrust__internalGetGlobalState as _internalGetGlobalState, braintrust__internalSetInitialState as _internalSetInitialState, braintrust_braintrustStreamChunkSchema as braintrustStreamChunkSchema, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_deepCopyEvent as deepCopyEvent, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_evaluatorDefinitionSchema as evaluatorDefinitionSchema, braintrust_evaluatorDefinitionsSchema as evaluatorDefinitionsSchema, braintrust_flush as flush, braintrust_getContextManager as getContextManager, braintrust_getIdGenerator as getIdGenerator, braintrust_getPromptVersions as getPromptVersions, braintrust_getSpanParentObject as getSpanParentObject, graphFramework as graph, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, braintrust_initFunction as initFunction, braintrust_initLogger as initLogger, braintrust_invoke as invoke, braintrust_loadPrompt as loadPrompt, braintrust_log as log, braintrust_logError as logError, braintrust_login as login, braintrust_loginToState as loginToState, braintrust_newId as newId, braintrust_parseCachedHeader as parseCachedHeader, braintrust_permalink as permalink, braintrust_renderMessage as renderMessage, braintrust_renderPromptParams as renderPromptParams, braintrust_setFetch as setFetch, braintrust_setMaskingFunction as setMaskingFunction, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, braintrust_traceable as traceable, braintrust_traced as traced, braintrust_updateSpan as updateSpan, braintrust_withCurrent as withCurrent, braintrust_withDataset as withDataset, braintrust_withExperiment as withExperiment, braintrust_withLogger as withLogger, braintrust_withParent as withParent, braintrust_wrapAISDK as wrapAISDK, braintrust_wrapAnthropic as wrapAnthropic, braintrust_wrapClaudeAgentSDK as wrapClaudeAgentSDK, braintrust_wrapGoogleGenAI as wrapGoogleGenAI, braintrust_wrapMastraAgent as wrapMastraAgent, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
28848
28856
  }
28849
28857
 
28850
- export { type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, type BaseMetadata, BraintrustMiddleware, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, type EvalCase, type EvalParameterSerializedSchema, type EvalParameters, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitDatasetOptions, type FullInitOptions, type FullLoginOptions, IDGenerator, INTERNAL_BTQL_LIMIT, type IdField, type InitDatasetOptions, type InitLoggerOptions, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, JSONAttachment, LEGACY_CACHED_HEADER, LazyValue, type LoadPromptOptions, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, TestBackgroundLogger, UUIDGenerator, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getIdGenerator, getPromptVersions, getSpanParentObject, graphFramework as graph, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, renderMessage, renderPromptParams, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAnthropic, wrapClaudeAgentSDK, wrapGoogleGenAI, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
28858
+ export { type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, type BaseMetadata, BraintrustMiddleware, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, type EvalCase, type EvalParameterSerializedSchema, type EvalParameters, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitDatasetOptions, type FullInitOptions, type FullLoginOptions, IDGenerator, INTERNAL_BTQL_LIMIT, type IdField, type InitDatasetOptions, type InitLoggerOptions, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, JSONAttachment, LEGACY_CACHED_HEADER, LazyValue, type LoadPromptOptions, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, LoginInvalidOrgError, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, TestBackgroundLogger, UUIDGenerator, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getIdGenerator, getPromptVersions, getSpanParentObject, graphFramework as graph, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, renderMessage, renderPromptParams, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAnthropic, wrapClaudeAgentSDK, wrapGoogleGenAI, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
package/dist/browser.d.ts CHANGED
@@ -15464,10 +15464,16 @@ declare class PromptCache {
15464
15464
  set(key: PromptKey, value: Prompt): Promise<void>;
15465
15465
  }
15466
15466
 
15467
+ /// <reference lib="dom" />
15468
+
15467
15469
  interface ContextParentSpanIds {
15468
15470
  rootSpanId: string;
15469
15471
  spanParents: string[];
15470
15472
  }
15473
+ declare class LoginInvalidOrgError extends Error {
15474
+ message: string;
15475
+ constructor(message: string);
15476
+ }
15471
15477
  type SetCurrentArg = {
15472
15478
  setCurrent?: boolean;
15473
15479
  };
@@ -28757,6 +28763,8 @@ type braintrust_LogFeedbackFullArgs = LogFeedbackFullArgs;
28757
28763
  type braintrust_LogOptions<IsAsyncFlush> = LogOptions<IsAsyncFlush>;
28758
28764
  type braintrust_Logger<IsAsyncFlush extends boolean> = Logger<IsAsyncFlush>;
28759
28765
  declare const braintrust_Logger: typeof Logger;
28766
+ type braintrust_LoginInvalidOrgError = LoginInvalidOrgError;
28767
+ declare const braintrust_LoginInvalidOrgError: typeof LoginInvalidOrgError;
28760
28768
  type braintrust_LoginOptions = LoginOptions;
28761
28769
  type braintrust_MetricSummary = MetricSummary;
28762
28770
  declare const braintrust_NOOP_SPAN: typeof NOOP_SPAN;
@@ -28844,7 +28852,7 @@ declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
28844
28852
  declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
28845
28853
  declare const braintrust_wrapTraced: typeof wrapTraced;
28846
28854
  declare namespace braintrust {
28847
- export { type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, braintrust_AttachmentReference as AttachmentReference, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustMiddleware as BraintrustMiddleware, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, type braintrust_CommentEvent as CommentEvent, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, braintrust_ContextManager as ContextManager, type braintrust_ContextParentSpanIds as ContextParentSpanIds, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetRecord as DatasetRecord, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, braintrust_ERR_PERMALINK as ERR_PERMALINK, type braintrust_EndSpanArgs as EndSpanArgs, type braintrust_EvalCase as EvalCase, type braintrust_EvalParameterSerializedSchema as EvalParameterSerializedSchema, type braintrust_EvalParameters as EvalParameters, type braintrust_EvaluatorDefinition as EvaluatorDefinition, type braintrust_EvaluatorDefinitions as EvaluatorDefinitions, type braintrust_EvaluatorManifest as EvaluatorManifest, braintrust_Experiment as Experiment, type braintrust_ExperimentLogFullArgs as ExperimentLogFullArgs, type braintrust_ExperimentLogPartialArgs as ExperimentLogPartialArgs, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_ExternalAttachment as ExternalAttachment, type braintrust_ExternalAttachmentParams as ExternalAttachmentParams, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitDatasetOptions as FullInitDatasetOptions, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, braintrust_IDGenerator as IDGenerator, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, type braintrust_IdField as IdField, type braintrust_InitDatasetOptions as InitDatasetOptions, type braintrust_InitLoggerOptions as InitLoggerOptions, type braintrust_InitOptions as InitOptions, type braintrust_InputField as InputField, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_JSONAttachment as JSONAttachment, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, type braintrust_LoadPromptOptions as LoadPromptOptions, type braintrust_LogCommentFullArgs as LogCommentFullArgs, type braintrust_LogFeedbackFullArgs as LogFeedbackFullArgs, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NOOP_SPAN_PERMALINK as NOOP_SPAN_PERMALINK, braintrust_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, type braintrust_OtherExperimentLogFields as OtherExperimentLogFields, type braintrust_ParentExperimentIds as ParentExperimentIds, type braintrust_ParentProjectLogIds as ParentProjectLogIds, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyAttachment as ReadonlyAttachment, braintrust_ReadonlyExperiment as ReadonlyExperiment, type braintrust_ScoreSummary as ScoreSummary, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type braintrust_Span as Span, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_TestBackgroundLogger as TestBackgroundLogger, braintrust_UUIDGenerator as UUIDGenerator, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__exportsForTestingOnly as _exportsForTestingOnly, braintrust__internalGetGlobalState as _internalGetGlobalState, braintrust__internalSetInitialState as _internalSetInitialState, braintrust_braintrustStreamChunkSchema as braintrustStreamChunkSchema, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_deepCopyEvent as deepCopyEvent, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_evaluatorDefinitionSchema as evaluatorDefinitionSchema, braintrust_evaluatorDefinitionsSchema as evaluatorDefinitionsSchema, braintrust_flush as flush, braintrust_getContextManager as getContextManager, braintrust_getIdGenerator as getIdGenerator, braintrust_getPromptVersions as getPromptVersions, braintrust_getSpanParentObject as getSpanParentObject, graphFramework as graph, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, braintrust_initFunction as initFunction, braintrust_initLogger as initLogger, braintrust_invoke as invoke, braintrust_loadPrompt as loadPrompt, braintrust_log as log, braintrust_logError as logError, braintrust_login as login, braintrust_loginToState as loginToState, braintrust_newId as newId, braintrust_parseCachedHeader as parseCachedHeader, braintrust_permalink as permalink, braintrust_renderMessage as renderMessage, braintrust_renderPromptParams as renderPromptParams, braintrust_setFetch as setFetch, braintrust_setMaskingFunction as setMaskingFunction, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, braintrust_traceable as traceable, braintrust_traced as traced, braintrust_updateSpan as updateSpan, braintrust_withCurrent as withCurrent, braintrust_withDataset as withDataset, braintrust_withExperiment as withExperiment, braintrust_withLogger as withLogger, braintrust_withParent as withParent, braintrust_wrapAISDK as wrapAISDK, braintrust_wrapAnthropic as wrapAnthropic, braintrust_wrapClaudeAgentSDK as wrapClaudeAgentSDK, braintrust_wrapGoogleGenAI as wrapGoogleGenAI, braintrust_wrapMastraAgent as wrapMastraAgent, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
28855
+ export { type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, braintrust_AttachmentReference as AttachmentReference, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustMiddleware as BraintrustMiddleware, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, type braintrust_CommentEvent as CommentEvent, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, braintrust_ContextManager as ContextManager, type braintrust_ContextParentSpanIds as ContextParentSpanIds, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetRecord as DatasetRecord, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, braintrust_ERR_PERMALINK as ERR_PERMALINK, type braintrust_EndSpanArgs as EndSpanArgs, type braintrust_EvalCase as EvalCase, type braintrust_EvalParameterSerializedSchema as EvalParameterSerializedSchema, type braintrust_EvalParameters as EvalParameters, type braintrust_EvaluatorDefinition as EvaluatorDefinition, type braintrust_EvaluatorDefinitions as EvaluatorDefinitions, type braintrust_EvaluatorManifest as EvaluatorManifest, braintrust_Experiment as Experiment, type braintrust_ExperimentLogFullArgs as ExperimentLogFullArgs, type braintrust_ExperimentLogPartialArgs as ExperimentLogPartialArgs, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_ExternalAttachment as ExternalAttachment, type braintrust_ExternalAttachmentParams as ExternalAttachmentParams, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitDatasetOptions as FullInitDatasetOptions, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, braintrust_IDGenerator as IDGenerator, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, type braintrust_IdField as IdField, type braintrust_InitDatasetOptions as InitDatasetOptions, type braintrust_InitLoggerOptions as InitLoggerOptions, type braintrust_InitOptions as InitOptions, type braintrust_InputField as InputField, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_JSONAttachment as JSONAttachment, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, type braintrust_LoadPromptOptions as LoadPromptOptions, type braintrust_LogCommentFullArgs as LogCommentFullArgs, type braintrust_LogFeedbackFullArgs as LogFeedbackFullArgs, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, braintrust_LoginInvalidOrgError as LoginInvalidOrgError, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NOOP_SPAN_PERMALINK as NOOP_SPAN_PERMALINK, braintrust_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, type braintrust_OtherExperimentLogFields as OtherExperimentLogFields, type braintrust_ParentExperimentIds as ParentExperimentIds, type braintrust_ParentProjectLogIds as ParentProjectLogIds, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyAttachment as ReadonlyAttachment, braintrust_ReadonlyExperiment as ReadonlyExperiment, type braintrust_ScoreSummary as ScoreSummary, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type braintrust_Span as Span, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_TestBackgroundLogger as TestBackgroundLogger, braintrust_UUIDGenerator as UUIDGenerator, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__exportsForTestingOnly as _exportsForTestingOnly, braintrust__internalGetGlobalState as _internalGetGlobalState, braintrust__internalSetInitialState as _internalSetInitialState, braintrust_braintrustStreamChunkSchema as braintrustStreamChunkSchema, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_deepCopyEvent as deepCopyEvent, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_evaluatorDefinitionSchema as evaluatorDefinitionSchema, braintrust_evaluatorDefinitionsSchema as evaluatorDefinitionsSchema, braintrust_flush as flush, braintrust_getContextManager as getContextManager, braintrust_getIdGenerator as getIdGenerator, braintrust_getPromptVersions as getPromptVersions, braintrust_getSpanParentObject as getSpanParentObject, graphFramework as graph, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, braintrust_initFunction as initFunction, braintrust_initLogger as initLogger, braintrust_invoke as invoke, braintrust_loadPrompt as loadPrompt, braintrust_log as log, braintrust_logError as logError, braintrust_login as login, braintrust_loginToState as loginToState, braintrust_newId as newId, braintrust_parseCachedHeader as parseCachedHeader, braintrust_permalink as permalink, braintrust_renderMessage as renderMessage, braintrust_renderPromptParams as renderPromptParams, braintrust_setFetch as setFetch, braintrust_setMaskingFunction as setMaskingFunction, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, braintrust_traceable as traceable, braintrust_traced as traced, braintrust_updateSpan as updateSpan, braintrust_withCurrent as withCurrent, braintrust_withDataset as withDataset, braintrust_withExperiment as withExperiment, braintrust_withLogger as withLogger, braintrust_withParent as withParent, braintrust_wrapAISDK as wrapAISDK, braintrust_wrapAnthropic as wrapAnthropic, braintrust_wrapClaudeAgentSDK as wrapClaudeAgentSDK, braintrust_wrapGoogleGenAI as wrapGoogleGenAI, braintrust_wrapMastraAgent as wrapMastraAgent, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
28848
28856
  }
28849
28857
 
28850
- export { type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, type BaseMetadata, BraintrustMiddleware, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, type EvalCase, type EvalParameterSerializedSchema, type EvalParameters, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitDatasetOptions, type FullInitOptions, type FullLoginOptions, IDGenerator, INTERNAL_BTQL_LIMIT, type IdField, type InitDatasetOptions, type InitLoggerOptions, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, JSONAttachment, LEGACY_CACHED_HEADER, LazyValue, type LoadPromptOptions, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, TestBackgroundLogger, UUIDGenerator, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getIdGenerator, getPromptVersions, getSpanParentObject, graphFramework as graph, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, renderMessage, renderPromptParams, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAnthropic, wrapClaudeAgentSDK, wrapGoogleGenAI, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
28858
+ export { type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, type BaseMetadata, BraintrustMiddleware, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, type EvalCase, type EvalParameterSerializedSchema, type EvalParameters, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitDatasetOptions, type FullInitOptions, type FullLoginOptions, IDGenerator, INTERNAL_BTQL_LIMIT, type IdField, type InitDatasetOptions, type InitLoggerOptions, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, JSONAttachment, LEGACY_CACHED_HEADER, LazyValue, type LoadPromptOptions, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, LoginInvalidOrgError, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, TestBackgroundLogger, UUIDGenerator, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getIdGenerator, getPromptVersions, getSpanParentObject, graphFramework as graph, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, renderMessage, renderPromptParams, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAnthropic, wrapClaudeAgentSDK, wrapGoogleGenAI, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
package/dist/browser.js CHANGED
@@ -3249,6 +3249,12 @@ function getMustacheVars(prompt) {
3249
3249
  var BRAINTRUST_ATTACHMENT = BraintrustAttachmentReference.shape.type.value;
3250
3250
  var EXTERNAL_ATTACHMENT = ExternalAttachmentReference.shape.type.value;
3251
3251
  var BRAINTRUST_PARAMS = Object.keys(BraintrustModelParams.shape);
3252
+ var LoginInvalidOrgError = class extends Error {
3253
+ constructor(message) {
3254
+ super(message);
3255
+ this.message = message;
3256
+ }
3257
+ };
3252
3258
  var REDACTION_FIELDS = [
3253
3259
  "input",
3254
3260
  "output",
@@ -5903,7 +5909,7 @@ function wrapTraced(fn, args) {
5903
5909
  return wrapTracedAsyncGenerator(fn, spanArgs, !!noTraceIO);
5904
5910
  }
5905
5911
  if (_optionalChain([args, 'optionalAccess', _44 => _44.asyncFlush])) {
5906
- return (...fnArgs) => traced((span) => {
5912
+ return ((...fnArgs) => traced((span) => {
5907
5913
  if (!hasExplicitInput) {
5908
5914
  span.log({ input: fnArgs });
5909
5915
  }
@@ -5920,9 +5926,9 @@ function wrapTraced(fn, args) {
5920
5926
  }
5921
5927
  }
5922
5928
  return output;
5923
- }, spanArgs);
5929
+ }, spanArgs));
5924
5930
  } else {
5925
- return (...fnArgs) => traced(async (span) => {
5931
+ return ((...fnArgs) => traced(async (span) => {
5926
5932
  if (!hasExplicitInput) {
5927
5933
  span.log({ input: fnArgs });
5928
5934
  }
@@ -5932,7 +5938,7 @@ function wrapTraced(fn, args) {
5932
5938
  span.log({ output });
5933
5939
  }
5934
5940
  return output;
5935
- }, spanArgs);
5941
+ }, spanArgs));
5936
5942
  }
5937
5943
  }
5938
5944
  var traceable = wrapTraced;
@@ -6039,7 +6045,9 @@ function withParent(parent, callback, state = void 0) {
6039
6045
  }
6040
6046
  function _saveOrgInfo(state, org_info, org_name) {
6041
6047
  if (org_info.length === 0) {
6042
- throw new Error("This user is not part of any organizations.");
6048
+ throw new LoginInvalidOrgError(
6049
+ "This user is not part of any organizations."
6050
+ );
6043
6051
  }
6044
6052
  for (const org of org_info) {
6045
6053
  if (org_name === void 0 || org.name === org_name) {
@@ -6052,7 +6060,7 @@ function _saveOrgInfo(state, org_info, org_name) {
6052
6060
  }
6053
6061
  }
6054
6062
  if (state.orgId === void 0) {
6055
- throw new Error(
6063
+ throw new LoginInvalidOrgError(
6056
6064
  `Organization ${org_name} not found. Must be one of ${org_info.map((x) => x.name).join(", ")}`
6057
6065
  );
6058
6066
  }
@@ -7751,6 +7759,7 @@ __export(exports_browser_exports, {
7751
7759
  LEGACY_CACHED_HEADER: () => LEGACY_CACHED_HEADER,
7752
7760
  LazyValue: () => LazyValue,
7753
7761
  Logger: () => Logger,
7762
+ LoginInvalidOrgError: () => LoginInvalidOrgError,
7754
7763
  NOOP_SPAN: () => NOOP_SPAN,
7755
7764
  NOOP_SPAN_PERMALINK: () => NOOP_SPAN_PERMALINK,
7756
7765
  NoopSpan: () => NoopSpan,
@@ -10282,7 +10291,7 @@ function wrapClaudeAgentQuery(queryFn, defaultThis) {
10282
10291
  }
10283
10292
  currentMessages.length = 0;
10284
10293
  };
10285
- const wrappedGenerator = async function* () {
10294
+ const wrappedGenerator = (async function* () {
10286
10295
  try {
10287
10296
  const invocationTarget = thisArg === proxy || thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
10288
10297
  const generator = withCurrent(
@@ -10338,7 +10347,7 @@ function wrapClaudeAgentQuery(queryFn, defaultThis) {
10338
10347
  } finally {
10339
10348
  span.end();
10340
10349
  }
10341
- }();
10350
+ })();
10342
10351
  return wrappedGenerator;
10343
10352
  }
10344
10353
  });
@@ -11325,4 +11334,5 @@ var browser_default = exports_browser_exports;
11325
11334
 
11326
11335
 
11327
11336
 
11328
- exports.Attachment = Attachment; exports.BaseAttachment = BaseAttachment; exports.BraintrustMiddleware = BraintrustMiddleware; exports.BraintrustState = BraintrustState; exports.BraintrustStream = BraintrustStream; exports.ContextManager = ContextManager; exports.Dataset = Dataset2; exports.ERR_PERMALINK = ERR_PERMALINK; exports.Experiment = Experiment2; exports.ExternalAttachment = ExternalAttachment; exports.FailedHTTPResponse = FailedHTTPResponse; exports.IDGenerator = IDGenerator; exports.INTERNAL_BTQL_LIMIT = INTERNAL_BTQL_LIMIT; exports.JSONAttachment = JSONAttachment; exports.LEGACY_CACHED_HEADER = LEGACY_CACHED_HEADER; exports.LazyValue = LazyValue; exports.Logger = Logger; exports.NOOP_SPAN = NOOP_SPAN; exports.NOOP_SPAN_PERMALINK = NOOP_SPAN_PERMALINK; exports.NoopSpan = NoopSpan; exports.Prompt = Prompt2; exports.ReadonlyAttachment = ReadonlyAttachment; exports.ReadonlyExperiment = ReadonlyExperiment; exports.SpanImpl = SpanImpl; exports.TestBackgroundLogger = TestBackgroundLogger; exports.UUIDGenerator = UUIDGenerator; exports.X_CACHED_HEADER = X_CACHED_HEADER; exports._exportsForTestingOnly = _exportsForTestingOnly; exports._internalGetGlobalState = _internalGetGlobalState; exports._internalSetInitialState = _internalSetInitialState; exports.braintrustStreamChunkSchema = braintrustStreamChunkSchema; exports.createFinalValuePassThroughStream = createFinalValuePassThroughStream; exports.currentExperiment = currentExperiment; exports.currentLogger = currentLogger; exports.currentSpan = currentSpan; exports.deepCopyEvent = deepCopyEvent; exports.default = browser_default; exports.deserializePlainStringAsJSON = deserializePlainStringAsJSON; exports.devNullWritableStream = devNullWritableStream; exports.evaluatorDefinitionSchema = evaluatorDefinitionSchema; exports.evaluatorDefinitionsSchema = evaluatorDefinitionsSchema; exports.flush = flush; exports.getContextManager = getContextManager; exports.getIdGenerator = getIdGenerator; exports.getPromptVersions = getPromptVersions; exports.getSpanParentObject = getSpanParentObject; exports.graph = graph_framework_exports; exports.init = init; exports.initDataset = initDataset; exports.initExperiment = initExperiment; exports.initFunction = initFunction; exports.initLogger = initLogger; exports.invoke = invoke; exports.loadPrompt = loadPrompt; exports.log = log; exports.logError = logError; exports.login = login; exports.loginToState = loginToState; exports.newId = newId; exports.parseCachedHeader = parseCachedHeader; exports.permalink = permalink; exports.renderMessage = renderMessage; exports.renderPromptParams = renderPromptParams; exports.setFetch = setFetch; exports.setMaskingFunction = setMaskingFunction; exports.spanComponentsToObjectId = spanComponentsToObjectId; exports.startSpan = startSpan; exports.summarize = summarize; exports.traceable = traceable; exports.traced = traced; exports.updateSpan = updateSpan; exports.withCurrent = withCurrent; exports.withDataset = withDataset; exports.withExperiment = withExperiment; exports.withLogger = withLogger; exports.withParent = withParent; exports.wrapAISDK = wrapAISDK; exports.wrapAnthropic = wrapAnthropic; exports.wrapClaudeAgentSDK = wrapClaudeAgentSDK; exports.wrapGoogleGenAI = wrapGoogleGenAI; exports.wrapMastraAgent = wrapMastraAgent; exports.wrapOpenAI = wrapOpenAI; exports.wrapOpenAIv4 = wrapOpenAIv4; exports.wrapTraced = wrapTraced;
11337
+
11338
+ exports.Attachment = Attachment; exports.BaseAttachment = BaseAttachment; exports.BraintrustMiddleware = BraintrustMiddleware; exports.BraintrustState = BraintrustState; exports.BraintrustStream = BraintrustStream; exports.ContextManager = ContextManager; exports.Dataset = Dataset2; exports.ERR_PERMALINK = ERR_PERMALINK; exports.Experiment = Experiment2; exports.ExternalAttachment = ExternalAttachment; exports.FailedHTTPResponse = FailedHTTPResponse; exports.IDGenerator = IDGenerator; exports.INTERNAL_BTQL_LIMIT = INTERNAL_BTQL_LIMIT; exports.JSONAttachment = JSONAttachment; exports.LEGACY_CACHED_HEADER = LEGACY_CACHED_HEADER; exports.LazyValue = LazyValue; exports.Logger = Logger; exports.LoginInvalidOrgError = LoginInvalidOrgError; exports.NOOP_SPAN = NOOP_SPAN; exports.NOOP_SPAN_PERMALINK = NOOP_SPAN_PERMALINK; exports.NoopSpan = NoopSpan; exports.Prompt = Prompt2; exports.ReadonlyAttachment = ReadonlyAttachment; exports.ReadonlyExperiment = ReadonlyExperiment; exports.SpanImpl = SpanImpl; exports.TestBackgroundLogger = TestBackgroundLogger; exports.UUIDGenerator = UUIDGenerator; exports.X_CACHED_HEADER = X_CACHED_HEADER; exports._exportsForTestingOnly = _exportsForTestingOnly; exports._internalGetGlobalState = _internalGetGlobalState; exports._internalSetInitialState = _internalSetInitialState; exports.braintrustStreamChunkSchema = braintrustStreamChunkSchema; exports.createFinalValuePassThroughStream = createFinalValuePassThroughStream; exports.currentExperiment = currentExperiment; exports.currentLogger = currentLogger; exports.currentSpan = currentSpan; exports.deepCopyEvent = deepCopyEvent; exports.default = browser_default; exports.deserializePlainStringAsJSON = deserializePlainStringAsJSON; exports.devNullWritableStream = devNullWritableStream; exports.evaluatorDefinitionSchema = evaluatorDefinitionSchema; exports.evaluatorDefinitionsSchema = evaluatorDefinitionsSchema; exports.flush = flush; exports.getContextManager = getContextManager; exports.getIdGenerator = getIdGenerator; exports.getPromptVersions = getPromptVersions; exports.getSpanParentObject = getSpanParentObject; exports.graph = graph_framework_exports; exports.init = init; exports.initDataset = initDataset; exports.initExperiment = initExperiment; exports.initFunction = initFunction; exports.initLogger = initLogger; exports.invoke = invoke; exports.loadPrompt = loadPrompt; exports.log = log; exports.logError = logError; exports.login = login; exports.loginToState = loginToState; exports.newId = newId; exports.parseCachedHeader = parseCachedHeader; exports.permalink = permalink; exports.renderMessage = renderMessage; exports.renderPromptParams = renderPromptParams; exports.setFetch = setFetch; exports.setMaskingFunction = setMaskingFunction; exports.spanComponentsToObjectId = spanComponentsToObjectId; exports.startSpan = startSpan; exports.summarize = summarize; exports.traceable = traceable; exports.traced = traced; exports.updateSpan = updateSpan; exports.withCurrent = withCurrent; exports.withDataset = withDataset; exports.withExperiment = withExperiment; exports.withLogger = withLogger; exports.withParent = withParent; exports.wrapAISDK = wrapAISDK; exports.wrapAnthropic = wrapAnthropic; exports.wrapClaudeAgentSDK = wrapClaudeAgentSDK; exports.wrapGoogleGenAI = wrapGoogleGenAI; exports.wrapMastraAgent = wrapMastraAgent; exports.wrapOpenAI = wrapOpenAI; exports.wrapOpenAIv4 = wrapOpenAIv4; exports.wrapTraced = wrapTraced;
package/dist/browser.mjs CHANGED
@@ -3249,6 +3249,12 @@ function getMustacheVars(prompt) {
3249
3249
  var BRAINTRUST_ATTACHMENT = BraintrustAttachmentReference.shape.type.value;
3250
3250
  var EXTERNAL_ATTACHMENT = ExternalAttachmentReference.shape.type.value;
3251
3251
  var BRAINTRUST_PARAMS = Object.keys(BraintrustModelParams.shape);
3252
+ var LoginInvalidOrgError = class extends Error {
3253
+ constructor(message) {
3254
+ super(message);
3255
+ this.message = message;
3256
+ }
3257
+ };
3252
3258
  var REDACTION_FIELDS = [
3253
3259
  "input",
3254
3260
  "output",
@@ -5903,7 +5909,7 @@ function wrapTraced(fn, args) {
5903
5909
  return wrapTracedAsyncGenerator(fn, spanArgs, !!noTraceIO);
5904
5910
  }
5905
5911
  if (args?.asyncFlush) {
5906
- return (...fnArgs) => traced((span) => {
5912
+ return ((...fnArgs) => traced((span) => {
5907
5913
  if (!hasExplicitInput) {
5908
5914
  span.log({ input: fnArgs });
5909
5915
  }
@@ -5920,9 +5926,9 @@ function wrapTraced(fn, args) {
5920
5926
  }
5921
5927
  }
5922
5928
  return output;
5923
- }, spanArgs);
5929
+ }, spanArgs));
5924
5930
  } else {
5925
- return (...fnArgs) => traced(async (span) => {
5931
+ return ((...fnArgs) => traced(async (span) => {
5926
5932
  if (!hasExplicitInput) {
5927
5933
  span.log({ input: fnArgs });
5928
5934
  }
@@ -5932,7 +5938,7 @@ function wrapTraced(fn, args) {
5932
5938
  span.log({ output });
5933
5939
  }
5934
5940
  return output;
5935
- }, spanArgs);
5941
+ }, spanArgs));
5936
5942
  }
5937
5943
  }
5938
5944
  var traceable = wrapTraced;
@@ -6039,7 +6045,9 @@ function withParent(parent, callback, state = void 0) {
6039
6045
  }
6040
6046
  function _saveOrgInfo(state, org_info, org_name) {
6041
6047
  if (org_info.length === 0) {
6042
- throw new Error("This user is not part of any organizations.");
6048
+ throw new LoginInvalidOrgError(
6049
+ "This user is not part of any organizations."
6050
+ );
6043
6051
  }
6044
6052
  for (const org of org_info) {
6045
6053
  if (org_name === void 0 || org.name === org_name) {
@@ -6052,7 +6060,7 @@ function _saveOrgInfo(state, org_info, org_name) {
6052
6060
  }
6053
6061
  }
6054
6062
  if (state.orgId === void 0) {
6055
- throw new Error(
6063
+ throw new LoginInvalidOrgError(
6056
6064
  `Organization ${org_name} not found. Must be one of ${org_info.map((x) => x.name).join(", ")}`
6057
6065
  );
6058
6066
  }
@@ -7751,6 +7759,7 @@ __export(exports_browser_exports, {
7751
7759
  LEGACY_CACHED_HEADER: () => LEGACY_CACHED_HEADER,
7752
7760
  LazyValue: () => LazyValue,
7753
7761
  Logger: () => Logger,
7762
+ LoginInvalidOrgError: () => LoginInvalidOrgError,
7754
7763
  NOOP_SPAN: () => NOOP_SPAN,
7755
7764
  NOOP_SPAN_PERMALINK: () => NOOP_SPAN_PERMALINK,
7756
7765
  NoopSpan: () => NoopSpan,
@@ -10282,7 +10291,7 @@ function wrapClaudeAgentQuery(queryFn, defaultThis) {
10282
10291
  }
10283
10292
  currentMessages.length = 0;
10284
10293
  };
10285
- const wrappedGenerator = async function* () {
10294
+ const wrappedGenerator = (async function* () {
10286
10295
  try {
10287
10296
  const invocationTarget = thisArg === proxy || thisArg === void 0 ? defaultThis ?? thisArg : thisArg;
10288
10297
  const generator = withCurrent(
@@ -10338,7 +10347,7 @@ function wrapClaudeAgentQuery(queryFn, defaultThis) {
10338
10347
  } finally {
10339
10348
  span.end();
10340
10349
  }
10341
- }();
10350
+ })();
10342
10351
  return wrappedGenerator;
10343
10352
  }
10344
10353
  });
@@ -11258,6 +11267,7 @@ export {
11258
11267
  LEGACY_CACHED_HEADER,
11259
11268
  LazyValue,
11260
11269
  Logger,
11270
+ LoginInvalidOrgError,
11261
11271
  NOOP_SPAN,
11262
11272
  NOOP_SPAN_PERMALINK,
11263
11273
  NoopSpan,