@maxmo74/pi-coding-agent 1.5.0-max.6 → 1.5.0-max.8
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/dist/bundle/chunks/{chunk-RVQPMSKJ.js → chunk-FGCQRPD5.js} +14 -14
- package/dist/bundle/chunks/{chunk-KZW44KNK.js → chunk-MSIQUO5T.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-KHAOYCUO.js → virtual-modules-CLD44EYP.js} +1 -1
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/core/session-move.d.ts.map +1 -1
- package/dist/core/session-move.js +22 -3
- package/dist/core/session-move.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +13 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +60 -12
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{AgentSession,AgentSessionRuntime,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,RpcClient,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,SkillInvocationMessageComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildSessionContext,buildSessionProjection,calculateContextTokens,collectEntriesForBranchSummary,compact,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodemodeExtension,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createMcpExtension,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createToolSearchExtension,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getLastAssistantUsage,getLatestCompactionEntry,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,parseArgs,parseFrontmatter,parseSessionEntries,parseSkillBlock,prepareBranchEntries,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,runRpcMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunk-RVQPMSKJ.js";import{DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,formatReadLineRange,formatSize,truncateHead,truncateLine,truncateTail,truncateToVisualLines}from"./chunk-62VOPMLK.js";import{ArminComponent}from"./chunk-3TGLJEWK.js";import{Container,SelectList,Theme,getAvailableThemes,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme,keyHint,keyText,rawKeyHint}from"./chunk-4EYXVSA5.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunk-NZY7EIPA.js";import{readStoredCredential}from"./chunk-R2EGYMOO.js";import{getPowerShellConfig,getShellConfig}from"./chunk-YZKQS34S.js";import{CONFIG_DIR_NAME,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunk-36QC74V4.js";import{__export}from"./chunk-JXWJOIH4.js";var dist_exports={};__export(dist_exports,{AgentSession:()=>AgentSession,AgentSessionRuntime:()=>AgentSessionRuntime,ArminComponent:()=>ArminComponent,AssistantMessageComponent:()=>AssistantMessageComponent,BashExecutionComponent:()=>BashExecutionComponent,BorderedLoader:()=>BorderedLoader,BranchSummaryMessageComponent:()=>BranchSummaryMessageComponent,CONFIG_DIR_NAME:()=>CONFIG_DIR_NAME,CURRENT_SESSION_VERSION:()=>CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent:()=>CompactionSummaryMessageComponent,CredentialSynchronizationError:()=>CredentialSynchronizationError,CustomEditor:()=>CustomEditor,CustomMessageComponent:()=>CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS:()=>DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES:()=>DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES:()=>DEFAULT_MAX_LINES,DefaultPackageManager:()=>DefaultPackageManager,DefaultResourceLoader:()=>DefaultResourceLoader,DynamicBorder:()=>DynamicBorder,ExtensionEditorComponent:()=>ExtensionEditorComponent,ExtensionInputComponent:()=>ExtensionInputComponent,ExtensionRunner:()=>ExtensionRunner,ExtensionSelectorComponent:()=>ExtensionSelectorComponent,FooterComponent:()=>FooterComponent,InteractiveMode:()=>InteractiveMode,LoginDialogComponent:()=>LoginDialogComponent,ModelRegistry:()=>ModelRegistry,ModelRuntime:()=>ModelRuntime,ModelSelectorComponent:()=>ModelSelectorComponent,OAuthSelectorComponent:()=>OAuthSelectorComponent,ProjectTrustStore:()=>ProjectTrustStore,RpcClient:()=>RpcClient,SessionManager:()=>SessionManager,SessionSelectorComponent:()=>SessionSelectorComponent,SettingsManager:()=>SettingsManager,SettingsSelectorComponent:()=>SettingsSelectorComponent,ShowImagesSelectorComponent:()=>ShowImagesSelectorComponent,SkillInvocationMessageComponent:()=>SkillInvocationMessageComponent,Theme:()=>Theme,ThemeSelectorComponent:()=>ThemeSelectorComponent,ThinkingSelectorComponent:()=>ThinkingSelectorComponent,ToolExecutionComponent:()=>ToolExecutionComponent,TreeSelectorComponent:()=>TreeSelectorComponent,UserMessageComponent:()=>UserMessageComponent,UserMessageSelectorComponent:()=>UserMessageSelectorComponent,VERSION:()=>VERSION,VIRTUAL_MODEL_STATE_ENTRY:()=>VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries:()=>buildContextEntries,buildSessionContext:()=>buildSessionContext,buildSessionProjection:()=>buildSessionProjection,calculateContextTokens:()=>calculateContextTokens,collectEntriesForBranchSummary:()=>collectEntriesForBranchSummary,compact:()=>compact,convertToLlm:()=>convertToLlm,convertToPng:()=>convertToPng,copyToClipboard:()=>copyToClipboard,createAgentSession:()=>createAgentSession,createAgentSessionFromServices:()=>createAgentSessionFromServices,createAgentSessionRuntime:()=>createAgentSessionRuntime,createAgentSessionServices:()=>createAgentSessionServices,createBashTool:()=>createBashTool,createBashToolDefinition:()=>createBashToolDefinition,createCodemodeExtension:()=>createCodemodeExtension,createCodingTools:()=>createCodingTools,createEditTool:()=>createEditTool,createEditToolDefinition:()=>createEditToolDefinition,createEventBus:()=>createEventBus,createExtensionRuntime:()=>createExtensionRuntime,createFindTool:()=>createFindTool,createFindToolDefinition:()=>createFindToolDefinition,createGrepTool:()=>createGrepTool,createGrepToolDefinition:()=>createGrepToolDefinition,createLocalBashOperations:()=>createLocalBashOperations,createLocalPowerShellOperations:()=>createLocalPowerShellOperations,createLsTool:()=>createLsTool,createLsToolDefinition:()=>createLsToolDefinition,createMcpExtension:()=>createMcpExtension,createPowerShellTool:()=>createPowerShellTool,createPowerShellToolDefinition:()=>createPowerShellToolDefinition,createReadOnlyTools:()=>createReadOnlyTools,createReadTool:()=>createReadTool,createReadToolDefinition:()=>createReadToolDefinition,createSyntheticSourceInfo:()=>createSyntheticSourceInfo,createToolSearchExtension:()=>createToolSearchExtension,createWriteTool:()=>createWriteTool,createWriteToolDefinition:()=>createWriteToolDefinition,defineTool:()=>defineTool,detectSupportedImageMimeTypeFromFile:()=>detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions:()=>discoverAndLoadExtensions,estimateTokens:()=>estimateTokens,findCutPoint:()=>findCutPoint,findTurnStartIndex:()=>findTurnStartIndex,formatDimensionNote:()=>formatDimensionNote,formatReadLineRange:()=>formatReadLineRange,formatSize:()=>formatSize,formatSkillsForPrompt:()=>formatSkillsForPrompt,generateBranchSummary:()=>generateBranchSummary,generateDiffString:()=>generateDiffString,generateSummary:()=>generateSummary,generateSummaryWithUsage:()=>generateSummaryWithUsage,generateUnifiedPatch:()=>generateUnifiedPatch,getAgentDir:()=>getAgentDir,getDocsPath:()=>getDocsPath,getExamplesPath:()=>getExamplesPath,getLanguageFromPath:()=>getLanguageFromPath,getLastAssistantUsage:()=>getLastAssistantUsage,getLatestCompactionEntry:()=>getLatestCompactionEntry,getMarkdownTheme:()=>getMarkdownTheme,getPackageDir:()=>getPackageDir,getPowerShellConfig:()=>getPowerShellConfig,getReadmePath:()=>getReadmePath,getSelectListTheme:()=>getSelectListTheme,getSettingsListTheme:()=>getSettingsListTheme,getShellConfig:()=>getShellConfig,hasTrustRequiringProjectResources:()=>hasTrustRequiringProjectResources,highlightCode:()=>highlightCode,initTheme:()=>initTheme,isBashToolResult:()=>isBashToolResult,isEditToolResult:()=>isEditToolResult,isFindToolResult:()=>isFindToolResult,isGrepToolResult:()=>isGrepToolResult,isLsToolResult:()=>isLsToolResult,isPowerShellToolResult:()=>isPowerShellToolResult,isReadToolResult:()=>isReadToolResult,isToolCallEventType:()=>isToolCallEventType,isWriteToolResult:()=>isWriteToolResult,keyHint:()=>keyHint,keyText:()=>keyText,loadProjectContextFiles:()=>loadProjectContextFiles,loadSkills:()=>loadSkills,loadSkillsFromDir:()=>loadSkillsFromDir,main:()=>main,migrateSessionEntries:()=>migrateSessionEntries,parseArgs:()=>parseArgs,parseFrontmatter:()=>parseFrontmatter,parseSessionEntries:()=>parseSessionEntries,parseSkillBlock:()=>parseSkillBlock,prepareBranchEntries:()=>prepareBranchEntries,rawKeyHint:()=>rawKeyHint,readStoredCredential:()=>readStoredCredential,renderDiff:()=>renderDiff,resizeImage:()=>resizeImage,resolveCliModel:()=>resolveCliModel,resolveModelScopeWithDiagnostics:()=>resolveModelScopeWithDiagnostics,runPrintMode:()=>runPrintMode,runRpcMode:()=>runRpcMode,serializeConversation:()=>serializeConversation,sessionEntryToContextMessages:()=>sessionEntryToContextMessages,shouldCompact:()=>shouldCompact,stripFrontmatter:()=>stripFrontmatter,truncateHead:()=>truncateHead,truncateLine:()=>truncateLine,truncateTail:()=>truncateTail,truncateToVisualLines:()=>truncateToVisualLines,withFileMutationQueue:()=>withFileMutationQueue,wrapRegisteredTool:()=>wrapRegisteredTool,wrapRegisteredTools:()=>wrapRegisteredTools});var SHOW_IMAGES_SELECT_LIST_LAYOUT={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},ShowImagesSelectorComponent=class extends Container{selectList;constructor(currentValue,onSelect,onCancel){super();let items=[{value:"yes",label:"Yes",description:"Show images inline in terminal"},{value:"no",label:"No",description:"Show text placeholder instead"}];this.addChild(new DynamicBorder),this.selectList=new SelectList(items,5,getSelectListTheme(),SHOW_IMAGES_SELECT_LIST_LAYOUT),this.selectList.setSelectedIndex(currentValue?0:1),this.selectList.onSelect=item=>{onSelect(item.value==="yes")},this.selectList.onCancel=()=>{onCancel()},this.addChild(this.selectList),this.addChild(new DynamicBorder)}getSelectList(){return this.selectList}};var THEME_SELECT_LIST_LAYOUT={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},ThemeSelectorComponent=class extends Container{selectList;onPreview;constructor(currentTheme,onSelect,onCancel,onPreview){super(),this.onPreview=onPreview;let themes=getAvailableThemes(),themeItems=themes.map(name=>({value:name,label:name,description:name===currentTheme?"(current)":void 0}));this.addChild(new DynamicBorder),this.selectList=new SelectList(themeItems,10,getSelectListTheme(),THEME_SELECT_LIST_LAYOUT);let currentIndex=themes.indexOf(currentTheme);currentIndex!==-1&&this.selectList.setSelectedIndex(currentIndex),this.selectList.onSelect=item=>{onSelect(item.value)},this.selectList.onCancel=()=>{onCancel()},this.selectList.onSelectionChange=item=>{this.onPreview(item.value)},this.addChild(this.selectList),this.addChild(new DynamicBorder)}getSelectList(){return this.selectList}};export{ShowImagesSelectorComponent,ThemeSelectorComponent,dist_exports};
|
|
2
|
+
import{AgentSession,AgentSessionRuntime,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,RpcClient,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,SkillInvocationMessageComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildSessionContext,buildSessionProjection,calculateContextTokens,collectEntriesForBranchSummary,compact,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodemodeExtension,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createMcpExtension,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createToolSearchExtension,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getLastAssistantUsage,getLatestCompactionEntry,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,parseArgs,parseFrontmatter,parseSessionEntries,parseSkillBlock,prepareBranchEntries,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,runRpcMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunk-FGCQRPD5.js";import{DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,formatReadLineRange,formatSize,truncateHead,truncateLine,truncateTail,truncateToVisualLines}from"./chunk-62VOPMLK.js";import{ArminComponent}from"./chunk-3TGLJEWK.js";import{Container,SelectList,Theme,getAvailableThemes,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme,keyHint,keyText,rawKeyHint}from"./chunk-4EYXVSA5.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunk-NZY7EIPA.js";import{readStoredCredential}from"./chunk-R2EGYMOO.js";import{getPowerShellConfig,getShellConfig}from"./chunk-YZKQS34S.js";import{CONFIG_DIR_NAME,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunk-36QC74V4.js";import{__export}from"./chunk-JXWJOIH4.js";var dist_exports={};__export(dist_exports,{AgentSession:()=>AgentSession,AgentSessionRuntime:()=>AgentSessionRuntime,ArminComponent:()=>ArminComponent,AssistantMessageComponent:()=>AssistantMessageComponent,BashExecutionComponent:()=>BashExecutionComponent,BorderedLoader:()=>BorderedLoader,BranchSummaryMessageComponent:()=>BranchSummaryMessageComponent,CONFIG_DIR_NAME:()=>CONFIG_DIR_NAME,CURRENT_SESSION_VERSION:()=>CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent:()=>CompactionSummaryMessageComponent,CredentialSynchronizationError:()=>CredentialSynchronizationError,CustomEditor:()=>CustomEditor,CustomMessageComponent:()=>CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS:()=>DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES:()=>DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES:()=>DEFAULT_MAX_LINES,DefaultPackageManager:()=>DefaultPackageManager,DefaultResourceLoader:()=>DefaultResourceLoader,DynamicBorder:()=>DynamicBorder,ExtensionEditorComponent:()=>ExtensionEditorComponent,ExtensionInputComponent:()=>ExtensionInputComponent,ExtensionRunner:()=>ExtensionRunner,ExtensionSelectorComponent:()=>ExtensionSelectorComponent,FooterComponent:()=>FooterComponent,InteractiveMode:()=>InteractiveMode,LoginDialogComponent:()=>LoginDialogComponent,ModelRegistry:()=>ModelRegistry,ModelRuntime:()=>ModelRuntime,ModelSelectorComponent:()=>ModelSelectorComponent,OAuthSelectorComponent:()=>OAuthSelectorComponent,ProjectTrustStore:()=>ProjectTrustStore,RpcClient:()=>RpcClient,SessionManager:()=>SessionManager,SessionSelectorComponent:()=>SessionSelectorComponent,SettingsManager:()=>SettingsManager,SettingsSelectorComponent:()=>SettingsSelectorComponent,ShowImagesSelectorComponent:()=>ShowImagesSelectorComponent,SkillInvocationMessageComponent:()=>SkillInvocationMessageComponent,Theme:()=>Theme,ThemeSelectorComponent:()=>ThemeSelectorComponent,ThinkingSelectorComponent:()=>ThinkingSelectorComponent,ToolExecutionComponent:()=>ToolExecutionComponent,TreeSelectorComponent:()=>TreeSelectorComponent,UserMessageComponent:()=>UserMessageComponent,UserMessageSelectorComponent:()=>UserMessageSelectorComponent,VERSION:()=>VERSION,VIRTUAL_MODEL_STATE_ENTRY:()=>VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries:()=>buildContextEntries,buildSessionContext:()=>buildSessionContext,buildSessionProjection:()=>buildSessionProjection,calculateContextTokens:()=>calculateContextTokens,collectEntriesForBranchSummary:()=>collectEntriesForBranchSummary,compact:()=>compact,convertToLlm:()=>convertToLlm,convertToPng:()=>convertToPng,copyToClipboard:()=>copyToClipboard,createAgentSession:()=>createAgentSession,createAgentSessionFromServices:()=>createAgentSessionFromServices,createAgentSessionRuntime:()=>createAgentSessionRuntime,createAgentSessionServices:()=>createAgentSessionServices,createBashTool:()=>createBashTool,createBashToolDefinition:()=>createBashToolDefinition,createCodemodeExtension:()=>createCodemodeExtension,createCodingTools:()=>createCodingTools,createEditTool:()=>createEditTool,createEditToolDefinition:()=>createEditToolDefinition,createEventBus:()=>createEventBus,createExtensionRuntime:()=>createExtensionRuntime,createFindTool:()=>createFindTool,createFindToolDefinition:()=>createFindToolDefinition,createGrepTool:()=>createGrepTool,createGrepToolDefinition:()=>createGrepToolDefinition,createLocalBashOperations:()=>createLocalBashOperations,createLocalPowerShellOperations:()=>createLocalPowerShellOperations,createLsTool:()=>createLsTool,createLsToolDefinition:()=>createLsToolDefinition,createMcpExtension:()=>createMcpExtension,createPowerShellTool:()=>createPowerShellTool,createPowerShellToolDefinition:()=>createPowerShellToolDefinition,createReadOnlyTools:()=>createReadOnlyTools,createReadTool:()=>createReadTool,createReadToolDefinition:()=>createReadToolDefinition,createSyntheticSourceInfo:()=>createSyntheticSourceInfo,createToolSearchExtension:()=>createToolSearchExtension,createWriteTool:()=>createWriteTool,createWriteToolDefinition:()=>createWriteToolDefinition,defineTool:()=>defineTool,detectSupportedImageMimeTypeFromFile:()=>detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions:()=>discoverAndLoadExtensions,estimateTokens:()=>estimateTokens,findCutPoint:()=>findCutPoint,findTurnStartIndex:()=>findTurnStartIndex,formatDimensionNote:()=>formatDimensionNote,formatReadLineRange:()=>formatReadLineRange,formatSize:()=>formatSize,formatSkillsForPrompt:()=>formatSkillsForPrompt,generateBranchSummary:()=>generateBranchSummary,generateDiffString:()=>generateDiffString,generateSummary:()=>generateSummary,generateSummaryWithUsage:()=>generateSummaryWithUsage,generateUnifiedPatch:()=>generateUnifiedPatch,getAgentDir:()=>getAgentDir,getDocsPath:()=>getDocsPath,getExamplesPath:()=>getExamplesPath,getLanguageFromPath:()=>getLanguageFromPath,getLastAssistantUsage:()=>getLastAssistantUsage,getLatestCompactionEntry:()=>getLatestCompactionEntry,getMarkdownTheme:()=>getMarkdownTheme,getPackageDir:()=>getPackageDir,getPowerShellConfig:()=>getPowerShellConfig,getReadmePath:()=>getReadmePath,getSelectListTheme:()=>getSelectListTheme,getSettingsListTheme:()=>getSettingsListTheme,getShellConfig:()=>getShellConfig,hasTrustRequiringProjectResources:()=>hasTrustRequiringProjectResources,highlightCode:()=>highlightCode,initTheme:()=>initTheme,isBashToolResult:()=>isBashToolResult,isEditToolResult:()=>isEditToolResult,isFindToolResult:()=>isFindToolResult,isGrepToolResult:()=>isGrepToolResult,isLsToolResult:()=>isLsToolResult,isPowerShellToolResult:()=>isPowerShellToolResult,isReadToolResult:()=>isReadToolResult,isToolCallEventType:()=>isToolCallEventType,isWriteToolResult:()=>isWriteToolResult,keyHint:()=>keyHint,keyText:()=>keyText,loadProjectContextFiles:()=>loadProjectContextFiles,loadSkills:()=>loadSkills,loadSkillsFromDir:()=>loadSkillsFromDir,main:()=>main,migrateSessionEntries:()=>migrateSessionEntries,parseArgs:()=>parseArgs,parseFrontmatter:()=>parseFrontmatter,parseSessionEntries:()=>parseSessionEntries,parseSkillBlock:()=>parseSkillBlock,prepareBranchEntries:()=>prepareBranchEntries,rawKeyHint:()=>rawKeyHint,readStoredCredential:()=>readStoredCredential,renderDiff:()=>renderDiff,resizeImage:()=>resizeImage,resolveCliModel:()=>resolveCliModel,resolveModelScopeWithDiagnostics:()=>resolveModelScopeWithDiagnostics,runPrintMode:()=>runPrintMode,runRpcMode:()=>runRpcMode,serializeConversation:()=>serializeConversation,sessionEntryToContextMessages:()=>sessionEntryToContextMessages,shouldCompact:()=>shouldCompact,stripFrontmatter:()=>stripFrontmatter,truncateHead:()=>truncateHead,truncateLine:()=>truncateLine,truncateTail:()=>truncateTail,truncateToVisualLines:()=>truncateToVisualLines,withFileMutationQueue:()=>withFileMutationQueue,wrapRegisteredTool:()=>wrapRegisteredTool,wrapRegisteredTools:()=>wrapRegisteredTools});var SHOW_IMAGES_SELECT_LIST_LAYOUT={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},ShowImagesSelectorComponent=class extends Container{selectList;constructor(currentValue,onSelect,onCancel){super();let items=[{value:"yes",label:"Yes",description:"Show images inline in terminal"},{value:"no",label:"No",description:"Show text placeholder instead"}];this.addChild(new DynamicBorder),this.selectList=new SelectList(items,5,getSelectListTheme(),SHOW_IMAGES_SELECT_LIST_LAYOUT),this.selectList.setSelectedIndex(currentValue?0:1),this.selectList.onSelect=item=>{onSelect(item.value==="yes")},this.selectList.onCancel=()=>{onCancel()},this.addChild(this.selectList),this.addChild(new DynamicBorder)}getSelectList(){return this.selectList}};var THEME_SELECT_LIST_LAYOUT={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},ThemeSelectorComponent=class extends Container{selectList;onPreview;constructor(currentTheme,onSelect,onCancel,onPreview){super(),this.onPreview=onPreview;let themes=getAvailableThemes(),themeItems=themes.map(name=>({value:name,label:name,description:name===currentTheme?"(current)":void 0}));this.addChild(new DynamicBorder),this.selectList=new SelectList(themeItems,10,getSelectListTheme(),THEME_SELECT_LIST_LAYOUT);let currentIndex=themes.indexOf(currentTheme);currentIndex!==-1&&this.selectList.setSelectedIndex(currentIndex),this.selectList.onSelect=item=>{onSelect(item.value)},this.selectList.onCancel=()=>{onCancel()},this.selectList.onSelectionChange=item=>{this.onPreview(item.value)},this.addChild(this.selectList),this.addChild(new DynamicBorder)}getSelectList(){return this.selectList}};export{ShowImagesSelectorComponent,ThemeSelectorComponent,dist_exports};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{dist_exports as dist_exports3}from"./chunk-KZW44KNK.js";import{all_exports,anthropicMessagesApi,azureOpenAIResponsesApi,bedrockConverseStreamApi,compile_exports,complete,completeSimple,createFauxCore,dist_exports as dist_exports2,envApiKeyAuth,fauxAssistantMessage,fauxProvider,fauxText,fauxThinking,fauxToolCall,generateImages,generateImagesOpenRouter,getApiProvider,getApiProviders,getImageModel,getImageModels,getImageProviders,getImagesApiProvider,getModel,getModels,getOverflowPatterns,getProviders,googleGenerativeAIApi,googleVertexApi,isContextOverflow,isRecoverableLength,lazyOAuth,mistralConversationsApi,openAICodexResponsesApi,openAICompletionsApi,openAIResponsesApi,piMessagesApi,registerApiProvider,registerBuiltInApiProviders,registerBuiltInImagesApiProviders,registerFauxProvider,registerImagesApiProvider,resetApiProviders,setBedrockProviderModule,stream,streamAnthropic,streamAzureOpenAIResponses,streamGoogle,streamGoogleVertex,streamMistral,streamOpenAICodexResponses,streamOpenAICompletions,streamOpenAIResponses,streamSimple,streamSimpleAnthropic,streamSimpleAzureOpenAIResponses,streamSimpleGoogle,streamSimpleGoogleVertex,streamSimpleMistral,streamSimpleOpenAICodexResponses,streamSimpleOpenAICompletions,streamSimpleOpenAIResponses,unregisterApiProviders,validateToolArguments,validateToolCall,value_exports}from"./chunk-RVQPMSKJ.js";import{DEFAULT_MAX_AGENT_RETRY_DELAY_MS,build_exports,isRetryableAssistantError,retryAssistantCall,retryDelayMs,typebox_exports}from"./chunk-62VOPMLK.js";import"./chunk-3TGLJEWK.js";import{dist_exports}from"./chunk-4EYXVSA5.js";import"./chunk-NZY7EIPA.js";import"./chunk-R2EGYMOO.js";import"./chunk-YZKQS34S.js";import"./chunk-6QGV3IWD.js";import"./chunk-36QC74V4.js";import{cleanupSessionResources,registerSessionResourceCleanup,uuidv7}from"./chunk-USJZMAIR.js";import"./chunk-5AGIVGSV.js";import{ANTHROPIC_API_KEY_ENV,ANTHROPIC_AUTH_TOKEN_ENV,ANTHROPIC_FEDERATION_RULE_ID_ENV,ANTHROPIC_IDENTITY_TOKEN_FILE_ENV,ANTHROPIC_OAUTH_TOKEN_ENV,ANTHROPIC_ORGANIZATION_ID_ENV,ANTHROPIC_SERVICE_ACCOUNT_ID_ENV,ANTHROPIC_WORKSPACE_ID_ENV,findEnvKeys,getEnvApiKey}from"./chunk-UKVNB6C4.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import{StreamingJsonParser,ToolCallArgumentsStream,parseJsonWithRepair,parseStreamingJson,parseToolCallArguments,repairJson}from"./chunk-FFMDRXC4.js";import{AI_TELEMETRY_SCHEMA,InMemoryCredentialStore,InMemoryModelsStore,ModelsError,calculateCost,clampThinkingLevel,collapseSystemMessages,createInitialSystemMessage,createModels,createProvider,declarationsEqual,defaultProviderAuthContext,getCurrentSystemMessage,getCurrentSystemPrompt,getCurrentTools,getDeclaredTools,getInitialSystemMessage,getModelType,getSupportedThinkingLevels,getToolStateChanges,hasApi,hasNonAdditiveToolChanges,hasToolRedefinitions,isModelType,lazyApi,lazyStream,modelsAreEqual,models_exports,normalizeContext,resolveTranscript,resolveTranscriptTools,toToolDeclaration,withoutInitialSystemMessage}from"./chunk-NL4X6LBY.js";import{AssistantMessageEventStream,EventStream,appendAssistantMessageDiagnostic,createAssistantMessageDiagnostic,createAssistantMessageEventStream,extractDiagnosticError,formatThrownValue}from"./chunk-LPXNMA2W.js";import{PI_AI_VERSION,PI_ATTRIBUTION,contentText,formatUserAgent,getAttributionHeaders,getClientVersion,getIdentityHeaders,getOpenCodeSessionHeaders,getSystemMessageText,mergeClientIdentity,renderSystemMessageUpdate,withClientIdentity}from"./chunk-V6KH5QG4.js";import{__export}from"./chunk-JXWJOIH4.js";var oauth_exports={};var pi_ai_extension_view_exports={};__export(pi_ai_extension_view_exports,{AI_TELEMETRY_SCHEMA:()=>AI_TELEMETRY_SCHEMA,ANTHROPIC_API_KEY_ENV:()=>ANTHROPIC_API_KEY_ENV,ANTHROPIC_AUTH_TOKEN_ENV:()=>ANTHROPIC_AUTH_TOKEN_ENV,ANTHROPIC_FEDERATION_RULE_ID_ENV:()=>ANTHROPIC_FEDERATION_RULE_ID_ENV,ANTHROPIC_IDENTITY_TOKEN_FILE_ENV:()=>ANTHROPIC_IDENTITY_TOKEN_FILE_ENV,ANTHROPIC_OAUTH_TOKEN_ENV:()=>ANTHROPIC_OAUTH_TOKEN_ENV,ANTHROPIC_ORGANIZATION_ID_ENV:()=>ANTHROPIC_ORGANIZATION_ID_ENV,ANTHROPIC_SERVICE_ACCOUNT_ID_ENV:()=>ANTHROPIC_SERVICE_ACCOUNT_ID_ENV,ANTHROPIC_WORKSPACE_ID_ENV:()=>ANTHROPIC_WORKSPACE_ID_ENV,AssistantMessageEventStream:()=>AssistantMessageEventStream,DEFAULT_MAX_AGENT_RETRY_DELAY_MS:()=>DEFAULT_MAX_AGENT_RETRY_DELAY_MS,EventStream:()=>EventStream,InMemoryCredentialStore:()=>InMemoryCredentialStore,InMemoryModelsStore:()=>InMemoryModelsStore,ModelsError:()=>ModelsError,PI_AI_VERSION:()=>PI_AI_VERSION,PI_ATTRIBUTION:()=>PI_ATTRIBUTION,StreamingJsonParser:()=>StreamingJsonParser,StringEnum:()=>StringEnum,ToolCallArgumentsStream:()=>ToolCallArgumentsStream,Type:()=>typebox_exports,anthropicMessagesApi:()=>anthropicMessagesApi,appendAssistantMessageDiagnostic:()=>appendAssistantMessageDiagnostic,azureOpenAIResponsesApi:()=>azureOpenAIResponsesApi,bedrockConverseStreamApi:()=>bedrockConverseStreamApi,calculateCost:()=>calculateCost,clampThinkingLevel:()=>clampThinkingLevel,cleanupSessionResources:()=>cleanupSessionResources,collapseSystemMessages:()=>collapseSystemMessages,complete:()=>complete,completeSimple:()=>completeSimple,contentText:()=>contentText,createAssistantMessageDiagnostic:()=>createAssistantMessageDiagnostic,createAssistantMessageEventStream:()=>createAssistantMessageEventStream,createFauxCore:()=>createFauxCore,createInitialSystemMessage:()=>createInitialSystemMessage,createModels:()=>createModels,createProvider:()=>createProvider,declarationsEqual:()=>declarationsEqual,defaultProviderAuthContext:()=>defaultProviderAuthContext,envApiKeyAuth:()=>envApiKeyAuth,extractDiagnosticError:()=>extractDiagnosticError,fauxAssistantMessage:()=>fauxAssistantMessage,fauxProvider:()=>fauxProvider,fauxText:()=>fauxText,fauxThinking:()=>fauxThinking,fauxToolCall:()=>fauxToolCall,findEnvKeys:()=>findEnvKeys,formatThrownValue:()=>formatThrownValue,formatUserAgent:()=>formatUserAgent,generateImages:()=>generateImages,generateImagesOpenRouter:()=>generateImagesOpenRouter,getApiProvider:()=>getApiProvider,getApiProviders:()=>getApiProviders,getAttributionHeaders:()=>getAttributionHeaders,getClientVersion:()=>getClientVersion,getCurrentSystemMessage:()=>getCurrentSystemMessage,getCurrentSystemPrompt:()=>getCurrentSystemPrompt,getCurrentTools:()=>getCurrentTools,getDeclaredTools:()=>getDeclaredTools,getEnvApiKey:()=>getEnvApiKey,getIdentityHeaders:()=>getIdentityHeaders,getImageModel:()=>getImageModel,getImageModels:()=>getImageModels,getImageProviders:()=>getImageProviders,getImagesApiProvider:()=>getImagesApiProvider,getInitialSystemMessage:()=>getInitialSystemMessage,getModel:()=>getModel,getModelType:()=>getModelType,getModels:()=>getModels,getOpenCodeSessionHeaders:()=>getOpenCodeSessionHeaders,getOverflowPatterns:()=>getOverflowPatterns,getProviders:()=>getProviders,getSupportedThinkingLevels:()=>getSupportedThinkingLevels,getSystemMessageText:()=>getSystemMessageText,getToolStateChanges:()=>getToolStateChanges,googleGenerativeAIApi:()=>googleGenerativeAIApi,googleVertexApi:()=>googleVertexApi,hasApi:()=>hasApi,hasNonAdditiveToolChanges:()=>hasNonAdditiveToolChanges,hasToolRedefinitions:()=>hasToolRedefinitions,isContextOverflow:()=>isContextOverflow,isModelType:()=>isModelType,isRecoverableLength:()=>isRecoverableLength,isRetryableAssistantError:()=>isRetryableAssistantError,lazyApi:()=>lazyApi,lazyOAuth:()=>lazyOAuth,lazyStream:()=>lazyStream,mergeClientIdentity:()=>mergeClientIdentity,mistralConversationsApi:()=>mistralConversationsApi,modelsAreEqual:()=>modelsAreEqual,normalizeContext:()=>normalizeContext,openAICodexResponsesApi:()=>openAICodexResponsesApi,openAICompletionsApi:()=>openAICompletionsApi,openAIResponsesApi:()=>openAIResponsesApi,parseJsonWithRepair:()=>parseJsonWithRepair,parseStreamingJson:()=>parseStreamingJson,parseToolCallArguments:()=>parseToolCallArguments,piMessagesApi:()=>piMessagesApi,registerApiProvider:()=>registerApiProvider,registerBuiltInApiProviders:()=>registerBuiltInApiProviders,registerBuiltInImagesApiProviders:()=>registerBuiltInImagesApiProviders,registerFauxProvider:()=>registerFauxProvider,registerImagesApiProvider:()=>registerImagesApiProvider,registerSessionResourceCleanup:()=>registerSessionResourceCleanup,renderSystemMessageUpdate:()=>renderSystemMessageUpdate,repairJson:()=>repairJson,resetApiProviders:()=>resetApiProviders,resolveTranscript:()=>resolveTranscript,resolveTranscriptTools:()=>resolveTranscriptTools,retryAssistantCall:()=>retryAssistantCall,retryDelayMs:()=>retryDelayMs,setBedrockProviderModule:()=>setBedrockProviderModule,stream:()=>stream,streamAnthropic:()=>streamAnthropic,streamAzureOpenAIResponses:()=>streamAzureOpenAIResponses,streamGoogle:()=>streamGoogle,streamGoogleVertex:()=>streamGoogleVertex,streamMistral:()=>streamMistral,streamOpenAICodexResponses:()=>streamOpenAICodexResponses,streamOpenAICompletions:()=>streamOpenAICompletions,streamOpenAIResponses:()=>streamOpenAIResponses,streamSimple:()=>streamSimple,streamSimpleAnthropic:()=>streamSimpleAnthropic,streamSimpleAzureOpenAIResponses:()=>streamSimpleAzureOpenAIResponses,streamSimpleGoogle:()=>streamSimpleGoogle,streamSimpleGoogleVertex:()=>streamSimpleGoogleVertex,streamSimpleMistral:()=>streamSimpleMistral,streamSimpleOpenAICodexResponses:()=>streamSimpleOpenAICodexResponses,streamSimpleOpenAICompletions:()=>streamSimpleOpenAICompletions,streamSimpleOpenAIResponses:()=>streamSimpleOpenAIResponses,toToolDeclaration:()=>toToolDeclaration,unregisterApiProviders:()=>unregisterApiProviders,uuidv7:()=>uuidv7,validateToolArguments:()=>validateToolArguments,validateToolCall:()=>validateToolCall,withClientIdentity:()=>withClientIdentity,withoutInitialSystemMessage:()=>withoutInitialSystemMessage});function StringEnum(values,options){return typebox_exports.Unsafe({type:"string",enum:values,...options?.description&&{description:options.description},...options?.default&&{default:options.default}})}var VIRTUAL_MODULES={typebox:build_exports,"typebox/compile":compile_exports,"typebox/value":value_exports,"@sinclair/typebox":build_exports,"@sinclair/typebox/compile":compile_exports,"@sinclair/typebox/value":value_exports,"@earendil-works/pi-agent-core":dist_exports2,"@earendil-works/pi-tui":dist_exports,"@earendil-works/pi-ai":pi_ai_extension_view_exports,"@earendil-works/pi-ai/compat":pi_ai_extension_view_exports,"@earendil-works/pi-ai/models":models_exports,"@earendil-works/pi-ai/oauth":oauth_exports,"@earendil-works/pi-ai/providers/all":all_exports,"@earendil-works/pi-coding-agent":dist_exports3,"@mariozechner/pi-agent-core":dist_exports2,"@mariozechner/pi-tui":dist_exports,"@mariozechner/pi-ai":pi_ai_extension_view_exports,"@mariozechner/pi-ai/compat":pi_ai_extension_view_exports,"@mariozechner/pi-ai/models":models_exports,"@mariozechner/pi-ai/oauth":oauth_exports,"@mariozechner/pi-ai/providers/all":all_exports,"@mariozechner/pi-coding-agent":dist_exports3};export{VIRTUAL_MODULES};
|
|
2
|
+
import{dist_exports as dist_exports3}from"./chunk-MSIQUO5T.js";import{all_exports,anthropicMessagesApi,azureOpenAIResponsesApi,bedrockConverseStreamApi,compile_exports,complete,completeSimple,createFauxCore,dist_exports as dist_exports2,envApiKeyAuth,fauxAssistantMessage,fauxProvider,fauxText,fauxThinking,fauxToolCall,generateImages,generateImagesOpenRouter,getApiProvider,getApiProviders,getImageModel,getImageModels,getImageProviders,getImagesApiProvider,getModel,getModels,getOverflowPatterns,getProviders,googleGenerativeAIApi,googleVertexApi,isContextOverflow,isRecoverableLength,lazyOAuth,mistralConversationsApi,openAICodexResponsesApi,openAICompletionsApi,openAIResponsesApi,piMessagesApi,registerApiProvider,registerBuiltInApiProviders,registerBuiltInImagesApiProviders,registerFauxProvider,registerImagesApiProvider,resetApiProviders,setBedrockProviderModule,stream,streamAnthropic,streamAzureOpenAIResponses,streamGoogle,streamGoogleVertex,streamMistral,streamOpenAICodexResponses,streamOpenAICompletions,streamOpenAIResponses,streamSimple,streamSimpleAnthropic,streamSimpleAzureOpenAIResponses,streamSimpleGoogle,streamSimpleGoogleVertex,streamSimpleMistral,streamSimpleOpenAICodexResponses,streamSimpleOpenAICompletions,streamSimpleOpenAIResponses,unregisterApiProviders,validateToolArguments,validateToolCall,value_exports}from"./chunk-FGCQRPD5.js";import{DEFAULT_MAX_AGENT_RETRY_DELAY_MS,build_exports,isRetryableAssistantError,retryAssistantCall,retryDelayMs,typebox_exports}from"./chunk-62VOPMLK.js";import"./chunk-3TGLJEWK.js";import{dist_exports}from"./chunk-4EYXVSA5.js";import"./chunk-NZY7EIPA.js";import"./chunk-R2EGYMOO.js";import"./chunk-YZKQS34S.js";import"./chunk-6QGV3IWD.js";import"./chunk-36QC74V4.js";import{cleanupSessionResources,registerSessionResourceCleanup,uuidv7}from"./chunk-USJZMAIR.js";import"./chunk-5AGIVGSV.js";import{ANTHROPIC_API_KEY_ENV,ANTHROPIC_AUTH_TOKEN_ENV,ANTHROPIC_FEDERATION_RULE_ID_ENV,ANTHROPIC_IDENTITY_TOKEN_FILE_ENV,ANTHROPIC_OAUTH_TOKEN_ENV,ANTHROPIC_ORGANIZATION_ID_ENV,ANTHROPIC_SERVICE_ACCOUNT_ID_ENV,ANTHROPIC_WORKSPACE_ID_ENV,findEnvKeys,getEnvApiKey}from"./chunk-UKVNB6C4.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import{StreamingJsonParser,ToolCallArgumentsStream,parseJsonWithRepair,parseStreamingJson,parseToolCallArguments,repairJson}from"./chunk-FFMDRXC4.js";import{AI_TELEMETRY_SCHEMA,InMemoryCredentialStore,InMemoryModelsStore,ModelsError,calculateCost,clampThinkingLevel,collapseSystemMessages,createInitialSystemMessage,createModels,createProvider,declarationsEqual,defaultProviderAuthContext,getCurrentSystemMessage,getCurrentSystemPrompt,getCurrentTools,getDeclaredTools,getInitialSystemMessage,getModelType,getSupportedThinkingLevels,getToolStateChanges,hasApi,hasNonAdditiveToolChanges,hasToolRedefinitions,isModelType,lazyApi,lazyStream,modelsAreEqual,models_exports,normalizeContext,resolveTranscript,resolveTranscriptTools,toToolDeclaration,withoutInitialSystemMessage}from"./chunk-NL4X6LBY.js";import{AssistantMessageEventStream,EventStream,appendAssistantMessageDiagnostic,createAssistantMessageDiagnostic,createAssistantMessageEventStream,extractDiagnosticError,formatThrownValue}from"./chunk-LPXNMA2W.js";import{PI_AI_VERSION,PI_ATTRIBUTION,contentText,formatUserAgent,getAttributionHeaders,getClientVersion,getIdentityHeaders,getOpenCodeSessionHeaders,getSystemMessageText,mergeClientIdentity,renderSystemMessageUpdate,withClientIdentity}from"./chunk-V6KH5QG4.js";import{__export}from"./chunk-JXWJOIH4.js";var oauth_exports={};var pi_ai_extension_view_exports={};__export(pi_ai_extension_view_exports,{AI_TELEMETRY_SCHEMA:()=>AI_TELEMETRY_SCHEMA,ANTHROPIC_API_KEY_ENV:()=>ANTHROPIC_API_KEY_ENV,ANTHROPIC_AUTH_TOKEN_ENV:()=>ANTHROPIC_AUTH_TOKEN_ENV,ANTHROPIC_FEDERATION_RULE_ID_ENV:()=>ANTHROPIC_FEDERATION_RULE_ID_ENV,ANTHROPIC_IDENTITY_TOKEN_FILE_ENV:()=>ANTHROPIC_IDENTITY_TOKEN_FILE_ENV,ANTHROPIC_OAUTH_TOKEN_ENV:()=>ANTHROPIC_OAUTH_TOKEN_ENV,ANTHROPIC_ORGANIZATION_ID_ENV:()=>ANTHROPIC_ORGANIZATION_ID_ENV,ANTHROPIC_SERVICE_ACCOUNT_ID_ENV:()=>ANTHROPIC_SERVICE_ACCOUNT_ID_ENV,ANTHROPIC_WORKSPACE_ID_ENV:()=>ANTHROPIC_WORKSPACE_ID_ENV,AssistantMessageEventStream:()=>AssistantMessageEventStream,DEFAULT_MAX_AGENT_RETRY_DELAY_MS:()=>DEFAULT_MAX_AGENT_RETRY_DELAY_MS,EventStream:()=>EventStream,InMemoryCredentialStore:()=>InMemoryCredentialStore,InMemoryModelsStore:()=>InMemoryModelsStore,ModelsError:()=>ModelsError,PI_AI_VERSION:()=>PI_AI_VERSION,PI_ATTRIBUTION:()=>PI_ATTRIBUTION,StreamingJsonParser:()=>StreamingJsonParser,StringEnum:()=>StringEnum,ToolCallArgumentsStream:()=>ToolCallArgumentsStream,Type:()=>typebox_exports,anthropicMessagesApi:()=>anthropicMessagesApi,appendAssistantMessageDiagnostic:()=>appendAssistantMessageDiagnostic,azureOpenAIResponsesApi:()=>azureOpenAIResponsesApi,bedrockConverseStreamApi:()=>bedrockConverseStreamApi,calculateCost:()=>calculateCost,clampThinkingLevel:()=>clampThinkingLevel,cleanupSessionResources:()=>cleanupSessionResources,collapseSystemMessages:()=>collapseSystemMessages,complete:()=>complete,completeSimple:()=>completeSimple,contentText:()=>contentText,createAssistantMessageDiagnostic:()=>createAssistantMessageDiagnostic,createAssistantMessageEventStream:()=>createAssistantMessageEventStream,createFauxCore:()=>createFauxCore,createInitialSystemMessage:()=>createInitialSystemMessage,createModels:()=>createModels,createProvider:()=>createProvider,declarationsEqual:()=>declarationsEqual,defaultProviderAuthContext:()=>defaultProviderAuthContext,envApiKeyAuth:()=>envApiKeyAuth,extractDiagnosticError:()=>extractDiagnosticError,fauxAssistantMessage:()=>fauxAssistantMessage,fauxProvider:()=>fauxProvider,fauxText:()=>fauxText,fauxThinking:()=>fauxThinking,fauxToolCall:()=>fauxToolCall,findEnvKeys:()=>findEnvKeys,formatThrownValue:()=>formatThrownValue,formatUserAgent:()=>formatUserAgent,generateImages:()=>generateImages,generateImagesOpenRouter:()=>generateImagesOpenRouter,getApiProvider:()=>getApiProvider,getApiProviders:()=>getApiProviders,getAttributionHeaders:()=>getAttributionHeaders,getClientVersion:()=>getClientVersion,getCurrentSystemMessage:()=>getCurrentSystemMessage,getCurrentSystemPrompt:()=>getCurrentSystemPrompt,getCurrentTools:()=>getCurrentTools,getDeclaredTools:()=>getDeclaredTools,getEnvApiKey:()=>getEnvApiKey,getIdentityHeaders:()=>getIdentityHeaders,getImageModel:()=>getImageModel,getImageModels:()=>getImageModels,getImageProviders:()=>getImageProviders,getImagesApiProvider:()=>getImagesApiProvider,getInitialSystemMessage:()=>getInitialSystemMessage,getModel:()=>getModel,getModelType:()=>getModelType,getModels:()=>getModels,getOpenCodeSessionHeaders:()=>getOpenCodeSessionHeaders,getOverflowPatterns:()=>getOverflowPatterns,getProviders:()=>getProviders,getSupportedThinkingLevels:()=>getSupportedThinkingLevels,getSystemMessageText:()=>getSystemMessageText,getToolStateChanges:()=>getToolStateChanges,googleGenerativeAIApi:()=>googleGenerativeAIApi,googleVertexApi:()=>googleVertexApi,hasApi:()=>hasApi,hasNonAdditiveToolChanges:()=>hasNonAdditiveToolChanges,hasToolRedefinitions:()=>hasToolRedefinitions,isContextOverflow:()=>isContextOverflow,isModelType:()=>isModelType,isRecoverableLength:()=>isRecoverableLength,isRetryableAssistantError:()=>isRetryableAssistantError,lazyApi:()=>lazyApi,lazyOAuth:()=>lazyOAuth,lazyStream:()=>lazyStream,mergeClientIdentity:()=>mergeClientIdentity,mistralConversationsApi:()=>mistralConversationsApi,modelsAreEqual:()=>modelsAreEqual,normalizeContext:()=>normalizeContext,openAICodexResponsesApi:()=>openAICodexResponsesApi,openAICompletionsApi:()=>openAICompletionsApi,openAIResponsesApi:()=>openAIResponsesApi,parseJsonWithRepair:()=>parseJsonWithRepair,parseStreamingJson:()=>parseStreamingJson,parseToolCallArguments:()=>parseToolCallArguments,piMessagesApi:()=>piMessagesApi,registerApiProvider:()=>registerApiProvider,registerBuiltInApiProviders:()=>registerBuiltInApiProviders,registerBuiltInImagesApiProviders:()=>registerBuiltInImagesApiProviders,registerFauxProvider:()=>registerFauxProvider,registerImagesApiProvider:()=>registerImagesApiProvider,registerSessionResourceCleanup:()=>registerSessionResourceCleanup,renderSystemMessageUpdate:()=>renderSystemMessageUpdate,repairJson:()=>repairJson,resetApiProviders:()=>resetApiProviders,resolveTranscript:()=>resolveTranscript,resolveTranscriptTools:()=>resolveTranscriptTools,retryAssistantCall:()=>retryAssistantCall,retryDelayMs:()=>retryDelayMs,setBedrockProviderModule:()=>setBedrockProviderModule,stream:()=>stream,streamAnthropic:()=>streamAnthropic,streamAzureOpenAIResponses:()=>streamAzureOpenAIResponses,streamGoogle:()=>streamGoogle,streamGoogleVertex:()=>streamGoogleVertex,streamMistral:()=>streamMistral,streamOpenAICodexResponses:()=>streamOpenAICodexResponses,streamOpenAICompletions:()=>streamOpenAICompletions,streamOpenAIResponses:()=>streamOpenAIResponses,streamSimple:()=>streamSimple,streamSimpleAnthropic:()=>streamSimpleAnthropic,streamSimpleAzureOpenAIResponses:()=>streamSimpleAzureOpenAIResponses,streamSimpleGoogle:()=>streamSimpleGoogle,streamSimpleGoogleVertex:()=>streamSimpleGoogleVertex,streamSimpleMistral:()=>streamSimpleMistral,streamSimpleOpenAICodexResponses:()=>streamSimpleOpenAICodexResponses,streamSimpleOpenAICompletions:()=>streamSimpleOpenAICompletions,streamSimpleOpenAIResponses:()=>streamSimpleOpenAIResponses,toToolDeclaration:()=>toToolDeclaration,unregisterApiProviders:()=>unregisterApiProviders,uuidv7:()=>uuidv7,validateToolArguments:()=>validateToolArguments,validateToolCall:()=>validateToolCall,withClientIdentity:()=>withClientIdentity,withoutInitialSystemMessage:()=>withoutInitialSystemMessage});function StringEnum(values,options){return typebox_exports.Unsafe({type:"string",enum:values,...options?.description&&{description:options.description},...options?.default&&{default:options.default}})}var VIRTUAL_MODULES={typebox:build_exports,"typebox/compile":compile_exports,"typebox/value":value_exports,"@sinclair/typebox":build_exports,"@sinclair/typebox/compile":compile_exports,"@sinclair/typebox/value":value_exports,"@earendil-works/pi-agent-core":dist_exports2,"@earendil-works/pi-tui":dist_exports,"@earendil-works/pi-ai":pi_ai_extension_view_exports,"@earendil-works/pi-ai/compat":pi_ai_extension_view_exports,"@earendil-works/pi-ai/models":models_exports,"@earendil-works/pi-ai/oauth":oauth_exports,"@earendil-works/pi-ai/providers/all":all_exports,"@earendil-works/pi-coding-agent":dist_exports3,"@mariozechner/pi-agent-core":dist_exports2,"@mariozechner/pi-tui":dist_exports,"@mariozechner/pi-ai":pi_ai_extension_view_exports,"@mariozechner/pi-ai/compat":pi_ai_extension_view_exports,"@mariozechner/pi-ai/models":models_exports,"@mariozechner/pi-ai/oauth":oauth_exports,"@mariozechner/pi-ai/providers/all":all_exports,"@mariozechner/pi-coding-agent":dist_exports3};export{VIRTUAL_MODULES};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
3
|
-
import{configureHttpDispatcher,main}from"./chunks/chunk-
|
|
3
|
+
import{configureHttpDispatcher,main}from"./chunks/chunk-FGCQRPD5.js";import"./chunks/chunk-62VOPMLK.js";import"./chunks/chunk-3TGLJEWK.js";import"./chunks/chunk-4EYXVSA5.js";import"./chunks/chunk-NZY7EIPA.js";import"./chunks/chunk-R2EGYMOO.js";import"./chunks/chunk-YZKQS34S.js";import"./chunks/chunk-6QGV3IWD.js";import{APP_NAME}from"./chunks/chunk-36QC74V4.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-UKVNB6C4.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-NL4X6LBY.js";import"./chunks/chunk-LPXNMA2W.js";import"./chunks/chunk-V6KH5QG4.js";import"./chunks/chunk-JXWJOIH4.js";function setupCli(){process.title=APP_NAME,process.env.PI_CODING_AGENT="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),configureHttpDispatcher()}setupCli();main(process.argv.slice(2));
|
package/dist/bundle/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{ShowImagesSelectorComponent,ThemeSelectorComponent}from"./chunks/chunk-
|
|
2
|
+
import{ShowImagesSelectorComponent,ThemeSelectorComponent}from"./chunks/chunk-MSIQUO5T.js";import{AgentSession,AgentSessionRuntime,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,RpcClient,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,SkillInvocationMessageComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildSessionContext,buildSessionProjection,calculateContextTokens,collectEntriesForBranchSummary,compact,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodemodeExtension,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createMcpExtension,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createToolSearchExtension,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getLastAssistantUsage,getLatestCompactionEntry,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,parseArgs,parseFrontmatter,parseSessionEntries,parseSkillBlock,prepareBranchEntries,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,runRpcMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-FGCQRPD5.js";import{DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,formatReadLineRange,formatSize,truncateHead,truncateLine,truncateTail,truncateToVisualLines}from"./chunks/chunk-62VOPMLK.js";import{ArminComponent}from"./chunks/chunk-3TGLJEWK.js";import{Theme,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme,keyHint,keyText,rawKeyHint}from"./chunks/chunk-4EYXVSA5.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunks/chunk-NZY7EIPA.js";import{readStoredCredential}from"./chunks/chunk-R2EGYMOO.js";import{getPowerShellConfig,getShellConfig}from"./chunks/chunk-YZKQS34S.js";import"./chunks/chunk-6QGV3IWD.js";import{CONFIG_DIR_NAME,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunks/chunk-36QC74V4.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-UKVNB6C4.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-NL4X6LBY.js";import"./chunks/chunk-LPXNMA2W.js";import"./chunks/chunk-V6KH5QG4.js";import"./chunks/chunk-JXWJOIH4.js";export{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CONFIG_DIR_NAME,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,ProjectTrustStore,RpcClient,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,Theme,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,VERSION,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildSessionContext,buildSessionProjection,calculateContextTokens,collectEntriesForBranchSummary,compact,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodemodeExtension,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createMcpExtension,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createToolSearchExtension,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatReadLineRange,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getAgentDir,getDocsPath,getExamplesPath,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,getMarkdownTheme,getPackageDir,getPowerShellConfig,getReadmePath,getSelectListTheme,getSettingsListTheme,getShellConfig,hasTrustRequiringProjectResources,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,keyHint,keyText,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,parseArgs,parseFrontmatter,parseSessionEntries,parseSkillBlock,prepareBranchEntries,rawKeyHint,readStoredCredential,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,runRpcMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools};
|
package/dist/bundle/rpc-entry.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
3
|
-
import{configureHttpDispatcher,main}from"./chunks/chunk-
|
|
3
|
+
import{configureHttpDispatcher,main}from"./chunks/chunk-FGCQRPD5.js";import"./chunks/chunk-62VOPMLK.js";import"./chunks/chunk-3TGLJEWK.js";import"./chunks/chunk-4EYXVSA5.js";import"./chunks/chunk-NZY7EIPA.js";import"./chunks/chunk-R2EGYMOO.js";import"./chunks/chunk-YZKQS34S.js";import"./chunks/chunk-6QGV3IWD.js";import{APP_NAME}from"./chunks/chunk-36QC74V4.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-UKVNB6C4.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-NL4X6LBY.js";import"./chunks/chunk-LPXNMA2W.js";import"./chunks/chunk-V6KH5QG4.js";import"./chunks/chunk-JXWJOIH4.js";process.title=`${APP_NAME}-rpc`;process.env.PI_CODING_AGENT="true";process.env.AI_AGENT="pi";process.emitWarning=(()=>{});configureHttpDispatcher();main(["--mode","rpc",...process.argv.slice(2)]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-move.d.ts","sourceRoot":"","sources":["../../src/core/session-move.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session-move.d.ts","sourceRoot":"","sources":["../../src/core/session-move.ts"],"names":[],"mappings":"AAyDA,yGAAyG;AACzG,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,SAAgB,GAAG,MAAM,CAqGvG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Relocate an inactive session without rewriting its conversation history.
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
|
-
import { closeSync, fsyncSync, linkSync, lstatSync, mkdirSync, openSync, readdirSync, readFileSync, readSync, realpathSync, statSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
3
|
+
import { closeSync, fsyncSync, linkSync, lstatSync, mkdirSync, openSync, readdirSync, readFileSync, readSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
4
4
|
import { basename, dirname, join, resolve } from "node:path";
|
|
5
5
|
import { getAgentDir } from "../config.js";
|
|
6
6
|
import { canonicalizePath } from "../utils/paths.js";
|
|
@@ -78,8 +78,12 @@ export function moveSessionHere(sourcePath, targetCwd, agentDir = getAgentDir())
|
|
|
78
78
|
original.subarray(newline + 1),
|
|
79
79
|
]);
|
|
80
80
|
const destination = join(getDefaultSessionDir(target, agentDir), basename(source));
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
// A session can be stored under one folder while its header names another. The picker lists sessions by
|
|
82
|
+
// storage directory and labels them by the header, so such a session appears under the current folder
|
|
83
|
+
// wearing another folder's name, and asking to move it there lands here: the destination is the source.
|
|
84
|
+
// Nothing needs moving and nothing can be linked over an existing name, so relabel it in place instead
|
|
85
|
+
// of refusing -- the header is the only thing that disagrees with reality.
|
|
86
|
+
const inPlace = resolve(destination) === source;
|
|
83
87
|
const backupDir = join(agentDir, "session-move-backups");
|
|
84
88
|
mkdirSync(backupDir, { recursive: true, mode: 0o700 });
|
|
85
89
|
const backup = join(backupDir, `${randomUUID()}.jsonl`);
|
|
@@ -103,6 +107,21 @@ export function moveSessionHere(sourcePath, targetCwd, agentDir = getAgentDir())
|
|
|
103
107
|
finally {
|
|
104
108
|
closeSync(fd);
|
|
105
109
|
}
|
|
110
|
+
if (inPlace) {
|
|
111
|
+
try {
|
|
112
|
+
if (!readFileSync(temporary).equals(output))
|
|
113
|
+
throw new Error("Relabelled session verification failed.");
|
|
114
|
+
// rename replaces the destination, which is what an in-place relabel needs; the hard link below
|
|
115
|
+
// deliberately cannot replace anything, which is what makes a real move safe against a name that
|
|
116
|
+
// already exists. The backup written above holds the bytes being overwritten either way.
|
|
117
|
+
renameSync(temporary, destination);
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
rmSync(temporary, { force: true });
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
return destination;
|
|
124
|
+
}
|
|
106
125
|
let published = false;
|
|
107
126
|
let marked = false;
|
|
108
127
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-move.js","sourceRoot":"","sources":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AAC,CAAC;QACpB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,MAAM;gBAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;YACvC,IAAI,SAAS;gBAAE,UAAU,CAAC,WAAW,CAAC,CAAC;YACvC,MAAM,KAAK,CAAC;QACb,CAAC;gBAAS,CAAC;YACV,UAAU,CAAC,SAAS,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,WAAW,CAAC;IACpB,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Relocate an inactive session without rewriting its conversation history.\nimport { randomUUID } from \"node:crypto\";\nimport {\n\tcloseSync,\n\tfsyncSync,\n\tlinkSync,\n\tlstatSync,\n\tmkdirSync,\n\topenSync,\n\treaddirSync,\n\treadFileSync,\n\treadSync,\n\trealpathSync,\n\tstatSync,\n\tunlinkSync,\n\twriteFileSync,\n} from \"node:fs\";\nimport { basename, dirname, join, resolve } from \"node:path\";\nimport { getAgentDir } from \"../config.ts\";\nimport { canonicalizePath } from \"../utils/paths.ts\";\nimport { getDefaultSessionDir, type SessionHeader } from \"./session-manager.ts\";\nimport {\n\tassertSessionUnused,\n\tmarkSessionMoved,\n\tunmarkSessionMoved,\n\twithSessionOwnershipGate,\n} from \"./session-ownership.ts\";\n\nfunction readHeader(path: string): SessionHeader {\n\tconst fd = openSync(path, \"r\");\n\ttry {\n\t\tconst buffer = Buffer.alloc(1024 * 1024);\n\t\tconst count = readSync(fd, buffer, 0, buffer.length, 0);\n\t\tconst newline = buffer.subarray(0, count).indexOf(10);\n\t\tif (newline < 0) throw new Error(`Missing or oversized session header: ${path}`);\n\t\tconst value = JSON.parse(buffer.subarray(0, newline).toString(\"utf8\"));\n\t\tif (value?.type !== \"session\" || typeof value.id !== \"string\" || typeof value.cwd !== \"string\") {\n\t\t\tthrow new Error(`Invalid session header: ${path}`);\n\t\t}\n\t\treturn value as SessionHeader;\n\t} finally {\n\t\tcloseSync(fd);\n\t}\n}\n\nfunction writeDurableFile(path: string, content: Buffer | string): void {\n\tconst fd = openSync(path, \"wx\", 0o600);\n\ttry {\n\t\twriteFileSync(fd, content);\n\t\tfsyncSync(fd);\n\t} finally {\n\t\tcloseSync(fd);\n\t}\n}\n\n/** Move a default-storage session; retain a backup and refuse uncertain ownership or linked children. */\nexport function moveSessionHere(sourcePath: string, targetCwd: string, agentDir = getAgentDir()): string {\n\treturn withSessionOwnershipGate(() => {\n\t\tconst source = realpathSync(sourcePath);\n\t\tif (lstatSync(sourcePath).isSymbolicLink()) throw new Error(\"Moving symlinked session files is not supported.\");\n\t\tif (statSync(source).nlink !== 1) throw new Error(\"Moving hard-linked session files is not supported.\");\n\t\tconst target = realpathSync(targetCwd);\n\t\tif (!statSync(target).isDirectory()) throw new Error(\"Move destination must be a directory.\");\n\t\tconst header = readHeader(source);\n\t\tif (canonicalizePath(header.cwd) === target) throw new Error(\"Session already belongs to this directory.\");\n\t\tconst sessionsRoot = realpathSync(join(agentDir, \"sessions\"));\n\t\tif (dirname(dirname(source)) !== sessionsRoot)\n\t\t\tthrow new Error(\"Only default session storage is supported for now.\");\n\t\tassertSessionUnused(source);\n\n\t\t// Changing child headers would require a multi-file transaction. Do not silently break ancestry.\n\t\tfor (const directory of readdirSync(sessionsRoot, { withFileTypes: true })) {\n\t\t\tif (directory.isSymbolicLink())\n\t\t\t\tthrow new Error(\"Symlinked session storage needs manual review before moving.\");\n\t\t\tif (!directory.isDirectory()) continue;\n\t\t\tfor (const file of readdirSync(join(sessionsRoot, directory.name))) {\n\t\t\t\tif (!file.endsWith(\".jsonl\")) continue;\n\t\t\t\tconst child = readHeader(join(sessionsRoot, directory.name, file));\n\t\t\t\tif (child.parentSession && canonicalizePath(child.parentSession) === source) {\n\t\t\t\t\tthrow new Error(\"Session has forks or clones referencing its path; moving it is not supported yet.\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst original = readFileSync(source);\n\t\tconst newline = original.indexOf(10);\n\t\t// Validate every JSONL record, but preserve all bytes after the header, including unknown entry types.\n\t\tfor (const line of original.toString(\"utf8\").split(\"\\n\")) if (line.trim()) JSON.parse(line);\n\t\tconst output = Buffer.concat([\n\t\t\tBuffer.from(`${JSON.stringify({ ...header, cwd: target })}\\n`),\n\t\t\toriginal.subarray(newline + 1),\n\t\t]);\n\t\tconst destination = join(getDefaultSessionDir(target, agentDir), basename(source));\n\t\tif (resolve(destination) === source) throw new Error(\"Source and destination storage paths are identical.\");\n\t\tconst backupDir = join(agentDir, \"session-move-backups\");\n\t\tmkdirSync(backupDir, { recursive: true, mode: 0o700 });\n\t\tconst backup = join(backupDir, `${randomUUID()}.jsonl`);\n\t\twriteDurableFile(backup, original);\n\t\tif (!readFileSync(backup).equals(original)) throw new Error(`Backup verification failed: ${backup}`);\n\t\twriteDurableFile(\n\t\t\t`${backup}.metadata.json`,\n\t\t\t`${JSON.stringify({ source, destination, sessionId: header.id, created: new Date().toISOString() }, null, 2)}\\n`,\n\t\t);\n\t\tconst backupDirectoryFd = openSync(backupDir, \"r\");\n\t\ttry {\n\t\t\tfsyncSync(backupDirectoryFd);\n\t\t} finally {\n\t\t\tcloseSync(backupDirectoryFd);\n\t\t}\n\t\tconst temporary = `${destination}.${randomUUID()}.tmp`;\n\t\tconst fd = openSync(temporary, \"wx\", 0o600);\n\t\ttry {\n\t\t\twriteFileSync(fd, output);\n\t\t\tfsyncSync(fd);\n\t\t} finally {\n\t\t\tcloseSync(fd);\n\t\t}\n\t\tlet published = false;\n\t\tlet marked = false;\n\t\ttry {\n\t\t\t// Hard-link publication is atomic and never replaces an existing destination.\n\t\t\tlinkSync(temporary, destination);\n\t\t\tpublished = true;\n\t\t\tif (!readFileSync(destination).equals(output)) throw new Error(\"Destination verification failed.\");\n\t\t\tif (!readFileSync(source).equals(original)) throw new Error(\"Source changed during the move.\");\n\t\t\tmarkSessionMoved(source, destination);\n\t\t\tmarked = true;\n\t\t\tunlinkSync(source);\n\t\t} catch (error) {\n\t\t\tif (marked) unmarkSessionMoved(source);\n\t\t\tif (published) unlinkSync(destination);\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tunlinkSync(temporary);\n\t\t}\n\t\treturn destination;\n\t});\n}\n"]}
|
|
1
|
+
{"version":3,"file":"session-move.js","sourceRoot":"","sources":["../../src/core/session-move.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACN,SAAS,EACT,SAAS,EACT,QAAQ,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,MAAM,EACN,QAAQ,EACR,UAAU,EACV,aAAa,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAsB,MAAM,sBAAsB,CAAC;AAChF,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,SAAS,UAAU,CAAC,IAAY;IAC/B,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC/B,IAAI,CAAC;QACJ,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACxD,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACtD,IAAI,OAAO,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AAC,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;gBACnC,MAAM,KAAK,CAAC;YACb,CAAC;YACD,OAAO,WAAW,CAAC;QACpB,CAAC;QAED,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC;YACJ,8EAA8E;YAC9E,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;YACjC,SAAS,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;YACnG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;YAC/F,gBAAgB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YACtC,MAAM,GAAG,IAAI,CAAC;YACd,UAAU,CAAC,MAAM,CAAC,CAAC;QACpB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,MAAM;gBAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;YACvC,IAAI,SAAS;gBAAE,UAAU,CAAC,WAAW,CAAC,CAAC;YACvC,MAAM,KAAK,CAAC;QACb,CAAC;gBAAS,CAAC;YACV,UAAU,CAAC,SAAS,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,WAAW,CAAC;IACpB,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Relocate an inactive session without rewriting its conversation history.\nimport { randomUUID } from \"node:crypto\";\nimport {\n\tcloseSync,\n\tfsyncSync,\n\tlinkSync,\n\tlstatSync,\n\tmkdirSync,\n\topenSync,\n\treaddirSync,\n\treadFileSync,\n\treadSync,\n\trealpathSync,\n\trenameSync,\n\trmSync,\n\tstatSync,\n\tunlinkSync,\n\twriteFileSync,\n} from \"node:fs\";\nimport { basename, dirname, join, resolve } from \"node:path\";\nimport { getAgentDir } from \"../config.ts\";\nimport { canonicalizePath } from \"../utils/paths.ts\";\nimport { getDefaultSessionDir, type SessionHeader } from \"./session-manager.ts\";\nimport {\n\tassertSessionUnused,\n\tmarkSessionMoved,\n\tunmarkSessionMoved,\n\twithSessionOwnershipGate,\n} from \"./session-ownership.ts\";\n\nfunction readHeader(path: string): SessionHeader {\n\tconst fd = openSync(path, \"r\");\n\ttry {\n\t\tconst buffer = Buffer.alloc(1024 * 1024);\n\t\tconst count = readSync(fd, buffer, 0, buffer.length, 0);\n\t\tconst newline = buffer.subarray(0, count).indexOf(10);\n\t\tif (newline < 0) throw new Error(`Missing or oversized session header: ${path}`);\n\t\tconst value = JSON.parse(buffer.subarray(0, newline).toString(\"utf8\"));\n\t\tif (value?.type !== \"session\" || typeof value.id !== \"string\" || typeof value.cwd !== \"string\") {\n\t\t\tthrow new Error(`Invalid session header: ${path}`);\n\t\t}\n\t\treturn value as SessionHeader;\n\t} finally {\n\t\tcloseSync(fd);\n\t}\n}\n\nfunction writeDurableFile(path: string, content: Buffer | string): void {\n\tconst fd = openSync(path, \"wx\", 0o600);\n\ttry {\n\t\twriteFileSync(fd, content);\n\t\tfsyncSync(fd);\n\t} finally {\n\t\tcloseSync(fd);\n\t}\n}\n\n/** Move a default-storage session; retain a backup and refuse uncertain ownership or linked children. */\nexport function moveSessionHere(sourcePath: string, targetCwd: string, agentDir = getAgentDir()): string {\n\treturn withSessionOwnershipGate(() => {\n\t\tconst source = realpathSync(sourcePath);\n\t\tif (lstatSync(sourcePath).isSymbolicLink()) throw new Error(\"Moving symlinked session files is not supported.\");\n\t\tif (statSync(source).nlink !== 1) throw new Error(\"Moving hard-linked session files is not supported.\");\n\t\tconst target = realpathSync(targetCwd);\n\t\tif (!statSync(target).isDirectory()) throw new Error(\"Move destination must be a directory.\");\n\t\tconst header = readHeader(source);\n\t\tif (canonicalizePath(header.cwd) === target) throw new Error(\"Session already belongs to this directory.\");\n\t\tconst sessionsRoot = realpathSync(join(agentDir, \"sessions\"));\n\t\tif (dirname(dirname(source)) !== sessionsRoot)\n\t\t\tthrow new Error(\"Only default session storage is supported for now.\");\n\t\tassertSessionUnused(source);\n\n\t\t// Changing child headers would require a multi-file transaction. Do not silently break ancestry.\n\t\tfor (const directory of readdirSync(sessionsRoot, { withFileTypes: true })) {\n\t\t\tif (directory.isSymbolicLink())\n\t\t\t\tthrow new Error(\"Symlinked session storage needs manual review before moving.\");\n\t\t\tif (!directory.isDirectory()) continue;\n\t\t\tfor (const file of readdirSync(join(sessionsRoot, directory.name))) {\n\t\t\t\tif (!file.endsWith(\".jsonl\")) continue;\n\t\t\t\tconst child = readHeader(join(sessionsRoot, directory.name, file));\n\t\t\t\tif (child.parentSession && canonicalizePath(child.parentSession) === source) {\n\t\t\t\t\tthrow new Error(\"Session has forks or clones referencing its path; moving it is not supported yet.\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst original = readFileSync(source);\n\t\tconst newline = original.indexOf(10);\n\t\t// Validate every JSONL record, but preserve all bytes after the header, including unknown entry types.\n\t\tfor (const line of original.toString(\"utf8\").split(\"\\n\")) if (line.trim()) JSON.parse(line);\n\t\tconst output = Buffer.concat([\n\t\t\tBuffer.from(`${JSON.stringify({ ...header, cwd: target })}\\n`),\n\t\t\toriginal.subarray(newline + 1),\n\t\t]);\n\t\tconst destination = join(getDefaultSessionDir(target, agentDir), basename(source));\n\t\t// A session can be stored under one folder while its header names another. The picker lists sessions by\n\t\t// storage directory and labels them by the header, so such a session appears under the current folder\n\t\t// wearing another folder's name, and asking to move it there lands here: the destination is the source.\n\t\t// Nothing needs moving and nothing can be linked over an existing name, so relabel it in place instead\n\t\t// of refusing -- the header is the only thing that disagrees with reality.\n\t\tconst inPlace = resolve(destination) === source;\n\t\tconst backupDir = join(agentDir, \"session-move-backups\");\n\t\tmkdirSync(backupDir, { recursive: true, mode: 0o700 });\n\t\tconst backup = join(backupDir, `${randomUUID()}.jsonl`);\n\t\twriteDurableFile(backup, original);\n\t\tif (!readFileSync(backup).equals(original)) throw new Error(`Backup verification failed: ${backup}`);\n\t\twriteDurableFile(\n\t\t\t`${backup}.metadata.json`,\n\t\t\t`${JSON.stringify({ source, destination, sessionId: header.id, created: new Date().toISOString() }, null, 2)}\\n`,\n\t\t);\n\t\tconst backupDirectoryFd = openSync(backupDir, \"r\");\n\t\ttry {\n\t\t\tfsyncSync(backupDirectoryFd);\n\t\t} finally {\n\t\t\tcloseSync(backupDirectoryFd);\n\t\t}\n\t\tconst temporary = `${destination}.${randomUUID()}.tmp`;\n\t\tconst fd = openSync(temporary, \"wx\", 0o600);\n\t\ttry {\n\t\t\twriteFileSync(fd, output);\n\t\t\tfsyncSync(fd);\n\t\t} finally {\n\t\t\tcloseSync(fd);\n\t\t}\n\n\t\tif (inPlace) {\n\t\t\ttry {\n\t\t\t\tif (!readFileSync(temporary).equals(output)) throw new Error(\"Relabelled session verification failed.\");\n\t\t\t\t// rename replaces the destination, which is what an in-place relabel needs; the hard link below\n\t\t\t\t// deliberately cannot replace anything, which is what makes a real move safe against a name that\n\t\t\t\t// already exists. The backup written above holds the bytes being overwritten either way.\n\t\t\t\trenameSync(temporary, destination);\n\t\t\t} catch (error) {\n\t\t\t\trmSync(temporary, { force: true });\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\treturn destination;\n\t\t}\n\n\t\tlet published = false;\n\t\tlet marked = false;\n\t\ttry {\n\t\t\t// Hard-link publication is atomic and never replaces an existing destination.\n\t\t\tlinkSync(temporary, destination);\n\t\t\tpublished = true;\n\t\t\tif (!readFileSync(destination).equals(output)) throw new Error(\"Destination verification failed.\");\n\t\t\tif (!readFileSync(source).equals(original)) throw new Error(\"Source changed during the move.\");\n\t\t\tmarkSessionMoved(source, destination);\n\t\t\tmarked = true;\n\t\t\tunlinkSync(source);\n\t\t} catch (error) {\n\t\t\tif (marked) unmarkSessionMoved(source);\n\t\t\tif (published) unlinkSync(destination);\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tunlinkSync(temporary);\n\t\t}\n\t\treturn destination;\n\t});\n}\n"]}
|
|
@@ -96,6 +96,19 @@ export declare class SessionSelectorComponent extends Container implements Focus
|
|
|
96
96
|
private loadScope;
|
|
97
97
|
private toggleSortMode;
|
|
98
98
|
private toggleNameFilter;
|
|
99
|
+
/**
|
|
100
|
+
* Fold a move into the lists already on screen instead of reloading them.
|
|
101
|
+
*
|
|
102
|
+
* A reload is what made deleting or moving feel like it lost your place: loadScope() reports progress in
|
|
103
|
+
* pages, setSessions() clamps the cursor to whatever the current page holds, and the index never grows
|
|
104
|
+
* back when the rest of the list lands -- so a cursor at row 38 of 45 ends up around row 19. A move also
|
|
105
|
+
* changes the selected row's path, which is the key a reload re-finds the selection by.
|
|
106
|
+
*
|
|
107
|
+
* Correcting the cached entry in place avoids both: the session is still listed either way, only its
|
|
108
|
+
* folder (and, for a real move, its file) changed. The scope that is not on screen is dropped so it
|
|
109
|
+
* re-reads lazily when Tab switches to it, since the moved session now belongs there.
|
|
110
|
+
*/
|
|
111
|
+
private applyMovedSession;
|
|
99
112
|
private refreshSessionsAfterMutation;
|
|
100
113
|
private toggleScope;
|
|
101
114
|
getSessionList(): SessionList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/session-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,SAAS,EACd,SAAS,EACT,KAAK,SAAS,EAOd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAMzF,OAAO,EAAyC,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAoSrH;;GAEG;AACH,cAAM,WAAY,YAAW,SAAS,EAAE,SAAS;I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;KACzD,EACD,sBAAsB,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"session-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/session-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,SAAS,EACd,SAAS,EACT,KAAK,SAAS,EAOd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAMzF,OAAO,EAAyC,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAoSrH;;GAEG;AACH,cAAM,WAAY,YAAW,SAAS,EAAE,SAAS;IACzC,sBAAsB,IAAI,MAAM,GAAG,SAAS,CAGlD;IACD,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,gBAAgB,CAAyB;IACjD,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,qBAAqB,CAAC,CAAS;IAChC,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,IAAI,CAAY;IAC9B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,O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EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,EACvC,QAAQ,EAAE,MAAM,IAAI,EACpB,MAAM,EAAE,MAAM,IAAI,EAClB,aAAa,EAAE,MAAM,IAAI,EACzB,OAAO,CAAC,EAAE;QACT,aAAa,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QACxF,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,WAAW,CAAC,EAAE,kBAAkB,CAAC;QACjC,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;KACzD,EACD,sBAAsB,CAAC,EAAE,MAAM,EAoI/B;IAED,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,eAAe;IAuBvB,OAAO,CAAC,cAAc;YASR,aAAa;YAwBb,SAAS;IAoEvB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,gBAAgB;IAOxB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,iBAAiB;YA0BX,4BAA4B;IAO1C,OAAO,CAAC,WAAW;IAWnB,cAAc,IAAI,WAAW,CAE5B;CACD"}
|
|
@@ -700,8 +700,8 @@ export class SessionSelectorComponent extends Container {
|
|
|
700
700
|
this.sessionList.moving = true;
|
|
701
701
|
this.cancelLoads();
|
|
702
702
|
try {
|
|
703
|
-
(options?.moveSession ?? moveSessionHere)(session.path, this.sessionList.moveTarget);
|
|
704
|
-
|
|
703
|
+
const destination = (options?.moveSession ?? moveSessionHere)(session.path, this.sessionList.moveTarget);
|
|
704
|
+
this.applyMovedSession(session, destination);
|
|
705
705
|
this.header.setStatusMessage({ type: "info", message: "Session moved to starting directory" }, 3000);
|
|
706
706
|
}
|
|
707
707
|
catch (error) {
|
|
@@ -765,18 +765,27 @@ export class SessionSelectorComponent extends Container {
|
|
|
765
765
|
this.sessionList.onDeleteSession = async (sessionPath) => {
|
|
766
766
|
const result = await deleteSessionFile(sessionPath);
|
|
767
767
|
if (result.ok) {
|
|
768
|
-
if (this.currentSessions) {
|
|
769
|
-
this.currentSessions = this.currentSessions.filter((s) => s.path !== sessionPath);
|
|
770
|
-
}
|
|
771
|
-
if (this.allSessions) {
|
|
772
|
-
this.allSessions = this.allSessions.filter((s) => s.path !== sessionPath);
|
|
773
|
-
}
|
|
774
|
-
const sessions = this.scope === "all" ? (this.allSessions ?? []) : (this.currentSessions ?? []);
|
|
775
|
-
const showCwd = this.scope === "all";
|
|
776
|
-
this.sessionList.setSessions(sessions, showCwd);
|
|
777
768
|
const msg = result.method === "trash" ? "Session moved to trash" : "Session deleted";
|
|
778
769
|
this.header.setStatusMessage({ type: "info", message: msg }, 2000);
|
|
779
|
-
|
|
770
|
+
if ((this.scope === "all" ? this.allLoad : this.currentLoad) !== null) {
|
|
771
|
+
// A load that started before the delete can still hand back the row that was just removed, so
|
|
772
|
+
// while one is running the list has to be read again. The cursor moves on its own anyway while
|
|
773
|
+
// rows are arriving, so a reload costs nothing extra here.
|
|
774
|
+
await this.refreshSessionsAfterMutation();
|
|
775
|
+
}
|
|
776
|
+
else {
|
|
777
|
+
// Otherwise fold the delete into what is already on screen. Re-reading clamps the cursor to the
|
|
778
|
+
// first page of the reload (see applyMovedSession), which used to send anyone who deleted a row
|
|
779
|
+
// near the bottom of a long list somewhere into the middle of it.
|
|
780
|
+
if (this.currentSessions) {
|
|
781
|
+
this.currentSessions = this.currentSessions.filter((s) => s.path !== sessionPath);
|
|
782
|
+
}
|
|
783
|
+
if (this.allSessions) {
|
|
784
|
+
this.allSessions = this.allSessions.filter((s) => s.path !== sessionPath);
|
|
785
|
+
}
|
|
786
|
+
const sessions = (this.scope === "all" ? this.allSessions : this.currentSessions) ?? [];
|
|
787
|
+
this.sessionList.setSessions(sessions, this.scope === "all");
|
|
788
|
+
}
|
|
780
789
|
}
|
|
781
790
|
else {
|
|
782
791
|
const errorMessage = result.error ?? "Unknown error";
|
|
@@ -929,6 +938,45 @@ export class SessionSelectorComponent extends Container {
|
|
|
929
938
|
this.sessionList.setNameFilter(this.nameFilter);
|
|
930
939
|
this.requestRender();
|
|
931
940
|
}
|
|
941
|
+
/**
|
|
942
|
+
* Fold a move into the lists already on screen instead of reloading them.
|
|
943
|
+
*
|
|
944
|
+
* A reload is what made deleting or moving feel like it lost your place: loadScope() reports progress in
|
|
945
|
+
* pages, setSessions() clamps the cursor to whatever the current page holds, and the index never grows
|
|
946
|
+
* back when the rest of the list lands -- so a cursor at row 38 of 45 ends up around row 19. A move also
|
|
947
|
+
* changes the selected row's path, which is the key a reload re-finds the selection by.
|
|
948
|
+
*
|
|
949
|
+
* Correcting the cached entry in place avoids both: the session is still listed either way, only its
|
|
950
|
+
* folder (and, for a real move, its file) changed. The scope that is not on screen is dropped so it
|
|
951
|
+
* re-reads lazily when Tab switches to it, since the moved session now belongs there.
|
|
952
|
+
*/
|
|
953
|
+
applyMovedSession(session, destination) {
|
|
954
|
+
const cwd = this.sessionList.moveTarget;
|
|
955
|
+
for (const cached of [this.currentSessions, this.allSessions]) {
|
|
956
|
+
if (!cached)
|
|
957
|
+
continue;
|
|
958
|
+
for (const entry of cached) {
|
|
959
|
+
if (entry.path === session.path) {
|
|
960
|
+
entry.path = destination;
|
|
961
|
+
entry.cwd = cwd;
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
if (this.scope === "all") {
|
|
966
|
+
this.currentSessions = null;
|
|
967
|
+
}
|
|
968
|
+
else {
|
|
969
|
+
this.allSessions = null;
|
|
970
|
+
}
|
|
971
|
+
const sessions = this.scope === "all" ? this.allSessions : this.currentSessions;
|
|
972
|
+
if (sessions === null) {
|
|
973
|
+
// Nothing on screen to fold the change into. cancelLoads() drops the cache of any load that was
|
|
974
|
+
// still running, so moving while the list is arriving is the one case that has to read it again.
|
|
975
|
+
void this.loadScope(this.scope);
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
this.sessionList.setSessions(sessions, this.scope === "all");
|
|
979
|
+
}
|
|
932
980
|
async refreshSessionsAfterMutation() {
|
|
933
981
|
this.cancelLoads();
|
|
934
982
|
this.currentSessions = null;
|