Skip to content

Commit 1968adf

Browse files
jason-rlclaude
andcommitted
feat: add --public flag to agent create and fix object upload --public
Add a --public option to `agent create` that sets `is_public: true` in the API request body (field exists on the API but is hidden from the SDK/OpenAPI spec). Also fix the existing `object upload --public` flag which was defined but never passed through to the API. Both --public flags are hidden from --help output when RUNLOOP_BASE_URL is unset or points to the default runloop.ai domain, and become visible when a custom base URL is configured. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3ef6271 commit 1968adf

4 files changed

Lines changed: 19 additions & 4 deletions

File tree

src/commands/agent/create.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ interface CreateOptions {
1515
ref?: string;
1616
objectId?: string;
1717
setupCommands?: string[];
18+
public?: boolean;
1819
output?: string;
1920
}
2021

@@ -104,6 +105,7 @@ export async function createAgentCommand(
104105
const agent = await createAgent({
105106
name: options.name,
106107
...(options.agentVersion ? { version: options.agentVersion } : {}),
108+
...(options.public ? { is_public: true } : {}),
107109
source: { type: sourceType, [sourceType]: sourceOptions },
108110
});
109111

src/commands/object/upload.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ export async function uploadObject(options: UploadObjectOptions) {
241241
const createResponse = await client.objects.create({
242242
name,
243243
content_type: detectedContentType,
244-
});
244+
...(options.public ? { is_public: true } : {}),
245+
} as any);
245246

246247
// Step 2: Upload the file
247248
const uploadResponse = await fetch(createResponse.upload_url!, {

src/services/agentService.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ export async function listPublicAgents(
258258
export interface CreateAgentOptions {
259259
name: string;
260260
version?: string;
261+
is_public?: boolean;
261262
source?: {
262263
type: string;
263264
npm?: {
@@ -280,10 +281,11 @@ export interface CreateAgentOptions {
280281
*/
281282
export async function createAgent(options: CreateAgentOptions): Promise<Agent> {
282283
const client = getClient();
283-
const { version, ...rest } = options;
284+
const { version, is_public, ...rest } = options;
284285
// eslint-disable-next-line @typescript-eslint/no-explicit-any
285286
const params: any = { ...rest };
286287
if (version) params.version = version;
288+
if (is_public !== undefined) params.is_public = is_public;
287289
return client.agents.create(params);
288290
}
289291

src/utils/commands.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1-
import { Command } from "commander";
1+
import { Command, Option } from "commander";
22
import { VERSION } from "../version.js";
33
import { createDevbox } from "../commands/devbox/create.js";
44
import { listDevboxes } from "../commands/devbox/list.js";
55
import { deleteDevbox } from "../commands/devbox/delete.js";
66
import { execCommand } from "../commands/devbox/exec.js";
77
import { uploadFile } from "../commands/devbox/upload.js";
8+
import { runloopBaseDomain } from "./config.js";
9+
10+
function publicOption(description: string): Option {
11+
const opt = new Option("--public", description);
12+
if (runloopBaseDomain() === "runloop.ai") {
13+
opt.hideHelp();
14+
}
15+
return opt;
16+
}
817

918
/**
1019
* Creates and configures the Commander program with all commands.
@@ -657,7 +666,7 @@ export function createProgram(): Command {
657666
"--content-type <type>",
658667
"Content type: unspecified|text|binary|gzip|tar|tgz",
659668
)
660-
.option("--public", "Make object publicly accessible")
669+
.addOption(publicOption("Make object publicly accessible"))
661670
.option(
662671
"-o, --output [format]",
663672
"Output format: text|json|yaml (default: text)",
@@ -1210,6 +1219,7 @@ export function createProgram(): Command {
12101219
"--setup-commands <commands...>",
12111220
"Setup commands to run after installation",
12121221
)
1222+
.addOption(publicOption("Make agent publicly accessible"))
12131223
.option(
12141224
"-o, --output [format]",
12151225
"Output format: text|json|yaml (default: text)",

0 commit comments

Comments
 (0)