Skip to content

feat: add top-level exec and shell commands - #52

Draft
Hweinstock wants to merge 8 commits into
refactorfrom
feat/top-level-exec-shell
Draft

Hweinstock wants to merge 8 commits into
refactorfrom
feat/top-level-exec-shell

Conversation

@Hweinstock

Copy link
Copy Markdown
Owner

Summary

  • Add top-level agentcore exec with Runtime/Harness selectors and shared ARN resolution.
  • Add top-level agentcore shell while routing interactive flows through the existing Runtime shell and Harness exec screens.
  • Remove the nested harness exec and runtime shell command registrations.
  • Update command reference and user documentation.

Spec

Top-level exec and shell support Runtime/Harness resources under the hood and reuse the existing TUI flows. The requested resource resolver is implemented in src/handlers/utils.tsx.

Verification

  • bun run typecheck
  • bun run lint:check
  • bun run format:check
  • bun run compile
  • Focused handler and TUI tests: 154 passed
  • Full suite reached 3,447 passed; remaining failures were environment-restricted process/listener/network tests in the sandbox.

Account-backed Runtime/Harness execution and TUI recordings require account credentials and resource IDs, so those could not be captured in this environment.

@Hweinstock
Hweinstock force-pushed the feat/top-level-exec-shell branch from f2d3d12 to 8113ec3 Compare September 24, 2026 20:23
Comment thread src/handlers/utils.tsx Outdated
import { JsonRendererKey } from "../tui";
import type { Core } from "./types";

export type ResourceType = "runtime" | "gateway" | "harness";

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just inline this type, it doesn't deserve an alias?

Comment thread src/handlers/utils.tsx Outdated
}

/**
* Given a resource type and identifier, resolve the resource's full ARN.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets use tsdoc format here.

Comment thread command.md
- [`agentcore traces runtime get`](#agentcore-traces-runtime-get)
- [`agentcore traces harness`](#agentcore-traces-harness)
- [`agentcore traces harness list`](#agentcore-traces-harness-list)
- [`agentcore traces harness get`](#agentcore-traces-harness-get)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont touch command.md manually.

Comment thread src/handlers/exec/operation.ts Outdated
output: string;
};

export async function invokeExecCommand(

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets use a object here for the input args. ex. { core: Core, input: ExecInput, ...}

Comment thread src/handlers/exec/index.tsx Outdated
await renderTuiAt(path, ctx, core, io);
} else {
const path = [
"/agentcore/runtime/shell",

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're going to want a single path: /agentcore/shell that supports both with a query param for resource type of something. The paths should match the underlying command structure.

Comment thread scripts/generate-command-reference.mjs Outdated
"build",
],
},
{ id: "runtime", title: "Runtime commands", commands: ["exec", "shell"] },

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this still here? I thought we removed runtime exec as a command?

Comment thread src/handlers/exec/index.tsx Outdated
if (flags.command !== undefined || ctx.require(JsonKey)) {
throw new InputValidationError("specify one of --runtime or --harness");
}
await renderTuiAt("/agentcore", ctx, core, io);

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not sure why we would render the home page when running this command?

Comment thread src/handlers/exec/index.tsx Outdated
if (flags["session-id"]) params.set("sessionId", flags["session-id"]);
if (flags.qualifier) params.set("qualifier", flags.qualifier);
await renderTuiAt(
`/agentcore/shell/${encodeURIComponent(resourceId)}?${params}`,

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is exec routing to shell?

Comment thread src/components/Root.tsx Outdated
path="agentcore/harness/exec/:harnessId/:sessionId"
element={<HarnessExecScreen ctx={ctx} core={core} />}
/>
<Route path="agentcore/shell/:resourceId?" element={<ShellScreen ctx={ctx} core={core} />} />

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't actually think we need a tui path for shell, shell just opens a shell. We would need one for exec.

Comment thread src/handlers/harness/exec/screen.tsx Outdated
export function HarnessExecScreen({
harnessId: routeHarnessId,
sessionId: routeSessionId,
routePath = "/agentcore/harness/exec",

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets simplify by removing exec under harness, and only supporting it at the top level.

Comment thread src/handlers/runtime/shell/screen.tsx Outdated
export function RuntimeShellScreen({
runtimeId: routeRuntimeId,
qualifier: routeQualifier,
routePath = "/agentcore/runtime/shell",

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, lets simplify by removing the nested ones.

Comment thread src/handlers/shell/screen.tsx Outdated
import { RuntimeShellScreen } from "../runtime/shell/screen";
import type { ScreenProps } from "../types";

export function ShellScreen(props: ScreenProps) {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think harness supports shell. also shell should not have a tui.

Comment thread src/handlers/utils.tsx Outdated
import { JsonRendererKey } from "../tui";
import type { Core } from "./types";

export type ResourceType = "runtime" | "gateway" | "harness";

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inline this below on line 49.

Comment thread command.md
- [`agentcore traces`](#agentcore-traces)
- [`agentcore traces runtime`](#agentcore-traces-runtime)
- [`agentcore traces runtime list`](#agentcore-traces-runtime-list)
- [`agentcore traces runtime get`](#agentcore-traces-runtime-get)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undo diff to this one.

Comment thread src/components/Root.tsx Outdated
/>
<Route path="agentcore/harness/exec" element={<HarnessExecScreen ctx={ctx} core={core} />} />
<Route path="agentcore/exec" element={<ExecScreen ctx={ctx} core={core} />} />
<Route path="agentcore/exec/:harnessId" element={<ExecScreen ctx={ctx} core={core} />} />

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to support runtime as well, so keep the harnessId general enough to resourceId. Then use the resourceType query parameter like we did before to determine the resource type.


const resourceId = serviceIdFromArn(resourceArn);
if (flags.command === undefined) {
if (ctx.require(JsonKey)) {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i feel like we could simplify this here with an or to avoid the same error twice.

return;
}

const result = await invokeExecCommand({

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i want to be able to exec in runtime. see previous comment.

breadcrumb={["agentcore", "harness", "exec"]}
breadcrumb={["agentcore", "exec"]}
description="choose a harness to exec into"
onSelect={(id) => navigate(`/agentcore/harness/exec/${id}`)}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment on resource type.

Comment thread src/handlers/utils.tsx Outdated
import { JsonRendererKey } from "../tui";
import type { Core } from "./types";

export type ResourceType = "runtime" | "gateway" | "harness";

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

INLINE THIS

Comment thread src/components/Root.tsx Outdated
path="agentcore/harness/exec/:harnessId/:sessionId"
element={<HarnessExecScreen ctx={ctx} core={core} />}
/>
<Route path="agentcore/exec/:resourceId?" element={<ExecScreen ctx={ctx} core={core} />} />

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets just do agentcore/exec/:resourceType/:resourceId where resourceType is either runtime or harness.

Then we still need the agentcore/exec/:resourceType/:resourceId/:sessionId from below as well.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant