Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 0 deletions src/commands/agent/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface CreateOptions {
ref?: string;
objectId?: string;
setupCommands?: string[];
public?: boolean;
output?: string;
}

Expand Down Expand Up @@ -104,6 +105,7 @@ export async function createAgentCommand(
const agent = await createAgent({
name: options.name,
...(options.agentVersion ? { version: options.agentVersion } : {}),
...(options.public ? { is_public: true } : {}),
source: { type: sourceType, [sourceType]: sourceOptions },
});

Expand Down
3 changes: 2 additions & 1 deletion src/commands/object/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@
const createResponse = await client.objects.create({
name,
content_type: detectedContentType,
});
...(options.public ? { is_public: true } : {}),
} as any);

Check warning on line 245 in src/commands/object/upload.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type

// Step 2: Upload the file
const uploadResponse = await fetch(createResponse.upload_url!, {
Expand Down
4 changes: 3 additions & 1 deletion src/services/agentService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ export async function listPublicAgents(
export interface CreateAgentOptions {
name: string;
version?: string;
is_public?: boolean;
source?: {
type: string;
npm?: {
Expand All @@ -280,10 +281,11 @@ export interface CreateAgentOptions {
*/
export async function createAgent(options: CreateAgentOptions): Promise<Agent> {
const client = getClient();
const { version, ...rest } = options;
const { version, is_public, ...rest } = options;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const params: any = { ...rest };
if (version) params.version = version;
if (is_public !== undefined) params.is_public = is_public;
return client.agents.create(params);
}

Expand Down
14 changes: 12 additions & 2 deletions src/utils/commands.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import { Command } from "commander";
import { Command, Option } from "commander";
import { VERSION } from "../version.js";
import { createDevbox } from "../commands/devbox/create.js";
import { listDevboxes } from "../commands/devbox/list.js";
import { deleteDevbox } from "../commands/devbox/delete.js";
import { execCommand } from "../commands/devbox/exec.js";
import { uploadFile } from "../commands/devbox/upload.js";
import { runloopBaseDomain } from "./config.js";

function publicOption(description: string): Option {
const opt = new Option("--public", description);
if (runloopBaseDomain() === "runloop.ai") {
opt.hideHelp();
}
return opt;
}

/**
* Creates and configures the Commander program with all commands.
Expand Down Expand Up @@ -657,7 +666,7 @@ export function createProgram(): Command {
"--content-type <type>",
"Content type: unspecified|text|binary|gzip|tar|tgz",
)
.option("--public", "Make object publicly accessible")
.addOption(publicOption("Make object publicly accessible"))
.option(
"-o, --output [format]",
"Output format: text|json|yaml (default: text)",
Expand Down Expand Up @@ -1210,6 +1219,7 @@ export function createProgram(): Command {
"--setup-commands <commands...>",
"Setup commands to run after installation",
)
.addOption(publicOption("Make agent publicly accessible"))
.option(
"-o, --output [format]",
"Output format: text|json|yaml (default: text)",
Expand Down
Loading