Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e24f9ec
fix(forms): a flag that gives a field another way counts as given, so…
Bradenream Dec 1, 2026
bae6212
fix(forms): a file flag's path is checked before any form or request,…
Bradenream Dec 1, 2026
d739d54
feat(document): create-text takes the text itself, typed or piped in,…
Bradenream Dec 1, 2026
be6ac86
fix(home): use project takes an ID or name, says what is wrong with a…
Bradenream Dec 1, 2026
26a1bc0
fix(forms): a write given all it needs runs without "Fill in N option…
Bradenream Dec 1, 2026
f632f3f
fix(output): --strict after a create or a patch never says to run it …
Bradenream Dec 1, 2026
1d0ac57
fix(tool): refuse a captureInputVariables entry keyed by an input's name
Bradenream Dec 1, 2026
ad2124b
fix(scripting): a JSON flag whose keys were all dropped sends nothing…
Bradenream Dec 1, 2026
3614665
fix(output): a patch at a terminal ends with a ✓ line, the lines it c…
Bradenream Dec 1, 2026
216a4ec
fix(session): a send at a terminal says how to go on in the session a…
Bradenream Dec 1, 2026
05866e4
fix(session): end's Next reads the transcript, then scores it with an…
Bradenream Dec 1, 2026
aeec351
fix(session): a turn that runs an edit says so, and that earlier repl…
Bradenream Dec 1, 2026
95289ce
fix(session): Ctrl-C during a chat turn in a shell stops the turn, no…
Bradenream Dec 1, 2026
dd1c9a8
fix(session): the chat's lines break between words, and its footer fits
Bradenream Dec 1, 2026
b909c15
fix(home): "chat", "talk" and "conversation" select session start, an…
Bradenream Dec 1, 2026
500160f
docs(session): the compile rule names the clients a compile changes, …
Bradenream Dec 1, 2026
e73be4e
fix(session): run-script's answer says session, and a reused -s start…
Bradenream Dec 1, 2026
2cf1e47
fix(session): a deleted project's sessions and edit marks leave sessi…
Bradenream Dec 1, 2026
17c51de
fix(home): "/text" and "/note" find document create-text beside a com…
Bradenream Dec 1, 2026
9014cc1
fix(forms): Enter on an optional field that takes one of several type…
Bradenream Dec 1, 2026
6856117
fix(home): a command the word names as a task comes before one with t…
Bradenream Dec 1, 2026
1959e1c
test(session): the conversation package's tests keep out of the real …
Bradenream Dec 1, 2026
d98a3b4
docs(knowledge-base): help leads with adding text you type
Bradenream Dec 1, 2026
0b1a6df
fix(forms): the Text field's "no file" message gives its advice first
Bradenream Dec 1, 2026
9c39eb1
fix(home): use project reads its own workspace, not the list of every…
Bradenream Dec 1, 2026
ffa13d2
Merge braden/sweep-r8 into braden/sweep-r9: vet.sh skips module downl…
Bradenream Dec 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Worth knowing before you script against the CLI:

- **A session talks to the draft, what you are editing; `vf session start -v published` talks to the live version.** A new project is created with a first release already in place, so either works immediately — you do not have to publish anything first.
- **vf remembers the current session** for each project and environment, so `send`, `get`, `update` and `end` need no ID, and a `send` with none going starts one. `-s <id>` names another. A session's ID is its conversation's user ID: `vf transcript search --session <id>` lists its transcripts, and `vf evaluation run --session <id>` evaluates its newest. `vf session run-script` runs a list of messages as a fresh session. At a terminal, `vf session start` goes on to a chat, a turn a line, until `/end`; Ctrl-D leaves the session going, and `vf session send` with no message goes back to it. (`vf conversation`, which took a user ID, a version and an action in JSON on every turn, still runs for the scripts that use it.)
- **A session with the draft runs your latest edits.** The draft runs as last compiled, so vf compiles it when a session starts (`session start`, `session run-script`, a `send` that starts one), and before a turn after vf itself edited the draft (`vf agent update`, `vf playbook update`, …). Other turns don't compile. A compile takes about half a second. If the draft won't compile, vf says why and sends nothing (`error_type` `compile_failed`, exit 1). An edit made elsewhere, or while a turn runs, can miss that turn; vf then compiles after it and warns, so the next turn runs it. A conversation already going can still be swayed by its earlier replies: to try an edit cleanly, start a new session. `--no-compile` talks to the last build as it is; the published version is never compiled.
- **A session with the draft runs your latest edits.** The draft runs as last compiled, so vf compiles it when a session starts (`session start`, `session run-script`, a `send` that starts one), and before a turn after vf itself edited the draft (`vf agent update`, `vf playbook update`, …). Other turns don't compile. A compile takes about half a second. If the draft won't compile, vf says why and sends nothing (`error_type` `compile_failed`, exit 1). An edit made elsewhere, or while a turn runs, can miss that turn; vf then compiles after it and warns, so the next turn runs it. A conversation already going can still be swayed by its earlier replies: to try an edit cleanly, start a new session. `--no-compile` talks to the last build as it is; the published version is never compiled. Clients outside vf that run the draft, such as the Dialog Manager API with the draft's version ID, run it as last compiled: after an edit, run `vf environment compile`, unless a vf session with the draft has started or taken a turn since. The web chat widget serves the published version by default, so an edit reaches it with `vf environment publish`.
- **Pass `--output-format json` explicitly when piping.** Inside AI coding agents (`CLAUDECODE`, `CURSOR_AGENT`, …) the default output is TOON, not JSON.
- **Capture values with `--jq`**: `ID=$(vf project create … --jq .project.id)`. A string result prints raw, as `jq -r` prints it; anything else prints as JSON.
- **`vf whoami` is offline** — it shows which credential source is configured but does not validate the token. `vf workspace list` is the real check.
Expand Down
6 changes: 4 additions & 2 deletions docs/vf_session_run-script.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Run a list of user messages as one new conversation, and make it the current ses

