@kortix/sandbox 0.4.1
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/config/customize.sh +143 -0
- package/config/kortix-env-setup.sh +25 -0
- package/kortix-master/package.json +22 -0
- package/kortix-master/src/config.ts +22 -0
- package/kortix-master/src/index.ts +44 -0
- package/kortix-master/src/routes/env.ts +65 -0
- package/kortix-master/src/routes/proxy.ts +108 -0
- package/kortix-master/src/routes/update.ts +185 -0
- package/kortix-master/src/services/proxy.ts +43 -0
- package/kortix-master/src/services/secret-store.ts +156 -0
- package/kortix-master/tsconfig.json +14 -0
- package/opencode/agents/kortix-browser.md +142 -0
- package/opencode/agents/kortix-build.md +62 -0
- package/opencode/agents/kortix-explore.md +66 -0
- package/opencode/agents/kortix-image-gen.md +33 -0
- package/opencode/agents/kortix-main.md +450 -0
- package/opencode/agents/kortix-plan.md +100 -0
- package/opencode/agents/kortix-research.md +84 -0
- package/opencode/agents/kortix-sheets.md +61 -0
- package/opencode/agents/kortix-slides.md +64 -0
- package/opencode/agents/kortix-web-dev.md +572 -0
- package/opencode/commands/email.md +36 -0
- package/opencode/commands/init.md +43 -0
- package/opencode/commands/journal.md +44 -0
- package/opencode/commands/memory-init.md +81 -0
- package/opencode/commands/memory-search.md +50 -0
- package/opencode/commands/memory-status.md +56 -0
- package/opencode/commands/research.md +36 -0
- package/opencode/commands/search.md +38 -0
- package/opencode/commands/slides.md +32 -0
- package/opencode/commands/spreadsheet.md +30 -0
- package/opencode/memory.json +37 -0
- package/opencode/ocx.jsonc +10 -0
- package/opencode/opencode.jsonc +103 -0
- package/opencode/package.json +25 -0
- package/opencode/patches/apply.sh +19 -0
- package/opencode/patches/opencode-pty-spawn.txt +49 -0
- package/opencode/plugin/background-agents.ts.disabled +483 -0
- package/opencode/plugin/kdco-primitives/get-project-id.ts +172 -0
- package/opencode/plugin/kdco-primitives/index.ts +26 -0
- package/opencode/plugin/kdco-primitives/log-warn.ts +51 -0
- package/opencode/plugin/kdco-primitives/mutex.ts +122 -0
- package/opencode/plugin/kdco-primitives/shell.ts +138 -0
- package/opencode/plugin/kdco-primitives/temp.ts +36 -0
- package/opencode/plugin/kdco-primitives/terminal-detect.ts +34 -0
- package/opencode/plugin/kdco-primitives/types.ts +13 -0
- package/opencode/plugin/kdco-primitives/with-timeout.ts +84 -0
- package/opencode/plugin/memory.ts +306 -0
- package/opencode/plugin/worktree/state.ts +412 -0
- package/opencode/plugin/worktree/terminal.ts +1002 -0
- package/opencode/plugin/worktree.ts +861 -0
- package/opencode/skills/KORTIX-browser/SKILL.md +478 -0
- package/opencode/skills/KORTIX-cron-triggers/SKILL.md +173 -0
- package/opencode/skills/KORTIX-deep-research/SKILL.md +278 -0
- package/opencode/skills/KORTIX-docx/SKILL.md +398 -0
- package/opencode/skills/KORTIX-docx/scripts/__init__.py +1 -0
- package/opencode/skills/KORTIX-docx/scripts/accept_changes.py +104 -0
- package/opencode/skills/KORTIX-docx/scripts/comment.py +244 -0
- package/opencode/skills/KORTIX-docx/scripts/office/helpers/__init__.py +0 -0
- package/opencode/skills/KORTIX-docx/scripts/office/helpers/merge_runs.py +199 -0
- package/opencode/skills/KORTIX-docx/scripts/office/helpers/simplify_redlines.py +197 -0
- package/opencode/skills/KORTIX-docx/scripts/office/pack.py +159 -0
- package/opencode/skills/KORTIX-docx/scripts/office/soffice.py +183 -0
- package/opencode/skills/KORTIX-docx/scripts/office/unpack.py +132 -0
- package/opencode/skills/KORTIX-docx/scripts/office/validate.py +111 -0
- package/opencode/skills/KORTIX-docx/scripts/office/validators/__init__.py +15 -0
- package/opencode/skills/KORTIX-docx/scripts/office/validators/base.py +847 -0
- package/opencode/skills/KORTIX-docx/scripts/office/validators/docx.py +446 -0
- package/opencode/skills/KORTIX-docx/scripts/office/validators/pptx.py +275 -0
- package/opencode/skills/KORTIX-docx/scripts/office/validators/redlining.py +247 -0
- package/opencode/skills/KORTIX-docx/scripts/render_docx.py +179 -0
- package/opencode/skills/KORTIX-docx/scripts/templates/comments.xml +3 -0
- package/opencode/skills/KORTIX-docx/scripts/templates/commentsExtended.xml +3 -0
- package/opencode/skills/KORTIX-docx/scripts/templates/commentsExtensible.xml +3 -0
- package/opencode/skills/KORTIX-docx/scripts/templates/commentsIds.xml +3 -0
- package/opencode/skills/KORTIX-docx/scripts/templates/people.xml +3 -0
- package/opencode/skills/KORTIX-domain-research/SKILL.md +96 -0
- package/opencode/skills/KORTIX-domain-research/scripts/domain-lookup.py +810 -0
- package/opencode/skills/KORTIX-elevenlabs/SKILL.md +230 -0
- package/opencode/skills/KORTIX-elevenlabs/scripts/tts.py +389 -0
- package/opencode/skills/KORTIX-email/SKILL.md +145 -0
- package/opencode/skills/KORTIX-legal-writer/SKILL.md +409 -0
- package/opencode/skills/KORTIX-legal-writer/references/bluebook.md +152 -0
- package/opencode/skills/KORTIX-legal-writer/references/document-types.md +416 -0
- package/opencode/skills/KORTIX-legal-writer/scripts/courtlistener.py +291 -0
- package/opencode/skills/KORTIX-legal-writer/scripts/ecfr_lookup.py +299 -0
- package/opencode/skills/KORTIX-legal-writer/scripts/verify-legal.py +507 -0
- package/opencode/skills/KORTIX-logo-creator/SKILL.md +293 -0
- package/opencode/skills/KORTIX-logo-creator/references/prompt-patterns.md +134 -0
- package/opencode/skills/KORTIX-logo-creator/scripts/compose_logo.py +406 -0
- package/opencode/skills/KORTIX-logo-creator/scripts/create_logo_sheet.py +258 -0
- package/opencode/skills/KORTIX-logo-creator/scripts/remove_bg.py +96 -0
- package/opencode/skills/KORTIX-memory/SKILL.md +261 -0
- package/opencode/skills/KORTIX-memory/scripts/export-sessions.py +409 -0
- package/opencode/skills/KORTIX-paper-creator/SKILL.md +549 -0
- package/opencode/skills/KORTIX-paper-creator/assets/template.tex +101 -0
- package/opencode/skills/KORTIX-paper-creator/scripts/compile.sh +177 -0
- package/opencode/skills/KORTIX-paper-creator/scripts/openalex_to_bibtex.py +220 -0
- package/opencode/skills/KORTIX-paper-creator/scripts/verify.sh +354 -0
- package/opencode/skills/KORTIX-paper-search/SKILL.md +418 -0
- package/opencode/skills/KORTIX-pdf/SKILL.md +232 -0
- package/opencode/skills/KORTIX-pdf/forms.md +36 -0
- package/opencode/skills/KORTIX-pdf/reference.md +105 -0
- package/opencode/skills/KORTIX-pdf/scripts/check_bounding_boxes.py +65 -0
- package/opencode/skills/KORTIX-pdf/scripts/check_fillable_fields.py +11 -0
- package/opencode/skills/KORTIX-pdf/scripts/convert_pdf_to_images.py +33 -0
- package/opencode/skills/KORTIX-pdf/scripts/create_validation_image.py +37 -0
- package/opencode/skills/KORTIX-pdf/scripts/extract_form_field_info.py +122 -0
- package/opencode/skills/KORTIX-pdf/scripts/extract_form_structure.py +115 -0
- package/opencode/skills/KORTIX-pdf/scripts/fill_fillable_fields.py +98 -0
- package/opencode/skills/KORTIX-pdf/scripts/fill_pdf_form_with_annotations.py +107 -0
- package/opencode/skills/KORTIX-plan/SKILL.md +228 -0
- package/opencode/skills/KORTIX-presentation-viewer/SKILL.md +87 -0
- package/opencode/skills/KORTIX-presentation-viewer/serve.ts +136 -0
- package/opencode/skills/KORTIX-presentation-viewer/viewer.html +559 -0
- package/opencode/skills/KORTIX-presentations/SKILL.md +344 -0
- package/opencode/skills/KORTIX-remotion/SKILL.md +56 -0
- package/opencode/skills/KORTIX-remotion/rules/3d.md +86 -0
- package/opencode/skills/KORTIX-remotion/rules/animations.md +29 -0
- package/opencode/skills/KORTIX-remotion/rules/assets.md +78 -0
- package/opencode/skills/KORTIX-remotion/rules/audio-visualization.md +198 -0
- package/opencode/skills/KORTIX-remotion/rules/audio.md +169 -0
- package/opencode/skills/KORTIX-remotion/rules/calculate-metadata.md +104 -0
- package/opencode/skills/KORTIX-remotion/rules/can-decode.md +75 -0
- package/opencode/skills/KORTIX-remotion/rules/charts.md +120 -0
- package/opencode/skills/KORTIX-remotion/rules/compositions.md +141 -0
- package/opencode/skills/KORTIX-remotion/rules/display-captions.md +184 -0
- package/opencode/skills/KORTIX-remotion/rules/extract-frames.md +229 -0
- package/opencode/skills/KORTIX-remotion/rules/ffmpeg.md +38 -0
- package/opencode/skills/KORTIX-remotion/rules/fonts.md +152 -0
- package/opencode/skills/KORTIX-remotion/rules/get-audio-duration.md +58 -0
- package/opencode/skills/KORTIX-remotion/rules/get-video-dimensions.md +68 -0
- package/opencode/skills/KORTIX-remotion/rules/get-video-duration.md +58 -0
- package/opencode/skills/KORTIX-remotion/rules/gifs.md +141 -0
- package/opencode/skills/KORTIX-remotion/rules/images.md +130 -0
- package/opencode/skills/KORTIX-remotion/rules/import-srt-captions.md +69 -0
- package/opencode/skills/KORTIX-remotion/rules/light-leaks.md +73 -0
- package/opencode/skills/KORTIX-remotion/rules/lottie.md +68 -0
- package/opencode/skills/KORTIX-remotion/rules/maps.md +401 -0
- package/opencode/skills/KORTIX-remotion/rules/measuring-dom-nodes.md +35 -0
- package/opencode/skills/KORTIX-remotion/rules/measuring-text.md +143 -0
- package/opencode/skills/KORTIX-remotion/rules/parameters.md +98 -0
- package/opencode/skills/KORTIX-remotion/rules/sequencing.md +118 -0
- package/opencode/skills/KORTIX-remotion/rules/subtitles.md +36 -0
- package/opencode/skills/KORTIX-remotion/rules/tailwind.md +11 -0
- package/opencode/skills/KORTIX-remotion/rules/text-animations.md +20 -0
- package/opencode/skills/KORTIX-remotion/rules/timing.md +179 -0
- package/opencode/skills/KORTIX-remotion/rules/transcribe-captions.md +70 -0
- package/opencode/skills/KORTIX-remotion/rules/transitions.md +197 -0
- package/opencode/skills/KORTIX-remotion/rules/transparent-videos.md +106 -0
- package/opencode/skills/KORTIX-remotion/rules/trimming.md +53 -0
- package/opencode/skills/KORTIX-remotion/rules/videos.md +171 -0
- package/opencode/skills/KORTIX-secrets/SKILL.md +280 -0
- package/opencode/skills/KORTIX-semantic-search/SKILL.md +213 -0
- package/opencode/skills/KORTIX-session-search/SKILL.md +807 -0
- package/opencode/skills/KORTIX-session-search/Untitled +1 -0
- package/opencode/skills/KORTIX-skill-creator/SKILL.md +163 -0
- package/opencode/skills/KORTIX-web-research/SKILL.md +69 -0
- package/opencode/skills/KORTIX-xlsx/LICENSE.txt +30 -0
- package/opencode/skills/KORTIX-xlsx/SKILL.md +549 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/helpers/__init__.py +0 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/helpers/merge_runs.py +199 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/helpers/simplify_redlines.py +197 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/pack.py +159 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/soffice.py +183 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/unpack.py +132 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/validate.py +111 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/validators/__init__.py +15 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/validators/base.py +847 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/validators/docx.py +446 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/validators/pptx.py +275 -0
- package/opencode/skills/KORTIX-xlsx/scripts/office/validators/redlining.py +247 -0
- package/opencode/skills/KORTIX-xlsx/scripts/recalc.py +184 -0
- package/opencode/tools/image-gen.ts +342 -0
- package/opencode/tools/image-search.ts +190 -0
- package/opencode/tools/memory-get.ts +168 -0
- package/opencode/tools/memory-search.ts +247 -0
- package/opencode/tools/presentation-gen.ts +723 -0
- package/opencode/tools/scrape-webpage.ts +115 -0
- package/opencode/tools/scripts/.python-version +1 -0
- package/opencode/tools/scripts/convert_pdf.py +184 -0
- package/opencode/tools/scripts/convert_pptx.py +562 -0
- package/opencode/tools/scripts/pyproject.toml +11 -0
- package/opencode/tools/scripts/uv.lock +287 -0
- package/opencode/tools/scripts/validate_slide.py +74 -0
- package/opencode/tools/show-user.ts +217 -0
- package/opencode/tools/tests/e2e-presentation-fix.ts +277 -0
- package/opencode/tools/tests/image-gen.test.ts +215 -0
- package/opencode/tools/tests/image-search.test.ts +125 -0
- package/opencode/tools/tests/memory-system-benchmark.ts +1076 -0
- package/opencode/tools/tests/presentation-gen.test.ts +389 -0
- package/opencode/tools/tests/scrape-webpage.test.ts +74 -0
- package/opencode/tools/tests/show-user.test.ts +241 -0
- package/opencode/tools/tests/video-gen.test.ts +110 -0
- package/opencode/tools/tests/web-search.test.ts +106 -0
- package/opencode/tools/video-gen.ts +200 -0
- package/opencode/tools/web-search.ts +153 -0
- package/opencode/tsconfig.json +29 -0
- package/package.json +36 -0
- package/patch-agent-browser.js +100 -0
- package/postinstall.sh +88 -0
- package/services/KORTIX-presentation-viewer/run +37 -0
- package/services/agent-browser-viewer/run +48 -0
- package/services/kortix-master/run +16 -0
- package/services/lss-sync/run +22 -0
- package/services/opencode-serve/run +25 -0
- package/services/opencode-web/run +21 -0
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kortix-browser
|
|
3
|
+
description: "Browser automation skill using agent-browser CLI. Use when the agent needs to interact with web pages — navigating, clicking, filling forms, extracting data, taking screenshots, testing web UIs, scraping dynamic content, or performing any end-to-end browser automation. Triggers on: 'open this page', 'click the button', 'fill the form', 'test the login flow', 'scrape this site', 'take a screenshot', 'check if the page works', 'automate the browser', 'e2e test', any task requiring a real browser with JavaScript execution."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Browser Automation
|
|
7
|
+
|
|
8
|
+
Full browser control via the `agent-browser` CLI. This gives you a real Chromium instance you can drive end-to-end — navigate, click, type, screenshot, extract data, wait for elements, handle tabs, cookies, network interception, and more.
|
|
9
|
+
|
|
10
|
+
## Environment
|
|
11
|
+
|
|
12
|
+
The system Chromium is pre-configured. No setup needed.
|
|
13
|
+
|
|
14
|
+
**IMPORTANT: Always use `--session` with a unique name.** Never run bare `agent-browser` commands without a session. This prevents conflicts when multiple agents browse concurrently.
|
|
15
|
+
|
|
16
|
+
- **`--session kortix`** — The primary shared session. Has a persistent profile (cookies, logins survive restarts). Streams on port 9223. The human watches this via the Browser Viewer at `http://localhost:9224`.
|
|
17
|
+
- **`--session <any-other-name>`** — Ephemeral sessions. Fresh browser, no cookies, no profile lock conflicts. Each gets its own stream port. Use for parallel/throwaway work.
|
|
18
|
+
|
|
19
|
+
## Core Workflow
|
|
20
|
+
|
|
21
|
+
**ALWAYS use `--session` on every command:**
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# 1. Navigate to page (primary session — persistent, human can see it)
|
|
25
|
+
agent-browser --session kortix open https://example.com
|
|
26
|
+
|
|
27
|
+
# 2. Get accessibility tree with element refs
|
|
28
|
+
agent-browser --session kortix snapshot -i
|
|
29
|
+
|
|
30
|
+
# 3. Interact using refs from snapshot
|
|
31
|
+
agent-browser --session kortix click @e2
|
|
32
|
+
agent-browser --session kortix fill @e3 "text"
|
|
33
|
+
|
|
34
|
+
# 4. Re-snapshot after page changes
|
|
35
|
+
agent-browser --session kortix snapshot -i
|
|
36
|
+
|
|
37
|
+
# 5. When done (only close if you're done with this task — the human might be using it)
|
|
38
|
+
agent-browser --session kortix close
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**For throwaway/parallel work, use a descriptive session name:**
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Name sessions after what they DO — short, lowercase, hyphenated
|
|
45
|
+
agent-browser --session scrape-pricing open https://example.com/pricing
|
|
46
|
+
agent-browser --session scrape-pricing snapshot -i
|
|
47
|
+
agent-browser --session scrape-pricing close
|
|
48
|
+
|
|
49
|
+
agent-browser --session test-login open https://app.example.com/login
|
|
50
|
+
agent-browser --session check-docs open https://docs.example.com
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Session naming rules:**
|
|
54
|
+
- **Descriptive** — Name after the task: `scrape-pricing`, `login-github`, `test-checkout`, `read-docs`
|
|
55
|
+
- **Short** — 2-4 words max, hyphenated: `fill-survey`, `compare-plans`, NOT `task-1738900000`
|
|
56
|
+
- **Lowercase** — Always lowercase, no spaces: `search-flights` not `Search Flights`
|
|
57
|
+
- **No timestamps** — Never use `task-$(date +%s)` or random IDs. The human sees these in the Browser Viewer tabs and needs to know what each session is doing at a glance.
|
|
58
|
+
- **Unique per concurrent run** — If running two scrapers in parallel, differentiate: `scrape-site-a`, `scrape-site-b`
|
|
59
|
+
|
|
60
|
+
**Why refs?** The `snapshot` command returns an accessibility tree where every interactive element has a ref like `@e1`, `@e2`. Using refs is deterministic and fast — no fragile CSS selectors needed.
|
|
61
|
+
|
|
62
|
+
## Command Reference
|
|
63
|
+
|
|
64
|
+
### Navigation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
agent-browser open <url> # Navigate to URL
|
|
68
|
+
agent-browser back # Go back
|
|
69
|
+
agent-browser forward # Go forward
|
|
70
|
+
agent-browser reload # Reload page
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Interaction
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
agent-browser click <sel> # Click element
|
|
77
|
+
agent-browser dblclick <sel> # Double-click
|
|
78
|
+
agent-browser fill <sel> <text> # Clear and fill input
|
|
79
|
+
agent-browser type <sel> <text> # Type into element (appends)
|
|
80
|
+
agent-browser press <key> # Press key (Enter, Tab, Control+a)
|
|
81
|
+
agent-browser hover <sel> # Hover element
|
|
82
|
+
agent-browser select <sel> <val> # Select dropdown option
|
|
83
|
+
agent-browser check <sel> # Check checkbox
|
|
84
|
+
agent-browser uncheck <sel> # Uncheck checkbox
|
|
85
|
+
agent-browser scroll <dir> [px] # Scroll (up/down/left/right)
|
|
86
|
+
agent-browser upload <sel> <files> # Upload files
|
|
87
|
+
agent-browser drag <src> <tgt> # Drag and drop
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Snapshot (AI-Optimized)
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
agent-browser snapshot # Full accessibility tree with refs
|
|
94
|
+
agent-browser snapshot -i # Interactive elements only (recommended)
|
|
95
|
+
agent-browser snapshot -i -C # Include cursor-interactive elements (onclick divs)
|
|
96
|
+
agent-browser snapshot -c # Compact (remove empty structural nodes)
|
|
97
|
+
agent-browser snapshot -d 3 # Limit depth to 3 levels
|
|
98
|
+
agent-browser snapshot -s "#main" # Scope to CSS selector
|
|
99
|
+
agent-browser snapshot -i -c -d 5 # Combine options
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Flags:**
|
|
103
|
+
| Flag | Description |
|
|
104
|
+
|------|-------------|
|
|
105
|
+
| `-i, --interactive` | Only interactive elements (buttons, links, inputs) |
|
|
106
|
+
| `-C, --cursor` | Include cursor-interactive elements (cursor:pointer, onclick) |
|
|
107
|
+
| `-c, --compact` | Remove empty structural elements |
|
|
108
|
+
| `-d, --depth <n>` | Limit tree depth |
|
|
109
|
+
| `-s, --selector <sel>` | Scope to CSS selector |
|
|
110
|
+
|
|
111
|
+
The `-C` flag is essential for modern web apps that use custom clickable divs/spans instead of semantic buttons/links.
|
|
112
|
+
|
|
113
|
+
### Extract Information
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
agent-browser get text <sel> # Get text content
|
|
117
|
+
agent-browser get html <sel> # Get innerHTML
|
|
118
|
+
agent-browser get value <sel> # Get input value
|
|
119
|
+
agent-browser get attr <sel> <attr> # Get attribute
|
|
120
|
+
agent-browser get title # Get page title
|
|
121
|
+
agent-browser get url # Get current URL
|
|
122
|
+
agent-browser get count <sel> # Count matching elements
|
|
123
|
+
agent-browser get box <sel> # Get bounding box
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Check State
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
agent-browser is visible <sel> # Check if visible
|
|
130
|
+
agent-browser is enabled <sel> # Check if enabled
|
|
131
|
+
agent-browser is checked <sel> # Check if checked
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Screenshots & PDF
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
agent-browser screenshot [path] # Take screenshot (temp dir if no path)
|
|
138
|
+
agent-browser screenshot --full # Full page screenshot
|
|
139
|
+
agent-browser pdf <path> # Save page as PDF
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Wait
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
agent-browser wait <selector> # Wait for element visible
|
|
146
|
+
agent-browser wait <ms> # Wait milliseconds
|
|
147
|
+
agent-browser wait --text "Welcome" # Wait for text to appear
|
|
148
|
+
agent-browser wait --url "**/dash" # Wait for URL pattern
|
|
149
|
+
agent-browser wait --load networkidle # Wait for network idle
|
|
150
|
+
agent-browser wait --fn "window.ready === true" # Wait for JS condition
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### JavaScript Evaluation
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
agent-browser eval "<js>" # Run JavaScript in page
|
|
157
|
+
agent-browser eval "<js>" -b # Base64-encode the JS
|
|
158
|
+
agent-browser eval --stdin # Read JS from stdin
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Semantic Locators (Alternative to Refs)
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
agent-browser find role button click --name "Submit"
|
|
165
|
+
agent-browser find text "Sign In" click
|
|
166
|
+
agent-browser find label "Email" fill "test@test.com"
|
|
167
|
+
agent-browser find placeholder "Search..." fill "query"
|
|
168
|
+
agent-browser find testid "submit-btn" click
|
|
169
|
+
agent-browser find first ".item" click
|
|
170
|
+
agent-browser find nth 2 "a" text
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Tabs & Frames
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
agent-browser tab # List tabs
|
|
177
|
+
agent-browser tab new [url] # New tab
|
|
178
|
+
agent-browser tab <n> # Switch to tab n
|
|
179
|
+
agent-browser tab close [n] # Close tab
|
|
180
|
+
agent-browser frame <sel> # Switch to iframe
|
|
181
|
+
agent-browser frame main # Back to main frame
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Cookies & Storage
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
agent-browser cookies # Get all cookies
|
|
188
|
+
agent-browser cookies set <name> <val> # Set cookie
|
|
189
|
+
agent-browser cookies clear # Clear cookies
|
|
190
|
+
agent-browser storage local # Get all localStorage
|
|
191
|
+
agent-browser storage local <key> # Get specific key
|
|
192
|
+
agent-browser storage local set <k> <v> # Set value
|
|
193
|
+
agent-browser storage local clear # Clear all
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Network Interception
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
agent-browser network route <url> # Intercept requests
|
|
200
|
+
agent-browser network route <url> --abort # Block requests
|
|
201
|
+
agent-browser network route <url> --body <json> # Mock response
|
|
202
|
+
agent-browser network unroute [url] # Remove routes
|
|
203
|
+
agent-browser network requests # View tracked requests
|
|
204
|
+
agent-browser network requests --filter api # Filter requests
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Browser Settings
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
agent-browser set viewport <w> <h> # Set viewport size
|
|
211
|
+
agent-browser set device <name> # Emulate device ("iPhone 14")
|
|
212
|
+
agent-browser set geo <lat> <lng> # Set geolocation
|
|
213
|
+
agent-browser set offline [on|off] # Toggle offline mode
|
|
214
|
+
agent-browser set headers <json> # Extra HTTP headers
|
|
215
|
+
agent-browser set credentials <u> <p> # HTTP basic auth
|
|
216
|
+
agent-browser set media [dark|light] # Emulate color scheme
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Dialogs
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
agent-browser dialog accept [text] # Accept dialog (with optional prompt text)
|
|
223
|
+
agent-browser dialog dismiss # Dismiss dialog
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Debug
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
agent-browser console # View console messages
|
|
230
|
+
agent-browser console --clear # Clear console
|
|
231
|
+
agent-browser errors # View page errors (uncaught exceptions)
|
|
232
|
+
agent-browser errors --clear # Clear errors
|
|
233
|
+
agent-browser highlight <sel> # Highlight element visually
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Sessions & Parallel Browsing
|
|
237
|
+
|
|
238
|
+
**Every `--session` name must be unique across concurrent runs.** This prevents Chromium profile lock conflicts.
|
|
239
|
+
|
|
240
|
+
**Two types of sessions:**
|
|
241
|
+
|
|
242
|
+
| Session | Name | Profile | Stream Port | Human Visible | Use For |
|
|
243
|
+
|---------|------|---------|-------------|---------------|---------|
|
|
244
|
+
| Primary | `kortix` | Persistent (`/workspace/.browser-profile`) | 9223 | Yes (viewer) | Authenticated work, human-shared browsing |
|
|
245
|
+
| Ephemeral | Any other name | None (fresh) | Auto-assigned | Yes (viewer tabs) | Parallel scraping, testing, throwaway tasks |
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Primary session — persistent profile, human watches at localhost:9224
|
|
249
|
+
agent-browser --session kortix open https://example.com
|
|
250
|
+
|
|
251
|
+
# Ephemeral sessions — descriptive names, parallel-safe, no conflicts
|
|
252
|
+
agent-browser --session scrape-products open https://site-a.com/products
|
|
253
|
+
agent-browser --session test-signup open https://site-b.com/signup
|
|
254
|
+
|
|
255
|
+
# Each session is fully isolated — its own cookies, storage, history
|
|
256
|
+
agent-browser --session scrape-products snapshot -i
|
|
257
|
+
agent-browser --session test-signup click @e3
|
|
258
|
+
|
|
259
|
+
# List active sessions
|
|
260
|
+
agent-browser session list
|
|
261
|
+
|
|
262
|
+
# ALWAYS close ephemeral sessions when done — frees resources and declutters the viewer
|
|
263
|
+
agent-browser --session scrape-products close
|
|
264
|
+
agent-browser --session test-signup close
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Key rules:**
|
|
268
|
+
- **Always use `--session`** on every command — never run bare `agent-browser` without it
|
|
269
|
+
- **`--session kortix`** is the only session with persistent cookies/logins
|
|
270
|
+
- All other session names are ephemeral — fresh browser, no cookies
|
|
271
|
+
- **Name sessions descriptively** — the human sees these as tabs in the Browser Viewer. `scrape-pricing` is useful; `task-1738900000` is not.
|
|
272
|
+
- Each session gets its own stream port, visible in the Browser Viewer tabs
|
|
273
|
+
- Multiple ephemeral sessions can run in parallel without issues
|
|
274
|
+
- **Always close ephemeral sessions when done** — `agent-browser --session <name> close`. This frees memory and removes clutter from the viewer. Never leave sessions open after your task is complete.
|
|
275
|
+
|
|
276
|
+
### Authentication & Login
|
|
277
|
+
|
|
278
|
+
**Primary session `kortix` (persistent — preferred for authenticated work):**
|
|
279
|
+
|
|
280
|
+
The `kortix` session persists all login state. Login once via the agent or have the human login via the Browser Viewer at `http://localhost:9224`. Cookies survive forever.
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
# Agent logs in (persists in profile)
|
|
284
|
+
agent-browser --session kortix open https://app.example.com/login
|
|
285
|
+
agent-browser --session kortix snapshot -i
|
|
286
|
+
agent-browser --session kortix fill @e1 "user@example.com"
|
|
287
|
+
agent-browser --session kortix fill @e2 "password123"
|
|
288
|
+
agent-browser --session kortix click @e3
|
|
289
|
+
agent-browser --session kortix wait --load networkidle
|
|
290
|
+
# Done — login persists across restarts
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
**Human-assisted login (for OAuth, 2FA, CAPTCHAs):**
|
|
294
|
+
|
|
295
|
+
When the agent can't handle a login flow (OAuth redirects, 2FA, CAPTCHA), instruct the human:
|
|
296
|
+
|
|
297
|
+
1. Tell the user: "Please open http://localhost:9224 and log into [service name]. I'll navigate to the login page for you."
|
|
298
|
+
2. Navigate: `agent-browser --session kortix open https://service.com/login`
|
|
299
|
+
3. The human completes the login in the Browser Viewer (clicking, typing, solving CAPTCHAs)
|
|
300
|
+
4. Once logged in, the agent continues: `agent-browser --session kortix snapshot -i` to verify
|
|
301
|
+
5. The login persists in the profile — the agent can use it from now on
|
|
302
|
+
|
|
303
|
+
**Sharing auth with ephemeral sessions:**
|
|
304
|
+
|
|
305
|
+
Ephemeral sessions don't have the persistent profile, but you can copy auth state:
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Save auth state from primary session
|
|
309
|
+
agent-browser --session kortix state save /workspace/.browser-auth.json
|
|
310
|
+
|
|
311
|
+
# Load it into an ephemeral session
|
|
312
|
+
agent-browser --session worker-$(date +%s) state load /workspace/.browser-auth.json
|
|
313
|
+
agent-browser --session worker-1234 open https://app.example.com/dashboard
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
**API token auth (no login needed):**
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
# Set auth headers scoped to origin (not leaked to other domains)
|
|
320
|
+
agent-browser --session kortix open api.example.com --headers '{"Authorization": "Bearer <token>"}'
|
|
321
|
+
|
|
322
|
+
# Works with ephemeral sessions too
|
|
323
|
+
agent-browser --session api-task-$(date +%s) open api.example.com --headers '{"Authorization": "Bearer <token>"}'
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### JSON Output (Machine-Readable)
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
agent-browser snapshot --json # JSON accessibility tree
|
|
330
|
+
agent-browser get text @e1 --json # JSON text content
|
|
331
|
+
agent-browser is visible @e2 --json # JSON boolean
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
## Selector Types
|
|
335
|
+
|
|
336
|
+
In order of preference:
|
|
337
|
+
|
|
338
|
+
1. **Refs** (best) — `@e1`, `@e2` from snapshot output. Deterministic, fast.
|
|
339
|
+
2. **CSS selectors** — `"#id"`, `".class"`, `"div > button"`
|
|
340
|
+
3. **Text selectors** — `"text=Submit"`
|
|
341
|
+
4. **XPath** — `"xpath=//button[@type='submit']"`
|
|
342
|
+
5. **Semantic locators** — `find role button click --name "Submit"`
|
|
343
|
+
|
|
344
|
+
Always prefer refs from snapshot. Fall back to CSS/text only when refs are unavailable.
|
|
345
|
+
|
|
346
|
+
## Common Patterns
|
|
347
|
+
|
|
348
|
+
### Login Flow
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
agent-browser open https://app.example.com/login
|
|
352
|
+
agent-browser snapshot -i
|
|
353
|
+
# Output shows: textbox "Email" [ref=e1], textbox "Password" [ref=e2], button "Sign In" [ref=e3]
|
|
354
|
+
agent-browser fill @e1 "user@example.com"
|
|
355
|
+
agent-browser fill @e2 "password123"
|
|
356
|
+
agent-browser click @e3
|
|
357
|
+
agent-browser wait --load networkidle
|
|
358
|
+
agent-browser snapshot -i
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### Form Submission
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
agent-browser open https://example.com/form
|
|
365
|
+
agent-browser snapshot -i
|
|
366
|
+
agent-browser fill @e1 "John Doe"
|
|
367
|
+
agent-browser fill @e2 "john@example.com"
|
|
368
|
+
agent-browser select @e3 "premium"
|
|
369
|
+
agent-browser check @e4
|
|
370
|
+
agent-browser click @e5
|
|
371
|
+
agent-browser wait --text "Thank you"
|
|
372
|
+
agent-browser screenshot confirmation.png
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Data Extraction / Scraping
|
|
376
|
+
|
|
377
|
+
```bash
|
|
378
|
+
agent-browser open https://example.com/products
|
|
379
|
+
agent-browser snapshot -c
|
|
380
|
+
agent-browser eval "JSON.stringify([...document.querySelectorAll('.product')].map(p => ({name: p.querySelector('h2').textContent, price: p.querySelector('.price').textContent})))"
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### E2E Testing
|
|
384
|
+
|
|
385
|
+
```bash
|
|
386
|
+
agent-browser open http://localhost:3000
|
|
387
|
+
agent-browser snapshot -i
|
|
388
|
+
agent-browser click @e1 # Click nav link
|
|
389
|
+
agent-browser wait --load networkidle
|
|
390
|
+
agent-browser get url # Verify URL changed
|
|
391
|
+
agent-browser get text @e2 # Verify content
|
|
392
|
+
agent-browser screenshot test-result.png
|
|
393
|
+
agent-browser close
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Screenshot for Visual Verification
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
agent-browser open https://example.com
|
|
400
|
+
agent-browser wait --load networkidle
|
|
401
|
+
agent-browser screenshot page.png
|
|
402
|
+
agent-browser screenshot --full full-page.png
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
### Working with SPAs (Single Page Apps)
|
|
406
|
+
|
|
407
|
+
```bash
|
|
408
|
+
agent-browser open https://spa-app.com
|
|
409
|
+
agent-browser wait --load networkidle
|
|
410
|
+
agent-browser snapshot -i -C # -C catches onclick divs
|
|
411
|
+
agent-browser click @e5
|
|
412
|
+
agent-browser wait --fn "document.querySelector('.loaded') !== null"
|
|
413
|
+
agent-browser snapshot -i -C
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Network Monitoring
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
agent-browser open https://example.com
|
|
420
|
+
agent-browser network requests --filter api
|
|
421
|
+
# See all API calls the page made
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### Mobile Device Emulation
|
|
425
|
+
|
|
426
|
+
```bash
|
|
427
|
+
agent-browser set device "iPhone 14"
|
|
428
|
+
agent-browser open https://example.com
|
|
429
|
+
agent-browser screenshot mobile.png
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
## Browser Viewer & Live Streaming
|
|
433
|
+
|
|
434
|
+
The human can watch and interact with the browser at **http://localhost:9224** (Browser Viewer).
|
|
435
|
+
|
|
436
|
+
**Features:**
|
|
437
|
+
- **Session tabs** — Switch between all active sessions (default + named). Each session streams on its own port.
|
|
438
|
+
- **Live viewport** — See exactly what the agent sees in real-time
|
|
439
|
+
- **Input injection** — Click, type, scroll directly in the viewer. Events are forwarded to the browser.
|
|
440
|
+
- **Pair browsing** — Human and agent work on the same page simultaneously
|
|
441
|
+
|
|
442
|
+
**When to direct the human to the viewer:**
|
|
443
|
+
- OAuth/SSO login flows the agent can't handle
|
|
444
|
+
- CAPTCHA solving
|
|
445
|
+
- 2FA verification
|
|
446
|
+
- Visual confirmation ("does this look right?")
|
|
447
|
+
- Any task requiring human judgment on visual layout
|
|
448
|
+
|
|
449
|
+
**Link directly to the right session** — use the `?session=` URL parameter:
|
|
450
|
+
```
|
|
451
|
+
http://localhost:9224?session=kortix ← primary session
|
|
452
|
+
http://localhost:9224?session=login-github ← specific ephemeral session
|
|
453
|
+
```
|
|
454
|
+
Always include the `?session=` parameter when telling the human to check the viewer, so they land on the correct tab immediately.
|
|
455
|
+
|
|
456
|
+
**WebSocket protocol** (for programmatic access):
|
|
457
|
+
- Default session stream: `ws://localhost:9223`
|
|
458
|
+
- Named session streams: auto-assigned ports (check `/workspace/.agent-browser/<session>.stream`)
|
|
459
|
+
- Frame format: `{"type": "frame", "data": "<base64-jpeg>", "metadata": {...}}`
|
|
460
|
+
- Input format: `{"type": "input_mouse", "eventType": "mousePressed", "x": 100, "y": 200, ...}`
|
|
461
|
+
|
|
462
|
+
## Tips
|
|
463
|
+
|
|
464
|
+
1. **Always snapshot after navigation or clicks** — The page state changes; refs become stale.
|
|
465
|
+
2. **Use `-i` flag on snapshots** — Reduces noise by showing only interactive elements.
|
|
466
|
+
3. **Use `-C` with modern apps** — Many apps use custom clickable elements that `-i` alone misses.
|
|
467
|
+
4. **Use `--json` for structured data** — When parsing output programmatically.
|
|
468
|
+
5. **Use `wait` before interacting** — Ensure elements are loaded before clicking.
|
|
469
|
+
6. **Use default session for authenticated work** — It has the persistent profile with all logins.
|
|
470
|
+
7. **Use named sessions for parallel work** — `--session scraper`, `--session tester` etc. Ephemeral, no profile conflicts.
|
|
471
|
+
8. **Direct human to viewer for complex logins** — OAuth, 2FA, CAPTCHAs → tell user to open `http://localhost:9224`.
|
|
472
|
+
9. **Save auth state for named sessions** — `state save` from default, `state load` into named sessions.
|
|
473
|
+
10. **Use `eval` for complex extraction** — When snapshot/get isn't enough, run JS directly.
|
|
474
|
+
11. **Close ephemeral sessions when done** — `agent-browser --session name close` frees resources and removes the tab from the viewer. The primary `kortix` session stays open.
|
|
475
|
+
12. **Check `errors` and `console`** — When debugging page issues.
|
|
476
|
+
13. **Never close the `kortix` session unless intentional** — It's the shared browser the human sees.
|
|
477
|
+
14. **Link to the right session** — When telling the human to check the viewer, always use `http://localhost:9224?session=<name>` so they land on the correct tab.
|
|
478
|
+
15. **Name sessions for the human** — The human sees session names as tabs. Use descriptive names like `login-stripe`, `debug-api`, `fill-form` — never random IDs or timestamps.
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kortix-cron-triggers
|
|
3
|
+
description: "Cron trigger management for scheduled agent execution. Use when the user wants to: schedule recurring tasks, set up cron jobs, create timed triggers, automate agent execution on a schedule, manage periodic tasks, view scheduled task history, check execution logs. Triggers on: 'schedule this', 'run every', 'cron job', 'every morning at', 'daily task', 'recurring', 'set a timer for', 'automate this on a schedule', 'trigger at', 'run periodically', 'scheduled trigger', 'timed trigger', 'cron trigger'."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Cron Trigger Service
|
|
7
|
+
|
|
8
|
+
The Kortix Cron service runs outside the sandbox as a platform service. It manages scheduled triggers that fire agents inside sandboxes on cron schedules.
|
|
9
|
+
|
|
10
|
+
## Architecture
|
|
11
|
+
|
|
12
|
+
- **Service**: `kortix-cron` (Bun + Hono) running at port 8011
|
|
13
|
+
- **Database**: `kortix_cron` schema in Supabase PostgreSQL (Drizzle ORM)
|
|
14
|
+
- **Scheduler**: Polling loop (1s tick) that checks for due triggers
|
|
15
|
+
- **Executor**: Calls OpenCode API inside sandbox to create sessions and send prompts
|
|
16
|
+
|
|
17
|
+
## Cron Expression Format
|
|
18
|
+
|
|
19
|
+
6-field extended cron with seconds support:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
┌──────── second (0-59)
|
|
23
|
+
│ ┌────── minute (0-59)
|
|
24
|
+
│ │ ┌──── hour (0-23)
|
|
25
|
+
│ │ │ ┌── day of month (1-31)
|
|
26
|
+
│ │ │ │ ┌ month (1-12 or JAN-DEC)
|
|
27
|
+
│ │ │ │ │ ┌ day of week (0-7 or SUN-SAT, 0 and 7 are Sunday)
|
|
28
|
+
│ │ │ │ │ │
|
|
29
|
+
* * * * * *
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Common Patterns
|
|
33
|
+
|
|
34
|
+
| Pattern | Expression |
|
|
35
|
+
|---------|-----------|
|
|
36
|
+
| Every 30 seconds | `*/30 * * * * *` |
|
|
37
|
+
| Every 5 minutes | `0 */5 * * * *` |
|
|
38
|
+
| Every hour | `0 0 * * * *` |
|
|
39
|
+
| Daily at 9:00 AM | `0 0 9 * * *` |
|
|
40
|
+
| Daily at midnight | `0 0 0 * * *` |
|
|
41
|
+
| Every Monday at 8 AM | `0 0 8 * * 1` |
|
|
42
|
+
| First of month at noon | `0 0 12 1 * *` |
|
|
43
|
+
| Weekdays at 6 PM | `0 0 18 * * 1-5` |
|
|
44
|
+
|
|
45
|
+
## API Reference
|
|
46
|
+
|
|
47
|
+
Base URL: `http://localhost:8011` (local) or the deployed service URL.
|
|
48
|
+
|
|
49
|
+
All `/v1/*` endpoints require `Authorization: Bearer <supabase-jwt>`.
|
|
50
|
+
|
|
51
|
+
### Sandbox Management
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Register a sandbox
|
|
55
|
+
curl -X POST http://localhost:8011/v1/sandboxes \
|
|
56
|
+
-H "Authorization: Bearer $TOKEN" \
|
|
57
|
+
-H "Content-Type: application/json" \
|
|
58
|
+
-d '{
|
|
59
|
+
"name": "My Local Sandbox",
|
|
60
|
+
"base_url": "http://localhost:8000",
|
|
61
|
+
"auth_token": "user:password"
|
|
62
|
+
}'
|
|
63
|
+
|
|
64
|
+
# List sandboxes
|
|
65
|
+
curl http://localhost:8011/v1/sandboxes \
|
|
66
|
+
-H "Authorization: Bearer $TOKEN"
|
|
67
|
+
|
|
68
|
+
# Check sandbox health
|
|
69
|
+
curl -X POST http://localhost:8011/v1/sandboxes/{id}/health \
|
|
70
|
+
-H "Authorization: Bearer $TOKEN"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Trigger Management
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Create a trigger - daily report at 9 AM UTC
|
|
77
|
+
curl -X POST http://localhost:8011/v1/triggers \
|
|
78
|
+
-H "Authorization: Bearer $TOKEN" \
|
|
79
|
+
-H "Content-Type: application/json" \
|
|
80
|
+
-d '{
|
|
81
|
+
"sandbox_id": "uuid-of-sandbox",
|
|
82
|
+
"name": "Daily Report",
|
|
83
|
+
"cron_expr": "0 0 9 * * *",
|
|
84
|
+
"timezone": "UTC",
|
|
85
|
+
"agent_name": "@kortix-main",
|
|
86
|
+
"prompt": "Generate the daily status report and save it to /workspace/reports/",
|
|
87
|
+
"session_mode": "new"
|
|
88
|
+
}'
|
|
89
|
+
|
|
90
|
+
# Create a trigger - every 5 minutes health check
|
|
91
|
+
curl -X POST http://localhost:8011/v1/triggers \
|
|
92
|
+
-H "Authorization: Bearer $TOKEN" \
|
|
93
|
+
-H "Content-Type: application/json" \
|
|
94
|
+
-d '{
|
|
95
|
+
"sandbox_id": "uuid-of-sandbox",
|
|
96
|
+
"name": "Health Monitor",
|
|
97
|
+
"cron_expr": "0 */5 * * * *",
|
|
98
|
+
"prompt": "Check system health and report any issues",
|
|
99
|
+
"session_mode": "new",
|
|
100
|
+
"timeout_ms": 60000
|
|
101
|
+
}'
|
|
102
|
+
|
|
103
|
+
# List triggers
|
|
104
|
+
curl http://localhost:8011/v1/triggers \
|
|
105
|
+
-H "Authorization: Bearer $TOKEN"
|
|
106
|
+
|
|
107
|
+
# Pause a trigger
|
|
108
|
+
curl -X POST http://localhost:8011/v1/triggers/{id}/pause \
|
|
109
|
+
-H "Authorization: Bearer $TOKEN"
|
|
110
|
+
|
|
111
|
+
# Resume a trigger
|
|
112
|
+
curl -X POST http://localhost:8011/v1/triggers/{id}/resume \
|
|
113
|
+
-H "Authorization: Bearer $TOKEN"
|
|
114
|
+
|
|
115
|
+
# Fire a trigger immediately (manual run)
|
|
116
|
+
curl -X POST http://localhost:8011/v1/triggers/{id}/run \
|
|
117
|
+
-H "Authorization: Bearer $TOKEN"
|
|
118
|
+
|
|
119
|
+
# Delete a trigger
|
|
120
|
+
curl -X DELETE http://localhost:8011/v1/triggers/{id} \
|
|
121
|
+
-H "Authorization: Bearer $TOKEN"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Execution History
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# List all executions
|
|
128
|
+
curl "http://localhost:8011/v1/executions?limit=20" \
|
|
129
|
+
-H "Authorization: Bearer $TOKEN"
|
|
130
|
+
|
|
131
|
+
# Filter by status
|
|
132
|
+
curl "http://localhost:8011/v1/executions?status=failed" \
|
|
133
|
+
-H "Authorization: Bearer $TOKEN"
|
|
134
|
+
|
|
135
|
+
# Filter by date range
|
|
136
|
+
curl "http://localhost:8011/v1/executions?since=2026-02-01T00:00:00Z&until=2026-02-11T00:00:00Z" \
|
|
137
|
+
-H "Authorization: Bearer $TOKEN"
|
|
138
|
+
|
|
139
|
+
# Executions for a specific trigger
|
|
140
|
+
curl http://localhost:8011/v1/executions/by-trigger/{triggerId} \
|
|
141
|
+
-H "Authorization: Bearer $TOKEN"
|
|
142
|
+
|
|
143
|
+
# Get execution details
|
|
144
|
+
curl http://localhost:8011/v1/executions/{id} \
|
|
145
|
+
-H "Authorization: Bearer $TOKEN"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Health Check (no auth)
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
curl http://localhost:8011/health
|
|
152
|
+
# Returns: { status, service, timestamp, scheduler: { running, tickCount, lastTick } }
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Session Modes
|
|
156
|
+
|
|
157
|
+
- **`new`** (default): Creates a fresh OpenCode session for each trigger execution. Best for independent tasks.
|
|
158
|
+
- **`reuse`**: Sends prompt to an existing session (specified by `session_id`). Best for ongoing monitoring or conversations that need context continuity.
|
|
159
|
+
|
|
160
|
+
## Trigger Properties
|
|
161
|
+
|
|
162
|
+
| Field | Required | Description |
|
|
163
|
+
|-------|----------|-------------|
|
|
164
|
+
| `sandbox_id` | Yes | UUID of the target sandbox |
|
|
165
|
+
| `name` | Yes | Human-readable trigger name |
|
|
166
|
+
| `cron_expr` | Yes | 6-field cron expression |
|
|
167
|
+
| `prompt` | Yes | The prompt to send to the agent |
|
|
168
|
+
| `timezone` | No | IANA timezone (default: UTC) |
|
|
169
|
+
| `agent_name` | No | Target agent (e.g., `@kortix-main`) |
|
|
170
|
+
| `session_mode` | No | `new` or `reuse` (default: `new`) |
|
|
171
|
+
| `session_id` | No | Session ID for `reuse` mode |
|
|
172
|
+
| `max_retries` | No | 0-10 (default: 0) |
|
|
173
|
+
| `timeout_ms` | No | 1000-3600000 ms (default: 300000) |
|