takt 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/runner.d.ts.map +1 -1
- package/dist/agents/runner.js +2 -1
- package/dist/agents/runner.js.map +1 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +7 -3
- package/dist/cli.js.map +1 -1
- package/dist/commands/config.d.ts +33 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +110 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +1 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/workflow.js +1 -1
- package/dist/commands/workflow.js.map +1 -1
- package/dist/config/initialization.js +1 -1
- package/dist/config/initialization.js.map +1 -1
- package/dist/config/projectConfig.d.ts +12 -1
- package/dist/config/projectConfig.d.ts.map +1 -1
- package/dist/config/projectConfig.js +1 -0
- package/dist/config/projectConfig.js.map +1 -1
- package/dist/{interactive/prompt.d.ts → prompt/index.d.ts} +3 -1
- package/dist/prompt/index.d.ts.map +1 -0
- package/dist/{interactive/prompt.js → prompt/index.js} +11 -1
- package/dist/prompt/index.js.map +1 -0
- package/package.json +1 -1
- package/dist/cli/agentExecution.d.ts +0 -16
- package/dist/cli/agentExecution.d.ts.map +0 -1
- package/dist/cli/agentExecution.js +0 -40
- package/dist/cli/agentExecution.js.map +0 -1
- package/dist/cli/help.d.ts +0 -8
- package/dist/cli/help.d.ts.map +0 -1
- package/dist/cli/help.js +0 -46
- package/dist/cli/help.js.map +0 -1
- package/dist/cli/index.d.ts +0 -8
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -8
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/taskBatch.d.ts +0 -8
- package/dist/cli/taskBatch.d.ts.map +0 -1
- package/dist/cli/taskBatch.js +0 -69
- package/dist/cli/taskBatch.js.map +0 -1
- package/dist/cli/workflowExecution.d.ts +0 -18
- package/dist/cli/workflowExecution.d.ts.map +0 -1
- package/dist/cli/workflowExecution.js +0 -112
- package/dist/cli/workflowExecution.js.map +0 -1
- package/dist/commands/agentExecution.d.ts +0 -8
- package/dist/commands/agentExecution.d.ts.map +0 -1
- package/dist/commands/agentExecution.js +0 -44
- package/dist/commands/agentExecution.js.map +0 -1
- package/dist/interactive/commands/agent.d.ts +0 -7
- package/dist/interactive/commands/agent.d.ts.map +0 -1
- package/dist/interactive/commands/agent.js +0 -65
- package/dist/interactive/commands/agent.js.map +0 -1
- package/dist/interactive/commands/basic.d.ts +0 -7
- package/dist/interactive/commands/basic.d.ts.map +0 -1
- package/dist/interactive/commands/basic.js +0 -81
- package/dist/interactive/commands/basic.js.map +0 -1
- package/dist/interactive/commands/index.d.ts +0 -12
- package/dist/interactive/commands/index.d.ts.map +0 -1
- package/dist/interactive/commands/index.js +0 -14
- package/dist/interactive/commands/index.js.map +0 -1
- package/dist/interactive/commands/registry.d.ts +0 -41
- package/dist/interactive/commands/registry.d.ts.map +0 -1
- package/dist/interactive/commands/registry.js +0 -37
- package/dist/interactive/commands/registry.js.map +0 -1
- package/dist/interactive/commands/session.d.ts +0 -7
- package/dist/interactive/commands/session.d.ts.map +0 -1
- package/dist/interactive/commands/session.js +0 -75
- package/dist/interactive/commands/session.js.map +0 -1
- package/dist/interactive/commands/task.d.ts +0 -7
- package/dist/interactive/commands/task.d.ts.map +0 -1
- package/dist/interactive/commands/task.js +0 -156
- package/dist/interactive/commands/task.js.map +0 -1
- package/dist/interactive/commands/workflow.d.ts +0 -7
- package/dist/interactive/commands/workflow.d.ts.map +0 -1
- package/dist/interactive/commands/workflow.js +0 -56
- package/dist/interactive/commands/workflow.js.map +0 -1
- package/dist/interactive/escape-tracker.d.ts +0 -37
- package/dist/interactive/escape-tracker.d.ts.map +0 -1
- package/dist/interactive/escape-tracker.js +0 -52
- package/dist/interactive/escape-tracker.js.map +0 -1
- package/dist/interactive/handlers.d.ts +0 -24
- package/dist/interactive/handlers.d.ts.map +0 -1
- package/dist/interactive/handlers.js +0 -191
- package/dist/interactive/handlers.js.map +0 -1
- package/dist/interactive/history-manager.d.ts +0 -45
- package/dist/interactive/history-manager.d.ts.map +0 -1
- package/dist/interactive/history-manager.js +0 -91
- package/dist/interactive/history-manager.js.map +0 -1
- package/dist/interactive/index.d.ts +0 -8
- package/dist/interactive/index.d.ts.map +0 -1
- package/dist/interactive/index.js +0 -8
- package/dist/interactive/index.js.map +0 -1
- package/dist/interactive/ink/components/App.d.ts +0 -16
- package/dist/interactive/ink/components/App.d.ts.map +0 -1
- package/dist/interactive/ink/components/App.js +0 -123
- package/dist/interactive/ink/components/App.js.map +0 -1
- package/dist/interactive/ink/components/AskUserQuestion.d.ts +0 -16
- package/dist/interactive/ink/components/AskUserQuestion.d.ts.map +0 -1
- package/dist/interactive/ink/components/AskUserQuestion.js +0 -139
- package/dist/interactive/ink/components/AskUserQuestion.js.map +0 -1
- package/dist/interactive/ink/components/Header.d.ts +0 -20
- package/dist/interactive/ink/components/Header.d.ts.map +0 -1
- package/dist/interactive/ink/components/Header.js +0 -7
- package/dist/interactive/ink/components/Header.js.map +0 -1
- package/dist/interactive/ink/components/HelpView.d.ts +0 -13
- package/dist/interactive/ink/components/HelpView.d.ts.map +0 -1
- package/dist/interactive/ink/components/HelpView.js +0 -45
- package/dist/interactive/ink/components/HelpView.js.map +0 -1
- package/dist/interactive/ink/components/IterationLimit.d.ts +0 -19
- package/dist/interactive/ink/components/IterationLimit.d.ts.map +0 -1
- package/dist/interactive/ink/components/IterationLimit.js +0 -59
- package/dist/interactive/ink/components/IterationLimit.js.map +0 -1
- package/dist/interactive/ink/components/ModalRouter.d.ts +0 -11
- package/dist/interactive/ink/components/ModalRouter.d.ts.map +0 -1
- package/dist/interactive/ink/components/ModalRouter.js +0 -71
- package/dist/interactive/ink/components/ModalRouter.js.map +0 -1
- package/dist/interactive/ink/components/PermissionPrompt.d.ts +0 -17
- package/dist/interactive/ink/components/PermissionPrompt.d.ts.map +0 -1
- package/dist/interactive/ink/components/PermissionPrompt.js +0 -102
- package/dist/interactive/ink/components/PermissionPrompt.js.map +0 -1
- package/dist/interactive/ink/components/PromptInput.d.ts +0 -26
- package/dist/interactive/ink/components/PromptInput.d.ts.map +0 -1
- package/dist/interactive/ink/components/PromptInput.js +0 -70
- package/dist/interactive/ink/components/PromptInput.js.map +0 -1
- package/dist/interactive/ink/components/Spinner.d.ts +0 -14
- package/dist/interactive/ink/components/Spinner.d.ts.map +0 -1
- package/dist/interactive/ink/components/Spinner.js +0 -8
- package/dist/interactive/ink/components/Spinner.js.map +0 -1
- package/dist/interactive/ink/components/StreamingOutput.d.ts +0 -25
- package/dist/interactive/ink/components/StreamingOutput.d.ts.map +0 -1
- package/dist/interactive/ink/components/StreamingOutput.js +0 -8
- package/dist/interactive/ink/components/StreamingOutput.js.map +0 -1
- package/dist/interactive/ink/components/UserInputPrompt.d.ts +0 -18
- package/dist/interactive/ink/components/UserInputPrompt.d.ts.map +0 -1
- package/dist/interactive/ink/components/UserInputPrompt.js +0 -30
- package/dist/interactive/ink/components/UserInputPrompt.js.map +0 -1
- package/dist/interactive/ink/components/WorkflowSelector.d.ts +0 -18
- package/dist/interactive/ink/components/WorkflowSelector.d.ts.map +0 -1
- package/dist/interactive/ink/components/WorkflowSelector.js +0 -65
- package/dist/interactive/ink/components/WorkflowSelector.js.map +0 -1
- package/dist/interactive/ink/constants.d.ts +0 -8
- package/dist/interactive/ink/constants.d.ts.map +0 -1
- package/dist/interactive/ink/constants.js +0 -8
- package/dist/interactive/ink/constants.js.map +0 -1
- package/dist/interactive/ink/context/AppContext.d.ts +0 -26
- package/dist/interactive/ink/context/AppContext.d.ts.map +0 -1
- package/dist/interactive/ink/context/AppContext.js +0 -30
- package/dist/interactive/ink/context/AppContext.js.map +0 -1
- package/dist/interactive/ink/context/appReducer.d.ts +0 -13
- package/dist/interactive/ink/context/appReducer.d.ts.map +0 -1
- package/dist/interactive/ink/context/appReducer.js +0 -183
- package/dist/interactive/ink/context/appReducer.js.map +0 -1
- package/dist/interactive/ink/context/types.d.ts +0 -144
- package/dist/interactive/ink/context/types.d.ts.map +0 -1
- package/dist/interactive/ink/context/types.js +0 -5
- package/dist/interactive/ink/context/types.js.map +0 -1
- package/dist/interactive/ink/hooks/keyDetection.d.ts +0 -116
- package/dist/interactive/ink/hooks/keyDetection.d.ts.map +0 -1
- package/dist/interactive/ink/hooks/keyDetection.js +0 -183
- package/dist/interactive/ink/hooks/keyDetection.js.map +0 -1
- package/dist/interactive/ink/hooks/multilineInputLogic.d.ts +0 -50
- package/dist/interactive/ink/hooks/multilineInputLogic.d.ts.map +0 -1
- package/dist/interactive/ink/hooks/multilineInputLogic.js +0 -150
- package/dist/interactive/ink/hooks/multilineInputLogic.js.map +0 -1
- package/dist/interactive/ink/hooks/useCommands.d.ts +0 -20
- package/dist/interactive/ink/hooks/useCommands.d.ts.map +0 -1
- package/dist/interactive/ink/hooks/useCommands.js +0 -129
- package/dist/interactive/ink/hooks/useCommands.js.map +0 -1
- package/dist/interactive/ink/hooks/useHistory.d.ts +0 -28
- package/dist/interactive/ink/hooks/useHistory.d.ts.map +0 -1
- package/dist/interactive/ink/hooks/useHistory.js +0 -59
- package/dist/interactive/ink/hooks/useHistory.js.map +0 -1
- package/dist/interactive/ink/hooks/useMultilineInput.d.ts +0 -49
- package/dist/interactive/ink/hooks/useMultilineInput.d.ts.map +0 -1
- package/dist/interactive/ink/hooks/useMultilineInput.js +0 -106
- package/dist/interactive/ink/hooks/useMultilineInput.js.map +0 -1
- package/dist/interactive/ink/hooks/usePermissionHandlers.d.ts +0 -16
- package/dist/interactive/ink/hooks/usePermissionHandlers.d.ts.map +0 -1
- package/dist/interactive/ink/hooks/usePermissionHandlers.js +0 -172
- package/dist/interactive/ink/hooks/usePermissionHandlers.js.map +0 -1
- package/dist/interactive/ink/hooks/useRawKeypress.d.ts +0 -41
- package/dist/interactive/ink/hooks/useRawKeypress.d.ts.map +0 -1
- package/dist/interactive/ink/hooks/useRawKeypress.js +0 -79
- package/dist/interactive/ink/hooks/useRawKeypress.js.map +0 -1
- package/dist/interactive/ink/hooks/useTaskQueue.d.ts +0 -32
- package/dist/interactive/ink/hooks/useTaskQueue.d.ts.map +0 -1
- package/dist/interactive/ink/hooks/useTaskQueue.js +0 -68
- package/dist/interactive/ink/hooks/useTaskQueue.js.map +0 -1
- package/dist/interactive/ink/hooks/useWorkflow.d.ts +0 -45
- package/dist/interactive/ink/hooks/useWorkflow.d.ts.map +0 -1
- package/dist/interactive/ink/hooks/useWorkflow.js +0 -93
- package/dist/interactive/ink/hooks/useWorkflow.js.map +0 -1
- package/dist/interactive/ink/hooks/useWorkflowExecution.d.ts +0 -14
- package/dist/interactive/ink/hooks/useWorkflowExecution.d.ts.map +0 -1
- package/dist/interactive/ink/hooks/useWorkflowExecution.js +0 -144
- package/dist/interactive/ink/hooks/useWorkflowExecution.js.map +0 -1
- package/dist/interactive/ink/index.d.ts +0 -30
- package/dist/interactive/ink/index.d.ts.map +0 -1
- package/dist/interactive/ink/index.js +0 -33
- package/dist/interactive/ink/index.js.map +0 -1
- package/dist/interactive/ink/utils/workflow.d.ts +0 -11
- package/dist/interactive/ink/utils/workflow.d.ts.map +0 -1
- package/dist/interactive/ink/utils/workflow.js +0 -19
- package/dist/interactive/ink/utils/workflow.js.map +0 -1
- package/dist/interactive/input-buffer.d.ts +0 -67
- package/dist/interactive/input-buffer.d.ts.map +0 -1
- package/dist/interactive/input-buffer.js +0 -162
- package/dist/interactive/input-buffer.js.map +0 -1
- package/dist/interactive/input-handlers.d.ts +0 -50
- package/dist/interactive/input-handlers.d.ts.map +0 -1
- package/dist/interactive/input-handlers.js +0 -170
- package/dist/interactive/input-handlers.js.map +0 -1
- package/dist/interactive/input.d.ts +0 -43
- package/dist/interactive/input.d.ts.map +0 -1
- package/dist/interactive/input.js +0 -74
- package/dist/interactive/input.js.map +0 -1
- package/dist/interactive/keyDetection.d.ts +0 -85
- package/dist/interactive/keyDetection.d.ts.map +0 -1
- package/dist/interactive/keyDetection.js +0 -167
- package/dist/interactive/keyDetection.js.map +0 -1
- package/dist/interactive/multilineInputLogic.d.ts +0 -30
- package/dist/interactive/multilineInputLogic.d.ts.map +0 -1
- package/dist/interactive/multilineInputLogic.js +0 -143
- package/dist/interactive/multilineInputLogic.js.map +0 -1
- package/dist/interactive/passthrough.d.ts +0 -30
- package/dist/interactive/passthrough.d.ts.map +0 -1
- package/dist/interactive/passthrough.js +0 -94
- package/dist/interactive/passthrough.js.map +0 -1
- package/dist/interactive/permission.d.ts +0 -33
- package/dist/interactive/permission.d.ts.map +0 -1
- package/dist/interactive/permission.js +0 -231
- package/dist/interactive/permission.js.map +0 -1
- package/dist/interactive/prompt.d.ts.map +0 -1
- package/dist/interactive/prompt.js.map +0 -1
- package/dist/interactive/repl.d.ts +0 -13
- package/dist/interactive/repl.d.ts.map +0 -1
- package/dist/interactive/repl.js +0 -202
- package/dist/interactive/repl.js.map +0 -1
- package/dist/interactive/types.d.ts +0 -35
- package/dist/interactive/types.d.ts.map +0 -1
- package/dist/interactive/types.js +0 -5
- package/dist/interactive/types.js.map +0 -1
- package/dist/interactive/ui.d.ts +0 -16
- package/dist/interactive/ui.d.ts.map +0 -1
- package/dist/interactive/ui.js +0 -122
- package/dist/interactive/ui.js.map +0 -1
- package/dist/interactive/user-input.d.ts +0 -26
- package/dist/interactive/user-input.d.ts.map +0 -1
- package/dist/interactive/user-input.js +0 -115
- package/dist/interactive/user-input.js.map +0 -1
- package/dist/interactive/workflow-executor.d.ts +0 -20
- package/dist/interactive/workflow-executor.d.ts.map +0 -1
- package/dist/interactive/workflow-executor.js +0 -200
- package/dist/interactive/workflow-executor.js.map +0 -1
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session management commands
|
|
3
|
-
*
|
|
4
|
-
* Commands: /clear, /cls, /reset, /status, /history
|
|
5
|
-
*/
|
|
6
|
-
import chalk from 'chalk';
|
|
7
|
-
import { info, success, status, divider } from '../../utils/ui.js';
|
|
8
|
-
import { generateSessionId } from '../../utils/session.js';
|
|
9
|
-
import { setCurrentWorkflow } from '../../config/paths.js';
|
|
10
|
-
import { commandRegistry, createCommand } from './registry.js';
|
|
11
|
-
import { clearScreen, printWelcome } from '../ui.js';
|
|
12
|
-
/** /clear - Clear session and start fresh */
|
|
13
|
-
commandRegistry.register(createCommand(['clear'], 'Clear session and start fresh', async (_, state) => {
|
|
14
|
-
state.claudeSessionId = undefined;
|
|
15
|
-
state.conversationHistory = [];
|
|
16
|
-
state.sessionId = generateSessionId();
|
|
17
|
-
clearScreen();
|
|
18
|
-
printWelcome(state);
|
|
19
|
-
success('Session cleared. Starting fresh.');
|
|
20
|
-
return { continue: true };
|
|
21
|
-
}));
|
|
22
|
-
/** /cls - Clear screen only (keep session) */
|
|
23
|
-
commandRegistry.register(createCommand(['cls'], 'Clear screen only (keep session)', async (_, state) => {
|
|
24
|
-
clearScreen();
|
|
25
|
-
printWelcome(state);
|
|
26
|
-
return { continue: true };
|
|
27
|
-
}));
|
|
28
|
-
/** /reset - Full reset (session + workflow) */
|
|
29
|
-
commandRegistry.register(createCommand(['reset'], 'Full reset (session + workflow)', async (_, state) => {
|
|
30
|
-
state.claudeSessionId = undefined;
|
|
31
|
-
state.conversationHistory = [];
|
|
32
|
-
state.sessionId = generateSessionId();
|
|
33
|
-
state.workflowName = 'default';
|
|
34
|
-
setCurrentWorkflow(state.cwd, 'default');
|
|
35
|
-
clearScreen();
|
|
36
|
-
printWelcome(state);
|
|
37
|
-
success('Session and workflow reset.');
|
|
38
|
-
return { continue: true };
|
|
39
|
-
}));
|
|
40
|
-
/** /status - Show current session info */
|
|
41
|
-
commandRegistry.register(createCommand(['status'], 'Show current session info', async (_, state) => {
|
|
42
|
-
divider();
|
|
43
|
-
status('Session ID', state.sessionId);
|
|
44
|
-
status('Workflow', state.workflowName);
|
|
45
|
-
status('Project', state.cwd);
|
|
46
|
-
status('History', `${state.conversationHistory.length} messages`);
|
|
47
|
-
status('Claude Session', state.claudeSessionId || '(none - will create on first message)');
|
|
48
|
-
divider();
|
|
49
|
-
return { continue: true };
|
|
50
|
-
}));
|
|
51
|
-
/** /history - Show conversation history */
|
|
52
|
-
commandRegistry.register(createCommand(['history'], 'Show conversation history', async (_, state) => {
|
|
53
|
-
if (state.conversationHistory.length === 0) {
|
|
54
|
-
info('No conversation history');
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
divider('═', 60);
|
|
58
|
-
console.log(chalk.bold.magenta(' Conversation History'));
|
|
59
|
-
divider('═', 60);
|
|
60
|
-
state.conversationHistory.forEach((msg, i) => {
|
|
61
|
-
const roleColor = msg.role === 'user' ? chalk.cyan : chalk.green;
|
|
62
|
-
const roleLabel = msg.role === 'user' ? 'You' : 'Assistant';
|
|
63
|
-
const preview = msg.content.length > 100
|
|
64
|
-
? msg.content.slice(0, 100) + '...'
|
|
65
|
-
: msg.content;
|
|
66
|
-
console.log();
|
|
67
|
-
console.log(roleColor(`[${i + 1}] ${roleLabel}:`));
|
|
68
|
-
console.log(chalk.gray(` ${preview}`));
|
|
69
|
-
});
|
|
70
|
-
console.log();
|
|
71
|
-
divider('═', 60);
|
|
72
|
-
}
|
|
73
|
-
return { continue: true };
|
|
74
|
-
}));
|
|
75
|
-
//# sourceMappingURL=session.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/interactive/commands/session.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO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AE,CAAC,CAAC;QACjB,KAAK,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;YAC3C,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;YACjE,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC;YAC5D,MAAM,OAAO,GACX,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG;gBACtB,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK;gBACnC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC;YAClB,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS,GAAG,CAAC,CAAC,CAAC;YACnD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,OAAO,EAAE,CAAC,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACnB,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAC,CAAC,CACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../../src/interactive/commands/task.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task execution commands
|
|
3
|
-
*
|
|
4
|
-
* Commands: /task, /t
|
|
5
|
-
*/
|
|
6
|
-
import chalk from 'chalk';
|
|
7
|
-
import { header, info, error, success, divider, StreamDisplay } from '../../utils/ui.js';
|
|
8
|
-
import { showTaskList } from '../../task/index.js';
|
|
9
|
-
import { commandRegistry, createCommand } from './registry.js';
|
|
10
|
-
import { runAgent } from '../../agents/runner.js';
|
|
11
|
-
/** Execute a task using coder agent */
|
|
12
|
-
async function executeTaskWithAgent(task, state) {
|
|
13
|
-
const startedAt = new Date().toISOString();
|
|
14
|
-
const executionLog = [];
|
|
15
|
-
console.log();
|
|
16
|
-
divider('=', 60);
|
|
17
|
-
header(`Task: ${task.name}`);
|
|
18
|
-
divider('=', 60);
|
|
19
|
-
console.log(chalk.cyan(`\n${task.content}\n`));
|
|
20
|
-
divider('-', 60);
|
|
21
|
-
let response;
|
|
22
|
-
let taskSuccess;
|
|
23
|
-
try {
|
|
24
|
-
// Use stream display for real-time output
|
|
25
|
-
const display = new StreamDisplay('coder');
|
|
26
|
-
const streamHandler = display.createHandler();
|
|
27
|
-
const result = await runAgent('coder', task.content, {
|
|
28
|
-
cwd: state.cwd,
|
|
29
|
-
onStream: (event) => {
|
|
30
|
-
if (event.type !== 'result') {
|
|
31
|
-
streamHandler(event);
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
display.flush();
|
|
36
|
-
taskSuccess = result.status === 'done';
|
|
37
|
-
response = result.content;
|
|
38
|
-
executionLog.push(`Response received: ${response.length} chars`);
|
|
39
|
-
}
|
|
40
|
-
catch (err) {
|
|
41
|
-
response = `[ERROR] Task execution error: ${err instanceof Error ? err.message : String(err)}`;
|
|
42
|
-
taskSuccess = false;
|
|
43
|
-
executionLog.push(`Error: ${err}`);
|
|
44
|
-
}
|
|
45
|
-
const completedAt = new Date().toISOString();
|
|
46
|
-
return {
|
|
47
|
-
task,
|
|
48
|
-
success: taskSuccess,
|
|
49
|
-
response,
|
|
50
|
-
executionLog,
|
|
51
|
-
startedAt,
|
|
52
|
-
completedAt,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
/** Handle /task list subcommand */
|
|
56
|
-
async function handleTaskList(state) {
|
|
57
|
-
showTaskList(state.taskRunner);
|
|
58
|
-
}
|
|
59
|
-
/** Execute a single task and return the result */
|
|
60
|
-
async function executeSingleTask(task, state) {
|
|
61
|
-
// Execute the task
|
|
62
|
-
const result = await executeTaskWithAgent(task, state);
|
|
63
|
-
// Mark task as completed
|
|
64
|
-
const reportFile = state.taskRunner.completeTask(result);
|
|
65
|
-
console.log();
|
|
66
|
-
divider('=', 60);
|
|
67
|
-
if (result.success) {
|
|
68
|
-
success('Task completed');
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
error('Task failed');
|
|
72
|
-
}
|
|
73
|
-
divider('=', 60);
|
|
74
|
-
info(`Report: ${reportFile}`);
|
|
75
|
-
return { result, reportFile };
|
|
76
|
-
}
|
|
77
|
-
/** Run all tasks starting from the given task */
|
|
78
|
-
async function runTasksFromStart(startTask, state) {
|
|
79
|
-
let task = startTask;
|
|
80
|
-
let completedCount = 0;
|
|
81
|
-
let failedCount = 0;
|
|
82
|
-
while (task) {
|
|
83
|
-
const { result } = await executeSingleTask(task, state);
|
|
84
|
-
if (result.success) {
|
|
85
|
-
completedCount++;
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
failedCount++;
|
|
89
|
-
}
|
|
90
|
-
task = state.taskRunner.getNextTask();
|
|
91
|
-
if (task) {
|
|
92
|
-
console.log();
|
|
93
|
-
info(`Proceeding to next task: ${task.name}`);
|
|
94
|
-
divider('-', 60);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
console.log();
|
|
98
|
-
divider('=', 60);
|
|
99
|
-
success(`All tasks completed! (${completedCount} succeeded, ${failedCount} failed)`);
|
|
100
|
-
divider('=', 60);
|
|
101
|
-
}
|
|
102
|
-
/** Handle /task run [name] subcommand - runs all pending tasks (optionally starting from a specific task) */
|
|
103
|
-
async function handleTaskRun(taskName, state) {
|
|
104
|
-
let task;
|
|
105
|
-
if (taskName) {
|
|
106
|
-
task = state.taskRunner.getTask(taskName);
|
|
107
|
-
if (!task) {
|
|
108
|
-
error(`Task '${taskName}' not found`);
|
|
109
|
-
showTaskList(state.taskRunner);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
task = state.taskRunner.getNextTask();
|
|
115
|
-
if (!task) {
|
|
116
|
-
info('No pending tasks.');
|
|
117
|
-
console.log(chalk.gray(`Place task files (.md) in ${state.taskRunner.getTasksDir()}/`));
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
await runTasksFromStart(task, state);
|
|
122
|
-
}
|
|
123
|
-
/** Handle /task all subcommand - alias for /task run (for backward compatibility) */
|
|
124
|
-
async function handleTaskAll(state) {
|
|
125
|
-
const task = state.taskRunner.getNextTask();
|
|
126
|
-
if (!task) {
|
|
127
|
-
info('No pending tasks.');
|
|
128
|
-
console.log(chalk.gray(`Place task files (.md) in ${state.taskRunner.getTasksDir()}/`));
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
await runTasksFromStart(task, state);
|
|
132
|
-
}
|
|
133
|
-
/** /task, /t - Task management command */
|
|
134
|
-
commandRegistry.register(createCommand(['task', 't'], 'Task management (list/run)', async (args, state) => {
|
|
135
|
-
const subcommand = args[0]?.toLowerCase() ?? '';
|
|
136
|
-
const subargs = args.slice(1).join(' ');
|
|
137
|
-
// /task or /task list - show task list
|
|
138
|
-
if (!subcommand || subcommand === 'list') {
|
|
139
|
-
await handleTaskList(state);
|
|
140
|
-
return { continue: true };
|
|
141
|
-
}
|
|
142
|
-
// /task run [name] - run all pending tasks (optionally starting from a specific task)
|
|
143
|
-
if (subcommand === 'run') {
|
|
144
|
-
await handleTaskRun(subargs || undefined, state);
|
|
145
|
-
return { continue: true };
|
|
146
|
-
}
|
|
147
|
-
// /task all - alias for /task run (backward compatibility)
|
|
148
|
-
if (subcommand === 'all') {
|
|
149
|
-
await handleTaskAll(state);
|
|
150
|
-
return { continue: true };
|
|
151
|
-
}
|
|
152
|
-
error(`Unknown subcommand: ${subcommand}`);
|
|
153
|
-
info('Usage: /task [list|run [name]|all]');
|
|
154
|
-
return { continue: true };
|
|
155
|
-
}));
|
|
156
|
-
//# sourceMappingURL=task.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task.js","sourceRoot":"","sources":["../../../src/interactive/commands/task.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,YAAY,EAAkC,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,uCAAuC;AACvC,KAAK,UAAU,oBAAoB,CACjC,IAAc,EACd,KAAuB;IAEvB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC3C,MAAM,YAAY,GAAa,EAAE,CAAC;IAElC,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACjB,MAAM,CAAC,SAAS,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7B,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC;IAC/C,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAEjB,IAAI,QAAgB,CAAC;IACrB,IAAI,WAAoB,CAAC;IAEzB,IAAI,CAAC;QACH,0CAA0C;QAC1C,MAAM,OAAO,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.ts","sourceRoot":"","sources":["../../../src/interactive/commands/workflow.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Workflow management commands
|
|
3
|
-
*
|
|
4
|
-
* Commands: /switch, /sw, /workflow, /workflows
|
|
5
|
-
*/
|
|
6
|
-
import { loadWorkflow, listWorkflows, getBuiltinWorkflow, } from '../../config/index.js';
|
|
7
|
-
import { setCurrentWorkflow } from '../../config/paths.js';
|
|
8
|
-
import { header, info, success, error, list } from '../../utils/ui.js';
|
|
9
|
-
import { commandRegistry, createCommand } from './registry.js';
|
|
10
|
-
import { selectWorkflow } from '../ui.js';
|
|
11
|
-
/** /switch, /sw - Interactive workflow selection */
|
|
12
|
-
commandRegistry.register(createCommand(['switch', 'sw'], 'Switch workflow (interactive selection)', async (_, state, rl) => {
|
|
13
|
-
const selected = await selectWorkflow(state, rl);
|
|
14
|
-
if (selected) {
|
|
15
|
-
state.workflowName = selected;
|
|
16
|
-
setCurrentWorkflow(state.cwd, selected);
|
|
17
|
-
success(`Switched to workflow: ${selected}`);
|
|
18
|
-
info('Enter a task to start the workflow.');
|
|
19
|
-
}
|
|
20
|
-
return { continue: true };
|
|
21
|
-
}));
|
|
22
|
-
/** /workflow [name] - Show or change current workflow */
|
|
23
|
-
commandRegistry.register(createCommand(['workflow'], 'Show or change current workflow', async (args, state) => {
|
|
24
|
-
if (args.length > 0) {
|
|
25
|
-
const newWorkflow = args.join(' ');
|
|
26
|
-
// Check if it exists
|
|
27
|
-
const builtin = getBuiltinWorkflow(newWorkflow);
|
|
28
|
-
const custom = loadWorkflow(newWorkflow);
|
|
29
|
-
if (builtin || custom) {
|
|
30
|
-
state.workflowName = newWorkflow;
|
|
31
|
-
setCurrentWorkflow(state.cwd, newWorkflow);
|
|
32
|
-
success(`Switched to workflow: ${newWorkflow}`);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
error(`Workflow not found: ${newWorkflow}`);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
info(`Current workflow: ${state.workflowName}`);
|
|
40
|
-
}
|
|
41
|
-
return { continue: true };
|
|
42
|
-
}));
|
|
43
|
-
/** /workflows - List available workflows */
|
|
44
|
-
commandRegistry.register(createCommand(['workflows'], 'List available workflows', async () => {
|
|
45
|
-
const workflows = listWorkflows();
|
|
46
|
-
if (workflows.length === 0) {
|
|
47
|
-
info('No workflows defined.');
|
|
48
|
-
info('Add workflow files to ~/.takt/workflows/');
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
header('Available Workflows');
|
|
52
|
-
list(workflows);
|
|
53
|
-
}
|
|
54
|
-
return { continue: true };
|
|
55
|
-
}));
|
|
56
|
-
//# sourceMappingURL=workflow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../../src/interactive/commands/workflow.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,YAAY,EACZ,aAAa,EACb,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,oDAAoD;AACpD,eAAe,CAAC,QAAQ,CACtB,aAAa,CACX,CAAC,QAAQ,EAAE,IAAI,CAAC,EAChB,yCAAyC,EACzC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;IACrB,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACjD,IAAI,QAAQ,EAAE,CAAC;QACb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AI,EAAE;IAClE,MAAM,SAAS,GAAG,aAAa,EAAE,CAAC;IAClC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,IAAI,CAAC,uBAAuB,CAAC,CAAC;QAC9B,IAAI,CAAC,0CAA0C,CAAC,CAAC;IACnD,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAC9B,IAAI,CAAC,SAAS,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAC,CAAC,CACH,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Escape sequence tracking for iTerm2-style Option+Enter detection
|
|
3
|
-
*
|
|
4
|
-
* iTerm2 (and some other Mac terminals) send Option+Enter as two separate events:
|
|
5
|
-
* Escape followed by Enter. This module provides a tracker to detect this pattern
|
|
6
|
-
* by checking if Enter is pressed shortly after Escape.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Tracks Escape key timing for detecting iTerm2-style Option+Enter.
|
|
10
|
-
*
|
|
11
|
-
* The threshold of 50ms is based on:
|
|
12
|
-
* - Typical keyboard repeat delay is 200-500ms
|
|
13
|
-
* - Terminal escape sequence transmission is near-instantaneous (<10ms)
|
|
14
|
-
* - Human intentional Esc→Enter would take at least 100-150ms
|
|
15
|
-
* - 50ms provides a safe margin to detect machine-generated sequences
|
|
16
|
-
* while avoiding false positives from intentional key presses
|
|
17
|
-
*/
|
|
18
|
-
export declare class EscapeSequenceTracker {
|
|
19
|
-
private lastEscapeTime;
|
|
20
|
-
private readonly thresholdMs;
|
|
21
|
-
/**
|
|
22
|
-
* @param thresholdMs Time window to consider Esc+Enter as Option+Enter (default: 50ms)
|
|
23
|
-
*/
|
|
24
|
-
constructor(thresholdMs?: number);
|
|
25
|
-
/** Record that Escape key was pressed */
|
|
26
|
-
trackEscape(): void;
|
|
27
|
-
/**
|
|
28
|
-
* Check if Enter was pressed within threshold of Escape.
|
|
29
|
-
* Resets the tracker if true to prevent repeated triggers.
|
|
30
|
-
*/
|
|
31
|
-
isEscapeThenEnter(): boolean;
|
|
32
|
-
/** Reset the tracker state */
|
|
33
|
-
reset(): void;
|
|
34
|
-
/** Get the threshold value (for testing) */
|
|
35
|
-
getThreshold(): number;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=escape-tracker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"escape-tracker.d.ts","sourceRoot":"","sources":["../../src/interactive/escape-tracker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;GASG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IAErC;;OAEG;gBACS,WAAW,GAAE,MAAW;IAIpC,yCAAyC;IACzC,WAAW,IAAI,IAAI;IAInB;;;OAGG;IACH,iBAAiB,IAAI,OAAO;IAS5B,8BAA8B;IAC9B,KAAK,IAAI,IAAI;IAIb,4CAA4C;IAC5C,YAAY,IAAI,MAAM;CAGvB"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Escape sequence tracking for iTerm2-style Option+Enter detection
|
|
3
|
-
*
|
|
4
|
-
* iTerm2 (and some other Mac terminals) send Option+Enter as two separate events:
|
|
5
|
-
* Escape followed by Enter. This module provides a tracker to detect this pattern
|
|
6
|
-
* by checking if Enter is pressed shortly after Escape.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Tracks Escape key timing for detecting iTerm2-style Option+Enter.
|
|
10
|
-
*
|
|
11
|
-
* The threshold of 50ms is based on:
|
|
12
|
-
* - Typical keyboard repeat delay is 200-500ms
|
|
13
|
-
* - Terminal escape sequence transmission is near-instantaneous (<10ms)
|
|
14
|
-
* - Human intentional Esc→Enter would take at least 100-150ms
|
|
15
|
-
* - 50ms provides a safe margin to detect machine-generated sequences
|
|
16
|
-
* while avoiding false positives from intentional key presses
|
|
17
|
-
*/
|
|
18
|
-
export class EscapeSequenceTracker {
|
|
19
|
-
lastEscapeTime = 0;
|
|
20
|
-
thresholdMs;
|
|
21
|
-
/**
|
|
22
|
-
* @param thresholdMs Time window to consider Esc+Enter as Option+Enter (default: 50ms)
|
|
23
|
-
*/
|
|
24
|
-
constructor(thresholdMs = 50) {
|
|
25
|
-
this.thresholdMs = thresholdMs;
|
|
26
|
-
}
|
|
27
|
-
/** Record that Escape key was pressed */
|
|
28
|
-
trackEscape() {
|
|
29
|
-
this.lastEscapeTime = Date.now();
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Check if Enter was pressed within threshold of Escape.
|
|
33
|
-
* Resets the tracker if true to prevent repeated triggers.
|
|
34
|
-
*/
|
|
35
|
-
isEscapeThenEnter() {
|
|
36
|
-
const elapsed = Date.now() - this.lastEscapeTime;
|
|
37
|
-
const isRecent = elapsed < this.thresholdMs && this.lastEscapeTime > 0;
|
|
38
|
-
if (isRecent) {
|
|
39
|
-
this.lastEscapeTime = 0; // Reset to prevent accidental triggers
|
|
40
|
-
}
|
|
41
|
-
return isRecent;
|
|
42
|
-
}
|
|
43
|
-
/** Reset the tracker state */
|
|
44
|
-
reset() {
|
|
45
|
-
this.lastEscapeTime = 0;
|
|
46
|
-
}
|
|
47
|
-
/** Get the threshold value (for testing) */
|
|
48
|
-
getThreshold() {
|
|
49
|
-
return this.thresholdMs;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=escape-tracker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"escape-tracker.js","sourceRoot":"","sources":["../../src/interactive/escape-tracker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;GASG;AACH,MAAM,OAAO,qBAAqB;IACxB,cAAc,GAAW,CAAC,CAAC;IAClB,WAAW,CAAS;IAErC;;OAEG;IACH,YAAY,cAAsB,EAAE;QAClC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,yCAAyC;IACzC,WAAW;QACT,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,iBAAiB;QACf,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,cAAc,CAAC;QACjD,MAAM,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;QACvE,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC,uCAAuC;QAClE,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,8BAA8B;IAC9B,KAAK;QACH,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED,4CAA4C;IAC5C,YAAY;QACV,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interactive handlers for user questions and input
|
|
3
|
-
*
|
|
4
|
-
* Handles AskUserQuestion tool responses and user input prompts
|
|
5
|
-
* during workflow execution.
|
|
6
|
-
*/
|
|
7
|
-
import type { InputHistoryManager } from './input.js';
|
|
8
|
-
import { createReadlineInterface } from './input.js';
|
|
9
|
-
import type { AskUserQuestionHandler } from '../claude/process.js';
|
|
10
|
-
/**
|
|
11
|
-
* Create a handler that uses another agent to answer questions.
|
|
12
|
-
* This allows automatic question answering by delegating to a specified agent.
|
|
13
|
-
*/
|
|
14
|
-
export declare function createAgentAnswerHandler(answerAgentName: string, cwd: string): AskUserQuestionHandler;
|
|
15
|
-
/**
|
|
16
|
-
* Handle AskUserQuestion tool from Claude Code.
|
|
17
|
-
* Displays questions to the user and collects their answers.
|
|
18
|
-
*/
|
|
19
|
-
export declare function createAskUserQuestionHandler(rl: ReturnType<typeof createReadlineInterface>, historyManager: InputHistoryManager): AskUserQuestionHandler;
|
|
20
|
-
/**
|
|
21
|
-
* Create a handler for sacrifice mode that auto-skips all questions.
|
|
22
|
-
*/
|
|
23
|
-
export declare function createSacrificeModeQuestionHandler(): AskUserQuestionHandler;
|
|
24
|
-
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/interactive/handlers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAqB,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,KAAK,EAAwB,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAIzF;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,MAAM,EACvB,GAAG,EAAE,MAAM,GACV,sBAAsB,CA+ExB;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,EAAE,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,EAC9C,cAAc,EAAE,mBAAmB,GAClC,sBAAsB,CAkGxB;AAED;;GAEG;AACH,wBAAgB,kCAAkC,IAAI,sBAAsB,CAK3E"}
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interactive handlers for user questions and input
|
|
3
|
-
*
|
|
4
|
-
* Handles AskUserQuestion tool responses and user input prompts
|
|
5
|
-
* during workflow execution.
|
|
6
|
-
*/
|
|
7
|
-
import chalk from 'chalk';
|
|
8
|
-
import { multiLineQuestion } from './input.js';
|
|
9
|
-
import { runAgent } from '../agents/runner.js';
|
|
10
|
-
import { info } from '../utils/ui.js';
|
|
11
|
-
/**
|
|
12
|
-
* Create a handler that uses another agent to answer questions.
|
|
13
|
-
* This allows automatic question answering by delegating to a specified agent.
|
|
14
|
-
*/
|
|
15
|
-
export function createAgentAnswerHandler(answerAgentName, cwd) {
|
|
16
|
-
return async (input) => {
|
|
17
|
-
const answers = {};
|
|
18
|
-
console.log();
|
|
19
|
-
console.log(chalk.magenta('━'.repeat(60)));
|
|
20
|
-
console.log(chalk.magenta.bold(`🤖 ${answerAgentName} が質問に回答します`));
|
|
21
|
-
console.log(chalk.magenta('━'.repeat(60)));
|
|
22
|
-
for (let i = 0; i < input.questions.length; i++) {
|
|
23
|
-
const q = input.questions[i];
|
|
24
|
-
if (!q)
|
|
25
|
-
continue;
|
|
26
|
-
const questionKey = `q${i}`;
|
|
27
|
-
// Build a prompt for the answer agent
|
|
28
|
-
let prompt = `以下の質問に回答してください。回答のみを出力してください。\n\n`;
|
|
29
|
-
prompt += `質問: ${q.question}\n`;
|
|
30
|
-
if (q.options && q.options.length > 0) {
|
|
31
|
-
prompt += `\n選択肢:\n`;
|
|
32
|
-
q.options.forEach((opt, idx) => {
|
|
33
|
-
prompt += `${idx + 1}. ${opt.label}`;
|
|
34
|
-
if (opt.description) {
|
|
35
|
-
prompt += ` - ${opt.description}`;
|
|
36
|
-
}
|
|
37
|
-
prompt += '\n';
|
|
38
|
-
});
|
|
39
|
-
prompt += `\n選択肢の番号またはラベルで回答してください。選択肢以外の回答も可能です。`;
|
|
40
|
-
}
|
|
41
|
-
console.log(chalk.gray(`質問: ${q.question}`));
|
|
42
|
-
try {
|
|
43
|
-
const response = await runAgent(answerAgentName, prompt, {
|
|
44
|
-
cwd,
|
|
45
|
-
// Don't use session for answer agent - each question is independent
|
|
46
|
-
});
|
|
47
|
-
// Extract the answer from agent response
|
|
48
|
-
const answerContent = response.content.trim();
|
|
49
|
-
// If the agent selected a numbered option, convert to label
|
|
50
|
-
const options = q.options;
|
|
51
|
-
if (options && options.length > 0) {
|
|
52
|
-
const num = parseInt(answerContent, 10);
|
|
53
|
-
if (num >= 1 && num <= options.length) {
|
|
54
|
-
const selectedOption = options[num - 1];
|
|
55
|
-
answers[questionKey] = selectedOption?.label ?? answerContent;
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
// Check if agent replied with exact label
|
|
59
|
-
const matchedOption = options.find(opt => opt.label.toLowerCase() === answerContent.toLowerCase());
|
|
60
|
-
if (matchedOption) {
|
|
61
|
-
answers[questionKey] = matchedOption.label;
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
answers[questionKey] = answerContent;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
answers[questionKey] = answerContent;
|
|
70
|
-
}
|
|
71
|
-
console.log(chalk.green(`回答: ${answers[questionKey]}`));
|
|
72
|
-
}
|
|
73
|
-
catch (err) {
|
|
74
|
-
console.log(chalk.red(`エージェントエラー: ${err instanceof Error ? err.message : String(err)}`));
|
|
75
|
-
// Fall back to empty answer on error
|
|
76
|
-
answers[questionKey] = '';
|
|
77
|
-
}
|
|
78
|
-
console.log();
|
|
79
|
-
}
|
|
80
|
-
console.log(chalk.magenta('━'.repeat(60)));
|
|
81
|
-
console.log();
|
|
82
|
-
return answers;
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Handle AskUserQuestion tool from Claude Code.
|
|
87
|
-
* Displays questions to the user and collects their answers.
|
|
88
|
-
*/
|
|
89
|
-
export function createAskUserQuestionHandler(rl, historyManager) {
|
|
90
|
-
return async (input) => {
|
|
91
|
-
const answers = {};
|
|
92
|
-
console.log();
|
|
93
|
-
console.log(chalk.blue('━'.repeat(60)));
|
|
94
|
-
console.log(chalk.blue.bold('❓ Claude Code からの質問'));
|
|
95
|
-
console.log(chalk.blue('━'.repeat(60)));
|
|
96
|
-
console.log();
|
|
97
|
-
for (let i = 0; i < input.questions.length; i++) {
|
|
98
|
-
const q = input.questions[i];
|
|
99
|
-
if (!q)
|
|
100
|
-
continue;
|
|
101
|
-
const questionKey = `q${i}`;
|
|
102
|
-
// Show the question
|
|
103
|
-
if (q.header) {
|
|
104
|
-
console.log(chalk.cyan.bold(`[${q.header}]`));
|
|
105
|
-
}
|
|
106
|
-
console.log(chalk.white(q.question));
|
|
107
|
-
// Show options if available
|
|
108
|
-
const options = q.options;
|
|
109
|
-
if (options && options.length > 0) {
|
|
110
|
-
console.log();
|
|
111
|
-
options.forEach((opt, idx) => {
|
|
112
|
-
const label = chalk.yellow(` ${idx + 1}. ${opt.label}`);
|
|
113
|
-
const desc = opt.description ? chalk.gray(` - ${opt.description}`) : '';
|
|
114
|
-
console.log(label + desc);
|
|
115
|
-
});
|
|
116
|
-
console.log(chalk.gray(` ${options.length + 1}. その他(自由入力)`));
|
|
117
|
-
console.log();
|
|
118
|
-
// Prompt for selection
|
|
119
|
-
const answer = await new Promise((resolve) => {
|
|
120
|
-
multiLineQuestion(rl, {
|
|
121
|
-
promptStr: chalk.magenta('選択> '),
|
|
122
|
-
onCtrlC: () => {
|
|
123
|
-
resolve('');
|
|
124
|
-
return true;
|
|
125
|
-
},
|
|
126
|
-
historyManager,
|
|
127
|
-
}).then(resolve).catch(() => resolve(''));
|
|
128
|
-
});
|
|
129
|
-
const trimmed = answer.trim();
|
|
130
|
-
const num = parseInt(trimmed, 10);
|
|
131
|
-
if (num >= 1 && num <= options.length) {
|
|
132
|
-
// User selected an option
|
|
133
|
-
const selectedOption = options[num - 1];
|
|
134
|
-
answers[questionKey] = selectedOption?.label ?? '';
|
|
135
|
-
}
|
|
136
|
-
else if (num === options.length + 1 || isNaN(num)) {
|
|
137
|
-
// User selected "Other" or entered free text
|
|
138
|
-
if (isNaN(num) && trimmed !== '') {
|
|
139
|
-
answers[questionKey] = trimmed;
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
console.log(chalk.cyan('自由入力してください:'));
|
|
143
|
-
const freeAnswer = await new Promise((resolve) => {
|
|
144
|
-
multiLineQuestion(rl, {
|
|
145
|
-
promptStr: chalk.magenta('回答> '),
|
|
146
|
-
onCtrlC: () => {
|
|
147
|
-
resolve('');
|
|
148
|
-
return true;
|
|
149
|
-
},
|
|
150
|
-
historyManager,
|
|
151
|
-
}).then(resolve).catch(() => resolve(''));
|
|
152
|
-
});
|
|
153
|
-
answers[questionKey] = freeAnswer.trim();
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
answers[questionKey] = trimmed;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
// No options, free text input
|
|
162
|
-
console.log();
|
|
163
|
-
const answer = await new Promise((resolve) => {
|
|
164
|
-
multiLineQuestion(rl, {
|
|
165
|
-
promptStr: chalk.magenta('回答> '),
|
|
166
|
-
onCtrlC: () => {
|
|
167
|
-
resolve('');
|
|
168
|
-
return true;
|
|
169
|
-
},
|
|
170
|
-
historyManager,
|
|
171
|
-
}).then(resolve).catch(() => resolve(''));
|
|
172
|
-
});
|
|
173
|
-
answers[questionKey] = answer.trim();
|
|
174
|
-
}
|
|
175
|
-
console.log();
|
|
176
|
-
}
|
|
177
|
-
console.log(chalk.blue('━'.repeat(60)));
|
|
178
|
-
console.log();
|
|
179
|
-
return answers;
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Create a handler for sacrifice mode that auto-skips all questions.
|
|
184
|
-
*/
|
|
185
|
-
export function createSacrificeModeQuestionHandler() {
|
|
186
|
-
return async (_input) => {
|
|
187
|
-
info('[SACRIFICE MODE] Auto-skipping AskUserQuestion');
|
|
188
|
-
return {};
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
//# sourceMappingURL=handlers.js.map
|