@alivault/pico 0.12.0 → 0.14.0
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/.output/nitro.json +1 -1
- package/.output/public/assets/addon-fit-CMMXLNsg.js +1 -0
- package/.output/public/assets/{index-DQLwecED.js → index-DBVxXDtw.js} +11 -10
- package/.output/public/assets/routes-yUxD2q-l.js +2194 -0
- package/.output/public/assets/styles-CUVz7jV9.css +2 -0
- package/.output/public/assets/xterm-CCMwI7sy.js +36 -0
- package/.output/public/screenshots/pico-ios-dark.png +0 -0
- package/.output/public/screenshots/pico-ios-light.png +0 -0
- package/.output/public/screenshots/pico-macos-dark.jpg +0 -0
- package/.output/public/screenshots/pico-macos-light.jpg +0 -0
- package/.output/server/_chunks/ssr-renderer.mjs +3 -3
- package/.output/server/_libs/crossws.mjs +2929 -0
- package/.output/server/_libs/h3+rou3+srvx.mjs +7 -1
- package/.output/server/_libs/lucide-react.mjs +20 -1
- package/.output/server/_libs/unctx.mjs +1 -1
- package/.output/server/_libs/xterm__addon-fit.mjs +44 -0
- package/.output/server/_libs/xterm__xterm.mjs +10234 -0
- package/.output/server/_routes/api/terminal/[id]/ws.mjs +8874 -0
- package/.output/server/_ssr/{router-D36lUq7O.mjs → router-CN4JMm2A.mjs} +1605 -314
- package/.output/server/_ssr/{routes-C8qT6Oju.mjs → routes-BsQ26pbY.mjs} +2377 -730
- package/.output/server/_ssr/{routes-9nZumcXQ.mjs → routes-DbjuMLFI.mjs} +176 -26
- package/.output/server/_ssr/ssr.mjs +3 -3
- package/.output/server/_ssr/start-jIczsXlR.mjs +4 -0
- package/.output/server/{_tanstack-start-manifest_v-Cd2ypHmK.mjs → _tanstack-start-manifest_v-Bs4g_j1_.mjs} +8 -4
- package/.output/server/index.mjs +594 -501
- package/.output/server/node_modules/node-pty/LICENSE +69 -0
- package/.output/server/node_modules/node-pty/README.md +165 -0
- package/.output/server/node_modules/node-pty/binding.gyp +111 -0
- package/.output/server/node_modules/node-pty/build/Makefile +369 -0
- package/.output/server/node_modules/node-pty/build/Release/pty.node +0 -0
- package/.output/server/node_modules/node-pty/build/binding.Makefile +6 -0
- package/.output/server/node_modules/node-pty/build/pty.target.mk +168 -0
- package/.output/server/node_modules/node-pty/deps/.editorconfig +2 -0
- package/.output/server/node_modules/node-pty/deps/winpty/.drone.yml +17 -0
- package/.output/server/node_modules/node-pty/deps/winpty/.gitattributes +19 -0
- package/.output/server/node_modules/node-pty/deps/winpty/LICENSE +21 -0
- package/.output/server/node_modules/node-pty/deps/winpty/Makefile +166 -0
- package/.output/server/node_modules/node-pty/deps/winpty/README.md +151 -0
- package/.output/server/node_modules/node-pty/deps/winpty/RELEASES.md +280 -0
- package/.output/server/node_modules/node-pty/deps/winpty/VERSION.txt +1 -0
- package/.output/server/node_modules/node-pty/deps/winpty/configure +167 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/BufferResizeTests.cc +90 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ChangeScreenBuffer.cc +53 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ClearConsole.cc +72 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ConinMode.cc +117 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ConinMode.ps1 +116 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ConoutMode.cc +113 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/DebugClient.py +42 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/DebugServer.py +63 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/DumpLines.py +5 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/EnableExtendedFlags.txt +46 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP437-Consolas.txt +528 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP437-Lucida.txt +633 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP932.txt +630 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP936.txt +630 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP949.txt +630 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP950.txt +630 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/MinimumWindowWidths.txt +16 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/Results.txt +4 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/Windows10SetFontBugginess.txt +144 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/FontSurvey.cc +100 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/FormatChar.h +21 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/FreezePerfTest.cc +62 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/GetCh.cc +20 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/GetConsolePos.cc +41 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/GetFont.cc +261 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/IdentifyConsoleWindow.ps1 +51 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/IsNewConsole.cc +87 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/MouseInputNotes.txt +90 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/MoveConsoleWindow.cc +34 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Notes.txt +219 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/OSVersion.cc +27 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ScreenBufferFreezeInactive.cc +101 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ScreenBufferTest.cc +671 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ScreenBufferTest2.cc +151 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/SelectAllTest.cc +45 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/SetBufferSize.cc +32 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/SetCursorPos.cc +10 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/SetFont.cc +145 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/SetWindowRect.cc +36 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ShowArgv.cc +12 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ShowConsoleInput.cc +40 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Spew.py +5 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/TestUtil.cc +172 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/UnicodeDoubleWidthTest.cc +102 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/UnicodeWideTest1.cc +246 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/UnicodeWideTest2.cc +130 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/UnixEcho.cc +89 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Utf16Echo.cc +46 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/VeryLargeRead.cc +122 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/VkEscapeTest.cc +56 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win10ResizeWhileFrozen.cc +52 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win10WrapTest1.cc +57 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win10WrapTest2.cc +30 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win32Echo1.cc +26 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win32Echo2.cc +19 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win32Test1.cc +46 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win32Test2.cc +70 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win32Test3.cc +78 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win32Write1.cc +44 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/WindowsBugCrashReader.cc +27 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/WriteConsole.cc +106 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/build32.sh +9 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/build64.sh +9 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/color-test.sh +212 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/font-notes.txt +300 -0
- package/.output/server/node_modules/node-pty/deps/winpty/misc/winbug-15048.cc +201 -0
- package/.output/server/node_modules/node-pty/deps/winpty/ship/build-pty4j-libpty.bat +36 -0
- package/.output/server/node_modules/node-pty/deps/winpty/ship/common_ship.py +53 -0
- package/.output/server/node_modules/node-pty/deps/winpty/ship/make_msvc_package.py +165 -0
- package/.output/server/node_modules/node-pty/deps/winpty/ship/ship.py +108 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Agent.cc +613 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Agent.h +103 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/AgentCreateDesktop.cc +84 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/AgentCreateDesktop.h +28 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/ConsoleFont.cc +632 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/ConsoleFont.h +28 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/ConsoleInput.cc +852 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/ConsoleInput.h +109 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/ConsoleInputReencoding.cc +121 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/ConsoleInputReencoding.h +36 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/ConsoleLine.cc +152 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/ConsoleLine.h +41 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Coord.h +87 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/DebugShowInput.cc +239 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/DebugShowInput.h +32 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/DefaultInputMap.cc +422 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/DefaultInputMap.h +28 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/DsrSender.h +30 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/EventLoop.cc +99 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/EventLoop.h +47 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/InputMap.cc +246 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/InputMap.h +114 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/LargeConsoleRead.cc +71 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/LargeConsoleRead.h +68 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/NamedPipe.cc +378 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/NamedPipe.h +125 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Scraper.cc +699 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Scraper.h +103 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/SimplePool.h +75 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/SmallRect.h +143 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Terminal.cc +535 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Terminal.h +69 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/UnicodeEncoding.h +157 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/UnicodeEncodingTest.cc +189 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Win32Console.cc +107 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Win32Console.h +67 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Win32ConsoleBuffer.cc +193 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Win32ConsoleBuffer.h +99 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/main.cc +114 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/subdir.mk +61 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/configurations.gypi +60 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/debugserver/DebugServer.cc +117 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/debugserver/subdir.mk +41 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/include/winpty.h +242 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/include/winpty_constants.h +131 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/libwinpty/AgentLocation.cc +75 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/libwinpty/AgentLocation.h +28 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/libwinpty/LibWinptyException.h +54 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/libwinpty/WinptyInternal.h +72 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/libwinpty/subdir.mk +46 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/libwinpty/winpty.cc +970 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/AgentMsg.h +38 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/BackgroundDesktop.cc +122 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/BackgroundDesktop.h +73 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/Buffer.cc +103 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/Buffer.h +102 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/DebugClient.cc +187 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/DebugClient.h +38 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/GenRandom.cc +138 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/GenRandom.h +55 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/GetCommitHash.bat +13 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/Mutex.h +54 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/OsModule.h +63 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/OwnedHandle.cc +36 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/OwnedHandle.h +45 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/PrecompiledHeader.h +43 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/StringBuilder.h +227 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/StringBuilderTest.cc +114 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/StringUtil.cc +55 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/StringUtil.h +80 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/TimeMeasurement.h +63 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/UnixCtrlChars.h +45 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/UpdateGenVersion.bat +20 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WindowsSecurity.cc +460 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WindowsSecurity.h +104 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WindowsVersion.cc +252 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WindowsVersion.h +29 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WinptyAssert.cc +55 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WinptyAssert.h +64 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WinptyException.cc +57 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WinptyException.h +43 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WinptyVersion.cc +42 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WinptyVersion.h +27 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/winpty_snprintf.h +99 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/subdir.mk +5 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/tests/subdir.mk +28 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/tests/trivial_test.cc +158 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/InputHandler.cc +114 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/InputHandler.h +56 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/OutputHandler.cc +80 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/OutputHandler.h +53 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/Util.cc +86 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/Util.h +31 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/WakeupFd.cc +70 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/WakeupFd.h +42 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/main.cc +729 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/subdir.mk +41 -0
- package/.output/server/node_modules/node-pty/deps/winpty/src/winpty.gyp +234 -0
- package/.output/server/node_modules/node-pty/deps/winpty/vcbuild.bat +83 -0
- package/.output/server/node_modules/node-pty/lib/conpty_console_list_agent.js +16 -0
- package/.output/server/node_modules/node-pty/lib/conpty_console_list_agent.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/eventEmitter2.js +47 -0
- package/.output/server/node_modules/node-pty/lib/eventEmitter2.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/eventEmitter2.test.js +30 -0
- package/.output/server/node_modules/node-pty/lib/eventEmitter2.test.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/index.js +52 -0
- package/.output/server/node_modules/node-pty/lib/index.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/interfaces.js +7 -0
- package/.output/server/node_modules/node-pty/lib/interfaces.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/shared/conout.js +11 -0
- package/.output/server/node_modules/node-pty/lib/shared/conout.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/terminal.js +190 -0
- package/.output/server/node_modules/node-pty/lib/terminal.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/terminal.test.js +139 -0
- package/.output/server/node_modules/node-pty/lib/terminal.test.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/testUtils.test.js +28 -0
- package/.output/server/node_modules/node-pty/lib/testUtils.test.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/types.js +7 -0
- package/.output/server/node_modules/node-pty/lib/types.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/unixTerminal.js +346 -0
- package/.output/server/node_modules/node-pty/lib/unixTerminal.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/unixTerminal.test.js +351 -0
- package/.output/server/node_modules/node-pty/lib/unixTerminal.test.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/utils.js +39 -0
- package/.output/server/node_modules/node-pty/lib/utils.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/windowsConoutConnection.js +125 -0
- package/.output/server/node_modules/node-pty/lib/windowsConoutConnection.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/windowsPtyAgent.js +320 -0
- package/.output/server/node_modules/node-pty/lib/windowsPtyAgent.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/windowsPtyAgent.test.js +90 -0
- package/.output/server/node_modules/node-pty/lib/windowsPtyAgent.test.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/windowsTerminal.js +199 -0
- package/.output/server/node_modules/node-pty/lib/windowsTerminal.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/windowsTerminal.test.js +219 -0
- package/.output/server/node_modules/node-pty/lib/windowsTerminal.test.js.map +1 -0
- package/.output/server/node_modules/node-pty/lib/worker/conoutSocketWorker.js +22 -0
- package/.output/server/node_modules/node-pty/lib/worker/conoutSocketWorker.js.map +1 -0
- package/.output/server/node_modules/node-pty/package.json +64 -0
- package/.output/server/node_modules/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/darwin-x64/pty.node +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/darwin-x64/spawn-helper +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/conpty.node +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/conpty.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/conpty_console_list.node +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/conpty_console_list.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/pty.node +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/pty.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/winpty-agent.exe +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/winpty-agent.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/winpty.dll +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/winpty.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/conpty.node +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/conpty.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/pty.node +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/pty.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/winpty-agent.exe +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/winpty-agent.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/winpty.dll +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/winpty.pdb +0 -0
- package/.output/server/node_modules/node-pty/scripts/gen-compile-commands.js +8 -0
- package/.output/server/node_modules/node-pty/scripts/increment-version.js +54 -0
- package/.output/server/node_modules/node-pty/scripts/post-install.js +80 -0
- package/.output/server/node_modules/node-pty/scripts/prebuild.js +34 -0
- package/.output/server/node_modules/node-pty/src/conpty_console_list_agent.ts +15 -0
- package/.output/server/node_modules/node-pty/src/eventEmitter2.test.ts +30 -0
- package/.output/server/node_modules/node-pty/src/eventEmitter2.ts +48 -0
- package/.output/server/node_modules/node-pty/src/index.ts +52 -0
- package/.output/server/node_modules/node-pty/src/interfaces.ts +130 -0
- package/.output/server/node_modules/node-pty/src/native.d.ts +54 -0
- package/.output/server/node_modules/node-pty/src/shared/conout.ts +15 -0
- package/.output/server/node_modules/node-pty/src/terminal.test.ts +119 -0
- package/.output/server/node_modules/node-pty/src/terminal.ts +211 -0
- package/.output/server/node_modules/node-pty/src/testUtils.test.ts +23 -0
- package/.output/server/node_modules/node-pty/src/tsconfig.json +22 -0
- package/.output/server/node_modules/node-pty/src/types.ts +15 -0
- package/.output/server/node_modules/node-pty/src/unix/pty.cc +799 -0
- package/.output/server/node_modules/node-pty/src/unix/spawn-helper.cc +23 -0
- package/.output/server/node_modules/node-pty/src/unixTerminal.test.ts +367 -0
- package/.output/server/node_modules/node-pty/src/unixTerminal.ts +388 -0
- package/.output/server/node_modules/node-pty/src/utils.ts +29 -0
- package/.output/server/node_modules/node-pty/src/win/conpty.cc +583 -0
- package/.output/server/node_modules/node-pty/src/win/conpty.h +41 -0
- package/.output/server/node_modules/node-pty/src/win/conpty_console_list.cc +44 -0
- package/.output/server/node_modules/node-pty/src/win/path_util.cc +95 -0
- package/.output/server/node_modules/node-pty/src/win/path_util.h +26 -0
- package/.output/server/node_modules/node-pty/src/win/winpty.cc +333 -0
- package/.output/server/node_modules/node-pty/src/windowsConoutConnection.ts +82 -0
- package/.output/server/node_modules/node-pty/src/windowsPtyAgent.test.ts +94 -0
- package/.output/server/node_modules/node-pty/src/windowsPtyAgent.ts +321 -0
- package/.output/server/node_modules/node-pty/src/windowsTerminal.test.ts +229 -0
- package/.output/server/node_modules/node-pty/src/windowsTerminal.ts +203 -0
- package/.output/server/node_modules/node-pty/src/worker/conoutSocketWorker.ts +22 -0
- package/.output/server/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-arm64/OpenConsole.exe +0 -0
- package/.output/server/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-arm64/conpty.dll +0 -0
- package/.output/server/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-x64/OpenConsole.exe +0 -0
- package/.output/server/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-x64/conpty.dll +0 -0
- package/.output/server/node_modules/node-pty/typings/node-pty.d.ts +211 -0
- package/.output/server/package.json +1 -0
- package/README.md +68 -6
- package/bin/pico.mjs +103 -1
- package/package.json +14 -7
- package/public/screenshots/pico-ios-dark.png +0 -0
- package/public/screenshots/pico-ios-light.png +0 -0
- package/public/screenshots/pico-macos-dark.jpg +0 -0
- package/public/screenshots/pico-macos-light.jpg +0 -0
- package/.output/public/assets/routes-DynLhCvj.js +0 -2195
- package/.output/public/assets/styles-DJ9ubgcc.css +0 -2
- package/.output/server/_ssr/start-Captdpmb.mjs +0 -4
- package/scripts/patch-react-jsx-dev-runtime.mjs +0 -93
- /package/.output/public/assets/{wasm-CEUrWlVz.js → wasm-D_MQmneJ.js} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as __toESM } from "../_runtime.mjs";
|
|
2
2
|
import { $ as require_react, Q as require_jsx_runtime } from "../_libs/@base-ui/react+[...].mjs";
|
|
3
3
|
import { a as createRouter, c as createRootRoute, n as Scripts, r as HeadContent, s as createFileRoute } from "../_libs/@tanstack/react-router+[...].mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { B as
|
|
4
|
+
import { T as Info, a as TriangleAlert, y as OctagonX, z as CircleCheck } from "../_libs/lucide-react.mjs";
|
|
5
|
+
import { B as buildItemsFromSync, H as createCompactionSummaryItem, J as extractToolText, K as extractMessageImages, Lt as toolCategoryFromTool, P as TooltipProvider, R as appliedThemeClassColorMode, T as Spinner, Z as mergeAssistantBlocksForStreaming, f as PICO_SHIKI_VARIABLE_DEFAULTS, n as APPLIED_THEME_STORAGE_KEY, q as extractMessageText$1, t as APPLIED_THEME_CLASSES, u as PICO_CODE_SHIKI_THEME, x as Route$62, z as assistantBlocksFromMessage } from "./routes-DbjuMLFI.mjs";
|
|
6
6
|
import { t as QueryClient } from "../_libs/tanstack__query-core.mjs";
|
|
7
7
|
import { t as setupRouterSsrQueryIntegration } from "../_libs/@tanstack/react-router-ssr-query+[...].mjs";
|
|
8
8
|
import { n as HotkeysProvider } from "../_libs/tanstack__react-hotkeys.mjs";
|
|
@@ -11,16 +11,17 @@ import { t as Toaster } from "../_libs/sonner.mjs";
|
|
|
11
11
|
import { c as bundledLanguages, l as bundledLanguagesAlias, s as codeToHtml, u as createCssVariablesTheme } from "../_libs/@pierre/diffs+[...].mjs";
|
|
12
12
|
import { t as createTwoFilesPatch } from "../_libs/diff.mjs";
|
|
13
13
|
import { n as Debouncer } from "../_libs/tanstack__pacer.mjs";
|
|
14
|
+
import { createRequire } from "node:module";
|
|
14
15
|
import { createHash, randomUUID } from "node:crypto";
|
|
15
16
|
import fs, { constants, existsSync, readFileSync, watch } from "node:fs";
|
|
16
17
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
17
18
|
import path, { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
18
|
-
import { access, mkdir, readFile, readdir, realpath, rename, stat, unlink, writeFile } from "node:fs/promises";
|
|
19
|
+
import { access, chmod, mkdir, readFile, readdir, realpath, rename, stat, unlink, writeFile } from "node:fs/promises";
|
|
19
20
|
import os, { homedir } from "node:os";
|
|
20
21
|
import { performance } from "node:perf_hooks";
|
|
21
22
|
import { isMainThread } from "node:worker_threads";
|
|
22
23
|
import { execSync, spawn } from "node:child_process";
|
|
23
|
-
//#region node_modules/.nitro/vite/services/ssr/assets/router-
|
|
24
|
+
//#region node_modules/.nitro/vite/services/ssr/assets/router-CN4JMm2A.js
|
|
24
25
|
var import_react = /* @__PURE__ */ __toESM(require_react());
|
|
25
26
|
var import_jsx_runtime = require_jsx_runtime();
|
|
26
27
|
function sonnerThemeFromAppliedTheme(theme) {
|
|
@@ -87,15 +88,19 @@ function AppProviders({ children }) {
|
|
|
87
88
|
})
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
|
-
var styles_default = "/assets/styles-
|
|
91
|
+
var styles_default = "/assets/styles-CUVz7jV9.css";
|
|
91
92
|
var TANSTACK_DEVTOOLS_SETTINGS_KEY = "tanstack_devtools_settings";
|
|
92
|
-
var TANSTACK_DEVTOOLS_DEFAULTS_STORAGE_KEY = "pico-tanstack-devtools-defaults-
|
|
93
|
+
var TANSTACK_DEVTOOLS_DEFAULTS_STORAGE_KEY = "pico-tanstack-devtools-defaults-v2";
|
|
93
94
|
var TANSTACK_DEVTOOLS_CONFIG = {
|
|
94
95
|
position: "bottom-right",
|
|
95
|
-
openHotkey: [
|
|
96
|
+
openHotkey: [
|
|
97
|
+
"Control",
|
|
98
|
+
"Shift",
|
|
99
|
+
"`"
|
|
100
|
+
],
|
|
96
101
|
triggerHidden: true
|
|
97
102
|
};
|
|
98
|
-
var Route$
|
|
103
|
+
var Route$61 = createRootRoute({
|
|
99
104
|
head: () => ({
|
|
100
105
|
meta: [
|
|
101
106
|
{ charSet: "utf-8" },
|
|
@@ -264,15 +269,18 @@ async function loadPiSdk() {
|
|
|
264
269
|
const sdkDir = resolvePiSdkDir();
|
|
265
270
|
return patchSdkForWorkerThreads(await importExternalModule(path.join(sdkDir, "dist", "index.js")));
|
|
266
271
|
}
|
|
272
|
+
function addPiAiCandidateEntries(candidates, packageDir) {
|
|
273
|
+
candidates.push(path.join(packageDir, "dist", "compat.js"), path.join(packageDir, "dist", "index.js"));
|
|
274
|
+
}
|
|
267
275
|
function getPiAiCandidates(sdkDir) {
|
|
268
276
|
const candidates = [];
|
|
269
|
-
for (const scope of ["@earendil-works", "@mariozechner"]) candidates
|
|
277
|
+
for (const scope of ["@earendil-works", "@mariozechner"]) addPiAiCandidateEntries(candidates, path.join(sdkDir, "node_modules", scope, "pi-ai"));
|
|
270
278
|
try {
|
|
271
279
|
const realSdkDir = fs.realpathSync(sdkDir);
|
|
272
|
-
for (const scope of ["@earendil-works", "@mariozechner"]) candidates
|
|
273
|
-
candidates
|
|
280
|
+
for (const scope of ["@earendil-works", "@mariozechner"]) addPiAiCandidateEntries(candidates, path.join(realSdkDir, "node_modules", scope, "pi-ai"));
|
|
281
|
+
addPiAiCandidateEntries(candidates, path.join(path.dirname(realSdkDir), "pi-ai"));
|
|
274
282
|
} catch {}
|
|
275
|
-
candidates
|
|
283
|
+
addPiAiCandidateEntries(candidates, path.join(path.dirname(sdkDir), "pi-ai"));
|
|
276
284
|
return candidates;
|
|
277
285
|
}
|
|
278
286
|
function resolvePiAiEntry(sdkDir) {
|
|
@@ -456,11 +464,62 @@ function buildSessionNamePrompt(prompt, cwdBasename, imageCount) {
|
|
|
456
464
|
normalizedPrompt
|
|
457
465
|
].filter(Boolean).join("\n");
|
|
458
466
|
}
|
|
467
|
+
function modelLabel(model) {
|
|
468
|
+
return `${model.provider}/${model.id}`;
|
|
469
|
+
}
|
|
470
|
+
function formatSessionNamingError(error) {
|
|
471
|
+
if (error instanceof Error) return error.message;
|
|
472
|
+
if (typeof error === "string") return error;
|
|
473
|
+
return "Unknown error";
|
|
474
|
+
}
|
|
475
|
+
function modelSupportsTextInput(model) {
|
|
476
|
+
if (!Array.isArray(model.input)) return true;
|
|
477
|
+
return model.input.includes("text");
|
|
478
|
+
}
|
|
479
|
+
function collectSessionNamingModelCandidates(entry) {
|
|
480
|
+
const candidates = [];
|
|
481
|
+
const seen = /* @__PURE__ */ new Set();
|
|
482
|
+
const addCandidate = (model, source) => {
|
|
483
|
+
if (!model || !modelSupportsTextInput(model)) return;
|
|
484
|
+
const key = modelLabel(model);
|
|
485
|
+
if (seen.has(key)) return;
|
|
486
|
+
seen.add(key);
|
|
487
|
+
candidates.push({
|
|
488
|
+
model,
|
|
489
|
+
source
|
|
490
|
+
});
|
|
491
|
+
};
|
|
492
|
+
addCandidate(entry.model, "active");
|
|
493
|
+
for (const model of entry.services.modelRegistry.getAvailable()) addCandidate(model, "available");
|
|
494
|
+
return candidates;
|
|
495
|
+
}
|
|
496
|
+
async function selectSessionNamingModel(entry) {
|
|
497
|
+
const candidates = collectSessionNamingModelCandidates(entry);
|
|
498
|
+
if (candidates.length === 0) return {
|
|
499
|
+
ok: false,
|
|
500
|
+
reason: "no text-capable models are available for session naming"
|
|
501
|
+
};
|
|
502
|
+
const failures = [];
|
|
503
|
+
for (const candidate of candidates) try {
|
|
504
|
+
const auth = await entry.services.modelRegistry.getApiKeyAndHeaders(candidate.model);
|
|
505
|
+
if (auth?.ok) return {
|
|
506
|
+
ok: true,
|
|
507
|
+
...candidate,
|
|
508
|
+
auth
|
|
509
|
+
};
|
|
510
|
+
failures.push(`${modelLabel(candidate.model)}: ${auth?.error || "not authenticated"}`);
|
|
511
|
+
} catch (error) {
|
|
512
|
+
failures.push(`${modelLabel(candidate.model)}: ${formatSessionNamingError(error)}`);
|
|
513
|
+
}
|
|
514
|
+
return {
|
|
515
|
+
ok: false,
|
|
516
|
+
reason: `no authenticated text model is available for session naming${failures.length > 0 ? ` (${failures.slice(0, 3).join("; ")})` : ""}`
|
|
517
|
+
};
|
|
518
|
+
}
|
|
459
519
|
async function generateSessionNameWithLlm(entry, text, imageCount) {
|
|
460
|
-
const
|
|
461
|
-
if (!
|
|
462
|
-
const auth =
|
|
463
|
-
if (!auth?.ok) return { reason: auth?.error || `failed to authenticate ${model.provider}/${model.id} for session naming` };
|
|
520
|
+
const selectedModel = await selectSessionNamingModel(entry);
|
|
521
|
+
if (!selectedModel.ok) return { reason: selectedModel.reason };
|
|
522
|
+
const { model, auth } = selectedModel;
|
|
464
523
|
const response = await (await loadPiAi()).complete(model, {
|
|
465
524
|
systemPrompt: SESSION_NAME_SYSTEM_PROMPT,
|
|
466
525
|
messages: [{
|
|
@@ -488,8 +547,12 @@ function normalizeSessionScope(rawScope, defaultCwd) {
|
|
|
488
547
|
function resolveScopeCwd(scope, defaultCwd) {
|
|
489
548
|
return normalizeSessionScope(scope ?? null, defaultCwd);
|
|
490
549
|
}
|
|
491
|
-
function
|
|
492
|
-
|
|
550
|
+
function formatSsePayloadText(payload, options) {
|
|
551
|
+
const prefixLines = [];
|
|
552
|
+
if (options?.id) prefixLines.push(`id: ${options.id}`);
|
|
553
|
+
if (typeof options?.retry === "number" && Number.isFinite(options.retry)) prefixLines.push(`retry: ${Math.max(0, Math.round(options.retry))}`);
|
|
554
|
+
const dataLines = JSON.stringify(payload).split(/\r?\n/).map((line) => `data: ${line}`);
|
|
555
|
+
return `${[...prefixLines, ...dataLines].join("\n")}\n\n`;
|
|
493
556
|
}
|
|
494
557
|
function writeRawToClient(options) {
|
|
495
558
|
const { encoder, context, client, text, closeSseClient } = options;
|
|
@@ -503,12 +566,15 @@ function writeRawToClient(options) {
|
|
|
503
566
|
}
|
|
504
567
|
}
|
|
505
568
|
function sendPayloadToClient(options) {
|
|
506
|
-
const { context, client, payload, closeSseClient, encoder } = options;
|
|
569
|
+
const { context, client, payload, closeSseClient, encoder, eventId, retry } = options;
|
|
507
570
|
return writeRawToClient({
|
|
508
571
|
encoder,
|
|
509
572
|
context,
|
|
510
573
|
client,
|
|
511
|
-
text:
|
|
574
|
+
text: formatSsePayloadText(payload, {
|
|
575
|
+
id: eventId,
|
|
576
|
+
retry
|
|
577
|
+
}),
|
|
512
578
|
closeSseClient
|
|
513
579
|
});
|
|
514
580
|
}
|
|
@@ -630,6 +696,398 @@ async function buildHighlightPayload(options) {
|
|
|
630
696
|
}))
|
|
631
697
|
};
|
|
632
698
|
}
|
|
699
|
+
var TERMINAL_BACKLOG_MAX_CHUNKS = 500;
|
|
700
|
+
var TERMINAL_BACKLOG_MAX_BYTES = 512 * 1024;
|
|
701
|
+
var TERMINAL_EXITED_TTL_MS = 1800 * 1e3;
|
|
702
|
+
var TERMINAL_CLEANUP_INTERVAL_MS = 60 * 1e3;
|
|
703
|
+
var TERMINAL_MIN_COLS = 20;
|
|
704
|
+
var TERMINAL_MAX_COLS = 500;
|
|
705
|
+
var TERMINAL_MIN_ROWS = 5;
|
|
706
|
+
var TERMINAL_MAX_ROWS = 200;
|
|
707
|
+
var TERMINAL_DEFAULT_COLS = 100;
|
|
708
|
+
var TERMINAL_DEFAULT_ROWS = 30;
|
|
709
|
+
var TERMINAL_KEY_MAX_LENGTH = 256;
|
|
710
|
+
var require = createRequire(import.meta.url);
|
|
711
|
+
var ensureSpawnHelperExecutablePromise;
|
|
712
|
+
function normalizeDimension(value, fallback, min, max) {
|
|
713
|
+
const numericValue = typeof value === "number" ? value : Number(value);
|
|
714
|
+
if (!Number.isFinite(numericValue)) return fallback;
|
|
715
|
+
return Math.min(max, Math.max(min, Math.round(numericValue)));
|
|
716
|
+
}
|
|
717
|
+
function createTerminalEnv() {
|
|
718
|
+
const env = {};
|
|
719
|
+
for (const [key, value] of Object.entries(process.env)) if (typeof value === "string") env[key] = value;
|
|
720
|
+
delete env.ZELLIJ;
|
|
721
|
+
delete env.ZELLIJ_SESSION_NAME;
|
|
722
|
+
delete env.TMUX;
|
|
723
|
+
delete env.TMUX_PANE;
|
|
724
|
+
env.TERM = "xterm-256color";
|
|
725
|
+
env.COLORTERM = "truecolor";
|
|
726
|
+
return env;
|
|
727
|
+
}
|
|
728
|
+
function defaultShell() {
|
|
729
|
+
if (process.platform === "win32") return process.env.COMSPEC || "powershell.exe";
|
|
730
|
+
return process.env.SHELL || "/bin/sh";
|
|
731
|
+
}
|
|
732
|
+
async function ensureNodePtySpawnHelperExecutable() {
|
|
733
|
+
if (process.platform === "win32") return;
|
|
734
|
+
ensureSpawnHelperExecutablePromise ??= (async () => {
|
|
735
|
+
try {
|
|
736
|
+
const helperPath = join(dirname(dirname(require.resolve("node-pty"))), "prebuilds", `${process.platform}-${process.arch}`, "spawn-helper");
|
|
737
|
+
const helperStat = await stat(helperPath).catch(() => null);
|
|
738
|
+
if (!helperStat) return;
|
|
739
|
+
if ((helperStat.mode & 73) !== 0) return;
|
|
740
|
+
await chmod(helperPath, helperStat.mode | 493);
|
|
741
|
+
} catch {}
|
|
742
|
+
})();
|
|
743
|
+
await ensureSpawnHelperExecutablePromise;
|
|
744
|
+
}
|
|
745
|
+
function terminalLabel(shell) {
|
|
746
|
+
return basename(shell) || shell;
|
|
747
|
+
}
|
|
748
|
+
function eventSize(event) {
|
|
749
|
+
if (event.type === "output") return event.data.length;
|
|
750
|
+
return JSON.stringify(event).length;
|
|
751
|
+
}
|
|
752
|
+
function formatTerminalError(error) {
|
|
753
|
+
if (error instanceof Error && error.message.trim()) return error.message;
|
|
754
|
+
if (typeof error === "string" && error.trim()) return error;
|
|
755
|
+
return "Unknown terminal error";
|
|
756
|
+
}
|
|
757
|
+
function sseFrame(event) {
|
|
758
|
+
return `${event.type === "output" ? `id: ${event.seq}\n` : ""}data: ${JSON.stringify(event)}\n\n`;
|
|
759
|
+
}
|
|
760
|
+
function exitPayload(exitCode, signal) {
|
|
761
|
+
return typeof signal === "number" && signal > 0 ? {
|
|
762
|
+
exitCode,
|
|
763
|
+
signal
|
|
764
|
+
} : { exitCode };
|
|
765
|
+
}
|
|
766
|
+
function exitEvent(exitCode, signal) {
|
|
767
|
+
return {
|
|
768
|
+
type: "exit",
|
|
769
|
+
...exitPayload(exitCode, signal)
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
function readyEvent(record) {
|
|
773
|
+
return {
|
|
774
|
+
type: "ready",
|
|
775
|
+
backend: record.backend,
|
|
776
|
+
id: record.id,
|
|
777
|
+
cwd: record.cwd,
|
|
778
|
+
shell: terminalLabel(record.shell),
|
|
779
|
+
nextInputSeq: record.lastInputSeq + 1
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
function parseTerminalWebSocketMessage(text) {
|
|
783
|
+
const parsed = JSON.parse(text);
|
|
784
|
+
if (!parsed || typeof parsed !== "object") throw new Error("Terminal WebSocket message must be an object.");
|
|
785
|
+
const message = parsed;
|
|
786
|
+
if (message.type !== "input" && message.type !== "resize" && message.type !== "ping") throw new Error("Unknown terminal WebSocket message type.");
|
|
787
|
+
return message;
|
|
788
|
+
}
|
|
789
|
+
function normalizeTerminalKey(value) {
|
|
790
|
+
if (typeof value !== "string") return void 0;
|
|
791
|
+
const normalized = value.trim();
|
|
792
|
+
if (!normalized) return void 0;
|
|
793
|
+
return normalized.slice(0, TERMINAL_KEY_MAX_LENGTH);
|
|
794
|
+
}
|
|
795
|
+
function terminalLookupKey(scopeKey, terminalKey) {
|
|
796
|
+
return `${scopeKey}\0${terminalKey}`;
|
|
797
|
+
}
|
|
798
|
+
var PicoTerminalManager = class {
|
|
799
|
+
terminals = /* @__PURE__ */ new Map();
|
|
800
|
+
terminalKeys = /* @__PURE__ */ new Map();
|
|
801
|
+
encoder = new TextEncoder();
|
|
802
|
+
cleanupTimer;
|
|
803
|
+
constructor() {
|
|
804
|
+
this.cleanupTimer = setInterval(() => {
|
|
805
|
+
this.cleanupExitedTerminals();
|
|
806
|
+
}, TERMINAL_CLEANUP_INTERVAL_MS);
|
|
807
|
+
this.cleanupTimer.unref?.();
|
|
808
|
+
}
|
|
809
|
+
async createTerminal({ clientKey, cols, cwd, rows, scopeKey }) {
|
|
810
|
+
await ensureNodePtySpawnHelperExecutable();
|
|
811
|
+
const terminalKey = normalizeTerminalKey(clientKey);
|
|
812
|
+
const lookupKey = terminalKey ? terminalLookupKey(scopeKey, terminalKey) : void 0;
|
|
813
|
+
const existingId = lookupKey ? this.terminalKeys.get(lookupKey) : void 0;
|
|
814
|
+
const existingRecord = existingId ? this.terminals.get(existingId) : void 0;
|
|
815
|
+
if (existingRecord && !existingRecord.exited) {
|
|
816
|
+
existingRecord.lastUsedAt = Date.now();
|
|
817
|
+
return {
|
|
818
|
+
id: existingRecord.id,
|
|
819
|
+
backend: existingRecord.backend,
|
|
820
|
+
cwd: existingRecord.cwd,
|
|
821
|
+
shell: terminalLabel(existingRecord.shell),
|
|
822
|
+
reused: true
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
if (existingRecord) await this.disposeTerminalRecord(existingRecord.id);
|
|
826
|
+
const spawnConfig = this.createSpawnConfig();
|
|
827
|
+
const pty = await this.spawnPty(spawnConfig, cwd, cols, rows);
|
|
828
|
+
const id = randomUUID();
|
|
829
|
+
const now = Date.now();
|
|
830
|
+
const record = {
|
|
831
|
+
id,
|
|
832
|
+
args: spawnConfig.args,
|
|
833
|
+
backend: spawnConfig.backend,
|
|
834
|
+
command: spawnConfig.command,
|
|
835
|
+
scopeKey,
|
|
836
|
+
cwd,
|
|
837
|
+
shell: spawnConfig.shellLabel,
|
|
838
|
+
pty,
|
|
839
|
+
dataDisposable: { dispose: () => {} },
|
|
840
|
+
exitDisposable: { dispose: () => {} },
|
|
841
|
+
subscribers: /* @__PURE__ */ new Set(),
|
|
842
|
+
backlog: [],
|
|
843
|
+
backlogBytes: 0,
|
|
844
|
+
nextOutputSeq: 1,
|
|
845
|
+
lastInputSeq: 0,
|
|
846
|
+
createdAt: now,
|
|
847
|
+
lastUsedAt: now
|
|
848
|
+
};
|
|
849
|
+
if (lookupKey) record.lookupKey = lookupKey;
|
|
850
|
+
if (terminalKey) record.terminalKey = terminalKey;
|
|
851
|
+
this.attachPtyHandlers(record);
|
|
852
|
+
this.terminals.set(id, record);
|
|
853
|
+
if (lookupKey) this.terminalKeys.set(lookupKey, id);
|
|
854
|
+
return {
|
|
855
|
+
id,
|
|
856
|
+
backend: record.backend,
|
|
857
|
+
cwd,
|
|
858
|
+
shell: terminalLabel(record.shell),
|
|
859
|
+
reused: false
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
createEventsResponse(id, scopeKey, signal, lastSeq) {
|
|
863
|
+
const record = this.assertTerminalScope(id, scopeKey);
|
|
864
|
+
record.lastUsedAt = Date.now();
|
|
865
|
+
let cleanupStream = () => {};
|
|
866
|
+
const stream = new ReadableStream({
|
|
867
|
+
start: (controller) => {
|
|
868
|
+
let closed = false;
|
|
869
|
+
const send = (event) => {
|
|
870
|
+
if (closed) return;
|
|
871
|
+
try {
|
|
872
|
+
controller.enqueue(this.encoder.encode(sseFrame(event)));
|
|
873
|
+
} catch {
|
|
874
|
+
cleanup();
|
|
875
|
+
}
|
|
876
|
+
};
|
|
877
|
+
const cleanup = () => {
|
|
878
|
+
if (closed) return;
|
|
879
|
+
closed = true;
|
|
880
|
+
record.subscribers.delete(send);
|
|
881
|
+
signal.removeEventListener("abort", cleanup);
|
|
882
|
+
try {
|
|
883
|
+
controller.close();
|
|
884
|
+
} catch {}
|
|
885
|
+
};
|
|
886
|
+
cleanupStream = cleanup;
|
|
887
|
+
record.subscribers.add(send);
|
|
888
|
+
signal.addEventListener("abort", cleanup, { once: true });
|
|
889
|
+
this.sendInitialEvents(record, send, lastSeq);
|
|
890
|
+
},
|
|
891
|
+
cancel: () => {
|
|
892
|
+
cleanupStream();
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
return new Response(stream, { headers: {
|
|
896
|
+
"cache-control": "no-cache, no-transform",
|
|
897
|
+
connection: "keep-alive",
|
|
898
|
+
"content-type": "text/event-stream; charset=utf-8",
|
|
899
|
+
"x-accel-buffering": "no"
|
|
900
|
+
} });
|
|
901
|
+
}
|
|
902
|
+
validateTerminal(id, scopeKey) {
|
|
903
|
+
this.assertTerminalScope(id, scopeKey);
|
|
904
|
+
}
|
|
905
|
+
connectWebSocket(options) {
|
|
906
|
+
const { id, lastSeq, peer, scopeKey } = options;
|
|
907
|
+
const record = this.assertTerminalScope(id, scopeKey);
|
|
908
|
+
record.lastUsedAt = Date.now();
|
|
909
|
+
let closed = false;
|
|
910
|
+
const send = (event) => {
|
|
911
|
+
if (closed) return;
|
|
912
|
+
try {
|
|
913
|
+
peer.send(JSON.stringify(event));
|
|
914
|
+
} catch {
|
|
915
|
+
cleanup();
|
|
916
|
+
}
|
|
917
|
+
};
|
|
918
|
+
const cleanup = () => {
|
|
919
|
+
if (closed) return;
|
|
920
|
+
closed = true;
|
|
921
|
+
record.subscribers.delete(send);
|
|
922
|
+
};
|
|
923
|
+
record.subscribers.add(send);
|
|
924
|
+
this.sendInitialEvents(record, send, lastSeq);
|
|
925
|
+
return cleanup;
|
|
926
|
+
}
|
|
927
|
+
handleWebSocketMessage(options) {
|
|
928
|
+
const { id, message, peer, scopeKey } = options;
|
|
929
|
+
try {
|
|
930
|
+
const payload = parseTerminalWebSocketMessage(message);
|
|
931
|
+
if (payload.type === "input") {
|
|
932
|
+
const inputSeq = this.writeTerminal(id, scopeKey, payload.data, payload.inputSeq);
|
|
933
|
+
if (typeof inputSeq === "number" && inputSeq > 0) peer.send(JSON.stringify({
|
|
934
|
+
type: "input_ack",
|
|
935
|
+
inputSeq
|
|
936
|
+
}));
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
if (payload.type === "resize") {
|
|
940
|
+
this.resizeTerminal(id, scopeKey, payload);
|
|
941
|
+
return;
|
|
942
|
+
}
|
|
943
|
+
peer.send(JSON.stringify({ type: "pong" }));
|
|
944
|
+
} catch (error) {
|
|
945
|
+
try {
|
|
946
|
+
peer.send(JSON.stringify({
|
|
947
|
+
type: "error",
|
|
948
|
+
error: formatTerminalError(error)
|
|
949
|
+
}));
|
|
950
|
+
} catch {}
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
writeTerminal(id, scopeKey, data, inputSeq) {
|
|
954
|
+
const record = this.assertTerminalScope(id, scopeKey);
|
|
955
|
+
if (record.exited) throw new Error("Terminal has exited.");
|
|
956
|
+
if (typeof data !== "string") throw new Error("Terminal input data is required.");
|
|
957
|
+
const normalizedInputSeq = normalizeDimension(inputSeq, 0, 0, Number.MAX_SAFE_INTEGER);
|
|
958
|
+
if (normalizedInputSeq > 0) {
|
|
959
|
+
if (normalizedInputSeq <= record.lastInputSeq) return normalizedInputSeq;
|
|
960
|
+
record.lastInputSeq = normalizedInputSeq;
|
|
961
|
+
}
|
|
962
|
+
record.lastUsedAt = Date.now();
|
|
963
|
+
record.pty.write(data);
|
|
964
|
+
return normalizedInputSeq > 0 ? normalizedInputSeq : void 0;
|
|
965
|
+
}
|
|
966
|
+
resizeTerminal(id, scopeKey, dimensions) {
|
|
967
|
+
const record = this.assertTerminalScope(id, scopeKey);
|
|
968
|
+
if (record.exited) return;
|
|
969
|
+
const cols = normalizeDimension(dimensions.cols, record.pty.cols, TERMINAL_MIN_COLS, TERMINAL_MAX_COLS);
|
|
970
|
+
const rows = normalizeDimension(dimensions.rows, record.pty.rows, TERMINAL_MIN_ROWS, TERMINAL_MAX_ROWS);
|
|
971
|
+
record.lastUsedAt = Date.now();
|
|
972
|
+
record.pty.resize(cols, rows);
|
|
973
|
+
}
|
|
974
|
+
async closeTerminal(id, scopeKey) {
|
|
975
|
+
this.assertTerminalScope(id, scopeKey);
|
|
976
|
+
await this.disposeTerminalRecord(id);
|
|
977
|
+
}
|
|
978
|
+
dispose() {
|
|
979
|
+
clearInterval(this.cleanupTimer);
|
|
980
|
+
for (const id of this.terminals.keys()) this.disposeTerminalRecord(id);
|
|
981
|
+
}
|
|
982
|
+
async spawnPty(spawnConfig, cwd, cols, rows) {
|
|
983
|
+
return (await import("node-pty")).spawn(spawnConfig.command, spawnConfig.args, {
|
|
984
|
+
cols: normalizeDimension(cols, TERMINAL_DEFAULT_COLS, TERMINAL_MIN_COLS, TERMINAL_MAX_COLS),
|
|
985
|
+
cwd,
|
|
986
|
+
env: createTerminalEnv(),
|
|
987
|
+
name: "xterm-256color",
|
|
988
|
+
rows: normalizeDimension(rows, TERMINAL_DEFAULT_ROWS, TERMINAL_MIN_ROWS, TERMINAL_MAX_ROWS)
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
attachPtyHandlers(record) {
|
|
992
|
+
record.dataDisposable = record.pty.onData((data) => {
|
|
993
|
+
const seq = record.nextOutputSeq;
|
|
994
|
+
record.nextOutputSeq += 1;
|
|
995
|
+
this.publish(record, {
|
|
996
|
+
type: "output",
|
|
997
|
+
data,
|
|
998
|
+
seq
|
|
999
|
+
});
|
|
1000
|
+
});
|
|
1001
|
+
record.exitDisposable = record.pty.onExit((event) => {
|
|
1002
|
+
this.handlePtyExit(record, event.exitCode, event.signal);
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
handlePtyExit(record, exitCode, signal) {
|
|
1006
|
+
if (this.terminals.get(record.id) !== record) return;
|
|
1007
|
+
record.exited = exitPayload(exitCode, signal);
|
|
1008
|
+
this.publish(record, exitEvent(exitCode, signal));
|
|
1009
|
+
}
|
|
1010
|
+
createSpawnConfig() {
|
|
1011
|
+
const shell = defaultShell();
|
|
1012
|
+
return {
|
|
1013
|
+
args: [],
|
|
1014
|
+
backend: "shell",
|
|
1015
|
+
command: shell,
|
|
1016
|
+
shellLabel: shell
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
assertTerminalScope(id, scopeKey) {
|
|
1020
|
+
const record = this.terminals.get(id);
|
|
1021
|
+
if (!record) throw new Error("Terminal not found.");
|
|
1022
|
+
if (record.scopeKey !== scopeKey) throw new Error("Terminal not found for this session.");
|
|
1023
|
+
return record;
|
|
1024
|
+
}
|
|
1025
|
+
sendInitialEvents(record, send, lastSeq) {
|
|
1026
|
+
send(readyEvent(record));
|
|
1027
|
+
const firstSeq = record.backlog[0]?.seq;
|
|
1028
|
+
if (typeof lastSeq === "number" && firstSeq !== void 0 && lastSeq < firstSeq - 1) send({
|
|
1029
|
+
type: "reset",
|
|
1030
|
+
reason: "backlog_gap",
|
|
1031
|
+
firstSeq,
|
|
1032
|
+
nextSeq: record.nextOutputSeq
|
|
1033
|
+
});
|
|
1034
|
+
for (const event of record.backlog) {
|
|
1035
|
+
if (typeof lastSeq === "number" && event.seq <= lastSeq) continue;
|
|
1036
|
+
send(event);
|
|
1037
|
+
}
|
|
1038
|
+
if (record.exited) send(exitEvent(record.exited.exitCode, record.exited.signal));
|
|
1039
|
+
}
|
|
1040
|
+
publish(record, event) {
|
|
1041
|
+
record.lastUsedAt = Date.now();
|
|
1042
|
+
this.rememberBacklog(record, event);
|
|
1043
|
+
for (const subscriber of record.subscribers) try {
|
|
1044
|
+
subscriber(event);
|
|
1045
|
+
} catch {
|
|
1046
|
+
record.subscribers.delete(subscriber);
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
rememberBacklog(record, event) {
|
|
1050
|
+
if (event.type !== "output") return;
|
|
1051
|
+
record.backlog.push(event);
|
|
1052
|
+
record.backlogBytes += eventSize(event);
|
|
1053
|
+
while (record.backlog.length > TERMINAL_BACKLOG_MAX_CHUNKS || record.backlogBytes > TERMINAL_BACKLOG_MAX_BYTES) {
|
|
1054
|
+
const removed = record.backlog.shift();
|
|
1055
|
+
if (!removed) break;
|
|
1056
|
+
record.backlogBytes = Math.max(0, record.backlogBytes - eventSize(removed));
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
async disposeTerminalRecord(id) {
|
|
1060
|
+
const record = this.terminals.get(id);
|
|
1061
|
+
if (!record) return;
|
|
1062
|
+
this.terminals.delete(id);
|
|
1063
|
+
if (record.lookupKey) this.terminalKeys.delete(record.lookupKey);
|
|
1064
|
+
record.subscribers.clear();
|
|
1065
|
+
try {
|
|
1066
|
+
record.dataDisposable.dispose();
|
|
1067
|
+
} catch {}
|
|
1068
|
+
try {
|
|
1069
|
+
record.exitDisposable.dispose();
|
|
1070
|
+
} catch {}
|
|
1071
|
+
try {
|
|
1072
|
+
record.pty.kill();
|
|
1073
|
+
} catch (error) {
|
|
1074
|
+
const message = formatTerminalError(error);
|
|
1075
|
+
if (!record.exited) this.rememberBacklog(record, {
|
|
1076
|
+
type: "error",
|
|
1077
|
+
error: message
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
cleanupExitedTerminals() {
|
|
1082
|
+
const now = Date.now();
|
|
1083
|
+
for (const record of this.terminals.values()) {
|
|
1084
|
+
if (record.subscribers.size > 0) continue;
|
|
1085
|
+
if (!record.exited) continue;
|
|
1086
|
+
if (now - record.lastUsedAt < TERMINAL_EXITED_TTL_MS) continue;
|
|
1087
|
+
this.disposeTerminalRecord(record.id);
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
};
|
|
633
1091
|
function messageItemIndex(item) {
|
|
634
1092
|
const match = item.itemKey?.match(/^message:(\d+)$/);
|
|
635
1093
|
if (!match) return -1;
|
|
@@ -1399,6 +1857,22 @@ function serializeSessionTreeNode(node) {
|
|
|
1399
1857
|
});
|
|
1400
1858
|
return serialized;
|
|
1401
1859
|
}
|
|
1860
|
+
function extractBranchableMessages(entry) {
|
|
1861
|
+
const manager = entry.session.sessionManager;
|
|
1862
|
+
const leafId = manager.getLeafId?.() ?? null;
|
|
1863
|
+
const branchEntries = manager.getBranch?.(leafId) ?? [];
|
|
1864
|
+
return (branchEntries.length > 0 ? branchEntries : []).flatMap((entry) => {
|
|
1865
|
+
const entryId = typeof entry.id === "string" ? entry.id.trim() : "";
|
|
1866
|
+
const message = entry.message;
|
|
1867
|
+
const role = typeof message?.role === "string" ? message.role : "";
|
|
1868
|
+
if (!entryId || entry.type !== "message" || role !== "user" && role !== "assistant") return [];
|
|
1869
|
+
return [{
|
|
1870
|
+
entryId,
|
|
1871
|
+
role,
|
|
1872
|
+
text: extractMessageText(message)
|
|
1873
|
+
}];
|
|
1874
|
+
});
|
|
1875
|
+
}
|
|
1402
1876
|
function extractForkableUserMessages(entry) {
|
|
1403
1877
|
const messages = entry.session.getUserMessagesForForking?.();
|
|
1404
1878
|
if (Array.isArray(messages) && messages.length > 0) return messages.flatMap((message) => {
|
|
@@ -2486,6 +2960,39 @@ async function unstageDirectoryGitAll(cwd) {
|
|
|
2486
2960
|
stderr: result.stderr
|
|
2487
2961
|
};
|
|
2488
2962
|
}
|
|
2963
|
+
async function unstageDirectoryGitFile(cwd, path, previousPath) {
|
|
2964
|
+
const normalizedCwd = normalizeGitCwd(cwd);
|
|
2965
|
+
const normalizedPath = assertGitFilePath(path);
|
|
2966
|
+
const normalizedPreviousPath = previousPath ? assertGitFilePath(previousPath) : void 0;
|
|
2967
|
+
if (!normalizedCwd) throw new Error("cwd is required");
|
|
2968
|
+
if (!await isInsideWorkTree(normalizedCwd)) throw new Error("No git repository detected");
|
|
2969
|
+
const paths = uniqueGitActionPaths([normalizedPreviousPath, normalizedPath]);
|
|
2970
|
+
const result = await gitRepositoryHasHead(normalizedCwd) ? await runCommand("git", [
|
|
2971
|
+
"restore",
|
|
2972
|
+
"--staged",
|
|
2973
|
+
"--",
|
|
2974
|
+
...paths
|
|
2975
|
+
], {
|
|
2976
|
+
cwd: normalizedCwd,
|
|
2977
|
+
timeoutMs: GIT_ACTION_TIMEOUT_MS
|
|
2978
|
+
}) : await runCommand("git", [
|
|
2979
|
+
"rm",
|
|
2980
|
+
"-r",
|
|
2981
|
+
"--cached",
|
|
2982
|
+
"--ignore-unmatch",
|
|
2983
|
+
"--",
|
|
2984
|
+
...paths
|
|
2985
|
+
], {
|
|
2986
|
+
cwd: normalizedCwd,
|
|
2987
|
+
timeoutMs: GIT_ACTION_TIMEOUT_MS
|
|
2988
|
+
});
|
|
2989
|
+
if (result.code !== 0) throw new Error(gitCommandErrorMessage("Failed to unstage changes", result));
|
|
2990
|
+
invalidateDirectoryGitCaches(normalizedCwd);
|
|
2991
|
+
return {
|
|
2992
|
+
stdout: result.stdout,
|
|
2993
|
+
stderr: result.stderr
|
|
2994
|
+
};
|
|
2995
|
+
}
|
|
2489
2996
|
async function discardDirectoryGitAll(cwd) {
|
|
2490
2997
|
const normalizedCwd = normalizeGitCwd(cwd);
|
|
2491
2998
|
if (!normalizedCwd) throw new Error("cwd is required");
|
|
@@ -3539,12 +4046,20 @@ var VALID_THINKING_LEVELS = new Set([
|
|
|
3539
4046
|
"high",
|
|
3540
4047
|
"xhigh"
|
|
3541
4048
|
]);
|
|
4049
|
+
var PICO_DEFAULT_MODEL_PROVIDER = "openai-codex";
|
|
4050
|
+
var PICO_DEFAULT_MODEL_ID = "gpt-5.5";
|
|
4051
|
+
var PICO_DEFAULT_THINKING_LEVEL = "xhigh";
|
|
3542
4052
|
var SESSION_LIST_LIMIT_DEFAULT = 5;
|
|
3543
4053
|
var SESSION_LIST_LIMIT_MAX = 100;
|
|
3544
4054
|
var SESSION_HISTORY_PAGE_LIMIT_DEFAULT = 50;
|
|
3545
4055
|
var SESSION_HISTORY_PAGE_LIMIT_MAX = 200;
|
|
3546
4056
|
var SESSION_NAME_MAX_LENGTH = 48;
|
|
3547
4057
|
var HEARTBEAT_INTERVAL_MS = 2e4;
|
|
4058
|
+
var SSE_RETRY_MS = 1e3;
|
|
4059
|
+
var SSE_REPLAY_MAX_EVENTS = 200;
|
|
4060
|
+
var CONTEXT_INACTIVE_GRACE_MS = 3e4;
|
|
4061
|
+
var PROMPT_IDEMPOTENCY_TTL_MS = 1440 * 60 * 1e3;
|
|
4062
|
+
var PROMPT_IDEMPOTENCY_MAX_RECORDS = 200;
|
|
3548
4063
|
var SESSION_INDEX_CACHE_TTL_MS = 5e3;
|
|
3549
4064
|
var SESSION_LOAD_DEBUG_ENV_KEYS = [
|
|
3550
4065
|
"PICO_DEBUG_SESSION_LOAD",
|
|
@@ -3702,17 +4217,40 @@ function normalizeRequestedDirectories(values) {
|
|
|
3702
4217
|
}
|
|
3703
4218
|
return nextDirectories;
|
|
3704
4219
|
}
|
|
4220
|
+
function textFromThinkingSignature(value) {
|
|
4221
|
+
if (typeof value !== "string" || !value.trim()) return "";
|
|
4222
|
+
let parsed;
|
|
4223
|
+
try {
|
|
4224
|
+
parsed = JSON.parse(value);
|
|
4225
|
+
} catch {
|
|
4226
|
+
return "";
|
|
4227
|
+
}
|
|
4228
|
+
if (!parsed || typeof parsed !== "object") return "";
|
|
4229
|
+
const content = parsed.content;
|
|
4230
|
+
if (!Array.isArray(content)) return "";
|
|
4231
|
+
return content.flatMap((part) => {
|
|
4232
|
+
if (!part || typeof part !== "object") return [];
|
|
4233
|
+
const type = part.type;
|
|
4234
|
+
const text = part.text;
|
|
4235
|
+
return type === "reasoning_text" && typeof text === "string" && text.trim() ? [text] : [];
|
|
4236
|
+
}).join("\n\n").trim();
|
|
4237
|
+
}
|
|
3705
4238
|
function sanitizeMessageContentPart(part) {
|
|
3706
4239
|
const type = typeof part?.type === "string" ? part.type : "";
|
|
3707
4240
|
if (type === "text") return {
|
|
3708
4241
|
type: "text",
|
|
3709
4242
|
text: typeof part.text === "string" ? part.text : ""
|
|
3710
4243
|
};
|
|
3711
|
-
if (type === "thinking")
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
4244
|
+
if (type === "thinking") {
|
|
4245
|
+
const rawThinking = typeof part.thinking === "string" ? part.thinking : "";
|
|
4246
|
+
const signatureThinking = textFromThinkingSignature(part.thinkingSignature);
|
|
4247
|
+
const summaryLabel = typeof part.summaryLabel === "string" ? part.summaryLabel : signatureThinking && rawThinking.trim() ? rawThinking : void 0;
|
|
4248
|
+
return {
|
|
4249
|
+
type: "thinking",
|
|
4250
|
+
thinking: signatureThinking || rawThinking,
|
|
4251
|
+
...summaryLabel ? { summaryLabel } : {}
|
|
4252
|
+
};
|
|
4253
|
+
}
|
|
3716
4254
|
if (type === "toolCall") return {
|
|
3717
4255
|
type: "toolCall",
|
|
3718
4256
|
...typeof part.id === "string" ? { id: part.id } : {},
|
|
@@ -3733,6 +4271,8 @@ function sanitizeSessionMessage(message) {
|
|
|
3733
4271
|
const sanitizedPart = sanitizeMessageContentPart(part);
|
|
3734
4272
|
return sanitizedPart ? [sanitizedPart] : [];
|
|
3735
4273
|
}) : typeof message?.content === "string" ? message.content : void 0;
|
|
4274
|
+
const tokensBefore = Number(message?.tokensBefore);
|
|
4275
|
+
const estimatedTokensAfter = message?.estimatedTokensAfter == null ? NaN : Number(message.estimatedTokensAfter);
|
|
3736
4276
|
return {
|
|
3737
4277
|
...role ? { role } : {},
|
|
3738
4278
|
...sanitizedContent !== void 0 ? { content: sanitizedContent } : {},
|
|
@@ -3743,7 +4283,8 @@ function sanitizeSessionMessage(message) {
|
|
|
3743
4283
|
...message?.queued || metadata?.queued ? { queued: true } : {},
|
|
3744
4284
|
...message?.streamingBehavior === "steer" || message?.streamingBehavior === "followUp" ? { streamingBehavior: message.streamingBehavior } : message?.deliverAs === "steer" || message?.deliverAs === "followUp" ? { streamingBehavior: message.deliverAs } : metadata?.streamingBehavior === "steer" || metadata?.streamingBehavior === "followUp" ? { streamingBehavior: metadata.streamingBehavior } : metadata?.deliverAs === "steer" || metadata?.deliverAs === "followUp" ? { streamingBehavior: metadata.deliverAs } : {},
|
|
3745
4285
|
...typeof message?.summary === "string" ? { summary: message.summary } : {},
|
|
3746
|
-
...Number.isFinite(
|
|
4286
|
+
...Number.isFinite(tokensBefore) ? { tokensBefore } : {},
|
|
4287
|
+
...Number.isFinite(estimatedTokensAfter) ? { estimatedTokensAfter } : {},
|
|
3747
4288
|
...typeof message?.toolCallId === "string" ? { toolCallId: message.toolCallId } : {},
|
|
3748
4289
|
...Object.prototype.hasOwnProperty.call(message, "details") ? { details: message.details } : {},
|
|
3749
4290
|
...message?.isError ? { isError: true } : {}
|
|
@@ -3902,10 +4443,72 @@ function normalizeClientPendingId(value) {
|
|
|
3902
4443
|
if (pendingId.length > 128) return void 0;
|
|
3903
4444
|
return pendingId;
|
|
3904
4445
|
}
|
|
4446
|
+
function normalizeClientPromptRequestId(value) {
|
|
4447
|
+
if (typeof value !== "string") return void 0;
|
|
4448
|
+
const requestId = value.trim();
|
|
4449
|
+
if (!requestId.startsWith("prompt:")) return void 0;
|
|
4450
|
+
if (requestId.length > 160) return void 0;
|
|
4451
|
+
return requestId;
|
|
4452
|
+
}
|
|
4453
|
+
function parsePositiveInteger(value) {
|
|
4454
|
+
if (!value) return void 0;
|
|
4455
|
+
const parsed = Number(value);
|
|
4456
|
+
if (!Number.isSafeInteger(parsed) || parsed < 0) return void 0;
|
|
4457
|
+
return parsed;
|
|
4458
|
+
}
|
|
4459
|
+
function terminalWebSocketIdFromRequest(request) {
|
|
4460
|
+
const pathname = new URL(request.url).pathname;
|
|
4461
|
+
const match = /^\/api\/terminal\/([^/]+)\/ws\/?$/.exec(pathname);
|
|
4462
|
+
if (!match?.[1]) throw new Response("Terminal WebSocket route not found.", { status: 404 });
|
|
4463
|
+
try {
|
|
4464
|
+
return decodeURIComponent(match[1]);
|
|
4465
|
+
} catch {
|
|
4466
|
+
throw new Response("Invalid terminal id.", { status: 400 });
|
|
4467
|
+
}
|
|
4468
|
+
}
|
|
4469
|
+
function terminalWebSocketCleanupFromPeer(peer) {
|
|
4470
|
+
const cleanup = peer.context.terminalCleanup;
|
|
4471
|
+
return typeof cleanup === "function" ? cleanup : void 0;
|
|
4472
|
+
}
|
|
4473
|
+
function terminalWebSocketContextFromPeer(peer) {
|
|
4474
|
+
const { terminalId, terminalLastSeq, terminalScopeKey } = peer.context;
|
|
4475
|
+
if (typeof terminalId !== "string" || !terminalId) throw new Error("Terminal WebSocket is missing a terminal id.");
|
|
4476
|
+
if (typeof terminalScopeKey !== "string" || !terminalScopeKey) throw new Error("Terminal WebSocket is missing a terminal scope.");
|
|
4477
|
+
return {
|
|
4478
|
+
terminalId,
|
|
4479
|
+
terminalLastSeq: typeof terminalLastSeq === "number" ? terminalLastSeq : void 0,
|
|
4480
|
+
terminalScopeKey
|
|
4481
|
+
};
|
|
4482
|
+
}
|
|
4483
|
+
function normalizePromptDraftOwnerKey(value) {
|
|
4484
|
+
if (typeof value !== "string") return "";
|
|
4485
|
+
const ownerKey = value.trim();
|
|
4486
|
+
if (!ownerKey.startsWith("draft:")) return "";
|
|
4487
|
+
if (ownerKey.length > 1024) return "";
|
|
4488
|
+
return ownerKey;
|
|
4489
|
+
}
|
|
4490
|
+
function normalizePromptDraftCwd(value) {
|
|
4491
|
+
if (typeof value !== "string") return void 0;
|
|
4492
|
+
return value.trim() || void 0;
|
|
4493
|
+
}
|
|
4494
|
+
function promptDraftOwnerKeyForCwd(cwd) {
|
|
4495
|
+
return `draft:${cwd?.trim() || "default"}`;
|
|
4496
|
+
}
|
|
4497
|
+
function promptDraftCwdFromOwnerKey(ownerKey) {
|
|
4498
|
+
if (!ownerKey || ownerKey === promptDraftOwnerKeyForCwd(void 0)) return;
|
|
4499
|
+
return ownerKey.slice(6).trim() || void 0;
|
|
4500
|
+
}
|
|
4501
|
+
function promptDraftTargetMatches(entry, target) {
|
|
4502
|
+
if (target.cwd && entry.cwd === target.cwd) return true;
|
|
4503
|
+
const entryOwnerKey = promptDraftOwnerKeyForCwd(entry.cwd);
|
|
4504
|
+
if (target.ownerKey === entryOwnerKey) return true;
|
|
4505
|
+
return target.ownerKey === promptDraftOwnerKeyForCwd(void 0);
|
|
4506
|
+
}
|
|
3905
4507
|
var PicoRuntime = class {
|
|
3906
4508
|
encoder = new TextEncoder();
|
|
3907
4509
|
contexts = /* @__PURE__ */ new Map();
|
|
3908
4510
|
sessionEntries = /* @__PURE__ */ new Map();
|
|
4511
|
+
contextCleanupTimeout;
|
|
3909
4512
|
sessionTreeLeafOverrides = /* @__PURE__ */ new Map();
|
|
3910
4513
|
servicesByCwd = /* @__PURE__ */ new Map();
|
|
3911
4514
|
pendingUiRequests = /* @__PURE__ */ new Map();
|
|
@@ -3916,6 +4519,7 @@ var PicoRuntime = class {
|
|
|
3916
4519
|
gitWatchManager = new GitWatchManager((change) => {
|
|
3917
4520
|
this.handleGitWatchChange(change);
|
|
3918
4521
|
});
|
|
4522
|
+
terminalManager = new PicoTerminalManager();
|
|
3919
4523
|
sessionIndexCache;
|
|
3920
4524
|
sessionIndexPromise;
|
|
3921
4525
|
sdkPromise;
|
|
@@ -4060,6 +4664,20 @@ var PicoRuntime = class {
|
|
|
4060
4664
|
});
|
|
4061
4665
|
});
|
|
4062
4666
|
}
|
|
4667
|
+
findPicoDefaultModel(entry) {
|
|
4668
|
+
return entry.services.modelRegistry.getAvailable().find((model) => model.provider === PICO_DEFAULT_MODEL_PROVIDER && model.id === PICO_DEFAULT_MODEL_ID);
|
|
4669
|
+
}
|
|
4670
|
+
async applyPicoDefaultSessionPreferences(entry) {
|
|
4671
|
+
const settingsManager = entry.services.settingsManager;
|
|
4672
|
+
const configuredProvider = settingsManager.getDefaultProvider?.()?.trim();
|
|
4673
|
+
const configuredModel = settingsManager.getDefaultModel?.()?.trim();
|
|
4674
|
+
const configuredThinkingLevel = settingsManager.getDefaultThinkingLevel?.()?.trim();
|
|
4675
|
+
if (!configuredProvider && !configuredModel) {
|
|
4676
|
+
const defaultModel = this.findPicoDefaultModel(entry);
|
|
4677
|
+
if (defaultModel && (entry.session.model?.provider !== defaultModel.provider || entry.session.model?.id !== defaultModel.id)) await entry.session.setModel(defaultModel);
|
|
4678
|
+
}
|
|
4679
|
+
if (!configuredThinkingLevel && entry.session.thinkingLevel !== PICO_DEFAULT_THINKING_LEVEL && entry.session.getAvailableThinkingLevels().includes(PICO_DEFAULT_THINKING_LEVEL)) entry.session.setThinkingLevel(PICO_DEFAULT_THINKING_LEVEL);
|
|
4680
|
+
}
|
|
4063
4681
|
listAvailableModels(entry) {
|
|
4064
4682
|
return entry.services.modelRegistry.getAvailable().flatMap((model) => {
|
|
4065
4683
|
const serializedModel = serializeModel(model);
|
|
@@ -4090,7 +4708,10 @@ var PicoRuntime = class {
|
|
|
4090
4708
|
draftKey: void 0,
|
|
4091
4709
|
sessionScope: process.cwd(),
|
|
4092
4710
|
unreadFinished: /* @__PURE__ */ new Set(),
|
|
4093
|
-
sidebarBootstrapDirectories: []
|
|
4711
|
+
sidebarBootstrapDirectories: [],
|
|
4712
|
+
nextSseEventId: 1,
|
|
4713
|
+
replayEvents: [],
|
|
4714
|
+
inactiveSince: void 0
|
|
4094
4715
|
};
|
|
4095
4716
|
this.contexts.set(id, next);
|
|
4096
4717
|
return next;
|
|
@@ -4152,11 +4773,27 @@ var PicoRuntime = class {
|
|
|
4152
4773
|
});
|
|
4153
4774
|
await Promise.all(candidates.map((entry) => this.disposeSessionEntry(entry)));
|
|
4154
4775
|
}
|
|
4776
|
+
scheduleInactiveContextCleanup() {
|
|
4777
|
+
if (this.contextCleanupTimeout) return;
|
|
4778
|
+
this.contextCleanupTimeout = setTimeout(() => {
|
|
4779
|
+
this.contextCleanupTimeout = void 0;
|
|
4780
|
+
this.cleanupInactiveContexts();
|
|
4781
|
+
}, CONTEXT_INACTIVE_GRACE_MS + 100);
|
|
4782
|
+
}
|
|
4155
4783
|
async cleanupInactiveContexts() {
|
|
4784
|
+
const now = performance.now();
|
|
4156
4785
|
for (const context of this.contexts.values()) {
|
|
4157
|
-
if (context.clients.size > 0)
|
|
4786
|
+
if (context.clients.size > 0) {
|
|
4787
|
+
context.inactiveSince = void 0;
|
|
4788
|
+
continue;
|
|
4789
|
+
}
|
|
4158
4790
|
const activeEntry = this.getActiveEntry(context);
|
|
4159
4791
|
if (activeEntry && this.isSessionBusyForDone(activeEntry)) continue;
|
|
4792
|
+
context.inactiveSince ??= now;
|
|
4793
|
+
if (now - context.inactiveSince < CONTEXT_INACTIVE_GRACE_MS) {
|
|
4794
|
+
this.scheduleInactiveContextCleanup();
|
|
4795
|
+
continue;
|
|
4796
|
+
}
|
|
4160
4797
|
this.contexts.delete(context.id);
|
|
4161
4798
|
}
|
|
4162
4799
|
this.syncGitWatchDirectories();
|
|
@@ -4199,6 +4836,49 @@ var PicoRuntime = class {
|
|
|
4199
4836
|
}
|
|
4200
4837
|
return lastValue;
|
|
4201
4838
|
}
|
|
4839
|
+
stateConversationItems(entry) {
|
|
4840
|
+
const branchableMessages = extractBranchableMessages(entry);
|
|
4841
|
+
const forkableMessages = branchableMessages.length === 0 ? extractForkableUserMessages(entry) : [];
|
|
4842
|
+
if (branchableMessages.length === 0 && forkableMessages.length === 0) return entry.retainedConversationItems;
|
|
4843
|
+
let branchableIndex = 0;
|
|
4844
|
+
let forkableIndex = 0;
|
|
4845
|
+
let changed = false;
|
|
4846
|
+
const nextBranchableMessage = (role) => {
|
|
4847
|
+
const matchedIndex = branchableMessages.findIndex((message, index) => index >= branchableIndex && message.role === role);
|
|
4848
|
+
if (matchedIndex < 0) return void 0;
|
|
4849
|
+
branchableIndex = matchedIndex + 1;
|
|
4850
|
+
return branchableMessages[matchedIndex];
|
|
4851
|
+
};
|
|
4852
|
+
const nextForkableUserEntryId = (text) => {
|
|
4853
|
+
const normalizedText = text.trim();
|
|
4854
|
+
if (!normalizedText) return void 0;
|
|
4855
|
+
const matchedIndex = forkableMessages.findIndex((message, index) => index >= forkableIndex && message.text.trim() === normalizedText);
|
|
4856
|
+
if (matchedIndex < 0) return void 0;
|
|
4857
|
+
forkableIndex = matchedIndex + 1;
|
|
4858
|
+
return forkableMessages[matchedIndex]?.entryId;
|
|
4859
|
+
};
|
|
4860
|
+
const items = entry.retainedConversationItems.map((item) => {
|
|
4861
|
+
if (item.kind === "user") {
|
|
4862
|
+
const entryId = nextBranchableMessage("user")?.entryId ?? nextForkableUserEntryId(item.text);
|
|
4863
|
+
if (!entryId || item.forkEntryId === entryId) return item;
|
|
4864
|
+
changed = true;
|
|
4865
|
+
return {
|
|
4866
|
+
...item,
|
|
4867
|
+
forkEntryId: entryId
|
|
4868
|
+
};
|
|
4869
|
+
}
|
|
4870
|
+
if (item.streaming) return item;
|
|
4871
|
+
const entryId = nextBranchableMessage("assistant")?.entryId;
|
|
4872
|
+
if (!entryId || item.branchEntryId === entryId) return item;
|
|
4873
|
+
changed = true;
|
|
4874
|
+
return {
|
|
4875
|
+
...item,
|
|
4876
|
+
branchEntryId: entryId
|
|
4877
|
+
};
|
|
4878
|
+
});
|
|
4879
|
+
if (changed) entry.retainedConversationItems = items;
|
|
4880
|
+
return entry.retainedConversationItems;
|
|
4881
|
+
}
|
|
4202
4882
|
currentStatePayload(entry, context) {
|
|
4203
4883
|
const draft = this.isDraftEntry(entry);
|
|
4204
4884
|
const historyTotalCount = entry.session.messages.length;
|
|
@@ -4206,7 +4886,7 @@ var PicoRuntime = class {
|
|
|
4206
4886
|
type: "state_sync",
|
|
4207
4887
|
activationRevision: context.activeRevision,
|
|
4208
4888
|
sessionKey: entry.key,
|
|
4209
|
-
items: entry
|
|
4889
|
+
items: this.stateConversationItems(entry),
|
|
4210
4890
|
pendingUserMessages: entry.pendingUserMessages.map((message) => clonePendingUserMessage(message)),
|
|
4211
4891
|
draft,
|
|
4212
4892
|
streaming: this.getEntryStreamingState(entry),
|
|
@@ -4504,8 +5184,32 @@ var PicoRuntime = class {
|
|
|
4504
5184
|
messages
|
|
4505
5185
|
};
|
|
4506
5186
|
}
|
|
5187
|
+
shouldReplayPayload(payload) {
|
|
5188
|
+
if (!payload || typeof payload !== "object") return false;
|
|
5189
|
+
const type = payload.type;
|
|
5190
|
+
return type === "session_done" || type === "request_error" || type === "extension_error" || type === "extension_ui_request" || type === "auto_session_naming_error" || type === "git_changed";
|
|
5191
|
+
}
|
|
5192
|
+
rememberReplayPayload(context, payload) {
|
|
5193
|
+
if (!this.shouldReplayPayload(payload)) return void 0;
|
|
5194
|
+
const eventId = context.nextSseEventId;
|
|
5195
|
+
context.nextSseEventId += 1;
|
|
5196
|
+
context.replayEvents.push({
|
|
5197
|
+
id: eventId,
|
|
5198
|
+
text: formatSsePayloadText(payload, { id: String(eventId) })
|
|
5199
|
+
});
|
|
5200
|
+
while (context.replayEvents.length > SSE_REPLAY_MAX_EVENTS) context.replayEvents.shift();
|
|
5201
|
+
return String(eventId);
|
|
5202
|
+
}
|
|
5203
|
+
replayEventsToClient(context, client, lastEventId) {
|
|
5204
|
+
if (lastEventId === void 0 || context.replayEvents.length === 0) return;
|
|
5205
|
+
for (const event of context.replayEvents) {
|
|
5206
|
+
if (event.id <= lastEventId) continue;
|
|
5207
|
+
this.writeRawToClient(context, client, event.text);
|
|
5208
|
+
}
|
|
5209
|
+
}
|
|
4507
5210
|
sendToContext(context, payload) {
|
|
4508
|
-
|
|
5211
|
+
const eventId = this.rememberReplayPayload(context, payload);
|
|
5212
|
+
for (const client of context.clients) this.sendPayloadToClient(context, client, payload, { eventId });
|
|
4509
5213
|
}
|
|
4510
5214
|
sendStatePayloadToClient(context, client, payload, options) {
|
|
4511
5215
|
const debug = isSessionLoadDebugEnabled();
|
|
@@ -4845,6 +5549,32 @@ var PicoRuntime = class {
|
|
|
4845
5549
|
if (!entry || !this.isDraftEntry(entry)) return;
|
|
4846
5550
|
if (![...this.contexts.values()].some((context) => context.activeKey === entry.key || context.draftKey === entry.key)) await this.disposeSessionEntry(entry);
|
|
4847
5551
|
}
|
|
5552
|
+
async recoverMissingPromptDraftTarget(context, target) {
|
|
5553
|
+
if (!target.ownerKey && !target.cwd) return void 0;
|
|
5554
|
+
const matchesTarget = (entry) => Boolean(entry && this.isDraftEntry(entry) && promptDraftTargetMatches(entry, target));
|
|
5555
|
+
const recoveredCwd = target.cwd || promptDraftCwdFromOwnerKey(target.ownerKey) || (target.ownerKey === promptDraftOwnerKeyForCwd(void 0) ? resolveScopeCwd(context.sessionScope, process.cwd()) : void 0);
|
|
5556
|
+
const activeEntry = this.getActiveEntry(context);
|
|
5557
|
+
if (matchesTarget(activeEntry)) return activeEntry;
|
|
5558
|
+
if (activeEntry && recoveredCwd && activeEntry.cwd === recoveredCwd && this.getEntryStreamingState(activeEntry)) return activeEntry;
|
|
5559
|
+
const draftEntry = context.draftKey ? this.sessionEntries.get(context.draftKey) : void 0;
|
|
5560
|
+
if (draftEntry && matchesTarget(draftEntry)) {
|
|
5561
|
+
await this.activateContextSession(context, draftEntry);
|
|
5562
|
+
return draftEntry;
|
|
5563
|
+
}
|
|
5564
|
+
if (!recoveredCwd) return void 0;
|
|
5565
|
+
const nextEntry = await this.createNewSessionEntry(recoveredCwd, {
|
|
5566
|
+
draft: true,
|
|
5567
|
+
sessionDir: activeEntry && recoveredCwd === activeEntry.cwd ? activeEntry.session.sessionManager.getSessionDir?.() : void 0,
|
|
5568
|
+
sessionStartEvent: {
|
|
5569
|
+
type: "session_start",
|
|
5570
|
+
reason: "new",
|
|
5571
|
+
previousSessionFile: activeEntry?.session.sessionFile
|
|
5572
|
+
}
|
|
5573
|
+
});
|
|
5574
|
+
context.draftKey = nextEntry.key;
|
|
5575
|
+
await this.activateContextSession(context, nextEntry);
|
|
5576
|
+
return nextEntry;
|
|
5577
|
+
}
|
|
4848
5578
|
async clearContextDraft(context) {
|
|
4849
5579
|
await clearContextDraft({
|
|
4850
5580
|
context,
|
|
@@ -4958,6 +5688,9 @@ var PicoRuntime = class {
|
|
|
4958
5688
|
getBaseCwd(activeEntry, context) {
|
|
4959
5689
|
return activeEntry.cwd || resolveScopeCwd(context.sessionScope, process.cwd());
|
|
4960
5690
|
}
|
|
5691
|
+
getTerminalScopeKey(activeEntry, context) {
|
|
5692
|
+
return `${context.id}:${activeEntry.key}:${this.getBaseCwd(activeEntry, context)}`;
|
|
5693
|
+
}
|
|
4961
5694
|
async createSessionEntryFromRuntime(runtime, options) {
|
|
4962
5695
|
const startedAt = performance.now();
|
|
4963
5696
|
this.logRuntimeDiagnostics(runtime.diagnostics);
|
|
@@ -4990,6 +5723,7 @@ var PicoRuntime = class {
|
|
|
4990
5723
|
retainedConversationItems: createRetainedConversationState(session.messages.map((message) => sanitizeSessionMessage(message))).items,
|
|
4991
5724
|
pendingUserMessages: [],
|
|
4992
5725
|
pendingQueueMutation: false,
|
|
5726
|
+
pausedPendingUserMessageIds: /* @__PURE__ */ new Set(),
|
|
4993
5727
|
canceledPendingUserMessageIds: /* @__PURE__ */ new Set(),
|
|
4994
5728
|
firstMessageHint: "",
|
|
4995
5729
|
modifiedAt: void 0,
|
|
@@ -5004,6 +5738,7 @@ var PicoRuntime = class {
|
|
|
5004
5738
|
disposed: false
|
|
5005
5739
|
},
|
|
5006
5740
|
promptRequestChain: Promise.resolve(),
|
|
5741
|
+
promptRequestRecords: /* @__PURE__ */ new Map(),
|
|
5007
5742
|
doneNotificationSuppressed: false
|
|
5008
5743
|
};
|
|
5009
5744
|
this.sessionEntries.set(key, entry);
|
|
@@ -5039,10 +5774,12 @@ var PicoRuntime = class {
|
|
|
5039
5774
|
async createNewSessionEntry(cwd, options) {
|
|
5040
5775
|
const sessionManager = (await this.getSdk()).SessionManager.create(cwd, options?.sessionDir);
|
|
5041
5776
|
if (options?.newSessionOptions && sessionManager.newSession) sessionManager.newSession(options.newSessionOptions);
|
|
5042
|
-
|
|
5777
|
+
const entry = await this.createSessionEntry(sessionManager, {
|
|
5043
5778
|
draft: options?.draft,
|
|
5044
5779
|
sessionStartEvent: options?.sessionStartEvent
|
|
5045
5780
|
});
|
|
5781
|
+
await this.applyPicoDefaultSessionPreferences(entry);
|
|
5782
|
+
return entry;
|
|
5046
5783
|
}
|
|
5047
5784
|
async ensureSessionEntryByPath(sessionPath) {
|
|
5048
5785
|
const existing = this.sessionEntries.get(sessionPath);
|
|
@@ -5172,6 +5909,18 @@ var PicoRuntime = class {
|
|
|
5172
5909
|
refinementReason: input.refinementReason
|
|
5173
5910
|
});
|
|
5174
5911
|
}
|
|
5912
|
+
applyHeuristicSessionNameAttempt(entry, text, imageCount) {
|
|
5913
|
+
const heuristic = deriveHeuristicSessionNameAttempt(text, imageCount);
|
|
5914
|
+
if (heuristic.name) this.applyManagedSessionName(entry, heuristic.name, "initial");
|
|
5915
|
+
return heuristic;
|
|
5916
|
+
}
|
|
5917
|
+
applySessionNameFallbackAfterRefinementFailure(entry, text, imageCount) {
|
|
5918
|
+
if (this.getCurrentSessionName(entry)) return true;
|
|
5919
|
+
if (this.applyHeuristicSessionNameAttempt(entry, text, imageCount).name && this.getCurrentSessionName(entry)) return true;
|
|
5920
|
+
const fallbackName = cleanupSessionNameCandidate(normalizeSessionListTitle(text, SESSION_NAME_MAX_LENGTH));
|
|
5921
|
+
if (!fallbackName) return false;
|
|
5922
|
+
return this.applyManagedSessionName(entry, fallbackName, "initial");
|
|
5923
|
+
}
|
|
5175
5924
|
scheduleSessionNameRefinement(entry, text, imageCount, heuristicReason) {
|
|
5176
5925
|
if (entry.sessionNaming.pendingGeneration) return;
|
|
5177
5926
|
entry.sessionNaming.pendingGeneration = true;
|
|
@@ -5181,10 +5930,11 @@ var PicoRuntime = class {
|
|
|
5181
5930
|
try {
|
|
5182
5931
|
const generated = await generateSessionNameWithLlm({
|
|
5183
5932
|
cwd: entry.cwd,
|
|
5933
|
+
model: entry.session.model,
|
|
5184
5934
|
services: { modelRegistry: entry.services.modelRegistry }
|
|
5185
5935
|
}, text, imageCount);
|
|
5186
5936
|
if (!generated?.name) {
|
|
5187
|
-
if (!entry.sessionNaming.disposed && entry.sessionNaming.nonce === nonce && sessionId === entry.session.sessionId && !this.
|
|
5937
|
+
if (!entry.sessionNaming.disposed && entry.sessionNaming.nonce === nonce && sessionId === entry.session.sessionId && !this.applySessionNameFallbackAfterRefinementFailure(entry, text, imageCount)) this.emitAutoSessionNamingFailure(entry, {
|
|
5188
5938
|
heuristicReason,
|
|
5189
5939
|
refinementReason: generated?.reason || "session name refinement returned no usable title",
|
|
5190
5940
|
text,
|
|
@@ -5195,7 +5945,7 @@ var PicoRuntime = class {
|
|
|
5195
5945
|
if (entry.sessionNaming.disposed || entry.sessionNaming.nonce !== nonce || sessionId !== entry.session.sessionId) return;
|
|
5196
5946
|
this.applyManagedSessionName(entry, generated.name, "refine");
|
|
5197
5947
|
} catch (error) {
|
|
5198
|
-
if (!entry.sessionNaming.disposed && entry.sessionNaming.nonce === nonce && sessionId === entry.session.sessionId && !this.
|
|
5948
|
+
if (!entry.sessionNaming.disposed && entry.sessionNaming.nonce === nonce && sessionId === entry.session.sessionId && !this.applySessionNameFallbackAfterRefinementFailure(entry, text, imageCount)) this.emitAutoSessionNamingFailure(entry, {
|
|
5199
5949
|
heuristicReason,
|
|
5200
5950
|
refinementReason: formatError(error),
|
|
5201
5951
|
text,
|
|
@@ -5208,21 +5958,28 @@ var PicoRuntime = class {
|
|
|
5208
5958
|
}
|
|
5209
5959
|
startAutoSessionNaming(entry, text, imageCount) {
|
|
5210
5960
|
if (this.getCurrentSessionName(entry)) return;
|
|
5211
|
-
const heuristic =
|
|
5212
|
-
if (heuristic.name) this.applyManagedSessionName(entry, heuristic.name, "initial");
|
|
5961
|
+
const heuristic = this.applyHeuristicSessionNameAttempt(entry, text, imageCount);
|
|
5213
5962
|
this.scheduleSessionNameRefinement(entry, text, imageCount, heuristic.reason);
|
|
5214
5963
|
}
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
for (const message of entry.session.messages) {
|
|
5964
|
+
getFirstPromptForNamingFromMessages(messages, firstMessageHint = "") {
|
|
5965
|
+
for (const message of messages) {
|
|
5218
5966
|
if (message?.role !== "user") continue;
|
|
5219
5967
|
const firstPrompt = summarizePromptContent(message.content);
|
|
5220
|
-
if (firstPrompt.text || firstPrompt.imageCount > 0)
|
|
5221
|
-
this.startAutoSessionNaming(entry, firstPrompt.text, firstPrompt.imageCount);
|
|
5222
|
-
return;
|
|
5223
|
-
}
|
|
5968
|
+
if (firstPrompt.text || firstPrompt.imageCount > 0) return firstPrompt;
|
|
5224
5969
|
}
|
|
5225
|
-
|
|
5970
|
+
const trimmedHint = firstMessageHint.trim();
|
|
5971
|
+
return trimmedHint ? {
|
|
5972
|
+
text: trimmedHint,
|
|
5973
|
+
imageCount: 0
|
|
5974
|
+
} : null;
|
|
5975
|
+
}
|
|
5976
|
+
getSessionFirstPromptForNaming(entry) {
|
|
5977
|
+
return this.getFirstPromptForNamingFromMessages(entry.session.messages, entry.firstMessageHint);
|
|
5978
|
+
}
|
|
5979
|
+
maybeAutoNameSession(entry) {
|
|
5980
|
+
if (this.getCurrentSessionName(entry)) return;
|
|
5981
|
+
const firstPrompt = this.getSessionFirstPromptForNaming(entry);
|
|
5982
|
+
if (firstPrompt) this.startAutoSessionNaming(entry, firstPrompt.text, firstPrompt.imageCount);
|
|
5226
5983
|
}
|
|
5227
5984
|
reconcilePendingUserMessages(entry, queueState) {
|
|
5228
5985
|
const nextQueueState = queueState ?? {
|
|
@@ -5231,7 +5988,10 @@ var PicoRuntime = class {
|
|
|
5231
5988
|
};
|
|
5232
5989
|
const steering = [...nextQueueState.steering].filter((text) => typeof text === "string");
|
|
5233
5990
|
const followUp = [...nextQueueState.followUp].filter((text) => typeof text === "string");
|
|
5234
|
-
const
|
|
5991
|
+
const allPending = entry.pendingUserMessages.map((message) => clonePendingUserMessage(message));
|
|
5992
|
+
const pausedPending = allPending.filter((message) => entry.pausedPendingUserMessageIds.has(message.pendingId));
|
|
5993
|
+
const pending = allPending.filter((message) => !entry.pausedPendingUserMessageIds.has(message.pendingId));
|
|
5994
|
+
entry.pausedPendingUserMessageIds = new Set(pausedPending.map((message) => message.pendingId));
|
|
5235
5995
|
const steeringCounts = /* @__PURE__ */ new Map();
|
|
5236
5996
|
const followUpCounts = /* @__PURE__ */ new Map();
|
|
5237
5997
|
for (const text of steering) steeringCounts.set(text, (steeringCounts.get(text) ?? 0) + 1);
|
|
@@ -5257,7 +6017,7 @@ var PicoRuntime = class {
|
|
|
5257
6017
|
nextPending.push(createPendingUserMessage(text, [], "followUp"));
|
|
5258
6018
|
followUpCounts.set(text, count - 1);
|
|
5259
6019
|
}
|
|
5260
|
-
entry.pendingUserMessages = sortPendingUserMessages(nextPending);
|
|
6020
|
+
entry.pendingUserMessages = sortPendingUserMessages([...pausedPending, ...nextPending]);
|
|
5261
6021
|
return entry.pendingUserMessages;
|
|
5262
6022
|
}
|
|
5263
6023
|
pendingMessagesFromClientUpdate(entry, pendingMessagesUpdate) {
|
|
@@ -5328,6 +6088,75 @@ var PicoRuntime = class {
|
|
|
5328
6088
|
await this.broadcastEntryState(entry);
|
|
5329
6089
|
return entry.pendingUserMessages;
|
|
5330
6090
|
}
|
|
6091
|
+
drainPendingUserMessagesWhenIdle(entry) {
|
|
6092
|
+
if (entry.pendingQueueDrainPromise) return entry.pendingQueueDrainPromise;
|
|
6093
|
+
const drainPromise = this.runSerializedPromptRequest(entry, async () => {
|
|
6094
|
+
if (this.getEntryStreamingState(entry) || entry.session.isStreaming || this.getEntryCompactingState(entry) || entry.session.isCompacting) return;
|
|
6095
|
+
const pendingMessages = sortPendingUserMessages(entry.pendingUserMessages.map((message) => clonePendingUserMessage(message)));
|
|
6096
|
+
const pendingMessage = pendingMessages[0];
|
|
6097
|
+
if (!pendingMessage) return;
|
|
6098
|
+
const remainingMessages = pendingMessages.slice(1);
|
|
6099
|
+
const message = pendingMessage.text;
|
|
6100
|
+
const images = normalizePromptImages(pendingMessage.images);
|
|
6101
|
+
if (!message.trim() && images.length === 0) {
|
|
6102
|
+
await this.replacePendingUserMessages(entry, remainingMessages);
|
|
6103
|
+
return;
|
|
6104
|
+
}
|
|
6105
|
+
entry.streamingState = true;
|
|
6106
|
+
this.markSessionUserMessage(entry);
|
|
6107
|
+
entry.pendingUserMessages = remainingMessages;
|
|
6108
|
+
await this.broadcastEntryState(entry);
|
|
6109
|
+
await this.broadcastSessionsAll();
|
|
6110
|
+
this.broadcastToViewers(entry.key, {
|
|
6111
|
+
type: "user_message",
|
|
6112
|
+
message,
|
|
6113
|
+
images,
|
|
6114
|
+
queued: false
|
|
6115
|
+
});
|
|
6116
|
+
let promptPreflightComplete;
|
|
6117
|
+
let promptPreflightSettled = false;
|
|
6118
|
+
const promptPreflight = new Promise((resolve) => {
|
|
6119
|
+
promptPreflightComplete = resolve;
|
|
6120
|
+
});
|
|
6121
|
+
const settlePromptPreflight = () => {
|
|
6122
|
+
if (promptPreflightSettled) return;
|
|
6123
|
+
promptPreflightSettled = true;
|
|
6124
|
+
promptPreflightComplete?.();
|
|
6125
|
+
};
|
|
6126
|
+
const promptOptions = images.length > 0 ? { images } : void 0;
|
|
6127
|
+
const promptPromise = entry.session.prompt(message, {
|
|
6128
|
+
...promptOptions,
|
|
6129
|
+
preflightResult: settlePromptPreflight
|
|
6130
|
+
});
|
|
6131
|
+
const finishPromptIfIdle = async () => {
|
|
6132
|
+
if (!entry.streamingState || entry.session.isStreaming) return;
|
|
6133
|
+
entry.streamingState = false;
|
|
6134
|
+
this.reconcilePendingUserMessages(entry);
|
|
6135
|
+
await this.broadcastEntryState(entry);
|
|
6136
|
+
await this.broadcastSessionsAll();
|
|
6137
|
+
};
|
|
6138
|
+
promptPromise.then(() => {}).catch(async (error) => {
|
|
6139
|
+
await finishPromptIfIdle();
|
|
6140
|
+
console.error("[pico] queued prompt error", error);
|
|
6141
|
+
this.broadcastToViewers(entry.key, {
|
|
6142
|
+
type: "request_error",
|
|
6143
|
+
scope: "prompt",
|
|
6144
|
+
message,
|
|
6145
|
+
error: formatError(error)
|
|
6146
|
+
});
|
|
6147
|
+
}).finally(() => {
|
|
6148
|
+
settlePromptPreflight();
|
|
6149
|
+
});
|
|
6150
|
+
await promptPreflight;
|
|
6151
|
+
if (remainingMessages.length > 0) await this.replacePendingUserMessages(entry, remainingMessages);
|
|
6152
|
+
});
|
|
6153
|
+
let trackedPromise = Promise.resolve();
|
|
6154
|
+
trackedPromise = drainPromise.finally(() => {
|
|
6155
|
+
if (entry.pendingQueueDrainPromise === trackedPromise) entry.pendingQueueDrainPromise = void 0;
|
|
6156
|
+
});
|
|
6157
|
+
entry.pendingQueueDrainPromise = trackedPromise;
|
|
6158
|
+
return trackedPromise;
|
|
6159
|
+
}
|
|
5331
6160
|
refreshRetainedConversationItems(entry) {
|
|
5332
6161
|
entry.retainedConversationItems = createRetainedConversationState(entry.session.messages.map((message) => sanitizeSessionMessage(message))).items;
|
|
5333
6162
|
}
|
|
@@ -5530,7 +6359,8 @@ var PicoRuntime = class {
|
|
|
5530
6359
|
const state = createRetainedConversationState(entry.session.messages.map((message) => sanitizeSessionMessage(message)));
|
|
5531
6360
|
const summary = result.summary;
|
|
5532
6361
|
const tokensBefore = result.tokensBefore;
|
|
5533
|
-
|
|
6362
|
+
const estimatedTokensAfter = result.estimatedTokensAfter;
|
|
6363
|
+
state.items = [...state.items, createCompactionSummaryItem(summary, tokensBefore, `compaction:live:${state.items.length}`, estimatedTokensAfter)];
|
|
5534
6364
|
entry.retainedConversationItems = state.items;
|
|
5535
6365
|
return;
|
|
5536
6366
|
}
|
|
@@ -5563,6 +6393,7 @@ var PicoRuntime = class {
|
|
|
5563
6393
|
followUp: Array.isArray(event.followUp) ? event.followUp : []
|
|
5564
6394
|
});
|
|
5565
6395
|
}
|
|
6396
|
+
if (type === "session_info_changed") this.touchSessionEntry(entry);
|
|
5566
6397
|
if (type === "message_end" && event.message?.role === "user") {
|
|
5567
6398
|
this.touchSessionEntry(entry);
|
|
5568
6399
|
this.reconcilePendingUserMessages(entry);
|
|
@@ -5575,6 +6406,7 @@ var PicoRuntime = class {
|
|
|
5575
6406
|
const willRetry = Boolean(event.willRetry);
|
|
5576
6407
|
if (compactionReason === "manual" && compactionSucceeded) this.scheduleSessionDoneCheck(entry, "manual_compaction");
|
|
5577
6408
|
else if (entry.pendingDoneReason === "agent" && !willRetry) this.scheduleSessionDoneCheck(entry, "agent", entry.pendingDoneOutcome ?? "success");
|
|
6409
|
+
this.drainPendingUserMessagesWhenIdle(entry);
|
|
5578
6410
|
}
|
|
5579
6411
|
if (type === "auto_retry_end") {
|
|
5580
6412
|
if (entry.pendingDoneReason === "agent" && event.success === false) this.scheduleSessionDoneCheck(entry, "agent", "error");
|
|
@@ -5593,7 +6425,7 @@ var PicoRuntime = class {
|
|
|
5593
6425
|
if (statusChanged) this.broadcastSessionStatusAll(entry);
|
|
5594
6426
|
this.rememberSessionTreeLeaf(entry, true);
|
|
5595
6427
|
await this.broadcastEntryState(entry);
|
|
5596
|
-
if (type === "agent_start" || type === "agent_end" || type === "message_end" || type === "compaction_end" || type === "queue_update") await this.broadcastSessionsAll();
|
|
6428
|
+
if (type === "agent_start" || type === "agent_end" || type === "message_end" || type === "compaction_end" || type === "queue_update" || type === "session_info_changed") await this.broadcastSessionsAll();
|
|
5597
6429
|
if (type === "agent_end" || type === "compaction_end") await this.cleanupInactiveContexts();
|
|
5598
6430
|
}
|
|
5599
6431
|
writeRawToClient(context, client, text) {
|
|
@@ -5605,12 +6437,14 @@ var PicoRuntime = class {
|
|
|
5605
6437
|
closeSseClient: (activeContext, activeClient) => this.closeSseClient(activeContext, activeClient)
|
|
5606
6438
|
});
|
|
5607
6439
|
}
|
|
5608
|
-
sendPayloadToClient(context, client, payload) {
|
|
6440
|
+
sendPayloadToClient(context, client, payload, options) {
|
|
5609
6441
|
return sendPayloadToClient({
|
|
5610
6442
|
encoder: this.encoder,
|
|
5611
6443
|
context,
|
|
5612
6444
|
client,
|
|
5613
6445
|
payload,
|
|
6446
|
+
eventId: options?.eventId,
|
|
6447
|
+
retry: options?.retry,
|
|
5614
6448
|
closeSseClient: (activeContext, activeClient) => this.closeSseClient(activeContext, activeClient)
|
|
5615
6449
|
});
|
|
5616
6450
|
}
|
|
@@ -5618,6 +6452,10 @@ var PicoRuntime = class {
|
|
|
5618
6452
|
if (client.closed) return;
|
|
5619
6453
|
client.closed = true;
|
|
5620
6454
|
context.clients.delete(client);
|
|
6455
|
+
if (context.clients.size === 0) {
|
|
6456
|
+
context.inactiveSince = performance.now();
|
|
6457
|
+
this.scheduleInactiveContextCleanup();
|
|
6458
|
+
}
|
|
5621
6459
|
this.syncGitWatchDirectories();
|
|
5622
6460
|
try {
|
|
5623
6461
|
client.controller.close();
|
|
@@ -5627,6 +6465,7 @@ var PicoRuntime = class {
|
|
|
5627
6465
|
const startedAt = performance.now();
|
|
5628
6466
|
const { url, context, activeEntry } = await this.resolveRequest(request, { preferActiveDraft: false });
|
|
5629
6467
|
context.sidebarBootstrapDirectories = normalizeRequestedDirectories(url.searchParams.getAll("sidebarDirectory"));
|
|
6468
|
+
const lastEventId = parsePositiveInteger(request.headers.get("last-event-id") || url.searchParams.get("lastEventId"));
|
|
5630
6469
|
this.logSessionLoadDebug("events_response:create", {
|
|
5631
6470
|
contextId: context.id,
|
|
5632
6471
|
sidebarBootstrapDirectoryCount: context.sidebarBootstrapDirectories.length,
|
|
@@ -5642,9 +6481,11 @@ var PicoRuntime = class {
|
|
|
5642
6481
|
controller,
|
|
5643
6482
|
lastStateSyncSnapshot: void 0
|
|
5644
6483
|
};
|
|
6484
|
+
context.inactiveSince = void 0;
|
|
5645
6485
|
context.clients.add(client);
|
|
5646
6486
|
this.syncGitWatchDirectories();
|
|
5647
|
-
this.writeRawToClient(context, client,
|
|
6487
|
+
this.writeRawToClient(context, client, `retry: ${SSE_RETRY_MS}\n: connected\n\n`);
|
|
6488
|
+
this.replayEventsToClient(context, client, lastEventId);
|
|
5648
6489
|
(async () => {
|
|
5649
6490
|
const bootstrapStartedAt = performance.now();
|
|
5650
6491
|
try {
|
|
@@ -5704,8 +6545,43 @@ var PicoRuntime = class {
|
|
|
5704
6545
|
release?.();
|
|
5705
6546
|
}
|
|
5706
6547
|
}
|
|
6548
|
+
prunePromptRequestRecords(entry) {
|
|
6549
|
+
const now = Date.now();
|
|
6550
|
+
for (const [requestId, record] of entry.promptRequestRecords) if (now - record.createdAt > PROMPT_IDEMPOTENCY_TTL_MS) entry.promptRequestRecords.delete(requestId);
|
|
6551
|
+
while (entry.promptRequestRecords.size > PROMPT_IDEMPOTENCY_MAX_RECORDS) {
|
|
6552
|
+
const oldestRequestId = entry.promptRequestRecords.keys().next().value;
|
|
6553
|
+
if (!oldestRequestId) break;
|
|
6554
|
+
entry.promptRequestRecords.delete(oldestRequestId);
|
|
6555
|
+
}
|
|
6556
|
+
}
|
|
5707
6557
|
async prompt(request, body) {
|
|
5708
|
-
const
|
|
6558
|
+
const url = new URL(request.url);
|
|
6559
|
+
const requestedSessionKey = url.searchParams.get("sessionKey")?.trim() || "";
|
|
6560
|
+
const requestedDraftTarget = {
|
|
6561
|
+
ownerKey: normalizePromptDraftOwnerKey(body.draftOwnerKey),
|
|
6562
|
+
cwd: normalizePromptDraftCwd(body.draftCwd)
|
|
6563
|
+
};
|
|
6564
|
+
let resolvedContext;
|
|
6565
|
+
let resolvedActiveEntry;
|
|
6566
|
+
if (requestedSessionKey && !this.sessionEntries.has(requestedSessionKey)) {
|
|
6567
|
+
const context = this.ensureContext(url.searchParams.get("context") || "default");
|
|
6568
|
+
context.sessionScope = normalizeSessionScope(url.searchParams.get("scope"), process.cwd());
|
|
6569
|
+
const recoveredEntry = await this.recoverMissingPromptDraftTarget(context, requestedDraftTarget);
|
|
6570
|
+
if (!recoveredEntry) throw new Error("Requested session is no longer available.");
|
|
6571
|
+
this.logSessionLoadDebug("prompt:recovered_missing_draft_target", {
|
|
6572
|
+
requestedSessionKey,
|
|
6573
|
+
requestedDraftOwnerKey: requestedDraftTarget.ownerKey || void 0,
|
|
6574
|
+
requestedDraftCwd: requestedDraftTarget.cwd,
|
|
6575
|
+
...this.sessionDebugDetails(recoveredEntry)
|
|
6576
|
+
});
|
|
6577
|
+
resolvedContext = context;
|
|
6578
|
+
resolvedActiveEntry = recoveredEntry;
|
|
6579
|
+
}
|
|
6580
|
+
const { context, activeEntry } = resolvedActiveEntry ? {
|
|
6581
|
+
url,
|
|
6582
|
+
context: resolvedContext,
|
|
6583
|
+
activeEntry: resolvedActiveEntry
|
|
6584
|
+
} : await this.resolveRequest(request, {
|
|
5709
6585
|
preferActiveDraft: true,
|
|
5710
6586
|
preferActiveDraftOverRequestedSession: true
|
|
5711
6587
|
});
|
|
@@ -5716,104 +6592,132 @@ var PicoRuntime = class {
|
|
|
5716
6592
|
if (requestedThinkingLevel && !VALID_THINKING_LEVELS.has(requestedThinkingLevel)) throw new Error(`Invalid thinking level: ${requestedThinkingLevel || "(empty)"}`);
|
|
5717
6593
|
const streamingBehavior = body.streamingBehavior === "steer" ? "steer" : body.streamingBehavior === "followUp" ? "followUp" : void 0;
|
|
5718
6594
|
const clientPendingId = normalizeClientPendingId(body.pendingId);
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
activeEntry.
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
6595
|
+
const clientRequestId = normalizeClientPromptRequestId(body.clientRequestId);
|
|
6596
|
+
const executePromptRequest = async () => {
|
|
6597
|
+
return await this.runSerializedPromptRequest(activeEntry, async () => {
|
|
6598
|
+
if (requestedThinkingLevel && activeEntry.session.thinkingLevel !== requestedThinkingLevel) activeEntry.session.setThinkingLevel(requestedThinkingLevel);
|
|
6599
|
+
const promptOptions = images.length > 0 ? { images } : void 0;
|
|
6600
|
+
const promotedDraft = this.isDraftEntry(activeEntry);
|
|
6601
|
+
const isAlreadyStreaming = this.getEntryStreamingState(activeEntry);
|
|
6602
|
+
const isCompactingOnly = !isAlreadyStreaming && Boolean(this.getEntryCompactingState(activeEntry) || activeEntry.session.isCompacting);
|
|
6603
|
+
const isAlreadyBusy = isAlreadyStreaming || isCompactingOnly;
|
|
6604
|
+
if (clientPendingId && activeEntry.canceledPendingUserMessageIds.delete(clientPendingId)) {
|
|
6605
|
+
await this.broadcastEntryState(activeEntry);
|
|
6606
|
+
return {
|
|
6607
|
+
ok: true,
|
|
6608
|
+
queued: isAlreadyBusy,
|
|
6609
|
+
pendingId: clientPendingId,
|
|
6610
|
+
canceled: true
|
|
6611
|
+
};
|
|
6612
|
+
}
|
|
6613
|
+
if (!this.getSessionFirstMessage(activeEntry)) {
|
|
6614
|
+
activeEntry.firstMessageHint = message.trim();
|
|
6615
|
+
this.startAutoSessionNaming(activeEntry, message.trim(), images.length);
|
|
6616
|
+
}
|
|
6617
|
+
if (activeEntry.uiState.editorText) activeEntry.uiState.editorText = "";
|
|
6618
|
+
if (isAlreadyBusy) {
|
|
6619
|
+
const queuedStreamingBehavior = streamingBehavior ?? "steer";
|
|
6620
|
+
const pendingMessage = createPendingUserMessage(message, images, queuedStreamingBehavior, clientPendingId);
|
|
6621
|
+
this.markSessionUserMessage(activeEntry);
|
|
6622
|
+
activeEntry.canceledPendingUserMessageIds.delete(pendingMessage.pendingId);
|
|
6623
|
+
activeEntry.pendingUserMessages.push(pendingMessage);
|
|
6624
|
+
activeEntry.pendingUserMessages = sortPendingUserMessages(activeEntry.pendingUserMessages);
|
|
6625
|
+
await this.broadcastEntryState(activeEntry);
|
|
6626
|
+
if (isCompactingOnly) {
|
|
6627
|
+
await this.broadcastSessionsAll();
|
|
6628
|
+
return {
|
|
6629
|
+
ok: true,
|
|
6630
|
+
queued: true,
|
|
6631
|
+
pendingId: pendingMessage.pendingId
|
|
6632
|
+
};
|
|
6633
|
+
}
|
|
6634
|
+
try {
|
|
6635
|
+
await activeEntry.session.prompt(message, {
|
|
6636
|
+
...promptOptions,
|
|
6637
|
+
streamingBehavior: queuedStreamingBehavior
|
|
6638
|
+
});
|
|
6639
|
+
} catch (error) {
|
|
6640
|
+
activeEntry.pendingUserMessages = activeEntry.pendingUserMessages.filter((entry) => entry.pendingId !== pendingMessage.pendingId);
|
|
6641
|
+
this.reconcilePendingUserMessages(activeEntry);
|
|
6642
|
+
await this.broadcastEntryState(activeEntry);
|
|
6643
|
+
throw error;
|
|
6644
|
+
}
|
|
5751
6645
|
this.reconcilePendingUserMessages(activeEntry);
|
|
5752
6646
|
await this.broadcastEntryState(activeEntry);
|
|
5753
|
-
|
|
6647
|
+
await this.broadcastSessionsAll();
|
|
6648
|
+
return {
|
|
6649
|
+
ok: true,
|
|
6650
|
+
queued: true,
|
|
6651
|
+
pendingId: pendingMessage.pendingId
|
|
6652
|
+
};
|
|
6653
|
+
}
|
|
6654
|
+
activeEntry.streamingState = true;
|
|
6655
|
+
this.markSessionUserMessage(activeEntry);
|
|
6656
|
+
if (promotedDraft) {
|
|
6657
|
+
activeEntry.draft = false;
|
|
6658
|
+
if (context.draftKey === activeEntry.key) context.draftKey = void 0;
|
|
6659
|
+
await this.broadcastEntryState(activeEntry);
|
|
6660
|
+
await this.broadcastSessionsAll();
|
|
5754
6661
|
}
|
|
5755
|
-
this.reconcilePendingUserMessages(activeEntry);
|
|
5756
|
-
await this.broadcastEntryState(activeEntry);
|
|
5757
|
-
await this.broadcastSessionsAll();
|
|
5758
|
-
return {
|
|
5759
|
-
ok: true,
|
|
5760
|
-
queued: true,
|
|
5761
|
-
pendingId: pendingMessage.pendingId
|
|
5762
|
-
};
|
|
5763
|
-
}
|
|
5764
|
-
activeEntry.streamingState = true;
|
|
5765
|
-
this.markSessionUserMessage(activeEntry);
|
|
5766
|
-
if (promotedDraft) {
|
|
5767
|
-
activeEntry.draft = false;
|
|
5768
|
-
if (context.draftKey === activeEntry.key) context.draftKey = void 0;
|
|
5769
|
-
await this.broadcastEntryState(activeEntry);
|
|
5770
|
-
await this.broadcastSessionsAll();
|
|
5771
|
-
}
|
|
5772
|
-
this.broadcastToViewers(activeEntry.key, {
|
|
5773
|
-
type: "user_message",
|
|
5774
|
-
message,
|
|
5775
|
-
images,
|
|
5776
|
-
queued: false
|
|
5777
|
-
});
|
|
5778
|
-
let promptPreflightComplete;
|
|
5779
|
-
let promptPreflightSettled = false;
|
|
5780
|
-
const promptPreflight = new Promise((resolve) => {
|
|
5781
|
-
promptPreflightComplete = resolve;
|
|
5782
|
-
});
|
|
5783
|
-
const settlePromptPreflight = () => {
|
|
5784
|
-
if (promptPreflightSettled) return;
|
|
5785
|
-
promptPreflightSettled = true;
|
|
5786
|
-
promptPreflightComplete?.();
|
|
5787
|
-
};
|
|
5788
|
-
const promptPromise = activeEntry.session.prompt(message, {
|
|
5789
|
-
...promptOptions,
|
|
5790
|
-
preflightResult: settlePromptPreflight
|
|
5791
|
-
});
|
|
5792
|
-
const finishPromptIfIdle = async () => {
|
|
5793
|
-
if (!activeEntry.streamingState || activeEntry.session.isStreaming) return;
|
|
5794
|
-
activeEntry.streamingState = false;
|
|
5795
|
-
this.reconcilePendingUserMessages(activeEntry);
|
|
5796
|
-
await this.broadcastEntryState(activeEntry);
|
|
5797
|
-
await this.broadcastSessionsAll();
|
|
5798
|
-
};
|
|
5799
|
-
promptPromise.then(() => {}).catch(async (error) => {
|
|
5800
|
-
await finishPromptIfIdle();
|
|
5801
|
-
console.error("[pico] prompt error", error);
|
|
5802
6662
|
this.broadcastToViewers(activeEntry.key, {
|
|
5803
|
-
type: "
|
|
5804
|
-
scope: "prompt",
|
|
6663
|
+
type: "user_message",
|
|
5805
6664
|
message,
|
|
5806
|
-
|
|
6665
|
+
images,
|
|
6666
|
+
queued: false
|
|
5807
6667
|
});
|
|
5808
|
-
|
|
5809
|
-
|
|
6668
|
+
let promptPreflightComplete;
|
|
6669
|
+
let promptPreflightSettled = false;
|
|
6670
|
+
const promptPreflight = new Promise((resolve) => {
|
|
6671
|
+
promptPreflightComplete = resolve;
|
|
6672
|
+
});
|
|
6673
|
+
const settlePromptPreflight = () => {
|
|
6674
|
+
if (promptPreflightSettled) return;
|
|
6675
|
+
promptPreflightSettled = true;
|
|
6676
|
+
promptPreflightComplete?.();
|
|
6677
|
+
};
|
|
6678
|
+
const promptPromise = activeEntry.session.prompt(message, {
|
|
6679
|
+
...promptOptions,
|
|
6680
|
+
preflightResult: settlePromptPreflight
|
|
6681
|
+
});
|
|
6682
|
+
const finishPromptIfIdle = async () => {
|
|
6683
|
+
if (!activeEntry.streamingState || activeEntry.session.isStreaming) return;
|
|
6684
|
+
activeEntry.streamingState = false;
|
|
6685
|
+
this.reconcilePendingUserMessages(activeEntry);
|
|
6686
|
+
await this.broadcastEntryState(activeEntry);
|
|
6687
|
+
await this.broadcastSessionsAll();
|
|
6688
|
+
};
|
|
6689
|
+
promptPromise.then(() => {}).catch(async (error) => {
|
|
6690
|
+
await finishPromptIfIdle();
|
|
6691
|
+
console.error("[pico] prompt error", error);
|
|
6692
|
+
this.broadcastToViewers(activeEntry.key, {
|
|
6693
|
+
type: "request_error",
|
|
6694
|
+
scope: "prompt",
|
|
6695
|
+
message,
|
|
6696
|
+
error: formatError(error)
|
|
6697
|
+
});
|
|
6698
|
+
}).finally(() => {
|
|
6699
|
+
settlePromptPreflight();
|
|
6700
|
+
});
|
|
6701
|
+
await promptPreflight;
|
|
6702
|
+
return {
|
|
6703
|
+
ok: true,
|
|
6704
|
+
queued: false
|
|
6705
|
+
};
|
|
5810
6706
|
});
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
6707
|
+
};
|
|
6708
|
+
if (!clientRequestId) return await executePromptRequest();
|
|
6709
|
+
const existingRequest = activeEntry.promptRequestRecords.get(clientRequestId);
|
|
6710
|
+
if (existingRequest) return await existingRequest.promise;
|
|
6711
|
+
this.prunePromptRequestRecords(activeEntry);
|
|
6712
|
+
const promptPromise = executePromptRequest().catch((error) => {
|
|
6713
|
+
activeEntry.promptRequestRecords.delete(clientRequestId);
|
|
6714
|
+
throw error;
|
|
6715
|
+
});
|
|
6716
|
+
activeEntry.promptRequestRecords.set(clientRequestId, {
|
|
6717
|
+
createdAt: Date.now(),
|
|
6718
|
+
promise: promptPromise
|
|
5816
6719
|
});
|
|
6720
|
+
return await promptPromise;
|
|
5817
6721
|
}
|
|
5818
6722
|
async reorderPendingMessages(request, body) {
|
|
5819
6723
|
const { activeEntry } = await this.resolveRequest(request);
|
|
@@ -5850,6 +6754,7 @@ var PicoRuntime = class {
|
|
|
5850
6754
|
throw new Error("Pending prompt not found");
|
|
5851
6755
|
}
|
|
5852
6756
|
activeEntry.canceledPendingUserMessageIds.delete(pendingId);
|
|
6757
|
+
activeEntry.pausedPendingUserMessageIds.delete(pendingId);
|
|
5853
6758
|
pendingMessages.splice(pendingIndex, 1);
|
|
5854
6759
|
await this.replacePendingUserMessages(activeEntry, pendingMessages);
|
|
5855
6760
|
return {
|
|
@@ -5857,13 +6762,42 @@ var PicoRuntime = class {
|
|
|
5857
6762
|
pendingId
|
|
5858
6763
|
};
|
|
5859
6764
|
}
|
|
6765
|
+
async startPendingQueue(request) {
|
|
6766
|
+
const { activeEntry } = await this.resolveRequest(request);
|
|
6767
|
+
if (activeEntry.pendingUserMessages.length === 0) return {
|
|
6768
|
+
ok: true,
|
|
6769
|
+
pendingMessages: []
|
|
6770
|
+
};
|
|
6771
|
+
if (this.getEntryStreamingState(activeEntry) || activeEntry.session.isStreaming || this.getEntryCompactingState(activeEntry) || activeEntry.session.isCompacting) throw new Error("Wait for the current response to finish before starting the queue.");
|
|
6772
|
+
activeEntry.pausedPendingUserMessageIds.clear();
|
|
6773
|
+
await this.drainPendingUserMessagesWhenIdle(activeEntry);
|
|
6774
|
+
return {
|
|
6775
|
+
ok: true,
|
|
6776
|
+
pendingMessages: activeEntry.pendingUserMessages.map((message) => ({
|
|
6777
|
+
pendingId: message.pendingId,
|
|
6778
|
+
text: message.text,
|
|
6779
|
+
images: message.images,
|
|
6780
|
+
streamingBehavior: message.streamingBehavior
|
|
6781
|
+
}))
|
|
6782
|
+
};
|
|
6783
|
+
}
|
|
5860
6784
|
async abort(request) {
|
|
5861
6785
|
const { activeEntry } = await this.resolveRequest(request);
|
|
5862
6786
|
activeEntry.doneNotificationSuppressed = true;
|
|
5863
6787
|
this.clearPendingSessionDone(activeEntry);
|
|
6788
|
+
const pendingMessages = activeEntry.pendingUserMessages.map((message) => clonePendingUserMessage(message));
|
|
6789
|
+
if (pendingMessages.length > 0) for (const message of pendingMessages) activeEntry.pausedPendingUserMessageIds.add(message.pendingId);
|
|
6790
|
+
activeEntry.pendingQueueMutation = true;
|
|
6791
|
+
try {
|
|
6792
|
+
activeEntry.session.clearQueue?.();
|
|
6793
|
+
activeEntry.pendingUserMessages = pendingMessages;
|
|
6794
|
+
} finally {
|
|
6795
|
+
activeEntry.pendingQueueMutation = false;
|
|
6796
|
+
}
|
|
5864
6797
|
activeEntry.session.abortCompaction?.();
|
|
5865
6798
|
activeEntry.session.abortBranchSummary?.();
|
|
5866
6799
|
await activeEntry.session.abort();
|
|
6800
|
+
await this.broadcastEntryState(activeEntry);
|
|
5867
6801
|
return { ok: true };
|
|
5868
6802
|
}
|
|
5869
6803
|
async createNewSession(request, body) {
|
|
@@ -5882,7 +6816,9 @@ var PicoRuntime = class {
|
|
|
5882
6816
|
await this.activateContextSession(context, nextEntry);
|
|
5883
6817
|
return {
|
|
5884
6818
|
ok: true,
|
|
5885
|
-
draft: true
|
|
6819
|
+
draft: true,
|
|
6820
|
+
sessionKey: nextEntry.key,
|
|
6821
|
+
cwd: nextEntry.cwd
|
|
5886
6822
|
};
|
|
5887
6823
|
}
|
|
5888
6824
|
async selectSession(request) {
|
|
@@ -5972,7 +6908,8 @@ var PicoRuntime = class {
|
|
|
5972
6908
|
return {
|
|
5973
6909
|
ok: true,
|
|
5974
6910
|
model: serializeModel(activeEntry.session.model),
|
|
5975
|
-
thinkingLevel: activeEntry.session.thinkingLevel
|
|
6911
|
+
thinkingLevel: activeEntry.session.thinkingLevel,
|
|
6912
|
+
availableThinkingLevels: activeEntry.session.getAvailableThinkingLevels()
|
|
5976
6913
|
};
|
|
5977
6914
|
}
|
|
5978
6915
|
async setThinking(request, body) {
|
|
@@ -6140,13 +7077,18 @@ var PicoRuntime = class {
|
|
|
6140
7077
|
const { context, activeEntry } = await this.resolveRequest(request);
|
|
6141
7078
|
const entryId = typeof body.entryId === "string" ? body.entryId.trim() : "";
|
|
6142
7079
|
if (!entryId) throw new Error("entryId is required");
|
|
7080
|
+
const forkPosition = body.position === "at" ? "at" : "before";
|
|
7081
|
+
const isEditFork = forkPosition === "before";
|
|
6143
7082
|
const currentManager = activeEntry.session.sessionManager;
|
|
6144
7083
|
const selectedEntry = currentManager.getEntry?.(entryId);
|
|
6145
7084
|
const selectedParentId = typeof selectedEntry?.parentId === "string" ? selectedEntry.parentId : void 0;
|
|
6146
|
-
|
|
6147
|
-
|
|
7085
|
+
const selectedRole = typeof selectedEntry?.message?.role === "string" ? selectedEntry.message.role : "";
|
|
7086
|
+
if (!selectedEntry || selectedEntry.type !== "message" || (isEditFork ? selectedRole !== "user" : selectedRole !== "assistant")) throw new Error("Invalid entry ID for forking");
|
|
7087
|
+
const selectedText = isEditFork ? extractMessageText(selectedEntry.message) : "";
|
|
6148
7088
|
const previousSessionFile = activeEntry.session.sessionFile;
|
|
6149
7089
|
const sourceSessionDir = currentManager.getSessionDir?.();
|
|
7090
|
+
const forkLeafId = isEditFork ? selectedParentId : entryId;
|
|
7091
|
+
const draft = isEditFork ? !selectedParentId : false;
|
|
6150
7092
|
let nextEntry;
|
|
6151
7093
|
if (currentManager.isPersisted?.()) {
|
|
6152
7094
|
const sdk = await this.getSdk();
|
|
@@ -6155,7 +7097,7 @@ var PicoRuntime = class {
|
|
|
6155
7097
|
const sourceManager = sdk.SessionManager.open(currentSessionFile, sourceSessionDir, activeEntry.cwd);
|
|
6156
7098
|
const runtime = await this.createSessionRuntime(sourceManager);
|
|
6157
7099
|
try {
|
|
6158
|
-
const result = await runtime.fork(entryId, { position:
|
|
7100
|
+
const result = await runtime.fork(entryId, { position: forkPosition });
|
|
6159
7101
|
if (result.cancelled) {
|
|
6160
7102
|
await runtime.dispose();
|
|
6161
7103
|
return {
|
|
@@ -6163,8 +7105,8 @@ var PicoRuntime = class {
|
|
|
6163
7105
|
cancelled: true
|
|
6164
7106
|
};
|
|
6165
7107
|
}
|
|
6166
|
-
nextEntry = await this.createSessionEntryFromRuntime(runtime, { draft
|
|
6167
|
-
if (result.selectedText) nextEntry.uiState.editorText = result.selectedText;
|
|
7108
|
+
nextEntry = await this.createSessionEntryFromRuntime(runtime, { draft });
|
|
7109
|
+
if (isEditFork && result.selectedText) nextEntry.uiState.editorText = result.selectedText;
|
|
6168
7110
|
} catch (error) {
|
|
6169
7111
|
await runtime.dispose().catch(() => {});
|
|
6170
7112
|
throw error;
|
|
@@ -6175,30 +7117,102 @@ var PicoRuntime = class {
|
|
|
6175
7117
|
reason: "fork",
|
|
6176
7118
|
previousSessionFile
|
|
6177
7119
|
};
|
|
6178
|
-
const sessionManager = await this.createForkedInMemorySessionManager(currentManager,
|
|
7120
|
+
const sessionManager = await this.createForkedInMemorySessionManager(currentManager, forkLeafId, previousSessionFile);
|
|
6179
7121
|
nextEntry = await this.createSessionEntry(sessionManager, {
|
|
6180
|
-
draft
|
|
7122
|
+
draft,
|
|
6181
7123
|
sessionStartEvent
|
|
6182
7124
|
});
|
|
6183
7125
|
}
|
|
6184
|
-
if (!nextEntry.uiState.editorText) nextEntry.uiState.editorText = selectedText;
|
|
7126
|
+
if (isEditFork && !nextEntry.uiState.editorText) nextEntry.uiState.editorText = selectedText;
|
|
6185
7127
|
const baseName = cleanupSessionNameCandidate(activeEntry.session.sessionName) || getSessionListTitle({
|
|
6186
7128
|
name: activeEntry.session.sessionName,
|
|
6187
7129
|
firstMessage: this.getSessionFirstMessage(activeEntry)
|
|
6188
7130
|
});
|
|
6189
|
-
if (baseName) nextEntry.session.setSessionName(clampSessionNameLength(`${baseName} fork`));
|
|
6190
|
-
|
|
6191
|
-
|
|
7131
|
+
if (baseName) nextEntry.session.setSessionName(clampSessionNameLength(`${baseName} ${isEditFork ? "fork" : "branch"}`));
|
|
7132
|
+
if (isEditFork) {
|
|
7133
|
+
nextEntry.uiState.editorText = selectedText;
|
|
7134
|
+
if (!selectedParentId) nextEntry.firstMessageHint = selectedText;
|
|
7135
|
+
} else nextEntry.uiState.editorText = "";
|
|
6192
7136
|
this.touchSessionEntry(nextEntry);
|
|
6193
7137
|
await this.activateContextSession(context, nextEntry);
|
|
6194
7138
|
await this.broadcastSessionsAll();
|
|
6195
7139
|
return {
|
|
6196
7140
|
ok: true,
|
|
6197
7141
|
draft: this.isDraftEntry(nextEntry),
|
|
7142
|
+
sessionKey: nextEntry.key,
|
|
6198
7143
|
sessionId: nextEntry.session.sessionId,
|
|
6199
7144
|
sessionFile: nextEntry.session.sessionFile
|
|
6200
7145
|
};
|
|
6201
7146
|
}
|
|
7147
|
+
async generateSessionName(request, body) {
|
|
7148
|
+
const sessionPath = typeof body.path === "string" ? body.path.trim() : "";
|
|
7149
|
+
let source;
|
|
7150
|
+
let temporaryRuntime;
|
|
7151
|
+
try {
|
|
7152
|
+
if (sessionPath) {
|
|
7153
|
+
const targetEntry = this.sessionEntries.get(sessionPath);
|
|
7154
|
+
if (targetEntry) {
|
|
7155
|
+
const firstPrompt = this.getSessionFirstPromptForNaming(targetEntry);
|
|
7156
|
+
if (firstPrompt) source = {
|
|
7157
|
+
cwd: targetEntry.cwd,
|
|
7158
|
+
model: targetEntry.session.model,
|
|
7159
|
+
modelRegistry: targetEntry.services.modelRegistry,
|
|
7160
|
+
firstPrompt
|
|
7161
|
+
};
|
|
7162
|
+
} else {
|
|
7163
|
+
const sessionManager = (await this.getSdk()).SessionManager.open(sessionPath);
|
|
7164
|
+
this.restoreSessionTreeLeafOverride(sessionManager, sessionPath);
|
|
7165
|
+
temporaryRuntime = await this.createSessionRuntime(sessionManager);
|
|
7166
|
+
const firstPrompt = this.getFirstPromptForNamingFromMessages(temporaryRuntime.session.messages);
|
|
7167
|
+
if (firstPrompt) source = {
|
|
7168
|
+
cwd: temporaryRuntime.cwd,
|
|
7169
|
+
model: temporaryRuntime.session.model,
|
|
7170
|
+
modelRegistry: temporaryRuntime.services.modelRegistry,
|
|
7171
|
+
firstPrompt
|
|
7172
|
+
};
|
|
7173
|
+
}
|
|
7174
|
+
} else {
|
|
7175
|
+
const { activeEntry } = await this.resolveRequest(request);
|
|
7176
|
+
const firstPrompt = this.getSessionFirstPromptForNaming(activeEntry);
|
|
7177
|
+
if (firstPrompt) source = {
|
|
7178
|
+
cwd: activeEntry.cwd,
|
|
7179
|
+
model: activeEntry.session.model,
|
|
7180
|
+
modelRegistry: activeEntry.services.modelRegistry,
|
|
7181
|
+
firstPrompt
|
|
7182
|
+
};
|
|
7183
|
+
}
|
|
7184
|
+
if (!source) throw new Error("Session has no user message to name from");
|
|
7185
|
+
const heuristic = deriveHeuristicSessionNameAttempt(source.firstPrompt.text, source.firstPrompt.imageCount);
|
|
7186
|
+
const generated = await generateSessionNameWithLlm({
|
|
7187
|
+
cwd: source.cwd,
|
|
7188
|
+
model: source.model,
|
|
7189
|
+
services: { modelRegistry: source.modelRegistry }
|
|
7190
|
+
}, source.firstPrompt.text, source.firstPrompt.imageCount);
|
|
7191
|
+
if (generated.name) return {
|
|
7192
|
+
ok: true,
|
|
7193
|
+
name: clampSessionNameLength(generated.name),
|
|
7194
|
+
source: "llm"
|
|
7195
|
+
};
|
|
7196
|
+
if (heuristic.name) return {
|
|
7197
|
+
ok: true,
|
|
7198
|
+
name: clampSessionNameLength(heuristic.name),
|
|
7199
|
+
source: "heuristic",
|
|
7200
|
+
reason: generated.reason || heuristic.reason
|
|
7201
|
+
};
|
|
7202
|
+
const fallbackName = cleanupSessionNameCandidate(normalizeSessionListTitle(source.firstPrompt.text, SESSION_NAME_MAX_LENGTH));
|
|
7203
|
+
if (fallbackName) return {
|
|
7204
|
+
ok: true,
|
|
7205
|
+
name: clampSessionNameLength(fallbackName),
|
|
7206
|
+
source: "heuristic",
|
|
7207
|
+
reason: generated.reason || heuristic.reason
|
|
7208
|
+
};
|
|
7209
|
+
throw new Error(generated.reason || heuristic.reason || "Could not generate a session name from the first user message");
|
|
7210
|
+
} finally {
|
|
7211
|
+
await temporaryRuntime?.dispose().catch((error) => {
|
|
7212
|
+
console.error("[pico] temporary session dispose error:", error);
|
|
7213
|
+
});
|
|
7214
|
+
}
|
|
7215
|
+
}
|
|
6202
7216
|
async renameSession(body) {
|
|
6203
7217
|
const sessionPath = typeof body.path === "string" ? body.path : "";
|
|
6204
7218
|
const nextName = typeof body.name === "string" ? body.name.trim() : "";
|
|
@@ -6438,6 +7452,7 @@ var PicoRuntime = class {
|
|
|
6438
7452
|
}
|
|
6439
7453
|
async getAuthProviders(request) {
|
|
6440
7454
|
const { activeEntry } = await this.resolveRequest(request);
|
|
7455
|
+
this.refreshModelRegistries();
|
|
6441
7456
|
const modelRegistry = activeEntry.services.modelRegistry;
|
|
6442
7457
|
const authStorage = this.requireAuthStorage(activeEntry);
|
|
6443
7458
|
const oauthProviders = authStorage.getOAuthProviders();
|
|
@@ -6482,7 +7497,8 @@ var PicoRuntime = class {
|
|
|
6482
7497
|
...authStatus(providerId),
|
|
6483
7498
|
configured: true
|
|
6484
7499
|
};
|
|
6485
|
-
}).sort((left, right) => left.name.localeCompare(right.name))
|
|
7500
|
+
}).sort((left, right) => left.name.localeCompare(right.name)),
|
|
7501
|
+
availableModels: this.listAvailableModels(activeEntry)
|
|
6486
7502
|
};
|
|
6487
7503
|
}
|
|
6488
7504
|
async saveProviderApiKey(request, body) {
|
|
@@ -6651,11 +7667,86 @@ var PicoRuntime = class {
|
|
|
6651
7667
|
activeEntry.compactingState = false;
|
|
6652
7668
|
await this.broadcastEntryState(activeEntry);
|
|
6653
7669
|
await this.broadcastSessionsAll();
|
|
7670
|
+
this.drainPendingUserMessagesWhenIdle(activeEntry);
|
|
6654
7671
|
}
|
|
6655
7672
|
}
|
|
6656
7673
|
async resolveUiRequest(id, body) {
|
|
6657
7674
|
return resolvePendingUiRequest(this.pendingUiRequests, id, body);
|
|
6658
7675
|
}
|
|
7676
|
+
async createTerminal(request, body) {
|
|
7677
|
+
const { context, activeEntry } = await this.resolveRequest(request);
|
|
7678
|
+
const cwd = this.getBaseCwd(activeEntry, context);
|
|
7679
|
+
return {
|
|
7680
|
+
ok: true,
|
|
7681
|
+
...await this.terminalManager.createTerminal({
|
|
7682
|
+
clientKey: body.clientKey,
|
|
7683
|
+
cols: body.cols,
|
|
7684
|
+
cwd,
|
|
7685
|
+
rows: body.rows,
|
|
7686
|
+
scopeKey: this.getTerminalScopeKey(activeEntry, context)
|
|
7687
|
+
})
|
|
7688
|
+
};
|
|
7689
|
+
}
|
|
7690
|
+
async createTerminalEventsResponse(request, id) {
|
|
7691
|
+
const { context, activeEntry } = await this.resolveRequest(request);
|
|
7692
|
+
const lastSeq = parsePositiveInteger(request.headers.get("last-event-id") || new URL(request.url).searchParams.get("lastSeq"));
|
|
7693
|
+
return this.terminalManager.createEventsResponse(id, this.getTerminalScopeKey(activeEntry, context), request.signal, lastSeq);
|
|
7694
|
+
}
|
|
7695
|
+
async createTerminalWebSocketContext(request) {
|
|
7696
|
+
try {
|
|
7697
|
+
const id = terminalWebSocketIdFromRequest(request);
|
|
7698
|
+
const { context, activeEntry } = await this.resolveRequest(request);
|
|
7699
|
+
const scopeKey = this.getTerminalScopeKey(activeEntry, context);
|
|
7700
|
+
const lastSeq = parsePositiveInteger(request.headers.get("last-event-id") || new URL(request.url).searchParams.get("lastSeq"));
|
|
7701
|
+
this.terminalManager.validateTerminal(id, scopeKey);
|
|
7702
|
+
return {
|
|
7703
|
+
terminalId: id,
|
|
7704
|
+
terminalLastSeq: lastSeq,
|
|
7705
|
+
terminalScopeKey: scopeKey
|
|
7706
|
+
};
|
|
7707
|
+
} catch (error) {
|
|
7708
|
+
if (error instanceof Response) throw error;
|
|
7709
|
+
throw new Response(safeErrorMessage(error), { status: 400 });
|
|
7710
|
+
}
|
|
7711
|
+
}
|
|
7712
|
+
openTerminalWebSocket(peer) {
|
|
7713
|
+
const context = terminalWebSocketContextFromPeer(peer);
|
|
7714
|
+
const cleanup = this.terminalManager.connectWebSocket({
|
|
7715
|
+
id: context.terminalId,
|
|
7716
|
+
lastSeq: context.terminalLastSeq,
|
|
7717
|
+
peer,
|
|
7718
|
+
scopeKey: context.terminalScopeKey
|
|
7719
|
+
});
|
|
7720
|
+
peer.context.terminalCleanup = cleanup;
|
|
7721
|
+
}
|
|
7722
|
+
handleTerminalWebSocketMessage(peer, message) {
|
|
7723
|
+
const context = terminalWebSocketContextFromPeer(peer);
|
|
7724
|
+
this.terminalManager.handleWebSocketMessage({
|
|
7725
|
+
id: context.terminalId,
|
|
7726
|
+
message,
|
|
7727
|
+
peer,
|
|
7728
|
+
scopeKey: context.terminalScopeKey
|
|
7729
|
+
});
|
|
7730
|
+
}
|
|
7731
|
+
closeTerminalWebSocket(peer) {
|
|
7732
|
+
terminalWebSocketCleanupFromPeer(peer)?.();
|
|
7733
|
+
delete peer.context.terminalCleanup;
|
|
7734
|
+
}
|
|
7735
|
+
async writeTerminalInput(request, id, body) {
|
|
7736
|
+
const { context, activeEntry } = await this.resolveRequest(request);
|
|
7737
|
+
this.terminalManager.writeTerminal(id, this.getTerminalScopeKey(activeEntry, context), body.data, body.inputSeq);
|
|
7738
|
+
return { ok: true };
|
|
7739
|
+
}
|
|
7740
|
+
async resizeTerminal(request, id, body) {
|
|
7741
|
+
const { context, activeEntry } = await this.resolveRequest(request);
|
|
7742
|
+
this.terminalManager.resizeTerminal(id, this.getTerminalScopeKey(activeEntry, context), body);
|
|
7743
|
+
return { ok: true };
|
|
7744
|
+
}
|
|
7745
|
+
async closeTerminal(request, id) {
|
|
7746
|
+
const { context, activeEntry } = await this.resolveRequest(request);
|
|
7747
|
+
await this.terminalManager.closeTerminal(id, this.getTerminalScopeKey(activeEntry, context));
|
|
7748
|
+
return { ok: true };
|
|
7749
|
+
}
|
|
6659
7750
|
async highlightCode(code, language) {
|
|
6660
7751
|
const text = typeof code === "string" ? code : "";
|
|
6661
7752
|
try {
|
|
@@ -6713,6 +7804,7 @@ var PicoRuntime = class {
|
|
|
6713
7804
|
pending.resolve({ cancelled: true });
|
|
6714
7805
|
} catch {}
|
|
6715
7806
|
this.pendingUiRequests.clear();
|
|
7807
|
+
this.terminalManager.dispose();
|
|
6716
7808
|
await Promise.all([...this.sessionEntries.values()].map((entry) => this.disposeSessionEntry(entry)));
|
|
6717
7809
|
}
|
|
6718
7810
|
};
|
|
@@ -6720,7 +7812,7 @@ function getPicoRuntime() {
|
|
|
6720
7812
|
globalThis.__picoRuntime ??= new PicoRuntime();
|
|
6721
7813
|
return globalThis.__picoRuntime;
|
|
6722
7814
|
}
|
|
6723
|
-
var Route$
|
|
7815
|
+
var Route$60 = createFileRoute("/events")({ server: { handlers: { GET: ({ request }) => getPicoRuntime().createEventsResponse(request) } } });
|
|
6724
7816
|
function jsonResponse(data, init = 200) {
|
|
6725
7817
|
const responseInit = typeof init === "number" ? { status: init } : init;
|
|
6726
7818
|
const headers = new Headers(responseInit.headers);
|
|
@@ -6756,7 +7848,7 @@ function routeErrorResponse(error, fallbackMessage) {
|
|
|
6756
7848
|
async function readRequestJson(request) {
|
|
6757
7849
|
return await request.json().catch(() => ({}));
|
|
6758
7850
|
}
|
|
6759
|
-
var Route$
|
|
7851
|
+
var Route$59 = createFileRoute("/api/thinking")({ server: { handlers: { POST: async ({ request }) => {
|
|
6760
7852
|
try {
|
|
6761
7853
|
const body = await readRequestJson(request);
|
|
6762
7854
|
return jsonResponse(await getPicoRuntime().setThinking(request, body));
|
|
@@ -6764,7 +7856,15 @@ var Route$51 = createFileRoute("/api/thinking")({ server: { handlers: { POST: as
|
|
|
6764
7856
|
return routeErrorResponse(error, "Failed to update thinking level");
|
|
6765
7857
|
}
|
|
6766
7858
|
} } } });
|
|
6767
|
-
var Route$
|
|
7859
|
+
var Route$58 = createFileRoute("/api/terminal")({ server: { handlers: { POST: async ({ request }) => {
|
|
7860
|
+
try {
|
|
7861
|
+
const body = await readRequestJson(request);
|
|
7862
|
+
return jsonResponse(await getPicoRuntime().createTerminal(request, body));
|
|
7863
|
+
} catch (error) {
|
|
7864
|
+
return routeErrorResponse(error, "Failed to create terminal");
|
|
7865
|
+
}
|
|
7866
|
+
} } } });
|
|
7867
|
+
var Route$57 = createFileRoute("/api/slash-command")({ server: { handlers: { POST: async ({ request }) => {
|
|
6768
7868
|
try {
|
|
6769
7869
|
const body = await readRequestJson(request);
|
|
6770
7870
|
return jsonResponse(await getPicoRuntime().runSlashCommand(request, body));
|
|
@@ -6772,7 +7872,7 @@ var Route$50 = createFileRoute("/api/slash-command")({ server: { handlers: { POS
|
|
|
6772
7872
|
return routeErrorResponse(error, "Failed to run slash command");
|
|
6773
7873
|
}
|
|
6774
7874
|
} } } });
|
|
6775
|
-
var Route$
|
|
7875
|
+
var Route$56 = createFileRoute("/api/provider-usage")({ server: { handlers: { GET: async ({ request }) => {
|
|
6776
7876
|
const provider = new URL(request.url).searchParams.get("provider") || void 0;
|
|
6777
7877
|
try {
|
|
6778
7878
|
return jsonResponse({
|
|
@@ -6783,7 +7883,7 @@ var Route$49 = createFileRoute("/api/provider-usage")({ server: { handlers: { GE
|
|
|
6783
7883
|
return routeErrorResponse(error, "Failed to read provider usage");
|
|
6784
7884
|
}
|
|
6785
7885
|
} } } });
|
|
6786
|
-
var Route$
|
|
7886
|
+
var Route$55 = createFileRoute("/api/prompt")({ server: { handlers: { POST: async ({ request }) => {
|
|
6787
7887
|
try {
|
|
6788
7888
|
const body = await readRequestJson(request);
|
|
6789
7889
|
return jsonResponse(await getPicoRuntime().prompt(request, body));
|
|
@@ -7338,7 +8438,7 @@ async function listFileReferenceEntries(query, baseCwd, { isQuotedPrefix = false
|
|
|
7338
8438
|
};
|
|
7339
8439
|
});
|
|
7340
8440
|
}
|
|
7341
|
-
var Route$
|
|
8441
|
+
var Route$54 = createFileRoute("/api/path-completions")({ server: { handlers: { POST: async ({ request }) => {
|
|
7342
8442
|
try {
|
|
7343
8443
|
const body = await readRequestJson(request);
|
|
7344
8444
|
const { context, activeEntry } = await getPicoRuntime().resolveRequest(request);
|
|
@@ -7354,7 +8454,7 @@ var Route$47 = createFileRoute("/api/path-completions")({ server: { handlers: {
|
|
|
7354
8454
|
return routeErrorResponse(error, "Failed to list path completions");
|
|
7355
8455
|
}
|
|
7356
8456
|
} } } });
|
|
7357
|
-
var Route$
|
|
8457
|
+
var Route$53 = createFileRoute("/api/model")({ server: { handlers: { POST: async ({ request }) => {
|
|
7358
8458
|
try {
|
|
7359
8459
|
const body = await readRequestJson(request);
|
|
7360
8460
|
return jsonResponse(await getPicoRuntime().setModel(request, body));
|
|
@@ -7362,7 +8462,7 @@ var Route$46 = createFileRoute("/api/model")({ server: { handlers: { POST: async
|
|
|
7362
8462
|
return routeErrorResponse(error, "Failed to update model");
|
|
7363
8463
|
}
|
|
7364
8464
|
} } } });
|
|
7365
|
-
var Route$
|
|
8465
|
+
var Route$52 = createFileRoute("/api/highlight")({ server: { handlers: { POST: async ({ request }) => {
|
|
7366
8466
|
try {
|
|
7367
8467
|
const body = await readRequestJson(request);
|
|
7368
8468
|
return jsonResponse(await getPicoRuntime().highlightCode(body.code, body.language));
|
|
@@ -7370,7 +8470,7 @@ var Route$45 = createFileRoute("/api/highlight")({ server: { handlers: { POST: a
|
|
|
7370
8470
|
return routeErrorResponse(error, "Failed to highlight code");
|
|
7371
8471
|
}
|
|
7372
8472
|
} } } });
|
|
7373
|
-
var Route$
|
|
8473
|
+
var Route$51 = createFileRoute("/api/git-status")({ server: { handlers: { GET: async ({ request }) => {
|
|
7374
8474
|
const requestedCwd = new URL(request.url).searchParams.get("cwd") || "";
|
|
7375
8475
|
if (!requestedCwd.trim()) return errorResponse("cwd is required");
|
|
7376
8476
|
try {
|
|
@@ -7385,10 +8485,12 @@ var Route$44 = createFileRoute("/api/git-status")({ server: { handlers: { GET: a
|
|
|
7385
8485
|
return routeErrorResponse(error, "Failed to read git status");
|
|
7386
8486
|
}
|
|
7387
8487
|
} } } });
|
|
7388
|
-
var Route$
|
|
8488
|
+
var Route$50 = createFileRoute("/api/git-stage")({ server: { handlers: { POST: async ({ request }) => {
|
|
8489
|
+
let errorFallback = "Failed to stage changes";
|
|
7389
8490
|
try {
|
|
7390
8491
|
const body = await readRequestJson(request);
|
|
7391
8492
|
const action = typeof body.action === "string" ? body.action : "";
|
|
8493
|
+
if (action === "unstage" || action === "unstage-all") errorFallback = "Failed to unstage changes";
|
|
7392
8494
|
const all = body.all === true;
|
|
7393
8495
|
const requestedCwd = typeof body.cwd === "string" ? body.cwd : "";
|
|
7394
8496
|
const path = typeof body.path === "string" ? body.path : "";
|
|
@@ -7397,7 +8499,7 @@ var Route$43 = createFileRoute("/api/git-stage")({ server: { handlers: { POST: a
|
|
|
7397
8499
|
if (!path.trim() && !all && action !== "stage-all" && action !== "unstage-all") throw new Error("file path is required");
|
|
7398
8500
|
const { context, activeEntry } = await getPicoRuntime().resolveRequest(request);
|
|
7399
8501
|
const cwd = await resolveDirectoryPath(requestedCwd, getPicoRuntime().getBaseCwd(activeEntry, context));
|
|
7400
|
-
const result = action === "unstage-all" ? await unstageDirectoryGitAll(cwd) : all || action === "stage-all" ? await stageDirectoryGitAll(cwd) : await stageDirectoryGitFile(cwd, path, previousPath || void 0);
|
|
8502
|
+
const result = action === "unstage-all" ? await unstageDirectoryGitAll(cwd) : action === "unstage" ? await unstageDirectoryGitFile(cwd, path, previousPath || void 0) : all || action === "stage-all" ? await stageDirectoryGitAll(cwd) : await stageDirectoryGitFile(cwd, path, previousPath || void 0);
|
|
7401
8503
|
return jsonResponse({
|
|
7402
8504
|
ok: true,
|
|
7403
8505
|
cwd,
|
|
@@ -7405,10 +8507,10 @@ var Route$43 = createFileRoute("/api/git-stage")({ server: { handlers: { POST: a
|
|
|
7405
8507
|
stderr: result.stderr
|
|
7406
8508
|
});
|
|
7407
8509
|
} catch (error) {
|
|
7408
|
-
return routeErrorResponse(error,
|
|
8510
|
+
return routeErrorResponse(error, errorFallback);
|
|
7409
8511
|
}
|
|
7410
8512
|
} } } });
|
|
7411
|
-
var Route$
|
|
8513
|
+
var Route$49 = createFileRoute("/api/git-review")({ server: { handlers: { GET: async ({ request }) => {
|
|
7412
8514
|
const url = new URL(request.url);
|
|
7413
8515
|
const requestedCwd = url.searchParams.get("cwd") || "";
|
|
7414
8516
|
const requestedPath = url.searchParams.get("path") || "";
|
|
@@ -7431,7 +8533,7 @@ var Route$42 = createFileRoute("/api/git-review")({ server: { handlers: { GET: a
|
|
|
7431
8533
|
return routeErrorResponse(error, "Failed to read git review file");
|
|
7432
8534
|
}
|
|
7433
8535
|
} } } });
|
|
7434
|
-
var Route$
|
|
8536
|
+
var Route$48 = createFileRoute("/api/git-push")({ server: { handlers: { POST: async ({ request }) => {
|
|
7435
8537
|
try {
|
|
7436
8538
|
const body = await readRequestJson(request);
|
|
7437
8539
|
const requestedCwd = typeof body.cwd === "string" ? body.cwd : "";
|
|
@@ -7450,7 +8552,7 @@ var Route$41 = createFileRoute("/api/git-push")({ server: { handlers: { POST: as
|
|
|
7450
8552
|
return routeErrorResponse(error, "Failed to push changes");
|
|
7451
8553
|
}
|
|
7452
8554
|
} } } });
|
|
7453
|
-
var Route$
|
|
8555
|
+
var Route$47 = createFileRoute("/api/git-pull")({ server: { handlers: { POST: async ({ request }) => {
|
|
7454
8556
|
try {
|
|
7455
8557
|
const body = await readRequestJson(request);
|
|
7456
8558
|
const requestedCwd = typeof body.cwd === "string" ? body.cwd : "";
|
|
@@ -7468,7 +8570,7 @@ var Route$40 = createFileRoute("/api/git-pull")({ server: { handlers: { POST: as
|
|
|
7468
8570
|
return routeErrorResponse(error, "Failed to pull changes");
|
|
7469
8571
|
}
|
|
7470
8572
|
} } } });
|
|
7471
|
-
var Route$
|
|
8573
|
+
var Route$46 = createFileRoute("/api/git-discard")({ server: { handlers: { POST: async ({ request }) => {
|
|
7472
8574
|
try {
|
|
7473
8575
|
const body = await readRequestJson(request);
|
|
7474
8576
|
const action = typeof body.action === "string" ? body.action : "";
|
|
@@ -7492,7 +8594,7 @@ var Route$39 = createFileRoute("/api/git-discard")({ server: { handlers: { POST:
|
|
|
7492
8594
|
return routeErrorResponse(error, "Failed to discard changes");
|
|
7493
8595
|
}
|
|
7494
8596
|
} } } });
|
|
7495
|
-
var Route$
|
|
8597
|
+
var Route$45 = createFileRoute("/api/git-diff")({ server: { handlers: { GET: async ({ request }) => {
|
|
7496
8598
|
const url = new URL(request.url);
|
|
7497
8599
|
const requestedCwd = url.searchParams.get("cwd") || "";
|
|
7498
8600
|
const requestedPath = url.searchParams.get("path") || "";
|
|
@@ -7512,7 +8614,7 @@ var Route$38 = createFileRoute("/api/git-diff")({ server: { handlers: { GET: asy
|
|
|
7512
8614
|
return routeErrorResponse(error, "Failed to read git diff");
|
|
7513
8615
|
}
|
|
7514
8616
|
} } } });
|
|
7515
|
-
var Route$
|
|
8617
|
+
var Route$44 = createFileRoute("/api/git-commit-remote-url")({ server: { handlers: { GET: async ({ request }) => {
|
|
7516
8618
|
try {
|
|
7517
8619
|
const url = new URL(request.url);
|
|
7518
8620
|
const requestedCwd = url.searchParams.get("cwd") || "";
|
|
@@ -7533,7 +8635,7 @@ var Route$37 = createFileRoute("/api/git-commit-remote-url")({ server: { handler
|
|
|
7533
8635
|
return routeErrorResponse(error, "Failed to read commit remote URL");
|
|
7534
8636
|
}
|
|
7535
8637
|
} } } });
|
|
7536
|
-
var Route$
|
|
8638
|
+
var Route$43 = createFileRoute("/api/git-commit-message")({ server: { handlers: { POST: async ({ request }) => {
|
|
7537
8639
|
try {
|
|
7538
8640
|
const body = await readRequestJson(request);
|
|
7539
8641
|
const requestedCwd = typeof body.cwd === "string" ? body.cwd : "";
|
|
@@ -7552,7 +8654,7 @@ var Route$36 = createFileRoute("/api/git-commit-message")({ server: { handlers:
|
|
|
7552
8654
|
return routeErrorResponse(error, "Failed to generate commit message");
|
|
7553
8655
|
}
|
|
7554
8656
|
} } } });
|
|
7555
|
-
var Route$
|
|
8657
|
+
var Route$42 = createFileRoute("/api/git-commit-files")({ server: { handlers: { GET: async ({ request }) => {
|
|
7556
8658
|
try {
|
|
7557
8659
|
const url = new URL(request.url);
|
|
7558
8660
|
const requestedCwd = url.searchParams.get("cwd") || "";
|
|
@@ -7575,7 +8677,7 @@ function normalizeGitCommitDiffMode(value) {
|
|
|
7575
8677
|
if (value === "head" || value === "previous") return value;
|
|
7576
8678
|
return "commit";
|
|
7577
8679
|
}
|
|
7578
|
-
var Route$
|
|
8680
|
+
var Route$41 = createFileRoute("/api/git-commit-diff")({ server: { handlers: { GET: async ({ request }) => {
|
|
7579
8681
|
try {
|
|
7580
8682
|
const url = new URL(request.url);
|
|
7581
8683
|
const requestedCwd = url.searchParams.get("cwd") || "";
|
|
@@ -7612,7 +8714,7 @@ var gitCommitActions = new Set([
|
|
|
7612
8714
|
"drop",
|
|
7613
8715
|
"squash"
|
|
7614
8716
|
]);
|
|
7615
|
-
var Route$
|
|
8717
|
+
var Route$40 = createFileRoute("/api/git-commit-action")({ server: { handlers: { POST: async ({ request }) => {
|
|
7616
8718
|
try {
|
|
7617
8719
|
const body = await readRequestJson(request);
|
|
7618
8720
|
const requestedCwd = typeof body.cwd === "string" ? body.cwd : "";
|
|
@@ -7638,7 +8740,7 @@ var Route$33 = createFileRoute("/api/git-commit-action")({ server: { handlers: {
|
|
|
7638
8740
|
return routeErrorResponse(error, "Failed to run commit action");
|
|
7639
8741
|
}
|
|
7640
8742
|
} } } });
|
|
7641
|
-
var Route$
|
|
8743
|
+
var Route$39 = createFileRoute("/api/git-commit")({ server: { handlers: { POST: async ({ request }) => {
|
|
7642
8744
|
try {
|
|
7643
8745
|
const body = await readRequestJson(request);
|
|
7644
8746
|
const requestedCwd = typeof body.cwd === "string" ? body.cwd : "";
|
|
@@ -7663,7 +8765,7 @@ var Route$32 = createFileRoute("/api/git-commit")({ server: { handlers: { POST:
|
|
|
7663
8765
|
return routeErrorResponse(error, "Failed to commit changes");
|
|
7664
8766
|
}
|
|
7665
8767
|
} } } });
|
|
7666
|
-
var Route$
|
|
8768
|
+
var Route$38 = createFileRoute("/api/git-checkout")({ server: { handlers: { POST: async ({ request }) => {
|
|
7667
8769
|
try {
|
|
7668
8770
|
const body = await readRequestJson(request);
|
|
7669
8771
|
const requestedCwd = typeof body.cwd === "string" ? body.cwd : "";
|
|
@@ -7713,7 +8815,7 @@ function getRuntimeRequestForGitChanges(request, url) {
|
|
|
7713
8815
|
method: request.method
|
|
7714
8816
|
});
|
|
7715
8817
|
}
|
|
7716
|
-
var Route$
|
|
8818
|
+
var Route$37 = createFileRoute("/api/git-changes")({ server: { handlers: { GET: async ({ request }) => {
|
|
7717
8819
|
const url = new URL(request.url);
|
|
7718
8820
|
const requestedCwd = url.searchParams.get("cwd") || "";
|
|
7719
8821
|
const gitScope = getGitChangesScope(url);
|
|
@@ -7783,7 +8885,7 @@ var Route$30 = createFileRoute("/api/git-changes")({ server: { handlers: { GET:
|
|
|
7783
8885
|
return routeErrorResponse(error, "Failed to read git changes");
|
|
7784
8886
|
}
|
|
7785
8887
|
} } } });
|
|
7786
|
-
var Route$
|
|
8888
|
+
var Route$36 = createFileRoute("/api/file-completions")({ server: { handlers: { POST: async ({ request }) => {
|
|
7787
8889
|
try {
|
|
7788
8890
|
const body = await readRequestJson(request);
|
|
7789
8891
|
const { context, activeEntry } = await getPicoRuntime().resolveRequest(request);
|
|
@@ -7800,7 +8902,7 @@ var Route$29 = createFileRoute("/api/file-completions")({ server: { handlers: {
|
|
|
7800
8902
|
return routeErrorResponse(error, "Failed to list file completions");
|
|
7801
8903
|
}
|
|
7802
8904
|
} } } });
|
|
7803
|
-
var Route$
|
|
8905
|
+
var Route$35 = createFileRoute("/api/directory-sessions-indexes")({ server: { handlers: { GET: async ({ request }) => {
|
|
7804
8906
|
const directories = new URL(request.url).searchParams.getAll("directory");
|
|
7805
8907
|
if (directories.length === 0) return errorResponse("at least one directory is required");
|
|
7806
8908
|
try {
|
|
@@ -7809,7 +8911,7 @@ var Route$28 = createFileRoute("/api/directory-sessions-indexes")({ server: { ha
|
|
|
7809
8911
|
return routeErrorResponse(error, "Failed to list directory session indexes");
|
|
7810
8912
|
}
|
|
7811
8913
|
} } } });
|
|
7812
|
-
var Route$
|
|
8914
|
+
var Route$34 = createFileRoute("/api/directory-sessions-index")({ server: { handlers: { GET: async ({ request }) => {
|
|
7813
8915
|
const directory = new URL(request.url).searchParams.get("directory") || "";
|
|
7814
8916
|
if (!directory.trim()) return errorResponse("directory is required");
|
|
7815
8917
|
try {
|
|
@@ -7818,7 +8920,7 @@ var Route$27 = createFileRoute("/api/directory-sessions-index")({ server: { hand
|
|
|
7818
8920
|
return routeErrorResponse(error, "Failed to list directory session index");
|
|
7819
8921
|
}
|
|
7820
8922
|
} } } });
|
|
7821
|
-
var Route$
|
|
8923
|
+
var Route$33 = createFileRoute("/api/directory-sessions")({ server: { handlers: { GET: async ({ request }) => {
|
|
7822
8924
|
const url = new URL(request.url);
|
|
7823
8925
|
const directory = url.searchParams.get("directory") || "";
|
|
7824
8926
|
const offset = Number.parseInt(url.searchParams.get("offset") || "0", 10);
|
|
@@ -7833,7 +8935,7 @@ var Route$26 = createFileRoute("/api/directory-sessions")({ server: { handlers:
|
|
|
7833
8935
|
return routeErrorResponse(error, "Failed to list directory sessions");
|
|
7834
8936
|
}
|
|
7835
8937
|
} } } });
|
|
7836
|
-
var Route$
|
|
8938
|
+
var Route$32 = createFileRoute("/api/directory-search")({ server: { handlers: { POST: async ({ request }) => {
|
|
7837
8939
|
try {
|
|
7838
8940
|
const body = await readRequestJson(request);
|
|
7839
8941
|
const { context, activeEntry } = await getPicoRuntime().resolveRequest(request);
|
|
@@ -7849,14 +8951,14 @@ var Route$25 = createFileRoute("/api/directory-search")({ server: { handlers: {
|
|
|
7849
8951
|
return routeErrorResponse(error, "Failed to search directories");
|
|
7850
8952
|
}
|
|
7851
8953
|
} } } });
|
|
7852
|
-
var Route$
|
|
8954
|
+
var Route$31 = createFileRoute("/api/abort")({ server: { handlers: { POST: async ({ request }) => {
|
|
7853
8955
|
try {
|
|
7854
8956
|
return jsonResponse(await getPicoRuntime().abort(request));
|
|
7855
8957
|
} catch (error) {
|
|
7856
8958
|
return routeErrorResponse(error, "Failed to abort session");
|
|
7857
8959
|
}
|
|
7858
8960
|
} } } });
|
|
7859
|
-
var Route$
|
|
8961
|
+
var Route$30 = createFileRoute("/api/ui/$id")({ server: { handlers: { POST: async ({ request, params }) => {
|
|
7860
8962
|
try {
|
|
7861
8963
|
const body = await readRequestJson(request);
|
|
7862
8964
|
return jsonResponse(await getPicoRuntime().resolveUiRequest(params.id, body));
|
|
@@ -7864,7 +8966,7 @@ var Route$23 = createFileRoute("/api/ui/$id")({ server: { handlers: { POST: asyn
|
|
|
7864
8966
|
return routeErrorResponse(error, "Failed to resolve UI request");
|
|
7865
8967
|
}
|
|
7866
8968
|
} } } });
|
|
7867
|
-
var Route$
|
|
8969
|
+
var Route$29 = createFileRoute("/api/settings/hide-thinking")({ server: { handlers: { POST: async ({ request }) => {
|
|
7868
8970
|
try {
|
|
7869
8971
|
const body = await readRequestJson(request);
|
|
7870
8972
|
return jsonResponse(await getPicoRuntime().setHideThinking(body));
|
|
@@ -7872,7 +8974,7 @@ var Route$22 = createFileRoute("/api/settings/hide-thinking")({ server: { handle
|
|
|
7872
8974
|
return routeErrorResponse(error, "Failed to update hide-thinking setting");
|
|
7873
8975
|
}
|
|
7874
8976
|
} } } });
|
|
7875
|
-
var Route$
|
|
8977
|
+
var Route$28 = createFileRoute("/api/sessions/delete")({ server: { handlers: { POST: async ({ request }) => {
|
|
7876
8978
|
try {
|
|
7877
8979
|
const body = await readRequestJson(request);
|
|
7878
8980
|
return jsonResponse(await getPicoRuntime().deleteSessions(request, body));
|
|
@@ -7880,7 +8982,7 @@ var Route$21 = createFileRoute("/api/sessions/delete")({ server: { handlers: { P
|
|
|
7880
8982
|
return routeErrorResponse(error, "Failed to delete sessions");
|
|
7881
8983
|
}
|
|
7882
8984
|
} } } });
|
|
7883
|
-
var Route$
|
|
8985
|
+
var Route$27 = createFileRoute("/api/session/tree")({ server: { handlers: {
|
|
7884
8986
|
GET: async ({ request }) => {
|
|
7885
8987
|
try {
|
|
7886
8988
|
return jsonResponse(await getPicoRuntime().getSessionTreeForRequest(request));
|
|
@@ -7897,14 +8999,14 @@ var Route$20 = createFileRoute("/api/session/tree")({ server: { handlers: {
|
|
|
7897
8999
|
}
|
|
7898
9000
|
}
|
|
7899
9001
|
} } });
|
|
7900
|
-
var Route$
|
|
9002
|
+
var Route$26 = createFileRoute("/api/session/select")({ server: { handlers: { POST: async ({ request }) => {
|
|
7901
9003
|
try {
|
|
7902
9004
|
return jsonResponse(await getPicoRuntime().selectSession(request));
|
|
7903
9005
|
} catch (error) {
|
|
7904
9006
|
return routeErrorResponse(error, "Failed to select session");
|
|
7905
9007
|
}
|
|
7906
9008
|
} } } });
|
|
7907
|
-
var Route$
|
|
9009
|
+
var Route$25 = createFileRoute("/api/session/rename")({ server: { handlers: { POST: async ({ request }) => {
|
|
7908
9010
|
try {
|
|
7909
9011
|
const body = await readRequestJson(request);
|
|
7910
9012
|
return jsonResponse(await getPicoRuntime().renameSession(body));
|
|
@@ -7912,7 +9014,7 @@ var Route$18 = createFileRoute("/api/session/rename")({ server: { handlers: { PO
|
|
|
7912
9014
|
return routeErrorResponse(error, "Failed to rename session");
|
|
7913
9015
|
}
|
|
7914
9016
|
} } } });
|
|
7915
|
-
var Route$
|
|
9017
|
+
var Route$24 = createFileRoute("/api/session/read-state")({ server: { handlers: { POST: async ({ request }) => {
|
|
7916
9018
|
try {
|
|
7917
9019
|
const body = await readRequestJson(request);
|
|
7918
9020
|
return jsonResponse(await getPicoRuntime().setSessionReadState(request, body));
|
|
@@ -7920,7 +9022,7 @@ var Route$17 = createFileRoute("/api/session/read-state")({ server: { handlers:
|
|
|
7920
9022
|
return routeErrorResponse(error, "Failed to update session read state");
|
|
7921
9023
|
}
|
|
7922
9024
|
} } } });
|
|
7923
|
-
var Route$
|
|
9025
|
+
var Route$23 = createFileRoute("/api/session/new")({ server: { handlers: { POST: async ({ request }) => {
|
|
7924
9026
|
try {
|
|
7925
9027
|
const body = await readRequestJson(request);
|
|
7926
9028
|
return jsonResponse(await getPicoRuntime().createNewSession(request, body));
|
|
@@ -7928,7 +9030,15 @@ var Route$16 = createFileRoute("/api/session/new")({ server: { handlers: { POST:
|
|
|
7928
9030
|
return routeErrorResponse(error, "Failed to create session");
|
|
7929
9031
|
}
|
|
7930
9032
|
} } } });
|
|
7931
|
-
var Route$
|
|
9033
|
+
var Route$22 = createFileRoute("/api/session/name")({ server: { handlers: { POST: async ({ request }) => {
|
|
9034
|
+
try {
|
|
9035
|
+
const body = await readRequestJson(request);
|
|
9036
|
+
return jsonResponse(await getPicoRuntime().generateSessionName(request, body));
|
|
9037
|
+
} catch (error) {
|
|
9038
|
+
return routeErrorResponse(error, "Failed to generate session name");
|
|
9039
|
+
}
|
|
9040
|
+
} } } });
|
|
9041
|
+
var Route$21 = createFileRoute("/api/session/move")({ server: { handlers: { POST: async ({ request }) => {
|
|
7932
9042
|
try {
|
|
7933
9043
|
const body = await readRequestJson(request);
|
|
7934
9044
|
return jsonResponse(await getPicoRuntime().moveSession(request, body));
|
|
@@ -7936,7 +9046,7 @@ var Route$15 = createFileRoute("/api/session/move")({ server: { handlers: { POST
|
|
|
7936
9046
|
return routeErrorResponse(error, "Failed to move session");
|
|
7937
9047
|
}
|
|
7938
9048
|
} } } });
|
|
7939
|
-
var Route$
|
|
9049
|
+
var Route$20 = createFileRoute("/api/session/history")({ server: { handlers: { GET: async ({ request }) => {
|
|
7940
9050
|
try {
|
|
7941
9051
|
const url = new URL(request.url);
|
|
7942
9052
|
const before = Number(url.searchParams.get("before"));
|
|
@@ -7949,7 +9059,7 @@ var Route$14 = createFileRoute("/api/session/history")({ server: { handlers: { G
|
|
|
7949
9059
|
return routeErrorResponse(error, "Failed to load session history");
|
|
7950
9060
|
}
|
|
7951
9061
|
} } } });
|
|
7952
|
-
var Route$
|
|
9062
|
+
var Route$19 = createFileRoute("/api/session/fork")({ server: { handlers: {
|
|
7953
9063
|
GET: async ({ request }) => {
|
|
7954
9064
|
try {
|
|
7955
9065
|
return jsonResponse(await getPicoRuntime().getForkableMessages(request));
|
|
@@ -7966,7 +9076,7 @@ var Route$13 = createFileRoute("/api/session/fork")({ server: { handlers: {
|
|
|
7966
9076
|
}
|
|
7967
9077
|
}
|
|
7968
9078
|
} } });
|
|
7969
|
-
var Route$
|
|
9079
|
+
var Route$18 = createFileRoute("/api/session/delete")({ server: { handlers: { POST: async ({ request }) => {
|
|
7970
9080
|
try {
|
|
7971
9081
|
const body = await readRequestJson(request);
|
|
7972
9082
|
return jsonResponse(await getPicoRuntime().deleteSession(request, body));
|
|
@@ -7974,14 +9084,21 @@ var Route$12 = createFileRoute("/api/session/delete")({ server: { handlers: { PO
|
|
|
7974
9084
|
return routeErrorResponse(error, "Failed to delete session");
|
|
7975
9085
|
}
|
|
7976
9086
|
} } } });
|
|
7977
|
-
var Route$
|
|
9087
|
+
var Route$17 = createFileRoute("/api/session/clone")({ server: { handlers: { POST: async ({ request }) => {
|
|
7978
9088
|
try {
|
|
7979
9089
|
return jsonResponse(await getPicoRuntime().cloneSession(request));
|
|
7980
9090
|
} catch (error) {
|
|
7981
9091
|
return routeErrorResponse(error, "Failed to clone session");
|
|
7982
9092
|
}
|
|
7983
9093
|
} } } });
|
|
7984
|
-
var Route$
|
|
9094
|
+
var Route$16 = createFileRoute("/api/pending-messages/start")({ server: { handlers: { POST: async ({ request }) => {
|
|
9095
|
+
try {
|
|
9096
|
+
return jsonResponse(await getPicoRuntime().startPendingQueue(request));
|
|
9097
|
+
} catch (error) {
|
|
9098
|
+
return routeErrorResponse(error, "Failed to start queued prompts");
|
|
9099
|
+
}
|
|
9100
|
+
} } } });
|
|
9101
|
+
var Route$15 = createFileRoute("/api/pending-messages/reorder")({ server: { handlers: { POST: async ({ request }) => {
|
|
7985
9102
|
try {
|
|
7986
9103
|
const body = await readRequestJson(request);
|
|
7987
9104
|
return jsonResponse(await getPicoRuntime().reorderPendingMessages(request, body));
|
|
@@ -7989,7 +9106,7 @@ var Route$10 = createFileRoute("/api/pending-messages/reorder")({ server: { hand
|
|
|
7989
9106
|
return routeErrorResponse(error, "Failed to update pending prompts");
|
|
7990
9107
|
}
|
|
7991
9108
|
} } } });
|
|
7992
|
-
var Route$
|
|
9109
|
+
var Route$14 = createFileRoute("/api/pending-message/remove")({ server: { handlers: { POST: async ({ request }) => {
|
|
7993
9110
|
try {
|
|
7994
9111
|
const body = await readRequestJson(request);
|
|
7995
9112
|
return jsonResponse(await getPicoRuntime().removePendingMessage(request, body));
|
|
@@ -7997,7 +9114,7 @@ var Route$9 = createFileRoute("/api/pending-message/remove")({ server: { handler
|
|
|
7997
9114
|
return routeErrorResponse(error, "Failed to remove pending prompt");
|
|
7998
9115
|
}
|
|
7999
9116
|
} } } });
|
|
8000
|
-
var Route$
|
|
9117
|
+
var Route$13 = createFileRoute("/api/files/tree")({ server: { handlers: { GET: async ({ request }) => {
|
|
8001
9118
|
const requestedCwd = new URL(request.url).searchParams.get("cwd") || "";
|
|
8002
9119
|
if (!requestedCwd.trim()) return errorResponse("cwd is required");
|
|
8003
9120
|
try {
|
|
@@ -8014,7 +9131,7 @@ var Route$8 = createFileRoute("/api/files/tree")({ server: { handlers: { GET: as
|
|
|
8014
9131
|
return routeErrorResponse(error, "Failed to read file tree");
|
|
8015
9132
|
}
|
|
8016
9133
|
} } } });
|
|
8017
|
-
var Route$
|
|
9134
|
+
var Route$12 = createFileRoute("/api/files/read")({ server: { handlers: { GET: async ({ request }) => {
|
|
8018
9135
|
const url = new URL(request.url);
|
|
8019
9136
|
const requestedCwd = url.searchParams.get("cwd") || "";
|
|
8020
9137
|
const requestedPath = url.searchParams.get("path") || "";
|
|
@@ -8034,7 +9151,7 @@ var Route$7 = createFileRoute("/api/files/read")({ server: { handlers: { GET: as
|
|
|
8034
9151
|
return routeErrorResponse(error, "Failed to read file");
|
|
8035
9152
|
}
|
|
8036
9153
|
} } } });
|
|
8037
|
-
var Route$
|
|
9154
|
+
var Route$11 = createFileRoute("/api/directory/resolve")({ server: { handlers: { POST: async ({ request }) => {
|
|
8038
9155
|
try {
|
|
8039
9156
|
const body = await readRequestJson(request);
|
|
8040
9157
|
const { context, activeEntry } = await getPicoRuntime().resolveRequest(request);
|
|
@@ -8046,7 +9163,7 @@ var Route$6 = createFileRoute("/api/directory/resolve")({ server: { handlers: {
|
|
|
8046
9163
|
return routeErrorResponse(error, "Failed to resolve directory");
|
|
8047
9164
|
}
|
|
8048
9165
|
} } } });
|
|
8049
|
-
var Route$
|
|
9166
|
+
var Route$10 = createFileRoute("/api/directory-sessions/cleanup")({ server: { handlers: { POST: async ({ request }) => {
|
|
8050
9167
|
try {
|
|
8051
9168
|
const body = await readRequestJson(request);
|
|
8052
9169
|
return jsonResponse(await getPicoRuntime().deleteOldDirectorySessions(request, body));
|
|
@@ -8054,14 +9171,107 @@ var Route$5 = createFileRoute("/api/directory-sessions/cleanup")({ server: { han
|
|
|
8054
9171
|
return routeErrorResponse(error, "Failed to clean up sessions");
|
|
8055
9172
|
}
|
|
8056
9173
|
} } } });
|
|
8057
|
-
var
|
|
9174
|
+
var API_CONTRACT_VERSION = 1;
|
|
9175
|
+
function readPicoPackageVersion() {
|
|
9176
|
+
let currentDir = dirname(fileURLToPath(import.meta.url));
|
|
9177
|
+
while (currentDir && currentDir !== dirname(currentDir)) {
|
|
9178
|
+
const packageJsonPath = join(currentDir, "package.json");
|
|
9179
|
+
if (existsSync(packageJsonPath)) try {
|
|
9180
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
9181
|
+
if (packageJson.name === "@alivault/pico" && typeof packageJson.version === "string") return packageJson.version;
|
|
9182
|
+
} catch {
|
|
9183
|
+
return "0.0.0";
|
|
9184
|
+
}
|
|
9185
|
+
currentDir = dirname(currentDir);
|
|
9186
|
+
}
|
|
9187
|
+
return "0.0.0";
|
|
9188
|
+
}
|
|
9189
|
+
function buildClientManifest() {
|
|
9190
|
+
return {
|
|
9191
|
+
ok: true,
|
|
9192
|
+
name: "@alivault/pico",
|
|
9193
|
+
version: readPicoPackageVersion(),
|
|
9194
|
+
displayName: "Pico",
|
|
9195
|
+
apiContractVersion: API_CONTRACT_VERSION,
|
|
9196
|
+
pairingRequired: false,
|
|
9197
|
+
authentication: { type: "none" },
|
|
9198
|
+
transport: {
|
|
9199
|
+
sse: true,
|
|
9200
|
+
httpsRequired: false,
|
|
9201
|
+
localHttpAllowed: true
|
|
9202
|
+
},
|
|
9203
|
+
capabilities: {
|
|
9204
|
+
events: [
|
|
9205
|
+
"state_sync",
|
|
9206
|
+
"sessions",
|
|
9207
|
+
"session_status",
|
|
9208
|
+
"session_done",
|
|
9209
|
+
"request_error",
|
|
9210
|
+
"extension_error",
|
|
9211
|
+
"extension_ui_request",
|
|
9212
|
+
"user_message",
|
|
9213
|
+
"auto_session_naming_error",
|
|
9214
|
+
"git_changed"
|
|
9215
|
+
],
|
|
9216
|
+
endpoints: [
|
|
9217
|
+
"/events",
|
|
9218
|
+
"/api/prompt",
|
|
9219
|
+
"/api/abort",
|
|
9220
|
+
"/api/session/new",
|
|
9221
|
+
"/api/session/select",
|
|
9222
|
+
"/api/session/fork",
|
|
9223
|
+
"/api/session/name",
|
|
9224
|
+
"/api/session/rename",
|
|
9225
|
+
"/api/session/delete",
|
|
9226
|
+
"/api/session/read-state",
|
|
9227
|
+
"/api/directory-sessions-indexes",
|
|
9228
|
+
"/api/directory/resolve",
|
|
9229
|
+
"/api/directory-search",
|
|
9230
|
+
"/api/path-completions",
|
|
9231
|
+
"/api/model",
|
|
9232
|
+
"/api/thinking",
|
|
9233
|
+
"/api/auth/providers",
|
|
9234
|
+
"/api/auth/api-key",
|
|
9235
|
+
"/api/auth/oauth",
|
|
9236
|
+
"/api/auth/logout",
|
|
9237
|
+
"/api/ui/$id",
|
|
9238
|
+
"/api/settings/hide-thinking",
|
|
9239
|
+
"/api/pending-message/remove",
|
|
9240
|
+
"/api/pending-messages/reorder",
|
|
9241
|
+
"/api/pending-messages/start"
|
|
9242
|
+
],
|
|
9243
|
+
features: [
|
|
9244
|
+
"sse",
|
|
9245
|
+
"session-browser",
|
|
9246
|
+
"conversation",
|
|
9247
|
+
"prompt-composer",
|
|
9248
|
+
"queue-and-steer",
|
|
9249
|
+
"model-selection",
|
|
9250
|
+
"thinking-selection",
|
|
9251
|
+
"provider-authentication",
|
|
9252
|
+
"native-directory-browser",
|
|
9253
|
+
"post-compaction-token-estimates",
|
|
9254
|
+
"edit-user-message-fork",
|
|
9255
|
+
"assistant-message-actions"
|
|
9256
|
+
]
|
|
9257
|
+
}
|
|
9258
|
+
};
|
|
9259
|
+
}
|
|
9260
|
+
var Route$9 = createFileRoute("/api/client/manifest")({ server: { handlers: { GET: async () => {
|
|
9261
|
+
try {
|
|
9262
|
+
return jsonResponse(buildClientManifest());
|
|
9263
|
+
} catch (error) {
|
|
9264
|
+
return routeErrorResponse(error, "Failed to build client manifest");
|
|
9265
|
+
}
|
|
9266
|
+
} } } });
|
|
9267
|
+
var Route$8 = createFileRoute("/api/auth/providers")({ server: { handlers: { GET: async ({ request }) => {
|
|
8058
9268
|
try {
|
|
8059
9269
|
return jsonResponse(await getPicoRuntime().getAuthProviders(request));
|
|
8060
9270
|
} catch (error) {
|
|
8061
9271
|
return routeErrorResponse(error, "Failed to list auth providers");
|
|
8062
9272
|
}
|
|
8063
9273
|
} } } });
|
|
8064
|
-
var Route$
|
|
9274
|
+
var Route$7 = createFileRoute("/api/auth/oauth")({ server: { handlers: { POST: async ({ request }) => {
|
|
8065
9275
|
try {
|
|
8066
9276
|
const body = await readRequestJson(request);
|
|
8067
9277
|
return jsonResponse(await getPicoRuntime().loginProviderOAuth(request, body));
|
|
@@ -8069,7 +9279,7 @@ var Route$3 = createFileRoute("/api/auth/oauth")({ server: { handlers: { POST: a
|
|
|
8069
9279
|
return routeErrorResponse(error, "Failed to login to provider");
|
|
8070
9280
|
}
|
|
8071
9281
|
} } } });
|
|
8072
|
-
var Route$
|
|
9282
|
+
var Route$6 = createFileRoute("/api/auth/logout")({ server: { handlers: { POST: async ({ request }) => {
|
|
8073
9283
|
try {
|
|
8074
9284
|
const body = await readRequestJson(request);
|
|
8075
9285
|
return jsonResponse(await getPicoRuntime().logoutProvider(request, body));
|
|
@@ -8077,7 +9287,7 @@ var Route$2 = createFileRoute("/api/auth/logout")({ server: { handlers: { POST:
|
|
|
8077
9287
|
return routeErrorResponse(error, "Failed to logout from provider");
|
|
8078
9288
|
}
|
|
8079
9289
|
} } } });
|
|
8080
|
-
var Route$
|
|
9290
|
+
var Route$5 = createFileRoute("/api/auth/api-key")({ server: { handlers: { POST: async ({ request }) => {
|
|
8081
9291
|
try {
|
|
8082
9292
|
const body = await readRequestJson(request);
|
|
8083
9293
|
return jsonResponse(await getPicoRuntime().saveProviderApiKey(request, body));
|
|
@@ -8085,6 +9295,36 @@ var Route$1 = createFileRoute("/api/auth/api-key")({ server: { handlers: { POST:
|
|
|
8085
9295
|
return routeErrorResponse(error, "Failed to save provider API key");
|
|
8086
9296
|
}
|
|
8087
9297
|
} } } });
|
|
9298
|
+
var Route$4 = createFileRoute("/api/terminal/$id/resize")({ server: { handlers: { POST: async ({ request, params }) => {
|
|
9299
|
+
try {
|
|
9300
|
+
const body = await readRequestJson(request);
|
|
9301
|
+
return jsonResponse(await getPicoRuntime().resizeTerminal(request, params.id, body));
|
|
9302
|
+
} catch (error) {
|
|
9303
|
+
return routeErrorResponse(error, "Failed to resize terminal");
|
|
9304
|
+
}
|
|
9305
|
+
} } } });
|
|
9306
|
+
var Route$3 = createFileRoute("/api/terminal/$id/input")({ server: { handlers: { POST: async ({ request, params }) => {
|
|
9307
|
+
try {
|
|
9308
|
+
const body = await readRequestJson(request);
|
|
9309
|
+
return jsonResponse(await getPicoRuntime().writeTerminalInput(request, params.id, body));
|
|
9310
|
+
} catch (error) {
|
|
9311
|
+
return routeErrorResponse(error, "Failed to write terminal input");
|
|
9312
|
+
}
|
|
9313
|
+
} } } });
|
|
9314
|
+
var Route$2 = createFileRoute("/api/terminal/$id/events")({ server: { handlers: { GET: async ({ request, params }) => {
|
|
9315
|
+
try {
|
|
9316
|
+
return await getPicoRuntime().createTerminalEventsResponse(request, params.id);
|
|
9317
|
+
} catch (error) {
|
|
9318
|
+
return routeErrorResponse(error, "Failed to connect terminal");
|
|
9319
|
+
}
|
|
9320
|
+
} } } });
|
|
9321
|
+
var Route$1 = createFileRoute("/api/terminal/$id/close")({ server: { handlers: { POST: async ({ request, params }) => {
|
|
9322
|
+
try {
|
|
9323
|
+
return jsonResponse(await getPicoRuntime().closeTerminal(request, params.id));
|
|
9324
|
+
} catch (error) {
|
|
9325
|
+
return routeErrorResponse(error, "Failed to close terminal");
|
|
9326
|
+
}
|
|
9327
|
+
} } } });
|
|
8088
9328
|
var Route = createFileRoute("/api/session/tree/label")({ server: { handlers: { POST: async ({ request }) => {
|
|
8089
9329
|
try {
|
|
8090
9330
|
const body = await readRequestJson(request);
|
|
@@ -8093,270 +9333,310 @@ var Route = createFileRoute("/api/session/tree/label")({ server: { handlers: { P
|
|
|
8093
9333
|
return routeErrorResponse(error, "Failed to update tree label");
|
|
8094
9334
|
}
|
|
8095
9335
|
} } } });
|
|
8096
|
-
var EventsRoute = Route$
|
|
9336
|
+
var EventsRoute = Route$60.update({
|
|
8097
9337
|
id: "/events",
|
|
8098
9338
|
path: "/events",
|
|
8099
|
-
getParentRoute: () => Route$
|
|
9339
|
+
getParentRoute: () => Route$61
|
|
8100
9340
|
});
|
|
8101
|
-
var IndexRoute = Route$
|
|
9341
|
+
var IndexRoute = Route$62.update({
|
|
8102
9342
|
id: "/",
|
|
8103
9343
|
path: "/",
|
|
8104
|
-
getParentRoute: () => Route$
|
|
9344
|
+
getParentRoute: () => Route$61
|
|
8105
9345
|
});
|
|
8106
|
-
var ApiThinkingRoute = Route$
|
|
9346
|
+
var ApiThinkingRoute = Route$59.update({
|
|
8107
9347
|
id: "/api/thinking",
|
|
8108
9348
|
path: "/api/thinking",
|
|
8109
|
-
getParentRoute: () => Route$
|
|
9349
|
+
getParentRoute: () => Route$61
|
|
8110
9350
|
});
|
|
8111
|
-
var
|
|
9351
|
+
var ApiTerminalRoute = Route$58.update({
|
|
9352
|
+
id: "/api/terminal",
|
|
9353
|
+
path: "/api/terminal",
|
|
9354
|
+
getParentRoute: () => Route$61
|
|
9355
|
+
});
|
|
9356
|
+
var ApiSlashCommandRoute = Route$57.update({
|
|
8112
9357
|
id: "/api/slash-command",
|
|
8113
9358
|
path: "/api/slash-command",
|
|
8114
|
-
getParentRoute: () => Route$
|
|
9359
|
+
getParentRoute: () => Route$61
|
|
8115
9360
|
});
|
|
8116
|
-
var ApiProviderUsageRoute = Route$
|
|
9361
|
+
var ApiProviderUsageRoute = Route$56.update({
|
|
8117
9362
|
id: "/api/provider-usage",
|
|
8118
9363
|
path: "/api/provider-usage",
|
|
8119
|
-
getParentRoute: () => Route$
|
|
9364
|
+
getParentRoute: () => Route$61
|
|
8120
9365
|
});
|
|
8121
|
-
var ApiPromptRoute = Route$
|
|
9366
|
+
var ApiPromptRoute = Route$55.update({
|
|
8122
9367
|
id: "/api/prompt",
|
|
8123
9368
|
path: "/api/prompt",
|
|
8124
|
-
getParentRoute: () => Route$
|
|
9369
|
+
getParentRoute: () => Route$61
|
|
8125
9370
|
});
|
|
8126
|
-
var ApiPathCompletionsRoute = Route$
|
|
9371
|
+
var ApiPathCompletionsRoute = Route$54.update({
|
|
8127
9372
|
id: "/api/path-completions",
|
|
8128
9373
|
path: "/api/path-completions",
|
|
8129
|
-
getParentRoute: () => Route$
|
|
9374
|
+
getParentRoute: () => Route$61
|
|
8130
9375
|
});
|
|
8131
|
-
var ApiModelRoute = Route$
|
|
9376
|
+
var ApiModelRoute = Route$53.update({
|
|
8132
9377
|
id: "/api/model",
|
|
8133
9378
|
path: "/api/model",
|
|
8134
|
-
getParentRoute: () => Route$
|
|
9379
|
+
getParentRoute: () => Route$61
|
|
8135
9380
|
});
|
|
8136
|
-
var ApiHighlightRoute = Route$
|
|
9381
|
+
var ApiHighlightRoute = Route$52.update({
|
|
8137
9382
|
id: "/api/highlight",
|
|
8138
9383
|
path: "/api/highlight",
|
|
8139
|
-
getParentRoute: () => Route$
|
|
9384
|
+
getParentRoute: () => Route$61
|
|
8140
9385
|
});
|
|
8141
|
-
var ApiGitStatusRoute = Route$
|
|
9386
|
+
var ApiGitStatusRoute = Route$51.update({
|
|
8142
9387
|
id: "/api/git-status",
|
|
8143
9388
|
path: "/api/git-status",
|
|
8144
|
-
getParentRoute: () => Route$
|
|
9389
|
+
getParentRoute: () => Route$61
|
|
8145
9390
|
});
|
|
8146
|
-
var ApiGitStageRoute = Route$
|
|
9391
|
+
var ApiGitStageRoute = Route$50.update({
|
|
8147
9392
|
id: "/api/git-stage",
|
|
8148
9393
|
path: "/api/git-stage",
|
|
8149
|
-
getParentRoute: () => Route$
|
|
9394
|
+
getParentRoute: () => Route$61
|
|
8150
9395
|
});
|
|
8151
|
-
var ApiGitReviewRoute = Route$
|
|
9396
|
+
var ApiGitReviewRoute = Route$49.update({
|
|
8152
9397
|
id: "/api/git-review",
|
|
8153
9398
|
path: "/api/git-review",
|
|
8154
|
-
getParentRoute: () => Route$
|
|
9399
|
+
getParentRoute: () => Route$61
|
|
8155
9400
|
});
|
|
8156
|
-
var ApiGitPushRoute = Route$
|
|
9401
|
+
var ApiGitPushRoute = Route$48.update({
|
|
8157
9402
|
id: "/api/git-push",
|
|
8158
9403
|
path: "/api/git-push",
|
|
8159
|
-
getParentRoute: () => Route$
|
|
9404
|
+
getParentRoute: () => Route$61
|
|
8160
9405
|
});
|
|
8161
|
-
var ApiGitPullRoute = Route$
|
|
9406
|
+
var ApiGitPullRoute = Route$47.update({
|
|
8162
9407
|
id: "/api/git-pull",
|
|
8163
9408
|
path: "/api/git-pull",
|
|
8164
|
-
getParentRoute: () => Route$
|
|
9409
|
+
getParentRoute: () => Route$61
|
|
8165
9410
|
});
|
|
8166
|
-
var ApiGitDiscardRoute = Route$
|
|
9411
|
+
var ApiGitDiscardRoute = Route$46.update({
|
|
8167
9412
|
id: "/api/git-discard",
|
|
8168
9413
|
path: "/api/git-discard",
|
|
8169
|
-
getParentRoute: () => Route$
|
|
9414
|
+
getParentRoute: () => Route$61
|
|
8170
9415
|
});
|
|
8171
|
-
var ApiGitDiffRoute = Route$
|
|
9416
|
+
var ApiGitDiffRoute = Route$45.update({
|
|
8172
9417
|
id: "/api/git-diff",
|
|
8173
9418
|
path: "/api/git-diff",
|
|
8174
|
-
getParentRoute: () => Route$
|
|
9419
|
+
getParentRoute: () => Route$61
|
|
8175
9420
|
});
|
|
8176
|
-
var ApiGitCommitRemoteUrlRoute = Route$
|
|
9421
|
+
var ApiGitCommitRemoteUrlRoute = Route$44.update({
|
|
8177
9422
|
id: "/api/git-commit-remote-url",
|
|
8178
9423
|
path: "/api/git-commit-remote-url",
|
|
8179
|
-
getParentRoute: () => Route$
|
|
9424
|
+
getParentRoute: () => Route$61
|
|
8180
9425
|
});
|
|
8181
|
-
var ApiGitCommitMessageRoute = Route$
|
|
9426
|
+
var ApiGitCommitMessageRoute = Route$43.update({
|
|
8182
9427
|
id: "/api/git-commit-message",
|
|
8183
9428
|
path: "/api/git-commit-message",
|
|
8184
|
-
getParentRoute: () => Route$
|
|
9429
|
+
getParentRoute: () => Route$61
|
|
8185
9430
|
});
|
|
8186
|
-
var ApiGitCommitFilesRoute = Route$
|
|
9431
|
+
var ApiGitCommitFilesRoute = Route$42.update({
|
|
8187
9432
|
id: "/api/git-commit-files",
|
|
8188
9433
|
path: "/api/git-commit-files",
|
|
8189
|
-
getParentRoute: () => Route$
|
|
9434
|
+
getParentRoute: () => Route$61
|
|
8190
9435
|
});
|
|
8191
|
-
var ApiGitCommitDiffRoute = Route$
|
|
9436
|
+
var ApiGitCommitDiffRoute = Route$41.update({
|
|
8192
9437
|
id: "/api/git-commit-diff",
|
|
8193
9438
|
path: "/api/git-commit-diff",
|
|
8194
|
-
getParentRoute: () => Route$
|
|
9439
|
+
getParentRoute: () => Route$61
|
|
8195
9440
|
});
|
|
8196
|
-
var ApiGitCommitActionRoute = Route$
|
|
9441
|
+
var ApiGitCommitActionRoute = Route$40.update({
|
|
8197
9442
|
id: "/api/git-commit-action",
|
|
8198
9443
|
path: "/api/git-commit-action",
|
|
8199
|
-
getParentRoute: () => Route$
|
|
9444
|
+
getParentRoute: () => Route$61
|
|
8200
9445
|
});
|
|
8201
|
-
var ApiGitCommitRoute = Route$
|
|
9446
|
+
var ApiGitCommitRoute = Route$39.update({
|
|
8202
9447
|
id: "/api/git-commit",
|
|
8203
9448
|
path: "/api/git-commit",
|
|
8204
|
-
getParentRoute: () => Route$
|
|
9449
|
+
getParentRoute: () => Route$61
|
|
8205
9450
|
});
|
|
8206
|
-
var ApiGitCheckoutRoute = Route$
|
|
9451
|
+
var ApiGitCheckoutRoute = Route$38.update({
|
|
8207
9452
|
id: "/api/git-checkout",
|
|
8208
9453
|
path: "/api/git-checkout",
|
|
8209
|
-
getParentRoute: () => Route$
|
|
9454
|
+
getParentRoute: () => Route$61
|
|
8210
9455
|
});
|
|
8211
|
-
var ApiGitChangesRoute = Route$
|
|
9456
|
+
var ApiGitChangesRoute = Route$37.update({
|
|
8212
9457
|
id: "/api/git-changes",
|
|
8213
9458
|
path: "/api/git-changes",
|
|
8214
|
-
getParentRoute: () => Route$
|
|
9459
|
+
getParentRoute: () => Route$61
|
|
8215
9460
|
});
|
|
8216
|
-
var ApiFileCompletionsRoute = Route$
|
|
9461
|
+
var ApiFileCompletionsRoute = Route$36.update({
|
|
8217
9462
|
id: "/api/file-completions",
|
|
8218
9463
|
path: "/api/file-completions",
|
|
8219
|
-
getParentRoute: () => Route$
|
|
9464
|
+
getParentRoute: () => Route$61
|
|
8220
9465
|
});
|
|
8221
|
-
var ApiDirectorySessionsIndexesRoute = Route$
|
|
9466
|
+
var ApiDirectorySessionsIndexesRoute = Route$35.update({
|
|
8222
9467
|
id: "/api/directory-sessions-indexes",
|
|
8223
9468
|
path: "/api/directory-sessions-indexes",
|
|
8224
|
-
getParentRoute: () => Route$
|
|
9469
|
+
getParentRoute: () => Route$61
|
|
8225
9470
|
});
|
|
8226
|
-
var ApiDirectorySessionsIndexRoute = Route$
|
|
9471
|
+
var ApiDirectorySessionsIndexRoute = Route$34.update({
|
|
8227
9472
|
id: "/api/directory-sessions-index",
|
|
8228
9473
|
path: "/api/directory-sessions-index",
|
|
8229
|
-
getParentRoute: () => Route$
|
|
9474
|
+
getParentRoute: () => Route$61
|
|
8230
9475
|
});
|
|
8231
|
-
var ApiDirectorySessionsRoute = Route$
|
|
9476
|
+
var ApiDirectorySessionsRoute = Route$33.update({
|
|
8232
9477
|
id: "/api/directory-sessions",
|
|
8233
9478
|
path: "/api/directory-sessions",
|
|
8234
|
-
getParentRoute: () => Route$
|
|
9479
|
+
getParentRoute: () => Route$61
|
|
8235
9480
|
});
|
|
8236
|
-
var ApiDirectorySearchRoute = Route$
|
|
9481
|
+
var ApiDirectorySearchRoute = Route$32.update({
|
|
8237
9482
|
id: "/api/directory-search",
|
|
8238
9483
|
path: "/api/directory-search",
|
|
8239
|
-
getParentRoute: () => Route$
|
|
9484
|
+
getParentRoute: () => Route$61
|
|
8240
9485
|
});
|
|
8241
|
-
var ApiAbortRoute = Route$
|
|
9486
|
+
var ApiAbortRoute = Route$31.update({
|
|
8242
9487
|
id: "/api/abort",
|
|
8243
9488
|
path: "/api/abort",
|
|
8244
|
-
getParentRoute: () => Route$
|
|
9489
|
+
getParentRoute: () => Route$61
|
|
8245
9490
|
});
|
|
8246
|
-
var ApiUiIdRoute = Route$
|
|
9491
|
+
var ApiUiIdRoute = Route$30.update({
|
|
8247
9492
|
id: "/api/ui/$id",
|
|
8248
9493
|
path: "/api/ui/$id",
|
|
8249
|
-
getParentRoute: () => Route$
|
|
9494
|
+
getParentRoute: () => Route$61
|
|
8250
9495
|
});
|
|
8251
|
-
var ApiSettingsHideThinkingRoute = Route$
|
|
9496
|
+
var ApiSettingsHideThinkingRoute = Route$29.update({
|
|
8252
9497
|
id: "/api/settings/hide-thinking",
|
|
8253
9498
|
path: "/api/settings/hide-thinking",
|
|
8254
|
-
getParentRoute: () => Route$
|
|
9499
|
+
getParentRoute: () => Route$61
|
|
8255
9500
|
});
|
|
8256
|
-
var ApiSessionsDeleteRoute = Route$
|
|
9501
|
+
var ApiSessionsDeleteRoute = Route$28.update({
|
|
8257
9502
|
id: "/api/sessions/delete",
|
|
8258
9503
|
path: "/api/sessions/delete",
|
|
8259
|
-
getParentRoute: () => Route$
|
|
9504
|
+
getParentRoute: () => Route$61
|
|
8260
9505
|
});
|
|
8261
|
-
var ApiSessionTreeRoute = Route$
|
|
9506
|
+
var ApiSessionTreeRoute = Route$27.update({
|
|
8262
9507
|
id: "/api/session/tree",
|
|
8263
9508
|
path: "/api/session/tree",
|
|
8264
|
-
getParentRoute: () => Route$
|
|
9509
|
+
getParentRoute: () => Route$61
|
|
8265
9510
|
});
|
|
8266
|
-
var ApiSessionSelectRoute = Route$
|
|
9511
|
+
var ApiSessionSelectRoute = Route$26.update({
|
|
8267
9512
|
id: "/api/session/select",
|
|
8268
9513
|
path: "/api/session/select",
|
|
8269
|
-
getParentRoute: () => Route$
|
|
9514
|
+
getParentRoute: () => Route$61
|
|
8270
9515
|
});
|
|
8271
|
-
var ApiSessionRenameRoute = Route$
|
|
9516
|
+
var ApiSessionRenameRoute = Route$25.update({
|
|
8272
9517
|
id: "/api/session/rename",
|
|
8273
9518
|
path: "/api/session/rename",
|
|
8274
|
-
getParentRoute: () => Route$
|
|
9519
|
+
getParentRoute: () => Route$61
|
|
8275
9520
|
});
|
|
8276
|
-
var ApiSessionReadStateRoute = Route$
|
|
9521
|
+
var ApiSessionReadStateRoute = Route$24.update({
|
|
8277
9522
|
id: "/api/session/read-state",
|
|
8278
9523
|
path: "/api/session/read-state",
|
|
8279
|
-
getParentRoute: () => Route$
|
|
9524
|
+
getParentRoute: () => Route$61
|
|
8280
9525
|
});
|
|
8281
|
-
var ApiSessionNewRoute = Route$
|
|
9526
|
+
var ApiSessionNewRoute = Route$23.update({
|
|
8282
9527
|
id: "/api/session/new",
|
|
8283
9528
|
path: "/api/session/new",
|
|
8284
|
-
getParentRoute: () => Route$
|
|
9529
|
+
getParentRoute: () => Route$61
|
|
9530
|
+
});
|
|
9531
|
+
var ApiSessionNameRoute = Route$22.update({
|
|
9532
|
+
id: "/api/session/name",
|
|
9533
|
+
path: "/api/session/name",
|
|
9534
|
+
getParentRoute: () => Route$61
|
|
8285
9535
|
});
|
|
8286
|
-
var ApiSessionMoveRoute = Route$
|
|
9536
|
+
var ApiSessionMoveRoute = Route$21.update({
|
|
8287
9537
|
id: "/api/session/move",
|
|
8288
9538
|
path: "/api/session/move",
|
|
8289
|
-
getParentRoute: () => Route$
|
|
9539
|
+
getParentRoute: () => Route$61
|
|
8290
9540
|
});
|
|
8291
|
-
var ApiSessionHistoryRoute = Route$
|
|
9541
|
+
var ApiSessionHistoryRoute = Route$20.update({
|
|
8292
9542
|
id: "/api/session/history",
|
|
8293
9543
|
path: "/api/session/history",
|
|
8294
|
-
getParentRoute: () => Route$
|
|
9544
|
+
getParentRoute: () => Route$61
|
|
8295
9545
|
});
|
|
8296
|
-
var ApiSessionForkRoute = Route$
|
|
9546
|
+
var ApiSessionForkRoute = Route$19.update({
|
|
8297
9547
|
id: "/api/session/fork",
|
|
8298
9548
|
path: "/api/session/fork",
|
|
8299
|
-
getParentRoute: () => Route$
|
|
9549
|
+
getParentRoute: () => Route$61
|
|
8300
9550
|
});
|
|
8301
|
-
var ApiSessionDeleteRoute = Route$
|
|
9551
|
+
var ApiSessionDeleteRoute = Route$18.update({
|
|
8302
9552
|
id: "/api/session/delete",
|
|
8303
9553
|
path: "/api/session/delete",
|
|
8304
|
-
getParentRoute: () => Route$
|
|
9554
|
+
getParentRoute: () => Route$61
|
|
8305
9555
|
});
|
|
8306
|
-
var ApiSessionCloneRoute = Route$
|
|
9556
|
+
var ApiSessionCloneRoute = Route$17.update({
|
|
8307
9557
|
id: "/api/session/clone",
|
|
8308
9558
|
path: "/api/session/clone",
|
|
8309
|
-
getParentRoute: () => Route$
|
|
9559
|
+
getParentRoute: () => Route$61
|
|
8310
9560
|
});
|
|
8311
|
-
var
|
|
9561
|
+
var ApiPendingMessagesStartRoute = Route$16.update({
|
|
9562
|
+
id: "/api/pending-messages/start",
|
|
9563
|
+
path: "/api/pending-messages/start",
|
|
9564
|
+
getParentRoute: () => Route$61
|
|
9565
|
+
});
|
|
9566
|
+
var ApiPendingMessagesReorderRoute = Route$15.update({
|
|
8312
9567
|
id: "/api/pending-messages/reorder",
|
|
8313
9568
|
path: "/api/pending-messages/reorder",
|
|
8314
|
-
getParentRoute: () => Route$
|
|
9569
|
+
getParentRoute: () => Route$61
|
|
8315
9570
|
});
|
|
8316
|
-
var ApiPendingMessageRemoveRoute = Route$
|
|
9571
|
+
var ApiPendingMessageRemoveRoute = Route$14.update({
|
|
8317
9572
|
id: "/api/pending-message/remove",
|
|
8318
9573
|
path: "/api/pending-message/remove",
|
|
8319
|
-
getParentRoute: () => Route$
|
|
9574
|
+
getParentRoute: () => Route$61
|
|
8320
9575
|
});
|
|
8321
|
-
var ApiFilesTreeRoute = Route$
|
|
9576
|
+
var ApiFilesTreeRoute = Route$13.update({
|
|
8322
9577
|
id: "/api/files/tree",
|
|
8323
9578
|
path: "/api/files/tree",
|
|
8324
|
-
getParentRoute: () => Route$
|
|
9579
|
+
getParentRoute: () => Route$61
|
|
8325
9580
|
});
|
|
8326
|
-
var ApiFilesReadRoute = Route$
|
|
9581
|
+
var ApiFilesReadRoute = Route$12.update({
|
|
8327
9582
|
id: "/api/files/read",
|
|
8328
9583
|
path: "/api/files/read",
|
|
8329
|
-
getParentRoute: () => Route$
|
|
9584
|
+
getParentRoute: () => Route$61
|
|
8330
9585
|
});
|
|
8331
|
-
var ApiDirectoryResolveRoute = Route$
|
|
9586
|
+
var ApiDirectoryResolveRoute = Route$11.update({
|
|
8332
9587
|
id: "/api/directory/resolve",
|
|
8333
9588
|
path: "/api/directory/resolve",
|
|
8334
|
-
getParentRoute: () => Route$
|
|
9589
|
+
getParentRoute: () => Route$61
|
|
8335
9590
|
});
|
|
8336
|
-
var ApiDirectorySessionsCleanupRoute = Route$
|
|
9591
|
+
var ApiDirectorySessionsCleanupRoute = Route$10.update({
|
|
8337
9592
|
id: "/cleanup",
|
|
8338
9593
|
path: "/cleanup",
|
|
8339
9594
|
getParentRoute: () => ApiDirectorySessionsRoute
|
|
8340
9595
|
});
|
|
8341
|
-
var
|
|
9596
|
+
var ApiClientManifestRoute = Route$9.update({
|
|
9597
|
+
id: "/api/client/manifest",
|
|
9598
|
+
path: "/api/client/manifest",
|
|
9599
|
+
getParentRoute: () => Route$61
|
|
9600
|
+
});
|
|
9601
|
+
var ApiAuthProvidersRoute = Route$8.update({
|
|
8342
9602
|
id: "/api/auth/providers",
|
|
8343
9603
|
path: "/api/auth/providers",
|
|
8344
|
-
getParentRoute: () => Route$
|
|
9604
|
+
getParentRoute: () => Route$61
|
|
8345
9605
|
});
|
|
8346
|
-
var ApiAuthOauthRoute = Route$
|
|
9606
|
+
var ApiAuthOauthRoute = Route$7.update({
|
|
8347
9607
|
id: "/api/auth/oauth",
|
|
8348
9608
|
path: "/api/auth/oauth",
|
|
8349
|
-
getParentRoute: () => Route$
|
|
9609
|
+
getParentRoute: () => Route$61
|
|
8350
9610
|
});
|
|
8351
|
-
var ApiAuthLogoutRoute = Route$
|
|
9611
|
+
var ApiAuthLogoutRoute = Route$6.update({
|
|
8352
9612
|
id: "/api/auth/logout",
|
|
8353
9613
|
path: "/api/auth/logout",
|
|
8354
|
-
getParentRoute: () => Route$
|
|
9614
|
+
getParentRoute: () => Route$61
|
|
8355
9615
|
});
|
|
8356
|
-
var ApiAuthApiKeyRoute = Route$
|
|
9616
|
+
var ApiAuthApiKeyRoute = Route$5.update({
|
|
8357
9617
|
id: "/api/auth/api-key",
|
|
8358
9618
|
path: "/api/auth/api-key",
|
|
8359
|
-
getParentRoute: () => Route$
|
|
9619
|
+
getParentRoute: () => Route$61
|
|
9620
|
+
});
|
|
9621
|
+
var ApiTerminalIdResizeRoute = Route$4.update({
|
|
9622
|
+
id: "/$id/resize",
|
|
9623
|
+
path: "/$id/resize",
|
|
9624
|
+
getParentRoute: () => ApiTerminalRoute
|
|
9625
|
+
});
|
|
9626
|
+
var ApiTerminalIdInputRoute = Route$3.update({
|
|
9627
|
+
id: "/$id/input",
|
|
9628
|
+
path: "/$id/input",
|
|
9629
|
+
getParentRoute: () => ApiTerminalRoute
|
|
9630
|
+
});
|
|
9631
|
+
var ApiTerminalIdEventsRoute = Route$2.update({
|
|
9632
|
+
id: "/$id/events",
|
|
9633
|
+
path: "/$id/events",
|
|
9634
|
+
getParentRoute: () => ApiTerminalRoute
|
|
9635
|
+
});
|
|
9636
|
+
var ApiTerminalIdCloseRoute = Route$1.update({
|
|
9637
|
+
id: "/$id/close",
|
|
9638
|
+
path: "/$id/close",
|
|
9639
|
+
getParentRoute: () => ApiTerminalRoute
|
|
8360
9640
|
});
|
|
8361
9641
|
var ApiSessionTreeLabelRoute = Route.update({
|
|
8362
9642
|
id: "/label",
|
|
@@ -8365,6 +9645,13 @@ var ApiSessionTreeLabelRoute = Route.update({
|
|
|
8365
9645
|
});
|
|
8366
9646
|
var ApiDirectorySessionsRouteChildren = { ApiDirectorySessionsCleanupRoute };
|
|
8367
9647
|
var ApiDirectorySessionsRouteWithChildren = ApiDirectorySessionsRoute._addFileChildren(ApiDirectorySessionsRouteChildren);
|
|
9648
|
+
var ApiTerminalRouteChildren = {
|
|
9649
|
+
ApiTerminalIdCloseRoute,
|
|
9650
|
+
ApiTerminalIdEventsRoute,
|
|
9651
|
+
ApiTerminalIdInputRoute,
|
|
9652
|
+
ApiTerminalIdResizeRoute
|
|
9653
|
+
};
|
|
9654
|
+
var ApiTerminalRouteWithChildren = ApiTerminalRoute._addFileChildren(ApiTerminalRouteChildren);
|
|
8368
9655
|
var ApiSessionTreeRouteChildren = { ApiSessionTreeLabelRoute };
|
|
8369
9656
|
var rootRouteChildren = {
|
|
8370
9657
|
IndexRoute,
|
|
@@ -8396,21 +9683,25 @@ var rootRouteChildren = {
|
|
|
8396
9683
|
ApiPromptRoute,
|
|
8397
9684
|
ApiProviderUsageRoute,
|
|
8398
9685
|
ApiSlashCommandRoute,
|
|
9686
|
+
ApiTerminalRoute: ApiTerminalRouteWithChildren,
|
|
8399
9687
|
ApiThinkingRoute,
|
|
8400
9688
|
ApiAuthApiKeyRoute,
|
|
8401
9689
|
ApiAuthLogoutRoute,
|
|
8402
9690
|
ApiAuthOauthRoute,
|
|
8403
9691
|
ApiAuthProvidersRoute,
|
|
9692
|
+
ApiClientManifestRoute,
|
|
8404
9693
|
ApiDirectoryResolveRoute,
|
|
8405
9694
|
ApiFilesReadRoute,
|
|
8406
9695
|
ApiFilesTreeRoute,
|
|
8407
9696
|
ApiPendingMessageRemoveRoute,
|
|
8408
9697
|
ApiPendingMessagesReorderRoute,
|
|
9698
|
+
ApiPendingMessagesStartRoute,
|
|
8409
9699
|
ApiSessionCloneRoute,
|
|
8410
9700
|
ApiSessionDeleteRoute,
|
|
8411
9701
|
ApiSessionForkRoute,
|
|
8412
9702
|
ApiSessionHistoryRoute,
|
|
8413
9703
|
ApiSessionMoveRoute,
|
|
9704
|
+
ApiSessionNameRoute,
|
|
8414
9705
|
ApiSessionNewRoute,
|
|
8415
9706
|
ApiSessionReadStateRoute,
|
|
8416
9707
|
ApiSessionRenameRoute,
|
|
@@ -8420,7 +9711,7 @@ var rootRouteChildren = {
|
|
|
8420
9711
|
ApiSettingsHideThinkingRoute,
|
|
8421
9712
|
ApiUiIdRoute
|
|
8422
9713
|
};
|
|
8423
|
-
var routeTree = Route$
|
|
9714
|
+
var routeTree = Route$61._addFileChildren(rootRouteChildren)._addFileTypes();
|
|
8424
9715
|
function getRouter() {
|
|
8425
9716
|
const queryClient = new QueryClient({ defaultOptions: { queries: {
|
|
8426
9717
|
retry: 1,
|