Skip to content

An open-source, faster Devin alternative

TypeScript

feat: deploy prompt-defined Flue agents from CLI

Igor Zalutski505b49b384a2
diff --git a/cmd/oc/internal/commands/agent_deploy_flue.go b/cmd/oc/internal/commands/agent_deploy_flue.go
index dc987743..2c5d37d9 100644
--- a/cmd/oc/internal/commands/agent_deploy_flue.go
+++ b/cmd/oc/internal/commands/agent_deploy_flue.go
@@ -1,27 +1,29 @@
package commands
// Flue deploy flow (design 013 §6 — the Worker-for-Platforms Durable-Object model).
-// When agent.toml declares `[runtime] family = "flue"`, `oc agent deploy` does NOT
-// read prompt.md/skills/; it runs the app's own `flue build --target cloudflare`, then
-// stages only regular .js/.mjs modules as one tar.gz in R2 via a presigned PUT, and
-// POSTs the deployment referencing only the R2 bundle digest + a small canonical
-// Flue descriptor + the entrypoint agent name — NO module bytes in the JSON, so the
-// API host stays byte-free. The CP records
-// a `verifying` deploy; an off-host runner fetches the bundle, composes, mints the
-// per-deploy token, WfP-uploads, and finalizes. The existing deployment poll absorbs
-// the runner latency (verifying → ready|failed).
+// A prompt-defined root stages only agent.toml, prompt.md, and exact SKILL.md files;
+// the isolated managed builder owns synthesis and the framework build. A complete app
+// runs its own local `flue build --target cloudflare` and stages only the resulting
+// regular .js/.mjs modules. Both paths keep source/module bytes out of API JSON and
+// converge on the same off-host deploy runner and verifying → ready|failed poll.
import (
"bytes"
"context"
+ "crypto/rand"
+ "encoding/hex"
"errors"
"fmt"
"io"
"net/http"
"os"
"path/filepath"
+ "regexp"
+ "strings"
"time"
+ "unicode/utf8"
+ "github.com/opensandbox/opensandbox/cmd/oc/internal/bundle"
"github.com/opensandbox/opensandbox/cmd/oc/internal/client"
"github.com/opensandbox/opensandbox/cmd/oc/internal/fluebuild"
"github.com/spf13/cobra"
@@ -38,11 +40,25 @@ type artifactUploadResponse struct {
AlreadyUploaded bool `json:"already_uploaded"`
}
+type localSourceUploadResponse struct {
+ URL string `json:"url"`
+ ExpiresAt string `json:"expires_at"`
+ AlreadyUploaded bool `json:"already_uploaded"`
+}
+
+const (
+ fluePromptMaxBytes = 256 * 1024
+ fluePromptMaxSkills = 32
+ fluePromptMaxSkillBytes = 256 * 1024
+ fluePromptMaxSkillsBytes = 2 * 1024 * 1024
+ fluePromptMaxArchive = 4 * 1024 * 1024
+)
+
+var fluePromptSkillName = regexp.MustCompile(`^[a-z0-9][a-z0-9-]{0,63}$`)
+
func deployFlue(cmd *cobra.Command, sc *client.Client, dir string, m *manifest, noActivate bool) error {
if isPromptDefinedFlueRoot(dir) {
- return fmt.Errorf(
- "prompt-defined Flue agents currently deploy from GitHub: push this directory, then choose Agents → Create agent → Import from GitHub",
- )
+ return deployPromptDefinedFlue(cmd, sc, dir, m, noActivate)
}
// 1. Run the same credential, manifest, engine, and lockfile projection as
// the managed builder before any authenticated API call. --check-only
@@ -163,11 +179,11 @@ func deployFlue(cmd *cobra.Command, sc *client.Client, dir string, m *manifest,
}
func isPromptDefinedFlueRoot(dir string) bool {
- regular := func(name string) bool {
- info, err := os.Lstat(name)
- return err == nil && info.Mode().IsRegular()
+ exists := func(name string) bool {
+ _, err := os.Lstat(name)
+ return err == nil
}
- if !regular(filepath.Join(dir, "prompt.md")) {
+ if !exists(filepath.Join(dir, "prompt.md")) {
return false
}
for _, marker := range []string{
@@ -184,6 +200,250 @@ func isPromptDefinedFlueRoot(dir string) bool {
return true
}
+// deployPromptDefinedFlue stages the bounded behavior source directly into the
+// transient source bucket, then asks the existing isolated managed-build plane
+// to synthesize and build it. The API sees only the source reference.
+func deployPromptDefinedFlue(
+ cmd *cobra.Command,
+ sc *client.Client,
+ dir string,
+ m *manifest,
+ noActivate bool,
+) error {
+ if m.Name == "" {
+ return fmt.Errorf("prompt-defined Flue deployments require `name` in agent.toml")
+ }
+ if m.Runtime.Type != "" && m.Runtime.Type != "default" {
+ return fmt.Errorf("prompt-defined Flue deployments require runtime.type = \"default\"")
+ }
+ files, err := readPromptDefinedFlueSource(dir)
+ if err != nil {
+ return err
+ }
+ sourceTarGz, err := bundle.Pack(files)
+ if err != nil {
+ return fmt.Errorf("pack prompt-defined Flue source: %w", err)
+ }
+ if len(sourceTarGz) > fluePromptMaxArchive {
+ return fmt.Errorf(
+ "prompt-defined Flue source archive exceeds %d bytes",
+ fluePromptMaxArchive,
+ )
+ }
+ uploadID, err := newLocalSourceUploadID()
+ if err != nil {
+ return fmt.Errorf("create source upload id: %w", err)
+ }
+ digest := bundle.Digest(sourceTarGz)
+
+ id, err := resolveDeployAgent(cmd, sc, m)
+ if err != nil {
+ return err
+ }
+ if err := syncManifestVars(cmd, sc, id, m); err != nil {
+ return err
+ }
+ if !jsonOutput {
+ printDeployProgress("uploading source")
+ }
+ if err := uploadLocalBuildSource(
+ cmd.Context(),
+ sc,
+ id,
+ uploadID,
+ digest,
+ sourceTarGz,
+ ); err != nil {
+ return err
+ }
+
+ rt := m.Runtime.Type
+ if rt == "" {
+ rt = "default"
+ }
+ input := map[string]interface{}{
+ "type": "source",
+ "source": map[string]interface{}{"upload_id": uploadID, "digest": digest, "size_bytes": len(sourceTarGz)},
+ "entrypoint": m.Name,
+ "model": m.Model,
+ "runtime": map[string]string{"type": rt},
+ }
+ body := map[string]interface{}{"input": input, "activate": !noActivate}
+ if idem, _ := cmd.Flags().GetString("idempotency-key"); idem != "" {
+ body["idempotency_key"] = idem
+ }
+ var env DeploymentEnvelope
+ if err := sc.Post(cmd.Context(), "/v3/agents/"+id+"/deployments", body, &env); err != nil {
+ return err
+ }
+ d := env.Deployment
+ if !terminalState(d.State) && d.State != "" {
+ to, _ := cmd.Flags().GetInt("timeout")
+ d, err = pollDeployment(cmd, sc, id, d.ID, time.Duration(to)*time.Second)
+ if err != nil {
+ return err
+ }
+ }
+ if d.State == "failed" {
+ printer.Print(d, func() { fmt.Printf("Deploy failed: %s\n", deployFailMsg(d)) })
+ return &ExitError{Code: 1}
+ }
+ handoff := Agent{}
+ if !jsonOutput && d.State == "ready" {
+ handoff = loadDeployHandoff(cmd, sc, id)
+ }
+ printer.Print(d, func() {
+ n := revisionNumber(cmd, sc, id, d.RevisionID)
+ status := "staged"
+ if d.Active {
+ status = "active"
+ }
+ printDeploySuccess(printer.W, deploySuccess{
+ Agent: handoff, Revision: n, Status: status,
+ })
+ })
+ return nil
+}
+
+func readPromptDefinedFlueSource(dir string) ([]bundle.File, error) {
+ readRegular := func(rel string, maxBytes int) ([]byte, error) {
+ path := filepath.Join(dir, filepath.FromSlash(rel))
+ info, err := os.Lstat(path)
+ if err != nil {
+ if os.IsNotExist(err) {
+ return nil, fmt.Errorf("%s is missing", rel)
+ }
+ return nil, fmt.Errorf("inspect %s: %w", rel, err)
+ }
+ if !info.Mode().IsRegular() {
+ return nil, fmt.Errorf("%s must be a regular file", rel)
+ }
+ if info.Size() > int64(maxBytes) {
+ return nil, fmt.Errorf("%s exceeds %d bytes", rel, maxBytes)
+ }
+ content, err := os.ReadFile(path)
+ if err != nil {
+ return nil, fmt.Errorf("read %s: %w", rel, err)
+ }
+ if !utf8.Valid(content) {
+ return nil, fmt.Errorf("%s must be valid UTF-8", rel)
+ }
+ return content, nil
+ }
+
+ manifestBytes, err := readRegular("agent.toml", fluePromptMaxArchive)
+ if err != nil {
+ return nil, err
+ }
+ promptBytes, err := readRegular("prompt.md", fluePromptMaxBytes)
+ if err != nil {
+ return nil, err
+ }
+ if strings.TrimSpace(string(promptBytes)) == "" {
+ return nil, fmt.Errorf("prompt.md must not be empty")
+ }
+ if _, err := os.Lstat(filepath.Join(dir, "mcp.json")); err == nil {
+ return nil, fmt.Errorf("mcp.json is not supported by prompt-defined Flue agents")
+ } else if !os.IsNotExist(err) {
+ return nil, fmt.Errorf("inspect mcp.json: %w", err)
+ }
+
+ files := []bundle.File{
+ {Path: "agent.toml", Mode: 0o644, Content: manifestBytes},
+ {Path: "prompt.md", Mode: 0o644, Content: promptBytes},
+ }
+ skillsRoot := filepath.Join(dir, "skills")
+ entries, err := os.ReadDir(skillsRoot)
+ if err != nil {
+ if os.IsNotExist(err) {
+ return files, nil
+ }
+ return nil, fmt.Errorf("read skills/: %w", err)
+ }
+ rootInfo, err := os.Lstat(skillsRoot)
+ if err != nil {
+ return nil, fmt.Errorf("inspect skills/: %w", err)
+ }
+ if !rootInfo.IsDir() {
+ return nil, fmt.Errorf("skills must be a directory")
+ }
+
+ totalSkillBytes := 0
+ for _, entry := range entries {
+ if !entry.IsDir() {
+ continue
+ }
+ rel := "skills/" + entry.Name() + "/SKILL.md"
+ if _, err := os.Lstat(filepath.Join(dir, filepath.FromSlash(rel))); err != nil {
+ if os.IsNotExist(err) {
+ continue
+ }
+ return nil, fmt.Errorf("inspect %s: %w", rel, err)
+ }
+ if !fluePromptSkillName.MatchString(entry.Name()) {
+ return nil, fmt.Errorf("skill directory %q has an invalid name", entry.Name())
+ }
+ content, err := readRegular(rel, fluePromptMaxSkillBytes)
+ if err != nil {
+ return nil, err
+ }
+ totalSkillBytes += len(content)
+ if totalSkillBytes > fluePromptMaxSkillsBytes {
+ return nil, fmt.Errorf(
+ "prompt-defined Flue skill files exceed %d bytes",
+ fluePromptMaxSkillsBytes,
+ )
+ }
+ files = append(files, bundle.File{Path: rel, Mode: 0o644, Content: content})
+ if len(files)-2 > fluePromptMaxSkills {
+ return nil, fmt.Errorf(
+ "prompt-defined Flue agents support at most %d skills",
+ fluePromptMaxSkills,
+ )
+ }
+ }
+ return files, nil
+}
+
+func newLocalSourceUploadID() (string, error) {
+ var raw [16]byte
+ if _, err := rand.Read(raw[:]); err != nil {
+ return "", err
+ }
+ return "src_" + hex.EncodeToString(raw[:]), nil
+}
+
+func uploadLocalBuildSource(
+ ctx context.Context,
+ sc *client.Client,
+ agentID string,
+ uploadID string,
+ digest string,
+ tarGz []byte,
+) error {
+ body := map[string]interface{}{
+ "upload_id": uploadID,
+ "digest": digest,
+ "size_bytes": len(tarGz),
+ }
+ var response localSourceUploadResponse
+ if err := sc.Post(
+ ctx,
+ "/v3/agents/"+agentID+"/source-artifacts",
+ body,
+ &response,
+ ); err != nil {
+ return fmt.Errorf("request source upload url: %w", err)
+ }
+ if response.AlreadyUploaded {
+ return nil
+ }
+ if response.URL == "" {
+ return fmt.Errorf("source upload url response was empty")
+ }
+ return putGzip(ctx, response.URL, tarGz, "source")
+}
+
func presentFlueBuildError(err error) error {
var credentialErr *fluebuild.CredentialError
if !errors.As(err, &credentialErr) {
@@ -225,7 +485,11 @@ func uploadArtifact(ctx context.Context, sc *client.Client, agentID, digest stri
if resp.URL == "" {
return fmt.Errorf("bundle upload url response was empty")
}
- req, err := http.NewRequestWithContext(ctx, http.MethodPut, resp.URL, bytes.NewReader(tarGz))
+ return putGzip(ctx, resp.URL, tarGz, "bundle")
+}
+
+func putGzip(ctx context.Context, url string, tarGz []byte, label string) error {
+ req, err := http.NewRequestWithContext(ctx, http.MethodPut, url, bytes.NewReader(tarGz))
if err != nil {
return err
}
@@ -233,12 +497,12 @@ func uploadArtifact(ctx context.Context, sc *client.Client, agentID, digest stri
req.ContentLength = int64(len(tarGz))
put, err := http.DefaultClient.Do(req)
if err != nil {
- return fmt.Errorf("upload bundle: %w", err)
+ return fmt.Errorf("upload %s: %w", label, err)
}
defer put.Body.Close()
if put.StatusCode >= 300 {
snippet, _ := io.ReadAll(io.LimitReader(put.Body, 512))
- return fmt.Errorf("bundle upload failed (HTTP %d): %s", put.StatusCode, string(snippet))
+ return fmt.Errorf("%s upload failed (HTTP %d): %s", label, put.StatusCode, string(snippet))
}
return nil
}
diff --git a/cmd/oc/internal/commands/agent_deploy_flue_test.go b/cmd/oc/internal/commands/agent_deploy_flue_test.go
index d74f4a6e..c36aeacd 100644
--- a/cmd/oc/internal/commands/agent_deploy_flue_test.go
+++ b/cmd/oc/internal/commands/agent_deploy_flue_test.go
@@ -19,6 +19,7 @@ import (
"net/http/httptest"
"os"
"path/filepath"
+ "regexp"
"runtime"
"strings"
"sync"
@@ -50,6 +51,8 @@ type fakeCP struct {
artifactDigest string
artifactSize float64
uploaded []byte
+ sourceBody map[string]any
+ sourceUploaded []byte
deployBody map[string]any
getCount int
}
@@ -83,6 +86,10 @@ func (f *fakeCP) ServeHTTP(w http.ResponseWriter, r *http.Request) {
f.artifactDigest, _ = body["digest"].(string)
f.artifactSize, _ = body["size_bytes"].(float64)
writeJSON(map[string]any{"url": f.self + "/upload/" + f.artifactDigest, "expires_at": "2099-01-01T00:00:00Z"})
+ case r.Method == "POST" && r.URL.Path == "/v3/agents/"+fakeAgentID+"/source-artifacts":
+ _ = json.NewDecoder(r.Body).Decode(&f.sourceBody)
+ uploadID, _ := f.sourceBody["upload_id"].(string)
+ writeJSON(map[string]any{"url": f.self + "/source-upload/" + uploadID, "expires_at": "2099-01-01T00:00:00Z"})
case r.Method == "PUT" && strings.HasPrefix(r.URL.Path, "/upload/"):
if ct := r.Header.Get("Content-Type"); ct != "application/gzip" {
http.Error(w, "bad content-type: "+ct, http.StatusBadRequest)
@@ -92,6 +99,15 @@ func (f *fakeCP) ServeHTTP(w http.ResponseWriter, r *http.Request) {
_, _ = buf.ReadFrom(r.Body)
f.uploaded = buf.Bytes()
w.WriteHeader(http.StatusOK)
+ case r.Method == "PUT" && strings.HasPrefix(r.URL.Path, "/source-upload/"):
+ if ct := r.Header.Get("Content-Type"); ct != "application/gzip" {
+ http.Error(w, "bad content-type: "+ct, http.StatusBadRequest)
+ return
+ }
+ buf := new(bytes.Buffer)
+ _, _ = buf.ReadFrom(r.Body)
+ f.sourceUploaded = buf.Bytes()
+ w.WriteHeader(http.StatusOK)
case r.Method == "POST" && r.URL.Path == "/v3/agents/"+fakeAgentID+"/deployments":
_ = json.NewDecoder(r.Body).Decode(&f.deployBody)
writeJSON(map[string]any{"deployment": map[string]any{"id": "dep_1", "state": "verifying"}})
@@ -441,30 +457,155 @@ func TestDeployFlueBlocksOnLeakedKey(t *testing.T) {
}
}
-func TestPromptDefinedFlueRootGetsGithubRecoveryInsteadOfNpmError(t *testing.T) {
+func TestDeployPromptDefinedFlueEndToEnd(t *testing.T) {
dir := t.TempDir()
- writeFile(t, filepath.Join(dir, "prompt.md"), "Help the user.\n", 0o644)
+ manifestBytes := []byte(
+ "name = \"e2e-flue\"\nmodel = \"anthropic/claude-sonnet-5\"\n" +
+ "[runtime]\nfamily = \"flue\"\ntype = \"default\"\n",
+ )
+ promptBytes := []byte("Help the user with `quotes`, ${expressions}, and care.\n")
+ skillBytes := []byte("# Review\n\nInspect the diff before publishing.\n")
+ writeFile(t, filepath.Join(dir, "agent.toml"), string(manifestBytes), 0o644)
+ writeFile(t, filepath.Join(dir, "prompt.md"), string(promptBytes), 0o644)
+ writeFile(t, filepath.Join(dir, "skills", "review", "SKILL.md"), string(skillBytes), 0o644)
+ writeFile(t, filepath.Join(dir, "README.md"), "not part of the build source\n", 0o644)
if !isPromptDefinedFlueRoot(dir) {
t.Fatal("expected prompt-defined root")
}
+
+ expected, err := bundle.Pack([]bundle.File{
+ {Path: "agent.toml", Mode: 0o644, Content: manifestBytes},
+ {Path: "prompt.md", Mode: 0o644, Content: promptBytes},
+ {Path: "skills/review/SKILL.md", Mode: 0o644, Content: skillBytes},
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+ expectedDigest := bundle.Digest(expected)
+
+ f := &fakeCP{}
+ srv := httptest.NewServer(f)
+ defer srv.Close()
+ f.self = srv.URL
+
cmd := &cobra.Command{}
+ cmd.Flags().String("agent", "", "")
+ cmd.Flags().String("idempotency-key", "local-e2e", "")
+ cmd.Flags().Int("timeout", 30, "")
cmd.SetContext(context.Background())
- err := deployFlue(
+ m := &manifest{Name: "e2e-flue", Model: "anthropic/claude-sonnet-5"}
+ m.Runtime.Family = "flue"
+ m.Runtime.Type = "default"
+
+ prev := printer
+ printer = output.New(false)
+ var humanOutput bytes.Buffer
+ printer.W = &humanOutput
+ defer func() { printer = prev }()
+
+ err = deployFlue(
cmd,
- client.NewSessionsAPI("http://127.0.0.1:0", "must-not-be-used"),
+ client.NewSessionsAPI(srv.URL, "test-key"),
dir,
- &manifest{},
+ m,
false,
)
- if err == nil || !strings.Contains(err.Error(), "deploy from GitHub") {
- t.Fatalf("expected GitHub recovery, got %v", err)
+ if err != nil {
+ t.Fatalf("deployFlue: %v", err)
+ }
+ if !bytes.Equal(f.sourceUploaded, expected) {
+ t.Fatalf("uploaded source differs from bounded canonical source (got %d bytes, want %d)", len(f.sourceUploaded), len(expected))
+ }
+ if f.sourceBody["digest"] != expectedDigest {
+ t.Errorf("source digest = %v, want %s", f.sourceBody["digest"], expectedDigest)
+ }
+ if f.sourceBody["size_bytes"] != float64(len(expected)) {
+ t.Errorf("source size = %v, want %d", f.sourceBody["size_bytes"], len(expected))
+ }
+ uploadID, _ := f.sourceBody["upload_id"].(string)
+ if !regexp.MustCompile(`^src_[0-9a-f]{32}$`).MatchString(uploadID) {
+ t.Errorf("upload id = %q", uploadID)
+ }
+
+ input, _ := f.deployBody["input"].(map[string]any)
+ if input["type"] != "source" || input["entrypoint"] != "e2e-flue" ||
+ input["model"] != "anthropic/claude-sonnet-5" {
+ t.Errorf("source deployment input = %#v", input)
+ }
+ source, _ := input["source"].(map[string]any)
+ if source["upload_id"] != uploadID || source["digest"] != expectedDigest ||
+ source["size_bytes"] != float64(len(expected)) {
+ t.Errorf("deployment source ref = %#v", source)
+ }
+ if runtimeInput, _ := input["runtime"].(map[string]any); runtimeInput["type"] != "default" {
+ t.Errorf("runtime input = %#v", input["runtime"])
+ }
+ if f.deployBody["activate"] != true || f.deployBody["idempotency_key"] != "local-e2e" {
+ t.Errorf("deployment envelope = %#v", f.deployBody)
+ }
+ encoded, _ := json.Marshal(f.deployBody)
+ for _, forbidden := range []string{
+ string(promptBytes),
+ string(skillBytes),
+ "README.md",
+ "source.tgz",
+ } {
+ if strings.Contains(string(encoded), forbidden) {
+ t.Errorf("byte-free deployment request leaked %q: %s", forbidden, encoded)
+ }
+ }
+ if !strings.Contains(humanOutput.String(), "✓ Deployed e2e-flue") ||
+ !strings.Contains(humanOutput.String(), "Agent URL") {
+ t.Errorf("deploy handoff missing:\n%s", humanOutput.String())
}
+
writeFile(t, filepath.Join(dir, "package.json"), "{}\n", 0o644)
if isPromptDefinedFlueRoot(dir) {
t.Fatal("a package marker must select the complete-app path")
}
}
+func TestReadPromptDefinedFlueSourceRejectsUnsafeShapes(t *testing.T) {
+ base := func(t *testing.T) string {
+ t.Helper()
+ dir := t.TempDir()
+ writeFile(t, filepath.Join(dir, "agent.toml"), "name='a'\n", 0o644)
+ writeFile(t, filepath.Join(dir, "prompt.md"), "Help.\n", 0o644)
+ return dir
+ }
+ t.Run("mcp", func(t *testing.T) {
+ dir := base(t)
+ writeFile(t, filepath.Join(dir, "mcp.json"), "{}\n", 0o644)
+ if _, err := readPromptDefinedFlueSource(dir); err == nil || !strings.Contains(err.Error(), "mcp.json") {
+ t.Fatalf("expected mcp rejection, got %v", err)
+ }
+ })
+ t.Run("invalid skill name", func(t *testing.T) {
+ dir := base(t)
+ writeFile(t, filepath.Join(dir, "skills", "Review_Skill", "SKILL.md"), "# Review\n", 0o644)
+ if _, err := readPromptDefinedFlueSource(dir); err == nil || !strings.Contains(err.Error(), "invalid name") {
+ t.Fatalf("expected skill-name rejection, got %v", err)
+ }
+ })
+ t.Run("prompt symlink", func(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ t.Skip("symlink semantics differ on Windows")
+ }
+ dir := base(t)
+ if err := os.Remove(filepath.Join(dir, "prompt.md")); err != nil {
+ t.Fatal(err)
+ }
+ outside := filepath.Join(t.TempDir(), "prompt.md")
+ writeFile(t, outside, "secret\n", 0o644)
+ if err := os.Symlink(outside, filepath.Join(dir, "prompt.md")); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := readPromptDefinedFlueSource(dir); err == nil || !strings.Contains(err.Error(), "regular file") {
+ t.Fatalf("expected symlink rejection, got %v", err)
+ }
+ })
+}
+
func writeFile(t *testing.T, path, content string, mode os.FileMode) {
t.Helper()
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
diff --git a/cmd/oc/internal/commands/agent_init.go b/cmd/oc/internal/commands/agent_init.go
index c7e230b7..d82a8173 100644
--- a/cmd/oc/internal/commands/agent_init.go
+++ b/cmd/oc/internal/commands/agent_init.go
@@ -82,8 +82,8 @@ var agentInitCmd = &cobra.Command{
}
if runtime == "flue" {
fmt.Printf(
- "\nScaffolded %d file(s). Edit prompt.md, push this directory to GitHub, then import it from Agents → Create agent.\n",
- created,
+ "\nScaffolded %d file(s). Edit prompt.md, then: oc agent deploy %s\n",
+ created, dir,
)
} else {
fmt.Printf("\nScaffolded %d file(s). Edit prompt.md, then: oc agent deploy %s\n", created, dir)
diff --git a/docs/agent-sessions/agents.mdx b/docs/agent-sessions/agents.mdx
index 794a7286..0077e5c5 100644
--- a/docs/agent-sessions/agents.mdx
+++ b/docs/agent-sessions/agents.mdx
@@ -11,8 +11,10 @@ An **agent** is a reusable identity, runtime, model, and deployed behavior. Ever
GitHub** and keeps **Configure manually** available. Repository import
recognizes both a complete [Flue](/agent-sessions/flue) app and a
prompt-defined Flue root containing `agent.toml`, `prompt.md`, and optional
- `skills/`. You can also deploy a local full-app checkout with `oc agent
- deploy`. Both paths produce the same deployment and revision history.
+ `skills/`. You can also deploy either local shape with `oc agent deploy`;
+ prompt-defined roots build in the isolated managed builder, while complete
+ apps build locally. Both paths produce the same deployment and revision
+ history.
</Note>
<CodeGroup>
diff --git a/docs/agent-sessions/api-reference.mdx b/docs/agent-sessions/api-reference.mdx
index c13099d1..6db0c8d3 100644
--- a/docs/agent-sessions/api-reference.mdx
+++ b/docs/agent-sessions/api-reference.mdx
@@ -664,7 +664,7 @@ graduate to `flue-app-v1`. Any other profile change sets the link status to
| Command | Purpose |
| ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
-| `oc agent deploy [dir] [--agent <id\|name>] [--no-activate] [--verbose]` | Bundle a local directory → inline deployment; stream framework build output with `--verbose`. |
+| `oc agent deploy [dir] [--agent <id\|name>] [--no-activate] [--verbose]` | Deploy a local built-in, prompt-defined Flue, or complete Flue directory; `--verbose` streams a local complete-app build. |
| `oc agent build --dir <dir> [--check-only] [--target cloudflare] [--output <dir>]` | Validate or build a Flue artifact without fetching, installing, authenticating, or deploying. |
| `oc agent deployments [--agent <id>]` · `oc agent deployments get <id>` | History · one deployment. |
@@ -674,7 +674,9 @@ graduate to `flue-app-v1`. Any other profile change sets the link status to
`input`: `{ type:"inline", prompt, model?, skills?, runtime? }` (the **complete** built-in
behavior — omitted `skills` = none) **or** `{ type:"github", ref?, sha? }` (deploys an already-linked
-repository; `repo`/`path` come from the server-owned link). `activate:false` stages an inline built-in
+repository; `repo`/`path` come from the server-owned link). The CLI's local prompt-defined Flue path
+uses a separately uploaded, digest-bound `source` reference; use `oc agent deploy` rather than constructing
+that transport manually. `activate:false` stages an inline built-in
deployment. Built-in GitHub links remain branch-driven. A new Flue repository agent instead starts
with [`POST /agents/import`](#review-and-import-a-repository-agent); import deploys the reviewed production head,
and subsequent production-branch pushes deploy automatically. Flue has no preview/staged Worker.
diff --git a/docs/agent-sessions/flue.mdx b/docs/agent-sessions/flue.mdx
index 3b5018ed..c081d79d 100644
--- a/docs/agent-sessions/flue.mdx
+++ b/docs/agent-sessions/flue.mdx
@@ -97,11 +97,12 @@ model = "anthropic/claude-haiku-4-5"
family = "flue"
```
-Import the repository from GitHub. OpenComputer compiles `prompt.md` and up to
-32 packaged skills into a pinned Flue application inside the isolated managed
-builder. The prompt may be at most 256 KiB; each `SKILL.md` may be at most 256
-KiB, with a 2 MiB combined limit. Skill directory names use lowercase letters,
-numbers, and hyphens. `mcp.json` is not supported by this profile.
+Run `oc agent deploy` from the directory, or import it from GitHub.
+OpenComputer compiles `prompt.md` and up to 32 packaged skills into a pinned
+Flue application inside the isolated managed builder. The prompt may be at most
+256 KiB; each `SKILL.md` may be at most 256 KiB, with a 2 MiB combined limit.
+Skill directory names use lowercase letters, numbers, and hyphens. `mcp.json`
+is not supported by this profile.
Add `package.json` and a `flue.config.*` file when you need custom tools or
application code. Those full-app markers take precedence over `prompt.md`, and
@@ -178,19 +179,29 @@ the existing agent, its active revision, or its sessions.
## Deploy from your machine
-Requirements: Node 22.19 or newer, the `oc` CLI, and an OpenComputer organization with Managed model
-access.
+Requirements: the `oc` CLI and an OpenComputer organization with Managed model
+access. A prompt-defined root needs no local Node installation: the CLI uploads
+its bounded behavior files and the isolated managed builder performs synthesis,
+dependency installation, and the Flue build.
-Local deployment currently builds a complete Flue app. Import a prompt-defined
-root from GitHub; `oc agent deploy` points to that path instead of reporting a
-missing npm package.
+```sh
+oc agent init ./support --runtime flue
+cd support
+$EDITOR prompt.md
+
+# Upload source, build in isolation, verify the live Worker, and print its URL.
+oc agent deploy
+```
+
+A complete Flue app builds on your machine and therefore also requires Node
+22.19 or newer and installed dependencies:
```sh
git clone https://github.com/diggerhq/oc-flue-starter
cd oc-flue-starter
npm install
-# Builds the Cloudflare target, deploys it, verifies the live Worker, and activates a revision.
+# Builds the Cloudflare target locally, deploys it, verifies the live Worker, and activates a revision.
# The agent is created from agent.toml when it does not exist yet.
oc agent deploy
diff --git a/docs/agent-sessions/revisions.mdx b/docs/agent-sessions/revisions.mdx
index 942c53e3..4c5ad927 100644
--- a/docs/agent-sessions/revisions.mdx
+++ b/docs/agent-sessions/revisions.mdx
@@ -36,7 +36,7 @@ The agent itself holds only **identity + bindings** (`name`, `runtime`, `credent
## Deploy
-`POST /agents/:id/deployments` is the common post-creation command. `input.type: "inline"` sends behavior directly (API / CLI / dashboard); `input.type: "github"` deploys an already-linked repo — see [Deploy from a repo](#deploy-from-a-repo). Creating a new Flue agent from GitHub uses the atomic [`POST /agents/import`](#import-a-flue-repository) command instead.
+`POST /agents/:id/deployments` is the common post-creation command. `input.type: "inline"` sends behavior directly (API / CLI / dashboard); `input.type: "github"` deploys an already-linked repo — see [Deploy from a repo](#deploy-from-a-repo). The CLI uses a bounded `source` upload for a local prompt-defined Flue root. Creating a new Flue agent from GitHub uses the atomic [`POST /agents/import`](#import-a-flue-repository) command instead.
An inline payload is the **complete** behavior — omitted fields aren't inherited (`prompt` is required; omitted `skills` means *no skills*).
@@ -177,13 +177,25 @@ Same as a repo push — handy for CI that isn't GitHub, or trying a change befor
### Flue framework agents
-A [Flue](/agent-sessions/flue) agent (`[runtime] family = "flue"` in `agent.toml`) carries its instructions, tools, and packaged skills in code, so `oc agent deploy` builds and ships the Cloudflare app instead of reading `prompt.md` and the top-level `skills/` directory:
+A prompt-defined [Flue](/agent-sessions/flue) agent contains `agent.toml`,
+`prompt.md`, and optional `skills/`. The CLI uploads those bounded files and
+waits while OpenComputer synthesizes and builds the app in the isolated managed
+builder:
+
+```bash CLI
+oc agent deploy # upload source, managed build, verify live Worker
+```
+
+A complete Flue app instead carries its behavior in code. The CLI runs its
+locally installed framework build and uploads the generated modules:
```bash CLI
oc agent deploy # flue build --target cloudflare, upload, verify live Worker
```
-The CLI creates the agent from `agent.toml` when needed, runs the locally installed Flue build, uploads the generated JavaScript modules, and waits for the exact live Worker to become stable. See [Run Flue agents](/agent-sessions/flue) for the required app wiring and current deployment constraints.
+Both paths create the agent from `agent.toml` when needed and wait for the exact
+live Worker to become stable. See [Run Flue agents](/agent-sessions/flue) for
+the two source shapes and current deployment constraints.
## Roll back and promote