opensteer 0.9.7 → 0.9.8

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.
Files changed (34) hide show
  1. package/README.md +2 -2
  2. package/dist/{chunk-R33BXCMQ.js → chunk-BPGXP3RF.js} +245 -21
  3. package/dist/chunk-BPGXP3RF.js.map +1 -0
  4. package/dist/{chunk-PJXN7HED.js → chunk-EXXRLPLI.js} +46 -35
  5. package/dist/chunk-EXXRLPLI.js.map +1 -0
  6. package/dist/{chunk-U4BUCIZ4.js → chunk-GKYBP3KD.js} +4 -4
  7. package/dist/chunk-GKYBP3KD.js.map +1 -0
  8. package/dist/{chunk-3OHKIPBD.js → chunk-LFWP5RXF.js} +189 -53
  9. package/dist/chunk-LFWP5RXF.js.map +1 -0
  10. package/dist/{chunk-52UNH5UW.js → chunk-SOJEWKSW.js} +5 -5
  11. package/dist/{chunk-52UNH5UW.js.map → chunk-SOJEWKSW.js.map} +1 -1
  12. package/dist/cli/bin.cjs +570 -119
  13. package/dist/cli/bin.cjs.map +1 -1
  14. package/dist/cli/bin.js +106 -28
  15. package/dist/cli/bin.js.map +1 -1
  16. package/dist/index.cjs +211 -72
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +10 -1
  19. package/dist/index.d.ts +10 -1
  20. package/dist/index.js +4 -4
  21. package/dist/local-view/serve-entry.cjs +288 -50
  22. package/dist/local-view/serve-entry.cjs.map +1 -1
  23. package/dist/local-view/serve-entry.js +2 -2
  24. package/dist/opensteer-XLPY343Y.js +6 -0
  25. package/dist/{opensteer-CY2QUJEG.js.map → opensteer-XLPY343Y.js.map} +1 -1
  26. package/dist/{session-control-FIP6ZJLH.js → session-control-FVKKD45R.js} +4 -4
  27. package/dist/{session-control-FIP6ZJLH.js.map → session-control-FVKKD45R.js.map} +1 -1
  28. package/package.json +7 -7
  29. package/skills/recorder/SKILL.md +2 -2
  30. package/dist/chunk-3OHKIPBD.js.map +0 -1
  31. package/dist/chunk-PJXN7HED.js.map +0 -1
  32. package/dist/chunk-R33BXCMQ.js.map +0 -1
  33. package/dist/chunk-U4BUCIZ4.js.map +0 -1
  34. package/dist/opensteer-CY2QUJEG.js +0 -6
