Remove redundant ternary in appendSetupScriptActivity

The ternary branches produced structurally identical activity objects.
Use destructuring + spread to build the activity once, preserving
discriminated-union type safety without duplicating the object literal.
This commit is contained in:
Cursor Agent committed 2026-04-12 08:27:49 +00:00
1 parent 58f45db792
commit c93fcf98f8
1 file changed
+10 -23
+10 -23
View File
@@ -161,33 +161,20 @@ const makeWsRpcLayer = (currentSessionId: AuthSessionId) =>
readonly tone: "error";
}
),
) =>
orchestrationEngine.dispatch({
) => {
const { threadId, ...rest } = input;
return orchestrationEngine.dispatch({
type: "thread.activity.append",
commandId: serverCommandId("setup-script-activity"),
threadId: input.threadId,
activity:
input.kind === "setup-script.failed"
? {
id: EventId.make(crypto.randomUUID()),
tone: input.tone,
kind: input.kind,
summary: input.summary,
payload: input.payload,
turnId: null,
createdAt: input.createdAt,
}
: {
id: EventId.make(crypto.randomUUID()),
tone: input.tone,
kind: input.kind,
summary: input.summary,
payload: input.payload,
turnId: null,
createdAt: input.createdAt,
},
threadId,
activity: {
id: EventId.make(crypto.randomUUID()),
...rest,
turnId: null,
},
createdAt: input.createdAt,
});
};
const toDispatchCommandError = (cause: unknown, fallbackMessage: string) =>
Schema.is(OrchestrationDispatchCommandError)(cause)