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
72 lines
2.3 KiB
TypeScript
72 lines
2.3 KiB
TypeScript
import { createContext, useContext } from "react";
|
|
|
|
const AgentGUIConversationRailSectionBatchDeletionDisabledContext =
|
|
createContext<boolean | null>(null);
|
|
const AgentGUIConversationRailSectionProjectActionLockedContext = createContext<
|
|
boolean | null
|
|
>(null);
|
|
const AgentGUIConversationRailSectionProjectDragDisabledContext = createContext<
|
|
boolean | null
|
|
>(null);
|
|
|
|
interface AgentGUIConversationRailSectionPresentationProviderProps {
|
|
batchDeletionDisabled: boolean;
|
|
children: React.ReactNode;
|
|
projectActionLocked: boolean;
|
|
projectDragDisabled: boolean;
|
|
}
|
|
|
|
export function AgentGUIConversationRailSectionPresentationProvider({
|
|
batchDeletionDisabled,
|
|
children,
|
|
projectActionLocked,
|
|
projectDragDisabled
|
|
}: AgentGUIConversationRailSectionPresentationProviderProps): React.JSX.Element {
|
|
return (
|
|
<AgentGUIConversationRailSectionBatchDeletionDisabledContext.Provider
|
|
value={batchDeletionDisabled}
|
|
>
|
|
<AgentGUIConversationRailSectionProjectActionLockedContext.Provider
|
|
value={projectActionLocked}
|
|
>
|
|
<AgentGUIConversationRailSectionProjectDragDisabledContext.Provider
|
|
value={projectDragDisabled}
|
|
>
|
|
{children}
|
|
</AgentGUIConversationRailSectionProjectDragDisabledContext.Provider>
|
|
</AgentGUIConversationRailSectionProjectActionLockedContext.Provider>
|
|
</AgentGUIConversationRailSectionBatchDeletionDisabledContext.Provider>
|
|
);
|
|
}
|
|
|
|
export function useAgentGUIConversationRailSectionBatchDeletionDisabled(): boolean {
|
|
return readSectionPresentationValue(
|
|
useContext(AgentGUIConversationRailSectionBatchDeletionDisabledContext),
|
|
"batch deletion disabled"
|
|
);
|
|
}
|
|
|
|
export function useAgentGUIConversationRailSectionProjectActionLocked(): boolean {
|
|
return readSectionPresentationValue(
|
|
useContext(AgentGUIConversationRailSectionProjectActionLockedContext),
|
|
"project action locked"
|
|
);
|
|
}
|
|
|
|
export function useAgentGUIConversationRailSectionProjectDragDisabled(): boolean {
|
|
return readSectionPresentationValue(
|
|
useContext(AgentGUIConversationRailSectionProjectDragDisabledContext),
|
|
"project drag disabled"
|
|
);
|
|
}
|
|
|
|
function readSectionPresentationValue(
|
|
value: boolean | null,
|
|
name: string
|
|
): boolean {
|
|
if (value === null) {
|
|
throw new Error(`Missing AgentGUI Rail Section ${name} provider`);
|
|
}
|
|
return value;
|
|
}
|