@withgateway/sdk 0.2.2 → 0.2.3

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/index.d.mts CHANGED
@@ -7,7 +7,7 @@ export { GatewayAgentDescriptor, GatewaySecurity, GatewaySecurityConfig, Gateway
7
7
  export { DEFAULT_TIMEOUT_SECONDS, ENV_GATEWAY_HOST, ENV_GATEWAY_PUBLIC_KEY, ENV_GATEWAY_SECRET_KEY, LoadSessionOptions, SessionLoadError, SessionObservation, SessionRecording, SessionTrace, basicAuthHeader, loadSession, sessionObservationFromApi, sessions } from './sessions/index.mjs';
8
8
  export { UserEvent, UserEventOptions, UserProfile, UserProfileError, UserProfileUpdate, UsersClient, UsersClientConfig, UsersClientFromEnvConfig, users } from './users/index.mjs';
9
9
  export { AGENT_ID_KEY, SUCCESS_METRIC_NAME_KEY, SUCCESS_SIGNAL_KEY, ScoreDataType, ScoreError, ScoreOptions, ScoresClient, ScoresClientConfig, ScoresClientFromEnvConfig, SuccessOptions, currentTraceId, scores, success } from './scores/index.mjs';
10
- export { BrowserActionEvent, BrowserActionRecorder, BrowserMode, BrowserPage, COMPUTER_USE_SPECS, DEFAULT_BRANCH, DEFAULT_VIEWPORT, DispatchedRun, EVENT_BATCH_SIZE, EVENT_FLUSH_INTERVAL_MS, EVENT_MAX_RETRIES, GradeResult, IngestExplode, IngestFieldSpec, IngestMapping, IngestMode, IngestOptions, IngestRefusal, IngestReport, IngestSource, IngestSourceReport, IngestToolCallsOptions, IngestToolCallsReport, LocalMeta, MigrateWorldOptions, ObservationConversion, ObservationLike, OpenSessionOptions, ParsedToolCall, Plaintext, PlaywrightBrowserLike, PlaywrightLike, RedactMode, RedactPolicy, Redaction, ResolvedWorldVersion, RunConfigInput, RunConfigSummary, RunProvenance, RunReport, STRIP_PREFIX, SURFACE_KINDS, SeedResult, SessionRunReport, SessionRunResult, SessionSurfaces, TRANSFORMS, ToolCallRecord, ToolCallSink, ToolFunctions, Transform, ValidateReport, ValidatedRun, WHITESPACE, WorldBrowser, WorldDependency, WorldDeprecation, WorldDescription, WorldEntity, WorldEntityMapping, WorldField, WorldMigrationRefusal, WorldMigrationReport, WorldQueryAcrossOptions, WorldQueryAcrossResult, WorldQueryCompare, WorldQueryCompareStatus, WorldQueryGroup, WorldQueryOptions, WorldQueryResult, WorldQuerySnapshot, WorldQueryWhere, WorldRelationship, WorldSession, WorldSessionCall, WorldSessionCallError, WorldSessionState, WorldSessionTask, WorldSessionTimeout, WorldSet, WorldSurfaceKind, WorldSurfaceUnavailable, WorldTask, WorldTaskCheck, WorldTaskDetail, WorldTaskFieldOp, WorldTaskGrader, WorldTaskIdRef, WorldTaskInfo, WorldTaskPage, WorldTaskRef, WorldTaskRubricCriterion, WorldTaskRubricGrader, WorldTaskScalar, WorldTaskSeed, WorldTaskSpec, WorldTaskSummary, WorldTaskValidation, WorldTaskVersionSummary, WorldToolSpec, WorldToolkit, WorldsClientOptions, apiRequest, applyTransforms, attachSession, buildSourceTarball, captureToolCalls, collectArchiveRelPaths, computeContentHash, computerUseToolkit, createRef, createTask, deleteEnvSecret, deleteTask, describeWorld, detectProvenance, getRun, getTask, hashForm, ingest, ingestToolCalls, isIncludedInContentHash, isTaskIdRef, isTaskSpec, listEnvSecretKeys, listRunConfigs, listTasks, localTreeState, migrateProjectWorlds, migrateWorld, openBrowser, openSession, openWorld, parseToolCallRecord, parseTransform, parseWorldTaskRefs, preserveForm, propose, pull, push, pyText, queryRows, queryRowsSearch, readLocalMeta, readToolCallRecords, redactActionArgs, redactionOf, resolveBrowserMode, roundForm, runSessions, schemaFromSignature, sessionToolObservations, setEnvSecret, shapeText, snapshotTreeHashes, storedForms, surfaceKinds, taskLabel, toolCallRecordsIn, toolCallsFromObservations, uiEntryUrl, uiUrl, updateTask, upsertRunConfig, validateTask, validateWorld, waitForRun, withoutUiToken, writeLocalMeta } from './worlds/index.mjs';
10
+ export { ApiError, BrowserActionEvent, BrowserActionRecorder, BrowserMode, BrowserPage, COMPUTER_USE_SPECS, DEFAULT_BRANCH, DEFAULT_VIEWPORT, DispatchedRun, EVENT_BATCH_SIZE, EVENT_FLUSH_INTERVAL_MS, EVENT_MAX_RETRIES, GradeResult, IngestExplode, IngestFieldSpec, IngestMapping, IngestMode, IngestOptions, IngestRefusal, IngestReport, IngestSource, IngestSourceReport, IngestToolCallsOptions, IngestToolCallsReport, LocalMeta, MigrateWorldOptions, ObservationConversion, ObservationLike, OpenSessionOptions, ParsedToolCall, Plaintext, PlaywrightBrowserLike, PlaywrightLike, RedactMode, RedactPolicy, Redaction, ResolvedWorldVersion, RunConfigInput, RunConfigSummary, RunProvenance, RunReport, STRIP_PREFIX, SURFACE_KINDS, SeedResult, SessionRunReport, SessionRunResult, SessionSurfaces, TRANSFORMS, ToolCallRecord, ToolCallSink, ToolFunctions, Transform, ValidateReport, ValidatedRun, WHITESPACE, WorldBrowser, WorldDependency, WorldDeprecation, WorldDescription, WorldEntity, WorldEntityMapping, WorldField, WorldMigrationRefusal, WorldMigrationReport, WorldQueryAcrossOptions, WorldQueryAcrossResult, WorldQueryCompare, WorldQueryCompareStatus, WorldQueryGroup, WorldQueryOptions, WorldQueryResult, WorldQuerySnapshot, WorldQueryWhere, WorldRelationship, WorldSession, WorldSessionCall, WorldSessionCallError, WorldSessionState, WorldSessionTask, WorldSessionTimeout, WorldSet, WorldSurfaceKind, WorldSurfaceUnavailable, WorldTask, WorldTaskCheck, WorldTaskDetail, WorldTaskFieldOp, WorldTaskGrader, WorldTaskIdRef, WorldTaskInfo, WorldTaskPage, WorldTaskRef, WorldTaskRubricCriterion, WorldTaskRubricGrader, WorldTaskScalar, WorldTaskSeed, WorldTaskSpec, WorldTaskSummary, WorldTaskValidation, WorldTaskVersionSummary, WorldToolSpec, WorldToolkit, WorldsClientOptions, apiRequest, applyTransforms, attachSession, buildSourceTarball, captureToolCalls, collectArchiveRelPaths, computeContentHash, computerUseToolkit, createRef, createTask, deleteEnvSecret, deleteTask, describeWorld, detectProvenance, getRun, getTask, hashForm, ingest, ingestToolCalls, isIncludedInContentHash, isTaskIdRef, isTaskSpec, listEnvSecretKeys, listRunConfigs, listTasks, localTreeState, migrateProjectWorlds, migrateWorld, openBrowser, openSession, openWorld, parseToolCallRecord, parseTransform, parseWorldTaskRefs, preserveForm, propose, pull, push, pyText, queryRows, queryRowsSearch, readLocalMeta, readToolCallRecords, redactActionArgs, redactionOf, resolveBrowserMode, roundForm, runSessions, schemaFromSignature, sessionToolObservations, setEnvSecret, shapeText, snapshotTreeHashes, storedForms, surfaceKinds, taskLabel, toolCallRecordsIn, toolCallsFromObservations, uiEntryUrl, uiUrl, updateTask, upsertRunConfig, validateTask, validateWorld, waitForRun, withoutUiToken, writeLocalMeta } from './worlds/index.mjs';
11
11
  export { i as files } from './index-CdbmO4aX.mjs';
12
12
  export { i as traces } from './index-CiKWoroJ.mjs';
13
13
  import { _ as _tracingModule } from './index-B5HUQQDE.mjs';
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { GatewayAgentDescriptor, GatewaySecurity, GatewaySecurityConfig, Gateway
7
7
  export { DEFAULT_TIMEOUT_SECONDS, ENV_GATEWAY_HOST, ENV_GATEWAY_PUBLIC_KEY, ENV_GATEWAY_SECRET_KEY, LoadSessionOptions, SessionLoadError, SessionObservation, SessionRecording, SessionTrace, basicAuthHeader, loadSession, sessionObservationFromApi, sessions } from './sessions/index.js';
8
8
  export { UserEvent, UserEventOptions, UserProfile, UserProfileError, UserProfileUpdate, UsersClient, UsersClientConfig, UsersClientFromEnvConfig, users } from './users/index.js';
9
9
  export { AGENT_ID_KEY, SUCCESS_METRIC_NAME_KEY, SUCCESS_SIGNAL_KEY, ScoreDataType, ScoreError, ScoreOptions, ScoresClient, ScoresClientConfig, ScoresClientFromEnvConfig, SuccessOptions, currentTraceId, scores, success } from './scores/index.js';
10
- export { BrowserActionEvent, BrowserActionRecorder, BrowserMode, BrowserPage, COMPUTER_USE_SPECS, DEFAULT_BRANCH, DEFAULT_VIEWPORT, DispatchedRun, EVENT_BATCH_SIZE, EVENT_FLUSH_INTERVAL_MS, EVENT_MAX_RETRIES, GradeResult, IngestExplode, IngestFieldSpec, IngestMapping, IngestMode, IngestOptions, IngestRefusal, IngestReport, IngestSource, IngestSourceReport, IngestToolCallsOptions, IngestToolCallsReport, LocalMeta, MigrateWorldOptions, ObservationConversion, ObservationLike, OpenSessionOptions, ParsedToolCall, Plaintext, PlaywrightBrowserLike, PlaywrightLike, RedactMode, RedactPolicy, Redaction, ResolvedWorldVersion, RunConfigInput, RunConfigSummary, RunProvenance, RunReport, STRIP_PREFIX, SURFACE_KINDS, SeedResult, SessionRunReport, SessionRunResult, SessionSurfaces, TRANSFORMS, ToolCallRecord, ToolCallSink, ToolFunctions, Transform, ValidateReport, ValidatedRun, WHITESPACE, WorldBrowser, WorldDependency, WorldDeprecation, WorldDescription, WorldEntity, WorldEntityMapping, WorldField, WorldMigrationRefusal, WorldMigrationReport, WorldQueryAcrossOptions, WorldQueryAcrossResult, WorldQueryCompare, WorldQueryCompareStatus, WorldQueryGroup, WorldQueryOptions, WorldQueryResult, WorldQuerySnapshot, WorldQueryWhere, WorldRelationship, WorldSession, WorldSessionCall, WorldSessionCallError, WorldSessionState, WorldSessionTask, WorldSessionTimeout, WorldSet, WorldSurfaceKind, WorldSurfaceUnavailable, WorldTask, WorldTaskCheck, WorldTaskDetail, WorldTaskFieldOp, WorldTaskGrader, WorldTaskIdRef, WorldTaskInfo, WorldTaskPage, WorldTaskRef, WorldTaskRubricCriterion, WorldTaskRubricGrader, WorldTaskScalar, WorldTaskSeed, WorldTaskSpec, WorldTaskSummary, WorldTaskValidation, WorldTaskVersionSummary, WorldToolSpec, WorldToolkit, WorldsClientOptions, apiRequest, applyTransforms, attachSession, buildSourceTarball, captureToolCalls, collectArchiveRelPaths, computeContentHash, computerUseToolkit, createRef, createTask, deleteEnvSecret, deleteTask, describeWorld, detectProvenance, getRun, getTask, hashForm, ingest, ingestToolCalls, isIncludedInContentHash, isTaskIdRef, isTaskSpec, listEnvSecretKeys, listRunConfigs, listTasks, localTreeState, migrateProjectWorlds, migrateWorld, openBrowser, openSession, openWorld, parseToolCallRecord, parseTransform, parseWorldTaskRefs, preserveForm, propose, pull, push, pyText, queryRows, queryRowsSearch, readLocalMeta, readToolCallRecords, redactActionArgs, redactionOf, resolveBrowserMode, roundForm, runSessions, schemaFromSignature, sessionToolObservations, setEnvSecret, shapeText, snapshotTreeHashes, storedForms, surfaceKinds, taskLabel, toolCallRecordsIn, toolCallsFromObservations, uiEntryUrl, uiUrl, updateTask, upsertRunConfig, validateTask, validateWorld, waitForRun, withoutUiToken, writeLocalMeta } from './worlds/index.js';
10
+ export { ApiError, BrowserActionEvent, BrowserActionRecorder, BrowserMode, BrowserPage, COMPUTER_USE_SPECS, DEFAULT_BRANCH, DEFAULT_VIEWPORT, DispatchedRun, EVENT_BATCH_SIZE, EVENT_FLUSH_INTERVAL_MS, EVENT_MAX_RETRIES, GradeResult, IngestExplode, IngestFieldSpec, IngestMapping, IngestMode, IngestOptions, IngestRefusal, IngestReport, IngestSource, IngestSourceReport, IngestToolCallsOptions, IngestToolCallsReport, LocalMeta, MigrateWorldOptions, ObservationConversion, ObservationLike, OpenSessionOptions, ParsedToolCall, Plaintext, PlaywrightBrowserLike, PlaywrightLike, RedactMode, RedactPolicy, Redaction, ResolvedWorldVersion, RunConfigInput, RunConfigSummary, RunProvenance, RunReport, STRIP_PREFIX, SURFACE_KINDS, SeedResult, SessionRunReport, SessionRunResult, SessionSurfaces, TRANSFORMS, ToolCallRecord, ToolCallSink, ToolFunctions, Transform, ValidateReport, ValidatedRun, WHITESPACE, WorldBrowser, WorldDependency, WorldDeprecation, WorldDescription, WorldEntity, WorldEntityMapping, WorldField, WorldMigrationRefusal, WorldMigrationReport, WorldQueryAcrossOptions, WorldQueryAcrossResult, WorldQueryCompare, WorldQueryCompareStatus, WorldQueryGroup, WorldQueryOptions, WorldQueryResult, WorldQuerySnapshot, WorldQueryWhere, WorldRelationship, WorldSession, WorldSessionCall, WorldSessionCallError, WorldSessionState, WorldSessionTask, WorldSessionTimeout, WorldSet, WorldSurfaceKind, WorldSurfaceUnavailable, WorldTask, WorldTaskCheck, WorldTaskDetail, WorldTaskFieldOp, WorldTaskGrader, WorldTaskIdRef, WorldTaskInfo, WorldTaskPage, WorldTaskRef, WorldTaskRubricCriterion, WorldTaskRubricGrader, WorldTaskScalar, WorldTaskSeed, WorldTaskSpec, WorldTaskSummary, WorldTaskValidation, WorldTaskVersionSummary, WorldToolSpec, WorldToolkit, WorldsClientOptions, apiRequest, applyTransforms, attachSession, buildSourceTarball, captureToolCalls, collectArchiveRelPaths, computeContentHash, computerUseToolkit, createRef, createTask, deleteEnvSecret, deleteTask, describeWorld, detectProvenance, getRun, getTask, hashForm, ingest, ingestToolCalls, isIncludedInContentHash, isTaskIdRef, isTaskSpec, listEnvSecretKeys, listRunConfigs, listTasks, localTreeState, migrateProjectWorlds, migrateWorld, openBrowser, openSession, openWorld, parseToolCallRecord, parseTransform, parseWorldTaskRefs, preserveForm, propose, pull, push, pyText, queryRows, queryRowsSearch, readLocalMeta, readToolCallRecords, redactActionArgs, redactionOf, resolveBrowserMode, roundForm, runSessions, schemaFromSignature, sessionToolObservations, setEnvSecret, shapeText, snapshotTreeHashes, storedForms, surfaceKinds, taskLabel, toolCallRecordsIn, toolCallsFromObservations, uiEntryUrl, uiUrl, updateTask, upsertRunConfig, validateTask, validateWorld, waitForRun, withoutUiToken, writeLocalMeta } from './worlds/index.js';
11
11
  export { i as files } from './index-CLkMr6VG.js';
12
12
  export { i as traces } from './index-BgvvQ3BC.js';
13
13
  import { _ as _tracingModule } from './index-Dpo-t8iO.js';
package/dist/index.js CHANGED
@@ -1354,7 +1354,7 @@ async function push(dir, opts = {}) {
1354
1354
  const pyproject = readPyproject(dir);
1355
1355
  const contractVersion = pyproject.version ? void 0 : readWorldContractVersion(dir).version;
1356
1356
  if (contractVersion) pyproject.version = contractVersion;
1357
- const slug = opts.slug ?? pyproject.name ?? path.basename(path.resolve(dir));
1357
+ const slug = opts.slug ?? localMeta.slug ?? pyproject.name ?? path.basename(path.resolve(dir));
1358
1358
  const resolve7 = await apiRequest(
1359
1359
  options,
1360
1360
  "POST",
@@ -3488,6 +3488,7 @@ var init_ingest = __esm({
3488
3488
  // src/worlds/index.ts
3489
3489
  var worlds_exports = {};
3490
3490
  __export(worlds_exports, {
3491
+ ApiError: () => ApiError2,
3491
3492
  BrowserActionRecorder: () => BrowserActionRecorder,
3492
3493
  COMPUTER_USE_SPECS: () => COMPUTER_USE_SPECS,
3493
3494
  DEFAULT_BRANCH: () => DEFAULT_BRANCH,
@@ -3596,11 +3597,7 @@ async function apiRequest(options, method, path9, body) {
3596
3597
  ...body === void 0 ? {} : { body: JSON.stringify(body) }
3597
3598
  });
3598
3599
  const text2 = await res.text();
3599
- if (!res.ok) {
3600
- throw new Error(
3601
- `${method} ${path9} -> ${res.status}: ${text2.slice(0, 400)}`
3602
- );
3603
- }
3600
+ if (!res.ok) throw new ApiError2(res.status, method, path9, text2.slice(0, 400));
3604
3601
  return JSON.parse(text2);
3605
3602
  }
3606
3603
  async function setEnvSecret(slug, key, value, options = {}) {
@@ -3752,7 +3749,7 @@ async function openWorld(slugRef, options = {}) {
3752
3749
  }
3753
3750
  return world;
3754
3751
  }
3755
- var WorldTask, WorldSet;
3752
+ var ApiError2, WorldTask, WorldSet;
3756
3753
  var init_worlds = __esm({
3757
3754
  "src/worlds/index.ts"() {
3758
3755
  "use strict";
@@ -3767,6 +3764,13 @@ var init_worlds = __esm({
3767
3764
  init_query();
3768
3765
  init_migrate();
3769
3766
  init_ingest();
3767
+ ApiError2 = class extends Error {
3768
+ constructor(status, method, path9, body) {
3769
+ super(`${method} ${path9} -> ${status}: ${body}`);
3770
+ this.status = status;
3771
+ this.name = "ApiError";
3772
+ }
3773
+ };
3770
3774
  WorldTask = class {
3771
3775
  constructor(world, name, variant) {
3772
3776
  this.world = world;
@@ -3837,7 +3841,7 @@ var require_package = __commonJS({
3837
3841
  "package.json"(exports2, module2) {
3838
3842
  module2.exports = {
3839
3843
  name: "@withgateway/sdk",
3840
- version: "0.2.2",
3844
+ version: "0.2.3",
3841
3845
  description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
3842
3846
  main: "./dist/index.js",
3843
3847
  module: "./dist/index.mjs",
@@ -4030,6 +4034,7 @@ var require_package = __commonJS({
4030
4034
  var src_exports = {};
4031
4035
  __export(src_exports, {
4032
4036
  AGENT_ID_KEY: () => AGENT_ID_KEY,
4037
+ ApiError: () => ApiError2,
4033
4038
  BrowserActionRecorder: () => BrowserActionRecorder,
4034
4039
  COMPUTER_USE_SPECS: () => COMPUTER_USE_SPECS,
4035
4040
  DEFAULT_BRANCH: () => DEFAULT_BRANCH,
@@ -8164,6 +8169,7 @@ var tracing = {
8164
8169
  // Annotate the CommonJS export names for ESM import in node:
8165
8170
  0 && (module.exports = {
8166
8171
  AGENT_ID_KEY,
8172
+ ApiError,
8167
8173
  BrowserActionRecorder,
8168
8174
  COMPUTER_USE_SPECS,
8169
8175
  DEFAULT_BRANCH,