With the draft, vf compiles it first, so the script runs your latest edits. 'vf session send' goes on from the script's last turn; --end ends the session after the script instead, and finds its transcript, for 'vf evaluation run'.

-s reuses a session ID, such as a phone number the agent expects: as with 'vf session start -s', vf ends the conversation it had and clears its state first, so the script starts clean.

```
vf session run-script [flags]
```
Expand All @@ -30,8 +32,8 @@ vf session run-script [flags]
-m, --messages string The user messages to send, in order, after the launch. A message is typed text, as a string or { "text": "…" }, or a button press, as { "button": "<label>" }, for a button the reply before offered. The digest shows offered buttons as "[buttons: Yes | No]". JSON: [string | { type?: string, text: string } | { type?: string, button: string }] [required]
--no-compile Run the draft as last compiled. Without it, vf compiles the draft first, so the script runs your latest edits.
-p, --project-id string The project's ID: in Creator, under the agent's Settings → General, or from 'vf project list'. [required]
-s, --session string The session ID to run as: another name for --user-id. Leave both out for a new one.
-u, --user-id string The conversation user ID to run as; the agent reads it as the user_id variable. Use it when the agent expects a caller ID of a known shape, such as a phone number, and make one up: never a real customer's ID. Draft version only. Leave it out to run as a new user each time. A reused ID keeps the variables an earlier conversation with it left.
-s, --session string The session ID to run as: another name for --user-id. Leave both out for a new one. One used before starts over: vf ends its conversation and clears its state first.
-u, --user-id string The conversation user ID to run as; the agent reads it as the user_id variable. Use it when the agent expects a caller ID of a known shape, such as a phone number, and make one up: never a real customer's ID. Draft version only. Leave it out to run as a new user each time. A reused ID starts over, as with -s.
--variables string Variable values to set before the launch, keyed by variable name, to start as a known caller. Next to messages, not inside launch. JSON: { <key>: any }
--version-param string Whether to talk to the draft or the published version of the environment. Draft unless you pass it. (options: draft, published) (default "draft")
```
Expand Down
2 changes: 2 additions & 0 deletions docs/vf_session_send.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ With the draft, vf compiles it when a conversation starts, and before a turn whe

An edit made elsewhere, in Creator or by another client, can miss a turn. Then vf compiles after it, and warns: the next turn runs the edit. --no-compile runs the draft as last compiled. The published version is never compiled.

Clients outside vf that run the draft, such as the Dialog Manager API with the draft's version ID, run it as last compiled: after an edit, run 'vf environment compile', unless a vf session with the draft has started or taken a turn since. The web chat widget serves the published version by default, so an edit reaches it with 'vf environment publish'.

The agent gets your edits on its next turn, but in a conversation already going its earlier replies can still sway it. To try an edit cleanly, start a new session: 'vf session start'.

```
Expand Down
44 changes: 44 additions & 0 deletions internal/cli/compilerule_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// This file is not generated by Speakeasy. It covers the compile rule as
// send's help (conversation/autocompile.go) and the README state it for
// clients outside vf.

package cli

import (
"os"
"strings"
"testing"
)

