@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.
Files changed (205) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +12 -10
  3. package/dist/builtin/cursor/CHANGELOG.md +4 -0
  4. package/dist/builtin/cursor/package.json +2 -2
  5. package/dist/builtin/intercom/CHANGELOG.md +4 -0
  6. package/dist/builtin/intercom/package.json +2 -2
  7. package/dist/builtin/mcp/CHANGELOG.md +4 -0
  8. package/dist/builtin/mcp/package.json +3 -3
  9. package/dist/builtin/subagents/CHANGELOG.md +13 -0
  10. package/dist/builtin/subagents/agents/codebase-online-researcher.md +8 -8
  11. package/dist/builtin/subagents/agents/debugger.md +6 -6
  12. package/dist/builtin/subagents/package.json +4 -4
  13. package/dist/builtin/subagents/skills/effective-liteparse/SKILL.md +118 -0
  14. package/dist/builtin/subagents/skills/effective-liteparse/scripts/search.py +128 -0
  15. package/dist/builtin/subagents/skills/playwright-cli/SKILL.md +404 -0
  16. package/dist/builtin/subagents/skills/playwright-cli/references/element-attributes.md +23 -0
  17. package/dist/builtin/subagents/skills/playwright-cli/references/playwright-tests.md +39 -0
  18. package/dist/builtin/subagents/skills/playwright-cli/references/request-mocking.md +87 -0
  19. package/dist/builtin/subagents/skills/playwright-cli/references/running-code.md +241 -0
  20. package/dist/builtin/subagents/skills/playwright-cli/references/session-management.md +225 -0
  21. package/dist/builtin/subagents/skills/playwright-cli/references/spec-driven-testing.md +305 -0
  22. package/dist/builtin/subagents/skills/playwright-cli/references/storage-state.md +275 -0
  23. package/dist/builtin/subagents/skills/playwright-cli/references/test-generation.md +134 -0
  24. package/dist/builtin/subagents/skills/playwright-cli/references/tracing.md +139 -0
  25. package/dist/builtin/subagents/skills/playwright-cli/references/video-recording.md +143 -0
  26. package/dist/builtin/web-access/CHANGELOG.md +4 -0
  27. package/dist/builtin/web-access/package.json +2 -2
  28. package/dist/builtin/workflows/CHANGELOG.md +16 -0
  29. package/dist/builtin/workflows/README.md +4 -4
  30. package/dist/builtin/workflows/builtin/deep-research-codebase.ts +1 -1
  31. package/dist/builtin/workflows/builtin/goal.ts +2 -2
  32. package/dist/builtin/workflows/builtin/open-claude-design.ts +60 -57
  33. package/dist/builtin/workflows/builtin/ralph.ts +117 -14
  34. package/dist/builtin/workflows/builtin/shared-prompts.ts +1 -1
  35. package/dist/builtin/workflows/package.json +2 -2
  36. package/dist/builtin/workflows/skills/research-codebase/SKILL.md +1 -1
  37. package/dist/builtin/workflows/src/extension/workflow-schema.ts +3 -1
  38. package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +5 -0
  39. package/dist/builtin/workflows/src/runs/shared/model-fallback.ts +95 -8
  40. package/dist/builtin/workflows/src/shared/authoring-contract.d.ts +11 -0
  41. package/dist/cli/args.d.ts +1 -0
  42. package/dist/cli/args.d.ts.map +1 -1
  43. package/dist/cli/args.js +21 -1
  44. package/dist/cli/args.js.map +1 -1
  45. package/dist/cli/list-models.d.ts.map +1 -1
  46. package/dist/cli/list-models.js +2 -1
  47. package/dist/cli/list-models.js.map +1 -1
  48. package/dist/core/agent-session-services.d.ts +2 -0
  49. package/dist/core/agent-session-services.d.ts.map +1 -1
  50. package/dist/core/agent-session-services.js +2 -0
  51. package/dist/core/agent-session-services.js.map +1 -1
  52. package/dist/core/agent-session.d.ts +18 -0
  53. package/dist/core/agent-session.d.ts.map +1 -1
  54. package/dist/core/agent-session.js +182 -19
  55. package/dist/core/agent-session.js.map +1 -1
  56. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  57. package/dist/core/compaction/branch-summarization.js +20 -5
  58. package/dist/core/compaction/branch-summarization.js.map +1 -1
  59. package/dist/core/compaction/context-compaction.d.ts.map +1 -1
  60. package/dist/core/compaction/context-compaction.js +14 -3
  61. package/dist/core/compaction/context-compaction.js.map +1 -1
  62. package/dist/core/context-window.d.ts +39 -0
  63. package/dist/core/context-window.d.ts.map +1 -0
  64. package/dist/core/context-window.js +99 -0
  65. package/dist/core/context-window.js.map +1 -0
  66. package/dist/core/copilot-errors.d.ts +9 -0
  67. package/dist/core/copilot-errors.d.ts.map +1 -0
  68. package/dist/core/copilot-errors.js +32 -0
  69. package/dist/core/copilot-errors.js.map +1 -0
  70. package/dist/core/copilot-model-catalog.d.ts +135 -0
  71. package/dist/core/copilot-model-catalog.d.ts.map +1 -0
  72. package/dist/core/copilot-model-catalog.js +257 -0
  73. package/dist/core/copilot-model-catalog.js.map +1 -0
  74. package/dist/core/export-html/template.js +10 -1
  75. package/dist/core/extensions/types.d.ts +3 -1
  76. package/dist/core/extensions/types.d.ts.map +1 -1
  77. package/dist/core/extensions/types.js.map +1 -1
  78. package/dist/core/model-registry.d.ts +10 -0
  79. package/dist/core/model-registry.d.ts.map +1 -1
  80. package/dist/core/model-registry.js +107 -4
  81. package/dist/core/model-registry.js.map +1 -1
  82. package/dist/core/model-resolver.d.ts.map +1 -1
  83. package/dist/core/model-resolver.js +4 -0
  84. package/dist/core/model-resolver.js.map +1 -1
  85. package/dist/core/project-trust.d.ts.map +1 -1
  86. package/dist/core/project-trust.js +2 -1
  87. package/dist/core/project-trust.js.map +1 -1
  88. package/dist/core/provider-attribution.d.ts.map +1 -1
  89. package/dist/core/provider-attribution.js +17 -7
  90. package/dist/core/provider-attribution.js.map +1 -1
  91. package/dist/core/sdk.d.ts +8 -0
  92. package/dist/core/sdk.d.ts.map +1 -1
  93. package/dist/core/sdk.js +58 -0
  94. package/dist/core/sdk.js.map +1 -1
  95. package/dist/core/session-manager.d.ts +8 -1
  96. package/dist/core/session-manager.d.ts.map +1 -1
  97. package/dist/core/session-manager.js +19 -3
  98. package/dist/core/session-manager.js.map +1 -1
  99. package/dist/core/settings-manager.d.ts +15 -0
  100. package/dist/core/settings-manager.d.ts.map +1 -1
  101. package/dist/core/settings-manager.js +124 -1
  102. package/dist/core/settings-manager.js.map +1 -1
  103. package/dist/core/system-prompt.d.ts.map +1 -1
  104. package/dist/core/system-prompt.js +1 -0
  105. package/dist/core/system-prompt.js.map +1 -1
  106. package/dist/core/tools/edit-diff.d.ts +1 -2
  107. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  108. package/dist/core/tools/edit-diff.js +1 -2
  109. package/dist/core/tools/edit-diff.js.map +1 -1
  110. package/dist/index.d.ts +3 -1
  111. package/dist/index.d.ts.map +1 -1
  112. package/dist/index.js +2 -0
  113. package/dist/index.js.map +1 -1
  114. package/dist/main.d.ts.map +1 -1
  115. package/dist/main.js +24 -1
  116. package/dist/main.js.map +1 -1
  117. package/dist/modes/index.d.ts +1 -1
  118. package/dist/modes/index.d.ts.map +1 -1
  119. package/dist/modes/index.js.map +1 -1
  120. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  121. package/dist/modes/interactive/components/config-selector.js +5 -7
  122. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  123. package/dist/modes/interactive/components/context-window-selector.d.ts +53 -0
  124. package/dist/modes/interactive/components/context-window-selector.d.ts.map +1 -0
  125. package/dist/modes/interactive/components/context-window-selector.js +136 -0
  126. package/dist/modes/interactive/components/context-window-selector.js.map +1 -0
  127. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  128. package/dist/modes/interactive/components/model-selector.js +2 -1
  129. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  130. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  131. package/dist/modes/interactive/components/scoped-models-selector.js +4 -1
  132. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  133. package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
  134. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  135. package/dist/modes/interactive/components/settings-selector.js +165 -15
  136. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  137. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  138. package/dist/modes/interactive/components/tree-selector.js +51 -4
  139. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  140. package/dist/modes/interactive/interactive-mode.d.ts +6 -1
  141. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  142. package/dist/modes/interactive/interactive-mode.js +115 -55
  143. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  144. package/dist/modes/interactive/model-search.d.ts +7 -0
  145. package/dist/modes/interactive/model-search.d.ts.map +1 -0
  146. package/dist/modes/interactive/model-search.js +6 -0
  147. package/dist/modes/interactive/model-search.js.map +1 -0
  148. package/dist/modes/interactive/theme/theme-controller.d.ts +30 -0
  149. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
  150. package/dist/modes/interactive/theme/theme-controller.js +108 -0
  151. package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
  152. package/dist/modes/interactive/theme/theme-schema.json +2 -1
  153. package/dist/modes/interactive/theme/theme.d.ts +5 -0
  154. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  155. package/dist/modes/interactive/theme/theme.js +70 -29
  156. package/dist/modes/interactive/theme/theme.js.map +1 -1
  157. package/dist/modes/rpc/rpc-client.d.ts +14 -2
  158. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  159. package/dist/modes/rpc/rpc-client.js +23 -3
  160. package/dist/modes/rpc/rpc-client.js.map +1 -1
  161. package/dist/modes/rpc/rpc-mode.d.ts +1 -1
  162. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  163. package/dist/modes/rpc/rpc-mode.js +31 -2
  164. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  165. package/dist/modes/rpc/rpc-types.d.ts +23 -0
  166. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  167. package/dist/modes/rpc/rpc-types.js.map +1 -1
  168. package/dist/package-manager-cli.d.ts.map +1 -1
  169. package/dist/package-manager-cli.js +39 -9
  170. package/dist/package-manager-cli.js.map +1 -1
  171. package/docs/custom-provider.md +4 -1
  172. package/docs/extensions.md +21 -0
  173. package/docs/json.md +3 -1
  174. package/docs/models.md +78 -2
  175. package/docs/packages.md +13 -9
  176. package/docs/providers.md +3 -0
  177. package/docs/quickstart.md +14 -0
  178. package/docs/rpc.md +80 -1
  179. package/docs/sdk.md +35 -11
  180. package/docs/session-format.md +15 -1
  181. package/docs/sessions.md +1 -1
  182. package/docs/settings.md +12 -2
  183. package/docs/themes.md +3 -1
  184. package/docs/tui.md +1 -1
  185. package/docs/usage.md +12 -9
  186. package/docs/workflows.md +34 -10
  187. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  188. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  189. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  190. package/examples/extensions/gondolin/package-lock.json +2 -2
  191. package/examples/extensions/gondolin/package.json +1 -1
  192. package/examples/extensions/preset.ts +10 -4
  193. package/examples/extensions/provider-payload.ts +5 -5
  194. package/examples/extensions/sandbox/index.ts +2 -2
  195. package/examples/extensions/sandbox/package-lock.json +3 -3
  196. package/examples/extensions/sandbox/package.json +2 -2
  197. package/examples/extensions/subagent/agents.ts +2 -2
  198. package/examples/extensions/subagent/index.ts +4 -2
  199. package/examples/extensions/with-deps/package-lock.json +2 -2
  200. package/examples/extensions/with-deps/package.json +1 -1
  201. package/package.json +5 -5
  202. package/dist/builtin/subagents/skills/browser/EXAMPLES.md +0 -151
  203. package/dist/builtin/subagents/skills/browser/LICENSE.txt +0 -21
  204. package/dist/builtin/subagents/skills/browser/REFERENCE.md +0 -451
  205. 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, ".atomic", "presets.json");
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("No presets defined. Add presets to ~/.atomic/agent/presets.json or .atomic/presets.json (legacy .pi/presets.json also works)", "warning");
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("No presets defined. Add presets to ~/.atomic/agent/presets.json or .atomic/presets.json (legacy .pi/presets.json also works)", "warning");
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 { ExtensionAPI } from "@bastani/atomic";
3
+ import { CONFIG_DIR_NAME, type ExtensionAPI } from "@bastani/atomic";
4
4
 
