opensteer 0.8.10 → 0.8.11

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.cjs CHANGED
@@ -1040,6 +1040,9 @@ function isBrowserCoreError(value) {
1040
1040
  // ../browser-core/src/cdp-visual-stability.ts
1041
1041
  var DEFAULT_VISUAL_STABILITY_SETTLE_MS = 750;
1042
1042
 
1043
+ // ../browser-core/src/post-load-tracker.ts
1044
+ var DEFAULT_POST_LOAD_TRACKER_QUIET_WINDOW_MS = 400;
1045
+
1043
1046
  // ../protocol/src/identity.ts
1044
1047
  var refPrefixes = [
1045
1048
  "session",
@@ -6229,9 +6232,23 @@ var opensteerInspectStorageInputSchema = objectSchema(
6229
6232
  title: "OpensteerInspectStorageInput"
6230
6233
  }
6231
6234
  );
6235
+ var opensteerComputerMouseButtonSchema = enumSchema(["left", "middle", "right"], {
6236
+ title: "OpensteerComputerMouseButton"
6237
+ });
6238
+ var opensteerComputerKeyModifierSchema = enumSchema(
6239
+ ["Shift", "Control", "Alt", "Meta"],
6240
+ {
6241
+ title: "OpensteerComputerKeyModifier"
6242
+ }
6243
+ );
6232
6244
  var opensteerDomClickInputSchema = objectSchema(
6233
6245
  {
6234
6246
  target: opensteerTargetInputSchema,
6247
+ button: opensteerComputerMouseButtonSchema,
6248
+ clickCount: integerSchema({ minimum: 1 }),
6249
+ modifiers: arraySchema(opensteerComputerKeyModifierSchema, {
6250
+ uniqueItems: true
6251
+ }),
6235
6252
  persistAsDescription: stringSchema(),
6236
6253
  captureNetwork: stringSchema({ minLength: 1 })
6237
6254
  },
@@ -6331,18 +6348,6 @@ var opensteerSessionCloseOutputSchema = objectSchema(
6331
6348
  required: ["closed"]
6332
6349
  }
6333
6350
  );
6334
- var opensteerComputerMouseButtonSchema = enumSchema(
6335
- ["left", "middle", "right"],
6336
- {
6337
- title: "OpensteerComputerMouseButton"
6338
- }
6339
- );
6340
- var opensteerComputerKeyModifierSchema = enumSchema(
6341
- ["Shift", "Control", "Alt", "Meta"],
6342
- {
6343
- title: "OpensteerComputerKeyModifier"
6344
- }
6345
- );
6346
6351
  var opensteerComputerAnnotationSchema = enumSchema(opensteerComputerAnnotationNames, {
6347
6352
  title: "OpensteerComputerAnnotation"
6348
6353
  });
@@ -9083,6 +9088,7 @@ var NAVIGATION_VISUAL_STABILITY_PROFILE = {
9083
9088
  scope: "visible-frames",
9084
9089
  timeoutMs: 7e3
9085
9090
  };
9091
+ var NAVIGATION_POST_LOAD_CAPTURE_WINDOW_MS = 1e3;
9086
9092
  var defaultDomActionSettleObserver = {
9087
9093
  async settle(input) {
9088
9094
  if (input.trigger !== "dom-action") {
@@ -9118,6 +9124,13 @@ var defaultNavigationSettleObserver = {
9118
9124
  return false;
9119
9125
  }
9120
9126
  try {
9127
+ await input.engine.waitForPostLoadQuiet({
9128
+ pageRef: input.pageRef,
9129
+ timeoutMs: effectiveTimeout,
9130
+ quietMs: DEFAULT_POST_LOAD_TRACKER_QUIET_WINDOW_MS,
9131
+ captureWindowMs: Math.min(NAVIGATION_POST_LOAD_CAPTURE_WINDOW_MS, effectiveTimeout),
9132
+ signal: input.signal
9133
+ });
9121
9134
  await input.engine.waitForVisualStability({
9122
9135
  pageRef: input.pageRef,
9123
9136
  timeoutMs: effectiveTimeout,
@@ -10831,16 +10844,7 @@ var MemoryDomDescriptorStore = class {
10831
10844
  // ../runtime-core/src/action-boundary.ts
10832
10845
  var actionBoundaryDiagnosticsBySignal = /* @__PURE__ */ new WeakMap();
10833
10846
  async function captureActionBoundarySnapshot(engine, pageRef) {
10834
- const frames = await engine.listFrames({ pageRef });
10835
- const mainFrame = frames.find((frame) => frame.isMainFrame);
10836
- if (!mainFrame) {
10837
- throw new Error(`page ${pageRef} does not expose a main frame`);
10838
- }
10839
- return {
10840
- pageRef,
10841
- documentRef: mainFrame.documentRef,
10842
- url: mainFrame.url
10843
- };
10847
+ return engine.getActionBoundarySnapshot({ pageRef });
10844
10848
  }
10845
10849
  function createActionBoundaryDiagnostics(input) {
10846
10850
  return {
@@ -23735,6 +23739,9 @@ var OpensteerSessionRuntime = class {
23735
23739
  const result = await this.requireDom().click({
23736
23740
  pageRef,
23737
23741
  target,
23742
+ ...input.button === void 0 ? {} : { button: input.button },
23743
+ ...input.clickCount === void 0 ? {} : { clickCount: input.clickCount },
23744
+ ...input.modifiers === void 0 ? {} : { modifiers: input.modifiers },
23738
23745
  timeout
23739
23746
  });
23740
23747
  return {
@@ -33073,6 +33080,30 @@ var OpensteerCloudClient = class {
33073
33080
  });
33074
33081
  return await response.json();
33075
33082
  }
33083
+ async getSessionRecording(sessionId) {
33084
+ const response = await this.request(`/v1/sessions/${encodeURIComponent(sessionId)}/recording`, {
33085
+ method: "GET"
33086
+ });
33087
+ return await response.json();
33088
+ }
33089
+ async startSessionRecording(sessionId) {
33090
+ const response = await this.request(
33091
+ `/v1/sessions/${encodeURIComponent(sessionId)}/recording/start`,
33092
+ {
33093
+ method: "POST"
33094
+ }
33095
+ );
33096
+ return await response.json();
33097
+ }
33098
+ async stopSessionRecording(sessionId) {
33099
+ const response = await this.request(
33100
+ `/v1/sessions/${encodeURIComponent(sessionId)}/recording/stop`,
33101
+ {
33102
+ method: "POST"
33103
+ }
33104
+ );
33105
+ return await response.json();
33106
+ }
33076
33107
  async closeSession(sessionId) {
33077
33108
  const response = await this.request(`/v1/sessions/${encodeURIComponent(sessionId)}`, {
33078
33109
  method: "DELETE"
@@ -33263,9 +33294,11 @@ function resolveCloudConfig(input = {}) {
33263
33294
  if (!baseUrl || baseUrl.trim().length === 0) {
33264
33295
  throw new Error("provider=cloud requires OPENSTEER_BASE_URL or provider.baseUrl.");
33265
33296
  }
33297
+ const appBaseUrl = cloudProvider?.appBaseUrl ?? input.environment?.OPENSTEER_CLOUD_APP_BASE_URL;
33266
33298
  return {
33267
33299
  apiKey: apiKey.trim(),
33268
33300
  baseUrl: baseUrl.trim().replace(/\/+$/, ""),
33301
+ ...appBaseUrl === void 0 || appBaseUrl.trim().length === 0 ? {} : { appBaseUrl: appBaseUrl.trim().replace(/\/+$/, "") },
33269
33302
  ...cloudProvider?.browserProfile === void 0 ? {} : { browserProfile: cloudProvider.browserProfile }
33270
33303
  };
33271
33304
  }
@@ -34334,18 +34367,6 @@ function isLoopbackBaseUrl(baseUrl) {
34334
34367
  }
34335
34368
 
34336
34369
  // src/sdk/runtime-resolution.ts
34337
- var LOCAL_ONLY_RUNTIME_OPTION_KEYS = [
34338
- "launch",
34339
- "context",
34340
- "engine",
34341
- "engineFactory",
34342
- "policy",
34343
- "descriptorStore",
34344
- "extractionDescriptorStore",
34345
- "registryOverrides",
34346
- "observationSessionId",
34347
- "observationSink"
34348
- ];
34349
34370
  function resolveOpensteerRuntimeConfig(input = {}) {
34350
34371
  const environment = input.environment ?? process.env;
34351
34372
  const provider = resolveOpensteerProvider({
@@ -34370,15 +34391,8 @@ function createOpensteerSemanticRuntime(input = {}) {
34370
34391
  ...input.provider === void 0 ? {} : { provider: input.provider },
34371
34392
  ...input.environment === void 0 ? {} : { environment: input.environment }
34372
34393
  });
34373
- const localOnlyRuntimeOptions = listLocalOnlyRuntimeOptions(runtimeOptions);
34374
- const providerMode = config.provider.mode === "cloud" && config.provider.source !== "explicit" && localOnlyRuntimeOptions.length > 0 ? "local" : config.provider.mode;
34375
- if (config.provider.mode === "cloud" && config.provider.source === "explicit" && localOnlyRuntimeOptions.length > 0) {
34376
- throw new Error(
34377
- `provider=cloud does not support local runtime options: ${localOnlyRuntimeOptions.join(", ")}.`
34378
- );
34379
- }
34380
- assertProviderSupportsEngine(providerMode, engine);
34381
- if (providerMode === "cloud") {
34394
+ assertProviderSupportsEngine(config.provider.mode, engine);
34395
+ if (config.provider.mode === "cloud") {
34382
34396
  return new CloudSessionProxy(new OpensteerCloudClient(config.cloud), {
34383
34397
  ...runtimeOptions.rootDir === void 0 ? {} : { rootDir: runtimeOptions.rootDir },
34384
34398
  ...runtimeOptions.rootPath === void 0 ? {} : { rootPath: runtimeOptions.rootPath },
@@ -34392,9 +34406,6 @@ function createOpensteerSemanticRuntime(input = {}) {
34392
34406
  engineName: engine
34393
34407
  });
34394
34408
  }
34395
- function listLocalOnlyRuntimeOptions(runtimeOptions) {
34396
- return LOCAL_ONLY_RUNTIME_OPTION_KEYS.filter((key) => runtimeOptions[key] !== void 0);
34397
- }
34398
34409
 
34399
34410
  // src/sdk/opensteer.ts
34400
34411
  var Opensteer = class {
@@ -34485,7 +34496,13 @@ var Opensteer = class {
34485
34496
  return this.runtime.addInitScript(normalized);
34486
34497
  }
34487
34498
  async click(input) {
34488
- const normalized = normalizeTargetOptions(input);
34499
+ const { button, clickCount, modifiers, ...target } = input;
34500
+ const normalized = {
34501
+ ...normalizeTargetOptions(target),
34502
+ ...button === void 0 ? {} : { button },
34503
+ ...clickCount === void 0 ? {} : { clickCount },
34504
+ ...modifiers === void 0 ? {} : { modifiers }
34505
+ };
34489
34506
  return this.runtime.click(normalized);
34490
34507
  }
34491
34508
  async hover(input) {