@bastani/atomic 0.8.30 → 0.8.31-alpha.2
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/CHANGELOG.md +29 -0
- package/README.md +12 -10
- package/dist/builtin/cursor/CHANGELOG.md +4 -0
- package/dist/builtin/cursor/package.json +2 -2
- package/dist/builtin/intercom/CHANGELOG.md +4 -0
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/mcp/CHANGELOG.md +4 -0
- package/dist/builtin/mcp/package.json +3 -3
- package/dist/builtin/subagents/CHANGELOG.md +13 -0
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +8 -8
- package/dist/builtin/subagents/agents/debugger.md +6 -6
- package/dist/builtin/subagents/package.json +4 -4
- package/dist/builtin/subagents/skills/effective-liteparse/SKILL.md +118 -0
- package/dist/builtin/subagents/skills/effective-liteparse/scripts/search.py +128 -0
- package/dist/builtin/subagents/skills/playwright-cli/SKILL.md +404 -0
- package/dist/builtin/subagents/skills/playwright-cli/references/element-attributes.md +23 -0
- package/dist/builtin/subagents/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/dist/builtin/subagents/skills/playwright-cli/references/request-mocking.md +87 -0
- package/dist/builtin/subagents/skills/playwright-cli/references/running-code.md +241 -0
- package/dist/builtin/subagents/skills/playwright-cli/references/session-management.md +225 -0
- package/dist/builtin/subagents/skills/playwright-cli/references/spec-driven-testing.md +305 -0
- package/dist/builtin/subagents/skills/playwright-cli/references/storage-state.md +275 -0
- package/dist/builtin/subagents/skills/playwright-cli/references/test-generation.md +134 -0
- package/dist/builtin/subagents/skills/playwright-cli/references/tracing.md +139 -0
- package/dist/builtin/subagents/skills/playwright-cli/references/video-recording.md +143 -0
- package/dist/builtin/web-access/CHANGELOG.md +4 -0
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +16 -0
- package/dist/builtin/workflows/README.md +4 -4
- package/dist/builtin/workflows/builtin/deep-research-codebase.ts +1 -1
- package/dist/builtin/workflows/builtin/goal.ts +2 -2
- package/dist/builtin/workflows/builtin/open-claude-design.ts +60 -57
- package/dist/builtin/workflows/builtin/ralph.ts +117 -14
- package/dist/builtin/workflows/builtin/shared-prompts.ts +1 -1
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/skills/research-codebase/SKILL.md +1 -1
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +3 -1
- package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +5 -0
- package/dist/builtin/workflows/src/runs/shared/model-fallback.ts +95 -8
- package/dist/builtin/workflows/src/shared/authoring-contract.d.ts +11 -0
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +21 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +2 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +2 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +2 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +18 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +182 -19
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +20 -5
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/context-compaction.d.ts.map +1 -1
- package/dist/core/compaction/context-compaction.js +14 -3
- package/dist/core/compaction/context-compaction.js.map +1 -1
- package/dist/core/context-window.d.ts +39 -0
- package/dist/core/context-window.d.ts.map +1 -0
- package/dist/core/context-window.js +99 -0
- package/dist/core/context-window.js.map +1 -0
- package/dist/core/copilot-errors.d.ts +9 -0
- package/dist/core/copilot-errors.d.ts.map +1 -0
- package/dist/core/copilot-errors.js +32 -0
- package/dist/core/copilot-errors.js.map +1 -0
- package/dist/core/copilot-model-catalog.d.ts +135 -0
- package/dist/core/copilot-model-catalog.d.ts.map +1 -0
- package/dist/core/copilot-model-catalog.js +257 -0
- package/dist/core/copilot-model-catalog.js.map +1 -0
- package/dist/core/export-html/template.js +10 -1
- package/dist/core/extensions/types.d.ts +3 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-registry.d.ts +10 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +107 -4
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +4 -0
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/project-trust.d.ts.map +1 -1
- package/dist/core/project-trust.js +2 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/provider-attribution.d.ts.map +1 -1
- package/dist/core/provider-attribution.js +17 -7
- package/dist/core/provider-attribution.js.map +1 -1
- package/dist/core/sdk.d.ts +8 -0
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +58 -0
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +8 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +19 -3
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +15 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +124 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +1 -0
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +1 -2
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +1 -2
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +24 -1
- package/dist/main.js.map +1 -1
- package/dist/modes/index.d.ts +1 -1
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +5 -7
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/context-window-selector.d.ts +53 -0
- package/dist/modes/interactive/components/context-window-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/context-window-selector.js +136 -0
- package/dist/modes/interactive/components/context-window-selector.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +2 -1
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +4 -1
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +165 -15
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +51 -4
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +6 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +115 -55
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/model-search.d.ts +7 -0
- package/dist/modes/interactive/model-search.d.ts.map +1 -0
- package/dist/modes/interactive/model-search.js +6 -0
- package/dist/modes/interactive/model-search.js.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +30 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.js +108 -0
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.json +2 -1
- package/dist/modes/interactive/theme/theme.d.ts +5 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +70 -29
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +14 -2
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +23 -3
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +31 -2
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +23 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +39 -9
- package/dist/package-manager-cli.js.map +1 -1
- package/docs/custom-provider.md +4 -1
- package/docs/extensions.md +21 -0
- package/docs/json.md +3 -1
- package/docs/models.md +78 -2
- package/docs/packages.md +13 -9
- package/docs/providers.md +3 -0
- package/docs/quickstart.md +14 -0
- package/docs/rpc.md +80 -1
- package/docs/sdk.md +35 -11
- package/docs/session-format.md +15 -1
- package/docs/sessions.md +1 -1
- package/docs/settings.md +12 -2
- package/docs/themes.md +3 -1
- package/docs/tui.md +1 -1
- package/docs/usage.md +12 -9
- package/docs/workflows.md +34 -10
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/preset.ts +10 -4
- package/examples/extensions/provider-payload.ts +5 -5
- package/examples/extensions/sandbox/index.ts +2 -2
- package/examples/extensions/sandbox/package-lock.json +3 -3
- package/examples/extensions/sandbox/package.json +2 -2
- package/examples/extensions/subagent/agents.ts +2 -2
- package/examples/extensions/subagent/index.ts +4 -2
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +5 -5
- package/dist/builtin/subagents/skills/browser/EXAMPLES.md +0 -151
- package/dist/builtin/subagents/skills/browser/LICENSE.txt +0 -21
- package/dist/builtin/subagents/skills/browser/REFERENCE.md +0 -451
- package/dist/builtin/subagents/skills/browser/SKILL.md +0 -170
|
@@ -42,7 +42,7 @@ import { existsSync, readFileSync } from "node:fs";
|
|
|
42
42
|
import { join } from "node:path";
|
|
43
43
|
import type { Api, Model } from "@earendil-works/pi-ai";
|
|
44
44
|
import type { ExtensionAPI, ExtensionContext } from "@bastani/atomic";
|
|
45
|
-
import { DynamicBorder, getAgentDir } from "@bastani/atomic";
|
|
45
|
+
import { CONFIG_DIR_NAME, DynamicBorder, getAgentDir } from "@bastani/atomic";
|
|
46
46
|
import { Container, Key, type SelectItem, SelectList, Text } from "@earendil-works/pi-tui";
|
|
47
47
|
|
|
48
48
|
// Preset configuration
|
|
@@ -69,7 +69,7 @@ interface PresetsConfig {
|
|
|
69
69
|
*/
|
|
70
70
|
function loadPresets(cwd: string, includeProjectPresets: boolean): PresetsConfig {
|
|
71
71
|
const globalPath = join(getAgentDir(), "presets.json");
|
|
72
|
-
const projectPath = join(cwd,
|
|
72
|
+
const projectPath = join(cwd, CONFIG_DIR_NAME, "presets.json");
|
|
73
73
|
const legacyProjectPath = join(cwd, ".pi", "presets.json");
|
|
74
74
|
|
|
75
75
|
let globalPresets: PresetsConfig = {};
|
|
@@ -202,7 +202,10 @@ export default function presetExtension(pi: ExtensionAPI) {
|
|
|
202
202
|
const presetNames = Object.keys(presets);
|
|
203
203
|
|
|
204
204
|
if (presetNames.length === 0) {
|
|
205
|
-
ctx.ui.notify(
|
|
205
|
+
ctx.ui.notify(
|
|
206
|
+
`No presets defined. Add presets to ${join(getAgentDir(), "presets.json")} or ${join(ctx.cwd, CONFIG_DIR_NAME, "presets.json")} (legacy ${join(ctx.cwd, ".pi", "presets.json")} also works)`,
|
|
207
|
+
"warning",
|
|
208
|
+
);
|
|
206
209
|
return;
|
|
207
210
|
}
|
|
208
211
|
|
|
@@ -310,7 +313,10 @@ export default function presetExtension(pi: ExtensionAPI) {
|
|
|
310
313
|
async function cyclePreset(ctx: ExtensionContext): Promise<void> {
|
|
311
314
|
const presetNames = getPresetOrder();
|
|
312
315
|
if (presetNames.length === 0) {
|
|
313
|
-
ctx.ui.notify(
|
|
316
|
+
ctx.ui.notify(
|
|
317
|
+
`No presets defined. Add presets to ${join(getAgentDir(), "presets.json")} or ${join(ctx.cwd, CONFIG_DIR_NAME, "presets.json")} (legacy ${join(ctx.cwd, ".pi", "presets.json")} also works)`,
|
|
318
|
+
"warning",
|
|
319
|
+
);
|
|
314
320
|
return;
|
|
315
321
|
}
|
|
316
322
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { appendFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import type
|
|
3
|
+
import { CONFIG_DIR_NAME, type ExtensionAPI } from "@bastani/atomic";
|
|
4
4
|
|
|
5
5
|
export default function (pi: ExtensionAPI) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
pi.on("before_provider_request", (event) => {
|
|
6
|
+
pi.on("before_provider_request", (event, ctx) => {
|
|
7
|
+
const logFile = join(ctx.cwd, CONFIG_DIR_NAME, "provider-payload.log");
|
|
9
8
|
appendFileSync(logFile, `${JSON.stringify(event.payload, null, 2)}\n\n`, "utf8");
|
|
10
9
|
|
|
11
10
|
// Optional: replace the payload instead of only logging it.
|
|
12
11
|
// return { ...event.payload, temperature: 0 };
|
|
13
12
|
});
|
|
14
13
|
|
|
15
|
-
pi.on("after_provider_response", (event) => {
|
|
14
|
+
pi.on("after_provider_response", (event, ctx) => {
|
|
15
|
+
const logFile = join(ctx.cwd, CONFIG_DIR_NAME, "provider-payload.log");
|
|
16
16
|
appendFileSync(logFile, `[${event.status}] ${JSON.stringify(event.headers)}\n\n`, "utf8");
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -46,7 +46,7 @@ import { existsSync, readFileSync } from "node:fs";
|
|
|
46
46
|
import { join } from "node:path";
|
|
47
47
|
import { SandboxManager, type SandboxRuntimeConfig } from "@anthropic-ai/sandbox-runtime";
|
|
48
48
|
import type { ExtensionAPI } from "@bastani/atomic";
|
|
49
|
-
import { type BashOperations, createBashTool, getAgentDir } from "@bastani/atomic";
|
|
49
|
+
import { type BashOperations, CONFIG_DIR_NAME, createBashTool, getAgentDir } from "@bastani/atomic";
|
|
50
50
|
|
|
51
51
|
interface SandboxConfig extends SandboxRuntimeConfig {
|
|
52
52
|
enabled?: boolean;
|
|
@@ -77,7 +77,7 @@ const DEFAULT_CONFIG: SandboxConfig = {
|
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
function loadConfig(cwd: string, includeProjectConfig: boolean): SandboxConfig {
|
|
80
|
-
const projectConfigPath = join(cwd,
|
|
80
|
+
const projectConfigPath = join(cwd, CONFIG_DIR_NAME, "sandbox.json");
|
|
81
81
|
const legacyProjectConfigPath = join(cwd, ".pi", "sandbox.json");
|
|
82
82
|
const globalConfigPath = join(getAgentDir(), "extensions", "sandbox.json");
|
|
83
83
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atomic-extension-sandbox",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.7",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "atomic-extension-sandbox",
|
|
9
|
-
"version": "1.9.
|
|
9
|
+
"version": "1.9.7",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@anthropic-ai/sandbox-runtime": "
|
|
11
|
+
"@anthropic-ai/sandbox-runtime": "0.0.26"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"node_modules/@anthropic-ai/sandbox-runtime": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atomic-extension-sandbox",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"clean": "echo 'nothing to clean'",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"check": "echo 'nothing to check'"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@anthropic-ai/sandbox-runtime": "
|
|
12
|
+
"@anthropic-ai/sandbox-runtime": "0.0.26"
|
|
13
13
|
},
|
|
14
14
|
"atomic": {
|
|
15
15
|
"extensions": [
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as path from "node:path";
|
|
7
|
-
import { getAgentDir, parseFrontmatter } from "@bastani/atomic";
|
|
7
|
+
import { CONFIG_DIR_NAME, getAgentDir, parseFrontmatter } from "@bastani/atomic";
|
|
8
8
|
|
|
9
9
|
export type AgentScope = "user" | "project" | "both";
|
|
10
10
|
|
|
@@ -85,7 +85,7 @@ function isDirectory(p: string): boolean {
|
|
|
85
85
|
function findNearestProjectAgentsDir(cwd: string): string | null {
|
|
86
86
|
let currentDir = cwd;
|
|
87
87
|
while (true) {
|
|
88
|
-
const atomicCandidate = path.join(currentDir,
|
|
88
|
+
const atomicCandidate = path.join(currentDir, CONFIG_DIR_NAME, "agents");
|
|
89
89
|
if (isDirectory(atomicCandidate)) return atomicCandidate;
|
|
90
90
|
const legacyCandidate = path.join(currentDir, ".pi", "agents");
|
|
91
91
|
if (isDirectory(legacyCandidate)) return legacyCandidate;
|
|
@@ -21,7 +21,9 @@ import type { Message } from "@earendil-works/pi-ai";
|
|
|
21
21
|
import { StringEnum } from "@earendil-works/pi-ai";
|
|
22
22
|
import {
|
|
23
23
|
APP_NAME,
|
|
24
|
+
CONFIG_DIR_NAME,
|
|
24
25
|
type ExtensionAPI,
|
|
26
|
+
getAgentDir,
|
|
25
27
|
getMarkdownTheme,
|
|
26
28
|
withFileMutationQueue,
|
|
27
29
|
} from "@bastani/atomic";
|
|
@@ -518,8 +520,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
518
520
|
description: [
|
|
519
521
|
"Delegate tasks to specialized subagents with isolated context.",
|
|
520
522
|
"Modes: single (agent + task), parallel (tasks array), chain (sequential with {previous} placeholder).",
|
|
521
|
-
|
|
522
|
-
|
|
523
|
+
`Default agent scope is "user" (from ${path.join(getAgentDir(), "agents")}).`,
|
|
524
|
+
`To enable project-local agents in ${CONFIG_DIR_NAME}/agents (legacy .pi/agents also works), set agentScope: "both" (or "project").`,
|
|
523
525
|
].join(" "),
|
|
524
526
|
parameters: SubagentParams,
|
|
525
527
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atomic-extension-with-deps",
|
|
3
|
-
"version": "0.79.
|
|
3
|
+
"version": "0.79.7",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "atomic-extension-with-deps",
|
|
9
|
-
"version": "0.79.
|
|
9
|
+
"version": "0.79.7",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"ms": "^2.1.3"
|
|
12
12
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/atomic",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.31-alpha.2",
|
|
4
4
|
"description": "Atomic coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"atomicConfig": {
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
"prepublishOnly": "bun run clean && bun run build"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@bastani/atomic-natives": "0.8.
|
|
71
|
+
"@bastani/atomic-natives": "0.8.31-alpha.2",
|
|
72
72
|
"@bufbuild/protobuf": "^2.0.0",
|
|
73
|
-
"@earendil-works/pi-agent-core": "^0.79.
|
|
74
|
-
"@earendil-works/pi-ai": "^0.79.
|
|
75
|
-
"@earendil-works/pi-tui": "^0.79.
|
|
73
|
+
"@earendil-works/pi-agent-core": "^0.79.7",
|
|
74
|
+
"@earendil-works/pi-ai": "^0.79.7",
|
|
75
|
+
"@earendil-works/pi-tui": "^0.79.7",
|
|
76
76
|
"@modelcontextprotocol/ext-apps": "^1.7.2",
|
|
77
77
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
78
78
|
"@mozilla/readability": "^0.6.0",
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
# Browser Automation Examples
|
|
2
|
-
|
|
3
|
-
Common browser automation workflows using the `browse` CLI. Each example demonstrates a distinct pattern using real commands.
|
|
4
|
-
|
|
5
|
-
For localhost and other local dev flows, start with `browse open <url> --local` for a clean isolated browser. Use `browse open <url> --auto-connect` only when the agent should attach to an existing debuggable Chrome session for cookies or login state.
|
|
6
|
-
|
|
7
|
-
## Example 1: Extract Data from a Page
|
|
8
|
-
|
|
9
|
-
**User request**: "Get the product details from example.com/product/123"
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
browse open https://example.com/product/123
|
|
13
|
-
browse snapshot # read page structure + element refs
|
|
14
|
-
browse get text "body" # extract all visible text content
|
|
15
|
-
browse stop
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Parse the text output to extract structured data (name, price, description, etc.).
|
|
19
|
-
|
|
20
|
-
For a specific section, use a CSS selector:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
browse get text ".product-details" # text from a specific container
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
**Note**: `browse get text` requires a CSS selector — use `"body"` for all page text.
|
|
27
|
-
|
|
28
|
-
## Example 2: Fill and Submit a Form
|
|
29
|
-
|
|
30
|
-
**User request**: "Fill out the contact form on example.com with my information"
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
browse open https://example.com/contact
|
|
34
|
-
browse snapshot # find form fields and their refs
|
|
35
|
-
browse click @0-3 # click the Name input (ref from snapshot)
|
|
36
|
-
browse type "John Doe"
|
|
37
|
-
browse press Tab # move to next field
|
|
38
|
-
browse type "john@example.com"
|
|
39
|
-
browse fill "#message" "I would like to inquire about your services"
|
|
40
|
-
browse snapshot # verify fields are filled
|
|
41
|
-
browse click @0-8 # click Submit button (ref from snapshot)
|
|
42
|
-
browse snapshot # confirm submission result
|
|
43
|
-
browse stop
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
**Key pattern**: Use `browse snapshot` before interacting to discover element refs, then `browse click <ref>` and `browse type` to interact.
|
|
47
|
-
|
|
48
|
-
## Example 3: Multi-Step Navigation
|
|
49
|
-
|
|
50
|
-
**User request**: "Get headlines from the first 3 pages of results on example.com/news"
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
browse open https://example.com/news
|
|
54
|
-
browse snapshot # read page 1 content
|
|
55
|
-
browse get text ".headline" # extract headlines
|
|
56
|
-
|
|
57
|
-
browse snapshot # find "Next" button ref
|
|
58
|
-
browse click @0-12 # click Next (ref from snapshot)
|
|
59
|
-
browse wait load # wait for page 2 to load
|
|
60
|
-
browse get text ".headline" # extract page 2 headlines
|
|
61
|
-
|
|
62
|
-
browse snapshot # find Next again (ref may change)
|
|
63
|
-
browse click @0-15 # click Next
|
|
64
|
-
browse wait load
|
|
65
|
-
browse get text ".headline" # extract page 3 headlines
|
|
66
|
-
|
|
67
|
-
browse stop
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
**Key pattern**: Re-run `browse snapshot` after each navigation because element refs change when the page updates.
|
|
71
|
-
|
|
72
|
-
## Example 4: Escalate to Remote Mode
|
|
73
|
-
|
|
74
|
-
**User request**: "Scrape pricing from competitor.com" (a site with Cloudflare protection)
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
# Attempt 1: local mode
|
|
78
|
-
browse open https://competitor.com/pricing --local
|
|
79
|
-
browse snapshot
|
|
80
|
-
# Output shows: "Checking your browser..." (Cloudflare interstitial)
|
|
81
|
-
# or: page content is empty / access denied
|
|
82
|
-
browse stop
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
The agent detects bot protection and tells the user:
|
|
86
|
-
|
|
87
|
-
> This site has Cloudflare bot detection. Browserbase remote mode can use Browserbase Identity with a Verified browser and residential proxies. Want me to set it up?
|
|
88
|
-
|
|
89
|
-
If the user agrees:
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
# Set Browserbase credentials
|
|
93
|
-
export BROWSERBASE_API_KEY="bb_live_..."
|
|
94
|
-
|
|
95
|
-
# Retry in remote mode
|
|
96
|
-
browse open https://competitor.com/pricing --remote
|
|
97
|
-
browse snapshot # full page content now accessible
|
|
98
|
-
browse get text ".pricing-table"
|
|
99
|
-
browse stop
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## Example 5: Persist Login with Context ID
|
|
103
|
-
|
|
104
|
-
**User request**: "Log into my dashboard and save the session so I don't have to log in again next time"
|
|
105
|
-
|
|
106
|
-
This uses Browserbase contexts to persist cookies and storage across sessions. Requires remote mode.
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
# Session 1: Log in and persist state
|
|
110
|
-
SESSION_JSON="$(browse cloud sessions create --context-id ctx_abc123 --persist --keep-alive)"
|
|
111
|
-
SESSION_ID="$(echo "$SESSION_JSON" | jq -r .id)"
|
|
112
|
-
CONNECT_URL="$(echo "$SESSION_JSON" | jq -r .connectUrl)"
|
|
113
|
-
|
|
114
|
-
browse open https://app.example.com/login --cdp "$CONNECT_URL"
|
|
115
|
-
browse snapshot # find login form fields
|
|
116
|
-
browse click @0-3 # click email input
|
|
117
|
-
browse type "user@example.com"
|
|
118
|
-
browse press Tab
|
|
119
|
-
browse type "my-password"
|
|
120
|
-
browse click @0-7 # click Sign In button
|
|
121
|
-
browse wait load
|
|
122
|
-
browse snapshot # confirm logged-in dashboard
|
|
123
|
-
browse stop
|
|
124
|
-
browse cloud sessions update "$SESSION_ID" --status REQUEST_RELEASE # state is saved back to ctx_abc123
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
In a later session, reuse the same context — already authenticated:
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
# Session 2: Resume with saved state (already logged in)
|
|
131
|
-
SESSION_JSON="$(browse cloud sessions create --context-id ctx_abc123 --keep-alive)"
|
|
132
|
-
SESSION_ID="$(echo "$SESSION_JSON" | jq -r .id)"
|
|
133
|
-
CONNECT_URL="$(echo "$SESSION_JSON" | jq -r .connectUrl)"
|
|
134
|
-
|
|
135
|
-
browse open https://app.example.com/dashboard --cdp "$CONNECT_URL"
|
|
136
|
-
browse snapshot # dashboard loads — no login needed
|
|
137
|
-
browse get text ".welcome-message"
|
|
138
|
-
browse stop
|
|
139
|
-
browse cloud sessions update "$SESSION_ID" --status REQUEST_RELEASE
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
**Key pattern**: Use `browse cloud sessions create --context-id <id> --persist` for the first Browserbase session to save auth state, then attach with `browse open ... --cdp "$CONNECT_URL"`. On subsequent sessions, create with the same `--context-id` and omit `--persist` if you don't want changes saved back.
|
|
143
|
-
|
|
144
|
-
## Tips
|
|
145
|
-
|
|
146
|
-
- **Snapshot first**: Always run `browse snapshot` before interacting — it gives you the accessibility tree with element refs
|
|
147
|
-
- **Use refs to click**: `browse click @0-5` is more reliable than trying to describe elements
|
|
148
|
-
- **Re-snapshot after actions**: Element refs change when the page updates
|
|
149
|
-
- **`get text` for data extraction**: Use `browse get text [selector]` to pull text content from specific elements
|
|
150
|
-
- **`stop` when done**: Always `browse stop` to clean up the browser session
|
|
151
|
-
- **Prefer snapshot over screenshot**: Snapshot is fast and structured; screenshot is slow and uses vision tokens. Only screenshot when you need visual context (layout, images, debugging)
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Browserbase, Inc.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|