/** * Opening the Sessions browser, from launch or from inside a session. * * One entry point for both, on purpose. `--resume` with no id and `/sessions` * ask the same question — which past session do you want — and the only thing * that differs is what is at stake when the answer arrives: at launch there is * no agent yet, so every choice is free, while inside a session the choice * retires a live agent and therefore has to pass {@link planResume}. * * Encoding that as one browser with different conditions rather than two * pickers is what keeps the launch path from being the poor relation it was: * search, titles, workspaces, lineage, and the same keyboard are available * before the first agent exists. * @module dshline/sessions */ import type { Context } from '@deepseek-ai/cordis'; import type { SessionId } from '@deepseek-ai/dsh-session'; export type { SessionCatalogSpec, SessionQueryReads } from './catalog.ts'; export { CATALOG_LIMIT, CONTENT_SEARCH_LIMIT, TITLE_BATCH_SIZE, EVENT_CONTEXT_AFTER, EVENT_CONTEXT_BEFORE, EXHAUSTIVE_TITLE_BATCH_SIZE, SessionCatalog, } from './catalog.ts'; export type { AgeChoice, OriginChoice, SessionFiltersValue, SessionWorkspace, WorkspaceChoice, } from './filters.ts'; export { DEFAULT_SESSION_FILTERS, equalFilters, EVERY_WORKSPACE, NO_FILTERS, workspaceScope } from './filters.ts'; export type { CatalogState, ContentState, EventContextState, EventHitEntry, EventSearchState, LineageState, SessionDetail, SessionEntry, SessionFact, SessionOrigin, SessionSearchMode, SessionTarget, SessionTitleHint, SessionTitleState, } from './model.ts'; export { CURRENT, filterEntries, matchesQuery, relativeAge, sessionFacts, sessionLabel, shortWorkspace, UNTITLED } from './model.ts'; export { createSessionsOverlay } from './overlay.ts'; export type { RenameDraftOutcome, ResumeRequest, SessionsOverlaySpec } from './overlay.ts'; export type { ResumeConditions, ResumePlan } from './plan.ts'; export { planResume } from './plan.ts'; export type { AgentOpener, Attached, AttachOutcome, AttachSpec, AttachTarget } from './reopen.ts'; export { attachTarget, newSessionFailureLines, reopenFailureLines } from './reopen.ts'; /** Result of asking Harness to accept a user-supplied session title. */ export type RenameTitleResult = /** Accepted, carrying Harness's normalized title. */ { readonly ok: true; readonly title: string; } /** Rejected, carrying the reason safe to report to the reader. */ | { readonly ok: false; readonly message: string; }; /** What opening the browser needs to know about the window it opens over. */ export interface BrowseSpec { /** Context carrying `ctx.sessionQuery` and the slot registry. */ readonly ctx: Context; /** The session this window is driving, or undefined before an agent exists. */ readonly currentSessionId: SessionId | undefined; /** * Whether the attached agent is mid-turn. * * A function rather than a value: the browser stays open across turns, and the * answer that matters is the one at the moment `enter` is pressed. */ readonly busy: () => boolean; /** Jobs and subagents attached to the session that would be left. */ readonly activeWork: () => number; /** Rename authority supplied only by the caller holding the live session. */ readonly renameTitle?: (title: string) => Promise; /** The user's home directory; injected so path shortening is assertable. */ readonly home?: string; /** * Effective workspace of the window opening the browser. * * Two things at once, deliberately: the exact `cwd` the catalog's `current` * filter narrows to (through {@link workspaceScope}), and the identity the * frame's right-hand label shows. */ readonly workspace?: string; /** Current time; injected so relative ages are assertable. */ readonly now?: () => number; } /** * Show the Sessions browser and wait for the reader's answer. * * Resolves with a session id only when the reader chose one AND the resume plan * accepted it, so the caller never has to re-check the conditions. Dismissing * resolves with undefined; a refused selection keeps the browser open. * @param spec - the context, the current session, and the live conditions. * @returns the session to reopen, or undefined when nothing was chosen. */ export declare function browseSessions(spec: BrowseSpec): Promise; //# sourceMappingURL=index.d.ts.map