Skip to content

An open-source, faster Devin alternative

TypeScript

feat(flue): add config and secret CLI and SDK surfaces

Igor Zalutski0946f4d7eecd
diff --git a/cmd/oc/internal/commands/agent.go b/cmd/oc/internal/commands/agent.go
index 3d95c1d8..cf230107 100644
--- a/cmd/oc/internal/commands/agent.go
+++ b/cmd/oc/internal/commands/agent.go
@@ -173,6 +173,7 @@ var agentCmd = &cobra.Command{
func init() {
registerAgentCrud()
registerAgentDeploy()
+ registerAgentConfig()
registerAgentSchedules()
rootCmd.AddCommand(sessionCmd)
}
diff --git a/cmd/oc/internal/commands/agent_config.go b/cmd/oc/internal/commands/agent_config.go
new file mode 100644
index 00000000..56f7910e
--- /dev/null
+++ b/cmd/oc/internal/commands/agent_config.go
@@ -0,0 +1,320 @@
+package commands
+
+// Flue Worker configuration. Non-secret vars can also live in agent.toml's
+// [vars] section; secret values are accepted only by the write-only secret API.
+
+import (
+ "bufio"
+ "fmt"
+ "net/url"
+ "os"
+ "sort"
+ "strings"
+
+ "github.com/opensandbox/opensandbox/cmd/oc/internal/client"
+ "github.com/spf13/cobra"
+)
+
+type agentConfig struct {
+ Vars map[string]string `json:"vars"`
+ EgressAllowlist []string `json:"egress_allowlist"`
+ DeploymentRequired bool `json:"deployment_required,omitempty"`
+}
+
+type agentSecret struct {
+ Name string `json:"name"`
+ Last4 string `json:"last4"`
+ UpdatedAt string `json:"updated_at"`
+ SyncStatus string `json:"sync_status"`
+}
+
+type agentSecretList struct {
+ Data []agentSecret `json:"data"`
+}
+
+func agentConfigPath(id string) string { return "/v3/agents/" + id + "/config" }
+func agentSecretsPath(id string) string { return "/v3/agents/" + id + "/secrets" }
+func agentSecretPath(id, name string) string {
+ return agentSecretsPath(id) + "/" + url.PathEscape(name)
+}
+
+func getAgentConfig(cmd *cobra.Command, sc *client.Client, id string) (agentConfig, error) {
+ var cfg agentConfig
+ err := sc.Get(cmd.Context(), agentConfigPath(id), &cfg)
+ if cfg.Vars == nil {
+ cfg.Vars = map[string]string{}
+ }
+ return cfg, err
+}
+
+func putAgentConfig(cmd *cobra.Command, sc *client.Client, id string, cfg agentConfig) (agentConfig, error) {
+ var saved agentConfig
+ err := sc.PutJSON(cmd.Context(), agentConfigPath(id), map[string]interface{}{
+ "vars": cfg.Vars, "egress_allowlist": cfg.EgressAllowlist,
+ }, &saved)
+ return saved, err
+}
+
+// syncManifestVars applies [vars] before a Flue deployment is enqueued. A nil
+// Vars map means no section was supplied, so an ordinary deploy never erases
+// config that was managed through the API/dashboard.
+func syncManifestVars(cmd *cobra.Command, sc *client.Client, id string, m *manifest) error {
+ if m.Vars == nil {
+ return nil
+ }
+ cfg, err := getAgentConfig(cmd, sc, id)
+ if err != nil {
+ return fmt.Errorf("read agent config: %w", err)
+ }
+ cfg.Vars = m.Vars
+ if _, err := putAgentConfig(cmd, sc, id, cfg); err != nil {
+ return fmt.Errorf("sync agent.toml [vars]: %w", err)
+ }
+ return nil
+}
+
+func parseConfigVars(values []string) (map[string]string, error) {
+ out := make(map[string]string, len(values))
+ for _, raw := range values {
+ name, value, ok := strings.Cut(raw, "=")
+ name = strings.TrimSpace(name)
+ if !ok || name == "" {
+ return nil, fmt.Errorf("invalid --var %q (want NAME=VALUE)", raw)
+ }
+ out[name] = value
+ }
+ return out, nil
+}
+
+func sortedUnique(values []string) []string {
+ seen := make(map[string]struct{}, len(values))
+ for _, value := range values {
+ value = strings.TrimSpace(value)
+ if value != "" {
+ seen[value] = struct{}{}
+ }
+ }
+ out := make([]string, 0, len(seen))
+ for value := range seen {
+ out = append(out, value)
+ }
+ sort.Strings(out)
+ return out
+}
+
+var agentConfigCmd = &cobra.Command{
+ Use: "config [id|name]",
+ Short: "Show or update a Flue agent's vars and outbound host allowlist",
+ Long: "Show a Flue agent's Worker configuration. Update it with --var, --unset-var,\n" +
+ "--allow-host, or --deny-host. Vars take effect on the next deploy; secrets use\n" +
+ "`oc agent secret` and never appear here.",
+ Args: cobra.MaximumNArgs(1),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ sc, err := sessionsClient(cmd)
+ if err != nil {
+ return err
+ }
+ id, err := targetAgentID(cmd, sc, args)
+ if err != nil {
+ return err
+ }
+ cfg, err := getAgentConfig(cmd, sc, id)
+ if err != nil {
+ return err
+ }
+
+ setVars, _ := cmd.Flags().GetStringArray("var")
+ unsetVars, _ := cmd.Flags().GetStringArray("unset-var")
+ allowHosts, _ := cmd.Flags().GetStringArray("allow-host")
+ denyHosts, _ := cmd.Flags().GetStringArray("deny-host")
+ clearVars, _ := cmd.Flags().GetBool("clear-vars")
+ clearEgress, _ := cmd.Flags().GetBool("clear-egress")
+ changing := len(setVars)+len(unsetVars)+len(allowHosts)+len(denyHosts) > 0 || clearVars || clearEgress
+ if changing {
+ parsed, err := parseConfigVars(setVars)
+ if err != nil {
+ return err
+ }
+ if clearVars {
+ cfg.Vars = map[string]string{}
+ }
+ for name, value := range parsed {
+ cfg.Vars[name] = value
+ }
+ for _, name := range unsetVars {
+ delete(cfg.Vars, strings.TrimSpace(name))
+ }
+ if clearEgress {
+ cfg.EgressAllowlist = nil
+ }
+ cfg.EgressAllowlist = append(cfg.EgressAllowlist, allowHosts...)
+ denied := make(map[string]struct{}, len(denyHosts))
+ for _, host := range denyHosts {
+ denied[strings.TrimSpace(host)] = struct{}{}
+ }
+ hosts := cfg.EgressAllowlist[:0]
+ for _, host := range sortedUnique(cfg.EgressAllowlist) {
+ if _, remove := denied[host]; !remove {
+ hosts = append(hosts, host)
+ }
+ }
+ cfg.EgressAllowlist = hosts
+ cfg, err = putAgentConfig(cmd, sc, id, cfg)
+ if err != nil {
+ return err
+ }
+ }
+
+ printer.Print(cfg, func() {
+ if len(cfg.Vars) == 0 {
+ fmt.Println("Vars: (none)")
+ } else {
+ fmt.Println("Vars:")
+ keys := make([]string, 0, len(cfg.Vars))
+ for key := range cfg.Vars {
+ keys = append(keys, key)
+ }
+ sort.Strings(keys)
+ for _, key := range keys {
+ fmt.Printf(" %s=%s\n", key, cfg.Vars[key])
+ }
+ }
+ if len(cfg.EgressAllowlist) == 0 {
+ fmt.Println("Outbound hosts: (none; fail-closed)")
+ } else {
+ fmt.Println("Outbound hosts:")
+ for _, host := range cfg.EgressAllowlist {
+ fmt.Printf(" %s\n", host)
+ }
+ }
+ if changing {
+ fmt.Println("Saved. Vars apply on the next deploy; egress policy applies shortly.")
+ }
+ })
+ return nil
+ },
+}
+
+var agentSecretCmd = &cobra.Command{
+ Use: "secret",
+ Short: "Manage write-only Flue Worker secrets",
+}
+
+var agentSecretListCmd = &cobra.Command{
+ Use: "list [id|name]",
+ Aliases: []string{"ls"},
+ Short: "List secret metadata (values are never returned)",
+ Args: cobra.MaximumNArgs(1),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ sc, err := sessionsClient(cmd)
+ if err != nil {
+ return err
+ }
+ id, err := targetAgentID(cmd, sc, args)
+ if err != nil {
+ return err
+ }
+ var res agentSecretList
+ if err := sc.Get(cmd.Context(), agentSecretsPath(id), &res); err != nil {
+ return err
+ }
+ printer.Print(res.Data, func() {
+ if len(res.Data) == 0 {
+ fmt.Println("No secrets.")
+ return
+ }
+ rows := make([][]string, 0, len(res.Data))
+ for _, secret := range res.Data {
+ rows = append(rows, []string{secret.Name, secret.Last4, secret.SyncStatus, formatAge(secret.UpdatedAt)})
+ }
+ printer.Table([]string{"NAME", "LAST4", "STATUS", "UPDATED"}, rows)
+ })
+ return nil
+ },
+}
+
+var agentSecretSetCmd = &cobra.Command{
+ Use: "set <name> [value]",
+ Short: "Set or rotate a Worker secret",
+ Long: "Set a write-only Flue Worker secret. Prefer --from-stdin so the value does not\n" +
+ "enter shell history. The live Worker is updated in place when already deployed.",
+ Args: cobra.RangeArgs(1, 2),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ sc, err := sessionsClient(cmd)
+ if err != nil {
+ return err
+ }
+ id, err := targetAgentID(cmd, sc, nil)
+ if err != nil {
+ return err
+ }
+ fromStdin, _ := cmd.Flags().GetBool("from-stdin")
+ var value string
+ switch {
+ case fromStdin && len(args) == 2:
+ return fmt.Errorf("pass the value or --from-stdin, not both")
+ case fromStdin:
+ scanner := bufio.NewScanner(os.Stdin)
+ var lines []string
+ for scanner.Scan() {
+ lines = append(lines, scanner.Text())
+ }
+ if err := scanner.Err(); err != nil {
+ return fmt.Errorf("reading stdin: %w", err)
+ }
+ value = strings.Join(lines, "\n")
+ case len(args) == 2:
+ value = args[1]
+ default:
+ return fmt.Errorf("provide a value or use --from-stdin")
+ }
+ if value == "" {
+ return fmt.Errorf("secret value cannot be empty")
+ }
+ var saved agentSecret
+ if err := sc.PutJSON(cmd.Context(), agentSecretPath(id, args[0]), map[string]string{"value": value}, &saved); err != nil {
+ return err
+ }
+ printer.Print(saved, func() { fmt.Printf("Secret %s set (%s).\n", saved.Name, saved.SyncStatus) })
+ return nil
+ },
+}
+
+var agentSecretDeleteCmd = &cobra.Command{
+ Use: "delete <name>",
+ Aliases: []string{"rm"},
+ Short: "Delete a Worker secret",
+ Args: cobra.ExactArgs(1),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ sc, err := sessionsClient(cmd)
+ if err != nil {
+ return err
+ }
+ id, err := targetAgentID(cmd, sc, nil)
+ if err != nil {
+ return err
+ }
+ if err := sc.Delete(cmd.Context(), agentSecretPath(id, args[0])); err != nil {
+ return err
+ }
+ fmt.Printf("Secret %s deleted.\n", args[0])
+ return nil
+ },
+}
+
+func registerAgentConfig() {
+ agentConfigCmd.Flags().String("agent", "", "Target agent id or name (else the cwd agent.toml)")
+ agentConfigCmd.Flags().StringArray("var", nil, "Set a non-secret binding (NAME=VALUE; repeatable)")
+ agentConfigCmd.Flags().StringArray("unset-var", nil, "Remove a non-secret binding (repeatable)")
+ agentConfigCmd.Flags().StringArray("allow-host", nil, "Allow outbound HTTPS to a hostname (repeatable; supports *.example.com)")
+ agentConfigCmd.Flags().StringArray("deny-host", nil, "Remove a hostname from the outbound allowlist (repeatable)")
+ agentConfigCmd.Flags().Bool("clear-vars", false, "Remove all non-secret bindings")
+ agentConfigCmd.Flags().Bool("clear-egress", false, "Return outbound HTTPS to fail-closed defaults")
+
+ for _, command := range []*cobra.Command{agentSecretListCmd, agentSecretSetCmd, agentSecretDeleteCmd} {
+ command.Flags().String("agent", "", "Target agent id or name (else the cwd agent.toml)")
+ }
+ agentSecretSetCmd.Flags().Bool("from-stdin", false, "Read the secret value from stdin")
+ agentSecretCmd.AddCommand(agentSecretListCmd, agentSecretSetCmd, agentSecretDeleteCmd)
+ agentCmd.AddCommand(agentConfigCmd, agentSecretCmd)
+}
diff --git a/cmd/oc/internal/commands/agent_deploy.go b/cmd/oc/internal/commands/agent_deploy.go
index d877ca4e..e45140ec 100644
--- a/cmd/oc/internal/commands/agent_deploy.go
+++ b/cmd/oc/internal/commands/agent_deploy.go
@@ -16,8 +16,12 @@ import (
// ── agent.toml manifest + deploy bundle ──
type manifest struct {
- Name string `toml:"name"`
- Model string `toml:"model"`
+ Name string `toml:"name"`
+ Model string `toml:"model"`
+ // Non-secret Flue Worker bindings. A nil map means the [vars] section was
+ // omitted and deploy must leave the remote config untouched; an explicitly
+ // empty [vars] section clears it. Secrets never belong in agent.toml.
+ Vars map[string]string `toml:"vars"`
Runtime struct {
Family string `toml:"family"`
Type string `toml:"type"`
diff --git a/cmd/oc/internal/commands/agent_deploy_flue.go b/cmd/oc/internal/commands/agent_deploy_flue.go
index e13f95d9..63957f4c 100644
--- a/cmd/oc/internal/commands/agent_deploy_flue.go
+++ b/cmd/oc/internal/commands/agent_deploy_flue.go
@@ -71,6 +71,13 @@ func deployFlue(cmd *cobra.Command, sc *client.Client, dir string, m *manifest,
if err != nil {
return err
}
+ // [vars] is part of the deployment input even though the values live in the
+ // agent config resource. Persist it before enqueueing so the off-host runner
+ // cannot race ahead and compose the Worker with stale bindings. Preserve the
+ // separately managed egress allowlist. Secrets are intentionally CLI/API only.
+ if err := syncManifestVars(cmd, sc, id, m); err != nil {
+ return err
+ }
// 3. Build the app with its own `flue` CLI (a devDependency).
if err := runFlueBuild(cmd.Context(), dir); err != nil {
diff --git a/cmd/oc/internal/commands/agent_deploy_flue_test.go b/cmd/oc/internal/commands/agent_deploy_flue_test.go
index ba0c059d..29a749bb 100644
--- a/cmd/oc/internal/commands/agent_deploy_flue_test.go
+++ b/cmd/oc/internal/commands/agent_deploy_flue_test.go
@@ -43,6 +43,8 @@ type fakeCP struct {
mu sync.Mutex
self string
createBody map[string]any
+ configGets int
+ configPutBody map[string]any
artifactDigest string
artifactSize float64
uploaded []byte
@@ -63,6 +65,15 @@ func (f *fakeCP) ServeHTTP(w http.ResponseWriter, r *http.Request) {
case r.Method == "POST" && r.URL.Path == "/v3/agents":
_ = json.NewDecoder(r.Body).Decode(&f.createBody)
writeJSON(map[string]any{"id": "agt_e2e", "name": "e2e-flue", "model": "anthropic/claude-sonnet-5", "runtime": "flue"})
+ case r.Method == "GET" && r.URL.Path == "/v3/agents/agt_e2e/config":
+ f.configGets++
+ writeJSON(map[string]any{"vars": map[string]string{}, "egress_allowlist": []string{"api.example.com"}})
+ case r.Method == "PUT" && r.URL.Path == "/v3/agents/agt_e2e/config":
+ _ = json.NewDecoder(r.Body).Decode(&f.configPutBody)
+ writeJSON(map[string]any{
+ "vars": f.configPutBody["vars"], "egress_allowlist": f.configPutBody["egress_allowlist"],
+ "deployment_required": true,
+ })
case r.Method == "POST" && r.URL.Path == "/v3/agents/agt_e2e/artifacts":
var body map[string]any
_ = json.NewDecoder(r.Body).Decode(&body)
@@ -215,6 +226,48 @@ func TestDeployFlueDoEndToEnd(t *testing.T) {
if f.getCount < 2 {
t.Errorf("expected the poll to observe verifying→ready (got %d GETs)", f.getCount)
}
+ if f.configGets != 0 || f.configPutBody != nil {
+ t.Errorf("manifest without [vars] unexpectedly touched remote config: gets=%d put=%v", f.configGets, f.configPutBody)
+ }
+}
+
+func TestSyncManifestVarsPreservesEgress(t *testing.T) {
+ f := &fakeCP{}
+ srv := httptest.NewServer(f)
+ defer srv.Close()
+ f.self = srv.URL
+
+ sc := client.NewSessionsAPI(srv.URL, "test-key")
+ cmd := &cobra.Command{}
+ cmd.SetContext(context.Background())
+ m := &manifest{Vars: map[string]string{"PUBLIC_MODE": "careful", "MAX_ITEMS": "12"}}
+ if err := syncManifestVars(cmd, sc, "agt_e2e", m); err != nil {
+ t.Fatalf("syncManifestVars: %v", err)
+ }
+ if f.configGets != 1 {
+ t.Fatalf("config GETs = %d, want 1", f.configGets)
+ }
+ vars, _ := f.configPutBody["vars"].(map[string]any)
+ if vars["PUBLIC_MODE"] != "careful" || vars["MAX_ITEMS"] != "12" {
+ t.Errorf("vars PUT = %#v", f.configPutBody["vars"])
+ }
+ hosts, _ := f.configPutBody["egress_allowlist"].([]any)
+ if len(hosts) != 1 || hosts[0] != "api.example.com" {
+ t.Errorf("egress allowlist was not preserved: %#v", f.configPutBody["egress_allowlist"])
+ }
+}
+
+func TestParseConfigVars(t *testing.T) {
+ got, err := parseConfigVars([]string{"MODE=fast", "EMPTY="})
+ if err != nil {
+ t.Fatal(err)
+ }
+ if got["MODE"] != "fast" || got["EMPTY"] != "" {
+ t.Fatalf("parsed = %#v", got)
+ }
+ if _, err := parseConfigVars([]string{"BROKEN"}); err == nil {
+ t.Fatal("expected malformed --var to fail")
+ }
}
func TestDeployFlueBlocksOnLeakedKey(t *testing.T) {
diff --git a/sdks/typescript/src/agents/agents.ts b/sdks/typescript/src/agents/agents.ts
index c45d8372..90c81b35 100644
--- a/sdks/typescript/src/agents/agents.ts
+++ b/sdks/typescript/src/agents/agents.ts
@@ -5,6 +5,7 @@ import {
type Deployment, type InlineSkillFile,
} from "./deployments.js";
import { Schedules } from "./schedules.js";
+import { AgentConfigResource } from "./config.js";
export interface CreateAgentParams {
name: string;
@@ -71,6 +72,8 @@ export class Agents {
readonly deploymentSource: DeploymentSourceResource;
/** Cron for agents — schedules that fire a session per slot (015). */
readonly schedules: Schedules;
+ /** Flue Worker vars, outbound host policy, and write-only secrets. */
+ readonly config: AgentConfigResource;
constructor(private readonly http: Http) {
this.deployments = new Deployments(http);
@@ -79,6 +82,7 @@ export class Agents {
this.skills = new Skills(http);
this.deploymentSource = new DeploymentSourceResource(http);
this.schedules = new Schedules(http);
+ this.config = new AgentConfigResource(http);
}
create(params: CreateAgentParams): Promise<Agent> {
diff --git a/sdks/typescript/src/agents/config.test.ts b/sdks/typescript/src/agents/config.test.ts
new file mode 100644
index 00000000..1b7354dc
--- /dev/null
+++ b/sdks/typescript/src/agents/config.test.ts
@@ -0,0 +1,37 @@
+import { describe, expect, it, vi } from "vitest";
+import { OpenComputer } from "./client.js";
+
+describe("Flue agent config", () => {
+ it("normalizes config and serializes replacement writes", async () => {
+ const calls: Array<{ url: string; init?: RequestInit }> = [];
+ const fetch = vi.fn(async (input: string | URL | Request, init?: RequestInit) => {
+ calls.push({ url: String(input), init });
+ if (init?.method === "PUT") {
+ return Response.json({ vars: { MODE: "safe" }, egress_allowlist: ["api.example.com"], deployment_required: true });
+ }
+ return Response.json({ vars: {}, egress_allowlist: [] });
+ });
+ const oc = new OpenComputer({ apiKey: "test", baseUrl: "https://cp.example/v3", fetch: fetch as typeof globalThis.fetch });
+
+ const saved = await oc.agents.config.put("agt_1", {
+ vars: { MODE: "safe" }, egressAllowlist: ["api.example.com"],
+ });
+
+ expect(saved.egressAllowlist).toEqual(["api.example.com"]);
+ expect(saved.deploymentRequired).toBe(true);
+ expect(calls[0]?.url).toBe("https://cp.example/v3/agents/agt_1/config");
+ expect(JSON.parse(String(calls[0]?.init?.body))).toEqual({
+ vars: { MODE: "safe" }, egress_allowlist: ["api.example.com"],
+ });
+ });
+
+ it("never expects values when listing write-only secrets", async () => {
+ const fetch = vi.fn(async () => Response.json({
+ data: [{ name: "GITHUB_TOKEN", last4: "1234", updated_at: "2026-07-12T00:00:00Z", sync_status: "synced" }],
+ }));
+ const oc = new OpenComputer({ apiKey: "test", baseUrl: "https://cp.example/v3", fetch: fetch as typeof globalThis.fetch });
+ const secrets = await oc.agents.config.listSecrets("agt_1");
+ expect(secrets).toEqual([{ name: "GITHUB_TOKEN", last4: "1234", updatedAt: "2026-07-12T00:00:00Z", syncStatus: "synced" }]);
+ expect(secrets[0]).not.toHaveProperty("value");
+ });
+});
diff --git a/sdks/typescript/src/agents/config.ts b/sdks/typescript/src/agents/config.ts
new file mode 100644
index 00000000..0f3f5435
--- /dev/null
+++ b/sdks/typescript/src/agents/config.ts
@@ -0,0 +1,52 @@
+import type { Http } from "./http.js";
+
+/** Non-secret bindings and the fail-closed outbound host policy for a Flue agent. */
+export interface FlueAgentConfig {
+ vars: Record<string, string>;
+ egressAllowlist: string[];
+ /** True after a config write because vars are baked into the next deployment. */
+ deploymentRequired?: boolean;
+}
+
+/** Replacement config. Read first when you want merge semantics. */
+export interface PutFlueAgentConfigParams {
+ vars?: Record<string, string>;
+ egressAllowlist?: string[];
+}
+
+/** Write-only secret metadata. The value is never returned. */
+export interface FlueAgentSecret {
+ name: string;
+ last4: string;
+ updatedAt: string;
+ syncStatus: "synced" | "pending_deploy" | "error";
+}
+
+/** Flue Worker config and write-only secret bindings (`oc.agents.config`). */
+export class AgentConfigResource {
+ constructor(private readonly http: Http) {}
+
+ get(agentId: string): Promise<FlueAgentConfig> {
+ return this.http.request("GET", `/agents/${agentId}/config`);
+ }
+
+ /** Replace non-secret vars and the outbound allowlist. Omitted fields become empty. */
+ put(agentId: string, params: PutFlueAgentConfigParams): Promise<FlueAgentConfig> {
+ return this.http.request("PUT", `/agents/${agentId}/config`, { body: params });
+ }
+
+ /** List names/status only; OpenComputer never returns secret values. */
+ async listSecrets(agentId: string): Promise<FlueAgentSecret[]> {
+ const result = await this.http.request<{ data: FlueAgentSecret[] }>("GET", `/agents/${agentId}/secrets`);
+ return result.data;
+ }
+
+ /** Create or rotate a secret. A deployed Worker is updated in place when possible. */
+ setSecret(agentId: string, name: string, value: string): Promise<FlueAgentSecret> {
+ return this.http.request("PUT", `/agents/${agentId}/secrets/${encodeURIComponent(name)}`, { body: { value } });
+ }
+
+ deleteSecret(agentId: string, name: string): Promise<void> {
+ return this.http.request("DELETE", `/agents/${agentId}/secrets/${encodeURIComponent(name)}`);
+ }
+}
diff --git a/sdks/typescript/src/agents/index.ts b/sdks/typescript/src/agents/index.ts
index 22f6a680..855d4d96 100644
--- a/sdks/typescript/src/agents/index.ts
+++ b/sdks/typescript/src/agents/index.ts
@@ -37,6 +37,10 @@ export type {
Schedule, ScheduleRun, ScheduleState, RunOutcome, Overlap,
CreateScheduleParams, UpdateScheduleParams, RunsPage,
} from "./schedules.js";
+export { AgentConfigResource } from "./config.js";
+export type {
+ FlueAgentConfig, PutFlueAgentConfigParams, FlueAgentSecret,
+} from "./config.js";
export { verifyWebhook, WebhookVerificationError } from "./webhooks.js";
export type { WebhookDelivery, VerifyWebhookOptions } from "./webhooks.js";
diff --git a/sdks/typescript/src/agents/normalize.test.ts b/sdks/typescript/src/agents/normalize.test.ts
index bcadbe24..168ddb04 100644
--- a/sdks/typescript/src/agents/normalize.test.ts
+++ b/sdks/typescript/src/agents/normalize.test.ts
@@ -31,6 +31,11 @@ describe("normalize (API response → idiomatic TS)", () => {
});
expect(out.refs).toEqual({ pull_number: 42, owner_repo: "acme/widgets", nested: { keep_me: true } });
});
+
+ it("passes env binding names through verbatim", () => {
+ const out = normalize<{ vars?: Record<string, string> }>({ vars: { PUBLIC_MODE: "safe" } });
+ expect(out.vars).toEqual({ PUBLIC_MODE: "safe" });
+ });
});
describe("serialize (request body → snake_case)", () => {
@@ -44,4 +49,9 @@ describe("serialize (request body → snake_case)", () => {
const out = serialize({ refs: { pullNumber: 42, owner_repo: "acme/widgets" } }) as Record<string, unknown>;
expect(out.refs).toEqual({ pullNumber: 42, owner_repo: "acme/widgets" });
});
+
+ it("leaves env binding names opaque on request bodies", () => {
+ const out = serialize({ vars: { PUBLIC_MODE: "safe" } }) as Record<string, unknown>;
+ expect(out.vars).toEqual({ PUBLIC_MODE: "safe" });
+ });
});
diff --git a/sdks/typescript/src/agents/normalize.ts b/sdks/typescript/src/agents/normalize.ts
index 23cb8fbb..2c609666 100644
--- a/sdks/typescript/src/agents/normalize.ts
+++ b/sdks/typescript/src/agents/normalize.ts
@@ -1,8 +1,8 @@
// Normalize API responses to idiomatic TS: snake_case keys → camelCase, and a known set
// of numeric fields that the API serializes as strings (bigints) → numbers. Opaque
// subtrees are passed through untouched: `raw` (source-specific adapter data),
-// `metadata`, and `refs` (caller-owned routing JSON — must round-trip verbatim,
-// keys included).
+// `metadata`, `refs`, and `vars` (caller-owned routing/config JSON — must
+// round-trip verbatim, keys included).
const NUMERIC = new Set([
"seq", "head", "inputCursor", "inputFromSeq", "inputToSeq", "exitCode", "bytes", "port",
@@ -18,7 +18,7 @@ export function normalize<T = any>(value: unknown): T {
const out: Record<string, unknown> = {};
for (const [k, v] of Object.entries(value as Record<string, unknown>)) {
const ck = camel(k);
- if (ck === "raw" || ck === "metadata" || ck === "refs") { out[ck] = v; continue; } // opaque: verbatim, keys untouched
+ if (ck === "raw" || ck === "metadata" || ck === "refs" || ck === "vars") { out[ck] = v; continue; } // opaque: verbatim, keys untouched
let nv: unknown = normalize(v);
if (NUMERIC.has(ck) && typeof nv === "string" && nv !== "" && !Number.isNaN(Number(nv))) {
nv = Number(nv);
@@ -34,7 +34,7 @@ export function normalize<T = any>(value: unknown): T {
// snake_case). Values are left untouched, and opaque/user-owned subtrees (raw, body,
// metadata, refs, input) are passed through without key-mangling.
const snakeKey = (k: string): string => k.replace(/[A-Z]/g, (c) => "_" + c.toLowerCase());
-const OPAQUE = new Set(["raw", "body", "metadata", "refs", "input"]);
+const OPAQUE = new Set(["raw", "body", "metadata", "refs", "input", "vars"]);
export function serialize(value: unknown): unknown {
if (Array.isArray(value)) return value.map((v) => serialize(v));