package/dist/index.d.cts CHANGED
@@ -45,6 +45,7 @@ type PageLifecycleState = "opening" | "open" | "closing" | "closed" | "crashed";
45
45
  interface PageInfo {
46
46
  readonly pageRef: PageRef;
47
47
  readonly sessionRef: SessionRef;
48
+ readonly targetId?: string;
48
49
  readonly openerPageRef?: PageRef;
49
50
  readonly url: string;
50
51
  readonly title: string;
@@ -1528,6 +1529,10 @@ interface OpenObservationSessionInput {
1528
1529
  readonly openedAt?: number;
1529
1530
  readonly config?: Partial<ObservabilityConfig>;
1530
1531
  }
1532
+ interface ConfigureObservationSessionInput {
1533
+ readonly updatedAt?: number;
1534
+ readonly config?: Partial<ObservabilityConfig>;
1535
+ }
1531
1536
  interface AppendObservationEventInput {
1532
1537
  readonly eventId?: string;
1533
1538
  readonly kind: ObservationEventKind;
@@ -1555,6 +1560,7 @@ interface WriteObservationArtifactInput {
1555
1560
  }
1556
1561
  interface SessionObservationSink {
1557
1562
  readonly sessionId: string;
1563
+ configure?(input: ConfigureObservationSessionInput): Promise<void>;
1558
1564
  append(input: AppendObservationEventInput): Promise<ObservationEvent>;
1559
1565
  appendBatch(input: readonly AppendObservationEventInput[]): Promise<readonly ObservationEvent[]>;
1560
1566
  writeArtifact(input: WriteObservationArtifactInput): Promise<ObservationArtifact>;
@@ -2984,6 +2990,7 @@ declare class Opensteer {
2984
2990
  private requireOwnedInstrumentationRuntime;
2985
2991
  }
2986
2992
 
2993
+ declare const DEFAULT_OPENSTEER_CLOUD_BASE_URL = "https://api.opensteer.com";
2987
2994
  interface OpensteerCloudConfig {
2988
2995
  readonly apiKey: string;
2989
2996
  readonly baseUrl: string;
@@ -3082,6 +3089,8 @@ interface PersistedSessionRecordBase {
3082
3089
  readonly workspace?: string;
3083
3090
  readonly updatedAt: number;
3084
3091
  readonly activePageRef?: string;
3092
+ readonly activePageUrl?: string;
3093
+ readonly activePageTitle?: string;
3085
3094
  readonly reconnectable?: boolean;
3086
3095
  readonly capabilities?: OpensteerSessionCapabilities;
3087
3096
  }
@@ -3148,4 +3157,4 @@ declare function discoverLocalCdpBrowsers(input?: {
3148
3157
  readonly timeoutMs?: number;
3149
3158
  }): Promise<readonly LocalCdpBrowserCandidate[]>;
3150
3159
 
3151
- export { type AnchorTargetRef, type AppendTraceEntryInput, type ArtifactManifest, type ArtifactPayloadType, type ArtifactScope, type BrowserProfileArchiveFormat, type BrowserProfileCreateRequest, type BrowserProfileDescriptor, type BrowserProfileImportCreateRequest, type BrowserProfileImportCreateResponse, type BrowserProfileImportDescriptor, type BrowserProfileImportStatus, type BrowserProfileListResponse, type BrowserProfileStatus, type CloudBrowserContextConfig, type CloudBrowserExtensionConfig, type CloudBrowserLaunchConfig, type CloudBrowserProfileLaunchPreference, type CloudBrowserProfilePreference, type CloudFingerprintMode, type CloudFingerprintPreference, type CloudGeolocation, type CloudProxyMode, type CloudProxyPreference, type CloudProxyProtocol, type CloudRegistryImportEntry, type CloudRegistryImportRequest, type CloudRegistryImportResponse, type CloudRequestPlanImportEntry, type CloudRequestPlanImportRequest, type CloudSessionLaunchConfig, type CloudSessionSourceType, type CloudSessionStatus, type CloudSessionSummary, type CloudSessionVisibilityScope, type CloudViewport, type ContextHop, type CreateFilesystemOpensteerWorkspaceOptions, type CreateTraceRunInput, DEFAULT_OPENSTEER_ENGINE, DEFERRED_MATCH_ATTR_KEYS, type DescriptorRecord, type DescriptorRegistryStore, type DomActionBridge, type DomActionBridgeProvider, type DomActionOutcome, type DomActionPolicyOperation, type DomActionScrollAlignment, type DomActionScrollOptions, type DomActionSettleOptions, type DomActionTargetInspection, type DomArrayFieldSelector, type DomArrayRowMetadata, type DomArraySelector, type DomBuildPathInput, type DomClickInput, type DomDescriptorPayload, type DomDescriptorRecord, type DomDescriptorStore, type DomExtractArrayRowsInput, type DomExtractFieldSelector, type DomExtractFieldsInput, type DomExtractedArrayRow, type DomHoverInput, type DomInputInput, type DomPath, type DomReadDescriptorInput, type DomResolveTargetInput, type DomRuntime, type DomScrollInput, type DomTargetRef, type DomWriteDescriptorInput, type ElementPath, ElementPathError, type FallbackDecision, type FallbackEvaluationInput, type FallbackPolicy, FilesystemArtifactStore, type FilesystemObservationStore, type FilesystemOpensteerWorkspace, type InspectedCdpEndpoint, type InteractionTraceRecord, type InteractionTraceRegistryStore, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type ListObservationArtifactsInput, type ListObservationEventsInput, type LocalCdpBrowserCandidate, type LocalChromeProfileDescriptor, MATCH_ATTRIBUTE_PRIORITY, type MatchClause, OPENSTEER_DOM_ACTION_BRIDGE_SYMBOL, OPENSTEER_ENGINE_NAMES, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, Opensteer, type OpensteerAddInitScriptOptions, type OpensteerArtifactStore, OpensteerAttachAmbiguousError, type OpensteerBrowserCloneOptions, type OpensteerBrowserController, OpensteerBrowserManager, type OpensteerBrowserManagerOptions, type OpensteerBrowserState, type OpensteerBrowserStatus, type OpensteerClickOptions, OpensteerCloudClient, type OpensteerCloudConfig, type OpensteerCloudProviderOptions, type OpensteerCloudSessionCreateInput, type OpensteerCloudSessionDescriptor, type OpensteerComputerExecuteOptions, type OpensteerCookieJar, type OpensteerDomController, type OpensteerEngineName, type OpensteerError, type OpensteerErrorCode, type OpensteerExtractOptions, type OpensteerExtractionDescriptorPayload, type OpensteerExtractionDescriptorRecord, type OpensteerExtractionDescriptorStore, type OpensteerFetchOptions, type OpensteerFetchedRouteResponse, type OpensteerGotoOptions, type OpensteerInputOptions, type OpensteerInterceptScriptOptions, type OpensteerLiveSessionProvider, type OpensteerLocalProviderOptions, type OpensteerNetworkController, type OpensteerNetworkDetailResult, type OpensteerNetworkQueryOptions, type OpensteerNetworkQueryResult, type OpensteerOptions, type OpensteerPolicy, OpensteerProtocolError, type OpensteerProviderMode, type OpensteerProviderOptions, type OpensteerProviderSource, type OpensteerResolvedProvider, type OpensteerRouteHandlerResult, type OpensteerRouteOptions, type OpensteerRouteRegistration, type OpensteerRuntimeOptions, type OpensteerScrollOptions, type OpensteerSessionRuntimeOptions, type OpensteerStorageMap, type OpensteerTargetOptions, type OpensteerTraceStore, type OpensteerWaitForPageOptions, type OpensteerWorkspaceManifest, type PathNode, type PersistedCloudSessionRecord, type PersistedLocalBrowserSessionRecord, type PersistedSessionRecord, type ProtocolArtifactDelivery, type RegistryProvenance, type RegistryRecord, type ReplayElementPath, type RequestPlanRecord, type RequestPlanRegistryStore, type ResolveRegistryRecordInput, type ResolvedDomTarget, type RetryDecision, type RetryEvaluationInput, type RetryPolicy, STABLE_PRIMARY_ATTR_KEYS, type SavedNetworkQueryInput, type SavedNetworkStore, type SettleContext, type SettleDelayInput, type SettleObserver, type SettlePolicy, type SettleTrigger, type StoredArtifactPayload, type StoredArtifactRecord, type StructuralElementAnchor, type StructuredArtifactKind, type SyncBrowserProfileCookiesInput, type TimeoutExecutionContext, type TimeoutPolicy, type TimeoutResolutionInput, type TraceEntryRecord, type TraceRunManifest, type UpdateRequestPlanFreshnessInput, type WorkspaceBrowserBootstrap, type WorkspaceBrowserManifest, type WorkspaceLiveBrowserRecord, type WriteBinaryArtifactInput, type WriteDescriptorInput, type WriteInteractionTraceInput, type WriteRequestPlanInput, type WriteStructuredArtifactInput, assertProviderSupportsEngine, buildArrayFieldPathCandidates, buildDomDescriptorKey, buildDomDescriptorPayload, buildDomDescriptorVersion, buildPathCandidates, buildPathSelectorHint, buildSegmentSelector, clearPersistedSessionRecord, cloneElementPath, cloneReplayElementPath, cloneStructuralElementAnchor, createArtifactStore, createDomDescriptorStore, createDomRuntime, createFilesystemOpensteerWorkspace, createObservationStore, createOpensteerExtractionDescriptorStore, defaultFallbackPolicy, defaultPolicy, defaultRetryPolicy, defaultSettlePolicy, defaultTimeoutPolicy, delayWithSignal, discoverLocalCdpBrowsers, hashDomDescriptorPersist, inspectCdpEndpoint, isCurrentUrlField, isOpensteerProtocolError, isValidCssAttributeKey, listLocalChromeProfiles, manifestToExternalBinaryLocation, normalizeExtractedValue, normalizeObservabilityConfig, normalizeOpensteerEngineName, normalizeOpensteerProviderMode, normalizeWorkspaceId, opensteerErrorCodes, parseDomDescriptorRecord, parseExtractionDescriptorRecord, readPersistedCloudSessionRecord, readPersistedLocalBrowserSessionRecord, readPersistedSessionRecord, resolveCloudConfig, resolveCloudSessionRecordPath, resolveDomActionBridge, resolveExtractedValueInContext, resolveFilesystemWorkspacePath, resolveLiveSessionRecordPath, resolveLocalSessionRecordPath, resolveOpensteerEngineName, resolveOpensteerProvider, resolveOpensteerRuntimeConfig, runWithPolicyTimeout, sanitizeElementPath, sanitizeReplayElementPath, sanitizeStructuralElementAnchor, settleWithPolicy, shouldKeepAttributeForPath, writePersistedSessionRecord };
3160
+ export { type AnchorTargetRef, type AppendTraceEntryInput, type ArtifactManifest, type ArtifactPayloadType, type ArtifactScope, type BrowserProfileArchiveFormat, type BrowserProfileCreateRequest, type BrowserProfileDescriptor, type BrowserProfileImportCreateRequest, type BrowserProfileImportCreateResponse, type BrowserProfileImportDescriptor, type BrowserProfileImportStatus, type BrowserProfileListResponse, type BrowserProfileStatus, type CloudBrowserContextConfig, type CloudBrowserExtensionConfig, type CloudBrowserLaunchConfig, type CloudBrowserProfileLaunchPreference, type CloudBrowserProfilePreference, type CloudFingerprintMode, type CloudFingerprintPreference, type CloudGeolocation, type CloudProxyMode, type CloudProxyPreference, type CloudProxyProtocol, type CloudRegistryImportEntry, type CloudRegistryImportRequest, type CloudRegistryImportResponse, type CloudRequestPlanImportEntry, type CloudRequestPlanImportRequest, type CloudSessionLaunchConfig, type CloudSessionSourceType, type CloudSessionStatus, type CloudSessionSummary, type CloudSessionVisibilityScope, type CloudViewport, type ContextHop, type CreateFilesystemOpensteerWorkspaceOptions, type CreateTraceRunInput, DEFAULT_OPENSTEER_CLOUD_BASE_URL, DEFAULT_OPENSTEER_ENGINE, DEFERRED_MATCH_ATTR_KEYS, type DescriptorRecord, type DescriptorRegistryStore, type DomActionBridge, type DomActionBridgeProvider, type DomActionOutcome, type DomActionPolicyOperation, type DomActionScrollAlignment, type DomActionScrollOptions, type DomActionSettleOptions, type DomActionTargetInspection, type DomArrayFieldSelector, type DomArrayRowMetadata, type DomArraySelector, type DomBuildPathInput, type DomClickInput, type DomDescriptorPayload, type DomDescriptorRecord, type DomDescriptorStore, type DomExtractArrayRowsInput, type DomExtractFieldSelector, type DomExtractFieldsInput, type DomExtractedArrayRow, type DomHoverInput, type DomInputInput, type DomPath, type DomReadDescriptorInput, type DomResolveTargetInput, type DomRuntime, type DomScrollInput, type DomTargetRef, type DomWriteDescriptorInput, type ElementPath, ElementPathError, type FallbackDecision, type FallbackEvaluationInput, type FallbackPolicy, FilesystemArtifactStore, type FilesystemObservationStore, type FilesystemOpensteerWorkspace, type InspectedCdpEndpoint, type InteractionTraceRecord, type InteractionTraceRegistryStore, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type ListObservationArtifactsInput, type ListObservationEventsInput, type LocalCdpBrowserCandidate, type LocalChromeProfileDescriptor, MATCH_ATTRIBUTE_PRIORITY, type MatchClause, OPENSTEER_DOM_ACTION_BRIDGE_SYMBOL, OPENSTEER_ENGINE_NAMES, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, Opensteer, type OpensteerAddInitScriptOptions, type OpensteerArtifactStore, OpensteerAttachAmbiguousError, type OpensteerBrowserCloneOptions, type OpensteerBrowserController, OpensteerBrowserManager, type OpensteerBrowserManagerOptions, type OpensteerBrowserState, type OpensteerBrowserStatus, type OpensteerClickOptions, OpensteerCloudClient, type OpensteerCloudConfig, type OpensteerCloudProviderOptions, type OpensteerCloudSessionCreateInput, type OpensteerCloudSessionDescriptor, type OpensteerComputerExecuteOptions, type OpensteerCookieJar, type OpensteerDomController, type OpensteerEngineName, type OpensteerError, type OpensteerErrorCode, type OpensteerExtractOptions, type OpensteerExtractionDescriptorPayload, type OpensteerExtractionDescriptorRecord, type OpensteerExtractionDescriptorStore, type OpensteerFetchOptions, type OpensteerFetchedRouteResponse, type OpensteerGotoOptions, type OpensteerInputOptions, type OpensteerInterceptScriptOptions, type OpensteerLiveSessionProvider, type OpensteerLocalProviderOptions, type OpensteerNetworkController, type OpensteerNetworkDetailResult, type OpensteerNetworkQueryOptions, type OpensteerNetworkQueryResult, type OpensteerOptions, type OpensteerPolicy, OpensteerProtocolError, type OpensteerProviderMode, type OpensteerProviderOptions, type OpensteerProviderSource, type OpensteerResolvedProvider, type OpensteerRouteHandlerResult, type OpensteerRouteOptions, type OpensteerRouteRegistration, type OpensteerRuntimeOptions, type OpensteerScrollOptions, type OpensteerSessionRuntimeOptions, type OpensteerStorageMap, type OpensteerTargetOptions, type OpensteerTraceStore, type OpensteerWaitForPageOptions, type OpensteerWorkspaceManifest, type PathNode, type PersistedCloudSessionRecord, type PersistedLocalBrowserSessionRecord, type PersistedSessionRecord, type ProtocolArtifactDelivery, type RegistryProvenance, type RegistryRecord, type ReplayElementPath, type RequestPlanRecord, type RequestPlanRegistryStore, type ResolveRegistryRecordInput, type ResolvedDomTarget, type RetryDecision, type RetryEvaluationInput, type RetryPolicy, STABLE_PRIMARY_ATTR_KEYS, type SavedNetworkQueryInput, type SavedNetworkStore, type SettleContext, type SettleDelayInput, type SettleObserver, type SettlePolicy, type SettleTrigger, type StoredArtifactPayload, type StoredArtifactRecord, type StructuralElementAnchor, type StructuredArtifactKind, type SyncBrowserProfileCookiesInput, type TimeoutExecutionContext, type TimeoutPolicy, type TimeoutResolutionInput, type TraceEntryRecord, type TraceRunManifest, type UpdateRequestPlanFreshnessInput, type WorkspaceBrowserBootstrap, type WorkspaceBrowserManifest, type WorkspaceLiveBrowserRecord, type WriteBinaryArtifactInput, type WriteDescriptorInput, type WriteInteractionTraceInput, type WriteRequestPlanInput, type WriteStructuredArtifactInput, assertProviderSupportsEngine, buildArrayFieldPathCandidates, buildDomDescriptorKey, buildDomDescriptorPayload, buildDomDescriptorVersion, buildPathCandidates, buildPathSelectorHint, buildSegmentSelector, clearPersistedSessionRecord, cloneElementPath, cloneReplayElementPath, cloneStructuralElementAnchor, createArtifactStore, createDomDescriptorStore, createDomRuntime, createFilesystemOpensteerWorkspace, createObservationStore, createOpensteerExtractionDescriptorStore, defaultFallbackPolicy, defaultPolicy, defaultRetryPolicy, defaultSettlePolicy, defaultTimeoutPolicy, delayWithSignal, discoverLocalCdpBrowsers, hashDomDescriptorPersist, inspectCdpEndpoint, isCurrentUrlField, isOpensteerProtocolError, isValidCssAttributeKey, listLocalChromeProfiles, manifestToExternalBinaryLocation, normalizeExtractedValue, normalizeObservabilityConfig, normalizeOpensteerEngineName, normalizeOpensteerProviderMode, normalizeWorkspaceId, opensteerErrorCodes, parseDomDescriptorRecord, parseExtractionDescriptorRecord, readPersistedCloudSessionRecord, readPersistedLocalBrowserSessionRecord, readPersistedSessionRecord, resolveCloudConfig, resolveCloudSessionRecordPath, resolveDomActionBridge, resolveExtractedValueInContext, resolveFilesystemWorkspacePath, resolveLiveSessionRecordPath, resolveLocalSessionRecordPath, resolveOpensteerEngineName, resolveOpensteerProvider, resolveOpensteerRuntimeConfig, runWithPolicyTimeout, sanitizeElementPath, sanitizeReplayElementPath, sanitizeStructuralElementAnchor, settleWithPolicy, shouldKeepAttributeForPath, writePersistedSessionRecord };
package/dist/index.d.ts CHANGED
@@ -45,6 +45,7 @@ type PageLifecycleState = "opening" | "open" | "closing" | "closed" | "crashed";
45
45
  interface PageInfo {
46
46
  readonly pageRef: PageRef;
47
47
  readonly sessionRef: SessionRef;
48
+ readonly targetId?: string;
48
49
  readonly openerPageRef?: PageRef;
49
50
  readonly url: string;
50
51
  readonly title: string;
@@ -1528,6 +1529,10 @@ interface OpenObservationSessionInput {
1528
1529
  readonly openedAt?: number;
1529
1530
  readonly config?: Partial<ObservabilityConfig>;
1530
1531
  }
1532
+ interface ConfigureObservationSessionInput {
1533
+ readonly updatedAt?: number;
1534
+ readonly config?: Partial<ObservabilityConfig>;
1535
+ }
1531
1536
  interface AppendObservationEventInput {
1532
1537
  readonly eventId?: string;
1533
1538
  readonly kind: ObservationEventKind;
@@ -1555,6 +1560,7 @@ interface WriteObservationArtifactInput {
1555
1560
  }
1556
1561
  interface SessionObservationSink {
1557
1562
  readonly sessionId: string;
1563
+ configure?(input: ConfigureObservationSessionInput): Promise<void>;
1558
1564
  append(input: AppendObservationEventInput): Promise<ObservationEvent>;
1559
1565
  appendBatch(input: readonly AppendObservationEventInput[]): Promise<readonly ObservationEvent[]>;
1560
1566
  writeArtifact(input: WriteObservationArtifactInput): Promise<ObservationArtifact>;
@@ -2984,6 +2990,7 @@ declare class Opensteer {
2984
2990
  private requireOwnedInstrumentationRuntime;
2985
2991
  }
2986
2992
 
2993
+ declare const DEFAULT_OPENSTEER_CLOUD_BASE_URL = "https://api.opensteer.com";
2987
2994
  interface OpensteerCloudConfig {
2988
2995
  readonly apiKey: string;
2989
2996
  readonly baseUrl: string;
@@ -3082,6 +3089,8 @@ interface PersistedSessionRecordBase {
3082
3089
  readonly workspace?: string;
3083
3090
  readonly updatedAt: number;
3084
3091
  readonly activePageRef?: string;
3092
+ readonly activePageUrl?: string;
3093
+ readonly activePageTitle?: string;
3085
3094
  readonly reconnectable?: boolean;
3086
3095
  readonly capabilities?: OpensteerSessionCapabilities;
3087
3096
  }
@@ -3148,4 +3157,4 @@ declare function discoverLocalCdpBrowsers(input?: {
3148
3157
  readonly timeoutMs?: number;
3149
3158
  }): Promise<readonly LocalCdpBrowserCandidate[]>;
3150
3159
 
3151
- export { type AnchorTargetRef, type AppendTraceEntryInput, type ArtifactManifest, type ArtifactPayloadType, type ArtifactScope, type BrowserProfileArchiveFormat, type BrowserProfileCreateRequest, type BrowserProfileDescriptor, type BrowserProfileImportCreateRequest, type BrowserProfileImportCreateResponse, type BrowserProfileImportDescriptor, type BrowserProfileImportStatus, type BrowserProfileListResponse, type BrowserProfileStatus, type CloudBrowserContextConfig, type CloudBrowserExtensionConfig, type CloudBrowserLaunchConfig, type CloudBrowserProfileLaunchPreference, type CloudBrowserProfilePreference, type CloudFingerprintMode, type CloudFingerprintPreference, type CloudGeolocation, type CloudProxyMode, type CloudProxyPreference, type CloudProxyProtocol, type CloudRegistryImportEntry, type CloudRegistryImportRequest, type CloudRegistryImportResponse, type CloudRequestPlanImportEntry, type CloudRequestPlanImportRequest, type CloudSessionLaunchConfig, type CloudSessionSourceType, type CloudSessionStatus, type CloudSessionSummary, type CloudSessionVisibilityScope, type CloudViewport, type ContextHop, type CreateFilesystemOpensteerWorkspaceOptions, type CreateTraceRunInput, DEFAULT_OPENSTEER_ENGINE, DEFERRED_MATCH_ATTR_KEYS, type DescriptorRecord, type DescriptorRegistryStore, type DomActionBridge, type DomActionBridgeProvider, type DomActionOutcome, type DomActionPolicyOperation, type DomActionScrollAlignment, type DomActionScrollOptions, type DomActionSettleOptions, type DomActionTargetInspection, type DomArrayFieldSelector, type DomArrayRowMetadata, type DomArraySelector, type DomBuildPathInput, type DomClickInput, type DomDescriptorPayload, type DomDescriptorRecord, type DomDescriptorStore, type DomExtractArrayRowsInput, type DomExtractFieldSelector, type DomExtractFieldsInput, type DomExtractedArrayRow, type DomHoverInput, type DomInputInput, type DomPath, type DomReadDescriptorInput, type DomResolveTargetInput, type DomRuntime, type DomScrollInput, type DomTargetRef, type DomWriteDescriptorInput, type ElementPath, ElementPathError, type FallbackDecision, type FallbackEvaluationInput, type FallbackPolicy, FilesystemArtifactStore, type FilesystemObservationStore, type FilesystemOpensteerWorkspace, type InspectedCdpEndpoint, type InteractionTraceRecord, type InteractionTraceRegistryStore, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type ListObservationArtifactsInput, type ListObservationEventsInput, type LocalCdpBrowserCandidate, type LocalChromeProfileDescriptor, MATCH_ATTRIBUTE_PRIORITY, type MatchClause, OPENSTEER_DOM_ACTION_BRIDGE_SYMBOL, OPENSTEER_ENGINE_NAMES, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, Opensteer, type OpensteerAddInitScriptOptions, type OpensteerArtifactStore, OpensteerAttachAmbiguousError, type OpensteerBrowserCloneOptions, type OpensteerBrowserController, OpensteerBrowserManager, type OpensteerBrowserManagerOptions, type OpensteerBrowserState, type OpensteerBrowserStatus, type OpensteerClickOptions, OpensteerCloudClient, type OpensteerCloudConfig, type OpensteerCloudProviderOptions, type OpensteerCloudSessionCreateInput, type OpensteerCloudSessionDescriptor, type OpensteerComputerExecuteOptions, type OpensteerCookieJar, type OpensteerDomController, type OpensteerEngineName, type OpensteerError, type OpensteerErrorCode, type OpensteerExtractOptions, type OpensteerExtractionDescriptorPayload, type OpensteerExtractionDescriptorRecord, type OpensteerExtractionDescriptorStore, type OpensteerFetchOptions, type OpensteerFetchedRouteResponse, type OpensteerGotoOptions, type OpensteerInputOptions, type OpensteerInterceptScriptOptions, type OpensteerLiveSessionProvider, type OpensteerLocalProviderOptions, type OpensteerNetworkController, type OpensteerNetworkDetailResult, type OpensteerNetworkQueryOptions, type OpensteerNetworkQueryResult, type OpensteerOptions, type OpensteerPolicy, OpensteerProtocolError, type OpensteerProviderMode, type OpensteerProviderOptions, type OpensteerProviderSource, type OpensteerResolvedProvider, type OpensteerRouteHandlerResult, type OpensteerRouteOptions, type OpensteerRouteRegistration, type OpensteerRuntimeOptions, type OpensteerScrollOptions, type OpensteerSessionRuntimeOptions, type OpensteerStorageMap, type OpensteerTargetOptions, type OpensteerTraceStore, type OpensteerWaitForPageOptions, type OpensteerWorkspaceManifest, type PathNode, type PersistedCloudSessionRecord, type PersistedLocalBrowserSessionRecord, type PersistedSessionRecord, type ProtocolArtifactDelivery, type RegistryProvenance, type RegistryRecord, type ReplayElementPath, type RequestPlanRecord, type RequestPlanRegistryStore, type ResolveRegistryRecordInput, type ResolvedDomTarget, type RetryDecision, type RetryEvaluationInput, type RetryPolicy, STABLE_PRIMARY_ATTR_KEYS, type SavedNetworkQueryInput, type SavedNetworkStore, type SettleContext, type SettleDelayInput, type SettleObserver, type SettlePolicy, type SettleTrigger, type StoredArtifactPayload, type StoredArtifactRecord, type StructuralElementAnchor, type StructuredArtifactKind, type SyncBrowserProfileCookiesInput, type TimeoutExecutionContext, type TimeoutPolicy, type TimeoutResolutionInput, type TraceEntryRecord, type TraceRunManifest, type UpdateRequestPlanFreshnessInput, type WorkspaceBrowserBootstrap, type WorkspaceBrowserManifest, type WorkspaceLiveBrowserRecord, type WriteBinaryArtifactInput, type WriteDescriptorInput, type WriteInteractionTraceInput, type WriteRequestPlanInput, type WriteStructuredArtifactInput, assertProviderSupportsEngine, buildArrayFieldPathCandidates, buildDomDescriptorKey, buildDomDescriptorPayload, buildDomDescriptorVersion, buildPathCandidates, buildPathSelectorHint, buildSegmentSelector, clearPersistedSessionRecord, cloneElementPath, cloneReplayElementPath, cloneStructuralElementAnchor, createArtifactStore, createDomDescriptorStore, createDomRuntime, createFilesystemOpensteerWorkspace, createObservationStore, createOpensteerExtractionDescriptorStore, defaultFallbackPolicy, defaultPolicy, defaultRetryPolicy, defaultSettlePolicy, defaultTimeoutPolicy, delayWithSignal, discoverLocalCdpBrowsers, hashDomDescriptorPersist, inspectCdpEndpoint, isCurrentUrlField, isOpensteerProtocolError, isValidCssAttributeKey, listLocalChromeProfiles, manifestToExternalBinaryLocation, normalizeExtractedValue, normalizeObservabilityConfig, normalizeOpensteerEngineName, normalizeOpensteerProviderMode, normalizeWorkspaceId, opensteerErrorCodes, parseDomDescriptorRecord, parseExtractionDescriptorRecord, readPersistedCloudSessionRecord, readPersistedLocalBrowserSessionRecord, readPersistedSessionRecord, resolveCloudConfig, resolveCloudSessionRecordPath, resolveDomActionBridge, resolveExtractedValueInContext, resolveFilesystemWorkspacePath, resolveLiveSessionRecordPath, resolveLocalSessionRecordPath, resolveOpensteerEngineName, resolveOpensteerProvider, resolveOpensteerRuntimeConfig, runWithPolicyTimeout, sanitizeElementPath, sanitizeReplayElementPath, sanitizeStructuralElementAnchor, settleWithPolicy, shouldKeepAttributeForPath, writePersistedSessionRecord };
3160
+ export { type AnchorTargetRef, type AppendTraceEntryInput, type ArtifactManifest, type ArtifactPayloadType, type ArtifactScope, type BrowserProfileArchiveFormat, type BrowserProfileCreateRequest, type BrowserProfileDescriptor, type BrowserProfileImportCreateRequest, type BrowserProfileImportCreateResponse, type BrowserProfileImportDescriptor, type BrowserProfileImportStatus, type BrowserProfileListResponse, type BrowserProfileStatus, type CloudBrowserContextConfig, type CloudBrowserExtensionConfig, type CloudBrowserLaunchConfig, type CloudBrowserProfileLaunchPreference, type CloudBrowserProfilePreference, type CloudFingerprintMode, type CloudFingerprintPreference, type CloudGeolocation, type CloudProxyMode, type CloudProxyPreference, type CloudProxyProtocol, type CloudRegistryImportEntry, type CloudRegistryImportRequest, type CloudRegistryImportResponse, type CloudRequestPlanImportEntry, type CloudRequestPlanImportRequest, type CloudSessionLaunchConfig, type CloudSessionSourceType, type CloudSessionStatus, type CloudSessionSummary, type CloudSessionVisibilityScope, type CloudViewport, type ContextHop, type CreateFilesystemOpensteerWorkspaceOptions, type CreateTraceRunInput, DEFAULT_OPENSTEER_CLOUD_BASE_URL, DEFAULT_OPENSTEER_ENGINE, DEFERRED_MATCH_ATTR_KEYS, type DescriptorRecord, type DescriptorRegistryStore, type DomActionBridge, type DomActionBridgeProvider, type DomActionOutcome, type DomActionPolicyOperation, type DomActionScrollAlignment, type DomActionScrollOptions, type DomActionSettleOptions, type DomActionTargetInspection, type DomArrayFieldSelector, type DomArrayRowMetadata, type DomArraySelector, type DomBuildPathInput, type DomClickInput, type DomDescriptorPayload, type DomDescriptorRecord, type DomDescriptorStore, type DomExtractArrayRowsInput, type DomExtractFieldSelector, type DomExtractFieldsInput, type DomExtractedArrayRow, type DomHoverInput, type DomInputInput, type DomPath, type DomReadDescriptorInput, type DomResolveTargetInput, type DomRuntime, type DomScrollInput, type DomTargetRef, type DomWriteDescriptorInput, type ElementPath, ElementPathError, type FallbackDecision, type FallbackEvaluationInput, type FallbackPolicy, FilesystemArtifactStore, type FilesystemObservationStore, type FilesystemOpensteerWorkspace, type InspectedCdpEndpoint, type InteractionTraceRecord, type InteractionTraceRegistryStore, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type ListObservationArtifactsInput, type ListObservationEventsInput, type LocalCdpBrowserCandidate, type LocalChromeProfileDescriptor, MATCH_ATTRIBUTE_PRIORITY, type MatchClause, OPENSTEER_DOM_ACTION_BRIDGE_SYMBOL, OPENSTEER_ENGINE_NAMES, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, Opensteer, type OpensteerAddInitScriptOptions, type OpensteerArtifactStore, OpensteerAttachAmbiguousError, type OpensteerBrowserCloneOptions, type OpensteerBrowserController, OpensteerBrowserManager, type OpensteerBrowserManagerOptions, type OpensteerBrowserState, type OpensteerBrowserStatus, type OpensteerClickOptions, OpensteerCloudClient, type OpensteerCloudConfig, type OpensteerCloudProviderOptions, type OpensteerCloudSessionCreateInput, type OpensteerCloudSessionDescriptor, type OpensteerComputerExecuteOptions, type OpensteerCookieJar, type OpensteerDomController, type OpensteerEngineName, type OpensteerError, type OpensteerErrorCode, type OpensteerExtractOptions, type OpensteerExtractionDescriptorPayload, type OpensteerExtractionDescriptorRecord, type OpensteerExtractionDescriptorStore, type OpensteerFetchOptions, type OpensteerFetchedRouteResponse, type OpensteerGotoOptions, type OpensteerInputOptions, type OpensteerInterceptScriptOptions, type OpensteerLiveSessionProvider, type OpensteerLocalProviderOptions, type OpensteerNetworkController, type OpensteerNetworkDetailResult, type OpensteerNetworkQueryOptions, type OpensteerNetworkQueryResult, type OpensteerOptions, type OpensteerPolicy, OpensteerProtocolError, type OpensteerProviderMode, type OpensteerProviderOptions, type OpensteerProviderSource, type OpensteerResolvedProvider, type OpensteerRouteHandlerResult, type OpensteerRouteOptions, type OpensteerRouteRegistration, type OpensteerRuntimeOptions, type OpensteerScrollOptions, type OpensteerSessionRuntimeOptions, type OpensteerStorageMap, type OpensteerTargetOptions, type OpensteerTraceStore, type OpensteerWaitForPageOptions, type OpensteerWorkspaceManifest, type PathNode, type PersistedCloudSessionRecord, type PersistedLocalBrowserSessionRecord, type PersistedSessionRecord, type ProtocolArtifactDelivery, type RegistryProvenance, type RegistryRecord, type ReplayElementPath, type RequestPlanRecord, type RequestPlanRegistryStore, type ResolveRegistryRecordInput, type ResolvedDomTarget, type RetryDecision, type RetryEvaluationInput, type RetryPolicy, STABLE_PRIMARY_ATTR_KEYS, type SavedNetworkQueryInput, type SavedNetworkStore, type SettleContext, type SettleDelayInput, type SettleObserver, type SettlePolicy, type SettleTrigger, type StoredArtifactPayload, type StoredArtifactRecord, type StructuralElementAnchor, type StructuredArtifactKind, type SyncBrowserProfileCookiesInput, type TimeoutExecutionContext, type TimeoutPolicy, type TimeoutResolutionInput, type TraceEntryRecord, type TraceRunManifest, type UpdateRequestPlanFreshnessInput, type WorkspaceBrowserBootstrap, type WorkspaceBrowserManifest, type WorkspaceLiveBrowserRecord, type WriteBinaryArtifactInput, type WriteDescriptorInput, type WriteInteractionTraceInput, type WriteRequestPlanInput, type WriteStructuredArtifactInput, assertProviderSupportsEngine, buildArrayFieldPathCandidates, buildDomDescriptorKey, buildDomDescriptorPayload, buildDomDescriptorVersion, buildPathCandidates, buildPathSelectorHint, buildSegmentSelector, clearPersistedSessionRecord, cloneElementPath, cloneReplayElementPath, cloneStructuralElementAnchor, createArtifactStore, createDomDescriptorStore, createDomRuntime, createFilesystemOpensteerWorkspace, createObservationStore, createOpensteerExtractionDescriptorStore, defaultFallbackPolicy, defaultPolicy, defaultRetryPolicy, defaultSettlePolicy, defaultTimeoutPolicy, delayWithSignal, discoverLocalCdpBrowsers, hashDomDescriptorPersist, inspectCdpEndpoint, isCurrentUrlField, isOpensteerProtocolError, isValidCssAttributeKey, listLocalChromeProfiles, manifestToExternalBinaryLocation, normalizeExtractedValue, normalizeObservabilityConfig, normalizeOpensteerEngineName, normalizeOpensteerProviderMode, normalizeWorkspaceId, opensteerErrorCodes, parseDomDescriptorRecord, parseExtractionDescriptorRecord, readPersistedCloudSessionRecord, readPersistedLocalBrowserSessionRecord, readPersistedSessionRecord, resolveCloudConfig, resolveCloudSessionRecordPath, resolveDomActionBridge, resolveExtractedValueInContext, resolveFilesystemWorkspacePath, resolveLiveSessionRecordPath, resolveLocalSessionRecordPath, resolveOpensteerEngineName, resolveOpensteerProvider, resolveOpensteerRuntimeConfig, runWithPolicyTimeout, sanitizeElementPath, sanitizeReplayElementPath, sanitizeStructuralElementAnchor, settleWithPolicy, shouldKeepAttributeForPath, writePersistedSessionRecord };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export { Opensteer } from './chunk-52UNH5UW.js';
2
- export { DEFERRED_MATCH_ATTR_KEYS, ElementPathError, MATCH_ATTRIBUTE_PRIORITY, OPENSTEER_DOM_ACTION_BRIDGE_SYMBOL, OpensteerCloudClient, STABLE_PRIMARY_ATTR_KEYS, assertProviderSupportsEngine, buildArrayFieldPathCandidates, buildDomDescriptorKey, buildDomDescriptorPayload, buildDomDescriptorVersion, buildPathCandidates, buildPathSelectorHint, buildSegmentSelector, cloneElementPath, cloneReplayElementPath, cloneStructuralElementAnchor, createDomDescriptorStore, createDomRuntime, createOpensteerExtractionDescriptorStore, defaultFallbackPolicy, defaultPolicy, defaultRetryPolicy, defaultSettlePolicy, defaultTimeoutPolicy, delayWithSignal, hashDomDescriptorPersist, isCurrentUrlField, isValidCssAttributeKey, normalizeExtractedValue, normalizeOpensteerProviderMode, parseDomDescriptorRecord, parseExtractionDescriptorRecord, resolveCloudConfig, resolveDomActionBridge, resolveExtractedValueInContext, resolveOpensteerProvider, resolveOpensteerRuntimeConfig, runWithPolicyTimeout, sanitizeElementPath, sanitizeReplayElementPath, sanitizeStructuralElementAnchor, settleWithPolicy, shouldKeepAttributeForPath } from './chunk-3OHKIPBD.js';
3
- export { DEFAULT_OPENSTEER_ENGINE, OPENSTEER_ENGINE_NAMES, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, OpensteerBrowserManager, OpensteerProtocolError, createArtifactStore, createFilesystemOpensteerWorkspace, createObservationStore, isOpensteerProtocolError, manifestToExternalBinaryLocation, normalizeObservabilityConfig, normalizeOpensteerEngineName, normalizeWorkspaceId, opensteerErrorCodes, resolveFilesystemWorkspacePath, resolveOpensteerEngineName } from './chunk-PJXN7HED.js';
4
- export { OpensteerAttachAmbiguousError, clearPersistedSessionRecord, discoverLocalCdpBrowsers, inspectCdpEndpoint, listLocalChromeProfiles, readPersistedCloudSessionRecord, readPersistedLocalBrowserSessionRecord, readPersistedSessionRecord, resolveCloudSessionRecordPath, resolveLiveSessionRecordPath, resolveLocalSessionRecordPath, writePersistedSessionRecord } from './chunk-U4BUCIZ4.js';
1
+ export { Opensteer } from './chunk-SOJEWKSW.js';
2
+ export { DEFAULT_OPENSTEER_CLOUD_BASE_URL, DEFERRED_MATCH_ATTR_KEYS, ElementPathError, MATCH_ATTRIBUTE_PRIORITY, OPENSTEER_DOM_ACTION_BRIDGE_SYMBOL, OpensteerCloudClient, STABLE_PRIMARY_ATTR_KEYS, assertProviderSupportsEngine, buildArrayFieldPathCandidates, buildDomDescriptorKey, buildDomDescriptorPayload, buildDomDescriptorVersion, buildPathCandidates, buildPathSelectorHint, buildSegmentSelector, cloneElementPath, cloneReplayElementPath, cloneStructuralElementAnchor, createDomDescriptorStore, createDomRuntime, createOpensteerExtractionDescriptorStore, defaultFallbackPolicy, defaultPolicy, defaultRetryPolicy, defaultSettlePolicy, defaultTimeoutPolicy, delayWithSignal, hashDomDescriptorPersist, isCurrentUrlField, isValidCssAttributeKey, normalizeExtractedValue, normalizeOpensteerProviderMode, parseDomDescriptorRecord, parseExtractionDescriptorRecord, resolveCloudConfig, resolveDomActionBridge, resolveExtractedValueInContext, resolveOpensteerProvider, resolveOpensteerRuntimeConfig, runWithPolicyTimeout, sanitizeElementPath, sanitizeReplayElementPath, sanitizeStructuralElementAnchor, settleWithPolicy, shouldKeepAttributeForPath } from './chunk-LFWP5RXF.js';
3
+ export { DEFAULT_OPENSTEER_ENGINE, OPENSTEER_ENGINE_NAMES, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, OpensteerBrowserManager, OpensteerProtocolError, createArtifactStore, createFilesystemOpensteerWorkspace, createObservationStore, isOpensteerProtocolError, manifestToExternalBinaryLocation, normalizeObservabilityConfig, normalizeOpensteerEngineName, normalizeWorkspaceId, opensteerErrorCodes, resolveFilesystemWorkspacePath, resolveOpensteerEngineName } from './chunk-EXXRLPLI.js';
4
+ export { OpensteerAttachAmbiguousError, clearPersistedSessionRecord, discoverLocalCdpBrowsers, inspectCdpEndpoint, listLocalChromeProfiles, readPersistedCloudSessionRecord, readPersistedLocalBrowserSessionRecord, readPersistedSessionRecord, resolveCloudSessionRecordPath, resolveLiveSessionRecordPath, resolveLocalSessionRecordPath, writePersistedSessionRecord } from './chunk-GKYBP3KD.js';
5
5
  //# sourceMappingURL=index.js.map
6
6
  //# sourceMappingURL=index.js.map
@@ -976,7 +976,7 @@ async function isAttachedLocalBrowserSessionReachable(record) {
976
976
  }
977
977
  }
978
978
  function isPersistedLocalBrowserSessionRecord(value) {
979
- return value.layout === OPENSTEER_LIVE_SESSION_LAYOUT && value.version === OPENSTEER_LIVE_SESSION_VERSION && value.provider === "local" && (value.engine === "playwright" || value.engine === "abp") && (value.ownership === void 0 || value.ownership === "owned" || value.ownership === "attached") && typeof value.pid === "number" && Number.isFinite(value.pid) && typeof value.startedAt === "number" && Number.isFinite(value.startedAt) && typeof value.updatedAt === "number" && Number.isFinite(value.updatedAt) && typeof value.userDataDir === "string" && value.userDataDir.length > 0;
979
+ return value.layout === OPENSTEER_LIVE_SESSION_LAYOUT && value.version === OPENSTEER_LIVE_SESSION_VERSION && value.provider === "local" && (value.engine === "playwright" || value.engine === "abp") && (value.ownership === void 0 || value.ownership === "owned" || value.ownership === "attached") && (value.activePageUrl === void 0 || typeof value.activePageUrl === "string") && (value.activePageTitle === void 0 || typeof value.activePageTitle === "string") && typeof value.pid === "number" && Number.isFinite(value.pid) && typeof value.startedAt === "number" && Number.isFinite(value.startedAt) && typeof value.updatedAt === "number" && Number.isFinite(value.updatedAt) && typeof value.userDataDir === "string" && value.userDataDir.length > 0;
980
980
  }
981
981
  var OPENSTEER_LIVE_SESSION_LAYOUT, OPENSTEER_LIVE_SESSION_VERSION;
982
982
  var init_live_session = __esm({
@@ -2621,6 +2621,9 @@ var init_metadata = __esm({
2621
2621
  {
2622
2622
  pageRef: pageRefSchema,
2623
2623
  sessionRef: sessionRefSchema,
2624
+ targetId: stringSchema({
2625
+ description: "Underlying browser target identifier when available."
2626
+ }),
2624
2627
  openerPageRef: pageRefSchema,
2625
2628
  url: stringSchema({
2626
2629
  description: "Current main-frame URL."
@@ -8741,6 +8744,9 @@ var init_observations = __esm({
8741
8744
  this.store = store;
8742
8745
  this.sessionId = sessionId;
8743
8746
  }
8747
+ configure(input) {
8748
+ return this.store.configureSession(this.sessionId, input);
8749
+ }
8744
8750
  append(input) {
8745
8751
  return this.store.appendEvent(this.sessionId, input);
8746
8752
  }
@@ -8771,40 +8777,14 @@ var init_observations = __esm({
8771
8777
  const sessionId = normalizeNonEmptyString("sessionId", input.sessionId);
8772
8778
  const openedAt = normalizeTimestamp("openedAt", input.openedAt ?? Date.now());
8773
8779
  const config = normalizeObservabilityConfig(input.config);
8774
- const redactor = createObservationRedactor(config);
8775
- this.redactors.set(sessionId, redactor);
8776
- const redactedLabels = redactor.redactLabels(config.labels);
8777
- const redactedTraceContext = redactor.redactTraceContext(config.traceContext);
8778
- await withFilesystemLock(this.sessionLockPath(sessionId), async () => {
8779
- const existing = await this.reconcileSessionManifest(sessionId);
8780
- if (existing === void 0) {
8781
- await ensureDirectory(this.sessionEventsDirectory(sessionId));
8782
- await ensureDirectory(this.sessionArtifactsDirectory(sessionId));
8783
- const session = {
8784
- sessionId,
8785
- profile: config.profile,
8786
- ...redactedLabels === void 0 ? {} : { labels: redactedLabels },
8787
- ...redactedTraceContext === void 0 ? {} : { traceContext: redactedTraceContext },
8788
- openedAt,
8789
- updatedAt: openedAt,
8790
- currentSequence: 0,
8791
- eventCount: 0,
8792
- artifactCount: 0
8793
- };
8794
- await writeJsonFileExclusive(this.sessionManifestPath(sessionId), session);
8795
- return;
8796
- }
8797
- const patched = {
8798
- ...existing,
8799
- profile: config.profile,
8800
- ...redactedLabels === void 0 ? {} : { labels: redactedLabels },
8801
- ...redactedTraceContext === void 0 ? {} : { traceContext: redactedTraceContext },
8802
- updatedAt: Math.max(existing.updatedAt, openedAt)
8803
- };
8804
- await writeJsonFileAtomic(this.sessionManifestPath(sessionId), patched);
8805
- });
8780
+ await this.applySessionConfiguration(sessionId, config, openedAt);
8806
8781
  return new FilesystemSessionSink(this, sessionId);
8807
8782
  }
8783
+ async configureSession(sessionId, input) {
8784
+ const updatedAt = normalizeTimestamp("updatedAt", input.updatedAt ?? Date.now());
8785
+ const config = normalizeObservabilityConfig(input.config);
8786
+ await this.applySessionConfiguration(sessionId, config, updatedAt);
8787
+ }
8808
8788
  async getSession(sessionId) {
8809
8789
  const manifestPath = this.sessionManifestPath(sessionId);
8810
8790
  if (!await pathExists(manifestPath)) {
@@ -9025,6 +9005,40 @@ var init_observations = __esm({
9025
9005
  sessionLockPath(sessionId) {
9026
9006
  return path12__default.default.join(this.sessionDirectory(sessionId), ".lock");
9027
9007
  }
9008
+ async applySessionConfiguration(sessionId, config, timestamp) {
9009
+ const redactor = createObservationRedactor(config);
9010
+ this.redactors.set(sessionId, redactor);
9011
+ const redactedLabels = redactor.redactLabels(config.labels);
9012
+ const redactedTraceContext = redactor.redactTraceContext(config.traceContext);
9013
+ await withFilesystemLock(this.sessionLockPath(sessionId), async () => {
9014
+ const existing = await this.reconcileSessionManifest(sessionId);
9015
+ if (existing === void 0) {
9016
+ await ensureDirectory(this.sessionEventsDirectory(sessionId));
9017
+ await ensureDirectory(this.sessionArtifactsDirectory(sessionId));
9018
+ const session = {
9019
+ sessionId,
9020
+ profile: config.profile,
9021
+ ...redactedLabels === void 0 ? {} : { labels: redactedLabels },
9022
+ ...redactedTraceContext === void 0 ? {} : { traceContext: redactedTraceContext },
9023
+ openedAt: timestamp,
9024
+ updatedAt: timestamp,
9025
+ currentSequence: 0,
9026
+ eventCount: 0,
9027
+ artifactCount: 0
9028
+ };
9029
+ await writeJsonFileExclusive(this.sessionManifestPath(sessionId), session);
9030
+ return;
9031
+ }
9032
+ const patched = {
9033
+ ...existing,
9034
+ profile: config.profile,
9035
+ ...redactedLabels === void 0 ? {} : { labels: redactedLabels },
9036
+ ...redactedTraceContext === void 0 ? {} : { traceContext: redactedTraceContext },
9037
+ updatedAt: Math.max(existing.updatedAt, timestamp)
9038
+ };
9039
+ await writeJsonFileAtomic(this.sessionManifestPath(sessionId), patched);
9040
+ });
9041
+ }
9028
9042
  async reconcileSessionManifest(sessionId) {
9029
9043
  const session = await this.getSession(sessionId);
9030
9044
  if (session === void 0) {
@@ -11354,6 +11368,172 @@ init_process_owner();
11354
11368
  init_service_state();
11355
11369
  init_service_state();
11356
11370
 
11371
+ // src/local-view/browser-target-order.ts
11372
+ async function readPageTargetId(page) {
11373
+ const cdp = await page.context().newCDPSession(page);
11374
+ try {
11375
+ const result = await cdp.send("Target.getTargetInfo");
11376
+ const targetId = result?.targetInfo?.targetId;
11377
+ return typeof targetId === "string" && targetId.length > 0 ? targetId : null;
11378
+ } finally {
11379
+ await cdp.detach().catch(() => void 0);
11380
+ }
11381
+ }
11382
+ async function readBrowserPageTargetOrder(browserContext) {
11383
+ const browser = browserContext.browser();
11384
+ if (!browser || !hasBrowserCdpSession(browser)) {
11385
+ return [];
11386
+ }
11387
+ const cdp = await browser.newBrowserCDPSession();
11388
+ try {
11389
+ const result = await cdp.send("Target.getTargets");
11390
+ return normalizeBrowserPageTargetOrder(result?.targetInfos ?? []);
11391
+ } catch {
11392
+ return [];
11393
+ } finally {
11394
+ await cdp.detach().catch(() => void 0);
11395
+ }
11396
+ }
11397
+ async function orderPagesByBrowserTargetOrder(browserContext, pages) {
11398
+ if (pages.length < 2) {
11399
+ return pages;
11400
+ }
11401
+ const orderedTargetIds = await readBrowserPageTargetOrder(browserContext);
11402
+ if (orderedTargetIds.length === 0) {
11403
+ return pages;
11404
+ }
11405
+ const rankByTargetId = new Map(orderedTargetIds.map((targetId, index) => [targetId, index]));
11406
+ const targetIds = await Promise.all(
11407
+ pages.map((page) => readPageTargetId(page).catch(() => null))
11408
+ );
11409
+ return pages.map((page, index) => {
11410
+ const targetId = targetIds[index] ?? void 0;
11411
+ return {
11412
+ page,
11413
+ index,
11414
+ rank: targetId === void 0 ? void 0 : rankByTargetId.get(targetId)
11415
+ };
11416
+ }).sort((left, right) => {
11417
+ if (left.rank !== void 0 && right.rank !== void 0) {
11418
+ return left.rank - right.rank;
11419
+ }
11420
+ if (left.rank !== void 0) {
11421
+ return -1;
11422
+ }
11423
+ if (right.rank !== void 0) {
11424
+ return 1;
11425
+ }
11426
+ return left.index - right.index;
11427
+ }).map((entry) => entry.page);
11428
+ }
11429
+ function hasBrowserCdpSession(browser) {
11430
+ return typeof browser.newBrowserCDPSession === "function";
11431
+ }
11432
+ function normalizeBrowserPageTargetOrder(targetInfos) {
11433
+ const reversedPageInfos = [];
11434
+ for (const targetInfo of targetInfos) {
11435
+ if (targetInfo.type !== "page") {
11436
+ continue;
11437
+ }
11438
+ const targetId = typeof targetInfo.targetId === "string" && targetInfo.targetId.length > 0 ? targetInfo.targetId : void 0;
11439
+ if (targetId === void 0) {
11440
+ continue;
11441
+ }
11442
+ reversedPageInfos.push({
11443
+ targetId,
11444
+ openerId: typeof targetInfo.openerId === "string" && targetInfo.openerId.length > 0 ? targetInfo.openerId : void 0
11445
+ });
11446
+ }
11447
+ reversedPageInfos.reverse();
11448
+ const rawTargetInfoById = new Map(
11449
+ reversedPageInfos.map((targetInfo) => [targetInfo.targetId, targetInfo])
11450
+ );
11451
+ const targetInfoById = new Map(
11452
+ reversedPageInfos.map(
11453
+ (targetInfo) => [
11454
+ targetInfo.targetId,
11455
+ {
11456
+ ...targetInfo,
11457
+ openerId: resolveAcyclicOpenerId(targetInfo.targetId, rawTargetInfoById)
11458
+ }
11459
+ ]
11460
+ )
11461
+ );
11462
+ const orderedTargetIds = [];
11463
+ const placed = /* @__PURE__ */ new Set();
11464
+ const placeTarget = (targetId) => {
11465
+ if (placed.has(targetId)) {
11466
+ return;
11467
+ }
11468
+ const targetInfo = targetInfoById.get(targetId);
11469
+ if (!targetInfo) {
11470
+ return;
11471
+ }
11472
+ const openerId = targetInfo.openerId;
11473
+ if (openerId === void 0) {
11474
+ orderedTargetIds.push(targetId);
11475
+ placed.add(targetId);
11476
+ return;
11477
+ }
11478
+ placeTarget(openerId);
11479
+ const openerIndex = orderedTargetIds.indexOf(openerId);
11480
+ const insertionIndex = openerIndex === -1 ? orderedTargetIds.length : findPopupInsertionIndex(orderedTargetIds, openerIndex, openerId, targetInfoById);
11481
+ orderedTargetIds.splice(insertionIndex, 0, targetId);
11482
+ placed.add(targetId);
11483
+ };
11484
+ for (const targetInfo of reversedPageInfos) {
11485
+ placeTarget(targetInfo.targetId);
11486
+ }
11487
+ return orderedTargetIds;
11488
+ }
11489
+ function resolveAcyclicOpenerId(targetId, targetInfoById) {
11490
+ const openerId = targetInfoById.get(targetId)?.openerId;
11491
+ if (openerId === void 0 || !targetInfoById.has(openerId)) {
11492
+ return void 0;
11493
+ }
11494
+ const visitedTargetIds = /* @__PURE__ */ new Set([targetId]);
11495
+ let currentTargetId = openerId;
11496
+ while (currentTargetId !== void 0) {
11497
+ if (visitedTargetIds.has(currentTargetId)) {
11498
+ return void 0;
11499
+ }
11500
+ visitedTargetIds.add(currentTargetId);
11501
+ currentTargetId = targetInfoById.get(currentTargetId)?.openerId;
11502
+ }
11503
+ return openerId;
11504
+ }
11505
+ function findPopupInsertionIndex(orderedTargetIds, openerIndex, openerTargetId, targetInfoById) {
11506
+ let index = openerIndex + 1;
11507
+ while (index < orderedTargetIds.length) {
11508
+ const candidateTargetId = orderedTargetIds[index];
11509
+ if (!candidateTargetId || !isDescendantTarget(candidateTargetId, openerTargetId, targetInfoById)) {
11510
+ break;
11511
+ }
11512
+ index += 1;
11513
+ }
11514
+ return index;
11515
+ }
11516
+ function isDescendantTarget(targetId, ancestorTargetId, targetInfoById) {
11517
+ const visitedTargetIds = /* @__PURE__ */ new Set();
11518
+ let currentTargetId = targetId;
11519
+ while (currentTargetId !== void 0) {
11520
+ if (visitedTargetIds.has(currentTargetId)) {
11521
+ return false;
11522
+ }
11523
+ visitedTargetIds.add(currentTargetId);
11524
+ const currentTargetInfo = targetInfoById.get(currentTargetId);
11525
+ const openerId = currentTargetInfo?.openerId;
11526
+ if (openerId === void 0) {
11527
+ return false;
11528
+ }
11529
+ if (openerId === ancestorTargetId) {
11530
+ return true;
11531
+ }
11532
+ currentTargetId = openerId;
11533
+ }
11534
+ return false;
11535
+ }
11536
+
11357
11537
  // src/local-view/tab-state-tracker.ts
11358
11538
  var ACTIVATION_INTENT_DISCOVERY_GRACE_MS = 2e3;
11359
11539
  var TabStateTracker = class {
@@ -11369,6 +11549,7 @@ var TabStateTracker = class {
11369
11549
  boundContextCleanup = null;
11370
11550
  constructor(deps) {
11371
11551
  this.deps = deps;
11552
+ this.lastActivePage = deps.initialActivePage ?? null;
11372
11553
  }
11373
11554
  start() {
11374
11555
  if (this.running) {
@@ -11493,7 +11674,7 @@ var TabStateTracker = class {
11493
11674
  this.updatePolling(pages.length);
11494
11675
  const preferredActivePage = this.lastActivePage ?? pages[0] ?? null;
11495
11676
  const pageStates = await Promise.all(
11496
- pages.map(async (page, index) => {
11677
+ pages.map(async (page, originalIndex) => {
11497
11678
  const metadata = await this.readPageMetadata(page, {
11498
11679
  refresh: args.refreshMetadata
11499
11680
  });
@@ -11503,7 +11684,7 @@ var TabStateTracker = class {
11503
11684
  };
11504
11685
  return {
11505
11686
  page,
11506
- index,
11687
+ originalIndex,
11507
11688
  targetId: metadata.targetId,
11508
11689
  url: page.url(),
11509
11690
  title: metadata.title,
@@ -11512,17 +11693,18 @@ var TabStateTracker = class {
11512
11693
  };
11513
11694
  })
11514
11695
  );
11696
+ const orderedPageStates = await this.orderPageStates(pageStates);
11515
11697
  const activePage = this.pickActivePage(
11516
- pageStates,
11698
+ orderedPageStates,
11517
11699
  this.lastActivePage,
11518
11700
  preferredActivePage,
11519
- this.resolveIntentPage(pageStates)
11701
+ this.resolveIntentPage(orderedPageStates)
11520
11702
  );
11521
11703
  if (activePage && activePage !== this.lastActivePage) {
11522
11704
  this.lastActivePage = activePage;
11523
11705
  this.deps.onActivePageChanged(activePage);
11524
11706
  }
11525
- const tabs = pageStates.map((state) => ({
11707
+ const tabs = orderedPageStates.map((state) => ({
11526
11708
  index: state.index,
11527
11709
  ...state.targetId === void 0 ? {} : { targetId: state.targetId },
11528
11710
  url: state.url,
@@ -11572,18 +11754,11 @@ var TabStateTracker = class {
11572
11754
  if (cached) {
11573
11755
  return cached;
11574
11756
  }
11575
- const cdp = await page.context().newCDPSession(page);
11576
- try {
11577
- const result = await cdp.send("Target.getTargetInfo");
11578
- const targetId = result?.targetInfo?.targetId;
11579
- if (typeof targetId === "string" && targetId.length > 0) {
11580
- this.targetIdByPage.set(page, targetId);
11581
- return targetId;
11582
- }
11583
- return null;
11584
- } finally {
11585
- await cdp.detach().catch(() => void 0);
11757
+ const targetId = await readPageTargetId(page);
11758
+ if (targetId) {
11759
+ this.targetIdByPage.set(page, targetId);
11586
11760
  }
11761
+ return targetId;
11587
11762
  }
11588
11763
  async readFocusState(page) {
11589
11764
  try {
@@ -11651,6 +11826,33 @@ var TabStateTracker = class {
11651
11826
  this.deps.runtimeState.clearPageActivationIntent(this.deps.sessionId, intent.targetId);
11652
11827
  return { page: matched.page };
11653
11828
  }
11829
+ async orderPageStates(pageStates) {
11830
+ if (pageStates.length < 2) {
11831
+ return pageStates.map(({ originalIndex: _originalIndex, ...state }, index) => ({
11832
+ ...state,
11833
+ index
11834
+ }));
11835
+ }
11836
+ const orderedTargetIds = await readBrowserPageTargetOrder(this.deps.browserContext);
11837
+ const rankByTargetId = new Map(orderedTargetIds.map((targetId, index) => [targetId, index]));
11838
+ return [...pageStates].sort((left, right) => {
11839
+ const leftRank = left.targetId === void 0 ? void 0 : rankByTargetId.get(left.targetId);
11840
+ const rightRank = right.targetId === void 0 ? void 0 : rankByTargetId.get(right.targetId);
11841
+ if (leftRank !== void 0 && rightRank !== void 0) {
11842
+ return leftRank - rightRank;
11843
+ }
11844
+ if (leftRank !== void 0) {
11845
+ return -1;
11846
+ }
11847
+ if (rightRank !== void 0) {
11848
+ return 1;
11849
+ }
11850
+ return left.originalIndex - right.originalIndex;
11851
+ }).map(({ originalIndex: _originalIndex, ...state }, index) => ({
11852
+ ...state,
11853
+ index
11854
+ }));
11855
+ }
11654
11856
  };
11655
11857
 
11656
11858
  // src/local-view/view-stream-capture-policy.ts
@@ -12014,6 +12216,7 @@ var SessionViewStreamProducer = class {
12014
12216
  sessionId: this.deps.sessionId,
12015
12217
  pollMs: TAB_STATE_POLL_MS,
12016
12218
  runtimeState: this.deps.runtimeState,
12219
+ initialActivePage: session.page,
12017
12220
  onActivePageChanged: (page) => {
12018
12221
  this.activePage = page;
12019
12222
  void this.queueBindToPage(page).catch(() => void 0);
@@ -12112,7 +12315,20 @@ var SessionViewStreamProducer = class {
12112
12315
  if (!context) {
12113
12316
  throw new Error("Connected browser did not expose a Chromium browser context.");
12114
12317
  }
12115
- const page = context.pages()[0] ?? await context.newPage();
12318
+ const existingPages = context.pages();
12319
+ if (existingPages.length === 0) {
12320
+ const page2 = await context.newPage();
12321
+ return {
12322
+ browser,
12323
+ context,
12324
+ page: page2
12325
+ };
12326
+ }
12327
+ const orderedPages = await orderPagesByBrowserTargetOrder(context, existingPages);
12328
+ const page = await resolvePersistedActivePage(orderedPages, {
12329
+ ...resolved.record.activePageUrl === void 0 ? {} : { activePageUrl: resolved.record.activePageUrl },
12330
+ ...resolved.record.activePageTitle === void 0 ? {} : { activePageTitle: resolved.record.activePageTitle }
12331
+ }) ?? orderedPages[0];
12116
12332
  return {
12117
12333
  browser,
12118
12334
  context,
@@ -12457,6 +12673,28 @@ async function disconnectPlaywrightChromiumBrowser(browser) {
12457
12673
  const { disconnectPlaywrightChromiumBrowser: disconnect } = await import('@opensteer/engine-playwright');
12458
12674
  await disconnect(browser);
12459
12675
  }
12676
+ async function resolvePersistedActivePage(pages, input) {
12677
+ if (pages.length === 0) {
12678
+ return null;
12679
+ }
12680
+ if (input.activePageUrl === void 0 && input.activePageTitle === void 0) {
12681
+ return null;
12682
+ }
12683
+ const matchesByUrl = input.activePageUrl === void 0 ? pages : pages.filter((page) => page.url() === input.activePageUrl);
12684
+ if (matchesByUrl.length === 0) {
12685
+ return null;
12686
+ }
12687
+ if (input.activePageTitle === void 0) {
12688
+ return matchesByUrl[0] ?? null;
12689
+ }
12690
+ for (const page of matchesByUrl) {
12691
+ const title = await page.title().catch(() => "");
12692
+ if (title === input.activePageTitle) {
12693
+ return page;
12694
+ }
12695
+ }
12696
+ return matchesByUrl[0] ?? null;
12697
+ }
12460
12698
 
12461
12699
  // src/local-view/server.ts
12462
12700
  var DEFAULT_MAX_FPS = 12;