// fix-verifier:N6 (R8 #52): round 8's rule said "Run 'vf environment
// compile' only for other clients (the web chat, the raw API) after edits
// made outside vf", but `vf widget get-snippet` warned "The widget serves
// the published version", and its snippet pins versionVariant 'published':
// an agent that compiled to update the web chat saw no change. And vf's own
// edits reach a raw-API draft client only once something compiles. The rule
// now names the clients a compile changes, when they need one, and that the
// web chat takes a publish.
func TestTheCompileRuleNamesTheClientsACompileChanges(t *testing.T) {
help, _, err := runInHome(t, t.TempDir(), newSessionAPI(t).url, false, "session", "send", "--help")
if err != nil {
t.Fatal(err)
}
readme, err := os.ReadFile("../../README.md")
if err != nil {
t.Fatal(err)
}
for name, text := range map[string]string{"send --help": help, "README.md": string(readme)} {
flat := strings.ReplaceAll(strings.Join(strings.Fields(text), " "), "`", "'")
for _, rule := range []string{
"Clients outside vf that run the draft, such as the Dialog Manager API with the draft's version ID, run it as last compiled: after an edit, run 'vf environment compile', unless a vf session with the draft has started or taken a turn since.",
"The web chat widget serves the published version by default, so an edit reaches it with 'vf environment publish'.",
} {
if !strings.Contains(flat, rule) {
t.Errorf("%s should say %q", name, rule)
}
}
if strings.Contains(flat, "(the web chat, the raw API)") {
t.Errorf("%s still says the web chat takes a compile", name)
}
}
}
28 changes: 27 additions & 1 deletion internal/cli/conversation/autocompile.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
// line, so the next turn, from vf or anywhere else, runs the edit.
// --no-compile runs whatever was last compiled. The published version is a
// release, and is never compiled.
//
// Clients outside vf that run the draft (the Dialog Manager API with the
// draft's version ID) run it as last compiled, so send's help says when
// they need 'vf environment compile'. Round 8 said the web chat did, but
// the widget serves the published version unless its snippet is made with
// --version-param draft (fix-verifier N6).

package conversation

Expand Down Expand Up @@ -95,6 +101,8 @@ const sendCompiles = `With the draft, vf compiles it when a conversation starts,

An edit made elsewhere, in Creator or by another client, can miss a turn. Then vf compiles after it, and warns: the next turn runs the edit. --no-compile runs the draft as last compiled. The published version is never compiled.

Clients outside vf that run the draft, such as the Dialog Manager API with the draft's version ID, run it as last compiled: after an edit, run 'vf environment compile', unless a vf session with the draft has started or taken a turn since. The web chat widget serves the published version by default, so an edit reaches it with 'vf environment publish'.

The agent gets your edits on its next turn, but in a conversation already going its earlier replies can still sway it. To try an edit cleanly, start a new session: 'vf session start'.`

// turnWait is the wait for one turn, a send or a script: one spinner line,
Expand Down Expand Up @@ -199,9 +207,19 @@ const staleTurn = "This turn ran the build from before an edit made elsewhere or
// compileAfterStaleTurn is compileAfterStaleSend for an answer already
// read, whose needsRecompile is stale.
func compileAfterStaleTurn(cmd *cobra.Command, s *sdk.VoiceflowSDK, version string, stale bool, projectID, alias string) func() error {
return compileAfterStaleSessionTurn(cmd, s, version, stale, projectID, alias, "")
}

