mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:50:43 +00:00
refactor: share task flow create params
This commit is contained in:
@@ -58,12 +58,9 @@ type FlowRecordPatch = Omit<
|
||||
endedAt?: number | null;
|
||||
};
|
||||
|
||||
export type CreateFlowRecordParams = {
|
||||
syncMode?: TaskFlowSyncMode;
|
||||
type FlowRecordCreateFields = {
|
||||
ownerKey: string;
|
||||
requesterOrigin?: TaskFlowRecord["requesterOrigin"];
|
||||
controllerId?: string | null;
|
||||
revision?: number;
|
||||
status?: TaskFlowStatus;
|
||||
notifyPolicy?: TaskNotifyPolicy;
|
||||
goal: string;
|
||||
@@ -78,6 +75,12 @@ export type CreateFlowRecordParams = {
|
||||
endedAt?: number | null;
|
||||
};
|
||||
|
||||
export type CreateFlowRecordParams = FlowRecordCreateFields & {
|
||||
syncMode?: TaskFlowSyncMode;
|
||||
controllerId?: string | null;
|
||||
revision?: number;
|
||||
};
|
||||
|
||||
export type TaskFlowUpdateResult =
|
||||
| {
|
||||
applied: true;
|
||||
@@ -349,23 +352,11 @@ export function createFlowRecord(params: CreateFlowRecordParams): TaskFlowRecord
|
||||
return writeFlowRecord(record);
|
||||
}
|
||||
|
||||
export function createManagedTaskFlow(params: {
|
||||
ownerKey: string;
|
||||
controllerId: string;
|
||||
requesterOrigin?: TaskFlowRecord["requesterOrigin"];
|
||||
status?: TaskFlowStatus;
|
||||
notifyPolicy?: TaskNotifyPolicy;
|
||||
goal: string;
|
||||
currentStep?: string | null;
|
||||
blockedTaskId?: string | null;
|
||||
blockedSummary?: string | null;
|
||||
stateJson?: JsonValue | null;
|
||||
waitJson?: JsonValue | null;
|
||||
cancelRequestedAt?: number | null;
|
||||
createdAt?: number;
|
||||
updatedAt?: number;
|
||||
endedAt?: number | null;
|
||||
}): TaskFlowRecord {
|
||||
export function createManagedTaskFlow(
|
||||
params: FlowRecordCreateFields & {
|
||||
controllerId: string;
|
||||
},
|
||||
): TaskFlowRecord {
|
||||
return createFlowRecord({
|
||||
...params,
|
||||
syncMode: "managed",
|
||||
|
||||
Reference in New Issue
Block a user