@promptbook/node 0.112.0-12 → 0.112.0-15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/esm/index.es.js +969 -2797
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/cli/cli-commands/coder/{find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags.d.ts} +1 -1
  4. package/esm/src/cli/cli-commands/coder.d.ts +1 -1
  5. package/esm/src/commitments/USE_BROWSER/resolveRunBrowserToolForNode.d.ts +1 -1
  6. package/esm/src/commitments/USE_TIMEOUT/TimeoutToolNames.d.ts +1 -0
  7. package/esm/src/commitments/USE_TIMEOUT/TimeoutToolRuntimeAdapter.d.ts +51 -2
  8. package/esm/src/commitments/USE_TIMEOUT/USE_TIMEOUT.d.ts +2 -2
  9. package/esm/src/commitments/USE_TIMEOUT/getTimeoutToolRuntimeAdapterOrDisabledResult.d.ts +2 -2
  10. package/esm/src/commitments/USE_TIMEOUT/parseTimeoutToolArgs.d.ts +14 -1
  11. package/esm/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
  12. package/esm/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  13. package/esm/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  14. package/esm/src/llm-providers/google/google-models.d.ts +1 -1
  15. package/esm/src/llm-providers/openai/openai-models.d.ts +1 -1
  16. package/esm/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
  17. package/esm/src/scrapers/document/DocumentScraper.d.ts +1 -2
  18. package/esm/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
  19. package/esm/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
  20. package/esm/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
  21. package/esm/src/version.d.ts +1 -1
  22. package/package.json +2 -3
  23. package/umd/index.umd.js +933 -2758
  24. package/umd/index.umd.js.map +1 -1
  25. package/umd/src/cli/cli-commands/coder/{find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags.d.ts} +1 -1
  26. package/umd/src/cli/cli-commands/coder.d.ts +1 -1
  27. package/umd/src/commitments/USE_BROWSER/resolveRunBrowserToolForNode.d.ts +1 -1
  28. package/umd/src/commitments/USE_TIMEOUT/TimeoutToolNames.d.ts +1 -0
  29. package/umd/src/commitments/USE_TIMEOUT/TimeoutToolRuntimeAdapter.d.ts +51 -2
  30. package/umd/src/commitments/USE_TIMEOUT/USE_TIMEOUT.d.ts +2 -2
  31. package/umd/src/commitments/USE_TIMEOUT/getTimeoutToolRuntimeAdapterOrDisabledResult.d.ts +2 -2
  32. package/umd/src/commitments/USE_TIMEOUT/parseTimeoutToolArgs.d.ts +14 -1
  33. package/umd/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
  34. package/umd/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  35. package/umd/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  36. package/umd/src/llm-providers/google/google-models.d.ts +1 -1
  37. package/umd/src/llm-providers/openai/openai-models.d.ts +1 -1
  38. package/umd/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
  39. package/umd/src/scrapers/document/DocumentScraper.d.ts +1 -2
  40. package/umd/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
  41. package/umd/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
  42. package/umd/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
  43. package/umd/src/version.d.ts +1 -1
  44. package/esm/apps/agents-server/config.d.ts +0 -86
  45. package/esm/apps/agents-server/src/tools/$provideBrowserForServer.d.ts +0 -28
  46. package/esm/apps/agents-server/src/tools/BrowserConnectionProvider.d.ts +0 -142
  47. package/esm/apps/agents-server/src/tools/runBrowserArtifacts.d.ts +0 -25
  48. package/esm/apps/agents-server/src/tools/runBrowserConstants.d.ts +0 -21
  49. package/esm/apps/agents-server/src/tools/runBrowserErrorHandling.d.ts +0 -60
  50. package/esm/apps/agents-server/src/tools/runBrowserErrors.d.ts +0 -73
  51. package/esm/apps/agents-server/src/tools/runBrowserObservability.d.ts +0 -36
  52. package/esm/apps/agents-server/src/tools/runBrowserResultFormatting.d.ts +0 -47
  53. package/esm/apps/agents-server/src/tools/runBrowserRuntime.d.ts +0 -24
  54. package/esm/apps/agents-server/src/tools/runBrowserWorkflow.d.ts +0 -36
  55. package/esm/apps/agents-server/src/tools/run_browser.d.ts +0 -11
  56. package/esm/apps/agents-server/src/utils/retryWithBackoff.d.ts +0 -95
  57. package/esm/apps/agents-server/src/utils/runBrowserArtifactStorage.d.ts +0 -26
  58. package/umd/apps/agents-server/config.d.ts +0 -86
  59. package/umd/apps/agents-server/src/tools/$provideBrowserForServer.d.ts +0 -28
  60. package/umd/apps/agents-server/src/tools/BrowserConnectionProvider.d.ts +0 -142
  61. package/umd/apps/agents-server/src/tools/runBrowserArtifacts.d.ts +0 -25
  62. package/umd/apps/agents-server/src/tools/runBrowserConstants.d.ts +0 -21
  63. package/umd/apps/agents-server/src/tools/runBrowserErrorHandling.d.ts +0 -60
  64. package/umd/apps/agents-server/src/tools/runBrowserErrors.d.ts +0 -73
  65. package/umd/apps/agents-server/src/tools/runBrowserObservability.d.ts +0 -36
  66. package/umd/apps/agents-server/src/tools/runBrowserResultFormatting.d.ts +0 -47
  67. package/umd/apps/agents-server/src/tools/runBrowserRuntime.d.ts +0 -24
  68. package/umd/apps/agents-server/src/tools/runBrowserWorkflow.d.ts +0 -36
  69. package/umd/apps/agents-server/src/tools/run_browser.d.ts +0 -11
  70. package/umd/apps/agents-server/src/utils/retryWithBackoff.d.ts +0 -95
  71. package/umd/apps/agents-server/src/utils/runBrowserArtifactStorage.d.ts +0 -26
