@hachej/boring-agent 0.1.17 → 0.1.20

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 (39) hide show
  1. package/dist/{sandbox-handle-store-hK76cTjn.d.ts → agentPluginEvents-zyIvVjsA.d.ts} +28 -32
  2. package/dist/{chunk-F3CE5CNW.js → chunk-B5JECXMG.js} +5 -7
  3. package/dist/front/index.d.ts +23 -7
  4. package/dist/front/index.js +764 -421
  5. package/dist/front/styles.css +61 -0
  6. package/dist/{tool-ui-DSmWuqGe.d.ts → harness-DRrTn_5T.d.ts} +43 -24
  7. package/dist/server/index.d.ts +79 -10
  8. package/dist/server/index.js +251 -60
  9. package/dist/shared/index.d.ts +5 -3
  10. package/dist/shared/index.js +3 -1
  11. package/dist/tool-ui-DIFNGwYd.d.ts +20 -0
  12. package/docs/ACCESSIBILITY.md +55 -0
  13. package/docs/API.md +64 -0
  14. package/docs/CSP.md +40 -0
  15. package/docs/ERROR_CODES.md +54 -0
  16. package/docs/KNOWN_LIMITATIONS.md +100 -0
  17. package/docs/MIGRATION.md +50 -0
  18. package/docs/PERFORMANCE.md +68 -0
  19. package/docs/PLUGINS.md +108 -0
  20. package/docs/README.md +17 -0
  21. package/docs/RISKS-MULTI-TAB.md +46 -0
  22. package/docs/STYLING.md +71 -0
  23. package/docs/UI-SHADCN.md +56 -0
  24. package/docs/VERCEL_COSTS.md +103 -0
  25. package/docs/plans/AGENT_EVAL_FRAMEWORK.md +466 -0
  26. package/docs/plans/agent-package-spec.md +1777 -0
  27. package/docs/plans/harness-followup-capabilities.md +440 -0
  28. package/docs/plans/harness-tool-ui-capabilities.md +144 -0
  29. package/docs/plans/pi-followup-history-projection.md +229 -0
  30. package/docs/plans/pi-tools-migration.md +1061 -0
  31. package/docs/plans/reviews/pi-followup-history-codex-review.md +11 -0
  32. package/docs/plans/reviews/pi-followup-history-gpt-review.md +64 -0
  33. package/docs/plans/reviews/pi-followup-history-opus-review.md +43 -0
  34. package/docs/plans/reviews/pi-followup-history-xai-review.md +43 -0
  35. package/docs/plans/vercel-base-snapshot-template-plan.md +527 -0
  36. package/docs/plans/vercel-persistent-sandbox-adapter.md +553 -0
  37. package/docs/runtime.md +56 -0
  38. package/docs/tools.md +75 -0
  39. package/package.json +4 -3
