jupyterlab_claude_code_extension 1.2.24 → 1.2.26
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/README.md +2 -1
- package/lib/widget.d.ts +34 -0
- package/lib/widget.js +357 -49
- package/package.json +1 -1
- package/src/__tests__/jupyterlab_claude_code_extension.spec.ts +181 -5
- package/src/widget.ts +394 -51
- package/style/base.css +114 -12
package/README.md
CHANGED
|
@@ -31,7 +31,8 @@ Chat-panel extensions re-implement the agent loop and trail the real tool. This
|
|
|
31
31
|
- **Favorites** - star projects you keep coming back to via the right-click menu
|
|
32
32
|
- **Remove** - drop a project's Claude history from the panel via the right-click menu; a confirmation dialog names the project and warns it removes the whole project and all its conversations before anything is touched, then the history folder is moved to the trash (it honours JupyterLab's "move files to trash" setting), not deleted permanently
|
|
33
33
|
- **Clean up parallel sessions** - when a project has accumulated extra sessions beyond the main one, a right-click menu item (showing the count in brackets) removes them all, keeping only the main session; a confirmation dialog naming the project and the count appears first, and removed files honour the same trash setting
|
|
34
|
-
- **Conversation switcher** - a right-click "Switch and Manage Sessions" submenu lists a project's other conversations by name and short session id, e.g. `home (3f2a1b9c)`, with last-activity time; pick one and it becomes the row's current conversation - the next click resumes exactly that one. The submenu shows the 5 most recent; "Manage Sessions..." opens a searchable popup over the full list
|
|
34
|
+
- **Conversation switcher** - a right-click "Switch and Manage Sessions" submenu lists a project's other conversations by name and short session id, e.g. `home (3f2a1b9c)`, with last-activity time; pick one and it becomes the row's current conversation - the next click resumes exactly that one. The submenu shows the 5 most recent; "Manage Sessions..." opens a searchable popup - a scrollable table over the full list with the current conversation pinned at the top and accented. Conversations can also be deleted here - select one, many, or all via checkboxes, then click Delete; they move to trash immediately (no confirmation, with an "N moved to trash" message; removed files honour the trash setting). Rows with multiple conversations show a branch icon with the count after the name
|
|
35
|
+
- **Open branched conversation** - a separate right-click "Open Branched Conversation" submenu (and an "Open" button on every row of the Manage Sessions popup) opens any conversation directly in its own terminal, so several branches of one project can run side by side; clicking a row reuses an open terminal only when it is already running that exact conversation, so switching a branch and clicking lands you in the right one rather than the original
|
|
35
36
|
- **Branch session** - fork the current conversation into a new named session via the right-click menu (normal or skip-permissions mode); uses Claude's native `--fork-session`, opens in a new terminal, the chosen name is stamped automatically, and the fork becomes the row's current conversation
|
|
36
37
|
- **Copy session id** - a right-click "Copy Session ID" item copies the row's current conversation id to the clipboard; the Manage Sessions popup adds a copy button on every row, so any parallel conversation's id is one click away
|
|
37
38
|
- **Activity at a glance** - each row shows its last activity (`now`, `5m ago`, `2h ago`, `3d ago`) in an aligned column, with the favourite star in its own column beside it; rows active within the last minute light up in the theme's brand colour (including the `now` label), rows idle for over a week dim slightly
|
package/lib/widget.d.ts
CHANGED
|
@@ -47,6 +47,21 @@ export declare class ClaudeCodeSessionsWidget extends Widget {
|
|
|
47
47
|
private _remove;
|
|
48
48
|
private _cleanupParallel;
|
|
49
49
|
private _resumeInTerminal;
|
|
50
|
+
/**
|
|
51
|
+
* Reuse an open terminal only when it is running the conversation the
|
|
52
|
+
* caller wants; otherwise launch a fresh ``claude --resume <id>``.
|
|
53
|
+
*
|
|
54
|
+
* ``strict`` selects how a cwd-matching claude terminal whose conversation
|
|
55
|
+
* is UNKNOWN (started fresh, no ``--resume`` in its argv) is treated:
|
|
56
|
+
* - lenient (row resume): reuse it. A fresh session's id is not in its
|
|
57
|
+
* argv, so this is the only way to refocus a just-started session, and
|
|
58
|
+
* it avoids ``claude --resume`` erroring with "already in use".
|
|
59
|
+
* - strict (Open Branched Conversation): never reuse an unknown terminal -
|
|
60
|
+
* the user picked a specific branch and must land in THAT conversation,
|
|
61
|
+
* so a fresh/foreign terminal is left alone and a new one is launched.
|
|
62
|
+
* A terminal whose resume id is KNOWN and differs is never reused in
|
|
63
|
+
* either mode - that is the switch-then-click bug this fixes.
|
|
64
|
+
*/
|
|
50
65
|
private _doResumeInTerminal;
|
|
51
66
|
/** Absolute path of the file browser's current folder; falls back to the
|
|
52
67
|
* server root when no file browser is available. */
|
|
@@ -143,6 +158,24 @@ export declare class ClaudeCodeSessionsWidget extends Widget {
|
|
|
143
158
|
* The backend touches the branch JSONL's mtime; a refresh then shows
|
|
144
159
|
* the selected conversation as the row's current one. */
|
|
145
160
|
private _switchBranch;
|
|
161
|
+
/** Open a specific conversation branch in its own terminal.
|
|
162
|
+
*
|
|
163
|
+
* Strict reuse: only a terminal already running THIS conversation is
|
|
164
|
+
* refocused; otherwise a fresh ``claude --resume <id>`` is launched. So
|
|
165
|
+
* several branches of one project can be open independently and side by
|
|
166
|
+
* side - opening branch B never disturbs branch A's terminal. Honours the
|
|
167
|
+
* global skip-permissions toggle like a normal resume. */
|
|
168
|
+
private _openBranch;
|
|
169
|
+
/** Poll fast for a freshly forked branch to materialise, then refresh.
|
|
170
|
+
*
|
|
171
|
+
* claude writes a forked session's JSONL lazily (on its first turn), so a
|
|
172
|
+
* just-requested branch does not exist at launch and would otherwise only
|
|
173
|
+
* surface on the next 30s poll. This watches the project's branch list
|
|
174
|
+
* every ``BRANCH_WATCH_INTERVAL_MS`` until ``forkId`` appears (as current
|
|
175
|
+
* or in the list) - then does one full refresh and stops - or until a
|
|
176
|
+
* bounded number of attempts elapses. The panel is never updated before
|
|
177
|
+
* the branch genuinely exists. */
|
|
178
|
+
private _watchForBranch;
|
|
146
179
|
private _startPolling;
|
|
147
180
|
private _stopPolling;
|
|
148
181
|
private readonly _app;
|
|
@@ -157,6 +190,7 @@ export declare class ClaudeCodeSessionsWidget extends Widget {
|
|
|
157
190
|
private _commands;
|
|
158
191
|
private _contextMenu;
|
|
159
192
|
private _branchSubmenu;
|
|
193
|
+
private _openBranchSubmenu;
|
|
160
194
|
private _branchSessionMenu;
|
|
161
195
|
private _lastBranches;
|
|
162
196
|
private _lastBranchesCurrent;
|