[PR #6] [CLOSED] feat: add LLM prompt step type for hybrid workflows #7

Closed
opened 2026-02-15 18:15:38 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/openclaw/lobster/pull/6
Author: @Cluka-399
Created: 2/4/2026
Status: Closed

Base: mainHead: feat/llm-prompt-step


📝 Commits (3)

  • a33a030 feat: add LLM prompt step type for hybrid workflows
  • 040ac26 fix: address PR review issues for LLM prompt step
  • b504f61 chore: remove package-lock.json

📊 Changes

5 files changed (+508 additions, -13 deletions)

View changed files

examples/x-audio-brief.lobster (+29 -0)
📝 src/cli.ts (+65 -2)
📝 src/resume.ts (+21 -3)
📝 src/workflows/file.ts (+83 -8)
test/llm_prompt_step.test.ts (+310 -0)

📄 Description

Summary

Adds a prompt step type that delegates LLM calls to the calling agent via halt/resume — the same pattern as approve.

How it works

  1. Lobster runs deterministic shell steps
  2. Hits a prompt step → halts
  3. Returns status: needs_llm with the prompt, system prompt, context, and resume token
  4. Agent fulfills the prompt with its own model (Opus, Sonnet, Grok, whatever)
  5. Agent calls lobster resume --token X --llm-response "..."
  6. Lobster continues with remaining steps

No API keys. No HTTP calls. No new dependencies. Uses your existing model.

Example workflow

name: x-audio-brief
steps:
  - id: search
    command: node search-x/scripts/search.js --days 7 "${topic}"
  - id: summarize
    prompt: Summarize these tweets into a 5-minute audio script.
    stdin: $search.stdout
    system: You are a podcast host.

New step fields

Field Type Description
prompt string User prompt (supports $step refs and ${args})
system string? System prompt

A step must have either command OR prompt, never both.

Resume

New CLI flag: --llm-response on the resume command:

lobster resume --token <token> --llm-response "The LLM's response text"

Validation:

  • Missing value → error
  • Empty/whitespace-only → error

Design decisions

  • Reuses the approve halt/resume pattern — no new primitives needed
  • Host-only — the agent's own model handles the prompt (no direct API calls)
  • stdin → context — previous step output becomes context for the prompt
  • Same output contract$step.stdout and $step.json work identically to command steps
  • Zero new dependencies — no HTTP client, no API wrappers
  • Mutual exclusioncommand OR prompt, never both

Tests

57/57 pass (10 new):

  • Validation: prompt-only step, command+prompt rejection, neither rejection
  • Halt: prompt step returns needs_llm with prompt + system + context
  • Resume: LLM response injected, workflow completes
  • Args: ${arg} resolution in prompt templates
  • Multi-prompt: two sequential prompt steps resume correctly through both
  • Edge cases: missing --llm-response value, empty response, whitespace-only response

Files changed

  • src/workflows/file.ts — prompt step type, isPromptStep(), halt/resume logic
  • src/resume.ts--llm-response flag with validation
  • src/cli.tsneeds_llm status handling, writeLlmEnvelope helper
  • test/llm_prompt_step.test.ts — 10 tests
  • examples/x-audio-brief.lobster — example workflow (search + summarize)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/openclaw/lobster/pull/6 **Author:** [@Cluka-399](https://github.com/Cluka-399) **Created:** 2/4/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/llm-prompt-step` --- ### 📝 Commits (3) - [`a33a030`](https://github.com/openclaw/lobster/commit/a33a030213de8797704bfcf187ba4e962caec370) feat: add LLM prompt step type for hybrid workflows - [`040ac26`](https://github.com/openclaw/lobster/commit/040ac261a6fbd2f65fc5c2cd7261c043c3f80888) fix: address PR review issues for LLM prompt step - [`b504f61`](https://github.com/openclaw/lobster/commit/b504f61a3ba37a3b77a7d1a9c8c5894538a0e50c) chore: remove package-lock.json ### 📊 Changes **5 files changed** (+508 additions, -13 deletions) <details> <summary>View changed files</summary> ➕ `examples/x-audio-brief.lobster` (+29 -0) 📝 `src/cli.ts` (+65 -2) 📝 `src/resume.ts` (+21 -3) 📝 `src/workflows/file.ts` (+83 -8) ➕ `test/llm_prompt_step.test.ts` (+310 -0) </details> ### 📄 Description ## Summary Adds a `prompt` step type that delegates LLM calls to the calling agent via halt/resume — the same pattern as `approve`. ## How it works 1. Lobster runs deterministic shell steps 2. Hits a `prompt` step → **halts** 3. Returns `status: needs_llm` with the prompt, system prompt, context, and resume token 4. Agent fulfills the prompt with its own model (Opus, Sonnet, Grok, whatever) 5. Agent calls `lobster resume --token X --llm-response "..."` 6. Lobster continues with remaining steps **No API keys. No HTTP calls. No new dependencies. Uses your existing model.** ## Example workflow ```yaml name: x-audio-brief steps: - id: search command: node search-x/scripts/search.js --days 7 "${topic}" - id: summarize prompt: Summarize these tweets into a 5-minute audio script. stdin: $search.stdout system: You are a podcast host. ``` ## New step fields | Field | Type | Description | |-------|------|-------------| | `prompt` | string | User prompt (supports `$step` refs and `${args}`) | | `system` | string? | System prompt | A step must have either `command` OR `prompt`, never both. ## Resume New CLI flag: `--llm-response` on the resume command: ``` lobster resume --token <token> --llm-response "The LLM's response text" ``` Validation: - Missing value → error - Empty/whitespace-only → error ## Design decisions - **Reuses the `approve` halt/resume pattern** — no new primitives needed - **Host-only** — the agent's own model handles the prompt (no direct API calls) - **stdin → context** — previous step output becomes context for the prompt - **Same output contract** — `$step.stdout` and `$step.json` work identically to command steps - **Zero new dependencies** — no HTTP client, no API wrappers - **Mutual exclusion** — `command` OR `prompt`, never both ## Tests 57/57 pass (10 new): - Validation: prompt-only step, command+prompt rejection, neither rejection - Halt: prompt step returns `needs_llm` with prompt + system + context - Resume: LLM response injected, workflow completes - Args: `${arg}` resolution in prompt templates - Multi-prompt: two sequential prompt steps resume correctly through both - Edge cases: missing `--llm-response` value, empty response, whitespace-only response ## Files changed - `src/workflows/file.ts` — prompt step type, `isPromptStep()`, halt/resume logic - `src/resume.ts` — `--llm-response` flag with validation - `src/cli.ts` — `needs_llm` status handling, `writeLlmEnvelope` helper - `test/llm_prompt_step.test.ts` — 10 tests - `examples/x-audio-brief.lobster` — example workflow (search + summarize) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 18:15:38 -05:00
yindo closed this issue 2026-02-15 18:15:39 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: openclaw/lobster#7