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: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ellipsis/cli",
"version": "0.1.6",
"version": "0.8.0",
"description": "Ellipsis agent CLI: drive the Ellipsis cloud from your terminal",
"license": "MIT",
"type": "module",
Expand Down
27 changes: 20 additions & 7 deletions src/commands/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,34 +71,47 @@ export function registerConnect(session: Command): void {
.description(
'Connect to a cloud session: view the conversation, follow it live, and send messages',
)
.option('--no-backlog', 'skip printing the stored transcript on open')
.option('--no-steps', 'skip replaying prior steps on open')
.option(
'--no-input',
'follow read-only: never open the composer, even on a keyed session (for non-interactive callers)',
)
.addHelpText(
'after',
`\nMessage mode: render the conversation, follow it live, and send lines through
the session inbox — single-writer-safe and usable headless / inside a sandbox.`,
the session inbox — single-writer-safe and usable headless / inside a sandbox.
Pass --no-input to follow read-only from a script or agent (no TTY needed).`,
)
.action(async (sessionId: string | undefined, opts: { backlog: boolean }) => {
.action(async (sessionId: string | undefined, opts: { steps: boolean; input: boolean }) => {
await runAction(async () => {
const id = resolveConnectSessionId(sessionId)
await runConnect(id, opts.backlog)
await runConnect(id, opts.steps, !opts.input)
})
})
}

export async function runConnect(sessionId: string, backlog: boolean): Promise<void> {
export async function runConnect(
sessionId: string,
showSteps: boolean,
readOnly = false,
): Promise<void> {
const api = new ApiClient()
const token = requireToken()
const wsBase = resolveWsBase(resolveApiBase())

const [session, me] = await Promise.all([api.getAgentSession(sessionId), api.whoami()])
const { canSend, reason } = connectability(session)
const c = connectability(session)
// --no-input forces watch-only even when the session would accept messages.
const canSend = readOnly ? false : c.canSend
const reason =
readOnly && c.canSend ? 'read-only (--no-input) — following without the composer' : c.reason

console.log(`session: ${session.id} (${session.status})`)
if (session.agent_config_id) console.log(`config: ${session.agent_config_id}`)
console.log(`url: ${sessionUrl(resolveAppBase(), me.customer_login, sessionId)}`)
if (reason) console.log(reason)

if (backlog) {
if (showSteps) {
const steps = await api.getAgentSessionSteps(sessionId)
if (steps.length > 0) {
const ordered = [...steps].sort(
Expand Down
Loading
Loading