From ae961354d1cc6916f077cf58bdc3253c01c3f101 Mon Sep 17 00:00:00 2001 From: Catherine Jue Date: Sun, 8 Jun 2025 22:08:36 -0400 Subject: [PATCH 1/5] rename to advanced samples --- README.md | 4 +- index.ts | 26 +++--- .../.gitignore | 0 .../README.md | 0 .../main.py | 4 +- .../pyproject.toml | 4 +- .../uv.lock | 0 .../.gitignore | 0 .../README.md | 0 templates/typescript/advanced-sample/index.ts | 56 +++++++++++++ .../package.json | 0 .../pnpm-lock.yaml | 10 +-- .../tsconfig.json | 0 .../typescript/persistent-browser/index.ts | 84 ------------------- templates/typescript/sample-app/index.ts | 4 +- 15 files changed, 82 insertions(+), 110 deletions(-) rename templates/python/{persistent-browser => advanced-sample}/.gitignore (100%) rename templates/python/{persistent-browser => advanced-sample}/README.md (100%) rename templates/python/{persistent-browser => advanced-sample}/main.py (96%) rename templates/python/{persistent-browser => advanced-sample}/pyproject.toml (59%) rename templates/python/{persistent-browser => advanced-sample}/uv.lock (100%) rename templates/typescript/{persistent-browser => advanced-sample}/.gitignore (100%) rename templates/typescript/{persistent-browser => advanced-sample}/README.md (100%) create mode 100644 templates/typescript/advanced-sample/index.ts rename templates/typescript/{persistent-browser => advanced-sample}/package.json (100%) rename templates/typescript/{persistent-browser => advanced-sample}/pnpm-lock.yaml (85%) rename templates/typescript/{persistent-browser => advanced-sample}/tsconfig.json (100%) delete mode 100644 templates/typescript/persistent-browser/index.ts diff --git a/README.md b/README.md index 54e4132..b213c82 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ create-kernel-app [app-name] [options] - `sample-app`: Basic template with Playwright integration - `browser-use`: Template with Browser Use SDK (Python only) - `stagehand`: Template with Stagehand SDK (Typescript only) - - `persistent-browser`: Implements `sample-app` using a persistent browser + - `advanced-sample`: Implements sample apps using advanced Kernel configs - `computer-use`: Implements a prompt loop using Anthropic Computer Use ### Examples @@ -125,7 +125,7 @@ These are the sample apps currently available when you run `npx @onkernel/create | **sample-app** | Returns the page title of a specified URL | Playwright | `{ url }` | | **browser-use** | Completes a specified task | Browser Use | `{ task }` | | **stagehand** | Returns the first result of a specified Google search | Stagehand | `{ query }` | -| **persistent-browser** | Implements `sample-app` using a persistent browser | Playwright | `{ url }` | +| **advanced-sample** | Implements sample apps using advanced Kernel configs | n/a | | **computer-use** | Implements a prompt loop | Anthropic Computer Use API | `{ query }` | ## Documentation diff --git a/index.ts b/index.ts index b1c2420..7d327db 100644 --- a/index.ts +++ b/index.ts @@ -17,7 +17,7 @@ type TemplateKey = | "sample-app" | "browser-use" | "stagehand" - | "persistent-browser" + | "advanced-sample" | "computer-use"; type LanguageInfo = { name: string; shorthand: string }; type TemplateInfo = { @@ -32,7 +32,7 @@ const LANGUAGE_PYTHON = "python"; const TEMPLATE_SAMPLE_APP = "sample-app"; const TEMPLATE_BROWSER_USE = "browser-use"; const TEMPLATE_STAGEHAND = "stagehand"; -const TEMPLATE_PERSISTENT_BROWSER = "persistent-browser"; +const TEMPLATE_ADVANCED_SAMPLE = "advanced-sample"; const TEMPLATE_COMPUTER_USE = "computer-use"; const LANGUAGE_SHORTHAND_TS = "ts"; const LANGUAGE_SHORTHAND_PY = "py"; @@ -62,7 +62,7 @@ const TEMPLATES: Record = { description: "Implements the Stagehand SDK", languages: [LANGUAGE_TYPESCRIPT], }, - [TEMPLATE_PERSISTENT_BROWSER]: { + [TEMPLATE_ADVANCED_SAMPLE]: { name: "Persistent Browser", description: "Implements a persistent browser that maintains state across invocations", @@ -84,8 +84,8 @@ const INVOKE_SAMPLES: Record< 'kernel invoke ts-basic get-page-title --payload \'{"url": "https://www.google.com"}\'', [TEMPLATE_STAGEHAND]: 'kernel invoke ts-stagehand stagehand-task --payload \'{"query": "Best wired earbuds"}\'', - [TEMPLATE_PERSISTENT_BROWSER]: - 'kernel invoke ts-persistent-browser persistent-browser-task --payload \'{"url": "https://news.ycombinator.com/"}\'', + [TEMPLATE_ADVANCED_SAMPLE]: + 'kernel invoke ts-advanced create-persistent-browser', [TEMPLATE_COMPUTER_USE]: 'kernel invoke ts-cu cu-task --payload \'{"query": "Return the first url of a search result for NYC restaurant reviews Pete Wells"}\'', }, @@ -94,8 +94,8 @@ const INVOKE_SAMPLES: Record< 'kernel invoke python-basic get-page-title --payload \'{"url": "https://www.google.com"}\'', [TEMPLATE_BROWSER_USE]: 'kernel invoke python-bu bu-task --payload \'{"task": "Compare the price of gpt-4o and DeepSeek-V3"}\'', - [TEMPLATE_PERSISTENT_BROWSER]: - 'kernel invoke python-persistent-browser persistent-browser-task --payload \'{"url": "https://news.ycombinator.com/"}\'', + [TEMPLATE_ADVANCED_SAMPLE]: + 'kernel invoke python-advanced create-persistent-browser', [TEMPLATE_COMPUTER_USE]: 'kernel invoke python-cu cu-task --payload \'{"query": "Return the first url of a search result for NYC restaurant reviews Pete Wells"}\'', }, @@ -110,8 +110,8 @@ const REGISTERED_APP_NAMES: Record< 'ts-basic', [TEMPLATE_STAGEHAND]: 'ts-stagehand', - [TEMPLATE_PERSISTENT_BROWSER]: - 'ts-persistent-browser', + [TEMPLATE_ADVANCED_SAMPLE]: + 'ts-advanced', [TEMPLATE_COMPUTER_USE]: 'ts-cu', }, @@ -120,8 +120,8 @@ const REGISTERED_APP_NAMES: Record< 'python-basic', [TEMPLATE_BROWSER_USE]: 'python-bu', - [TEMPLATE_PERSISTENT_BROWSER]: - 'python-persistent-browser', + [TEMPLATE_ADVANCED_SAMPLE]: + 'python-advanced', [TEMPLATE_COMPUTER_USE]: 'python-cu', }, @@ -336,7 +336,7 @@ function printNextSteps( ): void { // Determine which sample command to show based on language and template const deployCommand = - language === LANGUAGE_TYPESCRIPT && (template === TEMPLATE_SAMPLE_APP || template === TEMPLATE_PERSISTENT_BROWSER) + language === LANGUAGE_TYPESCRIPT && (template === TEMPLATE_SAMPLE_APP || template === TEMPLATE_ADVANCED_SAMPLE) ? "kernel deploy index.ts" : language === LANGUAGE_TYPESCRIPT && template === TEMPLATE_STAGEHAND ? "kernel deploy index.ts --env OPENAI_API_KEY=XXX" @@ -384,7 +384,7 @@ program ) .option( "-t, --template