fix: retryコマンドの有効範囲と案内文を修正
This commit is contained in:
parent
e70bceb4a8
commit
2926785c2c
@ -77,6 +77,8 @@ vi.mock('../shared/i18n/index.js', () => ({
|
|||||||
proposed: 'Proposed:',
|
proposed: 'Proposed:',
|
||||||
actionPrompt: 'What next?',
|
actionPrompt: 'What next?',
|
||||||
playNoTask: 'No task for /play',
|
playNoTask: 'No task for /play',
|
||||||
|
retryNoOrder: 'No previous order found.',
|
||||||
|
retryUnavailable: '/retry is not available in this mode.',
|
||||||
cancelled: 'Cancelled',
|
cancelled: 'Cancelled',
|
||||||
actions: { execute: 'Execute', saveTask: 'Save', continue: 'Continue' },
|
actions: { execute: 'Execute', saveTask: 'Save', continue: 'Continue' },
|
||||||
})),
|
})),
|
||||||
@ -212,4 +214,15 @@ describe('/resume command', () => {
|
|||||||
expect(capture.sessionIds[0]).toBe('resumed-session-xyz');
|
expect(capture.sessionIds[0]).toBe('resumed-session-xyz');
|
||||||
expect(result.action).toBe('cancel');
|
expect(result.action).toBe('cancel');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should reject /retry in non-retry mode', async () => {
|
||||||
|
setupRawStdin(toRawInputs(['/retry', '/cancel']));
|
||||||
|
setupProvider([]);
|
||||||
|
|
||||||
|
const ctx = createSessionContext();
|
||||||
|
const result = await runConversationLoop('/test', ctx, defaultStrategy, undefined, undefined);
|
||||||
|
|
||||||
|
expect(mockLogInfo).toHaveBeenCalledWith('/retry is not available in this mode.');
|
||||||
|
expect(result.action).toBe('cancel');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -85,6 +85,8 @@ export interface ConversationStrategy {
|
|||||||
selectAction?: (task: string, lang: 'en' | 'ja') => Promise<PostSummaryAction | null>;
|
selectAction?: (task: string, lang: 'en' | 'ja') => Promise<PostSummaryAction | null>;
|
||||||
/** Previous order.md content for /replay command (retry/instruct only) */
|
/** Previous order.md content for /replay command (retry/instruct only) */
|
||||||
previousOrderContent?: string;
|
previousOrderContent?: string;
|
||||||
|
/** Enable /retry slash command (retry mode only) */
|
||||||
|
enableRetryCommand?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -166,6 +168,10 @@ export async function runConversationLoop(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (trimmed === '/retry') {
|
if (trimmed === '/retry') {
|
||||||
|
if (!strategy.enableRetryCommand) {
|
||||||
|
info(ui.retryUnavailable);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!strategy.previousOrderContent) {
|
if (!strategy.previousOrderContent) {
|
||||||
info(ui.retryNoOrder);
|
info(ui.retryNoOrder);
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@ -46,6 +46,7 @@ export interface InteractiveUIText {
|
|||||||
cancelled: string;
|
cancelled: string;
|
||||||
playNoTask: string;
|
playNoTask: string;
|
||||||
retryNoOrder: string;
|
retryNoOrder: string;
|
||||||
|
retryUnavailable: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -14,13 +14,12 @@ import {
|
|||||||
} from './conversationLoop.js';
|
} from './conversationLoop.js';
|
||||||
import {
|
import {
|
||||||
createSelectActionWithoutExecute,
|
createSelectActionWithoutExecute,
|
||||||
buildReplayHint,
|
|
||||||
formatMovementPreviews,
|
formatMovementPreviews,
|
||||||
type PieceContext,
|
type PieceContext,
|
||||||
} from './interactive-summary.js';
|
} from './interactive-summary.js';
|
||||||
import { resolveLanguage } from './interactive.js';
|
import { resolveLanguage } from './interactive.js';
|
||||||
import { loadTemplate } from '../../shared/prompts/index.js';
|
import { loadTemplate } from '../../shared/prompts/index.js';
|
||||||
import { getLabelObject } from '../../shared/i18n/index.js';
|
import { getLabel, getLabelObject } from '../../shared/i18n/index.js';
|
||||||
import { resolveConfigValues } from '../../infra/config/index.js';
|
import { resolveConfigValues } from '../../infra/config/index.js';
|
||||||
import type { InstructModeResult, InstructUIText } from '../tasks/list/instructMode.js';
|
import type { InstructModeResult, InstructUIText } from '../tasks/list/instructMode.js';
|
||||||
|
|
||||||
@ -120,10 +119,10 @@ export async function runRetryMode(
|
|||||||
const templateVars = buildRetryTemplateVars(retryContext, lang, previousOrderContent);
|
const templateVars = buildRetryTemplateVars(retryContext, lang, previousOrderContent);
|
||||||
const systemPrompt = loadTemplate('score_retry_system_prompt', ctx.lang, templateVars);
|
const systemPrompt = loadTemplate('score_retry_system_prompt', ctx.lang, templateVars);
|
||||||
|
|
||||||
const replayHint = buildReplayHint(ctx.lang, previousOrderContent !== null);
|
const retryIntro = getLabel('retry.ui.intro', ctx.lang);
|
||||||
const introLabel = ctx.lang === 'ja'
|
const introLabel = ctx.lang === 'ja'
|
||||||
? `## リトライ: ${retryContext.failure.taskName}\n\nブランチ: ${retryContext.branchName}\n\n${ui.intro}${replayHint}`
|
? `## リトライ: ${retryContext.failure.taskName}\n\nブランチ: ${retryContext.branchName}\n\n${retryIntro}`
|
||||||
: `## Retry: ${retryContext.failure.taskName}\n\nBranch: ${retryContext.branchName}\n\n${ui.intro}${replayHint}`;
|
: `## Retry: ${retryContext.failure.taskName}\n\nBranch: ${retryContext.branchName}\n\n${retryIntro}`;
|
||||||
|
|
||||||
const policyContent = loadTemplate('score_interactive_policy', ctx.lang, {});
|
const policyContent = loadTemplate('score_interactive_policy', ctx.lang, {});
|
||||||
|
|
||||||
@ -144,6 +143,7 @@ export async function runRetryMode(
|
|||||||
introMessage: introLabel,
|
introMessage: introLabel,
|
||||||
selectAction: createSelectActionWithoutExecute(ui),
|
selectAction: createSelectActionWithoutExecute(ui),
|
||||||
previousOrderContent: previousOrderContent ?? undefined,
|
previousOrderContent: previousOrderContent ?? undefined,
|
||||||
|
enableRetryCommand: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = await runConversationLoop(cwd, ctx, strategy, retryContext.pieceContext, undefined);
|
const result = await runConversationLoop(cwd, ctx, strategy, retryContext.pieceContext, undefined);
|
||||||
|
|||||||
@ -10,7 +10,7 @@ interactive:
|
|||||||
conversationLabel: "Conversation:"
|
conversationLabel: "Conversation:"
|
||||||
noTranscript: "(No local transcript. Summarize the current session context.)"
|
noTranscript: "(No local transcript. Summarize the current session context.)"
|
||||||
ui:
|
ui:
|
||||||
intro: "Interactive mode - describe your task. Commands: /go (execute), /play (run now), /resume (load session), /retry (rerun previous order), /cancel (exit)"
|
intro: "Interactive mode - describe your task. Commands: /go (create instruction & run), /play (run now), /resume (load session), /cancel (exit)"
|
||||||
resume: "Resuming previous session"
|
resume: "Resuming previous session"
|
||||||
noConversation: "No conversation yet. Please describe your task first."
|
noConversation: "No conversation yet. Please describe your task first."
|
||||||
summarizeFailed: "Failed to summarize conversation. Please try again."
|
summarizeFailed: "Failed to summarize conversation. Please try again."
|
||||||
@ -25,6 +25,7 @@ interactive:
|
|||||||
cancelled: "Cancelled"
|
cancelled: "Cancelled"
|
||||||
playNoTask: "Please specify task content: /play <task>"
|
playNoTask: "Please specify task content: /play <task>"
|
||||||
retryNoOrder: "No previous order (order.md) found. /retry is only available during retry."
|
retryNoOrder: "No previous order (order.md) found. /retry is only available during retry."
|
||||||
|
retryUnavailable: "/retry is only available in Retry mode from `takt list`."
|
||||||
personaFallback: "No persona available for the first movement. Falling back to assistant mode."
|
personaFallback: "No persona available for the first movement. Falling back to assistant mode."
|
||||||
modeSelection:
|
modeSelection:
|
||||||
prompt: "Select interactive mode:"
|
prompt: "Select interactive mode:"
|
||||||
@ -77,10 +78,10 @@ piece:
|
|||||||
# ===== Instruct Mode UI (takt list -> instruct) =====
|
# ===== Instruct Mode UI (takt list -> instruct) =====
|
||||||
instruct:
|
instruct:
|
||||||
ui:
|
ui:
|
||||||
intro: "Instruct mode - describe additional instructions. Commands: /go (summarize), /retry (rerun previous order), /cancel (exit)"
|
intro: "Instruct mode - describe additional instructions. Commands: /go (create instruction & run), /replay (resubmit previous order), /cancel (exit)"
|
||||||
resume: "Resuming previous session"
|
resume: "Resuming previous session"
|
||||||
noConversation: "No conversation yet. Please describe your instructions first."
|
noConversation: "No conversation yet. Please describe your instructions first."
|
||||||
summarizeFailed: "Failed to summarize conversation. Please try again."
|
summarizeFailed: "Failed to create instruction. Please try again."
|
||||||
continuePrompt: "Okay, continue describing your instructions."
|
continuePrompt: "Okay, continue describing your instructions."
|
||||||
proposed: "Proposed additional instructions:"
|
proposed: "Proposed additional instructions:"
|
||||||
actionPrompt: "What would you like to do?"
|
actionPrompt: "What would you like to do?"
|
||||||
@ -91,6 +92,11 @@ instruct:
|
|||||||
cancelled: "Cancelled"
|
cancelled: "Cancelled"
|
||||||
replayNoOrder: "Previous order (order.md) not found"
|
replayNoOrder: "Previous order (order.md) not found"
|
||||||
|
|
||||||
|
# ===== Retry Mode UI (takt list -> retry) =====
|
||||||
|
retry:
|
||||||
|
ui:
|
||||||
|
intro: "Retry mode - describe additional instructions. Commands: /go (create instruction & run), /retry (rerun previous order), /cancel (exit)"
|
||||||
|
|
||||||
run:
|
run:
|
||||||
notifyComplete: "Run complete ({total} tasks)"
|
notifyComplete: "Run complete ({total} tasks)"
|
||||||
notifyAbort: "Run finished with errors ({failed})"
|
notifyAbort: "Run finished with errors ({failed})"
|
||||||
|
|||||||
@ -10,7 +10,7 @@ interactive:
|
|||||||
conversationLabel: "会話:"
|
conversationLabel: "会話:"
|
||||||
noTranscript: "(ローカル履歴なし。現在のセッション文脈を要約してください。)"
|
noTranscript: "(ローカル履歴なし。現在のセッション文脈を要約してください。)"
|
||||||
ui:
|
ui:
|
||||||
intro: "対話モード - タスク内容を入力してください。コマンド: /go(実行), /play(即実行), /resume(セッション読込), /retry(前回の指示書で再実行), /cancel(終了)"
|
intro: "対話モード - タスク内容を入力してください。コマンド: /go(指示書作成・実行), /play(即実行), /resume(セッション読込), /cancel(終了)"
|
||||||
resume: "前回のセッションを再開します"
|
resume: "前回のセッションを再開します"
|
||||||
noConversation: "まだ会話がありません。まずタスク内容を入力してください。"
|
noConversation: "まだ会話がありません。まずタスク内容を入力してください。"
|
||||||
summarizeFailed: "会話の要約に失敗しました。再度お試しください。"
|
summarizeFailed: "会話の要約に失敗しました。再度お試しください。"
|
||||||
@ -25,6 +25,7 @@ interactive:
|
|||||||
cancelled: "キャンセルしました"
|
cancelled: "キャンセルしました"
|
||||||
playNoTask: "タスク内容を指定してください: /play <タスク内容>"
|
playNoTask: "タスク内容を指定してください: /play <タスク内容>"
|
||||||
retryNoOrder: "前回の指示書(order.md)が見つかりません。/retry はリトライ時のみ使用できます。"
|
retryNoOrder: "前回の指示書(order.md)が見つかりません。/retry はリトライ時のみ使用できます。"
|
||||||
|
retryUnavailable: "/retry は `takt list` の Retry モードでのみ使用できます。"
|
||||||
personaFallback: "先頭ムーブメントにペルソナがありません。アシスタントモードにフォールバックします。"
|
personaFallback: "先頭ムーブメントにペルソナがありません。アシスタントモードにフォールバックします。"
|
||||||
modeSelection:
|
modeSelection:
|
||||||
prompt: "対話モードを選択してください:"
|
prompt: "対話モードを選択してください:"
|
||||||
@ -77,10 +78,10 @@ piece:
|
|||||||
# ===== Instruct Mode UI (takt list -> instruct) =====
|
# ===== Instruct Mode UI (takt list -> instruct) =====
|
||||||
instruct:
|
instruct:
|
||||||
ui:
|
ui:
|
||||||
intro: "指示モード - 追加指示を入力してください。コマンド: /go(要約), /retry(前回の指示書で再実行), /cancel(終了)"
|
intro: "指示モード - 追加指示を入力してください。コマンド: /go(指示書作成・実行), /replay(前回の指示書で再投入), /cancel(終了)"
|
||||||
resume: "前回のセッションを再開します"
|
resume: "前回のセッションを再開します"
|
||||||
noConversation: "まだ会話がありません。まず追加指示を入力してください。"
|
noConversation: "まだ会話がありません。まず追加指示を入力してください。"
|
||||||
summarizeFailed: "会話の要約に失敗しました。再度お試しください。"
|
summarizeFailed: "指示書の作成に失敗しました。再度お試しください。"
|
||||||
continuePrompt: "続けて追加指示を入力してください。"
|
continuePrompt: "続けて追加指示を入力してください。"
|
||||||
proposed: "提案された追加指示:"
|
proposed: "提案された追加指示:"
|
||||||
actionPrompt: "どうしますか?"
|
actionPrompt: "どうしますか?"
|
||||||
@ -91,6 +92,11 @@ instruct:
|
|||||||
cancelled: "キャンセルしました"
|
cancelled: "キャンセルしました"
|
||||||
replayNoOrder: "前回の指示書(order.md)が見つかりません"
|
replayNoOrder: "前回の指示書(order.md)が見つかりません"
|
||||||
|
|
||||||
|
# ===== Retry Mode UI (takt list -> retry) =====
|
||||||
|
retry:
|
||||||
|
ui:
|
||||||
|
intro: "リトライモード - 追加指示を入力してください。コマンド: /go(指示書作成・実行), /retry(前回の指示書で再実行), /cancel(終了)"
|
||||||
|
|
||||||
run:
|
run:
|
||||||
notifyComplete: "run完了 ({total} tasks)"
|
notifyComplete: "run完了 ({total} tasks)"
|
||||||
notifyAbort: "runはエラー終了 ({failed})"
|
notifyAbort: "runはエラー終了 ({failed})"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user