@promptbook/cli 0.112.0-11 → 0.112.0-13
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/esm/index.es.js +2295 -2859
- package/esm/index.es.js.map +1 -1
- package/esm/src/book-2.0/agent-source/AgentBasicInformation.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/ChatToolCallModal.test.d.ts +2 -0
- package/esm/src/book-components/Chat/Chat/renderToolCallDetails.d.ts +4 -0
- package/esm/src/book-components/Chat/utils/getToolCallChipletInfo.timeout.test.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +123 -0
- package/esm/src/book-components/Chat/utils/timeoutToolCallPresentation.test.d.ts +1 -0
- package/esm/src/commitments/USE_BROWSER/resolveRunBrowserToolForNode.d.ts +1 -1
- package/esm/src/commitments/USE_CALENDAR/USE_CALENDAR.d.ts +42 -0
- package/esm/src/commitments/USE_CALENDAR/USE_CALENDAR.test.d.ts +1 -0
- package/esm/src/commitments/USE_CALENDAR/UseCalendarToolNames.d.ts +13 -0
- package/esm/src/commitments/USE_CALENDAR/UseCalendarWallet.d.ts +9 -0
- package/esm/src/commitments/USE_CALENDAR/calendarReference.d.ts +68 -0
- package/esm/src/commitments/USE_CALENDAR/callGoogleCalendarApi.d.ts +19 -0
- package/esm/src/commitments/USE_CALENDAR/createUseCalendarToolFunctions.d.ts +8 -0
- package/esm/src/commitments/USE_CALENDAR/createUseCalendarTools.d.ts +7 -0
- package/esm/src/commitments/USE_CALENDAR/getUseCalendarToolTitles.d.ts +7 -0
- package/esm/src/commitments/USE_CALENDAR/normalizeConfiguredCalendars.d.ts +19 -0
- package/esm/src/commitments/USE_CALENDAR/resolveUseCalendarToolRuntimeOrWalletCredentialResult.d.ts +34 -0
- package/esm/src/commitments/USE_TIMEOUT/TimeoutToolNames.d.ts +1 -0
- package/esm/src/commitments/USE_TIMEOUT/TimeoutToolRuntimeAdapter.d.ts +51 -2
- package/esm/src/commitments/USE_TIMEOUT/USE_TIMEOUT.d.ts +2 -2
- package/esm/src/commitments/USE_TIMEOUT/getTimeoutToolRuntimeAdapterOrDisabledResult.d.ts +2 -2
- package/esm/src/commitments/USE_TIMEOUT/parseTimeoutToolArgs.d.ts +14 -1
- package/esm/src/commitments/_common/toolRuntimeContext.d.ts +9 -0
- package/esm/src/commitments/index.d.ts +2 -1
- package/esm/src/executables/apps/locateVscode.d.ts +7 -0
- package/esm/src/executables/apps/locateVscode.test.d.ts +1 -0
- package/esm/src/executables/browsers/locateBrowser.d.ts +10 -0
- package/esm/src/executables/browsers/locateBrowser.test.d.ts +1 -0
- package/esm/src/executables/browsers/locateChrome.d.ts +7 -0
- package/esm/src/executables/browsers/locateChrome.test.d.ts +1 -0
- package/esm/src/executables/browsers/locateDefaultSystemBrowser.d.ts +10 -0
- package/esm/src/executables/browsers/locateDefaultSystemBrowser.test.d.ts +1 -0
- package/esm/src/executables/browsers/locateEdge.d.ts +7 -0
- package/esm/src/executables/browsers/locateEdge.test.d.ts +1 -0
- package/esm/src/executables/browsers/locateFirefox.d.ts +7 -0
- package/esm/src/executables/browsers/locateFirefox.test.d.ts +1 -0
- package/esm/src/executables/browsers/locateInternetExplorer.d.ts +7 -0
- package/esm/src/executables/browsers/locateInternetExplorer.test.d.ts +1 -0
- package/esm/src/executables/browsers/locateSafari.d.ts +7 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -2
- package/umd/index.umd.js +2296 -2856
- package/umd/index.umd.js.map +1 -1
- package/umd/src/book-2.0/agent-source/AgentBasicInformation.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/ChatToolCallModal.test.d.ts +2 -0
- package/umd/src/book-components/Chat/Chat/renderToolCallDetails.d.ts +4 -0
- package/umd/src/book-components/Chat/utils/getToolCallChipletInfo.timeout.test.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +123 -0
- package/umd/src/book-components/Chat/utils/timeoutToolCallPresentation.test.d.ts +1 -0
- package/umd/src/commitments/USE_BROWSER/resolveRunBrowserToolForNode.d.ts +1 -1
- package/umd/src/commitments/USE_CALENDAR/USE_CALENDAR.d.ts +42 -0
- package/umd/src/commitments/USE_CALENDAR/USE_CALENDAR.test.d.ts +1 -0
- package/umd/src/commitments/USE_CALENDAR/UseCalendarToolNames.d.ts +13 -0
- package/umd/src/commitments/USE_CALENDAR/UseCalendarWallet.d.ts +9 -0
- package/umd/src/commitments/USE_CALENDAR/calendarReference.d.ts +68 -0
- package/umd/src/commitments/USE_CALENDAR/callGoogleCalendarApi.d.ts +19 -0
- package/umd/src/commitments/USE_CALENDAR/createUseCalendarToolFunctions.d.ts +8 -0
- package/umd/src/commitments/USE_CALENDAR/createUseCalendarTools.d.ts +7 -0
- package/umd/src/commitments/USE_CALENDAR/getUseCalendarToolTitles.d.ts +7 -0
- package/umd/src/commitments/USE_CALENDAR/normalizeConfiguredCalendars.d.ts +19 -0
- package/umd/src/commitments/USE_CALENDAR/resolveUseCalendarToolRuntimeOrWalletCredentialResult.d.ts +34 -0
- package/umd/src/commitments/USE_TIMEOUT/TimeoutToolNames.d.ts +1 -0
- package/umd/src/commitments/USE_TIMEOUT/TimeoutToolRuntimeAdapter.d.ts +51 -2
- package/umd/src/commitments/USE_TIMEOUT/USE_TIMEOUT.d.ts +2 -2
- package/umd/src/commitments/USE_TIMEOUT/getTimeoutToolRuntimeAdapterOrDisabledResult.d.ts +2 -2
- package/umd/src/commitments/USE_TIMEOUT/parseTimeoutToolArgs.d.ts +14 -1
- package/umd/src/commitments/_common/toolRuntimeContext.d.ts +9 -0
- package/umd/src/commitments/index.d.ts +2 -1
- package/umd/src/executables/apps/locateVscode.d.ts +7 -0
- package/umd/src/executables/apps/locateVscode.test.d.ts +1 -0
- package/umd/src/executables/browsers/locateBrowser.d.ts +10 -0
- package/umd/src/executables/browsers/locateBrowser.test.d.ts +1 -0
- package/umd/src/executables/browsers/locateChrome.d.ts +7 -0
- package/umd/src/executables/browsers/locateChrome.test.d.ts +1 -0
- package/umd/src/executables/browsers/locateDefaultSystemBrowser.d.ts +10 -0
- package/umd/src/executables/browsers/locateDefaultSystemBrowser.test.d.ts +1 -0
- package/umd/src/executables/browsers/locateEdge.d.ts +7 -0
- package/umd/src/executables/browsers/locateEdge.test.d.ts +1 -0
- package/umd/src/executables/browsers/locateFirefox.d.ts +7 -0
- package/umd/src/executables/browsers/locateFirefox.test.d.ts +1 -0
- package/umd/src/executables/browsers/locateInternetExplorer.d.ts +7 -0
- package/umd/src/executables/browsers/locateInternetExplorer.test.d.ts +1 -0
- package/umd/src/executables/browsers/locateSafari.d.ts +7 -0
- package/umd/src/version.d.ts +1 -1
- package/esm/apps/agents-server/config.d.ts +0 -86
- package/esm/apps/agents-server/src/tools/$provideBrowserForServer.d.ts +0 -28
- package/esm/apps/agents-server/src/tools/BrowserConnectionProvider.d.ts +0 -142
- package/esm/apps/agents-server/src/tools/runBrowserArtifacts.d.ts +0 -25
- package/esm/apps/agents-server/src/tools/runBrowserConstants.d.ts +0 -21
- package/esm/apps/agents-server/src/tools/runBrowserErrorHandling.d.ts +0 -60
- package/esm/apps/agents-server/src/tools/runBrowserErrors.d.ts +0 -73
- package/esm/apps/agents-server/src/tools/runBrowserObservability.d.ts +0 -36
- package/esm/apps/agents-server/src/tools/runBrowserResultFormatting.d.ts +0 -47
- package/esm/apps/agents-server/src/tools/runBrowserRuntime.d.ts +0 -24
- package/esm/apps/agents-server/src/tools/runBrowserWorkflow.d.ts +0 -36
- package/esm/apps/agents-server/src/tools/run_browser.d.ts +0 -11
- package/esm/apps/agents-server/src/utils/retryWithBackoff.d.ts +0 -95
- package/esm/apps/agents-server/src/utils/runBrowserArtifactStorage.d.ts +0 -26
- package/umd/apps/agents-server/config.d.ts +0 -86
- package/umd/apps/agents-server/src/tools/$provideBrowserForServer.d.ts +0 -28
- package/umd/apps/agents-server/src/tools/BrowserConnectionProvider.d.ts +0 -142
- package/umd/apps/agents-server/src/tools/runBrowserArtifacts.d.ts +0 -25
- package/umd/apps/agents-server/src/tools/runBrowserConstants.d.ts +0 -21
- package/umd/apps/agents-server/src/tools/runBrowserErrorHandling.d.ts +0 -60
- package/umd/apps/agents-server/src/tools/runBrowserErrors.d.ts +0 -73
- package/umd/apps/agents-server/src/tools/runBrowserObservability.d.ts +0 -36
- package/umd/apps/agents-server/src/tools/runBrowserResultFormatting.d.ts +0 -47
- package/umd/apps/agents-server/src/tools/runBrowserRuntime.d.ts +0 -24
- package/umd/apps/agents-server/src/tools/runBrowserWorkflow.d.ts +0 -36
- package/umd/apps/agents-server/src/tools/run_browser.d.ts +0 -11
- package/umd/apps/agents-server/src/utils/retryWithBackoff.d.ts +0 -95
- package/umd/apps/agents-server/src/utils/runBrowserArtifactStorage.d.ts +0 -26
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Callback invoked before one retry wait.
|
|
3
|
-
*
|
|
4
|
-
* @private utility for Agents Server runtime retries
|
|
5
|
-
*/
|
|
6
|
-
export type RetryWithBackoffAttempt = {
|
|
7
|
-
/**
|
|
8
|
-
* Number of failed attempts completed so far (1-based).
|
|
9
|
-
*/
|
|
10
|
-
readonly attempt: number;
|
|
11
|
-
/**
|
|
12
|
-
* Configured number of retries after the first attempt.
|
|
13
|
-
*/
|
|
14
|
-
readonly retries: number;
|
|
15
|
-
/**
|
|
16
|
-
* Delay scheduled before the next attempt.
|
|
17
|
-
*/
|
|
18
|
-
readonly delayMs: number;
|
|
19
|
-
/**
|
|
20
|
-
* Error from the attempt that just failed.
|
|
21
|
-
*/
|
|
22
|
-
readonly error: unknown;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Result metadata returned from a retry operation.
|
|
26
|
-
*
|
|
27
|
-
* @private utility for Agents Server runtime retries
|
|
28
|
-
*/
|
|
29
|
-
export type RetryWithBackoffResult<TValue> = {
|
|
30
|
-
/**
|
|
31
|
-
* Value returned from the successful attempt.
|
|
32
|
-
*/
|
|
33
|
-
readonly value: TValue;
|
|
34
|
-
/**
|
|
35
|
-
* Number of attempts used (first try + retries).
|
|
36
|
-
*/
|
|
37
|
-
readonly attempts: number;
|
|
38
|
-
/**
|
|
39
|
-
* Total elapsed time in milliseconds across attempts and waits.
|
|
40
|
-
*/
|
|
41
|
-
readonly durationMs: number;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Configurable options for retrying one asynchronous operation with backoff.
|
|
45
|
-
*
|
|
46
|
-
* @private utility for Agents Server runtime retries
|
|
47
|
-
*/
|
|
48
|
-
export type RetryWithBackoffOptions = {
|
|
49
|
-
/**
|
|
50
|
-
* Number of retries after the initial attempt.
|
|
51
|
-
*/
|
|
52
|
-
readonly retries: number;
|
|
53
|
-
/**
|
|
54
|
-
* Initial backoff delay before retry #1.
|
|
55
|
-
*/
|
|
56
|
-
readonly initialDelayMs: number;
|
|
57
|
-
/**
|
|
58
|
-
* Upper bound for one backoff delay.
|
|
59
|
-
*/
|
|
60
|
-
readonly maxDelayMs: number;
|
|
61
|
-
/**
|
|
62
|
-
* Multiplier used for exponential growth between retry delays.
|
|
63
|
-
*/
|
|
64
|
-
readonly backoffFactor: number;
|
|
65
|
-
/**
|
|
66
|
-
* Randomized extra delay ratio relative to the exponential delay.
|
|
67
|
-
*/
|
|
68
|
-
readonly jitterRatio: number;
|
|
69
|
-
/**
|
|
70
|
-
* Optional cancellation signal.
|
|
71
|
-
*/
|
|
72
|
-
readonly signal?: AbortSignal;
|
|
73
|
-
/**
|
|
74
|
-
* Optional predicate deciding if the thrown error can be retried.
|
|
75
|
-
*/
|
|
76
|
-
readonly shouldRetry?: (error: unknown, attempt: number) => boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Optional callback called before waiting for one retry.
|
|
79
|
-
*/
|
|
80
|
-
readonly onRetry?: (attempt: RetryWithBackoffAttempt) => void;
|
|
81
|
-
/**
|
|
82
|
-
* Random provider used for jitter; defaults to `Math.random`.
|
|
83
|
-
*/
|
|
84
|
-
readonly random?: () => number;
|
|
85
|
-
/**
|
|
86
|
-
* Sleep implementation used during backoff; defaults to an abort-aware timeout.
|
|
87
|
-
*/
|
|
88
|
-
readonly sleep?: (delayMs: number, signal?: AbortSignal) => Promise<void>;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Retries one async operation with exponential backoff and jitter.
|
|
92
|
-
*
|
|
93
|
-
* @private utility for Agents Server runtime retries
|
|
94
|
-
*/
|
|
95
|
-
export declare function retryWithBackoff<TValue>(operation: (attempt: number) => Promise<TValue>, options: RetryWithBackoffOptions): Promise<RetryWithBackoffResult<TValue>>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Logical public directory marker used in `run_browser` payload paths.
|
|
3
|
-
*
|
|
4
|
-
* This value is kept stable for UI parsing and `/api/browser-artifacts/*` URL mapping.
|
|
5
|
-
*/
|
|
6
|
-
export declare const RUN_BROWSER_ARTIFACT_PUBLIC_DIRECTORY = ".playwright-cli";
|
|
7
|
-
/**
|
|
8
|
-
* Whitelist pattern for browser artifact filenames produced by `run_browser`.
|
|
9
|
-
*/
|
|
10
|
-
export declare const RUN_BROWSER_ARTIFACT_FILENAME_PATTERN: RegExp;
|
|
11
|
-
/**
|
|
12
|
-
* Resolves writable filesystem directory used for artifact persistence.
|
|
13
|
-
*/
|
|
14
|
-
export declare function resolveRunBrowserArtifactStorageDirectory(): string;
|
|
15
|
-
/**
|
|
16
|
-
* Resolves absolute filesystem path of one artifact filename.
|
|
17
|
-
*/
|
|
18
|
-
export declare function resolveRunBrowserArtifactFilesystemPath(artifactFilename: string): string;
|
|
19
|
-
/**
|
|
20
|
-
* Resolves payload path of one artifact filename used by replay renderers.
|
|
21
|
-
*/
|
|
22
|
-
export declare function resolveRunBrowserArtifactPublicPath(artifactFilename: string): string;
|
|
23
|
-
/**
|
|
24
|
-
* Validates whether one filename belongs to the supported browser artifact set.
|
|
25
|
-
*/
|
|
26
|
-
export declare function isRunBrowserArtifactFilename(artifactFilename: string): boolean;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Public URL of the deployment, e.g. "https://my-app.vercel.app"
|
|
3
|
-
*
|
|
4
|
-
* Note: When a request resolves through the global `_Server` registry,
|
|
5
|
-
* this URL will be overridden by the matched server domain.
|
|
6
|
-
*/
|
|
7
|
-
export declare const NEXT_PUBLIC_SITE_URL: URL | undefined;
|
|
8
|
-
/**
|
|
9
|
-
* [♐️] Vercel environment: "development" | "preview" | "production"
|
|
10
|
-
*/
|
|
11
|
-
export declare const NEXT_PUBLIC_VERCEL_ENV: string | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* [♐️] Target environment – can be system or custom
|
|
14
|
-
*/
|
|
15
|
-
export declare const NEXT_PUBLIC_VERCEL_TARGET_ENV: string | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* [♐️] Deployment URL (without https://), e.g. "my-app-abc123.vercel.app"
|
|
18
|
-
*/
|
|
19
|
-
export declare const NEXT_PUBLIC_VERCEL_URL: string | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* [♐️] Branch URL (without https://), only for branch deployments
|
|
22
|
-
*/
|
|
23
|
-
export declare const NEXT_PUBLIC_VERCEL_BRANCH_URL: string | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* [♐️] Production domain of the project
|
|
26
|
-
*/
|
|
27
|
-
export declare const NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL: string | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* [♐️] Git provider (github | gitlab | bitbucket)
|
|
30
|
-
*/
|
|
31
|
-
export declare const NEXT_PUBLIC_VERCEL_GIT_PROVIDER: string | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* [♐️] Repository owner (e.g. "hejny")
|
|
34
|
-
*/
|
|
35
|
-
export declare const NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER: string | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* [♐️] Repository slug (e.g. "my-project")
|
|
38
|
-
*/
|
|
39
|
-
export declare const NEXT_PUBLIC_VERCEL_GIT_REPO_SLUG: string | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* [♐️] Repository internal ID
|
|
42
|
-
*/
|
|
43
|
-
export declare const NEXT_PUBLIC_VERCEL_GIT_REPO_ID: string | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* [♐️] Git commit SHA (short or long)
|
|
46
|
-
*/
|
|
47
|
-
export declare const NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA: string | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* [♐️] Commit message used for this deployment
|
|
50
|
-
*/
|
|
51
|
-
export declare const NEXT_PUBLIC_VERCEL_GIT_COMMIT_MESSAGE: string | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* [♐️] Branch name (ref), e.g. "main"
|
|
54
|
-
*/
|
|
55
|
-
export declare const NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF: string | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* Author name of the commit
|
|
58
|
-
*/
|
|
59
|
-
export declare const NEXT_PUBLIC_VERCEL_GIT_COMMIT_AUTHOR_NAME: string | undefined;
|
|
60
|
-
/**
|
|
61
|
-
* [♐️] Author login/username
|
|
62
|
-
*/
|
|
63
|
-
export declare const NEXT_PUBLIC_VERCEL_GIT_COMMIT_AUTHOR_LOGIN: string | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* [♐️] Previous deployment commit SHA (if exists)
|
|
66
|
-
*/
|
|
67
|
-
export declare const NEXT_PUBLIC_VERCEL_GIT_PREVIOUS_SHA: string | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* [♐️] Pull Request ID for PR-based deployments
|
|
70
|
-
*/
|
|
71
|
-
export declare const NEXT_PUBLIC_VERCEL_GIT_PULL_REQUEST_ID: string | undefined;
|
|
72
|
-
/**
|
|
73
|
-
* Supabase table prefix
|
|
74
|
-
*
|
|
75
|
-
* This remains the fallback/default prefix used before `_Server` contains records
|
|
76
|
-
* or for local development requests.
|
|
77
|
-
*/
|
|
78
|
-
export declare const SUPABASE_TABLE_PREFIX: string;
|
|
79
|
-
/**
|
|
80
|
-
* WebSocket endpoint URL for remote Playwright browser server (e.g., ws://browser-server:3000).
|
|
81
|
-
*
|
|
82
|
-
* When set, browser automation will connect to this remote server instead of launching a local browser.
|
|
83
|
-
* This is useful for environments like Vercel where running a full browser locally is not possible.
|
|
84
|
-
* Leave empty to use local browser mode.
|
|
85
|
-
*/
|
|
86
|
-
export declare const REMOTE_BROWSER_URL: string;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { BrowserContext } from 'playwright';
|
|
2
|
-
import { type BrowserContextRequestOptions } from './BrowserConnectionProvider';
|
|
3
|
-
/**
|
|
4
|
-
* Provides a browser context for server-side operations, with caching to reuse instances.
|
|
5
|
-
*
|
|
6
|
-
* This function supports both local and remote browser connections based on environment configuration.
|
|
7
|
-
* Use REMOTE_BROWSER_URL environment variable to configure a remote Playwright server.
|
|
8
|
-
*
|
|
9
|
-
* @param options - Optional runtime request options used for cancellation and logging context.
|
|
10
|
-
* @returns Browser context instance
|
|
11
|
-
*/
|
|
12
|
-
export declare function $provideBrowserForServer(options?: BrowserContextRequestOptions): Promise<BrowserContext>;
|
|
13
|
-
/**
|
|
14
|
-
* Closes all open pages in the current browser context.
|
|
15
|
-
*
|
|
16
|
-
* This function is useful for cleanup between agent tasks to avoid memory leaks.
|
|
17
|
-
* It does not close the browser instance itself, allowing it to be reused.
|
|
18
|
-
*/
|
|
19
|
-
export declare function $closeBrowserPages(): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Closes the browser context and disconnects from the browser.
|
|
22
|
-
*
|
|
23
|
-
* This should be called during server shutdown or when the browser is no longer needed.
|
|
24
|
-
*/
|
|
25
|
-
export declare function $closeBrowser(): Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming
|
|
28
|
-
*/
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { BrowserContext } from 'playwright';
|
|
2
|
-
/**
|
|
3
|
-
* Runtime options used while acquiring a browser context.
|
|
4
|
-
*
|
|
5
|
-
* @private internal type for `BrowserConnectionProvider`
|
|
6
|
-
*/
|
|
7
|
-
export type BrowserContextRequestOptions = {
|
|
8
|
-
/**
|
|
9
|
-
* Optional signal to cancel connect retries and waits.
|
|
10
|
-
*/
|
|
11
|
-
readonly signal?: AbortSignal;
|
|
12
|
-
/**
|
|
13
|
-
* Optional browser run session identifier for structured logs.
|
|
14
|
-
*/
|
|
15
|
-
readonly sessionId?: string;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Constructor options for BrowserConnectionProvider.
|
|
19
|
-
*
|
|
20
|
-
* @private internal type for `BrowserConnectionProvider`
|
|
21
|
-
*/
|
|
22
|
-
type BrowserConnectionProviderOptions = {
|
|
23
|
-
/**
|
|
24
|
-
* Enable verbose provider-level logs.
|
|
25
|
-
*/
|
|
26
|
-
readonly isVerbose?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Connect timeout for one remote Playwright websocket attempt.
|
|
29
|
-
*/
|
|
30
|
-
readonly remoteConnectTimeoutMs?: number;
|
|
31
|
-
/**
|
|
32
|
-
* Number of retries after the initial remote connect attempt.
|
|
33
|
-
*/
|
|
34
|
-
readonly remoteConnectRetries?: number;
|
|
35
|
-
/**
|
|
36
|
-
* Initial retry delay in milliseconds.
|
|
37
|
-
*/
|
|
38
|
-
readonly remoteConnectBackoffInitialMs?: number;
|
|
39
|
-
/**
|
|
40
|
-
* Maximum retry delay in milliseconds.
|
|
41
|
-
*/
|
|
42
|
-
readonly remoteConnectBackoffMaxMs?: number;
|
|
43
|
-
/**
|
|
44
|
-
* Retry delay multiplier.
|
|
45
|
-
*/
|
|
46
|
-
readonly remoteConnectBackoffFactor?: number;
|
|
47
|
-
/**
|
|
48
|
-
* Retry jitter ratio.
|
|
49
|
-
*/
|
|
50
|
-
readonly remoteConnectJitterRatio?: number;
|
|
51
|
-
/**
|
|
52
|
-
* Optional random provider used by retry jitter.
|
|
53
|
-
*/
|
|
54
|
-
readonly random?: () => number;
|
|
55
|
-
/**
|
|
56
|
-
* Optional sleep provider for retry waits.
|
|
57
|
-
*/
|
|
58
|
-
readonly sleep?: (delayMs: number, signal?: AbortSignal) => Promise<void>;
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* Provides browser context instances with support for both local and remote browser connections.
|
|
62
|
-
*
|
|
63
|
-
* This provider manages browser lifecycle and supports:
|
|
64
|
-
* - Local mode: Launches a persistent Chromium context on the same machine
|
|
65
|
-
* - Remote mode: Connects to a remote Playwright browser via WebSocket
|
|
66
|
-
*
|
|
67
|
-
* The remote mode is useful for environments like Vercel where running a full browser
|
|
68
|
-
* is not possible due to resource constraints.
|
|
69
|
-
*
|
|
70
|
-
* @private internal utility for Agents Server browser tools
|
|
71
|
-
*/
|
|
72
|
-
export declare class BrowserConnectionProvider {
|
|
73
|
-
private browserContext;
|
|
74
|
-
private connectionMode;
|
|
75
|
-
private readonly isVerbose;
|
|
76
|
-
private readonly remoteConnectTimeoutMs;
|
|
77
|
-
private readonly remoteConnectRetries;
|
|
78
|
-
private readonly remoteConnectBackoffInitialMs;
|
|
79
|
-
private readonly remoteConnectBackoffMaxMs;
|
|
80
|
-
private readonly remoteConnectBackoffFactor;
|
|
81
|
-
private readonly remoteConnectJitterRatio;
|
|
82
|
-
private readonly random;
|
|
83
|
-
private readonly sleep?;
|
|
84
|
-
/**
|
|
85
|
-
* Creates a new BrowserConnectionProvider.
|
|
86
|
-
*
|
|
87
|
-
* @param options - Provider options
|
|
88
|
-
* @param options.isVerbose - Enable verbose logging
|
|
89
|
-
*/
|
|
90
|
-
constructor(options?: BrowserConnectionProviderOptions);
|
|
91
|
-
/**
|
|
92
|
-
* Gets a browser context, creating a new one if needed.
|
|
93
|
-
*
|
|
94
|
-
* This method automatically determines whether to use local or remote browser
|
|
95
|
-
* based on the REMOTE_BROWSER_URL environment variable.
|
|
96
|
-
*
|
|
97
|
-
* @returns Browser context instance
|
|
98
|
-
*/
|
|
99
|
-
getBrowserContext(options?: BrowserContextRequestOptions): Promise<BrowserContext>;
|
|
100
|
-
/**
|
|
101
|
-
* Closes all pages in the current browser context.
|
|
102
|
-
*
|
|
103
|
-
* This method is useful for cleanup between agent tasks without closing
|
|
104
|
-
* the entire browser instance.
|
|
105
|
-
*/
|
|
106
|
-
closeAllPages(): Promise<void>;
|
|
107
|
-
/**
|
|
108
|
-
* Closes the browser context and disconnects from the browser.
|
|
109
|
-
*
|
|
110
|
-
* This should be called when the browser is no longer needed to free up resources.
|
|
111
|
-
* For local mode, this closes the browser process. For remote mode, it disconnects
|
|
112
|
-
* from the remote browser but doesn't shut down the remote server.
|
|
113
|
-
*/
|
|
114
|
-
close(): Promise<void>;
|
|
115
|
-
/**
|
|
116
|
-
* Checks if a browser context is still alive and connected.
|
|
117
|
-
*
|
|
118
|
-
* @param context - Browser context to check
|
|
119
|
-
* @returns True if the context is connected and usable
|
|
120
|
-
*/
|
|
121
|
-
private isBrowserContextAlive;
|
|
122
|
-
/**
|
|
123
|
-
* Determines whether to use local or remote browser based on configuration.
|
|
124
|
-
*
|
|
125
|
-
* @returns Connection mode configuration
|
|
126
|
-
*/
|
|
127
|
-
private resolveConnectionMode;
|
|
128
|
-
/**
|
|
129
|
-
* Creates a local browser context using persistent Chromium.
|
|
130
|
-
*
|
|
131
|
-
* @returns Local browser context
|
|
132
|
-
*/
|
|
133
|
-
private createLocalBrowserContext;
|
|
134
|
-
/**
|
|
135
|
-
* Creates a remote browser context by connecting to a Playwright server.
|
|
136
|
-
*
|
|
137
|
-
* @param wsEndpoint - WebSocket endpoint of the remote Playwright server
|
|
138
|
-
* @returns Remote browser context
|
|
139
|
-
*/
|
|
140
|
-
private createRemoteBrowserContext;
|
|
141
|
-
}
|
|
142
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Page } from 'playwright';
|
|
2
|
-
import type { CaptureSnapshotArtifactOptions, RunBrowserArtifact } from './RunBrowserArgs';
|
|
3
|
-
/**
|
|
4
|
-
* Screenshot/artifact and page-cleanup helpers for `run_browser`.
|
|
5
|
-
*
|
|
6
|
-
* @private function of `run_browser`
|
|
7
|
-
*/
|
|
8
|
-
export declare const runBrowserArtifacts: {
|
|
9
|
-
/**
|
|
10
|
-
* Captures a screenshot artifact for the current page and returns relative path.
|
|
11
|
-
*/
|
|
12
|
-
captureSnapshot(page: Page, sessionId: string, fileSuffix?: string): Promise<string | null>;
|
|
13
|
-
/**
|
|
14
|
-
* Safely retrieves page title from current browser page.
|
|
15
|
-
*/
|
|
16
|
-
getPageTitle(page: Page): Promise<string | null>;
|
|
17
|
-
/**
|
|
18
|
-
* Closes browser page and logs non-fatal cleanup errors.
|
|
19
|
-
*/
|
|
20
|
-
cleanupPage(page: Page | null, sessionId: string): Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* Captures one screenshot artifact and enriches it with page metadata.
|
|
23
|
-
*/
|
|
24
|
-
captureSnapshotArtifact(options: CaptureSnapshotArtifactOptions): Promise<RunBrowserArtifact | null>;
|
|
25
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared constants used by the `run_browser` tool.
|
|
3
|
-
*
|
|
4
|
-
* @private internal constants of `run_browser`
|
|
5
|
-
*/
|
|
6
|
-
export declare const runBrowserConstants: {
|
|
7
|
-
readonly sessionPrefix: "agents-server-run-browser";
|
|
8
|
-
readonly snapshotDirectory: ".playwright-cli";
|
|
9
|
-
readonly resultSchema: "promptbook/run-browser@1";
|
|
10
|
-
readonly defaultWaitMs: 1000;
|
|
11
|
-
readonly maxWaitMs: 60000;
|
|
12
|
-
readonly defaultScrollPixels: 800;
|
|
13
|
-
readonly defaultNavigationTimeoutMs: 20000;
|
|
14
|
-
readonly defaultActionTimeoutMs: 15000;
|
|
15
|
-
readonly fallbackDynamicContentWarning: "Remote browser is unavailable. Fallback scraping was used and dynamic content may be missing.";
|
|
16
|
-
readonly validationErrorCode: "RUN_BROWSER_VALIDATION_ERROR";
|
|
17
|
-
readonly navigationFailedErrorCode: "RUN_BROWSER_NAVIGATION_FAILED";
|
|
18
|
-
readonly actionFailedErrorCode: "RUN_BROWSER_ACTION_FAILED";
|
|
19
|
-
readonly cancelledErrorCode: "RUN_BROWSER_CANCELLED";
|
|
20
|
-
readonly unknownErrorCode: "RUN_BROWSER_UNKNOWN_ERROR";
|
|
21
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { RunBrowserExecutionMode, TaggedRunBrowserError } from './RunBrowserArgs';
|
|
2
|
-
import { type RunBrowserToolError } from './runBrowserErrors';
|
|
3
|
-
/**
|
|
4
|
-
* Error classification and cancellation helpers used by `run_browser`.
|
|
5
|
-
*
|
|
6
|
-
* @private function of `run_browser`
|
|
7
|
-
*/
|
|
8
|
-
export declare const runBrowserErrorHandling: {
|
|
9
|
-
/**
|
|
10
|
-
* Creates one tagged ParseError used for deterministic input validation failures.
|
|
11
|
-
*/
|
|
12
|
-
createRunBrowserValidationError(options: {
|
|
13
|
-
readonly message: string;
|
|
14
|
-
readonly debug: Record<string, unknown>;
|
|
15
|
-
}): TaggedRunBrowserError;
|
|
16
|
-
/**
|
|
17
|
-
* Creates one tagged KnowledgeScrapeError used for navigation failures.
|
|
18
|
-
*/
|
|
19
|
-
createRunBrowserNavigationError(options: {
|
|
20
|
-
readonly message: string;
|
|
21
|
-
readonly debug: Record<string, unknown>;
|
|
22
|
-
readonly cause?: unknown;
|
|
23
|
-
}): TaggedRunBrowserError;
|
|
24
|
-
/**
|
|
25
|
-
* Creates one tagged KnowledgeScrapeError used for action failures.
|
|
26
|
-
*/
|
|
27
|
-
createRunBrowserActionError(options: {
|
|
28
|
-
readonly message: string;
|
|
29
|
-
readonly debug: Record<string, unknown>;
|
|
30
|
-
readonly cause?: unknown;
|
|
31
|
-
}): TaggedRunBrowserError;
|
|
32
|
-
/**
|
|
33
|
-
* Creates one tagged KnowledgeScrapeError used for cancellation.
|
|
34
|
-
*/
|
|
35
|
-
createRunBrowserCancelledError(options: {
|
|
36
|
-
readonly message: string;
|
|
37
|
-
readonly debug: Record<string, unknown>;
|
|
38
|
-
readonly cause?: unknown;
|
|
39
|
-
}): TaggedRunBrowserError;
|
|
40
|
-
/**
|
|
41
|
-
* Checks whether an unknown error carries run_browser classification tags.
|
|
42
|
-
*/
|
|
43
|
-
isTaggedRunBrowserError(error: unknown): error is TaggedRunBrowserError;
|
|
44
|
-
/**
|
|
45
|
-
* Converts unknown errors into structured tool error payloads.
|
|
46
|
-
*/
|
|
47
|
-
classifyRunBrowserToolError(options: {
|
|
48
|
-
readonly error: unknown;
|
|
49
|
-
readonly sessionId: string;
|
|
50
|
-
readonly mode: RunBrowserExecutionMode;
|
|
51
|
-
}): RunBrowserToolError;
|
|
52
|
-
/**
|
|
53
|
-
* Asserts that the run was not aborted.
|
|
54
|
-
*/
|
|
55
|
-
assertNotAborted(signal: AbortSignal | undefined, sessionId: string): void;
|
|
56
|
-
/**
|
|
57
|
-
* Returns true when the tool error represents remote browser unavailability.
|
|
58
|
-
*/
|
|
59
|
-
isRemoteBrowserUnavailableCode(code: string): boolean;
|
|
60
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { KnowledgeScrapeError } from '../../../../src/errors/KnowledgeScrapeError';
|
|
2
|
-
/**
|
|
3
|
-
* Structured error payload returned by the `run_browser` tool.
|
|
4
|
-
*/
|
|
5
|
-
export type RunBrowserToolError = {
|
|
6
|
-
readonly code: string;
|
|
7
|
-
readonly message: string;
|
|
8
|
-
readonly isRetryable: boolean;
|
|
9
|
-
readonly suggestedNextSteps: ReadonlyArray<string>;
|
|
10
|
-
readonly debug: Record<string, unknown>;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Metadata describing the sanitized remote browser endpoint used for debugging.
|
|
14
|
-
*/
|
|
15
|
-
export type RemoteBrowserEndpointDebug = {
|
|
16
|
-
readonly protocol: string | null;
|
|
17
|
-
readonly host: string | null;
|
|
18
|
-
readonly port: number | null;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Structured details captured when remote browser infrastructure is unavailable.
|
|
22
|
-
*/
|
|
23
|
-
export type RemoteBrowserUnavailableDebug = {
|
|
24
|
-
readonly endpoint: RemoteBrowserEndpointDebug;
|
|
25
|
-
readonly attempts: number;
|
|
26
|
-
readonly connectTimeoutMs: number;
|
|
27
|
-
readonly durationMs: number;
|
|
28
|
-
readonly networkErrorCode: string | null;
|
|
29
|
-
readonly originalMessage: string;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Error code used for remote-browser infrastructure outages.
|
|
33
|
-
*/
|
|
34
|
-
export declare const REMOTE_BROWSER_UNAVAILABLE_ERROR_CODE = "REMOTE_BROWSER_UNAVAILABLE";
|
|
35
|
-
/**
|
|
36
|
-
* Error thrown when a remote Playwright browser cannot be reached.
|
|
37
|
-
*/
|
|
38
|
-
export declare class RemoteBrowserUnavailableError extends KnowledgeScrapeError {
|
|
39
|
-
readonly code = "REMOTE_BROWSER_UNAVAILABLE";
|
|
40
|
-
readonly isRetryable = true;
|
|
41
|
-
readonly suggestedNextSteps: ReadonlyArray<string>;
|
|
42
|
-
readonly debug: RemoteBrowserUnavailableDebug;
|
|
43
|
-
constructor(options: {
|
|
44
|
-
readonly message: string;
|
|
45
|
-
readonly debug: RemoteBrowserUnavailableDebug;
|
|
46
|
-
readonly suggestedNextSteps?: ReadonlyArray<string>;
|
|
47
|
-
readonly cause?: unknown;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Returns true when an unknown value is one of the remote-browser outage errors.
|
|
52
|
-
*/
|
|
53
|
-
export declare function isRemoteBrowserUnavailableError(error: unknown): error is RemoteBrowserUnavailableError;
|
|
54
|
-
/**
|
|
55
|
-
* Sanitizes a remote websocket endpoint so debug payloads never expose path secrets.
|
|
56
|
-
*/
|
|
57
|
-
export declare function sanitizeRemoteBrowserEndpoint(wsEndpoint: string): RemoteBrowserEndpointDebug;
|
|
58
|
-
/**
|
|
59
|
-
* Extracts network-like error code from unknown error payload.
|
|
60
|
-
*/
|
|
61
|
-
export declare function extractNetworkErrorCode(error: unknown): string | null;
|
|
62
|
-
/**
|
|
63
|
-
* Classifies whether an unknown error most likely represents remote browser infra outage.
|
|
64
|
-
*/
|
|
65
|
-
export declare function isRemoteBrowserInfrastructureError(error: unknown): boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Converts unknown thrown values into safe string messages.
|
|
68
|
-
*/
|
|
69
|
-
export declare function getErrorMessage(error: unknown): string;
|
|
70
|
-
/**
|
|
71
|
-
* Converts unknown errors into stack payloads that are safe to render in debug mode.
|
|
72
|
-
*/
|
|
73
|
-
export declare function getErrorStack(error: unknown): string | null;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { RunBrowserModeUsed } from './RunBrowserArgs';
|
|
2
|
-
/**
|
|
3
|
-
* Observability counters and metric logging for `run_browser`.
|
|
4
|
-
*
|
|
5
|
-
* @private function of `run_browser`
|
|
6
|
-
*/
|
|
7
|
-
export declare const runBrowserObservability: {
|
|
8
|
-
/**
|
|
9
|
-
* Increments total-run counter and returns the updated value.
|
|
10
|
-
*/
|
|
11
|
-
incrementTotalRuns(): number;
|
|
12
|
-
/**
|
|
13
|
-
* Returns current total run count.
|
|
14
|
-
*/
|
|
15
|
-
getTotalRuns(): number;
|
|
16
|
-
/**
|
|
17
|
-
* Increments fallback counter and returns updated metrics.
|
|
18
|
-
*/
|
|
19
|
-
incrementFallbackRunsAndGetMetrics(): {
|
|
20
|
-
readonly fallbackRuns: number;
|
|
21
|
-
readonly fallbackRate: number;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Increments one error-code counter and returns the updated value.
|
|
25
|
-
*/
|
|
26
|
-
incrementRunBrowserErrorCodeCounter(code: string): number;
|
|
27
|
-
/**
|
|
28
|
-
* Writes one structured metric line for browser-tool observability.
|
|
29
|
-
*/
|
|
30
|
-
logRunBrowserMetric(options: {
|
|
31
|
-
readonly event: string;
|
|
32
|
-
readonly sessionId: string;
|
|
33
|
-
readonly mode: RunBrowserModeUsed;
|
|
34
|
-
readonly payload?: Record<string, unknown>;
|
|
35
|
-
}): void;
|
|
36
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { NormalizedRunBrowserAction, RunBrowserArtifact, RunBrowserExecutionMode, RunBrowserModeUsed, RunBrowserResultPayload } from './RunBrowserArgs';
|
|
2
|
-
import type { RunBrowserToolError } from './runBrowserErrors';
|
|
3
|
-
/**
|
|
4
|
-
* Payload and markdown formatters for `run_browser` outcomes.
|
|
5
|
-
*
|
|
6
|
-
* @private function of `run_browser`
|
|
7
|
-
*/
|
|
8
|
-
export declare const runBrowserResultFormatting: {
|
|
9
|
-
/**
|
|
10
|
-
* Produces one structured payload consumed by chat UI browser replay renderers.
|
|
11
|
-
*/
|
|
12
|
-
createResultPayload(options: {
|
|
13
|
-
readonly sessionId: string;
|
|
14
|
-
readonly mode: RunBrowserExecutionMode;
|
|
15
|
-
readonly modeUsed: RunBrowserModeUsed;
|
|
16
|
-
readonly initialUrl: string;
|
|
17
|
-
readonly finalUrl: string | null;
|
|
18
|
-
readonly finalTitle: string | null;
|
|
19
|
-
readonly executedActions: ReadonlyArray<NormalizedRunBrowserAction>;
|
|
20
|
-
readonly artifacts: ReadonlyArray<RunBrowserArtifact>;
|
|
21
|
-
readonly warning: string | null;
|
|
22
|
-
readonly error: RunBrowserToolError | null;
|
|
23
|
-
readonly fallbackContent: string | null;
|
|
24
|
-
readonly timing: RunBrowserResultPayload['timing'];
|
|
25
|
-
}): RunBrowserResultPayload;
|
|
26
|
-
/**
|
|
27
|
-
* Produces a model-friendly markdown summary from browser execution artifacts.
|
|
28
|
-
*/
|
|
29
|
-
formatSuccessResult(options: {
|
|
30
|
-
readonly payload: RunBrowserResultPayload;
|
|
31
|
-
readonly snapshotPath: string | null;
|
|
32
|
-
}): string;
|
|
33
|
-
/**
|
|
34
|
-
* Produces a model-friendly markdown payload when fallback scraping is used.
|
|
35
|
-
*/
|
|
36
|
-
formatFallbackResult(options: {
|
|
37
|
-
readonly payload: RunBrowserResultPayload;
|
|
38
|
-
readonly fallbackContent: string;
|
|
39
|
-
readonly requestedActions: number;
|
|
40
|
-
}): string;
|
|
41
|
-
/**
|
|
42
|
-
* Produces a model-friendly markdown error payload from browser execution failures.
|
|
43
|
-
*/
|
|
44
|
-
formatErrorResult(options: {
|
|
45
|
-
readonly payload: RunBrowserResultPayload;
|
|
46
|
-
}): string;
|
|
47
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { RunBrowserArgs, RunBrowserExecutionMode, RunBrowserTimeoutConfiguration } from './RunBrowserArgs';
|
|
2
|
-
/**
|
|
3
|
-
* Runtime helpers for mode/session/timeout handling in `run_browser`.
|
|
4
|
-
*
|
|
5
|
-
* @private function of `run_browser`
|
|
6
|
-
*/
|
|
7
|
-
export declare const runBrowserRuntime: {
|
|
8
|
-
/**
|
|
9
|
-
* Creates a dedicated session id for one tool invocation.
|
|
10
|
-
*/
|
|
11
|
-
createRunBrowserSessionId(): string;
|
|
12
|
-
/**
|
|
13
|
-
* Determines whether the browser tool is running in local or remote mode.
|
|
14
|
-
*/
|
|
15
|
-
resolveExecutionMode(): RunBrowserExecutionMode;
|
|
16
|
-
/**
|
|
17
|
-
* Converts the execution mode into a human-readable label.
|
|
18
|
-
*/
|
|
19
|
-
formatExecutionMode(mode: RunBrowserExecutionMode): string;
|
|
20
|
-
/**
|
|
21
|
-
* Resolves timeout configuration from env defaults and optional call overrides.
|
|
22
|
-
*/
|
|
23
|
-
resolveTimeoutConfiguration(overrides: RunBrowserArgs['timeouts'] | undefined): RunBrowserTimeoutConfiguration;
|
|
24
|
-
};
|