cascade-ai 0.78.0 → 0.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -880,6 +880,17 @@ interface ToolsConfig {
880
880
  * `src/tools/browser-control.ts`.
881
881
  */
882
882
  agentBrowserControl?: boolean;
883
+ /**
884
+ * Where a hosted run gets a browser. Absent means the capability does not
885
+ * exist on that surface. See `src/config/schema.ts` and
886
+ * `src/browser/remote/provider.ts`.
887
+ */
888
+ remoteBrowser?: {
889
+ provider?: 'cdp' | 'steel';
890
+ url?: string;
891
+ apiKey?: string;
892
+ maxSessions?: number;
893
+ };
883
894
  mcpServers?: McpServerConfig$1[];
884
895
  /**
885
896
  * Names of MCP servers (matching McpServerConfig.name) that the user has
@@ -3535,6 +3546,32 @@ declare class Cascade extends EventEmitter {
3535
3546
  * run — it is simply not there.
3536
3547
  */
3537
3548
  setBrowserController(controller: BrowserController, release?: BrowserActorRelease): void;
3549
+ /**
3550
+ * Wire a REMOTE browser — one the host connects to rather than one the user
3551
+ * is signed into.
3552
+ *
3553
+ * A separate entry point because the enablement is a different question, and
3554
+ * conflating them made the hosted capability dead on arrival: this went out
3555
+ * calling `setBrowserController`, which gates on `agentBrowserControl`, and
3556
+ * that flag means "drive the browser I am signed into on this machine". It
3557
+ * defaults to false and has no meaning on a server, so the hosted tool was
3558
+ * never registered at all — the feature looked shipped and did nothing.
3559
+ *
3560
+ * Configuring a provider IS the opt-in here. It takes a deliberate act with
3561
+ * an endpoint and usually a paid account, and the browser it reaches is a
3562
+ * throwaway signed into nothing — a smaller consent than handing over the
3563
+ * session the user is already authenticated in, and one the desktop flag
3564
+ * cannot stand in for.
3565
+ */
3566
+ setRemoteBrowserController(controller: BrowserController, release?: BrowserActorRelease): void;
3567
+ /**
3568
+ * The gates every surface shares, with only enablement differing.
3569
+ *
3570
+ * One place, because the two callers above are exactly the sibling-writer
3571
+ * shape that has already drifted twice in this feature: a rule added to one
3572
+ * and not the other is silent on the surface that missed it.
3573
+ */
3574
+ private registerBrowserControl;
3538
3575
  private registerMediaTools;
3539
3576
  /**
3540
3577
  * Register `generate_document` where there is a real workspace to write into.
@@ -4677,6 +4714,41 @@ declare const CascadeConfigSchema: z.ZodObject<{
4677
4714
  * stop control for the run that is acting.
4678
4715
  */
4679
4716
  agentBrowserControl: z.ZodDefault<z.ZodBoolean>;
4717
+ /**
4718
+ * Where a HOSTED run gets a browser, since it has none of its own.
4719
+ *
4720
+ * The desktop drives the Chromium the user is signed into and can watch. A
4721
+ * server has neither, and running one inside the container is wrong twice
4722
+ * over — page JavaScript issues requests no URL check ever sees, from inside
4723
+ * the trust boundary, and a session costs 200-400 MB. So this points at a
4724
+ * browser somebody else runs.
4725
+ *
4726
+ * Absent by default: no provider, no capability. There is nothing to turn
4727
+ * off because nothing is registered until an endpoint is supplied.
4728
+ */
4729
+ remoteBrowser: z.ZodOptional<z.ZodObject<{
4730
+ /** `cdp` for an endpoint you run; `steel` for a Steel deployment. */
4731
+ provider: z.ZodOptional<z.ZodEnum<["cdp", "steel"]>>;
4732
+ /** The websocket endpoint for `cdp`, or the API base for `steel`. */
4733
+ url: z.ZodOptional<z.ZodString>;
4734
+ apiKey: z.ZodOptional<z.ZodString>;
4735
+ /**
4736
+ * Concurrent sessions. One by default and deliberately so: every session
4737
+ * is billed, and a wave of workers each opening their own is a cost the
4738
+ * user did not choose. Raising it is a decision, not a default.
4739
+ */
4740
+ maxSessions: z.ZodDefault<z.ZodNumber>;
4741
+ }, "strip", z.ZodTypeAny, {
4742
+ maxSessions: number;
4743
+ url?: string | undefined;
4744
+ provider?: "cdp" | "steel" | undefined;
4745
+ apiKey?: string | undefined;
4746
+ }, {
4747
+ url?: string | undefined;
4748
+ provider?: "cdp" | "steel" | undefined;
4749
+ apiKey?: string | undefined;
4750
+ maxSessions?: number | undefined;
4751
+ }>>;
4680
4752
  mcpServers: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
4681
4753
  name: z.ZodString;
4682
4754
  command: z.ZodOptional<z.ZodString>;
@@ -4790,6 +4862,12 @@ declare const CascadeConfigSchema: z.ZodObject<{
4790
4862
  env?: Record<string, string> | undefined;
4791
4863
  oauthStore?: string | undefined;
4792
4864
  }[] | undefined;
4865
+ remoteBrowser?: {
4866
+ maxSessions: number;
4867
+ url?: string | undefined;
4868
+ provider?: "cdp" | "steel" | undefined;
4869
+ apiKey?: string | undefined;
4870
+ } | undefined;
4793
4871
  mcpTrusted?: string[] | undefined;
4794
4872
  webSearch?: {
4795
4873
  maxResults: number;
@@ -4815,6 +4893,12 @@ declare const CascadeConfigSchema: z.ZodObject<{
4815
4893
  requireApprovalFor?: string[] | undefined;
4816
4894
  browserEnabled?: boolean | undefined;
4817
4895
  agentBrowserControl?: boolean | undefined;
4896
+ remoteBrowser?: {
4897
+ url?: string | undefined;
4898
+ provider?: "cdp" | "steel" | undefined;
4899
+ apiKey?: string | undefined;
4900
+ maxSessions?: number | undefined;
4901
+ } | undefined;
4818
4902
  mcpTrusted?: string[] | undefined;
4819
4903
  webSearch?: {
4820
4904
  searxngUrl?: string | undefined;
@@ -5409,6 +5493,12 @@ declare const CascadeConfigSchema: z.ZodObject<{
5409
5493
  env?: Record<string, string> | undefined;
5410
5494
  oauthStore?: string | undefined;
5411
5495
  }[] | undefined;
5496
+ remoteBrowser?: {
5497
+ maxSessions: number;
5498
+ url?: string | undefined;
5499
+ provider?: "cdp" | "steel" | undefined;
5500
+ apiKey?: string | undefined;
5501
+ } | undefined;
5412
5502
  mcpTrusted?: string[] | undefined;
5413
5503
  webSearch?: {
5414
5504
  maxResults: number;
@@ -5588,6 +5678,12 @@ declare const CascadeConfigSchema: z.ZodObject<{
5588
5678
  requireApprovalFor?: string[] | undefined;
5589
5679
  browserEnabled?: boolean | undefined;
5590
5680
  agentBrowserControl?: boolean | undefined;
5681
+ remoteBrowser?: {
5682
+ url?: string | undefined;
5683
+ provider?: "cdp" | "steel" | undefined;
5684
+ apiKey?: string | undefined;
5685
+ maxSessions?: number | undefined;
5686
+ } | undefined;
5591
5687
  mcpTrusted?: string[] | undefined;
5592
5688
  webSearch?: {
5593
5689
  searxngUrl?: string | undefined;
@@ -5905,6 +6001,12 @@ interface SettingsPayload {
5905
6001
  braveApiKey?: string;
5906
6002
  tavilyApiKey?: string;
5907
6003
  };
6004
+ remoteBrowser?: {
6005
+ provider?: string;
6006
+ url?: string;
6007
+ apiKey?: string;
6008
+ maxSessions?: number;
6009
+ };
5908
6010
  advanced?: Record<string, unknown>;
5909
6011
  }
5910
6012
  /**
@@ -5968,6 +6070,12 @@ interface SettingsSnapshot {
5968
6070
  hasBraveKey: boolean;
5969
6071
  hasTavilyKey: boolean;
5970
6072
  };
6073
+ remoteBrowser: {
6074
+ provider?: string;
6075
+ url?: string;
6076
+ hasApiKey: boolean;
6077
+ maxSessions?: number;
6078
+ };
5971
6079
  advanced: Record<string, unknown>;
5972
6080
  }
5973
6081
  declare function settingsSnapshot(config: CascadeConfig): SettingsSnapshot;
@@ -6706,6 +6814,384 @@ declare function mcpServerPrefix(serverName: string): string;
6706
6814
  */
6707
6815
  declare function removeMcpServerDenials(disabledTools: string[] | undefined, serverName: string): string[] | undefined;
6708
6816
 
6817
+ /** A live browser session somebody else is hosting. */
6818
+ interface RemoteBrowserSession {
6819
+ /** The provider's id for this session, needed to end it. */
6820
+ id: string;
6821
+ /**
6822
+ * CDP endpoint to drive, for Playwright's `connectOverCDP`.
6823
+ *
6824
+ * Carries the provider's credentials in most cases (a token in the query
6825
+ * string), so it is as sensitive as the API key and must never be logged.
6826
+ */
6827
+ cdpUrl: string;
6828
+ /**
6829
+ * A page showing the live session, embeddable in an iframe.
6830
+ *
6831
+ * A CAPABILITY URL: providers issue it deliberately without a token so it can
6832
+ * be handed to a viewer, which means anyone holding it can watch and — where
6833
+ * the provider supports input passthrough — drive the browser. It must never
6834
+ * be persisted in run history, written to a log, or sent to any client other
6835
+ * than the one that owns the run.
6836
+ */
6837
+ liveViewUrl?: string;
6838
+ }
6839
+ /**
6840
+ * Somewhere to get a browser from.
6841
+ *
6842
+ * Deliberately tiny. Everything a session DOES goes over CDP and is identical
6843
+ * whoever hosts it; only obtaining and releasing one differs, so those are the
6844
+ * only two things a provider has to implement. That keeps a new adapter to a
6845
+ * few dozen lines and keeps provider-specific behaviour from leaking into the
6846
+ * driver.
6847
+ */
6848
+ interface RemoteBrowserProvider {
6849
+ /** A short name for messages the model and the user see. */
6850
+ readonly name: string;
6851
+ /**
6852
+ * Whether `createSession` yields a browser of its own.
6853
+ *
6854
+ * False for a bare CDP endpoint, and the consequence is not cosmetic: that
6855
+ * endpoint IS one browser, so two "sessions" against it are the same browser
6856
+ * and, taking `contexts()[0].pages()[0]`, the same PAGE. Two runs would then
6857
+ * type into each other's forms — across users on a shared deployment.
6858
+ *
6859
+ * A provider that cannot isolate is therefore capped at one concurrent run
6860
+ * whatever the configured limit says. Raising a limit must not silently buy
6861
+ * concurrency the provider cannot actually deliver.
6862
+ */
6863
+ readonly isolatesSessions: boolean;
6864
+ createSession(signal?: AbortSignal): Promise<RemoteBrowserSession>;
6865
+ endSession(id: string): Promise<void>;
6866
+ }
6867
+ /** How the host was told to obtain browsers. */
6868
+ interface RemoteBrowserConfig {
6869
+ /** `cdp` for an endpoint you run; `steel` for a Steel deployment. */
6870
+ provider?: 'cdp' | 'steel';
6871
+ /**
6872
+ * For `cdp`, the websocket endpoint to connect to.
6873
+ * For `steel`, the API base — defaults to Steel's hosted API.
6874
+ */
6875
+ url?: string;
6876
+ apiKey?: string;
6877
+ /**
6878
+ * Concurrent sessions allowed. One by default, and deliberately so: every
6879
+ * session is billed, and a wave of workers each opening their own is a cost
6880
+ * the user did not choose. Raising it is a decision, not a default.
6881
+ */
6882
+ maxSessions?: number;
6883
+ }
6884
+
6885
+ /** What a run's watcher is told about its browser. */
6886
+ interface BrowserViewInfo {
6887
+ /** A browser is attached to this run. Stop is meaningful while true. */
6888
+ active: boolean;
6889
+ /** Where to watch it, when the provider can stream one. */
6890
+ liveViewUrl?: string;
6891
+ }
6892
+ interface RemoteBrowserControllerOptions {
6893
+ provider: RemoteBrowserProvider;
6894
+ /**
6895
+ * Concurrent browser sessions. One by default: every session is billed, and
6896
+ * a wave of workers each opening their own is a cost nobody chose.
6897
+ */
6898
+ maxSessions?: number;
6899
+ /** Told when a run's live view becomes available, so the owner can watch. */
6900
+ onLiveView?: (runId: string, liveViewUrl: string | undefined) => void;
6901
+ }
6902
+ declare class RemoteBrowserController {
6903
+ private provider;
6904
+ private maxSessions;
6905
+ /**
6906
+ * Live-view listeners, one per run.
6907
+ *
6908
+ * A single callback was fine while each run had its own controller. Now the
6909
+ * controller is shared across a deployment, so one callback would send run
6910
+ * A's live-view URL to whichever run registered last — and that URL is a
6911
+ * bearer capability for a browser somebody else is driving.
6912
+ */
6913
+ private liveViewListeners;
6914
+ /** An embedder that wants every run's live view, told which run each is. */
6915
+ private onLiveViewAll;
6916
+ private runs;
6917
+ /**
6918
+ * Runs that have a pool slot but no browser yet.
6919
+ *
6920
+ * Counted alongside `runs` against the cap. Without it the limit was a
6921
+ * check-then-act across four awaits, and simultaneous first uses both won.
6922
+ */
6923
+ private opening;
6924
+ /**
6925
+ * A run's stop signal, created when its slot is reserved.
6926
+ *
6927
+ * Before this, Stop looked only in `runs` — so during the first `open()`,
6928
+ * while the run existed only in `opening` and four awaits were in flight, it
6929
+ * found nothing and returned. The open then completed, built a FRESH
6930
+ * unaborted controller, and the click the user had stopped went ahead. The
6931
+ * signal has to exist before the browser does.
6932
+ */
6933
+ private aborts;
6934
+ /**
6935
+ * Runs whose provider session is being released right now.
6936
+ *
6937
+ * `stopRun`, `endRun`, `releaseIfIdle`, and the stale-page branch of `open`
6938
+ * all delete a run from `runs` synchronously and only THEN await
6939
+ * `disposeRun` settling — the browser disconnect, and `provider.endSession`,
6940
+ * which for Steel is a real HTTP `/release` call. Between that delete and
6941
+ * the call actually finishing, the admission check in `open()` — which
6942
+ * counts only `runs` and `opening` — saw the slot as free, so a second run
6943
+ * could pass admission and call `createSession` before the first run's
6944
+ * session was truly released. At `maxSessions: 1` that is two live, BILLED
6945
+ * provider sessions at once, exactly what the pool exists to prevent.
6946
+ * Counting this set alongside the other two closes the window.
6947
+ *
6948
+ * Keyed by run id, not a counter: every one of those four call sites checks
6949
+ * the run is still IN `runs` before deleting it and starting teardown, and
6950
+ * that delete is synchronous, so at most one teardown can ever be in flight
6951
+ * for a given run id at a time — a second caller finds the entry already
6952
+ * gone and never starts a competing one. The entry is removed only once its
6953
+ * own teardown settles, so a later, genuine re-open of the same run id
6954
+ * never collides with one still in flight.
6955
+ */
6956
+ private closing;
6957
+ /** Runs the user has stopped, by run id — same meaning as on the desktop. */
6958
+ private revoked;
6959
+ /**
6960
+ * One lease PER RUN, because there is one browser per run.
6961
+ *
6962
+ * The desktop has a single lease because it has a single browser. Here each
6963
+ * run gets its own session, so a global lease would make run B queue behind
6964
+ * run A for a browser it was never going to use — and with no queue timeout,
6965
+ * queue for as long as A lasts. What limits runs against each other is the
6966
+ * session POOL, not the lease.
6967
+ */
6968
+ private leases;
6969
+ constructor(options: RemoteBrowserControllerOptions);
6970
+ private leaseFor;
6971
+ /** The controller to hand to `Cascade.setBrowserController`. */
6972
+ get controller(): (action: BrowserAction, context: BrowserActionContext) => Promise<BrowserActionOutcome>;
6973
+ /** Watch one run's browser. The URL never goes to any other run's listener. */
6974
+ onLiveViewFor(runKey: string, listener: (info: BrowserViewInfo) => void): void;
6975
+ offLiveViewFor(runKey: string): void;
6976
+ /**
6977
+ * Tell a run's listener what its browser situation is.
6978
+ *
6979
+ * `active` is separate from the URL and both are needed: a provider with no
6980
+ * live view is attached-but-unwatchable, and a finished run is not attached
6981
+ * at all. Both have no URL, so a listener given only the URL cannot tell them
6982
+ * apart — and would drop the Stop control for the first as if it were the
6983
+ * second.
6984
+ */
6985
+ private announceLiveView;
6986
+ /**
6987
+ * Hand back a session the run turned out not to want.
6988
+ *
6989
+ * A browser opened for an action that is then refused would otherwise stay
6990
+ * allocated and billed until the whole run ended, for a run that has just
6991
+ * been stopped.
6992
+ */
6993
+ private releaseIfIdle;
6994
+ /** Release every run's session. For when the deployment's config changes. */
6995
+ dispose(): Promise<void>;
6996
+ /** A worker finished; it will never ask for the browser again. */
6997
+ actorEnded(actorId: string): void;
6998
+ /** The user stopped this run. Refuses further actions and clears its queue. */
6999
+ stopRun(runId: string): void;
7000
+ /** A run ended: release its browser rather than pay for an idle session. */
7001
+ endRun(runId: string): Promise<void>;
7002
+ /** Forget a finished run entirely, so nothing accumulates per run. */
7003
+ private forgetRun;
7004
+ /**
7005
+ * Let go of one run's browser.
7006
+ *
7007
+ * Best-effort throughout: a run is already over by the time this runs, and a
7008
+ * provider that is briefly unreachable must not turn that into a failure the
7009
+ * user sees. The provider's own idle timeout collects anything left.
7010
+ */
7011
+ private disposeRun;
7012
+ /**
7013
+ * Run `disposeRun`, with the run id counted in `closing` until it settles.
7014
+ *
7015
+ * The caller adds the id to `closing` itself, synchronously, in the same
7016
+ * breath as deleting the run from `runs` — see the field comment. This just
7017
+ * guarantees the removal happens, success or failure, so a disposal that
7018
+ * throws cannot leave the slot counted against the pool forever.
7019
+ */
7020
+ private teardown;
7021
+ private act;
7022
+ /**
7023
+ * The run's browser, opened on first use.
7024
+ *
7025
+ * The ONE place the session cap is enforced. An earlier version also checked
7026
+ * it before taking the lease, on the reasoning that a run which cannot get a
7027
+ * session would otherwise queue forever — true when every run shared one
7028
+ * lease, and false once each run got its own, because a second run no longer
7029
+ * queues behind the first at all. Its own revert-check proved it dead: taking
7030
+ * it out changed no test. Two copies of a cap invite them to disagree.
7031
+ */
7032
+ private open;
7033
+ /** The part that may fail, with the pool slot already reserved. */
7034
+ private openReserved;
7035
+ private perform;
7036
+ }
7037
+
7038
+ declare class GenericCdpProvider implements RemoteBrowserProvider {
7039
+ readonly name = "CDP endpoint";
7040
+ readonly isolatesSessions = false;
7041
+ private endpoint;
7042
+ constructor(endpoint: string);
7043
+ /**
7044
+ * There is no session to create — the endpoint is the session.
7045
+ *
7046
+ * `id` is a constant rather than a generated one because there is nothing to
7047
+ * look up later: `endSession` has nothing to call. Inventing a unique id
7048
+ * would imply a lifecycle this provider does not have.
7049
+ */
7050
+ createSession(): Promise<RemoteBrowserSession>;
7051
+ /**
7052
+ * Deliberately nothing.
7053
+ *
7054
+ * The endpoint belongs to whoever runs it and outlives any single run, so
7055
+ * "ending" it is not ours to do — closing it would take the browser away from
7056
+ * every other user of a shared endpoint. The driver still closes its own
7057
+ * connection and its pages; this is only about the browser's lifetime.
7058
+ */
7059
+ endSession(): Promise<void>;
7060
+ }
7061
+ /**
7062
+ * Whether a URL is a plausible CDP endpoint.
7063
+ *
7064
+ * Checked so a misconfiguration is a clear message at startup rather than an
7065
+ * obscure Playwright failure on the first action, and so an `http://` URL
7066
+ * pasted from a provider's docs is named as the mistake it is.
7067
+ */
7068
+ declare function isCdpEndpoint(url: string): boolean;
7069
+
7070
+ declare class SteelProvider implements RemoteBrowserProvider {
7071
+ readonly name = "Steel";
7072
+ readonly isolatesSessions = true;
7073
+ private base;
7074
+ private apiKey;
7075
+ constructor(opts?: {
7076
+ url?: string;
7077
+ apiKey?: string;
7078
+ });
7079
+ createSession(signal?: AbortSignal): Promise<RemoteBrowserSession>;
7080
+ endSession(id: string): Promise<void>;
7081
+ private call;
7082
+ }
7083
+
7084
+ /**
7085
+ * Why an actor did not get the browser.
7086
+ *
7087
+ * A boolean was not enough: "the queue is full, try again" and "your run was
7088
+ * stopped" are different things to tell a model, and a waiter dropped because
7089
+ * the capability was switched off is neither. Reporting all three as "busy"
7090
+ * had a model politely retrying something that would never be granted.
7091
+ */
7092
+ type LeaseResult = 'granted' | 'busy' | 'cancelled' | 'off';
7093
+ interface BrowserLeaseOptions {
7094
+ /**
7095
+ * Whether a run has been stopped. The lease skips revoked runs when handing
7096
+ * on, so a stopped run is not dealt the browser only to refuse it a line
7097
+ * later while the actor behind it waits out the whole queue.
7098
+ */
7099
+ isRevoked?: (sessionId: string) => boolean;
7100
+ /** Called whenever ownership or queue depth changes, so a UI can follow. */
7101
+ onChange?: () => void;
7102
+ }
7103
+ declare class BrowserLease {
7104
+ private actor;
7105
+ private session;
7106
+ private ceilingTimer;
7107
+ private waiting;
7108
+ private lifecycleWired;
7109
+ /**
7110
+ * The action holding the browser, if any.
7111
+ *
7112
+ * Needed alongside the lease for a reason the lease cannot cover: the lease
7113
+ * is RE-ENTRANT for its holder — that is what makes a sequence a sequence —
7114
+ * so nothing in it stops ONE actor running two actions at once. A retry
7115
+ * racing the call it retried is exactly that shape.
7116
+ *
7117
+ * A symbol because it identifies the individual call: only the action that
7118
+ * took the slot may release it.
7119
+ */
7120
+ private action;
7121
+ private isRevoked;
7122
+ private onChange;
7123
+ constructor(options?: BrowserLeaseOptions);
7124
+ get holderActor(): string | null;
7125
+ get holderSession(): string | null;
7126
+ get queueDepth(): number;
7127
+ get actionInFlight(): boolean;
7128
+ /**
7129
+ * Declare that this host reports worker terminal states.
7130
+ *
7131
+ * When it does, timers stop being ownership boundaries entirely. When it does
7132
+ * not — an embedder that wired a controller but not the release — the
7133
+ * fallbacks stay, because something has to break a deadlock.
7134
+ */
7135
+ setLifecycleReleaseWired(on: boolean): void;
7136
+ /**
7137
+ * Take the browser for this actor, waiting in line if someone else holds it.
7138
+ *
7139
+ * Re-entrant for the actor that already holds it: that is the sequence case —
7140
+ * the same worker coming back for its next step must not queue behind itself.
7141
+ */
7142
+ acquire(actorId: string, sessionId: string, signal?: AbortSignal): Promise<LeaseResult>;
7143
+ /**
7144
+ * One worker has finished its whole sequence, so its hold ends.
7145
+ *
7146
+ * THIS is the semantic release. It comes from the worker's own terminal path,
7147
+ * so it means "this actor will never ask again" — which a timer can never
7148
+ * mean about a worker that is merely thinking.
7149
+ *
7150
+ * Idempotent, and safe for an actor that never touched the browser.
7151
+ */
7152
+ actorEnded(actorId: string): void;
7153
+ /**
7154
+ * Give the browser up when about to return without using it.
7155
+ *
7156
+ * Two guards, both load-bearing. Never while an action is in flight, because
7157
+ * the lease is RE-ENTRANT: the action still running may be this same actor's
7158
+ * previous step, and taking the lease off it hands the page to a queued
7159
+ * worker mid-sequence. And only while still the holder, because by the time a
7160
+ * refusal path runs a Stop may already have handed the lease on.
7161
+ */
7162
+ releaseIfHeldBy(actorId: string): void;
7163
+ /** Drop every queued waiter belonging to a run, and the lease if it holds it. */
7164
+ dropRun(sessionId: string): void;
7165
+ /** Turn everyone away — the capability itself has gone. */
7166
+ dropAll(): void;
7167
+ /** Hand the browser to the next actor in line, if any. */
7168
+ release(): void;
7169
+ /** Arm the deadlock ceiling. Not a release schedule — see the constant. */
7170
+ armCeiling(): void;
7171
+ clearCeiling(): void;
7172
+ /** Take the per-action slot, or null when one is already running. */
7173
+ beginAction(): symbol | null;
7174
+ /** Release the slot, but only for the action that took it. */
7175
+ endAction(token: symbol): boolean;
7176
+ /**
7177
+ * Wait, briefly, for an outgoing action to unwind.
7178
+ *
7179
+ * A release can hand the browser on while the previous holder's abort is
7180
+ * still propagating through an awaited navigation. That is a handoff, not a
7181
+ * conflict, so it is waited out rather than refused — but bounded, because a
7182
+ * wedged action must not pin the queue.
7183
+ */
7184
+ awaitActionSlot(): Promise<boolean>;
7185
+ /**
7186
+ * Queue one actor, resolving when it gets the browser or is turned away.
7187
+ *
7188
+ * `settle` is wrapped so it runs at most once and always takes the waiter out
7189
+ * of the line: the timeout, an abort and a handoff all race, and settling
7190
+ * twice would silently leave a dead entry holding a queue slot.
7191
+ */
7192
+ private enqueue;
7193
+ }
7194
+
6709
7195
  /** A unit of indexed text. `sourceId` groups chunks from one document/file. */
6710
7196
  interface Chunk {
6711
7197
  id: string;
@@ -7830,4 +8316,4 @@ declare function gatherSyncBundle(config: CascadeConfig): SyncBundle;
7830
8316
  /** Merge a pulled bundle into a config, returning the updated config to persist. */
7831
8317
  declare function applySyncBundle(bundle: SyncBundle, config: CascadeConfig, cleanup?: RetiredProviderCleanup): CascadeConfig;
7832
8318
 
7833
- export { AZURE_BASE_MODELS, AZURE_BASE_URL_TEMPLATE, type AcceptanceOptions, type AcceptanceProbe, type AcceptanceResult, type AcceptanceVerdict, type ApprovalRequest, type ApprovalResponse, type AuditEntry, AuditLogger, type AzureDeploymentInput, type BenchmarksConfig, type Block, type BrowserAction, type BrowserActionOutcome, BrowserControlTool, type BrowserController, type BudgetConfig, CASCADE_AUDIT_FILE, CASCADE_CONFIG_DIR, CASCADE_CONFIG_FILE, CASCADE_DASHBOARD_SECRET_FILE, CASCADE_DB_FILE, CASCADE_IGNORE_FILE, CASCADE_KEYSTORE_FILE, CASCADE_MD_FILE, CASCADE_VERSION, CHARS_PER_TOKEN, COMPLEXITY_T2_COUNT, Cascade, CascadeCancelledError, type CascadeConfig, CascadeConfigSchema, type CascadeEvent, type CascadeEventType, CascadeIgnore, type CascadeMessage, CascadeRouter, type CascadeRunOptions, type CascadeRunResult, type CascadeThemeName, CascadeToolError, type ChartSeries, type ChartSpec, type Chunk, type ChunkOptions, CloudClient, type CloudConversation, type CloudMessage, type CloudSession, type CloudSessionStore, type CloudTurnInput, type CloudUser, type CodeChunkOptions, type CodeChunker, CodeSearchTool, type CompileTaskGraphOptions, type CompiledTaskGraph, type CompleteFn, type CompletedNode, ConfigManager, type ConversationMessage, type CredentialDisposition, type CredentialEndpoint, type CredentialWriteOutcome, type CurrentPageProvider, type CurrentPageSnapshot, CurrentPageTool, DEFAULT_API_PORT, DEFAULT_APPROVAL_REQUIRED, DEFAULT_AUTO_SUMMARIZE_AT, DEFAULT_CLOUD_URL, DEFAULT_CONTEXT_LIMIT, DEFAULT_DASHBOARD_PORT, DEFAULT_MAX_SESSION_MESSAGES, DEFAULT_RETENTION_DAYS, DEFAULT_THEME, DOCUMENT_MIME, type DashboardConfig, DashboardServer, DependencyScheduler, type DeviceStart, type DiscoveredMcpTool, type DistilledFact, type ChartKind as DocumentChartKind, type DocumentFormat, type Embedder, type EncryptedBlob, type EscalationDecision, type EscalationPayload, type ExtendedContextConfig, type FileManifest, FileMcpOAuthStore, GLOBAL_CONFIG_DIR, GLOBAL_CREDENTIALS_FILE, GLOBAL_DB_FILE, GLOBAL_KEYSTORE_FILE, GLOBAL_RUNTIME_DB_FILE, GenerateDocumentTool, type GenerateOptions, type GenerateResult, type GraphFactSource, GraphRetriever, type GraphSearchOptions, GraphSearchTool, type HookDefinition, type HooksConfig, HooksRunner, type Identity, type ImageAttachment, type ImageByteLoader, type ImageInfo, type ImageRef, type InlineRun, Keystore, LLMReranker, LM_STUDIO_BASE_URL, type LegacyThemeName, type LoadedImage, MAX_PAGE_TEXT_CHARS, MCP_TOOL_PREFIX, MODELS, type ManifestDiff, McpClient, type McpDiscoveryResult, McpOAuthProvider, type McpOAuthState, type McpOAuthStore, type McpServerConfig$1 as McpServerConfig, type McpServerRename, type MemoryConfig, MemoryStore, type Message, type MessageContent, type MessagePayload, type MessageStatus, type MessageType, type ModelInfo, type ModelOverrides, type NativeProvider, OLLAMA_BASE_URL, OpenAICompatibleEmbedder, type OpenAIEmbedderOptions, PROVIDER_DISPLAY_NAMES, type PeerMessage, type PeerMessageEvent, type PeerSyncPayload, type PeerSyncType, type PermissionDecision, type PermissionDecisionPayload, type PermissionRequest, type PermissionTrailEntry, type PlanReviewConfig, type ProviderConfig, type ProviderType, RESUME_SCHEMA_VERSION, type RankedFact, type RefreshResult, type RenderOptions, type Reranker, type ResumeCheckpoint, type ResumeReason, ResumeStore, type ResumeStoreOptions, type RetrievalContext, type RetrievalMode, type RetrievalPlan, Retriever, type RetrieverSearchOptions, type RuntimeNode, type RuntimeNodeLog, type RuntimeRefreshPayload, type RuntimeScope, type RuntimeSession, type RuntimeSnapshotPayload, type ScheduledTask, type SchedulerExecutionMode, type SchedulerHooks, type SchedulerOptions, type SchedulerResult, type ScoredChunk, type SearchOptions, type Session, type SessionCheckpoint, type SessionMetadata, type SessionSubscriptionPayload, type SettingsCommitResult, type SettingsCredentialResult, type SettingsPayload, type SettingsSnapshot, type Slide, SqliteVectorStore, type StatusUpdate, type StoredMessage, type StreamChunk, type SyncBundle, T1Administrator, type T1ToT2Assignment, T1_MODEL_PRIORITY, T2Manager, type T2Result, type T2ToT3Assignment, T2_MODEL_PRIORITY, type T3Result, type T3ResultPayload, type T3SubtaskSpec, T3Worker, T3_MODEL_PRIORITY, THEME_NAMES, TOOL_NAMES, type TaskComplexity, type TaskGraph, type TaskGraphInputNode, type TaskGraphIssue, type TaskGraphIssueCode, type TaskGraphNode, type TaskGraphNodeKind, TaskGraphValidationError, type TaskGraphValidationMode, TaskScheduler, type TaskType, Telemetry, type TelemetryConfig, type Theme, type ThemeColors, type ThemeName, type TierConfig, type TierLimits, type TierRole, type TierStatus, type TokenUsage, type ToolCall, type ToolDefinition, type ToolExecuteOptions, ToolRegistry, type ToolResult, type ToolsConfig, VISION_MODEL_PRIORITY, type VectorStore, type WebSearchConfig, type WebhookConfig, type WorkspaceConfig, type WorkspaceFileReader, WorkspaceIndex, type WorkspaceIndexOptions, applyEndpointEdit, applyProviderApiKey, applyProviderCredential, applySettingsCredentials, applySettingsPayload, applySyncBundle, azureModelForDeployment, beginMcpOAuth, buildDocumentTools, buildManifest, buildSessionTranscript, bytesToBase64, cagCharBudget, chartKind, chartToTableRows, chatCompleterFromProviders, chunkCode, chunkText, commitSettings, compileSectionGraph, compileSubtaskGraph, compileTaskGraph, completeMcpOAuth, connectMcpWithLoopbackOAuth, createCascade, credentialDispositionForEdit, credentialEndpointIdentity, decryptJSON as decryptSyncBlob, diffManifest, disambiguateMcpServerNames, discoverMcpAuthServer, discoverMcpTools, distillSessionFacts, embedderFromProviders, encryptJSON as encryptSyncBlob, endpointFromSettingsPayload, evaluateAcceptance, explainRefusal, extractCharts, failures, fileExt, fileOAuthProvider, gatherSyncBundle, hasDefaultEndpoint, hasProviderCredential, hasUsableProvider, hashContent, heuristicCodeChunker, inferAzureBaseModel, inlineRuns, isDocumentFormat, isMcpToolName, matchImageLine, mcpServerPrefix, mcpToolName, nodeHttpFetch, normalizeEndpoint, parseBlocks, parseChartSpec, parseDelimited, parseRankOrder, parseSlide, planRetrieval, preferIpv4Host, priorAzureRow, reciprocalRankFusion, refreshMcpToken, removeMcpServerDenials, renderDocument, renderDocx, renderPptx, renderXlsx, runCascade, sameAzureEndpoint, sameCredentialEndpoint, sameEndpoint, sessionWorthRemembering, settingsSnapshot, sniffImage, splitSlides, streamCascade, stripInline, summarizeCompleted, undecided, uniqueMcpServerName };
8319
+ export { AZURE_BASE_MODELS, AZURE_BASE_URL_TEMPLATE, type AcceptanceOptions, type AcceptanceProbe, type AcceptanceResult, type AcceptanceVerdict, type ApprovalRequest, type ApprovalResponse, type AuditEntry, AuditLogger, type AzureDeploymentInput, type BenchmarksConfig, type Block, type BrowserAction, type BrowserActionOutcome, BrowserControlTool, type BrowserController, BrowserLease, type BudgetConfig, CASCADE_AUDIT_FILE, CASCADE_CONFIG_DIR, CASCADE_CONFIG_FILE, CASCADE_DASHBOARD_SECRET_FILE, CASCADE_DB_FILE, CASCADE_IGNORE_FILE, CASCADE_KEYSTORE_FILE, CASCADE_MD_FILE, CASCADE_VERSION, CHARS_PER_TOKEN, COMPLEXITY_T2_COUNT, Cascade, CascadeCancelledError, type CascadeConfig, CascadeConfigSchema, type CascadeEvent, type CascadeEventType, CascadeIgnore, type CascadeMessage, CascadeRouter, type CascadeRunOptions, type CascadeRunResult, type CascadeThemeName, CascadeToolError, type ChartSeries, type ChartSpec, type Chunk, type ChunkOptions, CloudClient, type CloudConversation, type CloudMessage, type CloudSession, type CloudSessionStore, type CloudTurnInput, type CloudUser, type CodeChunkOptions, type CodeChunker, CodeSearchTool, type CompileTaskGraphOptions, type CompiledTaskGraph, type CompleteFn, type CompletedNode, ConfigManager, type ConversationMessage, type CredentialDisposition, type CredentialEndpoint, type CredentialWriteOutcome, type CurrentPageProvider, type CurrentPageSnapshot, CurrentPageTool, DEFAULT_API_PORT, DEFAULT_APPROVAL_REQUIRED, DEFAULT_AUTO_SUMMARIZE_AT, DEFAULT_CLOUD_URL, DEFAULT_CONTEXT_LIMIT, DEFAULT_DASHBOARD_PORT, DEFAULT_MAX_SESSION_MESSAGES, DEFAULT_RETENTION_DAYS, DEFAULT_THEME, DOCUMENT_MIME, type DashboardConfig, DashboardServer, DependencyScheduler, type DeviceStart, type DiscoveredMcpTool, type DistilledFact, type ChartKind as DocumentChartKind, type DocumentFormat, type Embedder, type EncryptedBlob, type EscalationDecision, type EscalationPayload, type ExtendedContextConfig, type FileManifest, FileMcpOAuthStore, GLOBAL_CONFIG_DIR, GLOBAL_CREDENTIALS_FILE, GLOBAL_DB_FILE, GLOBAL_KEYSTORE_FILE, GLOBAL_RUNTIME_DB_FILE, GenerateDocumentTool, type GenerateOptions, type GenerateResult, GenericCdpProvider, type GraphFactSource, GraphRetriever, type GraphSearchOptions, GraphSearchTool, type HookDefinition, type HooksConfig, HooksRunner, type Identity, type ImageAttachment, type ImageByteLoader, type ImageInfo, type ImageRef, type InlineRun, Keystore, LLMReranker, LM_STUDIO_BASE_URL, type LegacyThemeName, type LoadedImage, MAX_PAGE_TEXT_CHARS, MCP_TOOL_PREFIX, MODELS, type ManifestDiff, McpClient, type McpDiscoveryResult, McpOAuthProvider, type McpOAuthState, type McpOAuthStore, type McpServerConfig$1 as McpServerConfig, type McpServerRename, type MemoryConfig, MemoryStore, type Message, type MessageContent, type MessagePayload, type MessageStatus, type MessageType, type ModelInfo, type ModelOverrides, type NativeProvider, OLLAMA_BASE_URL, OpenAICompatibleEmbedder, type OpenAIEmbedderOptions, PROVIDER_DISPLAY_NAMES, type PeerMessage, type PeerMessageEvent, type PeerSyncPayload, type PeerSyncType, type PermissionDecision, type PermissionDecisionPayload, type PermissionRequest, type PermissionTrailEntry, type PlanReviewConfig, type ProviderConfig, type ProviderType, RESUME_SCHEMA_VERSION, type RankedFact, type RefreshResult, type RemoteBrowserConfig, RemoteBrowserController, type RemoteBrowserProvider, type RemoteBrowserSession, type RenderOptions, type Reranker, type ResumeCheckpoint, type ResumeReason, ResumeStore, type ResumeStoreOptions, type RetrievalContext, type RetrievalMode, type RetrievalPlan, Retriever, type RetrieverSearchOptions, type RuntimeNode, type RuntimeNodeLog, type RuntimeRefreshPayload, type RuntimeScope, type RuntimeSession, type RuntimeSnapshotPayload, type ScheduledTask, type SchedulerExecutionMode, type SchedulerHooks, type SchedulerOptions, type SchedulerResult, type ScoredChunk, type SearchOptions, type Session, type SessionCheckpoint, type SessionMetadata, type SessionSubscriptionPayload, type SettingsCommitResult, type SettingsCredentialResult, type SettingsPayload, type SettingsSnapshot, type Slide, SqliteVectorStore, type StatusUpdate, SteelProvider, type StoredMessage, type StreamChunk, type SyncBundle, T1Administrator, type T1ToT2Assignment, T1_MODEL_PRIORITY, T2Manager, type T2Result, type T2ToT3Assignment, T2_MODEL_PRIORITY, type T3Result, type T3ResultPayload, type T3SubtaskSpec, T3Worker, T3_MODEL_PRIORITY, THEME_NAMES, TOOL_NAMES, type TaskComplexity, type TaskGraph, type TaskGraphInputNode, type TaskGraphIssue, type TaskGraphIssueCode, type TaskGraphNode, type TaskGraphNodeKind, TaskGraphValidationError, type TaskGraphValidationMode, TaskScheduler, type TaskType, Telemetry, type TelemetryConfig, type Theme, type ThemeColors, type ThemeName, type TierConfig, type TierLimits, type TierRole, type TierStatus, type TokenUsage, type ToolCall, type ToolDefinition, type ToolExecuteOptions, ToolRegistry, type ToolResult, type ToolsConfig, VISION_MODEL_PRIORITY, type VectorStore, type WebSearchConfig, type WebhookConfig, type WorkspaceConfig, type WorkspaceFileReader, WorkspaceIndex, type WorkspaceIndexOptions, applyEndpointEdit, applyProviderApiKey, applyProviderCredential, applySettingsCredentials, applySettingsPayload, applySyncBundle, azureModelForDeployment, beginMcpOAuth, buildDocumentTools, buildManifest, buildSessionTranscript, bytesToBase64, cagCharBudget, chartKind, chartToTableRows, chatCompleterFromProviders, chunkCode, chunkText, commitSettings, compileSectionGraph, compileSubtaskGraph, compileTaskGraph, completeMcpOAuth, connectMcpWithLoopbackOAuth, createCascade, credentialDispositionForEdit, credentialEndpointIdentity, decryptJSON as decryptSyncBlob, diffManifest, disambiguateMcpServerNames, discoverMcpAuthServer, discoverMcpTools, distillSessionFacts, embedderFromProviders, encryptJSON as encryptSyncBlob, endpointFromSettingsPayload, evaluateAcceptance, explainRefusal, extractCharts, failures, fileExt, fileOAuthProvider, gatherSyncBundle, hasDefaultEndpoint, hasProviderCredential, hasUsableProvider, hashContent, heuristicCodeChunker, inferAzureBaseModel, inlineRuns, isCdpEndpoint, isDocumentFormat, isMcpToolName, matchImageLine, mcpServerPrefix, mcpToolName, nodeHttpFetch, normalizeEndpoint, parseBlocks, parseChartSpec, parseDelimited, parseRankOrder, parseSlide, planRetrieval, preferIpv4Host, priorAzureRow, reciprocalRankFusion, refreshMcpToken, removeMcpServerDenials, renderDocument, renderDocx, renderPptx, renderXlsx, runCascade, sameAzureEndpoint, sameCredentialEndpoint, sameEndpoint, sessionWorthRemembering, settingsSnapshot, sniffImage, splitSlides, streamCascade, stripInline, summarizeCompleted, undecided, uniqueMcpServerName };