5
5
  export default function (pi: ExtensionAPI) {
6
- const logFile = join(process.cwd(), ".pi", "provider-payload.log");
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, ".atomic", "sandbox.json");
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.4",
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.4",
9
+ "version": "1.9.7",
10
10
  "dependencies": {
11
- "@anthropic-ai/sandbox-runtime": "^0.0.26"
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",
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": "^0.0.26"
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, ".atomic", "agents");
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
- 'Default agent scope is "user" (from ~/.atomic/agent/agents).',
522
- 'To enable project-local agents in .atomic/agents (legacy .pi/agents also works), set agentScope: "both" (or "project").',
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.4",
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.4",
9
+ "version": "0.79.7",
10
10
  "dependencies": {
11
11
  "ms": "^2.1.3"
12
12
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "atomic-extension-with-deps",
3
3
  "private": true,
4
- "version": "0.79.4",
4
+ "version": "0.79.7",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/atomic",
3
- "version": "0.8.30",
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.30",
71
+ "@bastani/atomic-natives": "0.8.31-alpha.2",
72
72
  "@bufbuild/protobuf": "^2.0.0",
73
- "@earendil-works/pi-agent-core": "^0.79.4",
74
- "@earendil-works/pi-ai": "^0.79.4",
75
- "@earendil-works/pi-tui": "^0.79.4",
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.