import type { SessionState } from "./session.js"; import { type DocKind } from "./doc-index.js"; /** * Issue L1 命令层选项(Phase 3,§Issue pt-doc-index-and-schema L1)。 * - profile / status:null 表示不过滤(caller 决定要不要降级) * - kind:仅 checkDocsText 使用,限定检查的文档类型 */ export interface ListDocsOptions { profile?: string | null; status?: string | null; kind?: DocKind; } /** Phase 3(issue pt-doc-index-and-schema L1):/pt issues / manuals / designs 列表选项。 * - profile / status 字段同时出现在 ListDocsOptions(设计文档共用)——为双注册提供统一形参 */ export interface IssuesTextOptions extends ListDocsOptions { } /** /pt status 内核:返回状态摘要文本(单行 | 分隔)。 */ export declare function statusText(session: SessionState): string; /** v15.x §4.4.4(缺口 5):/pt packs 详情命令——pack 诊断信息落点。 * pack.name/version/desc/asset 计数走这里,status 单行不再塞 desc。 * asset 计数:从 active bundle 的 workingSet.identity 索引按 pack.name 前缀过滤。 */ export declare function packsText(session: SessionState): string; /** /pt flows 内核:返回可用手册列表文本。无激活 Profile 返回提示串。 * * v13.x(issue pt-turn-inject-not-profile-scoped):不再预过滤——传全集 domains 给 listManuals, * adapter 内部用 setAgentContext 时存下的 profile 自行 filterDomainsByProfile 过滤。 * * v19(issue pt-llm-tool-consolidation):name 字段改为纯 domain 名(不再伪装成 `/pt_turn_inject ` * 人类命令——人类改用自然语言引导 LLM 调 `pt_inject` tool);文案相应改为 * "调 pt_inject tool 获取 手册" + listManuals 实现同步更新(pi-adapter.ts)。 */ export declare function flowsText(session: SessionState): string; /** /pt full 内核:构建写入 .pt/cache/fulls/ 的完整 systemPrompt 字符串(v10.x 修复 pt-full-duplicate-segment)。 * * 设计动机:消除 `/pt full` 与 PiAdapter `before_agent_start` 的双重拼接路径—— * - PiAdapter 每轮把 segment 拼到 base,写回 `agent.state.systemPrompt`(= `ctx.getSystemPrompt()`) * - 第一轮 prompt 之后,`ctx.getSystemPrompt()` 已含 segment;旧版 `/pt full` 再拼一次 → 2× 重复 * - 根因:两份拼接实现通过隐式时序耦合,缺乏单一信息源 * * 修复:把 `lastBuiltPrompt`(由 PiAdapter 的 `onInjected` 回调写入,正是 LLM 实际看到的 systemPrompt) * 作为 canonical source。第一轮之前的 fallback:模拟下一次 LLM 会看到的注入(保留旧版语义)。 * * 边界纪律: * - 不动 PiAdapter(PiAdapter 行为正确,不重复注入) * - 不动 Pi 上游 API(`getSystemPrompt` 语义不变) * - 只动这一个函数体,外加调用方 `src/index.ts` */ export declare function buildFullPrompt(baseSystemPrompt: string, cachedSegment: string | null, lastBuiltPrompt: string | null): string; /** /pt make-manual 内核:构建手册实例文档内容 + 目标文件路径。不写文件(写文件由壳负责)。 */ export interface ManualDocResult { content: string; filePath: string; error?: string; } export declare function buildManualDoc(cwd: string, session: SessionState, procedure: string, args: string, issue?: string): ManualDocResult; /** /pt check 选项(issue pt-asset-migration-visibility Layer 3)。 * - profileName:单 profile 体检(v1 范围;--all 全集是默认) * - fix:v2 范围(v1 不实现;只输出"运行 `/pt check --fix`"提示) * v1:format = "biome"(仅一种风格;预留给未来 tsc/eslint 切换)。 */ export interface CheckOptions { profileName?: string; fix?: boolean; format?: "biome"; } /** /pt check 输出结果(供 shell 检查输出与是否 issues)。 */ export interface CheckResult { /** 格式化后的多行文本(biome 风格)。 */ output: string; /** issue 数(errors + warnings + infos)。 */ issueCount: number; errors: number; warnings: number; /** v16:info 数(optional-domains slot 空等预期行为)——缺省 0(back-compat)。 */ infos?: number; } /** /pt check 内核:从 session.assetHealthIssues(已扫)格式化输出。 * v14.x(issue §Layer 3):session_start 已扫,/pt check 直接格式化——不重复扫描。 * 未扫(null)→ 返回提示串 + 0 issue。 * * 输出风格(biome/tsc 同源): * * ysl-developer.profile.md * × [error] ## session-context 缺 ### Modules * hint: 在 H2 段下加 `### Modules: [Scene, ...]` * * × 6 errors, 0 warnings * hint: 运行 `/pt check --fix` 自动应用已知 migration * * --profile X:只列该 profile 的 issue;其它 profile 的忽略(v1 简化)。 */ export declare function checkText(session: SessionState, opts?: CheckOptions): CheckResult; /** /pt issues 内核:扫 .pt/docs/issues,按 profile/status 过滤 + 表格格式化 */ export declare function issuesText(cwd: string, activeProfile: string | null, opts?: IssuesTextOptions): Promise; /** /pt manuals 内核 */ export declare function manualsText(cwd: string, activeProfile: string | null, opts?: IssuesTextOptions): Promise; /** /pt designs 内核 */ export declare function designsText(cwd: string, activeProfile: string | null, opts?: IssuesTextOptions): Promise; /** Phase 3:subArgs 解析 --key 与 --key=value 形态(与 /pt make-manual 的 --issue 解析同模式)。 * 返回的对象只包含实际出现的 key;不出现的字段为 undefined。 * v12.x:纯函数——单测只测字符串解析逻辑,不依赖 UI/session。 */ export declare function parseListFlags(args: string): { profile?: string; status?: string; kind?: string; }; /** /pt check-docs 内核:批量 schema 校验(biome 风格输出)。 * - kind:指定扫哪类文档;不传则扫全部 issue/manual/design * - 每类文档同时过滤 profile(与 issuesText / manualsText / designsText 一致) */ export declare function checkDocsText(cwd: string, activeProfile: string | null, opts?: IssuesTextOptions): Promise; /** v19(issue pt-llm-tool-consolidation):pt_doc {action: list, type: X} 的统一调度器(项目文档视图)。 * 作用对象=项目文档视图下分流到各纯函数(flowsText / issuesText / manualsText / designsText)。 * flowsText 需 session.cachedBlues+activeAdapter —— 调用方拿 session 后走 flowsText(s) 专属路径, * 此函数仅处理 issues/manuals/designs 三类(cwd+profile 维度)。 * type 不识别 → 返回提示串。 */ export declare function formatsList(cwd: string, profile: string | null, type: "issues" | "manuals" | "designs", statusFilter: string | undefined): Promise;