@@ -0,0 +1,71 @@
1
+ # STYLING
2
+
3
+ Styling contract for `@boring/agent` frontend surfaces.
4
+
5
+ ## Package CSS
6
+
7
+ Consumers import the precompiled package stylesheet once, after host/workspace
8
+ base CSS and before app overrides:
9
+
10
+ ```ts
11
+ import "@boring/workspace/globals.css"
12
+ import "@boring/agent/front/styles.css"
13
+ import "./app.css"
14
+ ```
15
+
16
+ The published `@boring/agent/front/styles.css` is consumer-safe: it contains no
17
+ Tailwind `@source`, no Tailwind imports, and no repo-relative source paths.
18
+
19
+ ## Public selectors
20
+
21
+ Agent surfaces expose a package namespace root and stable part attributes:
22
+
23
+ ```css
24
+ [data-boring-agent] {}
25
+ [data-boring-agent-part="chat"] {}
26
+ [data-boring-agent-part="composer"] {}
27
+ [data-boring-agent-part="tool-card"] {}
28
+ [data-boring-agent-message-role="assistant"] {}
29
+ [data-boring-state="selected"] {}
30
+ ```
31
+
32
+ `data-boring-agent-*` is the public selector namespace for agent UI. Workspace
33
+ uses `data-boring-workspace-*`; do not style agent internals through workspace
34
+ selectors.
35
+
36
+ ## Token contract
37
+
38
+ Workspace owns the public visual tokens (`--boring-*`). Agent consumes those
39
+ host tokens and provides standalone fallbacks under `[data-boring-agent]`.
40
+
41
+ Common tokens:
42
+
43
+ - `--boring-background`
44
+ - `--boring-foreground`
45
+ - `--boring-card`
46
+ - `--boring-muted`
47
+ - `--boring-muted-foreground`
48
+ - `--boring-accent`
49
+ - `--boring-border`
50
+ - `--boring-radius`
51
+ - `--boring-font-sans`
52
+ - `--boring-font-mono`
53
+
54
+ Example app override:
55
+
56
+ ```css
57
+ [data-boring-agent-part="composer"] {
58
+ --boring-accent: oklch(0.64 0.18 250);
59
+ }
60
+
61
+ [data-boring-agent-message-role="assistant"] {
62
+ --boring-card: oklch(0.98 0.01 250);
63
+ }
64
+ ```
65
+
66
+ ## Invariants
67
+
68
+ - Keep reusable primitives driven by semantic CSS variables and public data
69
+ attributes, not package-internal DOM structure.
70
+ - Keep styling decisions out of `src/shared/**` and server runtime modules.
71
+ - Published package CSS must remain precompiled and consumer-safe.
@@ -0,0 +1,56 @@
1
+ # Agent UI
2
+
3
+ `@boring/agent` exports the pane-embeddable `ChatPanel` and its frontend
4
+ primitives. The default styled surface is packaged with precompiled CSS.
5
+
6
+ ## Quickstart
7
+
8
+ ```tsx
9
+ import "@boring/workspace/globals.css"
10
+ import "@boring/agent/front/styles.css"
11
+ import { ChatPanel } from "@boring/agent"
12
+
13
+ function App() {
14
+ return <ChatPanel sessionId="my-session" />
15
+ }
16
+ ```
17
+
18
+ Import app overrides after the package CSS when customizing:
19
+
20
+ ```ts
21
+ import "@boring/workspace/globals.css"
22
+ import "@boring/agent/front/styles.css"
23
+ import "./app.css"
24
+ ```
25
+
26
+ ## Styling model
27
+
28
+ | Concern | Contract |
29
+ |---|---|
30
+ | Package CSS | `@boring/agent/front/styles.css` |
31
+ | Root selector | `[data-boring-agent]` |
32
+ | Parts | `[data-boring-agent-part="composer"]`, `[data-boring-agent-part="tool-card"]`, etc. |
33
+ | Message role | `[data-boring-agent-message-role="assistant"]` |
34
+ | State | `[data-boring-state="selected"]`, `[data-boring-state="disabled"]`, etc. |
35
+ | Tokens | Consumes host `--boring-*` tokens with standalone fallbacks |
36
+
37
+ The built stylesheet has no Tailwind `@source` directives, no Tailwind imports,
38
+ and no repo-relative source paths.
39
+
40
+ ## Dark mode
41
+
42
+ Add `class="dark"` to an ancestor. Workspace owns the dark `--boring-*` token
43
+ values; agent inherits them and falls back when embedded standalone.
44
+
45
+ ## Custom tool renderers
46
+
47
+ Same API as `ChatPanel`:
48
+
49
+ ```tsx
50
+ <ChatPanel
51
+ sessionId="sess"
52
+ toolRenderers={{
53
+ write: ({ toolCall }) => <div>Wrote {toolCall.input.path}</div>,
54
+ }}
55
+ />
56
+ ```
@@ -0,0 +1,103 @@
1
+ # Vercel Sandbox Cost Model
2
+
3
+ Date: 2026-04-23
4
+
5
+ ## Inputs
6
+
7
+ ### Pricing + limits (official)
8
+
9
+ Source: Vercel Sandbox pricing and limits (last updated March 14, 2026):
10
+ <https://vercel.com/docs/vercel-sandbox/pricing>
11
+
12
+ | Metric | Rate / Limit |
13
+ |---|---|
14
+ | Active CPU | `$0.128 / vCPU-hour` |
15
+ | Provisioned Memory | `$0.0212 / GB-hour` |
16
+ | Sandbox creations | `$0.60 / 1M` (`$0.0000006 / create`) |
17
+ | Data transfer | `$0.15 / GB` |
18
+ | Snapshot storage | `$0.08 / GB-month` |
19
+ | Default vCPU | `2` |
20
+ | Memory per vCPU | `2 GB` |
21
+ | Max runtime | Hobby `45 min`, Pro/Enterprise `5h` |
22
+ | vCPU allocation rate limit | Hobby `40 vCPU / 10 min`, Pro `200 / min`, Ent `400 / min` |
23
+
24
+ Snapshot defaults (official):
25
+ - <https://vercel.com/docs/vercel-sandbox/concepts/snapshots>
26
+ - Default snapshot expiration is `30 days` unless configured otherwise.
27
+
28
+ ### Measured workload inputs (this repo)
29
+
30
+ - Cold-start benchmark (`96h`): [PERFORMANCE.md](./PERFORMANCE.md)
31
+ - FS + exec latency benchmark (`f4f`): historical raw JSON artifact removed; see the root `docs/PERFORMANCE.md` rollup.
32
+ - Measured snapshot sizes from benchmark project: ~`279 MB` each (`0.2606 GB`).
33
+
34
+ Observations:
35
+ - 96h: cold-start p95 is below `3s`, so we do not need a large warm pool to hide startup.
36
+ - f4f + 96h traces are I/O-heavy; CPU-active share is much lower than wall-clock. Model uses `30%` CPU-active as the baseline.
37
+
38
+ ## Model
39
+
40
+ For one workspace/day:
41
+
42
+ ```text
43
+ daily_cost =
44
+ (active_cpu_vcpu_hours * 0.128) +
45
+ (memory_gb * wall_clock_hours * 0.0212) +
46
+ (creates_per_day * 0.0000006) +
47
+ (snapshot_gb * snapshots_kept * 0.08 / 30)
48
+ ```
49
+
50
+ Baseline assumptions used below:
51
+ - `2 vCPU`, `4 GB` memory.
52
+ - one active user session/day: `30 min` wall-clock, `30%` CPU-active.
53
+ - this gives `active_cpu_vcpu_hours = 2 * 0.5 * 0.3 = 0.3` vCPU-hours/day.
54
+ - `1` creation/day.
55
+ - snapshot retention `keep-last-2`.
56
+ - idle policy changes runtime billed for memory, but not active CPU time.
57
+
58
+ ## Cost per Workspace per Day
59
+
60
+ Historical companion CSV artifacts were removed from the package tree; the table below preserves the cost model.
61
+
62
+ | Idle policy | Runtime billed/day | CPU $/day | Memory $/day | Snapshot $/day | Create $/day | Total $/day |
63
+ |---|---:|---:|---:|---:|---:|---:|
64
+ | Stop on session end | 0.5 h | 0.0384 | 0.0424 | 0.0014 | 0.0000006 | **0.0822** |
65
+ | Idle-stop after 60 min | 1.0 h | 0.0384 | 0.0848 | 0.0014 | 0.0000006 | **0.1246** |
66
+ | No explicit stop (5h timeout) | 5.0 h | 0.0384 | 0.4240 | 0.0014 | 0.0000006 | **0.4638** |
67
+ | Pinned 24h workspace | 24.0 h | 0.0384 | 2.0352 | 0.0014 | 0.0000006 | **2.0750** |
68
+
69
+ Implication:
70
+ - Memory wall-clock billing dominates cost. Idle lifetime policy matters far more than creation count.
71
+
72
+ ## Snapshot Retention Trade-off
73
+
74
+ With measured snapshot size `0.2606 GB`:
75
+
76
+ | Retention | Storage/workspace/month |
77
+ |---|---:|
78
+ | Keep 1 | `$0.0209` |
79
+ | Keep 2 (current) | `$0.0417` |
80
+ | Keep 5 | `$0.1043` |
81
+ | Keep 10 | `$0.2085` |
82
+
83
+ Conclusion:
84
+ - **Keep-last-2 is still the right default.**
85
+ - Storage cost is tiny at small scale but scales linearly with workspace count.
86
+
87
+ ## Idle Pool Sizing
88
+
89
+ If we keep a warm 2 vCPU / 4 GB sandbox running for 24h, per slot:
90
+ - Memory-only floor: `4 GB * 24h * 0.0212 = $2.0352/day`.
91
+ - At 1% CPU-active overhead, total is about `~$2.10/day` per warm slot.
92
+
93
+ Because 96h cold-start p95 is already `<3s`, default should be **no prewarmed idle pool**.
94
+
95
+ ## Policy Recommendation
96
+
97
+ 1. Keep `BORING_AGENT_SNAPSHOT_KEEP=2` (confirmed).
98
+ 2. Stop sandbox proactively on session end; do not rely on timeout.
99
+ 3. Add/keep idle-stop guardrail at `<= 60 min` idle.
100
+ 4. Add stale-handle cleanup: force destroy after `24h` idle as a safety backstop if stop hooks are missed.
101
+ 5. Keep idle pool size at `0` by default; only enable a tiny pool behind feature flag if product latency goals tighten.
102
+
103
+ This policy minimizes spend while keeping current UX targets achievable.