osborn 0.8.10 → 0.8.12
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/.claude/settings.local.json +9 -0
- package/.claude/skills/markdown-to-pdf/SKILL.md +29 -0
- package/.claude/skills/pdf-to-markdown/SKILL.md +28 -0
- package/.claude/skills/playwright-browser/SKILL.md +90 -0
- package/.claude/skills/shadcn/SKILL.md +232 -0
- package/.claude/skills/shadcn/image.png +0 -0
- package/.claude/skills/youtube-transcript/SKILL.md +24 -0
- package/Dockerfile.sandbox +59 -0
- package/dist/claude-auth.d.ts +6 -0
- package/dist/claude-auth.js +66 -9
- package/dist/claude-llm.js +42 -8
- package/dist/codex-llm.js +1 -1
- package/dist/conversation-brain.d.ts +92 -0
- package/dist/conversation-brain.js +360 -0
- package/dist/fast-llm.d.ts +15 -0
- package/dist/fast-llm.js +81 -0
- package/dist/index.js +56 -10
- package/dist/pipeline-direct-llm.js +1 -1
- package/dist/prompts.js +25 -312
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Skill: Markdown to PDF
|
|
2
|
+
|
|
3
|
+
Export Markdown documents as formatted PDF files.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
When the user wants to create a PDF from a Markdown file, spec, or research findings.
|
|
7
|
+
|
|
8
|
+
## How to execute
|
|
9
|
+
|
|
10
|
+
Option 1 — Using md-to-pdf (best quality):
|
|
11
|
+
```bash
|
|
12
|
+
npx --yes md-to-pdf "<MARKDOWN_PATH>"
|
|
13
|
+
```
|
|
14
|
+
This creates a PDF alongside the source file with the same name.
|
|
15
|
+
|
|
16
|
+
Option 2 — Using pandoc (if available):
|
|
17
|
+
```bash
|
|
18
|
+
pandoc "<MARKDOWN_PATH>" -o "<OUTPUT_PATH>.pdf" --pdf-engine=wkhtmltopdf
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Option 3 — Using markdown-pdf:
|
|
22
|
+
```bash
|
|
23
|
+
npx --yes markdown-pdf "<MARKDOWN_PATH>" -o "<OUTPUT_PATH>.pdf"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Output
|
|
27
|
+
- Save the PDF to the session workspace (e.g., `library/{name}.pdf`)
|
|
28
|
+
- Confirm the output path and file size to the user
|
|
29
|
+
- If the source is spec.md, name the output `spec-export.pdf`
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Skill: PDF to Markdown
|
|
2
|
+
|
|
3
|
+
Convert PDF documents to readable Markdown text.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
When the user provides a PDF file path and wants to read, search, or work with its contents.
|
|
7
|
+
|
|
8
|
+
## How to execute
|
|
9
|
+
|
|
10
|
+
Option 1 — Using the built-in Read tool:
|
|
11
|
+
The Read tool can directly read PDF files. Use `pages` parameter for large PDFs (max 20 pages per request).
|
|
12
|
+
|
|
13
|
+
Option 2 — Full extraction via CLI (for better formatting or batch processing):
|
|
14
|
+
```bash
|
|
15
|
+
npx --yes pdf-parse-cli "<PDF_PATH>"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Option 3 — Using pdftotext (if available):
|
|
19
|
+
```bash
|
|
20
|
+
pdftotext -layout "<PDF_PATH>" -
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Output
|
|
24
|
+
Save the converted content to the session workspace as `library/{filename}.md` with:
|
|
25
|
+
- Document title and source path at the top
|
|
26
|
+
- Preserved heading structure where detectable
|
|
27
|
+
- Tables converted to Markdown tables where possible
|
|
28
|
+
- Page numbers as section markers
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Skill: Playwright Browser Automation
|
|
2
|
+
|
|
3
|
+
Automate web browser interactions — navigate pages, click buttons, fill forms, take screenshots, and extract content.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
- Navigate to a URL and interact with it
|
|
7
|
+
- Click buttons or links by their text or role
|
|
8
|
+
- Fill form fields and submit data
|
|
9
|
+
- Take screenshots of web pages
|
|
10
|
+
- Extract text or structured data from pages
|
|
11
|
+
- Automate multi-step web workflows (e.g. join a room, test a UI flow)
|
|
12
|
+
|
|
13
|
+
## How to execute
|
|
14
|
+
|
|
15
|
+
Uses `@playwright/cli` via npx — no global install needed. Token-efficient: uses element references (e.g. `e15`) instead of pixel coordinates.
|
|
16
|
+
|
|
17
|
+
### First time only — install browser binaries
|
|
18
|
+
```bash
|
|
19
|
+
npx playwright install chromium
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Step 1 — Open a URL
|
|
23
|
+
```bash
|
|
24
|
+
npx @playwright/cli open https://localhost:3000
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Step 2 — Get page structure and element references
|
|
28
|
+
```bash
|
|
29
|
+
npx @playwright/cli snapshot
|
|
30
|
+
```
|
|
31
|
+
Returns an accessibility tree with element IDs like e1, e2, e15. Use these in subsequent commands.
|
|
32
|
+
|
|
33
|
+
### Step 3 — Interact with elements
|
|
34
|
+
```bash
|
|
35
|
+
npx @playwright/cli click e15
|
|
36
|
+
npx @playwright/cli fill e3 "some text"
|
|
37
|
+
npx @playwright/cli press e3 Enter
|
|
38
|
+
npx @playwright/cli select e7 "optionValue"
|
|
39
|
+
npx @playwright/cli check e9
|
|
40
|
+
npx @playwright/cli hover e12
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Take a screenshot
|
|
44
|
+
```bash
|
|
45
|
+
npx @playwright/cli screenshot --path=/tmp/page.png
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Take a screenshot at a specific viewport size (mobile check)
|
|
49
|
+
```bash
|
|
50
|
+
npx @playwright/cli screenshot --viewport-size=375,812 --path=/tmp/page-mobile.png
|
|
51
|
+
```
|
|
52
|
+
Common mobile sizes: `375,812` (iPhone 14), `390,844` (iPhone 14 Pro), `412,915` (Pixel 7), `768,1024` (iPad).
|
|
53
|
+
|
|
54
|
+
### Close the browser
|
|
55
|
+
```bash
|
|
56
|
+
npx @playwright/cli close
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Named sessions (persistent state across commands)
|
|
60
|
+
```bash
|
|
61
|
+
npx @playwright/cli -s=myflow open https://localhost:3000
|
|
62
|
+
npx @playwright/cli -s=myflow snapshot
|
|
63
|
+
npx @playwright/cli -s=myflow fill e3 "abc123"
|
|
64
|
+
npx @playwright/cli -s=myflow click e5
|
|
65
|
+
npx @playwright/cli -s=myflow close
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Complete example — join Osborn voice room
|
|
69
|
+
```bash
|
|
70
|
+
npx @playwright/cli open http://localhost:3000
|
|
71
|
+
npx @playwright/cli snapshot
|
|
72
|
+
npx @playwright/cli fill e3 "abc123"
|
|
73
|
+
npx @playwright/cli click e4
|
|
74
|
+
npx @playwright/cli screenshot --path=/tmp/osborn-joined.png
|
|
75
|
+
npx @playwright/cli close
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Complete example — check mobile layout
|
|
79
|
+
```bash
|
|
80
|
+
npx @playwright/cli open http://localhost:3000
|
|
81
|
+
npx @playwright/cli screenshot --viewport-size=375,812 --path=/tmp/mobile-375.png
|
|
82
|
+
npx @playwright/cli close
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Notes
|
|
86
|
+
- Runs headless by default. Add --headed to see the browser window.
|
|
87
|
+
- Install browsers first if needed: npx playwright install chromium
|
|
88
|
+
- Element IDs are session-scoped — run snapshot again after page changes
|
|
89
|
+
- Use `--viewport-size=WIDTH,HEIGHT` to simulate mobile screen sizes (e.g. `375,812` for iPhone 14)
|
|
90
|
+
- Use `--storage-state=/tmp/state.json` to save and restore session state (cookies, localStorage) across runs
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# Skill: shadcn/ui Components
|
|
2
|
+
|
|
3
|
+
Add and configure shadcn/ui components in a Next.js or React project.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
When the user wants to add UI components (buttons, dialogs, cards, forms, tables, etc.) using shadcn/ui — the copy-paste component library built on Radix UI and Tailwind CSS.
|
|
7
|
+
|
|
8
|
+
## Setup (first time only)
|
|
9
|
+
|
|
10
|
+
Initialize shadcn in the project root (where package.json lives):
|
|
11
|
+
```bash
|
|
12
|
+
npx shadcn@latest init
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This creates `components.json` and sets up `src/components/ui/`. Answer the prompts to match your project's style preferences.
|
|
16
|
+
|
|
17
|
+
## Add a component
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx shadcn@latest add <component-name>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Add multiple components at once
|
|
24
|
+
```bash
|
|
25
|
+
npx shadcn@latest add button card dialog input form
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Commonly used components
|
|
29
|
+
|
|
30
|
+
| Component | Install name | Description |
|
|
31
|
+
|-----------|-------------|-------------|
|
|
32
|
+
| Button | `button` | Clickable button with variants |
|
|
33
|
+
| Card | `card` | Container with header/content/footer |
|
|
34
|
+
| Input | `input` | Text input field |
|
|
35
|
+
| Label | `label` | Form label |
|
|
36
|
+
| Textarea | `textarea` | Multi-line text input |
|
|
37
|
+
| Select | `select` | Dropdown select |
|
|
38
|
+
| Checkbox | `checkbox` | Checkbox with label |
|
|
39
|
+
| Switch | `switch` | Toggle switch |
|
|
40
|
+
| Dialog | `dialog` | Modal dialog |
|
|
41
|
+
| Sheet | `sheet` | Slide-in panel (drawer) |
|
|
42
|
+
| Popover | `popover` | Floating content panel |
|
|
43
|
+
| Tooltip | `tooltip` | Hover tooltip |
|
|
44
|
+
| Dropdown Menu | `dropdown-menu` | Contextual dropdown |
|
|
45
|
+
| Command | `command` | Command palette / search |
|
|
46
|
+
| Badge | `badge` | Small status indicator |
|
|
47
|
+
| Avatar | `avatar` | User avatar with fallback |
|
|
48
|
+
| Separator | `separator` | Visual divider |
|
|
49
|
+
| Table | `table` | Data table |
|
|
50
|
+
| Tabs | `tabs` | Tabbed interface |
|
|
51
|
+
| Accordion | `accordion` | Collapsible sections |
|
|
52
|
+
| Sonner | `sonner` | Toast notifications (preferred over toast) |
|
|
53
|
+
| Alert | `alert` | Inline alert message |
|
|
54
|
+
| Alert Dialog | `alert-dialog` | Confirmation dialog |
|
|
55
|
+
| Progress | `progress` | Progress bar |
|
|
56
|
+
| Skeleton | `skeleton` | Loading placeholder |
|
|
57
|
+
| Scroll Area | `scroll-area` | Custom scrollbar container |
|
|
58
|
+
| Calendar | `calendar` | Date picker calendar |
|
|
59
|
+
| Form | `form` | React Hook Form integration |
|
|
60
|
+
| Slider | `slider` | Range slider |
|
|
61
|
+
| Toggle | `toggle` | Toggle button |
|
|
62
|
+
| Navigation Menu | `navigation-menu` | Site navigation |
|
|
63
|
+
| Breadcrumb | `breadcrumb` | Page navigation breadcrumbs |
|
|
64
|
+
| Collapsible | `collapsible` | Expandable/collapsible section |
|
|
65
|
+
| Context Menu | `context-menu` | Right-click context menu |
|
|
66
|
+
| Menubar | `menubar` | Application menu bar |
|
|
67
|
+
| Resizable | `resizable` | Resizable panel groups |
|
|
68
|
+
|
|
69
|
+
## Import pattern
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { Button } from "@/components/ui/button"
|
|
73
|
+
import { Card, CardContent, CardHeader, CardTitle, CardDescription, CardFooter } from "@/components/ui/card"
|
|
74
|
+
import { Input } from "@/components/ui/input"
|
|
75
|
+
import { Label } from "@/components/ui/label"
|
|
76
|
+
import {
|
|
77
|
+
Dialog,
|
|
78
|
+
DialogContent,
|
|
79
|
+
DialogDescription,
|
|
80
|
+
DialogHeader,
|
|
81
|
+
DialogTitle,
|
|
82
|
+
DialogTrigger,
|
|
83
|
+
} from "@/components/ui/dialog"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Example — Button variants
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
<Button>Default</Button>
|
|
90
|
+
<Button variant="destructive">Delete</Button>
|
|
91
|
+
<Button variant="outline">Cancel</Button>
|
|
92
|
+
<Button variant="ghost">Ghost</Button>
|
|
93
|
+
<Button variant="link">Link</Button>
|
|
94
|
+
<Button size="sm">Small</Button>
|
|
95
|
+
<Button size="lg">Large</Button>
|
|
96
|
+
<Button disabled>Disabled</Button>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Example — Card
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
<Card>
|
|
103
|
+
<CardHeader>
|
|
104
|
+
<CardTitle>Card Title</CardTitle>
|
|
105
|
+
<CardDescription>Card description goes here</CardDescription>
|
|
106
|
+
</CardHeader>
|
|
107
|
+
<CardContent>
|
|
108
|
+
<p>Card content here</p>
|
|
109
|
+
</CardContent>
|
|
110
|
+
<CardFooter>
|
|
111
|
+
<Button>Action</Button>
|
|
112
|
+
</CardFooter>
|
|
113
|
+
</Card>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Example — Form with validation (React Hook Form + Zod)
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npx shadcn@latest add form input
|
|
120
|
+
npm install zod react-hook-form @hookform/resolvers
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
import { useForm } from "react-hook-form"
|
|
125
|
+
import { zodResolver } from "@hookform/resolvers/zod"
|
|
126
|
+
import * as z from "zod"
|
|
127
|
+
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"
|
|
128
|
+
import { Input } from "@/components/ui/input"
|
|
129
|
+
import { Button } from "@/components/ui/button"
|
|
130
|
+
|
|
131
|
+
const formSchema = z.object({
|
|
132
|
+
email: z.string().email("Invalid email address"),
|
|
133
|
+
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
export function LoginForm() {
|
|
137
|
+
const form = useForm<z.infer<typeof formSchema>>({
|
|
138
|
+
resolver: zodResolver(formSchema),
|
|
139
|
+
defaultValues: { email: "", password: "" },
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
function onSubmit(values: z.infer<typeof formSchema>) {
|
|
143
|
+
console.log(values)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<Form {...form}>
|
|
148
|
+
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
|
|
149
|
+
<FormField
|
|
150
|
+
control={form.control}
|
|
151
|
+
name="email"
|
|
152
|
+
render={({ field }) => (
|
|
153
|
+
<FormItem>
|
|
154
|
+
<FormLabel>Email</FormLabel>
|
|
155
|
+
<FormControl>
|
|
156
|
+
<Input placeholder="you@example.com" {...field} />
|
|
157
|
+
</FormControl>
|
|
158
|
+
<FormMessage />
|
|
159
|
+
</FormItem>
|
|
160
|
+
)}
|
|
161
|
+
/>
|
|
162
|
+
<FormField
|
|
163
|
+
control={form.control}
|
|
164
|
+
name="password"
|
|
165
|
+
render={({ field }) => (
|
|
166
|
+
<FormItem>
|
|
167
|
+
<FormLabel>Password</FormLabel>
|
|
168
|
+
<FormControl>
|
|
169
|
+
<Input type="password" {...field} />
|
|
170
|
+
</FormControl>
|
|
171
|
+
<FormMessage />
|
|
172
|
+
</FormItem>
|
|
173
|
+
)}
|
|
174
|
+
/>
|
|
175
|
+
<Button type="submit" className="w-full">Sign in</Button>
|
|
176
|
+
</form>
|
|
177
|
+
</Form>
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Example — Toast notifications (Sonner)
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
npx shadcn@latest add sonner
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
// In your root layout — add the Toaster once
|
|
190
|
+
import { Toaster } from "@/components/ui/sonner"
|
|
191
|
+
export default function RootLayout({ children }) {
|
|
192
|
+
return (
|
|
193
|
+
<html>
|
|
194
|
+
<body>
|
|
195
|
+
{children}
|
|
196
|
+
<Toaster />
|
|
197
|
+
</body>
|
|
198
|
+
</html>
|
|
199
|
+
)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Then anywhere in your app
|
|
203
|
+
import { toast } from "sonner"
|
|
204
|
+
|
|
205
|
+
toast("Event created")
|
|
206
|
+
toast.success("Profile saved")
|
|
207
|
+
toast.error("Something went wrong")
|
|
208
|
+
toast.promise(saveData(), {
|
|
209
|
+
loading: "Saving...",
|
|
210
|
+
success: "Saved!",
|
|
211
|
+
error: "Failed to save",
|
|
212
|
+
})
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## The cn() utility
|
|
216
|
+
|
|
217
|
+
shadcn uses `clsx` + `tailwind-merge` via a `cn()` helper for conditional classes:
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
import { cn } from "@/lib/utils"
|
|
221
|
+
|
|
222
|
+
<div className={cn("base-class", isActive && "active-class", className)} />
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Notes
|
|
226
|
+
- Components are **copied into your project** (not a node_modules dependency) — edit them freely
|
|
227
|
+
- Requires **Tailwind CSS** configured in the project
|
|
228
|
+
- Uses **Radix UI** primitives for accessibility
|
|
229
|
+
- Components land in `src/components/ui/` by default
|
|
230
|
+
- Run `npx shadcn@latest diff` to see if upstream components have changed
|
|
231
|
+
- Check `components.json` for path and style config
|
|
232
|
+
- Use Sonner (`sonner`) instead of the legacy `toast` component for notifications
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Skill: YouTube Transcript
|
|
2
|
+
|
|
3
|
+
Fetch and save transcripts from YouTube videos.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
When the user asks to get a transcript, subtitles, captions, or summary from a YouTube video URL.
|
|
7
|
+
|
|
8
|
+
## How to execute
|
|
9
|
+
|
|
10
|
+
yt-dlp is installed on this system. Use this exact command:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
yt-dlp --skip-download --write-auto-sub --sub-lang en --convert-subs srt -o "/tmp/yt-%(id)s" "<VIDEO_URL>"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
This downloads auto-generated English subtitles as an SRT file to /tmp/yt-{video-id}.en.srt
|
|
17
|
+
|
|
18
|
+
Then read the SRT file and strip the timing markers to get clean transcript text.
|
|
19
|
+
|
|
20
|
+
## Output
|
|
21
|
+
Save the cleaned transcript to the session workspace as `library/youtube-{video-id}-transcript.md` with:
|
|
22
|
+
- Video title and URL at the top
|
|
23
|
+
- Cleaned transcript text (strip SRT timing markers and duplicate lines)
|
|
24
|
+
- Key timestamps preserved as section markers if meaningful breaks exist
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Osborn Sandbox — Fly.io Machines (per-user)
|
|
2
|
+
# Installs osborn as npm package (not from source) for lightweight per-user machines.
|
|
3
|
+
# Build: docker build -f Dockerfile.sandbox -t registry.fly.io/osborn-sandbox/agent:latest .
|
|
4
|
+
# Push: fly auth docker && docker push registry.fly.io/osborn-sandbox/agent:latest
|
|
5
|
+
|
|
6
|
+
FROM node:22-slim
|
|
7
|
+
|
|
8
|
+
# Runtime deps for osborn + claude-code
|
|
9
|
+
RUN apt-get update -qq && \
|
|
10
|
+
apt-get install --no-install-recommends -y \
|
|
11
|
+
ca-certificates \
|
|
12
|
+
curl \
|
|
13
|
+
git \
|
|
14
|
+
python-is-python3 && \
|
|
15
|
+
rm -rf /var/lib/apt/lists/*
|
|
16
|
+
|
|
17
|
+
# Install osborn + claude-code globally
|
|
18
|
+
RUN npm install -g osborn@latest @anthropic-ai/claude-code
|
|
19
|
+
|
|
20
|
+
# Persistent workspace + claude config dirs
|
|
21
|
+
RUN mkdir -p /workspace /root/.claude
|
|
22
|
+
|
|
23
|
+
ENV OSBORN_CWD=/workspace
|
|
24
|
+
ENV OSBORN_API_PORT=8741
|
|
25
|
+
ENV NODE_ENV=production
|
|
26
|
+
|
|
27
|
+
WORKDIR /workspace
|
|
28
|
+
|
|
29
|
+
EXPOSE 8741
|
|
30
|
+
|
|
31
|
+
# Entrypoint: credential persistence + onboarding suppression + start
|
|
32
|
+
COPY <<'ENTRYPOINT' /entrypoint.sh
|
|
33
|
+
#!/bin/sh
|
|
34
|
+
set -e
|
|
35
|
+
|
|
36
|
+
# Claude credential persistence (volume at /workspace)
|
|
37
|
+
mkdir -p /workspace/.claude
|
|
38
|
+
rm -rf /root/.claude
|
|
39
|
+
ln -sf /workspace/.claude /root/.claude
|
|
40
|
+
|
|
41
|
+
# Suppress Claude Code interactive onboarding prompts
|
|
42
|
+
ONBOARDING_JSON='{"numStartups":10,"installMethod":"npm","autoUpdates":false,"hasCompletedOnboarding":true,"hasTrustDialogAccepted":true,"hasTrustDialogHooksAccepted":true,"hasCompletedProjectOnboarding":true,"hasAcknowledgedCostThreshold":true,"effortCalloutV2Dismissed":true,"theme":"dark","projects":{"/workspace":{"hasTrustDialogAccepted":true,"hasTrustDialogHooksAccepted":true,"hasCompletedProjectOnboarding":true}}}'
|
|
43
|
+
echo "$ONBOARDING_JSON" > /root/.claude.json
|
|
44
|
+
mkdir -p /workspace/.claude
|
|
45
|
+
echo "$ONBOARDING_JSON" > /workspace/.claude/.config.json
|
|
46
|
+
echo "$ONBOARDING_JSON" > /workspace/.claude/claude.json
|
|
47
|
+
|
|
48
|
+
# Restore OAuth token if persisted on volume
|
|
49
|
+
if [ -f /workspace/.claude/.oauth-token ]; then
|
|
50
|
+
export CLAUDE_CODE_OAUTH_TOKEN="$(cat /workspace/.claude/.oauth-token)"
|
|
51
|
+
echo "[sandbox] Restored CLAUDE_CODE_OAUTH_TOKEN from volume"
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
exec osborn
|
|
55
|
+
ENTRYPOINT
|
|
56
|
+
|
|
57
|
+
RUN chmod +x /entrypoint.sh
|
|
58
|
+
|
|
59
|
+
CMD ["/entrypoint.sh"]
|
package/dist/claude-auth.d.ts
CHANGED
|
@@ -53,6 +53,12 @@ export declare function runClaudeAuthFlow(callbacks: ClaudeAuthCallbacks): {
|
|
|
53
53
|
* 2. ~/.claude/.credentials.json file
|
|
54
54
|
* 3. `claude auth status --json`
|
|
55
55
|
* 4. Interactive OAuth flow (setup-token)
|
|
56
|
+
*
|
|
57
|
+
* Concurrency: if a previous call is still running its OAuth flow, new
|
|
58
|
+
* callers attach to the existing flow rather than spawning a second pty.
|
|
59
|
+
* This prevents the situation where LiveKit reconnects (e.g. after a
|
|
60
|
+
* microphone-permission error) retrigger ensureClaudeAuth and the user
|
|
61
|
+
* sees two different URLs / two different code_challenges racing.
|
|
56
62
|
*/
|
|
57
63
|
export declare function ensureClaudeAuth(sendToFrontend: (type: string, payload: unknown) => void): Promise<{
|
|
58
64
|
submitCode?: (code: string) => void;
|
package/dist/claude-auth.js
CHANGED
|
@@ -354,9 +354,7 @@ export function runClaudeAuthFlow(callbacks) {
|
|
|
354
354
|
});
|
|
355
355
|
return { handle, done };
|
|
356
356
|
}
|
|
357
|
-
|
|
358
|
-
// Startup Gate
|
|
359
|
-
// ─────────────────────────────────────────
|
|
357
|
+
let inFlightAuth = null;
|
|
360
358
|
/**
|
|
361
359
|
* Ensure Claude is authenticated before proceeding.
|
|
362
360
|
*
|
|
@@ -365,8 +363,33 @@ export function runClaudeAuthFlow(callbacks) {
|
|
|
365
363
|
* 2. ~/.claude/.credentials.json file
|
|
366
364
|
* 3. `claude auth status --json`
|
|
367
365
|
* 4. Interactive OAuth flow (setup-token)
|
|
366
|
+
*
|
|
367
|
+
* Concurrency: if a previous call is still running its OAuth flow, new
|
|
368
|
+
* callers attach to the existing flow rather than spawning a second pty.
|
|
369
|
+
* This prevents the situation where LiveKit reconnects (e.g. after a
|
|
370
|
+
* microphone-permission error) retrigger ensureClaudeAuth and the user
|
|
371
|
+
* sees two different URLs / two different code_challenges racing.
|
|
368
372
|
*/
|
|
369
373
|
export async function ensureClaudeAuth(sendToFrontend) {
|
|
374
|
+
// If an auth flow is already running, attach to it and replay any
|
|
375
|
+
// state we've already captured (the URL, any waiting_code prompt).
|
|
376
|
+
if (inFlightAuth) {
|
|
377
|
+
console.log('🔑 ensureClaudeAuth called while a flow is in-flight — attaching new subscriber');
|
|
378
|
+
inFlightAuth.subscribers.push(sendToFrontend);
|
|
379
|
+
// Replay the state the frontend needs to render the modal correctly.
|
|
380
|
+
sendToFrontend('claude_auth_required', {
|
|
381
|
+
message: 'Claude authentication required. A login URL will appear shortly.',
|
|
382
|
+
});
|
|
383
|
+
if (inFlightAuth.lastUrl) {
|
|
384
|
+
sendToFrontend('claude_auth_url', { url: inFlightAuth.lastUrl });
|
|
385
|
+
}
|
|
386
|
+
if (inFlightAuth.lastStatus === 'waiting_code') {
|
|
387
|
+
sendToFrontend('claude_auth_waiting_code', {
|
|
388
|
+
message: 'Paste the authentication code from the browser.',
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
return { submitCode: inFlightAuth.submitCode, done: inFlightAuth.done };
|
|
392
|
+
}
|
|
370
393
|
// Check 0: Restore token from volume if previously persisted
|
|
371
394
|
if (!hasOAuthTokenEnv()) {
|
|
372
395
|
try {
|
|
@@ -399,28 +422,62 @@ export async function ensureClaudeAuth(sendToFrontend) {
|
|
|
399
422
|
}
|
|
400
423
|
// Check 4: Need interactive OAuth flow
|
|
401
424
|
console.log('🔑 Claude not authenticated — starting OAuth flow');
|
|
402
|
-
|
|
425
|
+
// Create the in-flight record BEFORE spawning, and fan-out every
|
|
426
|
+
// callback to all current subscribers. New subscribers that attach
|
|
427
|
+
// later get replay of lastUrl / lastStatus from the deduped path
|
|
428
|
+
// at the top of this function.
|
|
429
|
+
const subscribers = [sendToFrontend];
|
|
430
|
+
const fanout = (type, payload) => {
|
|
431
|
+
for (const sub of subscribers) {
|
|
432
|
+
try {
|
|
433
|
+
sub(type, payload);
|
|
434
|
+
}
|
|
435
|
+
catch (err) {
|
|
436
|
+
console.warn('🔑 subscriber failed:', err);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
fanout('claude_auth_required', {
|
|
403
441
|
message: 'Claude authentication required. A login URL will appear shortly.',
|
|
404
442
|
});
|
|
405
443
|
const { handle, done } = runClaudeAuthFlow({
|
|
406
444
|
onUrl: (url) => {
|
|
407
|
-
console.log(
|
|
408
|
-
|
|
445
|
+
console.log(`📤 Sending Claude auth URL to frontend (${url.length} chars)`);
|
|
446
|
+
if (inFlightAuth) {
|
|
447
|
+
inFlightAuth.lastUrl = url;
|
|
448
|
+
inFlightAuth.lastStatus = 'waiting';
|
|
449
|
+
}
|
|
450
|
+
fanout('claude_auth_url', { url });
|
|
409
451
|
},
|
|
410
452
|
onWaitingForCode: () => {
|
|
411
453
|
console.log('📤 Sending code prompt to frontend');
|
|
412
|
-
|
|
454
|
+
if (inFlightAuth)
|
|
455
|
+
inFlightAuth.lastStatus = 'waiting_code';
|
|
456
|
+
fanout('claude_auth_waiting_code', {
|
|
413
457
|
message: 'Paste the authentication code from the browser.',
|
|
414
458
|
});
|
|
415
459
|
},
|
|
416
460
|
onComplete: () => {
|
|
417
|
-
|
|
461
|
+
fanout('claude_auth_complete', {
|
|
418
462
|
message: 'Claude authenticated successfully. Starting voice session...',
|
|
419
463
|
});
|
|
420
464
|
},
|
|
421
465
|
onError: (message) => {
|
|
422
|
-
|
|
466
|
+
fanout('claude_auth_error', { message });
|
|
423
467
|
},
|
|
424
468
|
});
|
|
469
|
+
// Publish the in-flight record so concurrent callers attach to it.
|
|
470
|
+
inFlightAuth = {
|
|
471
|
+
submitCode: handle.submitCode,
|
|
472
|
+
done,
|
|
473
|
+
lastUrl: null,
|
|
474
|
+
lastStatus: null,
|
|
475
|
+
subscribers,
|
|
476
|
+
};
|
|
477
|
+
// Clear the in-flight record once the flow settles, success or failure.
|
|
478
|
+
done.finally(() => {
|
|
479
|
+
console.log('🔑 OAuth flow settled — clearing in-flight guard');
|
|
480
|
+
inFlightAuth = null;
|
|
481
|
+
});
|
|
425
482
|
return { submitCode: handle.submitCode, done };
|
|
426
483
|
}
|