-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathADUC_launcher.bat
More file actions
174 lines (149 loc) · 5.51 KB
/
Copy pathADUC_launcher.bat
File metadata and controls
174 lines (149 loc) · 5.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
@echo off
setlocal EnableExtensions EnableDelayedExpansion
:: CHRONOS ADUC LAUNCHER
:: Launches ADUC in "Chronos Mode" (Pilot Mode)
:: 1. Reads settings from settings/launcher_config.yml
:: 2. Bundles Chronos Documentation into a single context file.
:: 3. Sets environment variables to inject this context into ADUC.
:: 4. Launches with configured CLI backend (Codex or Gemini).
set "CHRONOS_ROOT=%~dp0"
:: Remove trailing backslash
if "%CHRONOS_ROOT:~-1%"=="\" set "CHRONOS_ROOT=%CHRONOS_ROOT:~0,-1%"
set "ADUC_DIR=%CHRONOS_ROOT%\Agents Dress Up Committee"
set "DOCS_DIR=%CHRONOS_ROOT%\docs"
set "CTX_FILE=%TEMP%\chronos_full_context.md"
set "ADUC_TEMP_DIR=%TEMP%\ADUC"
set "DIGEST_FILE=%CHRONOS_ROOT%\temp\docs_digest.txt"
set "TRENDS_FILE=%CHRONOS_ROOT%\user\data\trends.md"
if /i "%ADUC_DASHBOARD%"=="1" (
set "ADUC_NO_BROWSER=1"
if not exist "%ADUC_TEMP_DIR%" mkdir "%ADUC_TEMP_DIR%" >nul 2>&1
echo 1 > "%ADUC_TEMP_DIR%\no_browser.flag"
)
:: Pick Python (prefer py)
set "PYCMD="
where py >nul 2>&1 && set "PYCMD=py"
if not defined PYCMD (
where python >nul 2>&1 && set "PYCMD=python"
)
if not defined PYCMD (
echo [ADUC] Python not found on PATH. Install Python 3.9+.
pause
exit /b 1
)
echo [Chronos] Initializing Pilot Mode...
:: Read configuration from launcher_config.yml
cd /d "%ADUC_DIR%"
for /f "tokens=*" %%a in ('%PYCMD% launch_config.py cli_backend') do set "CLI_BACKEND=%%a"
for /f "tokens=*" %%a in ('%PYCMD% launch_config.py working_directory') do set "WORK_DIR_SETTING=%%a"
for /f "tokens=*" %%a in ('%PYCMD% launch_config.py cli_timeout') do set "CLI_TIMEOUT=%%a"
for /f "tokens=*" %%a in ('%PYCMD% launch_config.py immersive') do set "IMMERSIVE=%%a"
for /f "tokens=*" %%a in ('%PYCMD% launch_config.py include_memory') do set "INCLUDE_MEMORY=%%a"
echo [Chronos] Config: backend=%CLI_BACKEND%, workdir=%WORK_DIR_SETTING%, timeout=%CLI_TIMEOUT%
:: Resolve working directory
if /i "%WORK_DIR_SETTING%"=="chronos" (
set "WORK_DIR=%CHRONOS_ROOT%"
) else if /i "%WORK_DIR_SETTING%"=="aduc" (
set "WORK_DIR=%ADUC_DIR%"
) else (
set "WORK_DIR=%WORK_DIR_SETTING%"
)
:: 1. Bundle Documentation (Excluding Legal)
echo [Chronos] Bundling Documentation context...
if exist "%CTX_FILE%" del /q "%CTX_FILE%" >nul 2>&1
:: Header
echo # SYSTEM CONTEXT: CHRONOS ENGINE MANUAL > "%CTX_FILE%"
echo. >> "%CTX_FILE%"
echo You are running inside the Chronos Engine. The following is the reference manual for the system you control. >> "%CTX_FILE%"
echo. >> "%CTX_FILE%"
if exist "%DIGEST_FILE%" (
echo [Chronos] Using compact docs digest...
type "%DIGEST_FILE%" >> "%CTX_FILE%"
echo. >> "%CTX_FILE%"
) else (
:: Loop through docs
for /r "%DOCS_DIR%" %%f in (*.md) do (
set "file_path=%%f"
echo Processing: !file_path!
:: Check if path contains "\Legal\" - simplistic string check
set "is_legal=0"
echo "!file_path!" | findstr /i "\\Legal\\" >nul && set "is_legal=1"
:: Skip docs that the watcher already injects separately
set "is_runtime_injected=0"
echo "!file_path!" | findstr /i "\\docs\\index.md" >nul && set "is_runtime_injected=1"
echo "!file_path!" | findstr /i "\\docs\\agents\\trick.md" >nul && set "is_runtime_injected=1"
if "!is_legal!"=="0" (
if "!is_runtime_injected!"=="0" (
echo. >> "%CTX_FILE%"
echo --- FILE: %%~nxf --- >> "%CTX_FILE%"
echo. >> "%CTX_FILE%"
type "%%f" >> "%CTX_FILE%"
echo. >> "%CTX_FILE%"
) else (
echo Skipping Runtime-Injected Doc: %%~nxf
)
) else (
echo Skipping Legal: %%~nxf
)
)
)
:: 1b. Bundle User Profile (pilot_brief.md, preferences.md)
set "PROFILE_DIR=%CHRONOS_ROOT%\user\profile"
echo [Chronos] Bundling User Profile context...
echo. >> "%CTX_FILE%"
echo # USER PROFILE >> "%CTX_FILE%"
echo. >> "%CTX_FILE%"
for %%f in ("%PROFILE_DIR%\*.md") do (
echo Processing: %%f
echo. >> "%CTX_FILE%"
echo --- FILE: %%~nxf --- >> "%CTX_FILE%"
echo. >> "%CTX_FILE%"
type "%%f" >> "%CTX_FILE%"
echo. >> "%CTX_FILE%"
)
if exist "%TRENDS_FILE%" (
echo [Chronos] Bundling Trends context...
echo. >> "%CTX_FILE%"
echo --- FILE: trends.md --- >> "%CTX_FILE%"
echo. >> "%CTX_FILE%"
type "%TRENDS_FILE%" >> "%CTX_FILE%"
echo. >> "%CTX_FILE%"
)
echo [Chronos] Context bundled to %CTX_FILE%
:: 2. Set Environment Variables
set "ADUC_EXTERNAL_CONTEXT_FILE=%CTX_FILE%"
set "ADUC_PROJECT_PATH=%WORK_DIR%"
set "ADUC_CLI_BACKEND=%CLI_BACKEND%"
:: Set timeout based on backend
if /i "%CLI_BACKEND%"=="gemini" (
set "ADUC_GEMINI_TIMEOUT=%CLI_TIMEOUT%"
) else (
set "ADUC_CODEX_TIMEOUT=%CLI_TIMEOUT%"
)
:: Set toggles
if /i "%IMMERSIVE%"=="true" set "ADUC_IMMERSIVE=1"
if /i "%INCLUDE_MEMORY%"=="true" set "ADUC_INCLUDE_MEMORY=1"
:: 3. Launch ADUC from the configured working directory
echo [Chronos] Working directory: %WORK_DIR%
echo [Chronos] CLI backend: %CLI_BACKEND%
cd /d "%WORK_DIR%"
:: Launch based on backend
cd /d "%ADUC_DIR%"
if /i "%CLI_BACKEND%"=="gemini" (
if exist "run_aduc_gemini.bat" (
echo [Chronos] Launching ADUC with Gemini...
call "run_aduc_gemini.bat"
) else (
echo [Error] run_aduc_gemini.bat not found in %ADUC_DIR%
pause
)
) else (
if exist "run_aduc_codex.bat" (
echo [Chronos] Launching ADUC with Codex...
call "run_aduc_codex.bat"
) else (
echo [Error] run_aduc_codex.bat not found in %ADUC_DIR%
pause
)
)
endlocal