import { type CompactToolName } from "../core/compact-tools.js"; import type { ActorContext, AddManyTasksInput, ClaimNextTaskInput, ClaimResult, CreateTaskInput, CreateTaskListInput, DeleteTaskInput, DeleteTaskListInput, DeleteTaskListResult, EnsureTaskListInput, FindTaskListsInput, FindTasksInput, GetTaskInput, GetTaskListInput, PrivateAccessEvent, PrivateAccessEventsGetInput, RefreshClaimInput, ReleaseExpiredClaimsInput, ReleaseExpiredClaimsResult, ReorderTasksInput, Task, TaskList, TaskListWithTasks, UpdateTaskInput, UpsertTaskInput } from "../core/types.js"; export type PiTasksSource = ActorContext["source"]; /** Options for bypassing private-list access checks after an explicit user confirmation. */ export interface PiTasksPrivateBypassOptions { /** Human-readable reason recorded in the private access audit log. */ reason: string; /** Tool or integration name recorded in the private access audit log. */ toolName: string; } /** * Constructor options for {@link PiTasks}, the public code API entrypoint. * * These comments are emitted to `dist/src/public/pi-tasks.d.ts`, so editors and * downstream TypeScript consumers receive the same documentation from the npm * package without needing the repository source files. */ export interface PiTasksOptions { /** * Absolute or cwd-relative SQLite database path. * * If omitted, `PI_TASKS_DB_PATH` is honored first, then pi-tasks uses * `/.pi/pi-tasks/tasks.sqlite`. */ dbPath?: string; /** * Base directory used when resolving the default database path or a relative * `dbPath`. Defaults to `process.cwd()`. */ cwd?: string; /** * Stable id for the calling agent/integration. * * If omitted, `PI_TASKS_AGENT_ID` is honored first, then a process-scoped * fallback id is generated. Use a stable value when claims or private-list * ownership must survive process restarts. */ agentId?: string; /** * Source label stored in access context and returned by `getAgentSummary()`. * Defaults to `"unknown"` for the public code API. */ source?: PiTasksSource; /** * Optional default private-list bypass applied to calls from this instance. * Prefer per-call bypasses when the confirmation is specific to one action. */ privateBypass?: PiTasksPrivateBypassOptions; /** * Clock override for deterministic tests or simulations. */ now?: () => Date; } export interface PiTasksCallOptions { agentId?: string; source?: PiTasksSource; privateBypass?: PiTasksPrivateBypassOptions; } export type TaskHelpAction = "all" | "workflow" | "schemas" | "examples"; export declare class PiTasks { readonly dbPath: string; readonly agentId: string; readonly source: PiTasksSource; private readonly service; private readonly privateBypass?; private readonly now?; constructor(options?: PiTasksOptions); close(): void; withActor(agentId: string, options?: { source?: PiTasksSource; }): PiTasks; withPrivateBypass(reason: string, toolName: string): PiTasks; getAgentSummary(options?: PiTasksCallOptions): { db_path: string; agent_id: string; source: string; }; createTaskList(input: CreateTaskListInput, options?: PiTasksCallOptions): TaskList; ensureTaskList(input: EnsureTaskListInput, options?: PiTasksCallOptions): TaskList; findTaskLists(input?: FindTaskListsInput, options?: PiTasksCallOptions): TaskList[]; getTaskList(input: GetTaskListInput | string, options?: PiTasksCallOptions): TaskListWithTasks; deleteTaskList(input: DeleteTaskListInput | string, options?: PiTasksCallOptions): DeleteTaskListResult; createTask(input: CreateTaskInput, options?: PiTasksCallOptions): Task; addManyTasks(input: AddManyTasksInput, options?: PiTasksCallOptions): Task[]; getTask(input: GetTaskInput | string, options?: PiTasksCallOptions): Task; findTasks(input?: FindTasksInput, options?: PiTasksCallOptions): Task[]; updateTask(input: UpdateTaskInput, options?: PiTasksCallOptions): Task; upsertTask(input: UpsertTaskInput, options?: PiTasksCallOptions): Task; reorderTasks(input: ReorderTasksInput, options?: PiTasksCallOptions): Task[]; deleteTask(input: DeleteTaskInput | string, options?: PiTasksCallOptions): Task; claimNextTask(input: ClaimNextTaskInput, options?: PiTasksCallOptions): ClaimResult; refreshClaim(input: RefreshClaimInput, options?: PiTasksCallOptions): Task; releaseExpiredClaims(input?: ReleaseExpiredClaimsInput, options?: PiTasksCallOptions): ReleaseExpiredClaimsResult; getPrivateAccessEvents(input?: PrivateAccessEventsGetInput, options?: PiTasksCallOptions): PrivateAccessEvent[]; dispatchCompactTool(toolName: CompactToolName, input: unknown, options?: PiTasksCallOptions): unknown; getHelp(action?: TaskHelpAction): Record; static resolveDbPath(cwd?: string): string; private access; }