/** * Instruction context types and edit rule generation * * Defines the context structures used by instruction builders. */ import type { AgentResponse, FallbackContext, Language, WorkflowMaxSteps, WorkflowState, ResolvedFacetContent, WorkflowWideRule } from '../../models/types.js'; import type { PullRequestContext } from '../pr-context.js'; import type { TaskReviewScope } from '../review-scope.js'; import type { CompanionReviewMode } from '../../models/companion-types.js'; /** * Context for building instruction from template. */ export interface InstructionContext { /** The main task/prompt */ task: string; /** Current iteration number (workflow-wide turn count) */ iteration: number; /** Maximum steps allowed */ maxSteps: WorkflowMaxSteps; /** Current step's iteration number (how many times this step has been executed) */ stepIteration: number; /** Working directory (agent work dir, may be a clone) */ cwd: string; /** Project root directory (where .takt/ lives). */ projectCwd: string; /** User inputs accumulated during workflow */ userInputs: string[]; /** Previous step output if available */ previousOutput?: AgentResponse; /** Source path for previous response snapshot */ previousResponseSourcePath?: string; /** Fallback context to inject once after provider switching */ fallbackContext?: FallbackContext; /** Preprocessed previous response text for template placeholder replacement */ previousResponseText?: string; /** Report directory path */ reportDir?: string; /** * run の reports ルート(namespace なし)。workflow_call の子の {report:X} が * 親成果物へ read-only フォールバックするために engine から明示的に渡す。 */ reportsRootDir?: string; /** Resume snapshot 上の元 run 座標を引くための論理 consumer key。 */ resumeReportConsumerKey?: string; /** * {report:X} の存在検証を無効化する(`takt prompt` プレビューなど実 run が * 存在しない文脈のみ)。既定は検証あり。 */ validateReportReferences?: boolean; /** Language for metadata rendering. Defaults to 'en'. */ language?: Language; /** Whether interactive-only rules are enabled */ interactive?: boolean; /** Top-level workflow steps for workflow structure display */ workflowSteps?: ReadonlyArray<{ name: string; description?: string; }>; /** Index of the current step in workflowSteps (0-based) */ currentStepIndex?: number; /** Workflow name */ workflowName?: string; /** Workflow description (optional) */ workflowDescription?: string; /** Retry note explaining why task is being retried */ retryNote?: string; /** Structured PR context resolved at the execution boundary. */ prContext?: PullRequestContext; /** * Engine-computed changed file set for this task, resolved at the execution * boundary and rendered by the `{review_scope}` placeholder. */ reviewScope?: TaskReviewScope; /** Resolved policy content strings for injection into instruction */ policyContents?: readonly ResolvedFacetContent[]; /** Source path for policy snapshot */ policySourcePath?: string; /** Resolved knowledge content strings for injection into instruction */ knowledgeContents?: readonly ResolvedFacetContent[]; /** Source path for knowledge snapshot */ knowledgeSourcePath?: string; /** Workflow state for context/structured/effect interpolation */ workflowState?: WorkflowState; /** Resolved workflow-wide rules for Phase 1 only. */ workflowRules?: readonly WorkflowWideRule[]; /** Scalar context inherited through workflow_call boundaries. */ workflowCallVars?: Readonly>; companion?: { mailboxDirectory: string; reviewMode: CompanionReviewMode; }; } /** * Build the edit rule string for the execution context section. * * Returns a localized string describing the edit permission for this step. * Returns empty string when edit is undefined (no explicit permission). */ export declare function buildEditRule(edit: boolean | undefined, language: Language): string; type GitRulePhase = 'phase1' | 'phase2'; /** * git 操作の禁止ルール。文面は src/shared/prompts/{en,ja}/parts/git_rules.md にある。 * * phase1 だけに載る「index の状態を根拠に指摘を立てるな」は、隣の「git add を実行するな」 * が**行為**の禁止でしかなく、指摘を立てる**判断**を禁じていなかったために足した(#1012)。 * TAKT が stage/commit を管理する実行では、実際にステージするのはワークフロー成功後の * stageAndCommit() だけなので、「未追跡だからコミットせよ」という指摘はそれ自身が * ブロックしている成功に依存し、coder には構造的に閉じられない。 * * 禁止は index の状態に限る。.gitignore の誤設定や意図しない削除など、git の状態が * 正当な証拠になる場合まで潰さない。 */ export declare function buildGitRules(allowGitCommit: boolean | undefined, language: Language, phase: GitRulePhase): string; export {}; //# sourceMappingURL=instruction-context.d.ts.map