@@ -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
- };
@@ -1,36 +0,0 @@
1
- import type { Page } from 'playwright';
2
- import type { NormalizedRunBrowserAction, OpenPageWithUrlResult, RunBrowserAction, RunBrowserTimeoutConfiguration } from './RunBrowserArgs';
3
- /**
4
- * Page open, action normalization and action execution helpers for `run_browser`.
5
- *
6
- * @private function of `run_browser`
7
- */
8
- export declare const runBrowserWorkflow: {
9
- /**
10
- * Opens a new browser page and navigates to the requested URL.
11
- */
12
- openPageWithUrl(options: {
13
- readonly url: string;
14
- readonly sessionId: string;
15
- readonly timeouts: RunBrowserTimeoutConfiguration;
16
- readonly signal?: AbortSignal;
17
- }): Promise<OpenPageWithUrlResult>;
18
- /**
19
- * Validates and normalizes browser actions received from the model.
20
- */
21
- normalizeActions(actions: ReadonlyArray<RunBrowserAction> | undefined): Array<NormalizedRunBrowserAction>;
22
- /**
23
- * Validates and normalizes a single action.
24
- */
25
- normalizeAction(action: RunBrowserAction, index: number): NormalizedRunBrowserAction;
26
- /**
27
- * Executes one normalized browser action on a Playwright page.
28
- */
29
- executeAction(options: {
30
- readonly page: Page;
31
- readonly action: NormalizedRunBrowserAction;
32
- readonly actionIndex: number;
33
- readonly timeouts: RunBrowserTimeoutConfiguration;
34
- readonly signal?: AbortSignal;
35
- }): Promise<void>;
36
- };
@@ -1,11 +0,0 @@
1
- import type { RunBrowserInternalOptions } from './RunBrowserArgs';
2
- export type { RunBrowserActionType, RunBrowserAction, RunBrowserArgs } from './RunBrowserArgs';
3
- import type { RunBrowserArgs } from './RunBrowserArgs';
4
- /**
5
- * Runs interactive browser automation through Playwright.
6
- *
7
- * @param args Tool arguments provided by the model.
8
- * @param internalOptions Optional runtime options for cancellation.
9
- * @returns Markdown summary with structured playback payload.
10
- */
11
- export declare function run_browser(args: RunBrowserArgs, internalOptions?: RunBrowserInternalOptions): Promise<string>;
@@ -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;