Repository navigation
Node 26, deletable conversations, stored permission mode ... various changes #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rainman74
wants to merge
37
commits into
techjarves:main
Choose a base branch
from
rainman74:release-2.1-pr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
133f761
Add runtime update check and adapter thinking fix
techjarves 6e2fd1d
Document update check, model windows and runtime resume
techjarves 4b86741
Document launcher commands
techjarves d1a6bf4
Merge PR #43 and #47: IME-safe composer and private LAN hosts
techjarves 2efb954
Document private LAN HTTP security trade-off
techjarves d101ffb
Add permanent delete-conversation button to dashboard
techjarves 247aeb1
Keep sidebar delete button visible for sync'd conversations
techjarves ae1d3b2
Add standalone resume, stored permission mode, and portable runtime i…
rainman74 476cd4a
Link the host Git configuration into portable sessions
rainman74 ac8e2f6
Document the full delta to the official repository
rainman74 b182531
Add paste and drop attachments, and send images as image blocks
rainman74 437ad84
Install Playwright from the launcher's install and update flow
rainman74 50bdd10
Mention Playwright in the lib/ tree description
rainman74 56a49a6
Bind Ctrl+V to image paste in the terminal, next to Alt+V
rainman74 16abdcf
Stop the sidebar rebuild from swallowing clicks
rainman74 deaaaa4
Release 2.0
rainman74 699def8
Tell sessions that the bundled Playwright exists
rainman74 bc13ad4
Make local paths clickable in the studio and document the terminal
rainman74 9f282f7
Release 2.1
rainman74 1d120de
Make paths in inline code clickable
rainman74 bf93b5e
Explain why Ctrl+V never reached Claude Code, and add WT.bat
rainman74 6ed0615
Remove the terminal changes
rainman74 d179b6d
Correct the image-paste fallback claim and drop the registry advice
rainman74 d9eb3f2
Correct the 2.0 section in place
rainman74 fffa7d4
Remove CHANGELOG.md
rainman74 c83eb6e
Load the demo video and thumbnail from the repository
rainman74 47be115
Fix the path handling and the local-model stack
rainman74 067c6e6
Fix the TLS upstream, the picker merge and the resume pause
rainman74 7d482cd
Accept a working directory that ends in a backslash
rainman74 7a58a99
Fix six review findings: permissions, picker cleanup, IPv6 and Ollama…
rainman74 3055e56
Reject empty file URLs and verify the upstream the proxy poll expects
rainman74 a53a5b8
Keep shared Ollama processes alive and verify the Chromium revision
rainman74 35c6fc3
Fix the five review findings, including two races in the new guards
rainman74 dfa5270
Bound the registry lock's age, never record a lost child, key the res…
rainman74 7857373
Decide proxy and server ownership by identity, not by child liveness
rainman74 904c972
Teach sessions to search through WebFetch, since WebSearch is server-…
rainman74 36af9ba
Version 2.3.0
rainman74 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,50 @@ | ||
| @echo off | ||
| call "%~dp0START.bat" resume %* | ||
| @echo off & setlocal EnableDelayedExpansion | ||
| chcp 65001 >nul | ||
| title ClaudeCode-Portable - Resume Session | ||
|
|
||
| REM Standalone session resume. Unlike START.bat this script installs, repairs, | ||
| REM updates and configures nothing - it only checks what START.bat set up once. | ||
|
|
||
| set "ROOT=%~dp0" | ||
|
|
||
| set "ARCH=x64" | ||
| if /i "%PROCESSOR_ARCHITECTURE%"=="ARM64" set "ARCH=arm64" | ||
| if /i "%PROCESSOR_ARCHITEW6432%"=="ARM64" set "ARCH=arm64" | ||
|
|
||
| set "NODE_EXE=%ROOT%engine\node-win32-%ARCH%\node.exe" | ||
| set "CLAUDE_EXE=%ROOT%engine\win32-%ARCH%\current\node_modules\@anthropic-ai\claude-code-win32-%ARCH%\claude.exe" | ||
|
|
||
| REM lib/paths.mjs lets PORTABLE_AI_DATA_DIR move the data folder, so the preflight | ||
| REM has to look where the runtime actually reads its settings from. | ||
| set "DATA_DIR=%PORTABLE_AI_DATA_DIR%" | ||
| if "%DATA_DIR%"=="" set "DATA_DIR=%ROOT%data" | ||
| set "CONFIG_FILE=%DATA_DIR%\settings.json" | ||
|
|
||
| if not exist "%NODE_EXE%" ( | ||
| echo [ERROR] Portable Node.js was not found: %NODE_EXE% | ||
| echo [ERROR] Run START.bat once to install the portable runtime, then try again. | ||
| if not defined PORTABLE_AI_NO_PAUSE pause | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| if not exist "%CLAUDE_EXE%" ( | ||
| echo [ERROR] Claude Code was not found: %CLAUDE_EXE% | ||
| echo [ERROR] Run START.bat once to install the portable runtime, then try again. | ||
| if not defined PORTABLE_AI_NO_PAUSE pause | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| if not exist "%CONFIG_FILE%" ( | ||
| echo [ERROR] No provider is configured: %CONFIG_FILE% | ||
| echo [ERROR] Run START.bat once and choose a provider, then try again. | ||
| if not defined PORTABLE_AI_NO_PAUSE pause | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| REM Argument parsing and validation happen in Node so quoting, duplicate flags | ||
| REM and the positional session ID / working directory rules stay testable. | ||
| "%NODE_EXE%" "%ROOT%tools\resume.mjs" %* | ||
| set "EXIT_CODE=%ERRORLEVEL%" | ||
|
|
||
| if not defined PORTABLE_AI_NO_PAUSE pause | ||
| exit /b %EXIT_CODE% | ||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export function isComposerSubmitKey(event, compositionActive=false){ | ||
| return event.key==='Enter'&&!event.shiftKey&&!event.isComposing&&!compositionActive; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,145 @@ | ||
| // Turns local paths and URLs in rendered text into clickable elements. | ||
| // | ||
| // A path is only made clickable when it looks like an absolute local path or a | ||
| // file:// URL; relative fragments such as "src/app.ts" stay plain text so the | ||
| // reader is not sent chasing paths that mean nothing outside a project. | ||
|
|
||
| // A quoted path may contain spaces; an unquoted one may not, because spaces in | ||
| // running text are far more often the sentence than part of the folder name. | ||
| const QUOTED_PATH = /"[A-Za-z]:[\\/](?:[^\\/:*?"<>|\r\n]+[\\/])*[^\\/:*?"<>|\r\n]+"/g; | ||
| const WINDOWS_PATH = /[A-Za-z]:\\(?:[^\\\s/:*?"<>|\r\n]+\\)*[^\\\s/:*?"<>|\r\n]+/g; | ||
|
rainman74 marked this conversation as resolved.
Resolved
|
||
| // Windows accepts forward slashes too, and `C:/Users/x/file.txt` is a common way | ||
| // to write a path in text that came from a URL bar or a config file. The | ||
| // lookbehind keeps it from matching the tail of `https://`: there the colon is | ||
| // preceded by a letter, so that `s:/` is not a drive. | ||
| const WINDOWS_FORWARD_PATH = /(?<![A-Za-z0-9])[A-Za-z]:\/(?:[^\s/\\:*?"<>|]+\/)*[^\s/\\:*?"<>|]+/g; | ||
| const UNC_PATH = /\\\\[^\\\s/:*?"<>|\r\n]+\\[^\\\s/:*?"<>|\r\n]+(?:\\[^\\\s/:*?"<>|\r\n]+)*/g; | ||
| const FILE_URL = /file:\/\/\/[^\s<>"']+/gi; | ||
| // Trailing punctuation is usually the sentence, not the path. | ||
| const TRAILING = /[.,;:!?)\]}'"»”]+$/; | ||
|
|
||
| export function trimPath(value) { | ||
| let text = String(value || ''); | ||
| let leading = ''; | ||
| let trailing = ''; | ||
| // Quotes belong to the sentence as well, and to the pattern that allows spaces. | ||
| while (text.length > 2 && /^["']/.test(text)) { leading += text[0]; text = text.slice(1); } | ||
| while (text.length > 1 && TRAILING.test(text)) { | ||
| trailing = text.slice(-1) + trailing; | ||
| text = text.slice(0, -1); | ||
| } | ||
| return { path: text, leading, trailing }; | ||
| } | ||
|
|
||
| export function isFilePath(candidate) { | ||
| const value = String(candidate || ''); | ||
| if (/^file:\/\//i.test(value)) return true; | ||
| if (/^[A-Za-z]:[\\/]/.test(value)) return true; | ||
| return /^\\\\[^\\/]+[\\/]/.test(value); | ||
| } | ||
|
|
||
| /** | ||
| * Replaces every path in a plain-text run with an anchor the caller styles. | ||
| * Returns the original text untouched when there is nothing to link. | ||
| */ | ||
| export function linkifyText(text, { allowed = isFilePath } = {}) { | ||
| const source = String(text ?? ''); | ||
| if (!source) return source; | ||
| const matches = []; | ||
| // The quoted pattern runs first so a path with spaces is not cut short, and | ||
| // the file URL before the drive patterns so its inner `D:/` is not taken twice. | ||
| for (const pattern of [QUOTED_PATH, FILE_URL, WINDOWS_PATH, WINDOWS_FORWARD_PATH, UNC_PATH]) { | ||
| for (const match of source.matchAll(pattern)) matches.push({ index: match.index, text: match[0] }); | ||
| } | ||
| if (!matches.length) return source; | ||
| matches.sort((a, b) => a.index - b.index); | ||
| const parts = []; | ||
| let cursor = 0; | ||
| let inserted = 0; | ||
| for (const match of matches) { | ||
| // Overlapping patterns can report the same run twice; the first one wins. | ||
| if (match.index < cursor) continue; | ||
| const { path, leading, trailing } = trimPath(match.text); | ||
| if (!path || !allowed(path)) continue; | ||
| parts.push(escapeHtml(source.slice(cursor, match.index))); | ||
| parts.push(escapeHtml(leading)); | ||
| parts.push(pathButtonHtml(path)); | ||
| parts.push(escapeHtml(trailing)); | ||
| cursor = match.index + match.text.length; | ||
| inserted++; | ||
| } | ||
| if (!inserted) return source; | ||
| parts.push(escapeHtml(source.slice(cursor))); | ||
| return parts.join(''); | ||
| } | ||
|
|
||
| // A button, not a link: opening a local file is an action with no URL, and a | ||
| // button stays reachable with Tab and the keyboard. | ||
| function pathButtonHtml(path) { | ||
| return `<button type="button" class="path-link" data-open-path="${escapeHtml(path)}" title="Open ${escapeHtml(path)}">${escapeHtml(path)}</button>`; | ||
| } | ||
|
|
||
| export function escapeHtml(value) { | ||
| return String(value ?? '').replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]); | ||
| } | ||
|
|
||
| /** | ||
| * Acts on already-rendered HTML: every web link gets target and rel so it never | ||
| * navigates the studio away, and every text node outside code blocks and links | ||
| * is scanned for paths. Returns how many nodes were rewritten. | ||
| * | ||
| * Inline code is linkified as a whole: backticks mark the exact value, so a | ||
| * space inside them belongs to the path (`D:\Apps\Claude Code\x.jpg`) rather | ||
| * than to the sentence. Code blocks stay plain so copying them still works. | ||
| */ | ||
| export function linkifyElement(root, documentRef = globalThis.document, { skip = 'PRE, A, BUTTON, TEXTAREA, SCRIPT, STYLE' } = {}) { | ||
| if (!root) return 0; | ||
| for (const link of root.querySelectorAll('a[href]')) { | ||
| if (!/^https?:/i.test(link.getAttribute('href'))) continue; | ||
| link.target = '_blank'; | ||
| link.rel = 'noopener noreferrer'; | ||
| } | ||
| const walker = documentRef.createTreeWalker(root, NodeFilter.SHOW_TEXT); | ||
| const targets = []; | ||
| for (let node = walker.nextNode(); node; node = walker.nextNode()) { | ||
| if (!node.nodeValue || !node.nodeValue.trim()) continue; | ||
| const parent = node.parentElement; | ||
| // Code blocks keep their text selectable and copyable, and links stay links. | ||
| if (!parent || parent.closest(skip)) continue; | ||
| targets.push({ node, inlineCode: parent.tagName === 'CODE' }); | ||
| } | ||
| let changed = 0; | ||
| for (const { node, inlineCode } of targets) { | ||
| const replacement = inlineCode ? inlineCodeHtml(node.nodeValue) : linkifyText(node.nodeValue); | ||
| if (replacement === node.nodeValue) continue; | ||
| const template = documentRef.createElement('template'); | ||
| template.innerHTML = replacement; | ||
| node.parentNode.replaceChild(template.content, node); | ||
| changed++; | ||
| } | ||
| return changed; | ||
| } | ||
|
|
||
| // A whole inline-code span that is one path becomes one button. | ||
| function inlineCodeHtml(text) { | ||
| const value = String(text ?? ''); | ||
| const path = inlineCodePath(value); | ||
| // Inside backticks the value is either one path or nothing; a partial | ||
| // replacement would cut a path with spaces in half. | ||
| return path ? pathButtonHtml(path) : value; | ||
|
rainman74 marked this conversation as resolved.
Resolved
|
||
| } | ||
|
|
||
| /** | ||
| * The path an inline-code span holds, or null. Accepts the whole span only when | ||
| * it holds exactly one path: two drive letters mean two paths, and a path with | ||
| * spaces would otherwise be split at the wrong place. | ||
| */ | ||
| export function inlineCodePath(text) { | ||
| const value = String(text ?? '').trim(); | ||
| if (!value || /\n/.test(value)) return null; | ||
| // A file URL carries a drive letter of its own, so it is counted separately. | ||
| const markers = /^file:\/\//i.test(value) ? [(value.match(/^file:\/\//i) || [''])[0]] : value.match(/[A-Za-z]:[\\/]/g); | ||
| if (!markers || markers.length !== 1) return null; | ||
| const { path } = trimPath(value); | ||
| return path && isFilePath(path) ? path : null; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /** | ||
| * The composer's permission picker chooses the mode for the next turn, not for | ||
| * the rest of the session: the dialog says "Enable for next turn", the toast | ||
| * says "selected for the next turn", and the README describes it as a | ||
| * single-turn override. Without this the confirmed Unrestricted choice would be | ||
| * attached to every later run - in every workspace - and bypass approvals | ||
| * silently. | ||
| * | ||
| * `runMode` is the mode the finished turn ran with, `currentMode` is what the | ||
| * picker holds now, `defaultMode` is the stored preference the studio starts | ||
| * from, and `pickedDuringRun` says whether the user opened the picker while the | ||
| * turn was running. Such a deliberate choice belongs to the next turn and is | ||
| * kept - even when it names the same mode the running turn already used, which | ||
| * a value comparison alone cannot tell apart from "nothing was picked". | ||
| * | ||
| * @returns {{mode: string, reset: boolean}} the mode to keep and whether the UI | ||
| * has to update because it changed. | ||
| */ | ||
| export function permissionModeAfterRun({ runMode, currentMode, defaultMode, pickedDuringRun = false }) { | ||
| if (pickedDuringRun) return { mode: currentMode, reset: false }; | ||
| // Picked while the turn was running before this flag existed. | ||
| if (currentMode !== runMode) return { mode: currentMode, reset: false }; | ||
| if (runMode === defaultMode) return { mode: currentMode, reset: false }; | ||
| return { mode: defaultMode, reset: currentMode !== defaultMode }; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.