import { DEFAULT_REQUEST_TYPE, isRequestType, VALID_REQUEST_TYPES, type PrerequisiteCheckResult, type RequestType } from './artifact-prerequisites.js'; import { type RequestTypeSource } from './request-artifact-metadata.js'; export { VALID_REQUEST_TYPES, DEFAULT_REQUEST_TYPE, isRequestType, type RequestType }; import { type RequestArtifactRole } from './artifact-templates.js'; export type { RequestArtifactRole } from './artifact-templates.js'; export { formatHandoffPath, formatCommitBoundaryPath, formatSkillUsageLessonsPath } from './artifact-templates.js'; export type CreateRequestArtifactOptions = { role: RequestArtifactRole; requestId: string; projectRoot: string; sessionId?: string; /** * Optional explicit session-id scope. When set, the artifact file lands at * `.peaks/_runtime///requests/...`. When unset, falls back * to the binding, then to the requestId. The CLI's `--session-id ` * flag uses this to preserve the legacy "session-id as scope dir name" * behavior. */ apply?: boolean; requestType?: RequestType; clock?: () => string; /** * this artifact creation (resolved via `resolveCallerId` by the CLI). * Recorded in the JSON envelope and on the artifact body's frontmatter * so a future reader knows which caller produced it. The caller-keyed * binding file itself is at `.peaks/_runtime/callers/.json`; * the per-caller active-skill marker is at * `.peaks/_runtime//active-skill-.json` (D6). */ callerId?: string; }; export type CreateRequestArtifactResult = { role: RequestArtifactRole; requestId: string; sessionId: string; path: string; content: string; applied: boolean; /** * (D4 priority: flag > env > platform fallback) when --caller-id * was passed. Omitted from the result when no callerId was set. */ callerId?: string; /** * dir resolved under `.peaks/_runtime//`. Always populated so * the sub-agent prompt can report a stable, canonical scope * location to the writer. */ scopeDir: string; }; /** * bytes, or traversal sequences. A request id is a single path segment, so * anything that builds a filename from one must test it against this first — * it is exported so those call sites reuse it instead of re-declaring a copy * that can drift. */ export declare const REQUEST_ID_PATTERN: RegExp; export declare function createRequestArtifact(options: CreateRequestArtifactOptions): Promise; export type RequestArtifactSummary = { role: RequestArtifactRole; /** * Durable scope of the artifact: the top-level `.peaks/_runtime//` * the prerequisite gate resolves paths under this dir (not the body * `- session:` line), so the file body and the on-disk path agree. */ sessionId: string; /** * Session binding (which developer's local session wrote the file). * Read from the file body's `- session:` line. Falls back to `sessionId` * when the body is missing the line. For back-compat with legacy * session-id dirs, this may equal the dir name. */ writerSessionId?: string; requestId: string; path: string; state: string; requestType: RequestType; /** Whether `requestType` was recorded in the body or substituted. See `RequestTypeSource`. */ requestTypeSource: RequestTypeSource; createdAt?: string; }; export type ListRequestArtifactsOptions = { projectRoot: string; sessionId?: string; role?: RequestArtifactRole; }; export type ShowRequestArtifactOptions = { projectRoot: string; role: RequestArtifactRole; requestId: string; sessionId?: string; }; export type ShowRequestArtifactResult = RequestArtifactSummary & { content: string; }; export declare function listRequestArtifacts(options: ListRequestArtifactsOptions): Promise; export declare function showRequestArtifact(options: ShowRequestArtifactOptions): Promise; export type TransitionRequestArtifactOptions = { role: RequestArtifactRole; requestId: string; projectRoot: string; newState: RequestArtifactState; sessionId?: string; reason?: string; allowIncomplete?: boolean; confirmed?: boolean; forceConfirm?: boolean; typeSanityCheck?: { projectRoot: string; declaredType: RequestType; }; clock?: () => string; }; export type TransitionRequestArtifactResult = RequestArtifactSummary & { previousState: string; content: string; bypassedPrerequisites?: PrerequisiteCheckResult; /** Soft-passed prerequisites on a SUCCESSFUL transition (set only when non-empty). Never affects `ok`. */ prerequisiteWarnings?: PrerequisiteCheckResult['warnings']; }; import { type RequestArtifactState } from './request-artifact-state-helpers.js'; export { allowedStatesForRole, FileSizeViolationError, LintGateError, PrerequisitesNotSatisfiedError, TypeSanityViolationError, updateStatusBlock } from './request-artifact-state-helpers.js'; export type { RequestArtifactState } from './request-artifact-state-helpers.js'; export declare function transitionRequestArtifact(options: TransitionRequestArtifactOptions): Promise;