源码快照 @ 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:
+78
@@ -0,0 +1,78 @@
|
||||
import type { AgentGUIConversationSummary } from "../model/agentGuiConversationModel";
|
||||
import type { AgentGUIConversationUserProject } from "../model/agentGuiConversationProjectResolver";
|
||||
import { resolveConversationSummaryById } from "./useAgentConversationSelection";
|
||||
|
||||
export interface AgentGUINewConversationRequestOptions {
|
||||
projectPath?: string | null;
|
||||
source?: string;
|
||||
}
|
||||
|
||||
export type AgentGUINewConversationProjectSelection =
|
||||
| { kind: "preserve_home" }
|
||||
| { kind: "replace"; projectPath: string | null }
|
||||
| { kind: "unresolved" };
|
||||
|
||||
export function requestAgentGUINewConversation(input: {
|
||||
createConversation(options: AgentGUINewConversationRequestOptions): void;
|
||||
activeConversationId: string | null;
|
||||
conversations: readonly AgentGUIConversationSummary[];
|
||||
transientConversation: AgentGUIConversationSummary | null;
|
||||
userProjects: readonly AgentGUIConversationUserProject[];
|
||||
options?: AgentGUINewConversationRequestOptions;
|
||||
}): boolean {
|
||||
if (input.options && "projectPath" in input.options) {
|
||||
input.createConversation(input.options);
|
||||
return true;
|
||||
}
|
||||
const selection = resolveAgentGUINewConversationProjectSelection({
|
||||
activeConversationId: input.activeConversationId,
|
||||
conversations: input.conversations,
|
||||
transientConversation: input.transientConversation,
|
||||
userProjects: input.userProjects
|
||||
});
|
||||
if (selection.kind === "unresolved") {
|
||||
return false;
|
||||
}
|
||||
if (selection.kind === "preserve_home") {
|
||||
input.createConversation(input.options ?? {});
|
||||
return true;
|
||||
}
|
||||
input.createConversation({
|
||||
...input.options,
|
||||
projectPath: selection.projectPath
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
export function resolveAgentGUINewConversationProjectSelection(input: {
|
||||
activeConversationId: string | null;
|
||||
conversations: readonly AgentGUIConversationSummary[];
|
||||
transientConversation: AgentGUIConversationSummary | null;
|
||||
userProjects: readonly AgentGUIConversationUserProject[];
|
||||
}): AgentGUINewConversationProjectSelection {
|
||||
if (input.activeConversationId === null) {
|
||||
return { kind: "preserve_home" };
|
||||
}
|
||||
const activeConversation = resolveConversationSummaryById(
|
||||
input.conversations,
|
||||
input.activeConversationId,
|
||||
input.transientConversation
|
||||
);
|
||||
if (!activeConversation) {
|
||||
return { kind: "unresolved" };
|
||||
}
|
||||
const sectionKey = activeConversation.railSectionKey?.trim() ?? "";
|
||||
if (sectionKey === "conversations") {
|
||||
return { kind: "replace", projectPath: null };
|
||||
}
|
||||
if (!sectionKey) {
|
||||
return { kind: "unresolved" };
|
||||
}
|
||||
const projectPath =
|
||||
input.userProjects
|
||||
.find((project) => project.sectionKey?.trim() === sectionKey)
|
||||
?.path.trim() ?? "";
|
||||
return projectPath
|
||||
? { kind: "replace", projectPath }
|
||||
: { kind: "unresolved" };
|
||||
}
|
||||
Reference in New Issue
Block a user