@hasna/projects
Version:
High-level project management CLI, MCP server, SDK, and AI SDK agent loop for coding agents
97 lines • 4.78 kB
TypeScript
import type { Database } from "bun:sqlite";
import type { EventSource, JsonObject, TmuxProfile, Workspace } from "../types/workspace.js";
import { type ProjectStartAgent, type ProjectStartSessionPolicy } from "./project-management.js";
import { type ConversationsChannelRunner, type ProjectAgentOnlineNotificationResult, type ProjectChannelEnsureResult } from "./project-channel.js";
import { type WorkspaceImportPreview } from "./workspace-import.js";
import { type ProjectStore } from "../store/project-store.js";
import { type WorkspaceTmuxResult, type WorkspaceTmuxWindowSpec } from "./workspace-runtime.js";
import { PROJECT_RENDER_SCHEMA_VERSION } from "./project-render.js";
import { type ProjectInstructionActivation, type ProjectInstructionsRunner } from "./project-instructions.js";
export { PROJECT_START_AGENTS, PROJECT_START_SESSION_POLICIES, type ProjectStartAgent, type ProjectStartSessionPolicy } from "./project-management.js";
export interface ProjectStartResolution {
target: string;
source: "id-or-slug" | "name" | "path" | "marker" | "imported" | "planned-import";
registered: boolean;
preview?: WorkspaceImportPreview;
}
export interface ProjectStartOptions {
/** Active registry/store selected by the calling surface. */
store?: ProjectStore;
agentTool?: ProjectStartAgent;
toolCommand?: string;
session?: string;
sessionPolicy?: ProjectStartSessionPolicy;
profile?: string;
windowName?: string;
requestedWindows?: WorkspaceTmuxWindowSpec[];
extraWindows?: WorkspaceTmuxWindowSpec[];
register?: boolean;
importTags?: string[];
importMetadata?: JsonObject;
dryRun?: boolean;
attach?: boolean;
agentId?: string;
source?: EventSource;
auditCommand?: string;
/** Ensure the project's conversations channel exists on start; defaults to shouldEnsureProjectChannel(). */
ensureChannel?: boolean;
/** Announce newly started coding agents in the project channel; enabled by default. */
notifyAgentOnline?: boolean;
/** Conversations CLI runner override (used by tests). */
channelRunner?: ConversationsChannelRunner;
/** Package-owned Instructions subprocess seam, also used by hermetic tests. */
instructionsRunner?: ProjectInstructionsRunner;
db?: Database;
}
export interface ProjectStartResult {
schema_version: typeof PROJECT_RENDER_SCHEMA_VERSION;
kind: "projects.start";
project: Workspace;
resolution: ProjectStartResolution;
agent_tool: ProjectStartAgent;
tool_command?: string;
rename_report: CodingSessionRenameReport[];
session_policy: ProjectStartSessionPolicy;
tmux_profile?: Pick<TmuxProfile, "id" | "slug" | "name">;
launch_defaults: {
agent_tool: string | null;
tool_command: string | null;
tmux_profile: string | null;
session_policy: string | null;
windows: WorkspaceTmuxWindowSpec[];
used_agent_tool: boolean;
used_tool_command: boolean;
used_tmux_profile: boolean;
used_session_policy: boolean;
used_windows: boolean;
};
tmux: WorkspaceTmuxResult;
channel: ProjectChannelEnsureResult | null;
online_notification: ProjectAgentOnlineNotificationResult;
attached: boolean;
instruction_activation: ProjectInstructionActivation | null;
render: JsonObject;
}
export interface CodingSessionRenameReport {
agent_tool: ProjectStartAgent;
desired_name: string;
status: "configured" | "manual" | "unsupported" | "skipped";
method: string | null;
command_changed: boolean;
message: string;
manual_instruction?: string;
}
export declare function parseProjectStartAgent(value: string | undefined): ProjectStartAgent;
export declare function projectStartCommand(agent: ProjectStartAgent, override?: string): string | undefined;
export declare function parseProjectStartSessionPolicy(value: string | undefined): ProjectStartSessionPolicy;
export declare function prepareCodingSessionRename(project: Workspace, agentTool: ProjectStartAgent, command: string | undefined): {
command: string | undefined;
report: CodingSessionRenameReport[];
};
export declare function skippedExactWindowsRenameReport(project: Workspace, agentTool: ProjectStartAgent): CodingSessionRenameReport[];
export declare function resolveProjectStartTarget(target: string | undefined, options?: Pick<ProjectStartOptions, "store" | "register" | "dryRun" | "agentId" | "db" | "importTags" | "importMetadata" | "source" | "auditCommand">): Promise<{
project: Workspace;
resolution: ProjectStartResolution;
}>;
export declare function startProject(target: string | undefined, options?: ProjectStartOptions): Promise<ProjectStartResult>;
//# sourceMappingURL=project-start.d.ts.map