// compileAfterStaleSessionTurn is compileAfterStaleTurn for a turn in a
// session going, whose warning ends with steer: what its earlier replies
// can still do, and how to start fresh (steerNote).
func compileAfterStaleSessionTurn(cmd *cobra.Command, s *sdk.VoiceflowSDK, version string, stale bool, projectID, alias, steer string) func() error {
if !stale || client.IsDryRun(cmd) || version != "draft" || skipCompile(cmd) {
return func() error { return nil }
}
if steer != "" {
steer = " " + steer
}
return func() error {
ctx := client.WithSpinnerMessage(cmd.Context(), compilingMessage)
if err := compile(ctx, s, projectID, alias); err != nil {
Expand All @@ -212,11 +230,19 @@ func compileAfterStaleTurn(cmd *cobra.Command, s *sdk.VoiceflowSDK, version stri
warn(cmd, staleTurn+" vf couldn't compile the draft after it ("+compileError(cmd, err)+"), so your next turn compiles it first.")
return nil
}
warn(cmd, staleTurn+" vf compiled it, so your next turn runs it.")
warn(cmd, staleTurn+" vf compiled it, so your next turn runs it."+steer)
return nil
}
}

// steerNote says that a session's earlier replies can still steer the
// agent after an edit, and that fresh starts a session without them: "/new"
// in the chat, a start command elsewhere. A turn that runs an edit prints it
// once, and so does the warning after a turn that missed one.
func steerNote(fresh string) string {
return "Earlier replies in this session can still steer the agent: " + fresh + " starts fresh."
}

func compile(ctx context.Context, s *sdk.VoiceflowSDK, projectID, alias string) error {
_, err := s.Environment.Compile(ctx, operations.StableEnvironmentControllerCompileRequest{ProjectID: projectID, EnvironmentAlias: alias}, operations.WithSkipDeserialization())
return err
Expand Down
3 changes: 2 additions & 1 deletion internal/cli/conversation/canceled.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
// exit 1, as any other cancel.
//
// In a shell, Ctrl-C ends vf itself (exit 130, nothing printed), so there
// is no claim to correct there.
// is no claim to correct there, except in the chat at a terminal, which
// catches it while a turn runs (sessionchat.go) and says the same.

package conversation

Expand Down
38 changes: 38 additions & 0 deletions internal/cli/conversation/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// This file is not generated by Speakeasy. It keeps this package's tests
// out of the real session store.
//
// A session start, a turn or a compile records the session and the compile
// time in ~/.config/vf/sessions.json (internal/sessions). Run against the
// fake project p1, these tests wrote p1/main into the real file of whoever
// ran them (round-9 sweep, fix-verifier:N3), and a test run beside a real
// session could clobber its compile time or current session.

package conversation

import (
"fmt"
"os"
"path/filepath"
"testing"

"github.com/voiceflow/cli/internal/sessions"
)

// TestMain runs the tests with HOME in a folder of their own, and fails the
// run if the session store is still under the real one.
func TestMain(m *testing.M) {
real, _ := os.UserHomeDir()
home, err := os.MkdirTemp("", "vf-conversation-test-home-")
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
os.Setenv("HOME", home)
if real != "" && filepath.Dir(filepath.Dir(filepath.Dir(sessions.Path()))) == real {
fmt.Fprintln(os.Stderr, "the session store is still under the real home:", sessions.Path())
os.Exit(1)
}
code := m.Run()
os.RemoveAll(home)
os.Exit(code)
}
4 changes: 3 additions & 1 deletion internal/cli/conversation/reply.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ func (t turn) write(cmd *cobra.Command, out io.Writer, debug bool) {
fmt.Fprintln(out, u.Muted("The conversation ended."))
}
if len(t.hidden) > 0 && !debug {
fmt.Fprintln(out, u.Muted(t.hiddenNote()+" "+u.Glyph(ui.Separator)+" --show-debug shows them"))
for _, line := range strings.Split(u.Fit(t.hiddenNote()+" "+u.Glyph(ui.Separator)+" --show-debug shows them", 0), "\n") {
fmt.Fprintln(out, u.Muted(line))
}
}
}
2 changes: 1 addition & 1 deletion internal/cli/conversation/runscript.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func runRunScriptCmd(cmd *cobra.Command, args []string) error {
if output.WantsRawJSON(cmd) {
sdkOpts = append(sdkOpts, operations.WithSkipDeserialization())
}
wait, err := compileBeforeScript(cmd, s, req) // autocompile.go: the script runs the latest edits
wait, err := startScript(cmd, s, req) // sessionscript.go: autocompile.go compiles, and in vf session a reused -s starts clean
if err != nil {
return err
}
Expand Down
17 changes: 15 additions & 2 deletions internal/cli/conversation/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io"
"slices"
"strings"

Expand Down Expand Up @@ -225,6 +226,9 @@ type sessionTurn struct {
answer map[string]any // nil in a dry run
traces []map[string]any
stale bool
// ranEdit: the turn compiled the draft first, after an edit, and was no
// launch: it runs the edit in a conversation already going.
ranEdit bool
}

// takeTurn sends req with wait's context, ends the wait, and reads the
Expand Down Expand Up @@ -344,8 +348,17 @@ func forAPerson(cmd *cobra.Command) bool {

// note prints a muted line for a person, under the turn.
func note(cmd *cobra.Command, line string) {
out := cmd.OutOrStdout()
fmt.Fprintln(out, output.UI(cmd, out).Muted(line))
sayMuted(cmd, cmd.OutOrStdout(), line)
}

// sayMuted prints text muted on w, broken between words to fit the
// terminal, which broke a long line mid-word ("termin" / "al", round 8:
// fix-verifier N7). A quoted command stays whole (ui/wrap.go).
func sayMuted(cmd *cobra.Command, w io.Writer, text string) {
u := output.UI(cmd, w)
for _, line := range strings.Split(u.Fit(text, 0), "\n") {
fmt.Fprintln(w, u.Muted(line))
}
}

// writeNext says what to run next, on stderr, as an update's Next does.
Expand Down
Loading
Loading