feat: add top-level exec and shell commands - #52
Hweinstock wants to merge 8 commits into
Conversation
f2d3d12 to
8113ec3
Compare
| import { JsonRendererKey } from "../tui"; | ||
| import type { Core } from "./types"; | ||
|
|
||
| export type ResourceType = "runtime" | "gateway" | "harness"; |
There was a problem hiding this comment.
just inline this type, it doesn't deserve an alias?
| } | ||
|
|
||
| /** | ||
| * Given a resource type and identifier, resolve the resource's full ARN. |
There was a problem hiding this comment.
lets use tsdoc format here.
| - [`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) |
There was a problem hiding this comment.
dont touch command.md manually.
| output: string; | ||
| }; | ||
|
|
||
| export async function invokeExecCommand( |
There was a problem hiding this comment.
lets use a object here for the input args. ex. { core: Core, input: ExecInput, ...}
| await renderTuiAt(path, ctx, core, io); | ||
| } else { | ||
| const path = [ | ||
| "/agentcore/runtime/shell", |
There was a problem hiding this comment.
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.
| "build", | ||
| ], | ||
| }, | ||
| { id: "runtime", title: "Runtime commands", commands: ["exec", "shell"] }, |
There was a problem hiding this comment.
why is this still here? I thought we removed runtime exec as a command?
| if (flags.command !== undefined || ctx.require(JsonKey)) { | ||
| throw new InputValidationError("specify one of --runtime or --harness"); | ||
| } | ||
| await renderTuiAt("/agentcore", ctx, core, io); |
There was a problem hiding this comment.
im not sure why we would render the home page when running this command?
| 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}`, |
There was a problem hiding this comment.
why is exec routing to shell?
| path="agentcore/harness/exec/:harnessId/:sessionId" | ||
| element={<HarnessExecScreen ctx={ctx} core={core} />} | ||
| /> | ||
| <Route path="agentcore/shell/:resourceId?" element={<ShellScreen ctx={ctx} core={core} />} /> |
There was a problem hiding this comment.
i don't actually think we need a tui path for shell, shell just opens a shell. We would need one for exec.
| export function HarnessExecScreen({ | ||
| harnessId: routeHarnessId, | ||
| sessionId: routeSessionId, | ||
| routePath = "/agentcore/harness/exec", |
There was a problem hiding this comment.
lets simplify by removing exec under harness, and only supporting it at the top level.
| export function RuntimeShellScreen({ | ||
| runtimeId: routeRuntimeId, | ||
| qualifier: routeQualifier, | ||
| routePath = "/agentcore/runtime/shell", |
There was a problem hiding this comment.
same here, lets simplify by removing the nested ones.
| import { RuntimeShellScreen } from "../runtime/shell/screen"; | ||
| import type { ScreenProps } from "../types"; | ||
|
|
||
| export function ShellScreen(props: ScreenProps) { |
There was a problem hiding this comment.
i don't think harness supports shell. also shell should not have a tui.
| import { JsonRendererKey } from "../tui"; | ||
| import type { Core } from "./types"; | ||
|
|
||
| export type ResourceType = "runtime" | "gateway" | "harness"; |
There was a problem hiding this comment.
inline this below on line 49.
| - [`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) |
There was a problem hiding this comment.
undo diff to this one.
| /> | ||
| <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} />} /> |
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
i feel like we could simplify this here with an or to avoid the same error twice.
| return; | ||
| } | ||
|
|
||
| const result = await invokeExecCommand({ |
There was a problem hiding this comment.
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}`)} |
There was a problem hiding this comment.
same comment on resource type.
| import { JsonRendererKey } from "../tui"; | ||
| import type { Core } from "./types"; | ||
|
|
||
| export type ResourceType = "runtime" | "gateway" | "harness"; |
| path="agentcore/harness/exec/:harnessId/:sessionId" | ||
| element={<HarnessExecScreen ctx={ctx} core={core} />} | ||
| /> | ||
| <Route path="agentcore/exec/:resourceId?" element={<ExecScreen ctx={ctx} core={core} />} /> |
There was a problem hiding this comment.
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.
Summary
agentcore execwith Runtime/Harness selectors and shared ARN resolution.agentcore shellwhile routing interactive flows through the existing Runtime shell and Harness exec screens.harness execandruntime shellcommand registrations.Spec
Top-level
execandshellsupport Runtime/Harness resources under the hood and reuse the existing TUI flows. The requested resource resolver is implemented insrc/handlers/utils.tsx.Verification
bun run typecheckbun run lint:checkbun run format:checkbun run compileAccount-backed Runtime/Harness execution and TUI recordings require account credentials and resource IDs, so those could not be captured in this environment.