源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
This commit is contained in:
commit
2ed3415fb7
8018 files changed
+1936476
No files matched your search
@@ -0,0 +1,69 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import type { AgentHostUserProjectsApi } from "../../host/agentHostApi";
|
||||
import { createAgentGUIUserProjectSelectionApi } from "./agentGuiUserProjectSelectionApi";
|
||||
|
||||
function createUserProjectsApi(): AgentHostUserProjectsApi {
|
||||
return {
|
||||
async list() {
|
||||
return { projects: [] };
|
||||
},
|
||||
async pin() {},
|
||||
async use({ path }) {
|
||||
return { id: path, label: path, path, pinnedAtUnixMs: 0 };
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
describe("createAgentGUIUserProjectSelectionApi", () => {
|
||||
it("uses only the explicitly injected project directory selector", async () => {
|
||||
const selectProjectDirectory = vi.fn(async () => ({
|
||||
path: "/workspace/existing"
|
||||
}));
|
||||
const api = createAgentGUIUserProjectSelectionApi({
|
||||
selectProjectDirectory,
|
||||
userProjects: createUserProjectsApi()
|
||||
});
|
||||
|
||||
await expect(api?.selectDirectory?.()).resolves.toEqual({
|
||||
path: "/workspace/existing"
|
||||
});
|
||||
expect(selectProjectDirectory).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("disables existing-project selection when the selector is unavailable", () => {
|
||||
const api = createAgentGUIUserProjectSelectionApi({
|
||||
selectProjectDirectory: undefined,
|
||||
userProjects: createUserProjectsApi()
|
||||
});
|
||||
|
||||
expect(api?.selectDirectory).toBeUndefined();
|
||||
});
|
||||
|
||||
it("adds the optional import flow without changing the default project API", async () => {
|
||||
const importDirectory = vi.fn(async () => ({
|
||||
path: "/workspace/imported"
|
||||
}));
|
||||
const api = createAgentGUIUserProjectSelectionApi({
|
||||
importDirectory,
|
||||
userProjects: createUserProjectsApi()
|
||||
});
|
||||
|
||||
await expect(api?.importDirectory?.()).resolves.toEqual({
|
||||
path: "/workspace/imported"
|
||||
});
|
||||
expect(api?.selectDirectory).toBeUndefined();
|
||||
});
|
||||
|
||||
it("does not fabricate a project catalog for a directory-only host", () => {
|
||||
const selectProjectDirectory = vi.fn(async () => ({
|
||||
path: "/workspace/existing"
|
||||
}));
|
||||
const api = createAgentGUIUserProjectSelectionApi({
|
||||
selectProjectDirectory,
|
||||
userProjects: null
|
||||
});
|
||||
|
||||
expect(api).toBeNull();
|
||||
expect(selectProjectDirectory).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user