commandmate 0.1.12 ā 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +4 -9
- package/.next/BUILD_ID +1 -1
- package/.next/app-build-manifest.json +24 -24
- package/.next/app-path-routes-manifest.json +1 -1
- package/.next/build-manifest.json +7 -7
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/1.pack +0 -0
- package/.next/cache/webpack/client-production/2.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack.old +0 -0
- package/.next/cache/webpack/edge-server-production/0.pack +0 -0
- package/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/react-loadable-manifest.json +7 -7
- package/.next/required-server-files.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/api/hooks/claude-done/route.js +1 -19
- package/.next/server/app/api/hooks/claude-done/route.js.nft.json +1 -1
- package/.next/server/app/api/repositories/clone/[jobId]/route.js +1 -1
- package/.next/server/app/api/repositories/clone/[jobId]/route.js.nft.json +1 -1
- package/.next/server/app/api/repositories/clone/route.js +1 -1
- package/.next/server/app/api/repositories/clone/route.js.nft.json +1 -1
- package/.next/server/app/api/repositories/excluded/route.js +36 -0
- package/.next/server/app/api/repositories/excluded/route.js.nft.json +1 -0
- package/.next/server/app/api/repositories/excluded.body +1 -0
- package/.next/server/app/api/repositories/excluded.meta +1 -0
- package/.next/server/app/api/repositories/restore/route.js +36 -0
- package/.next/server/app/api/repositories/restore/route.js.nft.json +1 -0
- package/.next/server/app/api/repositories/route.js +36 -1
- package/.next/server/app/api/repositories/route.js.nft.json +1 -1
- package/.next/server/app/api/repositories/scan/route.js +1 -1
- package/.next/server/app/api/repositories/sync/route.js +36 -1
- package/.next/server/app/api/slash-commands/route.js +1 -1
- package/.next/server/app/api/slash-commands.body +1 -1
- package/.next/server/app/api/worktrees/[id]/auto-yes/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/auto-yes/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/capture/route.js +2 -2
- package/.next/server/app/api/worktrees/[id]/current-output/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/current-output/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/interrupt/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/interrupt/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/kill-session/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/kill-session/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/logs/[filename]/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/logs/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/prompt-response/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/prompt-response/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/respond/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/respond/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/search/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/send/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/send/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/slash-commands/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/start-polling/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/start-polling/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/terminal/route.js +1 -1
- package/.next/server/app/api/worktrees/route.js +1 -1
- package/.next/server/app/api/worktrees/route.js.nft.json +1 -1
- package/.next/server/app/index.html +2 -2
- package/.next/server/app/index.rsc +3 -3
- package/.next/server/app/page.js +7 -7
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/proxy/[...path]/route.js +2 -2
- package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/worktrees/[id]/page.js +4 -4
- package/.next/server/app/worktrees/[id]/page.js.nft.json +1 -1
- package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/worktrees/[id]/simple-terminal/page_client-reference-manifest.js +1 -1
- package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +10 -8
- package/.next/server/chunks/5488.js +36 -0
- package/.next/server/chunks/6550.js +1 -1
- package/.next/server/chunks/7425.js +53 -50
- package/.next/server/chunks/7536.js +1 -0
- package/.next/server/chunks/8174.js +23 -0
- package/.next/server/chunks/9367.js +19 -0
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-manifest.json +2 -28
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/4327.740cc7fe2d0b5049.js +60 -0
- package/.next/static/chunks/4343-ebe884a2a80eb033.js +1 -0
- package/.next/static/chunks/6568-38a33aa67d82e12b.js +1 -0
- package/.next/static/chunks/816-c254f4e2406e696a.js +1 -0
- package/.next/static/chunks/app/layout-4804cfba519283cf.js +1 -0
- package/.next/static/chunks/app/page-3926224c4cdf315b.js +1 -0
- package/.next/static/chunks/app/worktrees/[id]/page-8bd88bdc29607413.js +1 -0
- package/.next/static/chunks/main-b6d727aa9248d4f2.js +1 -0
- package/.next/static/chunks/{webpack-3fc79fab9bb738d7.js ā webpack-4f85dcef6279c6ee.js} +1 -1
- package/.next/static/css/28be35e4727ae7ef.css +3 -0
- package/.next/trace +5 -5
- package/.next/types/app/api/repositories/excluded/route.ts +343 -0
- package/.next/types/app/api/repositories/restore/route.ts +343 -0
- package/README.md +2 -2
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +2 -13
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +3 -7
- package/dist/cli/config/security-messages.d.ts +11 -0
- package/dist/cli/config/security-messages.d.ts.map +1 -0
- package/dist/cli/config/security-messages.js +29 -0
- package/dist/cli/types/index.d.ts +0 -1
- package/dist/cli/types/index.d.ts.map +1 -1
- package/dist/cli/utils/daemon.d.ts.map +1 -1
- package/dist/cli/utils/daemon.js +3 -7
- package/dist/cli/utils/env-setup.d.ts +0 -4
- package/dist/cli/utils/env-setup.d.ts.map +1 -1
- package/dist/cli/utils/env-setup.js +0 -14
- package/dist/cli/utils/security-logger.d.ts.map +1 -1
- package/dist/cli/utils/security-logger.js +1 -2
- package/dist/server/server.js +25 -2
- package/dist/server/src/lib/auto-yes-manager.js +100 -11
- package/dist/server/src/lib/claude-poller.js +341 -0
- package/dist/server/src/lib/claude-session.js +48 -19
- package/dist/server/src/lib/cli-patterns.js +69 -6
- package/dist/server/src/lib/cli-tools/base.js +7 -1
- package/dist/server/src/lib/cli-tools/codex.js +14 -2
- package/dist/server/src/lib/cli-tools/manager.js +27 -0
- package/dist/server/src/lib/cli-tools/types.js +7 -0
- package/dist/server/src/lib/cli-tools/validation.js +41 -0
- package/dist/server/src/lib/db-repository.js +482 -0
- package/dist/server/src/lib/db.js +23 -0
- package/dist/server/src/lib/env.js +0 -17
- package/dist/server/src/lib/logger.js +0 -4
- package/dist/server/src/lib/prompt-detector.js +297 -109
- package/dist/server/src/lib/response-poller.js +73 -27
- package/dist/server/src/lib/tmux.js +48 -0
- package/dist/server/src/lib/ws-server.js +12 -1
- package/dist/server/src/types/sidebar.js +16 -31
- package/dist/server/src/types/slash-commands.js +2 -0
- package/package.json +1 -1
- package/.next/server/chunks/1318.js +0 -29
- package/.next/server/chunks/2597.js +0 -1
- package/.next/server/chunks/2648.js +0 -1
- package/.next/server/chunks/9703.js +0 -31
- package/.next/server/chunks/9723.js +0 -19
- package/.next/server/edge-runtime-webpack.js +0 -2
- package/.next/server/edge-runtime-webpack.js.map +0 -1
- package/.next/server/src/middleware.js +0 -14
- package/.next/server/src/middleware.js.map +0 -1
- package/.next/static/chunks/2853-d11a80b03c9a1640.js +0 -1
- package/.next/static/chunks/4327.3b84aa049900fdeb.js +0 -60
- package/.next/static/chunks/816-7e340dad784be28c.js +0 -1
- package/.next/static/chunks/9365-733d8c05712d2888.js +0 -1
- package/.next/static/chunks/app/layout-37e55f11dcc8b1bf.js +0 -1
- package/.next/static/chunks/app/page-fe35d61f14b90a51.js +0 -1
- package/.next/static/chunks/app/worktrees/[id]/page-58fcf2e63c056743.js +0 -1
- package/.next/static/chunks/main-a960f4a5e1a2f598.js +0 -1
- package/.next/static/css/376b339640084689.css +0 -3
- /package/.next/static/{564GHwluX5xIv9qpqLJV2 ā oUD-A998xeBoez6zsrTH3}/_buildManifest.js +0 -0
- /package/.next/static/{564GHwluX5xIv9qpqLJV2 ā oUD-A998xeBoez6zsrTH3}/_ssgManifest.js +0 -0
|
@@ -9,6 +9,7 @@ exports.hasSession = hasSession;
|
|
|
9
9
|
exports.listSessions = listSessions;
|
|
10
10
|
exports.createSession = createSession;
|
|
11
11
|
exports.sendKeys = sendKeys;
|
|
12
|
+
exports.sendSpecialKeys = sendSpecialKeys;
|
|
12
13
|
exports.capturePane = capturePane;
|
|
13
14
|
exports.killSession = killSession;
|
|
14
15
|
exports.ensureSession = ensureSession;
|
|
@@ -168,6 +169,53 @@ async function sendKeys(sessionName, keys, sendEnter = true) {
|
|
|
168
169
|
throw new Error(`Failed to send keys to tmux session: ${errorMessage}`);
|
|
169
170
|
}
|
|
170
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Allowed tmux special key names for sendSpecialKeys().
|
|
174
|
+
* Restricts input to prevent command injection via arbitrary tmux key names.
|
|
175
|
+
*/
|
|
176
|
+
const ALLOWED_SPECIAL_KEYS = new Set([
|
|
177
|
+
'Up', 'Down', 'Left', 'Right',
|
|
178
|
+
'Enter', 'Space', 'Tab', 'Escape',
|
|
179
|
+
'BSpace', 'DC', // Backspace, Delete
|
|
180
|
+
]);
|
|
181
|
+
/** Delay between individual key presses for TUI apps that need processing time (ms). */
|
|
182
|
+
const SPECIAL_KEY_DELAY_MS = 100;
|
|
183
|
+
/**
|
|
184
|
+
* Send tmux special keys (unquoted key names like Down, Up, Enter, Space).
|
|
185
|
+
* Used for cursor-based navigation in CLI tool prompts (e.g., Claude Code AskUserQuestion).
|
|
186
|
+
*
|
|
187
|
+
* Keys are sent one at a time with a short delay between each press,
|
|
188
|
+
* because ink-based TUI apps (like Claude Code) need time to process
|
|
189
|
+
* each keystroke before the next one arrives.
|
|
190
|
+
*
|
|
191
|
+
* @param sessionName - Target session name
|
|
192
|
+
* @param keys - Array of tmux special key names (e.g., ['Down', 'Down', 'Space', 'Enter'])
|
|
193
|
+
* @throws {Error} If any key name is not in the allowed set, or if tmux command fails
|
|
194
|
+
*/
|
|
195
|
+
async function sendSpecialKeys(sessionName, keys) {
|
|
196
|
+
if (keys.length === 0)
|
|
197
|
+
return;
|
|
198
|
+
// Validate all keys are in the allowed set (command injection prevention)
|
|
199
|
+
for (const key of keys) {
|
|
200
|
+
if (!ALLOWED_SPECIAL_KEYS.has(key)) {
|
|
201
|
+
throw new Error(`Invalid special key: ${key}`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
try {
|
|
205
|
+
for (let i = 0; i < keys.length; i++) {
|
|
206
|
+
const command = `tmux send-keys -t "${sessionName}" ${keys[i]}`;
|
|
207
|
+
await execAsync(command, { timeout: DEFAULT_TIMEOUT });
|
|
208
|
+
// Delay between key presses (skip after the last key)
|
|
209
|
+
if (i < keys.length - 1) {
|
|
210
|
+
await new Promise(resolve => setTimeout(resolve, SPECIAL_KEY_DELAY_MS));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
216
|
+
throw new Error(`Failed to send special keys to tmux session: ${errorMessage}`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
171
219
|
/**
|
|
172
220
|
* Capture pane output from a tmux session
|
|
173
221
|
*
|
|
@@ -27,7 +27,18 @@ const rooms = new Map();
|
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
29
|
function setupWebSocket(server) {
|
|
30
|
-
wss = new ws_1.WebSocketServer({
|
|
30
|
+
wss = new ws_1.WebSocketServer({ noServer: true });
|
|
31
|
+
// Handle upgrade requests - only accept app WebSocket connections, not Next.js HMR
|
|
32
|
+
server.on('upgrade', (request, socket, head) => {
|
|
33
|
+
const pathname = request.url || '/';
|
|
34
|
+
// Let Next.js handle its own HMR WebSocket connections
|
|
35
|
+
if (pathname.startsWith('/_next/')) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
wss.handleUpgrade(request, socket, head, (ws) => {
|
|
39
|
+
wss.emit('connection', ws, request);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
31
42
|
// Handle WebSocket server errors (e.g., invalid frames from clients)
|
|
32
43
|
wss.on('error', (error) => {
|
|
33
44
|
console.error('[WS Server] Error:', error.message);
|
|
@@ -5,43 +5,22 @@
|
|
|
5
5
|
* Types for sidebar components and branch status display
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.deriveCliStatus = deriveCliStatus;
|
|
8
9
|
exports.calculateHasUnread = calculateHasUnread;
|
|
9
10
|
exports.toBranchItem = toBranchItem;
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* Status priority:
|
|
14
|
-
* - waiting: Claude asked a yes/no prompt, waiting for user's answer (green dot)
|
|
15
|
-
* - running: Claude is actively processing user's request (spinner)
|
|
16
|
-
* - ready: Session running, waiting for user's new message (green dot)
|
|
17
|
-
* - idle: Session not running (gray dot)
|
|
12
|
+
* Derive BranchStatus from per-CLI tool session status flags.
|
|
13
|
+
* Shared by sidebar (toBranchItem) and WorktreeDetailRefactored tab dots.
|
|
18
14
|
*/
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
if (claudeStatus.isWaitingForResponse) {
|
|
24
|
-
return 'waiting';
|
|
25
|
-
}
|
|
26
|
-
if (claudeStatus.isProcessing) {
|
|
27
|
-
return 'running';
|
|
28
|
-
}
|
|
29
|
-
// Session running but not processing = ready (waiting for user to type new message)
|
|
30
|
-
if (claudeStatus.isRunning) {
|
|
31
|
-
return 'ready';
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
// Fall back to legacy status fields
|
|
35
|
-
if (worktree.isWaitingForResponse) {
|
|
15
|
+
function deriveCliStatus(toolStatus) {
|
|
16
|
+
if (!toolStatus)
|
|
17
|
+
return 'idle';
|
|
18
|
+
if (toolStatus.isWaitingForResponse)
|
|
36
19
|
return 'waiting';
|
|
37
|
-
|
|
38
|
-
if (worktree.isProcessing) {
|
|
20
|
+
if (toolStatus.isProcessing)
|
|
39
21
|
return 'running';
|
|
40
|
-
|
|
41
|
-
// Session running but not processing = ready
|
|
42
|
-
if (worktree.isSessionRunning) {
|
|
22
|
+
if (toolStatus.isRunning)
|
|
43
23
|
return 'ready';
|
|
44
|
-
}
|
|
45
24
|
return 'idle';
|
|
46
25
|
}
|
|
47
26
|
/**
|
|
@@ -74,7 +53,9 @@ function calculateHasUnread(worktree) {
|
|
|
74
53
|
* @returns SidebarBranchItem for sidebar display
|
|
75
54
|
*/
|
|
76
55
|
function toBranchItem(worktree) {
|
|
77
|
-
|
|
56
|
+
// Issue #4: Sidebar no longer shows per-CLI session status.
|
|
57
|
+
// Status is always 'idle' since detailed status is shown in WorktreeDetail.
|
|
58
|
+
const status = 'idle';
|
|
78
59
|
// Use new hasUnread logic based on lastAssistantMessageAt and lastViewedAt
|
|
79
60
|
const hasUnread = calculateHasUnread(worktree);
|
|
80
61
|
return {
|
|
@@ -85,5 +66,9 @@ function toBranchItem(worktree) {
|
|
|
85
66
|
hasUnread,
|
|
86
67
|
lastActivity: worktree.updatedAt,
|
|
87
68
|
description: worktree.description,
|
|
69
|
+
cliStatus: {
|
|
70
|
+
claude: deriveCliStatus(worktree.sessionStatusByCli?.claude),
|
|
71
|
+
codex: deriveCliStatus(worktree.sessionStatusByCli?.codex),
|
|
72
|
+
},
|
|
88
73
|
};
|
|
89
74
|
}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* Slash Command Types
|
|
4
4
|
*
|
|
5
5
|
* Type definitions for slash commands loaded from .claude/commands/*.md
|
|
6
|
+
*
|
|
7
|
+
* Issue #4: Added cliTools field for CLI tool-specific command filtering
|
|
6
8
|
*/
|
|
7
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
10
|
exports.COMMAND_CATEGORIES = exports.CATEGORY_LABELS = void 0;
|
package/package.json
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";exports.id=1318,exports.ids=[1318],exports.modules={61318:(e,t,r)=>{r.d(t,{v:()=>_});var o=r(61282),s=r(92048),a=r(55315),i=r.n(a);class n{constructor(){}static getInstance(){return n.instance||(n.instance=new n),n.instance}normalize(e){let t=e.match(/^ssh:\/\/git@([^:\/]+)(:\d+)?\/(.+?)(\.git)?$/);if(t)return`https://${t[1]}/${t[3]}`.toLowerCase().replace(/\/$/,"");let r=e.match(/^git@([^:]+):(.+?)(\.git)?$/);return r?`https://${r[1]}/${r[2]}`.toLowerCase().replace(/\/$/,""):e.replace(/\.git\/?$/,"").replace(/\/$/,"").toLowerCase()}isSameRepository(e,t){return this.normalize(e)===this.normalize(t)}extractRepoName(e){let t=e.match(/^ssh:\/\/git@[^\/]+\/(.+?)(\.git)?$/);if(t){let e=t[1].split("/");return e[e.length-1]}let r=e.match(/:(.+?)(\.git)?$/);if(r&&e.startsWith("git@")){let e=r[1].split("/");return e[e.length-1]}let o=e.match(/\/([^\/]+?)(\.git)?$/);return o?o[1]:""}getUrlType(e){return e.startsWith("https://")?"https":e.startsWith("git@")||e.startsWith("ssh://")?"ssh":null}validate(e){if(!e||"string"!=typeof e||""===e.trim())return{valid:!1,error:"EMPTY_URL"};let t=e.trim();return t.startsWith("https://")?/^https:\/\/[^\/]+\/[^\/]+\/[^\/]+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("git@")?/^git@[^:]+:.+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("ssh://")&&/^ssh:\/\/git@[^\/]+(:\d+)?\/[^\/]+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}}}var l=r(57440),c=r(84770);function d(e){return{id:e.id,cloneUrl:e.clone_url,normalizedCloneUrl:e.normalized_clone_url,targetPath:e.target_path,repositoryId:e.repository_id||void 0,status:e.status,pid:e.pid||void 0,progress:e.progress,errorCategory:e.error_category||void 0,errorCode:e.error_code||void 0,errorMessage:e.error_message||void 0,startedAt:e.started_at?new Date(e.started_at):void 0,completedAt:e.completed_at?new Date(e.completed_at):void 0,createdAt:new Date(e.created_at)}}function u(e,t){let r=e.prepare(`
|
|
2
|
-
SELECT * FROM clone_jobs
|
|
3
|
-
WHERE id = ?
|
|
4
|
-
`).get(t);return r?d(r):null}function g(e,t,r){let o=[],s=[];void 0!==r.status&&(o.push("status = ?"),s.push(r.status)),void 0!==r.pid&&(o.push("pid = ?"),s.push(r.pid)),void 0!==r.progress&&(o.push("progress = ?"),s.push(r.progress)),void 0!==r.repositoryId&&(o.push("repository_id = ?"),s.push(r.repositoryId)),void 0!==r.errorCategory&&(o.push("error_category = ?"),s.push(r.errorCategory)),void 0!==r.errorCode&&(o.push("error_code = ?"),s.push(r.errorCode)),void 0!==r.errorMessage&&(o.push("error_message = ?"),s.push(r.errorMessage)),void 0!==r.startedAt&&(o.push("started_at = ?"),s.push(r.startedAt.getTime())),void 0!==r.completedAt&&(o.push("completed_at = ?"),s.push(r.completedAt.getTime())),0!==o.length&&(s.push(t),e.prepare(`
|
|
5
|
-
UPDATE clone_jobs
|
|
6
|
-
SET ${o.join(", ")}
|
|
7
|
-
WHERE id = ?
|
|
8
|
-
`).run(...s))}var h=r(67722);class p extends Error{constructor(e){super(e.message),this.name="CloneManagerError",this.category=e.category,this.code=e.code,this.recoverable=e.recoverable,this.suggestedAction=e.suggestedAction}}let m={EMPTY_URL:{category:"validation",code:"EMPTY_URL",message:"Clone URL is required",recoverable:!0,suggestedAction:"Please enter a valid git clone URL"},INVALID_URL_FORMAT:{category:"validation",code:"INVALID_URL_FORMAT",message:"Invalid URL format. Please use HTTPS or SSH URL.",recoverable:!0,suggestedAction:"Enter a valid URL like https://github.com/owner/repo or git@github.com:owner/repo"},DUPLICATE_CLONE_URL:{category:"validation",code:"DUPLICATE_CLONE_URL",message:"This repository is already registered",recoverable:!1,suggestedAction:"Use the existing repository instead"},CLONE_IN_PROGRESS:{category:"validation",code:"CLONE_IN_PROGRESS",message:"A clone operation is already in progress for this URL",recoverable:!1,suggestedAction:"Wait for the current clone to complete"},DIRECTORY_EXISTS:{category:"filesystem",code:"DIRECTORY_EXISTS",message:"Target directory already exists",recoverable:!0,suggestedAction:"Choose a different directory or remove the existing one"},INVALID_TARGET_PATH:{category:"validation",code:"INVALID_TARGET_PATH",message:"Target path is invalid or outside allowed directory",recoverable:!0,suggestedAction:"Use a path within the configured base directory"},AUTH_FAILED:{category:"auth",code:"AUTH_FAILED",message:"Authentication failed",recoverable:!0,suggestedAction:"Check your credentials or SSH keys"},NETWORK_ERROR:{category:"network",code:"NETWORK_ERROR",message:"Network error occurred",recoverable:!0,suggestedAction:"Check your internet connection and try again"},GIT_ERROR:{category:"git",code:"GIT_ERROR",message:"Git command failed",recoverable:!1,suggestedAction:"Check the error message for details"},CLONE_TIMEOUT:{category:"network",code:"CLONE_TIMEOUT",message:"Clone operation timed out",recoverable:!0,suggestedAction:"Try again or clone a smaller repository"}};class _{constructor(e,t={}){this.db=e,this.urlNormalizer=n.getInstance(),this.config={basePath:t.basePath||process.env.WORKTREE_BASE_PATH||"/tmp/repos",timeout:t.timeout||6e5},this.activeProcesses=new Map}validateCloneRequest(e){let t=this.urlNormalizer.validate(e);return t.valid?{valid:!0,normalizedUrl:this.urlNormalizer.normalize(e),repoName:this.urlNormalizer.extractRepoName(e)}:{valid:!1,error:m[t.error||"INVALID_URL_FORMAT"]}}checkDuplicateRepository(e){return function(e,t){let r=e.prepare(`
|
|
9
|
-
SELECT * FROM repositories
|
|
10
|
-
WHERE normalized_clone_url = ?
|
|
11
|
-
`).get(t);return r?{id:r.id,name:r.name,path:r.path,enabled:1===r.enabled,cloneUrl:r.clone_url||void 0,normalizedCloneUrl:r.normalized_clone_url||void 0,cloneSource:r.clone_source,isEnvManaged:1===r.is_env_managed,createdAt:new Date(r.created_at),updatedAt:new Date(r.updated_at)}:null}(this.db,e)}checkActiveCloneJob(e){return function(e,t){let r=e.prepare(`
|
|
12
|
-
SELECT * FROM clone_jobs
|
|
13
|
-
WHERE normalized_clone_url = ?
|
|
14
|
-
AND status IN ('pending', 'running')
|
|
15
|
-
ORDER BY created_at DESC
|
|
16
|
-
LIMIT 1
|
|
17
|
-
`).get(t);return r?d(r):null}(this.db,e)}createCloneJob(e){return function(e,t){let r=(0,c.randomUUID)(),o=Date.now();return e.prepare(`
|
|
18
|
-
INSERT INTO clone_jobs (
|
|
19
|
-
id, clone_url, normalized_clone_url, target_path,
|
|
20
|
-
status, progress, created_at
|
|
21
|
-
)
|
|
22
|
-
VALUES (?, ?, ?, ?, 'pending', 0, ?)
|
|
23
|
-
`).run(r,t.cloneUrl,t.normalizedCloneUrl,t.targetPath,o),{id:r,cloneUrl:t.cloneUrl,normalizedCloneUrl:t.normalizedCloneUrl,targetPath:t.targetPath,status:"pending",progress:0,createdAt:new Date(o)}}(this.db,e)}getTargetPath(e){return i().join(this.config.basePath,e)}async startCloneJob(e,t){let r=this.validateCloneRequest(e);if(!r.valid)return{success:!1,error:r.error};let o=r.normalizedUrl,a=r.repoName,i=this.checkDuplicateRepository(o);if(i)return{success:!1,error:{...m.DUPLICATE_CLONE_URL,message:`This repository is already registered as "${i.name}"`}};let n=this.checkActiveCloneJob(o);if(n)return{success:!1,jobId:n.id,error:m.CLONE_IN_PROGRESS};let c=t||this.getTargetPath(a);if(t&&!(0,l.j)(t,this.config.basePath))return{success:!1,error:{...m.INVALID_TARGET_PATH,message:`Target path must be within ${this.config.basePath}`}};if((0,s.existsSync)(c))return{success:!1,error:{...m.DIRECTORY_EXISTS,message:`Target directory already exists: ${c}`}};let d=this.createCloneJob({cloneUrl:e,normalizedCloneUrl:o,targetPath:c});return this.executeClone(d.id,e,c).catch(e=>{console.error(`[CloneManager] Clone failed for job ${d.id}:`,e)}),{success:!0,jobId:d.id}}async executeClone(e,t,r){g(this.db,e,{status:"running",startedAt:new Date});let a=i().dirname(r);return(0,s.existsSync)(a)||(0,s.mkdirSync)(a,{recursive:!0}),new Promise((s,a)=>{let i=(0,o.spawn)("git",["clone","--progress",t,r],{stdio:["ignore","pipe","pipe"]});this.activeProcesses.set(e,i),i.pid&&g(this.db,e,{pid:i.pid});let n="";i.stderr?.on("data",t=>{n+=t.toString();let r=this.parseGitProgress(t.toString());null!==r&&g(this.db,e,{progress:r})});let l=setTimeout(()=>{i.kill("SIGTERM"),g(this.db,e,{status:"failed",errorCategory:"network",errorCode:"CLONE_TIMEOUT",errorMessage:"Clone operation timed out",completedAt:new Date}),this.activeProcesses.delete(e),a(new p(m.CLONE_TIMEOUT))},this.config.timeout);i.on("close",async o=>{if(clearTimeout(l),this.activeProcesses.delete(e),0===o)await this.onCloneSuccess(e,t,r),s();else{let t=this.parseGitError(n,o);g(this.db,e,{status:"failed",errorCategory:t.category,errorCode:t.code,errorMessage:t.message,completedAt:new Date}),a(new p(t))}}),i.on("error",t=>{clearTimeout(l),this.activeProcesses.delete(e);let r={category:"system",code:"SPAWN_ERROR",message:`Failed to spawn git process: ${t.message}`,recoverable:!1,suggestedAction:"Ensure git is installed and available in PATH"};g(this.db,e,{status:"failed",errorCategory:r.category,errorCode:r.code,errorMessage:r.message,completedAt:new Date}),a(new p(r))})})}async onCloneSuccess(e,t,r){let o=u(this.db,e);if(!o)return;let s=this.urlNormalizer.getUrlType(t),a=function(e,t){let r=(0,c.randomUUID)(),o=Date.now();return e.prepare(`
|
|
24
|
-
INSERT INTO repositories (
|
|
25
|
-
id, name, path, enabled, clone_url, normalized_clone_url,
|
|
26
|
-
clone_source, is_env_managed, created_at, updated_at
|
|
27
|
-
)
|
|
28
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
29
|
-
`).run(r,t.name,t.path,!1!==t.enabled?1:0,t.cloneUrl||null,t.normalizedCloneUrl||null,t.cloneSource,t.isEnvManaged?1:0,o,o),{id:r,name:t.name,path:t.path,enabled:!1!==t.enabled,cloneUrl:t.cloneUrl,normalizedCloneUrl:t.normalizedCloneUrl,cloneSource:t.cloneSource,isEnvManaged:t.isEnvManaged||!1,createdAt:new Date(o),updatedAt:new Date(o)}}(this.db,{name:i().basename(r),path:r,cloneUrl:t,normalizedCloneUrl:o.normalizedCloneUrl,cloneSource:s||"https"});try{let e=await (0,h.e9)(r);e.length>0&&((0,h.h2)(this.db,e),console.log(`[CloneManager] Registered ${e.length} worktree(s) for ${r}`))}catch(e){console.error(`[CloneManager] Failed to scan worktrees for ${r}:`,e)}g(this.db,e,{status:"completed",progress:100,repositoryId:a.id,completedAt:new Date})}parseGitProgress(e){let t=e.match(/(?:Receiving objects|Resolving deltas|Cloning into[^:]*?):\s*(\d+)%/);if(t){let e=parseInt(t[1],10);return isNaN(e)?null:e}return null}parseGitError(e,t){let r=e.toLowerCase(),o=e.substring(0,200);return["authentication failed","permission denied","could not read from remote repository"].some(e=>r.includes(e))?{...m.AUTH_FAILED,message:`Authentication failed: ${o}`}:["could not resolve host","connection refused","network is unreachable"].some(e=>r.includes(e))?{...m.NETWORK_ERROR,message:`Network error: ${o}`}:{...m.GIT_ERROR,message:`Git clone failed (exit code ${t}): ${o}`}}getCloneJobStatus(e){let t=u(this.db,e);if(!t)return null;let r={jobId:t.id,status:t.status,progress:t.progress,repositoryId:t.repositoryId};return"failed"===t.status&&t.errorCode&&(r.error={category:t.errorCategory||"system",code:t.errorCode,message:t.errorMessage||"Unknown error"}),r}cancelCloneJob(e){let t=this.activeProcesses.get(e);if(t)return t.kill("SIGTERM"),this.activeProcesses.delete(e),g(this.db,e,{status:"cancelled",completedAt:new Date}),!0;let r=u(this.db,e);return!!r&&"pending"===r.status&&(g(this.db,e,{status:"cancelled",completedAt:new Date}),!0)}}},57440:(e,t,r)=>{r.d(t,{j:()=>a});var o=r(55315),s=r.n(o);function a(e,t){if(!e||""===e.trim()||e.includes("\0"))return!1;let r=e;try{r=decodeURIComponent(e)}catch{r=e}if(r.includes("\0"))return!1;let o=s().resolve(t),a=s().resolve(t,r),i=s().relative(o,a);return!(i.startsWith("..")||s().isAbsolute(i))}},67722:(e,t,r)=>{r.d(t,{Lj:()=>u,a$:()=>c,e9:()=>d,h2:()=>g});var o=r(61282),s=r(21764),a=r(55315),i=r.n(a),n=r(75748),l=r(93346);function c(){let e=process.env.WORKTREE_REPOS;if(e&&e.trim())return e.split(",").map(e=>e.trim()).filter(e=>e.length>0);let t=(0,l.Hb)("CM_ROOT_DIR");return t&&t.trim()?[t.trim()]:[]}async function d(e){let t=(0,s.promisify)(o.exec);try{let{stdout:r}=await t("git worktree list",{cwd:e}),o=function(e){if(!e||""===e.trim())return[];let t=e.trim().split("\n"),r=[];for(let e of t){let t=e.trim();if(!t)continue;let o=t.match(/^(.+?)\s+([a-z0-9]+)\s+(?:\[(.+?)\]|\(detached HEAD\))/);if(o){let[,e,t,s]=o;r.push({path:e.trim(),branch:s||`detached-${t}`,commit:t})}}return r}(r),s=i().resolve(e),a=i().basename(s);return o.map(e=>({id:function(e,t){if(!e)return"";let r=e=>e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),o=r(e);if(t){let e=r(t);return`${e}-${o}`}return o}(e.branch,a),name:e.branch,path:i().resolve(e.path),repositoryPath:s,repositoryName:a})).filter(e=>["/etc","/root","/sys","/proc","/dev","/boot","/bin","/sbin","/usr/bin","/usr/sbin"].some(t=>e.path.startsWith(t))?(console.warn(`Skipping potentially unsafe worktree path: ${e.path}`),!1):!(e.path.includes("\0")||e.path.includes(".."))||(console.warn(`Skipping path with potentially malicious characters: ${e.path}`),!1))}catch(r){let e=r instanceof Error?r.message:String(r),t=r.code;if(e?.includes("not a git repository")||128===t)return[];throw r}}async function u(e){let t=[];for(let r of e)try{console.log(`Scanning repository: ${r}`);let e=await d(r);t.push(...e),console.log(` Found ${e.length} worktree(s)`)}catch(e){console.error(`Error scanning repository ${r}:`,e)}return t}function g(e,t){if(0===t.length)return;let r=new Map;for(let e of t){let t=e.repositoryPath||"";r.has(t)||r.set(t,[]),r.get(t).push(e)}for(let[t,o]of r){if(!t)continue;let r=(0,n.Pv)(e,t),s=new Set(o.map(e=>e.id)),a=r.filter(e=>!s.has(e));if(a.length>0){let r=(0,n.pM)(e,a);console.log(`Removed ${r.deletedCount} deleted worktree(s) from ${t}`)}for(let t of o)(0,n.ly)(e,t)}}}};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";exports.id=2597,exports.ids=[2597],exports.modules={89194:(t,e,s)=>{s.d(e,{Lg:()=>r,NA:()=>a});var i=s(10927),n=s(97213);let o=(0,s(43895).h)("cli-session");async function r(t,e){let s=n.g.getInstance().getTool(e).getSessionName(t);return await (0,i.Hk)(s)}async function a(t,e,s=1e3){let r=o.withContext({worktreeId:t,cliToolId:e});r.debug("captureSessionOutput:start",{requestedLines:s});let a=n.g.getInstance().getTool(e),l=a.getSessionName(t);if(!await (0,i.Hk)(l))throw r.debug("captureSessionOutput:sessionNotFound",{sessionName:l}),Error(`${a.name} session ${l} does not exist`);try{let t=await (0,i.xq)(l,{startLine:-s}),e=t.split("\n").length;return r.debug("captureSessionOutput:success",{actualLines:e,lastFewLines:t.split("\n").slice(-3).join(" | ")}),t}catch(e){let t=e instanceof Error?e.message:String(e);throw r.error("captureSessionOutput:failed",{error:t}),Error(`Failed to capture ${a.name} output: ${t}`)}}},97213:(t,e,s)=>{s.d(e,{g:()=>h});var i=s(61282),n=s(21764),o=s(10927);let r=(0,n.promisify)(i.exec);class a{async isInstalled(){try{return await r(`which ${this.command}`,{timeout:5e3}),!0}catch{return!1}}getSessionName(t){return`mcbd-${this.id}-${t}`}async interrupt(t){let e=this.getSessionName(t);await (0,o.ZV)(e,"Escape")}}var l=s(62648);class m extends a{async isInstalled(){return await (0,l.Uv)()}async isRunning(t){return await (0,l.YI)(t)}async startSession(t,e){await (0,l.ym)({worktreeId:t,worktreePath:e})}async sendMessage(t,e){await (0,l.xd)(t,e)}async killSession(t){await (0,l._f)(t)}constructor(...t){super(...t),this.id="claude",this.name="Claude Code",this.command="claude"}}let c=(0,n.promisify)(i.exec);class u extends a{async isRunning(t){let e=this.getSessionName(t);return await (0,o.Hk)(e)}async startSession(t,e){if(!await this.isInstalled())throw Error("Codex CLI is not installed or not in PATH");let s=this.getSessionName(t);if(await (0,o.Hk)(s)){console.log(`Codex session ${s} already exists`);return}try{await (0,o.ed)({sessionName:s,workingDirectory:e,historyLimit:5e4}),await new Promise(t=>setTimeout(t,100)),await (0,o.Is)(s,"codex",!0),await new Promise(t=>setTimeout(t,3e3)),await (0,o.Is)(s,"2",!0),await new Promise(t=>setTimeout(t,500)),console.log(`ā Started Codex session: ${s}`)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to start Codex session: ${t}`)}}async sendMessage(t,e){let s=this.getSessionName(t);if(!await (0,o.Hk)(s))throw Error(`Codex session ${s} does not exist. Start the session first.`);try{await (0,o.Is)(s,e,!1),await new Promise(t=>setTimeout(t,100)),await c(`tmux send-keys -t "${s}" C-m`),await new Promise(t=>setTimeout(t,200)),console.log(`ā Sent message to Codex session: ${s}`)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to send message to Codex: ${t}`)}}async killSession(t){let e=this.getSessionName(t);try{await (0,o.Hk)(e)&&(await c(`tmux send-keys -t "${e}" C-d`),await new Promise(t=>setTimeout(t,500))),await (0,o.AJ)(e)&&console.log(`ā Stopped Codex session: ${e}`)}catch(e){let t=e instanceof Error?e.message:String(e);throw console.error(`Error stopping Codex session: ${t}`),e}}constructor(...t){super(...t),this.id="codex",this.name="Codex CLI",this.command="codex"}}let d=(0,n.promisify)(i.exec);class p extends a{async isRunning(t){let e=this.getSessionName(t);return await (0,o.Hk)(e)}async startSession(t,e){if(!await this.isInstalled())throw Error("Gemini CLI is not installed or not in PATH");let s=this.getSessionName(t);if(await (0,o.Hk)(s)){console.log(`Gemini session ${s} already exists`);return}try{await (0,o.ed)({sessionName:s,workingDirectory:e,historyLimit:5e4}),console.log(`ā Started Gemini session: ${s}`)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to start Gemini session: ${t}`)}}async sendMessage(t,e){let s=this.getSessionName(t);if(!await (0,o.Hk)(s))throw Error(`Gemini session ${s} does not exist. Start the session first.`);try{let t=e.replace(/'/g,"'\\''");await (0,o.Is)(s,`echo '${t}' | gemini`,!0),console.log(`ā Sent message to Gemini session: ${s}`)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to send message to Gemini: ${t}`)}}async killSession(t){let e=this.getSessionName(t);try{await (0,o.Hk)(e)&&(await d(`tmux send-keys -t "${e}" C-d`),await new Promise(t=>setTimeout(t,500))),await (0,o.AJ)(e)&&console.log(`ā Stopped Gemini session: ${e}`)}catch(e){let t=e instanceof Error?e.message:String(e);throw console.error(`Error stopping Gemini session: ${t}`),e}}constructor(...t){super(...t),this.id="gemini",this.name="Gemini CLI",this.command="gemini"}}class h{constructor(){this.tools=new Map,this.tools.set("claude",new m),this.tools.set("codex",new u),this.tools.set("gemini",new p)}static getInstance(){return h.instance||(h.instance=new h),h.instance}getTool(t){let e=this.tools.get(t);if(!e)throw Error(`CLI tool '${t}' not found`);return e}getAllTools(){return Array.from(this.tools.values())}async getToolInfo(t){let e=this.getTool(t),s=await e.isInstalled();return{id:e.id,name:e.name,command:e.command,installed:s}}async getAllToolsInfo(){return Promise.all(this.getAllTools().map(async t=>{let e=await t.isInstalled();return{id:t.id,name:t.name,command:t.command,installed:e}}))}async getInstalledTools(){return(await this.getAllToolsInfo()).filter(t=>t.installed)}}},63661:(t,e,s)=>{s.d(e,{F:()=>n,J:()=>r});let i=(0,s(43895).h)("prompt-detector");function n(t){i.debug("detectPrompt:start",{outputLength:t.length});let e=t.split("\n").slice(-10).join("\n"),s=function(t){let e=t.split("\n"),s=/^\s*([⯠]\s*)?(\d+)\.\s*(.+)$/,i=[],n=-1,r=-1;for(let t=e.length-1;t>=0&&t>=e.length-50;t--){let o=e[t].trim(),a=e[t],l=o.match(s);if(l){let e=!!(l[1]&&l[1].includes("āÆ")),s=parseInt(l[2],10),n=l[3].trim();i.unshift({number:s,label:n,isDefault:e}),-1===r&&(r=t)}else if(i.length>0&&o&&!o.match(/^[-ā]+$/)){let e=a.match(/^\s{2,}[^\d]/)&&!a.match(/^\s*\d+\./),s=o.length<5&&!o.endsWith("?");if(e||s)continue;n=t;break}}let a=i.some(t=>t.isDefault);if(i.length<2||!a)return{isPrompt:!1,cleanContent:t.trim()};let l="";if(n>=0){let t=[];for(let s=Math.max(0,n-5);s<=n;s++){let i=e[s].trim();i&&!i.match(/^[-ā]+$/)&&t.push(i)}l=t.join(" ")}else l="Please select an option:";return{isPrompt:!0,promptData:{type:"multiple_choice",question:l.trim(),options:i.map(t=>{let e=o.some(e=>e.test(t.label));return{number:t.number,label:t.label,isDefault:t.isDefault,requiresTextInput:e}}),status:"pending"},cleanContent:l.trim()}}(t);if(s.isPrompt)return i.info("detectPrompt:multipleChoice",{isPrompt:!0,question:s.promptData?.question,optionsCount:s.promptData?.options?.length}),s;let n=e.match(/^(.+)\s+\(y\/n\)\s*$/m);if(n)return{isPrompt:!0,promptData:{type:"yes_no",question:n[1].trim(),options:["yes","no"],status:"pending"},cleanContent:n[1].trim()};let r=e.match(/^(.+)\s+\[y\/N\]\s*$/m);if(r)return{isPrompt:!0,promptData:{type:"yes_no",question:r[1].trim(),options:["yes","no"],status:"pending",defaultOption:"no"},cleanContent:r[1].trim()};let a=e.match(/^(.+)\s+\[Y\/n\]\s*$/m);if(a)return{isPrompt:!0,promptData:{type:"yes_no",question:a[1].trim(),options:["yes","no"],status:"pending",defaultOption:"yes"},cleanContent:a[1].trim()};let l=e.match(/^(.+)\s+\(yes\/no\)\s*$/m);if(l)return{isPrompt:!0,promptData:{type:"yes_no",question:l[1].trim(),options:["yes","no"],status:"pending"},cleanContent:l[1].trim()};let m=e.match(/^(.*?)Approve\?\s*$/m);if(m){let t=m[1].trim();return{isPrompt:!0,promptData:{type:"yes_no",question:t?`${t} Approve?`:"Approve?",options:["yes","no"],status:"pending"},cleanContent:t||"Approve?"}}return i.debug("detectPrompt:complete",{isPrompt:!1}),{isPrompt:!1,cleanContent:t.trim()}}let o=[/type\s+here/i,/tell\s+(me|claude)/i,/enter\s+/i,/custom/i,/differently/i];function r(t,e="yes_no"){let s=t.toLowerCase().trim();if("multiple_choice"===e){if(/^\d+$/.test(s))return s;throw Error(`Invalid answer for multiple choice: ${t}. Expected a number.`)}if("yes"===s||"y"===s)return"y";if("no"===s||"n"===s)return"n";throw Error(`Invalid answer: ${t}. Expected 'yes', 'no', 'y', or 'n'.`)}}};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";exports.id=2648,exports.ids=[2648],exports.modules={62648:(t,e,r)=>{r.d(e,{Lm:()=>x,Uv:()=>d,YI:()=>m,_f:()=>g,xd:()=>w,ym:()=>f});var n=r(10927),i=r(19377),a=r(61282);let s=(0,r(21764).promisify)(a.exec);function o(t){return t instanceof Error?t.message:String(t)}let c=null;async function u(){if(c)return c;if(process.env.CLAUDE_PATH)return c=process.env.CLAUDE_PATH;try{let{stdout:t}=await s("which claude",{timeout:5e3});return c=t.trim()}catch{for(let t of["/opt/homebrew/bin/claude","/usr/local/bin/claude","/usr/bin/claude"])try{return await s(`test -x "${t}"`,{timeout:1e3}),c=t}catch{}throw Error("Claude CLI not found. Set CLAUDE_PATH environment variable or install Claude CLI.")}}function l(t){return`mcbd-claude-${t}`}async function d(){try{return await s("which claude",{timeout:5e3}),!0}catch{return!1}}async function m(t){let e=l(t);return await (0,n.Hk)(e)}async function p(t,e=5e3){let r=Date.now();for(;Date.now()-r<e;){let e=await (0,n.xq)(t,{startLine:-50});if(i.V7.test((0,i.vp)(e)))return;await new Promise(t=>setTimeout(t,200))}throw Error(`Prompt detection timeout (${e}ms)`)}async function f(t){let{worktreeId:e,worktreePath:r}=t;if(!await d())throw Error("Claude CLI is not installed or not in PATH");let a=l(e);if(await (0,n.Hk)(a)){console.log(`Claude session ${a} already exists`);return}try{await (0,n.ed)({sessionName:a,workingDirectory:r,historyLimit:5e4});let t=await u();await (0,n.Is)(a,t,!0);let e=Date.now(),s=!1;for(;Date.now()-e<15e3;){await new Promise(t=>setTimeout(t,300));try{let t=await (0,n.xq)(a,{startLine:-50}),r=(0,i.vp)(t);if(i.V7.test(r)||i.FE.test(r)){await new Promise(t=>setTimeout(t,500)),console.log(`Claude initialized in ${Date.now()-e}ms`),s=!0;break}}catch{}}if(!s)throw Error("Claude initialization timeout (15000ms)");console.log(`Started Claude session: ${a}`)}catch(t){throw Error(`Failed to start Claude session: ${o(t)}`)}}async function w(t,e){let r=l(t);if(!await (0,n.Hk)(r))throw Error(`Claude session ${r} does not exist. Start the session first.`);let a=await (0,n.xq)(r,{startLine:-50});if(!i.V7.test((0,i.vp)(a)))try{await p(r,1e4)}catch{console.warn("[sendMessageToClaude] Prompt not detected, sending anyway")}await (0,n.Is)(r,e,!1),await (0,n.Is)(r,"",!0),console.log(`Sent message to Claude session: ${r}`)}async function x(t,e=1e3){let r=l(t);if(!await (0,n.Hk)(r))throw Error(`Claude session ${r} does not exist`);try{return await (0,n.xq)(r,{startLine:-e})}catch(t){throw Error(`Failed to capture Claude output: ${o(t)}`)}}async function g(t){let e=l(t);try{await (0,n.Hk)(e)&&(await (0,n.Is)(e,"",!1),await s(`tmux send-keys -t "${e}" C-d`),await new Promise(t=>setTimeout(t,500)));let t=await (0,n.AJ)(e);return t&&console.log(`ā Stopped Claude session: ${e}`),t}catch(t){return console.error(`Error stopping Claude session: ${o(t)}`),!1}}},19377:(t,e,r)=>{r.d(e,{FE:()=>o,V7:()=>s,Wg:()=>d,bs:()=>function t(e){switch(e){case"claude":return{promptPattern:s,separatorPattern:o,thinkingPattern:i,skipPatterns:[/^ā{10,}$/,/^[>āÆ]\s*$/,i,/^\s*[āæā]\s+Tip:/,/^\s*Tip:/,/^\s*\?\s*for shortcuts/,/to interrupt\)/]};case"codex":return{promptPattern:c,separatorPattern:u,thinkingPattern:a,skipPatterns:[/^ā.*ā+$/,/^āŗ\s*$/,/^āŗ\s+(Implement|Find and fix|Type)/,a,/^\s*\d+%\s+context left/,/^\s*for shortcuts$/,/āā+ā®/,/ā°ā+āÆ/]};case"gemini":return{promptPattern:l,separatorPattern:/^gemini\s+--\s+/m,thinkingPattern:/(?!)/m,skipPatterns:[/^gemini\s+--\s+/,l,/^\s*$/]};default:return t("claude")}},vp:()=>p});let n=(0,r(43895).h)("cli-patterns"),i=RegExp(`[ā»ā½āŗ\xb7ā“ā¢ā³ā¶ā¦æāāāāāāāā ā ⠹⠸⠼⠓⠦⠧ā ā ]\\s+.+ā¦|to interrupt\\)`,"m"),a=/ā¢\s*(Planning|Searching|Exploring|Running|Thinking|Working|Reading|Writing|Analyzing)/m,s=/^[>āÆ](\s*$|\s+\S)/m,o=/^ā{10,}$/m,c=/^āŗ\s+.+/m,u=/^ā.*Worked for.*ā+$/m,l=/^(%|\$|.*@.*[%$#])\s*$/m;function d(t,e){let r;let s=n.withContext({cliToolId:t});switch(s.debug("detectThinking:check",{contentLength:e.length}),t){case"claude":default:r=i.test(e);break;case"codex":r=a.test(e);break;case"gemini":r=!1}return s.debug("detectThinking:result",{isThinking:r}),r}let m=/\x1b\[[0-9;]*[a-zA-Z]|\x1b\][^\x07]*\x07|\[[0-9;]*m/g;function p(t){return t.replace(m,"")}},43895:(t,e,r)=>{r.d(e,{Y:()=>c,h:()=>u});var n=r(93346);let i=[{pattern:/Bearer\s+[A-Za-z0-9\-._~+/]+=*/gi,replacement:"Bearer [REDACTED]"},{pattern:/(password|passwd|pwd)[=:]\s*\S+/gi,replacement:"$1=[REDACTED]"},{pattern:/(token|secret|api_key|apikey|auth)[=:]\s*\S+/gi,replacement:"$1=[REDACTED]"},{pattern:/CM_AUTH_TOKEN=\S+/gi,replacement:"CM_AUTH_TOKEN=[REDACTED]"},{pattern:/MCBD_AUTH_TOKEN=\S+/gi,replacement:"MCBD_AUTH_TOKEN=[REDACTED]"},{pattern:/Authorization:\s*\S+/gi,replacement:"Authorization: [REDACTED]"},{pattern:/-----BEGIN\s+\w+\s+PRIVATE\s+KEY-----[\s\S]*?-----END\s+\w+\s+PRIVATE\s+KEY-----/g,replacement:"[SSH_KEY_REDACTED]"}],a=/password|secret|token|key|auth/i,s={debug:0,info:1,warn:2,error:3};function o(t,e,r,o,c){let u=(0,n.LI)().level;if(s[t]<s[u])return;let l=o?function t(e){if("string"==typeof e){let t=e;for(let{pattern:e,replacement:r}of i)t=t.replace(e,r);return t}if("object"==typeof e&&null!==e){if(Array.isArray(e))return e.map(t);let r={};for(let[n,i]of Object.entries(e))a.test(n)?r[n]="[REDACTED]":r[n]=t(i);return r}return e}(o):void 0,d=function(t){if("json"===(0,n.LI)().format)return JSON.stringify(t);let{timestamp:e,level:r,module:i,action:a,data:s,worktreeId:o,cliToolId:c,requestId:u}=t,l=[o,c].filter(Boolean),d=l.length>0?` [${l.join(":")}]`:"",m=u?` (${u.slice(0,8)})`:"",p=s?` ${JSON.stringify(s)}`:"";return`[${e}] [${r.toUpperCase()}] [${i}]${d}${m} ${a}${p}`}({level:t,module:e,action:r,timestamp:new Date().toISOString(),...c,...l&&{data:l}});switch(t){case"error":console.error(d);break;case"warn":console.warn(d);break;default:console.log(d)}}function c(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}function u(t){let e=r=>({debug:(e,n)=>o("debug",t,e,n,r),info:(e,n)=>o("info",t,e,n,r),warn:(e,n)=>o("warn",t,e,n,r),error:(e,n)=>o("error",t,e,n,r),withContext:t=>e({...r,...t})});return e()}},10927:(t,e,r)=>{r.d(e,{AJ:()=>u,Hk:()=>a,Is:()=>o,ZV:()=>l,ed:()=>s,xq:()=>c});var n=r(61282);let i=(0,r(21764).promisify)(n.exec);async function a(t){try{return await i(`tmux has-session -t "${t}"`,{timeout:5e3}),!0}catch{return!1}}async function s(t,e){let r,n,a;"string"==typeof t?(r=t,n=e,a=5e4):(r=t.sessionName,n=t.workingDirectory,a=t.historyLimit||5e4);try{await i(`tmux new-session -d -s "${r}" -c "${n}"`,{timeout:5e3}),await i(`tmux set-option -t "${r}" history-limit ${a}`,{timeout:5e3})}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to create tmux session: ${t}`)}}async function o(t,e,r=!0){let n=e.replace(/'/g,"'\\''"),a=r?`tmux send-keys -t "${t}" '${n}' C-m`:`tmux send-keys -t "${t}" '${n}'`;try{await i(a,{timeout:5e3})}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to send keys to tmux session: ${t}`)}}async function c(t,e){let r,n;"number"==typeof e?(r=-e,n="-"):e?(r=e.startLine??-1e4,n=e.endLine??"-"):(r=-1e3,n="-");try{let{stdout:e}=await i(`tmux capture-pane -t "${t}" -p -e -S ${r} -E ${n}`,{timeout:5e3,maxBuffer:10485760});return e}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to capture pane: ${t}`)}}async function u(t){try{return await i(`tmux kill-session -t "${t}"`,{timeout:5e3}),!0}catch(e){let t=e instanceof Error?e.message:String(e);if(t?.includes("no server running")||t?.includes("can't find session"))return!1;throw Error(`Failed to kill tmux session: ${t}`)}}async function l(t,e){try{await i(`tmux send-keys -t "${t}" ${e}`,{timeout:5e3})}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to send special key: ${t}`)}}}};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";exports.id=9703,exports.ids=[9703],exports.modules={75433:(e,t,s)=>{s.d(t,{Vw:()=>j});var a=s(10326),r=s(17577);s(90434);var n=s(87403),l=s(2982),i=s(35047),o=s(3885),c=s(61421);let d=(0,r.memo)(function({status:e}){let t=c.F4[e];return"spinner"===t.type?a.jsx("span",{"data-testid":"status-indicator",className:`
|
|
2
|
-
w-3 h-3 rounded-full flex-shrink-0
|
|
3
|
-
border-2 border-t-transparent
|
|
4
|
-
${t.className}
|
|
5
|
-
animate-spin
|
|
6
|
-
`,title:t.label,"aria-label":t.label}):a.jsx("span",{"data-testid":"status-indicator",className:`
|
|
7
|
-
w-3 h-3 rounded-full flex-shrink-0
|
|
8
|
-
${t.className}
|
|
9
|
-
`,title:t.label,"aria-label":t.label})}),u=(0,r.memo)(function({branch:e,isSelected:t,onClick:s}){return(0,a.jsxs)("button",{"data-testid":"branch-list-item",onClick:s,"aria-current":t?"true":void 0,className:`
|
|
10
|
-
w-full px-4 py-3 flex flex-col gap-1
|
|
11
|
-
hover:bg-gray-800 transition-colors
|
|
12
|
-
focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500
|
|
13
|
-
${t?"bg-gray-700 border-l-2 border-blue-500":"border-l-2 border-transparent"}
|
|
14
|
-
`,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 w-full",children:[a.jsx(d,{status:e.status}),(0,a.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[a.jsx("p",{className:"text-sm font-medium text-white truncate",children:e.name}),a.jsx("p",{className:"text-xs text-gray-400 truncate",children:e.repositoryName})]}),e.hasUnread&&a.jsx("span",{"data-testid":"unread-indicator",className:"w-2 h-2 rounded-full bg-blue-500 flex-shrink-0","aria-label":"Has unread messages"})]}),e.description&&a.jsx("div",{"data-testid":"branch-description",className:"pl-6 pr-2 mt-1 text-left",children:a.jsx("p",{className:"text-xs text-gray-400 line-clamp-2",children:e.description})})]})}),m=[{key:"updatedAt",label:"Updated"},{key:"repositoryName",label:"Repository"},{key:"branchName",label:"Branch"},{key:"status",label:"Status"}],x=(0,r.memo)(function(){let{sortKey:e,sortDirection:t,setSortKey:s,setSortDirection:l}=(0,n.Sz)(),[i,o]=(0,r.useState)(!1),c=(0,r.useRef)(null);(0,r.useEffect)(()=>{function e(e){c.current&&!c.current.contains(e.target)&&o(!1)}if(i)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]),(0,r.useEffect)(()=>{function e(e){"Escape"===e.key&&o(!1)}if(i)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[i]);let d=(0,r.useCallback)(()=>{o(e=>!e)},[]),u=(0,r.useCallback)(a=>{a===e?l("asc"===t?"desc":"asc"):(s(a),l("updatedAt"===a?"desc":"asc")),o(!1)},[e,t,s,l]),x=(0,r.useCallback)(()=>{l("asc"===t?"desc":"asc")},[t,l]),g=m.find(t=>t.key===e)?.label||"Sort";return(0,a.jsxs)("div",{ref:c,className:"relative","data-testid":"sort-selector",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsxs)("button",{type:"button",onClick:d,"aria-expanded":i,"aria-haspopup":"listbox","aria-label":`Sort by ${g}`,className:" flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-300 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 transition-colors ",children:[a.jsx(p,{className:"w-3 h-3"}),a.jsx("span",{className:"hidden sm:inline",children:g})]}),a.jsx("button",{type:"button",onClick:x,"aria-label":"asc"===t?"Sort ascending":"Sort descending",className:" p-1 rounded text-gray-300 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 transition-colors ",children:"asc"===t?a.jsx(h,{className:"w-3 h-3"}):a.jsx(b,{className:"w-3 h-3"})})]}),i&&a.jsx("div",{role:"listbox","aria-label":"Sort options",className:" absolute right-0 top-full mt-1 z-50 min-w-[140px] py-1 rounded-md shadow-lg bg-gray-800 border border-gray-600 ",children:m.map(s=>(0,a.jsxs)("button",{type:"button",role:"option","aria-selected":e===s.key,onClick:()=>u(s.key),className:`
|
|
15
|
-
w-full px-3 py-2 text-left text-sm
|
|
16
|
-
flex items-center justify-between
|
|
17
|
-
hover:bg-gray-700 transition-colors
|
|
18
|
-
${e===s.key?"text-blue-400":"text-gray-300"}
|
|
19
|
-
`,children:[a.jsx("span",{children:s.label}),e===s.key&&a.jsx("span",{className:"text-xs",children:"asc"===t?"ASC":"DESC"})]},s.key))})]})});function p({className:e}){return a.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4h13M3 8h9m-9 4h6m4 0l4-4m0 0l4 4m-4-4v12"})})}function h({className:e}){return a.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}function b({className:e}){return a.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function g(e){let t=function(e){let t=e.sessionStatusByCli?.claude;if(t){if(t.isWaitingForResponse)return"waiting";if(t.isProcessing)return"running";if(t.isRunning)return"ready"}return e.isWaitingForResponse?"waiting":e.isProcessing?"running":e.isSessionRunning?"ready":"idle"}(e),s=!!e.lastAssistantMessageAt&&(!e.lastViewedAt||new Date(e.lastAssistantMessageAt)>new Date(e.lastViewedAt));return{id:e.id,name:e.name,repositoryName:e.repositoryName,status:t,hasUnread:s,lastActivity:e.updatedAt,description:e.description}}let f={waiting:0,ready:1,running:2,generating:3,idle:4},y=(0,r.memo)(function(){let e=(0,i.useRouter)(),{worktrees:t,selectedWorktreeId:s,selectWorktree:l}=(0,o.Mu)(),{closeMobileDrawer:c,sortKey:d,sortDirection:m}=(0,n.Sz)(),[p,h]=(0,r.useState)(""),b=(0,r.useMemo)(()=>{let e=t.map(g),s=e;if(p.trim()){let t=p.toLowerCase();s=e.filter(e=>e.name.toLowerCase().includes(t)||e.repositoryName.toLowerCase().includes(t))}return function(e,t,s){let a=[...e];return a.sort((e,a)=>{let r=0;switch(t){case"updatedAt":{let t=e=>e?e instanceof Date?e.getTime():new Date(e).getTime():0,s=t(e.lastActivity);r=t(a.lastActivity)-s;break}case"repositoryName":{let t=e.repositoryName.toLowerCase(),s=a.repositoryName.toLowerCase();r=t.localeCompare(s);break}case"branchName":{let t=e.name.toLowerCase(),s=a.name.toLowerCase();r=t.localeCompare(s);break}case"status":r=f[e.status]-f[a.status]}return("updatedAt"===t?"desc"===s:"asc"===s)?r:-r}),a}(s,d,m)},[t,p,d,m]),y=t=>{l(t),e.push(`/worktrees/${t}`),c()};return(0,a.jsxs)("nav",{"data-testid":"sidebar","aria-label":"Branch navigation",className:"h-full flex flex-col bg-gray-900 text-white",role:"navigation",children:[a.jsx("div",{"data-testid":"sidebar-header",className:"flex-shrink-0 px-4 py-4 border-b border-gray-700",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"text-lg font-semibold text-white",children:"Branches"}),a.jsx(x,{})]})}),a.jsx("div",{className:"flex-shrink-0 px-4 py-3 border-b border-gray-700",children:a.jsx("input",{type:"text",placeholder:"Search branches...",value:p,onChange:e=>h(e.target.value),className:" w-full px-3 py-2 rounded-md bg-gray-800 text-white placeholder-gray-400 border border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent "})}),a.jsx("div",{"data-testid":"branch-list",className:"flex-1 overflow-y-auto",children:0===b.length?a.jsx("div",{className:"px-4 py-8 text-center text-gray-400",children:p?"No branches found":"No branches available"}):b.map(e=>a.jsx(u,{branch:e,isSelected:e.id===s,onClick:()=>y(e.id)},e.id))})]})});var w=s(22202);let v="transform transition-transform duration-300 ease-out",j=(0,r.memo)(function({children:e}){let{isOpen:t,isMobileDrawerOpen:s,closeMobileDrawer:r}=(0,n.Sz)();return(0,l.d)()?(0,a.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex flex-col",children:[s&&a.jsx("div",{"data-testid":"drawer-overlay",className:"fixed inset-0 bg-black/50 z-40",onClick:r,"aria-hidden":"true"}),a.jsx("aside",{"data-testid":"sidebar-container",className:`
|
|
20
|
-
fixed left-0 top-0 h-full w-72 z-50
|
|
21
|
-
${v}
|
|
22
|
-
${s?"translate-x-0":"-translate-x-full"}
|
|
23
|
-
`,role:"complementary",children:a.jsx(y,{})}),a.jsx("main",{className:"flex-1 min-h-0 overflow-hidden",role:"main",children:e})]}):(0,a.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex",children:[a.jsx("aside",{"data-testid":"sidebar-container",className:`
|
|
24
|
-
fixed left-0 top-0 h-full w-72
|
|
25
|
-
${v}
|
|
26
|
-
${t?"translate-x-0":"-translate-x-full"}
|
|
27
|
-
`,style:{zIndex:w.k.SIDEBAR},role:"complementary","aria-hidden":!t,children:a.jsx(y,{})}),a.jsx("main",{className:`
|
|
28
|
-
flex-1 min-w-0 h-full overflow-hidden
|
|
29
|
-
transition-[padding] duration-300 ease-out
|
|
30
|
-
${t?"md:pl-72":"md:pl-0"}
|
|
31
|
-
`,role:"main",children:e})]})})},28676:(e,t,s)=>{s.d(t,{u:()=>n});var a=s(10326),r=s(17577);function n({isOpen:e,onClose:t,title:s,children:n,size:l="lg",showCloseButton:i=!0,disableClose:o=!1}){let c=(0,r.useRef)(null);return e?(0,a.jsxs)("div",{className:"fixed inset-0 z-50 overflow-y-auto",children:[a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 transition-opacity",onClick:o?void 0:t}),a.jsx("div",{className:"flex min-h-full items-center justify-center p-2 sm:p-4",children:(0,a.jsxs)("div",{ref:c,className:`relative w-full ${{sm:"max-w-[calc(100vw-2rem)] sm:max-w-md",md:"max-w-[calc(100vw-2rem)] sm:max-w-2xl",lg:"max-w-[calc(100vw-2rem)] sm:max-w-4xl",xl:"max-w-[calc(100vw-2rem)] sm:max-w-6xl",full:"max-w-[calc(100vw-2rem)] sm:max-w-[95vw]"}[l]} bg-white rounded-lg shadow-xl transform transition-all`,children:[(s||i)&&(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 sm:px-6 py-3 sm:py-4 border-b border-gray-200",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold text-gray-900 truncate pr-2",children:s}),i&&a.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 transition-colors flex-shrink-0",children:a.jsx("svg",{className:"w-5 h-5 sm:w-6 sm:h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx("div",{className:"px-4 sm:px-6 py-3 sm:py-4",children:n})]})})]}):null}},77758:(e,t,s)=>{s.d(t,{Ct:()=>c,zx:()=>r,Zb:()=>n,aY:()=>o,Ol:()=>l,ll:()=>i,u_:()=>d.u});var a=s(10326);function r({variant:e="primary",size:t="md",fullWidth:s=!1,loading:r=!1,disabled:n,className:l="",children:i,...o}){let c=["btn",{primary:"btn-primary",secondary:"btn-secondary",danger:"btn-danger",ghost:"bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-500"}[e],{sm:"btn-sm",md:"",lg:"btn-lg"}[t],s?"w-full":"",n||r?"opacity-50 cursor-not-allowed":"",l].filter(Boolean).join(" ");return(0,a.jsxs)("button",{className:c,disabled:n||r,...o,children:[r&&(0,a.jsxs)("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),i]})}function n({hover:e=!1,padding:t="md",className:s="",children:r,...n}){let l=["card",e?"card-hover":"",{none:"",sm:"p-3",md:"p-4",lg:"p-6"}[t],s].filter(Boolean).join(" ");return a.jsx("div",{className:l,...n,children:r})}function l({className:e="",children:t,...s}){return a.jsx("div",{className:`mb-3 ${e}`,...s,children:t})}function i({className:e="",children:t,...s}){return a.jsx("h3",{className:`text-lg font-semibold text-gray-900 ${e}`,...s,children:t})}function o({className:e="",children:t,...s}){return a.jsx("div",{className:e,...s,children:t})}function c({variant:e="gray",dot:t=!1,className:s="",children:r,...n}){let l=["badge",{success:"badge-success",warning:"badge-warning",error:"badge-error",info:"badge-info",gray:"badge-gray"}[e],s].filter(Boolean).join(" ");return(0,a.jsxs)("span",{className:l,...n,children:[t&&a.jsx("span",{className:`mr-1.5 inline-block h-2 w-2 rounded-full ${{success:"bg-green-600",warning:"bg-yellow-600",error:"bg-red-600",info:"bg-blue-600",gray:"bg-gray-600"}[e]}`,"aria-hidden":"true"}),r]})}s(17577);var d=s(28676)},15470:(e,t,s)=>{s.d(t,{R:()=>m});var a=s(10326),r=s(17577),n=s(73002);function l(e,t){if(!t.trim())return e;let s=t.toLowerCase();return e.map(e=>({...e,commands:e.commands.filter(e=>{let t=e.name.toLowerCase().includes(s),a=e.description.toLowerCase().includes(s);return t||a})})).filter(e=>e.commands.length>0)}function i({groups:e,onSelect:t,highlightedIndex:s=-1,className:r=""}){let n=0;return 0===e.length?a.jsx("div",{className:`text-sm text-gray-500 p-4 text-center ${r}`,children:"No commands available"}):a.jsx("div",{className:`overflow-y-auto ${r}`,children:e.map(e=>(0,a.jsxs)("div",{className:"mb-2",children:[a.jsx("div",{className:"px-3 py-1.5 text-xs font-semibold text-gray-500 uppercase tracking-wider bg-gray-50",children:e.label}),a.jsx("div",{children:e.commands.map(e=>{let r=n;n++;let l=r===s;return(0,a.jsxs)("button",{type:"button","data-command-item":!0,"data-highlighted":l,onClick:()=>t(e),className:`w-full px-3 py-2 text-left flex items-start gap-2 hover:bg-blue-50 transition-colors ${l?"bg-blue-100":""}`,children:[(0,a.jsxs)("span",{className:"text-blue-600 font-mono text-sm flex-shrink-0",children:["/",e.name]}),a.jsx("span",{className:"text-gray-600 text-sm truncate",children:e.description})]},e.name)})})]},e.category))})}function o({isOpen:e,groups:t,onSelect:s,onClose:n,isMobile:o=!1,position:c,onFreeInput:d}){let[u,m]=(0,r.useState)(""),[x,p]=(0,r.useState)(0),h=(0,r.useRef)(null),b=(0,r.useMemo)(()=>l(t,u),[t,u]),g=(0,r.useMemo)(()=>b.flatMap(e=>e.commands),[b]),f=(0,r.useCallback)(e=>{s(e),n()},[s,n]);return((0,r.useCallback)(t=>{if(e)switch(t.key){case"Escape":t.preventDefault(),n();break;case"ArrowDown":t.preventDefault(),p(e=>Math.min(e+1,g.length-1));break;case"ArrowUp":t.preventDefault(),p(e=>Math.max(e-1,0));break;case"Enter":t.preventDefault(),g[x]&&f(g[x])}},[e,g,x,n,f]),e)?o?(0,a.jsxs)(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/50 z-40",onClick:n,"aria-hidden":"true"}),(0,a.jsxs)("div",{"data-testid":"slash-command-bottom-sheet",className:"fixed bottom-0 left-0 right-0 bg-white rounded-t-xl z-50 max-h-[70vh] flex flex-col shadow-xl",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200",children:[a.jsx("h2",{className:"text-lg font-semibold",children:"Commands"}),a.jsx("button",{type:"button",onClick:n,"aria-label":"Close",className:"p-2 rounded-full hover:bg-gray-100",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx("div",{className:"px-4 py-2 border-b border-gray-100",children:a.jsx("input",{ref:h,type:"text",value:u,onChange:e=>m(e.target.value),placeholder:"Search commands...",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"})}),d&&(0,a.jsxs)("button",{type:"button","data-testid":"free-input-button",onClick:d,className:"w-full px-4 py-3 text-left border-b border-gray-100 flex items-center gap-2 hover:bg-blue-50 transition-colors",children:[a.jsx("span",{className:"text-blue-600",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),a.jsx("span",{className:"text-gray-600",children:"Enter custom command..."})]}),a.jsx(i,{groups:b,onSelect:f,highlightedIndex:x,className:"flex-1 overflow-y-auto pb-20"})]})]}):(0,a.jsxs)("div",{role:"listbox",className:"absolute bg-white border border-gray-200 rounded-lg shadow-lg z-50 w-80 max-h-96 flex flex-col",style:c?{top:c.top,left:c.left}:{bottom:"100%",left:0,marginBottom:"4px"},children:[a.jsx("div",{className:"px-3 py-2 border-b border-gray-100",children:a.jsx("input",{ref:h,type:"text",value:u,onChange:e=>m(e.target.value),placeholder:"Search commands...",className:"w-full px-3 py-1.5 text-sm border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-blue-500"})}),d&&(0,a.jsxs)("button",{type:"button","data-testid":"free-input-button",onClick:d,className:"w-full px-3 py-2 text-left border-b border-gray-100 flex items-center gap-2 hover:bg-blue-50 transition-colors text-sm",children:[a.jsx("span",{className:"text-blue-600",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),a.jsx("span",{className:"text-gray-600",children:"Enter custom command..."})]}),a.jsx(i,{groups:b,onSelect:f,highlightedIndex:x,className:"flex-1 overflow-y-auto"}),(0,a.jsxs)("div",{className:"px-3 py-1.5 border-t border-gray-100 text-xs text-gray-400 flex gap-3",children:[(0,a.jsxs)("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 rounded",children:"Enter"})," select"]}),(0,a.jsxs)("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 rounded",children:"Esc"})," close"]})]})]}):null}function c({worktreeId:e,cliToolId:t,disabled:s=!1,onInterrupt:n}){let[l,i]=(0,r.useState)(!1),o=(0,r.useRef)(0),c=(0,r.useCallback)(async()=>{let s=Date.now();if(!(s-o.current<1e3)){o.current=s,i(!0);try{let s=await fetch(`/api/worktrees/${e}/interrupt`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cliToolId:t})});if(s.ok)n?.();else{let e=await s.json().catch(()=>({}));console.error("[InterruptButton] Failed to send interrupt:",e.error||s.statusText)}}catch(e){console.error("[InterruptButton] Error sending interrupt:",e)}finally{i(!1)}}},[e,t,n]);return a.jsx("button",{type:"button",onClick:c,disabled:s||l,className:"flex-shrink-0 p-2 text-orange-600 hover:bg-orange-50 rounded-full transition-colors disabled:text-gray-300 disabled:hover:bg-transparent","aria-label":"Stop processing","data-testid":"interrupt-button",children:l?(0,a.jsxs)("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):a.jsx(d,{})})}function d(){return a.jsx("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 24 24",children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}var u=s(2982);function m({worktreeId:e,onMessageSent:t,cliToolId:s,isSessionRunning:i=!1}){let[d,m]=(0,r.useState)(""),[x,p]=(0,r.useState)(!1),[h,b]=(0,r.useState)(null),[g,f]=(0,r.useState)(!1),[y,w]=(0,r.useState)(!1),v=(0,r.useRef)(null),j=(0,r.useRef)(null),N=(0,r.useRef)(!1),k=(0,r.useRef)(null),C=(0,u.d)(),{groups:S}=function(e){let[t,s]=(0,r.useState)([]),[a,i]=(0,r.useState)(!0),[o,c]=(0,r.useState)(null),[d,u]=(0,r.useState)(""),m=(0,r.useCallback)(async()=>{try{i(!0),c(null);let t=e?`/api/worktrees/${e}/slash-commands`:"/api/slash-commands",a=await fetch(t);if(!a.ok)throw Error(`HTTP error ${a.status}`);let r=await a.json();s(r.groups)}catch(e){c((0,n.zG)(e)),s([])}finally{i(!1)}},[e]),x=(0,r.useMemo)(()=>t.flatMap(e=>e.commands),[t]),p=(0,r.useMemo)(()=>l(t,d),[t,d]);return{groups:t,filteredGroups:p,allCommands:x,loading:a,error:o,filter:d,setFilter:u,refresh:(0,r.useCallback)(()=>{m()},[m])}}(e),L=async()=>{if(!g&&d.trim()&&!x)try{p(!0),b(null);let a=s||"claude";await n.Iv.sendMessage(e,d.trim(),a),m(""),t?.(a)}catch(e){b((0,n.zG)(e))}finally{p(!1)}},M=async e=>{e.preventDefault(),await L()},E=()=>{w(!1),v.current?.focus()};return(0,a.jsxs)("div",{ref:k,className:"space-y-2 relative",children:[h&&a.jsx("div",{className:"p-2 bg-red-50 border border-red-200 rounded text-sm text-red-800",children:h}),(0,a.jsxs)("form",{onSubmit:M,className:"flex items-end gap-2 bg-white border border-gray-300 rounded-lg px-4 py-2 focus-within:border-blue-500 focus-within:ring-1 focus-within:ring-blue-500",children:[C&&a.jsx("button",{type:"button",onClick:()=>w(!0),className:"flex-shrink-0 p-2 text-gray-500 hover:text-blue-600 hover:bg-blue-50 rounded-full transition-colors","aria-label":"Show slash commands","data-testid":"mobile-command-button",children:a.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"})})}),a.jsx("textarea",{ref:v,value:d,onChange:e=>{let t=e.target.value;m(t),"/"===t||t.startsWith("/")&&!t.includes(" ")?w(!0):w(!1)},onKeyDown:e=>{let{keyCode:t}=e.nativeEvent;if(229!==t){if("Escape"===e.key&&y){e.preventDefault(),E();return}if(N.current&&"Enter"===e.key){N.current=!1;return}if("Enter"===e.key&&!g&&!y){if(C)return;e.shiftKey||(e.preventDefault(),L())}}},onCompositionStart:()=>{f(!0),N.current=!1,j.current&&clearTimeout(j.current)},onCompositionEnd:()=>{f(!1),N.current=!0,j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{N.current=!1},300)},placeholder:C?"Type your message...":"Type your message... (/ for commands, Shift+Enter for line break)",disabled:x,rows:1,className:"flex-1 outline-none bg-transparent resize-none py-1 overflow-y-auto scrollbar-thin",style:{minHeight:"24px",maxHeight:"160px"}}),a.jsx(c,{worktreeId:e,cliToolId:s||"claude",disabled:!i}),a.jsx("button",{type:"submit",disabled:!d.trim()||x,className:"flex-shrink-0 p-2 text-blue-600 hover:bg-blue-50 rounded-full transition-colors disabled:text-gray-300 disabled:hover:bg-transparent","aria-label":"Send message",children:x?(0,a.jsxs)("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):a.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})})]}),a.jsx(o,{isOpen:y,groups:S,onSelect:e=>{m(`/${e.name} `),w(!1),v.current?.focus()},onClose:E,isMobile:C,onFreeInput:()=>{w(!1),m("/"),setTimeout(()=>{v.current?.focus()},50)}})]})}},61421:(e,t,s)=>{s.d(t,{F4:()=>r,Ie:()=>l,xh:()=>n});let a={idle:"bg-gray-500",ready:"bg-green-500",spinner:"border-blue-500",waiting:"bg-yellow-500",error:"bg-red-500"},r={idle:{className:a.idle,label:"Idle",type:"dot"},ready:{className:a.ready,label:"Ready",type:"dot"},running:{className:a.spinner,label:"Running",type:"spinner"},waiting:{className:a.waiting,label:"Waiting for response",type:"dot"},generating:{className:a.spinner,label:"Generating",type:"spinner"}},n={idle:{className:a.idle,label:"Idle",type:"dot"},ready:{className:a.ready,label:"Ready",type:"dot"},running:{className:a.spinner,label:"Running",type:"spinner"},waiting:{className:a.waiting,label:"Waiting for response",type:"dot"},error:{className:a.error,label:"Error",type:"dot"}},l={idle:{className:a.idle,label:"Idle - No active session",type:"dot"},ready:{className:a.ready,label:"Ready - Waiting for input",type:"dot"},running:{className:a.spinner,label:"Running - Processing",type:"spinner"},waiting:{className:a.waiting,label:"Waiting - User input required",type:"dot"},error:{className:a.error,label:"Error",type:"dot"}}},22202:(e,t,s)=>{s.d(t,{k:()=>a});let a={DROPDOWN:10,SIDEBAR:30,MODAL:50,MAXIMIZED_EDITOR:55,TOAST:60,CONTEXT_MENU:70}},2982:(e,t,s)=>{s.d(t,{d:()=>r});var a=s(17577);function r(e={}){let{breakpoint:t=768}=e,[s,r]=(0,a.useState)(!1);return s}},63601:(e,t,s)=>{s.r(t),s.d(t,{default:()=>r});var a=s(66621);let r=e=>[{type:"image/png",sizes:"180x180",url:(0,a.fillMetadataSegment)(".",e.params,"apple-icon.png")+"?31a89e65aa4ac65b"}]},71150:(e,t,s)=>{s.r(t),s.d(t,{default:()=>r});var a=s(66621);let r=e=>[{type:"image/png",sizes:"32x32",url:(0,a.fillMetadataSegment)(".",e.params,"icon.png")+"?32d9127ba30ee286"}]}};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
exports.id=9723,exports.ids=[9723],exports.modules={58359:()=>{},93739:()=>{},89287:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});let r=/š Session log: (.+?\/([^\/\s]+\.jsonl))/,s=/Request ID: ([^\s\n]+)/,o=/Summary: (.+?)(?:\nā|$)/s;function i(e){let t={content:e},n=r.exec(e);n&&(t.logFileName=n[2]);let i=s.exec(e);i&&(t.requestId=i[1]);let l=o.exec(e);return l&&(t.summary=l[1].trim()),t}},76966:(e,t,n)=>{"use strict";n.d(t,{o:()=>o});var r=n(75748),s=n(98636);async function o(e,t,n,o="claude"){let i=(0,r.vX)(e,t);if(i)try{await (0,s.xN)(t,i.content,n,o)}catch(e){console.error("[recordClaudeConversation] Failed to create log file:",e)}}},98636:(e,t,n)=>{"use strict";n.d(t,{e7:()=>p,xN:()=>d});var r=n(20629),s=n.n(r),o=n(55315),i=n.n(o),l=n(73853);let a=(0,n(93346).Hb)("CM_LOG_DIR")||i().join(process.cwd(),"data","logs");function c(e="claude"){return i().join(a,e)}async function u(e="claude"){let t=c(e);try{await s().access(t)}catch{await s().mkdir(t,{recursive:!0})}}async function d(e,t,n,r="claude"){await u(r);let o=function(e,t="claude"){let n=(0,l.WU)(new Date,"yyyy-MM-dd"),r=`${e}-${n}.md`,s=c(t);return i().join(s,r)}(e,r),a=(0,l.WU)(new Date,"yyyy-MM-dd HH:mm:ss"),d="";try{d=await s().readFile(o,"utf-8")}catch{let t="claude"===r?"Claude Code":"codex"===r?"Codex CLI":"Gemini CLI";d=`# ${t} Conversation Log: ${e}
|
|
2
|
-
|
|
3
|
-
Created: ${a}
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
`}return d+=`## Conversation at ${a}
|
|
8
|
-
|
|
9
|
-
### User
|
|
10
|
-
|
|
11
|
-
${t}
|
|
12
|
-
|
|
13
|
-
### ${"claude"===r?"Claude":"codex"===r?"Codex":"Gemini"}
|
|
14
|
-
|
|
15
|
-
${n}
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
`,await s().writeFile(o,d,"utf-8"),o}async function p(e,t="all"){let n=[];for(let r of"all"===t?["claude","codex","gemini"]:[t]){await u(r);let t=c(r);try{let r=(await s().readdir(t)).filter(t=>t.startsWith(`${e}-`)&&t.endsWith(".md")).map(e=>i().join(t,e));n.push(...r)}catch{}}return n.sort().reverse()}},59991:(e,t,n)=>{"use strict";n.d(t,{FN:()=>h,RJ:()=>m,ci:()=>f,cn:()=>C});var r=n(89194),s=n(97425),o=n(75748),i=n(25079),l=n(63661),a=n(76966),c=n(89287),u=n(19377);let d=new Map,p=new Map;function f(e){let t=(0,u.vp)(e).split("\n"),n=-1;for(let e=t.length-1;e>=0;e--)if(/^āÆ\s+\S/.test(t[e])){n=e;break}let r=n>=0?n+1:0,s=t.slice(r),o=[/CLAUDE_HOOKS_/,/\/bin\/claude/,/^claude\s*$/,/@.*\s+%\s*$/,/^[^āŗ]*curl.*POST/,/^[^āŗ]*Content-Type/,/^[^āŗ]*export\s+CLAUDE_/,/^\s*$/,/^[āā®ā°āÆāā\s]+$/,/^[āāā®ā°āÆ].*[āāā®ā°āÆ]$/,/Claude Code v[\d.]+/,/^Tips for getting started/,/^Welcome back/,/Run \/init to create/,/^Recent activity/,/^No recent activity/,/āāāāāāā|āāāāāāāāā|āā āā/,/^\s*Opus \d+\.\d+\s*Ā·\s*Claude Max/,/\.com's Organization/,/\?\s*for shortcuts\s*$/,/^ā{10,}$/,/^āÆ\s*$/],i=[];for(let e of s)!o.some(t=>t.test(e))&&e.trim()&&i.push(e);return i.join("\n").trim()}function m(e){let t=e.split("\n"),n=[],r=[/^maenokota@.*%/,/^zsh:/,/^feature-issue-\d+/,/^\s*$/],s=!1,o=[];for(let e of t){if(e.includes("ā¦")){s=!0;let t=e.indexOf("ā¦"),n=e.substring(t+1).trim();n&&o.push(n);continue}if(s){if(r.some(t=>t.test(e)))continue;o.push(e)}}if(o.length>0)return o.join("\n").trim();for(let e of t)r.some(t=>t.test(e))||n.push(e);return n.join("\n").trim()}async function g(e,t){let n=(0,s.n)();try{if(!(0,o.gU)(n,e))return console.error(`Worktree ${e} not found, stopping poller`),h(e,t),!1;if(!await (0,r.Lg)(e,t))return h(e,t),!1;let s=(0,o.zl)(n,e,t),d=s?.lastCapturedLine||0,p=await (0,r.NA)(e,t,1e4),g=function(e,t,n){let r=e.split("\n"),s=r.length;for(;s>0&&""===r[s-1].trim();)s--;let o=r.slice(0,s),i=o.length,a=i>0&&t>25&&i+25<t||i>0&&t>50&&i<50;if(!a&&i<t-5)return null;let c=o.slice(Math.max(0,i-20)).join("\n"),{promptPattern:d,separatorPattern:p,thinkingPattern:f,skipPatterns:m}=(0,u.bs)(n),g=(e=60)=>{let t="codex"===n?/^āŗ\s+(?!Implement|Find and fix|Type|Summarize)/:/^[>āÆ]\s+\S/;for(let n=i-1;n>=Math.max(0,i-e);n--){let e=(0,u.vp)(o[n]);if(t.test(e))return n}return -1};if("claude"===n){let e=o.join("\n"),t=(0,u.vp)(e);if((0,l.F)(t).isPrompt)return{response:t,isComplete:!0,lineCount:i}}let C=(0,u.vp)(c),h=d.test(C),$=p.test(C),y=f.test(C),w=("codex"===n||"gemini"===n)&&h&&!y,x="claude"===n&&h&&$&&!y;if(w||x){let e;let r=[];if(t>=i||a){let t=g(40);e=t>=0?t+1:0}else if("codex"===n)e=Math.max(0,t);else if(t>=i-5){let t=g(50);e=t>=0?t+1:Math.max(0,i-40)}else e=Math.max(0,t);let s=i;for(let t=e;t<i;t++){let e=o[t],i=(0,u.vp)(e);if("codex"===n&&/^āŗ\s+/.test(i)||"gemini"===n&&/^(%|\$|.*@.*[%$#])\s*$/.test(i)){s=t;break}m.some(e=>e.test(i))||r.push(e)}let l=r.join("\n").trim();if(f.test(l))return{response:"",isComplete:!1,lineCount:i};if("claude"===n){let e=(0,u.vp)(l),t=/[āā®ā°āÆā]/.test(e)||/ā{3,}/.test(e)||/ā{3,}/.test(e),n=/Claude Code|claude\/|v\d+\.\d+/.test(e),r=/Tip:|for shortcuts|\?\s*for help/.test(e),s=/^\s*\/Users\/.*$/m.test(e)&&e.split("\n").length<30,o=e.match(/^[>āÆ]\s+(\S.*)$/m);if(o){let t=e.indexOf(o[0]);if(0===e.substring(t+o[0].length).trim().split("\n").filter(e=>{let t=e.trim();return t&&!m.some(e=>e.test(t))&&!/^ā+$/.test(t)}).length)return{response:"",isComplete:!1,lineCount:i}}else if((t||n||r||s)&&l.length<2e3)return{response:"",isComplete:!1,lineCount:i}}return"gemini"===n&&((l.match(/[āāāā]/g)||[]).length>.3*l.length||l.includes("Waiting for auth")||l.includes("ā ")||l.includes("ā ")||l.includes("ā ¹")||l.includes("ā ø")||l.includes("ā ¼")||l.includes("ā “")||l.includes("ā ¦")||l.includes("ā §")||l.includes("ā ")||l.includes("ā ")||!l.includes("ā¦")&&l.length<10)?{response:"",isComplete:!1,lineCount:i}:{response:l,isComplete:!0,lineCount:s}}let v=o.join("\n");if((0,l.F)(v).isPrompt)return{response:v,isComplete:!0,lineCount:i};let M=[],k=a||t>=i-5,I=k?g(80):-1,S=k?I>=0?I+1:Math.max(0,i-80):Math.max(0,t);for(let e=S;e<i;e++){let t=o[e],n=(0,u.vp)(t);m.some(e=>e.test(n))||M.push(t)}let b=M.join("\n").trim();return b?{response:b,isComplete:!1,lineCount:i}:{response:"",isComplete:!1,lineCount:i}}(p,d,t);if(!g||!g.isComplete){let{thinkingPattern:r}=(0,u.bs)(t),s=(0,u.vp)(p);if(r.test(s)){let r=(0,o.GP)(n,e,t);r>0&&console.log(`Marked ${r} pending prompt(s) as answered (thinking detected) for ${e}`)}return!1}if(g.lineCount===d&&!s?.inProgressMessageId)return!1;if(g.lineCount<=d)return console.log(`[checkForResponse] Already saved up to line ${d}, skipping (result: ${g.lineCount})`),!1;let C=(0,l.F)(g.response);if(C.isPrompt){(0,o.Mf)(n,e,t);let r=(0,o.tn)(n,{worktreeId:e,role:"assistant",content:C.cleanContent,messageType:"prompt",promptData:C.promptData,timestamp:new Date,cliToolId:t});return(0,o.IH)(n,e,t,g.lineCount),(0,i.ps)("message",{worktreeId:e,message:r}),h(e,t),!0}if(!g.response||""===g.response.trim())return(0,o.IH)(n,e,t,g.lineCount),!1;let $="claude"===t?(0,c.Z)(g.response):void 0,y=g.response;if("gemini"===t?y=m(g.response):"claude"===t&&(y=f(g.response)),!y||""===y.trim()||"[No content]"===y)return(0,o.IH)(n,e,t,g.lineCount),(0,o.Mf)(n,e,t),!1;y&&await (0,a.o)(n,e,y,t);let w=(0,o.GP)(n,e,t);w>0&&console.log(`Marked ${w} pending prompt(s) as answered for ${e}`);let x=(0,o.zl)(n,e,t);if(x&&g.lineCount<=x.lastCapturedLine)return console.log(`[checkForResponse] Race condition detected, skipping save (result: ${g.lineCount}, current: ${x.lastCapturedLine})`),!1;let v=(0,o.tn)(n,{worktreeId:e,role:"assistant",content:y,messageType:"normal",timestamp:new Date,cliToolId:t,summary:$?.summary,logFileName:$?.logFileName,requestId:$?.requestId});return(0,i.ps)("message",{worktreeId:e,message:v}),(0,o.IH)(n,e,t,g.lineCount),!0}catch(t){return console.error(`Error checking for response (${e}):`,t instanceof Error?t.message:String(t)),!1}}function C(e,t){let n=`${e}:${t}`;h(e,t),p.set(n,Date.now());let r=setInterval(async()=>{let r=p.get(n);if(r&&Date.now()-r>3e5){h(e,t);return}try{await g(e,t)}catch(e){console.error("[Poller] Error:",e)}},2e3);d.set(n,r)}function h(e,t){let n=`${e}:${t}`,r=d.get(n);r&&(clearInterval(r),d.delete(n),p.delete(n))}},25079:(e,t,n)=>{"use strict";n.d(t,{ZV:()=>c,fM:()=>l,ps:()=>a});var r=n(34893);let s=new Map,o=new Map;function i(e,t){let n=o.get(e);if(console.log(`[WS] handleBroadcast called for ${e}, room size: ${n?.size||0}`),!n){console.log(`[WS] No room found for ${e}`);return}if(0===n.size){console.log(`[WS] Room for ${e} is empty`);return}try{let s=JSON.stringify({type:"broadcast",worktreeId:e,data:t}),o=0,i=0;n.forEach(e=>{if(e.readyState===r.XY.OPEN)try{e.send(s),o++}catch(e){i++,console.error("Error sending WebSocket message to client:",e)}}),console.log(`Broadcast to worktree ${e}: ${o}/${n.size} clients (${i} errors)`)}catch(t){console.error(`Error broadcasting to worktree ${e}:`,t);try{let t=JSON.stringify({type:"broadcast",worktreeId:e,data:{error:"Message encoding error"}});n.forEach(e=>{if(e.readyState===r.XY.OPEN)try{e.send(t)}catch{}})}catch(e){console.error("Failed to send fallback message:",e)}}}function l(e,t){i(e,t)}function a(e,t){t.worktreeId?i(t.worktreeId,{type:e,...t}):console.warn("broadcastMessage called without worktreeId")}function c(e){for(let t of e){let e=o.get(t);e&&(e.forEach(e=>{let n=s.get(e);n&&n.worktreeIds.delete(t)}),o.delete(t),console.log(`[WS] Cleaned up room for worktree: ${t}`))}}}};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";var e={},r={};function t(o){var n=r[o];if(void 0!==n)return n.exports;var i=r[o]={exports:{}},l=!0;try{e[o](i,i.exports,t),l=!1}finally{l&&delete r[o]}return i.exports}t.m=e,t.amdO={},(()=>{var e=[];t.O=(r,o,n,i)=>{if(o){i=i||0;for(var l=e.length;l>0&&e[l-1][2]>i;l--)e[l]=e[l-1];e[l]=[o,n,i];return}for(var a=1/0,l=0;l<e.length;l++){for(var[o,n,i]=e[l],f=!0,u=0;u<o.length;u++)a>=i&&Object.keys(t.O).every(e=>t.O[e](o[u]))?o.splice(u--,1):(f=!1,i<a&&(a=i));if(f){e.splice(l--,1);var s=n();void 0!==s&&(r=s)}}return r}})(),t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={993:0};t.O.j=r=>0===e[r];var r=(r,o)=>{var n,i,[l,a,f]=o,u=0;if(l.some(r=>0!==e[r])){for(n in a)t.o(a,n)&&(t.m[n]=a[n]);if(f)var s=f(t)}for(r&&r(o);u<l.length;u++)i=l[u],t.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return t.O(s)},o=self.webpackChunk_N_E=self.webpackChunk_N_E||[];o.forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o))})()})();
|
|
2
|
-
//# sourceMappingURL=edge-runtime-webpack.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edge-runtime-webpack.js","mappings":"4BACAA,EAAA,GAGA,SAAAC,EAAAC,CAAA,EAEA,IAAAC,EAAAH,CAAA,CAAAE,EAAA,CACA,GAAAC,KAAAC,IAAAD,EACA,OAAAA,EAAAE,OAAA,CAGA,IAAAC,EAAAN,CAAA,CAAAE,EAAA,EAGAG,QAAA,EACA,EAGAE,EAAA,GACA,IACAC,CAAA,CAAAN,EAAA,CAAAI,EAAAA,EAAAD,OAAA,CAAAJ,GACAM,EAAA,EACA,QAAG,CACHA,GAAA,OAAAP,CAAA,CAAAE,EAAA,CAIA,OAAAI,EAAAD,OAAA,CAIAJ,EAAAQ,CAAA,CAAAD,EC/BAP,EAAAS,IAAA,UCAA,IAAAC,EAAA,GACAV,EAAAW,CAAA,EAAAC,EAAAC,EAAAC,EAAAC,KACA,GAAAF,EAAA,CACAE,EAAAA,GAAA,EACA,QAAAC,EAAAN,EAAAO,MAAA,CAA+BD,EAAA,GAAAN,CAAA,CAAAM,EAAA,MAAAD,EAAwCC,IAAAN,CAAA,CAAAM,EAAA,CAAAN,CAAA,CAAAM,EAAA,GACvEN,CAAA,CAAAM,EAAA,EAAAH,EAAAC,EAAAC,EAAA,CACA,MACA,CAEA,QADAG,EAAAC,IACAH,EAAA,EAAiBA,EAAAN,EAAAO,MAAA,CAAqBD,IAAA,CAGtC,OAFA,CAAAH,EAAAC,EAAAC,EAAA,CAAAL,CAAA,CAAAM,EAAA,CACAI,EAAA,GACAC,EAAA,EAAkBA,EAAAR,EAAAI,MAAA,CAAqBI,IACvC,GAAAN,GAAAO,OAAAC,IAAA,CAAAvB,EAAAW,CAAA,EAAAa,KAAA,IAAAxB,EAAAW,CAAA,CAAAc,EAAA,CAAAZ,CAAA,CAAAQ,EAAA,GACAR,EAAAa,MAAA,CAAAL,IAAA,IAEAD,EAAA,GACAL,EAAAG,GAAAA,CAAAA,EAAAH,CAAA,GAGA,GAAAK,EAAA,CACAV,EAAAgB,MAAA,CAAAV,IAAA,GACA,IAAAW,EAAAb,GACAX,MAAAA,IAAAwB,GAAAf,CAAAA,EAAAe,CAAAA,CACA,CACA,CACA,OAAAf,CACA,MC1BAZ,EAAA4B,CAAA,EAAAxB,EAAAyB,KACA,QAAAJ,KAAAI,EACA7B,EAAA8B,CAAA,CAAAD,EAAAJ,IAAA,CAAAzB,EAAA8B,CAAA,CAAA1B,EAAAqB,IACAH,OAAAS,cAAA,CAAA3B,EAAAqB,EAAA,CAAyCO,WAAA,GAAAC,IAAAJ,CAAA,CAAAJ,EAAA,EAGzC,ECPAzB,EAAAkC,CAAA,YACA,oBAAAC,WAAA,OAAAA,WACA,IACA,sCACA,CAAG,MAAAC,EAAA,CACH,oBAAAC,OAAA,OAAAA,MACA,CACA,ICPArC,EAAA8B,CAAA,EAAAQ,EAAAC,IAAAjB,OAAAkB,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAJ,EAAAC,GCCAvC,EAAA2B,CAAA,KACA,oBAAAgB,QAAAA,OAAAC,WAAA,EACAtB,OAAAS,cAAA,CAAA3B,EAAAuC,OAAAC,WAAA,EAAuDC,MAAA,WAEvDvB,OAAAS,cAAA,CAAA3B,EAAA,cAAgDyC,MAAA,IAChD,QCDA,IAAAC,EAAA,CACA,KACA,CAYA9C,CAAAA,EAAAW,CAAA,CAAAU,CAAA,IAAAyB,IAAAA,CAAA,CAAAC,EAAA,CAGA,IAAAC,EAAA,CAAAC,EAAAC,KACA,IAGAjD,EAAA8C,EAHA,CAAAlC,EAAAsC,EAAAC,EAAA,CAAAF,EAGAlC,EAAA,EACA,GAAAH,EAAAwC,IAAA,IAAAP,IAAAA,CAAA,CAAAQ,EAAA,GACA,IAAArD,KAAAkD,EACAnD,EAAA8B,CAAA,CAAAqB,EAAAlD,IACAD,CAAAA,EAAAQ,CAAA,CAAAP,EAAA,CAAAkD,CAAA,CAAAlD,EAAA,EAGA,GAAAmD,EAAA,IAAAxC,EAAAwC,EAAApD,EACA,CAEA,IADAiD,GAAAA,EAAAC,GACMlC,EAAAH,EAAAI,MAAA,CAAqBD,IAC3B+B,EAAAlC,CAAA,CAAAG,EAAA,CACAhB,EAAA8B,CAAA,CAAAgB,EAAAC,IAAAD,CAAA,CAAAC,EAAA,EACAD,CAAA,CAAAC,EAAA,MAEAD,CAAA,CAAAC,EAAA,GAEA,OAAA/C,EAAAW,CAAA,CAAAC,EACA,EAEA2C,EAAAC,KAAA,iBAAAA,KAAA,qBACAD,EAAAE,OAAA,CAAAT,EAAAU,IAAA,UACAH,EAAAI,IAAA,CAAAX,EAAAU,IAAA,MAAAH,EAAAI,IAAA,CAAAD,IAAA,CAAAH","sources":["webpack://_N_E/webpack/bootstrap","webpack://_N_E/webpack/runtime/amd options","webpack://_N_E/webpack/runtime/chunk loaded","webpack://_N_E/webpack/runtime/define property getters","webpack://_N_E/webpack/runtime/global","webpack://_N_E/webpack/runtime/hasOwnProperty shorthand","webpack://_N_E/webpack/runtime/make namespace object","webpack://_N_E/webpack/runtime/jsonp chunk loading","webpack://_N_E/webpack/before-startup","webpack://_N_E/webpack/startup","webpack://_N_E/webpack/after-startup"],"sourcesContent":["// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\tvar threw = true;\n\ttry {\n\t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\t\tthrew = false;\n\t} finally {\n\t\tif(threw) delete __webpack_module_cache__[moduleId];\n\t}\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","__webpack_require__.amdO = {};","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t993: 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunk_N_E\"] = self[\"webpackChunk_N_E\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));"],"names":["__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","threw","__webpack_modules__","m","amdO","deferred","O","result","chunkIds","fn","priority","i","length","notFulfilled","Infinity","fulfilled","j","Object","keys","every","key","splice","r","d","definition","o","defineProperty","enumerable","get","g","globalThis","e","window","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","installedChunks","chunkId","webpackJsonpCallback","parentChunkLoadingFunction","data","moreModules","runtime","some","id","chunkLoadingGlobal","self","forEach","bind","push"],"sourceRoot":""}
|