源码快照 @ 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:
@@ -0,0 +1,69 @@
|
||||
import { useCallback } from "react";
|
||||
import type { AgentSessionEngine } from "@tutti-os/agent-activity-core";
|
||||
import { dispatchAgentPlanPromptAction } from "../../../shared/agentConversation/agentPlanPromptDispatch";
|
||||
import {
|
||||
PLAN_IMPLEMENTATION_ACTION_FEEDBACK,
|
||||
PLAN_IMPLEMENTATION_ACTION_IMPLEMENT,
|
||||
PLAN_IMPLEMENTATION_ACTION_SKIP
|
||||
} from "../../../shared/agentConversation/planImplementationPresentation";
|
||||
|
||||
interface CurrentValue<T> {
|
||||
current: T;
|
||||
}
|
||||
|
||||
interface UseAgentGUIPlanActionsInput {
|
||||
activeConversationIdRef: CurrentValue<string | null>;
|
||||
planActionsRef: CurrentValue<{
|
||||
implement: () => boolean;
|
||||
feedback: (feedback: string) => boolean;
|
||||
skip: () => boolean;
|
||||
}>;
|
||||
planImplementationTurnIdRef: CurrentValue<string | null>;
|
||||
sessionEngine: AgentSessionEngine;
|
||||
workspaceId: string;
|
||||
}
|
||||
|
||||
export function useAgentGUIPlanActions(input: UseAgentGUIPlanActionsInput) {
|
||||
const dispatchPlanAction = useCallback(
|
||||
(
|
||||
action: Parameters<typeof dispatchAgentPlanPromptAction>[0]["action"],
|
||||
feedbackText?: string
|
||||
): boolean => {
|
||||
const agentSessionId = input.activeConversationIdRef.current;
|
||||
const turnId = input.planImplementationTurnIdRef.current;
|
||||
if (!agentSessionId || !turnId) return false;
|
||||
return dispatchAgentPlanPromptAction({
|
||||
action,
|
||||
agentSessionId,
|
||||
engine: input.sessionEngine,
|
||||
...(feedbackText !== undefined ? { feedbackText } : {}),
|
||||
requestId: turnId,
|
||||
workspaceId: input.workspaceId
|
||||
});
|
||||
},
|
||||
[
|
||||
input.activeConversationIdRef,
|
||||
input.planImplementationTurnIdRef,
|
||||
input.sessionEngine,
|
||||
input.workspaceId
|
||||
]
|
||||
);
|
||||
const implement = useCallback(
|
||||
() => dispatchPlanAction(PLAN_IMPLEMENTATION_ACTION_IMPLEMENT),
|
||||
[dispatchPlanAction]
|
||||
);
|
||||
const feedback = useCallback(
|
||||
(value: string) => {
|
||||
const trimmed = value.trim();
|
||||
return trimmed
|
||||
? dispatchPlanAction(PLAN_IMPLEMENTATION_ACTION_FEEDBACK, trimmed)
|
||||
: false;
|
||||
},
|
||||
[dispatchPlanAction]
|
||||
);
|
||||
const skip = useCallback(
|
||||
() => dispatchPlanAction(PLAN_IMPLEMENTATION_ACTION_SKIP),
|
||||
[dispatchPlanAction]
|
||||
);
|
||||
input.planActionsRef.current = { implement, feedback, skip };
|
||||
}
|
||||
Reference in New Issue
Block a user