fix: orchestrator button + Pi SDK session error
- Move leftSidebarMode from URL state to local useState in unified-shell,
avoiding force-dynamic router round-trip that made the button appear broken - Replace fileURLToPath(new URL(..., import.meta.url)) with process.cwd()
in bb-pi-bootstrap.ts — import.meta.url is a webpack:// URL in Next.js,
causing cross-realm TypeError when passed to Node.js fileURLToPath()
This commit is contained in:
parent
643fa299dd
commit
d335e5bf71
98 changed files with 17851 additions and 944 deletions
41
src/lib/agent-workspace.ts
Normal file
41
src/lib/agent-workspace.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import { listProjects } from './registry';
|
||||
import { resolveProjectScope } from './project-scope';
|
||||
|
||||
export interface ResolveAgentWorkspaceOptions {
|
||||
currentProjectRoot?: string;
|
||||
requestedProjectKey?: string | null;
|
||||
requestedProjectRoot?: string | null;
|
||||
}
|
||||
|
||||
export interface ResolvedAgentWorkspace {
|
||||
root: string;
|
||||
key: string;
|
||||
source: 'explicit-root' | 'scope-selection';
|
||||
}
|
||||
|
||||
export async function resolveAgentWorkspace(options: ResolveAgentWorkspaceOptions = {}): Promise<ResolvedAgentWorkspace> {
|
||||
const currentProjectRoot = options.currentProjectRoot ?? process.cwd();
|
||||
|
||||
if (options.requestedProjectRoot && options.requestedProjectRoot.trim()) {
|
||||
const root = options.requestedProjectRoot.trim();
|
||||
return {
|
||||
root,
|
||||
key: root.toLowerCase(),
|
||||
source: 'explicit-root',
|
||||
};
|
||||
}
|
||||
|
||||
const registryProjects = await listProjects();
|
||||
const scope = resolveProjectScope({
|
||||
currentProjectRoot,
|
||||
registryProjects,
|
||||
requestedProjectKey: options.requestedProjectKey ?? null,
|
||||
requestedMode: 'single',
|
||||
});
|
||||
|
||||
return {
|
||||
root: process.platform === 'win32' ? scope.selected.root : scope.selected.displayPath,
|
||||
key: scope.selected.key,
|
||||
source: 'scope-selection',
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue