cascade-ai 0.80.0 → 0.81.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/cli.cjs +310 -11
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +310 -11
- package/dist/cli.js.map +1 -1
- package/dist/desktop-core.cjs +530 -29
- package/dist/index.cjs +530 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +328 -7
- package/dist/index.d.ts +328 -7
- package/dist/index.js +527 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1020,7 +1020,7 @@ interface ThemeColors {
|
|
|
1020
1020
|
t2Color: string;
|
|
1021
1021
|
t3Color: string;
|
|
1022
1022
|
}
|
|
1023
|
-
type CascadeEventType = 'task:start' | 'task:complete' | 'task:error' | 'tier:status' | 'tier:result' | 'tier:root' | 'stream:token' | 'stream:done' | 'tool:approval-request' | 'tool:approval-response' | 'tool:execute' | 'tool:result' | 'tool:call' | 'cost:update' | 'session:save' | 'escalation' | 'peer:sync' | 'peer:message' | 'plan' | 'log' | 'run:cancelled' | 'budget:warning' | 'budget:exceeded' | 'permission:user-required' | 'mcp:approval-required' | 'plan:approval-required' | 'context:approval-required' | 'context:compacted';
|
|
1023
|
+
type CascadeEventType = 'task:start' | 'task:complete' | 'task:error' | 'tier:status' | 'tier:result' | 'tier:root' | 'stream:token' | 'stream:done' | 'tool:approval-request' | 'tool:approval-response' | 'tool:execute' | 'tool:result' | 'tool:call' | 'cost:update' | 'session:save' | 'escalation' | 'peer:sync' | 'peer:message' | 'plan' | 'log' | 'run:cancelled' | 'budget:warning' | 'budget:exceeded' | 'permission:user-required' | 'mcp:approval-required' | 'plan:approval-required' | 'context:approval-required' | 'context:approval-closed' | 'context:compacted';
|
|
1024
1024
|
interface CascadeEvent<T = unknown> {
|
|
1025
1025
|
type: CascadeEventType;
|
|
1026
1026
|
taskId?: string;
|
|
@@ -3333,6 +3333,78 @@ declare class BrowserControlTool extends BaseTool {
|
|
|
3333
3333
|
execute(input: Record<string, unknown>, options: ToolExecuteOptions): Promise<string>;
|
|
3334
3334
|
}
|
|
3335
3335
|
|
|
3336
|
+
/** One thing the model needs to know before it can act. */
|
|
3337
|
+
interface ClarificationQuestion {
|
|
3338
|
+
/** Assigned here, never by the model: two questions with one id lose an answer. */
|
|
3339
|
+
id: string;
|
|
3340
|
+
prompt: string;
|
|
3341
|
+
/** `choice` picks one, `multi` picks any, `text` is free-form. */
|
|
3342
|
+
kind: 'choice' | 'multi' | 'text';
|
|
3343
|
+
/** Required for `choice` and `multi`; meaningless for `text`. */
|
|
3344
|
+
options?: string[];
|
|
3345
|
+
}
|
|
3346
|
+
interface ClarificationAnswer {
|
|
3347
|
+
id: string;
|
|
3348
|
+
/** One option, several, or typed text — matching the question's `kind`. */
|
|
3349
|
+
value: string | string[];
|
|
3350
|
+
}
|
|
3351
|
+
/**
|
|
3352
|
+
* Why a questionnaire came back empty.
|
|
3353
|
+
*
|
|
3354
|
+
* Distinguished because they mean different things to a reader of the
|
|
3355
|
+
* transcript: nobody was there to ask, the person was asked and did not
|
|
3356
|
+
* answer, or the run ended underneath the question.
|
|
3357
|
+
*/
|
|
3358
|
+
type ClarificationOutcome = 'answered' | 'no-listener' | 'timeout' | 'aborted';
|
|
3359
|
+
interface ClarificationResult {
|
|
3360
|
+
outcome: ClarificationOutcome;
|
|
3361
|
+
answers: ClarificationAnswer[];
|
|
3362
|
+
}
|
|
3363
|
+
/** What the host does with a questionnaire. Supplied by `Cascade`. */
|
|
3364
|
+
type ClarificationAsker = (questions: ClarificationQuestion[], signal: AbortSignal | undefined) => Promise<ClarificationResult>;
|
|
3365
|
+
declare class AskUserTool extends BaseTool {
|
|
3366
|
+
readonly name = "ask_user";
|
|
3367
|
+
readonly description: string;
|
|
3368
|
+
readonly inputSchema: {
|
|
3369
|
+
type: string;
|
|
3370
|
+
properties: {
|
|
3371
|
+
questions: {
|
|
3372
|
+
type: string;
|
|
3373
|
+
minItems: number;
|
|
3374
|
+
maxItems: number;
|
|
3375
|
+
description: string;
|
|
3376
|
+
items: {
|
|
3377
|
+
type: string;
|
|
3378
|
+
properties: {
|
|
3379
|
+
prompt: {
|
|
3380
|
+
type: string;
|
|
3381
|
+
description: string;
|
|
3382
|
+
};
|
|
3383
|
+
kind: {
|
|
3384
|
+
type: string;
|
|
3385
|
+
enum: string[];
|
|
3386
|
+
description: string;
|
|
3387
|
+
};
|
|
3388
|
+
options: {
|
|
3389
|
+
type: string;
|
|
3390
|
+
items: {
|
|
3391
|
+
type: string;
|
|
3392
|
+
};
|
|
3393
|
+
description: string;
|
|
3394
|
+
};
|
|
3395
|
+
};
|
|
3396
|
+
required: string[];
|
|
3397
|
+
};
|
|
3398
|
+
};
|
|
3399
|
+
};
|
|
3400
|
+
required: string[];
|
|
3401
|
+
};
|
|
3402
|
+
private ask;
|
|
3403
|
+
constructor(ask: ClarificationAsker);
|
|
3404
|
+
isDangerous(): boolean;
|
|
3405
|
+
execute(input: Record<string, unknown>, options: ToolExecuteOptions): Promise<string>;
|
|
3406
|
+
}
|
|
3407
|
+
|
|
3336
3408
|
/** One entry in the per-run orchestration decision trail (see /why). */
|
|
3337
3409
|
interface DecisionLogEntry {
|
|
3338
3410
|
at: string;
|
|
@@ -3427,6 +3499,77 @@ declare class Cascade extends EventEmitter {
|
|
|
3427
3499
|
private pendingPlanApproval?;
|
|
3428
3500
|
private requestPlanApproval;
|
|
3429
3501
|
private pendingEscalations;
|
|
3502
|
+
/**
|
|
3503
|
+
* Questionnaires waiting on a person, keyed by request id.
|
|
3504
|
+
*
|
|
3505
|
+
* Exactly the shape `pendingEscalations` uses, and for the same reason: the
|
|
3506
|
+
* answer, the timeout and the abort all race, and one settle path guarded by
|
|
3507
|
+
* the map delete is what makes the first of them win.
|
|
3508
|
+
*/
|
|
3509
|
+
private pendingClarifications;
|
|
3510
|
+
/**
|
|
3511
|
+
* Put a gate's opening question to its listeners, and NOTICE when one fails.
|
|
3512
|
+
*
|
|
3513
|
+
* `emit` cannot do this job. It calls listeners synchronously and discards
|
|
3514
|
+
* what they return, so an `async` listener — the ordinary shape for anything
|
|
3515
|
+
* that has to reach a socket or a UI — does not fail in a way `emit` reports:
|
|
3516
|
+
* it returns a REJECTED PROMISE that nobody is holding. The `try` around the
|
|
3517
|
+
* emit sees nothing, the gate is never told delivery failed, and it parks for
|
|
3518
|
+
* its full timeout while Node raises an unhandled rejection that can take the
|
|
3519
|
+
* process down.
|
|
3520
|
+
*
|
|
3521
|
+
* `onFailed` is called for either shape, and it is safe to call more than
|
|
3522
|
+
* once: both gates route it to `settle`, which is guarded by a map delete, so
|
|
3523
|
+
* the first failure wins and the rest are no-ops.
|
|
3524
|
+
*
|
|
3525
|
+
* PER LISTENER, not around the loop. `emit` stops dispatching at the first
|
|
3526
|
+
* throw, so one broken host used to cost a working one its notification —
|
|
3527
|
+
* the same reason `announceLiveView` delivers its two listeners separately.
|
|
3528
|
+
* A synchronous failure settles the gate once the whole snapshot has been
|
|
3529
|
+
* delivered; an asynchronous one settles it when the rejection arrives, which
|
|
3530
|
+
* is still far better than the window-long park it replaces.
|
|
3531
|
+
*
|
|
3532
|
+
* SETTLED AFTER THE LOOP, not inside it, and that is not tidiness. `onFailed`
|
|
3533
|
+
* settles the gate, and settling emits the gate's CLOSURE — so failing
|
|
3534
|
+
* mid-dispatch announced "this request is over" and then went on handing the
|
|
3535
|
+
* OPENING event to the listeners after it. A host later in the list would
|
|
3536
|
+
* draw a form whose only closure notification had already gone past, and it
|
|
3537
|
+
* would stand there forever. Deliver to everyone, then decide.
|
|
3538
|
+
*
|
|
3539
|
+
* `rawListeners`, NOT `listeners`. Bypassing `emit` means taking on what
|
|
3540
|
+
* `emit` was doing, and `once` is the part that bites: `listeners()` hands
|
|
3541
|
+
* back the UNWRAPPED callback, so calling it never runs the wrapper that
|
|
3542
|
+
* deregisters it. A host that asked to be told once would be told every
|
|
3543
|
+
* time — and told through a transport it had set up for one gate only.
|
|
3544
|
+
* `rawListeners()` returns the wrapper, which removes the registration and
|
|
3545
|
+
* passes the underlying listener's return value straight through, so the
|
|
3546
|
+
* promise below is still the one being observed. Verified against Node.
|
|
3547
|
+
*
|
|
3548
|
+
* `.call(this, …)`, which is the third thing `emit` was doing. EventEmitter
|
|
3549
|
+
* invokes listeners with the emitter as the receiver, so
|
|
3550
|
+
* `function () { this.resolveClarification(...) }` is a legitimate host — and
|
|
3551
|
+
* calling it bare gave it `this === undefined`, which throws, which this
|
|
3552
|
+
* would then have read as the host failing to receive the question and
|
|
3553
|
+
* settled the gate unanswered. A working listener turned into a delivery
|
|
3554
|
+
* failure by the thing delivering it.
|
|
3555
|
+
*/
|
|
3556
|
+
private deliverGate;
|
|
3557
|
+
/**
|
|
3558
|
+
* Tell listeners something that is over, and let none of them make it worse.
|
|
3559
|
+
*
|
|
3560
|
+
* The closing half of the gate family — `clarification:closed`,
|
|
3561
|
+
* `clarification:timeout`, `escalation:closed`, `escalation:timeout`. Each
|
|
3562
|
+
* was already wrapped in a `try` for the synchronous case, and each had the
|
|
3563
|
+
* same hole `deliverGate` had before last round: `emit` discards what a
|
|
3564
|
+
* listener returns, so an `async` host fails by returning a rejected promise
|
|
3565
|
+
* nobody is holding and Node raises an unhandled rejection.
|
|
3566
|
+
*
|
|
3567
|
+
* There is nothing to settle here — the gate is already closed, which is the
|
|
3568
|
+
* whole message — so unlike `deliverGate` this reports to no one. It exists
|
|
3569
|
+
* so that the four informational emits cannot take the process down, and so
|
|
3570
|
+
* the rule is written once rather than four times.
|
|
3571
|
+
*/
|
|
3572
|
+
private announceGateClosed;
|
|
3430
3573
|
private requestEscalationDecision;
|
|
3431
3574
|
/**
|
|
3432
3575
|
* Resolve a pending escalation from a REPL / dashboard / cloud listener.
|
|
@@ -3452,6 +3595,27 @@ declare class Cascade extends EventEmitter {
|
|
|
3452
3595
|
* reviewing and accepting that section's output.
|
|
3453
3596
|
*/
|
|
3454
3597
|
private releasePendingEscalations;
|
|
3598
|
+
/**
|
|
3599
|
+
* Put a questionnaire to whoever is watching, if anybody is.
|
|
3600
|
+
*
|
|
3601
|
+
* Returns `no-listener` rather than waiting when there is nothing attached to
|
|
3602
|
+
* answer — a scheduled run, an API caller with no socket, an autonomous run
|
|
3603
|
+
* that has already said it wants no prompts. That check is the whole reason
|
|
3604
|
+
* this can be offered to the model at all: a tool that might hang a headless
|
|
3605
|
+
* run forever is a tool that cannot be registered.
|
|
3606
|
+
*/
|
|
3607
|
+
askUser(questions: ClarificationQuestion[], signal?: AbortSignal): Promise<ClarificationResult>;
|
|
3608
|
+
/**
|
|
3609
|
+
* Answer a questionnaire from a REPL / dashboard / cloud listener.
|
|
3610
|
+
*
|
|
3611
|
+
* `requestId` comes back on the `clarification:required` event and is what
|
|
3612
|
+
* makes an answer land on the question that asked. Optional for a host with
|
|
3613
|
+
* only one in flight, matching `resolveEscalation`: without it the oldest
|
|
3614
|
+
* outstanding request is answered, which is correct whenever there is one.
|
|
3615
|
+
*/
|
|
3616
|
+
resolveClarification(answers: ClarificationAnswer[], requestId?: string): void;
|
|
3617
|
+
/** Release every parked questionnaire — run teardown, so none outlive the run. */
|
|
3618
|
+
private releasePendingClarifications;
|
|
3455
3619
|
/**
|
|
3456
3620
|
* Resolve a pending boardroom plan approval from a REPL / dashboard listener.
|
|
3457
3621
|
* An optional `note` re-plans and re-asks; an optional `editedPlan` is applied
|
|
@@ -3572,6 +3736,29 @@ declare class Cascade extends EventEmitter {
|
|
|
3572
3736
|
* and not the other is silent on the surface that missed it.
|
|
3573
3737
|
*/
|
|
3574
3738
|
private registerBrowserControl;
|
|
3739
|
+
/**
|
|
3740
|
+
* Declare that this host can put a questionnaire to a person and answer it.
|
|
3741
|
+
*
|
|
3742
|
+
* Explicit, and NOT done at construction, because registering a tool is a
|
|
3743
|
+
* promise the host has to keep. A host that registers `ask_user` without
|
|
3744
|
+
* listening for `clarification:required` gives the model a tool that always
|
|
3745
|
+
* answers "there is nobody watching this run" — while a person sits at the
|
|
3746
|
+
* terminal looking at it. That is worse than not offering the tool at all:
|
|
3747
|
+
* it costs a round trip and then tells the model something false.
|
|
3748
|
+
*
|
|
3749
|
+
* Only `cloud/server` bridges the protocol today. The CLI REPL and the
|
|
3750
|
+
* dashboard do not, so they do not call this, and their models are not shown
|
|
3751
|
+
* a capability nobody can serve. Wiring either of them is a matter of
|
|
3752
|
+
* listening for the event and calling `resolveClarification`, then calling
|
|
3753
|
+
* this.
|
|
3754
|
+
*
|
|
3755
|
+
* Still gated on the same conditions as the call itself, and `askUser`
|
|
3756
|
+
* re-checks them: `setUnattended` can land after this, so the tool can be
|
|
3757
|
+
* registered for a run that later turns out to have nobody on it. Then it
|
|
3758
|
+
* answers `no-listener` and the model proceeds on its own reading, which is
|
|
3759
|
+
* the same defence-in-depth `BrowserControlTool.revoke` provides.
|
|
3760
|
+
*/
|
|
3761
|
+
enableClarification(): void;
|
|
3575
3762
|
private registerMediaTools;
|
|
3576
3763
|
/**
|
|
3577
3764
|
* Register `generate_document` where there is a real workspace to write into.
|
|
@@ -6835,6 +7022,21 @@ interface RemoteBrowserSession {
|
|
|
6835
7022
|
* than the one that owns the run.
|
|
6836
7023
|
*/
|
|
6837
7024
|
liveViewUrl?: string;
|
|
7025
|
+
/**
|
|
7026
|
+
* How long the provider will keep this session before reaping it, in ms.
|
|
7027
|
+
*
|
|
7028
|
+
* Reported by the provider, never chosen by us: Steel's create API accepts
|
|
7029
|
+
* no timeout field (verified against the API source — see steel.ts), so this
|
|
7030
|
+
* ceiling is the provider's and the only thing we can do about it is know
|
|
7031
|
+
* what it is. Absent where a provider says nothing, which includes a bare
|
|
7032
|
+
* CDP endpoint: that browser is somebody else's and has no session at all.
|
|
7033
|
+
*
|
|
7034
|
+
* Worth surfacing because a session that outlives its usefulness dies at
|
|
7035
|
+
* exactly this number, and a leak is otherwise indistinguishable from a
|
|
7036
|
+
* deliberate shutdown — two field sessions ended at precisely 0:05:00 with
|
|
7037
|
+
* nothing anywhere recording that five minutes was the limit.
|
|
7038
|
+
*/
|
|
7039
|
+
expiresInMs?: number;
|
|
6838
7040
|
}
|
|
6839
7041
|
/**
|
|
6840
7042
|
* Somewhere to get a browser from.
|
|
@@ -6978,8 +7180,32 @@ interface RemoteBrowserControllerOptions {
|
|
|
6978
7180
|
* a wave of workers each opening their own is a cost nobody chose.
|
|
6979
7181
|
*/
|
|
6980
7182
|
maxSessions?: number;
|
|
6981
|
-
/**
|
|
6982
|
-
|
|
7183
|
+
/**
|
|
7184
|
+
* Told when a run's live view becomes available, so the owner can watch.
|
|
7185
|
+
*
|
|
7186
|
+
* `void | Promise<void>`, like `onReleaseFailed` below and for the same
|
|
7187
|
+
* reason: an async sink is the ordinary shape, TypeScript accepts one
|
|
7188
|
+
* wherever a `void` return is declared, and a signature promising `void`
|
|
7189
|
+
* tells an embedder their rejection is somebody's problem when it is
|
|
7190
|
+
* nobody's. `announceLiveView` observes it.
|
|
7191
|
+
*/
|
|
7192
|
+
onLiveView?: (runId: string, liveViewUrl: string | undefined) => void | Promise<void>;
|
|
7193
|
+
/**
|
|
7194
|
+
* Told when a provider session could not be handed back.
|
|
7195
|
+
*
|
|
7196
|
+
* Release is best-effort by design — a run that has finished must not be
|
|
7197
|
+
* reported as failed because the provider was briefly unreachable — but
|
|
7198
|
+
* best-effort is not the same as unobservable. A release that silently did
|
|
7199
|
+
* not happen leaves a billed browser running until the provider's own
|
|
7200
|
+
* timeout collects it, and without this there is no way to tell that from a
|
|
7201
|
+
* clean handback.
|
|
7202
|
+
*/
|
|
7203
|
+
/**
|
|
7204
|
+
* `void | Promise<void>`: an async sink is the ordinary shape for telemetry,
|
|
7205
|
+
* and a signature promising `void` tells an embedder their rejection is
|
|
7206
|
+
* somebody's problem when it is nobody's. `reportReleaseFailure` observes it.
|
|
7207
|
+
*/
|
|
7208
|
+
onReleaseFailed?: (runId: string, sessionId: string, err: unknown, expiresInMs?: number) => void | Promise<void>;
|
|
6983
7209
|
/**
|
|
6984
7210
|
* Something that must finish before this controller may open anything.
|
|
6985
7211
|
*
|
|
@@ -7025,6 +7251,34 @@ declare class RemoteBrowserController {
|
|
|
7025
7251
|
private controlAnnounced;
|
|
7026
7252
|
/** An embedder that wants every run's live view, told which run each is. */
|
|
7027
7253
|
private onLiveViewAll;
|
|
7254
|
+
/** Told when a provider session could not be handed back. See `disposeRun`. */
|
|
7255
|
+
private onReleaseFailed;
|
|
7256
|
+
/**
|
|
7257
|
+
* Tell the observer a session leaked, without letting it become the leak.
|
|
7258
|
+
*
|
|
7259
|
+
* Guarded, because this runs inside a `.catch` on the release: an observer
|
|
7260
|
+
* that throws — a logging or telemetry sink that is momentarily unavailable
|
|
7261
|
+
* is the ordinary case — would turn its own failure into a fresh rejection
|
|
7262
|
+
* from `disposeRun`, so `endRun` would reject before `forgetRun` and the
|
|
7263
|
+
* fire-and-forget `stopRun` path would raise an unhandled rejection.
|
|
7264
|
+
*
|
|
7265
|
+
* That is precisely the guarantee this whole change claims to preserve: a
|
|
7266
|
+
* release that fails must never fail the run. Reporting it cannot be the
|
|
7267
|
+
* thing that breaks it.
|
|
7268
|
+
*
|
|
7269
|
+
* TWO WAYS TO FAIL, not one. The `try` catches a synchronous throw; an
|
|
7270
|
+
* `async` sink — which is what a telemetry or logging callback usually is —
|
|
7271
|
+
* fails by returning a REJECTED PROMISE, which no `try` around a call that is
|
|
7272
|
+
* never awaited can see. Node then raises an unhandled rejection and can take
|
|
7273
|
+
* the process down: the observer would not merely have failed to report the
|
|
7274
|
+
* leak, it would have killed the run, which is the one outcome this function
|
|
7275
|
+
* exists to prevent, reached through the door the guard did not cover.
|
|
7276
|
+
*
|
|
7277
|
+
* Not awaited, though. The caller is a `.catch` on the release and is not
|
|
7278
|
+
* going to wait for a telemetry round trip; attaching a handler is what makes
|
|
7279
|
+
* the rejection observed, which is the whole requirement.
|
|
7280
|
+
*/
|
|
7281
|
+
private reportReleaseFailure;
|
|
7028
7282
|
private runs;
|
|
7029
7283
|
/**
|
|
7030
7284
|
* Runs that have a pool slot but no browser yet.
|
|
@@ -7106,9 +7360,9 @@ declare class RemoteBrowserController {
|
|
|
7106
7360
|
/** The controller to hand to `Cascade.setBrowserController`. */
|
|
7107
7361
|
get controller(): (action: BrowserAction, context: BrowserActionContext) => Promise<BrowserActionOutcome>;
|
|
7108
7362
|
/** Watch one run's browser. The URL never goes to any other run's listener. */
|
|
7109
|
-
onLiveViewFor(runKey: string, listener: (info: BrowserViewInfo) => void): void;
|
|
7363
|
+
onLiveViewFor(runKey: string, listener: (info: BrowserViewInfo) => void | Promise<void>): void;
|
|
7110
7364
|
offLiveViewFor(runKey: string): void;
|
|
7111
|
-
onControlFor(runKey: string, listener: (state: BrowserControlState) => void): void;
|
|
7365
|
+
onControlFor(runKey: string, listener: (state: BrowserControlState) => void | Promise<void>): void;
|
|
7112
7366
|
offControlFor(runKey: string): void;
|
|
7113
7367
|
/**
|
|
7114
7368
|
* Say who has the browser, but only when the answer has changed.
|
|
@@ -7164,7 +7418,7 @@ declare class RemoteBrowserController {
|
|
|
7164
7418
|
* it is already being watched. Callers use that to avoid promising a viewer
|
|
7165
7419
|
* a stream that will never arrive.
|
|
7166
7420
|
*/
|
|
7167
|
-
startWatching(runId: string, onFrame: (frame: BrowserFrame) => void): Promise<boolean>;
|
|
7421
|
+
startWatching(runId: string, onFrame: (frame: BrowserFrame) => void | Promise<void>): Promise<boolean>;
|
|
7168
7422
|
/**
|
|
7169
7423
|
* Run one watch or unwatch after every one already asked for.
|
|
7170
7424
|
*
|
|
@@ -7410,6 +7664,73 @@ declare class GenericCdpProvider implements RemoteBrowserProvider {
|
|
|
7410
7664
|
*/
|
|
7411
7665
|
declare function isCdpEndpoint(url: string): boolean;
|
|
7412
7666
|
|
|
7667
|
+
/**
|
|
7668
|
+
* Whether this configuration will end up talking to Steel's hosted API.
|
|
7669
|
+
*
|
|
7670
|
+
* Lives HERE, next to the default it has to agree with, rather than in the
|
|
7671
|
+
* caller that needs the answer. The hosted endpoint requires a credential and a
|
|
7672
|
+
* self-hosted one usually does not, so something has to decide which a given
|
|
7673
|
+
* config is — and a server-side copy of that decision is a second definition of
|
|
7674
|
+
* "hosted" free to drift from the one that actually picks the URL.
|
|
7675
|
+
*
|
|
7676
|
+
* Several configs reach the hosted API and they do not look alike: no url at
|
|
7677
|
+
* all, an empty one (`opts.url || DEFAULT_BASE` takes the default for both),
|
|
7678
|
+
* the hosted host typed out in full, and the fully-qualified spelling with a
|
|
7679
|
+
* terminal dot. Asking about the RESOLVED destination answers all of them at
|
|
7680
|
+
* once, which asking about the presence of `url` cannot.
|
|
7681
|
+
*
|
|
7682
|
+
* Compared by host key, so a trailing slash, a port, a path, a different scheme,
|
|
7683
|
+
* a different case or a root dot cannot disguise it. A URL this cannot parse is
|
|
7684
|
+
* not the hosted API — and is refused earlier anyway, for being unparseable.
|
|
7685
|
+
*/
|
|
7686
|
+
declare function isHostedSteel(url?: string): boolean;
|
|
7687
|
+
/**
|
|
7688
|
+
* Whether this can serve as the API base — asked of the URL ACTUALLY BUILT.
|
|
7689
|
+
*
|
|
7690
|
+
* Six rounds of review found six ways a base could look fine and not work:
|
|
7691
|
+
* a wrong host, a terminal dot, a query string, userinfo, a path prefix on the
|
|
7692
|
+
* hosted service, doubled trailing slashes. Each was answered by inspecting one
|
|
7693
|
+
* more component, and a seventh arrived that no component exposes — a bare `?`
|
|
7694
|
+
* or `#` leaves `search` and `hash` EMPTY while `href` keeps the delimiter, so
|
|
7695
|
+
* `${base}/v1/sessions` becomes `...?/v1/sessions` and the POST lands on `/`.
|
|
7696
|
+
*
|
|
7697
|
+
* So this stopped adding conditions and started asking the only question that
|
|
7698
|
+
* was ever the real one: build the request `call()` will build, and see whether
|
|
7699
|
+
* it addresses the endpoint. A spelling nobody has thought of yet fails this by
|
|
7700
|
+
* construction rather than by being enumerated.
|
|
7701
|
+
*/
|
|
7702
|
+
declare function isUsableSteelBase(url: string): boolean;
|
|
7703
|
+
/**
|
|
7704
|
+
* Whether this credential can actually be SENT.
|
|
7705
|
+
*
|
|
7706
|
+
* The env schema trims, which removes surrounding whitespace and nothing else,
|
|
7707
|
+
* so a key pasted out of a wrapped terminal or a here-doc can carry an embedded
|
|
7708
|
+
* newline. It is truthy, so the hosted gate reads the deployment as
|
|
7709
|
+
* authenticated and `/api/config` advertises Browser mode — and then `fetch`
|
|
7710
|
+
* refuses the header before a byte is sent, leaving a control that cannot make
|
|
7711
|
+
* one call. The third member of the category `fetch` refuses before sending,
|
|
7712
|
+
* after userinfo and blocked ports.
|
|
7713
|
+
*
|
|
7714
|
+
* CONSTRUCTING A HEADER IS NOT SENDING ONE, and the first version of this asked
|
|
7715
|
+
* the wrong one of those two questions. It built a `Headers` and trusted the
|
|
7716
|
+
* result — but `Headers` (and `Request`) accept DEL and every C0 control except
|
|
7717
|
+
* CR, LF and NUL, while the SEND path refuses them, so a key containing `\x7f`
|
|
7718
|
+
* was advertised as usable and then died as `invalid steel-api-key header`
|
|
7719
|
+
* before DNS. The comment here stated that as verified fact; it had verified
|
|
7720
|
+
* the constructor, which is a different thing.
|
|
7721
|
+
*
|
|
7722
|
+
* So this asks the send path's own rule — RFC 9110's field value: horizontal
|
|
7723
|
+
* tab, printable ASCII, or a high byte — because no constructor asks it.
|
|
7724
|
+
* Confirmed by probing every byte from 0x00 to 0xff through `fetch` itself:
|
|
7725
|
+
* refused are 0x00-0x08, 0x0a-0x1f and 0x7f, and this predicate agrees with it
|
|
7726
|
+
* on all 256. The test pins that set rather than describing it.
|
|
7727
|
+
*
|
|
7728
|
+
* A scan rather than a regex: the equivalent character class is linear, but
|
|
7729
|
+
* this file already carries two loops written to avoid CodeQL's backtracking
|
|
7730
|
+
* finding, and one idiom is easier to keep true than two. Code points above
|
|
7731
|
+
* 0xff fail here and at `fetch`, which refuses them as un-ByteString-able.
|
|
7732
|
+
*/
|
|
7733
|
+
declare function isUsableSteelKey(apiKey: string): boolean;
|
|
7413
7734
|
declare class SteelProvider implements RemoteBrowserProvider {
|
|
7414
7735
|
readonly name = "Steel";
|
|
7415
7736
|
readonly isolatesSessions = true;
|
|
@@ -8813,4 +9134,4 @@ declare function gatherSyncBundle(config: CascadeConfig): SyncBundle;
|
|
|
8813
9134
|
/** Merge a pulled bundle into a config, returning the updated config to persist. */
|
|
8814
9135
|
declare function applySyncBundle(bundle: SyncBundle, config: CascadeConfig, cleanup?: RetiredProviderCleanup): CascadeConfig;
|
|
8815
9136
|
|
|
8816
|
-
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, type BrowserControlState, BrowserControlTool, type BrowserController, type BrowserFrame, type BrowserInput, 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 };
|
|
9137
|
+
export { AZURE_BASE_MODELS, AZURE_BASE_URL_TEMPLATE, type AcceptanceOptions, type AcceptanceProbe, type AcceptanceResult, type AcceptanceVerdict, type ApprovalRequest, type ApprovalResponse, AskUserTool, type AuditEntry, AuditLogger, type AzureDeploymentInput, type BenchmarksConfig, type Block, type BrowserAction, type BrowserActionOutcome, type BrowserControlState, BrowserControlTool, type BrowserController, type BrowserFrame, type BrowserInput, 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, type ClarificationAnswer, type ClarificationOutcome, type ClarificationQuestion, type ClarificationResult, 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, isHostedSteel, isMcpToolName, isUsableSteelBase, isUsableSteelKey, 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 };
|