opensteer 0.9.5 → 0.9.7
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/{chunk-7LQL5YUR.js → chunk-3OHKIPBD.js} +571 -738
- package/dist/chunk-3OHKIPBD.js.map +1 -0
- package/dist/chunk-52UNH5UW.js +458 -0
- package/dist/chunk-52UNH5UW.js.map +1 -0
- package/dist/{chunk-GSCQQKZZ.js → chunk-PJXN7HED.js} +334 -18
- package/dist/chunk-PJXN7HED.js.map +1 -0
- package/dist/{chunk-ZRF7WMS3.js → chunk-R33BXCMQ.js} +16 -7
- package/dist/chunk-R33BXCMQ.js.map +1 -0
- package/dist/{chunk-T5P2QGZ3.js → chunk-U4BUCIZ4.js} +153 -12
- package/dist/chunk-U4BUCIZ4.js.map +1 -0
- package/dist/cli/bin.cjs +1421 -824
- package/dist/cli/bin.cjs.map +1 -1
- package/dist/cli/bin.js +286 -129
- package/dist/cli/bin.js.map +1 -1
- package/dist/index.cjs +1117 -703
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -53
- package/dist/index.d.ts +58 -53
- package/dist/index.js +4 -4
- package/dist/local-view/public/assets/app.js +10 -1
- package/dist/local-view/serve-entry.cjs +6815 -1272
- package/dist/local-view/serve-entry.cjs.map +1 -1
- package/dist/local-view/serve-entry.js +2 -2
- package/dist/opensteer-CY2QUJEG.js +6 -0
- package/dist/{opensteer-T2JENADR.js.map → opensteer-CY2QUJEG.js.map} +1 -1
- package/dist/{session-control-M3JD7ZKA.js → session-control-FIP6ZJLH.js} +4 -4
- package/dist/{session-control-M3JD7ZKA.js.map → session-control-FIP6ZJLH.js.map} +1 -1
- package/package.json +7 -7
- package/dist/chunk-7D45QUZ3.js +0 -332
- package/dist/chunk-7D45QUZ3.js.map +0 -1
- package/dist/chunk-7LQL5YUR.js.map +0 -1
- package/dist/chunk-GSCQQKZZ.js.map +0 -1
- package/dist/chunk-T5P2QGZ3.js.map +0 -1
- package/dist/chunk-ZRF7WMS3.js.map +0 -1
- package/dist/opensteer-T2JENADR.js +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { filePathToUri, resolveStoragePath, encodePathSegment, ensureDirectory, pathExists, readJsonFile, writeJsonFileAtomic, normalizeTimestamp, withFilesystemLock, resolveLocalViewPreferencesPath, resolveLocalViewServiceLockDir, readLocalViewServiceState, isLocalViewServiceStateLive, clearLocalViewServiceState, getLocalViewServiceStateLiveness, clearPersistedSessionRecord, writePersistedSessionRecord, isProcessRunning, readPersistedLocalBrowserSessionRecord, buildLocalViewSessionId, selectAttachBrowserCandidate, resolveChromeExecutablePath, readDevToolsActivePort,
|
|
1
|
+
import { filePathToUri, resolveStoragePath, encodePathSegment, ensureDirectory, pathExists, readJsonFile, writeJsonFileAtomic, normalizeTimestamp, withFilesystemLock, resolveLocalViewPreferencesPath, resolveLocalViewServiceLockDir, readLocalViewServiceState, isLocalViewServiceStateLive, clearLocalViewServiceState, getLocalViewServiceStateLiveness, clearPersistedSessionRecord, writePersistedSessionRecord, isAttachedLocalBrowserSessionReachable, isProcessRunning, readPersistedLocalBrowserSessionRecord, getPersistedLocalBrowserSessionOwnership, buildLocalViewSessionId, inspectCdpEndpoint, selectAttachBrowserCandidate, resolveChromeExecutablePath, readDevToolsActivePort, normalizeNonEmptyString, toCanonicalJsonValue, canonicalJsonString, sha256Hex, joinStoragePath, writeBufferIfMissing, writeJsonFileExclusive, isAlreadyExistsError, readBinaryFile, listJsonFiles, expandHome, createLocalViewSessionManifest, writeLocalViewSessionManifest, deleteLocalViewSessionManifest, CURRENT_PROCESS_OWNER, getProcessLiveness, processOwnersEqual, parseProcessOwner } from './chunk-U4BUCIZ4.js';
|
|
2
2
|
import path7, { join, resolve, dirname, relative } from 'path';
|
|
3
3
|
import { randomBytes, randomUUID } from 'crypto';
|
|
4
4
|
import { spawn } from 'child_process';
|
|
@@ -295,6 +295,218 @@ function mediaTypeExtension(mediaType) {
|
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
+
// ../protocol/src/json.ts
|
|
299
|
+
var JSON_SCHEMA_DRAFT_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
|
300
|
+
function defineSchema(schema) {
|
|
301
|
+
return schema;
|
|
302
|
+
}
|
|
303
|
+
function stringSchema(options = {}) {
|
|
304
|
+
return defineSchema({
|
|
305
|
+
type: "string",
|
|
306
|
+
...options
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
function numberSchema(options = {}) {
|
|
310
|
+
return defineSchema({
|
|
311
|
+
type: "number",
|
|
312
|
+
...options
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
function integerSchema(options = {}) {
|
|
316
|
+
return defineSchema({
|
|
317
|
+
type: "integer",
|
|
318
|
+
...options
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
function literalSchema(value, options = {}) {
|
|
322
|
+
return defineSchema({
|
|
323
|
+
const: value,
|
|
324
|
+
...options
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
function enumSchema(values, options = {}) {
|
|
328
|
+
return defineSchema({
|
|
329
|
+
enum: values,
|
|
330
|
+
...options
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
function arraySchema(items, options = {}) {
|
|
334
|
+
return defineSchema({
|
|
335
|
+
type: "array",
|
|
336
|
+
items,
|
|
337
|
+
...options
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
function objectSchema(properties, options = {}) {
|
|
341
|
+
const { required, additionalProperties, ...rest } = options;
|
|
342
|
+
return defineSchema({
|
|
343
|
+
type: "object",
|
|
344
|
+
properties,
|
|
345
|
+
...rest,
|
|
346
|
+
...required === void 0 ? {} : { required },
|
|
347
|
+
...additionalProperties === void 0 ? { additionalProperties: false } : { additionalProperties }
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
function recordSchema(valueSchema, options = {}) {
|
|
351
|
+
return defineSchema({
|
|
352
|
+
type: "object",
|
|
353
|
+
additionalProperties: valueSchema,
|
|
354
|
+
...options
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
function oneOfSchema(members, options = {}) {
|
|
358
|
+
return defineSchema({
|
|
359
|
+
oneOf: members,
|
|
360
|
+
...options
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// ../protocol/src/capabilities.ts
|
|
365
|
+
var opensteerCapabilities = [
|
|
366
|
+
"sessions.manage",
|
|
367
|
+
"pages.manage",
|
|
368
|
+
"pages.navigate",
|
|
369
|
+
"input.pointer",
|
|
370
|
+
"input.keyboard",
|
|
371
|
+
"input.touch",
|
|
372
|
+
"artifacts.screenshot",
|
|
373
|
+
"execution.pause",
|
|
374
|
+
"execution.resume",
|
|
375
|
+
"execution.freeze",
|
|
376
|
+
"inspect.pages",
|
|
377
|
+
"inspect.frames",
|
|
378
|
+
"inspect.html",
|
|
379
|
+
"inspect.domSnapshot",
|
|
380
|
+
"inspect.text",
|
|
381
|
+
"inspect.attributes",
|
|
382
|
+
"inspect.hitTest",
|
|
383
|
+
"inspect.viewportMetrics",
|
|
384
|
+
"inspect.network",
|
|
385
|
+
"inspect.networkBodies",
|
|
386
|
+
"inspect.cookies",
|
|
387
|
+
"inspect.localStorage",
|
|
388
|
+
"inspect.sessionStorage",
|
|
389
|
+
"inspect.indexedDb",
|
|
390
|
+
"transport.sessionHttp",
|
|
391
|
+
"instrumentation.initScripts",
|
|
392
|
+
"instrumentation.routing",
|
|
393
|
+
"events.pageLifecycle",
|
|
394
|
+
"events.dialog",
|
|
395
|
+
"events.download",
|
|
396
|
+
"events.chooser",
|
|
397
|
+
"events.worker",
|
|
398
|
+
"events.console",
|
|
399
|
+
"events.pageError",
|
|
400
|
+
"events.websocket",
|
|
401
|
+
"events.eventStream",
|
|
402
|
+
"events.executionState",
|
|
403
|
+
"surface.rest",
|
|
404
|
+
"surface.mcp"
|
|
405
|
+
];
|
|
406
|
+
var opensteerCapabilitySchema = enumSchema(opensteerCapabilities, {
|
|
407
|
+
title: "OpensteerCapability"
|
|
408
|
+
});
|
|
409
|
+
var opensteerCapabilitySetSchema = arraySchema(opensteerCapabilitySchema, {
|
|
410
|
+
title: "OpensteerCapabilitySet",
|
|
411
|
+
uniqueItems: true
|
|
412
|
+
});
|
|
413
|
+
var opensteerCapabilityDescriptorSchema = objectSchema(
|
|
414
|
+
{
|
|
415
|
+
key: opensteerCapabilitySchema,
|
|
416
|
+
description: stringSchema(),
|
|
417
|
+
stability: enumSchema(["stable", "experimental"])
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
title: "OpensteerCapabilityDescriptor",
|
|
421
|
+
required: ["key", "description", "stability"]
|
|
422
|
+
}
|
|
423
|
+
);
|
|
424
|
+
arraySchema(
|
|
425
|
+
opensteerCapabilityDescriptorSchema,
|
|
426
|
+
{
|
|
427
|
+
title: "OpensteerCapabilityDescriptorList",
|
|
428
|
+
uniqueItems: true
|
|
429
|
+
}
|
|
430
|
+
);
|
|
431
|
+
|
|
432
|
+
// ../protocol/src/errors.ts
|
|
433
|
+
var opensteerErrorCodes = [
|
|
434
|
+
"invalid-request",
|
|
435
|
+
"invalid-argument",
|
|
436
|
+
"invalid-ref",
|
|
437
|
+
"unsupported-version",
|
|
438
|
+
"unsupported-operation",
|
|
439
|
+
"unsupported-capability",
|
|
440
|
+
"not-found",
|
|
441
|
+
"stale-node-ref",
|
|
442
|
+
"session-closed",
|
|
443
|
+
"page-closed",
|
|
444
|
+
"frame-detached",
|
|
445
|
+
"timeout",
|
|
446
|
+
"navigation-failed",
|
|
447
|
+
"permission-denied",
|
|
448
|
+
"conflict",
|
|
449
|
+
"profile-unavailable",
|
|
450
|
+
"auth-failure",
|
|
451
|
+
"auth-recovery-failed",
|
|
452
|
+
"browser-required",
|
|
453
|
+
"rate-limited",
|
|
454
|
+
"operation-failed",
|
|
455
|
+
"internal"
|
|
456
|
+
];
|
|
457
|
+
var OpensteerProtocolError = class extends Error {
|
|
458
|
+
code;
|
|
459
|
+
retriable;
|
|
460
|
+
capability;
|
|
461
|
+
details;
|
|
462
|
+
constructor(code, message, options = {}) {
|
|
463
|
+
super(message, { cause: options.cause });
|
|
464
|
+
this.name = "OpensteerProtocolError";
|
|
465
|
+
this.code = code;
|
|
466
|
+
this.retriable = options.retriable ?? false;
|
|
467
|
+
this.capability = options.capability;
|
|
468
|
+
this.details = options.details;
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
function createOpensteerError(code, message, options = {}) {
|
|
472
|
+
return {
|
|
473
|
+
code,
|
|
474
|
+
message,
|
|
475
|
+
retriable: options.retriable ?? false,
|
|
476
|
+
...options.capability === void 0 ? {} : { capability: options.capability },
|
|
477
|
+
...options.details === void 0 ? {} : { details: options.details }
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
function isOpensteerProtocolError(value) {
|
|
481
|
+
return value instanceof OpensteerProtocolError;
|
|
482
|
+
}
|
|
483
|
+
function toOpensteerError(error) {
|
|
484
|
+
return createOpensteerError(error.code, error.message, {
|
|
485
|
+
retriable: error.retriable,
|
|
486
|
+
...error.capability === void 0 ? {} : { capability: error.capability },
|
|
487
|
+
...error.details === void 0 ? {} : { details: error.details }
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
var opensteerErrorCodeSchema = {
|
|
491
|
+
title: "OpensteerErrorCode",
|
|
492
|
+
enum: opensteerErrorCodes
|
|
493
|
+
};
|
|
494
|
+
var opensteerErrorSchema = objectSchema(
|
|
495
|
+
{
|
|
496
|
+
code: opensteerErrorCodeSchema,
|
|
497
|
+
message: stringSchema(),
|
|
498
|
+
retriable: {
|
|
499
|
+
type: "boolean"
|
|
500
|
+
},
|
|
501
|
+
capability: opensteerCapabilitySchema,
|
|
502
|
+
details: recordSchema({})
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
title: "OpensteerError",
|
|
506
|
+
required: ["code", "message", "retriable"]
|
|
507
|
+
}
|
|
508
|
+
);
|
|
509
|
+
|
|
298
510
|
// ../runtime-core/src/observation-utils.ts
|
|
299
511
|
var REDACTED = "[REDACTED]";
|
|
300
512
|
var SENSITIVE_KEY_PATTERN = /(authorization|proxy[_-]?authorization|cookie|set-cookie|api[_-]?key|access[_-]?token|refresh[_-]?token|auth[_-]?token|token|secret|password|passwd|private[_-]?key|database[_-]?url|db[_-]?url|session(?:id)?|csrf(?:token)?)/i;
|
|
@@ -2092,7 +2304,8 @@ function normalizeOpensteerEngineName(value, source = "engine") {
|
|
|
2092
2304
|
if (normalized === "playwright" || normalized === "abp") {
|
|
2093
2305
|
return normalized;
|
|
2094
2306
|
}
|
|
2095
|
-
throw new
|
|
2307
|
+
throw new OpensteerProtocolError(
|
|
2308
|
+
"invalid-argument",
|
|
2096
2309
|
`${source} must be one of ${OPENSTEER_ENGINE_NAMES.join(", ")}; received "${value}".`
|
|
2097
2310
|
);
|
|
2098
2311
|
}
|
|
@@ -2101,7 +2314,8 @@ function assertSupportedEngineOptions(input) {
|
|
|
2101
2314
|
return;
|
|
2102
2315
|
}
|
|
2103
2316
|
if (typeof input.browser === "object" && input.browser !== null && input.browser.mode === "attach") {
|
|
2104
|
-
throw new
|
|
2317
|
+
throw new OpensteerProtocolError(
|
|
2318
|
+
"invalid-argument",
|
|
2105
2319
|
'ABP engine does not support browser.mode="attach". Use the Playwright engine for attach flows.'
|
|
2106
2320
|
);
|
|
2107
2321
|
}
|
|
@@ -2109,7 +2323,8 @@ function assertSupportedEngineOptions(input) {
|
|
|
2109
2323
|
if (unsupportedContextOptionNames.length === 0) {
|
|
2110
2324
|
return;
|
|
2111
2325
|
}
|
|
2112
|
-
throw new
|
|
2326
|
+
throw new OpensteerProtocolError(
|
|
2327
|
+
"invalid-argument",
|
|
2113
2328
|
`ABP engine does not support ${unsupportedContextOptionNames.join(", ")}. Supported ABP context options: context.viewport.`
|
|
2114
2329
|
);
|
|
2115
2330
|
}
|
|
@@ -3258,7 +3473,7 @@ var OpensteerBrowserManager = class {
|
|
|
3258
3473
|
}
|
|
3259
3474
|
const liveRecord = await this.readLivePersistentBrowser(await this.ensureWorkspaceStore());
|
|
3260
3475
|
return {
|
|
3261
|
-
mode: this.mode,
|
|
3476
|
+
mode: liveRecord?.ownership === "attached" ? "attach" : this.mode,
|
|
3262
3477
|
engine: liveRecord?.engine ?? this.engineName,
|
|
3263
3478
|
...this.workspace === void 0 ? {} : { workspace: this.workspace },
|
|
3264
3479
|
live: liveRecord !== void 0
|
|
@@ -3386,6 +3601,7 @@ var OpensteerBrowserManager = class {
|
|
|
3386
3601
|
});
|
|
3387
3602
|
const liveRecord = {
|
|
3388
3603
|
mode: "persistent",
|
|
3604
|
+
ownership: "owned",
|
|
3389
3605
|
engine: "abp",
|
|
3390
3606
|
baseUrl: launched.baseUrl,
|
|
3391
3607
|
remoteDebuggingUrl: launched.remoteDebuggingUrl,
|
|
@@ -3472,11 +3688,78 @@ var OpensteerBrowserManager = class {
|
|
|
3472
3688
|
}
|
|
3473
3689
|
async createAttachEngine() {
|
|
3474
3690
|
const endpoint = await resolveAttachEndpoint(this.browserOptions);
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3691
|
+
if (this.workspace === void 0) {
|
|
3692
|
+
return this.createAttachedEngine({
|
|
3693
|
+
endpoint,
|
|
3694
|
+
...this.browserOptions?.headers === void 0 ? {} : { headers: this.browserOptions.headers },
|
|
3695
|
+
freshTab: this.browserOptions?.freshTab ?? true,
|
|
3696
|
+
onDispose: async () => void 0
|
|
3697
|
+
});
|
|
3698
|
+
}
|
|
3699
|
+
const workspace = await this.ensureWorkspaceStore();
|
|
3700
|
+
return workspace.lock(async () => {
|
|
3701
|
+
const live = await this.readLivePersistentBrowser(workspace);
|
|
3702
|
+
if (live) {
|
|
3703
|
+
if (live.engine !== "playwright") {
|
|
3704
|
+
throw new Error(
|
|
3705
|
+
`workspace "${this.workspace}" already has a live ${live.engine} browser. Close it before attaching a Playwright browser.`
|
|
3706
|
+
);
|
|
3707
|
+
}
|
|
3708
|
+
if (live.ownership !== "attached") {
|
|
3709
|
+
throw new Error(
|
|
3710
|
+
`workspace "${this.workspace}" already has a live Opensteer-owned browser. Close it before attaching another browser.`
|
|
3711
|
+
);
|
|
3712
|
+
}
|
|
3713
|
+
if (live.endpoint === void 0) {
|
|
3714
|
+
throw new Error("workspace live browser record is missing a DevTools endpoint.");
|
|
3715
|
+
}
|
|
3716
|
+
if (live.endpoint !== endpoint) {
|
|
3717
|
+
throw new Error(
|
|
3718
|
+
`workspace "${this.workspace}" is already attached to a different browser endpoint. Close it before reattaching.`
|
|
3719
|
+
);
|
|
3720
|
+
}
|
|
3721
|
+
await bestEffortRegisterLocalViewSession({
|
|
3722
|
+
rootPath: workspace.rootPath,
|
|
3723
|
+
...this.workspace === void 0 ? {} : { workspace: this.workspace },
|
|
3724
|
+
live: toPersistedLocalBrowserSessionRecord(this.workspace, live),
|
|
3725
|
+
ownership: "attached"
|
|
3726
|
+
});
|
|
3727
|
+
return this.createAttachedEngine({
|
|
3728
|
+
endpoint: live.endpoint,
|
|
3729
|
+
...this.browserOptions?.headers === void 0 ? {} : { headers: this.browserOptions.headers },
|
|
3730
|
+
freshTab: this.browserOptions?.freshTab ?? true,
|
|
3731
|
+
onDispose: async () => void 0
|
|
3732
|
+
});
|
|
3733
|
+
}
|
|
3734
|
+
const liveRecord = {
|
|
3735
|
+
mode: "persistent",
|
|
3736
|
+
ownership: "attached",
|
|
3737
|
+
engine: "playwright",
|
|
3738
|
+
endpoint,
|
|
3739
|
+
pid: 0,
|
|
3740
|
+
startedAt: Date.now(),
|
|
3741
|
+
userDataDir: workspace.browserUserDataDir
|
|
3742
|
+
};
|
|
3743
|
+
await this.writeLivePersistentBrowser(workspace, liveRecord);
|
|
3744
|
+
const persistedLiveRecord = toPersistedLocalBrowserSessionRecord(this.workspace, liveRecord);
|
|
3745
|
+
await bestEffortRegisterLocalViewSession({
|
|
3746
|
+
rootPath: workspace.rootPath,
|
|
3747
|
+
...this.workspace === void 0 ? {} : { workspace: this.workspace },
|
|
3748
|
+
live: persistedLiveRecord,
|
|
3749
|
+
ownership: "attached"
|
|
3750
|
+
});
|
|
3751
|
+
try {
|
|
3752
|
+
return await this.createAttachedEngine({
|
|
3753
|
+
endpoint,
|
|
3754
|
+
...this.browserOptions?.headers === void 0 ? {} : { headers: this.browserOptions.headers },
|
|
3755
|
+
freshTab: this.browserOptions?.freshTab ?? true,
|
|
3756
|
+
onDispose: async () => void 0
|
|
3757
|
+
});
|
|
3758
|
+
} catch (error) {
|
|
3759
|
+
await this.unregisterLocalViewSessionForRecord(workspace.rootPath, persistedLiveRecord);
|
|
3760
|
+
await clearPersistedSessionRecord(workspace.rootPath, "local").catch(() => void 0);
|
|
3761
|
+
throw error;
|
|
3762
|
+
}
|
|
3480
3763
|
});
|
|
3481
3764
|
}
|
|
3482
3765
|
async createPersistentEngine() {
|
|
@@ -3496,7 +3779,7 @@ var OpensteerBrowserManager = class {
|
|
|
3496
3779
|
rootPath: workspace.rootPath,
|
|
3497
3780
|
...this.workspace === void 0 ? {} : { workspace: this.workspace },
|
|
3498
3781
|
live: toPersistedLocalBrowserSessionRecord(this.workspace, live),
|
|
3499
|
-
ownership:
|
|
3782
|
+
ownership: live.ownership
|
|
3500
3783
|
});
|
|
3501
3784
|
return this.createAttachedEngine({
|
|
3502
3785
|
endpoint: live.endpoint,
|
|
@@ -3512,6 +3795,7 @@ var OpensteerBrowserManager = class {
|
|
|
3512
3795
|
});
|
|
3513
3796
|
const liveRecord = {
|
|
3514
3797
|
mode: "persistent",
|
|
3798
|
+
ownership: "owned",
|
|
3515
3799
|
engine: "playwright",
|
|
3516
3800
|
endpoint: launched.endpoint,
|
|
3517
3801
|
pid: launched.pid,
|
|
@@ -3641,7 +3925,20 @@ var OpensteerBrowserManager = class {
|
|
|
3641
3925
|
if (live === void 0) {
|
|
3642
3926
|
return void 0;
|
|
3643
3927
|
}
|
|
3928
|
+
if (live.ownership === "attached") {
|
|
3929
|
+
const attachedRecord = toPersistedLocalBrowserSessionRecord(this.workspace, live);
|
|
3930
|
+
if (!await isAttachedLocalBrowserSessionReachable(attachedRecord)) {
|
|
3931
|
+
await this.unregisterLocalViewSessionForRecord(workspace.rootPath, attachedRecord);
|
|
3932
|
+
await clearPersistedSessionRecord(workspace.rootPath, "local").catch(() => void 0);
|
|
3933
|
+
return void 0;
|
|
3934
|
+
}
|
|
3935
|
+
return live;
|
|
3936
|
+
}
|
|
3644
3937
|
if (!isProcessRunning(live.pid)) {
|
|
3938
|
+
await this.unregisterLocalViewSessionForRecord(
|
|
3939
|
+
workspace.rootPath,
|
|
3940
|
+
toPersistedLocalBrowserSessionRecord(this.workspace, live)
|
|
3941
|
+
);
|
|
3645
3942
|
await clearPersistedSessionRecord(workspace.rootPath, "local").catch(() => void 0);
|
|
3646
3943
|
return void 0;
|
|
3647
3944
|
}
|
|
@@ -3689,6 +3986,10 @@ var OpensteerBrowserManager = class {
|
|
|
3689
3986
|
workspace.rootPath,
|
|
3690
3987
|
toPersistedLocalBrowserSessionRecord(this.workspace, live)
|
|
3691
3988
|
);
|
|
3989
|
+
if (live.ownership === "attached") {
|
|
3990
|
+
await clearPersistedSessionRecord(workspace.rootPath, "local").catch(() => void 0);
|
|
3991
|
+
return;
|
|
3992
|
+
}
|
|
3692
3993
|
if (live.engine === "playwright") {
|
|
3693
3994
|
if (live.endpoint !== void 0) {
|
|
3694
3995
|
await requestBrowserClose(live.endpoint).catch(() => void 0);
|
|
@@ -3717,10 +4018,18 @@ var OpensteerBrowserManager = class {
|
|
|
3717
4018
|
}
|
|
3718
4019
|
async unregisterLocalViewSessionForRecord(rootPath, record) {
|
|
3719
4020
|
await bestEffortUnregisterLocalViewSession(
|
|
3720
|
-
buildLocalViewSessionId({
|
|
4021
|
+
getPersistedLocalBrowserSessionOwnership(record) === "attached" ? buildLocalViewSessionId({
|
|
4022
|
+
rootPath,
|
|
4023
|
+
startedAt: record.startedAt,
|
|
4024
|
+
ownership: "attached",
|
|
4025
|
+
...record.endpoint === void 0 ? {} : { endpoint: record.endpoint },
|
|
4026
|
+
...record.baseUrl === void 0 ? {} : { baseUrl: record.baseUrl },
|
|
4027
|
+
...record.remoteDebuggingUrl === void 0 ? {} : { remoteDebuggingUrl: record.remoteDebuggingUrl }
|
|
4028
|
+
}) : buildLocalViewSessionId({
|
|
3721
4029
|
rootPath,
|
|
3722
|
-
|
|
3723
|
-
|
|
4030
|
+
startedAt: record.startedAt,
|
|
4031
|
+
ownership: "owned",
|
|
4032
|
+
pid: record.pid
|
|
3724
4033
|
})
|
|
3725
4034
|
);
|
|
3726
4035
|
}
|
|
@@ -3755,6 +4064,7 @@ function toPersistedLocalBrowserSessionRecord(workspace, live) {
|
|
|
3755
4064
|
version: 1,
|
|
3756
4065
|
provider: "local",
|
|
3757
4066
|
...workspace === void 0 ? {} : { workspace },
|
|
4067
|
+
ownership: live.ownership,
|
|
3758
4068
|
engine: live.engine,
|
|
3759
4069
|
...live.endpoint === void 0 ? {} : { endpoint: live.endpoint },
|
|
3760
4070
|
...live.baseUrl === void 0 ? {} : { baseUrl: live.baseUrl },
|
|
@@ -3770,6 +4080,7 @@ function toPersistedLocalBrowserSessionRecord(workspace, live) {
|
|
|
3770
4080
|
function toWorkspaceLiveBrowserRecord(record) {
|
|
3771
4081
|
return {
|
|
3772
4082
|
mode: "persistent",
|
|
4083
|
+
ownership: getPersistedLocalBrowserSessionOwnership(record),
|
|
3773
4084
|
engine: record.engine,
|
|
3774
4085
|
...record.endpoint === void 0 ? {} : { endpoint: record.endpoint },
|
|
3775
4086
|
...record.baseUrl === void 0 ? {} : { baseUrl: record.baseUrl },
|
|
@@ -3796,7 +4107,12 @@ function isAttachBrowserOptions(browser) {
|
|
|
3796
4107
|
async function resolveAttachEndpoint(browser) {
|
|
3797
4108
|
const endpoint = browser?.endpoint?.trim();
|
|
3798
4109
|
if (endpoint && endpoint.length > 0) {
|
|
3799
|
-
|
|
4110
|
+
const inspected = await inspectCdpEndpoint({
|
|
4111
|
+
endpoint,
|
|
4112
|
+
...browser?.headers === void 0 ? {} : { headers: browser.headers },
|
|
4113
|
+
timeoutMs: DEFAULT_TIMEOUT_MS
|
|
4114
|
+
});
|
|
4115
|
+
return inspected.endpoint;
|
|
3800
4116
|
}
|
|
3801
4117
|
const selection = await selectAttachBrowserCandidate({
|
|
3802
4118
|
timeoutMs: DEFAULT_TIMEOUT_MS
|
|
@@ -4142,6 +4458,6 @@ async function sleep2(ms) {
|
|
|
4142
4458
|
await new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
4143
4459
|
}
|
|
4144
4460
|
|
|
4145
|
-
export { DEFAULT_OPENSTEER_ENGINE, OPENSTEER_ENGINE_NAMES, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, OpensteerBrowserManager, assertSupportedEngineOptions, buildLocalViewSessionUrl, createArtifactStore, createFilesystemOpensteerWorkspace, createObservationStore, ensureLocalViewServiceRunning, manifestToExternalBinaryLocation, normalizeObservabilityConfig, normalizeObservationContext, normalizeOpensteerEngineName, normalizeWorkspaceId, resolveFilesystemWorkspacePath, resolveOpensteerEngineName, setLocalViewMode, stopLocalViewService };
|
|
4146
|
-
//# sourceMappingURL=chunk-
|
|
4147
|
-
//# sourceMappingURL=chunk-
|
|
4461
|
+
export { DEFAULT_OPENSTEER_ENGINE, JSON_SCHEMA_DRAFT_2020_12, OPENSTEER_ENGINE_NAMES, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, OpensteerBrowserManager, OpensteerProtocolError, arraySchema, assertSupportedEngineOptions, buildLocalViewSessionUrl, createArtifactStore, createFilesystemOpensteerWorkspace, createObservationStore, createOpensteerError, defineSchema, ensureLocalViewServiceRunning, enumSchema, integerSchema, isOpensteerProtocolError, literalSchema, manifestToExternalBinaryLocation, normalizeObservabilityConfig, normalizeObservationContext, normalizeOpensteerEngineName, normalizeWorkspaceId, numberSchema, objectSchema, oneOfSchema, opensteerCapabilitySetSchema, opensteerErrorCodes, opensteerErrorSchema, recordSchema, resolveFilesystemWorkspacePath, resolveOpensteerEngineName, setLocalViewMode, stopLocalViewService, stringSchema, toOpensteerError };
|
|
4462
|
+
//# sourceMappingURL=chunk-PJXN7HED.js.map
|
|
4463
|
+
//# sourceMappingURL=chunk-PJXN7HED.js.map
|